Browse Source

Merge remote-tracking branch 'remotes/mrdoob/dev' into dev

WebGL part of this branch is completely broken. Do not use. This is for further merging.
alteredq 14 years ago
parent
commit
093fbbe334
43 changed files with 1762 additions and 7588 deletions
  1. 35 31
      README.md
  2. 157 161
      build/Three.js
  3. 86 93
      build/custom/ThreeCanvas.js
  4. 54 60
      build/custom/ThreeDOM.js
  5. 297 299
      build/custom/ThreeExtras.js
  6. 74 79
      build/custom/ThreeSVG.js
  7. 208 212
      build/custom/ThreeWebGL.js
  8. 3 2
      examples/canvas_geometry_cube.html
  9. 4 3
      examples/canvas_geometry_hierarchy.html
  10. 1 1
      examples/canvas_interactive_particles.html
  11. 12 7
      examples/canvas_lights_pointlights.html
  12. 13 9
      examples/canvas_lights_pointlights_smooth.html
  13. 37 48
      examples/canvas_materials_depth.html
  14. 19 11
      examples/canvas_materials_normal.html
  15. 13 10
      examples/canvas_materials_reflection.html
  16. 30 39
      examples/canvas_sandbox.html
  17. 6 6
      examples/js/Stats.js
  18. 0 4904
      examples/obj/WaltHead.js
  19. 23 0
      examples/obj/WaltHeadLo.js
  20. 1 8
      examples/webgl_geometry_subdivison.html
  21. 25 25
      gui/index.html
  22. 2 2
      gui/js/Code.js
  23. 254 0
      gui/js/UI.Viewport.js
  24. 0 432
      gui/js/UI.Viewports.js
  25. 3 3
      gui/js/UI.js
  26. 3 34
      src/cameras/Camera.js
  27. 112 139
      src/core/Matrix4.js
  28. 11 61
      src/core/Object3D.js
  29. 53 53
      src/core/Projector.js
  30. 13 4
      src/core/Quaternion.js
  31. 3 1
      src/core/Ray.js
  32. 82 80
      src/extras/controls/TrackballControls.js
  33. 1 1
      src/extras/geometries/OctahedronGeometry.js
  34. 5 5
      src/extras/loaders/ColladaLoader.js
  35. 3 0
      src/extras/loaders/SceneLoader.js
  36. 48 45
      src/renderers/CanvasRenderer.js
  37. 0 499
      src/renderers/Projector.js
  38. 59 53
      src/renderers/SVGRenderer.js
  39. 11 4
      src/renderers/WebGLRenderer.js
  40. 0 10
      src/renderers/renderables/RenderableObject.js
  41. 1 151
      src/scenes/Scene.js
  42. 0 3
      utils/build.py
  43. BIN
      utils/exporters/utf8/objcompress

+ 35 - 31
README.md

@@ -63,6 +63,7 @@ More? [#three.js on irc.freenode.net](http://webchat.freenode.net/?channels=thre
 
 ### Featured projects ###
 
+<a href="http://lights.elliegoulding.com/"><img src="http://mrdoob.github.com/three.js/assets/projects/20_lights.png" width="109" height="82" alt="Lights"></a>
 <a href="http://inear.se/beanstalk/"><img src="http://mrdoob.github.com/three.js/assets/projects/19_beanstalk.png" width="109" height="82" alt="Infinite beanstalk"></a>
 <a href="http://superfad.com/missioncontrol/"><img src="http://mrdoob.github.com/three.js/assets/projects/18_missioncontrol.png" width="109" height="82" alt="Mission Control"></a>
 <a href="http://ro.me/"><img src="http://mrdoob.github.com/three.js/assets/projects/17_rome.png" width="109" height="82" alt="ROME"></a>
@@ -81,57 +82,60 @@ More? [#three.js on irc.freenode.net](http://webchat.freenode.net/?channels=thre
 
 Download the [minified library](http://mrdoob.github.com/three.js/build/Three.js) and include it in your html.
 
-	<script src="js/Three.js"></script>
+```html
+<script src="js/Three.js"></script>
+```
 
 This code creates a camera, then creates a scene, adds a cube on it, creates a &lt;canvas&gt; renderer and adds its viewport in the document.body element.
 
-	<script>
+```html
+<script>
 
-		var camera, scene, renderer,
-		geometry, material, mesh;
+	var camera, scene, renderer,
+	geometry, material, mesh;
 
-		init();
-		animate();
+	init();
+	animate();
 
-		function init() {
+	function init() {
 
-			camera = new THREE.PerspectiveCamera( 75, window.innerWidth / window.innerHeight, 1, 10000 );
-			camera.position.z = 1000;
+		camera = new THREE.PerspectiveCamera( 75, window.innerWidth / window.innerHeight, 1, 10000 );
+		camera.position.z = 1000;
 
-			scene = new THREE.Scene();
+		scene = new THREE.Scene();
 
-			geometry = new THREE.CubeGeometry( 200, 200, 200 );
-			material = new THREE.MeshBasicMaterial( { color: 0xff0000, wireframe: true } );
+		geometry = new THREE.CubeGeometry( 200, 200, 200 );
+		material = new THREE.MeshBasicMaterial( { color: 0xff0000, wireframe: true } );
 
-			mesh = new THREE.Mesh( geometry, material );
-			scene.add( mesh );
+		mesh = new THREE.Mesh( geometry, material );
+		scene.add( mesh );
 
-			renderer = new THREE.CanvasRenderer();
-			renderer.setSize( window.innerWidth, window.innerHeight );
+		renderer = new THREE.CanvasRenderer();
+		renderer.setSize( window.innerWidth, window.innerHeight );
 
-			document.body.appendChild( renderer.domElement );
+		document.body.appendChild( renderer.domElement );
 
-		}
+	}
 
-		function animate() {
+	function animate() {
 
-			// Include examples/js/RequestAnimationFrame.js for cross-browser compatibility.
-			requestAnimationFrame( animate );
-			render();
+		// Include examples/js/RequestAnimationFrame.js for cross-browser compatibility.
+		requestAnimationFrame( animate );
+		render();
 
-		}
+	}
 
-		function render() {
+	function render() {
 
-			mesh.rotation.x += 0.01;
-			mesh.rotation.y += 0.02;
+		mesh.rotation.x += 0.01;
+		mesh.rotation.y += 0.02;
 
-			renderer.render( scene, camera );
+		renderer.render( scene, camera );
 
-		}
-
-	</script>
+	}
 
+</script>
+```
 
 ### Change Log ###
 
@@ -143,7 +147,7 @@ This code creates a camera, then creates a scene, adds a cube on it, creates a &
 * Added `.depthWrite` and `.fog` to `Material`. ([alteredq](http://github.com/alteredq))
 * Added `.applyMatrix` to `Geometry`. ([mrdoob](http://github.com/mrdoob))
 * Improved postprocessing stack in `/examples/js/postprocessing`. ([alteredq](http://github.com/alteredq))
-* Added a realistic sking shading example. ([alteredq](http://github.com/alteredq))
+* Added a realistic skin shading example. ([alteredq](http://github.com/alteredq))
 * Started of a GUI for composing scenes and autogenerate code. ([mrdoob](http://github.com/mrdoob))
 * Added `.center()` to `GeometryUtils`. ([alteredq](http://github.com/alteredq))
 * Fixed buggy scenegraph manipulation (adding/removing objects). ([jsermeno](http://github.com/jsermeno), [alteredq](http://github.com/alteredq) and [skython](http://github.com/skython))

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


+ 86 - 93
build/custom/ThreeCanvas.js

@@ -14,82 +14,81 @@ Math.abs(b)>1.0E-5?(this.x=Math.atan2(-a.n23/b,a.n33/b),this.z=Math.atan2(-a.n12
 THREE.Vector4.prototype={constructor:THREE.Vector4,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w!==void 0?a.w:1},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;this.w=a.w+b.w;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-
 b.z;this.w=a.w-b.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this},divideScalar:function(a){a?(this.x/=a,this.y/=a,this.z/=a,this.w/=a):(this.z=this.y=this.x=0,this.w=1);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z+this.w*a.w},lengthSq:function(){return this.dot(this)},length:function(){return Math.sqrt(this.lengthSq())},
 normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)},lerpSelf:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;this.w+=(a.w-this.w)*b;return this}};THREE.Ray=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3};
-THREE.Ray.prototype={constructor:THREE.Ray,intersectScene:function(a){return this.intersectObjects(a.objects)},intersectObjects:function(a){var b,c,d=[];b=0;for(c=a.length;b<c;b++)Array.prototype.push.apply(d,this.intersectObject(a[b]));d.sort(function(a,b){return a.distance-b.distance});return d},intersectObject:function(a){function b(a,b,c){var d;d=c.clone().subSelf(a).dot(b);if(d<=0)return null;a=a.clone().addSelf(b.clone().multiplyScalar(d));return c.distanceTo(a)}function c(a,b,c,d){var d=d.clone().subSelf(b),
+THREE.Ray.prototype={constructor:THREE.Ray,intersectScene:function(a){return this.intersectObjects(a.children)},intersectObjects:function(a){var b,c,d=[];b=0;for(c=a.length;b<c;b++)Array.prototype.push.apply(d,this.intersectObject(a[b]));d.sort(function(a,b){return a.distance-b.distance});return d},intersectObject:function(a){function b(a,b,c){var d;d=c.clone().subSelf(a).dot(b);if(d<=0)return null;a=a.clone().addSelf(b.clone().multiplyScalar(d));return c.distanceTo(a)}function c(a,b,c,d){var d=d.clone().subSelf(b),
 c=c.clone().subSelf(b),f=a.clone().subSelf(b),a=d.dot(d),b=d.dot(c),d=d.dot(f),e=c.dot(c),c=c.dot(f),f=1/(a*e-b*b),e=(e*d-b*c)*f,a=(a*c-b*d)*f;return e>0&&a>0&&e+a<1}for(var d,f=[],e=0,g=a.children.length;e<g;e++)Array.prototype.push.apply(f,this.intersectObject(a.children[e]));if(a instanceof THREE.Particle){e=b(this.origin,this.direction,a.matrixWorld.getPosition());if(e==null||e>a.scale.x)return[];d={distance:e,point:a.position,face:null,object:a};f.push(d)}else if(a instanceof THREE.Mesh){e=b(this.origin,
-this.direction,a.matrixWorld.getPosition());if(e==null||e>a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)))return f;for(var h,m,k,l,i,n,j,r,t=a.geometry,w=t.vertices,e=0,g=t.faces.length;e<g;e++)if(d=t.faces[e],j=this.origin.clone(),r=this.direction.clone(),l=a.matrixWorld,h=l.multiplyVector3(d.centroid.clone()).subSelf(j),n=h.dot(r),!(n<=0)&&(h=l.multiplyVector3(w[d.a].position.clone()),m=l.multiplyVector3(w[d.b].position.clone()),k=l.multiplyVector3(w[d.c].position.clone()),
-l=d instanceof THREE.Face4?l.multiplyVector3(w[d.d].position.clone()):null,i=a.matrixRotationWorld.multiplyVector3(d.normal.clone()),n=r.dot(i),a.doubleSided||(a.flipSided?n>0:n<0)))if(n=i.dot((new THREE.Vector3).sub(h,j))/n,j=j.addSelf(r.multiplyScalar(n)),d instanceof THREE.Face3)c(j,h,m,k)&&(d={distance:this.origin.distanceTo(j),point:j,face:d,object:a},f.push(d));else if(d instanceof THREE.Face4&&(c(j,h,m,l)||c(j,m,k,l)))d={distance:this.origin.distanceTo(j),point:j,face:d,object:a},f.push(d)}return f}};
-THREE.Rectangle=function(){function a(){e=d-b;g=f-c}var b,c,d,f,e,g,h=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return e};this.getHeight=function(){return g};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return f};this.set=function(e,g,l,i){h=!1;b=e;c=g;d=l;f=i;a()};this.addPoint=function(e,g){h?(h=!1,b=e,c=g,d=e,f=g):(b=b<e?b:e,c=c<g?c:g,d=d>e?d:e,f=f>g?f:g);a()};this.add3Points=
-function(e,g,l,i,n,j){h?(h=!1,b=e<l?e<n?e:n:l<n?l:n,c=g<i?g<j?g:j:i<j?i:j,d=e>l?e>n?e:n:l>n?l:n,f=g>i?g>j?g:j:i>j?i:j):(b=e<l?e<n?e<b?e:b:n<b?n:b:l<n?l<b?l:b:n<b?n:b,c=g<i?g<j?g<c?g:c:j<c?j:c:i<j?i<c?i:c:j<c?j:c,d=e>l?e>n?e>d?e:d:n>d?n:d:l>n?l>d?l:d:n>d?n:d,f=g>i?g>j?g>f?g:f:j>f?j:f:i>j?i>f?i:f:j>f?j:f);a()};this.addRectangle=function(e){h?(h=!1,b=e.getLeft(),c=e.getTop(),d=e.getRight(),f=e.getBottom()):(b=b<e.getLeft()?b:e.getLeft(),c=c<e.getTop()?c:e.getTop(),d=d>e.getRight()?d:e.getRight(),f=f>
+this.direction,a.matrixWorld.getPosition());if(e==null||e>a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)))return f;var h,l,m,j,i,o,n,p,k=a.geometry,v=k.vertices;a.matrixRotationWorld.extractRotation(a.matrixWorld);e=0;for(g=k.faces.length;e<g;e++)if(d=k.faces[e],n=this.origin.clone(),p=this.direction.clone(),j=a.matrixWorld,h=j.multiplyVector3(d.centroid.clone()).subSelf(n),o=h.dot(p),!(o<=0)&&(h=j.multiplyVector3(v[d.a].position.clone()),l=j.multiplyVector3(v[d.b].position.clone()),
+m=j.multiplyVector3(v[d.c].position.clone()),j=d instanceof THREE.Face4?j.multiplyVector3(v[d.d].position.clone()):null,i=a.matrixRotationWorld.multiplyVector3(d.normal.clone()),o=p.dot(i),a.doubleSided||(a.flipSided?o>0:o<0)))if(o=i.dot((new THREE.Vector3).sub(h,n))/o,n=n.addSelf(p.multiplyScalar(o)),d instanceof THREE.Face3)c(n,h,l,m)&&(d={distance:this.origin.distanceTo(n),point:n,face:d,object:a},f.push(d));else if(d instanceof THREE.Face4&&(c(n,h,l,j)||c(n,l,m,j)))d={distance:this.origin.distanceTo(n),
+point:n,face:d,object:a},f.push(d)}return f}};
+THREE.Rectangle=function(){function a(){e=d-b;g=f-c}var b,c,d,f,e,g,h=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return e};this.getHeight=function(){return g};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return f};this.set=function(e,g,j,i){h=!1;b=e;c=g;d=j;f=i;a()};this.addPoint=function(e,g){h?(h=!1,b=e,c=g,d=e,f=g):(b=b<e?b:e,c=c<g?c:g,d=d>e?d:e,f=f>g?f:g);a()};this.add3Points=
+function(e,g,j,i,o,n){h?(h=!1,b=e<j?e<o?e:o:j<o?j:o,c=g<i?g<n?g:n:i<n?i:n,d=e>j?e>o?e:o:j>o?j:o,f=g>i?g>n?g:n:i>n?i:n):(b=e<j?e<o?e<b?e:b:o<b?o:b:j<o?j<b?j:b:o<b?o:b,c=g<i?g<n?g<c?g:c:n<c?n:c:i<n?i<c?i:c:n<c?n:c,d=e>j?e>o?e>d?e:d:o>d?o:d:j>o?j>d?j:d:o>d?o:d,f=g>i?g>n?g>f?g:f:n>f?n:f:i>n?i>f?i:f:n>f?n:f);a()};this.addRectangle=function(e){h?(h=!1,b=e.getLeft(),c=e.getTop(),d=e.getRight(),f=e.getBottom()):(b=b<e.getLeft()?b:e.getLeft(),c=c<e.getTop()?c:e.getTop(),d=d>e.getRight()?d:e.getRight(),f=f>
 e.getBottom()?f:e.getBottom());a()};this.inflate=function(e){b-=e;c-=e;d+=e;f+=e;a()};this.minSelf=function(e){b=b>e.getLeft()?b:e.getLeft();c=c>e.getTop()?c:e.getTop();d=d<e.getRight()?d:e.getRight();f=f<e.getBottom()?f:e.getBottom();a()};this.intersects=function(a){return Math.min(d,a.getRight())-Math.max(b,a.getLeft())>=0&&Math.min(f,a.getBottom())-Math.max(c,a.getTop())>=0};this.empty=function(){h=!0;f=d=c=b=0;a()};this.isEmpty=function(){return h}};THREE.Matrix3=function(){this.m=[]};
 THREE.Matrix3.prototype={constructor:THREE.Matrix3,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,f,e,g,h,m,k,l,i,n,j,r,t){this.set(a!==void 0?a:1,b||0,c||0,d||0,f||0,e!==void 0?e:1,g||0,h||0,m||0,k||0,l!==void 0?l:1,i||0,n||0,j||0,r||0,t!==void 0?t:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
-THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,f,e,g,h,m,k,l,i,n,j,r,t){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=f;this.n22=e;this.n23=g;this.n24=h;this.n31=m;this.n32=k;this.n33=l;this.n34=i;this.n41=n;this.n42=j;this.n43=r;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,f=THREE.Matrix4.__v2,e=THREE.Matrix4.__v3;e.sub(a,b).normalize();if(e.length()===0)e.z=1;d.cross(c,e).normalize();d.length()===0&&(e.x+=1.0E-4,d.cross(c,e).normalize());f.cross(e,d).normalize();this.n11=d.x;this.n12=f.x;this.n13=e.x;this.n21=d.y;this.n22=f.y;this.n23=e.y;this.n31=d.z;this.n32=f.z;this.n33=e.z;return this},multiplyVector3:function(a){var b=a.x,c=a.y,d=a.z,f=1/(this.n41*b+this.n42*c+this.n43*d+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*d+this.n14)*f;
-a.y=(this.n21*b+this.n22*c+this.n23*d+this.n24)*f;a.z=(this.n31*b+this.n32*c+this.n33*d+this.n34)*f;return a},multiplyVector4:function(a){var b=a.x,c=a.y,d=a.z,f=a.w;a.x=this.n11*b+this.n12*c+this.n13*d+this.n14*f;a.y=this.n21*b+this.n22*c+this.n23*d+this.n24*f;a.z=this.n31*b+this.n32*c+this.n33*d+this.n34*f;a.w=this.n41*b+this.n42*c+this.n43*d+this.n44*f;return a},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,f=a.n13,e=a.n14,g=a.n21,h=a.n22,m=a.n23,k=a.n24,l=a.n31,i=a.n32,n=a.n33,j=a.n34,r=a.n41,t=a.n42,w=a.n43,u=a.n44,M=b.n11,R=b.n12,
-B=b.n13,N=b.n14,O=b.n21,s=b.n22,o=b.n23,C=b.n24,D=b.n31,T=b.n32,U=b.n33,F=b.n34,K=b.n41,I=b.n42,J=b.n43,P=b.n44;this.n11=c*M+d*O+f*D+e*K;this.n12=c*R+d*s+f*T+e*I;this.n13=c*B+d*o+f*U+e*J;this.n14=c*N+d*C+f*F+e*P;this.n21=g*M+h*O+m*D+k*K;this.n22=g*R+h*s+m*T+k*I;this.n23=g*B+h*o+m*U+k*J;this.n24=g*N+h*C+m*F+k*P;this.n31=l*M+i*O+n*D+j*K;this.n32=l*R+i*s+n*T+j*I;this.n33=l*B+i*o+n*U+j*J;this.n34=l*N+i*C+n*F+j*P;this.n41=r*M+t*O+w*D+u*K;this.n42=r*R+t*s+w*T+u*I;this.n43=r*B+t*o+w*U+u*J;this.n44=r*N+t*
-C+w*F+u*P;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,f=this.n21,e=this.n22,g=this.n23,h=this.n24,m=this.n31,k=this.n32,l=this.n33,i=this.n34,n=this.n41,j=this.n42,r=this.n43,t=this.n44;return d*g*k*n-c*h*k*n-d*e*l*n+b*h*l*n+c*e*i*n-b*g*i*n-d*g*m*j+c*h*m*j+d*f*l*j-a*h*l*j-c*f*i*j+a*g*i*j+d*e*m*r-b*h*m*r-d*f*k*r+a*h*k*r+b*f*i*r-a*e*i*r-c*e*m*t+b*g*m*t+c*f*k*t-a*g*k*t-b*f*l*t+a*e*l*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),f=1-c,e=a.x,g=a.y,h=a.z,m=f*e,k=f*g;this.set(m*e+c,m*g-d*h,m*h+d*g,0,m*g+d*h,k*g+c,k*h-d*e,0,m*h-d*g,k*h+d*e,f*h*h+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},getPosition:function(){if(!this.position)this.position=new THREE.Vector3;this.position.set(this.n14,this.n24,this.n34);return this.position},getColumnX:function(){if(!this.columnX)this.columnX=
-new THREE.Vector3;this.columnX.set(this.n11,this.n21,this.n31);return this.columnX},getColumnY:function(){if(!this.columnY)this.columnY=new THREE.Vector3;this.columnY.set(this.n12,this.n22,this.n32);return this.columnY},getColumnZ:function(){if(!this.columnZ)this.columnZ=new THREE.Vector3;this.columnZ.set(this.n13,this.n23,this.n33);return this.columnZ},setRotationFromEuler:function(a,b){var c=a.x,d=a.y,f=a.z,e=Math.cos(c),c=Math.sin(c),g=Math.cos(d),d=Math.sin(d),h=Math.cos(f),f=Math.sin(f);switch(b){case "YXZ":var m=
-g*h,k=g*f,l=d*h,i=d*f;this.n11=m+i*c;this.n12=l*c-k;this.n13=e*d;this.n21=e*f;this.n22=e*h;this.n23=-c;this.n31=k*c-l;this.n32=i+m*c;this.n33=e*g;break;case "ZXY":m=g*h;k=g*f;l=d*h;i=d*f;this.n11=m-i*c;this.n12=-e*f;this.n13=l+k*c;this.n21=k+l*c;this.n22=e*h;this.n23=i-m*c;this.n31=-e*d;this.n32=c;this.n33=e*g;break;case "ZYX":m=e*h;k=e*f;l=c*h;i=c*f;this.n11=g*h;this.n12=l*d-k;this.n13=m*d+i;this.n21=g*f;this.n22=i*d+m;this.n23=k*d-l;this.n31=-d;this.n32=c*g;this.n33=e*g;break;case "YZX":m=e*g;k=
-e*d;l=c*g;i=c*d;this.n11=g*h;this.n12=i-m*f;this.n13=l*f+k;this.n21=f;this.n22=e*h;this.n23=-c*h;this.n31=-d*h;this.n32=k*f+l;this.n33=m-i*f;break;case "XZY":m=e*g;k=e*d;l=c*g;i=c*d;this.n11=g*h;this.n12=-f;this.n13=d*h;this.n21=m*f+i;this.n22=e*h;this.n23=k*f-l;this.n31=l*f-k;this.n32=c*h;this.n33=i*f+m;break;default:m=e*h,k=e*f,l=c*h,i=c*f,this.n11=g*h,this.n12=-g*f,this.n13=d,this.n21=k+l*d,this.n22=m-i*d,this.n23=-c*g,this.n31=i-m*d,this.n32=l+k*d,this.n33=e*g}return this},setRotationFromQuaternion:function(a){var b=
-a.x,c=a.y,d=a.z,f=a.w,e=b+b,g=c+c,h=d+d,a=b*e,m=b*g;b*=h;var k=c*g;c*=h;d*=h;e*=f;g*=f;f*=h;this.n11=1-(k+d);this.n12=m-f;this.n13=b+g;this.n21=m+f;this.n22=1-(a+d);this.n23=c-e;this.n31=b-g;this.n32=c+e;this.n33=1-(a+k);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},compose:function(a,b,c){var d=THREE.Matrix4.__m1,f=THREE.Matrix4.__m2;
-d.identity();d.setRotationFromQuaternion(b);f.setScale(c.x,c.y,c.z);this.multiply(d,f);this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},decompose:function(a,b,c){var d=THREE.Matrix4.__v1,f=THREE.Matrix4.__v2,e=THREE.Matrix4.__v3;d.set(this.n11,this.n21,this.n31);f.set(this.n12,this.n22,this.n32);e.set(this.n13,this.n23,this.n33);a=a instanceof THREE.Vector3?a:new THREE.Vector3;b=b instanceof THREE.Quaternion?b:new THREE.Quaternion;c=c instanceof THREE.Vector3?c:new THREE.Vector3;c.x=d.length();
-c.y=f.length();c.z=e.length();a.x=this.n14;a.y=this.n24;a.z=this.n34;d=THREE.Matrix4.__m1;d.copy(this);d.n11/=c.x;d.n21/=c.x;d.n31/=c.x;d.n12/=c.y;d.n22/=c.y;d.n32/=c.y;d.n13/=c.z;d.n23/=c.z;d.n33/=c.z;b.setFromRotationMatrix(d);return[a,b,c]},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,f=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*f;this.n23=
-a.n23*f;this.n33=a.n33*f}};
-THREE.Matrix4.makeInvert=function(a,b){var c=a.n11,d=a.n12,f=a.n13,e=a.n14,g=a.n21,h=a.n22,m=a.n23,k=a.n24,l=a.n31,i=a.n32,n=a.n33,j=a.n34,r=a.n41,t=a.n42,w=a.n43,u=a.n44;b===void 0&&(b=new THREE.Matrix4);b.n11=m*j*t-k*n*t+k*i*w-h*j*w-m*i*u+h*n*u;b.n12=e*n*t-f*j*t-e*i*w+d*j*w+f*i*u-d*n*u;b.n13=f*k*t-e*m*t+e*h*w-d*k*w-f*h*u+d*m*u;b.n14=e*m*i-f*k*i-e*h*n+d*k*n+f*h*j-d*m*j;b.n21=k*n*r-m*j*r-k*l*w+g*j*w+m*l*u-g*n*u;b.n22=f*j*r-e*n*r+e*l*w-c*j*w-f*l*u+c*n*u;b.n23=e*m*r-f*k*r-e*g*w+c*k*w+f*g*u-c*m*u;b.n24=
-f*k*l-e*m*l+e*g*n-c*k*n-f*g*j+c*m*j;b.n31=h*j*r-k*i*r+k*l*t-g*j*t-h*l*u+g*i*u;b.n32=e*i*r-d*j*r-e*l*t+c*j*t+d*l*u-c*i*u;b.n33=f*k*r-e*h*r+e*g*t-c*k*t-d*g*u+c*h*u;b.n34=e*h*l-d*k*l-e*g*i+c*k*i+d*g*j-c*h*j;b.n41=m*i*r-h*n*r-m*l*t+g*n*t+h*l*w-g*i*w;b.n42=d*n*r-f*i*r+f*l*t-c*n*t-d*l*w+c*i*w;b.n43=f*h*r-d*m*r-f*g*t+c*m*t+d*g*w-c*h*w;b.n44=d*m*l-f*h*l+f*g*i-c*m*i-d*g*n+c*h*n;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,f=-a.n33*a.n21+a.n31*a.n23,e=a.n32*a.n21-a.n31*a.n22,g=-a.n33*a.n12+a.n32*a.n13,h=a.n33*a.n11-a.n31*a.n13,m=-a.n32*a.n11+a.n31*a.n12,k=a.n23*a.n12-a.n22*a.n13,l=-a.n23*a.n11+a.n21*a.n13,i=a.n22*a.n11-a.n21*a.n12,a=a.n11*d+a.n21*g+a.n31*k;a==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");a=1/a;c[0]=a*d;c[1]=a*f;c[2]=a*e;c[3]=a*g;c[4]=a*h;c[5]=a*m;c[6]=a*k;c[7]=a*l;c[8]=a*i;return b};
+THREE.Matrix4=function(a,b,c,d,f,e,g,h,l,m,j,i,o,n,p,k){this.set(a!==void 0?a:1,b||0,c||0,d||0,f||0,e!==void 0?e:1,g||0,h||0,l||0,m||0,j!==void 0?j:1,i||0,o||0,n||0,p||0,k!==void 0?k:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
+THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,f,e,g,h,l,m,j,i,o,n,p,k){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=f;this.n22=e;this.n23=g;this.n24=h;this.n31=l;this.n32=m;this.n33=j;this.n34=i;this.n41=o;this.n42=n;this.n43=p;this.n44=k;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,f=THREE.Matrix4.__v2,e=THREE.Matrix4.__v3;e.sub(a,b).normalize();if(e.length()===0)e.z=1;d.cross(c,e).normalize();d.length()===0&&(e.x+=1.0E-4,d.cross(c,e).normalize());f.cross(e,d).normalize();this.n11=d.x;this.n12=f.x;this.n13=e.x;this.n21=d.y;this.n22=f.y;this.n23=e.y;this.n31=d.z;this.n32=f.z;this.n33=e.z;return this},multiply:function(a,b){var c=a.n11,d=a.n12,f=a.n13,e=a.n14,g=a.n21,h=a.n22,l=a.n23,m=a.n24,j=a.n31,i=a.n32,o=a.n33,n=a.n34,p=a.n41,k=a.n42,v=a.n43,
+G=a.n44,I=b.n11,r=b.n12,M=b.n13,H=b.n14,N=b.n21,L=b.n22,O=b.n23,t=b.n24,x=b.n31,K=b.n32,R=b.n33,S=b.n34,P=b.n41,u=b.n42,A=b.n43,s=b.n44;this.n11=c*I+d*N+f*x+e*P;this.n12=c*r+d*L+f*K+e*u;this.n13=c*M+d*O+f*R+e*A;this.n14=c*H+d*t+f*S+e*s;this.n21=g*I+h*N+l*x+m*P;this.n22=g*r+h*L+l*K+m*u;this.n23=g*M+h*O+l*R+m*A;this.n24=g*H+h*t+l*S+m*s;this.n31=j*I+i*N+o*x+n*P;this.n32=j*r+i*L+o*K+n*u;this.n33=j*M+i*O+o*R+n*A;this.n34=j*H+i*t+o*S+n*s;this.n41=p*I+k*N+v*x+G*P;this.n42=p*r+k*L+v*K+G*u;this.n43=p*M+k*
+O+v*R+G*A;this.n44=p*H+k*t+v*S+G*s;return this},multiplySelf:function(a){return this.multiply(this,a)},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},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},multiplyVector3:function(a){var b=a.x,c=a.y,d=a.z,f=1/(this.n41*b+this.n42*c+this.n43*d+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*d+this.n14)*f;a.y=(this.n21*b+this.n22*c+this.n23*d+this.n24)*f;a.z=(this.n31*b+this.n32*c+this.n33*d+this.n34)*f;return a},multiplyVector4:function(a){var b=a.x,c=a.y,d=a.z,f=a.w;a.x=this.n11*b+this.n12*c+this.n13*d+this.n14*f;a.y=this.n21*b+this.n22*
+c+this.n23*d+this.n24*f;a.z=this.n31*b+this.n32*c+this.n33*d+this.n34*f;a.w=this.n41*b+this.n42*c+this.n43*d+this.n44*f;return a},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},determinant:function(){var a=this.n11,b=this.n12,c=this.n13,d=this.n14,f=this.n21,e=this.n22,g=this.n23,h=this.n24,l=this.n31,m=this.n32,j=this.n33,i=this.n34,o=this.n41,n=this.n42,p=this.n43,k=this.n44;return d*g*m*o-c*h*m*o-d*e*j*o+b*h*j*o+c*e*i*o-b*g*i*o-d*g*l*n+c*h*l*n+d*f*j*n-a*h*j*n-c*f*i*n+a*g*i*n+d*e*l*p-b*h*l*p-d*f*m*p+a*h*m*p+b*f*i*p-a*e*i*p-c*e*l*k+b*g*l*k+c*f*m*k-a*g*m*k-b*f*j*k+a*e*j*k},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),f=1-c,e=a.x,g=a.y,h=a.z,l=f*e,m=f*g;this.set(l*e+c,l*g-d*h,l*h+d*g,0,l*g+d*h,m*g+c,m*h-d*e,0,l*h-d*g,m*h+d*e,f*h*h+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},getPosition:function(){return THREE.Matrix4.__v1.set(this.n14,this.n24,this.n34)},getColumnX:function(){return THREE.Matrix4.__v1.set(this.n11,this.n21,this.n31)},getColumnY:function(){return THREE.Matrix4.__v1.set(this.n12,
+this.n22,this.n32)},getColumnZ:function(){return THREE.Matrix4.__v1.set(this.n13,this.n23,this.n33)},getInverse:function(a){var b=a.n11,c=a.n12,d=a.n13,f=a.n14,e=a.n21,g=a.n22,h=a.n23,l=a.n24,m=a.n31,j=a.n32,i=a.n33,o=a.n34,n=a.n41,p=a.n42,k=a.n43,v=a.n44;this.n11=h*o*p-l*i*p+l*j*k-g*o*k-h*j*v+g*i*v;this.n12=f*i*p-d*o*p-f*j*k+c*o*k+d*j*v-c*i*v;this.n13=d*l*p-f*h*p+f*g*k-c*l*k-d*g*v+c*h*v;this.n14=f*h*j-d*l*j-f*g*i+c*l*i+d*g*o-c*h*o;this.n21=l*i*n-h*o*n-l*m*k+e*o*k+h*m*v-e*i*v;this.n22=d*o*n-f*i*n+
+f*m*k-b*o*k-d*m*v+b*i*v;this.n23=f*h*n-d*l*n-f*e*k+b*l*k+d*e*v-b*h*v;this.n24=d*l*m-f*h*m+f*e*i-b*l*i-d*e*o+b*h*o;this.n31=g*o*n-l*j*n+l*m*p-e*o*p-g*m*v+e*j*v;this.n32=f*j*n-c*o*n-f*m*p+b*o*p+c*m*v-b*j*v;this.n33=d*l*n-f*g*n+f*e*p-b*l*p-c*e*v+b*g*v;this.n34=f*g*m-c*l*m-f*e*j+b*l*j+c*e*o-b*g*o;this.n41=h*j*n-g*i*n-h*m*p+e*i*p+g*m*k-e*j*k;this.n42=c*i*n-d*j*n+d*m*p-b*i*p-c*m*k+b*j*k;this.n43=d*g*n-c*h*n-d*e*p+b*h*p+c*e*k-b*g*k;this.n44=c*h*m-d*g*m+d*e*j-b*h*j-c*e*i+b*g*i;this.multiplyScalar(1/a.determinant());
+return this},setRotationFromEuler:function(a,b){var c=a.x,d=a.y,f=a.z,e=Math.cos(c),c=Math.sin(c),g=Math.cos(d),d=Math.sin(d),h=Math.cos(f),f=Math.sin(f);switch(b){case "YXZ":var l=g*h,m=g*f,j=d*h,i=d*f;this.n11=l+i*c;this.n12=j*c-m;this.n13=e*d;this.n21=e*f;this.n22=e*h;this.n23=-c;this.n31=m*c-j;this.n32=i+l*c;this.n33=e*g;break;case "ZXY":l=g*h;m=g*f;j=d*h;i=d*f;this.n11=l-i*c;this.n12=-e*f;this.n13=j+m*c;this.n21=m+j*c;this.n22=e*h;this.n23=i-l*c;this.n31=-e*d;this.n32=c;this.n33=e*g;break;case "ZYX":l=
+e*h;m=e*f;j=c*h;i=c*f;this.n11=g*h;this.n12=j*d-m;this.n13=l*d+i;this.n21=g*f;this.n22=i*d+l;this.n23=m*d-j;this.n31=-d;this.n32=c*g;this.n33=e*g;break;case "YZX":l=e*g;m=e*d;j=c*g;i=c*d;this.n11=g*h;this.n12=i-l*f;this.n13=j*f+m;this.n21=f;this.n22=e*h;this.n23=-c*h;this.n31=-d*h;this.n32=m*f+j;this.n33=l-i*f;break;case "XZY":l=e*g;m=e*d;j=c*g;i=c*d;this.n11=g*h;this.n12=-f;this.n13=d*h;this.n21=l*f+i;this.n22=e*h;this.n23=m*f-j;this.n31=j*f-m;this.n32=c*h;this.n33=i*f+l;break;default:l=e*h,m=e*
+f,j=c*h,i=c*f,this.n11=g*h,this.n12=-g*f,this.n13=d,this.n21=m+j*d,this.n22=l-i*d,this.n23=-c*g,this.n31=i-l*d,this.n32=j+m*d,this.n33=e*g}return this},setRotationFromQuaternion:function(a){var b=a.x,c=a.y,d=a.z,f=a.w,e=b+b,g=c+c,h=d+d,a=b*e,l=b*g;b*=h;var m=c*g;c*=h;d*=h;e*=f;g*=f;f*=h;this.n11=1-(m+d);this.n12=l-f;this.n13=b+g;this.n21=l+f;this.n22=1-(a+d);this.n23=c-e;this.n31=b-g;this.n32=c+e;this.n33=1-(a+m);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},compose:function(a,b,c){var d=THREE.Matrix4.__m1,f=THREE.Matrix4.__m2;d.identity();d.setRotationFromQuaternion(b);f.setScale(c.x,c.y,c.z);this.multiply(d,f);this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},decompose:function(a,b,c){var d=THREE.Matrix4.__v1,f=THREE.Matrix4.__v2,e=THREE.Matrix4.__v3;d.set(this.n11,this.n21,this.n31);f.set(this.n12,this.n22,this.n32);e.set(this.n13,
+this.n23,this.n33);a=a instanceof THREE.Vector3?a:new THREE.Vector3;b=b instanceof THREE.Quaternion?b:new THREE.Quaternion;c=c instanceof THREE.Vector3?c:new THREE.Vector3;c.x=d.length();c.y=f.length();c.z=e.length();a.x=this.n14;a.y=this.n24;a.z=this.n34;d=THREE.Matrix4.__m1;d.copy(this);d.n11/=c.x;d.n21/=c.x;d.n31/=c.x;d.n12/=c.y;d.n22/=c.y;d.n32/=c.y;d.n13/=c.z;d.n23/=c.z;d.n33/=c.z;b.setFromRotationMatrix(d);return[a,b,c]},extractPosition:function(a){this.n14=a.n14;this.n24=a.n24;this.n34=a.n34;
+return this},extractRotation:function(a){var b=THREE.Matrix4.__v1,c=1/b.set(a.n11,a.n21,a.n31).length(),d=1/b.set(a.n12,a.n22,a.n32).length(),b=1/b.set(a.n13,a.n23,a.n33).length();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*b;this.n23=a.n23*b;this.n33=a.n33*b;return this}};
+THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,d=a.n33*a.n22-a.n32*a.n23,f=-a.n33*a.n21+a.n31*a.n23,e=a.n32*a.n21-a.n31*a.n22,g=-a.n33*a.n12+a.n32*a.n13,h=a.n33*a.n11-a.n31*a.n13,l=-a.n32*a.n11+a.n31*a.n12,m=a.n23*a.n12-a.n22*a.n13,j=-a.n23*a.n11+a.n21*a.n13,i=a.n22*a.n11-a.n21*a.n12,a=a.n11*d+a.n21*g+a.n31*m;a==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");a=1/a;c[0]=a*d;c[1]=a*f;c[2]=a*e;c[3]=a*g;c[4]=a*h;c[5]=a*l;c[6]=a*m;c[7]=a*j;c[8]=a*i;return b};
 THREE.Matrix4.makeFrustum=function(a,b,c,d,f,e){var g;g=new THREE.Matrix4;g.n11=2*f/(b-a);g.n12=0;g.n13=(b+a)/(b-a);g.n14=0;g.n21=0;g.n22=2*f/(d-c);g.n23=(d+c)/(d-c);g.n24=0;g.n31=0;g.n32=0;g.n33=-(e+f)/(e-f);g.n34=-2*e*f/(e-f);g.n41=0;g.n42=0;g.n43=-1;g.n44=0;return g};THREE.Matrix4.makePerspective=function(a,b,c,d){var f,a=c*Math.tan(a*Math.PI/360);f=-a;return THREE.Matrix4.makeFrustum(f*b,a*b,f,a,c,d)};
-THREE.Matrix4.makeOrtho=function(a,b,c,d,f,e){var g,h,m,k;g=new THREE.Matrix4;h=b-a;m=c-d;k=e-f;g.n11=2/h;g.n12=0;g.n13=0;g.n14=-((b+a)/h);g.n21=0;g.n22=2/m;g.n23=0;g.n24=-((c+d)/m);g.n31=0;g.n32=0;g.n33=-2/k;g.n34=-((e+f)/k);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.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
+THREE.Matrix4.makeOrtho=function(a,b,c,d,f,e){var g,h,l,m;g=new THREE.Matrix4;h=b-a;l=c-d;m=e-f;g.n11=2/h;g.n12=0;g.n13=0;g.n14=-((b+a)/h);g.n21=0;g.n22=2/l;g.n23=0;g.n24=-((c+d)/l);g.n31=0;g.n32=0;g.n33=-2/m;g.n34=-((e+f)/m);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.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
 THREE.Object3D=function(){this.name="";this.id=THREE.Object3DCount++;this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder="XYZ";this.scale=new THREE.Vector3(1,1,1);this.flipSided=this.doubleSided=this.dynamic=!1;this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=
 !0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=!0;this.receiveShadow=this.castShadow=!1;this.frustumCulled=!0;this._vector=new THREE.Vector3};
 THREE.Object3D.prototype={constructor:THREE.Object3D,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(a,this.position,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},add:function(a){if(this.children.indexOf(a)===
--1){a.parent!==void 0&&a.parent.remove(a);a.parent=this;this.children.push(a);for(var b=this;b.parent!==void 0;)b=b.parent;b!==void 0&&b instanceof THREE.Scene&&b.addChildRecurse(a)}},remove:function(a){var b=this,c=this.children.indexOf(a);if(c!==-1){a.parent=void 0;for(this.children.splice(c,1);b.parent!==void 0;)b=b.parent;b!==void 0&&b instanceof THREE.Scene&&b.removeChildRecurse(a)}},getChildByName:function(a,b){var c,d,f;c=0;for(d=this.children.length;c<d;c++){f=this.children[c];if(f.name===
-a)return f;if(b&&(f=f.getChildByName(a,b),f!==void 0))return f}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder);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){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;for(var a=0,d=this.children.length;a<d;a++)this.children[a].update(this.matrixWorld,b,c)},addChild:function(a){console.warn("DEPRECATED: Object3D.addChild() is now Object3D.add().");this.add(a)},removeChild:function(a){console.warn("DEPRECATED: Object3D.removeChild() is now Object3D.remove().");
-this.remove(a)}};THREE.Object3DCount=0;
-THREE.Projector=function(){function a(){var a=m[h]=m[h]||new THREE.RenderableVertex;h++;return a}function b(a,b){return b.z-a.z}function c(a,b){var c=0,d=1,e=a.z+a.w,f=b.z+b.w,g=-a.z+a.w,j=-b.z+b.w;return e>=0&&f>=0&&g>=0&&j>=0?!0:e<0&&f<0||g<0&&j<0?!1:(e<0?c=Math.max(c,e/(e-f)):f<0&&(d=Math.min(d,e/(e-f))),g<0?c=Math.max(c,g/(g-j)):j<0&&(d=Math.min(d,g/(g-j))),d<c?!1:(a.lerpSelf(b,c),b.lerpSelf(a,1-d),!0))}var d,f,e=[],g,h,m=[],k,l,i=[],n,j=[],r,t,w=[],u,M,R=[],B=[],N=[],O=new THREE.Vector4,s=new THREE.Vector4,
-o=new THREE.Matrix4,C=new THREE.Matrix4,D=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],T=new THREE.Vector4,U=new THREE.Vector4;this.projectVector=function(a,b){o.multiply(b.projectionMatrix,b.matrixWorldInverse);o.multiplyVector3(a);return a};this.unprojectVector=function(a,b){o.multiply(b.matrixWorld,THREE.Matrix4.makeInvert(b.projectionMatrix));o.multiplyVector3(a);return a};this.pickingRay=function(a,b){var c;a.z=-1;c=new THREE.Vector3(a.x,
-a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.subSelf(a).normalize();return new THREE.Ray(a,c)};this.projectObjects=function(a,c,g){var j,h;f=B.length=0;j=a.objects;a=0;for(c=j.length;a<c;a++){h=j[a];var i;if(!(i=!h.visible))if(i=h instanceof THREE.Mesh)if(i=h.frustumCulled){a:{i=void 0;for(var k=h.matrixWorld,m=-h.geometry.boundingSphere.radius*Math.max(h.scale.x,Math.max(h.scale.y,h.scale.z)),l=0;l<6;l++)if(i=D[l].x*k.n14+D[l].y*k.n24+D[l].z*k.n34+D[l].w,i<=m){i=!1;break a}i=!0}i=
-!i}if(!i)i=e[f]=e[f]||new THREE.RenderableObject,f++,d=i,O.copy(h.position),o.multiplyVector3(O),d.object=h,d.z=O.z,B.push(d)}g&&B.sort(b);return B};this.projectScene=function(d,e,f){var J=e.near,P=e.far,Q,V,E,B,y,L,H,z,x,q,v,G,O,ea,Z,ba,W;M=t=n=l=N.length=0;e.matrixAutoUpdate&&e.update(void 0,!0);d.update(void 0,!1,e);o.multiply(e.projectionMatrix,e.matrixWorldInverse);D[0].set(o.n41-o.n11,o.n42-o.n12,o.n43-o.n13,o.n44-o.n14);D[1].set(o.n41+o.n11,o.n42+o.n12,o.n43+o.n13,o.n44+o.n14);D[2].set(o.n41+
-o.n21,o.n42+o.n22,o.n43+o.n23,o.n44+o.n24);D[3].set(o.n41-o.n21,o.n42-o.n22,o.n43-o.n23,o.n44-o.n24);D[4].set(o.n41-o.n31,o.n42-o.n32,o.n43-o.n33,o.n44-o.n34);D[5].set(o.n41+o.n31,o.n42+o.n32,o.n43+o.n33,o.n44+o.n34);for(Q=0;Q<6;Q++)x=D[Q],x.divideScalar(Math.sqrt(x.x*x.x+x.y*x.y+x.z*x.z));x=this.projectObjects(d,e,!0);d=0;for(Q=x.length;d<Q;d++)if(q=x[d].object,q.visible)if(v=q.matrixWorld,G=q.matrixRotationWorld,O=q.materials,ea=q.overdraw,h=0,q instanceof THREE.Mesh){Z=q.geometry;B=Z.vertices;
-ba=Z.faces;Z=Z.faceVertexUvs;V=0;for(E=B.length;V<E;V++)g=a(),g.positionWorld.copy(B[V].position),v.multiplyVector3(g.positionWorld),g.positionScreen.copy(g.positionWorld),o.multiplyVector4(g.positionScreen),g.positionScreen.x/=g.positionScreen.w,g.positionScreen.y/=g.positionScreen.w,g.visible=g.positionScreen.z>J&&g.positionScreen.z<P;B=0;for(V=ba.length;B<V;B++){E=ba[B];if(E instanceof THREE.Face3)if(y=m[E.a],L=m[E.b],H=m[E.c],y.visible&&L.visible&&H.visible&&(q.doubleSided||q.flipSided!=(H.positionScreen.x-
-y.positionScreen.x)*(L.positionScreen.y-y.positionScreen.y)-(H.positionScreen.y-y.positionScreen.y)*(L.positionScreen.x-y.positionScreen.x)<0))z=i[l]=i[l]||new THREE.RenderableFace3,l++,k=z,k.v1.copy(y),k.v2.copy(L),k.v3.copy(H);else continue;else if(E instanceof THREE.Face4)if(y=m[E.a],L=m[E.b],H=m[E.c],z=m[E.d],y.visible&&L.visible&&H.visible&&z.visible&&(q.doubleSided||q.flipSided!=((z.positionScreen.x-y.positionScreen.x)*(L.positionScreen.y-y.positionScreen.y)-(z.positionScreen.y-y.positionScreen.y)*
-(L.positionScreen.x-y.positionScreen.x)<0||(L.positionScreen.x-H.positionScreen.x)*(z.positionScreen.y-H.positionScreen.y)-(L.positionScreen.y-H.positionScreen.y)*(z.positionScreen.x-H.positionScreen.x)<0)))W=j[n]=j[n]||new THREE.RenderableFace4,n++,k=W,k.v1.copy(y),k.v2.copy(L),k.v3.copy(H),k.v4.copy(z);else continue;k.normalWorld.copy(E.normal);G.multiplyVector3(k.normalWorld);k.centroidWorld.copy(E.centroid);v.multiplyVector3(k.centroidWorld);k.centroidScreen.copy(k.centroidWorld);o.multiplyVector3(k.centroidScreen);
-H=E.vertexNormals;y=0;for(L=H.length;y<L;y++)z=k.vertexNormalsWorld[y],z.copy(H[y]),G.multiplyVector3(z);y=0;for(L=Z.length;y<L;y++)if(W=Z[y][B]){H=0;for(z=W.length;H<z;H++)k.uvs[y][H]=W[H]}k.meshMaterials=O;k.faceMaterials=E.materials;k.overdraw=ea;k.z=k.centroidScreen.z;N.push(k)}}else if(q instanceof THREE.Line){C.multiply(o,v);B=q.geometry.vertices;y=a();y.positionScreen.copy(B[0].position);C.multiplyVector4(y.positionScreen);V=1;for(E=B.length;V<E;V++)if(y=a(),y.positionScreen.copy(B[V].position),
-C.multiplyVector4(y.positionScreen),L=m[h-2],T.copy(y.positionScreen),U.copy(L.positionScreen),c(T,U))T.multiplyScalar(1/T.w),U.multiplyScalar(1/U.w),v=w[t]=w[t]||new THREE.RenderableLine,t++,r=v,r.v1.positionScreen.copy(T),r.v2.positionScreen.copy(U),r.z=Math.max(T.z,U.z),r.materials=q.materials,N.push(r)}else if(q instanceof THREE.Particle&&(s.set(q.matrixWorld.n14,q.matrixWorld.n24,q.matrixWorld.n34,1),o.multiplyVector4(s),s.z/=s.w,s.z>0&&s.z<1))v=R[M]=R[M]||new THREE.RenderableParticle,M++,u=
-v,u.x=s.x/s.w,u.y=s.y/s.w,u.z=s.z,u.rotation=q.rotation.z,u.scale.x=q.scale.x*Math.abs(u.x-(s.x+e.projectionMatrix.n11)/(s.w+e.projectionMatrix.n14)),u.scale.y=q.scale.y*Math.abs(u.y-(s.y+e.projectionMatrix.n22)/(s.w+e.projectionMatrix.n24)),u.materials=q.materials,N.push(u);f&&N.sort(b);return N}};THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,d!==void 0?d:1)};
+-1)a.parent!==void 0&&a.parent.remove(a),a.parent=this,this.children.push(a)},remove:function(a){var b=this.children.indexOf(a);if(b!==-1)a.parent=void 0,this.children.splice(b,1)},getChildByName:function(a,b){var c,d,f;c=0;for(d=this.children.length;c<d;c++){f=this.children[c];if(f.name===a)return f;if(b&&(f=f.getChildByName(a,b),f!==void 0))return f}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,
+this.eulerOrder);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},updateMatrixWorld:function(a){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||a)this.parent?this.matrixWorld.multiply(this.parent.matrixWorld,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,a=!0;for(var b=0,c=this.children.length;b<
+c;b++)this.children[b].updateMatrixWorld(a)}};THREE.Object3DCount=0;
+THREE.Projector=function(){function a(){var a=e[f]=e[f]||new THREE.RenderableVertex;f++;return a}function b(a,b){return b.z-a.z}function c(a,b){var c=0,d=1,e=a.z+a.w,f=b.z+b.w,g=-a.z+a.w,h=-b.z+b.w;return e>=0&&f>=0&&g>=0&&h>=0?!0:e<0&&f<0||g<0&&h<0?!1:(e<0?c=Math.max(c,e/(e-f)):f<0&&(d=Math.min(d,e/(e-f))),g<0?c=Math.max(c,g/(g-h)):h<0&&(d=Math.min(d,g/(g-h))),d<c?!1:(a.lerpSelf(b,c),b.lerpSelf(a,1-d),!0))}var d,f,e=[],g,h,l=[],m,j=[],i,o,n=[],p,k,v=[],G={objects:[],lights:[],elements:[]};new THREE.Vector3;
+var I=new THREE.Vector4,r=new THREE.Matrix4,M=new THREE.Matrix4,H=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],N=new THREE.Vector4,L=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);r.multiply(b.projectionMatrix,b.matrixWorldInverse);r.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);r.multiply(b.matrixWorld,b.projectionMatrixInverse);
+r.multiplyVector3(a);return a};this.pickingRay=function(a,b){var c;a.z=-1;c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.subSelf(a).normalize();return new THREE.Ray(a,c)};this.projectGraph=function(a){G.objects.length=0;G.lights.length=0;var b=function(a){if(a.visible!=!1){var c;if(!(c=a instanceof THREE.Particle))if(!(c=a instanceof THREE.Line))if(c=a instanceof THREE.Mesh)if(!(c=!a.frustumCulled))a:{for(var d=a.matrixWorld,e=-a.geometry.boundingSphere.radius*
+Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)),f=0;f<6;f++)if(c=H[f].x*d.n14+H[f].y*d.n24+H[f].z*d.n34+H[f].w,c<=e){c=!1;break a}c=!0}c?G.objects.push(a):a instanceof THREE.Light&&G.lights.push(a);c=0;for(d=a.children.length;c<d;c++)b(a.children[c])}};b(a);return G};this.projectScene=function(O,t,x){var K=t.near,R=t.far,S,P,u,A,s,E,z,J,w,V,$,ga,ha,da,y,B;k=o=m=h=0;G.elements.length=0;t.parent==null&&(console.warn("Camera is not on the Scene. Adding it..."),O.add(t));O.updateMatrixWorld();t.matrixWorldInverse.getInverse(t.matrixWorld);
+r.multiply(t.projectionMatrix,t.matrixWorldInverse);H[0].set(r.n41-r.n11,r.n42-r.n12,r.n43-r.n13,r.n44-r.n14);H[1].set(r.n41+r.n11,r.n42+r.n12,r.n43+r.n13,r.n44+r.n14);H[2].set(r.n41+r.n21,r.n42+r.n22,r.n43+r.n23,r.n44+r.n24);H[3].set(r.n41-r.n21,r.n42-r.n22,r.n43-r.n23,r.n44-r.n24);H[4].set(r.n41-r.n31,r.n42-r.n32,r.n43-r.n33,r.n44-r.n34);H[5].set(r.n41+r.n31,r.n42+r.n32,r.n43+r.n33,r.n44+r.n34);for(S=0;S<6;S++)w=H[S],w.divideScalar(Math.sqrt(w.x*w.x+w.y*w.y+w.z*w.z));G=this.projectGraph(O);O=0;
+for(S=G.objects.length;O<S;O++)if(w=G.objects[O],V=w.matrixWorld,ga=w.materials,ha=w.overdraw,f=0,w instanceof THREE.Mesh){$=w.geometry;A=$.vertices;da=$.faces;y=$.faceVertexUvs;$=w.matrixRotationWorld.extractRotation(w.matrixWorld);P=0;for(u=A.length;P<u;P++)d=a(),d.positionWorld.copy(A[P].position),V.multiplyVector3(d.positionWorld),d.positionScreen.copy(d.positionWorld),r.multiplyVector4(d.positionScreen),d.positionScreen.x/=d.positionScreen.w,d.positionScreen.y/=d.positionScreen.w,d.visible=d.positionScreen.z>
+K&&d.positionScreen.z<R;A=0;for(P=da.length;A<P;A++){u=da[A];if(u instanceof THREE.Face3)if(s=e[u.a],E=e[u.b],z=e[u.c],s.visible&&E.visible&&z.visible&&(w.doubleSided||w.flipSided!=(z.positionScreen.x-s.positionScreen.x)*(E.positionScreen.y-s.positionScreen.y)-(z.positionScreen.y-s.positionScreen.y)*(E.positionScreen.x-s.positionScreen.x)<0))J=l[h]=l[h]||new THREE.RenderableFace3,h++,g=J,g.v1.copy(s),g.v2.copy(E),g.v3.copy(z);else continue;else if(u instanceof THREE.Face4)if(s=e[u.a],E=e[u.b],z=e[u.c],
+J=e[u.d],s.visible&&E.visible&&z.visible&&J.visible&&(w.doubleSided||w.flipSided!=((J.positionScreen.x-s.positionScreen.x)*(E.positionScreen.y-s.positionScreen.y)-(J.positionScreen.y-s.positionScreen.y)*(E.positionScreen.x-s.positionScreen.x)<0||(E.positionScreen.x-z.positionScreen.x)*(J.positionScreen.y-z.positionScreen.y)-(E.positionScreen.y-z.positionScreen.y)*(J.positionScreen.x-z.positionScreen.x)<0)))B=j[m]=j[m]||new THREE.RenderableFace4,m++,g=B,g.v1.copy(s),g.v2.copy(E),g.v3.copy(z),g.v4.copy(J);
+else continue;g.normalWorld.copy(u.normal);$.multiplyVector3(g.normalWorld);g.centroidWorld.copy(u.centroid);V.multiplyVector3(g.centroidWorld);g.centroidScreen.copy(g.centroidWorld);r.multiplyVector3(g.centroidScreen);z=u.vertexNormals;s=0;for(E=z.length;s<E;s++)J=g.vertexNormalsWorld[s],J.copy(z[s]),$.multiplyVector3(J);s=0;for(E=y.length;s<E;s++)if(B=y[s][A]){z=0;for(J=B.length;z<J;z++)g.uvs[s][z]=B[z]}g.meshMaterials=ga;g.faceMaterials=u.materials;g.overdraw=ha;g.z=g.centroidScreen.z;G.elements.push(g)}}else if(w instanceof
+THREE.Line){M.multiply(r,V);A=w.geometry.vertices;s=a();s.positionScreen.copy(A[0].position);M.multiplyVector4(s.positionScreen);P=1;for(u=A.length;P<u;P++)if(s=a(),s.positionScreen.copy(A[P].position),M.multiplyVector4(s.positionScreen),E=e[f-2],N.copy(s.positionScreen),L.copy(E.positionScreen),c(N,L))N.multiplyScalar(1/N.w),L.multiplyScalar(1/L.w),V=n[o]=n[o]||new THREE.RenderableLine,o++,i=V,i.v1.positionScreen.copy(N),i.v2.positionScreen.copy(L),i.z=Math.max(N.z,L.z),i.materials=w.materials,G.elements.push(i)}else if(w instanceof
+THREE.Particle&&(I.set(w.matrixWorld.n14,w.matrixWorld.n24,w.matrixWorld.n34,1),r.multiplyVector4(I),I.z/=I.w,I.z>0&&I.z<1))V=v[k]=v[k]||new THREE.RenderableParticle,k++,p=V,p.x=I.x/I.w,p.y=I.y/I.w,p.z=I.z,p.rotation=w.rotation.z,p.scale.x=w.scale.x*Math.abs(p.x-(I.x+t.projectionMatrix.n11)/(I.w+t.projectionMatrix.n14)),p.scale.y=w.scale.y*Math.abs(p.y-(I.y+t.projectionMatrix.n22)/(I.w+t.projectionMatrix.n24)),p.materials=w.materials,G.elements.push(p);x&&G.elements.sort(b);return G}};
+THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,d!==void 0?d:1)};
 THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this},setFromEuler:function(a){var b=Math.PI/360,c=a.x*b,d=a.y*b,f=a.z*b,a=Math.cos(d),d=Math.sin(d),b=Math.cos(-f),f=Math.sin(-f),e=Math.cos(c),c=Math.sin(c),g=a*b,h=d*f;this.w=g*e-h*c;this.x=g*c+h*e;this.y=d*b*e+a*f*c;this.z=a*f*e-d*b*c;return this},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);
 this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRotationMatrix:function(a){var b=Math.pow(a.determinant(),1/3);this.w=Math.sqrt(Math.max(0,b+a.n11+a.n22+a.n33))/2;this.x=Math.sqrt(Math.max(0,b+a.n11-a.n22-a.n33))/2;this.y=Math.sqrt(Math.max(0,b-a.n11+a.n22-a.n33))/2;this.z=Math.sqrt(Math.max(0,b-a.n11-a.n22+a.n33))/2;this.x=a.n32-a.n23<0?-Math.abs(this.x):Math.abs(this.x);this.y=a.n13-a.n31<0?-Math.abs(this.y):Math.abs(this.y);this.z=a.n21-a.n12<0?-Math.abs(this.z):Math.abs(this.z);
 this.normalize();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);a==0?this.w=this.z=this.y=this.x=0:(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,f=this.w,e=a.x,g=a.y,h=a.z,a=a.w;this.x=b*a+f*e+c*h-d*g;this.y=c*a+f*g+d*e-b*h;this.z=d*a+f*h+b*g-c*e;this.w=f*a-b*e-c*g-d*h;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,f=a.z,e=this.x,g=this.y,h=this.z,m=this.w,k=m*c+g*f-h*d,l=m*d+h*c-e*f,i=m*f+e*d-g*c,c=-e*
-c-g*d-h*f;b.x=k*m+c*-e+l*-h-i*-g;b.y=l*m+c*-g+i*-e-k*-h;b.z=i*m+c*-h+k*-g-l*-e;return b}};THREE.Quaternion.slerp=function(a,b,c,d){var f=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(f)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var e=Math.acos(f),g=Math.sqrt(1-f*f);if(Math.abs(g)<0.0010)return 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),c;f=Math.sin((1-d)*e)/g;d=Math.sin(d*e)/g;c.w=a.w*f+b.w*d;c.x=a.x*f+b.x*d;c.y=a.y*f+b.y*d;c.z=a.z*f+b.z*d;return c};
-THREE.Vertex=function(a){this.position=a||new THREE.Vector3};THREE.Face3=function(a,b,c,d,f,e){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materials=e instanceof Array?e:[e];this.centroid=new THREE.Vector3};
+this.x,c=this.y,d=this.z,f=this.w,e=a.x,g=a.y,h=a.z,a=a.w;this.x=b*a+f*e+c*h-d*g;this.y=c*a+f*g+d*e-b*h;this.z=d*a+f*h+b*g-c*e;this.w=f*a-b*e-c*g-d*h;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,f=a.z,e=this.x,g=this.y,h=this.z,l=this.w,m=l*c+g*f-h*d,j=l*d+h*c-e*f,i=l*f+e*d-g*c,c=-e*
+c-g*d-h*f;b.x=m*l+c*-e+j*-h-i*-g;b.y=j*l+c*-g+i*-e-m*-h;b.z=i*l+c*-h+m*-g-j*-e;return b}};
+THREE.Quaternion.slerp=function(a,b,c,d){var f=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;f<0?(c.w=-b.w,c.x=-b.x,c.y=-b.y,c.z=-b.z,f=-f):c.copy(b);if(Math.abs(f)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var e=Math.acos(f),f=Math.sqrt(1-f*f);if(Math.abs(f)<0.0010)return 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),c;b=Math.sin((1-d)*e)/f;d=Math.sin(d*e)/f;c.w=a.w*b+c.w*d;c.x=a.x*b+c.x*d;c.y=a.y*b+c.y*d;c.z=a.z*b+c.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
+THREE.Face3=function(a,b,c,d,f,e){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materials=e instanceof Array?e:[e];this.centroid=new THREE.Vector3};
 THREE.Face4=function(a,b,c,d,f,e,g){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materials=g instanceof Array?g:[g];this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.u=a||0;this.v=b||0};
 THREE.UV.prototype={constructor:THREE.UV,set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.u=a.u;this.v=a.v;return this},clone:function(){return new THREE.UV(this.u,this.v)}};THREE.Geometry=function(){this.id=THREE.GeometryCount++;this.vertices=[];this.colors=[];this.faces=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.dynamic=this.hasTangents=!1};
 THREE.Geometry.prototype={constructor:THREE.Geometry,applyMatrix:function(a){var b=new THREE.Matrix4;b.extractRotation(a,new THREE.Vector3(1,1,1));for(var c=0,d=this.vertices.length;c<d;c++)a.multiplyVector3(this.vertices[c].position);c=0;for(d=this.faces.length;c<d;c++){var f=this.faces[c];b.multiplyVector3(f.normal);for(var e=0,g=f.vertexNormals.length;e<g;e++)b.multiplyVector3(f.vertexNormals[e]);a.multiplyVector3(f.centroid)}},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),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)):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,f,e,g,h=new THREE.Vector3,m=new THREE.Vector3;d=0;for(f=this.faces.length;d<f;d++){e=this.faces[d];if(a&&e.vertexNormals.length){h.set(0,0,0);b=0;for(c=e.vertexNormals.length;b<c;b++)h.addSelf(e.vertexNormals[b]);h.divideScalar(3)}else b=this.vertices[e.a],c=this.vertices[e.b],g=this.vertices[e.c],h.sub(g.position,c.position),m.sub(b.position,c.position),h.crossSelf(m);h.isZero()||h.normalize();e.normal.copy(h)}},computeVertexNormals:function(){var a,b,c,d;if(this.__tmpVertices==void 0){d=this.__tmpVertices=
+c,d,f,e,g,h=new THREE.Vector3,l=new THREE.Vector3;d=0;for(f=this.faces.length;d<f;d++){e=this.faces[d];if(a&&e.vertexNormals.length){h.set(0,0,0);b=0;for(c=e.vertexNormals.length;b<c;b++)h.addSelf(e.vertexNormals[b]);h.divideScalar(3)}else b=this.vertices[e.a],c=this.vertices[e.b],g=this.vertices[e.c],h.sub(g.position,c.position),l.sub(b.position,c.position),h.crossSelf(l);h.isZero()||h.normalize();e.normal.copy(h)}},computeVertexNormals:function(){var a,b,c,d;if(this.__tmpVertices==void 0){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++)if(c=this.faces[a],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],c instanceof
 THREE.Face3?(d[c.a].addSelf(c.normal),d[c.b].addSelf(c.normal),d[c.c].addSelf(c.normal)):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],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])):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(a,b,c,d,e,f,o){h=a.vertices[b].position;m=a.vertices[c].position;k=a.vertices[d].position;l=g[e];i=g[f];n=g[o];j=m.x-h.x;r=k.x-h.x;t=m.y-h.y;w=k.y-h.y;u=m.z-h.z;M=k.z-h.z;R=i.u-l.u;B=n.u-l.u;N=i.v-l.v;O=n.v-l.v;s=1/(R*O-B*N);T.set((O*j-N*r)*s,(O*t-N*w)*s,(O*u-N*M)*s);U.set((R*r-B*j)*s,(R*w-B*t)*s,(R*M-B*u)*s);C[b].addSelf(T);C[c].addSelf(T);C[d].addSelf(T);D[b].addSelf(U);
-D[c].addSelf(U);D[d].addSelf(U)}var b,c,d,f,e,g,h,m,k,l,i,n,j,r,t,w,u,M,R,B,N,O,s,o,C=[],D=[],T=new THREE.Vector3,U=new THREE.Vector3,F=new THREE.Vector3,K=new THREE.Vector3,I=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++)C[b]=new THREE.Vector3,D[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)e=this.faces[b],g=this.faceVertexUvs[0][b],e instanceof THREE.Face3?a(this,e.a,e.b,e.c,0,1,2):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));var J=["a","b",
-"c","d"];b=0;for(c=this.faces.length;b<c;b++){e=this.faces[b];for(d=0;d<e.vertexNormals.length;d++)I.copy(e.vertexNormals[d]),f=e[J[d]],o=C[f],F.copy(o),F.subSelf(I.multiplyScalar(I.dot(o))).normalize(),K.cross(e.vertexNormals[d],o),f=K.dot(D[f]),f=f<0?-1:1,e.vertexTangents[d]=new THREE.Vector4(F.x,F.y,F.z,f)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,
+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(a,b,c,d,e,f,u){h=a.vertices[b].position;l=a.vertices[c].position;m=a.vertices[d].position;j=g[e];i=g[f];o=g[u];n=l.x-h.x;p=m.x-h.x;k=l.y-h.y;v=m.y-h.y;G=l.z-h.z;I=m.z-h.z;r=i.u-j.u;M=o.u-j.u;H=i.v-j.v;N=o.v-j.v;L=1/(r*N-M*H);K.set((N*n-H*p)*L,(N*k-H*v)*L,(N*G-H*I)*L);R.set((r*p-M*n)*L,(r*v-M*k)*L,(r*I-M*G)*L);t[b].addSelf(K);t[c].addSelf(K);t[d].addSelf(K);x[b].addSelf(R);
+x[c].addSelf(R);x[d].addSelf(R)}var b,c,d,f,e,g,h,l,m,j,i,o,n,p,k,v,G,I,r,M,H,N,L,O,t=[],x=[],K=new THREE.Vector3,R=new THREE.Vector3,S=new THREE.Vector3,P=new THREE.Vector3,u=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++)t[b]=new THREE.Vector3,x[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)e=this.faces[b],g=this.faceVertexUvs[0][b],e instanceof THREE.Face3?a(this,e.a,e.b,e.c,0,1,2):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));var A=["a","b",
+"c","d"];b=0;for(c=this.faces.length;b<c;b++){e=this.faces[b];for(d=0;d<e.vertexNormals.length;d++)u.copy(e.vertexNormals[d]),f=e[A[d]],O=t[f],S.copy(O),S.subSelf(u.multiplyScalar(u.dot(O))).normalize(),P.cross(e.vertexNormals[d],O),f=P.dot(x[f]),f=f<0?-1:1,e.vertexTangents[d]=new THREE.Vector4(S.x,S.y,S.z,f)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,
 this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var 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=0,b=0,c=this.vertices.length;b<c;b++)a=Math.max(a,this.vertices[b].position.length());this.boundingSphere={radius:a}},mergeVertices:function(){var a={},b=[],c=[],d,f=Math.pow(10,4),e,g;e=0;for(g=this.vertices.length;e<g;e++)d=this.vertices[e].position,d=[Math.round(d.x*f),Math.round(d.y*f),Math.round(d.z*f)].join("_"),a[d]===void 0?(a[d]=e,b.push(this.vertices[e]),
 c[e]=b.length-1):c[e]=c[a[d]];e=0;for(g=this.faces.length;e<g;e++){a=this.faces[e];if(a instanceof THREE.Face3)a.a=c[a.a],a.b=c[a.b],a.c=c[a.c];if(a instanceof THREE.Face4)a.a=c[a.a],a.b=c[a.b],a.c=c[a.c],a.d=c[a.d]}this.vertices=b}};THREE.GeometryCount=0;
-THREE.Camera=function(){if(arguments.length)return console.warn("DEPRECATED: Camera() is now PerspectiveCamera() or OrthographicCamera()."),new THREE.PerspectiveCamera(arguments[0],arguments[1],arguments[2],arguments[3]);THREE.Object3D.call(this);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;
-THREE.Camera.prototype.lookAt=function(a){this.matrix.lookAt(this.position,a,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)};
-THREE.Camera.prototype.update=function(a,b,c){this.matrixAutoUpdate&&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.OrthographicCamera=function(a,b,c,d,f,e){THREE.Camera.call(this);this.left=a;this.right=b;this.top=c;this.bottom=d;this.near=f!==void 0?f:0.1;this.far=e!==void 0?e:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=new THREE.Camera;THREE.OrthographicCamera.prototype.constructor=THREE.OrthographicCamera;THREE.OrthographicCamera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makeOrtho(this.left,this.right,this.top,this.bottom,this.near,this.far)};
-THREE.PerspectiveCamera=function(a,b,c,d){THREE.Camera.call(this);this.fov=a!==void 0?a:50;this.aspect=b!==void 0?b:1;this.near=c!==void 0?c:0.1;this.far=d!==void 0?d:2E3;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype=new THREE.Camera;THREE.PerspectiveCamera.prototype.constructor=THREE.PerspectiveCamera;THREE.PerspectiveCamera.prototype.setLens=function(a,b){this.fov=2*Math.atan((b!==void 0?b:43.25)/(a*2));this.fov*=180/Math.PI;this.updateProjectionMatrix()};
-THREE.PerspectiveCamera.prototype.setViewOffset=function(a,b,c,d,f,e){this.fullWidth=a;this.fullHeight=b;this.x=c;this.y=d;this.width=f;this.height=e;this.updateProjectionMatrix()};
+THREE.Camera=function(){if(arguments.length)return console.warn("DEPRECATED: Camera() is now PerspectiveCamera() or OrthographicCamera()."),new THREE.PerspectiveCamera(arguments[0],arguments[1],arguments[2],arguments[3]);THREE.Object3D.call(this);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4;this.projectionMatrixInverse=new THREE.Matrix4};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;
+THREE.Camera.prototype.lookAt=function(a){this.matrix.lookAt(this.position,a,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)};THREE.OrthographicCamera=function(a,b,c,d,f,e){THREE.Camera.call(this);this.left=a;this.right=b;this.top=c;this.bottom=d;this.near=f!==void 0?f:0.1;this.far=e!==void 0?e:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=new THREE.Camera;THREE.OrthographicCamera.prototype.constructor=THREE.OrthographicCamera;
+THREE.OrthographicCamera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makeOrtho(this.left,this.right,this.top,this.bottom,this.near,this.far)};THREE.PerspectiveCamera=function(a,b,c,d){THREE.Camera.call(this);this.fov=a!==void 0?a:50;this.aspect=b!==void 0?b:1;this.near=c!==void 0?c:0.1;this.far=d!==void 0?d:2E3;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype=new THREE.Camera;THREE.PerspectiveCamera.prototype.constructor=THREE.PerspectiveCamera;
+THREE.PerspectiveCamera.prototype.setLens=function(a,b){this.fov=2*Math.atan((b!==void 0?b:43.25)/(a*2));this.fov*=180/Math.PI;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype.setViewOffset=function(a,b,c,d,f,e){this.fullWidth=a;this.fullHeight=b;this.x=c;this.y=d;this.width=f;this.height=e;this.updateProjectionMatrix()};
 THREE.PerspectiveCamera.prototype.updateProjectionMatrix=function(){if(this.fullWidth){var a=this.fullWidth/this.fullHeight,b=Math.tan(this.fov*Math.PI/360)*this.near,c=-b,d=a*c,a=Math.abs(a*b-d),c=Math.abs(b-c);this.projectionMatrix=THREE.Matrix4.makeFrustum(d+this.x*a/this.fullWidth,d+(this.x+this.width)*a/this.fullWidth,b-(this.y+this.height)*c/this.fullHeight,b-this.y*c/this.fullHeight,this.near,this.far)}else this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,
 this.far)};THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;
 THREE.DirectionalLight=function(a,b,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=b!==void 0?b:1;this.distance=c!==void 0?c:0};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,b,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,0,0);this.intensity=b!==void 0?b:1;this.distance=c!==void 0?c:0};THREE.PointLight.prototype=new THREE.Light;
@@ -119,41 +118,35 @@ THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material
 c}};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]!==void 0)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,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,f=this.children.length;if(this.hasNoneBoneChildren){this.matrixWorld.multiply(this.skin.matrixWorld,this.skinMatrix);for(d=0;d<f;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<f;d++)this.children[d].update(this.skinMatrix,
-b,c)};THREE.Bone.prototype.addChild=function(a){if(this.children.indexOf(a)===-1&&(a.parent!==void 0&&a.parent.removeChild(a),a.parent=this,this.children.push(a),!(a instanceof THREE.Bone)))this.hasNoneBoneChildren=!0};THREE.Scene=function(){THREE.Object3D.call(this);this.fog=null;this.matrixAutoUpdate=!1;this.collisions=this.overrideMaterial=null;this.objects=[];this.lights=[];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.add=function(a){this.supr.add.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.Camera||a instanceof THREE.Bone)&&this.objects.indexOf(a)===-1){this.objects.push(a);this.__objectsAdded.push(a);var b=this.__objectsRemoved.indexOf(a);b!==-1&&this.__objectsRemoved.splice(b,1)}for(b=0;b<a.children.length;b++)this.addChildRecurse(a.children[b])};THREE.Scene.prototype.remove=function(a){this.supr.remove.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 a instanceof THREE.Camera||(b=this.objects.indexOf(a),b!==-1&&(this.objects.splice(b,1),this.__objectsRemoved.push(a),b=this.__objectsAdded.indexOf(a),b!==-1&&this.__objectsAdded.splice(b,1)));for(b=0;b<a.children.length;b++)this.removeChildRecurse(a.children[b])};
-THREE.Scene.prototype.addChild=function(a){console.warn("DEPRECATED: Scene.addChild() is now Scene.add().");this.add(a)};THREE.Scene.prototype.addObject=function(a){console.warn("DEPRECATED: Scene.addObject() is now Scene.add().");this.add(a)};THREE.Scene.prototype.addLight=function(a){console.warn("DEPRECATED: Scene.addLight() is now Scene.add().");this.add(a)};THREE.Scene.prototype.removeChild=function(a){console.warn("DEPRECATED: Scene.removeChild() is now Scene.remove().");this.remove(a)};
-THREE.Scene.prototype.removeObject=function(a){console.warn("DEPRECATED: Scene.removeObject() is now Scene.remove().");this.remove(a)};THREE.Scene.prototype.removeLight=function(a){console.warn("DEPRECATED: Scene.removeLight() is now Scene.remove().");this.remove(a)};
-THREE.CanvasRenderer=function(a){function b(a){if(w!=a)j.globalAlpha=w=a}function c(a){if(u!=a){switch(a){case THREE.NormalBlending:j.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:j.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:j.globalCompositeOperation="darker"}u=a}}function d(a){if(M!=a)j.strokeStyle=M=a}function f(a){if(R!=a)j.fillStyle=R=a}var e=this,g=null,h=new THREE.Projector,a=a||{},m=a.canvas!==void 0?a.canvas:document.createElement("canvas"),
-k,l,i,n,j=m.getContext("2d"),r=new THREE.Color(0),t=0,w=1,u=0,M=null,R=null,B=null,N=null,O=null,s,o,C,D,T=new THREE.RenderableVertex,U=new THREE.RenderableVertex,F,K,I,J,P,Q,V,E,pa,y,L,H,z=new THREE.Color(0),x=new THREE.Color(0),q=new THREE.Color(0),v=new THREE.Color(0),G=new THREE.Color(0),za=[],ea,Z,ba,W,Da,Ea,Fa,Ga,Ha,Ia,ka=new THREE.Rectangle,$=new THREE.Rectangle,Y=new THREE.Rectangle,Aa=!1,ca=new THREE.Color,aa=new THREE.Color,ta=new THREE.Color,ua=new THREE.Color,S=new THREE.Vector3,qa,ra,
-Ba,da,sa,va,a=16;qa=document.createElement("canvas");qa.width=qa.height=2;ra=qa.getContext("2d");ra.fillStyle="rgba(0,0,0,1)";ra.fillRect(0,0,2,2);Ba=ra.getImageData(0,0,2,2);da=Ba.data;sa=document.createElement("canvas");sa.width=sa.height=a;va=sa.getContext("2d");va.translate(-a/2,-a/2);va.scale(a,a);a--;this.domElement=m;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setSize=function(a,b){k=a;l=b;i=Math.floor(k/2);n=Math.floor(l/2);m.width=k;m.height=
-l;ka.set(-i,-n,i,n);$.set(-i,-n,i,n);w=1;u=0;O=N=B=R=M=null};this.setClearColor=function(a,b){r.copy(a);t=b;$.set(-i,-n,i,n)};this.setClearColorHex=function(a,b){r.setHex(a);t=b;$.set(-i,-n,i,n)};this.clear=function(){j.setTransform(1,0,0,-1,i,n);$.isEmpty()||($.minSelf(ka),$.inflate(2),t<1&&j.clearRect(Math.floor($.getX()),Math.floor($.getY()),Math.floor($.getWidth()),Math.floor($.getHeight())),t>0&&(c(THREE.NormalBlending),b(1),f("rgba("+Math.floor(r.r*255)+","+Math.floor(r.g*255)+","+Math.floor(r.b*
-255)+","+t+")"),j.fillRect(Math.floor($.getX()),Math.floor($.getY()),Math.floor($.getWidth()),Math.floor($.getHeight()))),$.empty())};this.render=function(a,k){function l(a){var b,c,d,e=a.lights;aa.setRGB(0,0,0);ta.setRGB(0,0,0);ua.setRGB(0,0,0);a=0;for(b=e.length;a<b;a++)c=e[a],d=c.color,c instanceof THREE.AmbientLight?(aa.r+=d.r,aa.g+=d.g,aa.b+=d.b):c instanceof THREE.DirectionalLight?(ta.r+=d.r,ta.g+=d.g,ta.b+=d.b):c instanceof THREE.PointLight&&(ua.r+=d.r,ua.g+=d.g,ua.b+=d.b)}function m(a,b,c,
-d){var e,f,g,j,h=a.lights,a=0;for(e=h.length;a<e;a++)f=h[a],g=f.color,f instanceof THREE.DirectionalLight?(j=c.dot(f.position),j<=0||(j*=f.intensity,d.r+=g.r*j,d.g+=g.g*j,d.b+=g.b*j)):f instanceof THREE.PointLight&&(j=c.dot(S.sub(f.position,b).normalize()),j<=0||(j*=f.distance==0?1:1-Math.min(b.distanceTo(f.position)/f.distance,1),j!=0&&(j*=f.intensity,d.r+=g.r*j,d.g+=g.g*j,d.b+=g.b*j)))}function r(a,e,g){b(g.opacity);c(g.blending);var h,k,m,l,p,o;if(g instanceof THREE.ParticleBasicMaterial){if(g.map)l=
-g.map.image,p=l.width>>1,o=l.height>>1,g=e.scale.x*i,m=e.scale.y*n,h=g*p,k=m*o,Y.set(a.x-h,a.y-k,a.x+h,a.y+k),ka.intersects(Y)&&(j.save(),j.translate(a.x,a.y),j.rotate(-e.rotation),j.scale(g,-m),j.translate(-p,-o),j.drawImage(l,0,0),j.restore())}else g instanceof THREE.ParticleCanvasMaterial&&(h=e.scale.x*i,k=e.scale.y*n,Y.set(a.x-h,a.y-k,a.x+h,a.y+k),ka.intersects(Y)&&(d(g.color.getContextStyle()),f(g.color.getContextStyle()),j.save(),j.translate(a.x,a.y),j.rotate(-e.rotation),j.scale(h,k),g.program(j),
-j.restore()))}function t(a,e,f,g){b(g.opacity);c(g.blending);j.beginPath();j.moveTo(a.positionScreen.x,a.positionScreen.y);j.lineTo(e.positionScreen.x,e.positionScreen.y);j.closePath();if(g instanceof THREE.LineBasicMaterial){a=g.linewidth;if(B!=a)j.lineWidth=B=a;a=g.linecap;if(N!=a)j.lineCap=N=a;a=g.linejoin;if(O!=a)j.lineJoin=O=a;d(g.color.getContextStyle());j.stroke();Y.inflate(g.linewidth*2)}}function u(a,d,f,g,j,h,i,p,l){e.info.render.vertices+=3;e.info.render.faces++;b(p.opacity);c(p.blending);
-F=a.positionScreen.x;K=a.positionScreen.y;I=d.positionScreen.x;J=d.positionScreen.y;P=f.positionScreen.x;Q=f.positionScreen.y;M(F,K,I,J,P,Q);if(p instanceof THREE.MeshBasicMaterial)if(p.map)p.map.mapping instanceof THREE.UVMapping&&(W=i.uvs[0],Ca(F,K,I,J,P,Q,W[g].u,W[g].v,W[j].u,W[j].v,W[h].u,W[h].v,p.map));else if(p.envMap){if(p.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=k.matrixWorldInverse,S.copy(i.vertexNormalsWorld[0]),Da=(S.x*a.n11+S.y*a.n12+S.z*a.n13)*0.5+0.5,Ea=-(S.x*a.n21+
-S.y*a.n22+S.z*a.n23)*0.5+0.5,S.copy(i.vertexNormalsWorld[1]),Fa=(S.x*a.n11+S.y*a.n12+S.z*a.n13)*0.5+0.5,Ga=-(S.x*a.n21+S.y*a.n22+S.z*a.n23)*0.5+0.5,S.copy(i.vertexNormalsWorld[2]),Ha=(S.x*a.n11+S.y*a.n12+S.z*a.n13)*0.5+0.5,Ia=-(S.x*a.n21+S.y*a.n22+S.z*a.n23)*0.5+0.5,Ca(F,K,I,J,P,Q,Da,Ea,Fa,Ga,Ha,Ia,p.envMap)}else p.wireframe?ga(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):ha(p.color);else if(p instanceof THREE.MeshLambertMaterial)p.map&&!p.wireframe&&(p.map.mapping instanceof
-THREE.UVMapping&&(W=i.uvs[0],Ca(F,K,I,J,P,Q,W[g].u,W[g].v,W[j].u,W[j].v,W[h].u,W[h].v,p.map)),c(THREE.SubtractiveBlending)),Aa?!p.wireframe&&p.shading==THREE.SmoothShading&&i.vertexNormalsWorld.length==3?(x.r=q.r=v.r=aa.r,x.g=q.g=v.g=aa.g,x.b=q.b=v.b=aa.b,m(l,i.v1.positionWorld,i.vertexNormalsWorld[0],x),m(l,i.v2.positionWorld,i.vertexNormalsWorld[1],q),m(l,i.v3.positionWorld,i.vertexNormalsWorld[2],v),x.r=Math.max(0,Math.min(p.color.r*x.r,1)),x.g=Math.max(0,Math.min(p.color.g*x.g,1)),x.b=Math.max(0,
-Math.min(p.color.b*x.b,1)),q.r=Math.max(0,Math.min(p.color.r*q.r,1)),q.g=Math.max(0,Math.min(p.color.g*q.g,1)),q.b=Math.max(0,Math.min(p.color.b*q.b,1)),v.r=Math.max(0,Math.min(p.color.r*v.r,1)),v.g=Math.max(0,Math.min(p.color.g*v.g,1)),v.b=Math.max(0,Math.min(p.color.b*v.b,1)),G.r=(q.r+v.r)*0.5,G.g=(q.g+v.g)*0.5,G.b=(q.b+v.b)*0.5,ba=wa(x,q,v,G),ma(F,K,I,J,P,Q,0,0,1,0,0,1,ba)):(ca.r=aa.r,ca.g=aa.g,ca.b=aa.b,m(l,i.centroidWorld,i.normalWorld,ca),z.r=Math.max(0,Math.min(p.color.r*ca.r,1)),z.g=Math.max(0,
-Math.min(p.color.g*ca.g,1)),z.b=Math.max(0,Math.min(p.color.b*ca.b,1)),p.wireframe?ga(z,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):ha(z)):p.wireframe?ga(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):ha(p.color);else if(p instanceof THREE.MeshDepthMaterial)ea=k.near,Z=k.far,x.r=x.g=x.b=1-la(a.positionScreen.z,ea,Z),q.r=q.g=q.b=1-la(d.positionScreen.z,ea,Z),v.r=v.g=v.b=1-la(f.positionScreen.z,ea,Z),G.r=(q.r+v.r)*0.5,G.g=(q.g+v.g)*0.5,G.b=(q.b+v.b)*0.5,ba=wa(x,
-q,v,G),ma(F,K,I,J,P,Q,0,0,1,0,0,1,ba);else if(p instanceof THREE.MeshNormalMaterial)z.r=na(i.normalWorld.x),z.g=na(i.normalWorld.y),z.b=na(i.normalWorld.z),p.wireframe?ga(z,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):ha(z)}function w(a,d,f,g,j,h,i,p,l){e.info.render.vertices+=4;e.info.render.faces++;b(p.opacity);c(p.blending);if(p.map||p.envMap)u(a,d,g,0,1,3,i,p,l),u(j,f,h,1,2,3,i,p,l);else if(F=a.positionScreen.x,K=a.positionScreen.y,I=d.positionScreen.x,J=d.positionScreen.y,P=f.positionScreen.x,
-Q=f.positionScreen.y,V=g.positionScreen.x,E=g.positionScreen.y,pa=j.positionScreen.x,y=j.positionScreen.y,L=h.positionScreen.x,H=h.positionScreen.y,p instanceof THREE.MeshBasicMaterial)R(F,K,I,J,P,Q,V,E),p.wireframe?ga(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):ha(p.color);else if(p instanceof THREE.MeshLambertMaterial)Aa?!p.wireframe&&p.shading==THREE.SmoothShading&&i.vertexNormalsWorld.length==4?(x.r=q.r=v.r=G.r=aa.r,x.g=q.g=v.g=G.g=aa.g,x.b=q.b=v.b=G.b=aa.b,m(l,i.v1.positionWorld,
-i.vertexNormalsWorld[0],x),m(l,i.v2.positionWorld,i.vertexNormalsWorld[1],q),m(l,i.v4.positionWorld,i.vertexNormalsWorld[3],v),m(l,i.v3.positionWorld,i.vertexNormalsWorld[2],G),x.r=Math.max(0,Math.min(p.color.r*x.r,1)),x.g=Math.max(0,Math.min(p.color.g*x.g,1)),x.b=Math.max(0,Math.min(p.color.b*x.b,1)),q.r=Math.max(0,Math.min(p.color.r*q.r,1)),q.g=Math.max(0,Math.min(p.color.g*q.g,1)),q.b=Math.max(0,Math.min(p.color.b*q.b,1)),v.r=Math.max(0,Math.min(p.color.r*v.r,1)),v.g=Math.max(0,Math.min(p.color.g*
-v.g,1)),v.b=Math.max(0,Math.min(p.color.b*v.b,1)),G.r=Math.max(0,Math.min(p.color.r*G.r,1)),G.g=Math.max(0,Math.min(p.color.g*G.g,1)),G.b=Math.max(0,Math.min(p.color.b*G.b,1)),ba=wa(x,q,v,G),M(F,K,I,J,V,E),ma(F,K,I,J,V,E,0,0,1,0,0,1,ba),M(pa,y,P,Q,L,H),ma(pa,y,P,Q,L,H,1,0,1,1,0,1,ba)):(ca.r=aa.r,ca.g=aa.g,ca.b=aa.b,m(l,i.centroidWorld,i.normalWorld,ca),z.r=Math.max(0,Math.min(p.color.r*ca.r,1)),z.g=Math.max(0,Math.min(p.color.g*ca.g,1)),z.b=Math.max(0,Math.min(p.color.b*ca.b,1)),R(F,K,I,J,P,Q,V,E),
-p.wireframe?ga(z,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):ha(z)):(R(F,K,I,J,P,Q,V,E),p.wireframe?ga(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):ha(p.color));else if(p instanceof THREE.MeshNormalMaterial)z.r=na(i.normalWorld.x),z.g=na(i.normalWorld.y),z.b=na(i.normalWorld.z),R(F,K,I,J,P,Q,V,E),p.wireframe?ga(z,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):ha(z);else if(p instanceof THREE.MeshDepthMaterial)ea=k.near,Z=k.far,x.r=x.g=x.b=1-la(a.positionScreen.z,
-ea,Z),q.r=q.g=q.b=1-la(d.positionScreen.z,ea,Z),v.r=v.g=v.b=1-la(g.positionScreen.z,ea,Z),G.r=G.g=G.b=1-la(f.positionScreen.z,ea,Z),ba=wa(x,q,v,G),M(F,K,I,J,V,E),ma(F,K,I,J,V,E,0,0,1,0,0,1,ba),M(pa,y,P,Q,L,H),ma(pa,y,P,Q,L,H,1,0,1,1,0,1,ba)}function M(a,b,c,d,e,f){j.beginPath();j.moveTo(a,b);j.lineTo(c,d);j.lineTo(e,f);j.lineTo(a,b);j.closePath()}function R(a,b,c,d,e,f,g,h){j.beginPath();j.moveTo(a,b);j.lineTo(c,d);j.lineTo(e,f);j.lineTo(g,h);j.lineTo(a,b);j.closePath()}function ga(a,b,c,e){if(B!=
-b)j.lineWidth=B=b;if(N!=c)j.lineCap=N=c;if(O!=e)j.lineJoin=O=e;d(a.getContextStyle());j.stroke();Y.inflate(b*2)}function ha(a){f(a.getContextStyle());j.fill()}function Ca(a,b,c,d,e,g,h,i,l,k,m,o,n){if(n.image.width!=0){if(n.needsUpdate==!0||za[n.id]==void 0){var q=n.wrapS==THREE.RepeatWrapping,r=n.wrapT==THREE.RepeatWrapping;za[n.id]=j.createPattern(n.image,q&&r?"repeat":q&&!r?"repeat-x":!q&&r?"repeat-y":"no-repeat");n.needsUpdate=!1}f(za[n.id]);var q=n.offset.x/n.repeat.x,r=n.offset.y/n.repeat.y,
-s=(n.image.width-1)*n.repeat.x,n=(n.image.height-1)*n.repeat.y,h=(h+q)*s,i=(i+r)*n,l=(l+q)*s,k=(k+r)*n,m=(m+q)*s,o=(o+r)*n;c-=a;d-=b;e-=a;g-=b;l-=h;k-=i;m-=h;o-=i;q=1/(l*o-m*k);n=(o*c-k*e)*q;k=(o*d-k*g)*q;c=(l*e-m*c)*q;d=(l*g-m*d)*q;a=a-n*h-c*i;b=b-k*h-d*i;j.save();j.transform(n,k,c,d,a,b);j.fill();j.restore()}}function ma(a,b,c,d,e,f,g,h,i,k,l,m,n){var o,q;o=n.width-1;q=n.height-1;g*=o;h*=q;i*=o;k*=q;l*=o;m*=q;c-=a;d-=b;e-=a;f-=b;i-=g;k-=h;l-=g;m-=h;q=1/(i*m-l*k);o=(m*c-k*e)*q;k=(m*d-k*f)*q;c=(i*
-e-l*c)*q;d=(i*f-l*d)*q;a=a-o*g-c*h;b=b-k*g-d*h;j.save();j.transform(o,k,c,d,a,b);j.clip();j.drawImage(n,0,0);j.restore()}function wa(a,b,c,d){var e=~~(a.r*255),f=~~(a.g*255),a=~~(a.b*255),g=~~(b.r*255),h=~~(b.g*255),b=~~(b.b*255),i=~~(c.r*255),j=~~(c.g*255),c=~~(c.b*255),k=~~(d.r*255),l=~~(d.g*255),d=~~(d.b*255);da[0]=e<0?0:e>255?255:e;da[1]=f<0?0:f>255?255:f;da[2]=a<0?0:a>255?255:a;da[4]=g<0?0:g>255?255:g;da[5]=h<0?0:h>255?255:h;da[6]=b<0?0:b>255?255:b;da[8]=i<0?0:i>255?255:i;da[9]=j<0?0:j>255?255:
-j;da[10]=c<0?0:c>255?255:c;da[12]=k<0?0:k>255?255:k;da[13]=l<0?0:l>255?255:l;da[14]=d<0?0:d>255?255:d;ra.putImageData(Ba,0,0);va.drawImage(qa,0,0);return sa}function la(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function na(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}function ia(a,b){var c=b.x-a.x,d=b.y-a.y,e=c*c+d*d;e!=0&&(e=1/Math.sqrt(e),c*=e,d*=e,b.x+=c,b.y+=d,a.x-=c,a.y-=d)}var xa,Ja,A,fa,ja,oa,ya,X;this.autoClear?this.clear():j.setTransform(1,0,0,-1,i,n);e.info.render.vertices=0;e.info.render.faces=0;
-g=h.projectScene(a,k,this.sortElements);(Aa=a.lights.length>0)&&l(a);xa=0;for(Ja=g.length;xa<Ja;xa++){A=g[xa];Y.empty();if(A instanceof THREE.RenderableParticle){s=A;s.x*=i;s.y*=n;fa=0;for(ja=A.materials.length;fa<ja;)X=A.materials[fa++],X.opacity!=0&&r(s,A,X,a)}else if(A instanceof THREE.RenderableLine){if(s=A.v1,o=A.v2,s.positionScreen.x*=i,s.positionScreen.y*=n,o.positionScreen.x*=i,o.positionScreen.y*=n,Y.addPoint(s.positionScreen.x,s.positionScreen.y),Y.addPoint(o.positionScreen.x,o.positionScreen.y),
-ka.intersects(Y)){fa=0;for(ja=A.materials.length;fa<ja;)X=A.materials[fa++],X.opacity!=0&&t(s,o,A,X,a)}}else if(A instanceof THREE.RenderableFace3){if(s=A.v1,o=A.v2,C=A.v3,s.positionScreen.x*=i,s.positionScreen.y*=n,o.positionScreen.x*=i,o.positionScreen.y*=n,C.positionScreen.x*=i,C.positionScreen.y*=n,A.overdraw&&(ia(s.positionScreen,o.positionScreen),ia(o.positionScreen,C.positionScreen),ia(C.positionScreen,s.positionScreen)),Y.add3Points(s.positionScreen.x,s.positionScreen.y,o.positionScreen.x,
-o.positionScreen.y,C.positionScreen.x,C.positionScreen.y),ka.intersects(Y)){fa=0;for(ja=A.meshMaterials.length;fa<ja;)if(X=A.meshMaterials[fa++],X instanceof THREE.MeshFaceMaterial){oa=0;for(ya=A.faceMaterials.length;oa<ya;)(X=A.faceMaterials[oa++])&&X.opacity!=0&&u(s,o,C,0,1,2,A,X,a)}else X.opacity!=0&&u(s,o,C,0,1,2,A,X,a)}}else if(A instanceof THREE.RenderableFace4&&(s=A.v1,o=A.v2,C=A.v3,D=A.v4,s.positionScreen.x*=i,s.positionScreen.y*=n,o.positionScreen.x*=i,o.positionScreen.y*=n,C.positionScreen.x*=
-i,C.positionScreen.y*=n,D.positionScreen.x*=i,D.positionScreen.y*=n,T.positionScreen.copy(o.positionScreen),U.positionScreen.copy(D.positionScreen),A.overdraw&&(ia(s.positionScreen,o.positionScreen),ia(o.positionScreen,D.positionScreen),ia(D.positionScreen,s.positionScreen),ia(C.positionScreen,T.positionScreen),ia(C.positionScreen,U.positionScreen)),Y.addPoint(s.positionScreen.x,s.positionScreen.y),Y.addPoint(o.positionScreen.x,o.positionScreen.y),Y.addPoint(C.positionScreen.x,C.positionScreen.y),
-Y.addPoint(D.positionScreen.x,D.positionScreen.y),ka.intersects(Y))){fa=0;for(ja=A.meshMaterials.length;fa<ja;)if(X=A.meshMaterials[fa++],X instanceof THREE.MeshFaceMaterial){oa=0;for(ya=A.faceMaterials.length;oa<ya;)(X=A.faceMaterials[oa++])&&X.opacity!=0&&w(s,o,C,D,T,U,A,X,a)}else X.opacity!=0&&w(s,o,C,D,T,U,A,X,a)}$.addRectangle(Y)}j.setTransform(1,0,0,1,0,0)}};THREE.RenderableVertex=function(){this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.visible=!0};
-THREE.RenderableVertex.prototype.copy=function(a){this.positionWorld.copy(a.positionWorld);this.positionScreen.copy(a.positionScreen)};
+b,c)};THREE.Bone.prototype.addChild=function(a){if(this.children.indexOf(a)===-1&&(a.parent!==void 0&&a.parent.removeChild(a),a.parent=this,this.children.push(a),!(a instanceof THREE.Bone)))this.hasNoneBoneChildren=!0};THREE.Scene=function(){THREE.Object3D.call(this);this.overrideMaterial=this.fog=null;this.matrixAutoUpdate=!1};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;
+THREE.CanvasRenderer=function(a){function b(a){if(I!=a)k.globalAlpha=I=a}function c(a){if(r!=a){switch(a){case THREE.NormalBlending:k.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:k.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:k.globalCompositeOperation="darker"}r=a}}function d(a){if(M!=a)k.strokeStyle=M=a}function f(a){if(H!=a)k.fillStyle=H=a}var e=this,g,h,l,m=new THREE.Projector,a=a||{},j=a.canvas!==void 0?a.canvas:document.createElement("canvas"),
+i,o,n,p,k=j.getContext("2d"),v=new THREE.Color(0),G=0,I=1,r=0,M=null,H=null,N=null,L=null,O=null,t,x,K,R,S=new THREE.RenderableVertex,P=new THREE.RenderableVertex,u,A,s,E,z,J,w,V,$,ga,ha,da,y=new THREE.Color,B=new THREE.Color,C=new THREE.Color,D=new THREE.Color,Q=new THREE.Color,Aa=[],ea,fa,ca,Z,Ea,Fa,Ga,Ha,Ia,Ja,ma=new THREE.Rectangle,X=new THREE.Rectangle,W=new THREE.Rectangle,Ba=!1,Y=new THREE.Color,ua=new THREE.Color,va=new THREE.Color,T=new THREE.Vector3,ra,sa,Ca,aa,ta,wa,a=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);aa=Ca.data;ta=document.createElement("canvas");ta.width=ta.height=a;wa=ta.getContext("2d");wa.translate(-a/2,-a/2);wa.scale(a,a);a--;this.domElement=j;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setSize=function(a,b){i=a;o=b;n=Math.floor(i/2);p=Math.floor(o/2);j.width=i;j.height=o;ma.set(-n,-p,n,p);X.set(-n,-p,n,p);I=1;r=0;
+O=L=N=H=M=null};this.setClearColor=function(a,b){v.copy(a);G=b;X.set(-n,-p,n,p)};this.setClearColorHex=function(a,b){v.setHex(a);G=b;X.set(-n,-p,n,p)};this.clear=function(){k.setTransform(1,0,0,-1,n,p);X.isEmpty()||(X.minSelf(ma),X.inflate(2),G<1&&k.clearRect(Math.floor(X.getX()),Math.floor(X.getY()),Math.floor(X.getWidth()),Math.floor(X.getHeight())),G>0&&(c(THREE.NormalBlending),b(1),f("rgba("+Math.floor(v.r*255)+","+Math.floor(v.g*255)+","+Math.floor(v.b*255)+","+G+")"),k.fillRect(Math.floor(X.getX()),
+Math.floor(X.getY()),Math.floor(X.getWidth()),Math.floor(X.getHeight()))),X.empty())};this.render=function(a,j){function i(a){var b,c,d,e;Y.setRGB(0,0,0);ua.setRGB(0,0,0);va.setRGB(0,0,0);b=0;for(c=a.length;b<c;b++)d=a[b],e=d.color,d instanceof THREE.AmbientLight?(Y.r+=e.r,Y.g+=e.g,Y.b+=e.b):d instanceof THREE.DirectionalLight?(ua.r+=e.r,ua.g+=e.g,ua.b+=e.b):d instanceof THREE.PointLight&&(va.r+=e.r,va.g+=e.g,va.b+=e.b)}function o(a,b,c,d){var e,f,g,h,k,j;e=0;for(f=a.length;e<f;e++)g=a[e],h=g.color,
+g instanceof THREE.DirectionalLight?(k=g.matrixWorld.getPosition(),j=c.dot(k),j<=0||(j*=g.intensity,d.r+=h.r*j,d.g+=h.g*j,d.b+=h.b*j)):g instanceof THREE.PointLight&&(k=g.matrixWorld.getPosition(),j=c.dot(T.sub(k,b).normalize()),j<=0||(j*=g.distance==0?1:1-Math.min(b.distanceTo(k)/g.distance,1),j!=0&&(j*=g.intensity,d.r+=h.r*j,d.g+=h.g*j,d.b+=h.b*j)))}function r(a,e,g){b(g.opacity);c(g.blending);var h,j,l,i,q,o;if(g instanceof THREE.ParticleBasicMaterial){if(g.map)i=g.map.image,q=i.width>>1,o=i.height>>
+1,g=e.scale.x*n,l=e.scale.y*p,h=g*q,j=l*o,W.set(a.x-h,a.y-j,a.x+h,a.y+j),ma.intersects(W)&&(k.save(),k.translate(a.x,a.y),k.rotate(-e.rotation),k.scale(g,-l),k.translate(-q,-o),k.drawImage(i,0,0),k.restore())}else g instanceof THREE.ParticleCanvasMaterial&&(h=e.scale.x*n,j=e.scale.y*p,W.set(a.x-h,a.y-j,a.x+h,a.y+j),ma.intersects(W)&&(d(g.color.getContextStyle()),f(g.color.getContextStyle()),k.save(),k.translate(a.x,a.y),k.rotate(-e.rotation),k.scale(h,j),g.program(k),k.restore()))}function v(a,e,
+f,g){b(g.opacity);c(g.blending);k.beginPath();k.moveTo(a.positionScreen.x,a.positionScreen.y);k.lineTo(e.positionScreen.x,e.positionScreen.y);k.closePath();if(g instanceof THREE.LineBasicMaterial){a=g.linewidth;if(N!=a)k.lineWidth=N=a;a=g.linecap;if(L!=a)k.lineCap=L=a;a=g.linejoin;if(O!=a)k.lineJoin=O=a;d(g.color.getContextStyle());k.stroke();W.inflate(g.linewidth*2)}}function G(a,d,f,g,h,k,i,q){e.info.render.vertices+=3;e.info.render.faces++;b(q.opacity);c(q.blending);u=a.positionScreen.x;A=a.positionScreen.y;
+s=d.positionScreen.x;E=d.positionScreen.y;z=f.positionScreen.x;J=f.positionScreen.y;H(u,A,s,E,z,J);if(q instanceof THREE.MeshBasicMaterial)if(q.map)q.map.mapping instanceof THREE.UVMapping&&(Z=i.uvs[0],Da(u,A,s,E,z,J,Z[g].u,Z[g].v,Z[h].u,Z[h].v,Z[k].u,Z[k].v,q.map));else if(q.envMap){if(q.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=j.matrixWorldInverse,T.copy(i.vertexNormalsWorld[g]),Ea=(T.x*a.n11+T.y*a.n12+T.z*a.n13)*0.5+0.5,Fa=-(T.x*a.n21+T.y*a.n22+T.z*a.n23)*0.5+0.5,T.copy(i.vertexNormalsWorld[h]),
+Ga=(T.x*a.n11+T.y*a.n12+T.z*a.n13)*0.5+0.5,Ha=-(T.x*a.n21+T.y*a.n22+T.z*a.n23)*0.5+0.5,T.copy(i.vertexNormalsWorld[k]),Ia=(T.x*a.n11+T.y*a.n12+T.z*a.n13)*0.5+0.5,Ja=-(T.x*a.n21+T.y*a.n22+T.z*a.n23)*0.5+0.5,Da(u,A,s,E,z,J,Ea,Fa,Ga,Ha,Ia,Ja,q.envMap)}else q.wireframe?ia(q.color,q.wireframeLinewidth,q.wireframeLinecap,q.wireframeLinejoin):ja(q.color);else if(q instanceof THREE.MeshLambertMaterial)q.map&&!q.wireframe&&(q.map.mapping instanceof THREE.UVMapping&&(Z=i.uvs[0],Da(u,A,s,E,z,J,Z[g].u,Z[g].v,
+Z[h].u,Z[h].v,Z[k].u,Z[k].v,q.map)),c(THREE.SubtractiveBlending)),Ba?!q.wireframe&&q.shading==THREE.SmoothShading&&i.vertexNormalsWorld.length==3?(B.r=C.r=D.r=Y.r,B.g=C.g=D.g=Y.g,B.b=C.b=D.b=Y.b,o(l,i.v1.positionWorld,i.vertexNormalsWorld[0],B),o(l,i.v2.positionWorld,i.vertexNormalsWorld[1],C),o(l,i.v3.positionWorld,i.vertexNormalsWorld[2],D),B.r=Math.max(0,Math.min(q.color.r*B.r,1)),B.g=Math.max(0,Math.min(q.color.g*B.g,1)),B.b=Math.max(0,Math.min(q.color.b*B.b,1)),C.r=Math.max(0,Math.min(q.color.r*
+C.r,1)),C.g=Math.max(0,Math.min(q.color.g*C.g,1)),C.b=Math.max(0,Math.min(q.color.b*C.b,1)),D.r=Math.max(0,Math.min(q.color.r*D.r,1)),D.g=Math.max(0,Math.min(q.color.g*D.g,1)),D.b=Math.max(0,Math.min(q.color.b*D.b,1)),Q.r=(C.r+D.r)*0.5,Q.g=(C.g+D.g)*0.5,Q.b=(C.b+D.b)*0.5,ca=xa(B,C,D,Q),oa(u,A,s,E,z,J,0,0,1,0,0,1,ca)):(y.r=Y.r,y.g=Y.g,y.b=Y.b,o(l,i.centroidWorld,i.normalWorld,y),y.r=Math.max(0,Math.min(q.color.r*y.r,1)),y.g=Math.max(0,Math.min(q.color.g*y.g,1)),y.b=Math.max(0,Math.min(q.color.b*y.b,
+1)),q.wireframe?ia(y,q.wireframeLinewidth,q.wireframeLinecap,q.wireframeLinejoin):ja(y)):q.wireframe?ia(q.color,q.wireframeLinewidth,q.wireframeLinecap,q.wireframeLinejoin):ja(q.color);else if(q instanceof THREE.MeshDepthMaterial)ea=j.near,fa=j.far,B.r=B.g=B.b=1-na(a.positionScreen.z,ea,fa),C.r=C.g=C.b=1-na(d.positionScreen.z,ea,fa),D.r=D.g=D.b=1-na(f.positionScreen.z,ea,fa),Q.r=(C.r+D.r)*0.5,Q.g=(C.g+D.g)*0.5,Q.b=(C.b+D.b)*0.5,ca=xa(B,C,D,Q),oa(u,A,s,E,z,J,0,0,1,0,0,1,ca);else if(q instanceof THREE.MeshNormalMaterial)y.r=
+pa(i.normalWorld.x),y.g=pa(i.normalWorld.y),y.b=pa(i.normalWorld.z),q.wireframe?ia(y,q.wireframeLinewidth,q.wireframeLinecap,q.wireframeLinejoin):ja(y)}function I(a,d,f,g,h,k,i,q,n){e.info.render.vertices+=4;e.info.render.faces++;b(q.opacity);c(q.blending);if(q.map||q.envMap)G(a,d,g,0,1,3,i,q,n),G(h,f,k,1,2,3,i,q,n);else if(u=a.positionScreen.x,A=a.positionScreen.y,s=d.positionScreen.x,E=d.positionScreen.y,z=f.positionScreen.x,J=f.positionScreen.y,w=g.positionScreen.x,V=g.positionScreen.y,$=h.positionScreen.x,
+ga=h.positionScreen.y,ha=k.positionScreen.x,da=k.positionScreen.y,q instanceof THREE.MeshBasicMaterial)M(u,A,s,E,z,J,w,V),q.wireframe?ia(q.color,q.wireframeLinewidth,q.wireframeLinecap,q.wireframeLinejoin):ja(q.color);else if(q instanceof THREE.MeshLambertMaterial)Ba?!q.wireframe&&q.shading==THREE.SmoothShading&&i.vertexNormalsWorld.length==4?(B.r=C.r=D.r=Q.r=Y.r,B.g=C.g=D.g=Q.g=Y.g,B.b=C.b=D.b=Q.b=Y.b,o(l,i.v1.positionWorld,i.vertexNormalsWorld[0],B),o(l,i.v2.positionWorld,i.vertexNormalsWorld[1],
+C),o(l,i.v4.positionWorld,i.vertexNormalsWorld[3],D),o(l,i.v3.positionWorld,i.vertexNormalsWorld[2],Q),B.r=Math.max(0,Math.min(q.color.r*B.r,1)),B.g=Math.max(0,Math.min(q.color.g*B.g,1)),B.b=Math.max(0,Math.min(q.color.b*B.b,1)),C.r=Math.max(0,Math.min(q.color.r*C.r,1)),C.g=Math.max(0,Math.min(q.color.g*C.g,1)),C.b=Math.max(0,Math.min(q.color.b*C.b,1)),D.r=Math.max(0,Math.min(q.color.r*D.r,1)),D.g=Math.max(0,Math.min(q.color.g*D.g,1)),D.b=Math.max(0,Math.min(q.color.b*D.b,1)),Q.r=Math.max(0,Math.min(q.color.r*
+Q.r,1)),Q.g=Math.max(0,Math.min(q.color.g*Q.g,1)),Q.b=Math.max(0,Math.min(q.color.b*Q.b,1)),ca=xa(B,C,D,Q),H(u,A,s,E,w,V),oa(u,A,s,E,w,V,0,0,1,0,0,1,ca),H($,ga,z,J,ha,da),oa($,ga,z,J,ha,da,1,0,1,1,0,1,ca)):(y.r=Y.r,y.g=Y.g,y.b=Y.b,o(l,i.centroidWorld,i.normalWorld,y),y.r=Math.max(0,Math.min(q.color.r*y.r,1)),y.g=Math.max(0,Math.min(q.color.g*y.g,1)),y.b=Math.max(0,Math.min(q.color.b*y.b,1)),M(u,A,s,E,z,J,w,V),q.wireframe?ia(y,q.wireframeLinewidth,q.wireframeLinecap,q.wireframeLinejoin):ja(y)):(M(u,
+A,s,E,z,J,w,V),q.wireframe?ia(q.color,q.wireframeLinewidth,q.wireframeLinecap,q.wireframeLinejoin):ja(q.color));else if(q instanceof THREE.MeshNormalMaterial)y.r=pa(i.normalWorld.x),y.g=pa(i.normalWorld.y),y.b=pa(i.normalWorld.z),M(u,A,s,E,z,J,w,V),q.wireframe?ia(y,q.wireframeLinewidth,q.wireframeLinecap,q.wireframeLinejoin):ja(y);else if(q instanceof THREE.MeshDepthMaterial)ea=j.near,fa=j.far,B.r=B.g=B.b=1-na(a.positionScreen.z,ea,fa),C.r=C.g=C.b=1-na(d.positionScreen.z,ea,fa),D.r=D.g=D.b=1-na(g.positionScreen.z,
+ea,fa),Q.r=Q.g=Q.b=1-na(f.positionScreen.z,ea,fa),ca=xa(B,C,D,Q),H(u,A,s,E,w,V),oa(u,A,s,E,w,V,0,0,1,0,0,1,ca),H($,ga,z,J,ha,da),oa($,ga,z,J,ha,da,1,0,1,1,0,1,ca)}function H(a,b,c,d,e,f){k.beginPath();k.moveTo(a,b);k.lineTo(c,d);k.lineTo(e,f);k.lineTo(a,b);k.closePath()}function M(a,b,c,d,e,f,g,h){k.beginPath();k.moveTo(a,b);k.lineTo(c,d);k.lineTo(e,f);k.lineTo(g,h);k.lineTo(a,b);k.closePath()}function ia(a,b,c,e){if(N!=b)k.lineWidth=N=b;if(L!=c)k.lineCap=L=c;if(O!=e)k.lineJoin=O=e;d(a.getContextStyle());
+k.stroke();W.inflate(b*2)}function ja(a){f(a.getContextStyle());k.fill()}function Da(a,b,c,d,e,g,h,i,j,l,n,o,m){if(m.image.width!=0){if(m.needsUpdate==!0||Aa[m.id]==void 0){var p=m.wrapS==THREE.RepeatWrapping,r=m.wrapT==THREE.RepeatWrapping;Aa[m.id]=k.createPattern(m.image,p&&r?"repeat":p&&!r?"repeat-x":!p&&r?"repeat-y":"no-repeat");m.needsUpdate=!1}f(Aa[m.id]);var p=m.offset.x/m.repeat.x,r=m.offset.y/m.repeat.y,s=(m.image.width-1)*m.repeat.x,m=(m.image.height-1)*m.repeat.y,h=(h+p)*s,i=(i+r)*m,j=
+(j+p)*s,l=(l+r)*m,n=(n+p)*s,o=(o+r)*m;c-=a;d-=b;e-=a;g-=b;j-=h;l-=i;n-=h;o-=i;p=1/(j*o-n*l);m=(o*c-l*e)*p;l=(o*d-l*g)*p;c=(j*e-n*c)*p;d=(j*g-n*d)*p;a=a-m*h-c*i;b=b-l*h-d*i;k.save();k.transform(m,l,c,d,a,b);k.fill();k.restore()}}function oa(a,b,c,d,e,f,g,h,i,j,l,m,n){var o,p;o=n.width-1;p=n.height-1;g*=o;h*=p;i*=o;j*=p;l*=o;m*=p;c-=a;d-=b;e-=a;f-=b;i-=g;j-=h;l-=g;m-=h;p=1/(i*m-l*j);o=(m*c-j*e)*p;j=(m*d-j*f)*p;c=(i*e-l*c)*p;d=(i*f-l*d)*p;a=a-o*g-c*h;b=b-j*g-d*h;k.save();k.transform(o,j,c,d,a,b);k.clip();
+k.drawImage(n,0,0);k.restore()}function xa(a,b,c,d){var e=~~(a.r*255),f=~~(a.g*255),a=~~(a.b*255),g=~~(b.r*255),h=~~(b.g*255),b=~~(b.b*255),i=~~(c.r*255),j=~~(c.g*255),c=~~(c.b*255),k=~~(d.r*255),l=~~(d.g*255),d=~~(d.b*255);aa[0]=e<0?0:e>255?255:e;aa[1]=f<0?0:f>255?255:f;aa[2]=a<0?0:a>255?255:a;aa[4]=g<0?0:g>255?255:g;aa[5]=h<0?0:h>255?255:h;aa[6]=b<0?0:b>255?255:b;aa[8]=i<0?0:i>255?255:i;aa[9]=j<0?0:j>255?255:j;aa[10]=c<0?0:c>255?255:c;aa[12]=k<0?0:k>255?255:k;aa[13]=l<0?0:l>255?255:l;aa[14]=d<0?
+0:d>255?255:d;sa.putImageData(Ca,0,0);wa.drawImage(ra,0,0);return ta}function na(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function pa(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}function ka(a,b){var c=b.x-a.x,d=b.y-a.y,e=c*c+d*d;e!=0&&(e=1/Math.sqrt(e),c*=e,d*=e,b.x+=c,b.y+=d,a.x-=c,a.y-=d)}var ya,Ka,F,ba,la,qa,za,U;this.autoClear?this.clear():k.setTransform(1,0,0,-1,n,p);e.info.render.vertices=0;e.info.render.faces=0;g=m.projectScene(a,j,this.sortElements);h=g.elements;l=g.lights;(Ba=l.length>0)&&i(l);ya=
+0;for(Ka=h.length;ya<Ka;ya++){F=h[ya];W.empty();if(F instanceof THREE.RenderableParticle){t=F;t.x*=n;t.y*=p;ba=0;for(la=F.materials.length;ba<la;)U=F.materials[ba++],U.opacity!=0&&r(t,F,U,a)}else if(F instanceof THREE.RenderableLine){if(t=F.v1,x=F.v2,t.positionScreen.x*=n,t.positionScreen.y*=p,x.positionScreen.x*=n,x.positionScreen.y*=p,W.addPoint(t.positionScreen.x,t.positionScreen.y),W.addPoint(x.positionScreen.x,x.positionScreen.y),ma.intersects(W)){ba=0;for(la=F.materials.length;ba<la;)U=F.materials[ba++],
+U.opacity!=0&&v(t,x,F,U,a)}}else if(F instanceof THREE.RenderableFace3){if(t=F.v1,x=F.v2,K=F.v3,t.positionScreen.x*=n,t.positionScreen.y*=p,x.positionScreen.x*=n,x.positionScreen.y*=p,K.positionScreen.x*=n,K.positionScreen.y*=p,F.overdraw&&(ka(t.positionScreen,x.positionScreen),ka(x.positionScreen,K.positionScreen),ka(K.positionScreen,t.positionScreen)),W.add3Points(t.positionScreen.x,t.positionScreen.y,x.positionScreen.x,x.positionScreen.y,K.positionScreen.x,K.positionScreen.y),ma.intersects(W)){ba=
+0;for(la=F.meshMaterials.length;ba<la;)if(U=F.meshMaterials[ba++],U instanceof THREE.MeshFaceMaterial){qa=0;for(za=F.faceMaterials.length;qa<za;)(U=F.faceMaterials[qa++])&&U.opacity!=0&&G(t,x,K,0,1,2,F,U,a)}else U.opacity!=0&&G(t,x,K,0,1,2,F,U,a)}}else if(F instanceof THREE.RenderableFace4&&(t=F.v1,x=F.v2,K=F.v3,R=F.v4,t.positionScreen.x*=n,t.positionScreen.y*=p,x.positionScreen.x*=n,x.positionScreen.y*=p,K.positionScreen.x*=n,K.positionScreen.y*=p,R.positionScreen.x*=n,R.positionScreen.y*=p,S.positionScreen.copy(x.positionScreen),
+P.positionScreen.copy(R.positionScreen),F.overdraw&&(ka(t.positionScreen,x.positionScreen),ka(x.positionScreen,R.positionScreen),ka(R.positionScreen,t.positionScreen),ka(K.positionScreen,S.positionScreen),ka(K.positionScreen,P.positionScreen)),W.addPoint(t.positionScreen.x,t.positionScreen.y),W.addPoint(x.positionScreen.x,x.positionScreen.y),W.addPoint(K.positionScreen.x,K.positionScreen.y),W.addPoint(R.positionScreen.x,R.positionScreen.y),ma.intersects(W))){ba=0;for(la=F.meshMaterials.length;ba<
+la;)if(U=F.meshMaterials[ba++],U instanceof THREE.MeshFaceMaterial){qa=0;for(za=F.faceMaterials.length;qa<za;)(U=F.faceMaterials[qa++])&&U.opacity!=0&&I(t,x,K,R,S,P,F,U,a)}else U.opacity!=0&&I(t,x,K,R,S,P,F,U,a)}X.addRectangle(W)}k.setTransform(1,0,0,1,0,0)}};THREE.RenderableVertex=function(){this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.visible=!0};THREE.RenderableVertex.prototype.copy=function(a){this.positionWorld.copy(a.positionWorld);this.positionScreen.copy(a.positionScreen)};
 THREE.RenderableFace3=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterials=this.meshMaterials=null;this.overdraw=!1;this.uvs=[[]];this.z=null};
 THREE.RenderableFace4=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.v4=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterials=this.meshMaterials=null;this.overdraw=!1;this.uvs=[[]];this.z=null};
-THREE.RenderableObject=function(){this.z=this.object=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.RenderableVertex;this.v2=new THREE.RenderableVertex;this.materials=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.RenderableVertex;this.v2=new THREE.RenderableVertex;this.materials=null};

+ 54 - 60
build/custom/ThreeDOM.js

@@ -14,80 +14,74 @@ Math.abs(b)>1.0E-5?(this.x=Math.atan2(-a.n23/b,a.n33/b),this.z=Math.atan2(-a.n12
 THREE.Vector4.prototype={constructor:THREE.Vector4,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w!==void 0?a.w:1},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;this.w=a.w+b.w;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-
 b.z;this.w=a.w-b.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this},divideScalar:function(a){a?(this.x/=a,this.y/=a,this.z/=a,this.w/=a):(this.z=this.y=this.x=0,this.w=1);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z+this.w*a.w},lengthSq:function(){return this.dot(this)},length:function(){return Math.sqrt(this.lengthSq())},
 normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)},lerpSelf:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;this.w+=(a.w-this.w)*b;return this}};THREE.Ray=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3};
-THREE.Ray.prototype={constructor:THREE.Ray,intersectScene:function(a){return this.intersectObjects(a.objects)},intersectObjects:function(a){var b,c,d=[];b=0;for(c=a.length;b<c;b++)Array.prototype.push.apply(d,this.intersectObject(a[b]));d.sort(function(a,b){return a.distance-b.distance});return d},intersectObject:function(a){function b(a,b,c){var d;d=c.clone().subSelf(a).dot(b);if(d<=0)return null;a=a.clone().addSelf(b.clone().multiplyScalar(d));return c.distanceTo(a)}function c(a,b,c,d){var d=d.clone().subSelf(b),
+THREE.Ray.prototype={constructor:THREE.Ray,intersectScene:function(a){return this.intersectObjects(a.children)},intersectObjects:function(a){var b,c,d=[];b=0;for(c=a.length;b<c;b++)Array.prototype.push.apply(d,this.intersectObject(a[b]));d.sort(function(a,b){return a.distance-b.distance});return d},intersectObject:function(a){function b(a,b,c){var d;d=c.clone().subSelf(a).dot(b);if(d<=0)return null;a=a.clone().addSelf(b.clone().multiplyScalar(d));return c.distanceTo(a)}function c(a,b,c,d){var d=d.clone().subSelf(b),
 c=c.clone().subSelf(b),e=a.clone().subSelf(b),a=d.dot(d),b=d.dot(c),d=d.dot(e),f=c.dot(c),c=c.dot(e),e=1/(a*f-b*b),f=(f*d-b*c)*e,a=(a*c-b*d)*e;return f>0&&a>0&&f+a<1}for(var d,e=[],g=0,f=a.children.length;g<f;g++)Array.prototype.push.apply(e,this.intersectObject(a.children[g]));if(a instanceof THREE.Particle){g=b(this.origin,this.direction,a.matrixWorld.getPosition());if(g==null||g>a.scale.x)return[];d={distance:g,point:a.position,face:null,object:a};e.push(d)}else if(a instanceof THREE.Mesh){g=b(this.origin,
-this.direction,a.matrixWorld.getPosition());if(g==null||g>a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)))return e;for(var h,k,i,j,l,n,m,p,q=a.geometry,s=q.vertices,g=0,f=q.faces.length;g<f;g++)if(d=q.faces[g],m=this.origin.clone(),p=this.direction.clone(),j=a.matrixWorld,h=j.multiplyVector3(d.centroid.clone()).subSelf(m),n=h.dot(p),!(n<=0)&&(h=j.multiplyVector3(s[d.a].position.clone()),k=j.multiplyVector3(s[d.b].position.clone()),i=j.multiplyVector3(s[d.c].position.clone()),
-j=d instanceof THREE.Face4?j.multiplyVector3(s[d.d].position.clone()):null,l=a.matrixRotationWorld.multiplyVector3(d.normal.clone()),n=p.dot(l),a.doubleSided||(a.flipSided?n>0:n<0)))if(n=l.dot((new THREE.Vector3).sub(h,m))/n,m=m.addSelf(p.multiplyScalar(n)),d instanceof THREE.Face3)c(m,h,k,i)&&(d={distance:this.origin.distanceTo(m),point:m,face:d,object:a},e.push(d));else if(d instanceof THREE.Face4&&(c(m,h,k,j)||c(m,k,i,j)))d={distance:this.origin.distanceTo(m),point:m,face:d,object:a},e.push(d)}return e}};
-THREE.Rectangle=function(){function a(){g=d-b;f=e-c}var b,c,d,e,g,f,h=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return g};this.getHeight=function(){return f};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return e};this.set=function(f,g,j,l){h=!1;b=f;c=g;d=j;e=l;a()};this.addPoint=function(f,g){h?(h=!1,b=f,c=g,d=f,e=g):(b=b<f?b:f,c=c<g?c:g,d=d>f?d:f,e=e>g?e:g);a()};this.add3Points=
-function(f,g,j,l,n,m){h?(h=!1,b=f<j?f<n?f:n:j<n?j:n,c=g<l?g<m?g:m:l<m?l:m,d=f>j?f>n?f:n:j>n?j:n,e=g>l?g>m?g:m:l>m?l:m):(b=f<j?f<n?f<b?f:b:n<b?n:b:j<n?j<b?j:b:n<b?n:b,c=g<l?g<m?g<c?g:c:m<c?m:c:l<m?l<c?l:c:m<c?m:c,d=f>j?f>n?f>d?f:d:n>d?n:d:j>n?j>d?j:d:n>d?n:d,e=g>l?g>m?g>e?g:e:m>e?m:e:l>m?l>e?l:e:m>e?m:e);a()};this.addRectangle=function(f){h?(h=!1,b=f.getLeft(),c=f.getTop(),d=f.getRight(),e=f.getBottom()):(b=b<f.getLeft()?b:f.getLeft(),c=c<f.getTop()?c:f.getTop(),d=d>f.getRight()?d:f.getRight(),e=e>
+this.direction,a.matrixWorld.getPosition());if(g==null||g>a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)))return e;var h,k,l,i,j,n,m,p,q=a.geometry,s=q.vertices;a.matrixRotationWorld.extractRotation(a.matrixWorld);g=0;for(f=q.faces.length;g<f;g++)if(d=q.faces[g],m=this.origin.clone(),p=this.direction.clone(),i=a.matrixWorld,h=i.multiplyVector3(d.centroid.clone()).subSelf(m),n=h.dot(p),!(n<=0)&&(h=i.multiplyVector3(s[d.a].position.clone()),k=i.multiplyVector3(s[d.b].position.clone()),
+l=i.multiplyVector3(s[d.c].position.clone()),i=d instanceof THREE.Face4?i.multiplyVector3(s[d.d].position.clone()):null,j=a.matrixRotationWorld.multiplyVector3(d.normal.clone()),n=p.dot(j),a.doubleSided||(a.flipSided?n>0:n<0)))if(n=j.dot((new THREE.Vector3).sub(h,m))/n,m=m.addSelf(p.multiplyScalar(n)),d instanceof THREE.Face3)c(m,h,k,l)&&(d={distance:this.origin.distanceTo(m),point:m,face:d,object:a},e.push(d));else if(d instanceof THREE.Face4&&(c(m,h,k,i)||c(m,k,l,i)))d={distance:this.origin.distanceTo(m),
+point:m,face:d,object:a},e.push(d)}return e}};
+THREE.Rectangle=function(){function a(){g=d-b;f=e-c}var b,c,d,e,g,f,h=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return g};this.getHeight=function(){return f};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return e};this.set=function(f,g,i,j){h=!1;b=f;c=g;d=i;e=j;a()};this.addPoint=function(f,g){h?(h=!1,b=f,c=g,d=f,e=g):(b=b<f?b:f,c=c<g?c:g,d=d>f?d:f,e=e>g?e:g);a()};this.add3Points=
+function(f,g,i,j,n,m){h?(h=!1,b=f<i?f<n?f:n:i<n?i:n,c=g<j?g<m?g:m:j<m?j:m,d=f>i?f>n?f:n:i>n?i:n,e=g>j?g>m?g:m:j>m?j:m):(b=f<i?f<n?f<b?f:b:n<b?n:b:i<n?i<b?i:b:n<b?n:b,c=g<j?g<m?g<c?g:c:m<c?m:c:j<m?j<c?j:c:m<c?m:c,d=f>i?f>n?f>d?f:d:n>d?n:d:i>n?i>d?i:d:n>d?n:d,e=g>j?g>m?g>e?g:e:m>e?m:e:j>m?j>e?j:e:m>e?m:e);a()};this.addRectangle=function(f){h?(h=!1,b=f.getLeft(),c=f.getTop(),d=f.getRight(),e=f.getBottom()):(b=b<f.getLeft()?b:f.getLeft(),c=c<f.getTop()?c:f.getTop(),d=d>f.getRight()?d:f.getRight(),e=e>
 f.getBottom()?e:f.getBottom());a()};this.inflate=function(f){b-=f;c-=f;d+=f;e+=f;a()};this.minSelf=function(f){b=b>f.getLeft()?b:f.getLeft();c=c>f.getTop()?c:f.getTop();d=d<f.getRight()?d:f.getRight();e=e<f.getBottom()?e:f.getBottom();a()};this.intersects=function(a){return Math.min(d,a.getRight())-Math.max(b,a.getLeft())>=0&&Math.min(e,a.getBottom())-Math.max(c,a.getTop())>=0};this.empty=function(){h=!0;e=d=c=b=0;a()};this.isEmpty=function(){return h}};THREE.Matrix3=function(){this.m=[]};
 THREE.Matrix3.prototype={constructor:THREE.Matrix3,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,g,f,h,k,i,j,l,n,m,p,q){this.set(a!==void 0?a:1,b||0,c||0,d||0,e||0,g!==void 0?g:1,f||0,h||0,k||0,i||0,j!==void 0?j:1,l||0,n||0,m||0,p||0,q!==void 0?q:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
-THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,e,g,f,h,k,i,j,l,n,m,p,q){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=e;this.n22=g;this.n23=f;this.n24=h;this.n31=k;this.n32=i;this.n33=j;this.n34=l;this.n41=n;this.n42=m;this.n43=p;this.n44=q;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,g=THREE.Matrix4.__v3;g.sub(a,b).normalize();if(g.length()===0)g.z=1;d.cross(c,g).normalize();d.length()===0&&(g.x+=1.0E-4,d.cross(c,g).normalize());e.cross(g,d).normalize();this.n11=d.x;this.n12=e.x;this.n13=g.x;this.n21=d.y;this.n22=e.y;this.n23=g.y;this.n31=d.z;this.n32=e.z;this.n33=g.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,g=a.n14,f=a.n21,h=a.n22,k=a.n23,i=a.n24,j=a.n31,l=a.n32,n=a.n33,m=a.n34,p=a.n41,q=a.n42,s=a.n43,r=a.n44,J=b.n11,M=b.n12,
-C=b.n13,D=b.n14,H=b.n21,v=b.n22,o=b.n23,K=b.n24,z=b.n31,E=b.n32,F=b.n33,Q=b.n34,R=b.n41,S=b.n42,T=b.n43,U=b.n44;this.n11=c*J+d*H+e*z+g*R;this.n12=c*M+d*v+e*E+g*S;this.n13=c*C+d*o+e*F+g*T;this.n14=c*D+d*K+e*Q+g*U;this.n21=f*J+h*H+k*z+i*R;this.n22=f*M+h*v+k*E+i*S;this.n23=f*C+h*o+k*F+i*T;this.n24=f*D+h*K+k*Q+i*U;this.n31=j*J+l*H+n*z+m*R;this.n32=j*M+l*v+n*E+m*S;this.n33=j*C+l*o+n*F+m*T;this.n34=j*D+l*K+n*Q+m*U;this.n41=p*J+q*H+s*z+r*R;this.n42=p*M+q*v+s*E+r*S;this.n43=p*C+q*o+s*F+r*T;this.n44=p*D+q*
-K+s*Q+r*U;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,g=this.n22,f=this.n23,h=this.n24,k=this.n31,i=this.n32,j=this.n33,l=this.n34,n=this.n41,m=this.n42,p=this.n43,q=this.n44;return d*f*i*n-c*h*i*n-d*g*j*n+b*h*j*n+c*g*l*n-b*f*l*n-d*f*k*m+c*h*k*m+d*e*j*m-a*h*j*m-c*e*l*m+a*f*l*m+d*g*k*p-b*h*k*p-d*e*i*p+a*h*i*p+b*e*l*p-a*g*l*p-c*g*k*q+b*f*k*q+c*e*i*q-a*f*i*q-b*e*j*q+a*g*j*q},
-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,g=a.x,f=a.y,h=a.z,k=e*g,i=e*f;this.set(k*g+c,k*f-d*h,k*h+d*f,0,k*f+d*h,i*f+c,i*h-d*g,0,k*h-d*f,i*h+d*g,e*h*h+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},getPosition:function(){if(!this.position)this.position=new THREE.Vector3;this.position.set(this.n14,this.n24,this.n34);return this.position},getColumnX:function(){if(!this.columnX)this.columnX=
-new THREE.Vector3;this.columnX.set(this.n11,this.n21,this.n31);return this.columnX},getColumnY:function(){if(!this.columnY)this.columnY=new THREE.Vector3;this.columnY.set(this.n12,this.n22,this.n32);return this.columnY},getColumnZ:function(){if(!this.columnZ)this.columnZ=new THREE.Vector3;this.columnZ.set(this.n13,this.n23,this.n33);return this.columnZ},setRotationFromEuler:function(a,b){var c=a.x,d=a.y,e=a.z,g=Math.cos(c),c=Math.sin(c),f=Math.cos(d),d=Math.sin(d),h=Math.cos(e),e=Math.sin(e);switch(b){case "YXZ":var k=
-f*h,i=f*e,j=d*h,l=d*e;this.n11=k+l*c;this.n12=j*c-i;this.n13=g*d;this.n21=g*e;this.n22=g*h;this.n23=-c;this.n31=i*c-j;this.n32=l+k*c;this.n33=g*f;break;case "ZXY":k=f*h;i=f*e;j=d*h;l=d*e;this.n11=k-l*c;this.n12=-g*e;this.n13=j+i*c;this.n21=i+j*c;this.n22=g*h;this.n23=l-k*c;this.n31=-g*d;this.n32=c;this.n33=g*f;break;case "ZYX":k=g*h;i=g*e;j=c*h;l=c*e;this.n11=f*h;this.n12=j*d-i;this.n13=k*d+l;this.n21=f*e;this.n22=l*d+k;this.n23=i*d-j;this.n31=-d;this.n32=c*f;this.n33=g*f;break;case "YZX":k=g*f;i=
-g*d;j=c*f;l=c*d;this.n11=f*h;this.n12=l-k*e;this.n13=j*e+i;this.n21=e;this.n22=g*h;this.n23=-c*h;this.n31=-d*h;this.n32=i*e+j;this.n33=k-l*e;break;case "XZY":k=g*f;i=g*d;j=c*f;l=c*d;this.n11=f*h;this.n12=-e;this.n13=d*h;this.n21=k*e+l;this.n22=g*h;this.n23=i*e-j;this.n31=j*e-i;this.n32=c*h;this.n33=l*e+k;break;default:k=g*h,i=g*e,j=c*h,l=c*e,this.n11=f*h,this.n12=-f*e,this.n13=d,this.n21=i+j*d,this.n22=k-l*d,this.n23=-c*f,this.n31=l-k*d,this.n32=j+i*d,this.n33=g*f}return this},setRotationFromQuaternion:function(a){var b=
-a.x,c=a.y,d=a.z,e=a.w,g=b+b,f=c+c,h=d+d,a=b*g,k=b*f;b*=h;var i=c*f;c*=h;d*=h;g*=e;f*=e;e*=h;this.n11=1-(i+d);this.n12=k-e;this.n13=b+f;this.n21=k+e;this.n22=1-(a+d);this.n23=c-g;this.n31=b-f;this.n32=c+g;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},compose:function(a,b,c){var d=THREE.Matrix4.__m1,e=THREE.Matrix4.__m2;
-d.identity();d.setRotationFromQuaternion(b);e.setScale(c.x,c.y,c.z);this.multiply(d,e);this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},decompose:function(a,b,c){var d=THREE.Matrix4.__v1,e=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;d.set(this.n11,this.n21,this.n31);e.set(this.n12,this.n22,this.n32);g.set(this.n13,this.n23,this.n33);a=a instanceof THREE.Vector3?a:new THREE.Vector3;b=b instanceof THREE.Quaternion?b:new THREE.Quaternion;c=c instanceof THREE.Vector3?c:new THREE.Vector3;c.x=d.length();
-c.y=e.length();c.z=g.length();a.x=this.n14;a.y=this.n24;a.z=this.n34;d=THREE.Matrix4.__m1;d.copy(this);d.n11/=c.x;d.n21/=c.x;d.n31/=c.x;d.n12/=c.y;d.n22/=c.y;d.n32/=c.y;d.n13/=c.z;d.n23/=c.z;d.n33/=c.z;b.setFromRotationMatrix(d);return[a,b,c]},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,g=a.n14,f=a.n21,h=a.n22,k=a.n23,i=a.n24,j=a.n31,l=a.n32,n=a.n33,m=a.n34,p=a.n41,q=a.n42,s=a.n43,r=a.n44;b===void 0&&(b=new THREE.Matrix4);b.n11=k*m*q-i*n*q+i*l*s-h*m*s-k*l*r+h*n*r;b.n12=g*n*q-e*m*q-g*l*s+d*m*s+e*l*r-d*n*r;b.n13=e*i*q-g*k*q+g*h*s-d*i*s-e*h*r+d*k*r;b.n14=g*k*l-e*i*l-g*h*n+d*i*n+e*h*m-d*k*m;b.n21=i*n*p-k*m*p-i*j*s+f*m*s+k*j*r-f*n*r;b.n22=e*m*p-g*n*p+g*j*s-c*m*s-e*j*r+c*n*r;b.n23=g*k*p-e*i*p-g*f*s+c*i*s+e*f*r-c*k*r;b.n24=
-e*i*j-g*k*j+g*f*n-c*i*n-e*f*m+c*k*m;b.n31=h*m*p-i*l*p+i*j*q-f*m*q-h*j*r+f*l*r;b.n32=g*l*p-d*m*p-g*j*q+c*m*q+d*j*r-c*l*r;b.n33=e*i*p-g*h*p+g*f*q-c*i*q-d*f*r+c*h*r;b.n34=g*h*j-d*i*j-g*f*l+c*i*l+d*f*m-c*h*m;b.n41=k*l*p-h*n*p-k*j*q+f*n*q+h*j*s-f*l*s;b.n42=d*n*p-e*l*p+e*j*q-c*n*q-d*j*s+c*l*s;b.n43=e*h*p-d*k*p-e*f*q+c*k*q+d*f*s-c*h*s;b.n44=d*k*j-e*h*j+e*f*l-c*k*l-d*f*n+c*h*n;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,g=a.n32*a.n21-a.n31*a.n22,f=-a.n33*a.n12+a.n32*a.n13,h=a.n33*a.n11-a.n31*a.n13,k=-a.n32*a.n11+a.n31*a.n12,i=a.n23*a.n12-a.n22*a.n13,j=-a.n23*a.n11+a.n21*a.n13,l=a.n22*a.n11-a.n21*a.n12,a=a.n11*d+a.n21*f+a.n31*i;a==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");a=1/a;c[0]=a*d;c[1]=a*e;c[2]=a*g;c[3]=a*f;c[4]=a*h;c[5]=a*k;c[6]=a*i;c[7]=a*j;c[8]=a*l;return b};
+THREE.Matrix4=function(a,b,c,d,e,g,f,h,k,l,i,j,n,m,p,q){this.set(a!==void 0?a:1,b||0,c||0,d||0,e||0,g!==void 0?g:1,f||0,h||0,k||0,l||0,i!==void 0?i:1,j||0,n||0,m||0,p||0,q!==void 0?q:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
+THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,e,g,f,h,k,l,i,j,n,m,p,q){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=e;this.n22=g;this.n23=f;this.n24=h;this.n31=k;this.n32=l;this.n33=i;this.n34=j;this.n41=n;this.n42=m;this.n43=p;this.n44=q;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,g=THREE.Matrix4.__v3;g.sub(a,b).normalize();if(g.length()===0)g.z=1;d.cross(c,g).normalize();d.length()===0&&(g.x+=1.0E-4,d.cross(c,g).normalize());e.cross(g,d).normalize();this.n11=d.x;this.n12=e.x;this.n13=g.x;this.n21=d.y;this.n22=e.y;this.n23=g.y;this.n31=d.z;this.n32=e.z;this.n33=g.z;return this},multiply:function(a,b){var c=a.n11,d=a.n12,e=a.n13,g=a.n14,f=a.n21,h=a.n22,k=a.n23,l=a.n24,i=a.n31,j=a.n32,n=a.n33,m=a.n34,p=a.n41,q=a.n42,s=a.n43,
+x=a.n44,v=b.n11,o=b.n12,I=b.n13,B=b.n14,F=b.n21,G=b.n22,E=b.n23,z=b.n24,L=b.n31,M=b.n32,N=b.n33,H=b.n34,C=b.n41,u=b.n42,A=b.n43,r=b.n44;this.n11=c*v+d*F+e*L+g*C;this.n12=c*o+d*G+e*M+g*u;this.n13=c*I+d*E+e*N+g*A;this.n14=c*B+d*z+e*H+g*r;this.n21=f*v+h*F+k*L+l*C;this.n22=f*o+h*G+k*M+l*u;this.n23=f*I+h*E+k*N+l*A;this.n24=f*B+h*z+k*H+l*r;this.n31=i*v+j*F+n*L+m*C;this.n32=i*o+j*G+n*M+m*u;this.n33=i*I+j*E+n*N+m*A;this.n34=i*B+j*z+n*H+m*r;this.n41=p*v+q*F+s*L+x*C;this.n42=p*o+q*G+s*M+x*u;this.n43=p*I+q*
+E+s*N+x*A;this.n44=p*B+q*z+s*H+x*r;return this},multiplySelf:function(a){return this.multiply(this,a)},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},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},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},determinant:function(){var a=this.n11,b=this.n12,c=this.n13,d=this.n14,e=this.n21,g=this.n22,f=this.n23,h=this.n24,k=this.n31,l=this.n32,i=this.n33,j=this.n34,n=this.n41,m=this.n42,p=this.n43,q=this.n44;return d*f*l*n-c*h*l*n-d*g*i*n+b*h*i*n+c*g*j*n-b*f*j*n-d*f*k*m+c*h*k*m+d*e*i*m-a*h*i*m-c*e*j*m+a*f*j*m+d*g*k*p-b*h*k*p-d*e*l*p+a*h*l*p+b*e*j*p-a*g*j*p-c*g*k*q+b*f*k*q+c*e*l*q-a*f*l*q-b*e*i*q+a*g*i*q},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,g=a.x,f=a.y,h=a.z,k=e*g,l=e*f;this.set(k*g+c,k*f-d*h,k*h+d*f,0,k*f+d*h,l*f+c,l*h-d*g,0,k*h-d*f,l*h+d*g,e*h*h+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},getPosition:function(){return THREE.Matrix4.__v1.set(this.n14,this.n24,this.n34)},getColumnX:function(){return THREE.Matrix4.__v1.set(this.n11,this.n21,this.n31)},getColumnY:function(){return THREE.Matrix4.__v1.set(this.n12,
+this.n22,this.n32)},getColumnZ:function(){return THREE.Matrix4.__v1.set(this.n13,this.n23,this.n33)},getInverse:function(a){var b=a.n11,c=a.n12,d=a.n13,e=a.n14,g=a.n21,f=a.n22,h=a.n23,k=a.n24,l=a.n31,i=a.n32,j=a.n33,n=a.n34,m=a.n41,p=a.n42,q=a.n43,s=a.n44;this.n11=h*n*p-k*j*p+k*i*q-f*n*q-h*i*s+f*j*s;this.n12=e*j*p-d*n*p-e*i*q+c*n*q+d*i*s-c*j*s;this.n13=d*k*p-e*h*p+e*f*q-c*k*q-d*f*s+c*h*s;this.n14=e*h*i-d*k*i-e*f*j+c*k*j+d*f*n-c*h*n;this.n21=k*j*m-h*n*m-k*l*q+g*n*q+h*l*s-g*j*s;this.n22=d*n*m-e*j*m+
+e*l*q-b*n*q-d*l*s+b*j*s;this.n23=e*h*m-d*k*m-e*g*q+b*k*q+d*g*s-b*h*s;this.n24=d*k*l-e*h*l+e*g*j-b*k*j-d*g*n+b*h*n;this.n31=f*n*m-k*i*m+k*l*p-g*n*p-f*l*s+g*i*s;this.n32=e*i*m-c*n*m-e*l*p+b*n*p+c*l*s-b*i*s;this.n33=d*k*m-e*f*m+e*g*p-b*k*p-c*g*s+b*f*s;this.n34=e*f*l-c*k*l-e*g*i+b*k*i+c*g*n-b*f*n;this.n41=h*i*m-f*j*m-h*l*p+g*j*p+f*l*q-g*i*q;this.n42=c*j*m-d*i*m+d*l*p-b*j*p-c*l*q+b*i*q;this.n43=d*f*m-c*h*m-d*g*p+b*h*p+c*g*q-b*f*q;this.n44=c*h*l-d*f*l+d*g*i-b*h*i-c*g*j+b*f*j;this.multiplyScalar(1/a.determinant());
+return this},setRotationFromEuler:function(a,b){var c=a.x,d=a.y,e=a.z,g=Math.cos(c),c=Math.sin(c),f=Math.cos(d),d=Math.sin(d),h=Math.cos(e),e=Math.sin(e);switch(b){case "YXZ":var k=f*h,l=f*e,i=d*h,j=d*e;this.n11=k+j*c;this.n12=i*c-l;this.n13=g*d;this.n21=g*e;this.n22=g*h;this.n23=-c;this.n31=l*c-i;this.n32=j+k*c;this.n33=g*f;break;case "ZXY":k=f*h;l=f*e;i=d*h;j=d*e;this.n11=k-j*c;this.n12=-g*e;this.n13=i+l*c;this.n21=l+i*c;this.n22=g*h;this.n23=j-k*c;this.n31=-g*d;this.n32=c;this.n33=g*f;break;case "ZYX":k=
+g*h;l=g*e;i=c*h;j=c*e;this.n11=f*h;this.n12=i*d-l;this.n13=k*d+j;this.n21=f*e;this.n22=j*d+k;this.n23=l*d-i;this.n31=-d;this.n32=c*f;this.n33=g*f;break;case "YZX":k=g*f;l=g*d;i=c*f;j=c*d;this.n11=f*h;this.n12=j-k*e;this.n13=i*e+l;this.n21=e;this.n22=g*h;this.n23=-c*h;this.n31=-d*h;this.n32=l*e+i;this.n33=k-j*e;break;case "XZY":k=g*f;l=g*d;i=c*f;j=c*d;this.n11=f*h;this.n12=-e;this.n13=d*h;this.n21=k*e+j;this.n22=g*h;this.n23=l*e-i;this.n31=i*e-l;this.n32=c*h;this.n33=j*e+k;break;default:k=g*h,l=g*
+e,i=c*h,j=c*e,this.n11=f*h,this.n12=-f*e,this.n13=d,this.n21=l+i*d,this.n22=k-j*d,this.n23=-c*f,this.n31=j-k*d,this.n32=i+l*d,this.n33=g*f}return this},setRotationFromQuaternion:function(a){var b=a.x,c=a.y,d=a.z,e=a.w,g=b+b,f=c+c,h=d+d,a=b*g,k=b*f;b*=h;var l=c*f;c*=h;d*=h;g*=e;f*=e;e*=h;this.n11=1-(l+d);this.n12=k-e;this.n13=b+f;this.n21=k+e;this.n22=1-(a+d);this.n23=c-g;this.n31=b-f;this.n32=c+g;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},compose:function(a,b,c){var d=THREE.Matrix4.__m1,e=THREE.Matrix4.__m2;d.identity();d.setRotationFromQuaternion(b);e.setScale(c.x,c.y,c.z);this.multiply(d,e);this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},decompose:function(a,b,c){var d=THREE.Matrix4.__v1,e=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;d.set(this.n11,this.n21,this.n31);e.set(this.n12,this.n22,this.n32);g.set(this.n13,
+this.n23,this.n33);a=a instanceof THREE.Vector3?a:new THREE.Vector3;b=b instanceof THREE.Quaternion?b:new THREE.Quaternion;c=c instanceof THREE.Vector3?c:new THREE.Vector3;c.x=d.length();c.y=e.length();c.z=g.length();a.x=this.n14;a.y=this.n24;a.z=this.n34;d=THREE.Matrix4.__m1;d.copy(this);d.n11/=c.x;d.n21/=c.x;d.n31/=c.x;d.n12/=c.y;d.n22/=c.y;d.n32/=c.y;d.n13/=c.z;d.n23/=c.z;d.n33/=c.z;b.setFromRotationMatrix(d);return[a,b,c]},extractPosition:function(a){this.n14=a.n14;this.n24=a.n24;this.n34=a.n34;
+return this},extractRotation:function(a){var b=THREE.Matrix4.__v1,c=1/b.set(a.n11,a.n21,a.n31).length(),d=1/b.set(a.n12,a.n22,a.n32).length(),b=1/b.set(a.n13,a.n23,a.n33).length();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*b;this.n23=a.n23*b;this.n33=a.n33*b;return this}};
+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,g=a.n32*a.n21-a.n31*a.n22,f=-a.n33*a.n12+a.n32*a.n13,h=a.n33*a.n11-a.n31*a.n13,k=-a.n32*a.n11+a.n31*a.n12,l=a.n23*a.n12-a.n22*a.n13,i=-a.n23*a.n11+a.n21*a.n13,j=a.n22*a.n11-a.n21*a.n12,a=a.n11*d+a.n21*f+a.n31*l;a==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");a=1/a;c[0]=a*d;c[1]=a*e;c[2]=a*g;c[3]=a*f;c[4]=a*h;c[5]=a*k;c[6]=a*l;c[7]=a*i;c[8]=a*j;return b};
 THREE.Matrix4.makeFrustum=function(a,b,c,d,e,g){var f;f=new THREE.Matrix4;f.n11=2*e/(b-a);f.n12=0;f.n13=(b+a)/(b-a);f.n14=0;f.n21=0;f.n22=2*e/(d-c);f.n23=(d+c)/(d-c);f.n24=0;f.n31=0;f.n32=0;f.n33=-(g+e)/(g-e);f.n34=-2*g*e/(g-e);f.n41=0;f.n42=0;f.n43=-1;f.n44=0;return f};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,g){var f,h,k,i;f=new THREE.Matrix4;h=b-a;k=c-d;i=g-e;f.n11=2/h;f.n12=0;f.n13=0;f.n14=-((b+a)/h);f.n21=0;f.n22=2/k;f.n23=0;f.n24=-((c+d)/k);f.n31=0;f.n32=0;f.n33=-2/i;f.n34=-((g+e)/i);f.n41=0;f.n42=0;f.n43=0;f.n44=1;return f};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
+THREE.Matrix4.makeOrtho=function(a,b,c,d,e,g){var f,h,k,l;f=new THREE.Matrix4;h=b-a;k=c-d;l=g-e;f.n11=2/h;f.n12=0;f.n13=0;f.n14=-((b+a)/h);f.n21=0;f.n22=2/k;f.n23=0;f.n24=-((c+d)/k);f.n31=0;f.n32=0;f.n33=-2/l;f.n34=-((g+e)/l);f.n41=0;f.n42=0;f.n43=0;f.n44=1;return f};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
 THREE.Object3D=function(){this.name="";this.id=THREE.Object3DCount++;this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder="XYZ";this.scale=new THREE.Vector3(1,1,1);this.flipSided=this.doubleSided=this.dynamic=!1;this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=
 !0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=!0;this.receiveShadow=this.castShadow=!1;this.frustumCulled=!0;this._vector=new THREE.Vector3};
 THREE.Object3D.prototype={constructor:THREE.Object3D,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(a,this.position,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},add:function(a){if(this.children.indexOf(a)===
--1){a.parent!==void 0&&a.parent.remove(a);a.parent=this;this.children.push(a);for(var b=this;b.parent!==void 0;)b=b.parent;b!==void 0&&b instanceof THREE.Scene&&b.addChildRecurse(a)}},remove:function(a){var b=this,c=this.children.indexOf(a);if(c!==-1){a.parent=void 0;for(this.children.splice(c,1);b.parent!==void 0;)b=b.parent;b!==void 0&&b instanceof THREE.Scene&&b.removeChildRecurse(a)}},getChildByName:function(a,b){var c,d,e;c=0;for(d=this.children.length;c<d;c++){e=this.children[c];if(e.name===
-a)return e;if(b&&(e=e.getChildByName(a,b),e!==void 0))return e}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder);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){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;for(var a=0,d=this.children.length;a<d;a++)this.children[a].update(this.matrixWorld,b,c)},addChild:function(a){console.warn("DEPRECATED: Object3D.addChild() is now Object3D.add().");this.add(a)},removeChild:function(a){console.warn("DEPRECATED: Object3D.removeChild() is now Object3D.remove().");
-this.remove(a)}};THREE.Object3DCount=0;
-THREE.Projector=function(){function a(){var a=k[h]=k[h]||new THREE.RenderableVertex;h++;return a}function b(a,b){return b.z-a.z}function c(a,b){var c=0,d=1,e=a.z+a.w,f=b.z+b.w,g=-a.z+a.w,h=-b.z+b.w;return e>=0&&f>=0&&g>=0&&h>=0?!0:e<0&&f<0||g<0&&h<0?!1:(e<0?c=Math.max(c,e/(e-f)):f<0&&(d=Math.min(d,e/(e-f))),g<0?c=Math.max(c,g/(g-h)):h<0&&(d=Math.min(d,g/(g-h))),d<c?!1:(a.lerpSelf(b,c),b.lerpSelf(a,1-d),!0))}var d,e,g=[],f,h,k=[],i,j,l=[],n,m=[],p,q,s=[],r,J,M=[],C=[],D=[],H=new THREE.Vector4,v=new THREE.Vector4,
-o=new THREE.Matrix4,K=new THREE.Matrix4,z=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],E=new THREE.Vector4,F=new THREE.Vector4;this.projectVector=function(a,b){o.multiply(b.projectionMatrix,b.matrixWorldInverse);o.multiplyVector3(a);return a};this.unprojectVector=function(a,b){o.multiply(b.matrixWorld,THREE.Matrix4.makeInvert(b.projectionMatrix));o.multiplyVector3(a);return a};this.pickingRay=function(a,b){var c;a.z=-1;c=new THREE.Vector3(a.x,
-a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.subSelf(a).normalize();return new THREE.Ray(a,c)};this.projectObjects=function(a,c,f){var h,i;e=C.length=0;h=a.objects;a=0;for(c=h.length;a<c;a++){i=h[a];var j;if(!(j=!i.visible))if(j=i instanceof THREE.Mesh)if(j=i.frustumCulled){a:{j=void 0;for(var k=i.matrixWorld,l=-i.geometry.boundingSphere.radius*Math.max(i.scale.x,Math.max(i.scale.y,i.scale.z)),m=0;m<6;m++)if(j=z[m].x*k.n14+z[m].y*k.n24+z[m].z*k.n34+z[m].w,j<=l){j=!1;break a}j=!0}j=
-!j}if(!j)j=g[e]=g[e]||new THREE.RenderableObject,e++,d=j,H.copy(i.position),o.multiplyVector3(H),d.object=i,d.z=H.z,C.push(d)}f&&C.sort(b);return C};this.projectScene=function(d,e,g){var C=e.near,H=e.far,O,I,x,B,t,y,w,A,G,u,L,V,X,Y,N,W,P;J=q=n=j=D.length=0;e.matrixAutoUpdate&&e.update(void 0,!0);d.update(void 0,!1,e);o.multiply(e.projectionMatrix,e.matrixWorldInverse);z[0].set(o.n41-o.n11,o.n42-o.n12,o.n43-o.n13,o.n44-o.n14);z[1].set(o.n41+o.n11,o.n42+o.n12,o.n43+o.n13,o.n44+o.n14);z[2].set(o.n41+
-o.n21,o.n42+o.n22,o.n43+o.n23,o.n44+o.n24);z[3].set(o.n41-o.n21,o.n42-o.n22,o.n43-o.n23,o.n44-o.n24);z[4].set(o.n41-o.n31,o.n42-o.n32,o.n43-o.n33,o.n44-o.n34);z[5].set(o.n41+o.n31,o.n42+o.n32,o.n43+o.n33,o.n44+o.n34);for(O=0;O<6;O++)G=z[O],G.divideScalar(Math.sqrt(G.x*G.x+G.y*G.y+G.z*G.z));G=this.projectObjects(d,e,!0);d=0;for(O=G.length;d<O;d++)if(u=G[d].object,u.visible)if(L=u.matrixWorld,V=u.matrixRotationWorld,X=u.materials,Y=u.overdraw,h=0,u instanceof THREE.Mesh){N=u.geometry;B=N.vertices;W=
-N.faces;N=N.faceVertexUvs;I=0;for(x=B.length;I<x;I++)f=a(),f.positionWorld.copy(B[I].position),L.multiplyVector3(f.positionWorld),f.positionScreen.copy(f.positionWorld),o.multiplyVector4(f.positionScreen),f.positionScreen.x/=f.positionScreen.w,f.positionScreen.y/=f.positionScreen.w,f.visible=f.positionScreen.z>C&&f.positionScreen.z<H;B=0;for(I=W.length;B<I;B++){x=W[B];if(x instanceof THREE.Face3)if(t=k[x.a],y=k[x.b],w=k[x.c],t.visible&&y.visible&&w.visible&&(u.doubleSided||u.flipSided!=(w.positionScreen.x-
-t.positionScreen.x)*(y.positionScreen.y-t.positionScreen.y)-(w.positionScreen.y-t.positionScreen.y)*(y.positionScreen.x-t.positionScreen.x)<0))A=l[j]=l[j]||new THREE.RenderableFace3,j++,i=A,i.v1.copy(t),i.v2.copy(y),i.v3.copy(w);else continue;else if(x instanceof THREE.Face4)if(t=k[x.a],y=k[x.b],w=k[x.c],A=k[x.d],t.visible&&y.visible&&w.visible&&A.visible&&(u.doubleSided||u.flipSided!=((A.positionScreen.x-t.positionScreen.x)*(y.positionScreen.y-t.positionScreen.y)-(A.positionScreen.y-t.positionScreen.y)*
-(y.positionScreen.x-t.positionScreen.x)<0||(y.positionScreen.x-w.positionScreen.x)*(A.positionScreen.y-w.positionScreen.y)-(y.positionScreen.y-w.positionScreen.y)*(A.positionScreen.x-w.positionScreen.x)<0)))P=m[n]=m[n]||new THREE.RenderableFace4,n++,i=P,i.v1.copy(t),i.v2.copy(y),i.v3.copy(w),i.v4.copy(A);else continue;i.normalWorld.copy(x.normal);V.multiplyVector3(i.normalWorld);i.centroidWorld.copy(x.centroid);L.multiplyVector3(i.centroidWorld);i.centroidScreen.copy(i.centroidWorld);o.multiplyVector3(i.centroidScreen);
-w=x.vertexNormals;t=0;for(y=w.length;t<y;t++)A=i.vertexNormalsWorld[t],A.copy(w[t]),V.multiplyVector3(A);t=0;for(y=N.length;t<y;t++)if(P=N[t][B]){w=0;for(A=P.length;w<A;w++)i.uvs[t][w]=P[w]}i.meshMaterials=X;i.faceMaterials=x.materials;i.overdraw=Y;i.z=i.centroidScreen.z;D.push(i)}}else if(u instanceof THREE.Line){K.multiply(o,L);B=u.geometry.vertices;t=a();t.positionScreen.copy(B[0].position);K.multiplyVector4(t.positionScreen);I=1;for(x=B.length;I<x;I++)if(t=a(),t.positionScreen.copy(B[I].position),
-K.multiplyVector4(t.positionScreen),y=k[h-2],E.copy(t.positionScreen),F.copy(y.positionScreen),c(E,F))E.multiplyScalar(1/E.w),F.multiplyScalar(1/F.w),L=s[q]=s[q]||new THREE.RenderableLine,q++,p=L,p.v1.positionScreen.copy(E),p.v2.positionScreen.copy(F),p.z=Math.max(E.z,F.z),p.materials=u.materials,D.push(p)}else if(u instanceof THREE.Particle&&(v.set(u.matrixWorld.n14,u.matrixWorld.n24,u.matrixWorld.n34,1),o.multiplyVector4(v),v.z/=v.w,v.z>0&&v.z<1))L=M[J]=M[J]||new THREE.RenderableParticle,J++,r=
-L,r.x=v.x/v.w,r.y=v.y/v.w,r.z=v.z,r.rotation=u.rotation.z,r.scale.x=u.scale.x*Math.abs(r.x-(v.x+e.projectionMatrix.n11)/(v.w+e.projectionMatrix.n14)),r.scale.y=u.scale.y*Math.abs(r.y-(v.y+e.projectionMatrix.n22)/(v.w+e.projectionMatrix.n24)),r.materials=u.materials,D.push(r);g&&D.sort(b);return D}};THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,d!==void 0?d:1)};
+-1)a.parent!==void 0&&a.parent.remove(a),a.parent=this,this.children.push(a)},remove:function(a){var b=this.children.indexOf(a);if(b!==-1)a.parent=void 0,this.children.splice(b,1)},getChildByName:function(a,b){var c,d,e;c=0;for(d=this.children.length;c<d;c++){e=this.children[c];if(e.name===a)return e;if(b&&(e=e.getChildByName(a,b),e!==void 0))return e}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,
+this.eulerOrder);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},updateMatrixWorld:function(a){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||a)this.parent?this.matrixWorld.multiply(this.parent.matrixWorld,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,a=!0;for(var b=0,c=this.children.length;b<
+c;b++)this.children[b].updateMatrixWorld(a)}};THREE.Object3DCount=0;
+THREE.Projector=function(){function a(){var a=g[e]=g[e]||new THREE.RenderableVertex;e++;return a}function b(a,b){return b.z-a.z}function c(a,b){var c=0,d=1,f=a.z+a.w,e=b.z+b.w,g=-a.z+a.w,h=-b.z+b.w;return f>=0&&e>=0&&g>=0&&h>=0?!0:f<0&&e<0||g<0&&h<0?!1:(f<0?c=Math.max(c,f/(f-e)):e<0&&(d=Math.min(d,f/(f-e))),g<0?c=Math.max(c,g/(g-h)):h<0&&(d=Math.min(d,g/(g-h))),d<c?!1:(a.lerpSelf(b,c),b.lerpSelf(a,1-d),!0))}var d,e,g=[],f,h,k=[],l,i=[],j,n,m=[],p,q,s=[],x={objects:[],lights:[],elements:[]};new THREE.Vector3;
+var v=new THREE.Vector4,o=new THREE.Matrix4,I=new THREE.Matrix4,B=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],F=new THREE.Vector4,G=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);o.multiply(b.projectionMatrix,b.matrixWorldInverse);o.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);o.multiply(b.matrixWorld,b.projectionMatrixInverse);
+o.multiplyVector3(a);return a};this.pickingRay=function(a,b){var c;a.z=-1;c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.subSelf(a).normalize();return new THREE.Ray(a,c)};this.projectGraph=function(a){x.objects.length=0;x.lights.length=0;var b=function(a){if(a.visible!=!1){var c;if(!(c=a instanceof THREE.Particle))if(!(c=a instanceof THREE.Line))if(c=a instanceof THREE.Mesh)if(!(c=!a.frustumCulled))a:{for(var d=a.matrixWorld,f=-a.geometry.boundingSphere.radius*
+Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)),e=0;e<6;e++)if(c=B[e].x*d.n14+B[e].y*d.n24+B[e].z*d.n34+B[e].w,c<=f){c=!1;break a}c=!0}c?x.objects.push(a):a instanceof THREE.Light&&x.lights.push(a);c=0;for(d=a.children.length;c<d;c++)b(a.children[c])}};b(a);return x};this.projectScene=function(E,z,L){var M=z.near,N=z.far,H,C,u,A,r,y,w,D,t,J,K,R,S,P,Q,O;q=n=l=h=0;x.elements.length=0;z.parent==null&&(console.warn("Camera is not on the Scene. Adding it..."),E.add(z));E.updateMatrixWorld();z.matrixWorldInverse.getInverse(z.matrixWorld);
+o.multiply(z.projectionMatrix,z.matrixWorldInverse);B[0].set(o.n41-o.n11,o.n42-o.n12,o.n43-o.n13,o.n44-o.n14);B[1].set(o.n41+o.n11,o.n42+o.n12,o.n43+o.n13,o.n44+o.n14);B[2].set(o.n41+o.n21,o.n42+o.n22,o.n43+o.n23,o.n44+o.n24);B[3].set(o.n41-o.n21,o.n42-o.n22,o.n43-o.n23,o.n44-o.n24);B[4].set(o.n41-o.n31,o.n42-o.n32,o.n43-o.n33,o.n44-o.n34);B[5].set(o.n41+o.n31,o.n42+o.n32,o.n43+o.n33,o.n44+o.n34);for(H=0;H<6;H++)t=B[H],t.divideScalar(Math.sqrt(t.x*t.x+t.y*t.y+t.z*t.z));x=this.projectGraph(E);E=0;
+for(H=x.objects.length;E<H;E++)if(t=x.objects[E],J=t.matrixWorld,R=t.materials,S=t.overdraw,e=0,t instanceof THREE.Mesh){K=t.geometry;A=K.vertices;P=K.faces;Q=K.faceVertexUvs;K=t.matrixRotationWorld.extractRotation(t.matrixWorld);C=0;for(u=A.length;C<u;C++)d=a(),d.positionWorld.copy(A[C].position),J.multiplyVector3(d.positionWorld),d.positionScreen.copy(d.positionWorld),o.multiplyVector4(d.positionScreen),d.positionScreen.x/=d.positionScreen.w,d.positionScreen.y/=d.positionScreen.w,d.visible=d.positionScreen.z>
+M&&d.positionScreen.z<N;A=0;for(C=P.length;A<C;A++){u=P[A];if(u instanceof THREE.Face3)if(r=g[u.a],y=g[u.b],w=g[u.c],r.visible&&y.visible&&w.visible&&(t.doubleSided||t.flipSided!=(w.positionScreen.x-r.positionScreen.x)*(y.positionScreen.y-r.positionScreen.y)-(w.positionScreen.y-r.positionScreen.y)*(y.positionScreen.x-r.positionScreen.x)<0))D=k[h]=k[h]||new THREE.RenderableFace3,h++,f=D,f.v1.copy(r),f.v2.copy(y),f.v3.copy(w);else continue;else if(u instanceof THREE.Face4)if(r=g[u.a],y=g[u.b],w=g[u.c],
+D=g[u.d],r.visible&&y.visible&&w.visible&&D.visible&&(t.doubleSided||t.flipSided!=((D.positionScreen.x-r.positionScreen.x)*(y.positionScreen.y-r.positionScreen.y)-(D.positionScreen.y-r.positionScreen.y)*(y.positionScreen.x-r.positionScreen.x)<0||(y.positionScreen.x-w.positionScreen.x)*(D.positionScreen.y-w.positionScreen.y)-(y.positionScreen.y-w.positionScreen.y)*(D.positionScreen.x-w.positionScreen.x)<0)))O=i[l]=i[l]||new THREE.RenderableFace4,l++,f=O,f.v1.copy(r),f.v2.copy(y),f.v3.copy(w),f.v4.copy(D);
+else continue;f.normalWorld.copy(u.normal);K.multiplyVector3(f.normalWorld);f.centroidWorld.copy(u.centroid);J.multiplyVector3(f.centroidWorld);f.centroidScreen.copy(f.centroidWorld);o.multiplyVector3(f.centroidScreen);w=u.vertexNormals;r=0;for(y=w.length;r<y;r++)D=f.vertexNormalsWorld[r],D.copy(w[r]),K.multiplyVector3(D);r=0;for(y=Q.length;r<y;r++)if(O=Q[r][A]){w=0;for(D=O.length;w<D;w++)f.uvs[r][w]=O[w]}f.meshMaterials=R;f.faceMaterials=u.materials;f.overdraw=S;f.z=f.centroidScreen.z;x.elements.push(f)}}else if(t instanceof
+THREE.Line){I.multiply(o,J);A=t.geometry.vertices;r=a();r.positionScreen.copy(A[0].position);I.multiplyVector4(r.positionScreen);C=1;for(u=A.length;C<u;C++)if(r=a(),r.positionScreen.copy(A[C].position),I.multiplyVector4(r.positionScreen),y=g[e-2],F.copy(r.positionScreen),G.copy(y.positionScreen),c(F,G))F.multiplyScalar(1/F.w),G.multiplyScalar(1/G.w),J=m[n]=m[n]||new THREE.RenderableLine,n++,j=J,j.v1.positionScreen.copy(F),j.v2.positionScreen.copy(G),j.z=Math.max(F.z,G.z),j.materials=t.materials,x.elements.push(j)}else if(t instanceof
+THREE.Particle&&(v.set(t.matrixWorld.n14,t.matrixWorld.n24,t.matrixWorld.n34,1),o.multiplyVector4(v),v.z/=v.w,v.z>0&&v.z<1))J=s[q]=s[q]||new THREE.RenderableParticle,q++,p=J,p.x=v.x/v.w,p.y=v.y/v.w,p.z=v.z,p.rotation=t.rotation.z,p.scale.x=t.scale.x*Math.abs(p.x-(v.x+z.projectionMatrix.n11)/(v.w+z.projectionMatrix.n14)),p.scale.y=t.scale.y*Math.abs(p.y-(v.y+z.projectionMatrix.n22)/(v.w+z.projectionMatrix.n24)),p.materials=t.materials,x.elements.push(p);L&&x.elements.sort(b);return x}};
+THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,d!==void 0?d:1)};
 THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this},setFromEuler:function(a){var b=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),g=Math.cos(c),c=Math.sin(c),f=a*b,h=d*e;this.w=f*g-h*c;this.x=f*c+h*g;this.y=d*b*g+a*e*c;this.z=a*e*g-d*b*c;return this},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);
 this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRotationMatrix:function(a){var b=Math.pow(a.determinant(),1/3);this.w=Math.sqrt(Math.max(0,b+a.n11+a.n22+a.n33))/2;this.x=Math.sqrt(Math.max(0,b+a.n11-a.n22-a.n33))/2;this.y=Math.sqrt(Math.max(0,b-a.n11+a.n22-a.n33))/2;this.z=Math.sqrt(Math.max(0,b-a.n11-a.n22+a.n33))/2;this.x=a.n32-a.n23<0?-Math.abs(this.x):Math.abs(this.x);this.y=a.n13-a.n31<0?-Math.abs(this.y):Math.abs(this.y);this.z=a.n21-a.n12<0?-Math.abs(this.z):Math.abs(this.z);
 this.normalize();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);a==0?this.w=this.z=this.y=this.x=0:(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,g=a.x,f=a.y,h=a.z,a=a.w;this.x=b*a+e*g+c*h-d*f;this.y=c*a+e*f+d*g-b*h;this.z=d*a+e*h+b*f-c*g;this.w=e*a-b*g-c*f-d*h;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,g=this.x,f=this.y,h=this.z,k=this.w,i=k*c+f*e-h*d,j=k*d+h*c-g*e,l=k*e+g*d-f*c,c=-g*
-c-f*d-h*e;b.x=i*k+c*-g+j*-h-l*-f;b.y=j*k+c*-f+l*-g-i*-h;b.z=l*k+c*-h+i*-f-j*-g;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)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var g=Math.acos(e),f=Math.sqrt(1-e*e);if(Math.abs(f)<0.0010)return 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),c;e=Math.sin((1-d)*g)/f;d=Math.sin(d*g)/f;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){this.position=a||new THREE.Vector3};THREE.Face3=function(a,b,c,d,e,g){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materials=g instanceof Array?g:[g];this.centroid=new THREE.Vector3};
+this.x,c=this.y,d=this.z,e=this.w,g=a.x,f=a.y,h=a.z,a=a.w;this.x=b*a+e*g+c*h-d*f;this.y=c*a+e*f+d*g-b*h;this.z=d*a+e*h+b*f-c*g;this.w=e*a-b*g-c*f-d*h;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,g=this.x,f=this.y,h=this.z,k=this.w,l=k*c+f*e-h*d,i=k*d+h*c-g*e,j=k*e+g*d-f*c,c=-g*
+c-f*d-h*e;b.x=l*k+c*-g+i*-h-j*-f;b.y=i*k+c*-f+j*-g-l*-h;b.z=j*k+c*-h+l*-f-i*-g;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;e<0?(c.w=-b.w,c.x=-b.x,c.y=-b.y,c.z=-b.z,e=-e):c.copy(b);if(Math.abs(e)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var g=Math.acos(e),e=Math.sqrt(1-e*e);if(Math.abs(e)<0.0010)return 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),c;b=Math.sin((1-d)*g)/e;d=Math.sin(d*g)/e;c.w=a.w*b+c.w*d;c.x=a.x*b+c.x*d;c.y=a.y*b+c.y*d;c.z=a.z*b+c.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
+THREE.Face3=function(a,b,c,d,e,g){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materials=g instanceof Array?g:[g];this.centroid=new THREE.Vector3};
 THREE.Face4=function(a,b,c,d,e,g,f){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materials=f instanceof Array?f:[f];this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.u=a||0;this.v=b||0};
 THREE.UV.prototype={constructor:THREE.UV,set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.u=a.u;this.v=a.v;return this},clone:function(){return new THREE.UV(this.u,this.v)}};
-THREE.Camera=function(){if(arguments.length)return console.warn("DEPRECATED: Camera() is now PerspectiveCamera() or OrthographicCamera()."),new THREE.PerspectiveCamera(arguments[0],arguments[1],arguments[2],arguments[3]);THREE.Object3D.call(this);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;
-THREE.Camera.prototype.lookAt=function(a){this.matrix.lookAt(this.position,a,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)};
-THREE.Camera.prototype.update=function(a,b,c){this.matrixAutoUpdate&&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.OrthographicCamera=function(a,b,c,d,e,g){THREE.Camera.call(this);this.left=a;this.right=b;this.top=c;this.bottom=d;this.near=e!==void 0?e:0.1;this.far=g!==void 0?g:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=new THREE.Camera;THREE.OrthographicCamera.prototype.constructor=THREE.OrthographicCamera;THREE.OrthographicCamera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makeOrtho(this.left,this.right,this.top,this.bottom,this.near,this.far)};
-THREE.PerspectiveCamera=function(a,b,c,d){THREE.Camera.call(this);this.fov=a!==void 0?a:50;this.aspect=b!==void 0?b:1;this.near=c!==void 0?c:0.1;this.far=d!==void 0?d:2E3;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype=new THREE.Camera;THREE.PerspectiveCamera.prototype.constructor=THREE.PerspectiveCamera;THREE.PerspectiveCamera.prototype.setLens=function(a,b){this.fov=2*Math.atan((b!==void 0?b:43.25)/(a*2));this.fov*=180/Math.PI;this.updateProjectionMatrix()};
-THREE.PerspectiveCamera.prototype.setViewOffset=function(a,b,c,d,e,g){this.fullWidth=a;this.fullHeight=b;this.x=c;this.y=d;this.width=e;this.height=g;this.updateProjectionMatrix()};
+THREE.Camera=function(){if(arguments.length)return console.warn("DEPRECATED: Camera() is now PerspectiveCamera() or OrthographicCamera()."),new THREE.PerspectiveCamera(arguments[0],arguments[1],arguments[2],arguments[3]);THREE.Object3D.call(this);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4;this.projectionMatrixInverse=new THREE.Matrix4};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;
+THREE.Camera.prototype.lookAt=function(a){this.matrix.lookAt(this.position,a,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)};THREE.OrthographicCamera=function(a,b,c,d,e,g){THREE.Camera.call(this);this.left=a;this.right=b;this.top=c;this.bottom=d;this.near=e!==void 0?e:0.1;this.far=g!==void 0?g:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=new THREE.Camera;THREE.OrthographicCamera.prototype.constructor=THREE.OrthographicCamera;
+THREE.OrthographicCamera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makeOrtho(this.left,this.right,this.top,this.bottom,this.near,this.far)};THREE.PerspectiveCamera=function(a,b,c,d){THREE.Camera.call(this);this.fov=a!==void 0?a:50;this.aspect=b!==void 0?b:1;this.near=c!==void 0?c:0.1;this.far=d!==void 0?d:2E3;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype=new THREE.Camera;THREE.PerspectiveCamera.prototype.constructor=THREE.PerspectiveCamera;
+THREE.PerspectiveCamera.prototype.setLens=function(a,b){this.fov=2*Math.atan((b!==void 0?b:43.25)/(a*2));this.fov*=180/Math.PI;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype.setViewOffset=function(a,b,c,d,e,g){this.fullWidth=a;this.fullHeight=b;this.x=c;this.y=d;this.width=e;this.height=g;this.updateProjectionMatrix()};
 THREE.PerspectiveCamera.prototype.updateProjectionMatrix=function(){if(this.fullWidth){var a=this.fullWidth/this.fullHeight,b=Math.tan(this.fov*Math.PI/360)*this.near,c=-b,d=a*c,a=Math.abs(a*b-d),c=Math.abs(b-c);this.projectionMatrix=THREE.Matrix4.makeFrustum(d+this.x*a/this.fullWidth,d+(this.x+this.width)*a/this.fullWidth,b-(this.y+this.height)*c/this.fullHeight,b-this.y*c/this.fullHeight,this.near,this.far)}else this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,
 this.far)};THREE.ParticleDOMMaterial=function(a){THREE.Material.call(this);this.domElement=a};THREE.Particle=function(a){THREE.Object3D.call(this);this.materials=a instanceof Array?a:[a]};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,
-b,c)};THREE.Bone.prototype.addChild=function(a){if(this.children.indexOf(a)===-1&&(a.parent!==void 0&&a.parent.removeChild(a),a.parent=this,this.children.push(a),!(a instanceof THREE.Bone)))this.hasNoneBoneChildren=!0};THREE.Scene=function(){THREE.Object3D.call(this);this.fog=null;this.matrixAutoUpdate=!1;this.collisions=this.overrideMaterial=null;this.objects=[];this.lights=[];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.add=function(a){this.supr.add.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.Camera||a instanceof THREE.Bone)&&this.objects.indexOf(a)===-1){this.objects.push(a);this.__objectsAdded.push(a);var b=this.__objectsRemoved.indexOf(a);b!==-1&&this.__objectsRemoved.splice(b,1)}for(b=0;b<a.children.length;b++)this.addChildRecurse(a.children[b])};THREE.Scene.prototype.remove=function(a){this.supr.remove.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 a instanceof THREE.Camera||(b=this.objects.indexOf(a),b!==-1&&(this.objects.splice(b,1),this.__objectsRemoved.push(a),b=this.__objectsAdded.indexOf(a),b!==-1&&this.__objectsAdded.splice(b,1)));for(b=0;b<a.children.length;b++)this.removeChildRecurse(a.children[b])};
-THREE.Scene.prototype.addChild=function(a){console.warn("DEPRECATED: Scene.addChild() is now Scene.add().");this.add(a)};THREE.Scene.prototype.addObject=function(a){console.warn("DEPRECATED: Scene.addObject() is now Scene.add().");this.add(a)};THREE.Scene.prototype.addLight=function(a){console.warn("DEPRECATED: Scene.addLight() is now Scene.add().");this.add(a)};THREE.Scene.prototype.removeChild=function(a){console.warn("DEPRECATED: Scene.removeChild() is now Scene.remove().");this.remove(a)};
-THREE.Scene.prototype.removeObject=function(a){console.warn("DEPRECATED: Scene.removeObject() is now Scene.remove().");this.remove(a)};THREE.Scene.prototype.removeLight=function(a){console.warn("DEPRECATED: Scene.removeLight() is now Scene.remove().");this.remove(a)};
-THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,b=new THREE.Projector,c,d,e,g;this.domElement=document.createElement("div");this.setSize=function(a,b){c=a;d=b;e=c/2;g=d/2};this.render=function(c,d){var k,i,j,l,n,m,p,q;a=b.projectScene(c,d);k=0;for(i=a.length;k<i;k++)if(n=a[k],n instanceof THREE.RenderableParticle){p=n.x*e+e;q=n.y*g+g;j=0;for(l=n.material.length;j<l;j++)if(m=n.material[j],m instanceof THREE.ParticleDOMMaterial)m=m.domElement,m.style.left=p+"px",m.style.top=q+"px"}}};
+b,c)};THREE.Bone.prototype.addChild=function(a){if(this.children.indexOf(a)===-1&&(a.parent!==void 0&&a.parent.removeChild(a),a.parent=this,this.children.push(a),!(a instanceof THREE.Bone)))this.hasNoneBoneChildren=!0};THREE.Scene=function(){THREE.Object3D.call(this);this.overrideMaterial=this.fog=null;this.matrixAutoUpdate=!1};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;
+THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,b=new THREE.Projector,c,d,e,g;this.domElement=document.createElement("div");this.setSize=function(a,b){c=a;d=b;e=c/2;g=d/2};this.render=function(c,d){var k,l,i,j,n,m,p,q;a=b.projectScene(c,d);k=0;for(l=a.length;k<l;k++)if(n=a[k],n instanceof THREE.RenderableParticle){p=n.x*e+e;q=n.y*g+g;i=0;for(j=n.material.length;i<j;i++)if(m=n.material[i],m instanceof THREE.ParticleDOMMaterial)m=m.domElement,m.style.left=p+"px",m.style.top=q+"px"}}};
 THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.materials=null};

+ 297 - 299
build/custom/ThreeExtras.js

@@ -1,19 +1,19 @@
 // ThreeExtras.js r46dev - http://github.com/mrdoob/three.js
-THREE.ColorUtils={adjustHSV:function(a,b,c,e){var f=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(a,f);f.h=THREE.ColorUtils.clamp(f.h+b,0,1);f.s=THREE.ColorUtils.clamp(f.s+c,0,1);f.v=THREE.ColorUtils.clamp(f.v+e,0,1);a.setHSV(f.h,f.s,f.v)},rgbToHsv:function(a,b){var c=a.r,e=a.g,f=a.b,h=Math.max(Math.max(c,e),f),g=Math.min(Math.min(c,e),f);if(g==h)g=c=0;else{var k=h-g,g=k/h,c=c==h?(e-f)/k:e==h?2+(f-c)/k:4+(c-e)/k;c/=6;c<0&&(c+=1);c>1&&(c-=1)}b===void 0&&(b={h:0,s:0,v:0});b.h=c;b.s=g;b.v=h;return b},
-clamp:function(a,b,c){return a<b?b:a>c?c:a}};THREE.ColorUtils.__hsv={h:0,s:0,v:0};
-THREE.GeometryUtils={merge:function(a,b){var c,e,f=a.vertices.length,h=b instanceof THREE.Mesh?b.geometry:b,g=a.vertices,k=h.vertices,l=a.faces,m=h.faces,n=a.faceVertexUvs[0],h=h.faceVertexUvs[0];if(b instanceof THREE.Mesh)b.matrixAutoUpdate&&b.updateMatrix(),c=b.matrix,e=new THREE.Matrix4,e.extractRotation(c,b.scale);for(var o=0,t=k.length;o<t;o++){var u=new THREE.Vertex(k[o].position.clone());c&&c.multiplyVector3(u.position);g.push(u)}o=0;for(t=m.length;o<t;o++){var u=m[o],v,y,p=u.vertexNormals,
-z=u.vertexColors;u instanceof THREE.Face3?v=new THREE.Face3(u.a+f,u.b+f,u.c+f):u instanceof THREE.Face4&&(v=new THREE.Face4(u.a+f,u.b+f,u.c+f,u.d+f));v.normal.copy(u.normal);e&&e.multiplyVector3(v.normal);g=0;for(k=p.length;g<k;g++)y=p[g].clone(),e&&e.multiplyVector3(y),v.vertexNormals.push(y);v.color.copy(u.color);g=0;for(k=z.length;g<k;g++)y=z[g],v.vertexColors.push(y.clone());v.materials=u.materials.slice();v.centroid.copy(u.centroid);c&&c.multiplyVector3(v.centroid);l.push(v)}o=0;for(t=h.length;o<
-t;o++){c=h[o];e=[];g=0;for(k=c.length;g<k;g++)e.push(new THREE.UV(c[g].u,c[g].v));n.push(e)}},clone:function(a){var b=new THREE.Geometry,c,e=a.vertices,f=a.faces,h=a.faceVertexUvs[0],a=0;for(c=e.length;a<c;a++){var g=new THREE.Vertex(e[a].position.clone());b.vertices.push(g)}a=0;for(c=f.length;a<c;a++){var k=f[a],l,m,n=k.vertexNormals,o=k.vertexColors;k instanceof THREE.Face3?l=new THREE.Face3(k.a,k.b,k.c):k instanceof THREE.Face4&&(l=new THREE.Face4(k.a,k.b,k.c,k.d));l.normal.copy(k.normal);e=0;
-for(g=n.length;e<g;e++)m=n[e],l.vertexNormals.push(m.clone());l.color.copy(k.color);e=0;for(g=o.length;e<g;e++)m=o[e],l.vertexColors.push(m.clone());l.materials=k.materials.slice();l.centroid.copy(k.centroid);b.faces.push(l)}a=0;for(c=h.length;a<c;a++){f=h[a];l=[];e=0;for(g=f.length;e<g;e++)l.push(new THREE.UV(f[e].u,f[e].v));b.faceVertexUvs[0].push(l)}return b},randomPointInTriangle:function(a,b,c){var e,f,h,g=new THREE.Vector3,k=THREE.GeometryUtils.__v1;e=THREE.GeometryUtils.random();f=THREE.GeometryUtils.random();
-e+f>1&&(e=1-e,f=1-f);h=1-e-f;g.copy(a);g.multiplyScalar(e);k.copy(b);k.multiplyScalar(f);g.addSelf(k);k.copy(c);k.multiplyScalar(h);g.addSelf(k);return g},randomPointInFace:function(a,b,c){var e,f,h;if(a instanceof THREE.Face3)return e=b.vertices[a.a].position,f=b.vertices[a.b].position,h=b.vertices[a.c].position,THREE.GeometryUtils.randomPointInTriangle(e,f,h);else if(a instanceof THREE.Face4){e=b.vertices[a.a].position;f=b.vertices[a.b].position;h=b.vertices[a.c].position;var b=b.vertices[a.d].position,
-g;c?a._area1&&a._area2?(c=a._area1,g=a._area2):(c=THREE.GeometryUtils.triangleArea(e,f,b),g=THREE.GeometryUtils.triangleArea(f,h,b),a._area1=c,a._area2=g):(c=THREE.GeometryUtils.triangleArea(e,f,b),g=THREE.GeometryUtils.triangleArea(f,h,b));return THREE.GeometryUtils.random()*(c+g)<c?THREE.GeometryUtils.randomPointInTriangle(e,f,b):THREE.GeometryUtils.randomPointInTriangle(f,h,b)}},randomPointsInGeometry:function(a,b){function c(a){function c(b,e){if(e<b)return b;var g=b+Math.floor((e-b)/2);return m[g]>
-a?c(b,g-1):m[g]<a?c(g+1,e):g}return c(0,m.length-1)}var e,f,h=a.faces,g=a.vertices,k=h.length,l=0,m=[],n,o,t,u;for(f=0;f<k;f++){e=h[f];if(e instanceof THREE.Face3)n=g[e.a].position,o=g[e.b].position,t=g[e.c].position,e._area=THREE.GeometryUtils.triangleArea(n,o,t);else if(e instanceof THREE.Face4)n=g[e.a].position,o=g[e.b].position,t=g[e.c].position,u=g[e.d].position,e._area1=THREE.GeometryUtils.triangleArea(n,o,u),e._area2=THREE.GeometryUtils.triangleArea(o,t,u),e._area=e._area1+e._area2;l+=e._area;
-m[f]=l}e=[];g={};for(f=0;f<b;f++)k=THREE.GeometryUtils.random()*l,k=c(k),e[f]=THREE.GeometryUtils.randomPointInFace(h[k],a,!0),g[k]?g[k]+=1:g[k]=1;return e},triangleArea:function(a,b,c){var e,f=THREE.GeometryUtils.__v1;f.sub(a,b);e=f.length();f.sub(a,c);a=f.length();f.sub(b,c);c=f.length();b=0.5*(e+a+c);return Math.sqrt(b*(b-e)*(b-a)*(b-c))},random16:function(){return(65280*Math.random()+255*Math.random())/65535},center:function(a){a.computeBoundingBox();var b=new THREE.Matrix4;b.setTranslation(-0.5*
-(a.boundingBox.x[1]+a.boundingBox.x[0]),-0.5*(a.boundingBox.y[1]+a.boundingBox.y[0]),-0.5*(a.boundingBox.z[1]+a.boundingBox.z[0]));a.applyMatrix(b);a.computeBoundingBox()}};THREE.GeometryUtils.random=THREE.GeometryUtils.random16;THREE.GeometryUtils.__v1=new THREE.Vector3;
-THREE.ImageUtils={loadTexture:function(a,b,c){var e=new Image,f=new THREE.Texture(e,b);e.onload=function(){f.needsUpdate=!0;c&&c(this)};e.crossOrigin="";e.src=a;return f},loadTextureCube:function(a,b,c){var e,f=[],h=new THREE.Texture(f,b),b=f.loadCount=0;for(e=a.length;b<e;++b)f[b]=new Image,f[b].onload=function(){f.loadCount+=1;if(f.loadCount==6)h.needsUpdate=!0;c&&c(this)},f[b].crossOrigin="",f[b].src=a[b];return h},getNormalMap:function(a,b){var c=function(a){var c=Math.sqrt(a[0]*a[0]+a[1]*a[1]+
-a[2]*a[2]);return[a[0]/c,a[1]/c,a[2]/c]};b|=1;var e=a.width,f=a.height,h=document.createElement("canvas");h.width=e;h.height=f;var g=h.getContext("2d");g.drawImage(a,0,0);for(var k=g.getImageData(0,0,e,f).data,l=g.createImageData(e,f),m=l.data,n=0;n<e;n++)for(var o=1;o<f;o++){var t=o-1<0?f-1:o-1,u=(o+1)%f,v=n-1<0?e-1:n-1,y=(n+1)%e,p=[],z=[0,0,k[(o*e+n)*4]/255*b];p.push([-1,0,k[(o*e+v)*4]/255*b]);p.push([-1,-1,k[(t*e+v)*4]/255*b]);p.push([0,-1,k[(t*e+n)*4]/255*b]);p.push([1,-1,k[(t*e+y)*4]/255*b]);
-p.push([1,0,k[(o*e+y)*4]/255*b]);p.push([1,1,k[(u*e+y)*4]/255*b]);p.push([0,1,k[(u*e+n)*4]/255*b]);p.push([-1,1,k[(u*e+v)*4]/255*b]);t=[];v=p.length;for(u=0;u<v;u++){var y=p[u],x=p[(u+1)%v],y=[y[0]-z[0],y[1]-z[1],y[2]-z[2]],x=[x[0]-z[0],x[1]-z[1],x[2]-z[2]];t.push(c([y[1]*x[2]-y[2]*x[1],y[2]*x[0]-y[0]*x[2],y[0]*x[1]-y[1]*x[0]]))}p=[0,0,0];for(u=0;u<t.length;u++)p[0]+=t[u][0],p[1]+=t[u][1],p[2]+=t[u][2];p[0]/=t.length;p[1]/=t.length;p[2]/=t.length;z=(o*e+n)*4;m[z]=(p[0]+1)/2*255|0;m[z+1]=(p[1]+0.5)*
-255|0;m[z+2]=p[2]*255|0;m[z+3]=255}g.putImageData(l,0,0);return h}};THREE.SceneUtils={showHierarchy:function(a,b){THREE.SceneUtils.traverseHierarchy(a,function(a){a.visible=b})},traverseHierarchy:function(a,b){var c,e,f=a.children.length;for(e=0;e<f;e++)c=a.children[e],b(c),THREE.SceneUtils.traverseHierarchy(c,b)}};
+THREE.ColorUtils={adjustHSV:function(a,c,b,e){var g=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(a,g);g.h=THREE.ColorUtils.clamp(g.h+c,0,1);g.s=THREE.ColorUtils.clamp(g.s+b,0,1);g.v=THREE.ColorUtils.clamp(g.v+e,0,1);a.setHSV(g.h,g.s,g.v)},rgbToHsv:function(a,c){var b=a.r,e=a.g,g=a.b,h=Math.max(Math.max(b,e),g),f=Math.min(Math.min(b,e),g);if(f==h)f=b=0;else{var k=h-f,f=k/h,b=b==h?(e-g)/k:e==h?2+(g-b)/k:4+(b-e)/k;b/=6;b<0&&(b+=1);b>1&&(b-=1)}c===void 0&&(c={h:0,s:0,v:0});c.h=b;c.s=f;c.v=h;return c},
+clamp:function(a,c,b){return a<c?c:a>b?b:a}};THREE.ColorUtils.__hsv={h:0,s:0,v:0};
+THREE.GeometryUtils={merge:function(a,c){var b,e,g=a.vertices.length,h=c instanceof THREE.Mesh?c.geometry:c,f=a.vertices,k=h.vertices,l=a.faces,m=h.faces,n=a.faceVertexUvs[0],h=h.faceVertexUvs[0];if(c instanceof THREE.Mesh)c.matrixAutoUpdate&&c.updateMatrix(),b=c.matrix,e=new THREE.Matrix4,e.extractRotation(b,c.scale);for(var o=0,p=k.length;o<p;o++){var u=new THREE.Vertex(k[o].position.clone());b&&b.multiplyVector3(u.position);f.push(u)}o=0;for(p=m.length;o<p;o++){var u=m[o],v,y,t=u.vertexNormals,
+z=u.vertexColors;u instanceof THREE.Face3?v=new THREE.Face3(u.a+g,u.b+g,u.c+g):u instanceof THREE.Face4&&(v=new THREE.Face4(u.a+g,u.b+g,u.c+g,u.d+g));v.normal.copy(u.normal);e&&e.multiplyVector3(v.normal);f=0;for(k=t.length;f<k;f++)y=t[f].clone(),e&&e.multiplyVector3(y),v.vertexNormals.push(y);v.color.copy(u.color);f=0;for(k=z.length;f<k;f++)y=z[f],v.vertexColors.push(y.clone());v.materials=u.materials.slice();v.centroid.copy(u.centroid);b&&b.multiplyVector3(v.centroid);l.push(v)}o=0;for(p=h.length;o<
+p;o++){b=h[o];e=[];f=0;for(k=b.length;f<k;f++)e.push(new THREE.UV(b[f].u,b[f].v));n.push(e)}},clone:function(a){var c=new THREE.Geometry,b,e=a.vertices,g=a.faces,h=a.faceVertexUvs[0],a=0;for(b=e.length;a<b;a++){var f=new THREE.Vertex(e[a].position.clone());c.vertices.push(f)}a=0;for(b=g.length;a<b;a++){var k=g[a],l,m,n=k.vertexNormals,o=k.vertexColors;k instanceof THREE.Face3?l=new THREE.Face3(k.a,k.b,k.c):k instanceof THREE.Face4&&(l=new THREE.Face4(k.a,k.b,k.c,k.d));l.normal.copy(k.normal);e=0;
+for(f=n.length;e<f;e++)m=n[e],l.vertexNormals.push(m.clone());l.color.copy(k.color);e=0;for(f=o.length;e<f;e++)m=o[e],l.vertexColors.push(m.clone());l.materials=k.materials.slice();l.centroid.copy(k.centroid);c.faces.push(l)}a=0;for(b=h.length;a<b;a++){g=h[a];l=[];e=0;for(f=g.length;e<f;e++)l.push(new THREE.UV(g[e].u,g[e].v));c.faceVertexUvs[0].push(l)}return c},randomPointInTriangle:function(a,c,b){var e,g,h,f=new THREE.Vector3,k=THREE.GeometryUtils.__v1;e=THREE.GeometryUtils.random();g=THREE.GeometryUtils.random();
+e+g>1&&(e=1-e,g=1-g);h=1-e-g;f.copy(a);f.multiplyScalar(e);k.copy(c);k.multiplyScalar(g);f.addSelf(k);k.copy(b);k.multiplyScalar(h);f.addSelf(k);return f},randomPointInFace:function(a,c,b){var e,g,h;if(a instanceof THREE.Face3)return e=c.vertices[a.a].position,g=c.vertices[a.b].position,h=c.vertices[a.c].position,THREE.GeometryUtils.randomPointInTriangle(e,g,h);else if(a instanceof THREE.Face4){e=c.vertices[a.a].position;g=c.vertices[a.b].position;h=c.vertices[a.c].position;var c=c.vertices[a.d].position,
+f;b?a._area1&&a._area2?(b=a._area1,f=a._area2):(b=THREE.GeometryUtils.triangleArea(e,g,c),f=THREE.GeometryUtils.triangleArea(g,h,c),a._area1=b,a._area2=f):(b=THREE.GeometryUtils.triangleArea(e,g,c),f=THREE.GeometryUtils.triangleArea(g,h,c));return THREE.GeometryUtils.random()*(b+f)<b?THREE.GeometryUtils.randomPointInTriangle(e,g,c):THREE.GeometryUtils.randomPointInTriangle(g,h,c)}},randomPointsInGeometry:function(a,c){function b(a){function b(c,e){if(e<c)return c;var f=c+Math.floor((e-c)/2);return m[f]>
+a?b(c,f-1):m[f]<a?b(f+1,e):f}return b(0,m.length-1)}var e,g,h=a.faces,f=a.vertices,k=h.length,l=0,m=[],n,o,p,u;for(g=0;g<k;g++){e=h[g];if(e instanceof THREE.Face3)n=f[e.a].position,o=f[e.b].position,p=f[e.c].position,e._area=THREE.GeometryUtils.triangleArea(n,o,p);else if(e instanceof THREE.Face4)n=f[e.a].position,o=f[e.b].position,p=f[e.c].position,u=f[e.d].position,e._area1=THREE.GeometryUtils.triangleArea(n,o,u),e._area2=THREE.GeometryUtils.triangleArea(o,p,u),e._area=e._area1+e._area2;l+=e._area;
+m[g]=l}e=[];f={};for(g=0;g<c;g++)k=THREE.GeometryUtils.random()*l,k=b(k),e[g]=THREE.GeometryUtils.randomPointInFace(h[k],a,!0),f[k]?f[k]+=1:f[k]=1;return e},triangleArea:function(a,c,b){var e,g=THREE.GeometryUtils.__v1;g.sub(a,c);e=g.length();g.sub(a,b);a=g.length();g.sub(c,b);b=g.length();c=0.5*(e+a+b);return Math.sqrt(c*(c-e)*(c-a)*(c-b))},random16:function(){return(65280*Math.random()+255*Math.random())/65535},center:function(a){a.computeBoundingBox();var c=new THREE.Matrix4;c.setTranslation(-0.5*
+(a.boundingBox.x[1]+a.boundingBox.x[0]),-0.5*(a.boundingBox.y[1]+a.boundingBox.y[0]),-0.5*(a.boundingBox.z[1]+a.boundingBox.z[0]));a.applyMatrix(c);a.computeBoundingBox()}};THREE.GeometryUtils.random=THREE.GeometryUtils.random16;THREE.GeometryUtils.__v1=new THREE.Vector3;
+THREE.ImageUtils={loadTexture:function(a,c,b){var e=new Image,g=new THREE.Texture(e,c);e.onload=function(){g.needsUpdate=!0;b&&b(this)};e.crossOrigin="";e.src=a;return g},loadTextureCube:function(a,c,b){var e,g=[],h=new THREE.Texture(g,c),c=g.loadCount=0;for(e=a.length;c<e;++c)g[c]=new Image,g[c].onload=function(){g.loadCount+=1;if(g.loadCount==6)h.needsUpdate=!0;b&&b(this)},g[c].crossOrigin="",g[c].src=a[c];return h},getNormalMap:function(a,c){var b=function(a){var b=Math.sqrt(a[0]*a[0]+a[1]*a[1]+
+a[2]*a[2]);return[a[0]/b,a[1]/b,a[2]/b]};c|=1;var e=a.width,g=a.height,h=document.createElement("canvas");h.width=e;h.height=g;var f=h.getContext("2d");f.drawImage(a,0,0);for(var k=f.getImageData(0,0,e,g).data,l=f.createImageData(e,g),m=l.data,n=0;n<e;n++)for(var o=1;o<g;o++){var p=o-1<0?g-1:o-1,u=(o+1)%g,v=n-1<0?e-1:n-1,y=(n+1)%e,t=[],z=[0,0,k[(o*e+n)*4]/255*c];t.push([-1,0,k[(o*e+v)*4]/255*c]);t.push([-1,-1,k[(p*e+v)*4]/255*c]);t.push([0,-1,k[(p*e+n)*4]/255*c]);t.push([1,-1,k[(p*e+y)*4]/255*c]);
+t.push([1,0,k[(o*e+y)*4]/255*c]);t.push([1,1,k[(u*e+y)*4]/255*c]);t.push([0,1,k[(u*e+n)*4]/255*c]);t.push([-1,1,k[(u*e+v)*4]/255*c]);p=[];v=t.length;for(u=0;u<v;u++){var y=t[u],x=t[(u+1)%v],y=[y[0]-z[0],y[1]-z[1],y[2]-z[2]],x=[x[0]-z[0],x[1]-z[1],x[2]-z[2]];p.push(b([y[1]*x[2]-y[2]*x[1],y[2]*x[0]-y[0]*x[2],y[0]*x[1]-y[1]*x[0]]))}t=[0,0,0];for(u=0;u<p.length;u++)t[0]+=p[u][0],t[1]+=p[u][1],t[2]+=p[u][2];t[0]/=p.length;t[1]/=p.length;t[2]/=p.length;z=(o*e+n)*4;m[z]=(t[0]+1)/2*255|0;m[z+1]=(t[1]+0.5)*
+255|0;m[z+2]=t[2]*255|0;m[z+3]=255}f.putImageData(l,0,0);return h}};THREE.SceneUtils={showHierarchy:function(a,c){THREE.SceneUtils.traverseHierarchy(a,function(a){a.visible=c})},traverseHierarchy:function(a,c){var b,e,g=a.children.length;for(e=0;e<g;e++)b=a.children[e],c(b),THREE.SceneUtils.traverseHierarchy(b,c)}};
 if(THREE.WebGLRenderer)THREE.ShaderUtils={lib:{fresnel:{uniforms:{mRefractionRatio:{type:"f",value:1.02},mFresnelBias:{type:"f",value:0.1},mFresnelPower:{type:"f",value:2},mFresnelScale:{type:"f",value:1},tCube:{type:"t",value:1,texture:null}},fragmentShader:"uniform samplerCube tCube;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 reflectedColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );\nvec4 refractedColor = vec4( 1.0, 1.0, 1.0, 1.0 );\nrefractedColor.r = textureCube( tCube, vec3( -vRefract[0].x, vRefract[0].yz ) ).r;\nrefractedColor.g = textureCube( tCube, vec3( -vRefract[1].x, vRefract[1].yz ) ).g;\nrefractedColor.b = textureCube( tCube, vec3( -vRefract[2].x, vRefract[2].yz ) ).b;\nrefractedColor.a = 1.0;\ngl_FragColor = mix( refractedColor, reflectedColor, clamp( vReflectionFactor, 0.0, 1.0 ) );\n}",
 vertexShader:"uniform float mRefractionRatio;\nuniform float mFresnelBias;\nuniform float mFresnelScale;\nuniform float mFresnelPower;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = normalize ( mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal );\nvec3 I = mPosition.xyz - cameraPosition;\nvReflect = reflect( I, nWorld );\nvRefract[0] = refract( normalize( I ), nWorld, mRefractionRatio );\nvRefract[1] = refract( normalize( I ), nWorld, mRefractionRatio * 0.99 );\nvRefract[2] = refract( normalize( I ), nWorld, mRefractionRatio * 0.98 );\nvReflectionFactor = mFresnelBias + mFresnelScale * pow( 1.0 + dot( normalize( I ), nWorld ), mFresnelPower );\ngl_Position = projectionMatrix * mvPosition;\n}"},
 normal:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.fog,THREE.UniformsLib.lights,THREE.UniformsLib.shadowmap,{enableAO:{type:"i",value:0},enableDiffuse:{type:"i",value:0},enableSpecular:{type:"i",value:0},enableReflection:{type:"i",value:0},tDiffuse:{type:"t",value:0,texture:null},tCube:{type:"t",value:1,texture:null},tNormal:{type:"t",value:2,texture:null},tSpecular:{type:"t",value:3,texture:null},tAO:{type:"t",value:4,texture:null},tDisplacement:{type:"t",value:5,texture:null},uNormalScale:{type:"f",
@@ -22,299 +22,297 @@ THREE.ShaderChunk.shadowmap_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,"v
 THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:["attribute vec4 tangent;\nuniform vec2 uOffset;\nuniform vec2 uRepeat;\n#ifdef VERTEX_TEXTURES\nuniform sampler2D tDisplacement;\nuniform float uDisplacementScale;\nuniform float uDisplacementBias;\n#endif\nvarying vec3 vTangent;\nvarying vec3 vBinormal;\nvarying vec3 vNormal;\nvarying vec2 vUv;\n#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\nuniform float pointLightDistance[ MAX_POINT_LIGHTS ];\nvarying vec4 vPointLight[ MAX_POINT_LIGHTS ];\n#endif\nvarying vec3 vViewPosition;",
 THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvViewPosition = -mvPosition.xyz;\nvNormal = normalize( normalMatrix * normal );\nvTangent = normalize( normalMatrix * tangent.xyz );\nvBinormal = cross( vNormal, vTangent ) * tangent.w;\nvBinormal = normalize( vBinormal );\nvUv = uv * uRepeat + uOffset;\n#if MAX_POINT_LIGHTS > 0\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\nvec3 lVector = lPosition.xyz - mvPosition.xyz;\nfloat lDistance = 1.0;\nif ( pointLightDistance[ i ] > 0.0 )\nlDistance = 1.0 - min( ( length( lVector ) / pointLightDistance[ i ] ), 1.0 );\nlVector = normalize( lVector );\nvPointLight[ i ] = vec4( lVector, lDistance );\n}\n#endif\n#ifdef VERTEX_TEXTURES\nvec3 dv = texture2D( tDisplacement, uv ).xyz;\nfloat df = uDisplacementScale * dv.x + uDisplacementBias;\nvec4 displacedPosition = vec4( vNormal.xyz * df, 0.0 ) + mvPosition;\ngl_Position = projectionMatrix * displacedPosition;\n#else\ngl_Position = projectionMatrix * mvPosition;\n#endif",
 THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n")},cube:{uniforms:{tCube:{type:"t",value:1,texture:null},tFlip:{type:"f",value:-1}},vertexShader:"varying vec3 vViewPosition;\nvoid main() {\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvViewPosition = cameraPosition - mPosition.xyz;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform samplerCube tCube;\nuniform float tFlip;\nvarying vec3 vViewPosition;\nvoid main() {\nvec3 wPos = cameraPosition - vViewPosition;\ngl_FragColor = textureCube( tCube, vec3( tFlip * wPos.x, wPos.yz ) );\n}"}}};
-THREE.Curve=function(){};THREE.Curve.prototype.getPoint=function(){console.log("Warning, getPoint() not implemented!");return null};THREE.Curve.prototype.getPointAt=function(a){return this.getPoint(this.getUtoTmapping(a))};THREE.Curve.prototype.getPoints=function(a){a||(a=5);var b,c=[];for(b=0;b<=a;b++)c.push(this.getPoint(b/a));return c};THREE.Curve.prototype.getSpacedPoints=function(a){a||(a=5);var b,c=[];for(b=0;b<=a;b++)c.push(this.getPointAt(b/a));return c};
-THREE.Curve.prototype.getLength=function(){var a=this.getLengths();return a[a.length-1]};THREE.Curve.prototype.getLengths=function(a){a||(a=200);if(this.cacheArcLengths&&this.cacheArcLengths.length==a+1)return this.cacheArcLengths;var b=[],c,e=this.getPoint(0),f,h=0;b.push(0);for(f=1;f<=a;f++)c=this.getPoint(f/a),h+=c.distanceTo(e),b.push(h),e=c;return this.cacheArcLengths=b};
-THREE.Curve.prototype.getUtoTmapping=function(a,b){var c=this.getLengths(),e=0,f=c.length,h;h=b?b:a*c[f-1];time=Date.now();for(var g=0,k=f-1,l;g<=k;)if(e=Math.floor(g+(k-g)/2),l=c[e]-h,l<0)g=e+1;else if(l>0)k=e-1;else{k=e;break}e=k;if(c[e]==h)return e/(f-1);g=c[e];return c=(e+(h-g)/(c[e+1]-g))/(f-1)};THREE.Curve.prototype.getNormalVector=function(a){a=this.getTangent(a);return new THREE.Vector2(-a.y,a.x)};
-THREE.Curve.prototype.getTangent=function(a){var b=a-1.0E-4;a+=1.0E-4;b<0&&(b=0);a>1&&(a=1);var b=this.getPoint(b),a=this.getPoint(a),c=new THREE.Vector2;c.sub(a,b);return c.unit()};THREE.LineCurve=function(a,b){a instanceof THREE.Vector2?(this.v1=a,this.v2=b):THREE.LineCurve.oldConstructor.apply(this,arguments)};THREE.LineCurve.oldConstructor=function(a,b,c,e){this.constructor(new THREE.Vector2(a,b),new THREE.Vector2(c,e))};THREE.LineCurve.prototype=new THREE.Curve;
-THREE.LineCurve.prototype.constructor=THREE.LineCurve;THREE.LineCurve.prototype.getPoint=function(a){var b=new THREE.Vector2;b.sub(this.v2,this.v1);b.multiplyScalar(a).addSelf(this.v1);return b};THREE.LineCurve.prototype.getPointAt=function(a){return this.getPoint(a)};THREE.LineCurve.prototype.getTangent=function(){var a=new THREE.Vector2;a.sub(this.v2,this.v1);a.normalize();return a};
-THREE.QuadraticBezierCurve=function(a,b,c){if(!(b instanceof THREE.Vector2))var e=Array.prototype.slice.call(arguments),a=new THREE.Vector2(e[0],e[1]),b=new THREE.Vector2(e[2],e[3]),c=new THREE.Vector2(e[4],e[5]);this.v0=a;this.v1=b;this.v2=c};THREE.QuadraticBezierCurve.prototype=new THREE.Curve;THREE.QuadraticBezierCurve.prototype.constructor=THREE.QuadraticBezierCurve;
-THREE.QuadraticBezierCurve.prototype.getPoint=function(a){var b;b=THREE.Shape.Utils.b2(a,this.v0.x,this.v1.x,this.v2.x);a=THREE.Shape.Utils.b2(a,this.v0.y,this.v1.y,this.v2.y);return new THREE.Vector2(b,a)};THREE.QuadraticBezierCurve.prototype.getTangent=function(a){var b;b=THREE.Curve.Utils.tangentQuadraticBezier(a,this.v0.x,this.v1.x,this.v2.x);a=THREE.Curve.Utils.tangentQuadraticBezier(a,this.v0.y,this.v1.y,this.v2.y);b=new THREE.Vector2(b,a);b.normalize();return b};
-THREE.CubicBezierCurve=function(a,b,c,e){if(!(b instanceof THREE.Vector2))var f=Array.prototype.slice.call(arguments),a=new THREE.Vector2(f[0],f[1]),b=new THREE.Vector2(f[2],f[3]),c=new THREE.Vector2(f[4],f[5]),e=new THREE.Vector2(f[6],f[7]);this.v0=a;this.v1=b;this.v2=c;this.v3=e};THREE.CubicBezierCurve.prototype=new THREE.Curve;THREE.CubicBezierCurve.prototype.constructor=THREE.CubicBezierCurve;
-THREE.CubicBezierCurve.prototype.getPoint=function(a){var b;b=THREE.Shape.Utils.b3(a,this.v0.x,this.v1.x,this.v2.x,this.v3.x);a=THREE.Shape.Utils.b3(a,this.v0.y,this.v1.y,this.v2.y,this.v3.y);return new THREE.Vector2(b,a)};THREE.CubicBezierCurve.prototype.getTangent=function(a){var b;b=THREE.Curve.Utils.tangentCubicBezier(a,this.v0.x,this.v1.x,this.v2.x,this.v3.x);a=THREE.Curve.Utils.tangentCubicBezier(a,this.v0.y,this.v1.y,this.v2.y,this.v3.y);b=new THREE.Vector2(b,a);b.normalize();return b};
+THREE.Curve=function(){};THREE.Curve.prototype.getPoint=function(){console.log("Warning, getPoint() not implemented!");return null};THREE.Curve.prototype.getPointAt=function(a){return this.getPoint(this.getUtoTmapping(a))};THREE.Curve.prototype.getPoints=function(a){a||(a=5);var c,b=[];for(c=0;c<=a;c++)b.push(this.getPoint(c/a));return b};THREE.Curve.prototype.getSpacedPoints=function(a){a||(a=5);var c,b=[];for(c=0;c<=a;c++)b.push(this.getPointAt(c/a));return b};
+THREE.Curve.prototype.getLength=function(){var a=this.getLengths();return a[a.length-1]};THREE.Curve.prototype.getLengths=function(a){a||(a=200);if(this.cacheArcLengths&&this.cacheArcLengths.length==a+1)return this.cacheArcLengths;var c=[],b,e=this.getPoint(0),g,h=0;c.push(0);for(g=1;g<=a;g++)b=this.getPoint(g/a),h+=b.distanceTo(e),c.push(h),e=b;return this.cacheArcLengths=c};
+THREE.Curve.prototype.getUtoTmapping=function(a,c){var b=this.getLengths(),e=0,g=b.length,h;h=c?c:a*b[g-1];time=Date.now();for(var f=0,k=g-1,l;f<=k;)if(e=Math.floor(f+(k-f)/2),l=b[e]-h,l<0)f=e+1;else if(l>0)k=e-1;else{k=e;break}e=k;if(b[e]==h)return e/(g-1);f=b[e];return b=(e+(h-f)/(b[e+1]-f))/(g-1)};THREE.Curve.prototype.getNormalVector=function(a){a=this.getTangent(a);return new THREE.Vector2(-a.y,a.x)};
+THREE.Curve.prototype.getTangent=function(a){var c=a-1.0E-4;a+=1.0E-4;c<0&&(c=0);a>1&&(a=1);var c=this.getPoint(c),a=this.getPoint(a),b=new THREE.Vector2;b.sub(a,c);return b.unit()};THREE.LineCurve=function(a,c){a instanceof THREE.Vector2?(this.v1=a,this.v2=c):THREE.LineCurve.oldConstructor.apply(this,arguments)};THREE.LineCurve.oldConstructor=function(a,c,b,e){this.constructor(new THREE.Vector2(a,c),new THREE.Vector2(b,e))};THREE.LineCurve.prototype=new THREE.Curve;
+THREE.LineCurve.prototype.constructor=THREE.LineCurve;THREE.LineCurve.prototype.getPoint=function(a){var c=new THREE.Vector2;c.sub(this.v2,this.v1);c.multiplyScalar(a).addSelf(this.v1);return c};THREE.LineCurve.prototype.getPointAt=function(a){return this.getPoint(a)};THREE.LineCurve.prototype.getTangent=function(){var a=new THREE.Vector2;a.sub(this.v2,this.v1);a.normalize();return a};
+THREE.QuadraticBezierCurve=function(a,c,b){if(!(c instanceof THREE.Vector2))var e=Array.prototype.slice.call(arguments),a=new THREE.Vector2(e[0],e[1]),c=new THREE.Vector2(e[2],e[3]),b=new THREE.Vector2(e[4],e[5]);this.v0=a;this.v1=c;this.v2=b};THREE.QuadraticBezierCurve.prototype=new THREE.Curve;THREE.QuadraticBezierCurve.prototype.constructor=THREE.QuadraticBezierCurve;
+THREE.QuadraticBezierCurve.prototype.getPoint=function(a){var c;c=THREE.Shape.Utils.b2(a,this.v0.x,this.v1.x,this.v2.x);a=THREE.Shape.Utils.b2(a,this.v0.y,this.v1.y,this.v2.y);return new THREE.Vector2(c,a)};THREE.QuadraticBezierCurve.prototype.getTangent=function(a){var c;c=THREE.Curve.Utils.tangentQuadraticBezier(a,this.v0.x,this.v1.x,this.v2.x);a=THREE.Curve.Utils.tangentQuadraticBezier(a,this.v0.y,this.v1.y,this.v2.y);c=new THREE.Vector2(c,a);c.normalize();return c};
+THREE.CubicBezierCurve=function(a,c,b,e){if(!(c instanceof THREE.Vector2))var g=Array.prototype.slice.call(arguments),a=new THREE.Vector2(g[0],g[1]),c=new THREE.Vector2(g[2],g[3]),b=new THREE.Vector2(g[4],g[5]),e=new THREE.Vector2(g[6],g[7]);this.v0=a;this.v1=c;this.v2=b;this.v3=e};THREE.CubicBezierCurve.prototype=new THREE.Curve;THREE.CubicBezierCurve.prototype.constructor=THREE.CubicBezierCurve;
+THREE.CubicBezierCurve.prototype.getPoint=function(a){var c;c=THREE.Shape.Utils.b3(a,this.v0.x,this.v1.x,this.v2.x,this.v3.x);a=THREE.Shape.Utils.b3(a,this.v0.y,this.v1.y,this.v2.y,this.v3.y);return new THREE.Vector2(c,a)};THREE.CubicBezierCurve.prototype.getTangent=function(a){var c;c=THREE.Curve.Utils.tangentCubicBezier(a,this.v0.x,this.v1.x,this.v2.x,this.v3.x);a=THREE.Curve.Utils.tangentCubicBezier(a,this.v0.y,this.v1.y,this.v2.y,this.v3.y);c=new THREE.Vector2(c,a);c.normalize();return c};
 THREE.SplineCurve=function(a){this.points=a};THREE.SplineCurve.prototype=new THREE.Curve;THREE.SplineCurve.prototype.constructor=THREE.SplineCurve;
-THREE.SplineCurve.prototype.getPoint=function(a){var b=new THREE.Vector2,c=[],e=this.points,f;f=(e.length-1)*a;a=Math.floor(f);f-=a;c[0]=a==0?a:a-1;c[1]=a;c[2]=a>e.length-2?a:a+1;c[3]=a>e.length-3?a:a+2;b.x=THREE.Curve.Utils.interpolate(e[c[0]].x,e[c[1]].x,e[c[2]].x,e[c[3]].x,f);b.y=THREE.Curve.Utils.interpolate(e[c[0]].y,e[c[1]].y,e[c[2]].y,e[c[3]].y,f);return b};THREE.ArcCurve=function(a,b,c,e,f,h){this.aX=a;this.aY=b;this.aRadius=c;this.aStartAngle=e;this.aEndAngle=f;this.aClockwise=h};
-THREE.ArcCurve.prototype=new THREE.Curve;THREE.ArcCurve.prototype.constructor=THREE.ArcCurve;THREE.ArcCurve.prototype.getPoint=function(a){var b=this.aEndAngle-this.aStartAngle;this.aClockwise||(a=1-a);a=this.aStartAngle+a*b;return new THREE.Vector2(this.aX+this.aRadius*Math.cos(a),this.aY+this.aRadius*Math.sin(a))};
-THREE.Curve.Utils={tangentQuadraticBezier:function(a,b,c,e){return 2*(1-a)*(c-b)+2*a*(e-c)},tangentCubicBezier:function(a,b,c,e,f){return-3*b*(1-a)*(1-a)+3*c*(1-a)*(1-a)-6*a*c*(1-a)+6*a*e*(1-a)-3*a*a*e+3*a*a*f},tangentSpline:function(a){return 6*a*a-6*a+(3*a*a-4*a+1)+(-6*a*a+6*a)+(3*a*a-2*a)},interpolate:function(a,b,c,e,f){var a=(c-a)*0.5,e=(e-b)*0.5,h=f*f;return(2*b-2*c+a+e)*f*h+(-3*b+3*c-2*a-e)*h+a*f+b}};
-THREE.Curve.create=function(a,b){a.prototype=new THREE.Curve;a.prototype.constructor=a;a.prototype.getPoint=b;return a};THREE.LineCurve3=THREE.Curve.create(function(a,b){this.v1=a;this.v2=b},function(a){var b=new THREE.Vector3;b.sub(v2,v1);b.multiplyScalar(a);b.addSelf(this.v1);return b});
-THREE.QuadraticBezierCurve3=THREE.Curve.create(function(a,b,c){this.v0=a;this.v1=b;this.v2=c},function(a){var b,c;b=THREE.Shape.Utils.b2(a,this.v0.x,this.v1.x,this.v2.x);c=THREE.Shape.Utils.b2(a,this.v0.y,this.v1.y,this.v2.y);a=THREE.Shape.Utils.b2(a,this.v0.z,this.v1.z,this.v2.z);return new THREE.Vector3(b,c,a)});
-THREE.CubicBezierCurve3=THREE.Curve.create(function(a,b,c,e){this.v0=a;this.v1=b;this.v2=c;this.v3=e},function(a){var b,c;b=THREE.Shape.Utils.b3(a,this.v0.x,this.v1.x,this.v2.x,this.v3.x);c=THREE.Shape.Utils.b3(a,this.v0.y,this.v1.y,this.v2.y,this.v3.y);a=THREE.Shape.Utils.b3(a,this.v0.z,this.v1.z,this.v2.z,this.v3.z);return new THREE.Vector3(b,c,a)});
-THREE.SplineCurve3=THREE.Curve.create(function(a){this.points=a},function(a){var b=new THREE.Vector3,c=[],e=this.points,f;f=(e.length-1)*a;a=Math.floor(f);f-=a;c[0]=a==0?a:a-1;c[1]=a;c[2]=a>e.length-2?a:a+1;c[3]=a>e.length-3?a:a+2;b.x=THREE.Curve.Utils.interpolate(e[c[0]].x,e[c[1]].x,e[c[2]].x,e[c[3]].x,f);b.y=THREE.Curve.Utils.interpolate(e[c[0]].y,e[c[1]].y,e[c[2]].y,e[c[3]].y,f);b.z=THREE.Curve.Utils.interpolate(e[c[0]].z,e[c[1]].z,e[c[2]].z,e[c[3]].z,f);return b});
+THREE.SplineCurve.prototype.getPoint=function(a){var c=new THREE.Vector2,b=[],e=this.points,g;g=(e.length-1)*a;a=Math.floor(g);g-=a;b[0]=a==0?a:a-1;b[1]=a;b[2]=a>e.length-2?a:a+1;b[3]=a>e.length-3?a:a+2;c.x=THREE.Curve.Utils.interpolate(e[b[0]].x,e[b[1]].x,e[b[2]].x,e[b[3]].x,g);c.y=THREE.Curve.Utils.interpolate(e[b[0]].y,e[b[1]].y,e[b[2]].y,e[b[3]].y,g);return c};THREE.ArcCurve=function(a,c,b,e,g,h){this.aX=a;this.aY=c;this.aRadius=b;this.aStartAngle=e;this.aEndAngle=g;this.aClockwise=h};
+THREE.ArcCurve.prototype=new THREE.Curve;THREE.ArcCurve.prototype.constructor=THREE.ArcCurve;THREE.ArcCurve.prototype.getPoint=function(a){var c=this.aEndAngle-this.aStartAngle;this.aClockwise||(a=1-a);a=this.aStartAngle+a*c;return new THREE.Vector2(this.aX+this.aRadius*Math.cos(a),this.aY+this.aRadius*Math.sin(a))};
+THREE.Curve.Utils={tangentQuadraticBezier:function(a,c,b,e){return 2*(1-a)*(b-c)+2*a*(e-b)},tangentCubicBezier:function(a,c,b,e,g){return-3*c*(1-a)*(1-a)+3*b*(1-a)*(1-a)-6*a*b*(1-a)+6*a*e*(1-a)-3*a*a*e+3*a*a*g},tangentSpline:function(a){return 6*a*a-6*a+(3*a*a-4*a+1)+(-6*a*a+6*a)+(3*a*a-2*a)},interpolate:function(a,c,b,e,g){var a=(b-a)*0.5,e=(e-c)*0.5,h=g*g;return(2*c-2*b+a+e)*g*h+(-3*c+3*b-2*a-e)*h+a*g+c}};
+THREE.Curve.create=function(a,c){a.prototype=new THREE.Curve;a.prototype.constructor=a;a.prototype.getPoint=c;return a};THREE.LineCurve3=THREE.Curve.create(function(a,c){this.v1=a;this.v2=c},function(a){var c=new THREE.Vector3;c.sub(v2,v1);c.multiplyScalar(a);c.addSelf(this.v1);return c});
+THREE.QuadraticBezierCurve3=THREE.Curve.create(function(a,c,b){this.v0=a;this.v1=c;this.v2=b},function(a){var c,b;c=THREE.Shape.Utils.b2(a,this.v0.x,this.v1.x,this.v2.x);b=THREE.Shape.Utils.b2(a,this.v0.y,this.v1.y,this.v2.y);a=THREE.Shape.Utils.b2(a,this.v0.z,this.v1.z,this.v2.z);return new THREE.Vector3(c,b,a)});
+THREE.CubicBezierCurve3=THREE.Curve.create(function(a,c,b,e){this.v0=a;this.v1=c;this.v2=b;this.v3=e},function(a){var c,b;c=THREE.Shape.Utils.b3(a,this.v0.x,this.v1.x,this.v2.x,this.v3.x);b=THREE.Shape.Utils.b3(a,this.v0.y,this.v1.y,this.v2.y,this.v3.y);a=THREE.Shape.Utils.b3(a,this.v0.z,this.v1.z,this.v2.z,this.v3.z);return new THREE.Vector3(c,b,a)});
+THREE.SplineCurve3=THREE.Curve.create(function(a){this.points=a},function(a){var c=new THREE.Vector3,b=[],e=this.points,g;g=(e.length-1)*a;a=Math.floor(g);g-=a;b[0]=a==0?a:a-1;b[1]=a;b[2]=a>e.length-2?a:a+1;b[3]=a>e.length-3?a:a+2;c.x=THREE.Curve.Utils.interpolate(e[b[0]].x,e[b[1]].x,e[b[2]].x,e[b[3]].x,g);c.y=THREE.Curve.Utils.interpolate(e[b[0]].y,e[b[1]].y,e[b[2]].y,e[b[3]].y,g);c.z=THREE.Curve.Utils.interpolate(e[b[0]].z,e[b[1]].z,e[b[2]].z,e[b[3]].z,g);return c});
 THREE.CurvePath=function(){this.curves=[];this.bends=[]};THREE.CurvePath.prototype=new THREE.Curve;THREE.CurvePath.prototype.constructor=THREE.CurvePath;THREE.CurvePath.prototype.add=function(a){this.curves.push(a)};THREE.CurvePath.prototype.checkConnection=function(){};THREE.CurvePath.prototype.closePath=function(){};
-THREE.CurvePath.prototype.getPoint=function(a){for(var b=a*this.getLength(),c=this.getCurveLengths(),a=0;a<c.length;){if(c[a]>=b)return b=c[a]-b,a=this.curves[a],b=1-b/a.getLength(),a.getPointAt(b);a++}return null};THREE.CurvePath.prototype.getLength=function(){var a=this.getCurveLengths();return a[a.length-1]};
-THREE.CurvePath.prototype.getCurveLengths=function(){if(this.cacheLengths&&this.cacheLengths.length==this.curves.length)return this.cacheLengths;var a=[],b=0,c,e=this.curves.length;for(c=0;c<e;c++)b+=this.curves[c].getLength(),a.push(b);return this.cacheLengths=a};
-THREE.CurvePath.prototype.getBoundingBox=function(){var a=this.getPoints(),b,c,e,f;b=c=Number.NEGATIVE_INFINITY;e=f=Number.POSITIVE_INFINITY;var h,g,k,l;l=new THREE.Vector2;g=0;for(k=a.length;g<k;g++){h=a[g];if(h.x>b)b=h.x;else if(h.x<e)e=h.x;if(h.y>c)c=h.y;else if(h.y<c)f=h.y;l.addSelf(h.x,h.y)}return{minX:e,minY:f,maxX:b,maxY:c,centroid:l.divideScalar(k)}};THREE.CurvePath.prototype.createPointsGeometry=function(a){return this.createGeometry(this.getPoints(a,!0))};
-THREE.CurvePath.prototype.createSpacedPointsGeometry=function(a){return this.createGeometry(this.getSpacedPoints(a,!0))};THREE.CurvePath.prototype.createGeometry=function(a){for(var b=new THREE.Geometry,c=0;c<a.length;c++)b.vertices.push(new THREE.Vertex(new THREE.Vector3(a[c].x,a[c].y,0)));return b};THREE.CurvePath.prototype.addWrapPath=function(a){this.bends.push(a)};
-THREE.CurvePath.prototype.getTransformedPoints=function(a,b){var c=this.getPoints(a),e,f;if(!b)b=this.bends;e=0;for(f=b.length;e<f;e++)c=this.getWrapPoints(c,b[e]);return c};THREE.CurvePath.prototype.getTransformedSpacedPoints=function(a,b){var c=this.getSpacedPoints(a),e,f;if(!b)b=this.bends;e=0;for(f=b.length;e<f;e++)c=this.getWrapPoints(c,b[e]);return c};
-THREE.CurvePath.prototype.getWrapPoints=function(a,b){var c=this.getBoundingBox(),e,f,h,g,k,l;e=0;for(f=a.length;e<f;e++)h=a[e],g=h.x,k=h.y,l=g/c.maxX,l=b.getUtoTmapping(l,g),g=b.getPoint(l),k=b.getNormalVector(l).multiplyScalar(k),h.x=g.x+k.x,h.y=g.y+k.y;return a};THREE.Path=function(a){THREE.CurvePath.call(this);this.actions=[];a&&this.fromPoints(a)};THREE.Path.prototype=new THREE.CurvePath;THREE.Path.prototype.constructor=THREE.Path;
-THREE.PathActions={MOVE_TO:"moveTo",LINE_TO:"lineTo",QUADRATIC_CURVE_TO:"quadraticCurveTo",BEZIER_CURVE_TO:"bezierCurveTo",CSPLINE_THRU:"splineThru",ARC:"arc"};THREE.Path.prototype.fromPoints=function(a){this.moveTo(a[0].x,a[0].y);var b,c=a.length;for(b=1;b<c;b++)this.lineTo(a[b].x,a[b].y)};THREE.Path.prototype.moveTo=function(){var a=Array.prototype.slice.call(arguments);this.actions.push({action:THREE.PathActions.MOVE_TO,args:a})};
-THREE.Path.prototype.lineTo=function(a,b){var c=Array.prototype.slice.call(arguments),e=this.actions[this.actions.length-1].args;this.curves.push(new THREE.LineCurve(new THREE.Vector2(e[e.length-2],e[e.length-1]),new THREE.Vector2(a,b)));this.actions.push({action:THREE.PathActions.LINE_TO,args:c})};
-THREE.Path.prototype.quadraticCurveTo=function(a,b,c,e){var f=Array.prototype.slice.call(arguments),h=this.actions[this.actions.length-1].args;this.curves.push(new THREE.QuadraticBezierCurve(new THREE.Vector2(h[h.length-2],h[h.length-1]),new THREE.Vector2(a,b),new THREE.Vector2(c,e)));this.actions.push({action:THREE.PathActions.QUADRATIC_CURVE_TO,args:f})};
-THREE.Path.prototype.bezierCurveTo=function(a,b,c,e,f,h){var g=Array.prototype.slice.call(arguments),k=this.actions[this.actions.length-1].args;this.curves.push(new THREE.CubicBezierCurve(new THREE.Vector2(k[k.length-2],k[k.length-1]),new THREE.Vector2(a,b),new THREE.Vector2(c,e),new THREE.Vector2(f,h)));this.actions.push({action:THREE.PathActions.BEZIER_CURVE_TO,args:g})};
-THREE.Path.prototype.splineThru=function(a){var b=Array.prototype.slice.call(arguments),c=this.actions[this.actions.length-1].args,c=[new THREE.Vector2(c[c.length-2],c[c.length-1])];Array.prototype.push.apply(c,a);this.curves.push(new THREE.SplineCurve(c));this.actions.push({action:THREE.PathActions.CSPLINE_THRU,args:b})};
-THREE.Path.prototype.arc=function(a,b,c,e,f,h){var g=Array.prototype.slice.call(arguments);this.curves.push(new THREE.ArcCurve(a,b,c,e,f,h));this.actions.push({action:THREE.PathActions.ARC,args:g})};THREE.Path.prototype.getSpacedPoints=function(a){a||(a=40);for(var b=[],c=0;c<a;c++)b.push(this.getPoint(c/a));return b};
-THREE.Path.prototype.getPoints=function(a,b){var a=a||12,c=[],e,f,h,g,k,l,m,n,o,t,u,v,y;e=0;for(f=this.actions.length;e<f;e++)switch(h=this.actions[e],g=h.action,h=h.args,g){case THREE.PathActions.LINE_TO:c.push(new THREE.Vector2(h[0],h[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:k=h[2];l=h[3];o=h[0];t=h[1];c.length>0?(g=c[c.length-1],u=g.x,v=g.y):(g=this.actions[e-1].args,u=g[g.length-2],v=g[g.length-1]);for(g=1;g<=a;g++)y=g/a,h=THREE.Shape.Utils.b2(y,u,o,k),y=THREE.Shape.Utils.b2(y,v,t,
-l),c.push(new THREE.Vector2(h,y));break;case THREE.PathActions.BEZIER_CURVE_TO:k=h[4];l=h[5];o=h[0];t=h[1];m=h[2];n=h[3];c.length>0?(g=c[c.length-1],u=g.x,v=g.y):(g=this.actions[e-1].args,u=g[g.length-2],v=g[g.length-1]);for(g=1;g<=a;g++)y=g/a,h=THREE.Shape.Utils.b3(y,u,o,m,k),y=THREE.Shape.Utils.b3(y,v,t,n,l),c.push(new THREE.Vector2(h,y));break;case THREE.PathActions.CSPLINE_THRU:g=this.actions[e-1].args;g=[new THREE.Vector2(g[g.length-2],g[g.length-1])];y=a*h[0].length;g=g.concat(h[0]);h=new THREE.SplineCurve(g);
-for(g=1;g<=y;g++)c.push(h.getPointAt(g/y));break;case THREE.PathActions.ARC:g=this.actions[e-1].args;k=h[0];l=h[1];m=h[2];o=h[3];y=h[4];t=!!h[5];n=g[g.length-2];u=g[g.length-1];g.length==0&&(n=u=0);v=y-o;var p=a*2;for(g=1;g<=p;g++)y=g/p,t||(y=1-y),y=o+y*v,h=n+k+m*Math.cos(y),y=u+l+m*Math.sin(y),c.push(new THREE.Vector2(h,y))}b&&c.push(c[0]);return c};THREE.Path.prototype.transform=function(a,b){this.getBoundingBox();return this.getWrapPoints(this.getPoints(b),a)};
-THREE.Path.prototype.nltransform=function(a,b,c,e,f,h){var g=this.getPoints(),k,l,m,n,o;k=0;for(l=g.length;k<l;k++)m=g[k],n=m.x,o=m.y,m.x=a*n+b*o+c,m.y=e*o+f*n+h;return g};
-THREE.Path.prototype.debug=function(a){var b=this.getBoundingBox();a||(a=document.createElement("canvas"),a.setAttribute("width",b.maxX+100),a.setAttribute("height",b.maxY+100),document.body.appendChild(a));b=a.getContext("2d");b.fillStyle="white";b.fillRect(0,0,a.width,a.height);b.strokeStyle="black";b.beginPath();var c,e,f,a=0;for(c=this.actions.length;a<c;a++)e=this.actions[a],f=e.args,e=e.action,e!=THREE.PathActions.CSPLINE_THRU&&b[e].apply(b,f);b.stroke();b.closePath();b.strokeStyle="red";e=
-this.getPoints();a=0;for(c=e.length;a<c;a++)f=e[a],b.beginPath(),b.arc(f.x,f.y,1.5,0,Math.PI*2,!1),b.stroke(),b.closePath()};
-THREE.Path.prototype.toShapes=function(){var a,b,c,e,f=[],h=new THREE.Path;a=0;for(b=this.actions.length;a<b;a++)c=this.actions[a],e=c.args,c=c.action,c==THREE.PathActions.MOVE_TO&&h.actions.length!=0&&(f.push(h),h=new THREE.Path),h[c].apply(h,e);h.actions.length!=0&&f.push(h);if(f.length==0)return[];var g,h=[];if(THREE.Shape.Utils.isClockWise(f[0].getPoints())){a=0;for(b=f.length;a<b;a++)e=f[a],THREE.Shape.Utils.isClockWise(e.getPoints())?(g&&h.push(g),g=new THREE.Shape,g.actions=e.actions,g.curves=
-e.curves):g.holes.push(e);h.push(g)}else{g=new THREE.Shape;a=0;for(b=f.length;a<b;a++)e=f[a],THREE.Shape.Utils.isClockWise(e.getPoints())?(g.actions=e.actions,g.curves=e.curves,h.push(g),g=new THREE.Shape):g.holes.push(e)}return h};THREE.Shape=function(){THREE.Path.apply(this,arguments);this.holes=[]};THREE.Shape.prototype=new THREE.Path;THREE.Shape.prototype.constructor=THREE.Path;THREE.Shape.prototype.extrude=function(a){return new THREE.ExtrudeGeometry(this,a)};
-THREE.Shape.prototype.getPointsHoles=function(a){var b,c=this.holes.length,e=[];for(b=0;b<c;b++)e[b]=this.holes[b].getTransformedPoints(a,this.bends);return e};THREE.Shape.prototype.getSpacedPointsHoles=function(a){var b,c=this.holes.length,e=[];for(b=0;b<c;b++)e[b]=this.holes[b].getTransformedSpacedPoints(a,this.bends);return e};THREE.Shape.prototype.extractAllPoints=function(a){return{shape:this.getTransformedPoints(a),holes:this.getPointsHoles(a)}};
+THREE.CurvePath.prototype.getPoint=function(a){for(var c=a*this.getLength(),b=this.getCurveLengths(),a=0;a<b.length;){if(b[a]>=c)return c=b[a]-c,a=this.curves[a],c=1-c/a.getLength(),a.getPointAt(c);a++}return null};THREE.CurvePath.prototype.getLength=function(){var a=this.getCurveLengths();return a[a.length-1]};
+THREE.CurvePath.prototype.getCurveLengths=function(){if(this.cacheLengths&&this.cacheLengths.length==this.curves.length)return this.cacheLengths;var a=[],c=0,b,e=this.curves.length;for(b=0;b<e;b++)c+=this.curves[b].getLength(),a.push(c);return this.cacheLengths=a};
+THREE.CurvePath.prototype.getBoundingBox=function(){var a=this.getPoints(),c,b,e,g;c=b=Number.NEGATIVE_INFINITY;e=g=Number.POSITIVE_INFINITY;var h,f,k,l;l=new THREE.Vector2;f=0;for(k=a.length;f<k;f++){h=a[f];if(h.x>c)c=h.x;else if(h.x<e)e=h.x;if(h.y>b)b=h.y;else if(h.y<b)g=h.y;l.addSelf(h.x,h.y)}return{minX:e,minY:g,maxX:c,maxY:b,centroid:l.divideScalar(k)}};THREE.CurvePath.prototype.createPointsGeometry=function(a){return this.createGeometry(this.getPoints(a,!0))};
+THREE.CurvePath.prototype.createSpacedPointsGeometry=function(a){return this.createGeometry(this.getSpacedPoints(a,!0))};THREE.CurvePath.prototype.createGeometry=function(a){for(var c=new THREE.Geometry,b=0;b<a.length;b++)c.vertices.push(new THREE.Vertex(new THREE.Vector3(a[b].x,a[b].y,0)));return c};THREE.CurvePath.prototype.addWrapPath=function(a){this.bends.push(a)};
+THREE.CurvePath.prototype.getTransformedPoints=function(a,c){var b=this.getPoints(a),e,g;if(!c)c=this.bends;e=0;for(g=c.length;e<g;e++)b=this.getWrapPoints(b,c[e]);return b};THREE.CurvePath.prototype.getTransformedSpacedPoints=function(a,c){var b=this.getSpacedPoints(a),e,g;if(!c)c=this.bends;e=0;for(g=c.length;e<g;e++)b=this.getWrapPoints(b,c[e]);return b};
+THREE.CurvePath.prototype.getWrapPoints=function(a,c){var b=this.getBoundingBox(),e,g,h,f,k,l;e=0;for(g=a.length;e<g;e++)h=a[e],f=h.x,k=h.y,l=f/b.maxX,l=c.getUtoTmapping(l,f),f=c.getPoint(l),k=c.getNormalVector(l).multiplyScalar(k),h.x=f.x+k.x,h.y=f.y+k.y;return a};THREE.Path=function(a){THREE.CurvePath.call(this);this.actions=[];a&&this.fromPoints(a)};THREE.Path.prototype=new THREE.CurvePath;THREE.Path.prototype.constructor=THREE.Path;
+THREE.PathActions={MOVE_TO:"moveTo",LINE_TO:"lineTo",QUADRATIC_CURVE_TO:"quadraticCurveTo",BEZIER_CURVE_TO:"bezierCurveTo",CSPLINE_THRU:"splineThru",ARC:"arc"};THREE.Path.prototype.fromPoints=function(a){this.moveTo(a[0].x,a[0].y);var c,b=a.length;for(c=1;c<b;c++)this.lineTo(a[c].x,a[c].y)};THREE.Path.prototype.moveTo=function(){var a=Array.prototype.slice.call(arguments);this.actions.push({action:THREE.PathActions.MOVE_TO,args:a})};
+THREE.Path.prototype.lineTo=function(a,c){var b=Array.prototype.slice.call(arguments),e=this.actions[this.actions.length-1].args;this.curves.push(new THREE.LineCurve(new THREE.Vector2(e[e.length-2],e[e.length-1]),new THREE.Vector2(a,c)));this.actions.push({action:THREE.PathActions.LINE_TO,args:b})};
+THREE.Path.prototype.quadraticCurveTo=function(a,c,b,e){var g=Array.prototype.slice.call(arguments),h=this.actions[this.actions.length-1].args;this.curves.push(new THREE.QuadraticBezierCurve(new THREE.Vector2(h[h.length-2],h[h.length-1]),new THREE.Vector2(a,c),new THREE.Vector2(b,e)));this.actions.push({action:THREE.PathActions.QUADRATIC_CURVE_TO,args:g})};
+THREE.Path.prototype.bezierCurveTo=function(a,c,b,e,g,h){var f=Array.prototype.slice.call(arguments),k=this.actions[this.actions.length-1].args;this.curves.push(new THREE.CubicBezierCurve(new THREE.Vector2(k[k.length-2],k[k.length-1]),new THREE.Vector2(a,c),new THREE.Vector2(b,e),new THREE.Vector2(g,h)));this.actions.push({action:THREE.PathActions.BEZIER_CURVE_TO,args:f})};
+THREE.Path.prototype.splineThru=function(a){var c=Array.prototype.slice.call(arguments),b=this.actions[this.actions.length-1].args,b=[new THREE.Vector2(b[b.length-2],b[b.length-1])];Array.prototype.push.apply(b,a);this.curves.push(new THREE.SplineCurve(b));this.actions.push({action:THREE.PathActions.CSPLINE_THRU,args:c})};
+THREE.Path.prototype.arc=function(a,c,b,e,g,h){var f=Array.prototype.slice.call(arguments);this.curves.push(new THREE.ArcCurve(a,c,b,e,g,h));this.actions.push({action:THREE.PathActions.ARC,args:f})};THREE.Path.prototype.getSpacedPoints=function(a){a||(a=40);for(var c=[],b=0;b<a;b++)c.push(this.getPoint(b/a));return c};
+THREE.Path.prototype.getPoints=function(a,c){var a=a||12,b=[],e,g,h,f,k,l,m,n,o,p,u,v,y;e=0;for(g=this.actions.length;e<g;e++)switch(h=this.actions[e],f=h.action,h=h.args,f){case THREE.PathActions.LINE_TO:b.push(new THREE.Vector2(h[0],h[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:k=h[2];l=h[3];o=h[0];p=h[1];b.length>0?(f=b[b.length-1],u=f.x,v=f.y):(f=this.actions[e-1].args,u=f[f.length-2],v=f[f.length-1]);for(f=1;f<=a;f++)y=f/a,h=THREE.Shape.Utils.b2(y,u,o,k),y=THREE.Shape.Utils.b2(y,v,p,
+l),b.push(new THREE.Vector2(h,y));break;case THREE.PathActions.BEZIER_CURVE_TO:k=h[4];l=h[5];o=h[0];p=h[1];m=h[2];n=h[3];b.length>0?(f=b[b.length-1],u=f.x,v=f.y):(f=this.actions[e-1].args,u=f[f.length-2],v=f[f.length-1]);for(f=1;f<=a;f++)y=f/a,h=THREE.Shape.Utils.b3(y,u,o,m,k),y=THREE.Shape.Utils.b3(y,v,p,n,l),b.push(new THREE.Vector2(h,y));break;case THREE.PathActions.CSPLINE_THRU:f=this.actions[e-1].args;f=[new THREE.Vector2(f[f.length-2],f[f.length-1])];y=a*h[0].length;f=f.concat(h[0]);h=new THREE.SplineCurve(f);
+for(f=1;f<=y;f++)b.push(h.getPointAt(f/y));break;case THREE.PathActions.ARC:f=this.actions[e-1].args;k=h[0];l=h[1];m=h[2];o=h[3];y=h[4];p=!!h[5];n=f[f.length-2];u=f[f.length-1];f.length==0&&(n=u=0);v=y-o;var t=a*2;for(f=1;f<=t;f++)y=f/t,p||(y=1-y),y=o+y*v,h=n+k+m*Math.cos(y),y=u+l+m*Math.sin(y),b.push(new THREE.Vector2(h,y))}c&&b.push(b[0]);return b};THREE.Path.prototype.transform=function(a,c){this.getBoundingBox();return this.getWrapPoints(this.getPoints(c),a)};
+THREE.Path.prototype.nltransform=function(a,c,b,e,g,h){var f=this.getPoints(),k,l,m,n,o;k=0;for(l=f.length;k<l;k++)m=f[k],n=m.x,o=m.y,m.x=a*n+c*o+b,m.y=e*o+g*n+h;return f};
+THREE.Path.prototype.debug=function(a){var c=this.getBoundingBox();a||(a=document.createElement("canvas"),a.setAttribute("width",c.maxX+100),a.setAttribute("height",c.maxY+100),document.body.appendChild(a));c=a.getContext("2d");c.fillStyle="white";c.fillRect(0,0,a.width,a.height);c.strokeStyle="black";c.beginPath();var b,e,g,a=0;for(b=this.actions.length;a<b;a++)e=this.actions[a],g=e.args,e=e.action,e!=THREE.PathActions.CSPLINE_THRU&&c[e].apply(c,g);c.stroke();c.closePath();c.strokeStyle="red";e=
+this.getPoints();a=0;for(b=e.length;a<b;a++)g=e[a],c.beginPath(),c.arc(g.x,g.y,1.5,0,Math.PI*2,!1),c.stroke(),c.closePath()};
+THREE.Path.prototype.toShapes=function(){var a,c,b,e,g=[],h=new THREE.Path;a=0;for(c=this.actions.length;a<c;a++)b=this.actions[a],e=b.args,b=b.action,b==THREE.PathActions.MOVE_TO&&h.actions.length!=0&&(g.push(h),h=new THREE.Path),h[b].apply(h,e);h.actions.length!=0&&g.push(h);if(g.length==0)return[];var f,h=[];if(THREE.Shape.Utils.isClockWise(g[0].getPoints())){a=0;for(c=g.length;a<c;a++)e=g[a],THREE.Shape.Utils.isClockWise(e.getPoints())?(f&&h.push(f),f=new THREE.Shape,f.actions=e.actions,f.curves=
+e.curves):f.holes.push(e);h.push(f)}else{f=new THREE.Shape;a=0;for(c=g.length;a<c;a++)e=g[a],THREE.Shape.Utils.isClockWise(e.getPoints())?(f.actions=e.actions,f.curves=e.curves,h.push(f),f=new THREE.Shape):f.holes.push(e)}return h};THREE.Shape=function(){THREE.Path.apply(this,arguments);this.holes=[]};THREE.Shape.prototype=new THREE.Path;THREE.Shape.prototype.constructor=THREE.Path;THREE.Shape.prototype.extrude=function(a){return new THREE.ExtrudeGeometry(this,a)};
+THREE.Shape.prototype.getPointsHoles=function(a){var c,b=this.holes.length,e=[];for(c=0;c<b;c++)e[c]=this.holes[c].getTransformedPoints(a,this.bends);return e};THREE.Shape.prototype.getSpacedPointsHoles=function(a){var c,b=this.holes.length,e=[];for(c=0;c<b;c++)e[c]=this.holes[c].getTransformedSpacedPoints(a,this.bends);return e};THREE.Shape.prototype.extractAllPoints=function(a){return{shape:this.getTransformedPoints(a),holes:this.getPointsHoles(a)}};
 THREE.Shape.prototype.extractAllSpacedPoints=function(a){return{shape:this.getTransformedSpacedPoints(a),holes:this.getSpacedPointsHoles(a)}};
-THREE.Shape.Utils={removeHoles:function(a,b){var c=a.concat(),e=c.concat(),f,h,g,k,l,m,n,o,t,u,v=[];for(l=0;l<b.length;l++){m=b[l];Array.prototype.push.apply(e,m);h=Number.POSITIVE_INFINITY;for(f=0;f<m.length;f++){t=m[f];u=[];for(o=0;o<c.length;o++)n=c[o],n=t.distanceToSquared(n),u.push(n),n<h&&(h=n,g=f,k=o)}f=k-1>=0?k-1:c.length-1;h=g-1>=0?g-1:m.length-1;var y=[m[g],c[k],c[f]];o=THREE.FontUtils.Triangulate.area(y);var p=[m[g],m[h],c[k]];t=THREE.FontUtils.Triangulate.area(p);u=k;n=g;k+=1;g+=-1;k<
-0&&(k+=c.length);k%=c.length;g<0&&(g+=m.length);g%=m.length;f=k-1>=0?k-1:c.length-1;h=g-1>=0?g-1:m.length-1;y=[m[g],c[k],c[f]];y=THREE.FontUtils.Triangulate.area(y);p=[m[g],m[h],c[k]];p=THREE.FontUtils.Triangulate.area(p);o+t>y+p&&(k=u,g=n,k<0&&(k+=c.length),k%=c.length,g<0&&(g+=m.length),g%=m.length,f=k-1>=0?k-1:c.length-1,h=g-1>=0?g-1:m.length-1);o=c.slice(0,k);t=c.slice(k);u=m.slice(g);n=m.slice(0,g);h=[m[g],m[h],c[k]];v.push([m[g],c[k],c[f]]);v.push(h);c=o.concat(u).concat(n).concat(t)}return{shape:c,
-isolatedPts:v,allpoints:e}},triangulateShape:function(a,b){var c=THREE.Shape.Utils.removeHoles(a,b),e=c.allpoints,f=c.isolatedPts,c=THREE.FontUtils.Triangulate(c.shape,!1),h,g,k,l,m={};h=0;for(g=e.length;h<g;h++)l=e[h].x+":"+e[h].y,m[l]!==void 0&&console.log("Duplicate point",l),m[l]=h;h=0;for(g=c.length;h<g;h++){k=c[h];for(e=0;e<3;e++)l=k[e].x+":"+k[e].y,l=m[l],l!==void 0&&(k[e]=l)}h=0;for(g=f.length;h<g;h++){k=f[h];for(e=0;e<3;e++)l=k[e].x+":"+k[e].y,l=m[l],l!==void 0&&(k[e]=l)}return c.concat(f)},
-isClockWise:function(a){return THREE.FontUtils.Triangulate.area(a)<0},b2p0:function(a,b){var c=1-a;return c*c*b},b2p1:function(a,b){return 2*(1-a)*a*b},b2p2:function(a,b){return a*a*b},b2:function(a,b,c,e){return this.b2p0(a,b)+this.b2p1(a,c)+this.b2p2(a,e)},b3p0:function(a,b){var c=1-a;return c*c*c*b},b3p1:function(a,b){var c=1-a;return 3*c*c*a*b},b3p2:function(a,b){return 3*(1-a)*a*a*b},b3p3:function(a,b){return a*a*a*b},b3:function(a,b,c,e,f){return this.b3p0(a,b)+this.b3p1(a,c)+this.b3p2(a,e)+
-this.b3p3(a,f)}};THREE.TextPath=function(a,b){THREE.Path.call(this);this.parameters=b||{};this.set(a)};THREE.TextPath.prototype.set=function(a,b){this.text=a;var b=b||this.parameters,c=b.curveSegments!==void 0?b.curveSegments:4,e=b.font!==void 0?b.font:"helvetiker",f=b.weight!==void 0?b.weight:"normal",h=b.style!==void 0?b.style:"normal";THREE.FontUtils.size=b.size!==void 0?b.size:100;THREE.FontUtils.divisions=c;THREE.FontUtils.face=e;THREE.FontUtils.weight=f;THREE.FontUtils.style=h};
-THREE.TextPath.prototype.toShapes=function(){for(var a=THREE.FontUtils.drawText(this.text).paths,b=[],c=0,e=a.length;c<e;c++)Array.prototype.push.apply(b,a[c].toShapes());return b};
-THREE.AnimationHandler=function(){var a=[],b={},c={update:function(c){for(var b=0;b<a.length;b++)a[b].update(c)},addToUpdate:function(c){a.indexOf(c)===-1&&a.push(c)},removeFromUpdate:function(c){c=a.indexOf(c);c!==-1&&a.splice(c,1)},add:function(a){b[a.name]!==void 0&&console.log("THREE.AnimationHandler.add: Warning! "+a.name+" already exists in library. Overwriting.");b[a.name]=a;if(a.initialized!==!0){for(var c=0;c<a.hierarchy.length;c++){for(var e=0;e<a.hierarchy[c].keys.length;e++){if(a.hierarchy[c].keys[e].time<
-0)a.hierarchy[c].keys[e].time=0;if(a.hierarchy[c].keys[e].rot!==void 0&&!(a.hierarchy[c].keys[e].rot instanceof THREE.Quaternion)){var k=a.hierarchy[c].keys[e].rot;a.hierarchy[c].keys[e].rot=new THREE.Quaternion(k[0],k[1],k[2],k[3])}}if(a.hierarchy[c].keys[0].morphTargets!==void 0){k={};for(e=0;e<a.hierarchy[c].keys.length;e++)for(var l=0;l<a.hierarchy[c].keys[e].morphTargets.length;l++){var m=a.hierarchy[c].keys[e].morphTargets[l];k[m]=-1}a.hierarchy[c].usedMorphTargets=k;for(e=0;e<a.hierarchy[c].keys.length;e++){var n=
-{};for(m in k){for(l=0;l<a.hierarchy[c].keys[e].morphTargets.length;l++)if(a.hierarchy[c].keys[e].morphTargets[l]===m){n[m]=a.hierarchy[c].keys[e].morphTargetsInfluences[l];break}l===a.hierarchy[c].keys[e].morphTargets.length&&(n[m]=0)}a.hierarchy[c].keys[e].morphTargetsInfluences=n}}for(e=1;e<a.hierarchy[c].keys.length;e++)a.hierarchy[c].keys[e].time===a.hierarchy[c].keys[e-1].time&&(a.hierarchy[c].keys.splice(e,1),e--);for(e=1;e<a.hierarchy[c].keys.length;e++)a.hierarchy[c].keys[e].index=e}e=parseInt(a.length*
-a.fps,10);a.JIT={};a.JIT.hierarchy=[];for(c=0;c<a.hierarchy.length;c++)a.JIT.hierarchy.push(Array(e));a.initialized=!0}},get:function(a){if(typeof a==="string")return b[a]?b[a]:(console.log("THREE.AnimationHandler.get: Couldn't find animation "+a),null)},parse:function(a){var c=[];if(a instanceof THREE.SkinnedMesh)for(var b=0;b<a.bones.length;b++)c.push(a.bones[b]);else e(a,c);return c}},e=function(a,c){c.push(a);for(var b=0;b<a.children.length;b++)e(a.children[b],c)};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.loop=this.isPaused=!0;this.interpolationType=c!==void 0?c:THREE.AnimationHandler.LINEAR;this.JITCompile=e!==void 0?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!==void 0?a:!0;this.currentTime=b!==void 0?b:0;var c,e=this.hierarchy.length,f;for(c=0;c<e;c++){f=this.hierarchy[c];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)f.useQuaternion=!0;f.matrixAutoUpdate=!0;if(f.animationCache===void 0)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[c].keys[0];h.rot=this.data.hierarchy[c].keys[0];h.scl=this.data.hierarchy[c].keys[0];f.pos=this.getNextKeyWith("pos",c,1);f.rot=this.getNextKeyWith("rot",c,1);f.scl=this.getNextKeyWith("scl",c,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
+THREE.Shape.Utils={removeHoles:function(a,c){var b=a.concat(),e=b.concat(),g,h,f,k,l,m,n,o,p,u,v=[];for(l=0;l<c.length;l++){m=c[l];Array.prototype.push.apply(e,m);h=Number.POSITIVE_INFINITY;for(g=0;g<m.length;g++){p=m[g];u=[];for(o=0;o<b.length;o++)n=b[o],n=p.distanceToSquared(n),u.push(n),n<h&&(h=n,f=g,k=o)}g=k-1>=0?k-1:b.length-1;h=f-1>=0?f-1:m.length-1;var y=[m[f],b[k],b[g]];o=THREE.FontUtils.Triangulate.area(y);var t=[m[f],m[h],b[k]];p=THREE.FontUtils.Triangulate.area(t);u=k;n=f;k+=1;f+=-1;k<
+0&&(k+=b.length);k%=b.length;f<0&&(f+=m.length);f%=m.length;g=k-1>=0?k-1:b.length-1;h=f-1>=0?f-1:m.length-1;y=[m[f],b[k],b[g]];y=THREE.FontUtils.Triangulate.area(y);t=[m[f],m[h],b[k]];t=THREE.FontUtils.Triangulate.area(t);o+p>y+t&&(k=u,f=n,k<0&&(k+=b.length),k%=b.length,f<0&&(f+=m.length),f%=m.length,g=k-1>=0?k-1:b.length-1,h=f-1>=0?f-1:m.length-1);o=b.slice(0,k);p=b.slice(k);u=m.slice(f);n=m.slice(0,f);h=[m[f],m[h],b[k]];v.push([m[f],b[k],b[g]]);v.push(h);b=o.concat(u).concat(n).concat(p)}return{shape:b,
+isolatedPts:v,allpoints:e}},triangulateShape:function(a,c){var b=THREE.Shape.Utils.removeHoles(a,c),e=b.allpoints,g=b.isolatedPts,b=THREE.FontUtils.Triangulate(b.shape,!1),h,f,k,l,m={};h=0;for(f=e.length;h<f;h++)l=e[h].x+":"+e[h].y,m[l]!==void 0&&console.log("Duplicate point",l),m[l]=h;h=0;for(f=b.length;h<f;h++){k=b[h];for(e=0;e<3;e++)l=k[e].x+":"+k[e].y,l=m[l],l!==void 0&&(k[e]=l)}h=0;for(f=g.length;h<f;h++){k=g[h];for(e=0;e<3;e++)l=k[e].x+":"+k[e].y,l=m[l],l!==void 0&&(k[e]=l)}return b.concat(g)},
+isClockWise:function(a){return THREE.FontUtils.Triangulate.area(a)<0},b2p0:function(a,c){var b=1-a;return b*b*c},b2p1:function(a,c){return 2*(1-a)*a*c},b2p2:function(a,c){return a*a*c},b2:function(a,c,b,e){return this.b2p0(a,c)+this.b2p1(a,b)+this.b2p2(a,e)},b3p0:function(a,c){var b=1-a;return b*b*b*c},b3p1:function(a,c){var b=1-a;return 3*b*b*a*c},b3p2:function(a,c){return 3*(1-a)*a*a*c},b3p3:function(a,c){return a*a*a*c},b3:function(a,c,b,e,g){return this.b3p0(a,c)+this.b3p1(a,b)+this.b3p2(a,e)+
+this.b3p3(a,g)}};THREE.TextPath=function(a,c){THREE.Path.call(this);this.parameters=c||{};this.set(a)};THREE.TextPath.prototype.set=function(a,c){this.text=a;var c=c||this.parameters,b=c.curveSegments!==void 0?c.curveSegments:4,e=c.font!==void 0?c.font:"helvetiker",g=c.weight!==void 0?c.weight:"normal",h=c.style!==void 0?c.style:"normal";THREE.FontUtils.size=c.size!==void 0?c.size:100;THREE.FontUtils.divisions=b;THREE.FontUtils.face=e;THREE.FontUtils.weight=g;THREE.FontUtils.style=h};
+THREE.TextPath.prototype.toShapes=function(){for(var a=THREE.FontUtils.drawText(this.text).paths,c=[],b=0,e=a.length;b<e;b++)Array.prototype.push.apply(c,a[b].toShapes());return c};
+THREE.AnimationHandler=function(){var a=[],c={},b={update:function(b){for(var c=0;c<a.length;c++)a[c].update(b)},addToUpdate:function(b){a.indexOf(b)===-1&&a.push(b)},removeFromUpdate:function(b){b=a.indexOf(b);b!==-1&&a.splice(b,1)},add:function(a){c[a.name]!==void 0&&console.log("THREE.AnimationHandler.add: Warning! "+a.name+" already exists in library. Overwriting.");c[a.name]=a;if(a.initialized!==!0){for(var b=0;b<a.hierarchy.length;b++){for(var e=0;e<a.hierarchy[b].keys.length;e++){if(a.hierarchy[b].keys[e].time<
+0)a.hierarchy[b].keys[e].time=0;if(a.hierarchy[b].keys[e].rot!==void 0&&!(a.hierarchy[b].keys[e].rot instanceof THREE.Quaternion)){var k=a.hierarchy[b].keys[e].rot;a.hierarchy[b].keys[e].rot=new THREE.Quaternion(k[0],k[1],k[2],k[3])}}if(a.hierarchy[b].keys[0].morphTargets!==void 0){k={};for(e=0;e<a.hierarchy[b].keys.length;e++)for(var l=0;l<a.hierarchy[b].keys[e].morphTargets.length;l++){var m=a.hierarchy[b].keys[e].morphTargets[l];k[m]=-1}a.hierarchy[b].usedMorphTargets=k;for(e=0;e<a.hierarchy[b].keys.length;e++){var n=
+{};for(m in k){for(l=0;l<a.hierarchy[b].keys[e].morphTargets.length;l++)if(a.hierarchy[b].keys[e].morphTargets[l]===m){n[m]=a.hierarchy[b].keys[e].morphTargetsInfluences[l];break}l===a.hierarchy[b].keys[e].morphTargets.length&&(n[m]=0)}a.hierarchy[b].keys[e].morphTargetsInfluences=n}}for(e=1;e<a.hierarchy[b].keys.length;e++)a.hierarchy[b].keys[e].time===a.hierarchy[b].keys[e-1].time&&(a.hierarchy[b].keys.splice(e,1),e--);for(e=1;e<a.hierarchy[b].keys.length;e++)a.hierarchy[b].keys[e].index=e}e=parseInt(a.length*
+a.fps,10);a.JIT={};a.JIT.hierarchy=[];for(b=0;b<a.hierarchy.length;b++)a.JIT.hierarchy.push(Array(e));a.initialized=!0}},get:function(a){if(typeof a==="string")return c[a]?c[a]:(console.log("THREE.AnimationHandler.get: Couldn't find animation "+a),null)},parse:function(a){var b=[];if(a instanceof THREE.SkinnedMesh)for(var c=0;c<a.bones.length;c++)b.push(a.bones[c]);else e(a,b);return b}},e=function(a,b){b.push(a);for(var c=0;c<a.children.length;c++)e(a.children[c],b)};b.LINEAR=0;b.CATMULLROM=1;b.CATMULLROM_FORWARD=
+2;return b}();THREE.Animation=function(a,c,b,e){this.root=a;this.data=THREE.AnimationHandler.get(c);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.loop=this.isPaused=!0;this.interpolationType=b!==void 0?b:THREE.AnimationHandler.LINEAR;this.JITCompile=e!==void 0?e:!0;this.points=[];this.target=new THREE.Vector3};
+THREE.Animation.prototype.play=function(a,c){if(!this.isPlaying){this.isPlaying=!0;this.loop=a!==void 0?a:!0;this.currentTime=c!==void 0?c:0;var b,e=this.hierarchy.length,g;for(b=0;b<e;b++){g=this.hierarchy[b];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)g.useQuaternion=!0;g.matrixAutoUpdate=!0;if(g.animationCache===void 0)g.animationCache={},g.animationCache.prevKey={pos:0,rot:0,scl:0},g.animationCache.nextKey={pos:0,rot:0,scl:0},g.animationCache.originalMatrix=g instanceof
+THREE.Bone?g.skinMatrix:g.matrix;var h=g.animationCache.prevKey;g=g.animationCache.nextKey;h.pos=this.data.hierarchy[b].keys[0];h.rot=this.data.hierarchy[b].keys[0];h.scl=this.data.hierarchy[b].keys[0];g.pos=this.getNextKeyWith("pos",b,1);g.rot=this.getNextKeyWith("rot",b,1);g.scl=this.getNextKeyWith("scl",b,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.isPaused=this.isPlaying=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.hierarchy.length;a++)if(this.hierarchy[a].animationCache!==void 0)this.hierarchy[a]instanceof THREE.Bone?this.hierarchy[a].skinMatrix=this.hierarchy[a].animationCache.originalMatrix: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,f,h,g,k,l,m,n=this.data.JIT.hierarchy,o,t;this.currentTime+=a*this.timeScale;t=this.currentTime;o=this.currentTime%=this.data.length;m=parseInt(Math.min(o*this.data.fps,this.data.length*this.data.fps),10);for(var u=0,v=this.hierarchy.length;u<v;u++)if(a=this.hierarchy[u],l=a.animationCache,this.JITCompile&&n[u][m]!==void 0)a instanceof THREE.Bone?(a.skinMatrix=n[u][m],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=
-!1):(a.matrix=n[u][m],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=!0);else{if(this.JITCompile)a instanceof THREE.Bone?a.skinMatrix=a.animationCache.originalMatrix:a.matrix=a.animationCache.originalMatrix;for(var y=0;y<3;y++){c=b[y];g=l.prevKey[c];k=l.nextKey[c];if(k.time<=t){if(o<t)if(this.loop){g=this.data.hierarchy[u].keys[0];for(k=this.getNextKeyWith(c,u,1);k.time<o;)g=k,k=this.getNextKeyWith(c,u,k.index+1)}else{this.stop();return}else{do g=k,k=this.getNextKeyWith(c,u,k.index+1);while(k.time<
-o)}l.prevKey[c]=g;l.nextKey[c]=k}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;e=(o-g.time)/(k.time-g.time);f=g[c];h=k[c];if(e<0||e>1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+e+" on bone "+u),e=e<0?0:1;if(c==="pos")if(c=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)c.x=f[0]+(h[0]-f[0])*e,c.y=f[1]+(h[1]-f[1])*e,c.z=f[2]+(h[2]-f[2])*e;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
-this.getPrevKeyWith("pos",u,g.index-1).pos,this.points[1]=f,this.points[2]=h,this.points[3]=this.getNextKeyWith("pos",u,k.index+1).pos,e=e*0.33+0.33,f=this.interpolateCatmullRom(this.points,e),c.x=f[0],c.y=f[1],c.z=f[2],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(f,h,a.quaternion,e);else if(c==="scl")c=a.scale,c.x=f[0]+(h[0]-f[0])*e,c.y=f[1]+(h[1]-f[1])*e,c.z=f[2]+(h[2]-f[2])*e}}if(this.JITCompile&&n[0][m]===void 0){this.hierarchy[0].update(void 0,!0);for(u=0;u<this.hierarchy.length;u++)n[u][m]=this.hierarchy[u]instanceof THREE.Bone?this.hierarchy[u].skinMatrix.clone():this.hierarchy[u].matrix.clone()}}};
-THREE.Animation.prototype.interpolateCatmullRom=function(a,b){var c=[],e=[],f,h,g,k,l,m;f=(a.length-1)*b;h=Math.floor(f);f-=h;c[0]=h==0?h:h-1;c[1]=h;c[2]=h>a.length-2?h:h+1;c[3]=h>a.length-3?h:h+2;h=a[c[0]];k=a[c[1]];l=a[c[2]];m=a[c[3]];c=f*f;g=f*c;e[0]=this.interpolate(h[0],k[0],l[0],m[0],f,c,g);e[1]=this.interpolate(h[1],k[1],l[1],m[1],f,c,g);e[2]=this.interpolate(h[2],k[2],l[2],m[2],f,c,g);return e};
-THREE.Animation.prototype.interpolate=function(a,b,c,e,f,h,g){a=(c-a)*0.5;e=(e-b)*0.5;return(2*(b-c)+a+e)*g+(-3*(b-c)-2*a-e)*h+a*f+b};THREE.Animation.prototype.getNextKeyWith=function(a,b,c){var e=this.data.hierarchy[b].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c=c<e.length-1?c:e.length-1:c%=e.length;c<e.length;c++)if(e[c][a]!==void 0)return e[c];return this.data.hierarchy[b].keys[0]};
-THREE.Animation.prototype.getPrevKeyWith=function(a,b,c){for(var e=this.data.hierarchy[b].keys,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]!==void 0)return e[c];return this.data.hierarchy[b].keys[e.length-1]};
-THREE.CubeCamera=function(a,b,c,e){this.heightOffset=c;this.position=new THREE.Vector3(0,c,0);this.cameraPX=new THREE.PerspectiveCamera(90,1,a,b);this.cameraNX=new THREE.PerspectiveCamera(90,1,a,b);this.cameraPY=new THREE.PerspectiveCamera(90,1,a,b);this.cameraNY=new THREE.PerspectiveCamera(90,1,a,b);this.cameraPZ=new THREE.PerspectiveCamera(90,1,a,b);this.cameraNZ=new THREE.PerspectiveCamera(90,1,a,b);this.cameraPX.position=this.position;this.cameraNX.position=this.position;this.cameraPY.position=
+THREE.Animation.prototype.update=function(a){if(this.isPlaying){var c=["pos","rot","scl"],b,e,g,h,f,k,l,m,n=this.data.JIT.hierarchy,o,p;this.currentTime+=a*this.timeScale;p=this.currentTime;o=this.currentTime%=this.data.length;m=parseInt(Math.min(o*this.data.fps,this.data.length*this.data.fps),10);for(var u=0,v=this.hierarchy.length;u<v;u++)if(a=this.hierarchy[u],l=a.animationCache,this.JITCompile&&n[u][m]!==void 0)a instanceof THREE.Bone?(a.skinMatrix=n[u][m],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=
+!1):(a.matrix=n[u][m],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=!0);else{if(this.JITCompile)a instanceof THREE.Bone?a.skinMatrix=a.animationCache.originalMatrix:a.matrix=a.animationCache.originalMatrix;for(var y=0;y<3;y++){b=c[y];f=l.prevKey[b];k=l.nextKey[b];if(k.time<=p){if(o<p)if(this.loop){f=this.data.hierarchy[u].keys[0];for(k=this.getNextKeyWith(b,u,1);k.time<o;)f=k,k=this.getNextKeyWith(b,u,k.index+1)}else{this.stop();return}else{do f=k,k=this.getNextKeyWith(b,u,k.index+1);while(k.time<
+o)}l.prevKey[b]=f;l.nextKey[b]=k}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;e=(o-f.time)/(k.time-f.time);g=f[b];h=k[b];if(e<0||e>1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+e+" on bone "+u),e=e<0?0:1;if(b==="pos")if(b=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)b.x=g[0]+(h[0]-g[0])*e,b.y=g[1]+(h[1]-g[1])*e,b.z=g[2]+(h[2]-g[2])*e;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
+this.getPrevKeyWith("pos",u,f.index-1).pos,this.points[1]=g,this.points[2]=h,this.points[3]=this.getNextKeyWith("pos",u,k.index+1).pos,e=e*0.33+0.33,g=this.interpolateCatmullRom(this.points,e),b.x=g[0],b.y=g[1],b.z=g[2],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(b),this.target.y=0,this.target.normalize(),e=Math.atan2(this.target.x,this.target.z),a.rotation.set(0,e,0)}else if(b===
+"rot")THREE.Quaternion.slerp(g,h,a.quaternion,e);else if(b==="scl")b=a.scale,b.x=g[0]+(h[0]-g[0])*e,b.y=g[1]+(h[1]-g[1])*e,b.z=g[2]+(h[2]-g[2])*e}}if(this.JITCompile&&n[0][m]===void 0){this.hierarchy[0].update(void 0,!0);for(u=0;u<this.hierarchy.length;u++)n[u][m]=this.hierarchy[u]instanceof THREE.Bone?this.hierarchy[u].skinMatrix.clone():this.hierarchy[u].matrix.clone()}}};
+THREE.Animation.prototype.interpolateCatmullRom=function(a,c){var b=[],e=[],g,h,f,k,l,m;g=(a.length-1)*c;h=Math.floor(g);g-=h;b[0]=h==0?h:h-1;b[1]=h;b[2]=h>a.length-2?h:h+1;b[3]=h>a.length-3?h:h+2;h=a[b[0]];k=a[b[1]];l=a[b[2]];m=a[b[3]];b=g*g;f=g*b;e[0]=this.interpolate(h[0],k[0],l[0],m[0],g,b,f);e[1]=this.interpolate(h[1],k[1],l[1],m[1],g,b,f);e[2]=this.interpolate(h[2],k[2],l[2],m[2],g,b,f);return e};
+THREE.Animation.prototype.interpolate=function(a,c,b,e,g,h,f){a=(b-a)*0.5;e=(e-c)*0.5;return(2*(c-b)+a+e)*f+(-3*(c-b)-2*a-e)*h+a*g+c};THREE.Animation.prototype.getNextKeyWith=function(a,c,b){var e=this.data.hierarchy[c].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?b=b<e.length-1?b:e.length-1:b%=e.length;b<e.length;b++)if(e[b][a]!==void 0)return e[b];return this.data.hierarchy[c].keys[0]};
+THREE.Animation.prototype.getPrevKeyWith=function(a,c,b){for(var e=this.data.hierarchy[c].keys,b=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?b>0?b:0:b>=0?b:b+e.length;b>=0;b--)if(e[b][a]!==void 0)return e[b];return this.data.hierarchy[c].keys[e.length-1]};
+THREE.CubeCamera=function(a,c,b,e){this.heightOffset=b;this.position=new THREE.Vector3(0,b,0);this.cameraPX=new THREE.PerspectiveCamera(90,1,a,c);this.cameraNX=new THREE.PerspectiveCamera(90,1,a,c);this.cameraPY=new THREE.PerspectiveCamera(90,1,a,c);this.cameraNY=new THREE.PerspectiveCamera(90,1,a,c);this.cameraPZ=new THREE.PerspectiveCamera(90,1,a,c);this.cameraNZ=new THREE.PerspectiveCamera(90,1,a,c);this.cameraPX.position=this.position;this.cameraNX.position=this.position;this.cameraPY.position=
 this.position;this.cameraNY.position=this.position;this.cameraPZ.position=this.position;this.cameraNZ.position=this.position;this.cameraPX.up.set(0,-1,0);this.cameraNX.up.set(0,-1,0);this.cameraPY.up.set(0,0,1);this.cameraNY.up.set(0,0,-1);this.cameraPZ.up.set(0,-1,0);this.cameraNZ.up.set(0,-1,0);this.targetPX=new THREE.Vector3(0,0,0);this.targetNX=new THREE.Vector3(0,0,0);this.targetPY=new THREE.Vector3(0,0,0);this.targetNY=new THREE.Vector3(0,0,0);this.targetPZ=new THREE.Vector3(0,0,0);this.targetNZ=
 new THREE.Vector3(0,0,0);this.renderTarget=new THREE.WebGLRenderTargetCube(e,e,{format:THREE.RGBFormat,magFilter:THREE.LinearFilter,minFilter:THREE.LinearFilter});this.updatePosition=function(a){this.position.copy(a);this.position.y+=this.heightOffset;this.targetPX.copy(this.position);this.targetNX.copy(this.position);this.targetPY.copy(this.position);this.targetNY.copy(this.position);this.targetPZ.copy(this.position);this.targetNZ.copy(this.position);this.targetPX.x+=1;this.targetNX.x-=1;this.targetPY.y+=
-1;this.targetNY.y-=1;this.targetPZ.z+=1;this.targetNZ.z-=1;this.cameraPX.lookAt(this.targetPX);this.cameraNX.lookAt(this.targetNX);this.cameraPY.lookAt(this.targetPY);this.cameraNY.lookAt(this.targetNY);this.cameraPZ.lookAt(this.targetPZ);this.cameraNZ.lookAt(this.targetNZ)};this.updateCubeMap=function(a,c){var b=this.renderTarget;b.activeCubeFace=0;a.render(c,this.cameraPX,b);b.activeCubeFace=1;a.render(c,this.cameraNX,b);b.activeCubeFace=2;a.render(c,this.cameraPY,b);b.activeCubeFace=3;a.render(c,
-this.cameraNY,b);b.activeCubeFace=4;a.render(c,this.cameraPZ,b);b.activeCubeFace=5;a.render(c,this.cameraNZ,b)}};THREE.FirstPersonCamera=function(){console.warn("DEPRECATED: FirstPersonCamera() is FirstPersonControls().")};THREE.PathCamera=function(){console.warn("DEPRECATED: PathCamera() is PathControls().")};THREE.FlyCamera=function(){console.warn("DEPRECATED: FlyCamera() is FlyControls().")};THREE.RollCamera=function(){console.warn("DEPRECATED: RollCamera() is RollControls().")};
-THREE.TrackballCamera=function(){console.warn("DEPRECATED: TrackballCamera() is TrackballControls().")};THREE.CombinedCamera=function(a,b,c,e,f,h,g){THREE.Camera.call(this);this.cameraO=new THREE.OrthographicCamera(a/-2,a/2,b/2,b/-2,h,g);this.cameraP=new THREE.PerspectiveCamera(c,a/b,e,f);this.toPerspective()};THREE.CombinedCamera.prototype=new THREE.Camera;THREE.CombinedCamera.prototype.constructor=THREE.CoolCamera;
+1;this.targetNY.y-=1;this.targetPZ.z+=1;this.targetNZ.z-=1;this.cameraPX.lookAt(this.targetPX);this.cameraNX.lookAt(this.targetNX);this.cameraPY.lookAt(this.targetPY);this.cameraNY.lookAt(this.targetNY);this.cameraPZ.lookAt(this.targetPZ);this.cameraNZ.lookAt(this.targetNZ)};this.updateCubeMap=function(a,b){var e=this.renderTarget;e.activeCubeFace=0;a.render(b,this.cameraPX,e);e.activeCubeFace=1;a.render(b,this.cameraNX,e);e.activeCubeFace=2;a.render(b,this.cameraPY,e);e.activeCubeFace=3;a.render(b,
+this.cameraNY,e);e.activeCubeFace=4;a.render(b,this.cameraPZ,e);e.activeCubeFace=5;a.render(b,this.cameraNZ,e)}};THREE.FirstPersonCamera=function(){console.warn("DEPRECATED: FirstPersonCamera() is FirstPersonControls().")};THREE.PathCamera=function(){console.warn("DEPRECATED: PathCamera() is PathControls().")};THREE.FlyCamera=function(){console.warn("DEPRECATED: FlyCamera() is FlyControls().")};THREE.RollCamera=function(){console.warn("DEPRECATED: RollCamera() is RollControls().")};
+THREE.TrackballCamera=function(){console.warn("DEPRECATED: TrackballCamera() is TrackballControls().")};THREE.CombinedCamera=function(a,c,b,e,g,h,f){THREE.Camera.call(this);this.cameraO=new THREE.OrthographicCamera(a/-2,a/2,c/2,c/-2,h,f);this.cameraP=new THREE.PerspectiveCamera(b,a/c,e,g);this.toPerspective()};THREE.CombinedCamera.prototype=new THREE.Camera;THREE.CombinedCamera.prototype.constructor=THREE.CoolCamera;
 THREE.CombinedCamera.prototype.toPerspective=function(){this.near=this.cameraP.near;this.far=this.cameraP.far;this.projectionMatrix=this.cameraP.projectionMatrix};THREE.CombinedCamera.prototype.toOrthographic=function(){this.near=this.cameraO.near;this.far=this.cameraO.far;this.projectionMatrix=this.cameraO.projectionMatrix};THREE.CombinedCamera.prototype.setFov=function(a){this.cameraP.fov=a;this.cameraP.updateProjectionMatrix();this.toPerspective()};
-THREE.CombinedCamera.prototype.setLens=function(a,b){b||(b=43.25);var c=2*Math.atan(b/(a*2));c*=180/Math.PI;this.setFov(c);return c};
-THREE.FirstPersonControls=function(a,b){function c(a,c){return function(){c.apply(a,arguments)}}this.object=a;this.target=new THREE.Vector3(0,0,0);this.domElement=b!==void 0?b:document;this.movementSpeed=1;this.lookSpeed=0.0050;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=Math.PI;this.lastUpdate=(new Date).getTime();this.theta=this.phi=this.lon=this.lat=
+THREE.CombinedCamera.prototype.setLens=function(a,c){c||(c=43.25);var b=2*Math.atan(c/(a*2));b*=180/Math.PI;this.setFov(b);return b};
+THREE.FirstPersonControls=function(a,c){function b(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.target=new THREE.Vector3(0,0,0);this.domElement=c!==void 0?c:document;this.movementSpeed=1;this.lookSpeed=0.0050;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=Math.PI;this.lastUpdate=(new Date).getTime();this.theta=this.phi=this.lon=this.lat=
 this.mouseY=this.mouseX=this.autoSpeedFactor=this.tdiff=0;this.mouseDragOn=this.freeze=this.moveRight=this.moveLeft=this.moveBackward=this.moveForward=!1;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));this.onMouseDown=function(a){this.domElement!==document&&this.domElement.focus();a.preventDefault();a.stopPropagation();
 if(this.activeLook)switch(a.button){case 0:this.moveForward=!0;break;case 2:this.moveBackward=!0}this.mouseDragOn=!0};this.onMouseUp=function(a){a.preventDefault();a.stopPropagation();if(this.activeLook)switch(a.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=!1}this.mouseDragOn=!1};this.onMouseMove=function(a){this.domElement===document?(this.mouseX=a.pageX-this.viewHalfX,this.mouseY=a.pageY-this.viewHalfY):(this.mouseX=a.pageX-this.domElement.offsetLeft-this.viewHalfX,this.mouseY=
 a.pageY-this.domElement.offsetTop-this.viewHalfY)};this.onKeyDown=function(a){switch(a.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;break;case 82:this.moveUp=!0;break;case 70:this.moveDown=!0;break;case 81:this.freeze=!this.freeze}};this.onKeyUp=function(a){switch(a.keyCode){case 38:case 87:this.moveForward=!1;break;case 37:case 65:this.moveLeft=!1;break;case 40:case 83:this.moveBackward=
-!1;break;case 39:case 68:this.moveRight=!1;break;case 82:this.moveUp=!1;break;case 70:this.moveDown=!1}};this.update=function(){var a=(new Date).getTime();this.tdiff=(a-this.lastUpdate)/1E3;this.lastUpdate=a;if(!this.freeze){this.autoSpeedFactor=this.heightSpeed?this.tdiff*((this.object.position.y<this.heightMin?this.heightMin:this.object.position.y>this.heightMax?this.heightMax:this.object.position.y)-this.heightMin)*this.heightCoef:0;var c=this.tdiff*this.movementSpeed;(this.moveForward||this.autoForward&&
-!this.moveBackward)&&this.object.translateZ(-(c+this.autoSpeedFactor));this.moveBackward&&this.object.translateZ(c);this.moveLeft&&this.object.translateX(-c);this.moveRight&&this.object.translateX(c);this.moveUp&&this.object.translateY(c);this.moveDown&&this.object.translateY(-c);c=this.tdiff*this.lookSpeed;this.activeLook||(c=0);this.lon+=this.mouseX*c;this.lookVertical&&(this.lat-=this.mouseY*c);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*
-Math.PI/180;var a=this.target,b=this.object.position;a.x=b.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=b.y+100*Math.cos(this.phi);a.z=b.z+100*Math.sin(this.phi)*Math.sin(this.theta)}a=1;this.constrainVertical&&(a=Math.PI/(this.verticalMax-this.verticalMin));this.lon+=this.mouseX*c;this.lookVertical&&(this.lat-=this.mouseY*c*a);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;if(this.constrainVertical)this.phi=(this.phi-0)*(this.verticalMax-
-this.verticalMin)/(Math.PI-0)+this.verticalMin;a=this.target;b=this.object.position;a.x=b.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=b.y+100*Math.cos(this.phi);a.z=b.z+100*Math.sin(this.phi)*Math.sin(this.theta);this.object.lookAt(a)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",c(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",c(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",
-c(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",c(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",c(this,this.onKeyUp),!1)};
-THREE.PathControls=function(a,b){function c(a){if((a*=2)<1)return 0.5*a*a;return-0.5*(--a*(a-2)-1)}function e(a,c){return function(){c.apply(a,arguments)}}function f(a,c,b,e){var g={name:b,fps:0.6,length:e,hierarchy:[]},h,f=c.getControlPointsArray(),k=c.getLength(),p=f.length,z=0;h=p-1;c={parent:-1,keys:[]};c.keys[0]={time:0,pos:f[0],rot:[0,0,0,1],scl:[1,1,1]};c.keys[h]={time:e,pos:f[h],rot:[0,0,0,1],scl:[1,1,1]};for(h=1;h<p-1;h++)z=e*k.chunks[h]/k.total,c.keys[h]={time:z,pos:f[h]};g.hierarchy[0]=
-c;THREE.AnimationHandler.add(g);return new THREE.Animation(a,b,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function h(a,c){var b,e,g=new THREE.Geometry;for(b=0;b<a.points.length*c;b++)e=b/(a.points.length*c),e=a.getPoint(e),g.vertices[b]=new THREE.Vertex(new THREE.Vector3(e.x,e.y,e.z));return g}this.object=a;this.domElement=b!==void 0?b:document;this.id="PathControls"+THREE.PathControlsIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=
+!1;break;case 39:case 68:this.moveRight=!1;break;case 82:this.moveUp=!1;break;case 70:this.moveDown=!1}};this.update=function(){var a=(new Date).getTime();this.tdiff=(a-this.lastUpdate)/1E3;this.lastUpdate=a;if(!this.freeze){this.autoSpeedFactor=this.heightSpeed?this.tdiff*((this.object.position.y<this.heightMin?this.heightMin:this.object.position.y>this.heightMax?this.heightMax:this.object.position.y)-this.heightMin)*this.heightCoef:0;var b=this.tdiff*this.movementSpeed;(this.moveForward||this.autoForward&&
+!this.moveBackward)&&this.object.translateZ(-(b+this.autoSpeedFactor));this.moveBackward&&this.object.translateZ(b);this.moveLeft&&this.object.translateX(-b);this.moveRight&&this.object.translateX(b);this.moveUp&&this.object.translateY(b);this.moveDown&&this.object.translateY(-b);b=this.tdiff*this.lookSpeed;this.activeLook||(b=0);this.lon+=this.mouseX*b;this.lookVertical&&(this.lat-=this.mouseY*b);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*
+Math.PI/180;var a=this.target,c=this.object.position;a.x=c.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=c.y+100*Math.cos(this.phi);a.z=c.z+100*Math.sin(this.phi)*Math.sin(this.theta)}a=1;this.constrainVertical&&(a=Math.PI/(this.verticalMax-this.verticalMin));this.lon+=this.mouseX*b;this.lookVertical&&(this.lat-=this.mouseY*b*a);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;if(this.constrainVertical)this.phi=(this.phi-0)*(this.verticalMax-
+this.verticalMin)/(Math.PI-0)+this.verticalMin;a=this.target;c=this.object.position;a.x=c.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=c.y+100*Math.cos(this.phi);a.z=c.z+100*Math.sin(this.phi)*Math.sin(this.theta);this.object.lookAt(a)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",b(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",b(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",
+b(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",b(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",b(this,this.onKeyUp),!1)};
+THREE.PathControls=function(a,c){function b(a){if((a*=2)<1)return 0.5*a*a;return-0.5*(--a*(a-2)-1)}function e(a,b){return function(){b.apply(a,arguments)}}function g(a,b,c,e){var f={name:c,fps:0.6,length:e,hierarchy:[]},h,g=b.getControlPointsArray(),k=b.getLength(),t=g.length,z=0;h=t-1;b={parent:-1,keys:[]};b.keys[0]={time:0,pos:g[0],rot:[0,0,0,1],scl:[1,1,1]};b.keys[h]={time:e,pos:g[h],rot:[0,0,0,1],scl:[1,1,1]};for(h=1;h<t-1;h++)z=e*k.chunks[h]/k.total,b.keys[h]={time:z,pos:g[h]};f.hierarchy[0]=
+b;THREE.AnimationHandler.add(f);return new THREE.Animation(a,c,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function h(a,b){var c,e,f=new THREE.Geometry;for(c=0;c<a.points.length*b;c++)e=c/(a.points.length*b),e=a.getPoint(e),f.vertices[c]=new THREE.Vertex(new THREE.Vector3(e.x,e.y,e.z));return f}this.object=a;this.domElement=c!==void 0?c:document;this.id="PathControls"+THREE.PathControlsIdCounter++;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.lookHorizontal=this.lookVertical=!0;this.verticalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.horizontalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.target=new THREE.Object3D;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=
-this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));var g=Math.PI*2,k=Math.PI/180;this.update=function(){var a,b;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)*k;this.theta=this.lon*k;a=this.phi%g;this.phi=a>=0?a:a+g;a=this.verticalAngleMap.srcRange;
-b=this.verticalAngleMap.dstRange;var e=b[1]-b[0];this.phi=c(((this.phi-a[0])*(b[1]-b[0])/(a[1]-a[0])+b[0]-b[0])/e)*e+b[0];a=this.horizontalAngleMap.srcRange;b=this.horizontalAngleMap.dstRange;e=b[1]-b[0];this.theta=c(((this.theta-a[0])*(b[1]-b[0])/(a[1]-a[0])+b[0]-b[0])/e)*e+b[0];a=this.target.position;a.x=100*Math.sin(this.phi)*Math.cos(this.theta);a.y=100*Math.cos(this.phi);a.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.object.lookAt(this.target.position)};this.onMouseMove=function(a){this.domElement===
-document?(this.mouseX=a.pageX-this.viewHalfX,this.mouseY=a.pageY-this.viewHalfY):(this.mouseX=a.pageX-this.domElement.offsetLeft-this.viewHalfX,this.mouseY=a.pageY-this.domElement.offsetTop-this.viewHalfY)};this.init=function(){this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){var a=new THREE.MeshLambertMaterial({color:30719}),c=new THREE.MeshLambertMaterial({color:65280}),
-b=new THREE.CubeGeometry(10,10,20),g=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(b,a);a=new THREE.Mesh(g,c);a.position.set(0,10,0);this.animation=f(this.animationParent,this.spline,this.id,this.duration);this.animationParent.add(this.object);this.animationParent.add(this.target);this.animationParent.add(a)}else this.animation=f(this.animationParent,this.spline,this.id,this.duration),this.animationParent.add(this.target),this.animationParent.add(this.object);if(this.createDebugPath){var a=
-this.debugPath,c=this.spline,b=h(c,10),g=h(c,10),k=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(b,k);particleObj=new THREE.ParticleSystem(g,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);a.add(lineObj);particleObj.scale.set(1,1,1);a.add(particleObj);g=new THREE.SphereGeometry(1,16,8);k=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<c.points.length;i++)b=new THREE.Mesh(g,k),b.position.copy(c.points[i]),a.add(b)}this.domElement.addEventListener("mousemove",
+this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));var f=Math.PI*2,k=Math.PI/180;this.update=function(){var a,c;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)*k;this.theta=this.lon*k;a=this.phi%f;this.phi=a>=0?a:a+f;a=this.verticalAngleMap.srcRange;
+c=this.verticalAngleMap.dstRange;var e=c[1]-c[0];this.phi=b(((this.phi-a[0])*(c[1]-c[0])/(a[1]-a[0])+c[0]-c[0])/e)*e+c[0];a=this.horizontalAngleMap.srcRange;c=this.horizontalAngleMap.dstRange;e=c[1]-c[0];this.theta=b(((this.theta-a[0])*(c[1]-c[0])/(a[1]-a[0])+c[0]-c[0])/e)*e+c[0];a=this.target.position;a.x=100*Math.sin(this.phi)*Math.cos(this.theta);a.y=100*Math.cos(this.phi);a.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.object.lookAt(this.target.position)};this.onMouseMove=function(a){this.domElement===
+document?(this.mouseX=a.pageX-this.viewHalfX,this.mouseY=a.pageY-this.viewHalfY):(this.mouseX=a.pageX-this.domElement.offsetLeft-this.viewHalfX,this.mouseY=a.pageY-this.domElement.offsetTop-this.viewHalfY)};this.init=function(){this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){var a=new THREE.MeshLambertMaterial({color:30719}),b=new THREE.MeshLambertMaterial({color:65280}),
+c=new THREE.CubeGeometry(10,10,20),f=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(c,a);a=new THREE.Mesh(f,b);a.position.set(0,10,0);this.animation=g(this.animationParent,this.spline,this.id,this.duration);this.animationParent.add(this.object);this.animationParent.add(this.target);this.animationParent.add(a)}else this.animation=g(this.animationParent,this.spline,this.id,this.duration),this.animationParent.add(this.target),this.animationParent.add(this.object);if(this.createDebugPath){var a=
+this.debugPath,b=this.spline,c=h(b,10),f=h(b,10),k=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(c,k);particleObj=new THREE.ParticleSystem(f,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);a.add(lineObj);particleObj.scale.set(1,1,1);a.add(particleObj);f=new THREE.SphereGeometry(1,16,8);k=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<b.points.length;i++)c=new THREE.Mesh(f,k),c.position.copy(b.points[i]),a.add(c)}this.domElement.addEventListener("mousemove",
 e(this,this.onMouseMove),!1)}};THREE.PathControlsIdCounter=0;
-THREE.FlyControls=function(a,b){function c(a,c){return function(){c.apply(a,arguments)}}this.object=a;this.domElement=b!==void 0?b:document;b&&this.domElement.setAttribute("tabindex",-1);this.movementSpeed=1;this.rollSpeed=0.0050;this.autoForward=this.dragToLook=!1;this.object.useQuaternion=!0;this.tmpQuaternion=new THREE.Quaternion;this.mouseStatus=0;this.moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0};this.moveVector=new THREE.Vector3(0,
+THREE.FlyControls=function(a,c){function b(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.domElement=c!==void 0?c:document;c&&this.domElement.setAttribute("tabindex",-1);this.movementSpeed=1;this.rollSpeed=0.0050;this.autoForward=this.dragToLook=!1;this.object.useQuaternion=!0;this.tmpQuaternion=new THREE.Quaternion;this.mouseStatus=0;this.moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0};this.moveVector=new THREE.Vector3(0,
 0,0);this.rotationVector=new THREE.Vector3(0,0,0);this.lastUpdate=-1;this.tdiff=0;this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.keydown=function(a){if(!a.altKey){switch(a.keyCode){case 16:this.movementSpeedMultiplier=0.1;break;case 87:this.moveState.forward=1;break;case 83:this.moveState.back=1;break;case 65:this.moveState.left=1;break;case 68:this.moveState.right=1;break;case 82:this.moveState.up=1;break;case 70:this.moveState.down=1;break;case 38:this.moveState.pitchUp=
 1;break;case 40:this.moveState.pitchDown=1;break;case 37:this.moveState.yawLeft=1;break;case 39:this.moveState.yawRight=1;break;case 81:this.moveState.rollLeft=1;break;case 69:this.moveState.rollRight=1}this.updateMovementVector();this.updateRotationVector()}};this.keyup=function(a){switch(a.keyCode){case 16:this.movementSpeedMultiplier=1;break;case 87:this.moveState.forward=0;break;case 83:this.moveState.back=0;break;case 65:this.moveState.left=0;break;case 68:this.moveState.right=0;break;case 82:this.moveState.up=
 0;break;case 70:this.moveState.down=0;break;case 38:this.moveState.pitchUp=0;break;case 40:this.moveState.pitchDown=0;break;case 37:this.moveState.yawLeft=0;break;case 39:this.moveState.yawRight=0;break;case 81:this.moveState.rollLeft=0;break;case 69:this.moveState.rollRight=0}this.updateMovementVector();this.updateRotationVector()};this.mousedown=function(a){this.domElement!==document&&this.domElement.focus();a.preventDefault();a.stopPropagation();if(this.dragToLook)this.mouseStatus++;else switch(a.button){case 0:this.object.moveForward=
-!0;break;case 2:this.object.moveBackward=!0}};this.mousemove=function(a){if(!this.dragToLook||this.mouseStatus>0){var c=this.getContainerDimensions(),b=c.size[0]/2,g=c.size[1]/2;this.moveState.yawLeft=-(a.pageX-c.offset[0]-b)/b;this.moveState.pitchDown=(a.pageY-c.offset[1]-g)/g;this.updateRotationVector()}};this.mouseup=function(a){a.preventDefault();a.stopPropagation();if(this.dragToLook)this.mouseStatus--,this.moveState.yawLeft=this.moveState.pitchDown=0;else switch(a.button){case 0:this.moveForward=
-!1;break;case 2:this.moveBackward=!1}this.updateRotationVector()};this.update=function(){var a=(new Date).getTime();if(this.lastUpdate==-1)this.lastUpdate=a;this.tdiff=(a-this.lastUpdate)/1E3;this.lastUpdate=a;var a=this.tdiff*this.movementSpeed,c=this.tdiff*this.rollSpeed;this.object.translateX(this.moveVector.x*a);this.object.translateY(this.moveVector.y*a);this.object.translateZ(this.moveVector.z*a);this.tmpQuaternion.set(this.rotationVector.x*c,this.rotationVector.y*c,this.rotationVector.z*c,
+!0;break;case 2:this.object.moveBackward=!0}};this.mousemove=function(a){if(!this.dragToLook||this.mouseStatus>0){var b=this.getContainerDimensions(),c=b.size[0]/2,f=b.size[1]/2;this.moveState.yawLeft=-(a.pageX-b.offset[0]-c)/c;this.moveState.pitchDown=(a.pageY-b.offset[1]-f)/f;this.updateRotationVector()}};this.mouseup=function(a){a.preventDefault();a.stopPropagation();if(this.dragToLook)this.mouseStatus--,this.moveState.yawLeft=this.moveState.pitchDown=0;else switch(a.button){case 0:this.moveForward=
+!1;break;case 2:this.moveBackward=!1}this.updateRotationVector()};this.update=function(){var a=(new Date).getTime();if(this.lastUpdate==-1)this.lastUpdate=a;this.tdiff=(a-this.lastUpdate)/1E3;this.lastUpdate=a;var a=this.tdiff*this.movementSpeed,b=this.tdiff*this.rollSpeed;this.object.translateX(this.moveVector.x*a);this.object.translateY(this.moveVector.y*a);this.object.translateZ(this.moveVector.z*a);this.tmpQuaternion.set(this.rotationVector.x*b,this.rotationVector.y*b,this.rotationVector.z*b,
 1).normalize();this.object.quaternion.multiplySelf(this.tmpQuaternion);this.object.matrix.setPosition(this.object.position);this.object.matrix.setRotationFromQuaternion(this.object.quaternion);this.object.matrixWorldNeedsUpdate=!0};this.updateMovementVector=function(){var a=this.moveState.forward||this.autoForward&&!this.moveState.back?1:0;this.moveVector.x=-this.moveState.left+this.moveState.right;this.moveVector.y=-this.moveState.down+this.moveState.up;this.moveVector.z=-a+this.moveState.back};
 this.updateRotationVector=function(){this.rotationVector.x=-this.moveState.pitchDown+this.moveState.pitchUp;this.rotationVector.y=-this.moveState.yawRight+this.moveState.yawLeft;this.rotationVector.z=-this.moveState.rollRight+this.moveState.rollLeft};this.getContainerDimensions=function(){return this.domElement!=document?{size:[this.domElement.offsetWidth,this.domElement.offsetHeight],offset:[this.domElement.offsetLeft,this.domElement.offsetTop]}:{size:[window.innerWidth,window.innerHeight],offset:[0,
-0]}};this.domElement.addEventListener("mousemove",c(this,this.mousemove),!1);this.domElement.addEventListener("mousedown",c(this,this.mousedown),!1);this.domElement.addEventListener("mouseup",c(this,this.mouseup),!1);this.domElement.addEventListener("keydown",c(this,this.keydown),!1);this.domElement.addEventListener("keyup",c(this,this.keyup),!1);this.updateMovementVector();this.updateRotationVector()};
-THREE.RollControls=function(a,b){this.object=a;this.domElement=b!==void 0?b:document;this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.object.matrixAutoUpdate=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;this.lastUpdate=-1;this.delta=0;var c=new THREE.Vector3,e=new THREE.Vector3,f=new THREE.Vector3,h=new THREE.Matrix4,g=!1,k=1,l=0,m=0,n=0,o=0,t=0,u=window.innerWidth/2,v=window.innerHeight/2;this.update=function(){var a=
-(new Date).getTime();if(this.lastUpdate==-1)this.lastUpdate=a;this.delta=(a-this.lastUpdate)/1E3;this.lastUpdate=a;this.mouseLook&&(a=this.delta*this.lookSpeed,this.rotateHorizontally(a*o),this.rotateVertically(a*t));a=this.delta*this.movementSpeed;this.object.translateZ(-a*(l>0||this.autoForward&&!(l<0)?1:l));this.object.translateX(a*m);this.object.translateY(a*n);g&&(this.roll+=this.rollSpeed*this.delta*k);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize();
-else if(this.forward.y<this.constrainVertical[0])this.forward.y=this.constrainVertical[0],this.forward.normalize();f.copy(this.forward);e.set(0,1,0);c.cross(e,f).normalize();e.cross(f,c).normalize();this.object.matrix.n11=c.x;this.object.matrix.n12=e.x;this.object.matrix.n13=f.x;this.object.matrix.n21=c.y;this.object.matrix.n22=e.y;this.object.matrix.n23=f.y;this.object.matrix.n31=c.z;this.object.matrix.n32=e.z;this.object.matrix.n33=f.z;h.identity();h.n11=Math.cos(this.roll);h.n12=-Math.sin(this.roll);
+0]}};this.domElement.addEventListener("mousemove",b(this,this.mousemove),!1);this.domElement.addEventListener("mousedown",b(this,this.mousedown),!1);this.domElement.addEventListener("mouseup",b(this,this.mouseup),!1);this.domElement.addEventListener("keydown",b(this,this.keydown),!1);this.domElement.addEventListener("keyup",b(this,this.keyup),!1);this.updateMovementVector();this.updateRotationVector()};
+THREE.RollControls=function(a,c){this.object=a;this.domElement=c!==void 0?c:document;this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.object.matrixAutoUpdate=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;this.lastUpdate=-1;this.delta=0;var b=new THREE.Vector3,e=new THREE.Vector3,g=new THREE.Vector3,h=new THREE.Matrix4,f=!1,k=1,l=0,m=0,n=0,o=0,p=0,u=window.innerWidth/2,v=window.innerHeight/2;this.update=function(){var a=
+(new Date).getTime();if(this.lastUpdate==-1)this.lastUpdate=a;this.delta=(a-this.lastUpdate)/1E3;this.lastUpdate=a;this.mouseLook&&(a=this.delta*this.lookSpeed,this.rotateHorizontally(a*o),this.rotateVertically(a*p));a=this.delta*this.movementSpeed;this.object.translateZ(-a*(l>0||this.autoForward&&!(l<0)?1:l));this.object.translateX(a*m);this.object.translateY(a*n);f&&(this.roll+=this.rollSpeed*this.delta*k);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize();
+else if(this.forward.y<this.constrainVertical[0])this.forward.y=this.constrainVertical[0],this.forward.normalize();g.copy(this.forward);e.set(0,1,0);b.cross(e,g).normalize();e.cross(g,b).normalize();this.object.matrix.n11=b.x;this.object.matrix.n12=e.x;this.object.matrix.n13=g.x;this.object.matrix.n21=b.y;this.object.matrix.n22=e.y;this.object.matrix.n23=g.y;this.object.matrix.n31=b.z;this.object.matrix.n32=e.z;this.object.matrix.n33=g.z;h.identity();h.n11=Math.cos(this.roll);h.n12=-Math.sin(this.roll);
 h.n21=Math.sin(this.roll);h.n22=Math.cos(this.roll);this.object.matrix.multiplySelf(h);this.object.matrixWorldNeedsUpdate=!0;this.object.matrix.n14=this.object.position.x;this.object.matrix.n24=this.object.position.y;this.object.matrix.n34=this.object.position.z};this.translateX=function(a){this.object.position.x+=this.object.matrix.n11*a;this.object.position.y+=this.object.matrix.n21*a;this.object.position.z+=this.object.matrix.n31*a};this.translateY=function(a){this.object.position.x+=this.object.matrix.n12*
-a;this.object.position.y+=this.object.matrix.n22*a;this.object.position.z+=this.object.matrix.n32*a};this.translateZ=function(a){this.object.position.x-=this.object.matrix.n13*a;this.object.position.y-=this.object.matrix.n23*a;this.object.position.z-=this.object.matrix.n33*a};this.rotateHorizontally=function(a){c.set(this.object.matrix.n11,this.object.matrix.n21,this.object.matrix.n31);c.multiplyScalar(a);this.forward.subSelf(c);this.forward.normalize()};this.rotateVertically=function(a){e.set(this.object.matrix.n12,
-this.object.matrix.n22,this.object.matrix.n32);e.multiplyScalar(a);this.forward.addSelf(e);this.forward.normalize()};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){o=(a.clientX-u)/window.innerWidth;t=(a.clientY-v)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:l=1;break;case 2:l=-1}},!1);this.domElement.addEventListener("mouseup",
-function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:l=0;break;case 2:l=0}},!1);this.domElement.addEventListener("keydown",function(a){switch(a.keyCode){case 38:case 87:l=1;break;case 37:case 65:m=-1;break;case 40:case 83:l=-1;break;case 39:case 68:m=1;break;case 81:g=!0;k=1;break;case 69:g=!0;k=-1;break;case 82:n=1;break;case 70:n=-1}},!1);this.domElement.addEventListener("keyup",function(a){switch(a.keyCode){case 38:case 87:l=0;break;case 37:case 65:m=0;break;case 40:case 83:l=
-0;break;case 39:case 68:m=0;break;case 81:g=!1;break;case 69:g=!1;break;case 82:n=0;break;case 70:n=0}},!1)};
-THREE.TrackballControls=function(a,b){function c(a,c){return function(){c.apply(a,arguments)}}this.object=a;this.domElement=b!==void 0?b:document;this.screen={width:window.innerWidth,height:window.innerHeight,offsetLeft:0,offsetTop:0};this.radius=(this.screen.width+this.screen.height)/4;this.rotateSpeed=1;this.zoomSpeed=1.2;this.panSpeed=0.3;this.staticMoving=this.noPan=this.noZoom=!1;this.dynamicDampingFactor=0.2;this.minDistance=0;this.maxDistance=Infinity;this.keys=[65,83,68];this.target=new THREE.Vector3(0,
-0,0);var e=!1,f=this.STATE.NONE,h=new THREE.Vector3,g=new THREE.Vector3,k=new THREE.Vector3,l=new THREE.Vector2,m=new THREE.Vector2,n=new THREE.Vector2,o=new THREE.Vector2;this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.getMouseOnScreen=function(a,c){return new THREE.Vector2((a-this.screen.offsetLeft)/this.radius*0.5,(c-this.screen.offsetTop)/this.radius*0.5)};this.getMouseProjectionOnBall=function(a,c){var b=new THREE.Vector3((a-this.screen.width*0.5-this.screen.offsetLeft)/
-this.radius,(this.screen.height*0.5+this.screen.offsetTop-c)/this.radius,0),e=b.length();e>1?b.normalize():b.z=Math.sqrt(1-e*e);h.copy(this.object.position).subSelf(this.target);e=this.object.up.clone().setLength(b.y);e.addSelf(this.object.up.clone().crossSelf(h).setLength(b.x));e.addSelf(h.setLength(b.z));return e};this.rotateCamera=function(){var a=Math.acos(g.dot(k)/g.length()/k.length());if(a){var c=(new THREE.Vector3).cross(g,k).normalize(),b=new THREE.Quaternion;a*=this.rotateSpeed;b.setFromAxisAngle(c,
--a);b.multiplyVector3(h);b.multiplyVector3(this.object.up);b.multiplyVector3(k);this.staticMoving?g=k:(b.setFromAxisAngle(c,a*(this.dynamicDampingFactor-1)),b.multiplyVector3(g))}};this.zoomCamera=function(){var a=1+(m.y-l.y)*this.zoomSpeed;a!==1&&a>0&&(h.multiplyScalar(a),this.staticMoving?l=m:l.y+=(m.y-l.y)*this.dynamicDampingFactor)};this.panCamera=function(){var a=o.clone().subSelf(n);if(a.lengthSq()){a.multiplyScalar(h.length()*this.panSpeed);var c=h.clone().crossSelf(this.object.up).setLength(a.x);
-c.addSelf(this.object.up.clone().setLength(a.y));this.object.position.addSelf(c);this.target.addSelf(c);this.staticMoving?n=o:n.addSelf(a.sub(o,n).multiplyScalar(this.dynamicDampingFactor))}};this.checkDistances=function(){if(!this.noZoom||!this.noPan)this.object.position.lengthSq()>this.maxDistance*this.maxDistance&&this.object.position.setLength(this.maxDistance),h.lengthSq()<this.minDistance*this.minDistance&&this.object.position.add(this.target,h.setLength(this.minDistance))};this.update=function(){h.copy(this.object.position).subSelf(this.target);
-this.rotateCamera();this.noZoom||this.zoomCamera();this.noPan||this.panCamera();this.object.position.add(this.target,h);this.checkDistances();this.object.lookAt(this.target)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",c(this,function(a){e&&(g=k=this.getMouseProjectionOnBall(a.clientX,a.clientY),l=m=this.getMouseOnScreen(a.clientX,a.clientY),n=o=this.getMouseOnScreen(a.clientX,a.clientY),e=!1);f!==this.STATE.NONE&&
-(f===this.STATE.ROTATE?k=this.getMouseProjectionOnBall(a.clientX,a.clientY):f===this.STATE.ZOOM&&!this.noZoom?m=this.getMouseOnScreen(a.clientX,a.clientY):f===this.STATE.PAN&&!this.noPan&&(o=this.getMouseOnScreen(a.clientX,a.clientY)))}),!1);this.domElement.addEventListener("mousedown",c(this,function(a){a.preventDefault();a.stopPropagation();if(f===this.STATE.NONE)f=a.button,f===this.STATE.ROTATE?g=k=this.getMouseProjectionOnBall(a.clientX,a.clientY):f===this.STATE.ZOOM&&!this.noZoom?l=m=this.getMouseOnScreen(a.clientX,
-a.clientY):this.noPan||(n=o=this.getMouseOnScreen(a.clientX,a.clientY))}),!1);this.domElement.addEventListener("mouseup",c(this,function(a){a.preventDefault();a.stopPropagation();f=this.STATE.NONE}),!1);window.addEventListener("keydown",c(this,function(a){if(f===this.STATE.NONE){if(a.keyCode===this.keys[this.STATE.ROTATE])f=this.STATE.ROTATE;else if(a.keyCode===this.keys[this.STATE.ZOOM]&&!this.noZoom)f=this.STATE.ZOOM;else if(a.keyCode===this.keys[this.STATE.PAN]&&!this.noPan)f=this.STATE.PAN;f!==
-this.STATE.NONE&&(e=!0)}}),!1);window.addEventListener("keyup",c(this,function(){if(f!==this.STATE.NONE)f=this.STATE.NONE}),!1)};THREE.TrackballControls.prototype.STATE={NONE:-1,ROTATE:0,ZOOM:1,PAN:2};
-THREE.CubeGeometry=function(a,b,c,e,f,h,g,k){function l(a,c,b,g,k,l,o,n){var u,t,v=e||1,K=f||1,C=k/2,F=l/2,J=m.vertices.length;if(a=="x"&&c=="y"||a=="y"&&c=="x")u="z";else if(a=="x"&&c=="z"||a=="z"&&c=="x")u="y",K=h||1;else if(a=="z"&&c=="y"||a=="y"&&c=="z")u="x",v=h||1;var M=v+1,N=K+1;k/=v;var L=l/K;for(t=0;t<N;t++)for(l=0;l<M;l++){var O=new THREE.Vector3;O[a]=(l*k-C)*b;O[c]=(t*L-F)*g;O[u]=o;m.vertices.push(new THREE.Vertex(O))}for(t=0;t<K;t++)for(l=0;l<v;l++)m.faces.push(new THREE.Face4(l+M*t+J,
-l+M*(t+1)+J,l+1+M*(t+1)+J,l+1+M*t+J,null,null,n)),m.faceVertexUvs[0].push([new THREE.UV(l/v,t/K),new THREE.UV(l/v,(t+1)/K),new THREE.UV((l+1)/v,(t+1)/K),new THREE.UV((l+1)/v,t/K)])}THREE.Geometry.call(this);var m=this,n=a/2,o=b/2,t=c/2;if(g!==void 0)if(g instanceof Array)this.materials=g;else{this.materials=[];for(var u=0;u<6;u++)this.materials.push([g])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(k!=void 0)for(var v in k)this.sides[v]!=void 0&&(this.sides[v]=k[v]);
-this.sides.px&&l("z","y",-1,-1,c,b,n,this.materials[0]);this.sides.nx&&l("z","y",1,-1,c,b,-n,this.materials[1]);this.sides.py&&l("x","z",1,1,a,c,o,this.materials[2]);this.sides.ny&&l("x","z",1,-1,a,c,-o,this.materials[3]);this.sides.pz&&l("x","y",1,-1,a,b,t,this.materials[4]);this.sides.nz&&l("x","y",-1,-1,a,b,-t,this.materials[5]);this.mergeVertices();this.computeCentroids();this.computeFaceNormals()};THREE.CubeGeometry.prototype=new THREE.Geometry;THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
-THREE.CylinderGeometry=function(a,b,c,e,f,h){THREE.Geometry.call(this);var a=a!=null?a:20,b=b!=null?b:20,c=c||100,g=c/2,e=e||8,f=f||1,k,l,m=[],n=[];for(l=0;l<=f;l++){var o=[],t=[],u=l/f,v=u*(b-a)+a;for(k=0;k<=e;k++){var y=k/e;this.vertices.push(new THREE.Vertex(new THREE.Vector3(v*Math.sin(y*Math.PI*2),-u*c+g,v*Math.cos(y*Math.PI*2))));o.push(this.vertices.length-1);t.push(new THREE.UV(y,u))}m.push(o);n.push(t)}for(l=0;l<f;l++)for(k=0;k<e;k++){var c=m[l][k],o=m[l+1][k],t=m[l+1][k+1],u=m[l][k+1],v=
-this.vertices[c].position.clone().setY(0).normalize(),y=this.vertices[o].position.clone().setY(0).normalize(),p=this.vertices[t].position.clone().setY(0).normalize(),z=this.vertices[u].position.clone().setY(0).normalize(),x=n[l][k].clone(),w=n[l+1][k].clone(),A=n[l+1][k+1].clone(),D=n[l][k+1].clone();this.faces.push(new THREE.Face4(c,o,t,u,[v,y,p,z]));this.faceVertexUvs[0].push([x,w,A,D])}if(!h&&a>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,g,0)));for(k=0;k<e;k++)c=m[0][k],o=m[0][k+
-1],t=this.vertices.length-1,v=new THREE.Vector3(0,1,0),y=new THREE.Vector3(0,1,0),p=new THREE.Vector3(0,1,0),x=n[0][k].clone(),w=n[0][k+1].clone(),A=new THREE.UV(w.u,0),this.faces.push(new THREE.Face3(c,o,t,[v,y,p])),this.faceVertexUvs[0].push([x,w,A])}if(!h&&b>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-g,0)));for(k=0;k<e;k++)c=m[l][k+1],o=m[l][k],t=this.vertices.length-1,v=new THREE.Vector3(0,-1,0),y=new THREE.Vector3(0,-1,0),p=new THREE.Vector3(0,-1,0),x=n[l][k+1].clone(),w=n[l][k].clone(),
-A=new THREE.UV(w.u,1),this.faces.push(new THREE.Face3(c,o,t,[v,y,p])),this.faceVertexUvs[0].push([x,w,A])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
-THREE.ExtrudeGeometry=function(a,b){if(typeof a!="undefined"){THREE.Geometry.call(this);var a=a instanceof Array?a:[a],c,e=a.length,f;this.shapebb=a[e-1].getBoundingBox();for(c=0;c<e;c++)f=a[c],this.addShape(f,b);this.computeCentroids();this.computeFaceNormals()}};THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;
-THREE.ExtrudeGeometry.prototype.addShape=function(a,b){function c(a,c,b){c||console.log("die");return c.clone().multiplyScalar(b).addSelf(a)}function e(a,c,b){var e=THREE.ExtrudeGeometry.__v1,g=THREE.ExtrudeGeometry.__v2,h=THREE.ExtrudeGeometry.__v3,f=THREE.ExtrudeGeometry.__v4,k=THREE.ExtrudeGeometry.__v5,l=THREE.ExtrudeGeometry.__v6;e.set(a.x-c.x,a.y-c.y);g.set(a.x-b.x,a.y-b.y);e=e.normalize();g=g.normalize();h.set(-e.y,e.x);f.set(g.y,-g.x);k.copy(a).addSelf(h);l.copy(a).addSelf(f);if(k.equals(l))return f.clone();
-k.copy(c).addSelf(h);l.copy(b).addSelf(f);h=e.dot(f);f=l.subSelf(k).dot(f);h==0&&(console.log("Either infinite or no solutions!"),f==0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));f/=h;if(f<0)return c=Math.atan2(c.y-a.y,c.x-a.x),a=Math.atan2(b.y-a.y,b.x-a.x),c>a&&(a+=Math.PI*2),anglec=(c+a)/2,new THREE.Vector2(-Math.cos(anglec),-Math.sin(anglec));return e.multiplyScalar(f).addSelf(k).subSelf(a).clone()}function f(a){for(C=a.length;--C>=0;){R=C;S=C-1;S<0&&(S=a.length-
-1);for(var c=0,b=u+n*2,c=0;c<b;c++){var e=O*c,g=O*(c+1),h=W+R+e,f=W+R+g,m=h,e=W+S+e,g=W+S+g,o=f;m+=K;e+=K;g+=K;o+=K;G.faces.push(new THREE.Face4(m,e,g,o,null,null,A));A&&(m=c/b,e=(c+1)/b,g=k+l*2,h=(G.vertices[h].position.z+l)/g,f=(G.vertices[f].position.z+l)/g,G.faceVertexUvs[0].push([new THREE.UV(h,m),new THREE.UV(f,m),new THREE.UV(f,e),new THREE.UV(h,e)]))}}}function h(a,c,b){G.vertices.push(new THREE.Vertex(new THREE.Vector3(a,c,b)))}function g(a,c,b){a+=K;c+=K;b+=K;G.faces.push(new THREE.Face3(a,
-c,b,null,null,w));if(w){var e=D.maxY,g=D.maxX,h=G.vertices[c].position.x,c=G.vertices[c].position.y,f=G.vertices[b].position.x,b=G.vertices[b].position.y;G.faceVertexUvs[0].push([new THREE.UV(G.vertices[a].position.x/g,G.vertices[a].position.y/e),new THREE.UV(h/g,c/e),new THREE.UV(f/g,b/e)])}}var k=b.amount!==void 0?b.amount:100,l=b.bevelThickness!==void 0?b.bevelThickness:6,m=b.bevelSize!==void 0?b.bevelSize:l-2,n=b.bevelSegments!==void 0?b.bevelSegments:3,o=b.bevelEnabled!==void 0?b.bevelEnabled:
-!0,t=b.curveSegments!==void 0?b.curveSegments:12,u=b.steps!==void 0?b.steps:1,v=b.bendPath,y=b.extrudePath,p,z=!1,x=b.useSpacedPoints!==void 0?b.useSpacedPoints:!1,w=b.material,A=b.extrudeMaterial,D=this.shapebb;if(y)p=y.getPoints(t),u=p.length,z=!0,o=!1;o||(m=l=n=0);var B,E,I,G=this,K=this.vertices.length;v&&a.addWrapPath(v);t=x?a.extractAllSpacedPoints(t):a.extractAllPoints(t);v=t.shape;t=t.holes;if(y=!THREE.Shape.Utils.isClockWise(v)){v=v.reverse();E=0;for(I=t.length;E<I;E++)B=t[E],THREE.Shape.Utils.isClockWise(B)&&
-(t[E]=B.reverse());y=!1}y=THREE.Shape.Utils.triangulateShape(v,t);x=v;E=0;for(I=t.length;E<I;E++)B=t[E],v=v.concat(B);var C,F,J,M,N,L,O=v.length,H=y.length,Q=[];C=0;F=x.length;R=F-1;for(S=C+1;C<F;C++,R++,S++)R==F&&(R=0),S==F&&(S=0),Q[C]=e(x[C],x[R],x[S]);var P=[],T,X=Q.concat();E=0;for(I=t.length;E<I;E++){B=t[E];T=[];C=0;F=B.length;R=F-1;for(S=C+1;C<F;C++,R++,S++)R==F&&(R=0),S==F&&(S=0),T[C]=e(B[C],B[R],B[S]);P.push(T);X=X.concat(T)}for(J=0;J<n;J++){M=J/n;N=l*(1-M);M=m*Math.sin(M*Math.PI/2);C=0;for(F=
-x.length;C<F;C++)L=c(x[C],Q[C],M),h(L.x,L.y,-N);E=0;for(I=t.length;E<I;E++){B=t[E];T=P[E];C=0;for(F=B.length;C<F;C++)L=c(B[C],T[C],M),h(L.x,L.y,-N)}}M=m;for(C=0;C<O;C++)L=o?c(v[C],X[C],M):v[C],z?h(L.x,L.y+p[0].y,p[0].x):h(L.x,L.y,0);for(J=1;J<=u;J++)for(C=0;C<O;C++)L=o?c(v[C],X[C],M):v[C],z?h(L.x,L.y+p[J-1].y,p[J-1].x):h(L.x,L.y,k/u*J);for(J=n-1;J>=0;J--){M=J/n;N=l*(1-M);M=m*Math.sin(M*Math.PI/2);C=0;for(F=x.length;C<F;C++)L=c(x[C],Q[C],M),h(L.x,L.y,k+N);E=0;for(I=t.length;E<I;E++){B=t[E];T=P[E];
-C=0;for(F=B.length;C<F;C++)L=c(B[C],T[C],M),z?h(L.x,L.y+p[u-1].y,p[u-1].x+N):h(L.x,L.y,k+N)}}if(o){o=O*0;for(C=0;C<H;C++)m=y[C],g(m[2]+o,m[1]+o,m[0]+o);o=O*(u+n*2);for(C=0;C<H;C++)m=y[C],g(m[0]+o,m[1]+o,m[2]+o)}else{for(C=0;C<H;C++)m=y[C],g(m[2],m[1],m[0]);for(C=0;C<H;C++)m=y[C],g(m[0]+O*u,m[1]+O*u,m[2]+O*u)}var R,S,W=0;f(x);W+=x.length;E=0;for(I=t.length;E<I;E++)B=t[E],f(B),W+=B.length};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;THREE.ExtrudeGeometry.__v2=new THREE.Vector2;
+a;this.object.position.y+=this.object.matrix.n22*a;this.object.position.z+=this.object.matrix.n32*a};this.translateZ=function(a){this.object.position.x-=this.object.matrix.n13*a;this.object.position.y-=this.object.matrix.n23*a;this.object.position.z-=this.object.matrix.n33*a};this.rotateHorizontally=function(a){b.set(this.object.matrix.n11,this.object.matrix.n21,this.object.matrix.n31);b.multiplyScalar(a);this.forward.subSelf(b);this.forward.normalize()};this.rotateVertically=function(a){e.set(this.object.matrix.n12,
+this.object.matrix.n22,this.object.matrix.n32);e.multiplyScalar(a);this.forward.addSelf(e);this.forward.normalize()};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){o=(a.clientX-u)/window.innerWidth;p=(a.clientY-v)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:l=1;break;case 2:l=-1}},!1);this.domElement.addEventListener("mouseup",
+function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:l=0;break;case 2:l=0}},!1);this.domElement.addEventListener("keydown",function(a){switch(a.keyCode){case 38:case 87:l=1;break;case 37:case 65:m=-1;break;case 40:case 83:l=-1;break;case 39:case 68:m=1;break;case 81:f=!0;k=1;break;case 69:f=!0;k=-1;break;case 82:n=1;break;case 70:n=-1}},!1);this.domElement.addEventListener("keyup",function(a){switch(a.keyCode){case 38:case 87:l=0;break;case 37:case 65:m=0;break;case 40:case 83:l=
+0;break;case 39:case 68:m=0;break;case 81:f=!1;break;case 69:f=!1;break;case 82:n=0;break;case 70:n=0}},!1)};
+THREE.TrackballControls=function(a,c){var b=this,e={NONE:-1,ROTATE:0,ZOOM:1,PAN:2};this.object=a;this.domElement=c!==void 0?c:document;this.enabled=!0;this.screen={width:window.innerWidth,height:window.innerHeight,offsetLeft:0,offsetTop:0};this.radius=(this.screen.width+this.screen.height)/4;this.rotateSpeed=1;this.zoomSpeed=1.2;this.panSpeed=0.3;this.staticMoving=this.noPan=this.noZoom=!1;this.dynamicDampingFactor=0.2;this.minDistance=0;this.maxDistance=Infinity;this.keys=[65,83,68];this.target=
+new THREE.Vector3(0,0,0);var g=!1,h=e.NONE,f=new THREE.Vector3,k=new THREE.Vector3,l=new THREE.Vector3,m=new THREE.Vector2,n=new THREE.Vector2,o=new THREE.Vector2,p=new THREE.Vector2;this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.getMouseOnScreen=function(a,c){return new THREE.Vector2((a-b.screen.offsetLeft)/b.radius*0.5,(c-b.screen.offsetTop)/b.radius*0.5)};this.getMouseProjectionOnBall=function(a,c){var e=new THREE.Vector3((a-b.screen.width*0.5-b.screen.offsetLeft)/
+b.radius,(b.screen.height*0.5+b.screen.offsetTop-c)/b.radius,0),h=e.length();h>1?e.normalize():e.z=Math.sqrt(1-h*h);f.copy(b.object.position).subSelf(b.target);h=b.object.up.clone().setLength(e.y);h.addSelf(b.object.up.clone().crossSelf(f).setLength(e.x));h.addSelf(f.setLength(e.z));return h};this.rotateCamera=function(){var a=Math.acos(k.dot(l)/k.length()/l.length());if(a){var c=(new THREE.Vector3).cross(k,l).normalize(),e=new THREE.Quaternion;a*=b.rotateSpeed;e.setFromAxisAngle(c,-a);e.multiplyVector3(f);
+e.multiplyVector3(b.object.up);e.multiplyVector3(l);b.staticMoving?k=l:(e.setFromAxisAngle(c,a*(b.dynamicDampingFactor-1)),e.multiplyVector3(k))}};this.zoomCamera=function(){var a=1+(n.y-m.y)*b.zoomSpeed;a!==1&&a>0&&(f.multiplyScalar(a),b.staticMoving?m=n:m.y+=(n.y-m.y)*this.dynamicDampingFactor)};this.panCamera=function(){var a=p.clone().subSelf(o);if(a.lengthSq()){a.multiplyScalar(f.length()*b.panSpeed);var c=f.clone().crossSelf(b.object.up).setLength(a.x);c.addSelf(b.object.up.clone().setLength(a.y));
+b.object.position.addSelf(c);b.target.addSelf(c);b.staticMoving?o=p:o.addSelf(a.sub(p,o).multiplyScalar(b.dynamicDampingFactor))}};this.checkDistances=function(){if(!b.noZoom||!b.noPan)b.object.position.lengthSq()>b.maxDistance*b.maxDistance&&b.object.position.setLength(b.maxDistance),f.lengthSq()<b.minDistance*b.minDistance&&b.object.position.add(b.target,f.setLength(b.minDistance))};this.update=function(){f.copy(b.object.position).subSelf(this.target);b.rotateCamera();b.noZoom||b.zoomCamera();b.noPan||
+b.panCamera();b.object.position.add(b.target,f);b.checkDistances();b.object.lookAt(b.target)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){b.enabled&&(g&&(k=l=b.getMouseProjectionOnBall(a.clientX,a.clientY),m=n=b.getMouseOnScreen(a.clientX,a.clientY),o=p=b.getMouseOnScreen(a.clientX,a.clientY),g=!1),h!==e.NONE&&(h===e.ROTATE?l=b.getMouseProjectionOnBall(a.clientX,a.clientY):h===e.ZOOM&&!b.noZoom?n=b.getMouseOnScreen(a.clientX,
+a.clientY):h===e.PAN&&!b.noPan&&(p=b.getMouseOnScreen(a.clientX,a.clientY))))},!1);this.domElement.addEventListener("mousedown",function(a){if(b.enabled&&(a.preventDefault(),a.stopPropagation(),h===e.NONE))h=a.button,h===e.ROTATE?k=l=b.getMouseProjectionOnBall(a.clientX,a.clientY):h===e.ZOOM&&!b.noZoom?m=n=b.getMouseOnScreen(a.clientX,a.clientY):this.noPan||(o=p=b.getMouseOnScreen(a.clientX,a.clientY))},!1);this.domElement.addEventListener("mouseup",function(a){if(b.enabled)a.preventDefault(),a.stopPropagation(),
+h=e.NONE},!1);window.addEventListener("keydown",function(a){if(b.enabled&&h===e.NONE){if(a.keyCode===b.keys[e.ROTATE])h=e.ROTATE;else if(a.keyCode===b.keys[e.ZOOM]&&!b.noZoom)h=e.ZOOM;else if(a.keyCode===b.keys[e.PAN]&&!b.noPan)h=e.PAN;h!==e.NONE&&(g=!0)}},!1);window.addEventListener("keyup",function(){if(b.enabled&&h!==e.NONE)h=e.NONE},!1)};
+THREE.CubeGeometry=function(a,c,b,e,g,h,f,k){function l(a,b,c,f,k,l,o,n){var u,p,v=e||1,K=g||1,C=k/2,F=l/2,J=m.vertices.length;if(a=="x"&&b=="y"||a=="y"&&b=="x")u="z";else if(a=="x"&&b=="z"||a=="z"&&b=="x")u="y",K=h||1;else if(a=="z"&&b=="y"||a=="y"&&b=="z")u="x",v=h||1;var M=v+1,N=K+1;k/=v;var L=l/K;for(p=0;p<N;p++)for(l=0;l<M;l++){var O=new THREE.Vector3;O[a]=(l*k-C)*c;O[b]=(p*L-F)*f;O[u]=o;m.vertices.push(new THREE.Vertex(O))}for(p=0;p<K;p++)for(l=0;l<v;l++)m.faces.push(new THREE.Face4(l+M*p+J,
+l+M*(p+1)+J,l+1+M*(p+1)+J,l+1+M*p+J,null,null,n)),m.faceVertexUvs[0].push([new THREE.UV(l/v,p/K),new THREE.UV(l/v,(p+1)/K),new THREE.UV((l+1)/v,(p+1)/K),new THREE.UV((l+1)/v,p/K)])}THREE.Geometry.call(this);var m=this,n=a/2,o=c/2,p=b/2;if(f!==void 0)if(f instanceof Array)this.materials=f;else{this.materials=[];for(var u=0;u<6;u++)this.materials.push([f])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(k!=void 0)for(var v in k)this.sides[v]!=void 0&&(this.sides[v]=k[v]);
+this.sides.px&&l("z","y",-1,-1,b,c,n,this.materials[0]);this.sides.nx&&l("z","y",1,-1,b,c,-n,this.materials[1]);this.sides.py&&l("x","z",1,1,a,b,o,this.materials[2]);this.sides.ny&&l("x","z",1,-1,a,b,-o,this.materials[3]);this.sides.pz&&l("x","y",1,-1,a,c,p,this.materials[4]);this.sides.nz&&l("x","y",-1,-1,a,c,-p,this.materials[5]);this.mergeVertices();this.computeCentroids();this.computeFaceNormals()};THREE.CubeGeometry.prototype=new THREE.Geometry;THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
+THREE.CylinderGeometry=function(a,c,b,e,g,h){THREE.Geometry.call(this);var a=a!=null?a:20,c=c!=null?c:20,b=b||100,f=b/2,e=e||8,g=g||1,k,l,m=[],n=[];for(l=0;l<=g;l++){var o=[],p=[],u=l/g,v=u*(c-a)+a;for(k=0;k<=e;k++){var y=k/e;this.vertices.push(new THREE.Vertex(new THREE.Vector3(v*Math.sin(y*Math.PI*2),-u*b+f,v*Math.cos(y*Math.PI*2))));o.push(this.vertices.length-1);p.push(new THREE.UV(y,u))}m.push(o);n.push(p)}for(l=0;l<g;l++)for(k=0;k<e;k++){var b=m[l][k],o=m[l+1][k],p=m[l+1][k+1],u=m[l][k+1],v=
+this.vertices[b].position.clone().setY(0).normalize(),y=this.vertices[o].position.clone().setY(0).normalize(),t=this.vertices[p].position.clone().setY(0).normalize(),z=this.vertices[u].position.clone().setY(0).normalize(),x=n[l][k].clone(),w=n[l+1][k].clone(),A=n[l+1][k+1].clone(),D=n[l][k+1].clone();this.faces.push(new THREE.Face4(b,o,p,u,[v,y,t,z]));this.faceVertexUvs[0].push([x,w,A,D])}if(!h&&a>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,f,0)));for(k=0;k<e;k++)b=m[0][k],o=m[0][k+
+1],p=this.vertices.length-1,v=new THREE.Vector3(0,1,0),y=new THREE.Vector3(0,1,0),t=new THREE.Vector3(0,1,0),x=n[0][k].clone(),w=n[0][k+1].clone(),A=new THREE.UV(w.u,0),this.faces.push(new THREE.Face3(b,o,p,[v,y,t])),this.faceVertexUvs[0].push([x,w,A])}if(!h&&c>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-f,0)));for(k=0;k<e;k++)b=m[l][k+1],o=m[l][k],p=this.vertices.length-1,v=new THREE.Vector3(0,-1,0),y=new THREE.Vector3(0,-1,0),t=new THREE.Vector3(0,-1,0),x=n[l][k+1].clone(),w=n[l][k].clone(),
+A=new THREE.UV(w.u,1),this.faces.push(new THREE.Face3(b,o,p,[v,y,t])),this.faceVertexUvs[0].push([x,w,A])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
+THREE.ExtrudeGeometry=function(a,c){if(typeof a!="undefined"){THREE.Geometry.call(this);var a=a instanceof Array?a:[a],b,e=a.length,g;this.shapebb=a[e-1].getBoundingBox();for(b=0;b<e;b++)g=a[b],this.addShape(g,c);this.computeCentroids();this.computeFaceNormals()}};THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;
+THREE.ExtrudeGeometry.prototype.addShape=function(a,c){function b(a,b,c){b||console.log("die");return b.clone().multiplyScalar(c).addSelf(a)}function e(a,b,c){var e=THREE.ExtrudeGeometry.__v1,f=THREE.ExtrudeGeometry.__v2,h=THREE.ExtrudeGeometry.__v3,g=THREE.ExtrudeGeometry.__v4,k=THREE.ExtrudeGeometry.__v5,l=THREE.ExtrudeGeometry.__v6;e.set(a.x-b.x,a.y-b.y);f.set(a.x-c.x,a.y-c.y);e=e.normalize();f=f.normalize();h.set(-e.y,e.x);g.set(f.y,-f.x);k.copy(a).addSelf(h);l.copy(a).addSelf(g);if(k.equals(l))return g.clone();
+k.copy(b).addSelf(h);l.copy(c).addSelf(g);h=e.dot(g);g=l.subSelf(k).dot(g);h==0&&(console.log("Either infinite or no solutions!"),g==0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));g/=h;if(g<0)return b=Math.atan2(b.y-a.y,b.x-a.x),a=Math.atan2(c.y-a.y,c.x-a.x),b>a&&(a+=Math.PI*2),anglec=(b+a)/2,new THREE.Vector2(-Math.cos(anglec),-Math.sin(anglec));return e.multiplyScalar(g).addSelf(k).subSelf(a).clone()}function g(a){for(C=a.length;--C>=0;){R=C;S=C-1;S<0&&(S=a.length-
+1);for(var b=0,c=u+n*2,b=0;b<c;b++){var e=O*b,f=O*(b+1),h=W+R+e,g=W+R+f,m=h,e=W+S+e,f=W+S+f,o=g;m+=K;e+=K;f+=K;o+=K;G.faces.push(new THREE.Face4(m,e,f,o,null,null,A));A&&(m=b/c,e=(b+1)/c,f=k+l*2,h=(G.vertices[h].position.z+l)/f,g=(G.vertices[g].position.z+l)/f,G.faceVertexUvs[0].push([new THREE.UV(h,m),new THREE.UV(g,m),new THREE.UV(g,e),new THREE.UV(h,e)]))}}}function h(a,b,c){G.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function f(a,b,c){a+=K;b+=K;c+=K;G.faces.push(new THREE.Face3(a,
+b,c,null,null,w));if(w){var e=D.maxY,f=D.maxX,h=G.vertices[b].position.x,b=G.vertices[b].position.y,g=G.vertices[c].position.x,c=G.vertices[c].position.y;G.faceVertexUvs[0].push([new THREE.UV(G.vertices[a].position.x/f,G.vertices[a].position.y/e),new THREE.UV(h/f,b/e),new THREE.UV(g/f,c/e)])}}var k=c.amount!==void 0?c.amount:100,l=c.bevelThickness!==void 0?c.bevelThickness:6,m=c.bevelSize!==void 0?c.bevelSize:l-2,n=c.bevelSegments!==void 0?c.bevelSegments:3,o=c.bevelEnabled!==void 0?c.bevelEnabled:
+!0,p=c.curveSegments!==void 0?c.curveSegments:12,u=c.steps!==void 0?c.steps:1,v=c.bendPath,y=c.extrudePath,t,z=!1,x=c.useSpacedPoints!==void 0?c.useSpacedPoints:!1,w=c.material,A=c.extrudeMaterial,D=this.shapebb;if(y)t=y.getPoints(p),u=t.length,z=!0,o=!1;o||(m=l=n=0);var B,E,I,G=this,K=this.vertices.length;v&&a.addWrapPath(v);p=x?a.extractAllSpacedPoints(p):a.extractAllPoints(p);v=p.shape;p=p.holes;if(y=!THREE.Shape.Utils.isClockWise(v)){v=v.reverse();E=0;for(I=p.length;E<I;E++)B=p[E],THREE.Shape.Utils.isClockWise(B)&&
+(p[E]=B.reverse());y=!1}y=THREE.Shape.Utils.triangulateShape(v,p);x=v;E=0;for(I=p.length;E<I;E++)B=p[E],v=v.concat(B);var C,F,J,M,N,L,O=v.length,H=y.length,Q=[];C=0;F=x.length;R=F-1;for(S=C+1;C<F;C++,R++,S++)R==F&&(R=0),S==F&&(S=0),Q[C]=e(x[C],x[R],x[S]);var P=[],T,X=Q.concat();E=0;for(I=p.length;E<I;E++){B=p[E];T=[];C=0;F=B.length;R=F-1;for(S=C+1;C<F;C++,R++,S++)R==F&&(R=0),S==F&&(S=0),T[C]=e(B[C],B[R],B[S]);P.push(T);X=X.concat(T)}for(J=0;J<n;J++){M=J/n;N=l*(1-M);M=m*Math.sin(M*Math.PI/2);C=0;for(F=
+x.length;C<F;C++)L=b(x[C],Q[C],M),h(L.x,L.y,-N);E=0;for(I=p.length;E<I;E++){B=p[E];T=P[E];C=0;for(F=B.length;C<F;C++)L=b(B[C],T[C],M),h(L.x,L.y,-N)}}M=m;for(C=0;C<O;C++)L=o?b(v[C],X[C],M):v[C],z?h(L.x,L.y+t[0].y,t[0].x):h(L.x,L.y,0);for(J=1;J<=u;J++)for(C=0;C<O;C++)L=o?b(v[C],X[C],M):v[C],z?h(L.x,L.y+t[J-1].y,t[J-1].x):h(L.x,L.y,k/u*J);for(J=n-1;J>=0;J--){M=J/n;N=l*(1-M);M=m*Math.sin(M*Math.PI/2);C=0;for(F=x.length;C<F;C++)L=b(x[C],Q[C],M),h(L.x,L.y,k+N);E=0;for(I=p.length;E<I;E++){B=p[E];T=P[E];
+C=0;for(F=B.length;C<F;C++)L=b(B[C],T[C],M),z?h(L.x,L.y+t[u-1].y,t[u-1].x+N):h(L.x,L.y,k+N)}}if(o){o=O*0;for(C=0;C<H;C++)m=y[C],f(m[2]+o,m[1]+o,m[0]+o);o=O*(u+n*2);for(C=0;C<H;C++)m=y[C],f(m[0]+o,m[1]+o,m[2]+o)}else{for(C=0;C<H;C++)m=y[C],f(m[2],m[1],m[0]);for(C=0;C<H;C++)m=y[C],f(m[0]+O*u,m[1]+O*u,m[2]+O*u)}var R,S,W=0;g(x);W+=x.length;E=0;for(I=p.length;E<I;E++)B=p[E],g(B),W+=B.length};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;THREE.ExtrudeGeometry.__v2=new THREE.Vector2;
 THREE.ExtrudeGeometry.__v3=new THREE.Vector2;THREE.ExtrudeGeometry.__v4=new THREE.Vector2;THREE.ExtrudeGeometry.__v5=new THREE.Vector2;THREE.ExtrudeGeometry.__v6=new THREE.Vector2;
-THREE.IcosahedronGeometry=function(a){function b(a,c,b){var e=Math.sqrt(a*a+c*c+b*b);return f.vertices.push(new THREE.Vertex(new THREE.Vector3(a/e,c/e,b/e)))-1}function c(a,c,b,e){e.faces.push(new THREE.Face3(a,c,b))}function e(a,c){var e=f.vertices[a].position,g=f.vertices[c].position;return b((e.x+g.x)/2,(e.y+g.y)/2,(e.z+g.z)/2)}var f=this,h=new THREE.Geometry;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;b(-1,a,0);b(1,a,0);b(-1,-a,0);b(1,-a,0);b(0,-1,a);b(0,1,a);b(0,-1,
--a);b(0,1,-a);b(a,0,-1);b(a,0,1);b(-a,0,-1);b(-a,0,1);c(0,11,5,h);c(0,5,1,h);c(0,1,7,h);c(0,7,10,h);c(0,10,11,h);c(1,5,9,h);c(5,11,4,h);c(11,10,2,h);c(10,7,6,h);c(7,1,8,h);c(3,9,4,h);c(3,4,2,h);c(3,2,6,h);c(3,6,8,h);c(3,8,9,h);c(4,9,5,h);c(2,4,11,h);c(6,2,10,h);c(8,6,7,h);c(9,8,1,h);for(var g=0;g<this.subdivisions;g++){var a=new THREE.Geometry,k;for(k in h.faces){var l=e(h.faces[k].a,h.faces[k].b),m=e(h.faces[k].b,h.faces[k].c),n=e(h.faces[k].c,h.faces[k].a);c(h.faces[k].a,l,n,a);c(h.faces[k].b,m,
-l,a);c(h.faces[k].c,n,m,a);c(l,m,n,a)}h.faces=a.faces}f.faces=h.faces;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;
-THREE.LatheGeometry=function(a,b,c){THREE.Geometry.call(this);this.steps=b||12;this.angle=c||2*Math.PI;for(var b=this.angle/this.steps,c=[],e=[],f=[],h=[],g=(new THREE.Matrix4).setRotationZ(b),k=0;k<a.length;k++)this.vertices.push(new THREE.Vertex(a[k])),c[k]=a[k].clone(),e[k]=this.vertices.length-1;for(var l=0;l<=this.angle+0.0010;l+=b){for(k=0;k<c.length;k++)l<this.angle?(c[k]=g.multiplyVector3(c[k].clone()),this.vertices.push(new THREE.Vertex(c[k])),f[k]=this.vertices.length-1):f=h;l==0&&(h=e);
-for(k=0;k<e.length-1;k++)this.faces.push(new THREE.Face4(f[k],f[k+1],e[k+1],e[k])),this.faceVertexUvs[0].push([new THREE.UV(1-l/this.angle,k/a.length),new THREE.UV(1-l/this.angle,(k+1)/a.length),new THREE.UV(1-(l-b)/this.angle,(k+1)/a.length),new THREE.UV(1-(l-b)/this.angle,k/a.length)]);e=f;f=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=new THREE.Geometry;THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry;
-THREE.OctahedronGeometry=function(a,b){function c(c){var b=c.clone().normalize(),b=new THREE.Vertex(b.clone().multiplyScalar(a));b.index=g.vertices.push(b)-1;b.uv=new THREE.UV(Math.atan2(c.z,-c.x)/2/Math.PI+0.5,Math.atan2(-c.y,Math.sqrt(c.x*c.x+c.z*c.z))/Math.PI+0.5);return b}function e(a,c,b,k){k<1?(k=new THREE.Face3(a.index,c.index,b.index,[a.position,c.position,b.position]),k.centroid.addSelf(a.position).addSelf(c.position).addSelf(b.position).divideScalar(3),k.normal=k.centroid.clone().normalize(),
-g.faces.push(k),k=Math.atan2(k.centroid.z,-k.centroid.x),g.faceVertexUvs[0].push([h(a.uv,a.position,k),h(c.uv,c.position,k),h(b.uv,b.position,k)])):(k-=1,e(a,f(a,c),f(a,b),k),e(f(a,c),c,f(c,b),k),e(f(a,b),f(c,b),b,k),e(f(a,c),f(c,b),f(a,b),k))}function f(a,b){k[a.index]||(k[a.index]=[]);k[b.index]||(k[b.index]=[]);var e=k[a.index][b.index];e===void 0&&(k[a.index][b.index]=k[b.index][a.index]=e=c((new THREE.Vector3).add(a.position,b.position).divideScalar(2)));return e}function h(a,c,b){b<0&&a.u===
-1&&(a=new THREE.UV(a.u-1,a.v));c.x===0&&c.z===0&&(a=new THREE.UV(b/2/Math.PI+0.5,a.v));return a}THREE.Geometry.call(this);var b=isFinite(b)?b:3,g=this;c(new THREE.Vector3(1,0,0));c(new THREE.Vector3(-1,0,0));c(new THREE.Vector3(0,1,0));c(new THREE.Vector3(0,-1,0));c(new THREE.Vector3(0,0,1));c(new THREE.Vector3(0,0,-1));var k=[],l=this.vertices;e(l[0],l[2],l[4],b);e(l[0],l[4],l[3],b);e(l[0],l[3],l[5],b);e(l[0],l[5],l[2],b);e(l[1],l[2],l[5],b);e(l[1],l[5],l[3],b);e(l[1],l[3],l[4],b);e(l[1],l[4],l[2],
-b);this.boundingSphere={radius:a}};THREE.OctahedronGeometry.prototype=new THREE.Geometry;THREE.OctahedronGeometry.prototype.constructor=THREE.OctahedronGeometry;
-THREE.PlaneGeometry=function(a,b,c,e){THREE.Geometry.call(this);var f,h=a/2,g=b/2,c=c||1,e=e||1,k=c+1,l=e+1;a/=c;var m=b/e;for(f=0;f<l;f++)for(b=0;b<k;b++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(b*a-h,-(f*m-g),0)));for(f=0;f<e;f++)for(b=0;b<c;b++)this.faces.push(new THREE.Face4(b+k*f,b+k*(f+1),b+1+k*(f+1),b+1+k*f)),this.faceVertexUvs[0].push([new THREE.UV(b/c,f/e),new THREE.UV(b/c,(f+1)/e),new THREE.UV((b+1)/c,(f+1)/e),new THREE.UV((b+1)/c,f/e)]);this.computeCentroids();this.computeFaceNormals()};
+THREE.IcosahedronGeometry=function(a){function c(a,b,c){var e=Math.sqrt(a*a+b*b+c*c);return g.vertices.push(new THREE.Vertex(new THREE.Vector3(a/e,b/e,c/e)))-1}function b(a,b,c,e){e.faces.push(new THREE.Face3(a,b,c))}function e(a,b){var e=g.vertices[a].position,f=g.vertices[b].position;return c((e.x+f.x)/2,(e.y+f.y)/2,(e.z+f.z)/2)}var g=this,h=new THREE.Geometry;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,h);b(0,5,1,h);b(0,1,7,h);b(0,7,10,h);b(0,10,11,h);b(1,5,9,h);b(5,11,4,h);b(11,10,2,h);b(10,7,6,h);b(7,1,8,h);b(3,9,4,h);b(3,4,2,h);b(3,2,6,h);b(3,6,8,h);b(3,8,9,h);b(4,9,5,h);b(2,4,11,h);b(6,2,10,h);b(8,6,7,h);b(9,8,1,h);for(var f=0;f<this.subdivisions;f++){var a=new THREE.Geometry,k;for(k in h.faces){var l=e(h.faces[k].a,h.faces[k].b),m=e(h.faces[k].b,h.faces[k].c),n=e(h.faces[k].c,h.faces[k].a);b(h.faces[k].a,l,n,a);b(h.faces[k].b,m,
+l,a);b(h.faces[k].c,n,m,a);b(l,m,n,a)}h.faces=a.faces}g.faces=h.faces;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;
+THREE.LatheGeometry=function(a,c,b){THREE.Geometry.call(this);this.steps=c||12;this.angle=b||2*Math.PI;for(var c=this.angle/this.steps,b=[],e=[],g=[],h=[],f=(new THREE.Matrix4).setRotationZ(c),k=0;k<a.length;k++)this.vertices.push(new THREE.Vertex(a[k])),b[k]=a[k].clone(),e[k]=this.vertices.length-1;for(var l=0;l<=this.angle+0.0010;l+=c){for(k=0;k<b.length;k++)l<this.angle?(b[k]=f.multiplyVector3(b[k].clone()),this.vertices.push(new THREE.Vertex(b[k])),g[k]=this.vertices.length-1):g=h;l==0&&(h=e);
+for(k=0;k<e.length-1;k++)this.faces.push(new THREE.Face4(g[k],g[k+1],e[k+1],e[k])),this.faceVertexUvs[0].push([new THREE.UV(1-l/this.angle,k/a.length),new THREE.UV(1-l/this.angle,(k+1)/a.length),new THREE.UV(1-(l-c)/this.angle,(k+1)/a.length),new THREE.UV(1-(l-c)/this.angle,k/a.length)]);e=g;g=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=new THREE.Geometry;THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry;
+THREE.OctahedronGeometry=function(a,c){function b(b){var c=b.clone().normalize(),c=new THREE.Vertex(c.clone().multiplyScalar(a));c.index=f.vertices.push(c)-1;c.uv=new THREE.UV(Math.atan2(b.z,-b.x)/2/Math.PI+0.5,Math.atan2(-b.y,Math.sqrt(b.x*b.x+b.z*b.z))/Math.PI+0.5);return c}function e(a,b,c,k){k<1?(k=new THREE.Face3(a.index,b.index,c.index,[a.position,b.position,c.position]),k.centroid.addSelf(a.position).addSelf(b.position).addSelf(c.position).divideScalar(3),k.normal=k.centroid.clone().normalize(),
+f.faces.push(k),k=Math.atan2(k.centroid.z,-k.centroid.x),f.faceVertexUvs[0].push([h(a.uv,a.position,k),h(b.uv,b.position,k),h(c.uv,c.position,k)])):(k-=1,e(a,g(a,b),g(a,c),k),e(g(a,b),b,g(b,c),k),e(g(a,c),g(b,c),c,k),e(g(a,b),g(b,c),g(a,c),k))}function g(a,c){k[a.index]||(k[a.index]=[]);k[c.index]||(k[c.index]=[]);var e=k[a.index][c.index];e===void 0&&(k[a.index][c.index]=k[c.index][a.index]=e=b((new THREE.Vector3).add(a.position,c.position).divideScalar(2)));return e}function h(a,b,c){c<0&&a.u===
+1&&(a=new THREE.UV(a.u-1,a.v));b.x===0&&b.z===0&&(a=new THREE.UV(c/2/Math.PI+0.5,a.v));return a}THREE.Geometry.call(this);var c=c||0,f=this;b(new THREE.Vector3(1,0,0));b(new THREE.Vector3(-1,0,0));b(new THREE.Vector3(0,1,0));b(new THREE.Vector3(0,-1,0));b(new THREE.Vector3(0,0,1));b(new THREE.Vector3(0,0,-1));var k=[],l=this.vertices;e(l[0],l[2],l[4],c);e(l[0],l[4],l[3],c);e(l[0],l[3],l[5],c);e(l[0],l[5],l[2],c);e(l[1],l[2],l[5],c);e(l[1],l[5],l[3],c);e(l[1],l[3],l[4],c);e(l[1],l[4],l[2],c);this.boundingSphere=
+{radius:a}};THREE.OctahedronGeometry.prototype=new THREE.Geometry;THREE.OctahedronGeometry.prototype.constructor=THREE.OctahedronGeometry;
+THREE.PlaneGeometry=function(a,c,b,e){THREE.Geometry.call(this);var g,h=a/2,f=c/2,b=b||1,e=e||1,k=b+1,l=e+1;a/=b;var m=c/e;for(g=0;g<l;g++)for(c=0;c<k;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*a-h,-(g*m-f),0)));for(g=0;g<e;g++)for(c=0;c<b;c++)this.faces.push(new THREE.Face4(c+k*g,c+k*(g+1),c+1+k*(g+1),c+1+k*g)),this.faceVertexUvs[0].push([new THREE.UV(c/b,g/e),new THREE.UV(c/b,(g+1)/e),new THREE.UV((c+1)/b,(g+1)/e),new THREE.UV((c+1)/b,g/e)]);this.computeCentroids();this.computeFaceNormals()};
 THREE.PlaneGeometry.prototype=new THREE.Geometry;THREE.PlaneGeometry.prototype.constructor=THREE.PlaneGeometry;
-THREE.SphereGeometry=function(a,b,c){THREE.Geometry.call(this);for(var a=a||50,e,f=Math.PI,h=Math.max(3,b||8),g=Math.max(2,c||6),b=[],c=0;c<g+1;c++){e=c/g;var k=a*Math.cos(e*f),l=a*Math.sin(e*f),m=[],n=0;for(e=0;e<h;e++){var o=2*e/h,t=l*Math.sin(o*f),o=l*Math.cos(o*f);(c==0||c==g)&&e>0||(n=this.vertices.push(new THREE.Vertex(new THREE.Vector3(o,k,t)))-1);m.push(n)}b.push(m)}for(var u,v,y,f=b.length,c=0;c<f;c++)if(h=b[c].length,c>0)for(e=0;e<h;e++){m=e==h-1;g=b[c][m?0:e+1];k=b[c][m?h-1:e];l=b[c-1][m?
-h-1:e];m=b[c-1][m?0:e+1];t=c/(f-1);u=(c-1)/(f-1);v=(e+1)/h;var o=e/h,n=new THREE.UV(1-v,t),t=new THREE.UV(1-o,t),o=new THREE.UV(1-o,u),p=new THREE.UV(1-v,u);c<b.length-1&&(u=this.vertices[g].position.clone(),v=this.vertices[k].position.clone(),y=this.vertices[l].position.clone(),u.normalize(),v.normalize(),y.normalize(),this.faces.push(new THREE.Face3(g,k,l,[new THREE.Vector3(u.x,u.y,u.z),new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(y.x,y.y,y.z)])),this.faceVertexUvs[0].push([n,t,o]));c>1&&(u=
-this.vertices[g].position.clone(),v=this.vertices[l].position.clone(),y=this.vertices[m].position.clone(),u.normalize(),v.normalize(),y.normalize(),this.faces.push(new THREE.Face3(g,l,m,[new THREE.Vector3(u.x,u.y,u.z),new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(y.x,y.y,y.z)])),this.faceVertexUvs[0].push([n,o,p]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};THREE.SphereGeometry.prototype=new THREE.Geometry;
+THREE.SphereGeometry=function(a,c,b){THREE.Geometry.call(this);for(var a=a||50,e,g=Math.PI,h=Math.max(3,c||8),f=Math.max(2,b||6),c=[],b=0;b<f+1;b++){e=b/f;var k=a*Math.cos(e*g),l=a*Math.sin(e*g),m=[],n=0;for(e=0;e<h;e++){var o=2*e/h,p=l*Math.sin(o*g),o=l*Math.cos(o*g);(b==0||b==f)&&e>0||(n=this.vertices.push(new THREE.Vertex(new THREE.Vector3(o,k,p)))-1);m.push(n)}c.push(m)}for(var u,v,y,g=c.length,b=0;b<g;b++)if(h=c[b].length,b>0)for(e=0;e<h;e++){m=e==h-1;f=c[b][m?0:e+1];k=c[b][m?h-1:e];l=c[b-1][m?
+h-1:e];m=c[b-1][m?0:e+1];p=b/(g-1);u=(b-1)/(g-1);v=(e+1)/h;var o=e/h,n=new THREE.UV(1-v,p),p=new THREE.UV(1-o,p),o=new THREE.UV(1-o,u),t=new THREE.UV(1-v,u);b<c.length-1&&(u=this.vertices[f].position.clone(),v=this.vertices[k].position.clone(),y=this.vertices[l].position.clone(),u.normalize(),v.normalize(),y.normalize(),this.faces.push(new THREE.Face3(f,k,l,[new THREE.Vector3(u.x,u.y,u.z),new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(y.x,y.y,y.z)])),this.faceVertexUvs[0].push([n,p,o]));b>1&&(u=
+this.vertices[f].position.clone(),v=this.vertices[l].position.clone(),y=this.vertices[m].position.clone(),u.normalize(),v.normalize(),y.normalize(),this.faces.push(new THREE.Face3(f,l,m,[new THREE.Vector3(u.x,u.y,u.z),new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(y.x,y.y,y.z)])),this.faceVertexUvs[0].push([n,o,t]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};THREE.SphereGeometry.prototype=new THREE.Geometry;
 THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry;
-THREE.TextGeometry=function(a,b){var c=(new THREE.TextPath(a,b)).toShapes();b.amount=b.height!==void 0?b.height:50;if(b.bevelThickness===void 0)b.bevelThickness=10;if(b.bevelSize===void 0)b.bevelSize=8;if(b.bevelEnabled===void 0)b.bevelEnabled=!1;if(b.bend){var e=c[c.length-1].getBoundingBox().maxX;b.bendPath=new THREE.QuadraticBezierCurve(new THREE.Vector2(0,0),new THREE.Vector2(e/2,120),new THREE.Vector2(e,0))}THREE.ExtrudeGeometry.call(this,c,b)};THREE.TextGeometry.prototype=new THREE.ExtrudeGeometry;
+THREE.TextGeometry=function(a,c){var b=(new THREE.TextPath(a,c)).toShapes();c.amount=c.height!==void 0?c.height:50;if(c.bevelThickness===void 0)c.bevelThickness=10;if(c.bevelSize===void 0)c.bevelSize=8;if(c.bevelEnabled===void 0)c.bevelEnabled=!1;if(c.bend){var e=b[b.length-1].getBoundingBox().maxX;c.bendPath=new THREE.QuadraticBezierCurve(new THREE.Vector2(0,0),new THREE.Vector2(e/2,120),new THREE.Vector2(e,0))}THREE.ExtrudeGeometry.call(this,b,c)};THREE.TextGeometry.prototype=new THREE.ExtrudeGeometry;
 THREE.TextGeometry.prototype.constructor=THREE.TextGeometry;
-THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function(){return this.faces[this.face][this.weight][this.style]},getTextShapes:function(a,b){return(new TextPath(a,b)).toShapes()},loadFace:function(a){var b=a.familyName.toLowerCase();this.faces[b]=this.faces[b]||{};this.faces[b][a.cssFontWeight]=this.faces[b][a.cssFontWeight]||{};this.faces[b][a.cssFontWeight][a.cssFontStyle]=a;return this.faces[b][a.cssFontWeight][a.cssFontStyle]=a},drawText:function(a){for(var b=
-this.getFace(),c=this.size/b.resolution,e=0,f=String(a).split(""),h=f.length,g=[],a=0;a<h;a++){var k=new THREE.Path,k=this.extractGlyphPoints(f[a],b,c,e,k);e+=k.offset;g.push(k.path)}return{paths:g,offset:e/2}},extractGlyphPoints:function(a,b,c,e,f){var h=[],g,k,l,m,n,o,t,u,v,y,p=b.glyphs[a]||b.glyphs[ctxt.options.fallbackCharacter];if(p){if(p.o){b=p._cachedOutline||(p._cachedOutline=p.o.split(" "));l=b.length;for(a=0;a<l;)switch(k=b[a++],k){case "m":k=b[a++]*c+e;m=b[a++]*c;h.push(new THREE.Vector2(k,
-m));f.moveTo(k,m);break;case "l":k=b[a++]*c+e;m=b[a++]*c;h.push(new THREE.Vector2(k,m));f.lineTo(k,m);break;case "q":k=b[a++]*c+e;m=b[a++]*c;t=b[a++]*c+e;u=b[a++]*c;f.quadraticCurveTo(t,u,k,m);if(g=h[h.length-1]){n=g.x;o=g.y;g=1;for(divisions=this.divisions;g<=divisions;g++){var z=g/divisions,x=THREE.Shape.Utils.b2(z,n,t,k),z=THREE.Shape.Utils.b2(z,o,u,m);h.push(new THREE.Vector2(x,z))}}break;case "b":if(k=b[a++]*c+e,m=b[a++]*c,t=b[a++]*c+e,u=b[a++]*-c,v=b[a++]*c+e,y=b[a++]*-c,f.bezierCurveTo(k,m,
-t,u,v,y),g=h[h.length-1]){n=g.x;o=g.y;g=1;for(divisions=this.divisions;g<=divisions;g++)z=g/divisions,x=THREE.Shape.Utils.b3(z,n,t,v,k),z=THREE.Shape.Utils.b3(z,o,u,y,m),h.push(new THREE.Vector2(x,z))}}}return{offset:p.ha*c,points:h,path:f}}}};
-(function(a){var b=function(a){for(var b=a.length,f=0,h=b-1,g=0;g<b;h=g++)f+=a[h].x*a[g].y-a[g].x*a[h].y;return f*0.5};a.Triangulate=function(a,e){var f=a.length;if(f<3)return null;var h=[],g=[],k=[],l,m,n;if(b(a)>0)for(m=0;m<f;m++)g[m]=m;else for(m=0;m<f;m++)g[m]=f-1-m;var o=2*f;for(m=f-1;f>2;){if(o--<=0){console.log("Warning, unable to triangulate polygon!");if(e)return k;return h}l=m;f<=l&&(l=0);m=l+1;f<=m&&(m=0);n=m+1;f<=n&&(n=0);var t;a:{t=a;var u=l,v=m,y=n,p=f,z=g,x=void 0,w=void 0,A=void 0,
-D=void 0,B=void 0,E=void 0,I=void 0,G=void 0,K=void 0,w=t[z[u]].x,A=t[z[u]].y,D=t[z[v]].x,B=t[z[v]].y,E=t[z[y]].x,I=t[z[y]].y;if(1.0E-10>(D-w)*(I-A)-(B-A)*(E-w))t=!1;else{for(x=0;x<p;x++)if(!(x==u||x==v||x==y)){var G=t[z[x]].x,K=t[z[x]].y,C=void 0,F=void 0,J=void 0,M=void 0,N=void 0,L=void 0,O=void 0,H=void 0,Q=void 0,P=void 0,T=void 0,X=void 0,C=J=N=void 0,C=E-D,F=I-B,J=w-E,M=A-I,N=D-w,L=B-A,O=G-w,H=K-A,Q=G-D,P=K-B,T=G-E,X=K-I,C=C*P-F*Q,N=N*H-L*O,J=J*X-M*T;if(C>=0&&J>=0&&N>=0){t=!1;break a}}t=!0}}if(t){h.push([a[g[l]],
-a[g[m]],a[g[n]]]);k.push([g[l],g[m],g[n]]);l=m;for(n=m+1;n<f;l++,n++)g[l]=g[n];f--;o=2*f}}if(e)return k;return h};a.Triangulate.area=b;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
-THREE.TorusGeometry=function(a,b,c,e,f){THREE.Geometry.call(this);this.radius=a||100;this.tube=b||40;this.segmentsR=c||8;this.segmentsT=e||6;this.arc=f||Math.PI*2;f=new THREE.Vector3;a=[];b=[];for(c=0;c<=this.segmentsR;c++)for(e=0;e<=this.segmentsT;e++){var h=e/this.segmentsT*this.arc,g=c/this.segmentsR*Math.PI*2;f.x=this.radius*Math.cos(h);f.y=this.radius*Math.sin(h);var k=new THREE.Vector3;k.x=(this.radius+this.tube*Math.cos(g))*Math.cos(h);k.y=(this.radius+this.tube*Math.cos(g))*Math.sin(h);k.z=
-this.tube*Math.sin(g);this.vertices.push(new THREE.Vertex(k));a.push(new THREE.UV(e/this.segmentsT,1-c/this.segmentsR));b.push(k.clone().subSelf(f).normalize())}for(c=1;c<=this.segmentsR;c++)for(e=1;e<=this.segmentsT;e++){var f=(this.segmentsT+1)*c+e-1,h=(this.segmentsT+1)*(c-1)+e-1,g=(this.segmentsT+1)*(c-1)+e,k=(this.segmentsT+1)*c+e,l=new THREE.Face4(f,h,g,k,[b[f],b[h],b[g],b[k]]);l.normal.addSelf(b[f]);l.normal.addSelf(b[h]);l.normal.addSelf(b[g]);l.normal.addSelf(b[k]);l.normal.normalize();this.faces.push(l);
-this.faceVertexUvs[0].push([a[f].clone(),a[h].clone(),a[g].clone(),a[k].clone()])}this.computeCentroids()};THREE.TorusGeometry.prototype=new THREE.Geometry;THREE.TorusGeometry.prototype.constructor=THREE.TorusGeometry;
-THREE.TorusKnotGeometry=function(a,b,c,e,f,h,g){function k(a,c,b,e,g,h){c=b/e*a;b=Math.cos(c);return new THREE.Vector3(g*(2+b)*0.5*Math.cos(a),g*(2+b)*Math.sin(a)*0.5,h*g*Math.sin(c)*0.5)}THREE.Geometry.call(this);this.radius=a||200;this.tube=b||40;this.segmentsR=c||64;this.segmentsT=e||8;this.p=f||2;this.q=h||3;this.heightScale=g||1;this.grid=Array(this.segmentsR);c=new THREE.Vector3;e=new THREE.Vector3;h=new THREE.Vector3;for(a=0;a<this.segmentsR;++a){this.grid[a]=Array(this.segmentsT);for(b=0;b<
-this.segmentsT;++b){var l=a/this.segmentsR*2*this.p*Math.PI,g=b/this.segmentsT*2*Math.PI,f=k(l,g,this.q,this.p,this.radius,this.heightScale),l=k(l+0.01,g,this.q,this.p,this.radius,this.heightScale);c.x=l.x-f.x;c.y=l.y-f.y;c.z=l.z-f.z;e.x=l.x+f.x;e.y=l.y+f.y;e.z=l.z+f.z;h.cross(c,e);e.cross(h,c);h.normalize();e.normalize();l=-this.tube*Math.cos(g);g=this.tube*Math.sin(g);f.x+=l*e.x+g*h.x;f.y+=l*e.y+g*h.y;f.z+=l*e.z+g*h.z;this.grid[a][b]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(f.x,f.y,
-f.z)))-1}}for(a=0;a<this.segmentsR;++a)for(b=0;b<this.segmentsT;++b){var e=(a+1)%this.segmentsR,h=(b+1)%this.segmentsT,f=this.grid[a][b],c=this.grid[e][b],e=this.grid[e][h],h=this.grid[a][h],g=new THREE.UV(a/this.segmentsR,b/this.segmentsT),l=new THREE.UV((a+1)/this.segmentsR,b/this.segmentsT),m=new THREE.UV((a+1)/this.segmentsR,(b+1)/this.segmentsT),n=new THREE.UV(a/this.segmentsR,(b+1)/this.segmentsT);this.faces.push(new THREE.Face4(f,c,e,h));this.faceVertexUvs[0].push([g,l,m,n])}this.computeCentroids();
-this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusKnotGeometry.prototype=new THREE.Geometry;THREE.TorusKnotGeometry.prototype.constructor=THREE.TorusKnotGeometry;THREE.SubdivisionModifier=function(a){this.subdivisions=a===void 0?1:a;this.useOldVertexColors=!1;this.supportUVs=!0};THREE.SubdivisionModifier.prototype.constructor=THREE.SubdivisionModifier;THREE.SubdivisionModifier.prototype.modify=function(a){for(var b=this.subdivisions;b-- >0;)this.smooth(a)};
-THREE.SubdivisionModifier.prototype.smooth=function(a){function b(a,c,b,e,k,l){var m=new THREE.Face4(a,c,b,e,null,k.color,k.material);if(g.useOldVertexColors){m.vertexColors=[];for(var n,p,u,t=0;t<4;t++){u=l[t];n=new THREE.Color;n.setRGB(0,0,0);for(var v=0;v<u.length;v++)p=k.vertexColors[u[v]-1],n.r+=p.r,n.g+=p.g,n.b+=p.b;n.r/=u.length;n.g/=u.length;n.b/=u.length;m.vertexColors[t]=n}}f.push(m);(!g.supportUVs||o.length!=0)&&h.push([o[a],o[c],o[b],o[e]])}function c(a,c){return Math.min(a,c)+"_"+Math.max(a,
-c)}var e=[],f=[],h=[],g=this,k=a.vertices,e=a.faces,l=k.concat(),m=[],n={},o=[],t,u,v,y,p,z=a.faceVertexUvs[0];t=0;for(u=z.length;t<u;t++){v=0;for(y=z[t].length;v<y;v++)p=e[t]["abcd".charAt(v)],o[p]||(o[p]=z[t][v])}var x;t=0;for(u=e.length;t<u;t++)if(p=e[t],m.push(p.centroid),l.push(new THREE.Vertex(p.centroid)),g.supportUVs&&o.length!=0){x=new THREE.UV;if(p instanceof THREE.Face3)x.u=o[p.a].u+o[p.b].u+o[p.c].u,x.v=o[p.a].v+o[p.b].v+o[p.c].v,x.u/=3,x.v/=3;else if(p instanceof THREE.Face4)x.u=o[p.a].u+
-o[p.b].u+o[p.c].u+o[p.d].u,x.v=o[p.a].v+o[p.b].v+o[p.c].v+o[p.d].v,x.u/=4,x.v/=4;o.push(x)}y=function(a){function b(a,c,e){a[c]===void 0&&(a[c]=[]);a[c].push(e)}var e,g,h,f,k={};e=0;for(g=a.faces.length;e<g;e++)h=a.faces[e],h instanceof THREE.Face3?(f=c(h.a,h.b),b(k,f,e),f=c(h.b,h.c),b(k,f,e),f=c(h.c,h.a),b(k,f,e)):h instanceof THREE.Face4&&(f=c(h.a,h.b),b(k,f,e),f=c(h.b,h.c),b(k,f,e),f=c(h.c,h.d),b(k,f,e),f=c(h.d,h.a),b(k,f,e));return k}(a);var w,A,D=0,z=k.length,B;for(t in y)if(p=y[t],x=p[0],w=
-p[1],B=t.split("_"),u=B[0],B=B[1],A=new THREE.Vector3,p.length!=2?(A.addSelf(k[u].position),A.addSelf(k[B].position),A.multiplyScalar(0.5)):(A.addSelf(m[x]),A.addSelf(m[w]),A.addSelf(k[u].position),A.addSelf(k[B].position),A.multiplyScalar(0.25)),n[t]=z+e.length+D,l.push(new THREE.Vertex(A)),D++,g.supportUVs&&o.length!=0)x=new THREE.UV,x.u=o[u].u+o[B].u,x.v=o[u].v+o[B].v,x.u/=2,x.v/=2,o.push(x);t=0;for(u=m.length;t<u;t++)p=e[t],x=z+t,p instanceof THREE.Face3?(w=c(p.a,p.b),B=c(p.b,p.c),D=c(p.c,p.a),
-b(x,n[w],p.b,n[B],p,["123","12","2","23"]),b(x,n[B],p.c,n[D],p,["123","23","3","31"]),b(x,n[D],p.a,n[w],p,["123","31","1","12"])):p instanceof THREE.Face4?(w=c(p.a,p.b),B=c(p.b,p.c),D=c(p.c,p.d),A=c(p.d,p.a),b(x,n[w],p.b,n[B],p,["1234","12","2","23"]),b(x,n[B],p.c,n[D],p,["1234","23","3","34"]),b(x,n[D],p.d,n[A],p,["1234","34","4","41"]),b(x,n[A],p.a,n[w],p,["1234","41","1","12"])):console.log("face should be a face!",p);var e=l,E={},I={},l=function(a,c){E[a]===void 0&&(E[a]=[]);E[a].push(c)},n=function(a,
-c){I[a]===void 0&&(I[a]={});I[a][c]=null};for(t in y)p=y[t],B=t.split("_"),u=B[0],B=B[1],l(u,[u,B]),l(B,[u,B]),x=p[0],w=p[1],n(u,x),w?n(u,w):n(u,x),n(B,x),w?n(B,w):n(B,x);l=new THREE.Vector3;n=new THREE.Vector3;t=0;for(u=k.length;t<u;t++)if(E[t]!==void 0){l.set(0,0,0);n.set(0,0,0);y=new THREE.Vector3(0,0,0);z=0;for(v in I[t])l.addSelf(m[v]),z++;l.divideScalar(z);z=E[t].length;for(v=0;v<z;v++)p=E[t][v],p=k[p[0]].position.clone().addSelf(k[p[1]].position).divideScalar(2),n.addSelf(p);n.divideScalar(z);
-y.addSelf(k[t].position);y.multiplyScalar(z-3);y.addSelf(l);y.addSelf(n.multiplyScalar(2));y.divideScalar(z);e[t].position=y}a.vertices=e;a.faces=f;a.faceVertexUvs[0]=h;delete a.__tmpVertices;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals()};THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
-THREE.Loader.prototype={constructor:THREE.Loader,addStatusElement:function(){var a=document.createElement("div");a.style.position="absolute";a.style.right="0px";a.style.top="0px";a.style.fontSize="0.8em";a.style.textAlign="left";a.style.background="rgba(0,0,0,0.25)";a.style.color="#fff";a.style.width="120px";a.style.padding="0.5em 0.5em 0.5em 0.5em";a.style.zIndex=1E3;a.innerHTML="Loading ...";return a},updateProgress:function(a){var b="Loaded ";b+=a.total?(100*a.loaded/a.total).toFixed(0)+"%":(a.loaded/
-1E3).toFixed(2)+" KB";this.statusDomElement.innerHTML=b},extractUrlbase:function(a){a=a.split("/");a.pop();return a.length<1?"":a.join("/")+"/"},init_materials:function(a,b,c){a.materials=[];for(var e=0;e<b.length;++e)a.materials[e]=[THREE.Loader.prototype.createMaterial(b[e],c)]},hasNormals:function(a){var b,c,e=a.materials.length;for(c=0;c<e;c++)if(b=a.materials[c][0],b instanceof THREE.ShaderMaterial)return!0;return!1},createMaterial:function(a,b){function c(a){a=Math.log(a)/Math.LN2;return Math.floor(a)==
-a}function e(a,b){var e=new Image;e.onload=function(){if(!c(this.width)||!c(this.height)){var b=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),e=Math.pow(2,Math.round(Math.log(this.height)/Math.LN2));a.image.width=b;a.image.height=e;a.image.getContext("2d").drawImage(this,0,0,b,e)}else a.image=this;a.needsUpdate=!0};e.src=b}function f(a,c,g,h,f,k){var l=document.createElement("canvas");a[c]=new THREE.Texture(l);a[c].sourceFile=g;if(h){a[c].repeat.set(h[0],h[1]);if(h[0]!=1)a[c].wrapS=THREE.RepeatWrapping;
-if(h[1]!=1)a[c].wrapT=THREE.RepeatWrapping}f&&a[c].offset.set(f[0],f[1]);if(k){h={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(h[k[0]]!==void 0)a[c].wrapS=h[k[0]];if(h[k[1]]!==void 0)a[c].wrapT=h[k[1]]}e(a[c],b+"/"+g)}function h(a){return(a[0]*255<<16)+(a[1]*255<<8)+a[2]*255}var g,k,l;k="MeshLambertMaterial";g={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:a.wireframe};a.shading&&(a.shading=="Phong"?k="MeshPhongMaterial":a.shading=="Basic"&&(k="MeshBasicMaterial"));
-if(a.blending)if(a.blending=="Additive")g.blending=THREE.AdditiveBlending;else if(a.blending=="Subtractive")g.blending=THREE.SubtractiveBlending;else if(a.blending=="Multiply")g.blending=THREE.MultiplyBlending;if(a.transparent!==void 0||a.opacity<1)g.transparent=a.transparent;if(a.depthTest!==void 0)g.depthTest=a.depthTest;if(a.vertexColors!==void 0)if(a.vertexColors=="face")g.vertexColors=THREE.FaceColors;else if(a.vertexColors)g.vertexColors=THREE.VertexColors;if(a.colorDiffuse)g.color=h(a.colorDiffuse);
-else if(a.DbgColor)g.color=a.DbgColor;if(a.colorSpecular)g.specular=h(a.colorSpecular);if(a.colorAmbient)g.ambient=h(a.colorAmbient);if(a.transparency)g.opacity=a.transparency;if(a.specularCoef)g.shininess=a.specularCoef;a.mapDiffuse&&b&&f(g,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap);a.mapLight&&b&&f(g,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap);a.mapNormal&&b&&f(g,"normalMap",a.mapNormal,a.mapNormalRepeat,a.mapNormalOffset,a.mapNormalWrap);
-a.mapSpecular&&b&&f(g,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){var m=THREE.ShaderUtils.lib.normal,n=THREE.UniformsUtils.clone(m.uniforms),o=g.color;k=g.specular;l=g.ambient;var t=g.shininess;n.tNormal.texture=g.normalMap;if(a.mapNormalFactor)n.uNormalScale.value=a.mapNormalFactor;if(g.map)n.tDiffuse.texture=g.map,n.enableDiffuse.value=!0;if(g.specularMap)n.tSpecular.texture=g.specularMap,n.enableSpecular.value=!0;if(g.lightMap)n.tAO.texture=
-g.lightMap,n.enableAO.value=!0;n.uDiffuseColor.value.setHex(o);n.uSpecularColor.value.setHex(k);n.uAmbientColor.value.setHex(l);n.uShininess.value=t;if(g.opacity)n.uOpacity.value=g.opacity;g=new THREE.ShaderMaterial({fragmentShader:m.fragmentShader,vertexShader:m.vertexShader,uniforms:n,lights:!0,fog:!0})}else g=new THREE[k](g);return g}};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;
+THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function(){return this.faces[this.face][this.weight][this.style]},getTextShapes:function(a,c){return(new TextPath(a,c)).toShapes()},loadFace:function(a){var c=a.familyName.toLowerCase();this.faces[c]=this.faces[c]||{};this.faces[c][a.cssFontWeight]=this.faces[c][a.cssFontWeight]||{};this.faces[c][a.cssFontWeight][a.cssFontStyle]=a;return this.faces[c][a.cssFontWeight][a.cssFontStyle]=a},drawText:function(a){for(var c=
+this.getFace(),b=this.size/c.resolution,e=0,g=String(a).split(""),h=g.length,f=[],a=0;a<h;a++){var k=new THREE.Path,k=this.extractGlyphPoints(g[a],c,b,e,k);e+=k.offset;f.push(k.path)}return{paths:f,offset:e/2}},extractGlyphPoints:function(a,c,b,e,g){var h=[],f,k,l,m,n,o,p,u,v,y,t=c.glyphs[a]||c.glyphs[ctxt.options.fallbackCharacter];if(t){if(t.o){c=t._cachedOutline||(t._cachedOutline=t.o.split(" "));l=c.length;for(a=0;a<l;)switch(k=c[a++],k){case "m":k=c[a++]*b+e;m=c[a++]*b;h.push(new THREE.Vector2(k,
+m));g.moveTo(k,m);break;case "l":k=c[a++]*b+e;m=c[a++]*b;h.push(new THREE.Vector2(k,m));g.lineTo(k,m);break;case "q":k=c[a++]*b+e;m=c[a++]*b;p=c[a++]*b+e;u=c[a++]*b;g.quadraticCurveTo(p,u,k,m);if(f=h[h.length-1]){n=f.x;o=f.y;f=1;for(divisions=this.divisions;f<=divisions;f++){var z=f/divisions,x=THREE.Shape.Utils.b2(z,n,p,k),z=THREE.Shape.Utils.b2(z,o,u,m);h.push(new THREE.Vector2(x,z))}}break;case "b":if(k=c[a++]*b+e,m=c[a++]*b,p=c[a++]*b+e,u=c[a++]*-b,v=c[a++]*b+e,y=c[a++]*-b,g.bezierCurveTo(k,m,
+p,u,v,y),f=h[h.length-1]){n=f.x;o=f.y;f=1;for(divisions=this.divisions;f<=divisions;f++)z=f/divisions,x=THREE.Shape.Utils.b3(z,n,p,v,k),z=THREE.Shape.Utils.b3(z,o,u,y,m),h.push(new THREE.Vector2(x,z))}}}return{offset:t.ha*b,points:h,path:g}}}};
+(function(a){var c=function(a){for(var c=a.length,g=0,h=c-1,f=0;f<c;h=f++)g+=a[h].x*a[f].y-a[f].x*a[h].y;return g*0.5};a.Triangulate=function(a,e){var g=a.length;if(g<3)return null;var h=[],f=[],k=[],l,m,n;if(c(a)>0)for(m=0;m<g;m++)f[m]=m;else for(m=0;m<g;m++)f[m]=g-1-m;var o=2*g;for(m=g-1;g>2;){if(o--<=0){console.log("Warning, unable to triangulate polygon!");if(e)return k;return h}l=m;g<=l&&(l=0);m=l+1;g<=m&&(m=0);n=m+1;g<=n&&(n=0);var p;a:{p=a;var u=l,v=m,y=n,t=g,z=f,x=void 0,w=void 0,A=void 0,
+D=void 0,B=void 0,E=void 0,I=void 0,G=void 0,K=void 0,w=p[z[u]].x,A=p[z[u]].y,D=p[z[v]].x,B=p[z[v]].y,E=p[z[y]].x,I=p[z[y]].y;if(1.0E-10>(D-w)*(I-A)-(B-A)*(E-w))p=!1;else{for(x=0;x<t;x++)if(!(x==u||x==v||x==y)){var G=p[z[x]].x,K=p[z[x]].y,C=void 0,F=void 0,J=void 0,M=void 0,N=void 0,L=void 0,O=void 0,H=void 0,Q=void 0,P=void 0,T=void 0,X=void 0,C=J=N=void 0,C=E-D,F=I-B,J=w-E,M=A-I,N=D-w,L=B-A,O=G-w,H=K-A,Q=G-D,P=K-B,T=G-E,X=K-I,C=C*P-F*Q,N=N*H-L*O,J=J*X-M*T;if(C>=0&&J>=0&&N>=0){p=!1;break a}}p=!0}}if(p){h.push([a[f[l]],
+a[f[m]],a[f[n]]]);k.push([f[l],f[m],f[n]]);l=m;for(n=m+1;n<g;l++,n++)f[l]=f[n];g--;o=2*g}}if(e)return k;return h};a.Triangulate.area=c;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
+THREE.TorusGeometry=function(a,c,b,e,g){THREE.Geometry.call(this);this.radius=a||100;this.tube=c||40;this.segmentsR=b||8;this.segmentsT=e||6;this.arc=g||Math.PI*2;g=new THREE.Vector3;a=[];c=[];for(b=0;b<=this.segmentsR;b++)for(e=0;e<=this.segmentsT;e++){var h=e/this.segmentsT*this.arc,f=b/this.segmentsR*Math.PI*2;g.x=this.radius*Math.cos(h);g.y=this.radius*Math.sin(h);var k=new THREE.Vector3;k.x=(this.radius+this.tube*Math.cos(f))*Math.cos(h);k.y=(this.radius+this.tube*Math.cos(f))*Math.sin(h);k.z=
+this.tube*Math.sin(f);this.vertices.push(new THREE.Vertex(k));a.push(new THREE.UV(e/this.segmentsT,1-b/this.segmentsR));c.push(k.clone().subSelf(g).normalize())}for(b=1;b<=this.segmentsR;b++)for(e=1;e<=this.segmentsT;e++){var g=(this.segmentsT+1)*b+e-1,h=(this.segmentsT+1)*(b-1)+e-1,f=(this.segmentsT+1)*(b-1)+e,k=(this.segmentsT+1)*b+e,l=new THREE.Face4(g,h,f,k,[c[g],c[h],c[f],c[k]]);l.normal.addSelf(c[g]);l.normal.addSelf(c[h]);l.normal.addSelf(c[f]);l.normal.addSelf(c[k]);l.normal.normalize();this.faces.push(l);
+this.faceVertexUvs[0].push([a[g].clone(),a[h].clone(),a[f].clone(),a[k].clone()])}this.computeCentroids()};THREE.TorusGeometry.prototype=new THREE.Geometry;THREE.TorusGeometry.prototype.constructor=THREE.TorusGeometry;
+THREE.TorusKnotGeometry=function(a,c,b,e,g,h,f){function k(a,b,c,e,f,h){b=c/e*a;c=Math.cos(b);return new THREE.Vector3(f*(2+c)*0.5*Math.cos(a),f*(2+c)*Math.sin(a)*0.5,h*f*Math.sin(b)*0.5)}THREE.Geometry.call(this);this.radius=a||200;this.tube=c||40;this.segmentsR=b||64;this.segmentsT=e||8;this.p=g||2;this.q=h||3;this.heightScale=f||1;this.grid=Array(this.segmentsR);b=new THREE.Vector3;e=new THREE.Vector3;h=new THREE.Vector3;for(a=0;a<this.segmentsR;++a){this.grid[a]=Array(this.segmentsT);for(c=0;c<
+this.segmentsT;++c){var l=a/this.segmentsR*2*this.p*Math.PI,f=c/this.segmentsT*2*Math.PI,g=k(l,f,this.q,this.p,this.radius,this.heightScale),l=k(l+0.01,f,this.q,this.p,this.radius,this.heightScale);b.x=l.x-g.x;b.y=l.y-g.y;b.z=l.z-g.z;e.x=l.x+g.x;e.y=l.y+g.y;e.z=l.z+g.z;h.cross(b,e);e.cross(h,b);h.normalize();e.normalize();l=-this.tube*Math.cos(f);f=this.tube*Math.sin(f);g.x+=l*e.x+f*h.x;g.y+=l*e.y+f*h.y;g.z+=l*e.z+f*h.z;this.grid[a][c]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(g.x,g.y,
+g.z)))-1}}for(a=0;a<this.segmentsR;++a)for(c=0;c<this.segmentsT;++c){var e=(a+1)%this.segmentsR,h=(c+1)%this.segmentsT,g=this.grid[a][c],b=this.grid[e][c],e=this.grid[e][h],h=this.grid[a][h],f=new THREE.UV(a/this.segmentsR,c/this.segmentsT),l=new THREE.UV((a+1)/this.segmentsR,c/this.segmentsT),m=new THREE.UV((a+1)/this.segmentsR,(c+1)/this.segmentsT),n=new THREE.UV(a/this.segmentsR,(c+1)/this.segmentsT);this.faces.push(new THREE.Face4(g,b,e,h));this.faceVertexUvs[0].push([f,l,m,n])}this.computeCentroids();
+this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusKnotGeometry.prototype=new THREE.Geometry;THREE.TorusKnotGeometry.prototype.constructor=THREE.TorusKnotGeometry;THREE.SubdivisionModifier=function(a){this.subdivisions=a===void 0?1:a;this.useOldVertexColors=!1;this.supportUVs=!0};THREE.SubdivisionModifier.prototype.constructor=THREE.SubdivisionModifier;THREE.SubdivisionModifier.prototype.modify=function(a){for(var c=this.subdivisions;c-- >0;)this.smooth(a)};
+THREE.SubdivisionModifier.prototype.smooth=function(a){function c(a,b,c,e,k,l){var m=new THREE.Face4(a,b,c,e,null,k.color,k.material);if(f.useOldVertexColors){m.vertexColors=[];for(var n,t,u,p=0;p<4;p++){u=l[p];n=new THREE.Color;n.setRGB(0,0,0);for(var v=0;v<u.length;v++)t=k.vertexColors[u[v]-1],n.r+=t.r,n.g+=t.g,n.b+=t.b;n.r/=u.length;n.g/=u.length;n.b/=u.length;m.vertexColors[p]=n}}g.push(m);(!f.supportUVs||o.length!=0)&&h.push([o[a],o[b],o[c],o[e]])}function b(a,b){return Math.min(a,b)+"_"+Math.max(a,
+b)}var e=[],g=[],h=[],f=this,k=a.vertices,e=a.faces,l=k.concat(),m=[],n={},o=[],p,u,v,y,t,z=a.faceVertexUvs[0];p=0;for(u=z.length;p<u;p++){v=0;for(y=z[p].length;v<y;v++)t=e[p]["abcd".charAt(v)],o[t]||(o[t]=z[p][v])}var x;p=0;for(u=e.length;p<u;p++)if(t=e[p],m.push(t.centroid),l.push(new THREE.Vertex(t.centroid)),f.supportUVs&&o.length!=0){x=new THREE.UV;if(t instanceof THREE.Face3)x.u=o[t.a].u+o[t.b].u+o[t.c].u,x.v=o[t.a].v+o[t.b].v+o[t.c].v,x.u/=3,x.v/=3;else if(t instanceof THREE.Face4)x.u=o[t.a].u+
+o[t.b].u+o[t.c].u+o[t.d].u,x.v=o[t.a].v+o[t.b].v+o[t.c].v+o[t.d].v,x.u/=4,x.v/=4;o.push(x)}y=function(a){function c(a,b,e){a[b]===void 0&&(a[b]=[]);a[b].push(e)}var e,f,h,g,k={};e=0;for(f=a.faces.length;e<f;e++)h=a.faces[e],h instanceof THREE.Face3?(g=b(h.a,h.b),c(k,g,e),g=b(h.b,h.c),c(k,g,e),g=b(h.c,h.a),c(k,g,e)):h instanceof THREE.Face4&&(g=b(h.a,h.b),c(k,g,e),g=b(h.b,h.c),c(k,g,e),g=b(h.c,h.d),c(k,g,e),g=b(h.d,h.a),c(k,g,e));return k}(a);var w,A,D=0,z=k.length,B;for(p in y)if(t=y[p],x=t[0],w=
+t[1],B=p.split("_"),u=B[0],B=B[1],A=new THREE.Vector3,t.length!=2?(A.addSelf(k[u].position),A.addSelf(k[B].position),A.multiplyScalar(0.5)):(A.addSelf(m[x]),A.addSelf(m[w]),A.addSelf(k[u].position),A.addSelf(k[B].position),A.multiplyScalar(0.25)),n[p]=z+e.length+D,l.push(new THREE.Vertex(A)),D++,f.supportUVs&&o.length!=0)x=new THREE.UV,x.u=o[u].u+o[B].u,x.v=o[u].v+o[B].v,x.u/=2,x.v/=2,o.push(x);p=0;for(u=m.length;p<u;p++)t=e[p],x=z+p,t instanceof THREE.Face3?(w=b(t.a,t.b),B=b(t.b,t.c),D=b(t.c,t.a),
+c(x,n[w],t.b,n[B],t,["123","12","2","23"]),c(x,n[B],t.c,n[D],t,["123","23","3","31"]),c(x,n[D],t.a,n[w],t,["123","31","1","12"])):t instanceof THREE.Face4?(w=b(t.a,t.b),B=b(t.b,t.c),D=b(t.c,t.d),A=b(t.d,t.a),c(x,n[w],t.b,n[B],t,["1234","12","2","23"]),c(x,n[B],t.c,n[D],t,["1234","23","3","34"]),c(x,n[D],t.d,n[A],t,["1234","34","4","41"]),c(x,n[A],t.a,n[w],t,["1234","41","1","12"])):console.log("face should be a face!",t);var e=l,E={},I={},l=function(a,b){E[a]===void 0&&(E[a]=[]);E[a].push(b)},n=function(a,
+b){I[a]===void 0&&(I[a]={});I[a][b]=null};for(p in y)t=y[p],B=p.split("_"),u=B[0],B=B[1],l(u,[u,B]),l(B,[u,B]),x=t[0],w=t[1],n(u,x),w?n(u,w):n(u,x),n(B,x),w?n(B,w):n(B,x);l=new THREE.Vector3;n=new THREE.Vector3;p=0;for(u=k.length;p<u;p++)if(E[p]!==void 0){l.set(0,0,0);n.set(0,0,0);y=new THREE.Vector3(0,0,0);z=0;for(v in I[p])l.addSelf(m[v]),z++;l.divideScalar(z);z=E[p].length;for(v=0;v<z;v++)t=E[p][v],t=k[t[0]].position.clone().addSelf(k[t[1]].position).divideScalar(2),n.addSelf(t);n.divideScalar(z);
+y.addSelf(k[p].position);y.multiplyScalar(z-3);y.addSelf(l);y.addSelf(n.multiplyScalar(2));y.divideScalar(z);e[p].position=y}a.vertices=e;a.faces=g;a.faceVertexUvs[0]=h;delete a.__tmpVertices;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals()};THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
+THREE.Loader.prototype={constructor:THREE.Loader,addStatusElement:function(){var a=document.createElement("div");a.style.position="absolute";a.style.right="0px";a.style.top="0px";a.style.fontSize="0.8em";a.style.textAlign="left";a.style.background="rgba(0,0,0,0.25)";a.style.color="#fff";a.style.width="120px";a.style.padding="0.5em 0.5em 0.5em 0.5em";a.style.zIndex=1E3;a.innerHTML="Loading ...";return a},updateProgress:function(a){var c="Loaded ";c+=a.total?(100*a.loaded/a.total).toFixed(0)+"%":(a.loaded/
+1E3).toFixed(2)+" KB";this.statusDomElement.innerHTML=c},extractUrlbase:function(a){a=a.split("/");a.pop();return a.length<1?"":a.join("/")+"/"},init_materials:function(a,c,b){a.materials=[];for(var e=0;e<c.length;++e)a.materials[e]=[THREE.Loader.prototype.createMaterial(c[e],b)]},hasNormals:function(a){var c,b,e=a.materials.length;for(b=0;b<e;b++)if(c=a.materials[b][0],c instanceof THREE.ShaderMaterial)return!0;return!1},createMaterial:function(a,c){function b(a){a=Math.log(a)/Math.LN2;return Math.floor(a)==
+a}function e(a,c){var e=new Image;e.onload=function(){if(!b(this.width)||!b(this.height)){var c=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),e=Math.pow(2,Math.round(Math.log(this.height)/Math.LN2));a.image.width=c;a.image.height=e;a.image.getContext("2d").drawImage(this,0,0,c,e)}else a.image=this;a.needsUpdate=!0};e.src=c}function g(a,b,f,h,g,k){var l=document.createElement("canvas");a[b]=new THREE.Texture(l);a[b].sourceFile=f;if(h){a[b].repeat.set(h[0],h[1]);if(h[0]!=1)a[b].wrapS=THREE.RepeatWrapping;
+if(h[1]!=1)a[b].wrapT=THREE.RepeatWrapping}g&&a[b].offset.set(g[0],g[1]);if(k){h={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(h[k[0]]!==void 0)a[b].wrapS=h[k[0]];if(h[k[1]]!==void 0)a[b].wrapT=h[k[1]]}e(a[b],c+"/"+f)}function h(a){return(a[0]*255<<16)+(a[1]*255<<8)+a[2]*255}var f,k,l;k="MeshLambertMaterial";f={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:a.wireframe};a.shading&&(a.shading=="Phong"?k="MeshPhongMaterial":a.shading=="Basic"&&(k="MeshBasicMaterial"));
+if(a.blending)if(a.blending=="Additive")f.blending=THREE.AdditiveBlending;else if(a.blending=="Subtractive")f.blending=THREE.SubtractiveBlending;else if(a.blending=="Multiply")f.blending=THREE.MultiplyBlending;if(a.transparent!==void 0||a.opacity<1)f.transparent=a.transparent;if(a.depthTest!==void 0)f.depthTest=a.depthTest;if(a.vertexColors!==void 0)if(a.vertexColors=="face")f.vertexColors=THREE.FaceColors;else if(a.vertexColors)f.vertexColors=THREE.VertexColors;if(a.colorDiffuse)f.color=h(a.colorDiffuse);
+else if(a.DbgColor)f.color=a.DbgColor;if(a.colorSpecular)f.specular=h(a.colorSpecular);if(a.colorAmbient)f.ambient=h(a.colorAmbient);if(a.transparency)f.opacity=a.transparency;if(a.specularCoef)f.shininess=a.specularCoef;a.mapDiffuse&&c&&g(f,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap);a.mapLight&&c&&g(f,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap);a.mapNormal&&c&&g(f,"normalMap",a.mapNormal,a.mapNormalRepeat,a.mapNormalOffset,a.mapNormalWrap);
+a.mapSpecular&&c&&g(f,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){var m=THREE.ShaderUtils.lib.normal,n=THREE.UniformsUtils.clone(m.uniforms),o=f.color;k=f.specular;l=f.ambient;var p=f.shininess;n.tNormal.texture=f.normalMap;if(a.mapNormalFactor)n.uNormalScale.value=a.mapNormalFactor;if(f.map)n.tDiffuse.texture=f.map,n.enableDiffuse.value=!0;if(f.specularMap)n.tSpecular.texture=f.specularMap,n.enableSpecular.value=!0;if(f.lightMap)n.tAO.texture=
+f.lightMap,n.enableAO.value=!0;n.uDiffuseColor.value.setHex(o);n.uSpecularColor.value.setHex(k);n.uAmbientColor.value.setHex(l);n.uShininess.value=p;if(f.opacity)n.uOpacity.value=f.opacity;f=new THREE.ShaderMaterial({fragmentShader:m.fragmentShader,vertexShader:m.vertexShader,uniforms:n,lights:!0,fog:!0})}else f=new THREE[k](f);return f}};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;
 THREE.BinaryLoader.prototype.supr=THREE.Loader.prototype;
-THREE.BinaryLoader.prototype.load=function(a){var b=a.model,c=a.callback,e=a.texture_path?a.texture_path:THREE.Loader.prototype.extractUrlbase(b),f=a.bin_path?a.bin_path:THREE.Loader.prototype.extractUrlbase(b),a=(new Date).getTime(),b=new Worker(b),h=this.showProgress?THREE.Loader.prototype.updateProgress:null;b.onmessage=function(a){THREE.BinaryLoader.prototype.loadAjaxBuffers(a.data.buffers,a.data.materials,c,f,e,h)};b.onerror=function(a){alert("worker.onerror: "+a.message+"\n"+a.data);a.preventDefault()};
-b.postMessage(a)};
-THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,b,c,e,f,h){var g=new XMLHttpRequest,k=e+"/"+a,l=0;g.onreadystatechange=function(){g.readyState==4?g.status==200||g.status==0?THREE.BinaryLoader.prototype.createBinModel(g.responseText,c,f,b):alert("Couldn't load ["+k+"] ["+g.status+"]"):g.readyState==3?h&&(l==0&&(l=g.getResponseHeader("Content-Length")),h({total:l,loaded:g.responseText.length})):g.readyState==2&&(l=g.getResponseHeader("Content-Length"))};g.open("GET",k,!0);g.overrideMimeType("text/plain; charset=x-user-defined");
-g.setRequestHeader("Content-Type","text/plain");g.send(null)};
-THREE.BinaryLoader.prototype.createBinModel=function(a,b,c,e){var f=function(c){function b(a,c){var e=n(a,c),g=n(a,c+1),f=n(a,c+2),h=n(a,c+3),k=(h<<1&255|f>>7)-127;e|=(f&127)<<16|g<<8;if(e==0&&k==-127)return 0;return(1-2*(h>>7))*(1+e*Math.pow(2,-23))*Math.pow(2,k)}function f(a,c){var b=n(a,c),e=n(a,c+1),g=n(a,c+2);return(n(a,c+3)<<24)+(g<<16)+(e<<8)+b}function l(a,c){var b=n(a,c);return(n(a,c+1)<<8)+b}function m(a,c){var b=n(a,c);return b>127?b-256:b}function n(a,c){return a.charCodeAt(c)&255}function o(c){var b,
-e,g;b=f(a,c);e=f(a,c+B);g=f(a,c+E);c=l(a,c+I);z.faces.push(new THREE.Face3(b,e,g,null,null,z.materials[c]))}function t(c){var b,e,g,h,m,o;b=f(a,c);e=f(a,c+B);g=f(a,c+E);h=l(a,c+I);m=f(a,c+G);o=f(a,c+K);c=f(a,c+C);h=z.materials[h];var n=A[o*3],p=A[o*3+1];o=A[o*3+2];var t=A[c*3],u=A[c*3+1],c=A[c*3+2];z.faces.push(new THREE.Face3(b,e,g,[new THREE.Vector3(A[m*3],A[m*3+1],A[m*3+2]),new THREE.Vector3(n,p,o),new THREE.Vector3(t,u,c)],null,h))}function u(c){var b,e,g,h;b=f(a,c);e=f(a,c+F);g=f(a,c+J);h=f(a,
-c+M);c=l(a,c+N);z.faces.push(new THREE.Face4(b,e,g,h,null,null,z.materials[c]))}function v(c){var b,e,g,h,m,o,n,p;b=f(a,c);e=f(a,c+F);g=f(a,c+J);h=f(a,c+M);m=l(a,c+N);o=f(a,c+L);n=f(a,c+O);p=f(a,c+H);c=f(a,c+Q);m=z.materials[m];var t=A[n*3],u=A[n*3+1];n=A[n*3+2];var la=A[p*3],ma=A[p*3+1];p=A[p*3+2];var na=A[c*3],v=A[c*3+1],c=A[c*3+2];z.faces.push(new THREE.Face4(b,e,g,h,[new THREE.Vector3(A[o*3],A[o*3+1],A[o*3+2]),new THREE.Vector3(t,u,n),new THREE.Vector3(la,ma,p),new THREE.Vector3(na,v,c)],null,
-m))}function y(c){var b,e,g,h;b=f(a,c);e=f(a,c+P);g=f(a,c+T);c=D[b*2];h=D[b*2+1];b=D[e*2];var l=z.faceVertexUvs[0];e=D[e*2+1];var m=D[g*2];g=D[g*2+1];var o=[];o.push(new THREE.UV(c,h));o.push(new THREE.UV(b,e));o.push(new THREE.UV(m,g));l.push(o)}function p(c){var b,e,g,h,l,m;b=f(a,c);e=f(a,c+X);g=f(a,c+R);h=f(a,c+S);c=D[b*2];l=D[b*2+1];b=D[e*2];m=D[e*2+1];e=D[g*2];var o=z.faceVertexUvs[0];g=D[g*2+1];var n=D[h*2];h=D[h*2+1];var p=[];p.push(new THREE.UV(c,l));p.push(new THREE.UV(b,m));p.push(new THREE.UV(e,
-g));p.push(new THREE.UV(n,h));o.push(p)}var z=this,x=0,w,A=[],D=[],B,E,I,G,K,C,F,J,M,N,L,O,H,Q,P,T,X,R,S,W,U,Z,Y,$,V;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(z,e,c);w={signature:a.substr(x,8),header_bytes:n(a,x+8),vertex_coordinate_bytes:n(a,x+9),normal_coordinate_bytes:n(a,x+10),uv_coordinate_bytes:n(a,x+11),vertex_index_bytes:n(a,x+12),normal_index_bytes:n(a,x+13),uv_index_bytes:n(a,x+14),material_index_bytes:n(a,x+15),nvertices:f(a,x+16),nnormals:f(a,x+16+4),nuvs:f(a,x+16+
-8),ntri_flat:f(a,x+16+12),ntri_smooth:f(a,x+16+16),ntri_flat_uv:f(a,x+16+20),ntri_smooth_uv:f(a,x+16+24),nquad_flat:f(a,x+16+28),nquad_smooth:f(a,x+16+32),nquad_flat_uv:f(a,x+16+36),nquad_smooth_uv:f(a,x+16+40)};x+=w.header_bytes;B=w.vertex_index_bytes;E=w.vertex_index_bytes*2;I=w.vertex_index_bytes*3;G=w.vertex_index_bytes*3+w.material_index_bytes;K=w.vertex_index_bytes*3+w.material_index_bytes+w.normal_index_bytes;C=w.vertex_index_bytes*3+w.material_index_bytes+w.normal_index_bytes*2;F=w.vertex_index_bytes;
-J=w.vertex_index_bytes*2;M=w.vertex_index_bytes*3;N=w.vertex_index_bytes*4;L=w.vertex_index_bytes*4+w.material_index_bytes;O=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes;H=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes*2;Q=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes*3;P=w.uv_index_bytes;T=w.uv_index_bytes*2;X=w.uv_index_bytes;R=w.uv_index_bytes*2;S=w.uv_index_bytes*3;c=w.vertex_index_bytes*3+w.material_index_bytes;V=w.vertex_index_bytes*
-4+w.material_index_bytes;W=w.ntri_flat*c;U=w.ntri_smooth*(c+w.normal_index_bytes*3);Z=w.ntri_flat_uv*(c+w.uv_index_bytes*3);Y=w.ntri_smooth_uv*(c+w.normal_index_bytes*3+w.uv_index_bytes*3);$=w.nquad_flat*V;c=w.nquad_smooth*(V+w.normal_index_bytes*4);V=w.nquad_flat_uv*(V+w.uv_index_bytes*4);x+=function(c){for(var e,h,f,k=w.vertex_coordinate_bytes*3,l=c+w.nvertices*k;c<l;c+=k)e=b(a,c),h=b(a,c+w.vertex_coordinate_bytes),f=b(a,c+w.vertex_coordinate_bytes*2),z.vertices.push(new THREE.Vertex(new THREE.Vector3(e,
-h,f)));return w.nvertices*k}(x);x+=function(c){for(var b,e,g,h=w.normal_coordinate_bytes*3,f=c+w.nnormals*h;c<f;c+=h)b=m(a,c),e=m(a,c+w.normal_coordinate_bytes),g=m(a,c+w.normal_coordinate_bytes*2),A.push(b/127,e/127,g/127);return w.nnormals*h}(x);x+=function(c){for(var e,h,f=w.uv_coordinate_bytes*2,k=c+w.nuvs*f;c<k;c+=f)e=b(a,c),h=b(a,c+w.uv_coordinate_bytes),D.push(e,h);return w.nuvs*f}(x);W=x+W;U=W+U;Z=U+Z;Y=Z+Y;$=Y+$;c=$+c;V=c+V;(function(a){var c,b=w.vertex_index_bytes*3+w.material_index_bytes,
-e=b+w.uv_index_bytes*3,g=a+w.ntri_flat_uv*e;for(c=a;c<g;c+=e)o(c),y(c+b);return g-a})(U);(function(a){var c,b=w.vertex_index_bytes*3+w.material_index_bytes+w.normal_index_bytes*3,e=b+w.uv_index_bytes*3,g=a+w.ntri_smooth_uv*e;for(c=a;c<g;c+=e)t(c),y(c+b);return g-a})(Z);(function(a){var c,b=w.vertex_index_bytes*4+w.material_index_bytes,e=b+w.uv_index_bytes*4,g=a+w.nquad_flat_uv*e;for(c=a;c<g;c+=e)u(c),p(c+b);return g-a})(c);(function(a){var c,b=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes*
-4,e=b+w.uv_index_bytes*4,g=a+w.nquad_smooth_uv*e;for(c=a;c<g;c+=e)v(c),p(c+b);return g-a})(V);(function(a){var c,b=w.vertex_index_bytes*3+w.material_index_bytes,e=a+w.ntri_flat*b;for(c=a;c<e;c+=b)o(c);return e-a})(x);(function(a){var c,b=w.vertex_index_bytes*3+w.material_index_bytes+w.normal_index_bytes*3,e=a+w.ntri_smooth*b;for(c=a;c<e;c+=b)t(c);return e-a})(W);(function(a){var c,b=w.vertex_index_bytes*4+w.material_index_bytes,e=a+w.nquad_flat*b;for(c=a;c<e;c+=b)u(c);return e-a})(Y);(function(a){var c,
-b=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes*4,e=a+w.nquad_smooth*b;for(c=a;c<e;c+=b)v(c);return e-a})($);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};f.prototype=new THREE.Geometry;f.prototype.constructor=f;b(new f(c))};
-THREE.ColladaLoader=function(){function a(a,e,f){U=a;e=e||$;f!==void 0&&(a=f.split("/"),a.pop(),ja=a.length<1?"":a.join("/")+"/");fa=b("//dae:library_images/dae:image",g,"image");ga=b("//dae:library_materials/dae:material",I,"material");ha=b("//dae:library_effects/dae:effect",J,"effect");ba=b("//dae:library_geometries/dae:geometry",p,"geometry");aa=b("//dae:library_controllers/dae:controller",k,"controller");ca=b("//dae:library_animations/dae:animation",N,"animation");ia=b(".//dae:library_visual_scenes/dae:visual_scene",
-n,"visual_scene");da=[];ea=[];(a=U.evaluate(".//dae:scene/dae:instance_visual_scene",U,Q,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(a=a.getAttribute("url").replace(/^#/,""),Y=ia[a]):Y=null;Z=new THREE.Object3D;for(a=0;a<Y.nodes.length;a++)Z.add(h(Y.nodes[a]));c();for(var l in ca);l={scene:Z,morphs:da,skins:ea,dae:{images:fa,materials:ga,effects:ha,geometries:ba,controllers:aa,animations:ca,visualScenes:ia,scene:Y}};e&&e(l);return l}function b(a,c,b){for(var a=U.evaluate(a,U,Q,XPathResult.ORDERED_NODE_ITERATOR_TYPE,
-null),e={},g=a.iterateNext(),f=0;g;){g=(new c).parse(g);if(g.id.length==0)g.id=b+f++;e[g.id]=g;g=a.iterateNext()}return e}function c(){var a=1E6,c=-a,b=0,e;for(e in ca)for(var g=ca[e],f=0;f<g.sampler.length;f++){var h=g.sampler[f];h.create();a=Math.min(a,h.startTime);c=Math.max(c,h.endTime);b=Math.max(b,h.input.length)}return{start:a,end:c,frames:b}}function e(a,c,b,g){a.world=a.world||new THREE.Matrix4;a.world.copy(a.matrix);if(a.channels&&a.channels.length){var f=a.channels[0].sampler.output[b];
-f instanceof THREE.Matrix4&&a.world.copy(f)}g&&a.world.multiply(g,a.world);c.push(a);for(g=0;g<a.nodes.length;g++)e(a.nodes[g],c,b,a.world)}function f(a,b,g){var f=aa[b.url];if(!f||!f.skin)console.log("ColladaLoader: Could not find skin controller.");else if(!b.skeleton||!b.skeleton.length)console.log("ColladaLoader: Could not find the skeleton for the skin. ");else{var h=c(),b=Y.getChildById(b.skeleton[0],!0)||Y.getChildBySid(b.skeleton[0],!0),k,l,m,o,n=new THREE.Vector3,p;for(k=0;k<a.vertices.length;k++)f.skin.bindShapeMatrix.multiplyVector3(a.vertices[k].position);
-for(g=0;g<h.frames;g++){var t=[],u=[];for(k=0;k<a.vertices.length;k++)u.push(new THREE.Vertex(new THREE.Vector3));e(b,t,g);k=t;l=f.skin;for(o=0;o<k.length;o++)if(m=k[o],p=-1,m.type=="JOINT"){for(var v=0;v<l.joints.length;v++)if(m.sid==l.joints[v]){p=v;break}if(p>=0){v=l.invBindMatrices[p];m.invBindMatrix=v;m.skinningMatrix=new THREE.Matrix4;m.skinningMatrix.multiply(m.world,v);m.weights=[];for(v=0;v<l.weights.length;v++)for(var y=0;y<l.weights[v].length;y++){var w=l.weights[v][y];w.joint==p&&m.weights.push(w)}}else throw"ColladaLoader: Could not find joint '"+
-m.sid+"'.";}for(k=0;k<t.length;k++)if(t[k].type=="JOINT")for(l=0;l<t[k].weights.length;l++)m=t[k].weights[l],o=m.index,m=m.weight,p=a.vertices[o],o=u[o],n.x=p.position.x,n.y=p.position.y,n.z=p.position.z,t[k].skinningMatrix.multiplyVector3(n),o.position.x+=n.x*m,o.position.y+=n.y*m,o.position.z+=n.z*m;a.morphTargets.push({name:"target_"+g,vertices:u})}}}function h(a){var c=new THREE.Object3D,b,e,g;c.name=a.id||"";c.matrixAutoUpdate=!1;c.matrix=a.matrix;for(g=0;g<a.controllers.length;g++){var k=aa[a.controllers[g].url];
-switch(k.type){case "skin":if(ba[k.skin.source]){var l=new y;l.url=k.skin.source;l.instance_material=a.controllers[g].instance_material;a.geometries.push(l);b=a.controllers[g]}else if(aa[k.skin.source]&&(e=k=aa[k.skin.source],k.morph&&ba[k.morph.source]))l=new y,l.url=k.morph.source,l.instance_material=a.controllers[g].instance_material,a.geometries.push(l);break;case "morph":if(ba[k.morph.source])l=new y,l.url=k.morph.source,l.instance_material=a.controllers[g].instance_material,a.geometries.push(l),
-e=a.controllers[g];console.log("ColladaLoader: Morph-controller partially supported.")}}for(g=0;g<a.geometries.length;g++){var k=a.geometries[g],l=k.instance_material,k=ba[k.url],m={},o=0,n;if(k&&k.mesh&&k.mesh.primitives){if(c.name.length==0)c.name=k.id;if(l)for(j=0;j<l.length;j++){n=l[j];var p=ha[ga[n.target].instance_effect.url].shader;p.material.opacity=!p.material.opacity?1:p.material.opacity;n=m[n.symbol]=p.material;o++}l=n||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});
-k=k.mesh.geometry3js;if(o>1){l=new THREE.MeshFaceMaterial;for(j=0;j<k.faces.length;j++)o=k.faces[j],o.materials=[m[o.daeMaterial]]}if(b!==void 0)f(k,b),l.morphTargets=!0,l=new THREE.SkinnedMesh(k,l),l.skeleton=b.skeleton,l.skinController=aa[b.url],l.skinInstanceController=b,l.name="skin_"+ea.length,ea.push(l);else if(e!==void 0){m=k;o=e instanceof u?aa[e.url]:e;if(!o||!o.morph)console.log("could not find morph controller!");else{o=o.morph;for(p=0;p<o.targets.length;p++){var t=ba[o.targets[p]];if(t.mesh&&
-t.mesh.primitives&&t.mesh.primitives.length)t=t.mesh.primitives[0].geometry,t.vertices.length===m.vertices.length&&m.morphTargets.push({name:"target_1",vertices:t.vertices})}m.morphTargets.push({name:"target_Z",vertices:m.vertices})}l.morphTargets=!0;l=new THREE.Mesh(k,l);l.name="morph_"+da.length;da.push(l)}else l=new THREE.Mesh(k,l);c.add(l)}}for(g=0;g<a.nodes.length;g++)c.add(h(a.nodes[g],a));return c}function g(){this.init_from=this.id=""}function k(){this.type=this.name=this.id="";this.morph=
-this.skin=null}function l(){this.weights=this.targets=this.source=this.method=null}function m(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function n(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function o(){this.sid=this.name=this.id="";this.nodes=[];this.controllers=[];this.transforms=[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function t(){this.type=this.sid="";this.data=[];this.matrix=new THREE.Matrix4}
-function u(){this.url="";this.skeleton=[];this.instance_material=[]}function v(){this.target=this.symbol=""}function y(){this.url="";this.instance_material=[]}function p(){this.id="";this.mesh=null}function z(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function x(){}function w(){this.material="";this.count=0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function A(){this.source="";this.stride=this.count=0;this.params=[]}function D(){this.input=
-{}}function B(){this.semantic="";this.offset=0;this.source="";this.set=0}function E(a){this.id=a;this.type=null}function I(){this.name=this.id="";this.instance_effect=null}function G(){this.color=new THREE.Color(0);this.color.setRGB(Math.random(),Math.random(),Math.random());this.color.a=1;this.texcoord=this.texture=null}function K(a,c){this.type=a;this.effect=c;this.material=null}function C(a){this.effect=a;this.format=this.init_from=null}function F(a){this.effect=a;this.mipfilter=this.magfilter=
-this.minfilter=this.wrap_t=this.wrap_s=this.source=null}function J(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function M(){this.url=""}function N(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function L(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=this.dotSyntax=this.sid=null}function O(a){this.id="";this.animation=a;this.inputs=[];this.endTime=this.startTime=this.interpolation=this.output=this.input=null;
-this.duration=0}function H(a){var c=a.getAttribute("id");if(V[c]!=void 0)return V[c];V[c]=(new E(c)).parse(a);return V[c]}function Q(a){if(a=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function P(a){for(var a=X(a).split(/\s+/),c=[],b=0;b<a.length;b++)c.push(parseFloat(a[b]));return c}function T(a){for(var a=X(a).split(/\s+/),c=[],b=0;b<a.length;b++)c.push(parseInt(a[b],10));return c}function X(a){return a.replace(/^\s+/,"").replace(/\s+$/,"")}function R(a,c,b){return a.hasAttribute(c)?
-parseInt(a.getAttribute(c),10):b}function S(a,c){if(a===void 0){for(var b="0.";b.length<c+2;)b+="0";return b}c=c||2;b=a.toString().split(".");for(b[1]=b.length>1?b[1].substr(0,c):"0";b[1].length<c;)b[1]+="0";return b.join(".")}function W(a,c){var b="";b+=S(a.x,c)+",";b+=S(a.y,c)+",";b+=S(a.z,c);return b}var U=null,Z=null,Y,$=null,V={},fa={},ca={},aa={},ba={},ga={},ha={},ia,ja,da,ea,ka=THREE.SmoothShading;g.prototype.parse=function(a){this.id=a.getAttribute("id");for(var c=0;c<a.childNodes.length;c++){var b=
-a.childNodes[c];if(b.nodeName=="init_from")this.init_from=b.textContent}return this};k.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.type="none";for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];switch(b.nodeName){case "skin":this.skin=(new m).parse(b);this.type=b.nodeName;break;case "morph":this.morph=(new l).parse(b),this.type=b.nodeName}}return this};l.prototype.parse=function(a){var c={},b=[],e;this.method=a.getAttribute("method");this.source=
-a.getAttribute("source").replace(/^#/,"");for(e=0;e<a.childNodes.length;e++){var g=a.childNodes[e];if(g.nodeType==1)switch(g.nodeName){case "source":g=(new E).parse(g);c[g.id]=g;break;case "targets":b=this.parseInputs(g);break;default:console.log(g.nodeName)}}for(e=0;e<b.length;e++)switch(a=b[e],g=c[a.source],a.semantic){case "MORPH_TARGET":this.targets=g.read();break;case "MORPH_WEIGHT":this.weights=g.read()}return this};l.prototype.parseInputs=function(a){for(var c=[],b=0;b<a.childNodes.length;b++){var e=
-a.childNodes[b];if(e.nodeType==1)switch(e.nodeName){case "input":c.push((new B).parse(e))}}return c};m.prototype.parse=function(a){var c={},b,e;this.source=a.getAttribute("source").replace(/^#/,"");this.invBindMatrices=[];this.joints=[];this.weights=[];for(var g=0;g<a.childNodes.length;g++){var f=a.childNodes[g];if(f.nodeType==1)switch(f.nodeName){case "bind_shape_matrix":f=P(f.textContent);this.bindShapeMatrix=new THREE.Matrix4;this.bindShapeMatrix.set(f[0],f[1],f[2],f[3],f[4],f[5],f[6],f[7],f[8],
-f[9],f[10],f[11],f[12],f[13],f[14],f[15]);break;case "source":f=(new E).parse(f);c[f.id]=f;break;case "joints":b=f;break;case "vertex_weights":e=f;break;default:console.log(f.nodeName)}}this.parseJoints(b,c);this.parseWeights(e,c);return this};m.prototype.parseJoints=function(a,c){for(var b=0;b<a.childNodes.length;b++){var e=a.childNodes[b];if(e.nodeType==1)switch(e.nodeName){case "input":var e=(new B).parse(e),g=c[e.source];if(e.semantic=="JOINT")this.joints=g.read();else if(e.semantic=="INV_BIND_MATRIX")this.invBindMatrices=
-g.read()}}};m.prototype.parseWeights=function(a,c){for(var b,e,g=[],f=0;f<a.childNodes.length;f++){var h=a.childNodes[f];if(h.nodeType==1)switch(h.nodeName){case "input":g.push((new B).parse(h));break;case "v":b=T(h.textContent);break;case "vcount":e=T(h.textContent)}}for(f=h=0;f<e.length;f++){for(var k=e[f],l=[],m=0;m<k;m++){for(var o={},n=0;n<g.length;n++){var p=g[n],t=b[h+p.offset];switch(p.semantic){case "JOINT":o.joint=t;break;case "WEIGHT":o.weight=c[p.source].data[t]}}l.push(o);h+=g.length}for(m=
-0;m<l.length;m++)l[m].index=f;this.weights.push(l)}};n.prototype.getChildById=function(a,c){for(var b=0;b<this.nodes.length;b++){var e=this.nodes[b].getChildById(a,c);if(e)return e}return null};n.prototype.getChildBySid=function(a,c){for(var b=0;b<this.nodes.length;b++){var e=this.nodes[b].getChildBySid(a,c);if(e)return e}return null};n.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.nodes=[];for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];
-if(b.nodeType==1)switch(b.nodeName){case "node":this.nodes.push((new o).parse(b))}}return this};o.prototype.getChannelForTransform=function(a){for(var c=0;c<this.channels.length;c++){var b=this.channels[c],e=b.target.split("/");e.shift();var g=e.shift(),f=g.indexOf(".")>=0,h=g.indexOf("(")>=0,k;if(f)e=g.split("."),g=e.shift(),e.shift();else if(h){k=g.split("(");g=k.shift();for(e=0;e<k.length;e++)k[e]=parseInt(k[e].replace(/\)/,""))}if(g==a)return b.info={sid:g,dotSyntax:f,arrSyntax:h,arrIndices:k},
-b}return null};o.prototype.getChildById=function(a,c){if(this.id==a)return this;if(c)for(var b=0;b<this.nodes.length;b++){var e=this.nodes[b].getChildById(a,c);if(e)return e}return null};o.prototype.getChildBySid=function(a,c){if(this.sid==a)return this;if(c)for(var b=0;b<this.nodes.length;b++){var e=this.nodes[b].getChildBySid(a,c);if(e)return e}return null};o.prototype.getTransformBySid=function(a){for(var c=0;c<this.transforms.length;c++)if(this.transforms[c].sid==a)return this.transforms[c];return null};
-o.prototype.parse=function(a){var c;this.id=a.getAttribute("id");this.sid=a.getAttribute("sid");this.name=a.getAttribute("name");this.type=a.getAttribute("type");this.type=this.type=="JOINT"?this.type:"NODE";this.nodes=[];this.transforms=[];this.geometries=[];this.controllers=[];this.matrix=new THREE.Matrix4;for(var b=0;b<a.childNodes.length;b++)if(c=a.childNodes[b],c.nodeType==1)switch(c.nodeName){case "node":this.nodes.push((new o).parse(c));break;case "instance_camera":break;case "instance_controller":this.controllers.push((new u).parse(c));
-break;case "instance_geometry":this.geometries.push((new y).parse(c));break;case "instance_light":break;case "instance_node":c=c.getAttribute("url").replace(/^#/,"");(c=U.evaluate(".//dae:library_nodes//dae:node[@id='"+c+"']",U,Q,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new o).parse(c));break;case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new t).parse(c));break;case "extra":break;default:console.log(c.nodeName)}a=
-[];b=1E6;c=-1E6;for(var e in ca)for(var g=ca[e],f=0;f<g.channel.length;f++){var h=g.channel[f],k=g.sampler[f];e=h.target.split("/")[0];if(e==this.id)k.create(),h.sampler=k,b=Math.min(b,k.startTime),c=Math.max(c,k.endTime),a.push(h)}if(a.length)this.startTime=b,this.endTime=c;if((this.channels=a)&&this.channels.length){e=1E7;for(i=0;i<this.channels.length;i++){a=this.channels[i].sampler;for(b=0;b<a.input.length-1;b++)e=Math.min(e,a.input[b+1]-a.input[b])}b=[];for(a=this.startTime;a<this.endTime;a+=
-e){c=a;for(var g={},l=f=void 0,f=0;f<this.channels.length;f++)l=this.channels[f],g[l.sid]=l;h=new THREE.Matrix4;for(f=0;f<this.transforms.length;f++)if(k=this.transforms[f],l=g[k.sid],l!==void 0){for(var m=l.sampler,n,l=0;l<m.input.length-1;l++)if(m.input[l+1]>c){n=m.output[l];break}h=n!==void 0?n instanceof THREE.Matrix4?h.multiply(h,n):h.multiply(h,k.matrix):h.multiply(h,k.matrix)}else h=h.multiply(h,k.matrix);c=h;b.push({time:a,pos:[c.n14,c.n24,c.n34],rotq:[0,0,0,1],scl:[1,1,1]})}this.keys=b}this.updateMatrix();
-return this};o.prototype.updateMatrix=function(){this.matrix.identity();for(var a=0;a<this.transforms.length;a++)this.matrix.multiply(this.matrix,this.transforms[a].matrix)};t.prototype.parse=function(a){this.sid=a.getAttribute("sid");this.type=a.nodeName;this.data=P(a.textContent);this.updateMatrix();return this};t.prototype.updateMatrix=function(){var a=0;this.matrix.identity();switch(this.type){case "matrix":this.matrix.set(this.data[0],this.data[1],this.data[2],this.data[3],this.data[4],this.data[5],
-this.data[6],this.data[7],this.data[8],this.data[9],this.data[10],this.data[11],this.data[12],this.data[13],this.data[14],this.data[15]);break;case "translate":this.matrix.setTranslation(this.data[0],this.data[1],this.data[2]);break;case "rotate":a=this.data[3]*(Math.PI/180);this.matrix.setRotationAxis(new THREE.Vector3(this.data[0],this.data[1],this.data[2]),a);break;case "scale":this.matrix.setScale(this.data[0],this.data[1],this.data[2])}return this.matrix};u.prototype.parse=function(a){this.url=
-a.getAttribute("url").replace(/^#/,"");this.skeleton=[];this.instance_material=[];for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeType==1)switch(b.nodeName){case "skeleton":this.skeleton.push(b.textContent.replace(/^#/,""));break;case "bind_material":if(b=U.evaluate(".//dae:instance_material",b,Q,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(var e=b.iterateNext();e;)this.instance_material.push((new v).parse(e)),e=b.iterateNext()}}return this};v.prototype.parse=function(a){this.symbol=
-a.getAttribute("symbol");this.target=a.getAttribute("target").replace(/^#/,"");return this};y.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.instance_material=[];for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeType==1&&b.nodeName=="bind_material"){if(a=U.evaluate(".//dae:instance_material",b,Q,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(c=a.iterateNext();c;)this.instance_material.push((new v).parse(c)),c=a.iterateNext();break}}return this};
-p.prototype.parse=function(a){this.id=a.getAttribute("id");for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];switch(b.nodeName){case "mesh":this.mesh=(new z(this)).parse(b)}}return this};z.prototype.parse=function(a){function c(a,b){var e=W(a.position);g[e]===void 0&&(g[e]={v:a,index:b});return g[e]}this.primitives=[];var b;for(b=0;b<a.childNodes.length;b++){var e=a.childNodes[b];switch(e.nodeName){case "source":H(e);break;case "vertices":this.vertices=(new D).parse(e);break;case "triangles":this.primitives.push((new w).parse(e));
-break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new x).parse(e))}}var g={};this.geometry3js=new THREE.Geometry;e=V[this.vertices.input.POSITION.source].data;for(a=b=0;b<e.length;b+=3,a++){var f=new THREE.Vertex(new THREE.Vector3(e[b],e[b+1],e[b+2]));c(f,a);this.geometry3js.vertices.push(f)}for(b=0;b<this.primitives.length;b++)primitive=this.primitives[b],primitive.setVertices(this.vertices),this.handlePrimitive(primitive,this.geometry3js,
-g);this.geometry3js.computeCentroids();this.geometry3js.computeFaceNormals();this.geometry3js.computeVertexNormals();this.geometry3js.computeBoundingBox();return this};z.prototype.handlePrimitive=function(a,c,b){var e=0,g,f,h=a.p,k=a.inputs,l,m,o,n=0,p=3,t=[];for(g=0;g<k.length;g++)switch(l=k[g],l.semantic){case "TEXCOORD":t.push(l.set)}for(;e<h.length;){var u=[],v=[],y={},w=[];a.vcount&&(p=a.vcount[n++]);for(g=0;g<p;g++)for(f=0;f<k.length;f++)switch(l=k[f],source=V[l.source],m=h[e+g*k.length+l.offset],
-numParams=source.accessor.params.length,o=m*numParams,l.semantic){case "VERTEX":l=W(c.vertices[m].position);u.push(b[l].index);break;case "NORMAL":v.push(new THREE.Vector3(source.data[o],source.data[o+1],source.data[o+2]));break;case "TEXCOORD":y[l.set]===void 0&&(y[l.set]=[]);y[l.set].push(new THREE.UV(source.data[o],source.data[o+1]));break;case "COLOR":w.push((new THREE.Color).setRGB(source.data[o],source.data[o+1],source.data[o+2]))}var x;p==3?x=new THREE.Face3(u[0],u[1],u[2],[v[0],v[1],v[2]],
-w.length?w:new THREE.Color):p==4&&(x=new THREE.Face4(u[0],u[1],u[2],u[3],[v[0],v[1],v[2],v[3]],w.length?w:new THREE.Color));x.daeMaterial=a.material;c.faces.push(x);for(f=0;f<t.length;f++)g=y[t[f]],c.faceVertexUvs[f].push([g[0],g[1],g[2]]);e+=k.length*p}};x.prototype=new w;x.prototype.constructor=x;w.prototype.setVertices=function(a){for(var c=0;c<this.inputs.length;c++)if(this.inputs[c].source==a.id)this.inputs[c].source=a.input.POSITION.source};w.prototype.parse=function(a){this.inputs=[];this.material=
-a.getAttribute("material");this.count=R(a,"count",0);for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];switch(b.nodeName){case "input":this.inputs.push((new B).parse(a.childNodes[c]));break;case "vcount":this.vcount=T(b.textContent);break;case "p":this.p=T(b.textContent)}}return this};A.prototype.parse=function(a){this.params=[];this.source=a.getAttribute("source");this.count=R(a,"count",0);this.stride=R(a,"stride",0);for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeName==
-"param"){var e={};e.name=b.getAttribute("name");e.type=b.getAttribute("type");this.params.push(e)}}return this};D.prototype.parse=function(a){this.id=a.getAttribute("id");for(var c=0;c<a.childNodes.length;c++)a.childNodes[c].nodeName=="input"&&(input=(new B).parse(a.childNodes[c]),this.input[input.semantic]=input);return this};B.prototype.parse=function(a){this.semantic=a.getAttribute("semantic");this.source=a.getAttribute("source").replace(/^#/,"");this.set=R(a,"set",-1);this.offset=R(a,"offset",
-0);if(this.semantic=="TEXCOORD"&&this.set<0)this.set=0;return this};E.prototype.parse=function(a){this.id=a.getAttribute("id");for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];switch(b.nodeName){case "bool_array":for(var e=X(b.textContent).split(/\s+/),g=[],f=0;f<e.length;f++)g.push(e[f]=="true"||e[f]=="1"?!0:!1);this.data=g;this.type=b.nodeName;break;case "float_array":this.data=P(b.textContent);this.type=b.nodeName;break;case "int_array":this.data=T(b.textContent);this.type=b.nodeName;
-break;case "IDREF_array":case "Name_array":this.data=X(b.textContent).split(/\s+/);this.type=b.nodeName;break;case "technique_common":for(e=0;e<b.childNodes.length;e++)if(b.childNodes[e].nodeName=="accessor"){this.accessor=(new A).parse(b.childNodes[e]);break}}}return this};E.prototype.read=function(){var a=[],c=this.accessor.params[0];switch(c.type){case "IDREF":case "Name":case "name":case "float":return this.data;case "float4x4":for(c=0;c<this.data.length;c+=16){var b=this.data.slice(c,c+16),e=
-new THREE.Matrix4;e.set(b[0],b[1],b[2],b[3],b[4],b[5],b[6],b[7],b[8],b[9],b[10],b[11],b[12],b[13],b[14],b[15]);a.push(e)}break;default:console.log("ColladaLoader: Source: Read dont know how to read "+c.type+".")}return a};I.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");for(var c=0;c<a.childNodes.length;c++)if(a.childNodes[c].nodeName=="instance_effect"){this.instance_effect=(new M).parse(a.childNodes[c]);break}return this};G.prototype.isColor=function(){return this.texture==
-null};G.prototype.isTexture=function(){return this.texture!=null};G.prototype.parse=function(a){for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeType==1)switch(b.nodeName){case "color":b=P(b.textContent);this.color=new THREE.Color(0);this.color.setRGB(b[0],b[1],b[2]);this.color.a=b[3];break;case "texture":this.texture=b.getAttribute("texture"),this.texcoord=b.getAttribute("texcoord")}}return this};K.prototype.parse=function(a){for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];
-if(b.nodeType==1)switch(b.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[b.nodeName]=(new G).parse(b);break;case "shininess":case "reflectivity":case "transparency":var e;e=U.evaluate(".//dae:float",b,Q,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);for(var g=e.iterateNext(),f=[];g;)f.push(g),g=e.iterateNext();e=f;e.length>0&&(this[b.nodeName]=parseFloat(e[0].textContent))}}this.create();return this};K.prototype.create=function(){var a={},c=this.transparency!==
-void 0&&this.transparency<1,b;for(b in this)switch(b){case "ambient":case "emission":case "diffuse":case "specular":var e=this[b];if(e instanceof G)if(e.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid&&(e=fa[this.effect.surface.init_from]))a.map=THREE.ImageUtils.loadTexture(ja+e.init_from),a.map.wrapS=THREE.RepeatWrapping,a.map.wrapT=THREE.RepeatWrapping,a.map.repeat.x=1,a.map.repeat.y=-1}else b=="diffuse"?a.color=e.color.getHex():c||(a[b]=
-e.color.getHex());break;case "shininess":case "reflectivity":a[b]=this[b];break;case "transparency":if(c)a.transparent=!0,a.opacity=this[b],c=!0}a.shading=ka;return this.material=new THREE.MeshLambertMaterial(a)};C.prototype.parse=function(a){for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeType==1)switch(b.nodeName){case "init_from":this.init_from=b.textContent;break;case "format":this.format=b.textContent;break;default:console.log("unhandled Surface prop: "+b.nodeName)}}return this};
-F.prototype.parse=function(a){for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeType==1)switch(b.nodeName){case "source":this.source=b.textContent;break;case "minfilter":this.minfilter=b.textContent;break;case "magfilter":this.magfilter=b.textContent;break;case "mipfilter":this.mipfilter=b.textContent;break;case "wrap_s":this.wrap_s=b.textContent;break;case "wrap_t":this.wrap_t=b.textContent;break;default:console.log("unhandled Sampler2D prop: "+b.nodeName)}}return this};J.prototype.create=
-function(){if(this.shader==null)return null};J.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.shader=null;for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeType==1)switch(b.nodeName){case "profile_COMMON":this.parseTechnique(this.parseProfileCOMMON(b))}}return this};J.prototype.parseNewparam=function(a){for(var c=a.getAttribute("sid"),b=0;b<a.childNodes.length;b++){var e=a.childNodes[b];if(e.nodeType==1)switch(e.nodeName){case "surface":this.surface=
-(new C(this)).parse(e);this.surface.sid=c;break;case "sampler2D":this.sampler=(new F(this)).parse(e);this.sampler.sid=c;break;case "extra":break;default:console.log(e.nodeName)}}};J.prototype.parseProfileCOMMON=function(a){for(var c,b=0;b<a.childNodes.length;b++){var e=a.childNodes[b];if(e.nodeType==1)switch(e.nodeName){case "profile_COMMON":this.parseProfileCOMMON(e);break;case "technique":c=e;break;case "newparam":this.parseNewparam(e);break;case "extra":break;default:console.log(e.nodeName)}}return c};
-J.prototype.parseTechnique=function(a){for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeType==1)switch(b.nodeName){case "lambert":case "blinn":case "phong":this.shader=(new K(b.nodeName,this)).parse(b)}}};M.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");return this};N.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.source={};for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeType==1)switch(b.nodeName){case "source":b=
-(new E).parse(b);this.source[b.id]=b;break;case "sampler":this.sampler.push((new O(this)).parse(b));break;case "channel":this.channel.push((new L(this)).parse(b))}}return this};L.prototype.parse=function(a){this.source=a.getAttribute("source").replace(/^#/,"");this.target=a.getAttribute("target");var c=this.target.split("/");c.shift();var a=c.shift(),b=a.indexOf(".")>=0,e=a.indexOf("(")>=0,g,f;if(b)c=a.split("."),a=c.shift(),f=c.shift();else if(e){g=a.split("(");a=g.shift();for(c=0;c<g.length;c++)g[c]=
-parseInt(g[c].replace(/\)/,""))}this.sid=a;this.dotSyntax=b;this.arrSyntax=e;this.arrIndices=g;this.member=f;return this};O.prototype.parse=function(a){this.id=a.getAttribute("id");this.inputs=[];for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeType==1)switch(b.nodeName){case "input":this.inputs.push((new B).parse(b))}}return this};O.prototype.create=function(){for(var a=0;a<this.inputs.length;a++){var c=this.inputs[a],b=this.animation.source[c.source];switch(c.semantic){case "INPUT":this.input=
-b.read();break;case "OUTPUT":this.output=b.read();break;case "INTERPOLATION":this.interpolation=b.read();break;case "IN_TANGENT":break;case "OUT_TANGENT":break;default:console.log(c.semantic)}}this.duration=this.endTime=this.startTime=0;if(this.input.length){this.startTime=1E8;this.endTime=-1E8;for(a=0;a<this.input.length;a++)this.startTime=Math.min(this.startTime,this.input[a]),this.endTime=Math.max(this.endTime,this.input[a]);this.duration=this.endTime-this.startTime}};return{load:function(c,b){if(document.implementation&&
-document.implementation.createDocument){document.implementation.createDocument("http://www.collada.org/2005/11/COLLADASchema","COLLADA",null);c+="?rnd="+Math.random();var e=new XMLHttpRequest;e.overrideMimeType&&e.overrideMimeType("text/xml");e.onreadystatechange=function(){if(e.readyState==4&&(e.status==0||e.status==200))$=b,a(e.responseXML,void 0,c)};e.open("GET",c,!0);e.send(null)}else alert("Don't know how to parse XML!")},parse:a,setPreferredShading:function(a){ka=a},applySkin:f,geometries:ba}};
-THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;
-THREE.JSONLoader.prototype.load=function(a,b,c){var e=this,f;if(a instanceof Object)console.warn("DEPRECATED: JSONLoader( parameters ) is now JSONLoader( url, callback, texturePath )."),f=a,a=f.model,b=f.callback,c=f.texture_path;f=new Worker(a);c=c?c:this.extractUrlbase(a);f.onmessage=function(a){e.createModel(a.data,b,c);e.onLoadComplete()};this.onLoadStart();f.postMessage((new Date).getTime())};
-THREE.JSONLoader.prototype.createModel=function(a,b,c){var e=new THREE.Geometry,f=a.scale!==void 0?1/a.scale:1;this.init_materials(e,a.materials,c);(function(c){if(a.version===void 0||a.version!=2)console.error("Deprecated file format.");else{var b,f,l,m,n,o,t,u,v,y,p,z,x,w,A=a.faces;o=a.vertices;var D=a.normals,B=a.colors,E=0;for(b=0;b<a.uvs.length;b++)a.uvs[b].length&&E++;for(b=0;b<E;b++)e.faceUvs[b]=[],e.faceVertexUvs[b]=[];m=0;for(n=o.length;m<n;)t=new THREE.Vertex,t.position.x=o[m++]*c,t.position.y=
-o[m++]*c,t.position.z=o[m++]*c,e.vertices.push(t);m=0;for(n=A.length;m<n;){c=A[m++];o=c&1;l=c&2;b=c&4;f=c&8;u=c&16;t=c&32;y=c&64;c&=128;o?(p=new THREE.Face4,p.a=A[m++],p.b=A[m++],p.c=A[m++],p.d=A[m++],o=4):(p=new THREE.Face3,p.a=A[m++],p.b=A[m++],p.c=A[m++],o=3);if(l)l=A[m++],p.materials=e.materials[l];l=e.faces.length;if(b)for(b=0;b<E;b++)z=a.uvs[b],v=A[m++],w=z[v*2],v=z[v*2+1],e.faceUvs[b][l]=new THREE.UV(w,v);if(f)for(b=0;b<E;b++){z=a.uvs[b];x=[];for(f=0;f<o;f++)v=A[m++],w=z[v*2],v=z[v*2+1],x[f]=
-new THREE.UV(w,v);e.faceVertexUvs[b][l]=x}if(u)u=A[m++]*3,f=new THREE.Vector3,f.x=D[u++],f.y=D[u++],f.z=D[u],p.normal=f;if(t)for(b=0;b<o;b++)u=A[m++]*3,f=new THREE.Vector3,f.x=D[u++],f.y=D[u++],f.z=D[u],p.vertexNormals.push(f);if(y)t=A[m++],t=new THREE.Color(B[t]),p.color=t;if(c)for(b=0;b<o;b++)t=A[m++],t=new THREE.Color(B[t]),p.vertexColors.push(t);e.faces.push(p)}}})(f);(function(){var c,b,f,l;if(a.skinWeights){c=0;for(b=a.skinWeights.length;c<b;c+=2)f=a.skinWeights[c],l=a.skinWeights[c+1],e.skinWeights.push(new THREE.Vector4(f,
-l,0,0))}if(a.skinIndices){c=0;for(b=a.skinIndices.length;c<b;c+=2)f=a.skinIndices[c],l=a.skinIndices[c+1],e.skinIndices.push(new THREE.Vector4(f,l,0,0))}e.bones=a.bones;e.animation=a.animation})();(function(c){if(a.morphTargets!==void 0){var b,f,l,m,n,o,t,u,v;b=0;for(f=a.morphTargets.length;b<f;b++){e.morphTargets[b]={};e.morphTargets[b].name=a.morphTargets[b].name;e.morphTargets[b].vertices=[];u=e.morphTargets[b].vertices;v=a.morphTargets[b].vertices;l=0;for(m=v.length;l<m;l+=3)n=v[l]*c,o=v[l+1]*
-c,t=v[l+2]*c,u.push(new THREE.Vertex(new THREE.Vector3(n,o,t)))}}if(a.morphColors!==void 0){b=0;for(f=a.morphColors.length;b<f;b++){e.morphColors[b]={};e.morphColors[b].name=a.morphColors[b].name;e.morphColors[b].colors=[];m=e.morphColors[b].colors;n=a.morphColors[b].colors;c=0;for(l=n.length;c<l;c+=3)o=new THREE.Color(16755200),o.setRGB(n[c],n[c+1],n[c+2]),m.push(o)}}})(f);e.computeCentroids();e.computeFaceNormals();this.hasNormals(e)&&e.computeTangents();b(e)};
+THREE.BinaryLoader.prototype.load=function(a){var c=a.model,b=a.callback,e=a.texture_path?a.texture_path:THREE.Loader.prototype.extractUrlbase(c),g=a.bin_path?a.bin_path:THREE.Loader.prototype.extractUrlbase(c),a=(new Date).getTime(),c=new Worker(c),h=this.showProgress?THREE.Loader.prototype.updateProgress:null;c.onmessage=function(a){THREE.BinaryLoader.prototype.loadAjaxBuffers(a.data.buffers,a.data.materials,b,g,e,h)};c.onerror=function(a){alert("worker.onerror: "+a.message+"\n"+a.data);a.preventDefault()};
+c.postMessage(a)};
+THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,c,b,e,g,h){var f=new XMLHttpRequest,k=e+"/"+a,l=0;f.onreadystatechange=function(){f.readyState==4?f.status==200||f.status==0?THREE.BinaryLoader.prototype.createBinModel(f.responseText,b,g,c):alert("Couldn't load ["+k+"] ["+f.status+"]"):f.readyState==3?h&&(l==0&&(l=f.getResponseHeader("Content-Length")),h({total:l,loaded:f.responseText.length})):f.readyState==2&&(l=f.getResponseHeader("Content-Length"))};f.open("GET",k,!0);f.overrideMimeType("text/plain; charset=x-user-defined");
+f.setRequestHeader("Content-Type","text/plain");f.send(null)};
+THREE.BinaryLoader.prototype.createBinModel=function(a,c,b,e){var g=function(b){function c(a,b){var e=n(a,b),f=n(a,b+1),h=n(a,b+2),g=n(a,b+3),k=(g<<1&255|h>>7)-127;e|=(h&127)<<16|f<<8;if(e==0&&k==-127)return 0;return(1-2*(g>>7))*(1+e*Math.pow(2,-23))*Math.pow(2,k)}function g(a,b){var c=n(a,b),e=n(a,b+1),f=n(a,b+2);return(n(a,b+3)<<24)+(f<<16)+(e<<8)+c}function l(a,b){var c=n(a,b);return(n(a,b+1)<<8)+c}function m(a,b){var c=n(a,b);return c>127?c-256:c}function n(a,b){return a.charCodeAt(b)&255}function o(b){var c,
+e,f;c=g(a,b);e=g(a,b+B);f=g(a,b+E);b=l(a,b+I);z.faces.push(new THREE.Face3(c,e,f,null,null,z.materials[b]))}function p(b){var c,e,f,h,m,o;c=g(a,b);e=g(a,b+B);f=g(a,b+E);h=l(a,b+I);m=g(a,b+G);o=g(a,b+K);b=g(a,b+C);h=z.materials[h];var n=A[o*3],p=A[o*3+1];o=A[o*3+2];var t=A[b*3],u=A[b*3+1],b=A[b*3+2];z.faces.push(new THREE.Face3(c,e,f,[new THREE.Vector3(A[m*3],A[m*3+1],A[m*3+2]),new THREE.Vector3(n,p,o),new THREE.Vector3(t,u,b)],null,h))}function u(b){var c,e,f,h;c=g(a,b);e=g(a,b+F);f=g(a,b+J);h=g(a,
+b+M);b=l(a,b+N);z.faces.push(new THREE.Face4(c,e,f,h,null,null,z.materials[b]))}function v(b){var c,e,f,h,m,o,n,p;c=g(a,b);e=g(a,b+F);f=g(a,b+J);h=g(a,b+M);m=l(a,b+N);o=g(a,b+L);n=g(a,b+O);p=g(a,b+H);b=g(a,b+Q);m=z.materials[m];var t=A[n*3],u=A[n*3+1];n=A[n*3+2];var la=A[p*3],ma=A[p*3+1];p=A[p*3+2];var na=A[b*3],v=A[b*3+1],b=A[b*3+2];z.faces.push(new THREE.Face4(c,e,f,h,[new THREE.Vector3(A[o*3],A[o*3+1],A[o*3+2]),new THREE.Vector3(t,u,n),new THREE.Vector3(la,ma,p),new THREE.Vector3(na,v,b)],null,
+m))}function y(b){var c,e,f,h;c=g(a,b);e=g(a,b+P);f=g(a,b+T);b=D[c*2];h=D[c*2+1];c=D[e*2];var l=z.faceVertexUvs[0];e=D[e*2+1];var m=D[f*2];f=D[f*2+1];var o=[];o.push(new THREE.UV(b,h));o.push(new THREE.UV(c,e));o.push(new THREE.UV(m,f));l.push(o)}function t(b){var c,e,f,h,l,m;c=g(a,b);e=g(a,b+X);f=g(a,b+R);h=g(a,b+S);b=D[c*2];l=D[c*2+1];c=D[e*2];m=D[e*2+1];e=D[f*2];var o=z.faceVertexUvs[0];f=D[f*2+1];var n=D[h*2];h=D[h*2+1];var p=[];p.push(new THREE.UV(b,l));p.push(new THREE.UV(c,m));p.push(new THREE.UV(e,
+f));p.push(new THREE.UV(n,h));o.push(p)}var z=this,x=0,w,A=[],D=[],B,E,I,G,K,C,F,J,M,N,L,O,H,Q,P,T,X,R,S,W,U,Z,Y,$,V;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(z,e,b);w={signature:a.substr(x,8),header_bytes:n(a,x+8),vertex_coordinate_bytes:n(a,x+9),normal_coordinate_bytes:n(a,x+10),uv_coordinate_bytes:n(a,x+11),vertex_index_bytes:n(a,x+12),normal_index_bytes:n(a,x+13),uv_index_bytes:n(a,x+14),material_index_bytes:n(a,x+15),nvertices:g(a,x+16),nnormals:g(a,x+16+4),nuvs:g(a,x+16+
+8),ntri_flat:g(a,x+16+12),ntri_smooth:g(a,x+16+16),ntri_flat_uv:g(a,x+16+20),ntri_smooth_uv:g(a,x+16+24),nquad_flat:g(a,x+16+28),nquad_smooth:g(a,x+16+32),nquad_flat_uv:g(a,x+16+36),nquad_smooth_uv:g(a,x+16+40)};x+=w.header_bytes;B=w.vertex_index_bytes;E=w.vertex_index_bytes*2;I=w.vertex_index_bytes*3;G=w.vertex_index_bytes*3+w.material_index_bytes;K=w.vertex_index_bytes*3+w.material_index_bytes+w.normal_index_bytes;C=w.vertex_index_bytes*3+w.material_index_bytes+w.normal_index_bytes*2;F=w.vertex_index_bytes;
+J=w.vertex_index_bytes*2;M=w.vertex_index_bytes*3;N=w.vertex_index_bytes*4;L=w.vertex_index_bytes*4+w.material_index_bytes;O=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes;H=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes*2;Q=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes*3;P=w.uv_index_bytes;T=w.uv_index_bytes*2;X=w.uv_index_bytes;R=w.uv_index_bytes*2;S=w.uv_index_bytes*3;b=w.vertex_index_bytes*3+w.material_index_bytes;V=w.vertex_index_bytes*
+4+w.material_index_bytes;W=w.ntri_flat*b;U=w.ntri_smooth*(b+w.normal_index_bytes*3);Z=w.ntri_flat_uv*(b+w.uv_index_bytes*3);Y=w.ntri_smooth_uv*(b+w.normal_index_bytes*3+w.uv_index_bytes*3);$=w.nquad_flat*V;b=w.nquad_smooth*(V+w.normal_index_bytes*4);V=w.nquad_flat_uv*(V+w.uv_index_bytes*4);x+=function(b){for(var e,h,g,k=w.vertex_coordinate_bytes*3,l=b+w.nvertices*k;b<l;b+=k)e=c(a,b),h=c(a,b+w.vertex_coordinate_bytes),g=c(a,b+w.vertex_coordinate_bytes*2),z.vertices.push(new THREE.Vertex(new THREE.Vector3(e,
+h,g)));return w.nvertices*k}(x);x+=function(b){for(var c,e,f,h=w.normal_coordinate_bytes*3,g=b+w.nnormals*h;b<g;b+=h)c=m(a,b),e=m(a,b+w.normal_coordinate_bytes),f=m(a,b+w.normal_coordinate_bytes*2),A.push(c/127,e/127,f/127);return w.nnormals*h}(x);x+=function(b){for(var e,h,g=w.uv_coordinate_bytes*2,k=b+w.nuvs*g;b<k;b+=g)e=c(a,b),h=c(a,b+w.uv_coordinate_bytes),D.push(e,h);return w.nuvs*g}(x);W=x+W;U=W+U;Z=U+Z;Y=Z+Y;$=Y+$;b=$+b;V=b+V;(function(a){var b,c=w.vertex_index_bytes*3+w.material_index_bytes,
+e=c+w.uv_index_bytes*3,f=a+w.ntri_flat_uv*e;for(b=a;b<f;b+=e)o(b),y(b+c);return f-a})(U);(function(a){var b,c=w.vertex_index_bytes*3+w.material_index_bytes+w.normal_index_bytes*3,e=c+w.uv_index_bytes*3,f=a+w.ntri_smooth_uv*e;for(b=a;b<f;b+=e)p(b),y(b+c);return f-a})(Z);(function(a){var b,c=w.vertex_index_bytes*4+w.material_index_bytes,e=c+w.uv_index_bytes*4,f=a+w.nquad_flat_uv*e;for(b=a;b<f;b+=e)u(b),t(b+c);return f-a})(b);(function(a){var b,c=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes*
+4,e=c+w.uv_index_bytes*4,f=a+w.nquad_smooth_uv*e;for(b=a;b<f;b+=e)v(b),t(b+c);return f-a})(V);(function(a){var b,c=w.vertex_index_bytes*3+w.material_index_bytes,e=a+w.ntri_flat*c;for(b=a;b<e;b+=c)o(b);return e-a})(x);(function(a){var b,c=w.vertex_index_bytes*3+w.material_index_bytes+w.normal_index_bytes*3,e=a+w.ntri_smooth*c;for(b=a;b<e;b+=c)p(b);return e-a})(W);(function(a){var b,c=w.vertex_index_bytes*4+w.material_index_bytes,e=a+w.nquad_flat*c;for(b=a;b<e;b+=c)u(b);return e-a})(Y);(function(a){var b,
+c=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes*4,e=a+w.nquad_smooth*c;for(b=a;b<e;b+=c)v(b);return e-a})($);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};g.prototype=new THREE.Geometry;g.prototype.constructor=g;c(new g(b))};
+THREE.ColladaLoader=function(){function a(a,e,g){U=a;e=e||$;g!==void 0&&(a=g.split("/"),a.pop(),ja=a.length<1?"":a.join("/")+"/");fa=c("//dae:library_images/dae:image",f,"image");ga=c("//dae:library_materials/dae:material",I,"material");ha=c("//dae:library_effects/dae:effect",J,"effect");ba=c("//dae:library_geometries/dae:geometry",t,"geometry");aa=c("//dae:library_controllers/dae:controller",k,"controller");ca=c("//dae:library_animations/dae:animation",N,"animation");ia=c(".//dae:library_visual_scenes/dae:visual_scene",
+n,"visual_scene");da=[];ea=[];(a=U.evaluate(".//dae:scene/dae:instance_visual_scene",U,Q,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(a=a.getAttribute("url").replace(/^#/,""),Y=ia[a]):Y=null;Z=new THREE.Object3D;for(a=0;a<Y.nodes.length;a++)Z.add(h(Y.nodes[a]));b();for(var l in ca);l={scene:Z,morphs:da,skins:ea,dae:{images:fa,materials:ga,effects:ha,geometries:ba,controllers:aa,animations:ca,visualScenes:ia,scene:Y}};e&&e(l);return l}function c(a,b,c){for(var a=U.evaluate(a,U,Q,XPathResult.ORDERED_NODE_ITERATOR_TYPE,
+null),e={},f=a.iterateNext(),h=0;f;){f=(new b).parse(f);if(f.id.length==0)f.id=c+h++;e[f.id]=f;f=a.iterateNext()}return e}function b(){var a=1E6,b=-a,c=0,e;for(e in ca)for(var f=ca[e],h=0;h<f.sampler.length;h++){var g=f.sampler[h];g.create();a=Math.min(a,g.startTime);b=Math.max(b,g.endTime);c=Math.max(c,g.input.length)}return{start:a,end:b,frames:c}}function e(a,b,c,f){a.world=a.world||new THREE.Matrix4;a.world.copy(a.matrix);if(a.channels&&a.channels.length){var h=a.channels[0].sampler.output[c];
+h instanceof THREE.Matrix4&&a.world.copy(h)}f&&a.world.multiply(f,a.world);b.push(a);for(f=0;f<a.nodes.length;f++)e(a.nodes[f],b,c,a.world)}function g(a,c,f){var h=aa[c.url];if(!h||!h.skin)console.log("ColladaLoader: Could not find skin controller.");else if(!c.skeleton||!c.skeleton.length)console.log("ColladaLoader: Could not find the skeleton for the skin. ");else{var g=b(),c=Y.getChildById(c.skeleton[0],!0)||Y.getChildBySid(c.skeleton[0],!0),k,l,m,o,n=new THREE.Vector3,p;for(k=0;k<a.vertices.length;k++)h.skin.bindShapeMatrix.multiplyVector3(a.vertices[k].position);
+for(f=0;f<g.frames;f++){var t=[],u=[];for(k=0;k<a.vertices.length;k++)u.push(new THREE.Vertex(new THREE.Vector3));e(c,t,f);k=t;l=h.skin;for(o=0;o<k.length;o++)if(m=k[o],p=-1,m.type=="JOINT"){for(var v=0;v<l.joints.length;v++)if(m.sid==l.joints[v]){p=v;break}if(p>=0){v=l.invBindMatrices[p];m.invBindMatrix=v;m.skinningMatrix=new THREE.Matrix4;m.skinningMatrix.multiply(m.world,v);m.weights=[];for(v=0;v<l.weights.length;v++)for(var y=0;y<l.weights[v].length;y++){var w=l.weights[v][y];w.joint==p&&m.weights.push(w)}}else throw"ColladaLoader: Could not find joint '"+
+m.sid+"'.";}for(k=0;k<t.length;k++)if(t[k].type=="JOINT")for(l=0;l<t[k].weights.length;l++)m=t[k].weights[l],o=m.index,m=m.weight,p=a.vertices[o],o=u[o],n.x=p.position.x,n.y=p.position.y,n.z=p.position.z,t[k].skinningMatrix.multiplyVector3(n),o.position.x+=n.x*m,o.position.y+=n.y*m,o.position.z+=n.z*m;a.morphTargets.push({name:"target_"+f,vertices:u})}}}function h(a){var b=new THREE.Object3D,c,e,f;for(f=0;f<a.controllers.length;f++){var k=aa[a.controllers[f].url];switch(k.type){case "skin":if(ba[k.skin.source]){var l=
+new y;l.url=k.skin.source;l.instance_material=a.controllers[f].instance_material;a.geometries.push(l);c=a.controllers[f]}else if(aa[k.skin.source]&&(e=k=aa[k.skin.source],k.morph&&ba[k.morph.source]))l=new y,l.url=k.morph.source,l.instance_material=a.controllers[f].instance_material,a.geometries.push(l);break;case "morph":if(ba[k.morph.source])l=new y,l.url=k.morph.source,l.instance_material=a.controllers[f].instance_material,a.geometries.push(l),e=a.controllers[f];console.log("ColladaLoader: Morph-controller partially supported.")}}for(f=
+0;f<a.geometries.length;f++){var k=a.geometries[f],l=k.instance_material,k=ba[k.url],m={},o=0,n;if(k&&k.mesh&&k.mesh.primitives){if(b.name.length==0)b.name=k.id;if(l)for(j=0;j<l.length;j++){n=l[j];var p=ha[ga[n.target].instance_effect.url].shader;p.material.opacity=!p.material.opacity?1:p.material.opacity;n=m[n.symbol]=p.material;o++}l=n||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});k=k.mesh.geometry3js;if(o>1){l=new THREE.MeshFaceMaterial;for(j=0;j<k.faces.length;j++)o=
+k.faces[j],o.materials=[m[o.daeMaterial]]}if(c!==void 0)g(k,c),l.morphTargets=!0,l=new THREE.SkinnedMesh(k,l),l.skeleton=c.skeleton,l.skinController=aa[c.url],l.skinInstanceController=c,l.name="skin_"+ea.length,ea.push(l);else if(e!==void 0){m=k;o=e instanceof u?aa[e.url]:e;if(!o||!o.morph)console.log("could not find morph controller!");else{o=o.morph;for(p=0;p<o.targets.length;p++){var t=ba[o.targets[p]];if(t.mesh&&t.mesh.primitives&&t.mesh.primitives.length)t=t.mesh.primitives[0].geometry,t.vertices.length===
+m.vertices.length&&m.morphTargets.push({name:"target_1",vertices:t.vertices})}m.morphTargets.push({name:"target_Z",vertices:m.vertices})}l.morphTargets=!0;l=new THREE.Mesh(k,l);l.name="morph_"+da.length;da.push(l)}else l=new THREE.Mesh(k,l);a.geometries.length>1?b.add(l):b=l}}b.name=a.id||"";a.matrix.decompose(b.position,b.rotation,b.scale);for(f=0;f<a.nodes.length;f++)b.add(h(a.nodes[f],a));return b}function f(){this.init_from=this.id=""}function k(){this.type=this.name=this.id="";this.morph=this.skin=
+null}function l(){this.weights=this.targets=this.source=this.method=null}function m(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function n(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function o(){this.sid=this.name=this.id="";this.nodes=[];this.controllers=[];this.transforms=[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function p(){this.type=this.sid="";this.data=[];this.matrix=new THREE.Matrix4}function u(){this.url=
+"";this.skeleton=[];this.instance_material=[]}function v(){this.target=this.symbol=""}function y(){this.url="";this.instance_material=[]}function t(){this.id="";this.mesh=null}function z(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function x(){}function w(){this.material="";this.count=0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function A(){this.source="";this.stride=this.count=0;this.params=[]}function D(){this.input={}}function B(){this.semantic=
+"";this.offset=0;this.source="";this.set=0}function E(a){this.id=a;this.type=null}function I(){this.name=this.id="";this.instance_effect=null}function G(){this.color=new THREE.Color(0);this.color.setRGB(Math.random(),Math.random(),Math.random());this.color.a=1;this.texcoord=this.texture=null}function K(a,b){this.type=a;this.effect=b;this.material=null}function C(a){this.effect=a;this.format=this.init_from=null}function F(a){this.effect=a;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=
+this.source=null}function J(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function M(){this.url=""}function N(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function L(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=this.dotSyntax=this.sid=null}function O(a){this.id="";this.animation=a;this.inputs=[];this.endTime=this.startTime=this.interpolation=this.output=this.input=null;this.duration=0}function H(a){var b=a.getAttribute("id");
+if(V[b]!=void 0)return V[b];V[b]=(new E(b)).parse(a);return V[b]}function Q(a){if(a=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function P(a){for(var a=X(a).split(/\s+/),b=[],c=0;c<a.length;c++)b.push(parseFloat(a[c]));return b}function T(a){for(var a=X(a).split(/\s+/),b=[],c=0;c<a.length;c++)b.push(parseInt(a[c],10));return b}function X(a){return a.replace(/^\s+/,"").replace(/\s+$/,"")}function R(a,b,c){return a.hasAttribute(b)?parseInt(a.getAttribute(b),10):c}function S(a,
+b){if(a===void 0){for(var c="0.";c.length<b+2;)c+="0";return c}b=b||2;c=a.toString().split(".");for(c[1]=c.length>1?c[1].substr(0,b):"0";c[1].length<b;)c[1]+="0";return c.join(".")}function W(a,b){var c="";c+=S(a.x,b)+",";c+=S(a.y,b)+",";c+=S(a.z,b);return c}var U=null,Z=null,Y,$=null,V={},fa={},ca={},aa={},ba={},ga={},ha={},ia,ja,da,ea,ka=THREE.SmoothShading;f.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName=="init_from")this.init_from=
+c.textContent}return this};k.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.type="none";for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "skin":this.skin=(new m).parse(c);this.type=c.nodeName;break;case "morph":this.morph=(new l).parse(c),this.type=c.nodeName}}return this};l.prototype.parse=function(a){var b={},c=[],e;this.method=a.getAttribute("method");this.source=a.getAttribute("source").replace(/^#/,"");for(e=
+0;e<a.childNodes.length;e++){var f=a.childNodes[e];if(f.nodeType==1)switch(f.nodeName){case "source":f=(new E).parse(f);b[f.id]=f;break;case "targets":c=this.parseInputs(f);break;default:console.log(f.nodeName)}}for(e=0;e<c.length;e++)switch(a=c[e],f=b[a.source],a.semantic){case "MORPH_TARGET":this.targets=f.read();break;case "MORPH_WEIGHT":this.weights=f.read()}return this};l.prototype.parseInputs=function(a){for(var b=[],c=0;c<a.childNodes.length;c++){var e=a.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "input":b.push((new B).parse(e))}}return b};
+m.prototype.parse=function(a){var b={},c,e;this.source=a.getAttribute("source").replace(/^#/,"");this.invBindMatrices=[];this.joints=[];this.weights=[];for(var f=0;f<a.childNodes.length;f++){var h=a.childNodes[f];if(h.nodeType==1)switch(h.nodeName){case "bind_shape_matrix":h=P(h.textContent);this.bindShapeMatrix=new THREE.Matrix4;this.bindShapeMatrix.set(h[0],h[1],h[2],h[3],h[4],h[5],h[6],h[7],h[8],h[9],h[10],h[11],h[12],h[13],h[14],h[15]);break;case "source":h=(new E).parse(h);b[h.id]=h;break;case "joints":c=
+h;break;case "vertex_weights":e=h;break;default:console.log(h.nodeName)}}this.parseJoints(c,b);this.parseWeights(e,b);return this};m.prototype.parseJoints=function(a,b){for(var c=0;c<a.childNodes.length;c++){var e=a.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "input":var e=(new B).parse(e),f=b[e.source];if(e.semantic=="JOINT")this.joints=f.read();else if(e.semantic=="INV_BIND_MATRIX")this.invBindMatrices=f.read()}}};m.prototype.parseWeights=function(a,b){for(var c,e,f=[],h=0;h<a.childNodes.length;h++){var g=
+a.childNodes[h];if(g.nodeType==1)switch(g.nodeName){case "input":f.push((new B).parse(g));break;case "v":c=T(g.textContent);break;case "vcount":e=T(g.textContent)}}for(h=g=0;h<e.length;h++){for(var k=e[h],l=[],m=0;m<k;m++){for(var o={},n=0;n<f.length;n++){var p=f[n],t=c[g+p.offset];switch(p.semantic){case "JOINT":o.joint=t;break;case "WEIGHT":o.weight=b[p.source].data[t]}}l.push(o);g+=f.length}for(m=0;m<l.length;m++)l[m].index=h;this.weights.push(l)}};n.prototype.getChildById=function(a,b){for(var c=
+0;c<this.nodes.length;c++){var e=this.nodes[c].getChildById(a,b);if(e)return e}return null};n.prototype.getChildBySid=function(a,b){for(var c=0;c<this.nodes.length;c++){var e=this.nodes[c].getChildBySid(a,b);if(e)return e}return null};n.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.nodes=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "node":this.nodes.push((new o).parse(c))}}return this};o.prototype.getChannelForTransform=
+function(a){for(var b=0;b<this.channels.length;b++){var c=this.channels[b],e=c.target.split("/");e.shift();var f=e.shift(),h=f.indexOf(".")>=0,g=f.indexOf("(")>=0,k;if(h)e=f.split("."),f=e.shift(),e.shift();else if(g){k=f.split("(");f=k.shift();for(e=0;e<k.length;e++)k[e]=parseInt(k[e].replace(/\)/,""))}if(f==a)return c.info={sid:f,dotSyntax:h,arrSyntax:g,arrIndices:k},c}return null};o.prototype.getChildById=function(a,b){if(this.id==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var e=this.nodes[c].getChildById(a,
+b);if(e)return e}return null};o.prototype.getChildBySid=function(a,b){if(this.sid==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var e=this.nodes[c].getChildBySid(a,b);if(e)return e}return null};o.prototype.getTransformBySid=function(a){for(var b=0;b<this.transforms.length;b++)if(this.transforms[b].sid==a)return this.transforms[b];return null};o.prototype.parse=function(a){var b;this.id=a.getAttribute("id");this.sid=a.getAttribute("sid");this.name=a.getAttribute("name");this.type=a.getAttribute("type");
+this.type=this.type=="JOINT"?this.type:"NODE";this.nodes=[];this.transforms=[];this.geometries=[];this.controllers=[];this.matrix=new THREE.Matrix4;for(var c=0;c<a.childNodes.length;c++)if(b=a.childNodes[c],b.nodeType==1)switch(b.nodeName){case "node":this.nodes.push((new o).parse(b));break;case "instance_camera":break;case "instance_controller":this.controllers.push((new u).parse(b));break;case "instance_geometry":this.geometries.push((new y).parse(b));break;case "instance_light":break;case "instance_node":b=
+b.getAttribute("url").replace(/^#/,"");(b=U.evaluate(".//dae:library_nodes//dae:node[@id='"+b+"']",U,Q,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new o).parse(b));break;case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new p).parse(b));break;case "extra":break;default:console.log(b.nodeName)}a=[];c=1E6;b=-1E6;for(var e in ca)for(var f=ca[e],h=0;h<f.channel.length;h++){var g=f.channel[h],k=f.sampler[h];e=g.target.split("/")[0];
+if(e==this.id)k.create(),g.sampler=k,c=Math.min(c,k.startTime),b=Math.max(b,k.endTime),a.push(g)}if(a.length)this.startTime=c,this.endTime=b;if((this.channels=a)&&this.channels.length){e=1E7;for(i=0;i<this.channels.length;i++){a=this.channels[i].sampler;for(c=0;c<a.input.length-1;c++)e=Math.min(e,a.input[c+1]-a.input[c])}c=[];for(a=this.startTime;a<this.endTime;a+=e){b=a;for(var f={},l=h=void 0,h=0;h<this.channels.length;h++)l=this.channels[h],f[l.sid]=l;g=new THREE.Matrix4;for(h=0;h<this.transforms.length;h++)if(k=
+this.transforms[h],l=f[k.sid],l!==void 0){for(var m=l.sampler,n,l=0;l<m.input.length-1;l++)if(m.input[l+1]>b){n=m.output[l];break}g=n!==void 0?n instanceof THREE.Matrix4?g.multiply(g,n):g.multiply(g,k.matrix):g.multiply(g,k.matrix)}else g=g.multiply(g,k.matrix);b=g;c.push({time:a,pos:[b.n14,b.n24,b.n34],rotq:[0,0,0,1],scl:[1,1,1]})}this.keys=c}this.updateMatrix();return this};o.prototype.updateMatrix=function(){this.matrix.identity();for(var a=0;a<this.transforms.length;a++)this.matrix.multiply(this.matrix,
+this.transforms[a].matrix)};p.prototype.parse=function(a){this.sid=a.getAttribute("sid");this.type=a.nodeName;this.data=P(a.textContent);this.updateMatrix();return this};p.prototype.updateMatrix=function(){var a=0;this.matrix.identity();switch(this.type){case "matrix":this.matrix.set(this.data[0],this.data[1],this.data[2],this.data[3],this.data[4],this.data[5],this.data[6],this.data[7],this.data[8],this.data[9],this.data[10],this.data[11],this.data[12],this.data[13],this.data[14],this.data[15]);break;
+case "translate":this.matrix.setTranslation(this.data[0],this.data[1],this.data[2]);break;case "rotate":a=this.data[3]*(Math.PI/180);this.matrix.setRotationAxis(new THREE.Vector3(this.data[0],this.data[1],this.data[2]),a);break;case "scale":this.matrix.setScale(this.data[0],this.data[1],this.data[2])}return this.matrix};u.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.skeleton=[];this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];
+if(c.nodeType==1)switch(c.nodeName){case "skeleton":this.skeleton.push(c.textContent.replace(/^#/,""));break;case "bind_material":if(c=U.evaluate(".//dae:instance_material",c,Q,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(var e=c.iterateNext();e;)this.instance_material.push((new v).parse(e)),e=c.iterateNext()}}return this};v.prototype.parse=function(a){this.symbol=a.getAttribute("symbol");this.target=a.getAttribute("target").replace(/^#/,"");return this};y.prototype.parse=function(a){this.url=
+a.getAttribute("url").replace(/^#/,"");this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1&&c.nodeName=="bind_material"){if(a=U.evaluate(".//dae:instance_material",c,Q,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(b=a.iterateNext();b;)this.instance_material.push((new v).parse(b)),b=a.iterateNext();break}}return this};t.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "mesh":this.mesh=
+(new z(this)).parse(c)}}return this};z.prototype.parse=function(a){function b(a,c){var e=W(a.position);f[e]===void 0&&(f[e]={v:a,index:c});return f[e]}this.primitives=[];var c;for(c=0;c<a.childNodes.length;c++){var e=a.childNodes[c];switch(e.nodeName){case "source":H(e);break;case "vertices":this.vertices=(new D).parse(e);break;case "triangles":this.primitives.push((new w).parse(e));break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new x).parse(e))}}var f=
+{};this.geometry3js=new THREE.Geometry;e=V[this.vertices.input.POSITION.source].data;for(a=c=0;c<e.length;c+=3,a++){var h=new THREE.Vertex(new THREE.Vector3(e[c],e[c+1],e[c+2]));b(h,a);this.geometry3js.vertices.push(h)}for(c=0;c<this.primitives.length;c++)primitive=this.primitives[c],primitive.setVertices(this.vertices),this.handlePrimitive(primitive,this.geometry3js,f);this.geometry3js.computeCentroids();this.geometry3js.computeFaceNormals();this.geometry3js.computeVertexNormals();this.geometry3js.computeBoundingBox();
+return this};z.prototype.handlePrimitive=function(a,b,c){var e=0,f,h,g=a.p,k=a.inputs,l,m,o,n=0,p=3,t=[];for(f=0;f<k.length;f++)switch(l=k[f],l.semantic){case "TEXCOORD":t.push(l.set)}for(;e<g.length;){var u=[],v=[],y={},w=[];a.vcount&&(p=a.vcount[n++]);for(f=0;f<p;f++)for(h=0;h<k.length;h++)switch(l=k[h],source=V[l.source],m=g[e+f*k.length+l.offset],numParams=source.accessor.params.length,o=m*numParams,l.semantic){case "VERTEX":l=W(b.vertices[m].position);u.push(c[l].index);break;case "NORMAL":v.push(new THREE.Vector3(source.data[o],
+source.data[o+1],source.data[o+2]));break;case "TEXCOORD":y[l.set]===void 0&&(y[l.set]=[]);y[l.set].push(new THREE.UV(source.data[o],source.data[o+1]));break;case "COLOR":w.push((new THREE.Color).setRGB(source.data[o],source.data[o+1],source.data[o+2]))}var x;p==3?x=new THREE.Face3(u[0],u[1],u[2],[v[0],v[1],v[2]],w.length?w:new THREE.Color):p==4&&(x=new THREE.Face4(u[0],u[1],u[2],u[3],[v[0],v[1],v[2],v[3]],w.length?w:new THREE.Color));x.daeMaterial=a.material;b.faces.push(x);for(h=0;h<t.length;h++)f=
+y[t[h]],b.faceVertexUvs[h].push([f[0],f[1],f[2]]);e+=k.length*p}};x.prototype=new w;x.prototype.constructor=x;w.prototype.setVertices=function(a){for(var b=0;b<this.inputs.length;b++)if(this.inputs[b].source==a.id)this.inputs[b].source=a.input.POSITION.source};w.prototype.parse=function(a){this.inputs=[];this.material=a.getAttribute("material");this.count=R(a,"count",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "input":this.inputs.push((new B).parse(a.childNodes[b]));
+break;case "vcount":this.vcount=T(c.textContent);break;case "p":this.p=T(c.textContent)}}return this};A.prototype.parse=function(a){this.params=[];this.source=a.getAttribute("source");this.count=R(a,"count",0);this.stride=R(a,"stride",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName=="param"){var e={};e.name=c.getAttribute("name");e.type=c.getAttribute("type");this.params.push(e)}}return this};D.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++)a.childNodes[b].nodeName==
+"input"&&(input=(new B).parse(a.childNodes[b]),this.input[input.semantic]=input);return this};B.prototype.parse=function(a){this.semantic=a.getAttribute("semantic");this.source=a.getAttribute("source").replace(/^#/,"");this.set=R(a,"set",-1);this.offset=R(a,"offset",0);if(this.semantic=="TEXCOORD"&&this.set<0)this.set=0;return this};E.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "bool_array":for(var e=
+X(c.textContent).split(/\s+/),f=[],h=0;h<e.length;h++)f.push(e[h]=="true"||e[h]=="1"?!0:!1);this.data=f;this.type=c.nodeName;break;case "float_array":this.data=P(c.textContent);this.type=c.nodeName;break;case "int_array":this.data=T(c.textContent);this.type=c.nodeName;break;case "IDREF_array":case "Name_array":this.data=X(c.textContent).split(/\s+/);this.type=c.nodeName;break;case "technique_common":for(e=0;e<c.childNodes.length;e++)if(c.childNodes[e].nodeName=="accessor"){this.accessor=(new A).parse(c.childNodes[e]);
+break}}}return this};E.prototype.read=function(){var a=[],b=this.accessor.params[0];switch(b.type){case "IDREF":case "Name":case "name":case "float":return this.data;case "float4x4":for(b=0;b<this.data.length;b+=16){var c=this.data.slice(b,b+16),e=new THREE.Matrix4;e.set(c[0],c[1],c[2],c[3],c[4],c[5],c[6],c[7],c[8],c[9],c[10],c[11],c[12],c[13],c[14],c[15]);a.push(e)}break;default:console.log("ColladaLoader: Source: Read dont know how to read "+b.type+".")}return a};I.prototype.parse=function(a){this.id=
+a.getAttribute("id");this.name=a.getAttribute("name");for(var b=0;b<a.childNodes.length;b++)if(a.childNodes[b].nodeName=="instance_effect"){this.instance_effect=(new M).parse(a.childNodes[b]);break}return this};G.prototype.isColor=function(){return this.texture==null};G.prototype.isTexture=function(){return this.texture!=null};G.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "color":c=P(c.textContent);this.color=new THREE.Color(0);
+this.color.setRGB(c[0],c[1],c[2]);this.color.a=c[3];break;case "texture":this.texture=c.getAttribute("texture"),this.texcoord=c.getAttribute("texcoord")}}return this};K.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[c.nodeName]=(new G).parse(c);break;case "shininess":case "reflectivity":case "transparency":var e;e=U.evaluate(".//dae:float",
+c,Q,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);for(var f=e.iterateNext(),h=[];f;)h.push(f),f=e.iterateNext();e=h;e.length>0&&(this[c.nodeName]=parseFloat(e[0].textContent))}}this.create();return this};K.prototype.create=function(){var a={},b=this.transparency!==void 0&&this.transparency<1,c;for(c in this)switch(c){case "ambient":case "emission":case "diffuse":case "specular":var e=this[c];if(e instanceof G)if(e.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==
+this.effect.surface.sid&&(e=fa[this.effect.surface.init_from]))a.map=THREE.ImageUtils.loadTexture(ja+e.init_from),a.map.wrapS=THREE.RepeatWrapping,a.map.wrapT=THREE.RepeatWrapping,a.map.repeat.x=1,a.map.repeat.y=-1}else c=="diffuse"?a.color=e.color.getHex():b||(a[c]=e.color.getHex());break;case "shininess":case "reflectivity":a[c]=this[c];break;case "transparency":if(b)a.transparent=!0,a.opacity=this[c],b=!0}a.shading=ka;return this.material=new THREE.MeshLambertMaterial(a)};C.prototype.parse=function(a){for(var b=
+0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "init_from":this.init_from=c.textContent;break;case "format":this.format=c.textContent;break;default:console.log("unhandled Surface prop: "+c.nodeName)}}return this};F.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "source":this.source=c.textContent;break;case "minfilter":this.minfilter=c.textContent;break;case "magfilter":this.magfilter=
+c.textContent;break;case "mipfilter":this.mipfilter=c.textContent;break;case "wrap_s":this.wrap_s=c.textContent;break;case "wrap_t":this.wrap_t=c.textContent;break;default:console.log("unhandled Sampler2D prop: "+c.nodeName)}}return this};J.prototype.create=function(){if(this.shader==null)return null};J.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.shader=null;for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "profile_COMMON":this.parseTechnique(this.parseProfileCOMMON(c))}}return this};
+J.prototype.parseNewparam=function(a){for(var b=a.getAttribute("sid"),c=0;c<a.childNodes.length;c++){var e=a.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "surface":this.surface=(new C(this)).parse(e);this.surface.sid=b;break;case "sampler2D":this.sampler=(new F(this)).parse(e);this.sampler.sid=b;break;case "extra":break;default:console.log(e.nodeName)}}};J.prototype.parseProfileCOMMON=function(a){for(var b,c=0;c<a.childNodes.length;c++){var e=a.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "profile_COMMON":this.parseProfileCOMMON(e);
+break;case "technique":b=e;break;case "newparam":this.parseNewparam(e);break;case "extra":break;default:console.log(e.nodeName)}}return b};J.prototype.parseTechnique=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "lambert":case "blinn":case "phong":this.shader=(new K(c.nodeName,this)).parse(c)}}};M.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");return this};N.prototype.parse=function(a){this.id=a.getAttribute("id");
+this.name=a.getAttribute("name");this.source={};for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "source":c=(new E).parse(c);this.source[c.id]=c;break;case "sampler":this.sampler.push((new O(this)).parse(c));break;case "channel":this.channel.push((new L(this)).parse(c))}}return this};L.prototype.parse=function(a){this.source=a.getAttribute("source").replace(/^#/,"");this.target=a.getAttribute("target");var b=this.target.split("/");b.shift();var a=
+b.shift(),c=a.indexOf(".")>=0,e=a.indexOf("(")>=0,f,h;if(c)b=a.split("."),a=b.shift(),h=b.shift();else if(e){f=a.split("(");a=f.shift();for(b=0;b<f.length;b++)f[b]=parseInt(f[b].replace(/\)/,""))}this.sid=a;this.dotSyntax=c;this.arrSyntax=e;this.arrIndices=f;this.member=h;return this};O.prototype.parse=function(a){this.id=a.getAttribute("id");this.inputs=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "input":this.inputs.push((new B).parse(c))}}return this};
+O.prototype.create=function(){for(var a=0;a<this.inputs.length;a++){var b=this.inputs[a],c=this.animation.source[b.source];switch(b.semantic){case "INPUT":this.input=c.read();break;case "OUTPUT":this.output=c.read();break;case "INTERPOLATION":this.interpolation=c.read();break;case "IN_TANGENT":break;case "OUT_TANGENT":break;default:console.log(b.semantic)}}this.duration=this.endTime=this.startTime=0;if(this.input.length){this.startTime=1E8;this.endTime=-1E8;for(a=0;a<this.input.length;a++)this.startTime=
+Math.min(this.startTime,this.input[a]),this.endTime=Math.max(this.endTime,this.input[a]);this.duration=this.endTime-this.startTime}};return{load:function(b,c){if(document.implementation&&document.implementation.createDocument){document.implementation.createDocument("http://www.collada.org/2005/11/COLLADASchema","COLLADA",null);b+="?rnd="+Math.random();var e=new XMLHttpRequest;e.overrideMimeType&&e.overrideMimeType("text/xml");e.onreadystatechange=function(){if(e.readyState==4&&(e.status==0||e.status==
+200))$=c,a(e.responseXML,void 0,b)};e.open("GET",b,!0);e.send(null)}else alert("Don't know how to parse XML!")},parse:a,setPreferredShading:function(a){ka=a},applySkin:g,geometries:ba}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;
+THREE.JSONLoader.prototype.load=function(a,c,b){var e=this,g;if(a instanceof Object)console.warn("DEPRECATED: JSONLoader( parameters ) is now JSONLoader( url, callback, texturePath )."),g=a,a=g.model,c=g.callback,b=g.texture_path;g=new Worker(a);b=b?b:this.extractUrlbase(a);g.onmessage=function(a){e.createModel(a.data,c,b);e.onLoadComplete()};this.onLoadStart();g.postMessage((new Date).getTime())};
+THREE.JSONLoader.prototype.createModel=function(a,c,b){var e=new THREE.Geometry,g=a.scale!==void 0?1/a.scale:1;this.init_materials(e,a.materials,b);(function(b){if(a.version===void 0||a.version!=2)console.error("Deprecated file format.");else{var c,g,l,m,n,o,p,u,v,y,t,z,x,w,A=a.faces;o=a.vertices;var D=a.normals,B=a.colors,E=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&E++;for(c=0;c<E;c++)e.faceUvs[c]=[],e.faceVertexUvs[c]=[];m=0;for(n=o.length;m<n;)p=new THREE.Vertex,p.position.x=o[m++]*b,p.position.y=
+o[m++]*b,p.position.z=o[m++]*b,e.vertices.push(p);m=0;for(n=A.length;m<n;){b=A[m++];o=b&1;l=b&2;c=b&4;g=b&8;u=b&16;p=b&32;y=b&64;b&=128;o?(t=new THREE.Face4,t.a=A[m++],t.b=A[m++],t.c=A[m++],t.d=A[m++],o=4):(t=new THREE.Face3,t.a=A[m++],t.b=A[m++],t.c=A[m++],o=3);if(l)l=A[m++],t.materials=e.materials[l];l=e.faces.length;if(c)for(c=0;c<E;c++)z=a.uvs[c],v=A[m++],w=z[v*2],v=z[v*2+1],e.faceUvs[c][l]=new THREE.UV(w,v);if(g)for(c=0;c<E;c++){z=a.uvs[c];x=[];for(g=0;g<o;g++)v=A[m++],w=z[v*2],v=z[v*2+1],x[g]=
+new THREE.UV(w,v);e.faceVertexUvs[c][l]=x}if(u)u=A[m++]*3,g=new THREE.Vector3,g.x=D[u++],g.y=D[u++],g.z=D[u],t.normal=g;if(p)for(c=0;c<o;c++)u=A[m++]*3,g=new THREE.Vector3,g.x=D[u++],g.y=D[u++],g.z=D[u],t.vertexNormals.push(g);if(y)p=A[m++],p=new THREE.Color(B[p]),t.color=p;if(b)for(c=0;c<o;c++)p=A[m++],p=new THREE.Color(B[p]),t.vertexColors.push(p);e.faces.push(t)}}})(g);(function(){var b,c,g,l;if(a.skinWeights){b=0;for(c=a.skinWeights.length;b<c;b+=2)g=a.skinWeights[b],l=a.skinWeights[b+1],e.skinWeights.push(new THREE.Vector4(g,
+l,0,0))}if(a.skinIndices){b=0;for(c=a.skinIndices.length;b<c;b+=2)g=a.skinIndices[b],l=a.skinIndices[b+1],e.skinIndices.push(new THREE.Vector4(g,l,0,0))}e.bones=a.bones;e.animation=a.animation})();(function(b){if(a.morphTargets!==void 0){var c,g,l,m,n,o,p,u,v;c=0;for(g=a.morphTargets.length;c<g;c++){e.morphTargets[c]={};e.morphTargets[c].name=a.morphTargets[c].name;e.morphTargets[c].vertices=[];u=e.morphTargets[c].vertices;v=a.morphTargets[c].vertices;l=0;for(m=v.length;l<m;l+=3)n=v[l]*b,o=v[l+1]*
+b,p=v[l+2]*b,u.push(new THREE.Vertex(new THREE.Vector3(n,o,p)))}}if(a.morphColors!==void 0){c=0;for(g=a.morphColors.length;c<g;c++){e.morphColors[c]={};e.morphColors[c].name=a.morphColors[c].name;e.morphColors[c].colors=[];m=e.morphColors[c].colors;n=a.morphColors[c].colors;b=0;for(l=n.length;b<l;b+=3)o=new THREE.Color(16755200),o.setRGB(n[b],n[b+1],n[b+2]),m.push(o)}}})(g);e.computeCentroids();e.computeFaceNormals();this.hasNormals(e)&&e.computeTangents();c(e)};
 THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};
-THREE.SceneLoader.prototype={load:function(a,b){var c=this,e=new Worker(a);e.postMessage(0);var f=THREE.Loader.prototype.extractUrlbase(a);e.onmessage=function(a){function e(a,c){return c=="relativeToHTML"?a:f+"/"+a}function k(){for(u in F.objects)if(!H.objects[u])if(x=F.objects[u],x.geometry!==void 0){if(B=H.geometries[x.geometry]){var a=!1;K=[];for(P=0;P<x.materials.length;P++)K[P]=H.materials[x.materials[P]],a=K[P]instanceof THREE.ShaderMaterial;a&&B.computeTangents();w=x.position;r=x.rotation;
+THREE.SceneLoader.prototype={load:function(a,c){var b=this,e=new Worker(a);e.postMessage(0);var g=THREE.Loader.prototype.extractUrlbase(a);e.onmessage=function(a){function e(a,b){return b=="relativeToHTML"?a:g+"/"+a}function k(){for(u in F.objects)if(!H.objects[u])if(x=F.objects[u],x.geometry!==void 0){if(B=H.geometries[x.geometry]){var a=!1;K=[];for(P=0;P<x.materials.length;P++)K[P]=H.materials[x.materials[P]],a=K[P]instanceof THREE.ShaderMaterial;a&&B.computeTangents();w=x.position;r=x.rotation;
 q=x.quaternion;s=x.scale;q=0;K.length==0&&(K[0]=new THREE.MeshFaceMaterial);K.length>1&&(K=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(B,K);object.name=u;object.position.set(w[0],w[1],w[2]);q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=x.visible;H.scene.add(object);H.objects[u]=object;x.meshCollider&&(a=THREE.CollisionUtils.MeshColliderWBox(object),H.scene.collisions.colliders.push(a));
 if(x.castsShadow)a=new THREE.ShadowVolume(B),H.scene.add(a),a.position=object.position,a.rotation=object.rotation,a.scale=object.scale;x.trigger&&x.trigger.toLowerCase()!="none"&&(a={type:x.trigger,object:x},H.triggers[object.name]=a)}}else w=x.position,r=x.rotation,q=x.quaternion,s=x.scale,q=0,object=new THREE.Object3D,object.name=u,object.position.set(w[0],w[1],w[2]),q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]),object.scale.set(s[0],
-s[1],s[2]),object.visible=x.visible!==void 0?x.visible:!1,H.scene.add(object),H.objects[u]=object,H.empties[u]=object,x.trigger&&x.trigger.toLowerCase()!="none"&&(a={type:x.trigger,object:x},H.triggers[object.name]=a)}function l(a){return function(b){H.geometries[a]=b;k();M-=1;c.onLoadComplete();n()}}function m(a){return function(c){H.geometries[a]=c}}function n(){c.callbackProgress({totalModels:L,totalTextures:O,loadedModels:L-M,loadedTextures:O-N},H);c.onLoadProgress();M==0&&N==0&&b(H)}var o,t,
-u,v,y,p,z,x,w,A,D,B,E,I,G,K,C,F,J,M,N,L,O,H;F=a.data;G=new THREE.BinaryLoader;J=new THREE.JSONLoader;N=M=0;H={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};a=!1;for(u in F.objects)if(x=F.objects[u],x.meshCollider){a=!0;break}if(a)H.scene.collisions=new THREE.CollisionSystem;if(F.transform){a=F.transform.position;A=F.transform.rotation;var Q=F.transform.scale;a&&H.scene.position.set(a[0],a[1],a[2]);A&&H.scene.rotation.set(A[0],
-A[1],A[2]);Q&&H.scene.scale.set(Q[0],Q[1],Q[2]);(a||A||Q)&&H.scene.updateMatrix()}a=function(){N-=1;n();c.onLoadComplete()};for(y in F.cameras)A=F.cameras[y],A.type=="perspective"?E=new THREE.PerspectiveCamera(A.fov,A.aspect,A.near,A.far):A.type=="ortho"&&(E=new THREE.OrthographicCamera(A.left,A.right,A.top,A.bottom,A.near,A.far)),w=A.position,A=A.target,E.position.set(w[0],w[1],w[2]),E.target=new THREE.Vector3(A[0],A[1],A[2]),H.cameras[y]=E;for(v in F.lights)y=F.lights[v],E=y.color!==void 0?y.color:
-16777215,A=y.intensity!==void 0?y.intensity:1,y.type=="directional"?(w=y.direction,C=new THREE.DirectionalLight(E,A),C.position.set(w[0],w[1],w[2]),C.position.normalize()):y.type=="point"?(w=y.position,d=y.distance,C=new THREE.PointLight(E,A,d),C.position.set(w[0],w[1],w[2])):y.type=="ambient"&&(C=new THREE.AmbientLight(E)),H.scene.add(C),H.lights[v]=C;for(p in F.fogs)v=F.fogs[p],v.type=="linear"?I=new THREE.Fog(0,v.near,v.far):v.type=="exp2"&&(I=new THREE.FogExp2(0,v.density)),A=v.color,I.color.setRGB(A[0],
-A[1],A[2]),H.fogs[p]=I;if(H.cameras&&F.defaults.camera)H.currentCamera=H.cameras[F.defaults.camera];if(H.fogs&&F.defaults.fog)H.scene.fog=H.fogs[F.defaults.fog];A=F.defaults.bgcolor;H.bgColor=new THREE.Color;H.bgColor.setRGB(A[0],A[1],A[2]);H.bgColorAlpha=F.defaults.bgalpha;for(o in F.geometries)if(p=F.geometries[o],p.type=="bin_mesh"||p.type=="ascii_mesh")M+=1,c.onLoadStart();L=M;for(o in F.geometries)p=F.geometries[o],p.type=="cube"?(B=new THREE.CubeGeometry(p.width,p.height,p.depth,p.segmentsWidth,
-p.segmentsHeight,p.segmentsDepth,null,p.flipped,p.sides),H.geometries[o]=B):p.type=="plane"?(B=new THREE.PlaneGeometry(p.width,p.height,p.segmentsWidth,p.segmentsHeight),H.geometries[o]=B):p.type=="sphere"?(B=new THREE.SphereGeometry(p.radius,p.segmentsWidth,p.segmentsHeight),H.geometries[o]=B):p.type=="cylinder"?(B=new THREE.CylinderGeometry(p.topRad,p.botRad,p.height,p.radSegs,p.heightSegs),H.geometries[o]=B):p.type=="torus"?(B=new THREE.TorusGeometry(p.radius,p.tube,p.segmentsR,p.segmentsT),H.geometries[o]=
-B):p.type=="icosahedron"?(B=new THREE.IcosahedronGeometry(p.subdivisions),H.geometries[o]=B):p.type=="bin_mesh"?G.load({model:e(p.url,F.urlBaseType),callback:l(o)}):p.type=="ascii_mesh"?J.load({model:e(p.url,F.urlBaseType),callback:l(o)}):p.type=="embedded_mesh"&&(p=F.embeds[p.id])&&J.createModel(p,m(o),"");for(z in F.textures)if(o=F.textures[z],o.url instanceof Array){N+=o.url.length;for(G=0;G<o.url.length;G++)c.onLoadStart()}else N+=1,c.onLoadStart();O=N;for(z in F.textures){o=F.textures[z];if(o.mapping!=
+s[1],s[2]),object.visible=x.visible!==void 0?x.visible:!1,H.scene.add(object),H.objects[u]=object,H.empties[u]=object,x.trigger&&x.trigger.toLowerCase()!="none"&&(a={type:x.trigger,object:x},H.triggers[object.name]=a)}function l(a){return function(c){H.geometries[a]=c;k();M-=1;b.onLoadComplete();n()}}function m(a){return function(b){H.geometries[a]=b}}function n(){b.callbackProgress({totalModels:L,totalTextures:O,loadedModels:L-M,loadedTextures:O-N},H);b.onLoadProgress();M==0&&N==0&&c(H)}var o,p,
+u,v,y,t,z,x,w,A,D,B,E,I,G,K,C,F,J,M,N,L,O,H;F=a.data;G=new THREE.BinaryLoader;J=new THREE.JSONLoader;N=M=0;H={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};a=!1;for(u in F.objects)if(x=F.objects[u],x.meshCollider){a=!0;break}if(a)H.scene.collisions=new THREE.CollisionSystem;if(F.transform){a=F.transform.position;A=F.transform.rotation;var Q=F.transform.scale;a&&H.scene.position.set(a[0],a[1],a[2]);A&&H.scene.rotation.set(A[0],
+A[1],A[2]);Q&&H.scene.scale.set(Q[0],Q[1],Q[2]);(a||A||Q)&&H.scene.updateMatrix()}a=function(){N-=1;n();b.onLoadComplete()};for(y in F.cameras)A=F.cameras[y],A.type=="perspective"?E=new THREE.PerspectiveCamera(A.fov,A.aspect,A.near,A.far):A.type=="ortho"&&(E=new THREE.OrthographicCamera(A.left,A.right,A.top,A.bottom,A.near,A.far)),w=A.position,A=A.target,E.position.set(w[0],w[1],w[2]),E.target=new THREE.Vector3(A[0],A[1],A[2]),H.cameras[y]=E;for(v in F.lights)y=F.lights[v],E=y.color!==void 0?y.color:
+16777215,A=y.intensity!==void 0?y.intensity:1,y.type=="directional"?(w=y.direction,C=new THREE.DirectionalLight(E,A),C.position.set(w[0],w[1],w[2]),C.position.normalize()):y.type=="point"?(w=y.position,d=y.distance,C=new THREE.PointLight(E,A,d),C.position.set(w[0],w[1],w[2])):y.type=="ambient"&&(C=new THREE.AmbientLight(E)),H.scene.add(C),H.lights[v]=C;for(t in F.fogs)v=F.fogs[t],v.type=="linear"?I=new THREE.Fog(0,v.near,v.far):v.type=="exp2"&&(I=new THREE.FogExp2(0,v.density)),A=v.color,I.color.setRGB(A[0],
+A[1],A[2]),H.fogs[t]=I;if(H.cameras&&F.defaults.camera)H.currentCamera=H.cameras[F.defaults.camera];if(H.fogs&&F.defaults.fog)H.scene.fog=H.fogs[F.defaults.fog];A=F.defaults.bgcolor;H.bgColor=new THREE.Color;H.bgColor.setRGB(A[0],A[1],A[2]);H.bgColorAlpha=F.defaults.bgalpha;for(o in F.geometries)if(t=F.geometries[o],t.type=="bin_mesh"||t.type=="ascii_mesh")M+=1,b.onLoadStart();L=M;for(o in F.geometries)t=F.geometries[o],t.type=="cube"?(B=new THREE.CubeGeometry(t.width,t.height,t.depth,t.segmentsWidth,
+t.segmentsHeight,t.segmentsDepth,null,t.flipped,t.sides),H.geometries[o]=B):t.type=="plane"?(B=new THREE.PlaneGeometry(t.width,t.height,t.segmentsWidth,t.segmentsHeight),H.geometries[o]=B):t.type=="sphere"?(B=new THREE.SphereGeometry(t.radius,t.segmentsWidth,t.segmentsHeight),H.geometries[o]=B):t.type=="cylinder"?(B=new THREE.CylinderGeometry(t.topRad,t.botRad,t.height,t.radSegs,t.heightSegs),H.geometries[o]=B):t.type=="torus"?(B=new THREE.TorusGeometry(t.radius,t.tube,t.segmentsR,t.segmentsT),H.geometries[o]=
+B):t.type=="icosahedron"?(B=new THREE.IcosahedronGeometry(t.subdivisions),H.geometries[o]=B):t.type=="bin_mesh"?G.load({model:e(t.url,F.urlBaseType),callback:l(o)}):t.type=="ascii_mesh"?J.load({model:e(t.url,F.urlBaseType),callback:l(o)}):t.type=="embedded_mesh"&&(t=F.embeds[t.id])&&J.createModel(t,m(o),"");for(z in F.textures)if(o=F.textures[z],o.url instanceof Array){N+=o.url.length;for(G=0;G<o.url.length;G++)b.onLoadStart()}else N+=1,b.onLoadStart();O=N;for(z in F.textures){o=F.textures[z];if(o.mapping!=
 void 0&&THREE[o.mapping]!=void 0)o.mapping=new THREE[o.mapping];if(o.url instanceof Array){G=[];for(var P=0;P<o.url.length;P++)G[P]=e(o.url[P],F.urlBaseType);G=THREE.ImageUtils.loadTextureCube(G,o.mapping,a)}else{G=THREE.ImageUtils.loadTexture(e(o.url,F.urlBaseType),o.mapping,a);if(THREE[o.minFilter]!=void 0)G.minFilter=THREE[o.minFilter];if(THREE[o.magFilter]!=void 0)G.magFilter=THREE[o.magFilter];if(o.repeat){G.repeat.set(o.repeat[0],o.repeat[1]);if(o.repeat[0]!=1)G.wrapS=THREE.RepeatWrapping;if(o.repeat[1]!=
-1)G.wrapT=THREE.RepeatWrapping}o.offset&&G.offset.set(o.offset[0],o.offset[1]);if(o.wrap){J={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(J[o.wrap[0]]!==void 0)G.wrapS=J[o.wrap[0]];if(J[o.wrap[1]]!==void 0)G.wrapT=J[o.wrap[1]]}}H.textures[z]=G}for(t in F.materials){z=F.materials[t];for(D in z.parameters)if(D=="envMap"||D=="map"||D=="lightMap")z.parameters[D]=H.textures[z.parameters[D]];else if(D=="shading")z.parameters[D]=z.parameters[D]=="flat"?THREE.FlatShading:THREE.SmoothShading;
+1)G.wrapT=THREE.RepeatWrapping}o.offset&&G.offset.set(o.offset[0],o.offset[1]);if(o.wrap){J={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(J[o.wrap[0]]!==void 0)G.wrapS=J[o.wrap[0]];if(J[o.wrap[1]]!==void 0)G.wrapT=J[o.wrap[1]]}}H.textures[z]=G}for(p in F.materials){z=F.materials[p];for(D in z.parameters)if(D=="envMap"||D=="map"||D=="lightMap")z.parameters[D]=H.textures[z.parameters[D]];else if(D=="shading")z.parameters[D]=z.parameters[D]=="flat"?THREE.FlatShading:THREE.SmoothShading;
 else if(D=="blending")z.parameters[D]=THREE[z.parameters[D]]?THREE[z.parameters[D]]:THREE.NormalBlending;else if(D=="combine")z.parameters[D]=z.parameters[D]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(D=="vertexColors")if(z.parameters[D]=="face")z.parameters[D]=THREE.FaceColors;else if(z.parameters[D])z.parameters[D]=THREE.VertexColors;if(z.parameters.opacity!==void 0&&z.parameters.opacity<1)z.parameters.transparent=!0;if(z.parameters.normalMap){o=THREE.ShaderUtils.lib.normal;
-a=THREE.UniformsUtils.clone(o.uniforms);G=z.parameters.color;J=z.parameters.specular;p=z.parameters.ambient;I=z.parameters.shininess;a.tNormal.texture=H.textures[z.parameters.normalMap];if(z.parameters.normalMapFactor)a.uNormalScale.value=z.parameters.normalMapFactor;if(z.parameters.map)a.tDiffuse.texture=z.parameters.map,a.enableDiffuse.value=!0;if(z.parameters.lightMap)a.tAO.texture=z.parameters.lightMap,a.enableAO.value=!0;if(z.parameters.specularMap)a.tSpecular.texture=H.textures[z.parameters.specularMap],
-a.enableSpecular.value=!0;a.uDiffuseColor.value.setHex(G);a.uSpecularColor.value.setHex(J);a.uAmbientColor.value.setHex(p);a.uShininess.value=I;if(z.parameters.opacity)a.uOpacity.value=z.parameters.opacity;z=new THREE.ShaderMaterial({fragmentShader:o.fragmentShader,vertexShader:o.vertexShader,uniforms:a,lights:!0,fog:!0})}else z=new THREE[z.type](z.parameters);H.materials[t]=z}k();c.callbackSync(H)}},constructor:THREE.SceneLoader};THREE.UTF8Loader=function(){};THREE.UTF8Loader.prototype=new THREE.UTF8Loader;
+a=THREE.UniformsUtils.clone(o.uniforms);G=z.parameters.color;J=z.parameters.specular;t=z.parameters.ambient;I=z.parameters.shininess;a.tNormal.texture=H.textures[z.parameters.normalMap];if(z.parameters.normalMapFactor)a.uNormalScale.value=z.parameters.normalMapFactor;if(z.parameters.map)a.tDiffuse.texture=z.parameters.map,a.enableDiffuse.value=!0;if(z.parameters.lightMap)a.tAO.texture=z.parameters.lightMap,a.enableAO.value=!0;if(z.parameters.specularMap)a.tSpecular.texture=H.textures[z.parameters.specularMap],
+a.enableSpecular.value=!0;a.uDiffuseColor.value.setHex(G);a.uSpecularColor.value.setHex(J);a.uAmbientColor.value.setHex(t);a.uShininess.value=I;if(z.parameters.opacity)a.uOpacity.value=z.parameters.opacity;z=new THREE.ShaderMaterial({fragmentShader:o.fragmentShader,vertexShader:o.vertexShader,uniforms:a,lights:!0,fog:!0})}else z=new THREE[z.type](z.parameters);H.materials[p]=z}k();b.callbackSync(H);n()}},constructor:THREE.SceneLoader};THREE.UTF8Loader=function(){};THREE.UTF8Loader.prototype=new THREE.UTF8Loader;
 THREE.UTF8Loader.prototype.constructor=THREE.UTF8Loader;
-THREE.UTF8Loader.prototype.load=function(a){var b=new XMLHttpRequest,c=a.model,e=a.callback,f=a.scale!==void 0?a.scale:1,h=a.offsetX!==void 0?a.offsetX:0,g=a.offsetY!==void 0?a.offsetY:0,k=a.offsetZ!==void 0?a.offsetZ:0;b.onreadystatechange=function(){b.readyState==4?b.status==200||b.status==0?THREE.UTF8Loader.prototype.createModel(b.responseText,e,f,h,g,k):alert("Couldn't load ["+c+"] ["+b.status+"]"):b.readyState!=3&&b.readyState==2&&b.getResponseHeader("Content-Length")};b.open("GET",c,!0);b.send(null)};
-THREE.UTF8Loader.prototype.decompressMesh=function(a){var b=a.charCodeAt(0);b>=57344&&(b-=2048);b++;for(var c=new Float32Array(8*b),e=1,f=0;f<8;f++){for(var h=0,g=0;g<b;++g){var k=a.charCodeAt(g+e);h+=k>>1^-(k&1);c[8*g+f]=h}e+=b}b=a.length-e;h=new Uint16Array(b);for(f=g=0;f<b;f++)k=a.charCodeAt(f+e),h[f]=g-k,k==0&&g++;return[c,h]};
-THREE.UTF8Loader.prototype.createModel=function(a,b,c,e,f,h){var g=function(){var b=this;b.materials=[];THREE.Geometry.call(this);var g=THREE.UTF8Loader.prototype.decompressMesh(a),m=[],n=[];(function(a,g,l){for(var m,n,p,z=a.length;l<z;l+=g)m=a[l],n=a[l+1],p=a[l+2],m=m/16383*c,n=n/16383*c,p=p/16383*c,m+=e,n+=f,p+=h,b.vertices.push(new THREE.Vertex(new THREE.Vector3(m,n,p)))})(g[0],8,0);(function(a,c,b){for(var e,f,g=a.length;b<g;b+=c)e=a[b],f=a[b+1],e/=1023,f/=1023,n.push(e,1-f)})(g[0],8,3);(function(a,
-c,b){for(var e,f,g,h=a.length;b<h;b+=c)e=a[b],f=a[b+1],g=a[b+2],e=(e-512)/511,f=(f-512)/511,g=(g-512)/511,m.push(e,f,g)})(g[0],8,5);(function(a){var c,e,f,g,h,l,x,w,A,D=a.length;for(c=0;c<D;c+=3){e=a[c];f=a[c+1];g=a[c+2];h=b;w=e;A=f;l=g;x=e;var B=f,E=g,I=h.materials[0],G=m[B*3],K=m[B*3+1],B=m[B*3+2],C=m[E*3],F=m[E*3+1],E=m[E*3+2];x=new THREE.Vector3(m[x*3],m[x*3+1],m[x*3+2]);B=new THREE.Vector3(G,K,B);E=new THREE.Vector3(C,F,E);h.faces.push(new THREE.Face3(w,A,l,[x,B,E],null,I));h=n[e*2];e=n[e*2+
-1];l=n[f*2];x=n[f*2+1];w=n[g*2];A=n[g*2+1];g=b.faceVertexUvs[0];f=l;l=x;x=[];x.push(new THREE.UV(h,e));x.push(new THREE.UV(f,l));x.push(new THREE.UV(w,A));g.push(x)}})(g[1]);this.computeCentroids();this.computeFaceNormals()};g.prototype=new THREE.Geometry;g.prototype.constructor=g;b(new g)};
-THREE.Axes=function(){THREE.Object3D.call(this);var a=new THREE.Geometry;a.vertices.push(new THREE.Vertex);a.vertices.push(new THREE.Vertex(new THREE.Vector3(0,100,0)));var b=new THREE.CylinderGeometry(0,5,25,5,1),c=new THREE.Line(a,new THREE.LineBasicMaterial({color:16711680}));c.rotation.z=-Math.PI/2;this.add(c);c=new THREE.Mesh(b,new THREE.MeshBasicMaterial({color:16711680}));c.position.x=100;c.rotation.z=-Math.PI/2;this.add(c);c=new THREE.Line(a,new THREE.LineBasicMaterial({color:65280}));this.add(c);
-c=new THREE.Mesh(b,new THREE.MeshBasicMaterial({color:65280}));c.position.y=100;this.add(c);c=new THREE.Line(a,new THREE.LineBasicMaterial({color:255}));c.rotation.x=Math.PI/2;this.add(c);c=new THREE.Mesh(b,new THREE.MeshBasicMaterial({color:255}));c.position.z=100;c.rotation.x=Math.PI/2;this.add(c)};THREE.Axes.prototype=new THREE.Object3D;THREE.Axes.prototype.constructor=THREE.Axes;
-THREE.MarchingCubes=function(a,b){THREE.Object3D.call(this);this.materials=b instanceof Array?b:[b];this.init=function(a){this.isolation=80;this.size=a;this.size2=this.size*this.size;this.size3=this.size2*this.size;this.halfsize=this.size/2;this.delta=2/this.size;this.yd=this.size;this.zd=this.size2;this.field=new Float32Array(this.size3);this.normal_cache=new Float32Array(this.size3*3);this.vlist=new Float32Array(36);this.nlist=new Float32Array(36);this.firstDraw=!0;this.maxCount=4096;this.count=
-0;this.hasNormal=this.hasPos=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(a,b,f){return a+(b-a)*f};this.VIntX=function(a,b,f,h,g,k,l,m,n,o){g=(g-n)/(o-n);n=this.normal_cache;b[h]=k+g*this.delta;b[h+1]=l;b[h+2]=m;f[h]=this.lerp(n[a],n[a+3],g);f[h+1]=this.lerp(n[a+1],n[a+4],g);f[h+2]=this.lerp(n[a+2],n[a+5],g)};this.VIntY=function(a,b,f,h,g,k,l,m,n,o){g=(g-n)/(o-n);n=this.normal_cache;b[h]=k;b[h+1]=l+g*this.delta;b[h+
-2]=m;b=a+this.yd*3;f[h]=this.lerp(n[a],n[b],g);f[h+1]=this.lerp(n[a+1],n[b+1],g);f[h+2]=this.lerp(n[a+2],n[b+2],g)};this.VIntZ=function(a,b,f,h,g,k,l,m,n,o){g=(g-n)/(o-n);n=this.normal_cache;b[h]=k;b[h+1]=l;b[h+2]=m+g*this.delta;b=a+this.zd*3;f[h]=this.lerp(n[a],n[b],g);f[h+1]=this.lerp(n[a+1],n[b+1],g);f[h+2]=this.lerp(n[a+2],n[b+2],g)};this.compNorm=function(a){var b=a*3;this.normal_cache[b]==0&&(this.normal_cache[b]=this.field[a-1]-this.field[a+1],this.normal_cache[b+1]=this.field[a-this.yd]-this.field[a+
-this.yd],this.normal_cache[b+2]=this.field[a-this.zd]-this.field[a+this.zd])};this.polygonize=function(a,b,f,h,g,k){var l=h+1,m=h+this.yd,n=h+this.zd,o=l+this.yd,t=l+this.zd,u=h+this.yd+this.zd,v=l+this.yd+this.zd,y=0,p=this.field[h],z=this.field[l],x=this.field[m],w=this.field[o],A=this.field[n],D=this.field[t],B=this.field[u],E=this.field[v];p<g&&(y|=1);z<g&&(y|=2);x<g&&(y|=8);w<g&&(y|=4);A<g&&(y|=16);D<g&&(y|=32);B<g&&(y|=128);E<g&&(y|=64);var I=THREE.edgeTable[y];if(I==0)return 0;var G=this.delta,
-K=a+G,C=b+G,G=f+G;I&1&&(this.compNorm(h),this.compNorm(l),this.VIntX(h*3,this.vlist,this.nlist,0,g,a,b,f,p,z));I&2&&(this.compNorm(l),this.compNorm(o),this.VIntY(l*3,this.vlist,this.nlist,3,g,K,b,f,z,w));I&4&&(this.compNorm(m),this.compNorm(o),this.VIntX(m*3,this.vlist,this.nlist,6,g,a,C,f,x,w));I&8&&(this.compNorm(h),this.compNorm(m),this.VIntY(h*3,this.vlist,this.nlist,9,g,a,b,f,p,x));I&16&&(this.compNorm(n),this.compNorm(t),this.VIntX(n*3,this.vlist,this.nlist,12,g,a,b,G,A,D));I&32&&(this.compNorm(t),
-this.compNorm(v),this.VIntY(t*3,this.vlist,this.nlist,15,g,K,b,G,D,E));I&64&&(this.compNorm(u),this.compNorm(v),this.VIntX(u*3,this.vlist,this.nlist,18,g,a,C,G,B,E));I&128&&(this.compNorm(n),this.compNorm(u),this.VIntY(n*3,this.vlist,this.nlist,21,g,a,b,G,A,B));I&256&&(this.compNorm(h),this.compNorm(n),this.VIntZ(h*3,this.vlist,this.nlist,24,g,a,b,f,p,A));I&512&&(this.compNorm(l),this.compNorm(t),this.VIntZ(l*3,this.vlist,this.nlist,27,g,K,b,f,z,D));I&1024&&(this.compNorm(o),this.compNorm(v),this.VIntZ(o*
-3,this.vlist,this.nlist,30,g,K,C,f,w,E));I&2048&&(this.compNorm(m),this.compNorm(u),this.VIntZ(m*3,this.vlist,this.nlist,33,g,a,C,f,x,B));y<<=4;for(g=h=0;THREE.triTable[y+g]!=-1;)a=y+g,b=a+1,f=a+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[a],3*THREE.triTable[b],3*THREE.triTable[f],k),g+=3,h++;return h};this.posnormtriv=function(a,b,f,h,g,k){var l=this.count*3;this.positionArray[l]=a[f];this.positionArray[l+1]=a[f+1];this.positionArray[l+2]=a[f+2];this.positionArray[l+3]=a[h];this.positionArray[l+
-4]=a[h+1];this.positionArray[l+5]=a[h+2];this.positionArray[l+6]=a[g];this.positionArray[l+7]=a[g+1];this.positionArray[l+8]=a[g+2];this.normalArray[l]=b[f];this.normalArray[l+1]=b[f+1];this.normalArray[l+2]=b[f+2];this.normalArray[l+3]=b[h];this.normalArray[l+4]=b[h+1];this.normalArray[l+5]=b[h+2];this.normalArray[l+6]=b[g];this.normalArray[l+7]=b[g+1];this.normalArray[l+8]=b[g+2];this.hasNormal=this.hasPos=!0;this.count+=3;this.count>=this.maxCount-3&&k(this)};this.begin=function(){this.count=0;
-this.hasNormal=this.hasPos=!1};this.end=function(a){if(this.count!=0){for(var b=this.count*3;b<this.positionArray.length;b++)this.positionArray[b]=0;a(this)}};this.addBall=function(a,b,f,h,g){var k=this.size*Math.sqrt(h/g),l=f*this.size,m=b*this.size,n=a*this.size,o=Math.floor(l-k);o<1&&(o=1);l=Math.floor(l+k);l>this.size-1&&(l=this.size-1);var t=Math.floor(m-k);t<1&&(t=1);m=Math.floor(m+k);m>this.size-1&&(m=this.size-1);var u=Math.floor(n-k);u<1&&(u=1);k=Math.floor(n+k);k>this.size-1&&(k=this.size-
-1);for(var v,y,p,z,x,w;o<l;o++){n=this.size2*o;y=o/this.size-f;x=y*y;for(y=t;y<m;y++){p=n+this.size*y;v=y/this.size-b;w=v*v;for(v=u;v<k;v++)z=v/this.size-a,z=h/(1.0E-6+z*z+w+x)-g,z>0&&(this.field[p+v]+=z)}}};this.addPlaneX=function(a,b){var f,h,g,k,l,m=this.size,n=this.yd,o=this.zd,t=this.field,u=m*Math.sqrt(a/b);u>m&&(u=m);for(f=0;f<u;f++)if(h=f/m,h*=h,k=a/(1.0E-4+h)-b,k>0)for(h=0;h<m;h++){l=f+h*n;for(g=0;g<m;g++)t[o*g+l]+=k}};this.addPlaneY=function(a,b){var f,h,g,k,l,m,n=this.size,o=this.yd,t=
-this.zd,u=this.field,v=n*Math.sqrt(a/b);v>n&&(v=n);for(h=0;h<v;h++)if(f=h/n,f*=f,k=a/(1.0E-4+f)-b,k>0){l=h*o;for(f=0;f<n;f++){m=l+f;for(g=0;g<n;g++)u[t*g+m]+=k}}};this.addPlaneZ=function(a,b){var f,h,g,k,l,m;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(a/b);dist>size&&(dist=size);for(g=0;g<dist;g++)if(f=g/size,f*=f,k=a/(1.0E-4+f)-b,k>0){l=zd*g;for(h=0;h<size;h++){m=l+h*yd;for(f=0;f<size;f++)field[m+f]+=k}}};this.reset=function(){var a;for(a=0;a<this.size3;a++)this.normal_cache[a*
-3]=0,this.field[a]=0};this.render=function(a){this.begin();var b,f,h,g,k,l,m,n,o,t=this.size-2;for(g=1;g<t;g++){o=this.size2*g;m=(g-this.halfsize)/this.halfsize;for(h=1;h<t;h++){n=o+this.size*h;l=(h-this.halfsize)/this.halfsize;for(f=1;f<t;f++)k=(f-this.halfsize)/this.halfsize,b=n+f,this.polygonize(k,l,m,b,this.isolation,a)}}this.end(a)};this.generateGeometry=function(){var a=0,b=new THREE.Geometry,f=[];this.render(function(h){var g,k,l,m,n,o,t,u;for(g=0;g<h.count;g++)t=g*3,n=t+1,u=t+2,k=h.positionArray[t],
-l=h.positionArray[n],m=h.positionArray[u],o=new THREE.Vector3(k,l,m),k=h.normalArray[t],l=h.normalArray[n],m=h.normalArray[u],t=new THREE.Vector3(k,l,m),t.normalize(),n=new THREE.Vertex(o),b.vertices.push(n),f.push(t);nfaces=h.count/3;for(g=0;g<nfaces;g++)t=(a+g)*3,n=t+1,u=t+2,o=f[t],k=f[n],l=f[u],t=new THREE.Face3(t,n,u,[o,k,l]),b.faces.push(t);a+=nfaces;h.count=0});return b};this.init(a)};THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
+THREE.UTF8Loader.prototype.load=function(a){var c=new XMLHttpRequest,b=a.model,e=a.callback,g=a.scale!==void 0?a.scale:1,h=a.offsetX!==void 0?a.offsetX:0,f=a.offsetY!==void 0?a.offsetY:0,k=a.offsetZ!==void 0?a.offsetZ:0;c.onreadystatechange=function(){c.readyState==4?c.status==200||c.status==0?THREE.UTF8Loader.prototype.createModel(c.responseText,e,g,h,f,k):alert("Couldn't load ["+b+"] ["+c.status+"]"):c.readyState!=3&&c.readyState==2&&c.getResponseHeader("Content-Length")};c.open("GET",b,!0);c.send(null)};
+THREE.UTF8Loader.prototype.decompressMesh=function(a){var c=a.charCodeAt(0);c>=57344&&(c-=2048);c++;for(var b=new Float32Array(8*c),e=1,g=0;g<8;g++){for(var h=0,f=0;f<c;++f){var k=a.charCodeAt(f+e);h+=k>>1^-(k&1);b[8*f+g]=h}e+=c}c=a.length-e;h=new Uint16Array(c);for(g=f=0;g<c;g++)k=a.charCodeAt(g+e),h[g]=f-k,k==0&&f++;return[b,h]};
+THREE.UTF8Loader.prototype.createModel=function(a,c,b,e,g,h){var f=function(){var c=this;c.materials=[];THREE.Geometry.call(this);var f=THREE.UTF8Loader.prototype.decompressMesh(a),m=[],n=[];(function(a,f,l){for(var m,n,t,z=a.length;l<z;l+=f)m=a[l],n=a[l+1],t=a[l+2],m=m/16383*b,n=n/16383*b,t=t/16383*b,m+=e,n+=g,t+=h,c.vertices.push(new THREE.Vertex(new THREE.Vector3(m,n,t)))})(f[0],8,0);(function(a,b,c){for(var e,f,g=a.length;c<g;c+=b)e=a[c],f=a[c+1],e/=1023,f/=1023,n.push(e,1-f)})(f[0],8,3);(function(a,
+b,c){for(var e,f,g,h=a.length;c<h;c+=b)e=a[c],f=a[c+1],g=a[c+2],e=(e-512)/511,f=(f-512)/511,g=(g-512)/511,m.push(e,f,g)})(f[0],8,5);(function(a){var b,e,f,g,h,l,x,w,A,D=a.length;for(b=0;b<D;b+=3){e=a[b];f=a[b+1];g=a[b+2];h=c;w=e;A=f;l=g;x=e;var B=f,E=g,I=h.materials[0],G=m[B*3],K=m[B*3+1],B=m[B*3+2],C=m[E*3],F=m[E*3+1],E=m[E*3+2];x=new THREE.Vector3(m[x*3],m[x*3+1],m[x*3+2]);B=new THREE.Vector3(G,K,B);E=new THREE.Vector3(C,F,E);h.faces.push(new THREE.Face3(w,A,l,[x,B,E],null,I));h=n[e*2];e=n[e*2+
+1];l=n[f*2];x=n[f*2+1];w=n[g*2];A=n[g*2+1];g=c.faceVertexUvs[0];f=l;l=x;x=[];x.push(new THREE.UV(h,e));x.push(new THREE.UV(f,l));x.push(new THREE.UV(w,A));g.push(x)}})(f[1]);this.computeCentroids();this.computeFaceNormals()};f.prototype=new THREE.Geometry;f.prototype.constructor=f;c(new f)};
+THREE.Axes=function(){THREE.Object3D.call(this);var a=new THREE.Geometry;a.vertices.push(new THREE.Vertex);a.vertices.push(new THREE.Vertex(new THREE.Vector3(0,100,0)));var c=new THREE.CylinderGeometry(0,5,25,5,1),b=new THREE.Line(a,new THREE.LineBasicMaterial({color:16711680}));b.rotation.z=-Math.PI/2;this.add(b);b=new THREE.Mesh(c,new THREE.MeshBasicMaterial({color:16711680}));b.position.x=100;b.rotation.z=-Math.PI/2;this.add(b);b=new THREE.Line(a,new THREE.LineBasicMaterial({color:65280}));this.add(b);
+b=new THREE.Mesh(c,new THREE.MeshBasicMaterial({color:65280}));b.position.y=100;this.add(b);b=new THREE.Line(a,new THREE.LineBasicMaterial({color:255}));b.rotation.x=Math.PI/2;this.add(b);b=new THREE.Mesh(c,new THREE.MeshBasicMaterial({color:255}));b.position.z=100;b.rotation.x=Math.PI/2;this.add(b)};THREE.Axes.prototype=new THREE.Object3D;THREE.Axes.prototype.constructor=THREE.Axes;
+THREE.MarchingCubes=function(a,c){THREE.Object3D.call(this);this.materials=c instanceof Array?c:[c];this.init=function(a){this.isolation=80;this.size=a;this.size2=this.size*this.size;this.size3=this.size2*this.size;this.halfsize=this.size/2;this.delta=2/this.size;this.yd=this.size;this.zd=this.size2;this.field=new Float32Array(this.size3);this.normal_cache=new Float32Array(this.size3*3);this.vlist=new Float32Array(36);this.nlist=new Float32Array(36);this.firstDraw=!0;this.maxCount=4096;this.count=
+0;this.hasNormal=this.hasPos=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(a,c,g){return a+(c-a)*g};this.VIntX=function(a,c,g,h,f,k,l,m,n,o){f=(f-n)/(o-n);n=this.normal_cache;c[h]=k+f*this.delta;c[h+1]=l;c[h+2]=m;g[h]=this.lerp(n[a],n[a+3],f);g[h+1]=this.lerp(n[a+1],n[a+4],f);g[h+2]=this.lerp(n[a+2],n[a+5],f)};this.VIntY=function(a,c,g,h,f,k,l,m,n,o){f=(f-n)/(o-n);n=this.normal_cache;c[h]=k;c[h+1]=l+f*this.delta;c[h+
+2]=m;c=a+this.yd*3;g[h]=this.lerp(n[a],n[c],f);g[h+1]=this.lerp(n[a+1],n[c+1],f);g[h+2]=this.lerp(n[a+2],n[c+2],f)};this.VIntZ=function(a,c,g,h,f,k,l,m,n,o){f=(f-n)/(o-n);n=this.normal_cache;c[h]=k;c[h+1]=l;c[h+2]=m+f*this.delta;c=a+this.zd*3;g[h]=this.lerp(n[a],n[c],f);g[h+1]=this.lerp(n[a+1],n[c+1],f);g[h+2]=this.lerp(n[a+2],n[c+2],f)};this.compNorm=function(a){var c=a*3;this.normal_cache[c]==0&&(this.normal_cache[c]=this.field[a-1]-this.field[a+1],this.normal_cache[c+1]=this.field[a-this.yd]-this.field[a+
+this.yd],this.normal_cache[c+2]=this.field[a-this.zd]-this.field[a+this.zd])};this.polygonize=function(a,c,g,h,f,k){var l=h+1,m=h+this.yd,n=h+this.zd,o=l+this.yd,p=l+this.zd,u=h+this.yd+this.zd,v=l+this.yd+this.zd,y=0,t=this.field[h],z=this.field[l],x=this.field[m],w=this.field[o],A=this.field[n],D=this.field[p],B=this.field[u],E=this.field[v];t<f&&(y|=1);z<f&&(y|=2);x<f&&(y|=8);w<f&&(y|=4);A<f&&(y|=16);D<f&&(y|=32);B<f&&(y|=128);E<f&&(y|=64);var I=THREE.edgeTable[y];if(I==0)return 0;var G=this.delta,
+K=a+G,C=c+G,G=g+G;I&1&&(this.compNorm(h),this.compNorm(l),this.VIntX(h*3,this.vlist,this.nlist,0,f,a,c,g,t,z));I&2&&(this.compNorm(l),this.compNorm(o),this.VIntY(l*3,this.vlist,this.nlist,3,f,K,c,g,z,w));I&4&&(this.compNorm(m),this.compNorm(o),this.VIntX(m*3,this.vlist,this.nlist,6,f,a,C,g,x,w));I&8&&(this.compNorm(h),this.compNorm(m),this.VIntY(h*3,this.vlist,this.nlist,9,f,a,c,g,t,x));I&16&&(this.compNorm(n),this.compNorm(p),this.VIntX(n*3,this.vlist,this.nlist,12,f,a,c,G,A,D));I&32&&(this.compNorm(p),
+this.compNorm(v),this.VIntY(p*3,this.vlist,this.nlist,15,f,K,c,G,D,E));I&64&&(this.compNorm(u),this.compNorm(v),this.VIntX(u*3,this.vlist,this.nlist,18,f,a,C,G,B,E));I&128&&(this.compNorm(n),this.compNorm(u),this.VIntY(n*3,this.vlist,this.nlist,21,f,a,c,G,A,B));I&256&&(this.compNorm(h),this.compNorm(n),this.VIntZ(h*3,this.vlist,this.nlist,24,f,a,c,g,t,A));I&512&&(this.compNorm(l),this.compNorm(p),this.VIntZ(l*3,this.vlist,this.nlist,27,f,K,c,g,z,D));I&1024&&(this.compNorm(o),this.compNorm(v),this.VIntZ(o*
+3,this.vlist,this.nlist,30,f,K,C,g,w,E));I&2048&&(this.compNorm(m),this.compNorm(u),this.VIntZ(m*3,this.vlist,this.nlist,33,f,a,C,g,x,B));y<<=4;for(f=h=0;THREE.triTable[y+f]!=-1;)a=y+f,c=a+1,g=a+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[a],3*THREE.triTable[c],3*THREE.triTable[g],k),f+=3,h++;return h};this.posnormtriv=function(a,c,g,h,f,k){var l=this.count*3;this.positionArray[l]=a[g];this.positionArray[l+1]=a[g+1];this.positionArray[l+2]=a[g+2];this.positionArray[l+3]=a[h];this.positionArray[l+
+4]=a[h+1];this.positionArray[l+5]=a[h+2];this.positionArray[l+6]=a[f];this.positionArray[l+7]=a[f+1];this.positionArray[l+8]=a[f+2];this.normalArray[l]=c[g];this.normalArray[l+1]=c[g+1];this.normalArray[l+2]=c[g+2];this.normalArray[l+3]=c[h];this.normalArray[l+4]=c[h+1];this.normalArray[l+5]=c[h+2];this.normalArray[l+6]=c[f];this.normalArray[l+7]=c[f+1];this.normalArray[l+8]=c[f+2];this.hasNormal=this.hasPos=!0;this.count+=3;this.count>=this.maxCount-3&&k(this)};this.begin=function(){this.count=0;
+this.hasNormal=this.hasPos=!1};this.end=function(a){if(this.count!=0){for(var c=this.count*3;c<this.positionArray.length;c++)this.positionArray[c]=0;a(this)}};this.addBall=function(a,c,g,h,f){var k=this.size*Math.sqrt(h/f),l=g*this.size,m=c*this.size,n=a*this.size,o=Math.floor(l-k);o<1&&(o=1);l=Math.floor(l+k);l>this.size-1&&(l=this.size-1);var p=Math.floor(m-k);p<1&&(p=1);m=Math.floor(m+k);m>this.size-1&&(m=this.size-1);var u=Math.floor(n-k);u<1&&(u=1);k=Math.floor(n+k);k>this.size-1&&(k=this.size-
+1);for(var v,y,t,z,x,w;o<l;o++){n=this.size2*o;y=o/this.size-g;x=y*y;for(y=p;y<m;y++){t=n+this.size*y;v=y/this.size-c;w=v*v;for(v=u;v<k;v++)z=v/this.size-a,z=h/(1.0E-6+z*z+w+x)-f,z>0&&(this.field[t+v]+=z)}}};this.addPlaneX=function(a,c){var g,h,f,k,l,m=this.size,n=this.yd,o=this.zd,p=this.field,u=m*Math.sqrt(a/c);u>m&&(u=m);for(g=0;g<u;g++)if(h=g/m,h*=h,k=a/(1.0E-4+h)-c,k>0)for(h=0;h<m;h++){l=g+h*n;for(f=0;f<m;f++)p[o*f+l]+=k}};this.addPlaneY=function(a,c){var g,h,f,k,l,m,n=this.size,o=this.yd,p=
+this.zd,u=this.field,v=n*Math.sqrt(a/c);v>n&&(v=n);for(h=0;h<v;h++)if(g=h/n,g*=g,k=a/(1.0E-4+g)-c,k>0){l=h*o;for(g=0;g<n;g++){m=l+g;for(f=0;f<n;f++)u[p*f+m]+=k}}};this.addPlaneZ=function(a,c){var g,h,f,k,l,m;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(a/c);dist>size&&(dist=size);for(f=0;f<dist;f++)if(g=f/size,g*=g,k=a/(1.0E-4+g)-c,k>0){l=zd*f;for(h=0;h<size;h++){m=l+h*yd;for(g=0;g<size;g++)field[m+g]+=k}}};this.reset=function(){var a;for(a=0;a<this.size3;a++)this.normal_cache[a*
+3]=0,this.field[a]=0};this.render=function(a){this.begin();var c,g,h,f,k,l,m,n,o,p=this.size-2;for(f=1;f<p;f++){o=this.size2*f;m=(f-this.halfsize)/this.halfsize;for(h=1;h<p;h++){n=o+this.size*h;l=(h-this.halfsize)/this.halfsize;for(g=1;g<p;g++)k=(g-this.halfsize)/this.halfsize,c=n+g,this.polygonize(k,l,m,c,this.isolation,a)}}this.end(a)};this.generateGeometry=function(){var a=0,c=new THREE.Geometry,g=[];this.render(function(h){var f,k,l,m,n,o,p,u;for(f=0;f<h.count;f++)p=f*3,n=p+1,u=p+2,k=h.positionArray[p],
+l=h.positionArray[n],m=h.positionArray[u],o=new THREE.Vector3(k,l,m),k=h.normalArray[p],l=h.normalArray[n],m=h.normalArray[u],p=new THREE.Vector3(k,l,m),p.normalize(),n=new THREE.Vertex(o),c.vertices.push(n),g.push(p);nfaces=h.count/3;for(f=0;f<nfaces;f++)p=(a+f)*3,n=p+1,u=p+2,o=g[p],k=g[n],l=g[u],p=new THREE.Face3(p,n,u,[o,k,l]),c.faces.push(p);a+=nfaces;h.count=0});return c};this.init(a)};THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
 THREE.edgeTable=new Int32Array([0,265,515,778,1030,1295,1541,1804,2060,2309,2575,2822,3082,3331,3593,3840,400,153,915,666,1430,1183,1941,1692,2460,2197,2975,2710,3482,3219,3993,3728,560,825,51,314,1590,1855,1077,1340,2620,2869,2111,2358,3642,3891,3129,3376,928,681,419,170,1958,1711,1445,1196,2988,2725,2479,2214,4010,3747,3497,3232,1120,1385,1635,1898,102,367,613,876,3180,3429,3695,3942,2154,2403,2665,2912,1520,1273,2035,1786,502,255,1013,764,3580,3317,4095,3830,2554,2291,3065,2800,1616,1881,1107,
 1370,598,863,85,348,3676,3925,3167,3414,2650,2899,2137,2384,1984,1737,1475,1226,966,719,453,204,4044,3781,3535,3270,3018,2755,2505,2240,2240,2505,2755,3018,3270,3535,3781,4044,204,453,719,966,1226,1475,1737,1984,2384,2137,2899,2650,3414,3167,3925,3676,348,85,863,598,1370,1107,1881,1616,2800,3065,2291,2554,3830,4095,3317,3580,764,1013,255,502,1786,2035,1273,1520,2912,2665,2403,2154,3942,3695,3429,3180,876,613,367,102,1898,1635,1385,1120,3232,3497,3747,4010,2214,2479,2725,2988,1196,1445,1711,1958,170,
 419,681,928,3376,3129,3891,3642,2358,2111,2869,2620,1340,1077,1855,1590,314,51,825,560,3728,3993,3219,3482,2710,2975,2197,2460,1692,1941,1183,1430,666,915,153,400,3840,3593,3331,3082,2822,2575,2309,2060,1804,1541,1295,1030,778,515,265,0]);
@@ -338,25 +336,25 @@ THREE.triTable=new Int32Array([-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0
 2,11,1,5,1,11,-1,0,2,5,0,5,9,2,11,5,4,5,8,11,8,5,-1,9,4,5,2,11,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,5,10,3,5,2,3,4,5,3,8,4,-1,-1,-1,-1,5,10,2,5,2,4,4,2,0,-1,-1,-1,-1,-1,-1,-1,3,10,2,3,5,10,3,8,5,4,5,8,0,1,9,-1,5,10,2,5,2,4,1,9,2,9,4,2,-1,-1,-1,-1,8,4,5,8,5,3,3,5,1,-1,-1,-1,-1,-1,-1,-1,0,4,5,1,0,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8,4,5,8,5,3,9,0,5,0,3,5,-1,-1,-1,-1,9,4,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,11,7,4,9,11,9,10,11,-1,-1,-1,-1,-1,-1,-1,0,8,3,4,9,7,9,11,7,9,10,11,-1,-1,-1,-1,1,10,11,1,11,
 4,1,4,0,7,4,11,-1,-1,-1,-1,3,1,4,3,4,8,1,10,4,7,4,11,10,11,4,-1,4,11,7,9,11,4,9,2,11,9,1,2,-1,-1,-1,-1,9,7,4,9,11,7,9,1,11,2,11,1,0,8,3,-1,11,7,4,11,4,2,2,4,0,-1,-1,-1,-1,-1,-1,-1,11,7,4,11,4,2,8,3,4,3,2,4,-1,-1,-1,-1,2,9,10,2,7,9,2,3,7,7,4,9,-1,-1,-1,-1,9,10,7,9,7,4,10,2,7,8,7,0,2,0,7,-1,3,7,10,3,10,2,7,4,10,1,10,0,4,0,10,-1,1,10,2,8,7,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,9,1,4,1,7,7,1,3,-1,-1,-1,-1,-1,-1,-1,4,9,1,4,1,7,0,8,1,8,7,1,-1,-1,-1,-1,4,0,3,7,4,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,8,7,-1,-1,-1,
 -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,10,8,10,11,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,0,9,3,9,11,11,9,10,-1,-1,-1,-1,-1,-1,-1,0,1,10,0,10,8,8,10,11,-1,-1,-1,-1,-1,-1,-1,3,1,10,11,3,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,2,11,1,11,9,9,11,8,-1,-1,-1,-1,-1,-1,-1,3,0,9,3,9,11,1,2,9,2,11,9,-1,-1,-1,-1,0,2,11,8,0,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,2,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,3,8,2,8,10,10,8,9,-1,-1,-1,-1,-1,-1,-1,9,10,2,0,9,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,3,8,2,8,10,0,1,8,1,10,8,-1,-1,-1,-1,1,10,
-2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,3,8,9,1,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,9,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,3,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1]);THREE.PlaneCollider=function(a,b){this.point=a;this.normal=b};THREE.SphereCollider=function(a,b){this.center=a;this.radius=b;this.radiusSq=b*b};THREE.BoxCollider=function(a,b){this.min=a;this.max=b;this.dynamic=!0;this.normal=new THREE.Vector3};
-THREE.MeshCollider=function(a,b){this.mesh=a;this.box=b;this.numFaces=this.mesh.geometry.faces.length;this.normal=new THREE.Vector3};THREE.CollisionSystem=function(){this.collisionNormal=new THREE.Vector3;this.colliders=[];this.hits=[]};THREE.Collisions=new THREE.CollisionSystem;THREE.CollisionSystem.prototype.merge=function(a){Array.prototype.push.apply(this.colliders,a.colliders);Array.prototype.push.apply(this.hits,a.hits)};
-THREE.CollisionSystem.prototype.rayCastAll=function(a){a.direction.normalize();this.hits.length=0;var b,c,e,f,h=0;b=0;for(c=this.colliders.length;b<c;b++)if(f=this.colliders[b],e=this.rayCast(a,f),e<Number.MAX_VALUE)f.distance=e,e>h?this.hits.push(f):this.hits.unshift(f),h=e;return this.hits};
-THREE.CollisionSystem.prototype.rayCastNearest=function(a){var b=this.rayCastAll(a);if(b.length==0)return null;for(var c=0;b[c]instanceof THREE.MeshCollider;){var e=this.rayMesh(a,b[c]);if(e.dist<Number.MAX_VALUE){b[c].distance=e.dist;b[c].faceIndex=e.faceIndex;break}c++}if(c>b.length)return null;return b[c]};
-THREE.CollisionSystem.prototype.rayCast=function(a,b){if(b instanceof THREE.PlaneCollider)return this.rayPlane(a,b);else if(b instanceof THREE.SphereCollider)return this.raySphere(a,b);else if(b instanceof THREE.BoxCollider)return this.rayBox(a,b);else if(b instanceof THREE.MeshCollider&&b.box)return this.rayBox(a,b.box)};
-THREE.CollisionSystem.prototype.rayMesh=function(a,b){for(var c=this.makeRayLocal(a,b.mesh),e=Number.MAX_VALUE,f,h=0;h<b.numFaces;h++){var g=b.mesh.geometry.faces[h],k=b.mesh.geometry.vertices[g.a].position,l=b.mesh.geometry.vertices[g.b].position,m=b.mesh.geometry.vertices[g.c].position,n=g instanceof THREE.Face4?b.mesh.geometry.vertices[g.d].position:null;g instanceof THREE.Face3?(g=this.rayTriangle(c,k,l,m,e,this.collisionNormal,b.mesh),g<e&&(e=g,f=h,b.normal.copy(this.collisionNormal),b.normal.normalize())):
-g instanceof THREE.Face4&&(g=this.rayTriangle(c,k,l,n,e,this.collisionNormal,b.mesh),g<e&&(e=g,f=h,b.normal.copy(this.collisionNormal),b.normal.normalize()),g=this.rayTriangle(c,l,m,n,e,this.collisionNormal,b.mesh),g<e&&(e=g,f=h,b.normal.copy(this.collisionNormal),b.normal.normalize()))}return{dist:e,faceIndex:f}};
-THREE.CollisionSystem.prototype.rayTriangle=function(a,b,c,e,f,h,g){var k=THREE.CollisionSystem.__v1,l=THREE.CollisionSystem.__v2;h.set(0,0,0);k.sub(c,b);l.sub(e,c);h.cross(k,l);k=h.dot(a.direction);if(!(k<0))if(g.doubleSided||g.flipSided)h.multiplyScalar(-1),k*=-1;else return Number.MAX_VALUE;g=h.dot(b)-h.dot(a.origin);if(!(g<=0))return Number.MAX_VALUE;if(!(g>=k*f))return Number.MAX_VALUE;g/=k;k=THREE.CollisionSystem.__v3;k.copy(a.direction);k.multiplyScalar(g);k.addSelf(a.origin);Math.abs(h.x)>
-Math.abs(h.y)?Math.abs(h.x)>Math.abs(h.z)?(a=k.y-b.y,h=c.y-b.y,f=e.y-b.y,k=k.z-b.z,c=c.z-b.z,e=e.z-b.z):(a=k.x-b.x,h=c.x-b.x,f=e.x-b.x,k=k.y-b.y,c=c.y-b.y,e=e.y-b.y):Math.abs(h.y)>Math.abs(h.z)?(a=k.x-b.x,h=c.x-b.x,f=e.x-b.x,k=k.z-b.z,c=c.z-b.z,e=e.z-b.z):(a=k.x-b.x,h=c.x-b.x,f=e.x-b.x,k=k.y-b.y,c=c.y-b.y,e=e.y-b.y);b=h*e-c*f;if(b==0)return Number.MAX_VALUE;b=1/b;e=(a*e-k*f)*b;if(!(e>=0))return Number.MAX_VALUE;b*=h*k-c*a;if(!(b>=0))return Number.MAX_VALUE;if(!(1-e-b>=0))return Number.MAX_VALUE;return g};
-THREE.CollisionSystem.prototype.makeRayLocal=function(a,b){var c=THREE.CollisionSystem.__m;THREE.Matrix4.makeInvert(b.matrixWorld,c);var e=THREE.CollisionSystem.__r;e.origin.copy(a.origin);e.direction.copy(a.direction);c.multiplyVector3(e.origin);c.rotateAxis(e.direction);e.direction.normalize();return e};
-THREE.CollisionSystem.prototype.rayBox=function(a,b){var c;b.dynamic&&b.mesh&&b.mesh.matrixWorld?c=this.makeRayLocal(a,b.mesh):(c=THREE.CollisionSystem.__r,c.origin.copy(a.origin),c.direction.copy(a.direction));var e=0,f=0,h=0,g=0,k=0,l=0,m=!0;c.origin.x<b.min.x?(e=b.min.x-c.origin.x,e/=c.direction.x,m=!1,g=-1):c.origin.x>b.max.x&&(e=b.max.x-c.origin.x,e/=c.direction.x,m=!1,g=1);c.origin.y<b.min.y?(f=b.min.y-c.origin.y,f/=c.direction.y,m=!1,k=-1):c.origin.y>b.max.y&&(f=b.max.y-c.origin.y,f/=c.direction.y,
-m=!1,k=1);c.origin.z<b.min.z?(h=b.min.z-c.origin.z,h/=c.direction.z,m=!1,l=-1):c.origin.z>b.max.z&&(h=b.max.z-c.origin.z,h/=c.direction.z,m=!1,l=1);if(m)return-1;m=0;f>e&&(m=1,e=f);h>e&&(m=2,e=h);switch(m){case 0:k=c.origin.y+c.direction.y*e;if(k<b.min.y||k>b.max.y)return Number.MAX_VALUE;c=c.origin.z+c.direction.z*e;if(c<b.min.z||c>b.max.z)return Number.MAX_VALUE;b.normal.set(g,0,0);break;case 1:g=c.origin.x+c.direction.x*e;if(g<b.min.x||g>b.max.x)return Number.MAX_VALUE;c=c.origin.z+c.direction.z*
-e;if(c<b.min.z||c>b.max.z)return Number.MAX_VALUE;b.normal.set(0,k,0);break;case 2:g=c.origin.x+c.direction.x*e;if(g<b.min.x||g>b.max.x)return Number.MAX_VALUE;k=c.origin.y+c.direction.y*e;if(k<b.min.y||k>b.max.y)return Number.MAX_VALUE;b.normal.set(0,0,l)}return e};THREE.CollisionSystem.prototype.rayPlane=function(a,b){var c=a.direction.dot(b.normal),e=b.point.dot(b.normal);if(c<0)c=(e-a.origin.dot(b.normal))/c;else return Number.MAX_VALUE;return c>0?c:Number.MAX_VALUE};
-THREE.CollisionSystem.prototype.raySphere=function(a,b){var c=b.center.clone().subSelf(a.origin);if(c.lengthSq<b.radiusSq)return-1;var e=c.dot(a.direction.clone());if(e<=0)return Number.MAX_VALUE;c=b.radiusSq-(c.lengthSq()-e*e);if(c>=0)return Math.abs(e)-Math.sqrt(c);return Number.MAX_VALUE};THREE.CollisionSystem.__v1=new THREE.Vector3;THREE.CollisionSystem.__v2=new THREE.Vector3;THREE.CollisionSystem.__v3=new THREE.Vector3;THREE.CollisionSystem.__nr=new THREE.Vector3;THREE.CollisionSystem.__m=new THREE.Matrix4;
-THREE.CollisionSystem.__r=new THREE.Ray;THREE.CollisionUtils={};THREE.CollisionUtils.MeshOBB=function(a){a.geometry.computeBoundingBox();var b=a.geometry.boundingBox,c=new THREE.Vector3(b.x[0],b.y[0],b.z[0]),b=new THREE.Vector3(b.x[1],b.y[1],b.z[1]),c=new THREE.BoxCollider(c,b);c.mesh=a;return c};THREE.CollisionUtils.MeshAABB=function(a){var b=THREE.CollisionUtils.MeshOBB(a);b.min.addSelf(a.position);b.max.addSelf(a.position);b.dynamic=!1;return b};
+2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,3,8,9,1,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,9,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,3,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1]);THREE.PlaneCollider=function(a,c){this.point=a;this.normal=c};THREE.SphereCollider=function(a,c){this.center=a;this.radius=c;this.radiusSq=c*c};THREE.BoxCollider=function(a,c){this.min=a;this.max=c;this.dynamic=!0;this.normal=new THREE.Vector3};
+THREE.MeshCollider=function(a,c){this.mesh=a;this.box=c;this.numFaces=this.mesh.geometry.faces.length;this.normal=new THREE.Vector3};THREE.CollisionSystem=function(){this.collisionNormal=new THREE.Vector3;this.colliders=[];this.hits=[]};THREE.Collisions=new THREE.CollisionSystem;THREE.CollisionSystem.prototype.merge=function(a){Array.prototype.push.apply(this.colliders,a.colliders);Array.prototype.push.apply(this.hits,a.hits)};
+THREE.CollisionSystem.prototype.rayCastAll=function(a){a.direction.normalize();this.hits.length=0;var c,b,e,g,h=0;c=0;for(b=this.colliders.length;c<b;c++)if(g=this.colliders[c],e=this.rayCast(a,g),e<Number.MAX_VALUE)g.distance=e,e>h?this.hits.push(g):this.hits.unshift(g),h=e;return this.hits};
+THREE.CollisionSystem.prototype.rayCastNearest=function(a){var c=this.rayCastAll(a);if(c.length==0)return null;for(var b=0;c[b]instanceof THREE.MeshCollider;){var e=this.rayMesh(a,c[b]);if(e.dist<Number.MAX_VALUE){c[b].distance=e.dist;c[b].faceIndex=e.faceIndex;break}b++}if(b>c.length)return null;return c[b]};
+THREE.CollisionSystem.prototype.rayCast=function(a,c){if(c instanceof THREE.PlaneCollider)return this.rayPlane(a,c);else if(c instanceof THREE.SphereCollider)return this.raySphere(a,c);else if(c instanceof THREE.BoxCollider)return this.rayBox(a,c);else if(c instanceof THREE.MeshCollider&&c.box)return this.rayBox(a,c.box)};
+THREE.CollisionSystem.prototype.rayMesh=function(a,c){for(var b=this.makeRayLocal(a,c.mesh),e=Number.MAX_VALUE,g,h=0;h<c.numFaces;h++){var f=c.mesh.geometry.faces[h],k=c.mesh.geometry.vertices[f.a].position,l=c.mesh.geometry.vertices[f.b].position,m=c.mesh.geometry.vertices[f.c].position,n=f instanceof THREE.Face4?c.mesh.geometry.vertices[f.d].position:null;f instanceof THREE.Face3?(f=this.rayTriangle(b,k,l,m,e,this.collisionNormal,c.mesh),f<e&&(e=f,g=h,c.normal.copy(this.collisionNormal),c.normal.normalize())):
+f instanceof THREE.Face4&&(f=this.rayTriangle(b,k,l,n,e,this.collisionNormal,c.mesh),f<e&&(e=f,g=h,c.normal.copy(this.collisionNormal),c.normal.normalize()),f=this.rayTriangle(b,l,m,n,e,this.collisionNormal,c.mesh),f<e&&(e=f,g=h,c.normal.copy(this.collisionNormal),c.normal.normalize()))}return{dist:e,faceIndex:g}};
+THREE.CollisionSystem.prototype.rayTriangle=function(a,c,b,e,g,h,f){var k=THREE.CollisionSystem.__v1,l=THREE.CollisionSystem.__v2;h.set(0,0,0);k.sub(b,c);l.sub(e,b);h.cross(k,l);k=h.dot(a.direction);if(!(k<0))if(f.doubleSided||f.flipSided)h.multiplyScalar(-1),k*=-1;else return Number.MAX_VALUE;f=h.dot(c)-h.dot(a.origin);if(!(f<=0))return Number.MAX_VALUE;if(!(f>=k*g))return Number.MAX_VALUE;f/=k;k=THREE.CollisionSystem.__v3;k.copy(a.direction);k.multiplyScalar(f);k.addSelf(a.origin);Math.abs(h.x)>
+Math.abs(h.y)?Math.abs(h.x)>Math.abs(h.z)?(a=k.y-c.y,h=b.y-c.y,g=e.y-c.y,k=k.z-c.z,b=b.z-c.z,e=e.z-c.z):(a=k.x-c.x,h=b.x-c.x,g=e.x-c.x,k=k.y-c.y,b=b.y-c.y,e=e.y-c.y):Math.abs(h.y)>Math.abs(h.z)?(a=k.x-c.x,h=b.x-c.x,g=e.x-c.x,k=k.z-c.z,b=b.z-c.z,e=e.z-c.z):(a=k.x-c.x,h=b.x-c.x,g=e.x-c.x,k=k.y-c.y,b=b.y-c.y,e=e.y-c.y);c=h*e-b*g;if(c==0)return Number.MAX_VALUE;c=1/c;e=(a*e-k*g)*c;if(!(e>=0))return Number.MAX_VALUE;c*=h*k-b*a;if(!(c>=0))return Number.MAX_VALUE;if(!(1-e-c>=0))return Number.MAX_VALUE;return f};
+THREE.CollisionSystem.prototype.makeRayLocal=function(a,c){var b=THREE.CollisionSystem.__m;THREE.Matrix4.makeInvert(c.matrixWorld,b);var e=THREE.CollisionSystem.__r;e.origin.copy(a.origin);e.direction.copy(a.direction);b.multiplyVector3(e.origin);b.rotateAxis(e.direction);e.direction.normalize();return e};
+THREE.CollisionSystem.prototype.rayBox=function(a,c){var b;c.dynamic&&c.mesh&&c.mesh.matrixWorld?b=this.makeRayLocal(a,c.mesh):(b=THREE.CollisionSystem.__r,b.origin.copy(a.origin),b.direction.copy(a.direction));var e=0,g=0,h=0,f=0,k=0,l=0,m=!0;b.origin.x<c.min.x?(e=c.min.x-b.origin.x,e/=b.direction.x,m=!1,f=-1):b.origin.x>c.max.x&&(e=c.max.x-b.origin.x,e/=b.direction.x,m=!1,f=1);b.origin.y<c.min.y?(g=c.min.y-b.origin.y,g/=b.direction.y,m=!1,k=-1):b.origin.y>c.max.y&&(g=c.max.y-b.origin.y,g/=b.direction.y,
+m=!1,k=1);b.origin.z<c.min.z?(h=c.min.z-b.origin.z,h/=b.direction.z,m=!1,l=-1):b.origin.z>c.max.z&&(h=c.max.z-b.origin.z,h/=b.direction.z,m=!1,l=1);if(m)return-1;m=0;g>e&&(m=1,e=g);h>e&&(m=2,e=h);switch(m){case 0:k=b.origin.y+b.direction.y*e;if(k<c.min.y||k>c.max.y)return Number.MAX_VALUE;b=b.origin.z+b.direction.z*e;if(b<c.min.z||b>c.max.z)return Number.MAX_VALUE;c.normal.set(f,0,0);break;case 1:f=b.origin.x+b.direction.x*e;if(f<c.min.x||f>c.max.x)return Number.MAX_VALUE;b=b.origin.z+b.direction.z*
+e;if(b<c.min.z||b>c.max.z)return Number.MAX_VALUE;c.normal.set(0,k,0);break;case 2:f=b.origin.x+b.direction.x*e;if(f<c.min.x||f>c.max.x)return Number.MAX_VALUE;k=b.origin.y+b.direction.y*e;if(k<c.min.y||k>c.max.y)return Number.MAX_VALUE;c.normal.set(0,0,l)}return e};THREE.CollisionSystem.prototype.rayPlane=function(a,c){var b=a.direction.dot(c.normal),e=c.point.dot(c.normal);if(b<0)b=(e-a.origin.dot(c.normal))/b;else return Number.MAX_VALUE;return b>0?b:Number.MAX_VALUE};
+THREE.CollisionSystem.prototype.raySphere=function(a,c){var b=c.center.clone().subSelf(a.origin);if(b.lengthSq<c.radiusSq)return-1;var e=b.dot(a.direction.clone());if(e<=0)return Number.MAX_VALUE;b=c.radiusSq-(b.lengthSq()-e*e);if(b>=0)return Math.abs(e)-Math.sqrt(b);return Number.MAX_VALUE};THREE.CollisionSystem.__v1=new THREE.Vector3;THREE.CollisionSystem.__v2=new THREE.Vector3;THREE.CollisionSystem.__v3=new THREE.Vector3;THREE.CollisionSystem.__nr=new THREE.Vector3;THREE.CollisionSystem.__m=new THREE.Matrix4;
+THREE.CollisionSystem.__r=new THREE.Ray;THREE.CollisionUtils={};THREE.CollisionUtils.MeshOBB=function(a){a.geometry.computeBoundingBox();var c=a.geometry.boundingBox,b=new THREE.Vector3(c.x[0],c.y[0],c.z[0]),c=new THREE.Vector3(c.x[1],c.y[1],c.z[1]),b=new THREE.BoxCollider(b,c);b.mesh=a;return b};THREE.CollisionUtils.MeshAABB=function(a){var c=THREE.CollisionUtils.MeshOBB(a);c.min.addSelf(a.position);c.max.addSelf(a.position);c.dynamic=!1;return c};
 THREE.CollisionUtils.MeshColliderWBox=function(a){return new THREE.MeshCollider(a,THREE.CollisionUtils.MeshOBB(a))};
-if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);var b=this,c=this.setSize,e=this.render,f=new THREE.PerspectiveCamera,h=new THREE.PerspectiveCamera,g=new THREE.Matrix4,k=new THREE.Matrix4,l,m,n;f.matrixAutoUpdate=h.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},o=new THREE.WebGLRenderTarget(512,512,a),t=new THREE.WebGLRenderTarget(512,512,a),u=new THREE.PerspectiveCamera(53,1,1,1E4);u.position.z=
-2;_material=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:o},mapRight:{type:"t",value:1,texture:t}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D mapLeft;\nuniform sampler2D mapRight;\nvarying vec2 vUv;\nvoid main() {\nvec4 colorL, colorR;\nvec2 uv = vUv;\ncolorL = texture2D( mapLeft, uv );\ncolorR = texture2D( mapRight, uv );\ngl_FragColor = vec4( colorL.g * 0.7 + colorL.b * 0.3, colorR.g, colorR.b, colorL.a + colorR.a ) * 1.1;\n}"});
-var v=new THREE.Scene;v.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));this.setSize=function(a,e){c.call(b,a,e);o.width=a;o.height=e;t.width=a;t.height=e};this.render=function(a,c){c.update(null,!0);if(l!==c.aspect||m!==c.near||n!==c.fov){l=c.aspect;m=c.near;n=c.fov;var z=c.projectionMatrix.clone(),x=125/30*0.5,w=x*m/125,A=m*Math.tan(n*Math.PI/360),D;g.n14=x;k.n14=-x;x=-A*l+w;D=A*l+w;z.n11=2*m/(D-x);z.n13=(D+x)/(D-x);f.projectionMatrix=z.clone();x=-A*l-w;D=A*l-w;z.n11=2*m/(D-x);z.n13=
-(D+x)/(D-x);h.projectionMatrix=z.clone()}f.matrix=c.matrixWorld.clone().multiplySelf(k);f.update(null,!0);f.position.copy(c.position);f.near=m;f.far=c.far;e.call(b,a,f,o,!0);h.matrix=c.matrixWorld.clone().multiplySelf(g);h.update(null,!0);h.position.copy(c.position);h.near=m;h.far=c.far;e.call(b,a,h,t,!0);e.call(b,v,u)}};
-if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoClear=!1;var b=this,c=this.setSize,e=this.render,f,h,g=new THREE.PerspectiveCamera;g.target=new THREE.Vector3(0,0,0);var k=new THREE.PerspectiveCamera;k.target=new THREE.Vector3(0,0,0);b.separation=10;if(a&&a.separation!==void 0)b.separation=a.separation;this.setSize=function(a,e){c.call(b,a,e);f=a/2;h=e};this.render=function(a,c){this.clear();g.fov=c.fov;g.aspect=0.5*c.aspect;g.near=c.near;g.far=
-c.far;g.updateProjectionMatrix();g.position.copy(c.position);g.target.copy(c.target);g.translateX(b.separation);g.lookAt(g.target);k.projectionMatrix=g.projectionMatrix;k.position.copy(c.position);k.target.copy(c.target);k.translateX(-b.separation);k.lookAt(k.target);this.setViewport(0,0,f,h);e.call(b,a,g);this.setViewport(f,0,f,h);e.call(b,a,k,!1)}};
+if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);var c=this,b=this.setSize,e=this.render,g=new THREE.PerspectiveCamera,h=new THREE.PerspectiveCamera,f=new THREE.Matrix4,k=new THREE.Matrix4,l,m,n;g.matrixAutoUpdate=h.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},o=new THREE.WebGLRenderTarget(512,512,a),p=new THREE.WebGLRenderTarget(512,512,a),u=new THREE.PerspectiveCamera(53,1,1,1E4);u.position.z=
+2;_material=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:o},mapRight:{type:"t",value:1,texture:p}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D mapLeft;\nuniform sampler2D mapRight;\nvarying vec2 vUv;\nvoid main() {\nvec4 colorL, colorR;\nvec2 uv = vUv;\ncolorL = texture2D( mapLeft, uv );\ncolorR = texture2D( mapRight, uv );\ngl_FragColor = vec4( colorL.g * 0.7 + colorL.b * 0.3, colorR.g, colorR.b, colorL.a + colorR.a ) * 1.1;\n}"});
+var v=new THREE.Scene;v.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));this.setSize=function(a,e){b.call(c,a,e);o.width=a;o.height=e;p.width=a;p.height=e};this.render=function(a,b){b.update(null,!0);if(l!==b.aspect||m!==b.near||n!==b.fov){l=b.aspect;m=b.near;n=b.fov;var z=b.projectionMatrix.clone(),x=125/30*0.5,w=x*m/125,A=m*Math.tan(n*Math.PI/360),D;f.n14=x;k.n14=-x;x=-A*l+w;D=A*l+w;z.n11=2*m/(D-x);z.n13=(D+x)/(D-x);g.projectionMatrix=z.clone();x=-A*l-w;D=A*l-w;z.n11=2*m/(D-x);z.n13=
+(D+x)/(D-x);h.projectionMatrix=z.clone()}g.matrix=b.matrixWorld.clone().multiplySelf(k);g.update(null,!0);g.position.copy(b.position);g.near=m;g.far=b.far;e.call(c,a,g,o,!0);h.matrix=b.matrixWorld.clone().multiplySelf(f);h.update(null,!0);h.position.copy(b.position);h.near=m;h.far=b.far;e.call(c,a,h,p,!0);e.call(c,v,u)}};
+if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoClear=!1;var c=this,b=this.setSize,e=this.render,g,h,f=new THREE.PerspectiveCamera;f.target=new THREE.Vector3(0,0,0);var k=new THREE.PerspectiveCamera;k.target=new THREE.Vector3(0,0,0);c.separation=10;if(a&&a.separation!==void 0)c.separation=a.separation;this.setSize=function(a,e){b.call(c,a,e);g=a/2;h=e};this.render=function(a,b){this.clear();f.fov=b.fov;f.aspect=0.5*b.aspect;f.near=b.near;f.far=
+b.far;f.updateProjectionMatrix();f.position.copy(b.position);f.target.copy(b.target);f.translateX(c.separation);f.lookAt(f.target);k.projectionMatrix=f.projectionMatrix;k.position.copy(b.position);k.target.copy(b.target);k.translateX(-c.separation);k.lookAt(k.target);this.setViewport(0,0,g,h);e.call(c,a,f);this.setViewport(g,0,g,h);e.call(c,a,k,!1)}};

+ 74 - 79
build/custom/ThreeSVG.js

@@ -14,82 +14,81 @@ Math.abs(b)>1.0E-5?(this.x=Math.atan2(-a.n23/b,a.n33/b),this.z=Math.atan2(-a.n12
 THREE.Vector4.prototype={constructor:THREE.Vector4,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w!==void 0?a.w:1},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;this.w=a.w+b.w;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-
 b.z;this.w=a.w-b.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this},divideScalar:function(a){a?(this.x/=a,this.y/=a,this.z/=a,this.w/=a):(this.z=this.y=this.x=0,this.w=1);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z+this.w*a.w},lengthSq:function(){return this.dot(this)},length:function(){return Math.sqrt(this.lengthSq())},
 normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)},lerpSelf:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;this.w+=(a.w-this.w)*b;return this}};THREE.Ray=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3};
-THREE.Ray.prototype={constructor:THREE.Ray,intersectScene:function(a){return this.intersectObjects(a.objects)},intersectObjects:function(a){var b,c,d=[];b=0;for(c=a.length;b<c;b++)Array.prototype.push.apply(d,this.intersectObject(a[b]));d.sort(function(a,b){return a.distance-b.distance});return d},intersectObject:function(a){function b(a,b,c){var d;d=c.clone().subSelf(a).dot(b);if(d<=0)return null;a=a.clone().addSelf(b.clone().multiplyScalar(d));return c.distanceTo(a)}function c(a,b,c,d){var d=d.clone().subSelf(b),
+THREE.Ray.prototype={constructor:THREE.Ray,intersectScene:function(a){return this.intersectObjects(a.children)},intersectObjects:function(a){var b,c,d=[];b=0;for(c=a.length;b<c;b++)Array.prototype.push.apply(d,this.intersectObject(a[b]));d.sort(function(a,b){return a.distance-b.distance});return d},intersectObject:function(a){function b(a,b,c){var d;d=c.clone().subSelf(a).dot(b);if(d<=0)return null;a=a.clone().addSelf(b.clone().multiplyScalar(d));return c.distanceTo(a)}function c(a,b,c,d){var d=d.clone().subSelf(b),
 c=c.clone().subSelf(b),f=a.clone().subSelf(b),a=d.dot(d),b=d.dot(c),d=d.dot(f),e=c.dot(c),c=c.dot(f),f=1/(a*e-b*b),e=(e*d-b*c)*f,a=(a*c-b*d)*f;return e>0&&a>0&&e+a<1}for(var d,f=[],e=0,g=a.children.length;e<g;e++)Array.prototype.push.apply(f,this.intersectObject(a.children[e]));if(a instanceof THREE.Particle){e=b(this.origin,this.direction,a.matrixWorld.getPosition());if(e==null||e>a.scale.x)return[];d={distance:e,point:a.position,face:null,object:a};f.push(d)}else if(a instanceof THREE.Mesh){e=b(this.origin,
-this.direction,a.matrixWorld.getPosition());if(e==null||e>a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)))return f;for(var i,k,h,j,m,n,l,p,q=a.geometry,v=q.vertices,e=0,g=q.faces.length;e<g;e++)if(d=q.faces[e],l=this.origin.clone(),p=this.direction.clone(),j=a.matrixWorld,i=j.multiplyVector3(d.centroid.clone()).subSelf(l),n=i.dot(p),!(n<=0)&&(i=j.multiplyVector3(v[d.a].position.clone()),k=j.multiplyVector3(v[d.b].position.clone()),h=j.multiplyVector3(v[d.c].position.clone()),
-j=d instanceof THREE.Face4?j.multiplyVector3(v[d.d].position.clone()):null,m=a.matrixRotationWorld.multiplyVector3(d.normal.clone()),n=p.dot(m),a.doubleSided||(a.flipSided?n>0:n<0)))if(n=m.dot((new THREE.Vector3).sub(i,l))/n,l=l.addSelf(p.multiplyScalar(n)),d instanceof THREE.Face3)c(l,i,k,h)&&(d={distance:this.origin.distanceTo(l),point:l,face:d,object:a},f.push(d));else if(d instanceof THREE.Face4&&(c(l,i,k,j)||c(l,k,h,j)))d={distance:this.origin.distanceTo(l),point:l,face:d,object:a},f.push(d)}return f}};
-THREE.Rectangle=function(){function a(){e=d-b;g=f-c}var b,c,d,f,e,g,i=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return e};this.getHeight=function(){return g};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return f};this.set=function(e,g,j,m){i=!1;b=e;c=g;d=j;f=m;a()};this.addPoint=function(e,g){i?(i=!1,b=e,c=g,d=e,f=g):(b=b<e?b:e,c=c<g?c:g,d=d>e?d:e,f=f>g?f:g);a()};this.add3Points=
-function(e,g,j,m,n,l){i?(i=!1,b=e<j?e<n?e:n:j<n?j:n,c=g<m?g<l?g:l:m<l?m:l,d=e>j?e>n?e:n:j>n?j:n,f=g>m?g>l?g:l:m>l?m:l):(b=e<j?e<n?e<b?e:b:n<b?n:b:j<n?j<b?j:b:n<b?n:b,c=g<m?g<l?g<c?g:c:l<c?l:c:m<l?m<c?m:c:l<c?l:c,d=e>j?e>n?e>d?e:d:n>d?n:d:j>n?j>d?j:d:n>d?n:d,f=g>m?g>l?g>f?g:f:l>f?l:f:m>l?m>f?m:f:l>f?l:f);a()};this.addRectangle=function(e){i?(i=!1,b=e.getLeft(),c=e.getTop(),d=e.getRight(),f=e.getBottom()):(b=b<e.getLeft()?b:e.getLeft(),c=c<e.getTop()?c:e.getTop(),d=d>e.getRight()?d:e.getRight(),f=f>
-e.getBottom()?f:e.getBottom());a()};this.inflate=function(e){b-=e;c-=e;d+=e;f+=e;a()};this.minSelf=function(e){b=b>e.getLeft()?b:e.getLeft();c=c>e.getTop()?c:e.getTop();d=d<e.getRight()?d:e.getRight();f=f<e.getBottom()?f:e.getBottom();a()};this.intersects=function(a){return Math.min(d,a.getRight())-Math.max(b,a.getLeft())>=0&&Math.min(f,a.getBottom())-Math.max(c,a.getTop())>=0};this.empty=function(){i=!0;f=d=c=b=0;a()};this.isEmpty=function(){return i}};THREE.Matrix3=function(){this.m=[]};
+this.direction,a.matrixWorld.getPosition());if(e==null||e>a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)))return f;var h,k,n,j,i,m,l,q,p=a.geometry,s=p.vertices;a.matrixRotationWorld.extractRotation(a.matrixWorld);e=0;for(g=p.faces.length;e<g;e++)if(d=p.faces[e],l=this.origin.clone(),q=this.direction.clone(),j=a.matrixWorld,h=j.multiplyVector3(d.centroid.clone()).subSelf(l),m=h.dot(q),!(m<=0)&&(h=j.multiplyVector3(s[d.a].position.clone()),k=j.multiplyVector3(s[d.b].position.clone()),
+n=j.multiplyVector3(s[d.c].position.clone()),j=d instanceof THREE.Face4?j.multiplyVector3(s[d.d].position.clone()):null,i=a.matrixRotationWorld.multiplyVector3(d.normal.clone()),m=q.dot(i),a.doubleSided||(a.flipSided?m>0:m<0)))if(m=i.dot((new THREE.Vector3).sub(h,l))/m,l=l.addSelf(q.multiplyScalar(m)),d instanceof THREE.Face3)c(l,h,k,n)&&(d={distance:this.origin.distanceTo(l),point:l,face:d,object:a},f.push(d));else if(d instanceof THREE.Face4&&(c(l,h,k,j)||c(l,k,n,j)))d={distance:this.origin.distanceTo(l),
+point:l,face:d,object:a},f.push(d)}return f}};
+THREE.Rectangle=function(){function a(){e=d-b;g=f-c}var b,c,d,f,e,g,h=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return e};this.getHeight=function(){return g};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return f};this.set=function(e,g,j,i){h=!1;b=e;c=g;d=j;f=i;a()};this.addPoint=function(e,g){h?(h=!1,b=e,c=g,d=e,f=g):(b=b<e?b:e,c=c<g?c:g,d=d>e?d:e,f=f>g?f:g);a()};this.add3Points=
+function(e,g,j,i,m,l){h?(h=!1,b=e<j?e<m?e:m:j<m?j:m,c=g<i?g<l?g:l:i<l?i:l,d=e>j?e>m?e:m:j>m?j:m,f=g>i?g>l?g:l:i>l?i:l):(b=e<j?e<m?e<b?e:b:m<b?m:b:j<m?j<b?j:b:m<b?m:b,c=g<i?g<l?g<c?g:c:l<c?l:c:i<l?i<c?i:c:l<c?l:c,d=e>j?e>m?e>d?e:d:m>d?m:d:j>m?j>d?j:d:m>d?m:d,f=g>i?g>l?g>f?g:f:l>f?l:f:i>l?i>f?i:f:l>f?l:f);a()};this.addRectangle=function(e){h?(h=!1,b=e.getLeft(),c=e.getTop(),d=e.getRight(),f=e.getBottom()):(b=b<e.getLeft()?b:e.getLeft(),c=c<e.getTop()?c:e.getTop(),d=d>e.getRight()?d:e.getRight(),f=f>
+e.getBottom()?f:e.getBottom());a()};this.inflate=function(e){b-=e;c-=e;d+=e;f+=e;a()};this.minSelf=function(e){b=b>e.getLeft()?b:e.getLeft();c=c>e.getTop()?c:e.getTop();d=d<e.getRight()?d:e.getRight();f=f<e.getBottom()?f:e.getBottom();a()};this.intersects=function(a){return Math.min(d,a.getRight())-Math.max(b,a.getLeft())>=0&&Math.min(f,a.getBottom())-Math.max(c,a.getTop())>=0};this.empty=function(){h=!0;f=d=c=b=0;a()};this.isEmpty=function(){return h}};THREE.Matrix3=function(){this.m=[]};
 THREE.Matrix3.prototype={constructor:THREE.Matrix3,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,f,e,g,i,k,h,j,m,n,l,p,q){this.set(a!==void 0?a:1,b||0,c||0,d||0,f||0,e!==void 0?e:1,g||0,i||0,k||0,h||0,j!==void 0?j:1,m||0,n||0,l||0,p||0,q!==void 0?q:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
-THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,f,e,g,i,k,h,j,m,n,l,p,q){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=f;this.n22=e;this.n23=g;this.n24=i;this.n31=k;this.n32=h;this.n33=j;this.n34=m;this.n41=n;this.n42=l;this.n43=p;this.n44=q;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,f=THREE.Matrix4.__v2,e=THREE.Matrix4.__v3;e.sub(a,b).normalize();if(e.length()===0)e.z=1;d.cross(c,e).normalize();d.length()===0&&(e.x+=1.0E-4,d.cross(c,e).normalize());f.cross(e,d).normalize();this.n11=d.x;this.n12=f.x;this.n13=e.x;this.n21=d.y;this.n22=f.y;this.n23=e.y;this.n31=d.z;this.n32=f.z;this.n33=e.z;return this},multiplyVector3:function(a){var b=a.x,c=a.y,d=a.z,f=1/(this.n41*b+this.n42*c+this.n43*d+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*d+this.n14)*f;
-a.y=(this.n21*b+this.n22*c+this.n23*d+this.n24)*f;a.z=(this.n31*b+this.n32*c+this.n33*d+this.n34)*f;return a},multiplyVector4:function(a){var b=a.x,c=a.y,d=a.z,f=a.w;a.x=this.n11*b+this.n12*c+this.n13*d+this.n14*f;a.y=this.n21*b+this.n22*c+this.n23*d+this.n24*f;a.z=this.n31*b+this.n32*c+this.n33*d+this.n34*f;a.w=this.n41*b+this.n42*c+this.n43*d+this.n44*f;return a},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,f=a.n13,e=a.n14,g=a.n21,i=a.n22,k=a.n23,h=a.n24,j=a.n31,m=a.n32,n=a.n33,l=a.n34,p=a.n41,q=a.n42,v=a.n43,u=a.n44,C=b.n11,K=b.n12,
-t=b.n13,w=b.n14,z=b.n21,y=b.n22,o=b.n23,E=b.n24,D=b.n31,F=b.n32,G=b.n33,A=b.n34,M=b.n41,N=b.n42,O=b.n43,S=b.n44;this.n11=c*C+d*z+f*D+e*M;this.n12=c*K+d*y+f*F+e*N;this.n13=c*t+d*o+f*G+e*O;this.n14=c*w+d*E+f*A+e*S;this.n21=g*C+i*z+k*D+h*M;this.n22=g*K+i*y+k*F+h*N;this.n23=g*t+i*o+k*G+h*O;this.n24=g*w+i*E+k*A+h*S;this.n31=j*C+m*z+n*D+l*M;this.n32=j*K+m*y+n*F+l*N;this.n33=j*t+m*o+n*G+l*O;this.n34=j*w+m*E+n*A+l*S;this.n41=p*C+q*z+v*D+u*M;this.n42=p*K+q*y+v*F+u*N;this.n43=p*t+q*o+v*G+u*O;this.n44=p*w+q*
-E+v*A+u*S;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,f=this.n21,e=this.n22,g=this.n23,i=this.n24,k=this.n31,h=this.n32,j=this.n33,m=this.n34,n=this.n41,l=this.n42,p=this.n43,q=this.n44;return d*g*h*n-c*i*h*n-d*e*j*n+b*i*j*n+c*e*m*n-b*g*m*n-d*g*k*l+c*i*k*l+d*f*j*l-a*i*j*l-c*f*m*l+a*g*m*l+d*e*k*p-b*i*k*p-d*f*h*p+a*i*h*p+b*f*m*p-a*e*m*p-c*e*k*q+b*g*k*q+c*f*h*q-a*g*h*q-b*f*j*q+a*e*j*q},
-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),f=1-c,e=a.x,g=a.y,i=a.z,k=f*e,h=f*g;this.set(k*e+c,k*g-d*i,k*i+d*g,0,k*g+d*i,h*g+c,h*i-d*e,0,k*i-d*g,h*i+d*e,f*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},getPosition:function(){if(!this.position)this.position=new THREE.Vector3;this.position.set(this.n14,this.n24,this.n34);return this.position},getColumnX:function(){if(!this.columnX)this.columnX=
-new THREE.Vector3;this.columnX.set(this.n11,this.n21,this.n31);return this.columnX},getColumnY:function(){if(!this.columnY)this.columnY=new THREE.Vector3;this.columnY.set(this.n12,this.n22,this.n32);return this.columnY},getColumnZ:function(){if(!this.columnZ)this.columnZ=new THREE.Vector3;this.columnZ.set(this.n13,this.n23,this.n33);return this.columnZ},setRotationFromEuler:function(a,b){var c=a.x,d=a.y,f=a.z,e=Math.cos(c),c=Math.sin(c),g=Math.cos(d),d=Math.sin(d),i=Math.cos(f),f=Math.sin(f);switch(b){case "YXZ":var k=
-g*i,h=g*f,j=d*i,m=d*f;this.n11=k+m*c;this.n12=j*c-h;this.n13=e*d;this.n21=e*f;this.n22=e*i;this.n23=-c;this.n31=h*c-j;this.n32=m+k*c;this.n33=e*g;break;case "ZXY":k=g*i;h=g*f;j=d*i;m=d*f;this.n11=k-m*c;this.n12=-e*f;this.n13=j+h*c;this.n21=h+j*c;this.n22=e*i;this.n23=m-k*c;this.n31=-e*d;this.n32=c;this.n33=e*g;break;case "ZYX":k=e*i;h=e*f;j=c*i;m=c*f;this.n11=g*i;this.n12=j*d-h;this.n13=k*d+m;this.n21=g*f;this.n22=m*d+k;this.n23=h*d-j;this.n31=-d;this.n32=c*g;this.n33=e*g;break;case "YZX":k=e*g;h=
-e*d;j=c*g;m=c*d;this.n11=g*i;this.n12=m-k*f;this.n13=j*f+h;this.n21=f;this.n22=e*i;this.n23=-c*i;this.n31=-d*i;this.n32=h*f+j;this.n33=k-m*f;break;case "XZY":k=e*g;h=e*d;j=c*g;m=c*d;this.n11=g*i;this.n12=-f;this.n13=d*i;this.n21=k*f+m;this.n22=e*i;this.n23=h*f-j;this.n31=j*f-h;this.n32=c*i;this.n33=m*f+k;break;default:k=e*i,h=e*f,j=c*i,m=c*f,this.n11=g*i,this.n12=-g*f,this.n13=d,this.n21=h+j*d,this.n22=k-m*d,this.n23=-c*g,this.n31=m-k*d,this.n32=j+h*d,this.n33=e*g}return this},setRotationFromQuaternion:function(a){var b=
-a.x,c=a.y,d=a.z,f=a.w,e=b+b,g=c+c,i=d+d,a=b*e,k=b*g;b*=i;var h=c*g;c*=i;d*=i;e*=f;g*=f;f*=i;this.n11=1-(h+d);this.n12=k-f;this.n13=b+g;this.n21=k+f;this.n22=1-(a+d);this.n23=c-e;this.n31=b-g;this.n32=c+e;this.n33=1-(a+h);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},compose:function(a,b,c){var d=THREE.Matrix4.__m1,f=THREE.Matrix4.__m2;
-d.identity();d.setRotationFromQuaternion(b);f.setScale(c.x,c.y,c.z);this.multiply(d,f);this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},decompose:function(a,b,c){var d=THREE.Matrix4.__v1,f=THREE.Matrix4.__v2,e=THREE.Matrix4.__v3;d.set(this.n11,this.n21,this.n31);f.set(this.n12,this.n22,this.n32);e.set(this.n13,this.n23,this.n33);a=a instanceof THREE.Vector3?a:new THREE.Vector3;b=b instanceof THREE.Quaternion?b:new THREE.Quaternion;c=c instanceof THREE.Vector3?c:new THREE.Vector3;c.x=d.length();
-c.y=f.length();c.z=e.length();a.x=this.n14;a.y=this.n24;a.z=this.n34;d=THREE.Matrix4.__m1;d.copy(this);d.n11/=c.x;d.n21/=c.x;d.n31/=c.x;d.n12/=c.y;d.n22/=c.y;d.n32/=c.y;d.n13/=c.z;d.n23/=c.z;d.n33/=c.z;b.setFromRotationMatrix(d);return[a,b,c]},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,f=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*f;this.n23=
-a.n23*f;this.n33=a.n33*f}};
-THREE.Matrix4.makeInvert=function(a,b){var c=a.n11,d=a.n12,f=a.n13,e=a.n14,g=a.n21,i=a.n22,k=a.n23,h=a.n24,j=a.n31,m=a.n32,n=a.n33,l=a.n34,p=a.n41,q=a.n42,v=a.n43,u=a.n44;b===void 0&&(b=new THREE.Matrix4);b.n11=k*l*q-h*n*q+h*m*v-i*l*v-k*m*u+i*n*u;b.n12=e*n*q-f*l*q-e*m*v+d*l*v+f*m*u-d*n*u;b.n13=f*h*q-e*k*q+e*i*v-d*h*v-f*i*u+d*k*u;b.n14=e*k*m-f*h*m-e*i*n+d*h*n+f*i*l-d*k*l;b.n21=h*n*p-k*l*p-h*j*v+g*l*v+k*j*u-g*n*u;b.n22=f*l*p-e*n*p+e*j*v-c*l*v-f*j*u+c*n*u;b.n23=e*k*p-f*h*p-e*g*v+c*h*v+f*g*u-c*k*u;b.n24=
-f*h*j-e*k*j+e*g*n-c*h*n-f*g*l+c*k*l;b.n31=i*l*p-h*m*p+h*j*q-g*l*q-i*j*u+g*m*u;b.n32=e*m*p-d*l*p-e*j*q+c*l*q+d*j*u-c*m*u;b.n33=f*h*p-e*i*p+e*g*q-c*h*q-d*g*u+c*i*u;b.n34=e*i*j-d*h*j-e*g*m+c*h*m+d*g*l-c*i*l;b.n41=k*m*p-i*n*p-k*j*q+g*n*q+i*j*v-g*m*v;b.n42=d*n*p-f*m*p+f*j*q-c*n*q-d*j*v+c*m*v;b.n43=f*i*p-d*k*p-f*g*q+c*k*q+d*g*v-c*i*v;b.n44=d*k*j-f*i*j+f*g*m-c*k*m-d*g*n+c*i*n;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,f=-a.n33*a.n21+a.n31*a.n23,e=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,k=-a.n32*a.n11+a.n31*a.n12,h=a.n23*a.n12-a.n22*a.n13,j=-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*h;a==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");a=1/a;c[0]=a*d;c[1]=a*f;c[2]=a*e;c[3]=a*g;c[4]=a*i;c[5]=a*k;c[6]=a*h;c[7]=a*j;c[8]=a*m;return b};
+THREE.Matrix4=function(a,b,c,d,f,e,g,h,k,n,j,i,m,l,q,p){this.set(a!==void 0?a:1,b||0,c||0,d||0,f||0,e!==void 0?e:1,g||0,h||0,k||0,n||0,j!==void 0?j:1,i||0,m||0,l||0,q||0,p!==void 0?p:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
+THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,f,e,g,h,k,n,j,i,m,l,q,p){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=f;this.n22=e;this.n23=g;this.n24=h;this.n31=k;this.n32=n;this.n33=j;this.n34=i;this.n41=m;this.n42=l;this.n43=q;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 d=THREE.Matrix4.__v1,f=THREE.Matrix4.__v2,e=THREE.Matrix4.__v3;e.sub(a,b).normalize();if(e.length()===0)e.z=1;d.cross(c,e).normalize();d.length()===0&&(e.x+=1.0E-4,d.cross(c,e).normalize());f.cross(e,d).normalize();this.n11=d.x;this.n12=f.x;this.n13=e.x;this.n21=d.y;this.n22=f.y;this.n23=e.y;this.n31=d.z;this.n32=f.z;this.n33=e.z;return this},multiply:function(a,b){var c=a.n11,d=a.n12,f=a.n13,e=a.n14,g=a.n21,h=a.n22,k=a.n23,n=a.n24,j=a.n31,i=a.n32,m=a.n33,l=a.n34,q=a.n41,p=a.n42,s=a.n43,
+v=a.n44,x=b.n11,o=b.n12,C=b.n13,F=b.n14,r=b.n21,B=b.n22,H=b.n23,D=b.n24,y=b.n31,L=b.n32,G=b.n33,I=b.n34,w=b.n41,z=b.n42,J=b.n43,u=b.n44;this.n11=c*x+d*r+f*y+e*w;this.n12=c*o+d*B+f*L+e*z;this.n13=c*C+d*H+f*G+e*J;this.n14=c*F+d*D+f*I+e*u;this.n21=g*x+h*r+k*y+n*w;this.n22=g*o+h*B+k*L+n*z;this.n23=g*C+h*H+k*G+n*J;this.n24=g*F+h*D+k*I+n*u;this.n31=j*x+i*r+m*y+l*w;this.n32=j*o+i*B+m*L+l*z;this.n33=j*C+i*H+m*G+l*J;this.n34=j*F+i*D+m*I+l*u;this.n41=q*x+p*r+s*y+v*w;this.n42=q*o+p*B+s*L+v*z;this.n43=q*C+p*
+H+s*G+v*J;this.n44=q*F+p*D+s*I+v*u;return this},multiplySelf:function(a){return this.multiply(this,a)},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},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},multiplyVector3:function(a){var b=a.x,c=a.y,d=a.z,f=1/(this.n41*b+this.n42*c+this.n43*d+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*d+this.n14)*f;a.y=(this.n21*b+this.n22*c+this.n23*d+this.n24)*f;a.z=(this.n31*b+this.n32*c+this.n33*d+this.n34)*f;return a},multiplyVector4:function(a){var b=a.x,c=a.y,d=a.z,f=a.w;a.x=this.n11*b+this.n12*c+this.n13*d+this.n14*f;a.y=this.n21*b+this.n22*
+c+this.n23*d+this.n24*f;a.z=this.n31*b+this.n32*c+this.n33*d+this.n34*f;a.w=this.n41*b+this.n42*c+this.n43*d+this.n44*f;return a},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},determinant:function(){var a=this.n11,b=this.n12,c=this.n13,d=this.n14,f=this.n21,e=this.n22,g=this.n23,h=this.n24,k=this.n31,n=this.n32,j=this.n33,i=this.n34,m=this.n41,l=this.n42,q=this.n43,p=this.n44;return d*g*n*m-c*h*n*m-d*e*j*m+b*h*j*m+c*e*i*m-b*g*i*m-d*g*k*l+c*h*k*l+d*f*j*l-a*h*j*l-c*f*i*l+a*g*i*l+d*e*k*q-b*h*k*q-d*f*n*q+a*h*n*q+b*f*i*q-a*e*i*q-c*e*k*p+b*g*k*p+c*f*n*p-a*g*n*p-b*f*j*p+a*e*j*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),f=1-c,e=a.x,g=a.y,h=a.z,k=f*e,n=f*g;this.set(k*e+c,k*g-d*h,k*h+d*g,0,k*g+d*h,n*g+c,n*h-d*e,0,k*h-d*g,n*h+d*e,f*h*h+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},getPosition:function(){return THREE.Matrix4.__v1.set(this.n14,this.n24,this.n34)},getColumnX:function(){return THREE.Matrix4.__v1.set(this.n11,this.n21,this.n31)},getColumnY:function(){return THREE.Matrix4.__v1.set(this.n12,
+this.n22,this.n32)},getColumnZ:function(){return THREE.Matrix4.__v1.set(this.n13,this.n23,this.n33)},getInverse:function(a){var b=a.n11,c=a.n12,d=a.n13,f=a.n14,e=a.n21,g=a.n22,h=a.n23,k=a.n24,n=a.n31,j=a.n32,i=a.n33,m=a.n34,l=a.n41,q=a.n42,p=a.n43,s=a.n44;this.n11=h*m*q-k*i*q+k*j*p-g*m*p-h*j*s+g*i*s;this.n12=f*i*q-d*m*q-f*j*p+c*m*p+d*j*s-c*i*s;this.n13=d*k*q-f*h*q+f*g*p-c*k*p-d*g*s+c*h*s;this.n14=f*h*j-d*k*j-f*g*i+c*k*i+d*g*m-c*h*m;this.n21=k*i*l-h*m*l-k*n*p+e*m*p+h*n*s-e*i*s;this.n22=d*m*l-f*i*l+
+f*n*p-b*m*p-d*n*s+b*i*s;this.n23=f*h*l-d*k*l-f*e*p+b*k*p+d*e*s-b*h*s;this.n24=d*k*n-f*h*n+f*e*i-b*k*i-d*e*m+b*h*m;this.n31=g*m*l-k*j*l+k*n*q-e*m*q-g*n*s+e*j*s;this.n32=f*j*l-c*m*l-f*n*q+b*m*q+c*n*s-b*j*s;this.n33=d*k*l-f*g*l+f*e*q-b*k*q-c*e*s+b*g*s;this.n34=f*g*n-c*k*n-f*e*j+b*k*j+c*e*m-b*g*m;this.n41=h*j*l-g*i*l-h*n*q+e*i*q+g*n*p-e*j*p;this.n42=c*i*l-d*j*l+d*n*q-b*i*q-c*n*p+b*j*p;this.n43=d*g*l-c*h*l-d*e*q+b*h*q+c*e*p-b*g*p;this.n44=c*h*n-d*g*n+d*e*j-b*h*j-c*e*i+b*g*i;this.multiplyScalar(1/a.determinant());
+return this},setRotationFromEuler:function(a,b){var c=a.x,d=a.y,f=a.z,e=Math.cos(c),c=Math.sin(c),g=Math.cos(d),d=Math.sin(d),h=Math.cos(f),f=Math.sin(f);switch(b){case "YXZ":var k=g*h,n=g*f,j=d*h,i=d*f;this.n11=k+i*c;this.n12=j*c-n;this.n13=e*d;this.n21=e*f;this.n22=e*h;this.n23=-c;this.n31=n*c-j;this.n32=i+k*c;this.n33=e*g;break;case "ZXY":k=g*h;n=g*f;j=d*h;i=d*f;this.n11=k-i*c;this.n12=-e*f;this.n13=j+n*c;this.n21=n+j*c;this.n22=e*h;this.n23=i-k*c;this.n31=-e*d;this.n32=c;this.n33=e*g;break;case "ZYX":k=
+e*h;n=e*f;j=c*h;i=c*f;this.n11=g*h;this.n12=j*d-n;this.n13=k*d+i;this.n21=g*f;this.n22=i*d+k;this.n23=n*d-j;this.n31=-d;this.n32=c*g;this.n33=e*g;break;case "YZX":k=e*g;n=e*d;j=c*g;i=c*d;this.n11=g*h;this.n12=i-k*f;this.n13=j*f+n;this.n21=f;this.n22=e*h;this.n23=-c*h;this.n31=-d*h;this.n32=n*f+j;this.n33=k-i*f;break;case "XZY":k=e*g;n=e*d;j=c*g;i=c*d;this.n11=g*h;this.n12=-f;this.n13=d*h;this.n21=k*f+i;this.n22=e*h;this.n23=n*f-j;this.n31=j*f-n;this.n32=c*h;this.n33=i*f+k;break;default:k=e*h,n=e*
+f,j=c*h,i=c*f,this.n11=g*h,this.n12=-g*f,this.n13=d,this.n21=n+j*d,this.n22=k-i*d,this.n23=-c*g,this.n31=i-k*d,this.n32=j+n*d,this.n33=e*g}return this},setRotationFromQuaternion:function(a){var b=a.x,c=a.y,d=a.z,f=a.w,e=b+b,g=c+c,h=d+d,a=b*e,k=b*g;b*=h;var n=c*g;c*=h;d*=h;e*=f;g*=f;f*=h;this.n11=1-(n+d);this.n12=k-f;this.n13=b+g;this.n21=k+f;this.n22=1-(a+d);this.n23=c-e;this.n31=b-g;this.n32=c+e;this.n33=1-(a+n);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},compose:function(a,b,c){var d=THREE.Matrix4.__m1,f=THREE.Matrix4.__m2;d.identity();d.setRotationFromQuaternion(b);f.setScale(c.x,c.y,c.z);this.multiply(d,f);this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},decompose:function(a,b,c){var d=THREE.Matrix4.__v1,f=THREE.Matrix4.__v2,e=THREE.Matrix4.__v3;d.set(this.n11,this.n21,this.n31);f.set(this.n12,this.n22,this.n32);e.set(this.n13,
+this.n23,this.n33);a=a instanceof THREE.Vector3?a:new THREE.Vector3;b=b instanceof THREE.Quaternion?b:new THREE.Quaternion;c=c instanceof THREE.Vector3?c:new THREE.Vector3;c.x=d.length();c.y=f.length();c.z=e.length();a.x=this.n14;a.y=this.n24;a.z=this.n34;d=THREE.Matrix4.__m1;d.copy(this);d.n11/=c.x;d.n21/=c.x;d.n31/=c.x;d.n12/=c.y;d.n22/=c.y;d.n32/=c.y;d.n13/=c.z;d.n23/=c.z;d.n33/=c.z;b.setFromRotationMatrix(d);return[a,b,c]},extractPosition:function(a){this.n14=a.n14;this.n24=a.n24;this.n34=a.n34;
+return this},extractRotation:function(a){var b=THREE.Matrix4.__v1,c=1/b.set(a.n11,a.n21,a.n31).length(),d=1/b.set(a.n12,a.n22,a.n32).length(),b=1/b.set(a.n13,a.n23,a.n33).length();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*b;this.n23=a.n23*b;this.n33=a.n33*b;return this}};
+THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,d=a.n33*a.n22-a.n32*a.n23,f=-a.n33*a.n21+a.n31*a.n23,e=a.n32*a.n21-a.n31*a.n22,g=-a.n33*a.n12+a.n32*a.n13,h=a.n33*a.n11-a.n31*a.n13,k=-a.n32*a.n11+a.n31*a.n12,n=a.n23*a.n12-a.n22*a.n13,j=-a.n23*a.n11+a.n21*a.n13,i=a.n22*a.n11-a.n21*a.n12,a=a.n11*d+a.n21*g+a.n31*n;a==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");a=1/a;c[0]=a*d;c[1]=a*f;c[2]=a*e;c[3]=a*g;c[4]=a*h;c[5]=a*k;c[6]=a*n;c[7]=a*j;c[8]=a*i;return b};
 THREE.Matrix4.makeFrustum=function(a,b,c,d,f,e){var g;g=new THREE.Matrix4;g.n11=2*f/(b-a);g.n12=0;g.n13=(b+a)/(b-a);g.n14=0;g.n21=0;g.n22=2*f/(d-c);g.n23=(d+c)/(d-c);g.n24=0;g.n31=0;g.n32=0;g.n33=-(e+f)/(e-f);g.n34=-2*e*f/(e-f);g.n41=0;g.n42=0;g.n43=-1;g.n44=0;return g};THREE.Matrix4.makePerspective=function(a,b,c,d){var f,a=c*Math.tan(a*Math.PI/360);f=-a;return THREE.Matrix4.makeFrustum(f*b,a*b,f,a,c,d)};
-THREE.Matrix4.makeOrtho=function(a,b,c,d,f,e){var g,i,k,h;g=new THREE.Matrix4;i=b-a;k=c-d;h=e-f;g.n11=2/i;g.n12=0;g.n13=0;g.n14=-((b+a)/i);g.n21=0;g.n22=2/k;g.n23=0;g.n24=-((c+d)/k);g.n31=0;g.n32=0;g.n33=-2/h;g.n34=-((e+f)/h);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.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
+THREE.Matrix4.makeOrtho=function(a,b,c,d,f,e){var g,h,k,n;g=new THREE.Matrix4;h=b-a;k=c-d;n=e-f;g.n11=2/h;g.n12=0;g.n13=0;g.n14=-((b+a)/h);g.n21=0;g.n22=2/k;g.n23=0;g.n24=-((c+d)/k);g.n31=0;g.n32=0;g.n33=-2/n;g.n34=-((e+f)/n);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.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
 THREE.Object3D=function(){this.name="";this.id=THREE.Object3DCount++;this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder="XYZ";this.scale=new THREE.Vector3(1,1,1);this.flipSided=this.doubleSided=this.dynamic=!1;this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=
 !0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=!0;this.receiveShadow=this.castShadow=!1;this.frustumCulled=!0;this._vector=new THREE.Vector3};
 THREE.Object3D.prototype={constructor:THREE.Object3D,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(a,this.position,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},add:function(a){if(this.children.indexOf(a)===
--1){a.parent!==void 0&&a.parent.remove(a);a.parent=this;this.children.push(a);for(var b=this;b.parent!==void 0;)b=b.parent;b!==void 0&&b instanceof THREE.Scene&&b.addChildRecurse(a)}},remove:function(a){var b=this,c=this.children.indexOf(a);if(c!==-1){a.parent=void 0;for(this.children.splice(c,1);b.parent!==void 0;)b=b.parent;b!==void 0&&b instanceof THREE.Scene&&b.removeChildRecurse(a)}},getChildByName:function(a,b){var c,d,f;c=0;for(d=this.children.length;c<d;c++){f=this.children[c];if(f.name===
-a)return f;if(b&&(f=f.getChildByName(a,b),f!==void 0))return f}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder);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){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;for(var a=0,d=this.children.length;a<d;a++)this.children[a].update(this.matrixWorld,b,c)},addChild:function(a){console.warn("DEPRECATED: Object3D.addChild() is now Object3D.add().");this.add(a)},removeChild:function(a){console.warn("DEPRECATED: Object3D.removeChild() is now Object3D.remove().");
-this.remove(a)}};THREE.Object3DCount=0;
-THREE.Projector=function(){function a(){var a=k[i]=k[i]||new THREE.RenderableVertex;i++;return a}function b(a,b){return b.z-a.z}function c(a,b){var c=0,d=1,e=a.z+a.w,f=b.z+b.w,g=-a.z+a.w,i=-b.z+b.w;return e>=0&&f>=0&&g>=0&&i>=0?!0:e<0&&f<0||g<0&&i<0?!1:(e<0?c=Math.max(c,e/(e-f)):f<0&&(d=Math.min(d,e/(e-f))),g<0?c=Math.max(c,g/(g-i)):i<0&&(d=Math.min(d,g/(g-i))),d<c?!1:(a.lerpSelf(b,c),b.lerpSelf(a,1-d),!0))}var d,f,e=[],g,i,k=[],h,j,m=[],n,l=[],p,q,v=[],u,C,K=[],t=[],w=[],z=new THREE.Vector4,y=new THREE.Vector4,
-o=new THREE.Matrix4,E=new THREE.Matrix4,D=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],F=new THREE.Vector4,G=new THREE.Vector4;this.projectVector=function(a,b){o.multiply(b.projectionMatrix,b.matrixWorldInverse);o.multiplyVector3(a);return a};this.unprojectVector=function(a,b){o.multiply(b.matrixWorld,THREE.Matrix4.makeInvert(b.projectionMatrix));o.multiplyVector3(a);return a};this.pickingRay=function(a,b){var c;a.z=-1;c=new THREE.Vector3(a.x,
-a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.subSelf(a).normalize();return new THREE.Ray(a,c)};this.projectObjects=function(a,c,g){var i,k;f=t.length=0;i=a.objects;a=0;for(c=i.length;a<c;a++){k=i[a];var h;if(!(h=!k.visible))if(h=k instanceof THREE.Mesh)if(h=k.frustumCulled){a:{h=void 0;for(var j=k.matrixWorld,m=-k.geometry.boundingSphere.radius*Math.max(k.scale.x,Math.max(k.scale.y,k.scale.z)),l=0;l<6;l++)if(h=D[l].x*j.n14+D[l].y*j.n24+D[l].z*j.n34+D[l].w,h<=m){h=!1;break a}h=!0}h=
-!h}if(!h)h=e[f]=e[f]||new THREE.RenderableObject,f++,d=h,z.copy(k.position),o.multiplyVector3(z),d.object=k,d.z=z.z,t.push(d)}g&&t.sort(b);return t};this.projectScene=function(d,e,f){var t=e.near,S=e.far,z,P,I,L,r,J,H,s,x,B,Q,U,W,X,R,V,T;C=q=n=j=w.length=0;e.matrixAutoUpdate&&e.update(void 0,!0);d.update(void 0,!1,e);o.multiply(e.projectionMatrix,e.matrixWorldInverse);D[0].set(o.n41-o.n11,o.n42-o.n12,o.n43-o.n13,o.n44-o.n14);D[1].set(o.n41+o.n11,o.n42+o.n12,o.n43+o.n13,o.n44+o.n14);D[2].set(o.n41+
-o.n21,o.n42+o.n22,o.n43+o.n23,o.n44+o.n24);D[3].set(o.n41-o.n21,o.n42-o.n22,o.n43-o.n23,o.n44-o.n24);D[4].set(o.n41-o.n31,o.n42-o.n32,o.n43-o.n33,o.n44-o.n34);D[5].set(o.n41+o.n31,o.n42+o.n32,o.n43+o.n33,o.n44+o.n34);for(z=0;z<6;z++)x=D[z],x.divideScalar(Math.sqrt(x.x*x.x+x.y*x.y+x.z*x.z));x=this.projectObjects(d,e,!0);d=0;for(z=x.length;d<z;d++)if(B=x[d].object,B.visible)if(Q=B.matrixWorld,U=B.matrixRotationWorld,W=B.materials,X=B.overdraw,i=0,B instanceof THREE.Mesh){R=B.geometry;L=R.vertices;V=
-R.faces;R=R.faceVertexUvs;P=0;for(I=L.length;P<I;P++)g=a(),g.positionWorld.copy(L[P].position),Q.multiplyVector3(g.positionWorld),g.positionScreen.copy(g.positionWorld),o.multiplyVector4(g.positionScreen),g.positionScreen.x/=g.positionScreen.w,g.positionScreen.y/=g.positionScreen.w,g.visible=g.positionScreen.z>t&&g.positionScreen.z<S;L=0;for(P=V.length;L<P;L++){I=V[L];if(I instanceof THREE.Face3)if(r=k[I.a],J=k[I.b],H=k[I.c],r.visible&&J.visible&&H.visible&&(B.doubleSided||B.flipSided!=(H.positionScreen.x-
-r.positionScreen.x)*(J.positionScreen.y-r.positionScreen.y)-(H.positionScreen.y-r.positionScreen.y)*(J.positionScreen.x-r.positionScreen.x)<0))s=m[j]=m[j]||new THREE.RenderableFace3,j++,h=s,h.v1.copy(r),h.v2.copy(J),h.v3.copy(H);else continue;else if(I instanceof THREE.Face4)if(r=k[I.a],J=k[I.b],H=k[I.c],s=k[I.d],r.visible&&J.visible&&H.visible&&s.visible&&(B.doubleSided||B.flipSided!=((s.positionScreen.x-r.positionScreen.x)*(J.positionScreen.y-r.positionScreen.y)-(s.positionScreen.y-r.positionScreen.y)*
-(J.positionScreen.x-r.positionScreen.x)<0||(J.positionScreen.x-H.positionScreen.x)*(s.positionScreen.y-H.positionScreen.y)-(J.positionScreen.y-H.positionScreen.y)*(s.positionScreen.x-H.positionScreen.x)<0)))T=l[n]=l[n]||new THREE.RenderableFace4,n++,h=T,h.v1.copy(r),h.v2.copy(J),h.v3.copy(H),h.v4.copy(s);else continue;h.normalWorld.copy(I.normal);U.multiplyVector3(h.normalWorld);h.centroidWorld.copy(I.centroid);Q.multiplyVector3(h.centroidWorld);h.centroidScreen.copy(h.centroidWorld);o.multiplyVector3(h.centroidScreen);
-H=I.vertexNormals;r=0;for(J=H.length;r<J;r++)s=h.vertexNormalsWorld[r],s.copy(H[r]),U.multiplyVector3(s);r=0;for(J=R.length;r<J;r++)if(T=R[r][L]){H=0;for(s=T.length;H<s;H++)h.uvs[r][H]=T[H]}h.meshMaterials=W;h.faceMaterials=I.materials;h.overdraw=X;h.z=h.centroidScreen.z;w.push(h)}}else if(B instanceof THREE.Line){E.multiply(o,Q);L=B.geometry.vertices;r=a();r.positionScreen.copy(L[0].position);E.multiplyVector4(r.positionScreen);P=1;for(I=L.length;P<I;P++)if(r=a(),r.positionScreen.copy(L[P].position),
-E.multiplyVector4(r.positionScreen),J=k[i-2],F.copy(r.positionScreen),G.copy(J.positionScreen),c(F,G))F.multiplyScalar(1/F.w),G.multiplyScalar(1/G.w),Q=v[q]=v[q]||new THREE.RenderableLine,q++,p=Q,p.v1.positionScreen.copy(F),p.v2.positionScreen.copy(G),p.z=Math.max(F.z,G.z),p.materials=B.materials,w.push(p)}else if(B instanceof THREE.Particle&&(y.set(B.matrixWorld.n14,B.matrixWorld.n24,B.matrixWorld.n34,1),o.multiplyVector4(y),y.z/=y.w,y.z>0&&y.z<1))Q=K[C]=K[C]||new THREE.RenderableParticle,C++,u=
-Q,u.x=y.x/y.w,u.y=y.y/y.w,u.z=y.z,u.rotation=B.rotation.z,u.scale.x=B.scale.x*Math.abs(u.x-(y.x+e.projectionMatrix.n11)/(y.w+e.projectionMatrix.n14)),u.scale.y=B.scale.y*Math.abs(u.y-(y.y+e.projectionMatrix.n22)/(y.w+e.projectionMatrix.n24)),u.materials=B.materials,w.push(u);f&&w.sort(b);return w}};THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,d!==void 0?d:1)};
-THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this},setFromEuler:function(a){var b=Math.PI/360,c=a.x*b,d=a.y*b,f=a.z*b,a=Math.cos(d),d=Math.sin(d),b=Math.cos(-f),f=Math.sin(-f),e=Math.cos(c),c=Math.sin(c),g=a*b,i=d*f;this.w=g*e-i*c;this.x=g*c+i*e;this.y=d*b*e+a*f*c;this.z=a*f*e-d*b*c;return this},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);
+-1)a.parent!==void 0&&a.parent.remove(a),a.parent=this,this.children.push(a)},remove:function(a){var b=this.children.indexOf(a);if(b!==-1)a.parent=void 0,this.children.splice(b,1)},getChildByName:function(a,b){var c,d,f;c=0;for(d=this.children.length;c<d;c++){f=this.children[c];if(f.name===a)return f;if(b&&(f=f.getChildByName(a,b),f!==void 0))return f}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,
+this.eulerOrder);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},updateMatrixWorld:function(a){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||a)this.parent?this.matrixWorld.multiply(this.parent.matrixWorld,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,a=!0;for(var b=0,c=this.children.length;b<
+c;b++)this.children[b].updateMatrixWorld(a)}};THREE.Object3DCount=0;
+THREE.Projector=function(){function a(){var a=e[f]=e[f]||new THREE.RenderableVertex;f++;return a}function b(a,b){return b.z-a.z}function c(a,b){var c=0,d=1,e=a.z+a.w,f=b.z+b.w,g=-a.z+a.w,h=-b.z+b.w;return e>=0&&f>=0&&g>=0&&h>=0?!0:e<0&&f<0||g<0&&h<0?!1:(e<0?c=Math.max(c,e/(e-f)):f<0&&(d=Math.min(d,e/(e-f))),g<0?c=Math.max(c,g/(g-h)):h<0&&(d=Math.min(d,g/(g-h))),d<c?!1:(a.lerpSelf(b,c),b.lerpSelf(a,1-d),!0))}var d,f,e=[],g,h,k=[],n,j=[],i,m,l=[],q,p,s=[],v={objects:[],lights:[],elements:[]};new THREE.Vector3;
+var x=new THREE.Vector4,o=new THREE.Matrix4,C=new THREE.Matrix4,F=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],r=new THREE.Vector4,B=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);o.multiply(b.projectionMatrix,b.matrixWorldInverse);o.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);o.multiply(b.matrixWorld,b.projectionMatrixInverse);
+o.multiplyVector3(a);return a};this.pickingRay=function(a,b){var c;a.z=-1;c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.subSelf(a).normalize();return new THREE.Ray(a,c)};this.projectGraph=function(a){v.objects.length=0;v.lights.length=0;var b=function(a){if(a.visible!=!1){var c;if(!(c=a instanceof THREE.Particle))if(!(c=a instanceof THREE.Line))if(c=a instanceof THREE.Mesh)if(!(c=!a.frustumCulled))a:{for(var d=a.matrixWorld,e=-a.geometry.boundingSphere.radius*
+Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)),f=0;f<6;f++)if(c=F[f].x*d.n14+F[f].y*d.n24+F[f].z*d.n34+F[f].w,c<=e){c=!1;break a}c=!0}c?v.objects.push(a):a instanceof THREE.Light&&v.lights.push(a);c=0;for(d=a.children.length;c<d;c++)b(a.children[c])}};b(a);return v};this.projectScene=function(H,D,y){var L=D.near,G=D.far,I,w,z,J,u,M,K,N,A,P,O,R,S,t,E,Q;p=m=n=h=0;v.elements.length=0;D.parent==null&&(console.warn("Camera is not on the Scene. Adding it..."),H.add(D));H.updateMatrixWorld();D.matrixWorldInverse.getInverse(D.matrixWorld);
+o.multiply(D.projectionMatrix,D.matrixWorldInverse);F[0].set(o.n41-o.n11,o.n42-o.n12,o.n43-o.n13,o.n44-o.n14);F[1].set(o.n41+o.n11,o.n42+o.n12,o.n43+o.n13,o.n44+o.n14);F[2].set(o.n41+o.n21,o.n42+o.n22,o.n43+o.n23,o.n44+o.n24);F[3].set(o.n41-o.n21,o.n42-o.n22,o.n43-o.n23,o.n44-o.n24);F[4].set(o.n41-o.n31,o.n42-o.n32,o.n43-o.n33,o.n44-o.n34);F[5].set(o.n41+o.n31,o.n42+o.n32,o.n43+o.n33,o.n44+o.n34);for(I=0;I<6;I++)A=F[I],A.divideScalar(Math.sqrt(A.x*A.x+A.y*A.y+A.z*A.z));v=this.projectGraph(H);H=0;
+for(I=v.objects.length;H<I;H++)if(A=v.objects[H],P=A.matrixWorld,R=A.materials,S=A.overdraw,f=0,A instanceof THREE.Mesh){O=A.geometry;J=O.vertices;t=O.faces;E=O.faceVertexUvs;O=A.matrixRotationWorld.extractRotation(A.matrixWorld);w=0;for(z=J.length;w<z;w++)d=a(),d.positionWorld.copy(J[w].position),P.multiplyVector3(d.positionWorld),d.positionScreen.copy(d.positionWorld),o.multiplyVector4(d.positionScreen),d.positionScreen.x/=d.positionScreen.w,d.positionScreen.y/=d.positionScreen.w,d.visible=d.positionScreen.z>
+L&&d.positionScreen.z<G;J=0;for(w=t.length;J<w;J++){z=t[J];if(z instanceof THREE.Face3)if(u=e[z.a],M=e[z.b],K=e[z.c],u.visible&&M.visible&&K.visible&&(A.doubleSided||A.flipSided!=(K.positionScreen.x-u.positionScreen.x)*(M.positionScreen.y-u.positionScreen.y)-(K.positionScreen.y-u.positionScreen.y)*(M.positionScreen.x-u.positionScreen.x)<0))N=k[h]=k[h]||new THREE.RenderableFace3,h++,g=N,g.v1.copy(u),g.v2.copy(M),g.v3.copy(K);else continue;else if(z instanceof THREE.Face4)if(u=e[z.a],M=e[z.b],K=e[z.c],
+N=e[z.d],u.visible&&M.visible&&K.visible&&N.visible&&(A.doubleSided||A.flipSided!=((N.positionScreen.x-u.positionScreen.x)*(M.positionScreen.y-u.positionScreen.y)-(N.positionScreen.y-u.positionScreen.y)*(M.positionScreen.x-u.positionScreen.x)<0||(M.positionScreen.x-K.positionScreen.x)*(N.positionScreen.y-K.positionScreen.y)-(M.positionScreen.y-K.positionScreen.y)*(N.positionScreen.x-K.positionScreen.x)<0)))Q=j[n]=j[n]||new THREE.RenderableFace4,n++,g=Q,g.v1.copy(u),g.v2.copy(M),g.v3.copy(K),g.v4.copy(N);
+else continue;g.normalWorld.copy(z.normal);O.multiplyVector3(g.normalWorld);g.centroidWorld.copy(z.centroid);P.multiplyVector3(g.centroidWorld);g.centroidScreen.copy(g.centroidWorld);o.multiplyVector3(g.centroidScreen);K=z.vertexNormals;u=0;for(M=K.length;u<M;u++)N=g.vertexNormalsWorld[u],N.copy(K[u]),O.multiplyVector3(N);u=0;for(M=E.length;u<M;u++)if(Q=E[u][J]){K=0;for(N=Q.length;K<N;K++)g.uvs[u][K]=Q[K]}g.meshMaterials=R;g.faceMaterials=z.materials;g.overdraw=S;g.z=g.centroidScreen.z;v.elements.push(g)}}else if(A instanceof
+THREE.Line){C.multiply(o,P);J=A.geometry.vertices;u=a();u.positionScreen.copy(J[0].position);C.multiplyVector4(u.positionScreen);w=1;for(z=J.length;w<z;w++)if(u=a(),u.positionScreen.copy(J[w].position),C.multiplyVector4(u.positionScreen),M=e[f-2],r.copy(u.positionScreen),B.copy(M.positionScreen),c(r,B))r.multiplyScalar(1/r.w),B.multiplyScalar(1/B.w),P=l[m]=l[m]||new THREE.RenderableLine,m++,i=P,i.v1.positionScreen.copy(r),i.v2.positionScreen.copy(B),i.z=Math.max(r.z,B.z),i.materials=A.materials,v.elements.push(i)}else if(A instanceof
+THREE.Particle&&(x.set(A.matrixWorld.n14,A.matrixWorld.n24,A.matrixWorld.n34,1),o.multiplyVector4(x),x.z/=x.w,x.z>0&&x.z<1))P=s[p]=s[p]||new THREE.RenderableParticle,p++,q=P,q.x=x.x/x.w,q.y=x.y/x.w,q.z=x.z,q.rotation=A.rotation.z,q.scale.x=A.scale.x*Math.abs(q.x-(x.x+D.projectionMatrix.n11)/(x.w+D.projectionMatrix.n14)),q.scale.y=A.scale.y*Math.abs(q.y-(x.y+D.projectionMatrix.n22)/(x.w+D.projectionMatrix.n24)),q.materials=A.materials,v.elements.push(q);y&&v.elements.sort(b);return v}};
+THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,d!==void 0?d:1)};
+THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this},setFromEuler:function(a){var b=Math.PI/360,c=a.x*b,d=a.y*b,f=a.z*b,a=Math.cos(d),d=Math.sin(d),b=Math.cos(-f),f=Math.sin(-f),e=Math.cos(c),c=Math.sin(c),g=a*b,h=d*f;this.w=g*e-h*c;this.x=g*c+h*e;this.y=d*b*e+a*f*c;this.z=a*f*e-d*b*c;return this},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);
 this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRotationMatrix:function(a){var b=Math.pow(a.determinant(),1/3);this.w=Math.sqrt(Math.max(0,b+a.n11+a.n22+a.n33))/2;this.x=Math.sqrt(Math.max(0,b+a.n11-a.n22-a.n33))/2;this.y=Math.sqrt(Math.max(0,b-a.n11+a.n22-a.n33))/2;this.z=Math.sqrt(Math.max(0,b-a.n11-a.n22+a.n33))/2;this.x=a.n32-a.n23<0?-Math.abs(this.x):Math.abs(this.x);this.y=a.n13-a.n31<0?-Math.abs(this.y):Math.abs(this.y);this.z=a.n21-a.n12<0?-Math.abs(this.z):Math.abs(this.z);
 this.normalize();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);a==0?this.w=this.z=this.y=this.x=0:(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,f=this.w,e=a.x,g=a.y,i=a.z,a=a.w;this.x=b*a+f*e+c*i-d*g;this.y=c*a+f*g+d*e-b*i;this.z=d*a+f*i+b*g-c*e;this.w=f*a-b*e-c*g-d*i;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,f=a.z,e=this.x,g=this.y,i=this.z,k=this.w,h=k*c+g*f-i*d,j=k*d+i*c-e*f,m=k*f+e*d-g*c,c=-e*
-c-g*d-i*f;b.x=h*k+c*-e+j*-i-m*-g;b.y=j*k+c*-g+m*-e-h*-i;b.z=m*k+c*-i+h*-g-j*-e;return b}};THREE.Quaternion.slerp=function(a,b,c,d){var f=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(f)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var e=Math.acos(f),g=Math.sqrt(1-f*f);if(Math.abs(g)<0.0010)return 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),c;f=Math.sin((1-d)*e)/g;d=Math.sin(d*e)/g;c.w=a.w*f+b.w*d;c.x=a.x*f+b.x*d;c.y=a.y*f+b.y*d;c.z=a.z*f+b.z*d;return c};
-THREE.Vertex=function(a){this.position=a||new THREE.Vector3};THREE.Face3=function(a,b,c,d,f,e){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materials=e instanceof Array?e:[e];this.centroid=new THREE.Vector3};
+this.x,c=this.y,d=this.z,f=this.w,e=a.x,g=a.y,h=a.z,a=a.w;this.x=b*a+f*e+c*h-d*g;this.y=c*a+f*g+d*e-b*h;this.z=d*a+f*h+b*g-c*e;this.w=f*a-b*e-c*g-d*h;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,f=a.z,e=this.x,g=this.y,h=this.z,k=this.w,n=k*c+g*f-h*d,j=k*d+h*c-e*f,i=k*f+e*d-g*c,c=-e*
+c-g*d-h*f;b.x=n*k+c*-e+j*-h-i*-g;b.y=j*k+c*-g+i*-e-n*-h;b.z=i*k+c*-h+n*-g-j*-e;return b}};
+THREE.Quaternion.slerp=function(a,b,c,d){var f=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;f<0?(c.w=-b.w,c.x=-b.x,c.y=-b.y,c.z=-b.z,f=-f):c.copy(b);if(Math.abs(f)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var e=Math.acos(f),f=Math.sqrt(1-f*f);if(Math.abs(f)<0.0010)return 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),c;b=Math.sin((1-d)*e)/f;d=Math.sin(d*e)/f;c.w=a.w*b+c.w*d;c.x=a.x*b+c.x*d;c.y=a.y*b+c.y*d;c.z=a.z*b+c.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
+THREE.Face3=function(a,b,c,d,f,e){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materials=e instanceof Array?e:[e];this.centroid=new THREE.Vector3};
 THREE.Face4=function(a,b,c,d,f,e,g){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materials=g instanceof Array?g:[g];this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.u=a||0;this.v=b||0};
 THREE.UV.prototype={constructor:THREE.UV,set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.u=a.u;this.v=a.v;return this},clone:function(){return new THREE.UV(this.u,this.v)}};THREE.Geometry=function(){this.id=THREE.GeometryCount++;this.vertices=[];this.colors=[];this.faces=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.dynamic=this.hasTangents=!1};
 THREE.Geometry.prototype={constructor:THREE.Geometry,applyMatrix:function(a){var b=new THREE.Matrix4;b.extractRotation(a,new THREE.Vector3(1,1,1));for(var c=0,d=this.vertices.length;c<d;c++)a.multiplyVector3(this.vertices[c].position);c=0;for(d=this.faces.length;c<d;c++){var f=this.faces[c];b.multiplyVector3(f.normal);for(var e=0,g=f.vertexNormals.length;e<g;e++)b.multiplyVector3(f.vertexNormals[e]);a.multiplyVector3(f.centroid)}},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),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)):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,f,e,g,i=new THREE.Vector3,k=new THREE.Vector3;d=0;for(f=this.faces.length;d<f;d++){e=this.faces[d];if(a&&e.vertexNormals.length){i.set(0,0,0);b=0;for(c=e.vertexNormals.length;b<c;b++)i.addSelf(e.vertexNormals[b]);i.divideScalar(3)}else b=this.vertices[e.a],c=this.vertices[e.b],g=this.vertices[e.c],i.sub(g.position,c.position),k.sub(b.position,c.position),i.crossSelf(k);i.isZero()||i.normalize();e.normal.copy(i)}},computeVertexNormals:function(){var a,b,c,d;if(this.__tmpVertices==void 0){d=this.__tmpVertices=
+c,d,f,e,g,h=new THREE.Vector3,k=new THREE.Vector3;d=0;for(f=this.faces.length;d<f;d++){e=this.faces[d];if(a&&e.vertexNormals.length){h.set(0,0,0);b=0;for(c=e.vertexNormals.length;b<c;b++)h.addSelf(e.vertexNormals[b]);h.divideScalar(3)}else b=this.vertices[e.a],c=this.vertices[e.b],g=this.vertices[e.c],h.sub(g.position,c.position),k.sub(b.position,c.position),h.crossSelf(k);h.isZero()||h.normalize();e.normal.copy(h)}},computeVertexNormals:function(){var a,b,c,d;if(this.__tmpVertices==void 0){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++)if(c=this.faces[a],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],c instanceof
 THREE.Face3?(d[c.a].addSelf(c.normal),d[c.b].addSelf(c.normal),d[c.c].addSelf(c.normal)):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],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])):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(a,b,c,d,e,f,o){i=a.vertices[b].position;k=a.vertices[c].position;h=a.vertices[d].position;j=g[e];m=g[f];n=g[o];l=k.x-i.x;p=h.x-i.x;q=k.y-i.y;v=h.y-i.y;u=k.z-i.z;C=h.z-i.z;K=m.u-j.u;t=n.u-j.u;w=m.v-j.v;z=n.v-j.v;y=1/(K*z-t*w);F.set((z*l-w*p)*y,(z*q-w*v)*y,(z*u-w*C)*y);G.set((K*p-t*l)*y,(K*v-t*q)*y,(K*C-t*u)*y);E[b].addSelf(F);E[c].addSelf(F);E[d].addSelf(F);D[b].addSelf(G);
-D[c].addSelf(G);D[d].addSelf(G)}var b,c,d,f,e,g,i,k,h,j,m,n,l,p,q,v,u,C,K,t,w,z,y,o,E=[],D=[],F=new THREE.Vector3,G=new THREE.Vector3,A=new THREE.Vector3,M=new THREE.Vector3,N=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++)E[b]=new THREE.Vector3,D[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)e=this.faces[b],g=this.faceVertexUvs[0][b],e instanceof THREE.Face3?a(this,e.a,e.b,e.c,0,1,2):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));var O=["a","b",
-"c","d"];b=0;for(c=this.faces.length;b<c;b++){e=this.faces[b];for(d=0;d<e.vertexNormals.length;d++)N.copy(e.vertexNormals[d]),f=e[O[d]],o=E[f],A.copy(o),A.subSelf(N.multiplyScalar(N.dot(o))).normalize(),M.cross(e.vertexNormals[d],o),f=M.dot(D[f]),f=f<0?-1:1,e.vertexTangents[d]=new THREE.Vector4(A.x,A.y,A.z,f)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,
+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(a,b,c,d,e,f,O){h=a.vertices[b].position;k=a.vertices[c].position;n=a.vertices[d].position;j=g[e];i=g[f];m=g[O];l=k.x-h.x;q=n.x-h.x;p=k.y-h.y;s=n.y-h.y;v=k.z-h.z;x=n.z-h.z;o=i.u-j.u;C=m.u-j.u;F=i.v-j.v;r=m.v-j.v;B=1/(o*r-C*F);L.set((r*l-F*q)*B,(r*p-F*s)*B,(r*v-F*x)*B);G.set((o*q-C*l)*B,(o*s-C*p)*B,(o*x-C*v)*B);D[b].addSelf(L);D[c].addSelf(L);D[d].addSelf(L);y[b].addSelf(G);
+y[c].addSelf(G);y[d].addSelf(G)}var b,c,d,f,e,g,h,k,n,j,i,m,l,q,p,s,v,x,o,C,F,r,B,H,D=[],y=[],L=new THREE.Vector3,G=new THREE.Vector3,I=new THREE.Vector3,w=new THREE.Vector3,z=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++)D[b]=new THREE.Vector3,y[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)e=this.faces[b],g=this.faceVertexUvs[0][b],e instanceof THREE.Face3?a(this,e.a,e.b,e.c,0,1,2):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));var J=["a","b",
+"c","d"];b=0;for(c=this.faces.length;b<c;b++){e=this.faces[b];for(d=0;d<e.vertexNormals.length;d++)z.copy(e.vertexNormals[d]),f=e[J[d]],H=D[f],I.copy(H),I.subSelf(z.multiplyScalar(z.dot(H))).normalize(),w.cross(e.vertexNormals[d],H),f=w.dot(y[f]),f=f<0?-1:1,e.vertexTangents[d]=new THREE.Vector4(I.x,I.y,I.z,f)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,
 this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var 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=0,b=0,c=this.vertices.length;b<c;b++)a=Math.max(a,this.vertices[b].position.length());this.boundingSphere={radius:a}},mergeVertices:function(){var a={},b=[],c=[],d,f=Math.pow(10,4),e,g;e=0;for(g=this.vertices.length;e<g;e++)d=this.vertices[e].position,d=[Math.round(d.x*f),Math.round(d.y*f),Math.round(d.z*f)].join("_"),a[d]===void 0?(a[d]=e,b.push(this.vertices[e]),
 c[e]=b.length-1):c[e]=c[a[d]];e=0;for(g=this.faces.length;e<g;e++){a=this.faces[e];if(a instanceof THREE.Face3)a.a=c[a.a],a.b=c[a.b],a.c=c[a.c];if(a instanceof THREE.Face4)a.a=c[a.a],a.b=c[a.b],a.c=c[a.c],a.d=c[a.d]}this.vertices=b}};THREE.GeometryCount=0;
-THREE.Camera=function(){if(arguments.length)return console.warn("DEPRECATED: Camera() is now PerspectiveCamera() or OrthographicCamera()."),new THREE.PerspectiveCamera(arguments[0],arguments[1],arguments[2],arguments[3]);THREE.Object3D.call(this);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;
-THREE.Camera.prototype.lookAt=function(a){this.matrix.lookAt(this.position,a,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)};
-THREE.Camera.prototype.update=function(a,b,c){this.matrixAutoUpdate&&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.OrthographicCamera=function(a,b,c,d,f,e){THREE.Camera.call(this);this.left=a;this.right=b;this.top=c;this.bottom=d;this.near=f!==void 0?f:0.1;this.far=e!==void 0?e:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=new THREE.Camera;THREE.OrthographicCamera.prototype.constructor=THREE.OrthographicCamera;THREE.OrthographicCamera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makeOrtho(this.left,this.right,this.top,this.bottom,this.near,this.far)};
-THREE.PerspectiveCamera=function(a,b,c,d){THREE.Camera.call(this);this.fov=a!==void 0?a:50;this.aspect=b!==void 0?b:1;this.near=c!==void 0?c:0.1;this.far=d!==void 0?d:2E3;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype=new THREE.Camera;THREE.PerspectiveCamera.prototype.constructor=THREE.PerspectiveCamera;THREE.PerspectiveCamera.prototype.setLens=function(a,b){this.fov=2*Math.atan((b!==void 0?b:43.25)/(a*2));this.fov*=180/Math.PI;this.updateProjectionMatrix()};
-THREE.PerspectiveCamera.prototype.setViewOffset=function(a,b,c,d,f,e){this.fullWidth=a;this.fullHeight=b;this.x=c;this.y=d;this.width=f;this.height=e;this.updateProjectionMatrix()};
+THREE.Camera=function(){if(arguments.length)return console.warn("DEPRECATED: Camera() is now PerspectiveCamera() or OrthographicCamera()."),new THREE.PerspectiveCamera(arguments[0],arguments[1],arguments[2],arguments[3]);THREE.Object3D.call(this);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4;this.projectionMatrixInverse=new THREE.Matrix4};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;
+THREE.Camera.prototype.lookAt=function(a){this.matrix.lookAt(this.position,a,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)};THREE.OrthographicCamera=function(a,b,c,d,f,e){THREE.Camera.call(this);this.left=a;this.right=b;this.top=c;this.bottom=d;this.near=f!==void 0?f:0.1;this.far=e!==void 0?e:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=new THREE.Camera;THREE.OrthographicCamera.prototype.constructor=THREE.OrthographicCamera;
+THREE.OrthographicCamera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makeOrtho(this.left,this.right,this.top,this.bottom,this.near,this.far)};THREE.PerspectiveCamera=function(a,b,c,d){THREE.Camera.call(this);this.fov=a!==void 0?a:50;this.aspect=b!==void 0?b:1;this.near=c!==void 0?c:0.1;this.far=d!==void 0?d:2E3;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype=new THREE.Camera;THREE.PerspectiveCamera.prototype.constructor=THREE.PerspectiveCamera;
+THREE.PerspectiveCamera.prototype.setLens=function(a,b){this.fov=2*Math.atan((b!==void 0?b:43.25)/(a*2));this.fov*=180/Math.PI;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype.setViewOffset=function(a,b,c,d,f,e){this.fullWidth=a;this.fullHeight=b;this.x=c;this.y=d;this.width=f;this.height=e;this.updateProjectionMatrix()};
 THREE.PerspectiveCamera.prototype.updateProjectionMatrix=function(){if(this.fullWidth){var a=this.fullWidth/this.fullHeight,b=Math.tan(this.fov*Math.PI/360)*this.near,c=-b,d=a*c,a=Math.abs(a*b-d),c=Math.abs(b-c);this.projectionMatrix=THREE.Matrix4.makeFrustum(d+this.x*a/this.fullWidth,d+(this.x+this.width)*a/this.fullWidth,b-(this.y+this.height)*c/this.fullHeight,b-this.y*c/this.fullHeight,this.near,this.far)}else this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,
 this.far)};THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;
 THREE.DirectionalLight=function(a,b,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=b!==void 0?b:1;this.distance=c!==void 0?c:0};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,b,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,0,0);this.intensity=b!==void 0?b:1;this.distance=c!==void 0?c:0};THREE.PointLight.prototype=new THREE.Light;
@@ -114,25 +113,21 @@ THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material
 c}};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]!==void 0)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,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,f=this.children.length;if(this.hasNoneBoneChildren){this.matrixWorld.multiply(this.skin.matrixWorld,this.skinMatrix);for(d=0;d<f;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<f;d++)this.children[d].update(this.skinMatrix,
-b,c)};THREE.Bone.prototype.addChild=function(a){if(this.children.indexOf(a)===-1&&(a.parent!==void 0&&a.parent.removeChild(a),a.parent=this,this.children.push(a),!(a instanceof THREE.Bone)))this.hasNoneBoneChildren=!0};THREE.Scene=function(){THREE.Object3D.call(this);this.fog=null;this.matrixAutoUpdate=!1;this.collisions=this.overrideMaterial=null;this.objects=[];this.lights=[];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.add=function(a){this.supr.add.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.Camera||a instanceof THREE.Bone)&&this.objects.indexOf(a)===-1){this.objects.push(a);this.__objectsAdded.push(a);var b=this.__objectsRemoved.indexOf(a);b!==-1&&this.__objectsRemoved.splice(b,1)}for(b=0;b<a.children.length;b++)this.addChildRecurse(a.children[b])};THREE.Scene.prototype.remove=function(a){this.supr.remove.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 a instanceof THREE.Camera||(b=this.objects.indexOf(a),b!==-1&&(this.objects.splice(b,1),this.__objectsRemoved.push(a),b=this.__objectsAdded.indexOf(a),b!==-1&&this.__objectsAdded.splice(b,1)));for(b=0;b<a.children.length;b++)this.removeChildRecurse(a.children[b])};
-THREE.Scene.prototype.addChild=function(a){console.warn("DEPRECATED: Scene.addChild() is now Scene.add().");this.add(a)};THREE.Scene.prototype.addObject=function(a){console.warn("DEPRECATED: Scene.addObject() is now Scene.add().");this.add(a)};THREE.Scene.prototype.addLight=function(a){console.warn("DEPRECATED: Scene.addLight() is now Scene.add().");this.add(a)};THREE.Scene.prototype.removeChild=function(a){console.warn("DEPRECATED: Scene.removeChild() is now Scene.remove().");this.remove(a)};
-THREE.Scene.prototype.removeObject=function(a){console.warn("DEPRECATED: Scene.removeObject() is now Scene.remove().");this.remove(a)};THREE.Scene.prototype.removeLight=function(a){console.warn("DEPRECATED: Scene.removeLight() is now Scene.remove().");this.remove(a)};
-THREE.SVGRenderer=function(){function a(a,b,c){var d,e,f,g;d=0;for(e=a.lights.length;d<e;d++)f=a.lights[d],f instanceof THREE.DirectionalLight?(g=b.normalWorld.dot(f.position)*f.intensity,g>0&&(c.r+=f.color.r*g,c.g+=f.color.g*g,c.b+=f.color.b*g)):f instanceof THREE.PointLight&&(D.sub(f.position,b.centroidWorld),D.normalize(),g=b.normalWorld.dot(D)*f.intensity,g>0&&(c.r+=f.color.r*g,c.g+=f.color.g*g,c.b+=f.color.b*g))}function b(b,c,g,i,h,j){e.info.render.vertices+=3;e.info.render.faces++;A=d(M++);
-A.setAttribute("d","M "+b.positionScreen.x+" "+b.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+g.positionScreen.x+","+g.positionScreen.y+"z");h instanceof THREE.MeshBasicMaterial?t.copy(h.color):h instanceof THREE.MeshLambertMaterial?K?(w.r=z.r,w.g=z.g,w.b=z.b,a(j,i,w),t.r=Math.max(0,Math.min(h.color.r*w.r,1)),t.g=Math.max(0,Math.min(h.color.g*w.g,1)),t.b=Math.max(0,Math.min(h.color.b*w.b,1))):t.copy(h.color):h instanceof THREE.MeshDepthMaterial?(E=1-h.__2near/(h.__farPlusNear-
-i.z*h.__farMinusNear),t.setRGB(E,E,E)):h instanceof THREE.MeshNormalMaterial&&t.setRGB(f(i.normalWorld.x),f(i.normalWorld.y),f(i.normalWorld.z));h.wireframe?A.setAttribute("style","fill: none; stroke: "+t.getContextStyle()+"; stroke-width: "+h.wireframeLinewidth+"; stroke-opacity: "+h.opacity+"; stroke-linecap: "+h.wireframeLinecap+"; stroke-linejoin: "+h.wireframeLinejoin):A.setAttribute("style","fill: "+t.getContextStyle()+"; fill-opacity: "+h.opacity);k.appendChild(A)}function c(b,c,g,i,h,j,l){e.info.render.vertices+=
-4;e.info.render.faces++;A=d(M++);A.setAttribute("d","M "+b.positionScreen.x+" "+b.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+g.positionScreen.x+","+g.positionScreen.y+" L "+i.positionScreen.x+","+i.positionScreen.y+"z");j instanceof THREE.MeshBasicMaterial?t.copy(j.color):j instanceof THREE.MeshLambertMaterial?K?(w.r=z.r,w.g=z.g,w.b=z.b,a(l,h,w),t.r=Math.max(0,Math.min(j.color.r*w.r,1)),t.g=Math.max(0,Math.min(j.color.g*w.g,1)),t.b=Math.max(0,Math.min(j.color.b*w.b,1))):
-t.copy(j.color):j instanceof THREE.MeshDepthMaterial?(E=1-j.__2near/(j.__farPlusNear-h.z*j.__farMinusNear),t.setRGB(E,E,E)):j instanceof THREE.MeshNormalMaterial&&t.setRGB(f(h.normalWorld.x),f(h.normalWorld.y),f(h.normalWorld.z));j.wireframe?A.setAttribute("style","fill: none; stroke: "+t.getContextStyle()+"; stroke-width: "+j.wireframeLinewidth+"; stroke-opacity: "+j.opacity+"; stroke-linecap: "+j.wireframeLinecap+"; stroke-linejoin: "+j.wireframeLinejoin):A.setAttribute("style","fill: "+t.getContextStyle()+
-"; fill-opacity: "+j.opacity);k.appendChild(A)}function d(a){F[a]==null&&(F[a]=document.createElementNS("http://www.w3.org/2000/svg","path"),O==0&&F[a].setAttribute("shape-rendering","crispEdges"));return F[a]}function f(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}var e=this,g=null,i=new THREE.Projector,k=document.createElementNS("http://www.w3.org/2000/svg","svg"),h,j,m,n,l,p,q,v,u=new THREE.Rectangle,C=new THREE.Rectangle,K=!1,t=new THREE.Color(16777215),w=new THREE.Color(16777215),z=new THREE.Color(0),
-y=new THREE.Color(0),o=new THREE.Color(0),E,D=new THREE.Vector3,F=[],G=[],A,M,N,O=1;this.domElement=k;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setQuality=function(a){switch(a){case "high":O=1;break;case "low":O=0}};this.setSize=function(a,b){h=a;j=b;m=h/2;n=j/2;k.setAttribute("viewBox",-m+" "+-n+" "+h+" "+j);k.setAttribute("width",h);k.setAttribute("height",j);u.set(-m,-n,m,n)};this.clear=function(){for(;k.childNodes.length>0;)k.removeChild(k.childNodes[0])};
-this.render=function(a,d){var f,h,j,r,t,w,s,x;this.autoClear&&this.clear();e.info.render.vertices=0;e.info.render.faces=0;g=i.projectScene(a,d,this.sortElements);N=M=0;if(K=a.lights.length>0){s=a.lights;z.setRGB(0,0,0);y.setRGB(0,0,0);o.setRGB(0,0,0);f=0;for(h=s.length;f<h;f++)j=s[f],r=j.color,j instanceof THREE.AmbientLight?(z.r+=r.r,z.g+=r.g,z.b+=r.b):j instanceof THREE.DirectionalLight?(y.r+=r.r,y.g+=r.g,y.b+=r.b):j instanceof THREE.PointLight&&(o.r+=r.r,o.g+=r.g,o.b+=r.b)}f=0;for(h=g.length;f<
-h;f++)if(s=g[f],C.empty(),s instanceof THREE.RenderableParticle){l=s;l.x*=m;l.y*=-n;j=0;for(r=s.materials.length;j<r;)j++}else if(s instanceof THREE.RenderableLine){if(l=s.v1,p=s.v2,l.positionScreen.x*=m,l.positionScreen.y*=-n,p.positionScreen.x*=m,p.positionScreen.y*=-n,C.addPoint(l.positionScreen.x,l.positionScreen.y),C.addPoint(p.positionScreen.x,p.positionScreen.y),u.intersects(C)){j=0;for(r=s.materials.length;j<r;)if((x=s.materials[j++])&&x.opacity!=0){t=l;w=p;var B=N++;G[B]==null&&(G[B]=document.createElementNS("http://www.w3.org/2000/svg",
-"line"),O==0&&G[B].setAttribute("shape-rendering","crispEdges"));A=G[B];A.setAttribute("x1",t.positionScreen.x);A.setAttribute("y1",t.positionScreen.y);A.setAttribute("x2",w.positionScreen.x);A.setAttribute("y2",w.positionScreen.y);x instanceof THREE.LineBasicMaterial&&(A.setAttribute("style","fill: none; stroke: "+x.color.getContextStyle()+"; stroke-width: "+x.linewidth+"; stroke-opacity: "+x.opacity+"; stroke-linecap: "+x.linecap+"; stroke-linejoin: "+x.linejoin),k.appendChild(A))}}}else if(s instanceof
-THREE.RenderableFace3){if(l=s.v1,p=s.v2,q=s.v3,l.positionScreen.x*=m,l.positionScreen.y*=-n,p.positionScreen.x*=m,p.positionScreen.y*=-n,q.positionScreen.x*=m,q.positionScreen.y*=-n,C.addPoint(l.positionScreen.x,l.positionScreen.y),C.addPoint(p.positionScreen.x,p.positionScreen.y),C.addPoint(q.positionScreen.x,q.positionScreen.y),u.intersects(C)){j=0;for(r=s.meshMaterials.length;j<r;)if(x=s.meshMaterials[j++],x instanceof THREE.MeshFaceMaterial){t=0;for(w=s.faceMaterials.length;t<w;)(x=s.faceMaterials[t++])&&
-x.opacity!=0&&b(l,p,q,s,x,a)}else x&&x.opacity!=0&&b(l,p,q,s,x,a)}}else if(s instanceof THREE.RenderableFace4&&(l=s.v1,p=s.v2,q=s.v3,v=s.v4,l.positionScreen.x*=m,l.positionScreen.y*=-n,p.positionScreen.x*=m,p.positionScreen.y*=-n,q.positionScreen.x*=m,q.positionScreen.y*=-n,v.positionScreen.x*=m,v.positionScreen.y*=-n,C.addPoint(l.positionScreen.x,l.positionScreen.y),C.addPoint(p.positionScreen.x,p.positionScreen.y),C.addPoint(q.positionScreen.x,q.positionScreen.y),C.addPoint(v.positionScreen.x,v.positionScreen.y),
-u.intersects(C))){j=0;for(r=s.meshMaterials.length;j<r;)if(x=s.meshMaterials[j++],x instanceof THREE.MeshFaceMaterial){t=0;for(w=s.faceMaterials.length;t<w;)(x=s.faceMaterials[t++])&&x.opacity!=0&&c(l,p,q,v,s,x,a)}else x&&x.opacity!=0&&c(l,p,q,v,s,x,a)}}};THREE.RenderableVertex=function(){this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.visible=!0};THREE.RenderableVertex.prototype.copy=function(a){this.positionWorld.copy(a.positionWorld);this.positionScreen.copy(a.positionScreen)};
+b,c)};THREE.Bone.prototype.addChild=function(a){if(this.children.indexOf(a)===-1&&(a.parent!==void 0&&a.parent.removeChild(a),a.parent=this,this.children.push(a),!(a instanceof THREE.Bone)))this.hasNoneBoneChildren=!0};THREE.Scene=function(){THREE.Object3D.call(this);this.overrideMaterial=this.fog=null;this.matrixAutoUpdate=!1};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;
+THREE.SVGRenderer=function(){function a(a,b,c,d){var e,f,g,h,j,k;e=0;for(f=a.length;e<f;e++)g=a[e],h=g.color,g instanceof THREE.DirectionalLight?(j=g.matrixWorld.getPosition(),k=c.dot(j),k<=0||(k*=g.intensity,d.r+=h.r*k,d.g+=h.g*k,d.b+=h.b*k)):g instanceof THREE.PointLight&&(j=g.matrixWorld.getPosition(),k=c.dot(L.sub(j,b).normalize()),k<=0||(k*=g.distance==0?1:1-Math.min(b.distanceTo(j)/g.distance,1),k!=0&&(k*=g.intensity,d.r+=h.r*k,d.g+=h.g*k,d.b+=h.b*k)))}function b(b,c,g,h,i){e.info.render.vertices+=
+3;e.info.render.faces++;w=d(z++);w.setAttribute("d","M "+b.positionScreen.x+" "+b.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+g.positionScreen.x+","+g.positionScreen.y+"z");i instanceof THREE.MeshBasicMaterial?r.copy(i.color):i instanceof THREE.MeshLambertMaterial?F?(r.r=B.r,r.g=B.g,r.b=B.b,a(k,h.centroidWorld,h.normalWorld,r),r.r=Math.max(0,Math.min(i.color.r*r.r,1)),r.g=Math.max(0,Math.min(i.color.g*r.g,1)),r.b=Math.max(0,Math.min(i.color.b*r.b,1))):r.copy(i.color):i instanceof
+THREE.MeshDepthMaterial?(y=1-i.__2near/(i.__farPlusNear-h.z*i.__farMinusNear),r.setRGB(y,y,y)):i instanceof THREE.MeshNormalMaterial&&r.setRGB(f(h.normalWorld.x),f(h.normalWorld.y),f(h.normalWorld.z));i.wireframe?w.setAttribute("style","fill: none; stroke: "+r.getContextStyle()+"; stroke-width: "+i.wireframeLinewidth+"; stroke-opacity: "+i.opacity+"; stroke-linecap: "+i.wireframeLinecap+"; stroke-linejoin: "+i.wireframeLinejoin):w.setAttribute("style","fill: "+r.getContextStyle()+"; fill-opacity: "+
+i.opacity);j.appendChild(w)}function c(b,c,g,h,i,l){e.info.render.vertices+=4;e.info.render.faces++;w=d(z++);w.setAttribute("d","M "+b.positionScreen.x+" "+b.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+g.positionScreen.x+","+g.positionScreen.y+" L "+h.positionScreen.x+","+h.positionScreen.y+"z");l instanceof THREE.MeshBasicMaterial?r.copy(l.color):l instanceof THREE.MeshLambertMaterial?F?(r.r=B.r,r.g=B.g,r.b=B.b,a(k,i.centroidWorld,i.normalWorld,r),r.r=Math.max(0,Math.min(l.color.r*
+r.r,1)),r.g=Math.max(0,Math.min(l.color.g*r.g,1)),r.b=Math.max(0,Math.min(l.color.b*r.b,1))):r.copy(l.color):l instanceof THREE.MeshDepthMaterial?(y=1-l.__2near/(l.__farPlusNear-i.z*l.__farMinusNear),r.setRGB(y,y,y)):l instanceof THREE.MeshNormalMaterial&&r.setRGB(f(i.normalWorld.x),f(i.normalWorld.y),f(i.normalWorld.z));l.wireframe?w.setAttribute("style","fill: none; stroke: "+r.getContextStyle()+"; stroke-width: "+l.wireframeLinewidth+"; stroke-opacity: "+l.opacity+"; stroke-linecap: "+l.wireframeLinecap+
+"; stroke-linejoin: "+l.wireframeLinejoin):w.setAttribute("style","fill: "+r.getContextStyle()+"; fill-opacity: "+l.opacity);j.appendChild(w)}function d(a){G[a]==null&&(G[a]=document.createElementNS("http://www.w3.org/2000/svg","path"),u==0&&G[a].setAttribute("shape-rendering","crispEdges"));return G[a]}function f(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}var e=this,g,h,k,n=new THREE.Projector,j=document.createElementNS("http://www.w3.org/2000/svg","svg"),i,m,l,q,p,s,v,x,o=new THREE.Rectangle,C=new THREE.Rectangle,
+F=!1,r=new THREE.Color,B=new THREE.Color,H=new THREE.Color,D=new THREE.Color,y,L=new THREE.Vector3,G=[],I=[],w,z,J,u=1;this.domElement=j;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setQuality=function(a){switch(a){case "high":u=1;break;case "low":u=0}};this.setSize=function(a,b){i=a;m=b;l=i/2;q=m/2;j.setAttribute("viewBox",-l+" "+-q+" "+i+" "+m);j.setAttribute("width",i);j.setAttribute("height",m);o.set(-l,-q,l,q)};this.clear=function(){for(;j.childNodes.length>
+0;)j.removeChild(j.childNodes[0])};this.render=function(a,d){var f,i,m,r,y,G,t,E;this.autoClear&&this.clear();e.info.render.vertices=0;e.info.render.faces=0;g=n.projectScene(a,d,this.sortElements);h=g.elements;k=g.lights;J=z=0;if(F=k.length>0){f=k;B.setRGB(0,0,0);H.setRGB(0,0,0);D.setRGB(0,0,0);i=0;for(m=f.length;i<m;i++)r=f[i],t=r.color,r instanceof THREE.AmbientLight?(B.r+=t.r,B.g+=t.g,B.b+=t.b):r instanceof THREE.DirectionalLight?(H.r+=t.r,H.g+=t.g,H.b+=t.b):r instanceof THREE.PointLight&&(D.r+=
+t.r,D.g+=t.g,D.b+=t.b)}f=0;for(i=h.length;f<i;f++)if(t=h[f],C.empty(),t instanceof THREE.RenderableParticle){p=t;p.x*=l;p.y*=-q;m=0;for(r=t.materials.length;m<r;)m++}else if(t instanceof THREE.RenderableLine){if(p=t.v1,s=t.v2,p.positionScreen.x*=l,p.positionScreen.y*=-q,s.positionScreen.x*=l,s.positionScreen.y*=-q,C.addPoint(p.positionScreen.x,p.positionScreen.y),C.addPoint(s.positionScreen.x,s.positionScreen.y),o.intersects(C)){m=0;for(r=t.materials.length;m<r;)if((E=t.materials[m++])&&E.opacity!=
+0){y=p;G=s;var L=J++;I[L]==null&&(I[L]=document.createElementNS("http://www.w3.org/2000/svg","line"),u==0&&I[L].setAttribute("shape-rendering","crispEdges"));w=I[L];w.setAttribute("x1",y.positionScreen.x);w.setAttribute("y1",y.positionScreen.y);w.setAttribute("x2",G.positionScreen.x);w.setAttribute("y2",G.positionScreen.y);E instanceof THREE.LineBasicMaterial&&(w.setAttribute("style","fill: none; stroke: "+E.color.getContextStyle()+"; stroke-width: "+E.linewidth+"; stroke-opacity: "+E.opacity+"; stroke-linecap: "+
+E.linecap+"; stroke-linejoin: "+E.linejoin),j.appendChild(w))}}}else if(t instanceof THREE.RenderableFace3){if(p=t.v1,s=t.v2,v=t.v3,p.positionScreen.x*=l,p.positionScreen.y*=-q,s.positionScreen.x*=l,s.positionScreen.y*=-q,v.positionScreen.x*=l,v.positionScreen.y*=-q,C.addPoint(p.positionScreen.x,p.positionScreen.y),C.addPoint(s.positionScreen.x,s.positionScreen.y),C.addPoint(v.positionScreen.x,v.positionScreen.y),o.intersects(C)){m=0;for(r=t.meshMaterials.length;m<r;)if(E=t.meshMaterials[m++],E instanceof
+THREE.MeshFaceMaterial){y=0;for(G=t.faceMaterials.length;y<G;)(E=t.faceMaterials[y++])&&E.opacity!=0&&b(p,s,v,t,E,a)}else E&&E.opacity!=0&&b(p,s,v,t,E,a)}}else if(t instanceof THREE.RenderableFace4&&(p=t.v1,s=t.v2,v=t.v3,x=t.v4,p.positionScreen.x*=l,p.positionScreen.y*=-q,s.positionScreen.x*=l,s.positionScreen.y*=-q,v.positionScreen.x*=l,v.positionScreen.y*=-q,x.positionScreen.x*=l,x.positionScreen.y*=-q,C.addPoint(p.positionScreen.x,p.positionScreen.y),C.addPoint(s.positionScreen.x,s.positionScreen.y),
+C.addPoint(v.positionScreen.x,v.positionScreen.y),C.addPoint(x.positionScreen.x,x.positionScreen.y),o.intersects(C))){m=0;for(r=t.meshMaterials.length;m<r;)if(E=t.meshMaterials[m++],E instanceof THREE.MeshFaceMaterial){y=0;for(G=t.faceMaterials.length;y<G;)(E=t.faceMaterials[y++])&&E.opacity!=0&&c(p,s,v,x,t,E,a)}else E&&E.opacity!=0&&c(p,s,v,x,t,E,a)}}};THREE.RenderableVertex=function(){this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.visible=!0};
+THREE.RenderableVertex.prototype.copy=function(a){this.positionWorld.copy(a.positionWorld);this.positionScreen.copy(a.positionScreen)};
 THREE.RenderableFace3=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterials=this.meshMaterials=null;this.overdraw=!1;this.uvs=[[]];this.z=null};
 THREE.RenderableFace4=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.v4=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterials=this.meshMaterials=null;this.overdraw=!1;this.uvs=[[]];this.z=null};
-THREE.RenderableObject=function(){this.z=this.object=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.RenderableVertex;this.v2=new THREE.RenderableVertex;this.materials=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.RenderableVertex;this.v2=new THREE.RenderableVertex;this.materials=null};

+ 208 - 212
build/custom/ThreeWebGL.js

@@ -1,103 +1,102 @@
 // ThreeWebGL.js r46dev - http://github.com/mrdoob/three.js
 var THREE=THREE||{};if(!self.Int32Array)self.Int32Array=Array,self.Float32Array=Array;THREE.Color=function(b){b!==void 0&&this.setHex(b);return this};
-THREE.Color.prototype={constructor:THREE.Color,r:1,g:1,b:1,copy:function(b){this.r=b.r;this.g=b.g;this.b=b.b;return this},setRGB:function(b,c,e){this.r=b;this.g=c;this.b=e;return this},setHSV:function(b,c,e){var d,h,i;if(e==0)this.r=this.g=this.b=0;else switch(d=Math.floor(b*6),h=b*6-d,b=e*(1-c),i=e*(1-c*h),c=e*(1-c*(1-h)),d){case 1:this.r=i;this.g=e;this.b=b;break;case 2:this.r=b;this.g=e;this.b=c;break;case 3:this.r=b;this.g=i;this.b=e;break;case 4:this.r=c;this.g=b;this.b=e;break;case 5:this.r=
-e;this.g=b;this.b=i;break;case 6:case 0:this.r=e,this.g=c,this.b=b}return this},setHex:function(b){b=Math.floor(b);this.r=(b>>16&255)/255;this.g=(b>>8&255)/255;this.b=(b&255)/255;return this},getHex:function(){return~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},getContextStyle:function(){return"rgb("+Math.floor(this.r*255)+","+Math.floor(this.g*255)+","+Math.floor(this.b*255)+")"},clone:function(){return(new THREE.Color).setRGB(this.r,this.g,this.b)}};
+THREE.Color.prototype={constructor:THREE.Color,r:1,g:1,b:1,copy:function(b){this.r=b.r;this.g=b.g;this.b=b.b;return this},setRGB:function(b,c,d){this.r=b;this.g=c;this.b=d;return this},setHSV:function(b,c,d){var e,h,i;if(d==0)this.r=this.g=this.b=0;else switch(e=Math.floor(b*6),h=b*6-e,b=d*(1-c),i=d*(1-c*h),c=d*(1-c*(1-h)),e){case 1:this.r=i;this.g=d;this.b=b;break;case 2:this.r=b;this.g=d;this.b=c;break;case 3:this.r=b;this.g=i;this.b=d;break;case 4:this.r=c;this.g=b;this.b=d;break;case 5:this.r=
+d;this.g=b;this.b=i;break;case 6:case 0:this.r=d,this.g=c,this.b=b}return this},setHex:function(b){b=Math.floor(b);this.r=(b>>16&255)/255;this.g=(b>>8&255)/255;this.b=(b&255)/255;return this},getHex:function(){return~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},getContextStyle:function(){return"rgb("+Math.floor(this.r*255)+","+Math.floor(this.g*255)+","+Math.floor(this.b*255)+")"},clone:function(){return(new THREE.Color).setRGB(this.r,this.g,this.b)}};
 THREE.Vector2=function(b,c){this.x=b||0;this.y=c||0};
 THREE.Vector2.prototype={constructor:THREE.Vector2,set:function(b,c){this.x=b;this.y=c;return this},copy:function(b){this.x=b.x;this.y=b.y;return this},clone:function(){return new THREE.Vector2(this.x,this.y)},add:function(b,c){this.x=b.x+c.x;this.y=b.y+c.y;return this},addSelf:function(b){this.x+=b.x;this.y+=b.y;return this},sub:function(b,c){this.x=b.x-c.x;this.y=b.y-c.y;return this},subSelf:function(b){this.x-=b.x;this.y-=b.y;return this},multiplyScalar:function(b){this.x*=b;this.y*=b;return this},
 divideScalar:function(b){b?(this.x/=b,this.y/=b):this.set(0,0);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(b){return this.x*b.x+this.y*b.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.lengthSq())},normalize:function(){return this.divideScalar(this.length())},distanceTo:function(b){return Math.sqrt(this.distanceToSquared(b))},distanceToSquared:function(b){var c=this.x-b.x,b=this.y-b.y;return c*c+b*b},setLength:function(b){return this.normalize().multiplyScalar(b)},
-equals:function(b){return b.x==this.x&&b.y==this.y}};THREE.Vector3=function(b,c,e){this.x=b||0;this.y=c||0;this.z=e||0};
-THREE.Vector3.prototype={constructor:THREE.Vector3,set:function(b,c,e){this.x=b;this.y=c;this.z=e;return this},setX:function(b){this.x=b;return this},setY:function(b){this.y=b;return this},setZ:function(b){this.z=b;return this},copy:function(b){this.x=b.x;this.y=b.y;this.z=b.z;return this},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)},add:function(b,c){this.x=b.x+c.x;this.y=b.y+c.y;this.z=b.z+c.z;return this},addSelf:function(b){this.x+=b.x;this.y+=b.y;this.z+=b.z;return this},
+equals:function(b){return b.x==this.x&&b.y==this.y}};THREE.Vector3=function(b,c,d){this.x=b||0;this.y=c||0;this.z=d||0};
+THREE.Vector3.prototype={constructor:THREE.Vector3,set:function(b,c,d){this.x=b;this.y=c;this.z=d;return this},setX:function(b){this.x=b;return this},setY:function(b){this.y=b;return this},setZ:function(b){this.z=b;return this},copy:function(b){this.x=b.x;this.y=b.y;this.z=b.z;return this},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)},add:function(b,c){this.x=b.x+c.x;this.y=b.y+c.y;this.z=b.z+c.z;return this},addSelf:function(b){this.x+=b.x;this.y+=b.y;this.z+=b.z;return this},
 addScalar:function(b){this.x+=b;this.y+=b;this.z+=b;return this},sub:function(b,c){this.x=b.x-c.x;this.y=b.y-c.y;this.z=b.z-c.z;return this},subSelf:function(b){this.x-=b.x;this.y-=b.y;this.z-=b.z;return this},multiply:function(b,c){this.x=b.x*c.x;this.y=b.y*c.y;this.z=b.z*c.z;return this},multiplySelf:function(b){this.x*=b.x;this.y*=b.y;this.z*=b.z;return this},multiplyScalar:function(b){this.x*=b;this.y*=b;this.z*=b;return this},divideSelf:function(b){this.x/=b.x;this.y/=b.y;this.z/=b.z;return this},
 divideScalar:function(b){b?(this.x/=b,this.y/=b,this.z/=b):this.set(0,0,0);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(b){return this.x*b.x+this.y*b.y+this.z*b.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.lengthSq())},lengthManhattan:function(){return this.x+this.y+this.z},normalize:function(){return this.divideScalar(this.length())},setLength:function(b){return this.normalize().multiplyScalar(b)},
 cross:function(b,c){this.x=b.y*c.z-b.z*c.y;this.y=b.z*c.x-b.x*c.z;this.z=b.x*c.y-b.y*c.x;return this},crossSelf:function(b){return this.set(this.y*b.z-this.z*b.y,this.z*b.x-this.x*b.z,this.x*b.y-this.y*b.x)},distanceTo:function(b){return Math.sqrt(this.distanceToSquared(b))},distanceToSquared:function(b){return(new THREE.Vector3).sub(this,b).lengthSq()},setPositionFromMatrix:function(b){this.x=b.n14;this.y=b.n24;this.z=b.n34},setRotationFromMatrix:function(b){var c=Math.cos(this.y);this.y=Math.asin(b.n13);
-Math.abs(c)>1.0E-5?(this.x=Math.atan2(-b.n23/c,b.n33/c),this.z=Math.atan2(-b.n12/c,b.n11/c)):(this.x=0,this.z=Math.atan2(b.n21,b.n22))},isZero:function(){return this.lengthSq()<1.0E-4}};THREE.Vector4=function(b,c,e,d){this.x=b||0;this.y=c||0;this.z=e||0;this.w=d!==void 0?d:1};
-THREE.Vector4.prototype={constructor:THREE.Vector4,set:function(b,c,e,d){this.x=b;this.y=c;this.z=e;this.w=d;return this},copy:function(b){this.x=b.x;this.y=b.y;this.z=b.z;this.w=b.w!==void 0?b.w:1},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},add:function(b,c){this.x=b.x+c.x;this.y=b.y+c.y;this.z=b.z+c.z;this.w=b.w+c.w;return this},addSelf:function(b){this.x+=b.x;this.y+=b.y;this.z+=b.z;this.w+=b.w;return this},sub:function(b,c){this.x=b.x-c.x;this.y=b.y-c.y;this.z=b.z-
+Math.abs(c)>1.0E-5?(this.x=Math.atan2(-b.n23/c,b.n33/c),this.z=Math.atan2(-b.n12/c,b.n11/c)):(this.x=0,this.z=Math.atan2(b.n21,b.n22))},isZero:function(){return this.lengthSq()<1.0E-4}};THREE.Vector4=function(b,c,d,e){this.x=b||0;this.y=c||0;this.z=d||0;this.w=e!==void 0?e:1};
+THREE.Vector4.prototype={constructor:THREE.Vector4,set:function(b,c,d,e){this.x=b;this.y=c;this.z=d;this.w=e;return this},copy:function(b){this.x=b.x;this.y=b.y;this.z=b.z;this.w=b.w!==void 0?b.w:1},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},add:function(b,c){this.x=b.x+c.x;this.y=b.y+c.y;this.z=b.z+c.z;this.w=b.w+c.w;return this},addSelf:function(b){this.x+=b.x;this.y+=b.y;this.z+=b.z;this.w+=b.w;return this},sub:function(b,c){this.x=b.x-c.x;this.y=b.y-c.y;this.z=b.z-
 c.z;this.w=b.w-c.w;return this},subSelf:function(b){this.x-=b.x;this.y-=b.y;this.z-=b.z;this.w-=b.w;return this},multiplyScalar:function(b){this.x*=b;this.y*=b;this.z*=b;this.w*=b;return this},divideScalar:function(b){b?(this.x/=b,this.y/=b,this.z/=b,this.w/=b):(this.z=this.y=this.x=0,this.w=1);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(b){return this.x*b.x+this.y*b.y+this.z*b.z+this.w*b.w},lengthSq:function(){return this.dot(this)},length:function(){return Math.sqrt(this.lengthSq())},
 normalize:function(){return this.divideScalar(this.length())},setLength:function(b){return this.normalize().multiplyScalar(b)},lerpSelf:function(b,c){this.x+=(b.x-this.x)*c;this.y+=(b.y-this.y)*c;this.z+=(b.z-this.z)*c;this.w+=(b.w-this.w)*c;return this}};THREE.Ray=function(b,c){this.origin=b||new THREE.Vector3;this.direction=c||new THREE.Vector3};
-THREE.Ray.prototype={constructor:THREE.Ray,intersectScene:function(b){return this.intersectObjects(b.objects)},intersectObjects:function(b){var c,e,d=[];c=0;for(e=b.length;c<e;c++)Array.prototype.push.apply(d,this.intersectObject(b[c]));d.sort(function(b,c){return b.distance-c.distance});return d},intersectObject:function(b){function c(b,c,e){var d;d=e.clone().subSelf(b).dot(c);if(d<=0)return null;b=b.clone().addSelf(c.clone().multiplyScalar(d));return e.distanceTo(b)}function e(b,c,e,d){var d=d.clone().subSelf(c),
-e=e.clone().subSelf(c),h=b.clone().subSelf(c),b=d.dot(d),c=d.dot(e),d=d.dot(h),i=e.dot(e),e=e.dot(h),h=1/(b*i-c*c),i=(i*d-c*e)*h,b=(b*e-c*d)*h;return i>0&&b>0&&i+b<1}for(var d,h=[],i=0,j=b.children.length;i<j;i++)Array.prototype.push.apply(h,this.intersectObject(b.children[i]));if(b instanceof THREE.Particle){i=c(this.origin,this.direction,b.matrixWorld.getPosition());if(i==null||i>b.scale.x)return[];d={distance:i,point:b.position,face:null,object:b};h.push(d)}else if(b instanceof THREE.Mesh){i=c(this.origin,
-this.direction,b.matrixWorld.getPosition());if(i==null||i>b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)))return h;for(var k,n,p,q,m,r,t,A,y=b.geometry,J=y.vertices,i=0,j=y.faces.length;i<j;i++)if(d=y.faces[i],t=this.origin.clone(),A=this.direction.clone(),q=b.matrixWorld,k=q.multiplyVector3(d.centroid.clone()).subSelf(t),r=k.dot(A),!(r<=0)&&(k=q.multiplyVector3(J[d.a].position.clone()),n=q.multiplyVector3(J[d.b].position.clone()),p=q.multiplyVector3(J[d.c].position.clone()),
-q=d instanceof THREE.Face4?q.multiplyVector3(J[d.d].position.clone()):null,m=b.matrixRotationWorld.multiplyVector3(d.normal.clone()),r=A.dot(m),b.doubleSided||(b.flipSided?r>0:r<0)))if(r=m.dot((new THREE.Vector3).sub(k,t))/r,t=t.addSelf(A.multiplyScalar(r)),d instanceof THREE.Face3)e(t,k,n,p)&&(d={distance:this.origin.distanceTo(t),point:t,face:d,object:b},h.push(d));else if(d instanceof THREE.Face4&&(e(t,k,n,q)||e(t,n,p,q)))d={distance:this.origin.distanceTo(t),point:t,face:d,object:b},h.push(d)}return h}};
-THREE.Rectangle=function(){function b(){i=d-c;j=h-e}var c,e,d,h,i,j,k=!0;this.getX=function(){return c};this.getY=function(){return e};this.getWidth=function(){return i};this.getHeight=function(){return j};this.getLeft=function(){return c};this.getTop=function(){return e};this.getRight=function(){return d};this.getBottom=function(){return h};this.set=function(i,j,q,m){k=!1;c=i;e=j;d=q;h=m;b()};this.addPoint=function(i,j){k?(k=!1,c=i,e=j,d=i,h=j):(c=c<i?c:i,e=e<j?e:j,d=d>i?d:i,h=h>j?h:j);b()};this.add3Points=
-function(i,j,q,m,r,t){k?(k=!1,c=i<q?i<r?i:r:q<r?q:r,e=j<m?j<t?j:t:m<t?m:t,d=i>q?i>r?i:r:q>r?q:r,h=j>m?j>t?j:t:m>t?m:t):(c=i<q?i<r?i<c?i:c:r<c?r:c:q<r?q<c?q:c:r<c?r:c,e=j<m?j<t?j<e?j:e:t<e?t:e:m<t?m<e?m:e:t<e?t:e,d=i>q?i>r?i>d?i:d:r>d?r:d:q>r?q>d?q:d:r>d?r:d,h=j>m?j>t?j>h?j:h:t>h?t:h:m>t?m>h?m:h:t>h?t:h);b()};this.addRectangle=function(i){k?(k=!1,c=i.getLeft(),e=i.getTop(),d=i.getRight(),h=i.getBottom()):(c=c<i.getLeft()?c:i.getLeft(),e=e<i.getTop()?e:i.getTop(),d=d>i.getRight()?d:i.getRight(),h=h>
-i.getBottom()?h:i.getBottom());b()};this.inflate=function(i){c-=i;e-=i;d+=i;h+=i;b()};this.minSelf=function(i){c=c>i.getLeft()?c:i.getLeft();e=e>i.getTop()?e:i.getTop();d=d<i.getRight()?d:i.getRight();h=h<i.getBottom()?h:i.getBottom();b()};this.intersects=function(b){return Math.min(d,b.getRight())-Math.max(c,b.getLeft())>=0&&Math.min(h,b.getBottom())-Math.max(e,b.getTop())>=0};this.empty=function(){k=!0;h=d=e=c=0;b()};this.isEmpty=function(){return k}};THREE.Matrix3=function(){this.m=[]};
+THREE.Ray.prototype={constructor:THREE.Ray,intersectScene:function(b){return this.intersectObjects(b.children)},intersectObjects:function(b){var c,d,e=[];c=0;for(d=b.length;c<d;c++)Array.prototype.push.apply(e,this.intersectObject(b[c]));e.sort(function(b,c){return b.distance-c.distance});return e},intersectObject:function(b){function c(b,c,d){var e;e=d.clone().subSelf(b).dot(c);if(e<=0)return null;b=b.clone().addSelf(c.clone().multiplyScalar(e));return d.distanceTo(b)}function d(b,c,d,e){var e=e.clone().subSelf(c),
+d=d.clone().subSelf(c),h=b.clone().subSelf(c),b=e.dot(e),c=e.dot(d),e=e.dot(h),i=d.dot(d),d=d.dot(h),h=1/(b*i-c*c),i=(i*e-c*d)*h,b=(b*d-c*e)*h;return i>0&&b>0&&i+b<1}for(var e,h=[],i=0,j=b.children.length;i<j;i++)Array.prototype.push.apply(h,this.intersectObject(b.children[i]));if(b instanceof THREE.Particle){i=c(this.origin,this.direction,b.matrixWorld.getPosition());if(i==null||i>b.scale.x)return[];e={distance:i,point:b.position,face:null,object:b};h.push(e)}else if(b instanceof THREE.Mesh){i=c(this.origin,
+this.direction,b.matrixWorld.getPosition());if(i==null||i>b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)))return h;var k,s,p,o,n,q,v,y,D=b.geometry,E=D.vertices;b.matrixRotationWorld.extractRotation(b.matrixWorld);i=0;for(j=D.faces.length;i<j;i++)if(e=D.faces[i],v=this.origin.clone(),y=this.direction.clone(),o=b.matrixWorld,k=o.multiplyVector3(e.centroid.clone()).subSelf(v),q=k.dot(y),!(q<=0)&&(k=o.multiplyVector3(E[e.a].position.clone()),s=o.multiplyVector3(E[e.b].position.clone()),
+p=o.multiplyVector3(E[e.c].position.clone()),o=e instanceof THREE.Face4?o.multiplyVector3(E[e.d].position.clone()):null,n=b.matrixRotationWorld.multiplyVector3(e.normal.clone()),q=y.dot(n),b.doubleSided||(b.flipSided?q>0:q<0)))if(q=n.dot((new THREE.Vector3).sub(k,v))/q,v=v.addSelf(y.multiplyScalar(q)),e instanceof THREE.Face3)d(v,k,s,p)&&(e={distance:this.origin.distanceTo(v),point:v,face:e,object:b},h.push(e));else if(e instanceof THREE.Face4&&(d(v,k,s,o)||d(v,s,p,o)))e={distance:this.origin.distanceTo(v),
+point:v,face:e,object:b},h.push(e)}return h}};
+THREE.Rectangle=function(){function b(){i=e-c;j=h-d}var c,d,e,h,i,j,k=!0;this.getX=function(){return c};this.getY=function(){return d};this.getWidth=function(){return i};this.getHeight=function(){return j};this.getLeft=function(){return c};this.getTop=function(){return d};this.getRight=function(){return e};this.getBottom=function(){return h};this.set=function(i,j,o,n){k=!1;c=i;d=j;e=o;h=n;b()};this.addPoint=function(i,j){k?(k=!1,c=i,d=j,e=i,h=j):(c=c<i?c:i,d=d<j?d:j,e=e>i?e:i,h=h>j?h:j);b()};this.add3Points=
+function(i,j,o,n,q,v){k?(k=!1,c=i<o?i<q?i:q:o<q?o:q,d=j<n?j<v?j:v:n<v?n:v,e=i>o?i>q?i:q:o>q?o:q,h=j>n?j>v?j:v:n>v?n:v):(c=i<o?i<q?i<c?i:c:q<c?q:c:o<q?o<c?o:c:q<c?q:c,d=j<n?j<v?j<d?j:d:v<d?v:d:n<v?n<d?n:d:v<d?v:d,e=i>o?i>q?i>e?i:e:q>e?q:e:o>q?o>e?o:e:q>e?q:e,h=j>n?j>v?j>h?j:h:v>h?v:h:n>v?n>h?n:h:v>h?v:h);b()};this.addRectangle=function(i){k?(k=!1,c=i.getLeft(),d=i.getTop(),e=i.getRight(),h=i.getBottom()):(c=c<i.getLeft()?c:i.getLeft(),d=d<i.getTop()?d:i.getTop(),e=e>i.getRight()?e:i.getRight(),h=h>
+i.getBottom()?h:i.getBottom());b()};this.inflate=function(i){c-=i;d-=i;e+=i;h+=i;b()};this.minSelf=function(i){c=c>i.getLeft()?c:i.getLeft();d=d>i.getTop()?d:i.getTop();e=e<i.getRight()?e:i.getRight();h=h<i.getBottom()?h:i.getBottom();b()};this.intersects=function(b){return Math.min(e,b.getRight())-Math.max(c,b.getLeft())>=0&&Math.min(h,b.getBottom())-Math.max(d,b.getTop())>=0};this.empty=function(){k=!0;h=e=d=c=0;b()};this.isEmpty=function(){return k}};THREE.Matrix3=function(){this.m=[]};
 THREE.Matrix3.prototype={constructor:THREE.Matrix3,transpose:function(){var b,c=this.m;b=c[1];c[1]=c[3];c[3]=b;b=c[2];c[2]=c[6];c[6]=b;b=c[5];c[5]=c[7];c[7]=b;return this},transposeIntoArray:function(b){var c=this.m;b[0]=c[0];b[1]=c[3];b[2]=c[6];b[3]=c[1];b[4]=c[4];b[5]=c[7];b[6]=c[2];b[7]=c[5];b[8]=c[8];return this}};
-THREE.Matrix4=function(b,c,e,d,h,i,j,k,n,p,q,m,r,t,A,y){this.set(b!==void 0?b:1,c||0,e||0,d||0,h||0,i!==void 0?i:1,j||0,k||0,n||0,p||0,q!==void 0?q:1,m||0,r||0,t||0,A||0,y!==void 0?y:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
-THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(b,c,e,d,h,i,j,k,n,p,q,m,r,t,A,y){this.n11=b;this.n12=c;this.n13=e;this.n14=d;this.n21=h;this.n22=i;this.n23=j;this.n24=k;this.n31=n;this.n32=p;this.n33=q;this.n34=m;this.n41=r;this.n42=t;this.n43=A;this.n44=y;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b,
-c,e){var d=THREE.Matrix4.__v1,h=THREE.Matrix4.__v2,i=THREE.Matrix4.__v3;i.sub(b,c).normalize();if(i.length()===0)i.z=1;d.cross(e,i).normalize();d.length()===0&&(i.x+=1.0E-4,d.cross(e,i).normalize());h.cross(i,d).normalize();this.n11=d.x;this.n12=h.x;this.n13=i.x;this.n21=d.y;this.n22=h.y;this.n23=i.y;this.n31=d.z;this.n32=h.z;this.n33=i.z;return this},multiplyVector3:function(b){var c=b.x,e=b.y,d=b.z,h=1/(this.n41*c+this.n42*e+this.n43*d+this.n44);b.x=(this.n11*c+this.n12*e+this.n13*d+this.n14)*h;
-b.y=(this.n21*c+this.n22*e+this.n23*d+this.n24)*h;b.z=(this.n31*c+this.n32*e+this.n33*d+this.n34)*h;return b},multiplyVector4:function(b){var c=b.x,e=b.y,d=b.z,h=b.w;b.x=this.n11*c+this.n12*e+this.n13*d+this.n14*h;b.y=this.n21*c+this.n22*e+this.n23*d+this.n24*h;b.z=this.n31*c+this.n32*e+this.n33*d+this.n34*h;b.w=this.n41*c+this.n42*e+this.n43*d+this.n44*h;return b},rotateAxis:function(b){var c=b.x,e=b.y,d=b.z;b.x=c*this.n11+e*this.n12+d*this.n13;b.y=c*this.n21+e*this.n22+d*this.n23;b.z=c*this.n31+
-e*this.n32+d*this.n33;b.normalize();return b},crossVector:function(b){var c=new THREE.Vector4;c.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;c.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;c.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;c.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return c},multiply:function(b,c){var e=b.n11,d=b.n12,h=b.n13,i=b.n14,j=b.n21,k=b.n22,n=b.n23,p=b.n24,q=b.n31,m=b.n32,r=b.n33,t=b.n34,A=b.n41,y=b.n42,J=b.n43,F=b.n44,xa=c.n11,ya=
-c.n12,ja=c.n13,ta=c.n14,ha=c.n21,G=c.n22,v=c.n23,T=c.n24,L=c.n31,V=c.n32,la=c.n33,Z=c.n34,Ca=c.n41,$=c.n42,M=c.n43,f=c.n44;this.n11=e*xa+d*ha+h*L+i*Ca;this.n12=e*ya+d*G+h*V+i*$;this.n13=e*ja+d*v+h*la+i*M;this.n14=e*ta+d*T+h*Z+i*f;this.n21=j*xa+k*ha+n*L+p*Ca;this.n22=j*ya+k*G+n*V+p*$;this.n23=j*ja+k*v+n*la+p*M;this.n24=j*ta+k*T+n*Z+p*f;this.n31=q*xa+m*ha+r*L+t*Ca;this.n32=q*ya+m*G+r*V+t*$;this.n33=q*ja+m*v+r*la+t*M;this.n34=q*ta+m*T+r*Z+t*f;this.n41=A*xa+y*ha+J*L+F*Ca;this.n42=A*ya+y*G+J*V+F*$;this.n43=
-A*ja+y*v+J*la+F*M;this.n44=A*ta+y*T+J*Z+F*f;return this},multiplyToArray:function(b,c,e){this.multiply(b,c);e[0]=this.n11;e[1]=this.n21;e[2]=this.n31;e[3]=this.n41;e[4]=this.n12;e[5]=this.n22;e[6]=this.n32;e[7]=this.n42;e[8]=this.n13;e[9]=this.n23;e[10]=this.n33;e[11]=this.n43;e[12]=this.n14;e[13]=this.n24;e[14]=this.n34;e[15]=this.n44;return this},multiplySelf:function(b){this.multiply(this,b);return this},multiplyScalar:function(b){this.n11*=b;this.n12*=b;this.n13*=b;this.n14*=b;this.n21*=b;this.n22*=
-b;this.n23*=b;this.n24*=b;this.n31*=b;this.n32*=b;this.n33*=b;this.n34*=b;this.n41*=b;this.n42*=b;this.n43*=b;this.n44*=b;return this},determinant:function(){var b=this.n11,c=this.n12,e=this.n13,d=this.n14,h=this.n21,i=this.n22,j=this.n23,k=this.n24,n=this.n31,p=this.n32,q=this.n33,m=this.n34,r=this.n41,t=this.n42,A=this.n43,y=this.n44;return d*j*p*r-e*k*p*r-d*i*q*r+c*k*q*r+e*i*m*r-c*j*m*r-d*j*n*t+e*k*n*t+d*h*q*t-b*k*q*t-e*h*m*t+b*j*m*t+d*i*n*A-c*k*n*A-d*h*p*A+b*k*p*A+c*h*m*A-b*i*m*A-e*i*n*y+c*j*
-n*y+e*h*p*y-b*j*p*y-c*h*q*y+b*i*q*y},transpose:function(){var b;b=this.n21;this.n21=this.n12;this.n12=b;b=this.n31;this.n31=this.n13;this.n13=b;b=this.n32;this.n32=this.n23;this.n23=b;b=this.n41;this.n41=this.n14;this.n14=b;b=this.n42;this.n42=this.n24;this.n24=b;b=this.n43;this.n43=this.n34;this.n43=b;return this},clone:function(){var b=new THREE.Matrix4;b.n11=this.n11;b.n12=this.n12;b.n13=this.n13;b.n14=this.n14;b.n21=this.n21;b.n22=this.n22;b.n23=this.n23;b.n24=this.n24;b.n31=this.n31;b.n32=this.n32;
+THREE.Matrix4=function(b,c,d,e,h,i,j,k,s,p,o,n,q,v,y,D){this.set(b!==void 0?b:1,c||0,d||0,e||0,h||0,i!==void 0?i:1,j||0,k||0,s||0,p||0,o!==void 0?o:1,n||0,q||0,v||0,y||0,D!==void 0?D:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
+THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(b,c,d,e,h,i,j,k,s,p,o,n,q,v,y,D){this.n11=b;this.n12=c;this.n13=d;this.n14=e;this.n21=h;this.n22=i;this.n23=j;this.n24=k;this.n31=s;this.n32=p;this.n33=o;this.n34=n;this.n41=q;this.n42=v;this.n43=y;this.n44=D;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b,
+c,d){var e=THREE.Matrix4.__v1,h=THREE.Matrix4.__v2,i=THREE.Matrix4.__v3;i.sub(b,c).normalize();if(i.length()===0)i.z=1;e.cross(d,i).normalize();e.length()===0&&(i.x+=1.0E-4,e.cross(d,i).normalize());h.cross(i,e).normalize();this.n11=e.x;this.n12=h.x;this.n13=i.x;this.n21=e.y;this.n22=h.y;this.n23=i.y;this.n31=e.z;this.n32=h.z;this.n33=i.z;return this},multiply:function(b,c){var d=b.n11,e=b.n12,h=b.n13,i=b.n14,j=b.n21,k=b.n22,s=b.n23,p=b.n24,o=b.n31,n=b.n32,q=b.n33,v=b.n34,y=b.n41,D=b.n42,E=b.n43,
+H=b.n44,ia=c.n11,B=c.n12,va=c.n13,ka=c.n14,sa=c.n21,N=c.n22,Y=c.n23,R=c.n24,ra=c.n31,aa=c.n32,la=c.n33,Z=c.n34,X=c.n41,x=c.n42,F=c.n43,f=c.n44;this.n11=d*ia+e*sa+h*ra+i*X;this.n12=d*B+e*N+h*aa+i*x;this.n13=d*va+e*Y+h*la+i*F;this.n14=d*ka+e*R+h*Z+i*f;this.n21=j*ia+k*sa+s*ra+p*X;this.n22=j*B+k*N+s*aa+p*x;this.n23=j*va+k*Y+s*la+p*F;this.n24=j*ka+k*R+s*Z+p*f;this.n31=o*ia+n*sa+q*ra+v*X;this.n32=o*B+n*N+q*aa+v*x;this.n33=o*va+n*Y+q*la+v*F;this.n34=o*ka+n*R+q*Z+v*f;this.n41=y*ia+D*sa+E*ra+H*X;this.n42=
+y*B+D*N+E*aa+H*x;this.n43=y*va+D*Y+E*la+H*F;this.n44=y*ka+D*R+E*Z+H*f;return this},multiplySelf:function(b){return this.multiply(this,b)},multiplyToArray:function(b,c,d){this.multiply(b,c);d[0]=this.n11;d[1]=this.n21;d[2]=this.n31;d[3]=this.n41;d[4]=this.n12;d[5]=this.n22;d[6]=this.n32;d[7]=this.n42;d[8]=this.n13;d[9]=this.n23;d[10]=this.n33;d[11]=this.n43;d[12]=this.n14;d[13]=this.n24;d[14]=this.n34;d[15]=this.n44;return this},multiplyScalar:function(b){this.n11*=b;this.n12*=b;this.n13*=b;this.n14*=
+b;this.n21*=b;this.n22*=b;this.n23*=b;this.n24*=b;this.n31*=b;this.n32*=b;this.n33*=b;this.n34*=b;this.n41*=b;this.n42*=b;this.n43*=b;this.n44*=b;return this},multiplyVector3:function(b){var c=b.x,d=b.y,e=b.z,h=1/(this.n41*c+this.n42*d+this.n43*e+this.n44);b.x=(this.n11*c+this.n12*d+this.n13*e+this.n14)*h;b.y=(this.n21*c+this.n22*d+this.n23*e+this.n24)*h;b.z=(this.n31*c+this.n32*d+this.n33*e+this.n34)*h;return b},multiplyVector4:function(b){var c=b.x,d=b.y,e=b.z,h=b.w;b.x=this.n11*c+this.n12*d+this.n13*
+e+this.n14*h;b.y=this.n21*c+this.n22*d+this.n23*e+this.n24*h;b.z=this.n31*c+this.n32*d+this.n33*e+this.n34*h;b.w=this.n41*c+this.n42*d+this.n43*e+this.n44*h;return b},rotateAxis:function(b){var c=b.x,d=b.y,e=b.z;b.x=c*this.n11+d*this.n12+e*this.n13;b.y=c*this.n21+d*this.n22+e*this.n23;b.z=c*this.n31+d*this.n32+e*this.n33;b.normalize();return b},crossVector:function(b){var c=new THREE.Vector4;c.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;c.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*
+b.w;c.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;c.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return c},determinant:function(){var b=this.n11,c=this.n12,d=this.n13,e=this.n14,h=this.n21,i=this.n22,j=this.n23,k=this.n24,s=this.n31,p=this.n32,o=this.n33,n=this.n34,q=this.n41,v=this.n42,y=this.n43,D=this.n44;return e*j*p*q-d*k*p*q-e*i*o*q+c*k*o*q+d*i*n*q-c*j*n*q-e*j*s*v+d*k*s*v+e*h*o*v-b*k*o*v-d*h*n*v+b*j*n*v+e*i*s*y-c*k*s*y-e*h*p*y+b*k*p*y+c*h*n*y-b*i*n*y-d*i*s*D+c*j*s*D+
+d*h*p*D-b*j*p*D-c*h*o*D+b*i*o*D},transpose:function(){var b;b=this.n21;this.n21=this.n12;this.n12=b;b=this.n31;this.n31=this.n13;this.n13=b;b=this.n32;this.n32=this.n23;this.n23=b;b=this.n41;this.n41=this.n14;this.n14=b;b=this.n42;this.n42=this.n24;this.n24=b;b=this.n43;this.n43=this.n34;this.n43=b;return this},clone:function(){var b=new THREE.Matrix4;b.n11=this.n11;b.n12=this.n12;b.n13=this.n13;b.n14=this.n14;b.n21=this.n21;b.n22=this.n22;b.n23=this.n23;b.n24=this.n24;b.n31=this.n31;b.n32=this.n32;
 b.n33=this.n33;b.n34=this.n34;b.n41=this.n41;b.n42=this.n42;b.n43=this.n43;b.n44=this.n44;return b},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(b){b[0]=
 this.n11;b[1]=this.n21;b[2]=this.n31;b[3]=this.n41;b[4]=this.n12;b[5]=this.n22;b[6]=this.n32;b[7]=this.n42;b[8]=this.n13;b[9]=this.n23;b[10]=this.n33;b[11]=this.n43;b[12]=this.n14;b[13]=this.n24;b[14]=this.n34;b[15]=this.n44;return b},flattenToArrayOffset:function(b,c){b[c]=this.n11;b[c+1]=this.n21;b[c+2]=this.n31;b[c+3]=this.n41;b[c+4]=this.n12;b[c+5]=this.n22;b[c+6]=this.n32;b[c+7]=this.n42;b[c+8]=this.n13;b[c+9]=this.n23;b[c+10]=this.n33;b[c+11]=this.n43;b[c+12]=this.n14;b[c+13]=this.n24;b[c+14]=
-this.n34;b[c+15]=this.n44;return b},setTranslation:function(b,c,e){this.set(1,0,0,b,0,1,0,c,0,0,1,e,0,0,0,1);return this},setScale:function(b,c,e){this.set(b,0,0,0,0,c,0,0,0,0,e,0,0,0,0,1);return this},setRotationX:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(1,0,0,0,0,c,-b,0,0,b,c,0,0,0,0,1);return this},setRotationY:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(c,0,b,0,0,1,0,0,-b,0,c,0,0,0,0,1);return this},setRotationZ:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(c,-b,0,
-0,b,c,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(b,c){var e=Math.cos(c),d=Math.sin(c),h=1-e,i=b.x,j=b.y,k=b.z,n=h*i,p=h*j;this.set(n*i+e,n*j-d*k,n*k+d*j,0,n*j+d*k,p*j+e,p*k-d*i,0,n*k-d*j,p*k+d*i,h*k*k+e,0,0,0,0,1);return this},setPosition:function(b){this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},getPosition:function(){if(!this.position)this.position=new THREE.Vector3;this.position.set(this.n14,this.n24,this.n34);return this.position},getColumnX:function(){if(!this.columnX)this.columnX=
-new THREE.Vector3;this.columnX.set(this.n11,this.n21,this.n31);return this.columnX},getColumnY:function(){if(!this.columnY)this.columnY=new THREE.Vector3;this.columnY.set(this.n12,this.n22,this.n32);return this.columnY},getColumnZ:function(){if(!this.columnZ)this.columnZ=new THREE.Vector3;this.columnZ.set(this.n13,this.n23,this.n33);return this.columnZ},setRotationFromEuler:function(b,c){var e=b.x,d=b.y,h=b.z,i=Math.cos(e),e=Math.sin(e),j=Math.cos(d),d=Math.sin(d),k=Math.cos(h),h=Math.sin(h);switch(c){case "YXZ":var n=
-j*k,p=j*h,q=d*k,m=d*h;this.n11=n+m*e;this.n12=q*e-p;this.n13=i*d;this.n21=i*h;this.n22=i*k;this.n23=-e;this.n31=p*e-q;this.n32=m+n*e;this.n33=i*j;break;case "ZXY":n=j*k;p=j*h;q=d*k;m=d*h;this.n11=n-m*e;this.n12=-i*h;this.n13=q+p*e;this.n21=p+q*e;this.n22=i*k;this.n23=m-n*e;this.n31=-i*d;this.n32=e;this.n33=i*j;break;case "ZYX":n=i*k;p=i*h;q=e*k;m=e*h;this.n11=j*k;this.n12=q*d-p;this.n13=n*d+m;this.n21=j*h;this.n22=m*d+n;this.n23=p*d-q;this.n31=-d;this.n32=e*j;this.n33=i*j;break;case "YZX":n=i*j;p=
-i*d;q=e*j;m=e*d;this.n11=j*k;this.n12=m-n*h;this.n13=q*h+p;this.n21=h;this.n22=i*k;this.n23=-e*k;this.n31=-d*k;this.n32=p*h+q;this.n33=n-m*h;break;case "XZY":n=i*j;p=i*d;q=e*j;m=e*d;this.n11=j*k;this.n12=-h;this.n13=d*k;this.n21=n*h+m;this.n22=i*k;this.n23=p*h-q;this.n31=q*h-p;this.n32=e*k;this.n33=m*h+n;break;default:n=i*k,p=i*h,q=e*k,m=e*h,this.n11=j*k,this.n12=-j*h,this.n13=d,this.n21=p+q*d,this.n22=n-m*d,this.n23=-e*j,this.n31=m-n*d,this.n32=q+p*d,this.n33=i*j}return this},setRotationFromQuaternion:function(b){var c=
-b.x,e=b.y,d=b.z,h=b.w,i=c+c,j=e+e,k=d+d,b=c*i,n=c*j;c*=k;var p=e*j;e*=k;d*=k;i*=h;j*=h;h*=k;this.n11=1-(p+d);this.n12=n-h;this.n13=c+j;this.n21=n+h;this.n22=1-(b+d);this.n23=e-i;this.n31=c-j;this.n32=e+i;this.n33=1-(b+p);return this},scale:function(b){var c=b.x,e=b.y,b=b.z;this.n11*=c;this.n12*=e;this.n13*=b;this.n21*=c;this.n22*=e;this.n23*=b;this.n31*=c;this.n32*=e;this.n33*=b;this.n41*=c;this.n42*=e;this.n43*=b;return this},compose:function(b,c,e){var d=THREE.Matrix4.__m1,h=THREE.Matrix4.__m2;
-d.identity();d.setRotationFromQuaternion(c);h.setScale(e.x,e.y,e.z);this.multiply(d,h);this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},decompose:function(b,c,e){var d=THREE.Matrix4.__v1,h=THREE.Matrix4.__v2,i=THREE.Matrix4.__v3;d.set(this.n11,this.n21,this.n31);h.set(this.n12,this.n22,this.n32);i.set(this.n13,this.n23,this.n33);b=b instanceof THREE.Vector3?b:new THREE.Vector3;c=c instanceof THREE.Quaternion?c:new THREE.Quaternion;e=e instanceof THREE.Vector3?e:new THREE.Vector3;e.x=d.length();
-e.y=h.length();e.z=i.length();b.x=this.n14;b.y=this.n24;b.z=this.n34;d=THREE.Matrix4.__m1;d.copy(this);d.n11/=e.x;d.n21/=e.x;d.n31/=e.x;d.n12/=e.y;d.n22/=e.y;d.n32/=e.y;d.n13/=e.z;d.n23/=e.z;d.n33/=e.z;c.setFromRotationMatrix(d);return[b,c,e]},extractPosition:function(b){this.n14=b.n14;this.n24=b.n24;this.n34=b.n34},extractRotation:function(b,c){var e=1/c.x,d=1/c.y,h=1/c.z;this.n11=b.n11*e;this.n21=b.n21*e;this.n31=b.n31*e;this.n12=b.n12*d;this.n22=b.n22*d;this.n32=b.n32*d;this.n13=b.n13*h;this.n23=
-b.n23*h;this.n33=b.n33*h}};
-THREE.Matrix4.makeInvert=function(b,c){var e=b.n11,d=b.n12,h=b.n13,i=b.n14,j=b.n21,k=b.n22,n=b.n23,p=b.n24,q=b.n31,m=b.n32,r=b.n33,t=b.n34,A=b.n41,y=b.n42,J=b.n43,F=b.n44;c===void 0&&(c=new THREE.Matrix4);c.n11=n*t*y-p*r*y+p*m*J-k*t*J-n*m*F+k*r*F;c.n12=i*r*y-h*t*y-i*m*J+d*t*J+h*m*F-d*r*F;c.n13=h*p*y-i*n*y+i*k*J-d*p*J-h*k*F+d*n*F;c.n14=i*n*m-h*p*m-i*k*r+d*p*r+h*k*t-d*n*t;c.n21=p*r*A-n*t*A-p*q*J+j*t*J+n*q*F-j*r*F;c.n22=h*t*A-i*r*A+i*q*J-e*t*J-h*q*F+e*r*F;c.n23=i*n*A-h*p*A-i*j*J+e*p*J+h*j*F-e*n*F;c.n24=
-h*p*q-i*n*q+i*j*r-e*p*r-h*j*t+e*n*t;c.n31=k*t*A-p*m*A+p*q*y-j*t*y-k*q*F+j*m*F;c.n32=i*m*A-d*t*A-i*q*y+e*t*y+d*q*F-e*m*F;c.n33=h*p*A-i*k*A+i*j*y-e*p*y-d*j*F+e*k*F;c.n34=i*k*q-d*p*q-i*j*m+e*p*m+d*j*t-e*k*t;c.n41=n*m*A-k*r*A-n*q*y+j*r*y+k*q*J-j*m*J;c.n42=d*r*A-h*m*A+h*q*y-e*r*y-d*q*J+e*m*J;c.n43=h*k*A-d*n*A-h*j*y+e*n*y+d*j*J-e*k*J;c.n44=d*n*q-h*k*q+h*j*m-e*n*m-d*j*r+e*k*r;c.multiplyScalar(1/b.determinant());return c};
-THREE.Matrix4.makeInvert3x3=function(b){var c=b.m33,e=c.m,d=b.n33*b.n22-b.n32*b.n23,h=-b.n33*b.n21+b.n31*b.n23,i=b.n32*b.n21-b.n31*b.n22,j=-b.n33*b.n12+b.n32*b.n13,k=b.n33*b.n11-b.n31*b.n13,n=-b.n32*b.n11+b.n31*b.n12,p=b.n23*b.n12-b.n22*b.n13,q=-b.n23*b.n11+b.n21*b.n13,m=b.n22*b.n11-b.n21*b.n12,b=b.n11*d+b.n21*j+b.n31*p;b==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");b=1/b;e[0]=b*d;e[1]=b*h;e[2]=b*i;e[3]=b*j;e[4]=b*k;e[5]=b*n;e[6]=b*p;e[7]=b*q;e[8]=b*m;return c};
-THREE.Matrix4.makeFrustum=function(b,c,e,d,h,i){var j;j=new THREE.Matrix4;j.n11=2*h/(c-b);j.n12=0;j.n13=(c+b)/(c-b);j.n14=0;j.n21=0;j.n22=2*h/(d-e);j.n23=(d+e)/(d-e);j.n24=0;j.n31=0;j.n32=0;j.n33=-(i+h)/(i-h);j.n34=-2*i*h/(i-h);j.n41=0;j.n42=0;j.n43=-1;j.n44=0;return j};THREE.Matrix4.makePerspective=function(b,c,e,d){var h,b=e*Math.tan(b*Math.PI/360);h=-b;return THREE.Matrix4.makeFrustum(h*c,b*c,h,b,e,d)};
-THREE.Matrix4.makeOrtho=function(b,c,e,d,h,i){var j,k,n,p;j=new THREE.Matrix4;k=c-b;n=e-d;p=i-h;j.n11=2/k;j.n12=0;j.n13=0;j.n14=-((c+b)/k);j.n21=0;j.n22=2/n;j.n23=0;j.n24=-((e+d)/n);j.n31=0;j.n32=0;j.n33=-2/p;j.n34=-((i+h)/p);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.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
+this.n34;b[c+15]=this.n44;return b},setTranslation:function(b,c,d){this.set(1,0,0,b,0,1,0,c,0,0,1,d,0,0,0,1);return this},setScale:function(b,c,d){this.set(b,0,0,0,0,c,0,0,0,0,d,0,0,0,0,1);return this},setRotationX:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(1,0,0,0,0,c,-b,0,0,b,c,0,0,0,0,1);return this},setRotationY:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(c,0,b,0,0,1,0,0,-b,0,c,0,0,0,0,1);return this},setRotationZ:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(c,-b,0,
+0,b,c,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(b,c){var d=Math.cos(c),e=Math.sin(c),h=1-d,i=b.x,j=b.y,k=b.z,s=h*i,p=h*j;this.set(s*i+d,s*j-e*k,s*k+e*j,0,s*j+e*k,p*j+d,p*k-e*i,0,s*k-e*j,p*k+e*i,h*k*k+d,0,0,0,0,1);return this},setPosition:function(b){this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},getPosition:function(){return THREE.Matrix4.__v1.set(this.n14,this.n24,this.n34)},getColumnX:function(){return THREE.Matrix4.__v1.set(this.n11,this.n21,this.n31)},getColumnY:function(){return THREE.Matrix4.__v1.set(this.n12,
+this.n22,this.n32)},getColumnZ:function(){return THREE.Matrix4.__v1.set(this.n13,this.n23,this.n33)},getInverse:function(b){var c=b.n11,d=b.n12,e=b.n13,h=b.n14,i=b.n21,j=b.n22,k=b.n23,s=b.n24,p=b.n31,o=b.n32,n=b.n33,q=b.n34,v=b.n41,y=b.n42,D=b.n43,E=b.n44;this.n11=k*q*y-s*n*y+s*o*D-j*q*D-k*o*E+j*n*E;this.n12=h*n*y-e*q*y-h*o*D+d*q*D+e*o*E-d*n*E;this.n13=e*s*y-h*k*y+h*j*D-d*s*D-e*j*E+d*k*E;this.n14=h*k*o-e*s*o-h*j*n+d*s*n+e*j*q-d*k*q;this.n21=s*n*v-k*q*v-s*p*D+i*q*D+k*p*E-i*n*E;this.n22=e*q*v-h*n*v+
+h*p*D-c*q*D-e*p*E+c*n*E;this.n23=h*k*v-e*s*v-h*i*D+c*s*D+e*i*E-c*k*E;this.n24=e*s*p-h*k*p+h*i*n-c*s*n-e*i*q+c*k*q;this.n31=j*q*v-s*o*v+s*p*y-i*q*y-j*p*E+i*o*E;this.n32=h*o*v-d*q*v-h*p*y+c*q*y+d*p*E-c*o*E;this.n33=e*s*v-h*j*v+h*i*y-c*s*y-d*i*E+c*j*E;this.n34=h*j*p-d*s*p-h*i*o+c*s*o+d*i*q-c*j*q;this.n41=k*o*v-j*n*v-k*p*y+i*n*y+j*p*D-i*o*D;this.n42=d*n*v-e*o*v+e*p*y-c*n*y-d*p*D+c*o*D;this.n43=e*j*v-d*k*v-e*i*y+c*k*y+d*i*D-c*j*D;this.n44=d*k*p-e*j*p+e*i*o-c*k*o-d*i*n+c*j*n;this.multiplyScalar(1/b.determinant());
+return this},setRotationFromEuler:function(b,c){var d=b.x,e=b.y,h=b.z,i=Math.cos(d),d=Math.sin(d),j=Math.cos(e),e=Math.sin(e),k=Math.cos(h),h=Math.sin(h);switch(c){case "YXZ":var s=j*k,p=j*h,o=e*k,n=e*h;this.n11=s+n*d;this.n12=o*d-p;this.n13=i*e;this.n21=i*h;this.n22=i*k;this.n23=-d;this.n31=p*d-o;this.n32=n+s*d;this.n33=i*j;break;case "ZXY":s=j*k;p=j*h;o=e*k;n=e*h;this.n11=s-n*d;this.n12=-i*h;this.n13=o+p*d;this.n21=p+o*d;this.n22=i*k;this.n23=n-s*d;this.n31=-i*e;this.n32=d;this.n33=i*j;break;case "ZYX":s=
+i*k;p=i*h;o=d*k;n=d*h;this.n11=j*k;this.n12=o*e-p;this.n13=s*e+n;this.n21=j*h;this.n22=n*e+s;this.n23=p*e-o;this.n31=-e;this.n32=d*j;this.n33=i*j;break;case "YZX":s=i*j;p=i*e;o=d*j;n=d*e;this.n11=j*k;this.n12=n-s*h;this.n13=o*h+p;this.n21=h;this.n22=i*k;this.n23=-d*k;this.n31=-e*k;this.n32=p*h+o;this.n33=s-n*h;break;case "XZY":s=i*j;p=i*e;o=d*j;n=d*e;this.n11=j*k;this.n12=-h;this.n13=e*k;this.n21=s*h+n;this.n22=i*k;this.n23=p*h-o;this.n31=o*h-p;this.n32=d*k;this.n33=n*h+s;break;default:s=i*k,p=i*
+h,o=d*k,n=d*h,this.n11=j*k,this.n12=-j*h,this.n13=e,this.n21=p+o*e,this.n22=s-n*e,this.n23=-d*j,this.n31=n-s*e,this.n32=o+p*e,this.n33=i*j}return this},setRotationFromQuaternion:function(b){var c=b.x,d=b.y,e=b.z,h=b.w,i=c+c,j=d+d,k=e+e,b=c*i,s=c*j;c*=k;var p=d*j;d*=k;e*=k;i*=h;j*=h;h*=k;this.n11=1-(p+e);this.n12=s-h;this.n13=c+j;this.n21=s+h;this.n22=1-(b+e);this.n23=d-i;this.n31=c-j;this.n32=d+i;this.n33=1-(b+p);return this},scale:function(b){var c=b.x,d=b.y,b=b.z;this.n11*=c;this.n12*=d;this.n13*=
+b;this.n21*=c;this.n22*=d;this.n23*=b;this.n31*=c;this.n32*=d;this.n33*=b;this.n41*=c;this.n42*=d;this.n43*=b;return this},compose:function(b,c,d){var e=THREE.Matrix4.__m1,h=THREE.Matrix4.__m2;e.identity();e.setRotationFromQuaternion(c);h.setScale(d.x,d.y,d.z);this.multiply(e,h);this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},decompose:function(b,c,d){var e=THREE.Matrix4.__v1,h=THREE.Matrix4.__v2,i=THREE.Matrix4.__v3;e.set(this.n11,this.n21,this.n31);h.set(this.n12,this.n22,this.n32);i.set(this.n13,
+this.n23,this.n33);b=b instanceof THREE.Vector3?b:new THREE.Vector3;c=c instanceof THREE.Quaternion?c:new THREE.Quaternion;d=d instanceof THREE.Vector3?d:new THREE.Vector3;d.x=e.length();d.y=h.length();d.z=i.length();b.x=this.n14;b.y=this.n24;b.z=this.n34;e=THREE.Matrix4.__m1;e.copy(this);e.n11/=d.x;e.n21/=d.x;e.n31/=d.x;e.n12/=d.y;e.n22/=d.y;e.n32/=d.y;e.n13/=d.z;e.n23/=d.z;e.n33/=d.z;c.setFromRotationMatrix(e);return[b,c,d]},extractPosition:function(b){this.n14=b.n14;this.n24=b.n24;this.n34=b.n34;
+return this},extractRotation:function(b){var c=THREE.Matrix4.__v1,d=1/c.set(b.n11,b.n21,b.n31).length(),e=1/c.set(b.n12,b.n22,b.n32).length(),c=1/c.set(b.n13,b.n23,b.n33).length();this.n11=b.n11*d;this.n21=b.n21*d;this.n31=b.n31*d;this.n12=b.n12*e;this.n22=b.n22*e;this.n32=b.n32*e;this.n13=b.n13*c;this.n23=b.n23*c;this.n33=b.n33*c;return this}};
+THREE.Matrix4.makeInvert3x3=function(b){var c=b.m33,d=c.m,e=b.n33*b.n22-b.n32*b.n23,h=-b.n33*b.n21+b.n31*b.n23,i=b.n32*b.n21-b.n31*b.n22,j=-b.n33*b.n12+b.n32*b.n13,k=b.n33*b.n11-b.n31*b.n13,s=-b.n32*b.n11+b.n31*b.n12,p=b.n23*b.n12-b.n22*b.n13,o=-b.n23*b.n11+b.n21*b.n13,n=b.n22*b.n11-b.n21*b.n12,b=b.n11*e+b.n21*j+b.n31*p;b==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");b=1/b;d[0]=b*e;d[1]=b*h;d[2]=b*i;d[3]=b*j;d[4]=b*k;d[5]=b*s;d[6]=b*p;d[7]=b*o;d[8]=b*n;return c};
+THREE.Matrix4.makeFrustum=function(b,c,d,e,h,i){var j;j=new THREE.Matrix4;j.n11=2*h/(c-b);j.n12=0;j.n13=(c+b)/(c-b);j.n14=0;j.n21=0;j.n22=2*h/(e-d);j.n23=(e+d)/(e-d);j.n24=0;j.n31=0;j.n32=0;j.n33=-(i+h)/(i-h);j.n34=-2*i*h/(i-h);j.n41=0;j.n42=0;j.n43=-1;j.n44=0;return j};THREE.Matrix4.makePerspective=function(b,c,d,e){var h,b=d*Math.tan(b*Math.PI/360);h=-b;return THREE.Matrix4.makeFrustum(h*c,b*c,h,b,d,e)};
+THREE.Matrix4.makeOrtho=function(b,c,d,e,h,i){var j,k,s,p;j=new THREE.Matrix4;k=c-b;s=d-e;p=i-h;j.n11=2/k;j.n12=0;j.n13=0;j.n14=-((c+b)/k);j.n21=0;j.n22=2/s;j.n23=0;j.n24=-((d+e)/s);j.n31=0;j.n32=0;j.n33=-2/p;j.n34=-((i+h)/p);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.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
 THREE.Object3D=function(){this.name="";this.id=THREE.Object3DCount++;this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder="XYZ";this.scale=new THREE.Vector3(1,1,1);this.flipSided=this.doubleSided=this.dynamic=!1;this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=
 !0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=!0;this.receiveShadow=this.castShadow=!1;this.frustumCulled=!0;this._vector=new THREE.Vector3};
 THREE.Object3D.prototype={constructor:THREE.Object3D,translate:function(b,c){this.matrix.rotateAxis(c);this.position.addSelf(c.multiplyScalar(b))},translateX:function(b){this.translate(b,this._vector.set(1,0,0))},translateY:function(b){this.translate(b,this._vector.set(0,1,0))},translateZ:function(b){this.translate(b,this._vector.set(0,0,1))},lookAt:function(b){this.matrix.lookAt(b,this.position,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},add:function(b){if(this.children.indexOf(b)===
--1){b.parent!==void 0&&b.parent.remove(b);b.parent=this;this.children.push(b);for(var c=this;c.parent!==void 0;)c=c.parent;c!==void 0&&c instanceof THREE.Scene&&c.addChildRecurse(b)}},remove:function(b){var c=this,e=this.children.indexOf(b);if(e!==-1){b.parent=void 0;for(this.children.splice(e,1);c.parent!==void 0;)c=c.parent;c!==void 0&&c instanceof THREE.Scene&&c.removeChildRecurse(b)}},getChildByName:function(b,c){var e,d,h;e=0;for(d=this.children.length;e<d;e++){h=this.children[e];if(h.name===
-b)return h;if(c&&(h=h.getChildByName(b,c),h!==void 0))return h}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z));this.matrixWorldNeedsUpdate=!0},update:function(b,c,e){this.matrixAutoUpdate&&
-this.updateMatrix();if(this.matrixWorldNeedsUpdate||c)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale),this.matrixWorldNeedsUpdate=!1,c=!0;for(var b=0,d=this.children.length;b<d;b++)this.children[b].update(this.matrixWorld,c,e)},addChild:function(b){console.warn("DEPRECATED: Object3D.addChild() is now Object3D.add().");this.add(b)},removeChild:function(b){console.warn("DEPRECATED: Object3D.removeChild() is now Object3D.remove().");
-this.remove(b)}};THREE.Object3DCount=0;
-THREE.Projector=function(){function b(){var b=n[k]=n[k]||new THREE.RenderableVertex;k++;return b}function c(b,c){return c.z-b.z}function e(b,c){var e=0,d=1,f=b.z+b.w,i=c.z+c.w,h=-b.z+b.w,j=-c.z+c.w;return f>=0&&i>=0&&h>=0&&j>=0?!0:f<0&&i<0||h<0&&j<0?!1:(f<0?e=Math.max(e,f/(f-i)):i<0&&(d=Math.min(d,f/(f-i))),h<0?e=Math.max(e,h/(h-j)):j<0&&(d=Math.min(d,h/(h-j))),d<e?!1:(b.lerpSelf(c,e),c.lerpSelf(b,1-d),!0))}var d,h,i=[],j,k,n=[],p,q,m=[],r,t=[],A,y,J=[],F,xa,ya=[],ja=[],ta=[],ha=new THREE.Vector4,
-G=new THREE.Vector4,v=new THREE.Matrix4,T=new THREE.Matrix4,L=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],V=new THREE.Vector4,la=new THREE.Vector4;this.projectVector=function(b,c){v.multiply(c.projectionMatrix,c.matrixWorldInverse);v.multiplyVector3(b);return b};this.unprojectVector=function(b,c){v.multiply(c.matrixWorld,THREE.Matrix4.makeInvert(c.projectionMatrix));v.multiplyVector3(b);return b};this.pickingRay=function(b,c){var e;
-b.z=-1;e=new THREE.Vector3(b.x,b.y,1);this.unprojectVector(b,c);this.unprojectVector(e,c);e.subSelf(b).normalize();return new THREE.Ray(b,e)};this.projectObjects=function(b,e,j){var k,f;h=ja.length=0;k=b.objects;b=0;for(e=k.length;b<e;b++){f=k[b];var p;if(!(p=!f.visible))if(p=f instanceof THREE.Mesh)if(p=f.frustumCulled){a:{p=void 0;for(var n=f.matrixWorld,t=-f.geometry.boundingSphere.radius*Math.max(f.scale.x,Math.max(f.scale.y,f.scale.z)),q=0;q<6;q++)if(p=L[q].x*n.n14+L[q].y*n.n24+L[q].z*n.n34+
-L[q].w,p<=t){p=!1;break a}p=!0}p=!p}if(!p)p=i[h]=i[h]||new THREE.RenderableObject,h++,d=p,ha.copy(f.position),v.multiplyVector3(ha),d.object=f,d.z=ha.z,ja.push(d)}j&&ja.sort(c);return ja};this.projectScene=function(d,i,h){var M=i.near,f=i.far,ja,ha,aa,na,D,R,U,W,ia,P,za,Ma,Sa,Ta,Aa,Da,va;xa=y=r=q=ta.length=0;i.matrixAutoUpdate&&i.update(void 0,!0);d.update(void 0,!1,i);v.multiply(i.projectionMatrix,i.matrixWorldInverse);L[0].set(v.n41-v.n11,v.n42-v.n12,v.n43-v.n13,v.n44-v.n14);L[1].set(v.n41+v.n11,
-v.n42+v.n12,v.n43+v.n13,v.n44+v.n14);L[2].set(v.n41+v.n21,v.n42+v.n22,v.n43+v.n23,v.n44+v.n24);L[3].set(v.n41-v.n21,v.n42-v.n22,v.n43-v.n23,v.n44-v.n24);L[4].set(v.n41-v.n31,v.n42-v.n32,v.n43-v.n33,v.n44-v.n34);L[5].set(v.n41+v.n31,v.n42+v.n32,v.n43+v.n33,v.n44+v.n34);for(ja=0;ja<6;ja++)ia=L[ja],ia.divideScalar(Math.sqrt(ia.x*ia.x+ia.y*ia.y+ia.z*ia.z));ia=this.projectObjects(d,i,!0);d=0;for(ja=ia.length;d<ja;d++)if(P=ia[d].object,P.visible)if(za=P.matrixWorld,Ma=P.matrixRotationWorld,Sa=P.materials,
-Ta=P.overdraw,k=0,P instanceof THREE.Mesh){Aa=P.geometry;na=Aa.vertices;Da=Aa.faces;Aa=Aa.faceVertexUvs;ha=0;for(aa=na.length;ha<aa;ha++)j=b(),j.positionWorld.copy(na[ha].position),za.multiplyVector3(j.positionWorld),j.positionScreen.copy(j.positionWorld),v.multiplyVector4(j.positionScreen),j.positionScreen.x/=j.positionScreen.w,j.positionScreen.y/=j.positionScreen.w,j.visible=j.positionScreen.z>M&&j.positionScreen.z<f;na=0;for(ha=Da.length;na<ha;na++){aa=Da[na];if(aa instanceof THREE.Face3)if(D=
-n[aa.a],R=n[aa.b],U=n[aa.c],D.visible&&R.visible&&U.visible&&(P.doubleSided||P.flipSided!=(U.positionScreen.x-D.positionScreen.x)*(R.positionScreen.y-D.positionScreen.y)-(U.positionScreen.y-D.positionScreen.y)*(R.positionScreen.x-D.positionScreen.x)<0))W=m[q]=m[q]||new THREE.RenderableFace3,q++,p=W,p.v1.copy(D),p.v2.copy(R),p.v3.copy(U);else continue;else if(aa instanceof THREE.Face4)if(D=n[aa.a],R=n[aa.b],U=n[aa.c],W=n[aa.d],D.visible&&R.visible&&U.visible&&W.visible&&(P.doubleSided||P.flipSided!=
-((W.positionScreen.x-D.positionScreen.x)*(R.positionScreen.y-D.positionScreen.y)-(W.positionScreen.y-D.positionScreen.y)*(R.positionScreen.x-D.positionScreen.x)<0||(R.positionScreen.x-U.positionScreen.x)*(W.positionScreen.y-U.positionScreen.y)-(R.positionScreen.y-U.positionScreen.y)*(W.positionScreen.x-U.positionScreen.x)<0)))va=t[r]=t[r]||new THREE.RenderableFace4,r++,p=va,p.v1.copy(D),p.v2.copy(R),p.v3.copy(U),p.v4.copy(W);else continue;p.normalWorld.copy(aa.normal);Ma.multiplyVector3(p.normalWorld);
-p.centroidWorld.copy(aa.centroid);za.multiplyVector3(p.centroidWorld);p.centroidScreen.copy(p.centroidWorld);v.multiplyVector3(p.centroidScreen);U=aa.vertexNormals;D=0;for(R=U.length;D<R;D++)W=p.vertexNormalsWorld[D],W.copy(U[D]),Ma.multiplyVector3(W);D=0;for(R=Aa.length;D<R;D++)if(va=Aa[D][na]){U=0;for(W=va.length;U<W;U++)p.uvs[D][U]=va[U]}p.meshMaterials=Sa;p.faceMaterials=aa.materials;p.overdraw=Ta;p.z=p.centroidScreen.z;ta.push(p)}}else if(P instanceof THREE.Line){T.multiply(v,za);na=P.geometry.vertices;
-D=b();D.positionScreen.copy(na[0].position);T.multiplyVector4(D.positionScreen);ha=1;for(aa=na.length;ha<aa;ha++)if(D=b(),D.positionScreen.copy(na[ha].position),T.multiplyVector4(D.positionScreen),R=n[k-2],V.copy(D.positionScreen),la.copy(R.positionScreen),e(V,la))V.multiplyScalar(1/V.w),la.multiplyScalar(1/la.w),za=J[y]=J[y]||new THREE.RenderableLine,y++,A=za,A.v1.positionScreen.copy(V),A.v2.positionScreen.copy(la),A.z=Math.max(V.z,la.z),A.materials=P.materials,ta.push(A)}else if(P instanceof THREE.Particle&&
-(G.set(P.matrixWorld.n14,P.matrixWorld.n24,P.matrixWorld.n34,1),v.multiplyVector4(G),G.z/=G.w,G.z>0&&G.z<1))za=ya[xa]=ya[xa]||new THREE.RenderableParticle,xa++,F=za,F.x=G.x/G.w,F.y=G.y/G.w,F.z=G.z,F.rotation=P.rotation.z,F.scale.x=P.scale.x*Math.abs(F.x-(G.x+i.projectionMatrix.n11)/(G.w+i.projectionMatrix.n14)),F.scale.y=P.scale.y*Math.abs(F.y-(G.y+i.projectionMatrix.n22)/(G.w+i.projectionMatrix.n24)),F.materials=P.materials,ta.push(F);h&&ta.sort(c);return ta}};
-THREE.Quaternion=function(b,c,e,d){this.set(b||0,c||0,e||0,d!==void 0?d:1)};
-THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(b,c,e,d){this.x=b;this.y=c;this.z=e;this.w=d;return this},copy:function(b){this.x=b.x;this.y=b.y;this.z=b.z;this.w=b.w;return this},setFromEuler:function(b){var c=Math.PI/360,e=b.x*c,d=b.y*c,h=b.z*c,b=Math.cos(d),d=Math.sin(d),c=Math.cos(-h),h=Math.sin(-h),i=Math.cos(e),e=Math.sin(e),j=b*c,k=d*h;this.w=j*i-k*e;this.x=j*e+k*i;this.y=d*c*i+b*h*e;this.z=b*h*i-d*c*e;return this},setFromAxisAngle:function(b,c){var e=c/2,d=Math.sin(e);
-this.x=b.x*d;this.y=b.y*d;this.z=b.z*d;this.w=Math.cos(e);return this},setFromRotationMatrix:function(b){var c=Math.pow(b.determinant(),1/3);this.w=Math.sqrt(Math.max(0,c+b.n11+b.n22+b.n33))/2;this.x=Math.sqrt(Math.max(0,c+b.n11-b.n22-b.n33))/2;this.y=Math.sqrt(Math.max(0,c-b.n11+b.n22-b.n33))/2;this.z=Math.sqrt(Math.max(0,c-b.n11-b.n22+b.n33))/2;this.x=b.n32-b.n23<0?-Math.abs(this.x):Math.abs(this.x);this.y=b.n13-b.n31<0?-Math.abs(this.y):Math.abs(this.y);this.z=b.n21-b.n12<0?-Math.abs(this.z):Math.abs(this.z);
+-1)b.parent!==void 0&&b.parent.remove(b),b.parent=this,this.children.push(b)},remove:function(b){var c=this.children.indexOf(b);if(c!==-1)b.parent=void 0,this.children.splice(c,1)},getChildByName:function(b,c){var d,e,h;d=0;for(e=this.children.length;d<e;d++){h=this.children[d];if(h.name===b)return h;if(c&&(h=h.getChildByName(b,c),h!==void 0))return h}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,
+this.eulerOrder);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},updateMatrixWorld:function(b){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||b)this.parent?this.matrixWorld.multiply(this.parent.matrixWorld,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,b=!0;for(var c=0,d=this.children.length;c<
+d;c++)this.children[c].updateMatrixWorld(b)}};THREE.Object3DCount=0;
+THREE.Projector=function(){function b(){var b=i[h]=i[h]||new THREE.RenderableVertex;h++;return b}function c(b,c){return c.z-b.z}function d(b,c){var d=0,e=1,i=b.z+b.w,h=c.z+c.w,j=-b.z+b.w,k=-c.z+c.w;return i>=0&&h>=0&&j>=0&&k>=0?!0:i<0&&h<0||j<0&&k<0?!1:(i<0?d=Math.max(d,i/(i-h)):h<0&&(e=Math.min(e,i/(i-h))),j<0?d=Math.max(d,j/(j-k)):k<0&&(e=Math.min(e,j/(j-k))),e<d?!1:(b.lerpSelf(c,d),c.lerpSelf(b,1-e),!0))}var e,h,i=[],j,k,s=[],p,o=[],n,q,v=[],y,D,E=[],H={objects:[],lights:[],elements:[]};new THREE.Vector3;
+var ia=new THREE.Vector4,B=new THREE.Matrix4,va=new THREE.Matrix4,ka=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],sa=new THREE.Vector4,N=new THREE.Vector4;this.projectVector=function(b,c){c.matrixWorldInverse.getInverse(c.matrixWorld);B.multiply(c.projectionMatrix,c.matrixWorldInverse);B.multiplyVector3(b);return b};this.unprojectVector=function(b,c){c.projectionMatrixInverse.getInverse(c.projectionMatrix);B.multiply(c.matrixWorld,c.projectionMatrixInverse);
+B.multiplyVector3(b);return b};this.pickingRay=function(b,c){var d;b.z=-1;d=new THREE.Vector3(b.x,b.y,1);this.unprojectVector(b,c);this.unprojectVector(d,c);d.subSelf(b).normalize();return new THREE.Ray(b,d)};this.projectGraph=function(b){H.objects.length=0;H.lights.length=0;var c=function(b){if(b.visible!=!1){var d;if(!(d=b instanceof THREE.Particle))if(!(d=b instanceof THREE.Line))if(d=b instanceof THREE.Mesh)if(!(d=!b.frustumCulled))a:{for(var e=b.matrixWorld,i=-b.geometry.boundingSphere.radius*
+Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),h=0;h<6;h++)if(d=ka[h].x*e.n14+ka[h].y*e.n24+ka[h].z*e.n34+ka[h].w,d<=i){d=!1;break a}d=!0}d?H.objects.push(b):b instanceof THREE.Light&&H.lights.push(b);d=0;for(e=b.children.length;d<e;d++)c(b.children[d])}};c(b);return H};this.projectScene=function(Y,R,ra){var aa=R.near,la=R.far,Z,X,x,F,f,S,O,W,J,oa,za,La,Ja,Aa,xa,ya;D=q=p=k=0;H.elements.length=0;R.parent==null&&(console.warn("Camera is not on the Scene. Adding it..."),Y.add(R));Y.updateMatrixWorld();
+R.matrixWorldInverse.getInverse(R.matrixWorld);B.multiply(R.projectionMatrix,R.matrixWorldInverse);ka[0].set(B.n41-B.n11,B.n42-B.n12,B.n43-B.n13,B.n44-B.n14);ka[1].set(B.n41+B.n11,B.n42+B.n12,B.n43+B.n13,B.n44+B.n14);ka[2].set(B.n41+B.n21,B.n42+B.n22,B.n43+B.n23,B.n44+B.n24);ka[3].set(B.n41-B.n21,B.n42-B.n22,B.n43-B.n23,B.n44-B.n24);ka[4].set(B.n41-B.n31,B.n42-B.n32,B.n43-B.n33,B.n44-B.n34);ka[5].set(B.n41+B.n31,B.n42+B.n32,B.n43+B.n33,B.n44+B.n34);for(Z=0;Z<6;Z++)J=ka[Z],J.divideScalar(Math.sqrt(J.x*
+J.x+J.y*J.y+J.z*J.z));H=this.projectGraph(Y);Y=0;for(Z=H.objects.length;Y<Z;Y++)if(J=H.objects[Y],oa=J.matrixWorld,La=J.materials,Ja=J.overdraw,h=0,J instanceof THREE.Mesh){za=J.geometry;F=za.vertices;Aa=za.faces;xa=za.faceVertexUvs;za=J.matrixRotationWorld.extractRotation(J.matrixWorld);X=0;for(x=F.length;X<x;X++)e=b(),e.positionWorld.copy(F[X].position),oa.multiplyVector3(e.positionWorld),e.positionScreen.copy(e.positionWorld),B.multiplyVector4(e.positionScreen),e.positionScreen.x/=e.positionScreen.w,
+e.positionScreen.y/=e.positionScreen.w,e.visible=e.positionScreen.z>aa&&e.positionScreen.z<la;F=0;for(X=Aa.length;F<X;F++){x=Aa[F];if(x instanceof THREE.Face3)if(f=i[x.a],S=i[x.b],O=i[x.c],f.visible&&S.visible&&O.visible&&(J.doubleSided||J.flipSided!=(O.positionScreen.x-f.positionScreen.x)*(S.positionScreen.y-f.positionScreen.y)-(O.positionScreen.y-f.positionScreen.y)*(S.positionScreen.x-f.positionScreen.x)<0))W=s[k]=s[k]||new THREE.RenderableFace3,k++,j=W,j.v1.copy(f),j.v2.copy(S),j.v3.copy(O);else continue;
+else if(x instanceof THREE.Face4)if(f=i[x.a],S=i[x.b],O=i[x.c],W=i[x.d],f.visible&&S.visible&&O.visible&&W.visible&&(J.doubleSided||J.flipSided!=((W.positionScreen.x-f.positionScreen.x)*(S.positionScreen.y-f.positionScreen.y)-(W.positionScreen.y-f.positionScreen.y)*(S.positionScreen.x-f.positionScreen.x)<0||(S.positionScreen.x-O.positionScreen.x)*(W.positionScreen.y-O.positionScreen.y)-(S.positionScreen.y-O.positionScreen.y)*(W.positionScreen.x-O.positionScreen.x)<0)))ya=o[p]=o[p]||new THREE.RenderableFace4,
+p++,j=ya,j.v1.copy(f),j.v2.copy(S),j.v3.copy(O),j.v4.copy(W);else continue;j.normalWorld.copy(x.normal);za.multiplyVector3(j.normalWorld);j.centroidWorld.copy(x.centroid);oa.multiplyVector3(j.centroidWorld);j.centroidScreen.copy(j.centroidWorld);B.multiplyVector3(j.centroidScreen);O=x.vertexNormals;f=0;for(S=O.length;f<S;f++)W=j.vertexNormalsWorld[f],W.copy(O[f]),za.multiplyVector3(W);f=0;for(S=xa.length;f<S;f++)if(ya=xa[f][F]){O=0;for(W=ya.length;O<W;O++)j.uvs[f][O]=ya[O]}j.meshMaterials=La;j.faceMaterials=
+x.materials;j.overdraw=Ja;j.z=j.centroidScreen.z;H.elements.push(j)}}else if(J instanceof THREE.Line){va.multiply(B,oa);F=J.geometry.vertices;f=b();f.positionScreen.copy(F[0].position);va.multiplyVector4(f.positionScreen);X=1;for(x=F.length;X<x;X++)if(f=b(),f.positionScreen.copy(F[X].position),va.multiplyVector4(f.positionScreen),S=i[h-2],sa.copy(f.positionScreen),N.copy(S.positionScreen),d(sa,N))sa.multiplyScalar(1/sa.w),N.multiplyScalar(1/N.w),oa=v[q]=v[q]||new THREE.RenderableLine,q++,n=oa,n.v1.positionScreen.copy(sa),
+n.v2.positionScreen.copy(N),n.z=Math.max(sa.z,N.z),n.materials=J.materials,H.elements.push(n)}else if(J instanceof THREE.Particle&&(ia.set(J.matrixWorld.n14,J.matrixWorld.n24,J.matrixWorld.n34,1),B.multiplyVector4(ia),ia.z/=ia.w,ia.z>0&&ia.z<1))oa=E[D]=E[D]||new THREE.RenderableParticle,D++,y=oa,y.x=ia.x/ia.w,y.y=ia.y/ia.w,y.z=ia.z,y.rotation=J.rotation.z,y.scale.x=J.scale.x*Math.abs(y.x-(ia.x+R.projectionMatrix.n11)/(ia.w+R.projectionMatrix.n14)),y.scale.y=J.scale.y*Math.abs(y.y-(ia.y+R.projectionMatrix.n22)/
+(ia.w+R.projectionMatrix.n24)),y.materials=J.materials,H.elements.push(y);ra&&H.elements.sort(c);return H}};THREE.Quaternion=function(b,c,d,e){this.set(b||0,c||0,d||0,e!==void 0?e:1)};
+THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(b,c,d,e){this.x=b;this.y=c;this.z=d;this.w=e;return this},copy:function(b){this.x=b.x;this.y=b.y;this.z=b.z;this.w=b.w;return this},setFromEuler:function(b){var c=Math.PI/360,d=b.x*c,e=b.y*c,h=b.z*c,b=Math.cos(e),e=Math.sin(e),c=Math.cos(-h),h=Math.sin(-h),i=Math.cos(d),d=Math.sin(d),j=b*c,k=e*h;this.w=j*i-k*d;this.x=j*d+k*i;this.y=e*c*i+b*h*d;this.z=b*h*i-e*c*d;return this},setFromAxisAngle:function(b,c){var d=c/2,e=Math.sin(d);
+this.x=b.x*e;this.y=b.y*e;this.z=b.z*e;this.w=Math.cos(d);return this},setFromRotationMatrix:function(b){var c=Math.pow(b.determinant(),1/3);this.w=Math.sqrt(Math.max(0,c+b.n11+b.n22+b.n33))/2;this.x=Math.sqrt(Math.max(0,c+b.n11-b.n22-b.n33))/2;this.y=Math.sqrt(Math.max(0,c-b.n11+b.n22-b.n33))/2;this.z=Math.sqrt(Math.max(0,c-b.n11-b.n22+b.n33))/2;this.x=b.n32-b.n23<0?-Math.abs(this.x):Math.abs(this.x);this.y=b.n13-b.n31<0?-Math.abs(this.y):Math.abs(this.y);this.z=b.n21-b.n12<0?-Math.abs(this.z):Math.abs(this.z);
 this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var b=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);b==0?this.w=this.z=this.y=this.x=0:(b=1/b,this.x*=b,this.y*=b,this.z*=b,this.w*=b);return this},multiplySelf:function(b){var c=
-this.x,e=this.y,d=this.z,h=this.w,i=b.x,j=b.y,k=b.z,b=b.w;this.x=c*b+h*i+e*k-d*j;this.y=e*b+h*j+d*i-c*k;this.z=d*b+h*k+c*j-e*i;this.w=h*b-c*i-e*j-d*k;return this},multiply:function(b,c){this.x=b.x*c.w+b.y*c.z-b.z*c.y+b.w*c.x;this.y=-b.x*c.z+b.y*c.w+b.z*c.x+b.w*c.y;this.z=b.x*c.y-b.y*c.x+b.z*c.w+b.w*c.z;this.w=-b.x*c.x-b.y*c.y-b.z*c.z+b.w*c.w;return this},multiplyVector3:function(b,c){c||(c=b);var e=b.x,d=b.y,h=b.z,i=this.x,j=this.y,k=this.z,n=this.w,p=n*e+j*h-k*d,q=n*d+k*e-i*h,m=n*h+i*d-j*e,e=-i*
-e-j*d-k*h;c.x=p*n+e*-i+q*-k-m*-j;c.y=q*n+e*-j+m*-i-p*-k;c.z=m*n+e*-k+p*-j-q*-i;return c}};THREE.Quaternion.slerp=function(b,c,e,d){var h=b.w*c.w+b.x*c.x+b.y*c.y+b.z*c.z;if(Math.abs(h)>=1)return e.w=b.w,e.x=b.x,e.y=b.y,e.z=b.z,e;var i=Math.acos(h),j=Math.sqrt(1-h*h);if(Math.abs(j)<0.0010)return e.w=0.5*(b.w+c.w),e.x=0.5*(b.x+c.x),e.y=0.5*(b.y+c.y),e.z=0.5*(b.z+c.z),e;h=Math.sin((1-d)*i)/j;d=Math.sin(d*i)/j;e.w=b.w*h+c.w*d;e.x=b.x*h+c.x*d;e.y=b.y*h+c.y*d;e.z=b.z*h+c.z*d;return e};
-THREE.Vertex=function(b){this.position=b||new THREE.Vector3};THREE.Face3=function(b,c,e,d,h,i){this.a=b;this.b=c;this.c=e;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=h instanceof THREE.Color?h:new THREE.Color;this.vertexColors=h instanceof Array?h:[];this.vertexTangents=[];this.materials=i instanceof Array?i:[i];this.centroid=new THREE.Vector3};
-THREE.Face4=function(b,c,e,d,h,i,j){this.a=b;this.b=c;this.c=e;this.d=d;this.normal=h instanceof THREE.Vector3?h:new THREE.Vector3;this.vertexNormals=h instanceof Array?h:[];this.color=i instanceof THREE.Color?i:new THREE.Color;this.vertexColors=i instanceof Array?i:[];this.vertexTangents=[];this.materials=j instanceof Array?j:[j];this.centroid=new THREE.Vector3};THREE.UV=function(b,c){this.u=b||0;this.v=c||0};
+this.x,d=this.y,e=this.z,h=this.w,i=b.x,j=b.y,k=b.z,b=b.w;this.x=c*b+h*i+d*k-e*j;this.y=d*b+h*j+e*i-c*k;this.z=e*b+h*k+c*j-d*i;this.w=h*b-c*i-d*j-e*k;return this},multiply:function(b,c){this.x=b.x*c.w+b.y*c.z-b.z*c.y+b.w*c.x;this.y=-b.x*c.z+b.y*c.w+b.z*c.x+b.w*c.y;this.z=b.x*c.y-b.y*c.x+b.z*c.w+b.w*c.z;this.w=-b.x*c.x-b.y*c.y-b.z*c.z+b.w*c.w;return this},multiplyVector3:function(b,c){c||(c=b);var d=b.x,e=b.y,h=b.z,i=this.x,j=this.y,k=this.z,s=this.w,p=s*d+j*h-k*e,o=s*e+k*d-i*h,n=s*h+i*e-j*d,d=-i*
+d-j*e-k*h;c.x=p*s+d*-i+o*-k-n*-j;c.y=o*s+d*-j+n*-i-p*-k;c.z=n*s+d*-k+p*-j-o*-i;return c}};
+THREE.Quaternion.slerp=function(b,c,d,e){var h=b.w*c.w+b.x*c.x+b.y*c.y+b.z*c.z;h<0?(d.w=-c.w,d.x=-c.x,d.y=-c.y,d.z=-c.z,h=-h):d.copy(c);if(Math.abs(h)>=1)return d.w=b.w,d.x=b.x,d.y=b.y,d.z=b.z,d;var i=Math.acos(h),h=Math.sqrt(1-h*h);if(Math.abs(h)<0.0010)return d.w=0.5*(b.w+c.w),d.x=0.5*(b.x+c.x),d.y=0.5*(b.y+c.y),d.z=0.5*(b.z+c.z),d;c=Math.sin((1-e)*i)/h;e=Math.sin(e*i)/h;d.w=b.w*c+d.w*e;d.x=b.x*c+d.x*e;d.y=b.y*c+d.y*e;d.z=b.z*c+d.z*e;return d};THREE.Vertex=function(b){this.position=b||new THREE.Vector3};
+THREE.Face3=function(b,c,d,e,h,i){this.a=b;this.b=c;this.c=d;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=h instanceof THREE.Color?h:new THREE.Color;this.vertexColors=h instanceof Array?h:[];this.vertexTangents=[];this.materials=i instanceof Array?i:[i];this.centroid=new THREE.Vector3};
+THREE.Face4=function(b,c,d,e,h,i,j){this.a=b;this.b=c;this.c=d;this.d=e;this.normal=h instanceof THREE.Vector3?h:new THREE.Vector3;this.vertexNormals=h instanceof Array?h:[];this.color=i instanceof THREE.Color?i:new THREE.Color;this.vertexColors=i instanceof Array?i:[];this.vertexTangents=[];this.materials=j instanceof Array?j:[j];this.centroid=new THREE.Vector3};THREE.UV=function(b,c){this.u=b||0;this.v=c||0};
 THREE.UV.prototype={constructor:THREE.UV,set:function(b,c){this.u=b;this.v=c;return this},copy:function(b){this.u=b.u;this.v=b.v;return this},clone:function(){return new THREE.UV(this.u,this.v)}};THREE.Geometry=function(){this.id=THREE.GeometryCount++;this.vertices=[];this.colors=[];this.faces=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.dynamic=this.hasTangents=!1};
-THREE.Geometry.prototype={constructor:THREE.Geometry,applyMatrix:function(b){var c=new THREE.Matrix4;c.extractRotation(b,new THREE.Vector3(1,1,1));for(var e=0,d=this.vertices.length;e<d;e++)b.multiplyVector3(this.vertices[e].position);e=0;for(d=this.faces.length;e<d;e++){var h=this.faces[e];c.multiplyVector3(h.normal);for(var i=0,j=h.vertexNormals.length;i<j;i++)c.multiplyVector3(h.vertexNormals[i]);b.multiplyVector3(h.centroid)}},computeCentroids:function(){var b,c,e;b=0;for(c=this.faces.length;b<
-c;b++)e=this.faces[b],e.centroid.set(0,0,0),e instanceof THREE.Face3?(e.centroid.addSelf(this.vertices[e.a].position),e.centroid.addSelf(this.vertices[e.b].position),e.centroid.addSelf(this.vertices[e.c].position),e.centroid.divideScalar(3)):e instanceof THREE.Face4&&(e.centroid.addSelf(this.vertices[e.a].position),e.centroid.addSelf(this.vertices[e.b].position),e.centroid.addSelf(this.vertices[e.c].position),e.centroid.addSelf(this.vertices[e.d].position),e.centroid.divideScalar(4))},computeFaceNormals:function(b){var c,
-e,d,h,i,j,k=new THREE.Vector3,n=new THREE.Vector3;d=0;for(h=this.faces.length;d<h;d++){i=this.faces[d];if(b&&i.vertexNormals.length){k.set(0,0,0);c=0;for(e=i.vertexNormals.length;c<e;c++)k.addSelf(i.vertexNormals[c]);k.divideScalar(3)}else c=this.vertices[i.a],e=this.vertices[i.b],j=this.vertices[i.c],k.sub(j.position,e.position),n.sub(c.position,e.position),k.crossSelf(n);k.isZero()||k.normalize();i.normal.copy(k)}},computeVertexNormals:function(){var b,c,e,d;if(this.__tmpVertices==void 0){d=this.__tmpVertices=
-Array(this.vertices.length);b=0;for(c=this.vertices.length;b<c;b++)d[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)if(e=this.faces[b],e instanceof THREE.Face3)e.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(e instanceof THREE.Face4)e.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{d=this.__tmpVertices;b=0;for(c=this.vertices.length;b<c;b++)d[b].set(0,0,0)}b=0;for(c=this.faces.length;b<c;b++)e=this.faces[b],e instanceof
-THREE.Face3?(d[e.a].addSelf(e.normal),d[e.b].addSelf(e.normal),d[e.c].addSelf(e.normal)):e instanceof THREE.Face4&&(d[e.a].addSelf(e.normal),d[e.b].addSelf(e.normal),d[e.c].addSelf(e.normal),d[e.d].addSelf(e.normal));b=0;for(c=this.vertices.length;b<c;b++)d[b].normalize();b=0;for(c=this.faces.length;b<c;b++)e=this.faces[b],e instanceof THREE.Face3?(e.vertexNormals[0].copy(d[e.a]),e.vertexNormals[1].copy(d[e.b]),e.vertexNormals[2].copy(d[e.c])):e instanceof THREE.Face4&&(e.vertexNormals[0].copy(d[e.a]),
-e.vertexNormals[1].copy(d[e.b]),e.vertexNormals[2].copy(d[e.c]),e.vertexNormals[3].copy(d[e.d]))},computeTangents:function(){function b(b,c,e,d,i,h,v){k=b.vertices[c].position;n=b.vertices[e].position;p=b.vertices[d].position;q=j[i];m=j[h];r=j[v];t=n.x-k.x;A=p.x-k.x;y=n.y-k.y;J=p.y-k.y;F=n.z-k.z;xa=p.z-k.z;ya=m.u-q.u;ja=r.u-q.u;ta=m.v-q.v;ha=r.v-q.v;G=1/(ya*ha-ja*ta);V.set((ha*t-ta*A)*G,(ha*y-ta*J)*G,(ha*F-ta*xa)*G);la.set((ya*A-ja*t)*G,(ya*J-ja*y)*G,(ya*xa-ja*F)*G);T[c].addSelf(V);T[e].addSelf(V);
-T[d].addSelf(V);L[c].addSelf(la);L[e].addSelf(la);L[d].addSelf(la)}var c,e,d,h,i,j,k,n,p,q,m,r,t,A,y,J,F,xa,ya,ja,ta,ha,G,v,T=[],L=[],V=new THREE.Vector3,la=new THREE.Vector3,Z=new THREE.Vector3,Ca=new THREE.Vector3,$=new THREE.Vector3;c=0;for(e=this.vertices.length;c<e;c++)T[c]=new THREE.Vector3,L[c]=new THREE.Vector3;c=0;for(e=this.faces.length;c<e;c++)i=this.faces[c],j=this.faceVertexUvs[0][c],i instanceof THREE.Face3?b(this,i.a,i.b,i.c,0,1,2):i instanceof THREE.Face4&&(b(this,i.a,i.b,i.c,0,1,
-2),b(this,i.a,i.b,i.d,0,1,3));var M=["a","b","c","d"];c=0;for(e=this.faces.length;c<e;c++){i=this.faces[c];for(d=0;d<i.vertexNormals.length;d++)$.copy(i.vertexNormals[d]),h=i[M[d]],v=T[h],Z.copy(v),Z.subSelf($.multiplyScalar($.dot(v))).normalize(),Ca.cross(i.vertexNormals[d],v),h=Ca.dot(L[h]),h=h<0?-1:1,i.vertexTangents[d]=new THREE.Vector4(Z.x,Z.y,Z.z,h)}this.hasTangents=!0},computeBoundingBox:function(){var b;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],
-y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var c=1,e=this.vertices.length;c<e;c++){b=this.vertices[c];if(b.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=b.position.x;else if(b.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=b.position.x;if(b.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=b.position.y;else if(b.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=b.position.y;if(b.position.z<
-this.boundingBox.z[0])this.boundingBox.z[0]=b.position.z;else if(b.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=b.position.z}}},computeBoundingSphere:function(){for(var b=0,c=0,e=this.vertices.length;c<e;c++)b=Math.max(b,this.vertices[c].position.length());this.boundingSphere={radius:b}},mergeVertices:function(){var b={},c=[],e=[],d,h=Math.pow(10,4),i,j;i=0;for(j=this.vertices.length;i<j;i++)d=this.vertices[i].position,d=[Math.round(d.x*h),Math.round(d.y*h),Math.round(d.z*h)].join("_"),
-b[d]===void 0?(b[d]=i,c.push(this.vertices[i]),e[i]=c.length-1):e[i]=e[b[d]];i=0;for(j=this.faces.length;i<j;i++){b=this.faces[i];if(b instanceof THREE.Face3)b.a=e[b.a],b.b=e[b.b],b.c=e[b.c];if(b instanceof THREE.Face4)b.a=e[b.a],b.b=e[b.b],b.c=e[b.c],b.d=e[b.d]}this.vertices=c}};THREE.GeometryCount=0;
-THREE.Spline=function(b){function c(b,c,e,d,i,h,j){b=(e-b)*0.5;d=(d-c)*0.5;return(2*(c-e)+b+d)*j+(-3*(c-e)-2*b-d)*h+b*i+c}this.points=b;var e=[],d={x:0,y:0,z:0},h,i,j,k,n,p,q,m,r;this.initFromArray=function(b){this.points=[];for(var c=0;c<b.length;c++)this.points[c]={x:b[c][0],y:b[c][1],z:b[c][2]}};this.getPoint=function(b){h=(this.points.length-1)*b;i=Math.floor(h);j=h-i;e[0]=i==0?i:i-1;e[1]=i;e[2]=i>this.points.length-2?i:i+1;e[3]=i>this.points.length-3?i:i+2;p=this.points[e[0]];q=this.points[e[1]];
-m=this.points[e[2]];r=this.points[e[3]];k=j*j;n=j*k;d.x=c(p.x,q.x,m.x,r.x,j,k,n);d.y=c(p.y,q.y,m.y,r.y,j,k,n);d.z=c(p.z,q.z,m.z,r.z,j,k,n);return d};this.getControlPointsArray=function(){var b,c,e=this.points.length,d=[];for(b=0;b<e;b++)c=this.points[b],d[b]=[c.x,c.y,c.z];return d};this.getLength=function(b){var c,e,d=c=c=0,i=new THREE.Vector3,h=new THREE.Vector3,j=[],k=0;j[0]=0;b||(b=100);e=this.points.length*b;i.copy(this.points[0]);for(b=1;b<e;b++)c=b/e,position=this.getPoint(c),h.copy(position),
-k+=h.distanceTo(i),i.copy(position),c*=this.points.length-1,c=Math.floor(c),c!=d&&(j[c]=k,d=c);j[j.length]=k;return{chunks:j,total:k}};this.reparametrizeByArcLength=function(b){var c,e,d,i,h,j,k=[],p=new THREE.Vector3,n=this.getLength();k.push(p.copy(this.points[0]).clone());for(c=1;c<this.points.length;c++){e=n.chunks[c]-n.chunks[c-1];j=Math.ceil(b*e/n.total);i=(c-1)/(this.points.length-1);h=c/(this.points.length-1);for(e=1;e<j-1;e++)d=i+e*(1/j)*(h-i),position=this.getPoint(d),k.push(p.copy(position).clone());
-k.push(p.copy(this.points[c]).clone())}this.points=k}};THREE.Edge=function(b,c,e,d){this.vertices=[b,c];this.vertexIndices=[e,d];this.faces=[];this.faceIndices=[]};THREE.Camera=function(){if(arguments.length)return console.warn("DEPRECATED: Camera() is now PerspectiveCamera() or OrthographicCamera()."),new THREE.PerspectiveCamera(arguments[0],arguments[1],arguments[2],arguments[3]);THREE.Object3D.call(this);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4};
-THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.lookAt=function(b){this.matrix.lookAt(this.position,b,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)};
-THREE.Camera.prototype.update=function(b,c,e){this.matrixAutoUpdate&&this.updateMatrix();if(c||this.matrixWorldNeedsUpdate)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,c=!0,THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);for(b=0;b<this.children.length;b++)this.children[b].update(this.matrixWorld,c,e)};
-THREE.OrthographicCamera=function(b,c,e,d,h,i){THREE.Camera.call(this);this.left=b;this.right=c;this.top=e;this.bottom=d;this.near=h!==void 0?h:0.1;this.far=i!==void 0?i:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=new THREE.Camera;THREE.OrthographicCamera.prototype.constructor=THREE.OrthographicCamera;THREE.OrthographicCamera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makeOrtho(this.left,this.right,this.top,this.bottom,this.near,this.far)};
-THREE.PerspectiveCamera=function(b,c,e,d){THREE.Camera.call(this);this.fov=b!==void 0?b:50;this.aspect=c!==void 0?c:1;this.near=e!==void 0?e:0.1;this.far=d!==void 0?d:2E3;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype=new THREE.Camera;THREE.PerspectiveCamera.prototype.constructor=THREE.PerspectiveCamera;THREE.PerspectiveCamera.prototype.setLens=function(b,c){this.fov=2*Math.atan((c!==void 0?c:43.25)/(b*2));this.fov*=180/Math.PI;this.updateProjectionMatrix()};
-THREE.PerspectiveCamera.prototype.setViewOffset=function(b,c,e,d,h,i){this.fullWidth=b;this.fullHeight=c;this.x=e;this.y=d;this.width=h;this.height=i;this.updateProjectionMatrix()};
-THREE.PerspectiveCamera.prototype.updateProjectionMatrix=function(){if(this.fullWidth){var b=this.fullWidth/this.fullHeight,c=Math.tan(this.fov*Math.PI/360)*this.near,e=-c,d=b*e,b=Math.abs(b*c-d),e=Math.abs(c-e);this.projectionMatrix=THREE.Matrix4.makeFrustum(d+this.x*b/this.fullWidth,d+(this.x+this.width)*b/this.fullWidth,c-(this.y+this.height)*e/this.fullHeight,c-this.y*e/this.fullHeight,this.near,this.far)}else this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,
+THREE.Geometry.prototype={constructor:THREE.Geometry,applyMatrix:function(b){var c=new THREE.Matrix4;c.extractRotation(b,new THREE.Vector3(1,1,1));for(var d=0,e=this.vertices.length;d<e;d++)b.multiplyVector3(this.vertices[d].position);d=0;for(e=this.faces.length;d<e;d++){var h=this.faces[d];c.multiplyVector3(h.normal);for(var i=0,j=h.vertexNormals.length;i<j;i++)c.multiplyVector3(h.vertexNormals[i]);b.multiplyVector3(h.centroid)}},computeCentroids:function(){var b,c,d;b=0;for(c=this.faces.length;b<
+c;b++)d=this.faces[b],d.centroid.set(0,0,0),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)):d instanceof THREE.Face4&&(d.centroid.addSelf(this.vertices[d.a].position),d.centroid.addSelf(this.vertices[d.b].position),d.centroid.addSelf(this.vertices[d.c].position),d.centroid.addSelf(this.vertices[d.d].position),d.centroid.divideScalar(4))},computeFaceNormals:function(b){var c,
+d,e,h,i,j,k=new THREE.Vector3,s=new THREE.Vector3;e=0;for(h=this.faces.length;e<h;e++){i=this.faces[e];if(b&&i.vertexNormals.length){k.set(0,0,0);c=0;for(d=i.vertexNormals.length;c<d;c++)k.addSelf(i.vertexNormals[c]);k.divideScalar(3)}else c=this.vertices[i.a],d=this.vertices[i.b],j=this.vertices[i.c],k.sub(j.position,d.position),s.sub(c.position,d.position),k.crossSelf(s);k.isZero()||k.normalize();i.normal.copy(k)}},computeVertexNormals:function(){var b,c,d,e;if(this.__tmpVertices==void 0){e=this.__tmpVertices=
+Array(this.vertices.length);b=0;for(c=this.vertices.length;b<c;b++)e[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)if(d=this.faces[b],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;b=0;for(c=this.vertices.length;b<c;b++)e[b].set(0,0,0)}b=0;for(c=this.faces.length;b<c;b++)d=this.faces[b],d instanceof
+THREE.Face3?(e[d.a].addSelf(d.normal),e[d.b].addSelf(d.normal),e[d.c].addSelf(d.normal)):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));b=0;for(c=this.vertices.length;b<c;b++)e[b].normalize();b=0;for(c=this.faces.length;b<c;b++)d=this.faces[b],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])):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 b(b,c,d,e,i,h,F){k=b.vertices[c].position;s=b.vertices[d].position;p=b.vertices[e].position;o=j[i];n=j[h];q=j[F];v=s.x-k.x;y=p.x-k.x;D=s.y-k.y;E=p.y-k.y;H=s.z-k.z;ia=p.z-k.z;B=n.u-o.u;va=q.u-o.u;ka=n.v-o.v;sa=q.v-o.v;N=1/(B*sa-va*ka);aa.set((sa*v-ka*y)*N,(sa*D-ka*E)*N,(sa*H-ka*ia)*N);la.set((B*y-va*v)*N,(B*E-va*D)*N,(B*ia-va*H)*N);R[c].addSelf(aa);R[d].addSelf(aa);
+R[e].addSelf(aa);ra[c].addSelf(la);ra[d].addSelf(la);ra[e].addSelf(la)}var c,d,e,h,i,j,k,s,p,o,n,q,v,y,D,E,H,ia,B,va,ka,sa,N,Y,R=[],ra=[],aa=new THREE.Vector3,la=new THREE.Vector3,Z=new THREE.Vector3,X=new THREE.Vector3,x=new THREE.Vector3;c=0;for(d=this.vertices.length;c<d;c++)R[c]=new THREE.Vector3,ra[c]=new THREE.Vector3;c=0;for(d=this.faces.length;c<d;c++)i=this.faces[c],j=this.faceVertexUvs[0][c],i instanceof THREE.Face3?b(this,i.a,i.b,i.c,0,1,2):i instanceof THREE.Face4&&(b(this,i.a,i.b,i.c,
+0,1,2),b(this,i.a,i.b,i.d,0,1,3));var F=["a","b","c","d"];c=0;for(d=this.faces.length;c<d;c++){i=this.faces[c];for(e=0;e<i.vertexNormals.length;e++)x.copy(i.vertexNormals[e]),h=i[F[e]],Y=R[h],Z.copy(Y),Z.subSelf(x.multiplyScalar(x.dot(Y))).normalize(),X.cross(i.vertexNormals[e],Y),h=X.dot(ra[h]),h=h<0?-1:1,i.vertexTangents[e]=new THREE.Vector4(Z.x,Z.y,Z.z,h)}this.hasTangents=!0},computeBoundingBox:function(){var b;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],
+y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var c=1,d=this.vertices.length;c<d;c++){b=this.vertices[c];if(b.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=b.position.x;else if(b.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=b.position.x;if(b.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=b.position.y;else if(b.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=b.position.y;if(b.position.z<
+this.boundingBox.z[0])this.boundingBox.z[0]=b.position.z;else if(b.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=b.position.z}}},computeBoundingSphere:function(){for(var b=0,c=0,d=this.vertices.length;c<d;c++)b=Math.max(b,this.vertices[c].position.length());this.boundingSphere={radius:b}},mergeVertices:function(){var b={},c=[],d=[],e,h=Math.pow(10,4),i,j;i=0;for(j=this.vertices.length;i<j;i++)e=this.vertices[i].position,e=[Math.round(e.x*h),Math.round(e.y*h),Math.round(e.z*h)].join("_"),
+b[e]===void 0?(b[e]=i,c.push(this.vertices[i]),d[i]=c.length-1):d[i]=d[b[e]];i=0;for(j=this.faces.length;i<j;i++){b=this.faces[i];if(b instanceof THREE.Face3)b.a=d[b.a],b.b=d[b.b],b.c=d[b.c];if(b instanceof THREE.Face4)b.a=d[b.a],b.b=d[b.b],b.c=d[b.c],b.d=d[b.d]}this.vertices=c}};THREE.GeometryCount=0;
+THREE.Spline=function(b){function c(b,c,d,e,i,h,j){b=(d-b)*0.5;e=(e-c)*0.5;return(2*(c-d)+b+e)*j+(-3*(c-d)-2*b-e)*h+b*i+c}this.points=b;var d=[],e={x:0,y:0,z:0},h,i,j,k,s,p,o,n,q;this.initFromArray=function(b){this.points=[];for(var c=0;c<b.length;c++)this.points[c]={x:b[c][0],y:b[c][1],z:b[c][2]}};this.getPoint=function(b){h=(this.points.length-1)*b;i=Math.floor(h);j=h-i;d[0]=i==0?i:i-1;d[1]=i;d[2]=i>this.points.length-2?i:i+1;d[3]=i>this.points.length-3?i:i+2;p=this.points[d[0]];o=this.points[d[1]];
+n=this.points[d[2]];q=this.points[d[3]];k=j*j;s=j*k;e.x=c(p.x,o.x,n.x,q.x,j,k,s);e.y=c(p.y,o.y,n.y,q.y,j,k,s);e.z=c(p.z,o.z,n.z,q.z,j,k,s);return e};this.getControlPointsArray=function(){var b,c,d=this.points.length,e=[];for(b=0;b<d;b++)c=this.points[b],e[b]=[c.x,c.y,c.z];return e};this.getLength=function(b){var c,d,e=c=c=0,i=new THREE.Vector3,h=new THREE.Vector3,j=[],k=0;j[0]=0;b||(b=100);d=this.points.length*b;i.copy(this.points[0]);for(b=1;b<d;b++)c=b/d,position=this.getPoint(c),h.copy(position),
+k+=h.distanceTo(i),i.copy(position),c*=this.points.length-1,c=Math.floor(c),c!=e&&(j[c]=k,e=c);j[j.length]=k;return{chunks:j,total:k}};this.reparametrizeByArcLength=function(b){var c,d,e,i,h,j,k=[],o=new THREE.Vector3,s=this.getLength();k.push(o.copy(this.points[0]).clone());for(c=1;c<this.points.length;c++){d=s.chunks[c]-s.chunks[c-1];j=Math.ceil(b*d/s.total);i=(c-1)/(this.points.length-1);h=c/(this.points.length-1);for(d=1;d<j-1;d++)e=i+d*(1/j)*(h-i),position=this.getPoint(e),k.push(o.copy(position).clone());
+k.push(o.copy(this.points[c]).clone())}this.points=k}};THREE.Edge=function(b,c,d,e){this.vertices=[b,c];this.vertexIndices=[d,e];this.faces=[];this.faceIndices=[]};
+THREE.Camera=function(){if(arguments.length)return console.warn("DEPRECATED: Camera() is now PerspectiveCamera() or OrthographicCamera()."),new THREE.PerspectiveCamera(arguments[0],arguments[1],arguments[2],arguments[3]);THREE.Object3D.call(this);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4;this.projectionMatrixInverse=new THREE.Matrix4};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;
+THREE.Camera.prototype.lookAt=function(b){this.matrix.lookAt(this.position,b,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)};THREE.OrthographicCamera=function(b,c,d,e,h,i){THREE.Camera.call(this);this.left=b;this.right=c;this.top=d;this.bottom=e;this.near=h!==void 0?h:0.1;this.far=i!==void 0?i:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=new THREE.Camera;THREE.OrthographicCamera.prototype.constructor=THREE.OrthographicCamera;
+THREE.OrthographicCamera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makeOrtho(this.left,this.right,this.top,this.bottom,this.near,this.far)};THREE.PerspectiveCamera=function(b,c,d,e){THREE.Camera.call(this);this.fov=b!==void 0?b:50;this.aspect=c!==void 0?c:1;this.near=d!==void 0?d:0.1;this.far=e!==void 0?e:2E3;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype=new THREE.Camera;THREE.PerspectiveCamera.prototype.constructor=THREE.PerspectiveCamera;
+THREE.PerspectiveCamera.prototype.setLens=function(b,c){this.fov=2*Math.atan((c!==void 0?c:43.25)/(b*2));this.fov*=180/Math.PI;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype.setViewOffset=function(b,c,d,e,h,i){this.fullWidth=b;this.fullHeight=c;this.x=d;this.y=e;this.width=h;this.height=i;this.updateProjectionMatrix()};
+THREE.PerspectiveCamera.prototype.updateProjectionMatrix=function(){if(this.fullWidth){var b=this.fullWidth/this.fullHeight,c=Math.tan(this.fov*Math.PI/360)*this.near,d=-c,e=b*d,b=Math.abs(b*c-e),d=Math.abs(c-d);this.projectionMatrix=THREE.Matrix4.makeFrustum(e+this.x*b/this.fullWidth,e+(this.x+this.width)*b/this.fullWidth,c-(this.y+this.height)*d/this.fullHeight,c-this.y*d/this.fullHeight,this.near,this.far)}else this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,
 this.far)};THREE.Light=function(b){THREE.Object3D.call(this);this.color=new THREE.Color(b)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(b){THREE.Light.call(this,b)};THREE.AmbientLight.prototype=new THREE.Light;THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;
-THREE.DirectionalLight=function(b,c,e){THREE.Light.call(this,b);this.position=new THREE.Vector3(0,1,0);this.intensity=c!==void 0?c:1;this.distance=e!==void 0?e:0};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(b,c,e){THREE.Light.call(this,b);this.position=new THREE.Vector3(0,0,0);this.intensity=c!==void 0?c:1;this.distance=e!==void 0?e:0};THREE.PointLight.prototype=new THREE.Light;
-THREE.PointLight.prototype.constructor=THREE.PointLight;THREE.SpotLight=function(b,c,e,d){THREE.Light.call(this,b);this.position=new THREE.Vector3(0,1,0);this.target=new THREE.Object3D;this.intensity=c!==void 0?c:1;this.distance=e!==void 0?e:0;this.castShadow=d!==void 0?d:!1};THREE.SpotLight.prototype=new THREE.Light;THREE.SpotLight.prototype.constructor=THREE.SpotLight;
+THREE.DirectionalLight=function(b,c,d){THREE.Light.call(this,b);this.position=new THREE.Vector3(0,1,0);this.intensity=c!==void 0?c:1;this.distance=d!==void 0?d:0};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(b,c,d){THREE.Light.call(this,b);this.position=new THREE.Vector3(0,0,0);this.intensity=c!==void 0?c:1;this.distance=d!==void 0?d:0};THREE.PointLight.prototype=new THREE.Light;
+THREE.PointLight.prototype.constructor=THREE.PointLight;THREE.SpotLight=function(b,c,d,e){THREE.Light.call(this,b);this.position=new THREE.Vector3(0,1,0);this.target=new THREE.Object3D;this.intensity=c!==void 0?c:1;this.distance=d!==void 0?d:0;this.castShadow=e!==void 0?e:!1};THREE.SpotLight.prototype=new THREE.Light;THREE.SpotLight.prototype.constructor=THREE.SpotLight;
 THREE.Material=function(b){this.name="";this.id=THREE.MaterialCount++;b=b||{};this.opacity=b.opacity!==void 0?b.opacity:1;this.transparent=b.transparent!==void 0?b.transparent:!1;this.blending=b.blending!==void 0?b.blending:THREE.NormalBlending;this.depthTest=b.depthTest!==void 0?b.depthTest:!0;this.depthWrite=b.depthWrite!==void 0?b.depthWrite:!0;this.polygonOffset=b.polygonOffset!==void 0?b.polygonOffset:!1;this.polygonOffsetFactor=b.polygonOffsetFactor!==void 0?b.polygonOffsetFactor:0;this.polygonOffsetUnits=
 b.polygonOffsetUnits!==void 0?b.polygonOffsetUnits:0;this.alphaTest=b.alphaTest!==void 0?b.alphaTest:0};THREE.MaterialCount=0;THREE.NoShading=0;THREE.FlatShading=1;THREE.SmoothShading=2;THREE.NoColors=0;THREE.FaceColors=1;THREE.VertexColors=2;THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;THREE.MultiplyBlending=3;THREE.AdditiveAlphaBlending=4;
 THREE.LineBasicMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.color=b.color!==void 0?new THREE.Color(b.color):new THREE.Color(16777215);this.linewidth=b.linewidth!==void 0?b.linewidth:1;this.linecap=b.linecap!==void 0?b.linecap:"round";this.linejoin=b.linejoin!==void 0?b.linejoin:"round";this.vertexColors=b.vertexColors?b.vertexColors:!1;this.fog=b.fog!==void 0?b.fog:!0};THREE.LineBasicMaterial.prototype=new THREE.Material;THREE.LineBasicMaterial.prototype.constructor=THREE.LineBasicMaterial;
@@ -116,36 +115,32 @@ THREE.MeshShaderMaterial=function(b){console.warn("DEPRECATED: MeshShaderMateria
 THREE.ParticleBasicMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.color=b.color!==void 0?new THREE.Color(b.color):new THREE.Color(16777215);this.map=b.map!==void 0?b.map:null;this.size=b.size!==void 0?b.size:1;this.sizeAttenuation=b.sizeAttenuation!==void 0?b.sizeAttenuation:!0;this.vertexColors=b.vertexColors!==void 0?b.vertexColors:!1;this.fog=b.fog!==void 0?b.fog:!0};THREE.ParticleBasicMaterial.prototype=new THREE.Material;THREE.ParticleBasicMaterial.prototype.constructor=THREE.ParticleBasicMaterial;
 THREE.ShaderMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.fragmentShader=b.fragmentShader!==void 0?b.fragmentShader:"void main() {}";this.vertexShader=b.vertexShader!==void 0?b.vertexShader:"void main() {}";this.uniforms=b.uniforms!==void 0?b.uniforms:{};this.attributes=b.attributes;this.shading=b.shading!==void 0?b.shading:THREE.SmoothShading;this.wireframe=b.wireframe!==void 0?b.wireframe:!1;this.wireframeLinewidth=b.wireframeLinewidth!==void 0?b.wireframeLinewidth:1;this.fog=b.fog!==
 void 0?b.fog:!1;this.lights=b.lights!==void 0?b.lights:!1;this.vertexColors=b.vertexColors!==void 0?b.vertexColors:!1;this.skinning=b.skinning!==void 0?b.skinning:!1;this.morphTargets=b.morphTargets!==void 0?b.morphTargets:!1};THREE.ShaderMaterial.prototype=new THREE.Material;THREE.ShaderMaterial.prototype.constructor=THREE.ShaderMaterial;
-THREE.Texture=function(b,c,e,d,h,i){this.id=THREE.TextureCount++;this.image=b;this.mapping=c!==void 0?c:new THREE.UVMapping;this.wrapS=e!==void 0?e:THREE.ClampToEdgeWrapping;this.wrapT=d!==void 0?d:THREE.ClampToEdgeWrapping;this.magFilter=h!==void 0?h:THREE.LinearFilter;this.minFilter=i!==void 0?i:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.needsUpdate=!1};
+THREE.Texture=function(b,c,d,e,h,i){this.id=THREE.TextureCount++;this.image=b;this.mapping=c!==void 0?c:new THREE.UVMapping;this.wrapS=d!==void 0?d:THREE.ClampToEdgeWrapping;this.wrapT=e!==void 0?e:THREE.ClampToEdgeWrapping;this.magFilter=h!==void 0?h:THREE.LinearFilter;this.minFilter=i!==void 0?i:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.needsUpdate=!1};
 THREE.Texture.prototype={constructor:THREE.Texture,clone:function(){var b=new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter);b.offset.copy(this.offset);b.repeat.copy(this.repeat);return b}};THREE.TextureCount=0;THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.LatitudeReflectionMapping=function(){};THREE.LatitudeRefractionMapping=function(){};
 THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=function(){};THREE.UVMapping=function(){};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.DataTexture=function(b,c,e,d,h,i,j,k,n){THREE.Texture.call(this,null,h,i,j,k,n);this.image={data:b,width:c,height:e};this.format=d!==void 0?d:THREE.RGBAFormat};THREE.DataTexture.prototype=new THREE.Texture;THREE.DataTexture.prototype.constructor=THREE.DataTexture;
+THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;THREE.DataTexture=function(b,c,d,e,h,i,j,k,s){THREE.Texture.call(this,null,h,i,j,k,s);this.image={data:b,width:c,height:d};this.format=e!==void 0?e:THREE.RGBAFormat};THREE.DataTexture.prototype=new THREE.Texture;THREE.DataTexture.prototype.constructor=THREE.DataTexture;
 THREE.DataTexture.prototype.clone=function(){var b=new THREE.DataTexture(this.data.slice(0),this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter);b.offset.copy(this.offset);b.repeat.copy(this.repeat);return b};THREE.Particle=function(b){THREE.Object3D.call(this);this.materials=b instanceof Array?b:[b]};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;
-THREE.ParticleSystem=function(b,c){THREE.Object3D.call(this);this.geometry=b;this.materials=c instanceof Array?c:[c];this.sortParticles=!1};THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem;THREE.Line=function(b,c,e){THREE.Object3D.call(this);this.geometry=b;this.materials=c instanceof Array?c:[c];this.type=e!=void 0?e:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;
+THREE.ParticleSystem=function(b,c){THREE.Object3D.call(this);this.geometry=b;this.materials=c instanceof Array?c:[c];this.sortParticles=!1};THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem;THREE.Line=function(b,c,d){THREE.Object3D.call(this);this.geometry=b;this.materials=c instanceof Array?c:[c];this.type=d!=void 0?d:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;
 THREE.Line.prototype.constructor=THREE.Line;
-THREE.Mesh=function(b,c){THREE.Object3D.call(this);this.geometry=b;this.materials=c&&c.length?c:[c];this.overdraw=!1;if(this.geometry&&(this.geometry.boundingSphere||this.geometry.computeBoundingSphere(),this.boundRadius=b.boundingSphere.radius,this.geometry.morphTargets.length)){this.morphTargetBase=-1;this.morphTargetForcedOrder=[];this.morphTargetInfluences=[];this.morphTargetDictionary={};for(var e=0;e<this.geometry.morphTargets.length;e++)this.morphTargetInfluences.push(0),this.morphTargetDictionary[this.geometry.morphTargets[e].name]=
-e}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;THREE.Mesh.prototype.getMorphTargetIndexByName=function(b){if(this.morphTargetDictionary[b]!==void 0)return this.morphTargetDictionary[b];console.log("THREE.Mesh.getMorphTargetIndexByName: morph target "+b+" does not exist. Returning 0.");return 0};
+THREE.Mesh=function(b,c){THREE.Object3D.call(this);this.geometry=b;this.materials=c&&c.length?c:[c];this.overdraw=!1;if(this.geometry&&(this.geometry.boundingSphere||this.geometry.computeBoundingSphere(),this.boundRadius=b.boundingSphere.radius,this.geometry.morphTargets.length)){this.morphTargetBase=-1;this.morphTargetForcedOrder=[];this.morphTargetInfluences=[];this.morphTargetDictionary={};for(var d=0;d<this.geometry.morphTargets.length;d++)this.morphTargetInfluences.push(0),this.morphTargetDictionary[this.geometry.morphTargets[d].name]=
+d}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;THREE.Mesh.prototype.getMorphTargetIndexByName=function(b){if(this.morphTargetDictionary[b]!==void 0)return this.morphTargetDictionary[b];console.log("THREE.Mesh.getMorphTargetIndexByName: morph target "+b+" does not exist. Returning 0.");return 0};
 THREE.Bone=function(b){THREE.Object3D.call(this);this.skin=b;this.skinMatrix=new THREE.Matrix4;this.hasNoneBoneChildren=!1};THREE.Bone.prototype=new THREE.Object3D;THREE.Bone.prototype.constructor=THREE.Bone;THREE.Bone.prototype.supr=THREE.Object3D.prototype;
-THREE.Bone.prototype.update=function(b,c,e){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate)b?this.skinMatrix.multiply(b,this.matrix):this.skinMatrix.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,c=!0;var d,h=this.children.length;if(this.hasNoneBoneChildren){this.matrixWorld.multiply(this.skin.matrixWorld,this.skinMatrix);for(d=0;d<h;d++)b=this.children[d],b instanceof THREE.Bone?b.update(this.skinMatrix,c,e):b.update(this.matrixWorld,!0,e)}else for(d=0;d<h;d++)this.children[d].update(this.skinMatrix,
-c,e)};THREE.Bone.prototype.addChild=function(b){if(this.children.indexOf(b)===-1&&(b.parent!==void 0&&b.parent.removeChild(b),b.parent=this,this.children.push(b),!(b instanceof THREE.Bone)))this.hasNoneBoneChildren=!0};
-THREE.SkinnedMesh=function(b,c){THREE.Mesh.call(this,b,c);this.identityMatrix=new THREE.Matrix4;this.bones=[];this.boneMatrices=[];var e,d,h,i,j,k;if(this.geometry.bones!==void 0){for(e=0;e<this.geometry.bones.length;e++)h=this.geometry.bones[e],i=h.pos,j=h.rotq,k=h.scl,d=this.addBone(),d.name=h.name,d.position.set(i[0],i[1],i[2]),d.quaternion.set(j[0],j[1],j[2],j[3]),d.useQuaternion=!0,k!==void 0?d.scale.set(k[0],k[1],k[2]):d.scale.set(1,1,1);for(e=0;e<this.bones.length;e++)h=this.geometry.bones[e],
-d=this.bones[e],h.parent===-1?this.addChild(d):this.bones[h.parent].addChild(d);this.boneMatrices=new Float32Array(16*this.bones.length);this.pose()}};THREE.SkinnedMesh.prototype=new THREE.Mesh;THREE.SkinnedMesh.prototype.constructor=THREE.SkinnedMesh;
-THREE.SkinnedMesh.prototype.update=function(b,c,e){if(this.visible){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,c=!0;var d,h=this.children.length;for(d=0;d<h;d++)b=this.children[d],b instanceof THREE.Bone?b.update(this.identityMatrix,!1,e):b.update(this.matrixWorld,c,e);e=this.bones.length;ba=this.bones;bm=this.boneMatrices;for(c=0;c<e;c++)ba[c].skinMatrix.flattenToArrayOffset(bm,
+THREE.Bone.prototype.update=function(b,c,d){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate)b?this.skinMatrix.multiply(b,this.matrix):this.skinMatrix.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,c=!0;var e,h=this.children.length;if(this.hasNoneBoneChildren){this.matrixWorld.multiply(this.skin.matrixWorld,this.skinMatrix);for(e=0;e<h;e++)b=this.children[e],b instanceof THREE.Bone?b.update(this.skinMatrix,c,d):b.update(this.matrixWorld,!0,d)}else for(e=0;e<h;e++)this.children[e].update(this.skinMatrix,
+c,d)};THREE.Bone.prototype.addChild=function(b){if(this.children.indexOf(b)===-1&&(b.parent!==void 0&&b.parent.removeChild(b),b.parent=this,this.children.push(b),!(b instanceof THREE.Bone)))this.hasNoneBoneChildren=!0};
+THREE.SkinnedMesh=function(b,c){THREE.Mesh.call(this,b,c);this.identityMatrix=new THREE.Matrix4;this.bones=[];this.boneMatrices=[];var d,e,h,i,j,k;if(this.geometry.bones!==void 0){for(d=0;d<this.geometry.bones.length;d++)h=this.geometry.bones[d],i=h.pos,j=h.rotq,k=h.scl,e=this.addBone(),e.name=h.name,e.position.set(i[0],i[1],i[2]),e.quaternion.set(j[0],j[1],j[2],j[3]),e.useQuaternion=!0,k!==void 0?e.scale.set(k[0],k[1],k[2]):e.scale.set(1,1,1);for(d=0;d<this.bones.length;d++)h=this.geometry.bones[d],
+e=this.bones[d],h.parent===-1?this.addChild(e):this.bones[h.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(b,c,d){if(this.visible){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,c=!0;var e,h=this.children.length;for(e=0;e<h;e++)b=this.children[e],b instanceof THREE.Bone?b.update(this.identityMatrix,!1,d):b.update(this.matrixWorld,c,d);d=this.bones.length;ba=this.bones;bm=this.boneMatrices;for(c=0;c<d;c++)ba[c].skinMatrix.flattenToArrayOffset(bm,
 c*16)}};THREE.SkinnedMesh.prototype.addBone=function(b){b===void 0&&(b=new THREE.Bone(this));this.bones.push(b);return b};
-THREE.SkinnedMesh.prototype.pose=function(){this.update(void 0,!0);for(var b,c=[],e=0;e<this.bones.length;e++)b=this.bones[e],c.push(THREE.Matrix4.makeInvert(b.skinMatrix)),b.skinMatrix.flattenToArrayOffset(this.boneMatrices,e*16);if(this.geometry.skinVerticesA===void 0){this.geometry.skinVerticesA=[];this.geometry.skinVerticesB=[];var d;for(b=0;b<this.geometry.skinIndices.length;b++){var e=this.geometry.vertices[b].position,h=this.geometry.skinIndices[b].x,i=this.geometry.skinIndices[b].y;d=new THREE.Vector3(e.x,
-e.y,e.z);this.geometry.skinVerticesA.push(c[h].multiplyVector3(d));d=new THREE.Vector3(e.x,e.y,e.z);this.geometry.skinVerticesB.push(c[i].multiplyVector3(d));this.geometry.skinWeights[b].x+this.geometry.skinWeights[b].y!==1&&(e=(1-(this.geometry.skinWeights[b].x+this.geometry.skinWeights[b].y))*0.5,this.geometry.skinWeights[b].x+=e,this.geometry.skinWeights[b].y+=e)}}};THREE.Ribbon=function(b,c){THREE.Object3D.call(this);this.geometry=b;this.materials=c instanceof Array?c:[c]};
-THREE.Ribbon.prototype=new THREE.Object3D;THREE.Ribbon.prototype.constructor=THREE.Ribbon;THREE.LOD=function(){THREE.Object3D.call(this);this.LODs=[]};THREE.LOD.prototype=new THREE.Object3D;THREE.LOD.prototype.constructor=THREE.LOD;THREE.LOD.prototype.supr=THREE.Object3D.prototype;THREE.LOD.prototype.addLevel=function(b,c){c===void 0&&(c=0);for(var c=Math.abs(c),e=0;e<this.LODs.length;e++)if(c<this.LODs[e].visibleAtDistance)break;this.LODs.splice(e,0,{visibleAtDistance:c,object3D:b});this.add(b)};
-THREE.LOD.prototype.update=function(b,c,e){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,c=!0;if(this.LODs.length>1){b=e.matrixWorldInverse;b=-(b.n31*this.position.x+b.n32*this.position.y+b.n33*this.position.z+b.n34);this.LODs[0].object3D.visible=!0;for(var d=1;d<this.LODs.length;d++)if(b>=this.LODs[d].visibleAtDistance)this.LODs[d-1].object3D.visible=!1,
-this.LODs[d].object3D.visible=!0;else break;for(;d<this.LODs.length;d++)this.LODs[d].object3D.visible=!1}for(b=0;b<this.children.length;b++)this.children[b].update(this.matrixWorld,c,e)};
+THREE.SkinnedMesh.prototype.pose=function(){this.update(void 0,!0);for(var b,c=[],d=0;d<this.bones.length;d++)b=this.bones[d],c.push(THREE.Matrix4.makeInvert(b.skinMatrix)),b.skinMatrix.flattenToArrayOffset(this.boneMatrices,d*16);if(this.geometry.skinVerticesA===void 0){this.geometry.skinVerticesA=[];this.geometry.skinVerticesB=[];var e;for(b=0;b<this.geometry.skinIndices.length;b++){var d=this.geometry.vertices[b].position,h=this.geometry.skinIndices[b].x,i=this.geometry.skinIndices[b].y;e=new THREE.Vector3(d.x,
+d.y,d.z);this.geometry.skinVerticesA.push(c[h].multiplyVector3(e));e=new THREE.Vector3(d.x,d.y,d.z);this.geometry.skinVerticesB.push(c[i].multiplyVector3(e));this.geometry.skinWeights[b].x+this.geometry.skinWeights[b].y!==1&&(d=(1-(this.geometry.skinWeights[b].x+this.geometry.skinWeights[b].y))*0.5,this.geometry.skinWeights[b].x+=d,this.geometry.skinWeights[b].y+=d)}}};THREE.Ribbon=function(b,c){THREE.Object3D.call(this);this.geometry=b;this.materials=c instanceof Array?c:[c]};
+THREE.Ribbon.prototype=new THREE.Object3D;THREE.Ribbon.prototype.constructor=THREE.Ribbon;THREE.LOD=function(){THREE.Object3D.call(this);this.LODs=[]};THREE.LOD.prototype=new THREE.Object3D;THREE.LOD.prototype.constructor=THREE.LOD;THREE.LOD.prototype.supr=THREE.Object3D.prototype;THREE.LOD.prototype.addLevel=function(b,c){c===void 0&&(c=0);for(var c=Math.abs(c),d=0;d<this.LODs.length;d++)if(c<this.LODs[d].visibleAtDistance)break;this.LODs.splice(d,0,{visibleAtDistance:c,object3D:b});this.add(b)};
+THREE.LOD.prototype.update=function(b,c,d){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,c=!0;if(this.LODs.length>1){b=d.matrixWorldInverse;b=-(b.n31*this.position.x+b.n32*this.position.y+b.n33*this.position.z+b.n34);this.LODs[0].object3D.visible=!0;for(var e=1;e<this.LODs.length;e++)if(b>=this.LODs[e].visibleAtDistance)this.LODs[e-1].object3D.visible=!1,
+this.LODs[e].object3D.visible=!0;else break;for(;e<this.LODs.length;e++)this.LODs[e].object3D.visible=!1}for(b=0;b<this.children.length;b++)this.children[b].update(this.matrixWorld,c,d)};
 THREE.Sprite=function(b){THREE.Object3D.call(this);this.color=b.color!==void 0?new THREE.Color(b.color):new THREE.Color(16777215);this.map=b.map instanceof THREE.Texture?b.map:THREE.ImageUtils.loadTexture(b.map);this.blending=b.blending!==void 0?b.blending:THREE.NormalBlending;this.useScreenCoordinates=b.useScreenCoordinates!==void 0?b.useScreenCoordinates:!0;this.mergeWith3D=b.mergeWith3D!==void 0?b.mergeWith3D:!this.useScreenCoordinates;this.affectedByDistance=b.affectedByDistance!==void 0?b.affectedByDistance:
 !this.useScreenCoordinates;this.scaleByViewport=b.scaleByViewport!==void 0?b.scaleByViewport:!this.affectedByDistance;this.alignment=b.alignment instanceof THREE.Vector2?b.alignment:THREE.SpriteAlignment.center;this.rotation3d=this.rotation;this.rotation=0;this.opacity=1;this.uvOffset=new THREE.Vector2(0,0);this.uvScale=new THREE.Vector2(1,1)};THREE.Sprite.prototype=new THREE.Object3D;THREE.Sprite.prototype.constructor=THREE.Sprite;THREE.Sprite.prototype.supr=THREE.Object3D.prototype;
 THREE.Sprite.prototype.updateMatrix=function(){this.matrix.setPosition(this.position);this.rotation3d.set(0,0,this.rotation);this.matrix.setRotationFromEuler(this.rotation3d);if(this.scale.x!==1||this.scale.y!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,this.scale.y);this.matrixWorldNeedsUpdate=!0};THREE.SpriteAlignment={};THREE.SpriteAlignment.topLeft=new THREE.Vector2(1,-1);THREE.SpriteAlignment.topCenter=new THREE.Vector2(0,-1);
 THREE.SpriteAlignment.topRight=new THREE.Vector2(-1,-1);THREE.SpriteAlignment.centerLeft=new THREE.Vector2(1,0);THREE.SpriteAlignment.center=new THREE.Vector2(0,0);THREE.SpriteAlignment.centerRight=new THREE.Vector2(-1,0);THREE.SpriteAlignment.bottomLeft=new THREE.Vector2(1,1);THREE.SpriteAlignment.bottomCenter=new THREE.Vector2(0,1);THREE.SpriteAlignment.bottomRight=new THREE.Vector2(-1,1);
-THREE.Scene=function(){THREE.Object3D.call(this);this.fog=null;this.matrixAutoUpdate=!1;this.collisions=this.overrideMaterial=null;this.objects=[];this.lights=[];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.add=function(b){this.supr.add.call(this,b);this.addChildRecurse(b)};
-THREE.Scene.prototype.addChildRecurse=function(b){if(b instanceof THREE.Light)this.lights.indexOf(b)===-1&&this.lights.push(b);else if(!(b instanceof THREE.Camera||b instanceof THREE.Bone)&&this.objects.indexOf(b)===-1){this.objects.push(b);this.__objectsAdded.push(b);var c=this.__objectsRemoved.indexOf(b);c!==-1&&this.__objectsRemoved.splice(c,1)}for(c=0;c<b.children.length;c++)this.addChildRecurse(b.children[c])};THREE.Scene.prototype.remove=function(b){this.supr.remove.call(this,b);this.removeChildRecurse(b)};
-THREE.Scene.prototype.removeChildRecurse=function(b){if(b instanceof THREE.Light){var c=this.lights.indexOf(b);c!==-1&&this.lights.splice(c,1)}else b instanceof THREE.Camera||(c=this.objects.indexOf(b),c!==-1&&(this.objects.splice(c,1),this.__objectsRemoved.push(b),c=this.__objectsAdded.indexOf(b),c!==-1&&this.__objectsAdded.splice(c,1)));for(c=0;c<b.children.length;c++)this.removeChildRecurse(b.children[c])};
-THREE.Scene.prototype.addChild=function(b){console.warn("DEPRECATED: Scene.addChild() is now Scene.add().");this.add(b)};THREE.Scene.prototype.addObject=function(b){console.warn("DEPRECATED: Scene.addObject() is now Scene.add().");this.add(b)};THREE.Scene.prototype.addLight=function(b){console.warn("DEPRECATED: Scene.addLight() is now Scene.add().");this.add(b)};THREE.Scene.prototype.removeChild=function(b){console.warn("DEPRECATED: Scene.removeChild() is now Scene.remove().");this.remove(b)};
-THREE.Scene.prototype.removeObject=function(b){console.warn("DEPRECATED: Scene.removeObject() is now Scene.remove().");this.remove(b)};THREE.Scene.prototype.removeLight=function(b){console.warn("DEPRECATED: Scene.removeLight() is now Scene.remove().");this.remove(b)};THREE.Fog=function(b,c,e){this.color=new THREE.Color(b);this.near=c!==void 0?c:1;this.far=e!==void 0?e:1E3};THREE.FogExp2=function(b,c){this.color=new THREE.Color(b);this.density=c!==void 0?c:2.5E-4};
+THREE.Scene=function(){THREE.Object3D.call(this);this.overrideMaterial=this.fog=null;this.matrixAutoUpdate=!1};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;THREE.Fog=function(b,c,d){this.color=new THREE.Color(b);this.near=c!==void 0?c:1;this.far=d!==void 0?d:1E3};THREE.FogExp2=function(b,c){this.color=new THREE.Color(b);this.density=c!==void 0?c:2.5E-4};
 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 float flipEnvMap;\nuniform int combine;\n#endif",envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( flipEnvMap * vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor.xyz = mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity );\n} else {\ngl_FragColor.xyz = gl_FragColor.xyz * cubeColor.xyz;\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",
@@ -159,7 +154,7 @@ morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\nuniform float morphTargetInflu
 default_vertex:"#ifndef USE_MORPHTARGETS\n#ifndef USE_SKINNING\ngl_Position = projectionMatrix * mvPosition;\n#endif\n#endif",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\nuniform sampler2D shadowMap[ MAX_SHADOWS ];\nuniform float shadowDarkness;\nuniform float shadowBias;\nvarying vec4 vShadowCoord[ MAX_SHADOWS ];\nfloat unpackDepth( const in vec4 rgba_depth ) {\nconst vec4 bit_shift = vec4( 1.0 / ( 256.0 * 256.0 * 256.0 ), 1.0 / ( 256.0 * 256.0 ), 1.0 / 256.0, 1.0 );\nfloat depth = dot( rgba_depth, bit_shift );\nreturn depth;\n}\n#endif",
 shadowmap_fragment:"#ifdef USE_SHADOWMAP\n#ifdef SHADOWMAP_SOFT\nconst float xPixelOffset = 1.0 / SHADOWMAP_WIDTH;\nconst float yPixelOffset = 1.0 / SHADOWMAP_HEIGHT;\n#endif\nvec4 shadowColor = vec4( 1.0 );\nfor( int i = 0; i < MAX_SHADOWS; i ++ ) {\nvec3 shadowCoord = vShadowCoord[ i ].xyz / vShadowCoord[ i ].w;\nshadowCoord.z += shadowBias;\nif ( shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0 ) {\n#ifdef SHADOWMAP_SOFT\nfloat shadow = 0.0;\nfor ( float y = -1.25; y <= 1.25; y += 1.25 )\nfor ( float x = -1.25; x <= 1.25; x += 1.25 ) {\nvec4 rgbaDepth = texture2D( shadowMap[ i ], vec2( x * xPixelOffset, y * yPixelOffset ) + shadowCoord.xy );\nfloat fDepth = unpackDepth( rgbaDepth );\nif ( fDepth < shadowCoord.z )\nshadow += 1.0;\n}\nshadow /= 9.0;\nshadowColor = shadowColor * vec4( vec3( ( 1.0 - shadowDarkness * shadow ) ), 1.0 );\n#else\nvec4 rgbaDepth = texture2D( shadowMap[ i ], shadowCoord.xy );\nfloat fDepth = unpackDepth( rgbaDepth );\nif ( fDepth < shadowCoord.z )\nshadowColor = shadowColor * vec4( vec3( shadowDarkness ), 1.0 );\n#endif\n}\n}\ngl_FragColor = gl_FragColor * shadowColor;\n#endif",
 shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\nvarying vec4 vShadowCoord[ MAX_SHADOWS ];\nuniform mat4 shadowMatrix[ MAX_SHADOWS ];\n#endif",shadowmap_vertex:"#ifdef USE_SHADOWMAP\nfor( int i = 0; i < MAX_SHADOWS; i ++ ) {\nvShadowCoord[ i ] = shadowMatrix[ i ] * objectMatrix * vec4( position, 1.0 );\n}\n#endif",alphatest_fragment:"#ifdef ALPHATEST\nif ( gl_FragColor.a < ALPHATEST ) discard;\n#endif"};
-THREE.UniformsUtils={merge:function(b){var c,e,d,h={};for(c=0;c<b.length;c++)for(e in d=this.clone(b[c]),d)h[e]=d[e];return h},clone:function(b){var c,e,d,h={};for(c in b)for(e in h[c]={},b[c])d=b[c][e],h[c][e]=d instanceof THREE.Color||d instanceof THREE.Vector2||d instanceof THREE.Vector3||d instanceof THREE.Vector4||d instanceof THREE.Matrix4||d instanceof THREE.Texture?d.clone():d instanceof Array?d.slice():d;return h}};
+THREE.UniformsUtils={merge:function(b){var c,d,e,h={};for(c=0;c<b.length;c++)for(d in e=this.clone(b[c]),e)h[d]=e[d];return h},clone:function(b){var c,d,e,h={};for(c in b)for(d in h[c]={},b[c])e=b[c][d],h[c][d]=e instanceof THREE.Color||e instanceof THREE.Vector2||e instanceof THREE.Vector3||e instanceof THREE.Vector4||e instanceof THREE.Matrix4||e instanceof THREE.Texture?e.clone():e instanceof Array?e.slice():e;return h}};
 THREE.UniformsLib={common:{diffuse:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},map:{type:"t",value:0,texture:null},offsetRepeat:{type:"v4",value:new THREE.Vector4(0,0,1,1)},lightMap:{type:"t",value:2,texture:null},envMap:{type:"t",value:1,texture:null},flipEnvMap:{type:"f",value:-1},useRefract:{type:"i",value:0},reflectivity:{type:"f",value:1},refractionRatio:{type:"f",value:0.98},combine:{type:"i",value:0},morphTargetInfluences:{type:"f",value:0}},fog:{fogDensity:{type:"f",
 value:2.5E-4},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)}},lights:{enableLighting:{type:"i",value:1},ambientLightColor:{type:"fv",value:[]},directionalLightDirection:{type:"fv",value:[]},directionalLightColor:{type:"fv",value:[]},pointLightColor:{type:"fv",value:[]},pointLightPosition:{type:"fv",value:[]},pointLightDistance:{type:"fv1",value:[]}},particle:{psColor:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},size:{type:"f",
 value:1},scale:{type:"f",value:1},map:{type:"t",value:0,texture:null},fogDensity:{type:"f",value:2.5E-4},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)}},shadowmap:{shadowMap:{type:"tv",value:6,texture:[]},shadowMatrix:{type:"m4v",value:[]},shadowBias:{type:"f",value:0.0039},shadowDarkness:{type:"f",value:0.2}}};
@@ -178,122 +173,123 @@ THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_pars_fragment,THREE.
 THREE.ShaderChunk.envmap_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n")},particle_basic:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.particle,THREE.UniformsLib.shadowmap]),vertexShader:["uniform float size;\nuniform float scale;",THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.shadowmap_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;",
 THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform vec3 psColor;\nuniform float opacity;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_particle_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.shadowmap_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.fog_fragment,
 "}"].join("\n")},depthRGBA:{uniforms:{},vertexShader:[THREE.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n"),fragmentShader:"vec4 pack_depth( const in float depth ) {\nconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\nconst vec4 bit_mask  = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\nvec4 res = fract( depth * bit_shift );\nres -= res.xxyz * bit_mask;\nreturn res;\n}\nvoid main() {\ngl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );\n}"}};
-THREE.WebGLRenderer=function(b){function c(b,c,e){var d,i,h,j=b.vertices,S=j.length,x=b.colors,k=x.length,E=b.__vertexArray,p=b.__colorArray,n=b.__sortArray,C=b.__dirtyVertices,q=b.__dirtyColors,m=b.__webglCustomAttributes,r,t;if(m)for(r in m)m[r].offset=0;if(e.sortParticles){Ea.multiplySelf(e.matrixWorld);for(d=0;d<S;d++)i=j[d].position,Ja.copy(i),Ea.multiplyVector3(Ja),n[d]=[Ja.z,d];n.sort(function(b,f){return f[0]-b[0]});for(d=0;d<S;d++)i=j[n[d][1]].position,h=d*3,E[h]=i.x,E[h+1]=i.y,E[h+2]=i.z;
-for(d=0;d<k;d++)h=d*3,color=x[n[d][1]],p[h]=color.r,p[h+1]=color.g,p[h+2]=color.b;if(m)for(r in m){d=m[r];x=d.value.length;for(h=0;h<x;h++){index=n[h][1];k=d.offset;if(d.size===1){if(d.boundTo===void 0||d.boundTo==="vertices")d.array[k]=d.value[index]}else{if(d.boundTo===void 0||d.boundTo==="vertices")t=d.value[index];d.size===2?(d.array[k]=t.x,d.array[k+1]=t.y):d.size===3?d.type==="c"?(d.array[k]=t.r,d.array[k+1]=t.g,d.array[k+2]=t.b):(d.array[k]=t.x,d.array[k+1]=t.y,d.array[k+2]=t.z):(d.array[k]=
-t.x,d.array[k+1]=t.y,d.array[k+2]=t.z,d.array[k+3]=t.w)}d.offset+=d.size}}}else{if(C)for(d=0;d<S;d++)i=j[d].position,h=d*3,E[h]=i.x,E[h+1]=i.y,E[h+2]=i.z;if(q)for(d=0;d<k;d++)color=x[d],h=d*3,p[h]=color.r,p[h+1]=color.g,p[h+2]=color.b;if(m)for(r in m)if(d=m[r],d.__original.needsUpdate){x=d.value.length;for(h=0;h<x;h++){k=d.offset;if(d.size===1){if(d.boundTo===void 0||d.boundTo==="vertices")d.array[k]=d.value[h]}else{if(d.boundTo===void 0||d.boundTo==="vertices")t=d.value[h];d.size===2?(d.array[k]=
-t.x,d.array[k+1]=t.y):d.size===3?d.type==="c"?(d.array[k]=t.r,d.array[k+1]=t.g,d.array[k+2]=t.b):(d.array[k]=t.x,d.array[k+1]=t.y,d.array[k+2]=t.z):(d.array[k]=t.x,d.array[k+1]=t.y,d.array[k+2]=t.z,d.array[k+3]=t.w)}d.offset+=d.size}}}if(C||e.sortParticles)f.bindBuffer(f.ARRAY_BUFFER,b.__webglVertexBuffer),f.bufferData(f.ARRAY_BUFFER,E,c);if(q||e.sortParticles)f.bindBuffer(f.ARRAY_BUFFER,b.__webglColorBuffer),f.bufferData(f.ARRAY_BUFFER,p,c);if(m)for(r in m)if(d=m[r],d.__original.needsUpdate||e.sortParticles)f.bindBuffer(f.ARRAY_BUFFER,
-d.buffer),f.bufferData(f.ARRAY_BUFFER,d.array,c)}function e(b,c,e,d,i){d.program||M.initMaterial(d,c,e,i);if(d.morphTargets&&!i.__webglMorphTargetInfluences){i.__webglMorphTargetInfluences=new Float32Array(M.maxMorphTargets);for(var h=0,j=M.maxMorphTargets;h<j;h++)i.__webglMorphTargetInfluences[h]=0}var k=!1,h=d.program,j=h.uniforms,x=d.uniforms;h!=Za&&(f.useProgram(h),Za=h,k=!0);if(d.id!=na)na=d.id,k=!0;if(k){f.uniformMatrix4fv(j.projectionMatrix,!1,Wa);if(e&&d.fog)if(x.fogColor.value=e.color,e instanceof
-THREE.Fog)x.fogNear.value=e.near,x.fogFar.value=e.far;else if(e instanceof THREE.FogExp2)x.fogDensity.value=e.density;if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){for(var p,E,n=0,q=0,C=0,m,t,r,u=ab,H=u.directional.colors,A=u.directional.positions,z=u.point.colors,y=u.point.positions,F=u.point.distances,D=0,K=0,e=p=r=0,k=c.length;e<k;e++)if(p=c[e],E=p.color,m=p.position,t=p.intensity,r=p.distance,p instanceof THREE.AmbientLight)n+=E.r,q+=E.g,C+=E.b;else if(p instanceof
-THREE.DirectionalLight)r=D*3,H[r]=E.r*t,H[r+1]=E.g*t,H[r+2]=E.b*t,A[r]=m.x,A[r+1]=m.y,A[r+2]=m.z,D+=1;else if(p instanceof THREE.SpotLight)r=D*3,H[r]=E.r*t,H[r+1]=E.g*t,H[r+2]=E.b*t,E=1/m.length(),A[r]=m.x*E,A[r+1]=m.y*E,A[r+2]=m.z*E,D+=1;else if(p instanceof THREE.PointLight)p=K*3,z[p]=E.r*t,z[p+1]=E.g*t,z[p+2]=E.b*t,y[p]=m.x,y[p+1]=m.y,y[p+2]=m.z,F[K]=r,K+=1;e=D*3;for(k=H.length;e<k;e++)H[e]=0;e=K*3;for(k=z.length;e<k;e++)z[e]=0;u.point.length=K;u.directional.length=D;u.ambient[0]=n;u.ambient[1]=
-q;u.ambient[2]=C;c=ab;x.enableLighting.value=c.directional.length+c.point.length;x.ambientLightColor.value=c.ambient;x.directionalLightColor.value=c.directional.colors;x.directionalLightDirection.value=c.directional.positions;x.pointLightColor.value=c.point.colors;x.pointLightPosition.value=c.point.positions;x.pointLightDistance.value=c.point.distances}if(d instanceof THREE.MeshBasicMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.MeshPhongMaterial)x.diffuse.value=d.color,x.opacity.value=
-d.opacity,(x.map.texture=d.map)&&x.offsetRepeat.value.set(d.map.offset.x,d.map.offset.y,d.map.repeat.x,d.map.repeat.y),x.lightMap.texture=d.lightMap,x.envMap.texture=d.envMap,x.flipEnvMap.value=d.envMap instanceof THREE.WebGLRenderTargetCube?1:-1,x.reflectivity.value=d.reflectivity,x.refractionRatio.value=d.refractionRatio,x.combine.value=d.combine,x.useRefract.value=d.envMap&&d.envMap.mapping instanceof THREE.CubeRefractionMapping;if(d instanceof THREE.LineBasicMaterial)x.diffuse.value=d.color,x.opacity.value=
-d.opacity;else if(d instanceof THREE.ParticleBasicMaterial)x.psColor.value=d.color,x.opacity.value=d.opacity,x.size.value=d.size,x.scale.value=Fa.height/2,x.map.texture=d.map;else if(d instanceof THREE.MeshPhongMaterial)x.ambient.value=d.ambient,x.specular.value=d.specular,x.shininess.value=d.shininess;else if(d instanceof THREE.MeshDepthMaterial)x.mNear.value=b.near,x.mFar.value=b.far,x.opacity.value=d.opacity;else if(d instanceof THREE.MeshNormalMaterial)x.opacity.value=d.opacity;if(i.receiveShadow&&
-!d._shadowPass&&x.shadowMatrix){for(c=0;c<Va.length;c++)x.shadowMatrix.value[c]=Va[c],x.shadowMap.texture[c]=M.shadowMap[c];x.shadowDarkness.value=M.shadowMapDarkness;x.shadowBias.value=M.shadowMapBias}c=d.uniformsList;x=0;for(e=c.length;x<e;x++)if(q=h.uniforms[c[x][1]])if(n=c[x][0],C=n.type,k=n.value,C=="i")f.uniform1i(q,k);else if(C=="f")f.uniform1f(q,k);else if(C=="v2")f.uniform2f(q,k.x,k.y);else if(C=="v3")f.uniform3f(q,k.x,k.y,k.z);else if(C=="v4")f.uniform4f(q,k.x,k.y,k.z,k.w);else if(C=="c")f.uniform3f(q,
-k.r,k.g,k.b);else if(C=="fv1")f.uniform1fv(q,k);else if(C=="fv")f.uniform3fv(q,k);else if(C=="v3v"){if(!n._array)n._array=new Float32Array(3*k.length);C=0;for(m=k.length;C<m;C++)u=C*3,n._array[u]=k[C].x,n._array[u+1]=k[C].y,n._array[u+2]=k[C].z;f.uniform3fv(q,n._array)}else if(C=="m4"){if(!n._array)n._array=new Float32Array(16);k.flattenToArray(n._array);f.uniformMatrix4fv(q,!1,n._array)}else if(C=="m4v"){if(!n._array)n._array=new Float32Array(16*k.length);C=0;for(m=k.length;C<m;C++)k[C].flattenToArrayOffset(n._array,
-C*16);f.uniformMatrix4fv(q,!1,n._array)}else if(C=="t"){if(f.uniform1i(q,k),q=n.texture)if(q.image instanceof Array&&q.image.length==6){if(n=q,n.image.length==6)if(n.needsUpdate){if(!n.image.__webglTextureCube)n.image.__webglTextureCube=f.createTexture();f.activeTexture(f.TEXTURE0+k);f.bindTexture(f.TEXTURE_CUBE_MAP,n.image.__webglTextureCube);for(k=0;k<6;k++)f.texImage2D(f.TEXTURE_CUBE_MAP_POSITIVE_X+k,0,f.RGBA,f.RGBA,f.UNSIGNED_BYTE,n.image[k]);v(f.TEXTURE_CUBE_MAP,n,n.image[0]);n.needsUpdate=!1}else f.activeTexture(f.TEXTURE0+
-k),f.bindTexture(f.TEXTURE_CUBE_MAP,n.image.__webglTextureCube)}else q instanceof THREE.WebGLRenderTargetCube?(n=q,f.activeTexture(f.TEXTURE0+k),f.bindTexture(f.TEXTURE_CUBE_MAP,n.__webglTexture)):T(q,k)}else if(C=="tv"){if(!n._array){n._array=[];C=0;for(m=n.texture.length;C<m;C++)n._array[C]=k+C}f.uniform1iv(q,n._array);C=0;for(m=n.texture.length;C<m;C++)(q=n.texture[C])&&T(q,n._array[C])}(d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&j.cameraPosition!==null&&
-f.uniform3f(j.cameraPosition,b.position.x,b.position.y,b.position.z);(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.ShaderMaterial||d.skinning)&&j.viewMatrix!==null&&f.uniformMatrix4fv(j.viewMatrix,!1,Xa);d.skinning&&(f.uniformMatrix4fv(j.cameraInverseMatrix,!1,Xa),f.uniformMatrix4fv(j.boneGlobalMatrices,!1,i.boneMatrices))}f.uniformMatrix4fv(j.modelViewMatrix,!1,i._modelViewMatrixArray);j.normalMatrix&&f.uniformMatrix3fv(j.normalMatrix,!1,i._normalMatrixArray);
-(d instanceof THREE.ShaderMaterial||d.envMap||d.skinning||i.receiveShadow)&&j.objectMatrix!==null&&f.uniformMatrix4fv(j.objectMatrix,!1,i._objectMatrixArray);return h}function d(b,c,d,i,h,j){if(i.opacity!=0){var k,d=e(b,c,d,i,j),b=d.attributes,c=!1,d=h.id*16777215+d.id*2+(i.wireframe?1:0);d!=D&&(D=d,c=!0);if(!i.morphTargets&&b.position>=0)c&&(f.bindBuffer(f.ARRAY_BUFFER,h.__webglVertexBuffer),f.vertexAttribPointer(b.position,3,f.FLOAT,!1,0,0));else if(j.morphTargetBase){d=i.program.attributes;j.morphTargetBase!==
--1?(f.bindBuffer(f.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[j.morphTargetBase]),f.vertexAttribPointer(d.position,3,f.FLOAT,!1,0,0)):d.position>=0&&(f.bindBuffer(f.ARRAY_BUFFER,h.__webglVertexBuffer),f.vertexAttribPointer(d.position,3,f.FLOAT,!1,0,0));if(j.morphTargetForcedOrder.length)for(var n=0,x=j.morphTargetForcedOrder,p=j.morphTargetInfluences;n<i.numSupportedMorphTargets&&n<x.length;)f.bindBuffer(f.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[x[n]]),f.vertexAttribPointer(d["morphTarget"+n],3,
-f.FLOAT,!1,0,0),j.__webglMorphTargetInfluences[n]=p[x[n]],n++;else{var x=[],q=-1,m=0,p=j.morphTargetInfluences,t,C=p.length,n=0;for(j.morphTargetBase!==-1&&(x[j.morphTargetBase]=!0);n<i.numSupportedMorphTargets;){for(t=0;t<C;t++)!x[t]&&p[t]>q&&(m=t,q=p[m]);f.bindBuffer(f.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[m]);f.vertexAttribPointer(d["morphTarget"+n],3,f.FLOAT,!1,0,0);j.__webglMorphTargetInfluences[n]=q;x[m]=1;q=-1;n++}}i.program.uniforms.morphTargetInfluences!==null&&f.uniform1fv(i.program.uniforms.morphTargetInfluences,
-j.__webglMorphTargetInfluences)}if(c){if(h.__webglCustomAttributes)for(k in h.__webglCustomAttributes)b[k]>=0&&(d=h.__webglCustomAttributes[k],f.bindBuffer(f.ARRAY_BUFFER,d.buffer),f.vertexAttribPointer(b[k],d.size,f.FLOAT,!1,0,0));b.color>=0&&(f.bindBuffer(f.ARRAY_BUFFER,h.__webglColorBuffer),f.vertexAttribPointer(b.color,3,f.FLOAT,!1,0,0));b.normal>=0&&(f.bindBuffer(f.ARRAY_BUFFER,h.__webglNormalBuffer),f.vertexAttribPointer(b.normal,3,f.FLOAT,!1,0,0));b.tangent>=0&&(f.bindBuffer(f.ARRAY_BUFFER,
+THREE.WebGLRenderer=function(b){function c(b,c,d){var e,i,h,j=b.vertices,T=j.length,r=b.colors,k=r.length,C=b.__vertexArray,I=b.__colorArray,o=b.__sortArray,K=b.__dirtyVertices,s=b.__dirtyColors,n=b.__webglCustomAttributes,p,q;if(n)for(p in n)n[p].offset=0;if(d.sortParticles){Ba.multiplySelf(d.matrixWorld);for(e=0;e<T;e++)i=j[e].position,Ea.copy(i),Ba.multiplyVector3(Ea),o[e]=[Ea.z,e];o.sort(function(b,f){return f[0]-b[0]});for(e=0;e<T;e++)i=j[o[e][1]].position,h=e*3,C[h]=i.x,C[h+1]=i.y,C[h+2]=i.z;
+for(e=0;e<k;e++)h=e*3,color=r[o[e][1]],I[h]=color.r,I[h+1]=color.g,I[h+2]=color.b;if(n)for(p in n){e=n[p];r=e.value.length;for(h=0;h<r;h++){index=o[h][1];k=e.offset;if(e.size===1){if(e.boundTo===void 0||e.boundTo==="vertices")e.array[k]=e.value[index]}else{if(e.boundTo===void 0||e.boundTo==="vertices")q=e.value[index];e.size===2?(e.array[k]=q.x,e.array[k+1]=q.y):e.size===3?e.type==="c"?(e.array[k]=q.r,e.array[k+1]=q.g,e.array[k+2]=q.b):(e.array[k]=q.x,e.array[k+1]=q.y,e.array[k+2]=q.z):(e.array[k]=
+q.x,e.array[k+1]=q.y,e.array[k+2]=q.z,e.array[k+3]=q.w)}e.offset+=e.size}}}else{if(K)for(e=0;e<T;e++)i=j[e].position,h=e*3,C[h]=i.x,C[h+1]=i.y,C[h+2]=i.z;if(s)for(e=0;e<k;e++)color=r[e],h=e*3,I[h]=color.r,I[h+1]=color.g,I[h+2]=color.b;if(n)for(p in n)if(e=n[p],e.__original.needsUpdate){r=e.value.length;for(h=0;h<r;h++){k=e.offset;if(e.size===1){if(e.boundTo===void 0||e.boundTo==="vertices")e.array[k]=e.value[h]}else{if(e.boundTo===void 0||e.boundTo==="vertices")q=e.value[h];e.size===2?(e.array[k]=
+q.x,e.array[k+1]=q.y):e.size===3?e.type==="c"?(e.array[k]=q.r,e.array[k+1]=q.g,e.array[k+2]=q.b):(e.array[k]=q.x,e.array[k+1]=q.y,e.array[k+2]=q.z):(e.array[k]=q.x,e.array[k+1]=q.y,e.array[k+2]=q.z,e.array[k+3]=q.w)}e.offset+=e.size}}}if(K||d.sortParticles)f.bindBuffer(f.ARRAY_BUFFER,b.__webglVertexBuffer),f.bufferData(f.ARRAY_BUFFER,C,c);if(s||d.sortParticles)f.bindBuffer(f.ARRAY_BUFFER,b.__webglColorBuffer),f.bufferData(f.ARRAY_BUFFER,I,c);if(n)for(p in n)if(e=n[p],e.__original.needsUpdate||d.sortParticles)f.bindBuffer(f.ARRAY_BUFFER,
+e.buffer),f.bufferData(f.ARRAY_BUFFER,e.array,c)}function d(b,c,d,e,i){e.program||F.initMaterial(e,c,d,i);if(e.morphTargets&&!i.__webglMorphTargetInfluences){i.__webglMorphTargetInfluences=new Float32Array(F.maxMorphTargets);for(var h=0,j=F.maxMorphTargets;h<j;h++)i.__webglMorphTargetInfluences[h]=0}var k=!1,h=e.program,j=h.uniforms,r=e.uniforms;h!=O&&(f.useProgram(h),O=h,k=!0);if(e.id!=J)J=e.id,k=!0;if(k){f.uniformMatrix4fv(j.projectionMatrix,!1,Ta);if(d&&e.fog)if(r.fogColor.value=d.color,d instanceof
+THREE.Fog)r.fogNear.value=d.near,r.fogFar.value=d.far;else if(d instanceof THREE.FogExp2)r.fogDensity.value=d.density;if(e instanceof THREE.MeshPhongMaterial||e instanceof THREE.MeshLambertMaterial||e.lights){for(var n,C,I=0,o=0,K=0,s,q,p,v=Za,u=v.directional.colors,B=v.directional.positions,z=v.point.colors,y=v.point.positions,D=v.point.distances,x=0,M=0,d=n=p=0,k=c.length;d<k;d++)if(n=c[d],C=n.color,s=n.position,q=n.intensity,p=n.distance,n instanceof THREE.AmbientLight)I+=C.r,o+=C.g,K+=C.b;else if(n instanceof
+THREE.DirectionalLight)p=x*3,u[p]=C.r*q,u[p+1]=C.g*q,u[p+2]=C.b*q,B[p]=s.x,B[p+1]=s.y,B[p+2]=s.z,x+=1;else if(n instanceof THREE.SpotLight)p=x*3,u[p]=C.r*q,u[p+1]=C.g*q,u[p+2]=C.b*q,C=1/s.length(),B[p]=s.x*C,B[p+1]=s.y*C,B[p+2]=s.z*C,x+=1;else if(n instanceof THREE.PointLight)n=M*3,z[n]=C.r*q,z[n+1]=C.g*q,z[n+2]=C.b*q,y[n]=s.x,y[n+1]=s.y,y[n+2]=s.z,D[M]=p,M+=1;d=x*3;for(k=u.length;d<k;d++)u[d]=0;d=M*3;for(k=z.length;d<k;d++)z[d]=0;v.point.length=M;v.directional.length=x;v.ambient[0]=I;v.ambient[1]=
+o;v.ambient[2]=K;c=Za;r.enableLighting.value=c.directional.length+c.point.length;r.ambientLightColor.value=c.ambient;r.directionalLightColor.value=c.directional.colors;r.directionalLightDirection.value=c.directional.positions;r.pointLightColor.value=c.point.colors;r.pointLightPosition.value=c.point.positions;r.pointLightDistance.value=c.point.distances}if(e instanceof THREE.MeshBasicMaterial||e instanceof THREE.MeshLambertMaterial||e instanceof THREE.MeshPhongMaterial)r.diffuse.value=e.color,r.opacity.value=
+e.opacity,(r.map.texture=e.map)&&r.offsetRepeat.value.set(e.map.offset.x,e.map.offset.y,e.map.repeat.x,e.map.repeat.y),r.lightMap.texture=e.lightMap,r.envMap.texture=e.envMap,r.flipEnvMap.value=e.envMap instanceof THREE.WebGLRenderTargetCube?1:-1,r.reflectivity.value=e.reflectivity,r.refractionRatio.value=e.refractionRatio,r.combine.value=e.combine,r.useRefract.value=e.envMap&&e.envMap.mapping instanceof THREE.CubeRefractionMapping;if(e instanceof THREE.LineBasicMaterial)r.diffuse.value=e.color,r.opacity.value=
+e.opacity;else if(e instanceof THREE.ParticleBasicMaterial)r.psColor.value=e.color,r.opacity.value=e.opacity,r.size.value=e.size,r.scale.value=Ca.height/2,r.map.texture=e.map;else if(e instanceof THREE.MeshPhongMaterial)r.ambient.value=e.ambient,r.specular.value=e.specular,r.shininess.value=e.shininess;else if(e instanceof THREE.MeshDepthMaterial)r.mNear.value=b.near,r.mFar.value=b.far,r.opacity.value=e.opacity;else if(e instanceof THREE.MeshNormalMaterial)r.opacity.value=e.opacity;if(i.receiveShadow&&
+!e._shadowPass&&r.shadowMatrix){for(c=0;c<Ka.length;c++)r.shadowMatrix.value[c]=Ka[c],r.shadowMap.texture[c]=F.shadowMap[c];r.shadowDarkness.value=F.shadowMapDarkness;r.shadowBias.value=F.shadowMapBias}c=e.uniformsList;r=0;for(d=c.length;r<d;r++)if(o=h.uniforms[c[r][1]])if(I=c[r][0],K=I.type,k=I.value,K=="i")f.uniform1i(o,k);else if(K=="f")f.uniform1f(o,k);else if(K=="v2")f.uniform2f(o,k.x,k.y);else if(K=="v3")f.uniform3f(o,k.x,k.y,k.z);else if(K=="v4")f.uniform4f(o,k.x,k.y,k.z,k.w);else if(K=="c")f.uniform3f(o,
+k.r,k.g,k.b);else if(K=="fv1")f.uniform1fv(o,k);else if(K=="fv")f.uniform3fv(o,k);else if(K=="v3v"){if(!I._array)I._array=new Float32Array(3*k.length);K=0;for(s=k.length;K<s;K++)v=K*3,I._array[v]=k[K].x,I._array[v+1]=k[K].y,I._array[v+2]=k[K].z;f.uniform3fv(o,I._array)}else if(K=="m4"){if(!I._array)I._array=new Float32Array(16);k.flattenToArray(I._array);f.uniformMatrix4fv(o,!1,I._array)}else if(K=="m4v"){if(!I._array)I._array=new Float32Array(16*k.length);K=0;for(s=k.length;K<s;K++)k[K].flattenToArrayOffset(I._array,
+K*16);f.uniformMatrix4fv(o,!1,I._array)}else if(K=="t"){if(f.uniform1i(o,k),o=I.texture)if(o.image instanceof Array&&o.image.length==6){if(I=o,I.image.length==6)if(I.needsUpdate){if(!I.image.__webglTextureCube)I.image.__webglTextureCube=f.createTexture();f.activeTexture(f.TEXTURE0+k);f.bindTexture(f.TEXTURE_CUBE_MAP,I.image.__webglTextureCube);for(k=0;k<6;k++)f.texImage2D(f.TEXTURE_CUBE_MAP_POSITIVE_X+k,0,f.RGBA,f.RGBA,f.UNSIGNED_BYTE,I.image[k]);Y(f.TEXTURE_CUBE_MAP,I,I.image[0]);I.needsUpdate=!1}else f.activeTexture(f.TEXTURE0+
+k),f.bindTexture(f.TEXTURE_CUBE_MAP,I.image.__webglTextureCube)}else o instanceof THREE.WebGLRenderTargetCube?(I=o,f.activeTexture(f.TEXTURE0+k),f.bindTexture(f.TEXTURE_CUBE_MAP,I.__webglTexture)):R(o,k)}else if(K=="tv"){if(!I._array){I._array=[];K=0;for(s=I.texture.length;K<s;K++)I._array[K]=k+K}f.uniform1iv(o,I._array);K=0;for(s=I.texture.length;K<s;K++)(o=I.texture[K])&&R(o,I._array[K])}(e instanceof THREE.ShaderMaterial||e instanceof THREE.MeshPhongMaterial||e.envMap)&&j.cameraPosition!==null&&
+f.uniform3f(j.cameraPosition,b.position.x,b.position.y,b.position.z);(e instanceof THREE.MeshPhongMaterial||e instanceof THREE.MeshLambertMaterial||e instanceof THREE.ShaderMaterial||e.skinning)&&j.viewMatrix!==null&&f.uniformMatrix4fv(j.viewMatrix,!1,Ua);e.skinning&&(f.uniformMatrix4fv(j.cameraInverseMatrix,!1,Ua),f.uniformMatrix4fv(j.boneGlobalMatrices,!1,i.boneMatrices))}f.uniformMatrix4fv(j.modelViewMatrix,!1,i._modelViewMatrixArray);j.normalMatrix&&f.uniformMatrix3fv(j.normalMatrix,!1,i._normalMatrixArray);
+(e instanceof THREE.ShaderMaterial||e.envMap||e.skinning||i.receiveShadow)&&j.objectMatrix!==null&&f.uniformMatrix4fv(j.objectMatrix,!1,i._objectMatrixArray);return h}function e(b,c,e,i,h,j){if(i.opacity!=0){var k,e=d(b,c,e,i,j),b=e.attributes,c=!1,e=h.id*16777215+e.id*2+(i.wireframe?1:0);e!=oa&&(oa=e,c=!0);if(!i.morphTargets&&b.position>=0)c&&(f.bindBuffer(f.ARRAY_BUFFER,h.__webglVertexBuffer),f.vertexAttribPointer(b.position,3,f.FLOAT,!1,0,0));else if(j.morphTargetBase){e=i.program.attributes;j.morphTargetBase!==
+-1?(f.bindBuffer(f.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[j.morphTargetBase]),f.vertexAttribPointer(e.position,3,f.FLOAT,!1,0,0)):e.position>=0&&(f.bindBuffer(f.ARRAY_BUFFER,h.__webglVertexBuffer),f.vertexAttribPointer(e.position,3,f.FLOAT,!1,0,0));if(j.morphTargetForcedOrder.length)for(var o=0,r=j.morphTargetForcedOrder,n=j.morphTargetInfluences;o<i.numSupportedMorphTargets&&o<r.length;)f.bindBuffer(f.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[r[o]]),f.vertexAttribPointer(e["morphTarget"+o],3,
+f.FLOAT,!1,0,0),j.__webglMorphTargetInfluences[o]=n[r[o]],o++;else{var r=[],C=-1,s=0,n=j.morphTargetInfluences,p,K=n.length,o=0;for(j.morphTargetBase!==-1&&(r[j.morphTargetBase]=!0);o<i.numSupportedMorphTargets;){for(p=0;p<K;p++)!r[p]&&n[p]>C&&(s=p,C=n[s]);f.bindBuffer(f.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[s]);f.vertexAttribPointer(e["morphTarget"+o],3,f.FLOAT,!1,0,0);j.__webglMorphTargetInfluences[o]=C;r[s]=1;C=-1;o++}}i.program.uniforms.morphTargetInfluences!==null&&f.uniform1fv(i.program.uniforms.morphTargetInfluences,
+j.__webglMorphTargetInfluences)}if(c){if(h.__webglCustomAttributes)for(k in h.__webglCustomAttributes)b[k]>=0&&(e=h.__webglCustomAttributes[k],f.bindBuffer(f.ARRAY_BUFFER,e.buffer),f.vertexAttribPointer(b[k],e.size,f.FLOAT,!1,0,0));b.color>=0&&(f.bindBuffer(f.ARRAY_BUFFER,h.__webglColorBuffer),f.vertexAttribPointer(b.color,3,f.FLOAT,!1,0,0));b.normal>=0&&(f.bindBuffer(f.ARRAY_BUFFER,h.__webglNormalBuffer),f.vertexAttribPointer(b.normal,3,f.FLOAT,!1,0,0));b.tangent>=0&&(f.bindBuffer(f.ARRAY_BUFFER,
 h.__webglTangentBuffer),f.vertexAttribPointer(b.tangent,4,f.FLOAT,!1,0,0));b.uv>=0&&(h.__webglUVBuffer?(f.bindBuffer(f.ARRAY_BUFFER,h.__webglUVBuffer),f.vertexAttribPointer(b.uv,2,f.FLOAT,!1,0,0),f.enableVertexAttribArray(b.uv)):f.disableVertexAttribArray(b.uv));b.uv2>=0&&(h.__webglUV2Buffer?(f.bindBuffer(f.ARRAY_BUFFER,h.__webglUV2Buffer),f.vertexAttribPointer(b.uv2,2,f.FLOAT,!1,0,0),f.enableVertexAttribArray(b.uv2)):f.disableVertexAttribArray(b.uv2));i.skinning&&b.skinVertexA>=0&&b.skinVertexB>=
 0&&b.skinIndex>=0&&b.skinWeight>=0&&(f.bindBuffer(f.ARRAY_BUFFER,h.__webglSkinVertexABuffer),f.vertexAttribPointer(b.skinVertexA,4,f.FLOAT,!1,0,0),f.bindBuffer(f.ARRAY_BUFFER,h.__webglSkinVertexBBuffer),f.vertexAttribPointer(b.skinVertexB,4,f.FLOAT,!1,0,0),f.bindBuffer(f.ARRAY_BUFFER,h.__webglSkinIndicesBuffer),f.vertexAttribPointer(b.skinIndex,4,f.FLOAT,!1,0,0),f.bindBuffer(f.ARRAY_BUFFER,h.__webglSkinWeightsBuffer),f.vertexAttribPointer(b.skinWeight,4,f.FLOAT,!1,0,0))}j instanceof THREE.Mesh?(i.wireframe?
-(f.lineWidth(i.wireframeLinewidth),c&&f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,h.__webglLineBuffer),f.drawElements(f.LINES,h.__webglLineCount,f.UNSIGNED_SHORT,0)):(c&&f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,h.__webglFaceBuffer),f.drawElements(f.TRIANGLES,h.__webglFaceCount,f.UNSIGNED_SHORT,0)),M.info.render.calls++,M.info.render.vertices+=h.__webglFaceCount,M.info.render.faces+=h.__webglFaceCount/3):j instanceof THREE.Line?(j=j.type==THREE.LineStrip?f.LINE_STRIP:f.LINES,f.lineWidth(i.linewidth),f.drawArrays(j,
-0,h.__webglLineCount),M.info.render.calls++):j instanceof THREE.ParticleSystem?(f.drawArrays(f.POINTS,0,h.__webglParticleCount),M.info.render.calls++):j instanceof THREE.Ribbon&&(f.drawArrays(f.TRIANGLE_STRIP,0,h.__webglVertexCount),M.info.render.calls++)}}function h(b,c,d){if(!b.__webglVertexBuffer)b.__webglVertexBuffer=f.createBuffer();if(!b.__webglNormalBuffer)b.__webglNormalBuffer=f.createBuffer();b.hasPos&&(f.bindBuffer(f.ARRAY_BUFFER,b.__webglVertexBuffer),f.bufferData(f.ARRAY_BUFFER,b.positionArray,
-f.DYNAMIC_DRAW),f.enableVertexAttribArray(c.attributes.position),f.vertexAttribPointer(c.attributes.position,3,f.FLOAT,!1,0,0));if(b.hasNormal){f.bindBuffer(f.ARRAY_BUFFER,b.__webglNormalBuffer);if(d==THREE.FlatShading){var e,h,i,j,k,x,n,p,q,m,C=b.count*3;for(m=0;m<C;m+=9)d=b.normalArray,e=d[m],h=d[m+1],i=d[m+2],j=d[m+3],x=d[m+4],p=d[m+5],k=d[m+6],n=d[m+7],q=d[m+8],e=(e+j+k)/3,h=(h+x+n)/3,i=(i+p+q)/3,d[m]=e,d[m+1]=h,d[m+2]=i,d[m+3]=e,d[m+4]=h,d[m+5]=i,d[m+6]=e,d[m+7]=h,d[m+8]=i}f.bufferData(f.ARRAY_BUFFER,
-b.normalArray,f.DYNAMIC_DRAW);f.enableVertexAttribArray(c.attributes.normal);f.vertexAttribPointer(c.attributes.normal,3,f.FLOAT,!1,0,0)}f.drawArrays(f.TRIANGLES,0,b.count);b.count=0}function i(b){if(U!=b.doubleSided)b.doubleSided?f.disable(f.CULL_FACE):f.enable(f.CULL_FACE),U=b.doubleSided;if(W!=b.flipSided)b.flipSided?f.frontFace(f.CW):f.frontFace(f.CCW),W=b.flipSided}function j(b){P!=b&&(b?f.enable(f.DEPTH_TEST):f.disable(f.DEPTH_TEST),P=b)}function k(b){za!=b&&(f.depthMask(b),za=b)}function n(b,
-c,d){Ma!=b&&(b?f.enable(f.POLYGON_OFFSET_FILL):f.disable(f.POLYGON_OFFSET_FILL),Ma=b);if(b&&(Sa!=c||Ta!=d))f.polygonOffset(c,d),Sa=c,Ta=d}function p(b){X[0].set(b.n41-b.n11,b.n42-b.n12,b.n43-b.n13,b.n44-b.n14);X[1].set(b.n41+b.n11,b.n42+b.n12,b.n43+b.n13,b.n44+b.n14);X[2].set(b.n41+b.n21,b.n42+b.n22,b.n43+b.n23,b.n44+b.n24);X[3].set(b.n41-b.n21,b.n42-b.n22,b.n43-b.n23,b.n44-b.n24);X[4].set(b.n41-b.n31,b.n42-b.n32,b.n43-b.n33,b.n44-b.n34);X[5].set(b.n41+b.n31,b.n42+b.n32,b.n43+b.n33,b.n44+b.n34);for(var c,
-b=0;b<6;b++)c=X[b],c.divideScalar(Math.sqrt(c.x*c.x+c.y*c.y+c.z*c.z))}function q(b){for(var c=b.matrixWorld,f=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),d=0;d<6;d++)if(b=X[d].x*c.n14+X[d].y*c.n24+X[d].z*c.n34+X[d].w,b<=f)return!1;return!0}function m(b,c){b.list[b.count]=c;b.count+=1}function r(b){var c,f,d=b.object,e=b.opaque,h=b.transparent;h.count=0;b=e.count=0;for(c=d.materials.length;b<c;b++)f=d.materials[b],f.transparent?m(h,f):m(e,f)}function t(b){var c,
-f,d,e,h=b.object,i=b.buffer,j=b.opaque,k=b.transparent;k.count=0;b=j.count=0;for(d=h.materials.length;b<d;b++)if(c=h.materials[b],c instanceof THREE.MeshFaceMaterial){c=0;for(f=i.materials.length;c<f;c++)(e=i.materials[c])&&(e.transparent?m(k,e):m(j,e))}else(e=c)&&(e.transparent?m(k,e):m(j,e))}function A(b,c){return c.z-b.z}function y(b){var c,k,n,I=0,m,t,r,x,u=b.lights;sa||(sa=new THREE.PerspectiveCamera(M.shadowCameraFov,M.shadowMapWidth/M.shadowMapHeight,M.shadowCameraNear,M.shadowCameraFar));
-c=0;for(k=u.length;c<k;c++)if(n=u[c],n instanceof THREE.SpotLight&&n.castShadow){na=-1;M.shadowMap[I]||(M.shadowMap[I]=new THREE.WebGLRenderTarget(M.shadowMapWidth,M.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}));Va[I]||(Va[I]=new THREE.Matrix4);m=M.shadowMap[I];t=Va[I];sa.position.copy(n.position);sa.lookAt(n.target.position);sa.update(void 0,!0);b.update(void 0,!1,sa);t.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);t.multiplySelf(sa.projectionMatrix);
-t.multiplySelf(sa.matrixWorldInverse);sa.matrixWorldInverse.flattenToArray(Xa);sa.projectionMatrix.flattenToArray(Wa);Ea.multiply(sa.projectionMatrix,sa.matrixWorldInverse);p(Ea);M.initWebGLObjects(b);V(m);f.clearColor(1,1,1,1);M.clear();f.clearColor(wa.r,wa.g,wa.b,Ba);t=b.__webglObjects.length;n=b.__webglObjectsImmediate.length;for(m=0;m<t;m++)r=b.__webglObjects[m],x=r.object,x.visible&&x.castShadow?!(x instanceof THREE.Mesh)||!x.frustumCulled||q(x)?(x.matrixWorld.flattenToArray(x._objectMatrixArray),
-F(x,sa,!1),r.render=!0):r.render=!1:r.render=!1;j(!0);G(THREE.NormalBlending);for(m=0;m<t;m++)if(r=b.__webglObjects[m],r.render)x=r.object,buffer=r.buffer,i(x),r=x.customDepthMaterial?x.customDepthMaterial:x.geometry.morphTargets.length?bb:Ya,d(sa,u,null,r,buffer,x);for(m=0;m<n;m++)r=b.__webglObjectsImmediate[m],x=r.object,x.visible&&x.castShadow&&(x.matrixAutoUpdate&&x.matrixWorld.flattenToArray(x._objectMatrixArray),D=-1,F(x,sa,!1),i(x),program=e(sa,u,null,Ya,x),x.immediateRenderCallback?x.immediateRenderCallback(program,
-f,X):x.render(function(b){h(b,program,Ya.shading)}));I++}}function J(b,c){var d,e,h;d=u.attributes;var i=u.uniforms,j=Ka/va,k,x=[],n=va*0.5,m=Ka*0.5,p=!0;f.useProgram(u.program);Za=u.program;D=P=ia=-1;cb||(f.enableVertexAttribArray(u.attributes.position),f.enableVertexAttribArray(u.attributes.uv),cb=!0);f.disable(f.CULL_FACE);f.enable(f.BLEND);f.depthMask(!0);f.bindBuffer(f.ARRAY_BUFFER,u.vertexBuffer);f.vertexAttribPointer(d.position,2,f.FLOAT,!1,16,0);f.vertexAttribPointer(d.uv,2,f.FLOAT,!1,16,
-8);f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,u.elementBuffer);f.uniformMatrix4fv(i.projectionMatrix,!1,Wa);f.activeTexture(f.TEXTURE0);f.uniform1i(i.map,0);d=0;for(e=b.__webglSprites.length;d<e;d++)if(h=b.__webglSprites[d],h.visible&&h.opacity!=0)h.useScreenCoordinates?h.z=-h.position.z:(h._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,h.matrixWorld,h._modelViewMatrixArray),h.z=-h._modelViewMatrix.n34);b.__webglSprites.sort(A);d=0;for(e=b.__webglSprites.length;d<e;d++)h=b.__webglSprites[d],h.visible&&
-h.opacity!=0&&h.map&&h.map.image&&h.map.image.width&&(h.useScreenCoordinates?(f.uniform1i(i.useScreenCoordinates,1),f.uniform3f(i.screenPosition,(h.position.x-n)/n,(m-h.position.y)/m,Math.max(0,Math.min(1,h.position.z)))):(f.uniform1i(i.useScreenCoordinates,0),f.uniform1i(i.affectedByDistance,h.affectedByDistance?1:0),f.uniformMatrix4fv(i.modelViewMatrix,!1,h._modelViewMatrixArray)),k=h.map.image.width/(h.scaleByViewport?Ka:1),x[0]=k*j*h.scale.x,x[1]=k*h.scale.y,f.uniform2f(i.uvScale,h.uvScale.x,
-h.uvScale.y),f.uniform2f(i.uvOffset,h.uvOffset.x,h.uvOffset.y),f.uniform2f(i.alignment,h.alignment.x,h.alignment.y),f.uniform1f(i.opacity,h.opacity),f.uniform3f(i.color,h.color.r,h.color.g,h.color.b),f.uniform1f(i.rotation,h.rotation),f.uniform2fv(i.scale,x),h.mergeWith3D&&!p?(f.enable(f.DEPTH_TEST),p=!0):!h.mergeWith3D&&p&&(f.disable(f.DEPTH_TEST),p=!1),G(h.blending),T(h.map,0),f.drawElements(f.TRIANGLES,6,f.UNSIGNED_SHORT,0));f.enable(f.CULL_FACE);f.enable(f.DEPTH_TEST);f.depthMask(za)}function F(b,
-c,f){b._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);f&&THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}function xa(b){var c,f,d,e;e=b.__materials;b=0;for(f=e.length;b<f;b++)if(d=e[b],d.attributes)for(c in d.attributes)if(d.attributes[c].needsUpdate)return!0;return!1}function ya(b){var c,f,d,e;e=b.__materials;b=0;for(f=e.length;b<f;b++)if(d=e[b],d.attributes)for(c in d.attributes)d.attributes[c].needsUpdate=!1}
-function ja(b,c){var f;for(f=b.length-1;f>=0;f--)b[f].object==c&&b.splice(f,1)}function ta(b){function c(b){var e=[];f=0;for(d=b.length;f<d;f++)b[f]==void 0?e.push("undefined"):e.push(b[f].id);return e.join("_")}var f,d,e,h,i,j,k,n,m={},p=b.morphTargets!==void 0?b.morphTargets.length:0;b.geometryGroups={};e=0;for(h=b.faces.length;e<h;e++)i=b.faces[e],j=i.materials,k=c(j),m[k]==void 0&&(m[k]={hash:k,counter:0}),n=m[k].hash+"_"+m[k].counter,b.geometryGroups[n]==void 0&&(b.geometryGroups[n]={faces:[],
-materials:j,vertices:0,numMorphTargets:p}),i=i instanceof THREE.Face3?3:4,b.geometryGroups[n].vertices+i>65535&&(m[k].counter+=1,n=m[k].hash+"_"+m[k].counter,b.geometryGroups[n]==void 0&&(b.geometryGroups[n]={faces:[],materials:j,vertices:0,numMorphTargets:p})),b.geometryGroups[n].faces.push(e),b.geometryGroups[n].vertices+=i;b.geometryGroupsList=[];for(var q in b.geometryGroups)b.geometryGroups[q].id=R++,b.geometryGroupsList.push(b.geometryGroups[q])}function ha(b,c,f){b.push({buffer:c,object:f,
-opaque:{list:[],count:0},transparent:{list:[],count:0}})}function G(b){if(b!=ia){switch(b){case THREE.AdditiveBlending:f.blendEquation(f.FUNC_ADD);f.blendFunc(f.SRC_ALPHA,f.ONE);break;case THREE.SubtractiveBlending:f.blendEquation(f.FUNC_ADD);f.blendFunc(f.ZERO,f.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:f.blendEquation(f.FUNC_ADD);f.blendFunc(f.ZERO,f.SRC_COLOR);break;default:f.blendEquationSeparate(f.FUNC_ADD,f.FUNC_ADD),f.blendFuncSeparate(f.SRC_ALPHA,f.ONE_MINUS_SRC_ALPHA,f.ONE,f.ONE_MINUS_SRC_ALPHA)}ia=
-b}}function v(b,c,d){(d.width&d.width-1)==0&&(d.height&d.height-1)==0?(f.texParameteri(b,f.TEXTURE_WRAP_S,$(c.wrapS)),f.texParameteri(b,f.TEXTURE_WRAP_T,$(c.wrapT)),f.texParameteri(b,f.TEXTURE_MAG_FILTER,$(c.magFilter)),f.texParameteri(b,f.TEXTURE_MIN_FILTER,$(c.minFilter)),f.generateMipmap(b)):(f.texParameteri(b,f.TEXTURE_WRAP_S,f.CLAMP_TO_EDGE),f.texParameteri(b,f.TEXTURE_WRAP_T,f.CLAMP_TO_EDGE),f.texParameteri(b,f.TEXTURE_MAG_FILTER,Ca(c.magFilter)),f.texParameteri(b,f.TEXTURE_MIN_FILTER,Ca(c.minFilter)))}
-function T(b,c){if(b.needsUpdate){if(!b.__webglInit)b.__webglInit=!0,b.__webglTexture=f.createTexture(),M.info.memory.textures++;f.activeTexture(f.TEXTURE0+c);f.bindTexture(f.TEXTURE_2D,b.__webglTexture);b instanceof THREE.DataTexture?f.texImage2D(f.TEXTURE_2D,0,$(b.format),b.image.width,b.image.height,0,$(b.format),f.UNSIGNED_BYTE,b.image.data):f.texImage2D(f.TEXTURE_2D,0,f.RGBA,f.RGBA,f.UNSIGNED_BYTE,b.image);v(f.TEXTURE_2D,b,b.image);b.needsUpdate=!1}else f.activeTexture(f.TEXTURE0+c),f.bindTexture(f.TEXTURE_2D,
-b.__webglTexture)}function L(b,c){f.bindRenderbuffer(f.RENDERBUFFER,b);c.depthBuffer&&!c.stencilBuffer?(f.renderbufferStorage(f.RENDERBUFFER,f.DEPTH_COMPONENT16,c.width,c.height),f.framebufferRenderbuffer(f.FRAMEBUFFER,f.DEPTH_ATTACHMENT,f.RENDERBUFFER,b)):c.depthBuffer&&c.stencilBuffer?(f.renderbufferStorage(f.RENDERBUFFER,f.DEPTH_STENCIL,c.width,c.height),f.framebufferRenderbuffer(f.FRAMEBUFFER,f.DEPTH_STENCIL_ATTACHMENT,f.RENDERBUFFER,b)):f.renderbufferStorage(f.RENDERBUFFER,f.RGBA4,c.width,c.height)}
-function V(b){var c=b instanceof THREE.WebGLRenderTargetCube;if(b&&!b.__webglFramebuffer){if(b.depthBuffer===void 0)b.depthBuffer=!0;if(b.stencilBuffer===void 0)b.stencilBuffer=!0;b.__webglTexture=f.createTexture();if(c){b.__webglFramebuffer=[];b.__webglRenderbuffer=[];f.bindTexture(f.TEXTURE_CUBE_MAP,b.__webglTexture);v(f.TEXTURE_CUBE_MAP,b,b);for(var d=0;d<6;d++){b.__webglFramebuffer[d]=f.createFramebuffer();b.__webglRenderbuffer[d]=f.createRenderbuffer();f.texImage2D(f.TEXTURE_CUBE_MAP_POSITIVE_X+
-d,0,$(b.format),b.width,b.height,0,$(b.format),$(b.type),null);var e=b,h=f.TEXTURE_CUBE_MAP_POSITIVE_X+d;f.bindFramebuffer(f.FRAMEBUFFER,b.__webglFramebuffer[d]);f.framebufferTexture2D(f.FRAMEBUFFER,f.COLOR_ATTACHMENT0,h,e.__webglTexture,0);L(b.__webglRenderbuffer[d],b)}}else b.__webglFramebuffer=f.createFramebuffer(),b.__webglRenderbuffer=f.createRenderbuffer(),f.bindTexture(f.TEXTURE_2D,b.__webglTexture),v(f.TEXTURE_2D,b,b),f.texImage2D(f.TEXTURE_2D,0,$(b.format),b.width,b.height,0,$(b.format),
-$(b.type),null),d=f.TEXTURE_2D,f.bindFramebuffer(f.FRAMEBUFFER,b.__webglFramebuffer),f.framebufferTexture2D(f.FRAMEBUFFER,f.COLOR_ATTACHMENT0,d,b.__webglTexture,0),f.bindRenderbuffer(f.RENDERBUFFER,b.__webglRenderbuffer),L(b.__webglRenderbuffer,b);c?f.bindTexture(f.TEXTURE_CUBE_MAP,null):f.bindTexture(f.TEXTURE_2D,null);f.bindRenderbuffer(f.RENDERBUFFER,null);f.bindFramebuffer(f.FRAMEBUFFER,null)}b?(c=c?b.__webglFramebuffer[b.activeCubeFace]:b.__webglFramebuffer,d=b.width,b=b.height,h=e=0):(c=null,
-d=va,b=Ka,e=Aa,h=Da);c!=aa&&(f.bindFramebuffer(f.FRAMEBUFFER,c),f.viewport(e,h,d,b),aa=c)}function la(b){b instanceof THREE.WebGLRenderTargetCube?(f.bindTexture(f.TEXTURE_CUBE_MAP,b.__webglTexture),f.generateMipmap(f.TEXTURE_CUBE_MAP),f.bindTexture(f.TEXTURE_CUBE_MAP,null)):(f.bindTexture(f.TEXTURE_2D,b.__webglTexture),f.generateMipmap(f.TEXTURE_2D),f.bindTexture(f.TEXTURE_2D,null))}function Z(b,c){var d;b=="fragment"?d=f.createShader(f.FRAGMENT_SHADER):b=="vertex"&&(d=f.createShader(f.VERTEX_SHADER));
-f.shaderSource(d,c);f.compileShader(d);if(!f.getShaderParameter(d,f.COMPILE_STATUS))return console.error(f.getShaderInfoLog(d)),console.error(c),null;return d}function Ca(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return f.NEAREST;default:return f.LINEAR}}function $(b){switch(b){case THREE.RepeatWrapping:return f.REPEAT;case THREE.ClampToEdgeWrapping:return f.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return f.MIRRORED_REPEAT;
+(f.lineWidth(i.wireframeLinewidth),c&&f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,h.__webglLineBuffer),f.drawElements(f.LINES,h.__webglLineCount,f.UNSIGNED_SHORT,0)):(c&&f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,h.__webglFaceBuffer),f.drawElements(f.TRIANGLES,h.__webglFaceCount,f.UNSIGNED_SHORT,0)),F.info.render.calls++,F.info.render.vertices+=h.__webglFaceCount,F.info.render.faces+=h.__webglFaceCount/3):j instanceof THREE.Line?(j=j.type==THREE.LineStrip?f.LINE_STRIP:f.LINES,f.lineWidth(i.linewidth),f.drawArrays(j,
+0,h.__webglLineCount),F.info.render.calls++):j instanceof THREE.ParticleSystem?(f.drawArrays(f.POINTS,0,h.__webglParticleCount),F.info.render.calls++):j instanceof THREE.Ribbon&&(f.drawArrays(f.TRIANGLE_STRIP,0,h.__webglVertexCount),F.info.render.calls++)}}function h(b,c,d){if(!b.__webglVertexBuffer)b.__webglVertexBuffer=f.createBuffer();if(!b.__webglNormalBuffer)b.__webglNormalBuffer=f.createBuffer();b.hasPos&&(f.bindBuffer(f.ARRAY_BUFFER,b.__webglVertexBuffer),f.bufferData(f.ARRAY_BUFFER,b.positionArray,
+f.DYNAMIC_DRAW),f.enableVertexAttribArray(c.attributes.position),f.vertexAttribPointer(c.attributes.position,3,f.FLOAT,!1,0,0));if(b.hasNormal){f.bindBuffer(f.ARRAY_BUFFER,b.__webglNormalBuffer);if(d==THREE.FlatShading){var e,h,i,j,k,r,o,n,s,p,K=b.count*3;for(p=0;p<K;p+=9)d=b.normalArray,e=d[p],h=d[p+1],i=d[p+2],j=d[p+3],r=d[p+4],n=d[p+5],k=d[p+6],o=d[p+7],s=d[p+8],e=(e+j+k)/3,h=(h+r+o)/3,i=(i+n+s)/3,d[p]=e,d[p+1]=h,d[p+2]=i,d[p+3]=e,d[p+4]=h,d[p+5]=i,d[p+6]=e,d[p+7]=h,d[p+8]=i}f.bufferData(f.ARRAY_BUFFER,
+b.normalArray,f.DYNAMIC_DRAW);f.enableVertexAttribArray(c.attributes.normal);f.vertexAttribPointer(c.attributes.normal,3,f.FLOAT,!1,0,0)}f.drawArrays(f.TRIANGLES,0,b.count);b.count=0}function i(b){if(La!=b.doubleSided)b.doubleSided?f.disable(f.CULL_FACE):f.enable(f.CULL_FACE),La=b.doubleSided;if(Ja!=b.flipSided)b.flipSided?f.frontFace(f.CW):f.frontFace(f.CCW),Ja=b.flipSided}function j(b){xa!=b&&(b?f.enable(f.DEPTH_TEST):f.disable(f.DEPTH_TEST),xa=b)}function k(b){ya!=b&&(f.depthMask(b),ya=b)}function s(b,
+c,d){$a!=b&&(b?f.enable(f.POLYGON_OFFSET_FILL):f.disable(f.POLYGON_OFFSET_FILL),$a=b);if(b&&(ab!=c||bb!=d))f.polygonOffset(c,d),ab=c,bb=d}function p(b){ta[0].set(b.n41-b.n11,b.n42-b.n12,b.n43-b.n13,b.n44-b.n14);ta[1].set(b.n41+b.n11,b.n42+b.n12,b.n43+b.n13,b.n44+b.n14);ta[2].set(b.n41+b.n21,b.n42+b.n22,b.n43+b.n23,b.n44+b.n24);ta[3].set(b.n41-b.n21,b.n42-b.n22,b.n43-b.n23,b.n44-b.n24);ta[4].set(b.n41-b.n31,b.n42-b.n32,b.n43-b.n33,b.n44-b.n34);ta[5].set(b.n41+b.n31,b.n42+b.n32,b.n43+b.n33,b.n44+b.n34);
+for(var c,b=0;b<6;b++)c=ta[b],c.divideScalar(Math.sqrt(c.x*c.x+c.y*c.y+c.z*c.z))}function o(b){for(var c=b.matrixWorld,f=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),d=0;d<6;d++)if(b=ta[d].x*c.n14+ta[d].y*c.n24+ta[d].z*c.n34+ta[d].w,b<=f)return!1;return!0}function n(b,c){b.list[b.count]=c;b.count+=1}function q(b){var c,f,d=b.object,e=b.opaque,h=b.transparent;h.count=0;b=e.count=0;for(c=d.materials.length;b<c;b++)f=d.materials[b],f.transparent?n(h,f):n(e,f)}function v(b){var c,
+f,d,e,h=b.object,i=b.buffer,j=b.opaque,k=b.transparent;k.count=0;b=j.count=0;for(d=h.materials.length;b<d;b++)if(c=h.materials[b],c instanceof THREE.MeshFaceMaterial){c=0;for(f=i.materials.length;c<f;c++)(e=i.materials[c])&&(e.transparent?n(k,e):n(j,e))}else(e=c)&&(e.transparent?n(k,e):n(j,e))}function y(b,c){return c.z-b.z}function D(b){var c,k,Ma,G=0,n,s,q,r,v=b.lights;U||(U=new THREE.PerspectiveCamera(F.shadowCameraFov,F.shadowMapWidth/F.shadowMapHeight,F.shadowCameraNear,F.shadowCameraFar));c=
+0;for(k=v.length;c<k;c++)if(Ma=v[c],Ma instanceof THREE.SpotLight&&Ma.castShadow){J=-1;F.shadowMap[G]||(F.shadowMap[G]=new THREE.WebGLRenderTarget(F.shadowMapWidth,F.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}));Ka[G]||(Ka[G]=new THREE.Matrix4);n=F.shadowMap[G];s=Ka[G];U.position.copy(Ma.position);U.lookAt(Ma.target.position);U.update(void 0,!0);b.update(void 0,!1,U);THREE.Matrix4.makeInvert(U.matrixWorld,U.matrixWorldInverse);s.set(0.5,0,0,
+0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);s.multiplySelf(U.projectionMatrix);s.multiplySelf(U.matrixWorldInverse);U.matrixWorldInverse.flattenToArray(Ua);U.projectionMatrix.flattenToArray(Ta);Ba.multiply(U.projectionMatrix,U.matrixWorldInverse);p(Ba);F.initWebGLObjects(b);aa(n);f.clearColor(1,1,1,1);F.clear();f.clearColor(ca.r,ca.g,ca.b,Da);s=b.__webglObjects.length;Ma=b.__webglObjectsImmediate.length;for(n=0;n<s;n++)q=b.__webglObjects[n],r=q.object,r.visible&&r.castShadow?!(r instanceof THREE.Mesh)||
+!r.frustumCulled||o(r)?(r.matrixWorld.flattenToArray(r._objectMatrixArray),H(r,U,!1),q.render=!0):q.render=!1:q.render=!1;j(!0);N(THREE.NormalBlending);for(n=0;n<s;n++)if(q=b.__webglObjects[n],q.render)r=q.object,buffer=q.buffer,i(r),q=r.customDepthMaterial?r.customDepthMaterial:r.geometry.morphTargets.length?cb:Va,e(U,v,null,q,buffer,r);for(n=0;n<Ma;n++)q=b.__webglObjectsImmediate[n],r=q.object,r.visible&&r.castShadow&&(r.matrixAutoUpdate&&r.matrixWorld.flattenToArray(r._objectMatrixArray),oa=-1,
+H(r,U,!1),i(r),program=d(U,v,null,Va,r),r.immediateRenderCallback?r.immediateRenderCallback(program,f,ta):r.render(function(b){h(b,program,Va.shading)}));G++}}function E(b,c){var d,e,h;d=u.attributes;var i=u.uniforms,j=Ha/Sa,k,r=[],n=Sa*0.5,o=Ha*0.5,p=!0;f.useProgram(u.program);O=u.program;oa=xa=Aa=-1;db||(f.enableVertexAttribArray(u.attributes.position),f.enableVertexAttribArray(u.attributes.uv),db=!0);f.disable(f.CULL_FACE);f.enable(f.BLEND);f.depthMask(!0);f.bindBuffer(f.ARRAY_BUFFER,u.vertexBuffer);
+f.vertexAttribPointer(d.position,2,f.FLOAT,!1,16,0);f.vertexAttribPointer(d.uv,2,f.FLOAT,!1,16,8);f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,u.elementBuffer);f.uniformMatrix4fv(i.projectionMatrix,!1,Ta);f.activeTexture(f.TEXTURE0);f.uniform1i(i.map,0);d=0;for(e=b.__webglSprites.length;d<e;d++)if(h=b.__webglSprites[d],h.visible&&h.opacity!=0)h.useScreenCoordinates?h.z=-h.position.z:(h._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,h.matrixWorld,h._modelViewMatrixArray),h.z=-h._modelViewMatrix.n34);
+b.__webglSprites.sort(y);d=0;for(e=b.__webglSprites.length;d<e;d++)h=b.__webglSprites[d],h.visible&&h.opacity!=0&&h.map&&h.map.image&&h.map.image.width&&(h.useScreenCoordinates?(f.uniform1i(i.useScreenCoordinates,1),f.uniform3f(i.screenPosition,(h.position.x-n)/n,(o-h.position.y)/o,Math.max(0,Math.min(1,h.position.z)))):(f.uniform1i(i.useScreenCoordinates,0),f.uniform1i(i.affectedByDistance,h.affectedByDistance?1:0),f.uniformMatrix4fv(i.modelViewMatrix,!1,h._modelViewMatrixArray)),k=h.map.image.width/
+(h.scaleByViewport?Ha:1),r[0]=k*j*h.scale.x,r[1]=k*h.scale.y,f.uniform2f(i.uvScale,h.uvScale.x,h.uvScale.y),f.uniform2f(i.uvOffset,h.uvOffset.x,h.uvOffset.y),f.uniform2f(i.alignment,h.alignment.x,h.alignment.y),f.uniform1f(i.opacity,h.opacity),f.uniform3f(i.color,h.color.r,h.color.g,h.color.b),f.uniform1f(i.rotation,h.rotation),f.uniform2fv(i.scale,r),h.mergeWith3D&&!p?(f.enable(f.DEPTH_TEST),p=!0):!h.mergeWith3D&&p&&(f.disable(f.DEPTH_TEST),p=!1),N(h.blending),R(h.map,0),f.drawElements(f.TRIANGLES,
+6,f.UNSIGNED_SHORT,0));f.enable(f.CULL_FACE);f.enable(f.DEPTH_TEST);f.depthMask(ya)}function H(b,c,f){b._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);f&&THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}function ia(b){var c,f,d,e;e=b.__materials;b=0;for(f=e.length;b<f;b++)if(d=e[b],d.attributes)for(c in d.attributes)if(d.attributes[c].needsUpdate)return!0;return!1}function B(b){var c,f,d,e;e=b.__materials;b=0;for(f=
+e.length;b<f;b++)if(d=e[b],d.attributes)for(c in d.attributes)d.attributes[c].needsUpdate=!1}function va(b,c){var f;for(f=b.length-1;f>=0;f--)b[f].object==c&&b.splice(f,1)}function ka(b){function c(b){var e=[];f=0;for(d=b.length;f<d;f++)b[f]==void 0?e.push("undefined"):e.push(b[f].id);return e.join("_")}var f,d,e,h,i,j,k,n,o={},p=b.morphTargets!==void 0?b.morphTargets.length:0;b.geometryGroups={};e=0;for(h=b.faces.length;e<h;e++)i=b.faces[e],j=i.materials,k=c(j),o[k]==void 0&&(o[k]={hash:k,counter:0}),
+n=o[k].hash+"_"+o[k].counter,b.geometryGroups[n]==void 0&&(b.geometryGroups[n]={faces:[],materials:j,vertices:0,numMorphTargets:p}),i=i instanceof THREE.Face3?3:4,b.geometryGroups[n].vertices+i>65535&&(o[k].counter+=1,n=o[k].hash+"_"+o[k].counter,b.geometryGroups[n]==void 0&&(b.geometryGroups[n]={faces:[],materials:j,vertices:0,numMorphTargets:p})),b.geometryGroups[n].faces.push(e),b.geometryGroups[n].vertices+=i;b.geometryGroupsList=[];for(var s in b.geometryGroups)b.geometryGroups[s].id=za++,b.geometryGroupsList.push(b.geometryGroups[s])}
+function sa(b,c,f){b.push({buffer:c,object:f,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function N(b){if(b!=Aa){switch(b){case THREE.AdditiveBlending:f.blendEquation(f.FUNC_ADD);f.blendFunc(f.SRC_ALPHA,f.ONE);break;case THREE.SubtractiveBlending:f.blendEquation(f.FUNC_ADD);f.blendFunc(f.ZERO,f.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:f.blendEquation(f.FUNC_ADD);f.blendFunc(f.ZERO,f.SRC_COLOR);break;default:f.blendEquationSeparate(f.FUNC_ADD,f.FUNC_ADD),f.blendFuncSeparate(f.SRC_ALPHA,
+f.ONE_MINUS_SRC_ALPHA,f.ONE,f.ONE_MINUS_SRC_ALPHA)}Aa=b}}function Y(b,c,d){(d.width&d.width-1)==0&&(d.height&d.height-1)==0?(f.texParameteri(b,f.TEXTURE_WRAP_S,x(c.wrapS)),f.texParameteri(b,f.TEXTURE_WRAP_T,x(c.wrapT)),f.texParameteri(b,f.TEXTURE_MAG_FILTER,x(c.magFilter)),f.texParameteri(b,f.TEXTURE_MIN_FILTER,x(c.minFilter)),f.generateMipmap(b)):(f.texParameteri(b,f.TEXTURE_WRAP_S,f.CLAMP_TO_EDGE),f.texParameteri(b,f.TEXTURE_WRAP_T,f.CLAMP_TO_EDGE),f.texParameteri(b,f.TEXTURE_MAG_FILTER,X(c.magFilter)),
+f.texParameteri(b,f.TEXTURE_MIN_FILTER,X(c.minFilter)))}function R(b,c){if(b.needsUpdate){if(!b.__webglInit)b.__webglInit=!0,b.__webglTexture=f.createTexture(),F.info.memory.textures++;f.activeTexture(f.TEXTURE0+c);f.bindTexture(f.TEXTURE_2D,b.__webglTexture);b instanceof THREE.DataTexture?f.texImage2D(f.TEXTURE_2D,0,x(b.format),b.image.width,b.image.height,0,x(b.format),f.UNSIGNED_BYTE,b.image.data):f.texImage2D(f.TEXTURE_2D,0,f.RGBA,f.RGBA,f.UNSIGNED_BYTE,b.image);Y(f.TEXTURE_2D,b,b.image);b.needsUpdate=
+!1}else f.activeTexture(f.TEXTURE0+c),f.bindTexture(f.TEXTURE_2D,b.__webglTexture)}function ra(b,c){f.bindRenderbuffer(f.RENDERBUFFER,b);c.depthBuffer&&!c.stencilBuffer?(f.renderbufferStorage(f.RENDERBUFFER,f.DEPTH_COMPONENT16,c.width,c.height),f.framebufferRenderbuffer(f.FRAMEBUFFER,f.DEPTH_ATTACHMENT,f.RENDERBUFFER,b)):c.depthBuffer&&c.stencilBuffer?(f.renderbufferStorage(f.RENDERBUFFER,f.DEPTH_STENCIL,c.width,c.height),f.framebufferRenderbuffer(f.FRAMEBUFFER,f.DEPTH_STENCIL_ATTACHMENT,f.RENDERBUFFER,
+b)):f.renderbufferStorage(f.RENDERBUFFER,f.RGBA4,c.width,c.height)}function aa(b){var c=b instanceof THREE.WebGLRenderTargetCube;if(b&&!b.__webglFramebuffer){if(b.depthBuffer===void 0)b.depthBuffer=!0;if(b.stencilBuffer===void 0)b.stencilBuffer=!0;b.__webglTexture=f.createTexture();if(c){b.__webglFramebuffer=[];b.__webglRenderbuffer=[];f.bindTexture(f.TEXTURE_CUBE_MAP,b.__webglTexture);Y(f.TEXTURE_CUBE_MAP,b,b);for(var d=0;d<6;d++){b.__webglFramebuffer[d]=f.createFramebuffer();b.__webglRenderbuffer[d]=
+f.createRenderbuffer();f.texImage2D(f.TEXTURE_CUBE_MAP_POSITIVE_X+d,0,x(b.format),b.width,b.height,0,x(b.format),x(b.type),null);var e=b,h=f.TEXTURE_CUBE_MAP_POSITIVE_X+d;f.bindFramebuffer(f.FRAMEBUFFER,b.__webglFramebuffer[d]);f.framebufferTexture2D(f.FRAMEBUFFER,f.COLOR_ATTACHMENT0,h,e.__webglTexture,0);ra(b.__webglRenderbuffer[d],b)}}else b.__webglFramebuffer=f.createFramebuffer(),b.__webglRenderbuffer=f.createRenderbuffer(),f.bindTexture(f.TEXTURE_2D,b.__webglTexture),Y(f.TEXTURE_2D,b,b),f.texImage2D(f.TEXTURE_2D,
+0,x(b.format),b.width,b.height,0,x(b.format),x(b.type),null),d=f.TEXTURE_2D,f.bindFramebuffer(f.FRAMEBUFFER,b.__webglFramebuffer),f.framebufferTexture2D(f.FRAMEBUFFER,f.COLOR_ATTACHMENT0,d,b.__webglTexture,0),f.bindRenderbuffer(f.RENDERBUFFER,b.__webglRenderbuffer),ra(b.__webglRenderbuffer,b);c?f.bindTexture(f.TEXTURE_CUBE_MAP,null):f.bindTexture(f.TEXTURE_2D,null);f.bindRenderbuffer(f.RENDERBUFFER,null);f.bindFramebuffer(f.FRAMEBUFFER,null)}b?(c=c?b.__webglFramebuffer[b.activeCubeFace]:b.__webglFramebuffer,
+d=b.width,b=b.height,h=e=0):(c=null,d=Sa,b=Ha,e=Wa,h=Xa);c!=W&&(f.bindFramebuffer(f.FRAMEBUFFER,c),f.viewport(e,h,d,b),W=c)}function la(b){b instanceof THREE.WebGLRenderTargetCube?(f.bindTexture(f.TEXTURE_CUBE_MAP,b.__webglTexture),f.generateMipmap(f.TEXTURE_CUBE_MAP),f.bindTexture(f.TEXTURE_CUBE_MAP,null)):(f.bindTexture(f.TEXTURE_2D,b.__webglTexture),f.generateMipmap(f.TEXTURE_2D),f.bindTexture(f.TEXTURE_2D,null))}function Z(b,c){var d;b=="fragment"?d=f.createShader(f.FRAGMENT_SHADER):b=="vertex"&&
+(d=f.createShader(f.VERTEX_SHADER));f.shaderSource(d,c);f.compileShader(d);if(!f.getShaderParameter(d,f.COMPILE_STATUS))return console.error(f.getShaderInfoLog(d)),console.error(c),null;return d}function X(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return f.NEAREST;default:return f.LINEAR}}function x(b){switch(b){case THREE.RepeatWrapping:return f.REPEAT;case THREE.ClampToEdgeWrapping:return f.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return f.MIRRORED_REPEAT;
 case THREE.NearestFilter:return f.NEAREST;case THREE.NearestMipMapNearestFilter:return f.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return f.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return f.LINEAR;case THREE.LinearMipMapNearestFilter:return f.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return f.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return f.BYTE;case THREE.UnsignedByteType:return f.UNSIGNED_BYTE;case THREE.ShortType:return f.SHORT;case THREE.UnsignedShortType:return f.UNSIGNED_SHORT;
-case THREE.IntType:return f.INT;case THREE.UnsignedShortType:return f.UNSIGNED_INT;case THREE.FloatType:return f.FLOAT;case THREE.AlphaFormat:return f.ALPHA;case THREE.RGBFormat:return f.RGB;case THREE.RGBAFormat:return f.RGBA;case THREE.LuminanceFormat:return f.LUMINANCE;case THREE.LuminanceAlphaFormat:return f.LUMINANCE_ALPHA}return 0}var M=this,f,Ha=[],Za=null,aa=null,na=-1,D=null,R=0,U=null,W=null,ia=null,P=null,za=null,Ma=null,Sa=null,Ta=null,Aa=0,Da=0,va=0,Ka=0,X=[new THREE.Vector4,new THREE.Vector4,
-new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Ea=new THREE.Matrix4,Wa=new Float32Array(16),Xa=new Float32Array(16),Ja=new THREE.Vector4,ab={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},Fa=b.canvas!==void 0?b.canvas:document.createElement("canvas"),Q=b.stencil!==void 0?b.stencil:!0,fb=b.preserveDrawingBuffer!==void 0?b.preserveDrawingBuffer:!1,gb=b.antialias!==void 0?b.antialias:!1,wa=b.clearColor!==
-void 0?new THREE.Color(b.clearColor):new THREE.Color(0),Ba=b.clearAlpha!==void 0?b.clearAlpha:0,$a=b.maxLights!==void 0?b.maxLights:4;this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0}};this.maxMorphTargets=8;this.domElement=Fa;this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.shadowMapBias=0.0039;this.shadowMapDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowCameraNear=1;this.shadowCameraFar=
-5E3;this.shadowCameraFov=50;this.shadowMap=[];this.shadowMapEnabled=!1;this.shadowMapSoft=!0;var sa,Va=[],b=THREE.ShaderLib.depthRGBA,db=THREE.UniformsUtils.clone(b.uniforms),Ya=new THREE.ShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:db}),bb=new THREE.ShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:db,morphTargets:!0});Ya._shadowPass=!0;bb._shadowPass=!0;try{if(!(f=Fa.getContext("experimental-webgl",{antialias:gb,stencil:Q,
-preserveDrawingBuffer:fb})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+f.getParameter(f.VERSION)+" | "+f.getParameter(f.VENDOR)+" | "+f.getParameter(f.RENDERER)+" | "+f.getParameter(f.SHADING_LANGUAGE_VERSION))}catch(hb){console.error(hb)}f.clearColor(0,0,0,1);f.clearDepth(1);f.clearStencil(0);f.enable(f.DEPTH_TEST);f.depthFunc(f.LEQUAL);f.frontFace(f.CCW);f.cullFace(f.BACK);f.enable(f.CULL_FACE);f.enable(f.BLEND);f.blendEquation(f.FUNC_ADD);f.blendFunc(f.SRC_ALPHA,
-f.ONE_MINUS_SRC_ALPHA);f.clearColor(wa.r,wa.g,wa.b,Ba);this.context=f;var eb=f.getParameter(f.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,u={};u.vertices=new Float32Array(16);u.faces=new Uint16Array(6);Q=0;u.vertices[Q++]=-1;u.vertices[Q++]=-1;u.vertices[Q++]=0;u.vertices[Q++]=1;u.vertices[Q++]=1;u.vertices[Q++]=-1;u.vertices[Q++]=1;u.vertices[Q++]=1;u.vertices[Q++]=1;u.vertices[Q++]=1;u.vertices[Q++]=1;u.vertices[Q++]=0;u.vertices[Q++]=-1;u.vertices[Q++]=1;u.vertices[Q++]=0;Q=u.vertices[Q++]=0;u.faces[Q++]=
-0;u.faces[Q++]=1;u.faces[Q++]=2;u.faces[Q++]=0;u.faces[Q++]=2;u.faces[Q++]=3;u.vertexBuffer=f.createBuffer();u.elementBuffer=f.createBuffer();f.bindBuffer(f.ARRAY_BUFFER,u.vertexBuffer);f.bufferData(f.ARRAY_BUFFER,u.vertices,f.STATIC_DRAW);f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,u.elementBuffer);f.bufferData(f.ELEMENT_ARRAY_BUFFER,u.faces,f.STATIC_DRAW);u.program=f.createProgram();f.attachShader(u.program,Z("fragment",THREE.ShaderLib.sprite.fragmentShader));f.attachShader(u.program,Z("vertex",THREE.ShaderLib.sprite.vertexShader));
+case THREE.IntType:return f.INT;case THREE.UnsignedShortType:return f.UNSIGNED_INT;case THREE.FloatType:return f.FLOAT;case THREE.AlphaFormat:return f.ALPHA;case THREE.RGBFormat:return f.RGB;case THREE.RGBAFormat:return f.RGBA;case THREE.LuminanceFormat:return f.LUMINANCE;case THREE.LuminanceAlphaFormat:return f.LUMINANCE_ALPHA}return 0}var F=this,f,S=[],O=null,W=null,J=-1,oa=null,za=0,La=null,Ja=null,Aa=null,xa=null,ya=null,$a=null,ab=null,bb=null,Wa=0,Xa=0,Sa=0,Ha=0,ta=[new THREE.Vector4,new THREE.Vector4,
+new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Ba=new THREE.Matrix4,Ta=new Float32Array(16),Ua=new Float32Array(16),Ea=new THREE.Vector4,Za={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},Ca=b.canvas!==void 0?b.canvas:document.createElement("canvas"),V=b.stencil!==void 0?b.stencil:!0,gb=b.preserveDrawingBuffer!==void 0?b.preserveDrawingBuffer:!1,hb=b.antialias!==void 0?b.antialias:!1,ca=b.clearColor!==
+void 0?new THREE.Color(b.clearColor):new THREE.Color(0),Da=b.clearAlpha!==void 0?b.clearAlpha:0,Ya=b.maxLights!==void 0?b.maxLights:4;this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0}};this.maxMorphTargets=8;this.domElement=Ca;this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.shadowMapBias=0.0039;this.shadowMapDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowCameraNear=1;this.shadowCameraFar=
+5E3;this.shadowCameraFov=50;this.shadowMap=[];this.shadowMapEnabled=!1;this.shadowMapSoft=!0;var U,Ka=[],b=THREE.ShaderLib.depthRGBA,eb=THREE.UniformsUtils.clone(b.uniforms),Va=new THREE.ShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:eb}),cb=new THREE.ShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:eb,morphTargets:!0});Va._shadowPass=!0;cb._shadowPass=!0;try{if(!(f=Ca.getContext("experimental-webgl",{antialias:hb,stencil:V,
+preserveDrawingBuffer:gb})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+f.getParameter(f.VERSION)+" | "+f.getParameter(f.VENDOR)+" | "+f.getParameter(f.RENDERER)+" | "+f.getParameter(f.SHADING_LANGUAGE_VERSION))}catch(ib){console.error(ib)}f.clearColor(0,0,0,1);f.clearDepth(1);f.clearStencil(0);f.enable(f.DEPTH_TEST);f.depthFunc(f.LEQUAL);f.frontFace(f.CCW);f.cullFace(f.BACK);f.enable(f.CULL_FACE);f.enable(f.BLEND);f.blendEquation(f.FUNC_ADD);f.blendFunc(f.SRC_ALPHA,
+f.ONE_MINUS_SRC_ALPHA);f.clearColor(ca.r,ca.g,ca.b,Da);this.context=f;var fb=f.getParameter(f.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,u={};u.vertices=new Float32Array(16);u.faces=new Uint16Array(6);V=0;u.vertices[V++]=-1;u.vertices[V++]=-1;u.vertices[V++]=0;u.vertices[V++]=1;u.vertices[V++]=1;u.vertices[V++]=-1;u.vertices[V++]=1;u.vertices[V++]=1;u.vertices[V++]=1;u.vertices[V++]=1;u.vertices[V++]=1;u.vertices[V++]=0;u.vertices[V++]=-1;u.vertices[V++]=1;u.vertices[V++]=0;V=u.vertices[V++]=0;u.faces[V++]=
+0;u.faces[V++]=1;u.faces[V++]=2;u.faces[V++]=0;u.faces[V++]=2;u.faces[V++]=3;u.vertexBuffer=f.createBuffer();u.elementBuffer=f.createBuffer();f.bindBuffer(f.ARRAY_BUFFER,u.vertexBuffer);f.bufferData(f.ARRAY_BUFFER,u.vertices,f.STATIC_DRAW);f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,u.elementBuffer);f.bufferData(f.ELEMENT_ARRAY_BUFFER,u.faces,f.STATIC_DRAW);u.program=f.createProgram();f.attachShader(u.program,Z("fragment",THREE.ShaderLib.sprite.fragmentShader));f.attachShader(u.program,Z("vertex",THREE.ShaderLib.sprite.vertexShader));
 f.linkProgram(u.program);u.attributes={};u.uniforms={};u.attributes.position=f.getAttribLocation(u.program,"position");u.attributes.uv=f.getAttribLocation(u.program,"uv");u.uniforms.uvOffset=f.getUniformLocation(u.program,"uvOffset");u.uniforms.uvScale=f.getUniformLocation(u.program,"uvScale");u.uniforms.rotation=f.getUniformLocation(u.program,"rotation");u.uniforms.scale=f.getUniformLocation(u.program,"scale");u.uniforms.alignment=f.getUniformLocation(u.program,"alignment");u.uniforms.color=f.getUniformLocation(u.program,
 "color");u.uniforms.map=f.getUniformLocation(u.program,"map");u.uniforms.opacity=f.getUniformLocation(u.program,"opacity");u.uniforms.useScreenCoordinates=f.getUniformLocation(u.program,"useScreenCoordinates");u.uniforms.affectedByDistance=f.getUniformLocation(u.program,"affectedByDistance");u.uniforms.screenPosition=f.getUniformLocation(u.program,"screenPosition");u.uniforms.modelViewMatrix=f.getUniformLocation(u.program,"modelViewMatrix");u.uniforms.projectionMatrix=f.getUniformLocation(u.program,
-"projectionMatrix");var cb=!1;this.setSize=function(b,c){Fa.width=b;Fa.height=c;this.setViewport(0,0,Fa.width,Fa.height)};this.setViewport=function(b,c,d,e){Aa=b;Da=c;va=d;Ka=e;f.viewport(Aa,Da,va,Ka)};this.setScissor=function(b,c,d,e){f.scissor(b,c,d,e)};this.enableScissorTest=function(b){b?f.enable(f.SCISSOR_TEST):f.disable(f.SCISSOR_TEST)};this.setClearColorHex=function(b,c){wa.setHex(b);Ba=c;f.clearColor(wa.r,wa.g,wa.b,Ba)};this.setClearColor=function(b,c){wa.copy(b);Ba=c;f.clearColor(wa.r,wa.g,
-wa.b,Ba)};this.getClearColor=function(){return wa};this.getClearAlpha=function(){return Ba};this.clear=function(b,c,d){var e=0;if(b==void 0||b)e|=f.COLOR_BUFFER_BIT;if(c==void 0||c)e|=f.DEPTH_BUFFER_BIT;if(d==void 0||d)e|=f.STENCIL_BUFFER_BIT;f.clear(e)};this.getContext=function(){return f};this.deallocateObject=function(b){if(b.__webglInit)if(b.__webglInit=!1,delete b._modelViewMatrix,delete b._normalMatrixArray,delete b._modelViewMatrixArray,delete b._objectMatrixArray,b instanceof THREE.Mesh)for(g in b.geometry.geometryGroups){var c=
+"projectionMatrix");var db=!1;this.setSize=function(b,c){Ca.width=b;Ca.height=c;this.setViewport(0,0,Ca.width,Ca.height)};this.setViewport=function(b,c,d,e){Wa=b;Xa=c;Sa=d;Ha=e;f.viewport(Wa,Xa,Sa,Ha)};this.setScissor=function(b,c,d,e){f.scissor(b,c,d,e)};this.enableScissorTest=function(b){b?f.enable(f.SCISSOR_TEST):f.disable(f.SCISSOR_TEST)};this.setClearColorHex=function(b,c){ca.setHex(b);Da=c;f.clearColor(ca.r,ca.g,ca.b,Da)};this.setClearColor=function(b,c){ca.copy(b);Da=c;f.clearColor(ca.r,ca.g,
+ca.b,Da)};this.getClearColor=function(){return ca};this.getClearAlpha=function(){return Da};this.clear=function(b,c,d){var e=0;if(b==void 0||b)e|=f.COLOR_BUFFER_BIT;if(c==void 0||c)e|=f.DEPTH_BUFFER_BIT;if(d==void 0||d)e|=f.STENCIL_BUFFER_BIT;f.clear(e)};this.getContext=function(){return f};this.deallocateObject=function(b){if(b.__webglInit)if(b.__webglInit=!1,delete b._modelViewMatrix,delete b._normalMatrixArray,delete b._modelViewMatrixArray,delete b._objectMatrixArray,b instanceof THREE.Mesh)for(g in b.geometry.geometryGroups){var c=
 b.geometry.geometryGroups[g];f.deleteBuffer(c.__webglVertexBuffer);f.deleteBuffer(c.__webglNormalBuffer);f.deleteBuffer(c.__webglTangentBuffer);f.deleteBuffer(c.__webglColorBuffer);f.deleteBuffer(c.__webglUVBuffer);f.deleteBuffer(c.__webglUV2Buffer);f.deleteBuffer(c.__webglSkinVertexABuffer);f.deleteBuffer(c.__webglSkinVertexBBuffer);f.deleteBuffer(c.__webglSkinIndicesBuffer);f.deleteBuffer(c.__webglSkinWeightsBuffer);f.deleteBuffer(c.__webglFaceBuffer);f.deleteBuffer(c.__webglLineBuffer);if(c.numMorphTargets)for(var d=
-0,e=c.numMorphTargets;d<e;d++)f.deleteBuffer(c.__webglMorphTargetsBuffers[d]);M.info.memory.geometries--}else if(b instanceof THREE.Ribbon)b=b.geometry,f.deleteBuffer(b.__webglVertexBuffer),f.deleteBuffer(b.__webglColorBuffer),M.info.memory.geometries--;else if(b instanceof THREE.Line)b=b.geometry,f.deleteBuffer(b.__webglVertexBuffer),f.deleteBuffer(b.__webglColorBuffer),M.info.memory.geometries--;else if(b instanceof THREE.ParticleSystem)b=b.geometry,f.deleteBuffer(b.__webglVertexBuffer),f.deleteBuffer(b.__webglColorBuffer),
-M.info.memory.geometries--};this.deallocateTexture=function(b){if(b.__webglInit)b.__webglInit=!1,f.deleteTexture(b.__webglTexture),M.info.memory.textures--};this.initMaterial=function(b,c,d,e){var h,i,j,k;b instanceof THREE.MeshDepthMaterial?k="depth":b instanceof THREE.MeshNormalMaterial?k="normal":b instanceof THREE.MeshBasicMaterial?k="basic":b instanceof THREE.MeshLambertMaterial?k="lambert":b instanceof THREE.MeshPhongMaterial?k="phong":b instanceof THREE.LineBasicMaterial?k="basic":b instanceof
-THREE.ParticleBasicMaterial&&(k="particle_basic");if(k){var n=THREE.ShaderLib[k];b.uniforms=THREE.UniformsUtils.clone(n.uniforms);b.vertexShader=n.vertexShader;b.fragmentShader=n.fragmentShader}var m,p,q;m=q=n=0;for(p=c.length;m<p;m++)j=c[m],j instanceof THREE.SpotLight&&q++,j instanceof THREE.DirectionalLight&&q++,j instanceof THREE.PointLight&&n++;n+q<=$a?m=q:(m=Math.ceil($a*q/(n+q)),n=$a-m);j={directional:m,point:n};n=q=0;for(m=c.length;n<m;n++)p=c[n],p instanceof THREE.SpotLight&&p.castShadow&&
-q++;var t=50;if(e!==void 0&&e instanceof THREE.SkinnedMesh)t=e.bones.length;var C;a:{m=b.fragmentShader;p=b.vertexShader;var n=b.uniforms,c=b.attributes,d={map:!!b.map,envMap:!!b.envMap,lightMap:!!b.lightMap,vertexColors:b.vertexColors,fog:d,useFog:b.fog,sizeAttenuation:b.sizeAttenuation,skinning:b.skinning,morphTargets:b.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:j.directional,maxPointLights:j.point,maxBones:t,shadowMapEnabled:this.shadowMapEnabled&&e.receiveShadow,shadowMapSoft:this.shadowMapSoft,
-shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:q,alphaTest:b.alphaTest},r,e=[];k?e.push(k):(e.push(m),e.push(p));for(r in d)e.push(r),e.push(d[r]);k=e.join();r=0;for(e=Ha.length;r<e;r++)if(Ha[r].code==k){C=Ha[r].program;break a}r=f.createProgram();e=[eb?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+d.maxDirLights,"#define MAX_POINT_LIGHTS "+d.maxPointLights,"#define MAX_SHADOWS "+d.maxShadows,"#define MAX_BONES "+d.maxBones,d.map?"#define USE_MAP":"",d.envMap?
+0,e=c.numMorphTargets;d<e;d++)f.deleteBuffer(c.__webglMorphTargetsBuffers[d]);F.info.memory.geometries--}else if(b instanceof THREE.Ribbon)b=b.geometry,f.deleteBuffer(b.__webglVertexBuffer),f.deleteBuffer(b.__webglColorBuffer),F.info.memory.geometries--;else if(b instanceof THREE.Line)b=b.geometry,f.deleteBuffer(b.__webglVertexBuffer),f.deleteBuffer(b.__webglColorBuffer),F.info.memory.geometries--;else if(b instanceof THREE.ParticleSystem)b=b.geometry,f.deleteBuffer(b.__webglVertexBuffer),f.deleteBuffer(b.__webglColorBuffer),
+F.info.memory.geometries--};this.deallocateTexture=function(b){if(b.__webglInit)b.__webglInit=!1,f.deleteTexture(b.__webglTexture),F.info.memory.textures--};this.initMaterial=function(b,c,d,e){var h,i,j,k;b instanceof THREE.MeshDepthMaterial?k="depth":b instanceof THREE.MeshNormalMaterial?k="normal":b instanceof THREE.MeshBasicMaterial?k="basic":b instanceof THREE.MeshLambertMaterial?k="lambert":b instanceof THREE.MeshPhongMaterial?k="phong":b instanceof THREE.LineBasicMaterial?k="basic":b instanceof
+THREE.ParticleBasicMaterial&&(k="particle_basic");if(k){var r=THREE.ShaderLib[k];b.uniforms=THREE.UniformsUtils.clone(r.uniforms);b.vertexShader=r.vertexShader;b.fragmentShader=r.fragmentShader}var n,o,p;n=p=r=0;for(o=c.length;n<o;n++)j=c[n],j instanceof THREE.SpotLight&&p++,j instanceof THREE.DirectionalLight&&p++,j instanceof THREE.PointLight&&r++;r+p<=Ya?n=p:(n=Math.ceil(Ya*p/(r+p)),r=Ya-n);j={directional:n,point:r};r=p=0;for(n=c.length;r<n;r++)o=c[r],o instanceof THREE.SpotLight&&o.castShadow&&
+p++;var s=50;if(e!==void 0&&e instanceof THREE.SkinnedMesh)s=e.bones.length;var q;a:{n=b.fragmentShader;o=b.vertexShader;var r=b.uniforms,c=b.attributes,d={map:!!b.map,envMap:!!b.envMap,lightMap:!!b.lightMap,vertexColors:b.vertexColors,fog:d,useFog:b.fog,sizeAttenuation:b.sizeAttenuation,skinning:b.skinning,morphTargets:b.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:j.directional,maxPointLights:j.point,maxBones:s,shadowMapEnabled:this.shadowMapEnabled&&e.receiveShadow,shadowMapSoft:this.shadowMapSoft,
+shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:p,alphaTest:b.alphaTest},v,e=[];k?e.push(k):(e.push(n),e.push(o));for(v in d)e.push(v),e.push(d[v]);k=e.join();v=0;for(e=S.length;v<e;v++)if(S[v].code==k){q=S[v].program;break a}v=f.createProgram();e=[fb?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+d.maxDirLights,"#define MAX_POINT_LIGHTS "+d.maxPointLights,"#define MAX_SHADOWS "+d.maxShadows,"#define MAX_BONES "+d.maxBones,d.map?"#define USE_MAP":"",d.envMap?
 "#define USE_ENVMAP":"",d.lightMap?"#define USE_LIGHTMAP":"",d.vertexColors?"#define USE_COLOR":"",d.skinning?"#define USE_SKINNING":"",d.morphTargets?"#define USE_MORPHTARGETS":"",d.shadowMapEnabled?"#define USE_SHADOWMAP":"",d.shadowMapSoft?"#define SHADOWMAP_SOFT":"",d.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
 j=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+d.maxDirLights,"#define MAX_POINT_LIGHTS "+d.maxPointLights,"#define MAX_SHADOWS "+d.maxShadows,d.alphaTest?"#define ALPHATEST "+d.alphaTest:"",d.useFog&&d.fog?"#define USE_FOG":"",d.useFog&&d.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",d.map?"#define USE_MAP":"",d.envMap?"#define USE_ENVMAP":"",d.lightMap?"#define USE_LIGHTMAP":"",d.vertexColors?"#define USE_COLOR":"",d.shadowMapEnabled?"#define USE_SHADOWMAP":"",
-d.shadowMapSoft?"#define SHADOWMAP_SOFT":"",d.shadowMapSoft?"#define SHADOWMAP_WIDTH "+d.shadowMapWidth.toFixed(1):"",d.shadowMapSoft?"#define SHADOWMAP_HEIGHT "+d.shadowMapHeight.toFixed(1):"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");f.attachShader(r,Z("fragment",j+m));f.attachShader(r,Z("vertex",e+p));f.linkProgram(r);f.getProgramParameter(r,f.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+f.getProgramParameter(r,f.VALIDATE_STATUS)+", gl error ["+
-f.getError()+"]");r.uniforms={};r.attributes={};var u,e=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(u in n)e.push(u);u=e;e=0;for(n=u.length;e<n;e++)m=u[e],r.uniforms[m]=f.getUniformLocation(r,m);e=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(u=0;u<d.maxMorphTargets;u++)e.push("morphTarget"+u);for(C in c)e.push(C);
-C=e;u=0;for(c=C.length;u<c;u++)d=C[u],r.attributes[d]=f.getAttribLocation(r,d);r.id=Ha.length;Ha.push({program:r,code:k});M.info.memory.programs=Ha.length;C=r}b.program=C;C=b.program.attributes;C.position>=0&&f.enableVertexAttribArray(C.position);C.color>=0&&f.enableVertexAttribArray(C.color);C.normal>=0&&f.enableVertexAttribArray(C.normal);C.tangent>=0&&f.enableVertexAttribArray(C.tangent);b.skinning&&C.skinVertexA>=0&&C.skinVertexB>=0&&C.skinIndex>=0&&C.skinWeight>=0&&(f.enableVertexAttribArray(C.skinVertexA),
-f.enableVertexAttribArray(C.skinVertexB),f.enableVertexAttribArray(C.skinIndex),f.enableVertexAttribArray(C.skinWeight));if(b.attributes)for(i in b.attributes)C[i]!==void 0&&C[i]>=0&&f.enableVertexAttribArray(C[i]);if(b.morphTargets)for(i=b.numSupportedMorphTargets=0;i<this.maxMorphTargets;i++)u="morphTarget"+i,C[u]>=0&&(f.enableVertexAttribArray(C[u]),b.numSupportedMorphTargets++);b.uniformsList=[];for(h in b.uniforms)b.uniformsList.push([b.uniforms[h],h])};this.clearTarget=function(b,c,d,f){V(b);
-this.clear(c,d,f)};this.render=function(b,c,m,u){var I,Ia,v,S,x,Ua,E,Qa,Ra=b.lights,C=b.fog;na=-1;this.shadowMapEnabled&&y(b,c);M.info.render.calls=0;M.info.render.vertices=0;M.info.render.faces=0;if(c.matrixAutoUpdate){for(x=c;x.parent;)x=x.parent;x.update(void 0,!0)}b.update(void 0,!1,c);c.matrixWorldInverse.flattenToArray(Xa);c.projectionMatrix.flattenToArray(Wa);Ea.multiply(c.projectionMatrix,c.matrixWorldInverse);p(Ea);this.initWebGLObjects(b);V(m);(this.autoClear||u)&&this.clear(this.autoClearColor,
-this.autoClearDepth,this.autoClearStencil);x=b.__webglObjects.length;for(u=0;u<x;u++)if(I=b.__webglObjects[u],E=I.object,E.visible)if(!(E instanceof THREE.Mesh)||!E.frustumCulled||q(E)){if(E.matrixWorld.flattenToArray(E._objectMatrixArray),F(E,c,!0),t(I),I.render=!0,this.sortObjects)I.object.renderDepth?I.z=I.object.renderDepth:(Ja.copy(E.position),Ea.multiplyVector3(Ja),I.z=Ja.z)}else I.render=!1;else I.render=!1;this.sortObjects&&b.__webglObjects.sort(A);Ua=b.__webglObjectsImmediate.length;for(u=
-0;u<Ua;u++)I=b.__webglObjectsImmediate[u],E=I.object,E.visible&&(E.matrixAutoUpdate&&E.matrixWorld.flattenToArray(E._objectMatrixArray),F(E,c,!0),r(I));if(b.overrideMaterial){j(b.overrideMaterial.depthTest);G(b.overrideMaterial.blending);for(u=0;u<x;u++)if(I=b.__webglObjects[u],I.render)E=I.object,Qa=I.buffer,i(E),d(c,Ra,C,b.overrideMaterial,Qa,E);for(u=0;u<Ua;u++)I=b.__webglObjectsImmediate[u],E=I.object,E.visible&&(D=-1,i(E),Ia=e(c,Ra,C,b.overrideMaterial,E),E.immediateRenderCallback?E.immediateRenderCallback(Ia,
-f,X):E.render(function(c){h(c,Ia,b.overrideMaterial.shading)}))}else{G(THREE.NormalBlending);for(u=x-1;u>=0;u--)if(I=b.__webglObjects[u],I.render){E=I.object;Qa=I.buffer;v=I.opaque;i(E);for(I=0;I<v.count;I++)S=v.list[I],j(S.depthTest),k(S.depthWrite),n(S.polygonOffset,S.polygonOffsetFactor,S.polygonOffsetUnits),d(c,Ra,C,S,Qa,E)}for(u=0;u<Ua;u++)if(I=b.__webglObjectsImmediate[u],E=I.object,E.visible){D=-1;v=I.opaque;i(E);for(I=0;I<v.count;I++)S=v.list[I],j(S.depthTest),k(S.depthWrite),n(S.polygonOffset,
-S.polygonOffsetFactor,S.polygonOffsetUnits),Ia=e(c,Ra,C,S,E),E.immediateRenderCallback?E.immediateRenderCallback(Ia,f,X):E.render(function(b){h(b,Ia,S.shading)})}for(u=0;u<x;u++)if(I=b.__webglObjects[u],I.render){E=I.object;Qa=I.buffer;v=I.transparent;i(E);for(I=0;I<v.count;I++)S=v.list[I],G(S.blending),j(S.depthTest),k(S.depthWrite),n(S.polygonOffset,S.polygonOffsetFactor,S.polygonOffsetUnits),d(c,Ra,C,S,Qa,E)}for(u=0;u<Ua;u++)if(I=b.__webglObjectsImmediate[u],E=I.object,E.visible){D=-1;v=I.transparent;
-i(E);for(I=0;I<v.count;I++)S=v.list[I],G(S.blending),j(S.depthTest),k(S.depthWrite),n(S.polygonOffset,S.polygonOffsetFactor,S.polygonOffsetUnits),Ia=e(c,Ra,C,S,E),E.immediateRenderCallback?E.immediateRenderCallback(Ia,f,X):E.render(function(b){h(b,Ia,S.shading)})}}b.__webglSprites.length&&J(b,c);m&&m.minFilter!==THREE.NearestFilter&&m.minFilter!==THREE.LinearFilter&&la(m)};this.initWebGLObjects=function(b){if(!b.__webglObjects)b.__webglObjects=[],b.__webglObjectsImmediate=[],b.__webglSprites=[];for(;b.__objectsAdded.length;){var d=
-b.__objectsAdded[0],e=b,h=void 0,i=void 0,j=void 0;if(!d.__webglInit)if(d.__webglInit=!0,d._modelViewMatrix=new THREE.Matrix4,d._normalMatrixArray=new Float32Array(9),d._modelViewMatrixArray=new Float32Array(16),d._objectMatrixArray=new Float32Array(16),d.matrixWorld.flattenToArray(d._objectMatrixArray),d instanceof THREE.Mesh)for(h in i=d.geometry,i.geometryGroups==void 0&&ta(i),i.geometryGroups){if(j=i.geometryGroups[h],!j.__webglVertexBuffer){var k=j;k.__webglVertexBuffer=f.createBuffer();k.__webglNormalBuffer=
-f.createBuffer();k.__webglTangentBuffer=f.createBuffer();k.__webglColorBuffer=f.createBuffer();k.__webglUVBuffer=f.createBuffer();k.__webglUV2Buffer=f.createBuffer();k.__webglSkinVertexABuffer=f.createBuffer();k.__webglSkinVertexBBuffer=f.createBuffer();k.__webglSkinIndicesBuffer=f.createBuffer();k.__webglSkinWeightsBuffer=f.createBuffer();k.__webglFaceBuffer=f.createBuffer();k.__webglLineBuffer=f.createBuffer();if(k.numMorphTargets){var n=void 0,m=void 0;k.__webglMorphTargetsBuffers=[];n=0;for(m=
-k.numMorphTargets;n<m;n++)k.__webglMorphTargetsBuffers.push(f.createBuffer())}M.info.memory.geometries++;for(var k=d,p=void 0,q=void 0,r=void 0,u=r=void 0,t=void 0,v=void 0,A=v=n=0,y=r=q=void 0,r=m=y=q=p=void 0,u=k.geometry,t=u.faces,y=j.faces,p=0,q=y.length;p<q;p++)r=y[p],r=t[r],r instanceof THREE.Face3?(n+=3,v+=1,A+=3):r instanceof THREE.Face4&&(n+=4,v+=2,A+=4);for(var p=j,q=k,F=y=t=void 0,H=void 0,F=void 0,r=[],t=0,y=q.materials.length;t<y;t++)if(F=q.materials[t],F instanceof THREE.MeshFaceMaterial){F=
-0;for(l=p.materials.length;F<l;F++)(H=p.materials[F])&&r.push(H)}else(H=F)&&r.push(H);p=r;j.__materials=p;a:{t=q=void 0;y=p.length;for(q=0;q<y;q++)if(t=p[q],t.map||t.lightMap||t instanceof THREE.ShaderMaterial){q=!0;break a}q=!1}a:{y=t=void 0;r=p.length;for(t=0;t<r;t++)if(y=p[t],!(y instanceof THREE.MeshBasicMaterial&&!y.envMap||y instanceof THREE.MeshDepthMaterial)){y=y&&y.shading!=void 0&&y.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}y=!1}a:{r=t=void 0;F=p.length;
-for(t=0;t<F;t++)if(r=p[t],r.vertexColors){r=r.vertexColors;break a}r=!1}j.__vertexArray=new Float32Array(n*3);if(y)j.__normalArray=new Float32Array(n*3);if(u.hasTangents)j.__tangentArray=new Float32Array(n*4);if(r)j.__colorArray=new Float32Array(n*3);if(q){if(u.faceUvs.length>0||u.faceVertexUvs.length>0)j.__uvArray=new Float32Array(n*2);if(u.faceUvs.length>1||u.faceVertexUvs.length>1)j.__uv2Array=new Float32Array(n*2)}if(k.geometry.skinWeights.length&&k.geometry.skinIndices.length)j.__skinVertexAArray=
-new Float32Array(n*4),j.__skinVertexBArray=new Float32Array(n*4),j.__skinIndexArray=new Float32Array(n*4),j.__skinWeightArray=new Float32Array(n*4);j.__faceArray=new Uint16Array(v*3+(k.geometry.edgeFaces?k.geometry.edgeFaces.length*6:0));j.__lineArray=new Uint16Array(A*2);if(j.numMorphTargets){j.__morphTargetsArrays=[];u=0;for(t=j.numMorphTargets;u<t;u++)j.__morphTargetsArrays.push(new Float32Array(n*3))}j.__needsSmoothNormals=y==THREE.SmoothShading;j.__uvType=q;j.__vertexColorType=r;j.__normalType=
-y;j.__webglFaceCount=v*3+(k.geometry.edgeFaces?k.geometry.edgeFaces.length*6:0);j.__webglLineCount=A*2;u=0;for(t=p.length;u<t;u++)if(q=p[u],q.attributes){if(j.__webglCustomAttributes===void 0)j.__webglCustomAttributes={};for(a in q.attributes){r=q.attributes[a];y={};for(m in r)y[m]=r[m];if(!y.__webglInitialized||y.createUniqueBuffers)y.__webglInitialized=!0,v=1,y.type==="v2"?v=2:y.type==="v3"?v=3:y.type==="v4"?v=4:y.type==="c"&&(v=3),y.size=v,y.array=new Float32Array(n*v),y.buffer=f.createBuffer(),
-y.buffer.belongsToAttribute=a,r.needsUpdate=!0,y.__original=r;j.__webglCustomAttributes[a]=y}}j.__inittedArrays=!0;i.__dirtyVertices=!0;i.__dirtyMorphTargets=!0;i.__dirtyElements=!0;i.__dirtyUvs=!0;i.__dirtyNormals=!0;i.__dirtyTangents=!0;i.__dirtyColors=!0}}else if(d instanceof THREE.Ribbon){if(i=d.geometry,!i.__webglVertexBuffer)j=i,j.__webglVertexBuffer=f.createBuffer(),j.__webglColorBuffer=f.createBuffer(),M.info.memory.geometries++,j=i,k=j.vertices.length,j.__vertexArray=new Float32Array(k*3),
-j.__colorArray=new Float32Array(k*3),j.__webglVertexCount=k,i.__dirtyVertices=!0,i.__dirtyColors=!0}else if(d instanceof THREE.Line){if(i=d.geometry,!i.__webglVertexBuffer)j=i,j.__webglVertexBuffer=f.createBuffer(),j.__webglColorBuffer=f.createBuffer(),M.info.memory.geometries++,j=i,k=j.vertices.length,j.__vertexArray=new Float32Array(k*3),j.__colorArray=new Float32Array(k*3),j.__webglLineCount=k,i.__dirtyVertices=!0,i.__dirtyColors=!0}else if(d instanceof THREE.ParticleSystem&&(i=d.geometry,!i.__webglVertexBuffer)){j=
-i;j.__webglVertexBuffer=f.createBuffer();j.__webglColorBuffer=f.createBuffer();M.info.geometries++;j=i;k=d;n=j.vertices.length;j.__vertexArray=new Float32Array(n*3);j.__colorArray=new Float32Array(n*3);j.__sortArray=[];j.__webglParticleCount=n;j.__materials=k.materials;A=v=m=void 0;m=0;for(v=k.materials.length;m<v;m++)if(A=k.materials[m],A.attributes){if(j.__webglCustomAttributes===void 0)j.__webglCustomAttributes={};for(a in A.attributes){originalAttribute=A.attributes[a];attribute={};for(property in originalAttribute)attribute[property]=
-originalAttribute[property];if(!attribute.__webglInitialized||attribute.createUniqueBuffers)attribute.__webglInitialized=!0,size=1,attribute.type==="v2"?size=2:attribute.type==="v3"?size=3:attribute.type==="v4"?size=4:attribute.type==="c"&&(size=3),attribute.size=size,attribute.array=new Float32Array(n*size),attribute.buffer=f.createBuffer(),attribute.buffer.belongsToAttribute=a,originalAttribute.needsUpdate=!0,attribute.__original=originalAttribute;j.__webglCustomAttributes[a]=attribute}}i.__dirtyVertices=
-!0;i.__dirtyColors=!0}if(!d.__webglActive){if(d instanceof THREE.Mesh)for(h in i=d.geometry,i.geometryGroups)j=i.geometryGroups[h],ha(e.__webglObjects,j,d);else d instanceof THREE.Ribbon||d instanceof THREE.Line||d instanceof THREE.ParticleSystem?(i=d.geometry,ha(e.__webglObjects,i,d)):THREE.MarchingCubes!==void 0&&d instanceof THREE.MarchingCubes||d.immediateRenderCallback?e.__webglObjectsImmediate.push({object:d,opaque:{list:[],count:0},transparent:{list:[],count:0}}):d instanceof THREE.Sprite&&
-e.__webglSprites.push(d);d.__webglActive=!0}b.__objectsAdded.splice(0,1)}for(;b.__objectsRemoved.length;){d=b.__objectsRemoved[0];e=b;if(d instanceof THREE.Mesh||d instanceof THREE.ParticleSystem||d instanceof THREE.Ribbon||d instanceof THREE.Line)ja(e.__webglObjects,d);else if(d instanceof THREE.Sprite){e=e.__webglSprites;h=d;i=void 0;for(i=e.length-1;i>=0;i--)e[i]==h&&e.splice(i,1)}else(d instanceof THREE.MarchingCubes||d.immediateRenderCallback)&&ja(e.__webglObjectsImmediate,d);d.__webglActive=
-!1;b.__objectsRemoved.splice(0,1)}d=0;for(e=b.__webglObjects.length;d<e;d++)if(i=b.__webglObjects[d].object,m=j=h=void 0,i instanceof THREE.Mesh){h=i.geometry;k=0;for(n=h.geometryGroupsList.length;k<n;k++)if(j=h.geometryGroupsList[k],m=xa(j),h.__dirtyVertices||h.__dirtyMorphTargets||h.__dirtyElements||h.__dirtyUvs||h.__dirtyNormals||h.__dirtyColors||h.__dirtyTangents||m)if(m=j,v=f.DYNAMIC_DRAW,A=!h.dynamic,m.__inittedArrays){var D=p=u=void 0,z=void 0,J=D=void 0,G=void 0,P=void 0,K=void 0,N=H=F=r=
-y=t=q=void 0,O=void 0,L=void 0,s=z=K=z=P=G=void 0,o=void 0,B=o=s=G=void 0,Q=void 0,U=B=o=s=D=D=J=K=z=B=o=s=Q=B=o=s=Q=B=o=s=void 0,ka=0,oa=0,$=0,aa=0,V=0,R=0,Y=0,T=0,ma=0,w=0,pa=0,B=s=0,B=void 0,qa=m.__vertexArray,la=m.__uvArray,na=m.__uv2Array,W=m.__normalArray,ca=m.__tangentArray,ra=m.__colorArray,da=m.__skinVertexAArray,ea=m.__skinVertexBArray,fa=m.__skinIndexArray,ga=m.__skinWeightArray,sa=m.__morphTargetsArrays,Z=m.__webglCustomAttributes,o=void 0,ia=m.__faceArray,X=m.__lineArray,wa=m.__needsSmoothNormals,
-t=m.__vertexColorType,q=m.__uvType,y=m.__normalType,ua=i.geometry,za=ua.__dirtyVertices,Aa=ua.__dirtyElements,va=ua.__dirtyUvs,Ca=ua.__dirtyNormals,Da=ua.__dirtyTangents,Ea=ua.__dirtyColors,Fa=ua.__dirtyMorphTargets,Ba=ua.vertices,Ha=m.faces,Ma=ua.faces,Ja=ua.faceVertexUvs[0],Ka=ua.faceVertexUvs[1],Na=ua.skinVerticesA,Oa=ua.skinVerticesB,Pa=ua.skinIndices,La=ua.skinWeights,Ga=ua.morphTargets;if(Z)for(U in Z)Z[U].offset=0,Z[U].offsetSrc=0;u=0;for(p=Ha.length;u<p;u++)if(D=Ha[u],z=Ma[D],Ja&&(r=Ja[D]),
-Ka&&(F=Ka[D]),D=z.vertexNormals,J=z.normal,G=z.vertexColors,P=z.color,K=z.vertexTangents,z instanceof THREE.Face3){if(za)H=Ba[z.a].position,N=Ba[z.b].position,O=Ba[z.c].position,qa[oa]=H.x,qa[oa+1]=H.y,qa[oa+2]=H.z,qa[oa+3]=N.x,qa[oa+4]=N.y,qa[oa+5]=N.z,qa[oa+6]=O.x,qa[oa+7]=O.y,qa[oa+8]=O.z,oa+=9;if(Z)for(U in Z)if(o=Z[U],o.__original.needsUpdate)s=o.offset,B=o.offsetSrc,o.size===1?(o.boundTo===void 0||o.boundTo==="vertices"?(o.array[s]=o.value[z.a],o.array[s+1]=o.value[z.b],o.array[s+2]=o.value[z.c]):
-o.boundTo==="faces"?(B=o.value[B],o.array[s]=B,o.array[s+1]=B,o.array[s+2]=B,o.offsetSrc++):o.boundTo==="faceVertices"&&(o.array[s]=o.value[B],o.array[s+1]=o.value[B+1],o.array[s+2]=o.value[B+2],o.offsetSrc+=3),o.offset+=3):(o.boundTo===void 0||o.boundTo==="vertices"?(H=o.value[z.a],N=o.value[z.b],O=o.value[z.c]):o.boundTo==="faces"?(O=N=H=B=o.value[B],o.offsetSrc++):o.boundTo==="faceVertices"&&(H=o.value[B],N=o.value[B+1],O=o.value[B+2],o.offsetSrc+=3),o.size===2?(o.array[s]=H.x,o.array[s+1]=H.y,
-o.array[s+2]=N.x,o.array[s+3]=N.y,o.array[s+4]=O.x,o.array[s+5]=O.y,o.offset+=6):o.size===3?(o.type==="c"?(o.array[s]=H.r,o.array[s+1]=H.g,o.array[s+2]=H.b,o.array[s+3]=N.r,o.array[s+4]=N.g,o.array[s+5]=N.b,o.array[s+6]=O.r,o.array[s+7]=O.g,o.array[s+8]=O.b):(o.array[s]=H.x,o.array[s+1]=H.y,o.array[s+2]=H.z,o.array[s+3]=N.x,o.array[s+4]=N.y,o.array[s+5]=N.z,o.array[s+6]=O.x,o.array[s+7]=O.y,o.array[s+8]=O.z),o.offset+=9):(o.array[s]=H.x,o.array[s+1]=H.y,o.array[s+2]=H.z,o.array[s+3]=H.w,o.array[s+
-4]=N.x,o.array[s+5]=N.y,o.array[s+6]=N.z,o.array[s+7]=N.w,o.array[s+8]=O.x,o.array[s+9]=O.y,o.array[s+10]=O.z,o.array[s+11]=O.w,o.offset+=12));if(Fa){s=0;for(o=Ga.length;s<o;s++)H=Ga[s].vertices[z.a].position,N=Ga[s].vertices[z.b].position,O=Ga[s].vertices[z.c].position,B=sa[s],B[pa]=H.x,B[pa+1]=H.y,B[pa+2]=H.z,B[pa+3]=N.x,B[pa+4]=N.y,B[pa+5]=N.z,B[pa+6]=O.x,B[pa+7]=O.y,B[pa+8]=O.z;pa+=9}if(La.length)s=La[z.a],o=La[z.b],B=La[z.c],ga[w]=s.x,ga[w+1]=s.y,ga[w+2]=s.z,ga[w+3]=s.w,ga[w+4]=o.x,ga[w+5]=o.y,
-ga[w+6]=o.z,ga[w+7]=o.w,ga[w+8]=B.x,ga[w+9]=B.y,ga[w+10]=B.z,ga[w+11]=B.w,s=Pa[z.a],o=Pa[z.b],B=Pa[z.c],fa[w]=s.x,fa[w+1]=s.y,fa[w+2]=s.z,fa[w+3]=s.w,fa[w+4]=o.x,fa[w+5]=o.y,fa[w+6]=o.z,fa[w+7]=o.w,fa[w+8]=B.x,fa[w+9]=B.y,fa[w+10]=B.z,fa[w+11]=B.w,s=Na[z.a],o=Na[z.b],B=Na[z.c],da[w]=s.x,da[w+1]=s.y,da[w+2]=s.z,da[w+3]=1,da[w+4]=o.x,da[w+5]=o.y,da[w+6]=o.z,da[w+7]=1,da[w+8]=B.x,da[w+9]=B.y,da[w+10]=B.z,da[w+11]=1,s=Oa[z.a],o=Oa[z.b],B=Oa[z.c],ea[w]=s.x,ea[w+1]=s.y,ea[w+2]=s.z,ea[w+3]=1,ea[w+4]=o.x,
-ea[w+5]=o.y,ea[w+6]=o.z,ea[w+7]=1,ea[w+8]=B.x,ea[w+9]=B.y,ea[w+10]=B.z,ea[w+11]=1,w+=12;if(Ea&&t)G.length==3&&t==THREE.VertexColors?(z=G[0],s=G[1],o=G[2]):o=s=z=P,ra[ma]=z.r,ra[ma+1]=z.g,ra[ma+2]=z.b,ra[ma+3]=s.r,ra[ma+4]=s.g,ra[ma+5]=s.b,ra[ma+6]=o.r,ra[ma+7]=o.g,ra[ma+8]=o.b,ma+=9;if(Da&&ua.hasTangents)G=K[0],P=K[1],z=K[2],ca[Y]=G.x,ca[Y+1]=G.y,ca[Y+2]=G.z,ca[Y+3]=G.w,ca[Y+4]=P.x,ca[Y+5]=P.y,ca[Y+6]=P.z,ca[Y+7]=P.w,ca[Y+8]=z.x,ca[Y+9]=z.y,ca[Y+10]=z.z,ca[Y+11]=z.w,Y+=12;if(Ca&&y)if(D.length==3&&
-wa)for(K=0;K<3;K++)J=D[K],W[R]=J.x,W[R+1]=J.y,W[R+2]=J.z,R+=3;else for(K=0;K<3;K++)W[R]=J.x,W[R+1]=J.y,W[R+2]=J.z,R+=3;if(va&&r!==void 0&&q)for(K=0;K<3;K++)D=r[K],la[$]=D.u,la[$+1]=D.v,$+=2;if(va&&F!==void 0&&q)for(K=0;K<3;K++)D=F[K],na[aa]=D.u,na[aa+1]=D.v,aa+=2;Aa&&(ia[V]=ka,ia[V+1]=ka+1,ia[V+2]=ka+2,V+=3,X[T]=ka,X[T+1]=ka+1,X[T+2]=ka,X[T+3]=ka+2,X[T+4]=ka+1,X[T+5]=ka+2,T+=6,ka+=3)}else if(z instanceof THREE.Face4){if(za)H=Ba[z.a].position,N=Ba[z.b].position,O=Ba[z.c].position,L=Ba[z.d].position,
-qa[oa]=H.x,qa[oa+1]=H.y,qa[oa+2]=H.z,qa[oa+3]=N.x,qa[oa+4]=N.y,qa[oa+5]=N.z,qa[oa+6]=O.x,qa[oa+7]=O.y,qa[oa+8]=O.z,qa[oa+9]=L.x,qa[oa+10]=L.y,qa[oa+11]=L.z,oa+=12;if(Z)for(U in Z)if(o=Z[U],o.__original.needsUpdate)s=o.offset,B=o.offsetSrc,o.size===1?(o.boundTo===void 0||o.boundTo==="vertices"?(o.array[s]=o.value[z.a],o.array[s+1]=o.value[z.b],o.array[s+2]=o.value[z.c],o.array[s+3]=o.value[z.d]):o.boundTo==="faces"?(B=o.value[B],o.array[s]=B,o.array[s+1]=B,o.array[s+2]=B,o.array[s+3]=B,o.offsetSrc++):
-o.boundTo==="faceVertices"&&(o.array[s]=o.value[B],o.array[s+1]=o.value[B+1],o.array[s+2]=o.value[B+2],o.array[s+3]=o.value[B+3],o.offsetSrc+=4),o.offset+=4):(o.boundTo===void 0||o.boundTo==="vertices"?(H=o.value[z.a],N=o.value[z.b],O=o.value[z.c],L=o.value[z.d]):o.boundTo==="faces"?(L=O=N=H=B=o.value[B],o.offsetSrc++):o.boundTo==="faceVertices"&&(H=o.value[B],N=o.value[B+1],O=o.value[B+2],L=o.value[B+3],o.offsetSrc+=4),o.size===2?(o.array[s]=H.x,o.array[s+1]=H.y,o.array[s+2]=N.x,o.array[s+3]=N.y,
-o.array[s+4]=O.x,o.array[s+5]=O.y,o.array[s+6]=L.x,o.array[s+7]=L.y,o.offset+=8):o.size===3?(o.type==="c"?(o.array[s]=H.r,o.array[s+1]=H.g,o.array[s+2]=H.b,o.array[s+3]=N.r,o.array[s+4]=N.g,o.array[s+5]=N.b,o.array[s+6]=O.r,o.array[s+7]=O.g,o.array[s+8]=O.b,o.array[s+9]=L.r,o.array[s+10]=L.g,o.array[s+11]=L.b):(o.array[s]=H.x,o.array[s+1]=H.y,o.array[s+2]=H.z,o.array[s+3]=N.x,o.array[s+4]=N.y,o.array[s+5]=N.z,o.array[s+6]=O.x,o.array[s+7]=O.y,o.array[s+8]=O.z,o.array[s+9]=L.x,o.array[s+10]=L.y,o.array[s+
-11]=L.z),o.offset+=12):(o.array[s]=H.x,o.array[s+1]=H.y,o.array[s+2]=H.z,o.array[s+3]=H.w,o.array[s+4]=N.x,o.array[s+5]=N.y,o.array[s+6]=N.z,o.array[s+7]=N.w,o.array[s+8]=O.x,o.array[s+9]=O.y,o.array[s+10]=O.z,o.array[s+11]=O.w,o.array[s+12]=L.x,o.array[s+13]=L.y,o.array[s+14]=L.z,o.array[s+15]=L.w,o.offset+=16));if(Fa){s=0;for(o=Ga.length;s<o;s++)H=Ga[s].vertices[z.a].position,N=Ga[s].vertices[z.b].position,O=Ga[s].vertices[z.c].position,L=Ga[s].vertices[z.d].position,B=sa[s],B[pa]=H.x,B[pa+1]=H.y,
-B[pa+2]=H.z,B[pa+3]=N.x,B[pa+4]=N.y,B[pa+5]=N.z,B[pa+6]=O.x,B[pa+7]=O.y,B[pa+8]=O.z,B[pa+9]=L.x,B[pa+10]=L.y,B[pa+11]=L.z;pa+=12}if(La.length)s=La[z.a],o=La[z.b],B=La[z.c],Q=La[z.d],ga[w]=s.x,ga[w+1]=s.y,ga[w+2]=s.z,ga[w+3]=s.w,ga[w+4]=o.x,ga[w+5]=o.y,ga[w+6]=o.z,ga[w+7]=o.w,ga[w+8]=B.x,ga[w+9]=B.y,ga[w+10]=B.z,ga[w+11]=B.w,ga[w+12]=Q.x,ga[w+13]=Q.y,ga[w+14]=Q.z,ga[w+15]=Q.w,s=Pa[z.a],o=Pa[z.b],B=Pa[z.c],Q=Pa[z.d],fa[w]=s.x,fa[w+1]=s.y,fa[w+2]=s.z,fa[w+3]=s.w,fa[w+4]=o.x,fa[w+5]=o.y,fa[w+6]=o.z,fa[w+
-7]=o.w,fa[w+8]=B.x,fa[w+9]=B.y,fa[w+10]=B.z,fa[w+11]=B.w,fa[w+12]=Q.x,fa[w+13]=Q.y,fa[w+14]=Q.z,fa[w+15]=Q.w,s=Na[z.a],o=Na[z.b],B=Na[z.c],Q=Na[z.d],da[w]=s.x,da[w+1]=s.y,da[w+2]=s.z,da[w+3]=1,da[w+4]=o.x,da[w+5]=o.y,da[w+6]=o.z,da[w+7]=1,da[w+8]=B.x,da[w+9]=B.y,da[w+10]=B.z,da[w+11]=1,da[w+12]=Q.x,da[w+13]=Q.y,da[w+14]=Q.z,da[w+15]=1,s=Oa[z.a],o=Oa[z.b],B=Oa[z.c],z=Oa[z.d],ea[w]=s.x,ea[w+1]=s.y,ea[w+2]=s.z,ea[w+3]=1,ea[w+4]=o.x,ea[w+5]=o.y,ea[w+6]=o.z,ea[w+7]=1,ea[w+8]=B.x,ea[w+9]=B.y,ea[w+10]=B.z,
-ea[w+11]=1,ea[w+12]=z.x,ea[w+13]=z.y,ea[w+14]=z.z,ea[w+15]=1,w+=16;if(Ea&&t)G.length==4&&t==THREE.VertexColors?(z=G[0],s=G[1],o=G[2],G=G[3]):G=o=s=z=P,ra[ma]=z.r,ra[ma+1]=z.g,ra[ma+2]=z.b,ra[ma+3]=s.r,ra[ma+4]=s.g,ra[ma+5]=s.b,ra[ma+6]=o.r,ra[ma+7]=o.g,ra[ma+8]=o.b,ra[ma+9]=G.r,ra[ma+10]=G.g,ra[ma+11]=G.b,ma+=12;if(Da&&ua.hasTangents)G=K[0],P=K[1],z=K[2],K=K[3],ca[Y]=G.x,ca[Y+1]=G.y,ca[Y+2]=G.z,ca[Y+3]=G.w,ca[Y+4]=P.x,ca[Y+5]=P.y,ca[Y+6]=P.z,ca[Y+7]=P.w,ca[Y+8]=z.x,ca[Y+9]=z.y,ca[Y+10]=z.z,ca[Y+11]=
-z.w,ca[Y+12]=K.x,ca[Y+13]=K.y,ca[Y+14]=K.z,ca[Y+15]=K.w,Y+=16;if(Ca&&y)if(D.length==4&&wa)for(K=0;K<4;K++)J=D[K],W[R]=J.x,W[R+1]=J.y,W[R+2]=J.z,R+=3;else for(K=0;K<4;K++)W[R]=J.x,W[R+1]=J.y,W[R+2]=J.z,R+=3;if(va&&r!==void 0&&q)for(K=0;K<4;K++)D=r[K],la[$]=D.u,la[$+1]=D.v,$+=2;if(va&&F!==void 0&&q)for(K=0;K<4;K++)D=F[K],na[aa]=D.u,na[aa+1]=D.v,aa+=2;Aa&&(ia[V]=ka,ia[V+1]=ka+1,ia[V+2]=ka+3,ia[V+3]=ka+1,ia[V+4]=ka+2,ia[V+5]=ka+3,V+=6,X[T]=ka,X[T+1]=ka+1,X[T+2]=ka,X[T+3]=ka+3,X[T+4]=ka+1,X[T+5]=ka+2,
-X[T+6]=ka+2,X[T+7]=ka+3,T+=8,ka+=4)}za&&(f.bindBuffer(f.ARRAY_BUFFER,m.__webglVertexBuffer),f.bufferData(f.ARRAY_BUFFER,qa,v));if(Z)for(U in Z)o=Z[U],o.__original.needsUpdate&&(f.bindBuffer(f.ARRAY_BUFFER,o.buffer),f.bufferData(f.ARRAY_BUFFER,o.array,v));if(Fa){s=0;for(o=Ga.length;s<o;s++)f.bindBuffer(f.ARRAY_BUFFER,m.__webglMorphTargetsBuffers[s]),f.bufferData(f.ARRAY_BUFFER,sa[s],v)}Ea&&ma>0&&(f.bindBuffer(f.ARRAY_BUFFER,m.__webglColorBuffer),f.bufferData(f.ARRAY_BUFFER,ra,v));Ca&&(f.bindBuffer(f.ARRAY_BUFFER,
-m.__webglNormalBuffer),f.bufferData(f.ARRAY_BUFFER,W,v));Da&&ua.hasTangents&&(f.bindBuffer(f.ARRAY_BUFFER,m.__webglTangentBuffer),f.bufferData(f.ARRAY_BUFFER,ca,v));va&&$>0&&(f.bindBuffer(f.ARRAY_BUFFER,m.__webglUVBuffer),f.bufferData(f.ARRAY_BUFFER,la,v));va&&aa>0&&(f.bindBuffer(f.ARRAY_BUFFER,m.__webglUV2Buffer),f.bufferData(f.ARRAY_BUFFER,na,v));Aa&&(f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,m.__webglFaceBuffer),f.bufferData(f.ELEMENT_ARRAY_BUFFER,ia,v),f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,m.__webglLineBuffer),
-f.bufferData(f.ELEMENT_ARRAY_BUFFER,X,v));w>0&&(f.bindBuffer(f.ARRAY_BUFFER,m.__webglSkinVertexABuffer),f.bufferData(f.ARRAY_BUFFER,da,v),f.bindBuffer(f.ARRAY_BUFFER,m.__webglSkinVertexBBuffer),f.bufferData(f.ARRAY_BUFFER,ea,v),f.bindBuffer(f.ARRAY_BUFFER,m.__webglSkinIndicesBuffer),f.bufferData(f.ARRAY_BUFFER,fa,v),f.bindBuffer(f.ARRAY_BUFFER,m.__webglSkinWeightsBuffer),f.bufferData(f.ARRAY_BUFFER,ga,v));A&&(delete m.__inittedArrays,delete m.__colorArray,delete m.__normalArray,delete m.__tangentArray,
-delete m.__uvArray,delete m.__uv2Array,delete m.__faceArray,delete m.__vertexArray,delete m.__lineArray,delete m.__skinVertexAArray,delete m.__skinVertexBArray,delete m.__skinIndexArray,delete m.__skinWeightArray)}h.__dirtyVertices=!1;h.__dirtyMorphTargets=!1;h.__dirtyElements=!1;h.__dirtyUvs=!1;h.__dirtyNormals=!1;h.__dirtyTangents=!1;h.__dirtyColors=!1;ya(j)}else if(i instanceof THREE.Ribbon){h=i.geometry;if(h.__dirtyVertices||h.__dirtyColors){i=h;j=f.DYNAMIC_DRAW;k=u=A=A=void 0;p=i.vertices;n=
-i.colors;q=p.length;m=n.length;t=i.__vertexArray;v=i.__colorArray;y=i.__dirtyColors;if(i.__dirtyVertices){for(A=0;A<q;A++)u=p[A].position,k=A*3,t[k]=u.x,t[k+1]=u.y,t[k+2]=u.z;f.bindBuffer(f.ARRAY_BUFFER,i.__webglVertexBuffer);f.bufferData(f.ARRAY_BUFFER,t,j)}if(y){for(A=0;A<m;A++)color=n[A],k=A*3,v[k]=color.r,v[k+1]=color.g,v[k+2]=color.b;f.bindBuffer(f.ARRAY_BUFFER,i.__webglColorBuffer);f.bufferData(f.ARRAY_BUFFER,v,j)}}h.__dirtyVertices=!1;h.__dirtyColors=!1}else if(i instanceof THREE.Line){h=i.geometry;
-if(h.__dirtyVertices||h.__dirtyColors){i=h;j=f.DYNAMIC_DRAW;k=u=A=A=void 0;p=i.vertices;n=i.colors;q=p.length;m=n.length;t=i.__vertexArray;v=i.__colorArray;y=i.__dirtyColors;if(i.__dirtyVertices){for(A=0;A<q;A++)u=p[A].position,k=A*3,t[k]=u.x,t[k+1]=u.y,t[k+2]=u.z;f.bindBuffer(f.ARRAY_BUFFER,i.__webglVertexBuffer);f.bufferData(f.ARRAY_BUFFER,t,j)}if(y){for(A=0;A<m;A++)color=n[A],k=A*3,v[k]=color.r,v[k+1]=color.g,v[k+2]=color.b;f.bindBuffer(f.ARRAY_BUFFER,i.__webglColorBuffer);f.bufferData(f.ARRAY_BUFFER,
-v,j)}}h.__dirtyVertices=!1;h.__dirtyColors=!1}else if(i instanceof THREE.ParticleSystem)h=i.geometry,m=xa(h),(h.__dirtyVertices||h.__dirtyColors||i.sortParticles||m)&&c(h,f.DYNAMIC_DRAW,i),h.__dirtyVertices=!1,h.__dirtyColors=!1,ya(h)};this.setFaceCulling=function(b,c){b?(!c||c=="ccw"?f.frontFace(f.CCW):f.frontFace(f.CW),b=="back"?f.cullFace(f.BACK):b=="front"?f.cullFace(f.FRONT):f.cullFace(f.FRONT_AND_BACK),f.enable(f.CULL_FACE)):f.disable(f.CULL_FACE)};this.supportsVertexTextures=function(){return eb}};
-THREE.WebGLRenderTarget=function(b,c,e){this.width=b;this.height=c;e=e||{};this.wrapS=e.wrapS!==void 0?e.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=e.wrapT!==void 0?e.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=e.magFilter!==void 0?e.magFilter:THREE.LinearFilter;this.minFilter=e.minFilter!==void 0?e.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=e.format!==void 0?e.format:THREE.RGBAFormat;this.type=e.type!==void 0?e.type:
-THREE.UnsignedByteType;this.depthBuffer=e.depthBuffer!==void 0?e.depthBuffer:!0;this.stencilBuffer=e.stencilBuffer!==void 0?e.stencilBuffer:!0};
-THREE.WebGLRenderTarget.prototype.clone=function(){var b=new THREE.WebGLRenderTarget(this.width,this.height);b.wrapS=this.wrapS;b.wrapT=this.wrapT;b.magFilter=this.magFilter;b.minFilter=this.minFilter;b.offset.copy(this.offset);b.repeat.copy(this.repeat);b.format=this.format;b.type=this.type;b.depthBuffer=this.depthBuffer;b.stencilBuffer=this.stencilBuffer;return b};THREE.WebGLRenderTargetCube=function(b,c,e){THREE.WebGLRenderTarget.call(this,b,c,e);this.activeCubeFace=0};
+d.shadowMapSoft?"#define SHADOWMAP_SOFT":"",d.shadowMapSoft?"#define SHADOWMAP_WIDTH "+d.shadowMapWidth.toFixed(1):"",d.shadowMapSoft?"#define SHADOWMAP_HEIGHT "+d.shadowMapHeight.toFixed(1):"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");f.attachShader(v,Z("fragment",j+n));f.attachShader(v,Z("vertex",e+o));f.linkProgram(v);f.getProgramParameter(v,f.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+f.getProgramParameter(v,f.VALIDATE_STATUS)+", gl error ["+
+f.getError()+"]");v.uniforms={};v.attributes={};var u,e=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(u in r)e.push(u);u=e;e=0;for(r=u.length;e<r;e++)n=u[e],v.uniforms[n]=f.getUniformLocation(v,n);e=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(u=0;u<d.maxMorphTargets;u++)e.push("morphTarget"+u);for(q in c)e.push(q);
+q=e;u=0;for(c=q.length;u<c;u++)d=q[u],v.attributes[d]=f.getAttribLocation(v,d);v.id=S.length;S.push({program:v,code:k});F.info.memory.programs=S.length;q=v}b.program=q;q=b.program.attributes;q.position>=0&&f.enableVertexAttribArray(q.position);q.color>=0&&f.enableVertexAttribArray(q.color);q.normal>=0&&f.enableVertexAttribArray(q.normal);q.tangent>=0&&f.enableVertexAttribArray(q.tangent);b.skinning&&q.skinVertexA>=0&&q.skinVertexB>=0&&q.skinIndex>=0&&q.skinWeight>=0&&(f.enableVertexAttribArray(q.skinVertexA),
+f.enableVertexAttribArray(q.skinVertexB),f.enableVertexAttribArray(q.skinIndex),f.enableVertexAttribArray(q.skinWeight));if(b.attributes)for(i in b.attributes)q[i]!==void 0&&q[i]>=0&&f.enableVertexAttribArray(q[i]);if(b.morphTargets)for(i=b.numSupportedMorphTargets=0;i<this.maxMorphTargets;i++)u="morphTarget"+i,q[u]>=0&&(f.enableVertexAttribArray(q[u]),b.numSupportedMorphTargets++);b.uniformsList=[];for(h in b.uniforms)b.uniformsList.push([b.uniforms[h],h])};this.clearTarget=function(b,c,d,f){aa(b);
+this.clear(c,d,f)};this.render=function(b,c,n,u){var G,Ga,B,T,r,x,C,I,Ra=b.lights,K=b.fog;J=-1;this.shadowMapEnabled&&D(b,c);F.info.render.calls=0;F.info.render.vertices=0;F.info.render.faces=0;if(c.matrixAutoUpdate){for(r=c;r.parent;)r=r.parent;r.update(void 0,!0)}b.update(void 0,!1,c);THREE.Matrix4.makeInvert(c.matrixWorld,c.matrixWorldInverse);c.matrixWorldInverse.flattenToArray(Ua);c.projectionMatrix.flattenToArray(Ta);Ba.multiply(c.projectionMatrix,c.matrixWorldInverse);p(Ba);this.initWebGLObjects(b);
+aa(n);(this.autoClear||u)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);r=b.__webglObjects.length;for(u=0;u<r;u++)if(G=b.__webglObjects[u],C=G.object,C.visible)if(!(C instanceof THREE.Mesh)||!C.frustumCulled||o(C)){if(C.matrixWorld.flattenToArray(C._objectMatrixArray),H(C,c,!0),v(G),G.render=!0,this.sortObjects)G.object.renderDepth?G.z=G.object.renderDepth:(Ea.copy(C.position),Ba.multiplyVector3(Ea),G.z=Ea.z)}else G.render=!1;else G.render=!1;this.sortObjects&&b.__webglObjects.sort(y);
+x=b.__webglObjectsImmediate.length;for(u=0;u<x;u++)G=b.__webglObjectsImmediate[u],C=G.object,C.visible&&(C.matrixAutoUpdate&&C.matrixWorld.flattenToArray(C._objectMatrixArray),H(C,c,!0),q(G));if(b.overrideMaterial){j(b.overrideMaterial.depthTest);N(b.overrideMaterial.blending);for(u=0;u<r;u++)if(G=b.__webglObjects[u],G.render)C=G.object,I=G.buffer,i(C),e(c,Ra,K,b.overrideMaterial,I,C);for(u=0;u<x;u++)G=b.__webglObjectsImmediate[u],C=G.object,C.visible&&(oa=-1,i(C),Ga=d(c,Ra,K,b.overrideMaterial,C),
+C.immediateRenderCallback?C.immediateRenderCallback(Ga,f,ta):C.render(function(c){h(c,Ga,b.overrideMaterial.shading)}))}else{N(THREE.NormalBlending);for(u=r-1;u>=0;u--)if(G=b.__webglObjects[u],G.render){C=G.object;I=G.buffer;B=G.opaque;i(C);for(G=0;G<B.count;G++)T=B.list[G],j(T.depthTest),k(T.depthWrite),s(T.polygonOffset,T.polygonOffsetFactor,T.polygonOffsetUnits),e(c,Ra,K,T,I,C)}for(u=0;u<x;u++)if(G=b.__webglObjectsImmediate[u],C=G.object,C.visible){oa=-1;B=G.opaque;i(C);for(G=0;G<B.count;G++)T=
+B.list[G],j(T.depthTest),k(T.depthWrite),s(T.polygonOffset,T.polygonOffsetFactor,T.polygonOffsetUnits),Ga=d(c,Ra,K,T,C),C.immediateRenderCallback?C.immediateRenderCallback(Ga,f,ta):C.render(function(b){h(b,Ga,T.shading)})}for(u=0;u<r;u++)if(G=b.__webglObjects[u],G.render){C=G.object;I=G.buffer;B=G.transparent;i(C);for(G=0;G<B.count;G++)T=B.list[G],N(T.blending),j(T.depthTest),k(T.depthWrite),s(T.polygonOffset,T.polygonOffsetFactor,T.polygonOffsetUnits),e(c,Ra,K,T,I,C)}for(u=0;u<x;u++)if(G=b.__webglObjectsImmediate[u],
+C=G.object,C.visible){oa=-1;B=G.transparent;i(C);for(G=0;G<B.count;G++)T=B.list[G],N(T.blending),j(T.depthTest),k(T.depthWrite),s(T.polygonOffset,T.polygonOffsetFactor,T.polygonOffsetUnits),Ga=d(c,Ra,K,T,C),C.immediateRenderCallback?C.immediateRenderCallback(Ga,f,ta):C.render(function(b){h(b,Ga,T.shading)})}}b.__webglSprites.length&&E(b,c);n&&n.minFilter!==THREE.NearestFilter&&n.minFilter!==THREE.LinearFilter&&la(n)};this.initWebGLObjects=function(b){if(!b.__webglObjects)b.__webglObjects=[],b.__webglObjectsImmediate=
+[],b.__webglSprites=[];for(;b.__objectsAdded.length;){var d=b.__objectsAdded[0],e=b,h=void 0,i=void 0,j=void 0;if(!d.__webglInit)if(d.__webglInit=!0,d._modelViewMatrix=new THREE.Matrix4,d._normalMatrixArray=new Float32Array(9),d._modelViewMatrixArray=new Float32Array(16),d._objectMatrixArray=new Float32Array(16),d.matrixWorld.flattenToArray(d._objectMatrixArray),d instanceof THREE.Mesh)for(h in i=d.geometry,i.geometryGroups==void 0&&ka(i),i.geometryGroups){if(j=i.geometryGroups[h],!j.__webglVertexBuffer){var k=
+j;k.__webglVertexBuffer=f.createBuffer();k.__webglNormalBuffer=f.createBuffer();k.__webglTangentBuffer=f.createBuffer();k.__webglColorBuffer=f.createBuffer();k.__webglUVBuffer=f.createBuffer();k.__webglUV2Buffer=f.createBuffer();k.__webglSkinVertexABuffer=f.createBuffer();k.__webglSkinVertexBBuffer=f.createBuffer();k.__webglSkinIndicesBuffer=f.createBuffer();k.__webglSkinWeightsBuffer=f.createBuffer();k.__webglFaceBuffer=f.createBuffer();k.__webglLineBuffer=f.createBuffer();if(k.numMorphTargets){var n=
+void 0,r=void 0;k.__webglMorphTargetsBuffers=[];n=0;for(r=k.numMorphTargets;n<r;n++)k.__webglMorphTargetsBuffers.push(f.createBuffer())}F.info.memory.geometries++;for(var k=d,o=void 0,p=void 0,q=void 0,s=q=void 0,u=void 0,v=void 0,y=v=n=0,x=q=p=void 0,q=r=x=p=o=void 0,s=k.geometry,u=s.faces,x=j.faces,o=0,p=x.length;o<p;o++)q=x[o],q=u[q],q instanceof THREE.Face3?(n+=3,v+=1,y+=3):q instanceof THREE.Face4&&(n+=4,v+=2,y+=4);for(var o=j,p=k,D=x=u=void 0,L=void 0,D=void 0,q=[],u=0,x=p.materials.length;u<
+x;u++)if(D=p.materials[u],D instanceof THREE.MeshFaceMaterial){D=0;for(l=o.materials.length;D<l;D++)(L=o.materials[D])&&q.push(L)}else(L=D)&&q.push(L);o=q;j.__materials=o;a:{u=p=void 0;x=o.length;for(p=0;p<x;p++)if(u=o[p],u.map||u.lightMap||u instanceof THREE.ShaderMaterial){p=!0;break a}p=!1}a:{x=u=void 0;q=o.length;for(u=0;u<q;u++)if(x=o[u],!(x instanceof THREE.MeshBasicMaterial&&!x.envMap||x instanceof THREE.MeshDepthMaterial)){x=x&&x.shading!=void 0&&x.shading==THREE.SmoothShading?THREE.SmoothShading:
+THREE.FlatShading;break a}x=!1}a:{q=u=void 0;D=o.length;for(u=0;u<D;u++)if(q=o[u],q.vertexColors){q=q.vertexColors;break a}q=!1}j.__vertexArray=new Float32Array(n*3);if(x)j.__normalArray=new Float32Array(n*3);if(s.hasTangents)j.__tangentArray=new Float32Array(n*4);if(q)j.__colorArray=new Float32Array(n*3);if(p){if(s.faceUvs.length>0||s.faceVertexUvs.length>0)j.__uvArray=new Float32Array(n*2);if(s.faceUvs.length>1||s.faceVertexUvs.length>1)j.__uv2Array=new Float32Array(n*2)}if(k.geometry.skinWeights.length&&
+k.geometry.skinIndices.length)j.__skinVertexAArray=new Float32Array(n*4),j.__skinVertexBArray=new Float32Array(n*4),j.__skinIndexArray=new Float32Array(n*4),j.__skinWeightArray=new Float32Array(n*4);j.__faceArray=new Uint16Array(v*3+(k.geometry.edgeFaces?k.geometry.edgeFaces.length*6:0));j.__lineArray=new Uint16Array(y*2);if(j.numMorphTargets){j.__morphTargetsArrays=[];s=0;for(u=j.numMorphTargets;s<u;s++)j.__morphTargetsArrays.push(new Float32Array(n*3))}j.__needsSmoothNormals=x==THREE.SmoothShading;
+j.__uvType=p;j.__vertexColorType=q;j.__normalType=x;j.__webglFaceCount=v*3+(k.geometry.edgeFaces?k.geometry.edgeFaces.length*6:0);j.__webglLineCount=y*2;s=0;for(u=o.length;s<u;s++)if(p=o[s],p.attributes){if(j.__webglCustomAttributes===void 0)j.__webglCustomAttributes={};for(a in p.attributes){q=p.attributes[a];x={};for(r in q)x[r]=q[r];if(!x.__webglInitialized||x.createUniqueBuffers)x.__webglInitialized=!0,v=1,x.type==="v2"?v=2:x.type==="v3"?v=3:x.type==="v4"?v=4:x.type==="c"&&(v=3),x.size=v,x.array=
+new Float32Array(n*v),x.buffer=f.createBuffer(),x.buffer.belongsToAttribute=a,q.needsUpdate=!0,x.__original=q;j.__webglCustomAttributes[a]=x}}j.__inittedArrays=!0;i.__dirtyVertices=!0;i.__dirtyMorphTargets=!0;i.__dirtyElements=!0;i.__dirtyUvs=!0;i.__dirtyNormals=!0;i.__dirtyTangents=!0;i.__dirtyColors=!0}}else if(d instanceof THREE.Ribbon){if(i=d.geometry,!i.__webglVertexBuffer)j=i,j.__webglVertexBuffer=f.createBuffer(),j.__webglColorBuffer=f.createBuffer(),F.info.memory.geometries++,j=i,k=j.vertices.length,
+j.__vertexArray=new Float32Array(k*3),j.__colorArray=new Float32Array(k*3),j.__webglVertexCount=k,i.__dirtyVertices=!0,i.__dirtyColors=!0}else if(d instanceof THREE.Line){if(i=d.geometry,!i.__webglVertexBuffer)j=i,j.__webglVertexBuffer=f.createBuffer(),j.__webglColorBuffer=f.createBuffer(),F.info.memory.geometries++,j=i,k=j.vertices.length,j.__vertexArray=new Float32Array(k*3),j.__colorArray=new Float32Array(k*3),j.__webglLineCount=k,i.__dirtyVertices=!0,i.__dirtyColors=!0}else if(d instanceof THREE.ParticleSystem&&
+(i=d.geometry,!i.__webglVertexBuffer)){j=i;j.__webglVertexBuffer=f.createBuffer();j.__webglColorBuffer=f.createBuffer();F.info.geometries++;j=i;k=d;n=j.vertices.length;j.__vertexArray=new Float32Array(n*3);j.__colorArray=new Float32Array(n*3);j.__sortArray=[];j.__webglParticleCount=n;j.__materials=k.materials;y=v=r=void 0;r=0;for(v=k.materials.length;r<v;r++)if(y=k.materials[r],y.attributes){if(j.__webglCustomAttributes===void 0)j.__webglCustomAttributes={};for(a in y.attributes){originalAttribute=
+y.attributes[a];attribute={};for(property in originalAttribute)attribute[property]=originalAttribute[property];if(!attribute.__webglInitialized||attribute.createUniqueBuffers)attribute.__webglInitialized=!0,size=1,attribute.type==="v2"?size=2:attribute.type==="v3"?size=3:attribute.type==="v4"?size=4:attribute.type==="c"&&(size=3),attribute.size=size,attribute.array=new Float32Array(n*size),attribute.buffer=f.createBuffer(),attribute.buffer.belongsToAttribute=a,originalAttribute.needsUpdate=!0,attribute.__original=
+originalAttribute;j.__webglCustomAttributes[a]=attribute}}i.__dirtyVertices=!0;i.__dirtyColors=!0}if(!d.__webglActive){if(d instanceof THREE.Mesh)for(h in i=d.geometry,i.geometryGroups)j=i.geometryGroups[h],sa(e.__webglObjects,j,d);else d instanceof THREE.Ribbon||d instanceof THREE.Line||d instanceof THREE.ParticleSystem?(i=d.geometry,sa(e.__webglObjects,i,d)):THREE.MarchingCubes!==void 0&&d instanceof THREE.MarchingCubes||d.immediateRenderCallback?e.__webglObjectsImmediate.push({object:d,opaque:{list:[],
+count:0},transparent:{list:[],count:0}}):d instanceof THREE.Sprite&&e.__webglSprites.push(d);d.__webglActive=!0}b.__objectsAdded.splice(0,1)}for(;b.__objectsRemoved.length;){d=b.__objectsRemoved[0];e=b;if(d instanceof THREE.Mesh||d instanceof THREE.ParticleSystem||d instanceof THREE.Ribbon||d instanceof THREE.Line)va(e.__webglObjects,d);else if(d instanceof THREE.Sprite){e=e.__webglSprites;h=d;i=void 0;for(i=e.length-1;i>=0;i--)e[i]==h&&e.splice(i,1)}else(d instanceof THREE.MarchingCubes||d.immediateRenderCallback)&&
+va(e.__webglObjectsImmediate,d);d.__webglActive=!1;b.__objectsRemoved.splice(0,1)}d=0;for(e=b.__webglObjects.length;d<e;d++)if(i=b.__webglObjects[d].object,r=j=h=void 0,i instanceof THREE.Mesh){h=i.geometry;k=0;for(n=h.geometryGroupsList.length;k<n;k++)if(j=h.geometryGroupsList[k],r=ia(j),h.__dirtyVertices||h.__dirtyMorphTargets||h.__dirtyElements||h.__dirtyUvs||h.__dirtyNormals||h.__dirtyColors||h.__dirtyTangents||r)if(r=j,v=f.DYNAMIC_DRAW,y=!h.dynamic,r.__inittedArrays){var E=o=s=void 0,z=void 0,
+J=E=void 0,H=void 0,R=void 0,M=void 0,P=L=D=q=x=u=p=void 0,Q=void 0,N=void 0,t=z=M=z=R=H=void 0,m=void 0,A=m=t=H=void 0,S=void 0,V=A=m=t=E=E=J=M=z=A=m=t=S=A=m=t=S=A=m=t=void 0,ja=0,O=0,Y=0,Z=0,X=0,U=0,$=0,W=0,ma=0,w=0,na=0,A=t=0,A=void 0,pa=r.__vertexArray,oa=r.__uvArray,ra=r.__uv2Array,aa=r.__normalArray,da=r.__tangentArray,qa=r.__colorArray,ea=r.__skinVertexAArray,fa=r.__skinVertexBArray,ga=r.__skinIndexArray,ha=r.__skinWeightArray,ta=r.__morphTargetsArrays,ca=r.__webglCustomAttributes,m=void 0,
+la=r.__faceArray,wa=r.__lineArray,za=r.__needsSmoothNormals,u=r.__vertexColorType,p=r.__uvType,x=r.__normalType,ua=i.geometry,ya=ua.__dirtyVertices,Aa=ua.__dirtyElements,xa=ua.__dirtyUvs,Ba=ua.__dirtyNormals,Ca=ua.__dirtyTangents,Da=ua.__dirtyColors,Ea=ua.__dirtyMorphTargets,Na=ua.vertices,Ha=r.faces,La=ua.faces,Ja=ua.faceVertexUvs[0],Ka=ua.faceVertexUvs[1],Oa=ua.skinVerticesA,Pa=ua.skinVerticesB,Qa=ua.skinIndices,Ia=ua.skinWeights,Fa=ua.morphTargets;if(ca)for(V in ca)ca[V].offset=0,ca[V].offsetSrc=
+0;s=0;for(o=Ha.length;s<o;s++)if(E=Ha[s],z=La[E],Ja&&(q=Ja[E]),Ka&&(D=Ka[E]),E=z.vertexNormals,J=z.normal,H=z.vertexColors,R=z.color,M=z.vertexTangents,z instanceof THREE.Face3){if(ya)L=Na[z.a].position,P=Na[z.b].position,Q=Na[z.c].position,pa[O]=L.x,pa[O+1]=L.y,pa[O+2]=L.z,pa[O+3]=P.x,pa[O+4]=P.y,pa[O+5]=P.z,pa[O+6]=Q.x,pa[O+7]=Q.y,pa[O+8]=Q.z,O+=9;if(ca)for(V in ca)if(m=ca[V],m.__original.needsUpdate)t=m.offset,A=m.offsetSrc,m.size===1?(m.boundTo===void 0||m.boundTo==="vertices"?(m.array[t]=m.value[z.a],
+m.array[t+1]=m.value[z.b],m.array[t+2]=m.value[z.c]):m.boundTo==="faces"?(A=m.value[A],m.array[t]=A,m.array[t+1]=A,m.array[t+2]=A,m.offsetSrc++):m.boundTo==="faceVertices"&&(m.array[t]=m.value[A],m.array[t+1]=m.value[A+1],m.array[t+2]=m.value[A+2],m.offsetSrc+=3),m.offset+=3):(m.boundTo===void 0||m.boundTo==="vertices"?(L=m.value[z.a],P=m.value[z.b],Q=m.value[z.c]):m.boundTo==="faces"?(Q=P=L=A=m.value[A],m.offsetSrc++):m.boundTo==="faceVertices"&&(L=m.value[A],P=m.value[A+1],Q=m.value[A+2],m.offsetSrc+=
+3),m.size===2?(m.array[t]=L.x,m.array[t+1]=L.y,m.array[t+2]=P.x,m.array[t+3]=P.y,m.array[t+4]=Q.x,m.array[t+5]=Q.y,m.offset+=6):m.size===3?(m.type==="c"?(m.array[t]=L.r,m.array[t+1]=L.g,m.array[t+2]=L.b,m.array[t+3]=P.r,m.array[t+4]=P.g,m.array[t+5]=P.b,m.array[t+6]=Q.r,m.array[t+7]=Q.g,m.array[t+8]=Q.b):(m.array[t]=L.x,m.array[t+1]=L.y,m.array[t+2]=L.z,m.array[t+3]=P.x,m.array[t+4]=P.y,m.array[t+5]=P.z,m.array[t+6]=Q.x,m.array[t+7]=Q.y,m.array[t+8]=Q.z),m.offset+=9):(m.array[t]=L.x,m.array[t+1]=
+L.y,m.array[t+2]=L.z,m.array[t+3]=L.w,m.array[t+4]=P.x,m.array[t+5]=P.y,m.array[t+6]=P.z,m.array[t+7]=P.w,m.array[t+8]=Q.x,m.array[t+9]=Q.y,m.array[t+10]=Q.z,m.array[t+11]=Q.w,m.offset+=12));if(Ea){t=0;for(m=Fa.length;t<m;t++)L=Fa[t].vertices[z.a].position,P=Fa[t].vertices[z.b].position,Q=Fa[t].vertices[z.c].position,A=ta[t],A[na]=L.x,A[na+1]=L.y,A[na+2]=L.z,A[na+3]=P.x,A[na+4]=P.y,A[na+5]=P.z,A[na+6]=Q.x,A[na+7]=Q.y,A[na+8]=Q.z;na+=9}if(Ia.length)t=Ia[z.a],m=Ia[z.b],A=Ia[z.c],ha[w]=t.x,ha[w+1]=t.y,
+ha[w+2]=t.z,ha[w+3]=t.w,ha[w+4]=m.x,ha[w+5]=m.y,ha[w+6]=m.z,ha[w+7]=m.w,ha[w+8]=A.x,ha[w+9]=A.y,ha[w+10]=A.z,ha[w+11]=A.w,t=Qa[z.a],m=Qa[z.b],A=Qa[z.c],ga[w]=t.x,ga[w+1]=t.y,ga[w+2]=t.z,ga[w+3]=t.w,ga[w+4]=m.x,ga[w+5]=m.y,ga[w+6]=m.z,ga[w+7]=m.w,ga[w+8]=A.x,ga[w+9]=A.y,ga[w+10]=A.z,ga[w+11]=A.w,t=Oa[z.a],m=Oa[z.b],A=Oa[z.c],ea[w]=t.x,ea[w+1]=t.y,ea[w+2]=t.z,ea[w+3]=1,ea[w+4]=m.x,ea[w+5]=m.y,ea[w+6]=m.z,ea[w+7]=1,ea[w+8]=A.x,ea[w+9]=A.y,ea[w+10]=A.z,ea[w+11]=1,t=Pa[z.a],m=Pa[z.b],A=Pa[z.c],fa[w]=t.x,
+fa[w+1]=t.y,fa[w+2]=t.z,fa[w+3]=1,fa[w+4]=m.x,fa[w+5]=m.y,fa[w+6]=m.z,fa[w+7]=1,fa[w+8]=A.x,fa[w+9]=A.y,fa[w+10]=A.z,fa[w+11]=1,w+=12;if(Da&&u)H.length==3&&u==THREE.VertexColors?(z=H[0],t=H[1],m=H[2]):m=t=z=R,qa[ma]=z.r,qa[ma+1]=z.g,qa[ma+2]=z.b,qa[ma+3]=t.r,qa[ma+4]=t.g,qa[ma+5]=t.b,qa[ma+6]=m.r,qa[ma+7]=m.g,qa[ma+8]=m.b,ma+=9;if(Ca&&ua.hasTangents)H=M[0],R=M[1],z=M[2],da[$]=H.x,da[$+1]=H.y,da[$+2]=H.z,da[$+3]=H.w,da[$+4]=R.x,da[$+5]=R.y,da[$+6]=R.z,da[$+7]=R.w,da[$+8]=z.x,da[$+9]=z.y,da[$+10]=z.z,
+da[$+11]=z.w,$+=12;if(Ba&&x)if(E.length==3&&za)for(M=0;M<3;M++)J=E[M],aa[U]=J.x,aa[U+1]=J.y,aa[U+2]=J.z,U+=3;else for(M=0;M<3;M++)aa[U]=J.x,aa[U+1]=J.y,aa[U+2]=J.z,U+=3;if(xa&&q!==void 0&&p)for(M=0;M<3;M++)E=q[M],oa[Y]=E.u,oa[Y+1]=E.v,Y+=2;if(xa&&D!==void 0&&p)for(M=0;M<3;M++)E=D[M],ra[Z]=E.u,ra[Z+1]=E.v,Z+=2;Aa&&(la[X]=ja,la[X+1]=ja+1,la[X+2]=ja+2,X+=3,wa[W]=ja,wa[W+1]=ja+1,wa[W+2]=ja,wa[W+3]=ja+2,wa[W+4]=ja+1,wa[W+5]=ja+2,W+=6,ja+=3)}else if(z instanceof THREE.Face4){if(ya)L=Na[z.a].position,P=
+Na[z.b].position,Q=Na[z.c].position,N=Na[z.d].position,pa[O]=L.x,pa[O+1]=L.y,pa[O+2]=L.z,pa[O+3]=P.x,pa[O+4]=P.y,pa[O+5]=P.z,pa[O+6]=Q.x,pa[O+7]=Q.y,pa[O+8]=Q.z,pa[O+9]=N.x,pa[O+10]=N.y,pa[O+11]=N.z,O+=12;if(ca)for(V in ca)if(m=ca[V],m.__original.needsUpdate)t=m.offset,A=m.offsetSrc,m.size===1?(m.boundTo===void 0||m.boundTo==="vertices"?(m.array[t]=m.value[z.a],m.array[t+1]=m.value[z.b],m.array[t+2]=m.value[z.c],m.array[t+3]=m.value[z.d]):m.boundTo==="faces"?(A=m.value[A],m.array[t]=A,m.array[t+1]=
+A,m.array[t+2]=A,m.array[t+3]=A,m.offsetSrc++):m.boundTo==="faceVertices"&&(m.array[t]=m.value[A],m.array[t+1]=m.value[A+1],m.array[t+2]=m.value[A+2],m.array[t+3]=m.value[A+3],m.offsetSrc+=4),m.offset+=4):(m.boundTo===void 0||m.boundTo==="vertices"?(L=m.value[z.a],P=m.value[z.b],Q=m.value[z.c],N=m.value[z.d]):m.boundTo==="faces"?(N=Q=P=L=A=m.value[A],m.offsetSrc++):m.boundTo==="faceVertices"&&(L=m.value[A],P=m.value[A+1],Q=m.value[A+2],N=m.value[A+3],m.offsetSrc+=4),m.size===2?(m.array[t]=L.x,m.array[t+
+1]=L.y,m.array[t+2]=P.x,m.array[t+3]=P.y,m.array[t+4]=Q.x,m.array[t+5]=Q.y,m.array[t+6]=N.x,m.array[t+7]=N.y,m.offset+=8):m.size===3?(m.type==="c"?(m.array[t]=L.r,m.array[t+1]=L.g,m.array[t+2]=L.b,m.array[t+3]=P.r,m.array[t+4]=P.g,m.array[t+5]=P.b,m.array[t+6]=Q.r,m.array[t+7]=Q.g,m.array[t+8]=Q.b,m.array[t+9]=N.r,m.array[t+10]=N.g,m.array[t+11]=N.b):(m.array[t]=L.x,m.array[t+1]=L.y,m.array[t+2]=L.z,m.array[t+3]=P.x,m.array[t+4]=P.y,m.array[t+5]=P.z,m.array[t+6]=Q.x,m.array[t+7]=Q.y,m.array[t+8]=
+Q.z,m.array[t+9]=N.x,m.array[t+10]=N.y,m.array[t+11]=N.z),m.offset+=12):(m.array[t]=L.x,m.array[t+1]=L.y,m.array[t+2]=L.z,m.array[t+3]=L.w,m.array[t+4]=P.x,m.array[t+5]=P.y,m.array[t+6]=P.z,m.array[t+7]=P.w,m.array[t+8]=Q.x,m.array[t+9]=Q.y,m.array[t+10]=Q.z,m.array[t+11]=Q.w,m.array[t+12]=N.x,m.array[t+13]=N.y,m.array[t+14]=N.z,m.array[t+15]=N.w,m.offset+=16));if(Ea){t=0;for(m=Fa.length;t<m;t++)L=Fa[t].vertices[z.a].position,P=Fa[t].vertices[z.b].position,Q=Fa[t].vertices[z.c].position,N=Fa[t].vertices[z.d].position,
+A=ta[t],A[na]=L.x,A[na+1]=L.y,A[na+2]=L.z,A[na+3]=P.x,A[na+4]=P.y,A[na+5]=P.z,A[na+6]=Q.x,A[na+7]=Q.y,A[na+8]=Q.z,A[na+9]=N.x,A[na+10]=N.y,A[na+11]=N.z;na+=12}if(Ia.length)t=Ia[z.a],m=Ia[z.b],A=Ia[z.c],S=Ia[z.d],ha[w]=t.x,ha[w+1]=t.y,ha[w+2]=t.z,ha[w+3]=t.w,ha[w+4]=m.x,ha[w+5]=m.y,ha[w+6]=m.z,ha[w+7]=m.w,ha[w+8]=A.x,ha[w+9]=A.y,ha[w+10]=A.z,ha[w+11]=A.w,ha[w+12]=S.x,ha[w+13]=S.y,ha[w+14]=S.z,ha[w+15]=S.w,t=Qa[z.a],m=Qa[z.b],A=Qa[z.c],S=Qa[z.d],ga[w]=t.x,ga[w+1]=t.y,ga[w+2]=t.z,ga[w+3]=t.w,ga[w+4]=
+m.x,ga[w+5]=m.y,ga[w+6]=m.z,ga[w+7]=m.w,ga[w+8]=A.x,ga[w+9]=A.y,ga[w+10]=A.z,ga[w+11]=A.w,ga[w+12]=S.x,ga[w+13]=S.y,ga[w+14]=S.z,ga[w+15]=S.w,t=Oa[z.a],m=Oa[z.b],A=Oa[z.c],S=Oa[z.d],ea[w]=t.x,ea[w+1]=t.y,ea[w+2]=t.z,ea[w+3]=1,ea[w+4]=m.x,ea[w+5]=m.y,ea[w+6]=m.z,ea[w+7]=1,ea[w+8]=A.x,ea[w+9]=A.y,ea[w+10]=A.z,ea[w+11]=1,ea[w+12]=S.x,ea[w+13]=S.y,ea[w+14]=S.z,ea[w+15]=1,t=Pa[z.a],m=Pa[z.b],A=Pa[z.c],z=Pa[z.d],fa[w]=t.x,fa[w+1]=t.y,fa[w+2]=t.z,fa[w+3]=1,fa[w+4]=m.x,fa[w+5]=m.y,fa[w+6]=m.z,fa[w+7]=1,fa[w+
+8]=A.x,fa[w+9]=A.y,fa[w+10]=A.z,fa[w+11]=1,fa[w+12]=z.x,fa[w+13]=z.y,fa[w+14]=z.z,fa[w+15]=1,w+=16;if(Da&&u)H.length==4&&u==THREE.VertexColors?(z=H[0],t=H[1],m=H[2],H=H[3]):H=m=t=z=R,qa[ma]=z.r,qa[ma+1]=z.g,qa[ma+2]=z.b,qa[ma+3]=t.r,qa[ma+4]=t.g,qa[ma+5]=t.b,qa[ma+6]=m.r,qa[ma+7]=m.g,qa[ma+8]=m.b,qa[ma+9]=H.r,qa[ma+10]=H.g,qa[ma+11]=H.b,ma+=12;if(Ca&&ua.hasTangents)H=M[0],R=M[1],z=M[2],M=M[3],da[$]=H.x,da[$+1]=H.y,da[$+2]=H.z,da[$+3]=H.w,da[$+4]=R.x,da[$+5]=R.y,da[$+6]=R.z,da[$+7]=R.w,da[$+8]=z.x,
+da[$+9]=z.y,da[$+10]=z.z,da[$+11]=z.w,da[$+12]=M.x,da[$+13]=M.y,da[$+14]=M.z,da[$+15]=M.w,$+=16;if(Ba&&x)if(E.length==4&&za)for(M=0;M<4;M++)J=E[M],aa[U]=J.x,aa[U+1]=J.y,aa[U+2]=J.z,U+=3;else for(M=0;M<4;M++)aa[U]=J.x,aa[U+1]=J.y,aa[U+2]=J.z,U+=3;if(xa&&q!==void 0&&p)for(M=0;M<4;M++)E=q[M],oa[Y]=E.u,oa[Y+1]=E.v,Y+=2;if(xa&&D!==void 0&&p)for(M=0;M<4;M++)E=D[M],ra[Z]=E.u,ra[Z+1]=E.v,Z+=2;Aa&&(la[X]=ja,la[X+1]=ja+1,la[X+2]=ja+3,la[X+3]=ja+1,la[X+4]=ja+2,la[X+5]=ja+3,X+=6,wa[W]=ja,wa[W+1]=ja+1,wa[W+2]=
+ja,wa[W+3]=ja+3,wa[W+4]=ja+1,wa[W+5]=ja+2,wa[W+6]=ja+2,wa[W+7]=ja+3,W+=8,ja+=4)}ya&&(f.bindBuffer(f.ARRAY_BUFFER,r.__webglVertexBuffer),f.bufferData(f.ARRAY_BUFFER,pa,v));if(ca)for(V in ca)m=ca[V],m.__original.needsUpdate&&(f.bindBuffer(f.ARRAY_BUFFER,m.buffer),f.bufferData(f.ARRAY_BUFFER,m.array,v));if(Ea){t=0;for(m=Fa.length;t<m;t++)f.bindBuffer(f.ARRAY_BUFFER,r.__webglMorphTargetsBuffers[t]),f.bufferData(f.ARRAY_BUFFER,ta[t],v)}Da&&ma>0&&(f.bindBuffer(f.ARRAY_BUFFER,r.__webglColorBuffer),f.bufferData(f.ARRAY_BUFFER,
+qa,v));Ba&&(f.bindBuffer(f.ARRAY_BUFFER,r.__webglNormalBuffer),f.bufferData(f.ARRAY_BUFFER,aa,v));Ca&&ua.hasTangents&&(f.bindBuffer(f.ARRAY_BUFFER,r.__webglTangentBuffer),f.bufferData(f.ARRAY_BUFFER,da,v));xa&&Y>0&&(f.bindBuffer(f.ARRAY_BUFFER,r.__webglUVBuffer),f.bufferData(f.ARRAY_BUFFER,oa,v));xa&&Z>0&&(f.bindBuffer(f.ARRAY_BUFFER,r.__webglUV2Buffer),f.bufferData(f.ARRAY_BUFFER,ra,v));Aa&&(f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,r.__webglFaceBuffer),f.bufferData(f.ELEMENT_ARRAY_BUFFER,la,v),f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,
+r.__webglLineBuffer),f.bufferData(f.ELEMENT_ARRAY_BUFFER,wa,v));w>0&&(f.bindBuffer(f.ARRAY_BUFFER,r.__webglSkinVertexABuffer),f.bufferData(f.ARRAY_BUFFER,ea,v),f.bindBuffer(f.ARRAY_BUFFER,r.__webglSkinVertexBBuffer),f.bufferData(f.ARRAY_BUFFER,fa,v),f.bindBuffer(f.ARRAY_BUFFER,r.__webglSkinIndicesBuffer),f.bufferData(f.ARRAY_BUFFER,ga,v),f.bindBuffer(f.ARRAY_BUFFER,r.__webglSkinWeightsBuffer),f.bufferData(f.ARRAY_BUFFER,ha,v));y&&(delete r.__inittedArrays,delete r.__colorArray,delete r.__normalArray,
+delete r.__tangentArray,delete r.__uvArray,delete r.__uv2Array,delete r.__faceArray,delete r.__vertexArray,delete r.__lineArray,delete r.__skinVertexAArray,delete r.__skinVertexBArray,delete r.__skinIndexArray,delete r.__skinWeightArray)}h.__dirtyVertices=!1;h.__dirtyMorphTargets=!1;h.__dirtyElements=!1;h.__dirtyUvs=!1;h.__dirtyNormals=!1;h.__dirtyTangents=!1;h.__dirtyColors=!1;B(j)}else if(i instanceof THREE.Ribbon){h=i.geometry;if(h.__dirtyVertices||h.__dirtyColors){i=h;j=f.DYNAMIC_DRAW;k=s=y=y=
+void 0;o=i.vertices;n=i.colors;p=o.length;r=n.length;u=i.__vertexArray;v=i.__colorArray;x=i.__dirtyColors;if(i.__dirtyVertices){for(y=0;y<p;y++)s=o[y].position,k=y*3,u[k]=s.x,u[k+1]=s.y,u[k+2]=s.z;f.bindBuffer(f.ARRAY_BUFFER,i.__webglVertexBuffer);f.bufferData(f.ARRAY_BUFFER,u,j)}if(x){for(y=0;y<r;y++)color=n[y],k=y*3,v[k]=color.r,v[k+1]=color.g,v[k+2]=color.b;f.bindBuffer(f.ARRAY_BUFFER,i.__webglColorBuffer);f.bufferData(f.ARRAY_BUFFER,v,j)}}h.__dirtyVertices=!1;h.__dirtyColors=!1}else if(i instanceof
+THREE.Line){h=i.geometry;if(h.__dirtyVertices||h.__dirtyColors){i=h;j=f.DYNAMIC_DRAW;k=s=y=y=void 0;o=i.vertices;n=i.colors;p=o.length;r=n.length;u=i.__vertexArray;v=i.__colorArray;x=i.__dirtyColors;if(i.__dirtyVertices){for(y=0;y<p;y++)s=o[y].position,k=y*3,u[k]=s.x,u[k+1]=s.y,u[k+2]=s.z;f.bindBuffer(f.ARRAY_BUFFER,i.__webglVertexBuffer);f.bufferData(f.ARRAY_BUFFER,u,j)}if(x){for(y=0;y<r;y++)color=n[y],k=y*3,v[k]=color.r,v[k+1]=color.g,v[k+2]=color.b;f.bindBuffer(f.ARRAY_BUFFER,i.__webglColorBuffer);
+f.bufferData(f.ARRAY_BUFFER,v,j)}}h.__dirtyVertices=!1;h.__dirtyColors=!1}else if(i instanceof THREE.ParticleSystem)h=i.geometry,r=ia(h),(h.__dirtyVertices||h.__dirtyColors||i.sortParticles||r)&&c(h,f.DYNAMIC_DRAW,i),h.__dirtyVertices=!1,h.__dirtyColors=!1,B(h)};this.setFaceCulling=function(b,c){b?(!c||c=="ccw"?f.frontFace(f.CCW):f.frontFace(f.CW),b=="back"?f.cullFace(f.BACK):b=="front"?f.cullFace(f.FRONT):f.cullFace(f.FRONT_AND_BACK),f.enable(f.CULL_FACE)):f.disable(f.CULL_FACE)};this.supportsVertexTextures=
+function(){return fb}};
+THREE.WebGLRenderTarget=function(b,c,d){this.width=b;this.height=c;d=d||{};this.wrapS=d.wrapS!==void 0?d.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=d.wrapT!==void 0?d.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=d.magFilter!==void 0?d.magFilter:THREE.LinearFilter;this.minFilter=d.minFilter!==void 0?d.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=d.format!==void 0?d.format:THREE.RGBAFormat;this.type=d.type!==void 0?d.type:
+THREE.UnsignedByteType;this.depthBuffer=d.depthBuffer!==void 0?d.depthBuffer:!0;this.stencilBuffer=d.stencilBuffer!==void 0?d.stencilBuffer:!0};
+THREE.WebGLRenderTarget.prototype.clone=function(){var b=new THREE.WebGLRenderTarget(this.width,this.height);b.wrapS=this.wrapS;b.wrapT=this.wrapT;b.magFilter=this.magFilter;b.minFilter=this.minFilter;b.offset.copy(this.offset);b.repeat.copy(this.repeat);b.format=this.format;b.type=this.type;b.depthBuffer=this.depthBuffer;b.stencilBuffer=this.stencilBuffer;return b};THREE.WebGLRenderTargetCube=function(b,c,d){THREE.WebGLRenderTarget.call(this,b,c,d);this.activeCubeFace=0};
 THREE.WebGLRenderTargetCube.prototype=new THREE.WebGLRenderTarget;THREE.WebGLRenderTargetCube.prototype.constructor=THREE.WebGLRenderTargetCube;

+ 3 - 2
examples/canvas_geometry_cube.html

@@ -53,11 +53,12 @@
 				info.innerHTML = 'Drag to spin the cube';
 				container.appendChild( info );
 
+				scene = new THREE.Scene();
+
 				camera = new THREE.PerspectiveCamera( 70, window.innerWidth / window.innerHeight, 1, 1000 );
 				camera.position.y = 150;
 				camera.position.z = 500;
-
-				scene = new THREE.Scene();
+				scene.add( camera );
 
 				// Cube
 

+ 4 - 3
examples/canvas_geometry_hierarchy.html

@@ -44,10 +44,12 @@
 				container = document.createElement( 'div' );
 				document.body.appendChild( container );
 
+				scene = new THREE.Scene();
+
 				camera = new THREE.PerspectiveCamera( 60, window.innerWidth / window.innerHeight, 1, 10000 );
 				camera.position.z = 500;
-
-				scene = new THREE.Scene();
+				camera.target = new THREE.Vector3();
+				scene.add( camera );
 
 				var geometry = new THREE.CubeGeometry( 100, 100, 100 );
 				var material = new THREE.MeshNormalMaterial();
@@ -65,7 +67,6 @@
 					mesh.rotation.y = Math.random() * 360 * ( Math.PI / 180 );
 					mesh.matrixAutoUpdate = false;
 					mesh.updateMatrix();
-
 					group.add( mesh );
 
 				}

+ 1 - 1
examples/canvas_interactive_particles.html

@@ -133,7 +133,7 @@
 
 				// find intersections
 
-				camera.update();
+				camera.updateMatrixWorld();
 
 				var vector = new THREE.Vector3( mouse.x, mouse.y, 0.5 );
 				projector.unprojectVector( vector, camera );

+ 12 - 7
examples/canvas_lights_pointlights.html

@@ -40,7 +40,6 @@
 		</div>
 
 		<script src="../build/Three.js"></script>
-		<script src="obj/WaltHead.js"></script>
 
 		<script src="js/RequestAnimationFrame.js"></script>
 
@@ -49,7 +48,7 @@
 			var camera, scene, renderer,
 			particle1, particle2, particle2,
 			light1, light2, light3,
-			mesh;
+			loader, mesh;
 
 			init();
 			animate();
@@ -58,7 +57,8 @@
 
 				var container = document.getElementById( 'container' );
 
-				camera = new THREE.PerspectiveCamera( 65, window.innerWidth / window.innerHeight, 1, 1000 );
+				camera = new THREE.PerspectiveCamera( 60, window.innerWidth / window.innerHeight, 1, 1000 );
+				camera.position.y = - 6;
 				camera.position.z = 100;
 
 				scene = new THREE.Scene();
@@ -96,9 +96,14 @@
 				particle3.scale.x = particle3.scale.y = particle3.scale.z = 0.5;
 				scene.add( particle3 );
 
-				mesh = new THREE.Mesh( new WaltHead(), new THREE.MeshLambertMaterial( { color: 0xffffff, shading: THREE.FlatShading } ) );
-				mesh.overdraw = true;
-				scene.add( mesh );
+				loader = new THREE.JSONLoader();
+				loader.load( 'obj/WaltHeadLo.js', function ( geometry ) {
+
+					mesh = new THREE.Mesh( geometry, new THREE.MeshLambertMaterial( { color: 0xffffff, shading: THREE.FlatShading } ) );
+					mesh.overdraw = true;
+					scene.add( mesh );
+
+				} );
 
 				renderer = new THREE.CanvasRenderer();
 				renderer.setSize( window.innerWidth, window.innerHeight );
@@ -119,7 +124,7 @@
 
 				var time = new Date().getTime() * 0.0005;
 
-				mesh.rotation.y -= 0.01;
+				if ( mesh ) mesh.rotation.y -= 0.01;
 
 				particle1.position.x = Math.sin( time * 0.7 ) * 30;
 				particle1.position.y = Math.cos( time * 0.5 ) * 40;

+ 13 - 9
examples/canvas_lights_pointlights_smooth.html

@@ -40,7 +40,6 @@
 		</div>
 
 		<script src="../build/Three.js"></script>
-		<script src="obj/WaltHead.js"></script>
 
 		<script src="js/RequestAnimationFrame.js"></script>
 
@@ -49,7 +48,7 @@
 			var camera, scene, renderer,
 			particle1, particle2, particle2,
 			light1, light2, light3,
-			geometry, mesh;
+			loader, mesh;
 
 			init();
 			animate();
@@ -58,7 +57,8 @@
 
 				var container = document.getElementById( 'container' );
 
-				camera = new THREE.PerspectiveCamera( 65, window.innerWidth / window.innerHeight, 1, 1000 );
+				camera = new THREE.PerspectiveCamera( 60, window.innerWidth / window.innerHeight, 1, 1000 );
+				camera.position.y = - 6;
 				camera.position.z = 100;
 
 				scene = new THREE.Scene();
@@ -96,12 +96,16 @@
 				particle3.scale.x = particle3.scale.y = particle3.scale.z = 0.5;
 				scene.add( particle3 );
 
-				geometry = new WaltHead();
-				geometry.computeVertexNormals();
+				loader = new THREE.JSONLoader();
+				loader.load( 'obj/WaltHeadLo.js', function ( geometry ) {
 
-				mesh = new THREE.Mesh( geometry, new THREE.MeshLambertMaterial( { color: 0xffffff, shading: THREE.SmoothShading } ) );
-				mesh.overdraw = true;
-				scene.add( mesh );
+					geometry.computeVertexNormals();
+
+					mesh = new THREE.Mesh( geometry, new THREE.MeshLambertMaterial( { color: 0xffffff } ) );
+					mesh.overdraw = true;
+					scene.add( mesh );
+
+				} );
 
 				renderer = new THREE.CanvasRenderer();
 				renderer.setSize( window.innerWidth, window.innerHeight );
@@ -123,7 +127,7 @@
 
 				var time = new Date().getTime() * 0.0005;
 
-				mesh.rotation.y -= 0.01;
+				if ( mesh ) mesh.rotation.y -= 0.01;
 
 				particle1.position.x = Math.sin( time * 0.7 ) * 30;
 				particle1.position.y = Math.cos( time * 0.5 ) * 40;

+ 37 - 48
examples/canvas_materials_depth.html

@@ -26,7 +26,7 @@
 
 			var camera, scene, renderer;
 
-			var cube, plane, target = new THREE.Vector3();
+			var cube, plane, objects = [];
 
 			var targetRotation = 0;
 			var targetRotationOnMouseDown = 0;
@@ -37,19 +37,15 @@
 			var windowHalfX = window.innerWidth / 2;
 			var windowHalfY = window.innerHeight / 2;
 
-			var moveForward = false,
-			moveBackwards = false,
-			moveUp = false,
-			moveDown = false,
-			moveLeft = false,
-			moveRight = false,
+			var moveForward = false;
+			var moveBackwards = false;
+			var moveLeft = false;
+			var moveRight = false;
+			var moveUp = false;
+			var moveDown = false;
 
-			yawLeft = false,
-			yawRight = false,
-			pitchUp = false,
-			pitchDown = false,
-			rollLeft = false,
-			rollRight = false;
+			var targetMoveLeft = false;
+			var targetMoveRight = false;
 
 			var debugContext;
 
@@ -65,6 +61,7 @@
 				camera.position.x = 1000;
 				camera.position.y = 1000;
 				camera.position.z = 1000;
+				camera.target = new THREE.Vector3( 0, 150, 0 );
 
 				scene = new THREE.Scene();
 
@@ -86,7 +83,7 @@
 				geometry = new THREE.CubeGeometry( 100, 100, 100 );
 				material = new THREE.MeshDepthMaterial( { near: 1, far: 2000 } );
 
-				for (var i = 0; i < 20; i ++ ) {
+				for ( var i = 0; i < 20; i ++ ) {
 
 					cube = new THREE.Mesh( geometry, material );
 					cube.overdraw = true;
@@ -98,7 +95,9 @@
 					cube.rotation.y = Math.random() * 200 - 100;
 					cube.rotation.z = Math.random() * 200 - 100;
 
-					scene.add(cube);
+					scene.add( cube );
+
+					objects.push( cube );
 
 				}
 
@@ -146,18 +145,16 @@
 
 			function onDocumentKeyDown( event ) {
 
-				switch( event.keyCode ) {
+				switch ( event.keyCode ) {
 
 					case 38: moveForward = true; break; // up
 					case 40: moveBackwards = true; break; // down
 					case 37: moveLeft = true; break; // left
 					case 39: moveRight = true; break; // right
-					case 65: yawLeft = true; break; // a
-					case 68: yawRight = true; break; // d
-					case 87: moveUp/*pitchUp*/ = true; break; // w
-					case 83: moveDown/*pitchDown*/ = true; break; // s
-					case 90: rollLeft = true; break; // z
-					case 67: rollRight = true; break; // c
+					case 87: moveUp = true; break; // w
+					case 83: moveDown = true; break; // s
+					case 65: targetMoveLeft = true; break; // a
+					case 68: targetMoveRight = true; break; // d
 
 				}
 
@@ -165,18 +162,16 @@
 
 			function onDocumentKeyUp( event ) {
 
-				switch( event.keyCode ) {
+				switch ( event.keyCode ) {
 
 					case 38: moveForward = false; break; // up
 					case 40: moveBackwards = false; break; // down
 					case 37: moveLeft = false; break; // left
 					case 39: moveRight = false; break; // right
-					case 65: yawLeft = false; break; // a
-					case 68: yawRight = false; break; // d
-					case 87: moveUp/*pitchUp*/ = false; break; // w
-					case 83: moveDown/*pitchDown*/ = false; break; // s
-					case 90: rollLeft = false; break; // z
-					case 67: rollRight = false; break; // c
+					case 87: moveUp = false; break; // w
+					case 83: moveDown = false; break; // s
+					case 65: targetMoveLeft = false; break; // a
+					case 68: targetMoveRight = false; break; // d
 
 				}
 
@@ -195,25 +190,19 @@
 
 			function render() {
 
-				if ( moveForward ) camera.position.z -= 10; // camera.moveZ( 10 );
-				if ( moveBackwards ) camera.position.z += 10; // camera.moveZ( - 10 );
-
-				if ( moveUp ) camera.position.y += 10; // camera.moveZ( 10 );
-				if ( moveDown ) camera.position.y -= 10; // camera.moveZ( - 10 );
-
-				if ( moveLeft ) camera.position.x -= 10; // camera.moveX( - 10 );
-				if ( moveRight ) camera.position.x += 10; // camera.moveX( 10 );
+				if ( moveForward ) camera.position.z -= 10;
+				if ( moveBackwards ) camera.position.z += 10;
 
-				if ( pitchUp ) camera.rotation.x += 0.01; // camera.rotateX( 1 );
-				if ( pitchDown ) camera.rotation.x -= 0.01; // camera.rotateX( - 1 );
+				if ( moveLeft ) camera.position.x -= 10;
+				if ( moveRight ) camera.position.x += 10;
 
-				if ( yawLeft ) target.x -= 10; // camera.rotation.y += 0.01; // camera.rotateY( 1 );
-				if ( yawRight ) target.x += 10; // camera.rotation.y -= 0.01; // camera.rotateY( - 1 );
+				if ( moveUp ) camera.position.y += 10;
+				if ( moveDown ) camera.position.y -= 10;
 
-				if ( rollLeft ) camera.rotation.z += 0.01; // camera.rotateZ( 1 );
-				if ( rollRight ) camera.rotation.z -= 0.01; // camera.rotateZ( - 1 );
+				if ( targetMoveLeft ) camera.target.x -= 10;
+				if ( targetMoveRight ) camera.target.x += 10;
 
-				camera.lookAt( target );
+				camera.lookAt( camera.target );
 
 				debugContext.clearRect( - 256, - 256, 512, 512 );
 
@@ -228,14 +217,14 @@
 				// camera
 
 				debugContext.moveTo( camera.position.x * 0.1, camera.position.z * 0.1 );
-				debugContext.lineTo( target.x * 0.1, target.z * 0.1 );
+				debugContext.lineTo( camera.target.x * 0.1, camera.target.z * 0.1 );
 				debugContext.rect( camera.position.x * 0.1 - 5, camera.position.z * 0.1 - 5, 10, 10 );
-				debugContext.rect( target.x * 0.1 - 5, target.z * 0.1 - 5, 10, 10 );
+				debugContext.rect( camera.target.x * 0.1 - 5, camera.target.z * 0.1 - 5, 10, 10 );
 				debugContext.rect( - 50, - 50, 100, 100 );
 
-				for ( var i = 1; i < scene.objects.length; i++ ) {
+				for ( var i = 0; i < objects.length; i++ ) {
 
-					var object = scene.objects[i];
+					var object = objects[ i ];
 
 					object.rotation.x += 0.01;
 					object.rotation.y += 0.005;

+ 19 - 11
examples/canvas_materials_normal.html

@@ -39,15 +39,14 @@
 			Walt Disney head by <a href="http://www.davidoreilly.com/2009/01/walt-disneys-head-on-a-plate" target="_blank">David OReilly</a>
 		</div>
 
-		<script src="../build/Three.js"></script> 
-		<script src="obj/WaltHead.js"></script>
+		<script src="../build/Three.js"></script>
 
 		<script src="js/RequestAnimationFrame.js"></script>
 
 		<script>
 
 			var camera, scene, renderer,
-			object;
+			loader, mesh;
 
 			init();
 			animate();
@@ -56,15 +55,20 @@
 
 				var container = document.getElementById( 'container' );
 
-				camera = new THREE.PerspectiveCamera( 50, window.innerWidth / window.innerHeight, 1, 2000 );
-				camera.position.z = 1000;
+				camera = new THREE.PerspectiveCamera( 60, window.innerWidth / window.innerHeight, 1, 2000 );
+				camera.position.y = - 6;
+				camera.position.z = 100;
 
 				scene = new THREE.Scene();
 
-				object = new THREE.Mesh( new WaltHead(), new THREE.MeshNormalMaterial() );
-				object.overdraw = true;
-				object.scale.x = object.scale.y = object.scale.z = 10;
-				scene.add( object );
+				loader = new THREE.JSONLoader();
+				loader.load( 'obj/WaltHeadLo.js', function ( geometry ) {
+
+					mesh = new THREE.Mesh( geometry, new THREE.MeshNormalMaterial() );
+					mesh.overdraw = true;
+					scene.add( mesh );
+
+				} );
 
 				renderer = new THREE.CanvasRenderer();
 				renderer.setSize( window.innerWidth, window.innerHeight );
@@ -85,8 +89,12 @@
 
 				var time = new Date().getTime() * 0.0005;
 
-				object.rotation.x -= 0.005;
-				object.rotation.y -= 0.01;
+				if ( mesh ) {
+
+					mesh.rotation.x -= 0.005;
+					mesh.rotation.y -= 0.01;
+
+				}
 
 				renderer.render( scene, camera );
 

+ 13 - 10
examples/canvas_materials_reflection.html

@@ -41,8 +41,6 @@
 		<script src="../build/Three.js"></script>
 		<script src="../src/extras/ImageUtils.js"></script>
 
-		<script src="obj/WaltHead.js"></script>
-
 		<script src="js/RequestAnimationFrame.js"></script>
 
 		<script>
@@ -50,7 +48,7 @@
 			var camera, scene, renderer,
 			particle1, particle2, particle2,
 			light1, light2, light3,
-			geometry, mesh;
+			loader, mesh;
 
 			init();
 			animate();
@@ -59,17 +57,22 @@
 
 				var container = document.getElementById( 'container' );
 
-				camera = new THREE.PerspectiveCamera( 65, window.innerWidth / window.innerHeight, 1, 1000 );
+				camera = new THREE.PerspectiveCamera( 60, window.innerWidth / window.innerHeight, 1, 1000 );
+				camera.position.y = - 6;
 				camera.position.z = 100;
 
 				scene = new THREE.Scene();
 
-				geometry = new WaltHead();
-				geometry.computeVertexNormals();
+				loader = new THREE.JSONLoader();
+				loader.load( 'obj/WaltHeadLo.js', function ( geometry ) {
+
+					geometry.computeVertexNormals();
+
+					mesh = new THREE.Mesh( geometry, new THREE.MeshBasicMaterial( { envMap: THREE.ImageUtils.loadTexture( 'textures/metal.jpg', new THREE.SphericalReflectionMapping() ) } ) );
+					mesh.overdraw = true;
+					scene.add( mesh );
 
-				mesh = new THREE.Mesh( geometry, new THREE.MeshBasicMaterial( { envMap: THREE.ImageUtils.loadTexture( 'textures/metal.jpg', new THREE.SphericalReflectionMapping() ) } ) );
-				mesh.overdraw = true;
-				scene.add( mesh );
+				} );
 
 				renderer = new THREE.CanvasRenderer();
 				renderer.setSize( window.innerWidth, window.innerHeight );
@@ -91,7 +94,7 @@
 
 				var time = new Date().getTime() * 0.0005;
 
-				mesh.rotation.y -= 0.01;
+				if ( mesh ) mesh.rotation.y -= 0.01;
 
 				renderer.render( scene, camera );
 

+ 30 - 39
examples/canvas_sandbox.html

@@ -38,15 +38,15 @@
 			var windowHalfX = window.innerWidth / 2;
 			var windowHalfY = window.innerHeight / 2;
 
-			var moveForward = false, moveBackwards = false,
-			moveUp = false, moveDown = false,
-			moveLeft = false, moveRight = false,
+			var moveForward = false;
+			var moveBackwards = false;
+			var moveLeft = false;
+			var moveRight = false;
+			var moveUp = false;
+			var moveDown = false;
 
-			yawLeft = false, yawRight = false,
-			pitchUp = false, pitchDown = false,
-			rollLeft = false, rollRight = false;
-
-			var target = new THREE.Vector3( 0, 150, 0 );
+			var targetMoveLeft = false;
+			var targetMoveRight = false;
 
 			var debugContext;
 
@@ -61,6 +61,7 @@
 				camera = new THREE.PerspectiveCamera( 45, window.innerWidth / window.innerHeight, 1, 10000 );
 				camera.position.y = 150;
 				camera.position.z = 400;
+				camera.target = new THREE.Vector3( 0, 150, 0 );
 
 				scene = new THREE.Scene();
 
@@ -157,18 +158,16 @@
 
 			function onDocumentKeyDown( event ) {
 
-				switch( event.keyCode ) {
+				switch ( event.keyCode ) {
 
 					case 38: moveForward = true; break; // up
 					case 40: moveBackwards = true; break; // down
 					case 37: moveLeft = true; break; // left
 					case 39: moveRight = true; break; // right
-					case 65: yawLeft = true; break; // a
-					case 68: yawRight = true; break; // d
-					case 87: moveUp/*pitchUp*/ = true; break; // w
-					case 83: moveDown/*pitchDown*/ = true; break; // s
-					case 90: rollLeft = true; break; // z
-					case 67: rollRight = true; break; // c
+					case 87: moveUp = true; break; // w
+					case 83: moveDown = true; break; // s
+					case 65: targetMoveLeft = true; break; // a
+					case 68: targetMoveRight = true; break; // d
 
 				}
 
@@ -176,18 +175,16 @@
 
 			function onDocumentKeyUp( event ) {
 
-				switch( event.keyCode ) {
+				switch ( event.keyCode ) {
 
 					case 38: moveForward = false; break; // up
 					case 40: moveBackwards = false; break; // down
 					case 37: moveLeft = false; break; // left
 					case 39: moveRight = false; break; // right
-					case 65: yawLeft = false; break; // a
-					case 68: yawRight = false; break; // d
-					case 87: moveUp/*pitchUp*/ = false; break; // w
-					case 83: moveDown/*pitchDown*/ = false; break; // s
-					case 90: rollLeft = false; break; // z
-					case 67: rollRight = false; break; // c
+					case 87: moveUp = false; break; // w
+					case 83: moveDown = false; break; // s
+					case 65: targetMoveLeft = false; break; // a
+					case 68: targetMoveRight = false; break; // d
 
 				}
 
@@ -206,25 +203,19 @@
 
 			function render() {
 
-				if ( moveForward ) camera.position.z -= 5;
-				if ( moveBackwards ) camera.position.z += 5;
-
-				if ( moveUp ) camera.position.y += 5;
-				if ( moveDown ) camera.position.y -= 5;
-
-				if ( moveLeft ) camera.position.x -= 5;
-				if ( moveRight ) camera.position.x += 5;
+				if ( moveForward ) camera.position.z -= 10;
+				if ( moveBackwards ) camera.position.z += 10;
 
-				if ( pitchUp ) camera.rotation.x += 0.01;
-				if ( pitchDown ) camera.rotation.x -= 0.01;
+				if ( moveLeft ) camera.position.x -= 10;
+				if ( moveRight ) camera.position.x += 10;
 
-				if ( yawLeft ) target.x -= 5;
-				if ( yawRight ) target.x += 5;
+				if ( moveUp ) camera.position.y += 10;
+				if ( moveDown ) camera.position.y -= 10;
 
-				if ( rollLeft ) camera.rotation.z += 0.01;
-				if ( rollRight ) camera.rotation.z -= 0.01;
+				if ( targetMoveLeft ) camera.target.x -= 10;
+				if ( targetMoveRight ) camera.target.x += 10;
 
-				camera.lookAt( target );
+				camera.lookAt( camera.target );
 
 				debugContext.clearRect( -256, -256, 512, 512 );
 
@@ -239,9 +230,9 @@
 				// camera
 
 				debugContext.moveTo( camera.position.x * 0.1, camera.position.z * 0.1 );
-				debugContext.lineTo( target.x * 0.1, target.z * 0.1 );
+				debugContext.lineTo( camera.target.x * 0.1, camera.target.z * 0.1 );
 				debugContext.rect( camera.position.x * 0.1 - 5, camera.position.z * 0.1 - 5, 10, 10 );
-				debugContext.rect( target.x * 0.1 - 5, target.z * 0.1 - 5, 10, 10 );
+				debugContext.rect( camera.target.x * 0.1 - 5, camera.target.z * 0.1 - 5, 10, 10 );
 				debugContext.rect( - 50, - 50, 100, 100 );
 
 				for ( var i = 0, l = objects.length; i < l; i++ ) {

+ 6 - 6
examples/js/Stats.js

@@ -1,10 +1,10 @@
-// stats.js r6 - http://github.com/mrdoob/stats.js
-var Stats=function(){function s(a,g,d){var f,c,e;for(c=0;c<30;c++)for(f=0;f<73;f++)e=(f+c*74)*4,a[e]=a[e+4],a[e+1]=a[e+5],a[e+2]=a[e+6];for(c=0;c<30;c++)e=(73+c*74)*4,c<g?(a[e]=b[d].bg.r,a[e+1]=b[d].bg.g,a[e+2]=b[d].bg.b):(a[e]=b[d].fg.r,a[e+1]=b[d].fg.g,a[e+2]=b[d].fg.b)}var r=0,t=2,g,u=0,j=(new Date).getTime(),F=j,v=j,l=0,w=1E3,x=0,k,d,a,m,y,n=0,z=1E3,A=0,f,c,o,B,p=0,C=1E3,D=0,h,i,q,E,b={fps:{bg:{r:16,g:16,b:48},fg:{r:0,g:255,b:255}},ms:{bg:{r:16,g:48,b:16},fg:{r:0,g:255,b:0}},mb:{bg:{r:48,g:16,
-b:26},fg:{r:255,g:0,b:128}}};g=document.createElement("div");g.style.cursor="pointer";g.style.width="80px";g.style.opacity="0.9";g.style.zIndex="10001";g.addEventListener("click",function(){r++;r==t&&(r=0);k.style.display="none";f.style.display="none";h.style.display="none";switch(r){case 0:k.style.display="block";break;case 1:f.style.display="block";break;case 2:h.style.display="block"}},!1);k=document.createElement("div");k.style.backgroundColor="rgb("+Math.floor(b.fps.bg.r/2)+","+Math.floor(b.fps.bg.g/
-2)+","+Math.floor(b.fps.bg.b/2)+")";k.style.padding="2px 0px 3px 0px";g.appendChild(k);d=document.createElement("div");d.style.fontFamily="Helvetica, Arial, sans-serif";d.style.textAlign="left";d.style.fontSize="9px";d.style.color="rgb("+b.fps.fg.r+","+b.fps.fg.g+","+b.fps.fg.b+")";d.style.margin="0px 0px 1px 3px";d.innerHTML='<span style="font-weight:bold">FPS</span>';k.appendChild(d);a=document.createElement("canvas");a.width=74;a.height=30;a.style.display="block";a.style.marginLeft="3px";k.appendChild(a);
+// stats.js r7 - http://github.com/mrdoob/stats.js
+var Stats=function(){function s(a,g,d){var f,c,e;for(c=0;c<30;c++)for(f=0;f<73;f++)e=(f+c*74)*4,a[e]=a[e+4],a[e+1]=a[e+5],a[e+2]=a[e+6];for(c=0;c<30;c++)e=(73+c*74)*4,c<g?(a[e]=b[d].bg.r,a[e+1]=b[d].bg.g,a[e+2]=b[d].bg.b):(a[e]=b[d].fg.r,a[e+1]=b[d].fg.g,a[e+2]=b[d].fg.b)}var r=0,t=2,g,u=0,j=Date.now(),F=j,v=j,l=0,w=1E3,x=0,k,d,a,m,y,n=0,z=1E3,A=0,f,c,o,B,p=0,C=1E3,D=0,h,i,q,E,b={fps:{bg:{r:16,g:16,b:48},fg:{r:0,g:255,b:255}},ms:{bg:{r:16,g:48,b:16},fg:{r:0,g:255,b:0}},mb:{bg:{r:48,g:16,b:26},fg:{r:255,
+g:0,b:128}}};g=document.createElement("div");g.style.cursor="pointer";g.style.width="80px";g.style.opacity="0.9";g.style.zIndex="10001";g.addEventListener("click",function(){r++;r==t&&(r=0);k.style.display="none";f.style.display="none";h.style.display="none";switch(r){case 0:k.style.display="block";break;case 1:f.style.display="block";break;case 2:h.style.display="block"}},!1);k=document.createElement("div");k.style.backgroundColor="rgb("+Math.floor(b.fps.bg.r/2)+","+Math.floor(b.fps.bg.g/2)+","+
+Math.floor(b.fps.bg.b/2)+")";k.style.padding="2px 0px 3px 0px";g.appendChild(k);d=document.createElement("div");d.style.fontFamily="Helvetica, Arial, sans-serif";d.style.textAlign="left";d.style.fontSize="9px";d.style.color="rgb("+b.fps.fg.r+","+b.fps.fg.g+","+b.fps.fg.b+")";d.style.margin="0px 0px 1px 3px";d.innerHTML='<span style="font-weight:bold">FPS</span>';k.appendChild(d);a=document.createElement("canvas");a.width=74;a.height=30;a.style.display="block";a.style.marginLeft="3px";k.appendChild(a);
 m=a.getContext("2d");m.fillStyle="rgb("+b.fps.bg.r+","+b.fps.bg.g+","+b.fps.bg.b+")";m.fillRect(0,0,a.width,a.height);y=m.getImageData(0,0,a.width,a.height);f=document.createElement("div");f.style.backgroundColor="rgb("+Math.floor(b.ms.bg.r/2)+","+Math.floor(b.ms.bg.g/2)+","+Math.floor(b.ms.bg.b/2)+")";f.style.padding="2px 0px 3px 0px";f.style.display="none";g.appendChild(f);c=document.createElement("div");c.style.fontFamily="Helvetica, Arial, sans-serif";c.style.textAlign="left";c.style.fontSize=
 "9px";c.style.color="rgb("+b.ms.fg.r+","+b.ms.fg.g+","+b.ms.fg.b+")";c.style.margin="0px 0px 1px 3px";c.innerHTML='<span style="font-weight:bold">MS</span>';f.appendChild(c);a=document.createElement("canvas");a.width=74;a.height=30;a.style.display="block";a.style.marginLeft="3px";f.appendChild(a);o=a.getContext("2d");o.fillStyle="rgb("+b.ms.bg.r+","+b.ms.bg.g+","+b.ms.bg.b+")";o.fillRect(0,0,a.width,a.height);B=o.getImageData(0,0,a.width,a.height);try{performance&&performance.memory&&performance.memory.totalJSHeapSize&&
 (t=3)}catch(G){}h=document.createElement("div");h.style.backgroundColor="rgb("+Math.floor(b.mb.bg.r/2)+","+Math.floor(b.mb.bg.g/2)+","+Math.floor(b.mb.bg.b/2)+")";h.style.padding="2px 0px 3px 0px";h.style.display="none";g.appendChild(h);i=document.createElement("div");i.style.fontFamily="Helvetica, Arial, sans-serif";i.style.textAlign="left";i.style.fontSize="9px";i.style.color="rgb("+b.mb.fg.r+","+b.mb.fg.g+","+b.mb.fg.b+")";i.style.margin="0px 0px 1px 3px";i.innerHTML='<span style="font-weight:bold">MB</span>';
-h.appendChild(i);a=document.createElement("canvas");a.width=74;a.height=30;a.style.display="block";a.style.marginLeft="3px";h.appendChild(a);q=a.getContext("2d");q.fillStyle="#301010";q.fillRect(0,0,a.width,a.height);E=q.getImageData(0,0,a.width,a.height);return{domElement:g,update:function(){u++;j=(new Date).getTime();n=j-F;z=Math.min(z,n);A=Math.max(A,n);s(B.data,Math.min(30,30-n/200*30),"ms");c.innerHTML='<span style="font-weight:bold">'+n+" MS</span> ("+z+"-"+A+")";o.putImageData(B,0,0);F=j;if(j>
-v+1E3){l=Math.round(u*1E3/(j-v));w=Math.min(w,l);x=Math.max(x,l);s(y.data,Math.min(30,30-l/100*30),"fps");d.innerHTML='<span style="font-weight:bold">'+l+" FPS</span> ("+w+"-"+x+")";m.putImageData(y,0,0);if(t==3)p=performance.memory.usedJSHeapSize*9.54E-7,C=Math.min(C,p),D=Math.max(D,p),s(E.data,Math.min(30,30-p/2),"mb"),i.innerHTML='<span style="font-weight:bold">'+Math.round(p)+" MB</span> ("+Math.round(C)+"-"+Math.round(D)+")",q.putImageData(E,0,0);v=j;u=0}}}};
+h.appendChild(i);a=document.createElement("canvas");a.width=74;a.height=30;a.style.display="block";a.style.marginLeft="3px";h.appendChild(a);q=a.getContext("2d");q.fillStyle="#301010";q.fillRect(0,0,a.width,a.height);E=q.getImageData(0,0,a.width,a.height);return{domElement:g,update:function(){u++;j=Date.now();n=j-F;z=Math.min(z,n);A=Math.max(A,n);s(B.data,Math.min(30,30-n/200*30),"ms");c.innerHTML='<span style="font-weight:bold">'+n+" MS</span> ("+z+"-"+A+")";o.putImageData(B,0,0);F=j;if(j>v+1E3){l=
+Math.round(u*1E3/(j-v));w=Math.min(w,l);x=Math.max(x,l);s(y.data,Math.min(30,30-l/100*30),"fps");d.innerHTML='<span style="font-weight:bold">'+l+" FPS</span> ("+w+"-"+x+")";m.putImageData(y,0,0);if(t==3)p=performance.memory.usedJSHeapSize*9.54E-7,C=Math.min(C,p),D=Math.max(D,p),s(E.data,Math.min(30,30-p/2),"mb"),i.innerHTML='<span style="font-weight:bold">'+Math.round(p)+" MB</span> ("+Math.round(C)+"-"+Math.round(D)+")",q.putImageData(E,0,0);v=j;u=0}}}};
 

+ 0 - 4904
examples/obj/WaltHead.js

@@ -1,4904 +0,0 @@
-// Generated with Blender 2.54 exporter
-// http://github.com/mrdoob/three.js/tree/master/utils/exporters/blender
-
-var WaltHead = function () {
-
-	var scope = this;
-
-	THREE.Geometry.call( this );
-
-	v( -18.816662, -3.880448, -10.115585 );
-	v( 18.958456, 12.065804, -2.187840 );
-	v( 12.674726, -7.119929, -22.527046 );
-	v( -17.882803, -6.895873, -6.259551 );
-	v( -3.639498, 9.475190, -33.899418 );
-	v( 11.643640, -25.413237, -20.183132 );
-	v( -17.469282, 26.948996, -24.085524 );
-	v( -10.066772, -15.760976, -21.168530 );
-	v( 6.404125, -32.577320, 1.711995 );
-	v( -18.303993, -0.302865, -20.281755 );
-	v( 12.864200, 34.387779, -5.902026 );
-	v( 3.041513, -16.639938, -24.447151 );
-	v( -7.402502, -20.237364, 10.585793 );
-	v( 5.362751, 31.833044, -27.518354 );
-	v( -8.923988, 32.430550, 6.558619 );
-	v( -0.455571, 12.079675, -34.196556 );
-	v( -5.272361, 37.818676, -5.178781 );
-	v( -18.781004, 11.218245, -26.386084 );
-	v( -3.474067, 37.695259, -0.064891 );
-	v( 6.947741, 33.654888, 5.977655 );
-	v( 17.160259, 0.615710, -23.053747 );
-	v( 9.022075, -24.965685, 0.923682 );
-	v( -9.078765, -10.937166, -22.741096 );
-	v( 15.659248, 31.974369, -17.494387 );
-	v( -3.261815, 24.856232, -32.255825 );
-	v( 18.324936, -5.925346, -14.193337 );
-	v( -8.941368, 21.857380, -32.430492 );
-	v( -19.294802, 1.315202, -8.689825 );
-	v( 5.937713, 8.776903, 11.925180 );
-	v( -5.902269, 20.074120, -33.288063 );
-	v( 15.481250, -26.839809, -9.750659 );
-	v( -12.742313, 20.945812, -31.660517 );
-	v( -10.231225, 28.835476, 9.019358 );
-	v( -18.231405, -5.816728, -7.182327 );
-	v( -1.093387, 37.288567, -21.130796 );
-	v( -2.872133, 3.717955, 16.853722 );
-	v( 13.426703, 34.777813, -10.899029 );
-	v( -10.942340, 14.242771, -32.930717 );
-	v( 11.891898, -9.302006, -22.646467 );
-	v( -20.428932, 1.400769, -12.119253 );
-	v( 19.289545, 3.295609, -4.185099 );
-	v( 8.879210, 26.248936, -30.551565 );
-	v( -8.605596, -38.705402, -27.114462 );
-	v( -21.175087, 16.982946, -21.493195 );
-	v( -19.618166, -2.313895, -15.797854 );
-	v( 21.690739, 13.187823, -20.964724 );
-	v( -2.456000, -5.262883, 16.294382 );
-	v( 22.821169, 15.994167, -14.340510 );
-	v( 0.862973, 8.111865, 17.185814 );
-	v( 10.454688, 5.336624, 13.027966 );
-	v( 21.614288, 7.311443, -17.032154 );
-	v( -1.448450, 39.460575, -10.121675 );
-	v( -20.016991, 14.156265, -5.226973 );
-	v( 3.347525, 27.958521, 13.068100 );
-	v( 5.600341, 35.817280, 2.855957 );
-	v( 0.047125, 36.122196, -22.729765 );
-	v( 1.177938, 30.979971, 12.648355 );
-	v( 1.980171, 37.931179, -3.469417 );
-	v( -11.418551, 22.608597, -31.816923 );
-	v( -5.217460, -9.142735, 14.546400 );
-	v( 18.451923, 30.246883, -8.690041 );
-	v( -3.670451, 8.005899, 11.738182 );
-	v( -2.787677, -36.203583, -27.729149 );
-	v( 5.922388, 28.765190, 11.794753 );
-	v( -3.341110, 32.596283, 10.554133 );
-	v( 18.330791, -0.305094, -8.116759 );
-	v( 3.974175, 4.953069, -33.109226 );
-	v( 20.710884, 5.464703, -8.434412 );
-	v( 3.813853, 36.842937, -0.009427 );
-	v( -13.392554, 32.052155, 0.823726 );
-	v( 19.316093, 7.238416, -4.061436 );
-	v( -17.435707, 16.248518, 1.526387 );
-	v( 5.058124, -22.827127, 9.362616 );
-	v( -15.197875, 11.643781, -30.426531 );
-	v( 3.768824, 7.617735, 11.545935 );
-	v( -6.738605, 34.099785, 5.391747 );
-	v( -3.362290, 12.632522, -34.590481 );
-	v( -0.013370, -8.599163, 16.810959 );
-	v( 5.002897, -12.976719, -24.586037 );
-	v( -12.826169, 34.628876, -17.653530 );
-	v( -16.599213, -3.745530, -20.198738 );
-	v( -17.945917, -0.640833, -8.904378 );
-	v( 22.188128, 24.185953, -10.666088 );
-	v( -15.247924, 24.866606, 2.749377 );
-	v( -2.048140, 7.105049, 15.058559 );
-	v( 4.720079, 24.805912, -32.418533 );
-	v( -21.043848, 9.173401, -17.388866 );
-	v( 2.454084, 12.618400, -34.429207 );
-	v( 11.847161, 34.015308, -2.452848 );
-	v( -18.157461, -2.646350, -19.545473 );
-	v( -18.461153, 0.193264, -4.018316 );
-	v( -16.871424, 30.839462, -8.375721 );
-	v( 15.763430, 31.494352, -10.822515 );
-	v( -7.188546, 32.372940, 7.327241 );
-	v( -17.181898, 26.093441, -3.148946 );
-	v( 8.645457, -15.523782, -22.049381 );
-	v( 5.721546, -6.073802, -27.029560 );
-	v( -9.681847, 27.673405, -29.942202 );
-	v( -9.714481, 31.070772, 7.048386 );
-	v( -1.676214, 1.564872, 20.192293 );
-	v( 14.074705, -10.850216, -19.201996 );
-	v( 19.643091, 6.311263, -10.094257 );
-	v( 6.379312, 38.288845, -12.866659 );
-	v( -19.475077, 27.138483, -16.264244 );
-	v( -15.961674, 32.521221, -11.726517 );
-	v( 15.420324, 25.342802, -27.623856 );
-	v( 15.042516, -17.907784, -8.792198 );
-	v( 14.949063, -11.833417, -18.471127 );
-	v( 8.621998, 8.309331, -32.312260 );
-	v( -21.004183, 7.650711, -19.389988 );
-	v( -19.966482, 10.790385, -5.297484 );
-	v( -4.942443, 7.815156, 11.314488 );
-	v( -15.136695, 4.224939, -28.028601 );
-	v( -5.491560, 8.449439, 11.664763 );
-	v( 7.991508, -7.179295, -25.659355 );
-	v( -17.644712, -6.483935, -17.460665 );
-	v( -13.949796, -2.068530, -24.386738 );
-	v( 8.075753, -4.044122, 14.648128 );
-	v( -10.386785, -8.101889, -23.042032 );
-	v( -18.861805, 24.414543, -6.952589 );
-	v( 23.438578, 8.885136, -14.540868 );
-	v( 2.239061, -0.618657, -30.931664 );
-	v( -3.507920, -3.140705, 17.708027 );
-	v( -19.908381, 7.159772, -6.981973 );
-	v( -23.881714, 5.231915, -14.467689 );
-	v( -14.962375, 27.067177, -26.765543 );
-	v( 4.699048, 38.548801, -15.849188 );
-	v( 1.068360, 37.533558, -20.626852 );
-	v( 1.844547, -2.755424, 18.351137 );
-	v( 22.729555, 18.101486, -11.403961 );
-	v( -6.818285, 29.470655, 11.433627 );
-	v( -12.913974, -2.685551, 12.462117 );
-	v( -16.433268, 17.975607, -29.470524 );
-	v( 13.416026, -30.016226, -4.816977 );
-	v( -3.338719, 34.524704, 7.330359 );
-	v( 14.910599, 10.901832, 11.219317 );
-	v( 9.483152, -12.766809, -22.763428 );
-	v( 22.429159, 20.390253, -9.421107 );
-	v( 5.648261, -19.772242, 12.913698 );
-	v( 10.553308, 6.488127, 12.565063 );
-	v( -14.714425, -16.157700, 1.341050 );
-	v( 3.987203, -17.897884, -23.313921 );
-	v( 13.259490, 31.286594, 2.505383 );
-	v( -0.667219, 35.472622, 6.953111 );
-	v( -19.588255, 6.890866, -8.893118 );
-	v( 1.942260, -11.436696, 15.267141 );
-	v( -19.126015, -6.737482, -7.563005 );
-	v( 10.414764, 28.378336, -29.341837 );
-	v( 10.617455, 7.354539, 11.190595 );
-	v( 18.312931, 13.633304, -1.181165 );
-	v( 5.517900, 36.747978, -2.041831 );
-	v( 5.721482, 2.077158, 14.963911 );
-	v( 6.138168, 13.222869, -34.204018 );
-	v( 18.781506, 1.145702, -10.278375 );
-	v( -2.070330, 38.513103, -5.620981 );
-	v( 14.815893, -13.731286, -17.862768 );
-	v( 14.643173, -12.932523, -18.524134 );
-	v( 10.230628, 28.581413, 8.627031 );
-	v( 18.509916, 1.343679, -4.188692 );
-	v( 20.029663, 17.235041, -23.672781 );
-	v( -18.366323, 1.650237, -21.785501 );
-	v( -2.692746, 36.125343, -22.474285 );
-	v( 13.529036, 31.559044, -23.930830 );
-	v( 8.790145, 16.455984, -33.117405 );
-	v( 17.965839, -0.704878, -8.734382 );
-	v( 6.308074, -15.006527, -23.480240 );
-	v( 20.247185, -1.869697, -10.412133 );
-	v( 12.967183, 8.321918, 11.628012 );
-	v( 17.039291, 21.416586, 0.998327 );
-	v( 8.166959, 21.792788, -32.848824 );
-	v( 1.036000, -31.253820, 4.278697 );
-	v( -18.876844, 12.053692, -2.665714 );
-	v( 20.260469, 9.264978, -8.561378 );
-	v( 8.654284, -12.879671, 11.861096 );
-	v( -8.022457, -18.925367, 11.907701 );
-	v( 12.059596, -8.259976, 11.123863 );
-	v( 11.292396, -2.152657, -26.399471 );
-	v( -10.764818, -11.015491, 11.230894 );
-	v( -2.815954, -24.495403, 8.909425 );
-	v( 26.546959, -37.059475, -11.127018 );
-	v( -10.338653, 35.032639, -3.888894 );
-	v( -20.237896, 18.700117, -8.625983 );
-	v( -3.393085, -19.579350, 15.108326 );
-	v( 22.664875, 9.225505, -9.301368 );
-	v( 12.494052, -5.904170, -24.382757 );
-	v( 5.302708, 38.010429, -11.353151 );
-	v( 19.916769, 7.235552, -9.400819 );
-	v( -20.104191, 6.483746, -21.982637 );
-	v( 11.107834, -21.730402, -0.616694 );
-	v( 6.327585, -9.009482, 11.343014 );
-	v( 14.947588, 3.668590, 9.945616 );
-	v( 7.563215, 0.579489, -29.903061 );
-	v( -1.924996, 31.269863, -28.807440 );
-	v( 13.277797, -9.579840, -20.543142 );
-	v( 8.865472, 33.290333, 4.794972 );
-	v( 19.300411, 2.276903, -8.915751 );
-	v( 20.310360, 3.703880, -20.103689 );
-	v( 18.745342, -3.822350, -10.122085 );
-	v( -10.240969, -13.916193, -21.498631 );
-	v( -8.407096, -24.107874, 2.027095 );
-	v( 6.338325, 6.983025, 12.962456 );
-	v( 5.227600, 6.136928, 12.118742 );
-	v( -18.627663, 28.753716, -9.995500 );
-	v( 17.006666, 20.236317, -28.889273 );
-	v( 1.799008, 31.313999, -28.707989 );
-	v( 3.221123, 8.513749, -34.026760 );
-	v( -2.691430, 27.814102, 13.337247 );
-	v( 4.867302, -0.054398, 15.830140 );
-	v( -16.854939, -8.758916, -16.705873 );
-	v( 9.899065, -16.356146, -20.711107 );
-	v( 5.140113, -2.062304, -29.661339 );
-	v( -7.438706, 13.431634, 14.838306 );
-	v( 18.254869, 4.337179, -23.386982 );
-	v( 13.352486, 33.985432, -19.621435 );
-	v( -17.701767, -33.821785, -6.708461 );
-	v( 5.316873, 37.222919, -7.552699 );
-	v( 18.798971, 26.461636, -23.198956 );
-	v( -19.396444, 3.509094, -12.841658 );
-	v( 22.398283, -38.740387, -6.509130 );
-	v( 0.832755, 39.828812, -14.498663 );
-	v( 10.251532, 9.587239, 13.600855 );
-	v( 8.536660, 27.718767, 10.967896 );
-	v( -10.368087, -6.424629, -24.058929 );
-	v( -16.268297, -11.918391, -8.979985 );
-	v( -18.675850, 22.262251, -25.861301 );
-	v( 19.934711, 1.061369, -15.275497 );
-	v( 5.966986, 31.315348, 9.680036 );
-	v( -3.627211, 36.099907, -22.520596 );
-	v( -18.665165, 4.262876, -2.829721 );
-	v( -9.929131, -23.033934, -21.080776 );
-	v( -5.839284, 10.003031, 13.034307 );
-	v( -7.728970, 34.899212, 3.100553 );
-	v( 1.558976, 4.729866, 18.831747 );
-	v( 18.529749, 4.198383, -2.718761 );
-	v( -7.631768, 9.694545, -33.637577 );
-	v( -8.925184, -7.383317, 12.551436 );
-	v( 17.990828, -5.512774, -9.923241 );
-	v( 10.068479, 8.665810, 13.074466 );
-	v( -6.007976, 38.213829, -10.205353 );
-	v( -22.436502, 8.286990, -11.892804 );
-	v( -6.063328, -13.944791, -23.787991 );
-	v( -11.743351, -37.583282, 0.172168 );
-	v( -1.536825, -10.304841, -26.627195 );
-	v( 24.010120, 8.786939, -14.191447 );
-	v( 15.743752, 8.111481, 8.585656 );
-	v( 0.032954, -21.561201, 14.409829 );
-	v( -16.885469, 8.797447, -27.434544 );
-	v( -6.553394, -7.243619, 13.900229 );
-	v( -2.813720, -11.871748, -25.702608 );
-	v( -20.419456, 23.353695, -15.528955 );
-	v( 19.486759, 16.819250, -25.543434 );
-	v( -8.809914, -1.504391, 15.120944 );
-	v( 3.227660, 4.230711, 15.613068 );
-	v( -15.452552, -31.203575, -19.319851 );
-	v( 15.907557, 30.614393, -5.447159 );
-	v( -3.471049, 28.809179, 12.914889 );
-	v( -9.973167, 27.554832, 9.797172 );
-	v( 16.538284, 6.051229, -26.257214 );
-	v( 2.354117, -15.261077, -24.854597 );
-	v( 14.284703, 25.151529, -28.852686 );
-	v( 3.954357, -14.472802, -24.909832 );
-	v( 18.520802, 7.506063, -1.604300 );
-	v( 7.859302, -21.984949, 6.828413 );
-	v( 1.581128, 24.123346, 15.852511 );
-	v( 5.166008, 26.001991, -31.962200 );
-	v( -18.412313, 21.089283, -4.300146 );
-	v( -10.273482, 5.069659, 13.199324 );
-	v( -5.103615, 22.774111, -32.807896 );
-	v( -13.038474, -7.446425, 10.640604 );
-	v( 0.249931, -2.807661, -30.675880 );
-	v( -18.612907, -4.330508, -17.750122 );
-	v( 3.219594, -18.194675, -23.796690 );
-	v( -17.711573, -7.771342, -15.580720 );
-	v( -17.792934, 14.021228, 0.500208 );
-	v( -1.466586, 39.242893, -16.325634 );
-	v( 18.320831, 0.742128, -3.264307 );
-	v( -5.970832, 0.747337, -31.122978 );
-	v( -11.491835, -13.645896, -21.128103 );
-	v( -8.504622, -31.585133, 0.160557 );
-	v( -7.192654, -13.765970, -23.417248 );
-	v( 3.124401, -20.940632, 14.445673 );
-	v( 15.476992, -11.946816, -17.315588 );
-	v( -0.358223, 24.252979, -32.579163 );
-	v( -22.961170, 10.076506, -10.448576 );
-	v( 17.992973, 29.104696, -19.676584 );
-	v( -11.180223, 33.025795, -23.741522 );
-	v( -1.894617, 22.401222, -33.031906 );
-	v( 3.870523, 11.019651, 14.973008 );
-	v( 11.353889, 23.196341, -31.565569 );
-	v( 7.724480, 18.596567, 15.383348 );
-	v( -11.509044, 28.276302, 7.908655 );
-	v( 20.713732, 7.830587, -21.998466 );
-	v( -12.073894, -14.396411, -20.360823 );
-	v( 2.350767, -5.103801, 16.373985 );
-	v( -13.486360, -18.776278, -0.361583 );
-	v( -12.095983, 16.991343, -32.656090 );
-	v( -20.797396, 21.451332, -21.344637 );
-	v( 13.136288, 11.506346, -31.512360 );
-	v( 2.920549, 35.681976, -23.506166 );
-	v( 0.792453, 36.004040, 6.021944 );
-	v( -19.256275, 24.842613, -21.331888 );
-	v( -19.286385, 5.895816, -11.073758 );
-	v( 11.708231, -37.681835, 0.262440 );
-	v( 2.486208, 1.999725, -31.983521 );
-	v( -0.785955, 4.208503, 19.854025 );
-	v( 20.351103, 10.554275, -8.086557 );
-	v( -18.707001, 9.446022, -25.990555 );
-	v( -7.306243, -7.251437, -25.627478 );
-	v( 4.672279, 8.268456, 12.098285 );
-	v( -0.839195, 18.640425, -34.106518 );
-	v( 18.030378, 2.346051, -2.730752 );
-	v( -7.107304, -8.660408, 11.149893 );
-	v( 3.884731, -31.052017, 2.565150 );
-	v( -16.701689, 20.138536, 1.661319 );
-	v( -2.774518, 8.060555, 12.494084 );
-	v( 18.307116, 28.034559, -4.715839 );
-	v( 23.031988, 13.489379, -15.456830 );
-	v( 14.824472, 31.281656, -22.299591 );
-	v( -4.795480, -1.824934, 15.323916 );
-	v( -1.072538, -6.718691, -27.684956 );
-	v( -13.203883, -11.789421, -20.404604 );
-	v( 17.223597, -5.455388, 1.561120 );
-	v( 20.317636, 26.003529, -6.322081 );
-	v( -12.940574, 5.282750, 11.613551 );
-	v( -16.042793, -28.761311, -13.065957 );
-	v( 4.372231, 33.146675, -25.915932 );
-	v( -0.882046, 37.717361, 0.449141 );
-	v( -12.944102, 0.105411, -26.272085 );
-	v( -19.136467, 18.647383, -4.467870 );
-	v( 2.816994, 22.204788, 15.962778 );
-	v( -14.778154, 8.503056, 10.237614 );
-	v( 17.347452, -4.015379, -6.472907 );
-	v( -0.893034, 29.965187, -29.897589 );
-	v( 13.576096, -11.703602, 6.901348 );
-	v( 21.310266, 21.987555, -16.729544 );
-	v( 6.837875, -11.825275, -24.259935 );
-	v( -3.811690, 16.830044, -34.270866 );
-	v( 8.966127, -7.156338, 12.603699 );
-	v( 1.340604, 39.453308, -9.830643 );
-	v( -23.809731, 8.876225, -13.086140 );
-	v( -19.997242, -1.046804, -13.057663 );
-	v( -0.650202, -5.849086, 17.099939 );
-	v( 0.910996, -1.022183, 22.368399 );
-	v( -3.494323, 3.473969, -32.963501 );
-	v( -5.324211, -9.773880, 11.586444 );
-	v( -2.804722, -8.913066, 13.635311 );
-	v( -18.432611, 13.147697, -1.461822 );
-	v( -19.450172, 20.450636, -24.211714 );
-	v( -8.049991, -4.990980, 13.831670 );
-	v( 0.334670, -10.973475, 14.614079 );
-	v( 0.413740, -13.413497, -25.505299 );
-	v( -14.798495, 10.648717, 11.204966 );
-	v( -0.958008, 25.842409, -32.187428 );
-	v( -5.596221, 9.026673, 12.885890 );
-	v( 7.771744, -16.588398, -21.914963 );
-	v( -5.366093, 38.848961, -14.501711 );
-	v( -19.451496, 5.862583, -7.510460 );
-	v( -0.844661, 38.806664, -3.644385 );
-	v( -8.599619, -14.818768, -21.948601 );
-	v( -6.736567, -11.506135, 12.343977 );
-	v( 10.614676, -11.730759, -22.377844 );
-	v( 4.126297, 35.422234, 5.128168 );
-	v( 5.635489, 21.571707, -33.097858 );
-	v( 18.503628, -1.167822, -8.435214 );
-	v( -23.414070, 9.622474, -11.112185 );
-	v( -3.092004, -15.270815, 14.751884 );
-	v( -0.859135, 30.027428, 13.184561 );
-	v( -10.503575, 7.311587, -31.524906 );
-	v( 16.764130, 31.519764, -13.925138 );
-	v( -16.388935, -10.549815, -16.588400 );
-	v( -17.267124, -6.341223, 1.149670 );
-	v( 0.601870, 3.156377, -33.113754 );
-	v( 8.391978, 37.644119, -16.751362 );
-	v( 21.292591, 21.529730, -18.499044 );
-	v( -4.434434, 34.415142, 7.668014 );
-	v( -16.437193, -10.539788, -7.533751 );
-	v( 3.022695, -11.109606, 12.937231 );
-	v( -14.377371, -23.692774, -7.788178 );
-	v( -11.067874, -14.926955, -21.322250 );
-	v( -19.596758, 27.238586, -18.563532 );
-	v( 18.300518, 15.887071, -1.286853 );
-	v( -2.571345, 37.963833, -5.070292 );
-	v( 7.818554, -4.805766, 14.016296 );
-	v( -10.634580, 7.377426, 11.201793 );
-	v( -5.746288, -17.968157, 13.448761 );
-	v( -17.348555, -8.993640, -13.534918 );
-	v( 10.417915, 0.708839, -28.753546 );
-	v( -11.712300, 0.655628, -28.005964 );
-	v( 4.894942, 29.471428, 11.948977 );
-	v( -6.617682, 12.514933, -33.950775 );
-	v( 2.356898, 24.460438, -32.576359 );
-	v( -21.722649, -2.522170, -13.223949 );
-	v( -13.176407, -38.750103, -0.588378 );
-	v( -2.922572, 28.335491, -30.589962 );
-	v( 2.434784, -2.448547, 18.317314 );
-	v( 6.655896, -9.090648, 13.307002 );
-	v( 18.944481, 8.537322, -24.356138 );
-	v( -5.990590, -24.761797, -23.423340 );
-	v( 6.895056, 32.357475, 8.041165 );
-	v( 15.417950, 6.060811, 8.876429 );
-	v( 15.350152, -5.150654, -20.266521 );
-	v( 7.808065, 32.937778, -25.750204 );
-	v( -20.833044, 15.869375, -12.793961 );
-	v( 20.884041, 0.915655, -12.192612 );
-	v( -14.772290, 4.064702, 10.430466 );
-	v( -11.495231, 7.312611, 11.609257 );
-	v( -10.671483, -2.492834, 14.305265 );
-	v( -9.465286, -2.094819, -27.348768 );
-	v( -16.585596, 31.790373, -17.169838 );
-	v( -11.143855, 32.571487, 4.104543 );
-	v( -13.408435, 15.774970, 12.171854 );
-	v( -1.571844, 9.745562, 16.185280 );
-	v( 22.529621, 6.049608, -12.731555 );
-	v( 11.712675, -4.213558, 13.055173 );
-	v( -22.103642, 1.551893, -14.204457 );
-	v( 3.386515, 14.365797, 16.450352 );
-	v( -14.613495, -18.345476, -5.515490 );
-	v( 15.165809, 22.705797, -30.010416 );
-	v( -4.178857, -13.947650, -25.024046 );
-	v( 6.217735, -8.369081, 14.144401 );
-	v( -3.945579, 4.178056, 14.912292 );
-	v( 10.284834, 2.425100, 13.771741 );
-	v( 22.616329, 18.614218, -15.744782 );
-	v( -14.501657, -5.796948, -21.607960 );
-	v( 1.800868, 16.911493, -34.042610 );
-	v( 12.815376, -10.396903, -21.136410 );
-	v( -7.640938, -0.370497, -29.237757 );
-	v( -7.411525, 23.595175, -32.511093 );
-	v( 2.020134, 35.164928, 6.854408 );
-	v( 14.411350, 15.941202, -31.318083 );
-	v( 10.361184, 9.217117, 13.135988 );
-	v( 8.024242, 34.203514, 4.274137 );
-	v( 11.554979, 13.969478, 14.442498 );
-	v( -13.325786, 26.453379, -29.190527 );
-	v( 0.079577, -3.968560, 22.040087 );
-	v( -11.253266, 35.391907, -8.716005 );
-	v( 12.366002, 5.674292, 11.596753 );
-	v( -20.888233, 10.223351, -22.562510 );
-	v( -20.158880, -4.600521, -11.877638 );
-	v( -14.013289, 27.341087, 4.299769 );
-	v( -5.724288, 37.350685, -18.774536 );
-	v( 22.128090, 15.666739, -19.009310 );
-	v( 16.867476, -3.929799, -19.793468 );
-	v( 4.259152, 32.477505, 9.762962 );
-	v( -1.719764, 36.031616, -22.529148 );
-	v( -0.159584, 18.928951, 16.924000 );
-	v( -3.137136, -14.049209, -24.888811 );
-	v( -13.784145, 12.546710, -31.451849 );
-	v( 0.181536, -8.965255, 14.481634 );
-	v( -19.292673, 2.507145, -8.765950 );
-	v( -5.965209, 15.477917, -33.792313 );
-	v( -18.992718, 6.416687, -4.027552 );
-	v( 11.962729, 35.481613, -8.000100 );
-	v( -16.394550, -12.148507, -14.602634 );
-	v( 11.851256, 4.659349, 12.601248 );
-	v( -12.444849, 35.612103, -15.032160 );
-	v( -5.053519, -14.438246, -24.111362 );
-	v( 0.029658, 39.068451, -8.447277 );
-	v( -15.998647, 0.254567, -23.575747 );
-	v( 17.670748, -7.413315, -3.552644 );
-	v( 12.113276, 25.484627, -30.197102 );
-	v( -9.911300, -17.289349, 10.276932 );
-	v( -16.036390, -11.789593, -15.928417 );
-	v( 2.593775, -3.485932, 18.968590 );
-	v( 15.029546, -19.213264, -15.567778 );
-	v( -8.148560, 36.410065, -6.683936 );
-	v( 2.568009, -26.954422, 5.700367 );
-	v( 8.941236, -4.280229, -27.353300 );
-	v( 3.416759, -18.824183, 15.084010 );
-	v( -3.650165, 8.675720, 12.125645 );
-	v( 1.215877, -7.362568, -27.542009 );
-	v( -21.000273, -1.486005, -14.700644 );
-	v( 18.386019, 13.233971, -26.874786 );
-	v( 12.190842, 4.204062, -29.587437 );
-	v( -9.696788, 25.090721, 12.337378 );
-	v( -15.891078, -12.970400, -13.303573 );
-	v( 3.086883, -0.516378, 17.260426 );
-	v( 22.191442, 7.798663, -19.723934 );
-	v( -26.936266, -37.035480, -13.925433 );
-	v( -0.358173, -14.278829, -25.153046 );
-	v( 11.670615, 33.422474, 1.325098 );
-	v( 15.476934, -14.469459, -8.937884 );
-	v( -12.059288, 18.463043, 12.971856 );
-	v( 20.293001, 14.562932, -22.711411 );
-	v( -13.682425, -3.934636, -22.790846 );
-	v( 19.477789, 3.012443, -10.573275 );
-	v( -8.400423, -16.347610, -21.357506 );
-	v( 14.124824, -29.967653, -20.223892 );
-	v( 20.266014, -33.073830, -10.724751 );
-	v( 15.903128, 16.751892, -30.006180 );
-	v( 18.279991, 8.911856, -26.688734 );
-	v( 10.189030, -14.896798, -21.551441 );
-	v( -8.556614, 29.854542, 9.637665 );
-	v( 14.636503, -15.925914, 1.923531 );
-	v( -6.126723, -36.677467, -27.420700 );
-	v( 16.381851, -10.908326, -7.434034 );
-	v( 13.386578, 6.551725, 10.520692 );
-	v( -14.727916, 34.467316, -17.036263 );
-	v( -21.448565, 19.083096, -16.060204 );
-	v( -11.881432, 25.680967, 8.900921 );
-	v( -23.331411, 5.235337, -15.603097 );
-	v( 16.509251, -8.851545, -17.253185 );
-	v( 21.760853, -2.411157, -13.471418 );
-	v( 22.056650, -0.075988, -14.144598 );
-	v( -21.726473, 4.295543, -14.735403 );
-	v( 15.325342, 0.753686, -23.772923 );
-	v( 19.634068, 5.661705, -11.019146 );
-	v( -13.624856, 29.860170, -26.144363 );
-	v( 17.857464, 16.542152, -0.040953 );
-	v( -0.228021, -24.323935, 10.327634 );
-	v( 7.031702, -3.225253, -27.767313 );
-	v( 9.363544, 22.729584, -32.146809 );
-	v( 16.058163, 31.115644, -8.892967 );
-	v( -6.338274, -8.517593, -25.483496 );
-	v( 23.494501, 10.146656, -12.539031 );
-	v( -10.365627, 6.909743, 12.676841 );
-	v( -1.209964, -9.660230, 15.111232 );
-	v( 18.654289, -2.683949, -8.413553 );
-	v( -15.123187, -14.030602, -4.614971 );
-	v( 13.450309, 3.421218, 11.945930 );
-	v( -3.517838, -0.361090, 16.686562 );
-	v( 9.110709, -23.478447, 1.484359 );
-	v( 15.971836, 31.969404, -15.812030 );
-	v( -18.244772, 4.332152, -23.219505 );
-	v( -5.170644, 14.311861, 16.129932 );
-	v( -18.151665, 0.202903, -5.375785 );
-	v( -6.431614, 36.614647, -3.253130 );
-	v( -20.199789, 22.068176, -11.810157 );
-	v( 22.787983, 9.655866, -13.263790 );
-	v( -7.645881, -8.740596, 12.417969 );
-	v( -16.105082, 4.579574, -25.999905 );
-	v( -15.600340, 32.075813, -6.604448 );
-	v( 9.870911, -6.768884, 12.114162 );
-	v( -3.822123, 18.985575, -33.726044 );
-	v( -11.723969, -28.002275, -21.202297 );
-	v( -5.362088, -16.670540, -23.571198 );
-	v( -3.447748, 14.425903, 16.456268 );
-	v( -16.574518, -11.324142, -14.063821 );
-	v( -24.113415, 9.510228, -13.910695 );
-	v( -24.054264, 5.401500, -15.051400 );
-	v( 9.850148, 31.180914, 6.390637 );
-	v( 3.197115, 37.561184, -1.802485 );
-	v( -2.101807, -3.936622, 19.585646 );
-	v( -16.013149, 6.798697, 7.706793 );
-	v( 20.753016, 24.762957, -8.392618 );
-	v( 19.276892, -3.423407, -14.664151 );
-	v( -1.301209, 31.618790, 11.719973 );
-	v( -6.332655, 35.097874, -22.793209 );
-	v( 0.232011, -15.974673, -25.334061 );
-	v( 14.238820, -16.769026, -1.092540 );
-	v( 2.430024, -8.473277, 16.289654 );
-	v( 8.978591, -38.732994, -27.038488 );
-	v( -14.559512, 26.916225, 3.220529 );
-	v( -18.771372, 4.517636, -4.443710 );
-	v( 3.422370, 31.487385, 11.398082 );
-	v( 13.495991, -2.529658, 11.819325 );
-	v( -16.089083, 16.887728, 4.621693 );
-	v( 17.841116, -7.441301, -12.828790 );
-	v( -6.255738, 11.248628, 14.271753 );
-	v( -20.784479, 22.948572, -18.578287 );
-	v( 0.861909, -33.186855, 3.805009 );
-	v( -9.681784, -19.850763, 9.135300 );
-	v( 22.775896, 9.311200, -17.779001 );
-	v( -20.574615, -0.320947, -10.435880 );
-	v( -9.543663, -38.720261, 2.483447 );
-	v( 14.624421, -17.987530, -5.649124 );
-	v( 27.045082, -36.941422, -13.198208 );
-	v( -3.005653, 34.008675, -25.722454 );
-	v( -15.324303, -12.243374, -17.087776 );
-	v( 20.912449, 16.629744, -20.558163 );
-	v( 19.490877, -1.810401, -8.826288 );
-	v( -8.236867, -4.333489, 14.459273 );
-	v( 0.186899, -9.548642, 16.352062 );
-	v( 27.951006, -38.784321, -11.496041 );
-	v( -16.627134, 16.296909, -29.542673 );
-	v( 21.701128, 27.237003, -13.594783 );
-	v( -12.548047, 14.060637, 13.592550 );
-	v( -18.971491, 24.225258, -24.200998 );
-	v( -19.414145, 5.763247, -11.137609 );
-	v( -0.147599, -28.518391, -24.996078 );
-	v( 6.987834, 2.200067, -30.555466 );
-	v( -2.370873, -16.008770, -24.941782 );
-	v( -9.793505, -14.900449, 11.286848 );
-	v( 4.416914, 7.897221, 11.745584 );
-	v( -16.119974, 27.062643, -0.693616 );
-	v( 17.644238, -3.643609, -7.212206 );
-	v( -9.168462, 3.511289, -30.560974 );
-	v( 21.631746, 8.847368, -8.767722 );
-	v( -15.525004, 33.286823, -14.364109 );
-	v( -23.261999, 9.408639, -14.001926 );
-	v( 10.465778, 23.918493, -31.246077 );
-	v( -18.314817, 0.349116, -7.657389 );
-	v( -13.711175, -28.570383, -5.542438 );
-	v( -12.408353, -24.277388, -19.436611 );
-	v( 4.770248, 36.586620, 1.503027 );
-	v( -2.783614, -17.957294, -24.047516 );
-	v( -7.473007, 36.241402, -1.345532 );
-	v( -20.959696, 9.170413, -8.953716 );
-	v( -14.524216, 19.786474, -31.550335 );
-	v( 20.674139, 4.591986, -15.942266 );
-	v( 1.142231, 13.356668, -34.424088 );
-	v( 17.947796, -0.861276, -1.658820 );
-	v( 6.293817, 15.533614, -33.956005 );
-	v( 19.450291, -1.462628, -12.878267 );
-	v( 3.519325, 19.398565, -33.656349 );
-	v( 4.003340, 38.558853, -14.839564 );
-	v( -8.433308, 4.617796, -30.832142 );
-	v( 19.037613, 21.328938, -25.266182 );
-	v( 20.654852, 27.531530, -8.689099 );
-	v( -19.252081, 14.773630, -25.140093 );
-	v( -9.158986, -24.684296, 0.872071 );
-	v( -10.273663, 34.638748, 0.482579 );
-	v( 19.313574, 14.141499, -3.921005 );
-	v( -2.552728, 33.073345, 9.888698 );
-	v( 4.621080, -1.352997, 15.458866 );
-	v( 20.196983, 9.482792, -6.489136 );
-	v( -0.272321, -3.123801, -29.997999 );
-	v( -2.125412, 5.947194, -33.574356 );
-	v( 9.775473, -17.434523, 10.195981 );
-	v( 10.125034, -4.642425, -26.336885 );
-	v( -5.984779, 6.667872, -33.095371 );
-	v( 1.010950, -0.239497, -31.713671 );
-	v( -17.529408, 22.982845, -1.493723 );
-	v( -9.864725, -33.275707, -24.874363 );
-	v( -20.546890, 14.777456, -15.707548 );
-	v( -6.482632, 32.374565, -27.008244 );
-	v( 11.363149, -13.776311, -21.207169 );
-	v( 20.511053, 26.621183, -18.896061 );
-	v( 16.517687, -11.854975, -15.500041 );
-	v( 1.296520, -13.813030, -25.740253 );
-	v( -19.418236, -0.997586, -13.241908 );
-	v( 10.959566, 11.433672, -32.981647 );
-	v( -1.506257, 36.833027, 3.910569 );
-	v( -20.219727, -5.727971, -7.521794 );
-	v( -18.985016, 9.117134, -3.295819 );
-	v( 20.991760, 3.414414, -14.033223 );
-	v( -16.386358, 28.833923, -22.504381 );
-	v( 8.740319, 10.670967, -33.025696 );
-	v( 10.137969, -29.319103, -22.883974 );
-	v( 15.973921, -12.007726, -16.644468 );
-	v( 12.711205, -17.114124, 6.134109 );
-	v( 13.357918, -14.232307, -19.633121 );
-	v( -13.847966, -17.483545, 0.256476 );
-	v( -28.213554, -38.705776, -14.107981 );
-	v( -15.307509, -9.896718, -18.393070 );
-	v( 6.089095, 9.095345, 13.077194 );
-	v( -16.512550, 4.060312, 6.889093 );
-	v( 20.370556, 4.573563, -10.789926 );
-	v( -9.588260, 14.423506, -33.172638 );
-	v( -5.133477, 17.257339, 16.195580 );
-	v( -6.654673, 35.902393, 2.426847 );
-	v( -2.163870, -2.545937, 18.526098 );
-	v( 1.129339, -4.238429, 18.268726 );
-	v( 8.704103, -18.256758, 11.458172 );
-	v( -7.373489, 5.467982, -32.841976 );
-	v( 15.004438, 30.324228, -1.901792 );
-	v( -16.246889, -11.730118, -14.998434 );
-	v( -4.519145, 34.805897, 6.041218 );
-	v( 22.361624, 11.725249, -19.261753 );
-	v( 8.951278, -28.076807, 1.300491 );
-	v( 7.157876, 30.299829, 10.267398 );
-	v( 3.768899, 26.206182, -31.744432 );
-	v( 11.515308, 32.706692, -23.268387 );
-	v( -20.426714, -6.102609, -8.759480 );
-	v( 22.295410, 8.014428, -11.601352 );
-	v( -21.507244, -1.733012, -12.880448 );
-	v( 9.273619, 3.522345, -30.525305 );
-	v( 7.466572, -8.922486, 12.186581 );
-	v( -13.469638, -7.480302, -21.510502 );
-	v( -17.624855, 18.657883, -27.599436 );
-	v( -10.172997, 12.493537, -32.580063 );
-	v( 8.931150, 30.019600, 9.771101 );
-	v( 2.955670, 29.035309, -30.463482 );
-	v( -10.719643, 8.914827, 13.001098 );
-	v( -21.244289, 18.579741, -17.926085 );
-	v( -6.787887, 36.175331, -21.041521 );
-	v( -6.400861, -8.969801, 11.936182 );
-	v( -17.033123, -8.464751, -17.632147 );
-	v( 4.026830, -2.744934, 17.742905 );
-	v( 9.968966, -14.718270, 11.234716 );
-	v( -19.189472, -3.013658, -8.653461 );
-	v( -3.733505, 38.201706, -7.946112 );
-	v( 0.333294, -27.794909, 6.033033 );
-	v( 14.212033, 24.801268, 4.648129 );
-	v( -3.181364, 5.809597, 14.225185 );
-	v( 0.678468, 38.611710, -2.679947 );
-	v( 21.217405, 12.561516, -7.346483 );
-	v( 18.662395, 30.336388, -16.475956 );
-	v( 22.571743, 5.683198, -11.779865 );
-	v( -13.782176, -12.972561, -19.000835 );
-	v( 13.777309, -25.807249, -17.657486 );
-	v( -17.479565, -7.100070, -11.714659 );
-	v( 19.927858, 28.302046, -15.695522 );
-	v( -1.631960, -0.742028, -31.271696 );
-	v( -0.106561, -26.036751, 8.343969 );
-	v( -11.488056, 10.762650, -32.691109 );
-	v( -9.745552, 26.458963, -30.655787 );
-	v( 17.126625, 19.412569, 1.100920 );
-	v( -18.725142, 9.476734, -1.297591 );
-	v( -1.543088, 14.217612, -33.913349 );
-	v( 10.111286, 23.055761, 13.131800 );
-	v( -1.647281, -5.384294, -28.650320 );
-	v( -6.982071, -17.077713, 12.846863 );
-	v( 18.470676, -5.943015, -13.144910 );
-	v( 17.903482, -7.856528, -14.287448 );
-	v( -19.100132, 7.265802, -24.791039 );
-	v( 5.209950, 14.183383, 16.177782 );
-	v( 8.984738, 24.838232, -31.535074 );
-	v( 10.921396, 34.741211, -1.374944 );
-	v( 16.344065, 26.366558, -25.134020 );
-	v( -15.024154, -11.537567, -18.012873 );
-	v( 19.270857, 10.122332, -25.680183 );
-	v( -15.956582, 25.404978, -27.939713 );
-	v( -15.996638, -10.745148, -17.340488 );
-	v( 7.422536, 37.667210, -11.376863 );
-	v( 7.825755, 14.413933, 15.284963 );
-	v( 16.699526, -11.555702, -14.696713 );
-	v( 19.800371, 13.009376, -4.780870 );
-	v( 10.588607, -27.782507, -0.283490 );
-	v( 20.814928, 10.913723, -22.840353 );
-	v( 5.394186, -7.201754, 14.816227 );
-	v( 12.367867, 12.598051, -32.450390 );
-	v( -15.404299, -13.281948, -16.345161 );
-	v( -11.946494, -6.532536, -23.056942 );
-	v( -6.706421, -16.256275, -22.958954 );
-	v( 5.447788, 33.062809, 8.086021 );
-	v( -11.484616, -21.491144, -1.253351 );
-	v( 13.828681, 18.728573, 10.719773 );
-	v( -15.355693, -14.886091, -8.723867 );
-	v( -12.234290, -3.744271, -24.397736 );
-	v( -8.969208, 15.795086, -33.437878 );
-	v( -22.679661, 8.933960, -9.364549 );
-	v( 17.609842, 22.906719, -27.120087 );
-	v( -0.303545, 39.782555, -12.879370 );
-	v( 19.856749, 7.492174, -7.124638 );
-	v( -19.080156, 26.658764, -22.288992 );
-	v( -2.730916, -2.618508, 17.574663 );
-	v( -14.680966, 28.736586, -24.979931 );
-	v( -11.167240, 30.259523, -27.118080 );
-	v( 12.562448, 34.104523, -4.225063 );
-	v( -7.697493, 8.884591, 12.015552 );
-	v( -13.733665, 6.344109, 10.333847 );
-	v( -4.037092, -31.000311, 2.553878 );
-	v( 17.611210, -8.599712, -13.300550 );
-	v( 7.223596, 37.018871, -19.475544 );
-	v( -0.968391, -11.319051, -26.158705 );
-	v( -2.249142, -10.825541, 14.152306 );
-	v( 16.865961, -10.921697, -13.959792 );
-	v( -18.215248, 12.700157, -0.007362 );
-	v( 3.776437, 37.586815, -4.065113 );
-	v( 16.563961, -29.625679, -9.539537 );
-	v( -1.307547, 16.077442, -34.000084 );
-	v( 4.014997, -7.455191, 15.783721 );
-	v( -14.101798, 5.526867, 10.484271 );
-	v( 21.006996, 17.830799, -7.083214 );
-	v( -27.713350, -38.705029, -10.887294 );
-	v( -0.018098, -11.349480, 14.033246 );
-	v( 21.418413, 24.858345, -12.553449 );
-	v( 4.853167, -25.323795, -23.932413 );
-	v( 5.788838, -25.443937, 4.424475 );
-	v( -20.581709, -38.729778, -4.602102 );
-	v( 17.885618, 24.769670, -25.575197 );
-	v( -14.320149, -13.765033, -18.219728 );
-	v( -5.328629, -28.649433, 2.429399 );
-	v( -4.153399, -3.512543, 15.619699 );
-	v( 16.066118, 21.997057, 2.402653 );
-	v( -2.666650, -8.563588, 16.115751 );
-	v( 10.434582, 8.031874, 11.148070 );
-	v( -20.165533, 15.267429, -9.141418 );
-	v( -17.298706, -8.824307, -1.527539 );
-	v( -18.348967, -0.369075, -8.384522 );
-	v( 17.946018, 4.866089, -1.151952 );
-	v( -13.621463, -25.565714, -17.786255 );
-	v( 11.736013, 34.774490, -20.452291 );
-	v( -9.347232, 16.045046, 14.837901 );
-	v( 15.222328, 32.147141, -19.498901 );
-	v( 2.738789, 17.791779, -33.697201 );
-	v( 9.923684, 35.591156, -4.935314 );
-	v( -5.480423, -7.656672, 14.742525 );
-	v( -19.945879, 9.295211, -6.511621 );
-	v( -11.406518, 30.993164, 5.233822 );
-	v( -11.565948, 7.461398, 12.028799 );
-	v( 2.395684, -36.214409, -27.701406 );
-	v( 11.796850, -19.103806, 5.620827 );
-	v( 11.688127, -20.456453, 3.218235 );
-	v( -9.834376, 33.307957, -24.703226 );
-	v( -15.056447, -1.678446, 9.600363 );
-	v( 15.789726, 23.801697, 2.526438 );
-	v( 18.695232, 0.113561, -20.150026 );
-	v( -1.294820, 2.263705, -32.457520 );
-	v( 18.876652, 15.108738, -2.877087 );
-	v( -7.562133, 18.580191, -33.568096 );
-	v( -19.056396, -3.974434, -12.801454 );
-	v( 0.885274, 33.269783, 10.847790 );
-	v( 10.940498, 34.989773, -3.894761 );
-	v( 3.258011, 38.958576, -16.045971 );
-	v( -12.657019, 29.054899, 6.169075 );
-	v( 8.349043, 35.704517, -21.329510 );
-	v( -9.524557, 9.670505, 13.453251 );
-	v( 11.524426, 7.470247, 12.018660 );
-	v( 7.817819, 27.038097, -30.396311 );
-	v( -9.400941, 8.717136, 11.684609 );
-	v( -16.221405, 12.912794, -29.100363 );
-	v( -18.611868, 0.560873, -3.202610 );
-	v( 14.005000, 19.339741, -31.988338 );
-	v( 25.138502, -37.367313, -17.072973 );
-	v( -9.265471, 30.710119, -28.011663 );
-	v( 18.981472, 22.913191, -26.081242 );
-	v( 11.216091, 36.616211, -13.961988 );
-	v( -11.382385, 3.723639, -30.438089 );
-	v( -20.675623, 25.235159, -18.882874 );
-	v( -15.447675, -14.854251, -15.348229 );
-	v( 11.889514, 18.829838, 13.011670 );
-	v( -2.271111, 37.290230, 1.992046 );
-	v( 17.965168, 15.354152, 0.279655 );
-	v( -8.931271, 7.056231, 11.765785 );
-	v( -4.175147, 19.028505, 16.373346 );
-	v( 10.607088, -32.875496, -24.461826 );
-	v( 16.528849, -11.037654, -9.033813 );
-	v( -18.635841, 2.269797, -5.210743 );
-	v( 4.274585, 33.888020, 7.797203 );
-	v( 15.258462, -13.483568, -5.293646 );
-	v( -6.333829, 8.865394, 11.977741 );
-	v( -2.980681, -11.151649, 12.964733 );
-	v( 22.849110, 8.342940, -12.972965 );
-	v( 11.597674, 26.348686, 8.467032 );
-	v( -19.371498, 2.231516, -20.409554 );
-	v( -16.955568, 24.259314, -27.449934 );
-	v( -17.389128, 4.008832, 0.210687 );
-	v( 19.931396, 11.960688, -6.066440 );
-	v( -11.296464, 29.696985, 6.710881 );
-	v( 10.862308, 32.731884, 4.331602 );
-	v( -20.703568, 7.066743, -17.539284 );
-	v( 2.453275, 30.085741, -29.777794 );
-	v( 16.981628, 12.179296, -28.736813 );
-	v( 18.596348, 23.880428, -2.819987 );
-	v( -2.054216, -14.057529, -25.766174 );
-	v( -14.361510, -7.821543, -20.498505 );
-	v( -21.008211, 11.529037, -16.270668 );
-	v( -24.451199, -38.734020, -8.326618 );
-	v( 15.240563, 33.735039, -11.230363 );
-	v( 19.871136, 20.929306, -24.244762 );
-	v( 14.547556, 33.984070, -16.485626 );
-	v( -20.103819, 26.013800, -13.453460 );
-	v( 7.127073, 35.093815, 3.131126 );
-	v( 6.121594, -36.580788, 2.976956 );
-	v( 11.166437, -14.330754, 10.082873 );
-	v( -18.690315, 14.304849, -27.229755 );
-	v( 1.032583, -4.627894, 17.288181 );
-	v( -3.832294, -38.306625, -28.078438 );
-	v( -7.537552, 6.833131, 13.105495 );
-	v( 3.768452, -11.685031, -25.470325 );
-	v( 19.241972, 28.833176, -9.849078 );
-	v( 16.376089, -12.219020, -14.580949 );
-	v( 4.203556, -7.389892, -26.461061 );
-	v( -18.653475, -5.735794, -15.009197 );
-	v( -0.020827, 30.074116, -29.926455 );
-	v( -18.439928, -1.083612, -8.477003 );
-	v( -19.771576, 1.732367, -18.032476 );
-	v( -1.192909, -27.299128, 6.140399 );
-	v( -19.352259, 5.549572, -11.005151 );
-	v( -0.321401, -11.524933, 15.612473 );
-	v( -20.257151, 19.260433, -20.908632 );
-	v( 4.223601, 23.632570, -32.778931 );
-	v( 11.297009, 36.604511, -16.009253 );
-	v( 13.341240, 5.255798, 11.290738 );
-	v( -11.616902, -13.343565, 10.075046 );
-	v( 1.492960, 37.444641, 1.783653 );
-	v( 19.459009, 3.378399, -12.878041 );
-	v( -9.204462, 36.685570, -10.977292 );
-	v( -13.042532, 4.073293, -28.751945 );
-	v( 15.019143, 32.008205, -3.025494 );
-	v( 18.078560, 18.449097, -0.648923 );
-	v( -3.694405, -6.619770, 15.831586 );
-	v( 9.006701, -22.996834, -21.489420 );
-	v( 5.801758, 38.389664, -16.652082 );
-	v( -3.892634, -10.871112, -25.852398 );
-	v( -13.772098, -13.798667, 5.644798 );
-	v( 8.922184, -12.007494, -23.716982 );
-	v( -8.298477, 3.488005, 13.744875 );
-	v( -3.933658, 39.215294, -14.038996 );
-	v( 3.883984, 38.827469, -12.284558 );
-	v( 20.711267, 5.985665, -20.526846 );
-	v( -4.431885, 29.306204, -29.956617 );
-	v( 2.304023, -1.206889, 21.350533 );
-	v( 15.687893, 2.958753, -26.150331 );
-	v( -4.653062, -34.381229, 3.359435 );
-	v( -11.668932, 36.696583, -16.090408 );
-	v( 12.603155, 35.867836, -13.564306 );
-	v( -9.214283, 35.052219, -0.172894 );
-	v( 21.255959, 9.277270, -9.099693 );
-	v( 17.907890, -4.049341, -18.773220 );
-	v( 18.886826, -0.046328, -9.964272 );
-	v( 16.122936, 7.208469, -27.477570 );
-	v( 11.913315, 3.776886, 13.157198 );
-	v( 20.611704, -0.500230, -10.239202 );
-	v( -8.790718, -13.125836, 11.842323 );
-	v( -12.790116, -17.252861, 5.991421 );
-	v( 8.839424, 8.861396, 11.877912 );
-	v( -0.356275, -5.267551, -28.392534 );
-	v( 10.811642, 3.264122, -30.166298 );
-	v( 18.188923, 0.297712, -5.871736 );
-	v( -21.287798, 7.955898, -9.559799 );
-	v( -11.952576, -12.326191, -20.891264 );
-	v( 7.722816, 5.243110, 13.415051 );
-	v( -11.912081, -9.137630, -21.894850 );
-	v( -21.457308, 5.721539, -10.491649 );
-	v( -2.585875, -3.426381, 18.957945 );
-	v( 3.416183, -0.641717, -30.739227 );
-	v( -10.681212, 7.760293, 11.072550 );
-	v( -3.550879, -17.474056, -23.847792 );
-	v( 3.268688, -21.892506, 11.809720 );
-	v( -2.438532, 2.257546, -32.423672 );
-	v( 21.677389, 18.378134, -18.008856 );
-	v( 12.944044, 35.149982, -12.209032 );
-	v( -3.143844, -0.571241, 17.348907 );
-	v( -1.114946, -1.310728, 22.362478 );
-	v( 22.822681, -36.705376, -8.511171 );
-	v( -11.807717, 35.154346, -10.660616 );
-	v( -6.258196, 4.052921, 13.662416 );
-	v( -3.483670, 37.850430, -3.445360 );
-	v( 1.479705, 33.707703, 9.261839 );
-	v( 9.616396, 36.440598, -9.910774 );
-	v( 5.034667, -9.983241, 11.787515 );
-	v( 17.390745, 15.850007, 1.650188 );
-	v( 1.375903, -7.662729, 16.938181 );
-	v( -18.495289, 17.320040, -2.429648 );
-	v( 13.667064, -26.166197, -6.421552 );
-	v( 19.512718, 5.945833, -6.703884 );
-	v( 5.980192, -9.615155, 12.956648 );
-	v( 8.516705, 35.732128, -2.041147 );
-	v( -17.784920, -8.189692, -14.422719 );
-	v( -9.417040, 8.815191, -32.923061 );
-	v( -2.657435, -38.726345, 5.345215 );
-	v( 21.054070, 7.244274, -9.442557 );
-	v( -12.761545, 32.903118, -22.160563 );
-	v( 19.797915, -6.056701, -7.697471 );
-	v( -6.420856, 30.050871, 10.837479 );
-	v( -7.661814, -16.232040, -21.815901 );
-	v( 2.317067, 28.610571, 13.079596 );
-	v( -2.551964, -0.762503, -31.325699 );
-	v( -21.244995, 12.815745, -14.655400 );
-	v( 11.970610, 6.743855, 11.551081 );
-	v( -19.391161, 5.410800, -11.142129 );
-	v( 5.041468, 3.051816, -31.953129 );
-	v( 9.164837, -19.168131, 10.056738 );
-	v( 0.107825, -37.907585, -27.973822 );
-	v( -19.696899, 20.345821, -10.585716 );
-	v( 11.998387, -21.220921, -1.942632 );
-	v( 17.992878, -6.716813, -15.160804 );
-	v( 5.323591, -16.659016, -23.244642 );
-	v( 15.983818, -12.709289, -15.295694 );
-	v( -10.672782, 36.253128, -11.053264 );
-	v( -14.708238, -14.020164, -17.267088 );
-	v( 9.866241, 16.947859, 14.567344 );
-	v( -21.432116, 15.445463, -17.540155 );
-	v( -5.301890, 36.749619, 0.003690 );
-	v( -15.127811, 29.600388, -0.846345 );
-	v( 11.212095, 32.904324, 3.153089 );
-	v( -3.360719, -7.487316, -27.086048 );
-	v( 13.116753, 33.175179, -21.371056 );
-	v( 5.058289, -9.466007, 13.041221 );
-	v( 21.806917, 2.544116, -14.228762 );
-	v( 0.046883, -12.417434, 16.013323 );
-	v( -1.385950, -13.324209, -25.549360 );
-	v( -10.023006, -6.930315, 12.007681 );
-	v( -20.408339, 11.658729, -8.047276 );
-	v( -11.039141, 35.931702, -19.538984 );
-	v( -20.941328, 12.754304, -11.883600 );
-	v( -25.813574, -38.668636, -18.134151 );
-	v( 6.310787, -17.529669, 13.115110 );
-	v( -21.793907, 3.583846, -13.454125 );
-	v( -9.649255, 8.902884, 13.228937 );
-	v( 17.859081, 20.119043, -27.611469 );
-	v( 24.071348, 5.235605, -14.894611 );
-	v( 22.656483, 8.685542, -9.590137 );
-	v( -3.479979, 7.266700, 11.930455 );
-	v( -2.256282, -6.475539, -27.781616 );
-	v( 17.696571, -8.065739, -15.642091 );
-	v( -7.648053, 5.319120, 13.297441 );
-	v( 4.360827, 37.742157, -7.323018 );
-	v( 4.421795, 34.876190, -23.563597 );
-	v( 11.618242, 8.609464, -31.725033 );
-	v( 3.643363, -38.412884, -28.075563 );
-	v( -15.528573, -28.398958, -9.014132 );
-	v( 7.421817, 34.516594, -23.865799 );
-	v( 2.671784, -2.633429, 17.488317 );
-	v( 14.051480, 5.854771, 10.321892 );
-	v( 7.651864, -8.538325, 12.516641 );
-	v( 1.815059, 33.147804, -26.926142 );
-	v( 16.151011, -29.575926, -14.472301 );
-	v( -17.245968, 1.305668, 3.752007 );
-	v( -19.323971, 4.540361, -5.800398 );
-	v( 10.141569, 36.312050, -19.306896 );
-	v( -15.467675, 13.420774, 9.186761 );
-	v( -2.564596, -7.900150, 16.488478 );
-	v( -5.574182, -38.738358, 3.806006 );
-	v( -1.339029, -3.832371, -29.398424 );
-	v( 2.150830, -2.690932, 21.745794 );
-	v( 14.354857, -8.200233, -20.137974 );
-	v( 5.261869, 4.686718, 13.586017 );
-	v( 4.587111, 31.218555, -28.476046 );
-	v( -13.389742, 16.409319, -32.381992 );
-	v( 17.842672, 0.699801, -21.440269 );
-	v( -16.368805, -6.283721, -18.993366 );
-	v( -12.860222, -9.758635, -21.195011 );
-	v( -2.452872, -22.016005, 12.172149 );
-	v( -4.019868, 23.932625, -32.652039 );
-	v( -9.567739, 36.191216, -6.790667 );
-	v( 3.231978, 38.513302, -9.091499 );
-	v( -16.723534, 19.639519, 2.157449 );
-	v( -11.549933, 19.590382, -32.657375 );
-	v( -18.233906, 2.046853, -8.596834 );
-	v( 0.188832, 17.844112, -34.461933 );
-	v( 17.748095, 17.225246, -0.322481 );
-	v( 9.045727, 37.578411, -14.728707 );
-	v( -18.996923, 20.012293, -26.201765 );
-	v( -4.434913, 7.896041, 11.745813 );
-	v( -0.657813, 14.437228, 17.353584 );
-	v( -4.435455, 10.178115, 13.562886 );
-	v( -16.324417, -2.557748, -21.984730 );
-	v( -10.932334, -12.171235, -21.715496 );
-	v( 16.125008, -9.685605, -17.784447 );
-	v( 4.984877, 34.567860, -24.602238 );
-	v( 0.665515, 5.715241, 18.959623 );
-	v( -18.748169, -36.860294, -23.656055 );
-	v( 21.069319, -1.088676, -13.225060 );
-	v( -20.591644, -33.287193, -11.349132 );
-	v( -19.340704, 5.020290, -12.225811 );
-	v( -8.482514, -10.271142, -24.142910 );
-	v( -19.486235, 4.475672, -8.819953 );
-	v( 0.478715, -17.742214, -24.647316 );
-	v( 18.858240, -37.136238, -3.706823 );
-	v( 22.482008, 20.866816, -11.734247 );
-	v( 12.593826, 32.667553, 0.993741 );
-	v( 3.021836, 36.564022, 3.248206 );
-	v( -6.327285, -17.532867, -22.372753 );
-	v( 2.378934, 4.413154, -33.033894 );
-	v( -19.870714, 11.594968, -23.312798 );
-	v( 6.784239, 7.121948, 11.970167 );
-	v( 22.068132, 21.903063, -14.909575 );
-	v( 3.428554, 8.541534, 12.092340 );
-	v( 2.776919, 16.911383, 16.835640 );
-	v( 20.624969, -3.323102, -9.989676 );
-	v( -0.057368, 38.854744, -17.704172 );
-	v( -10.097079, 11.398260, 13.735633 );
-	v( -15.091831, -24.051582, -12.615951 );
-	v( -1.761741, 34.424881, 8.757890 );
-	v( -12.712471, 13.874793, -32.557140 );
-	v( -13.030563, 6.151845, 10.581923 );
-	v( 19.718100, 12.258553, -24.208681 );
-	v( -5.350003, -31.844135, 2.267198 );
-	v( -12.834101, 34.806576, -8.375687 );
-	v( 19.357239, 4.088199, -21.783728 );
-	v( -1.680337, -3.123512, 22.085356 );
-	v( -5.510403, 9.115337, -33.811432 );
-	v( -8.421470, 36.544117, -19.765047 );
-	v( 2.234627, 32.143429, 10.872072 );
-	v( 6.113432, -16.881519, -22.812189 );
-	v( -15.408820, 18.040709, -30.782110 );
-	v( 11.942061, 18.439077, -32.486958 );
-	v( 3.177714, 33.246361, -26.819986 );
-	v( 17.637877, -32.807537, -7.318667 );
-	v( 1.751811, -2.884906, 17.467651 );
-	v( -10.400933, 14.180868, 15.059999 );
-	v( 18.388252, 10.692023, -1.130795 );
-	v( -4.125986, 1.993150, -32.197880 );
-	v( -8.382974, 22.520779, 14.315391 );
-	v( -3.104114, 38.462360, -18.007351 );
-	v( -20.940060, -1.109299, -13.177700 );
-	v( -17.193722, -9.485427, -14.718478 );
-	v( -4.394449, 36.133678, 3.707798 );
-	v( 13.511829, -18.627834, -0.668357 );
-	v( -19.325487, 5.485562, -11.125546 );
-	v( 18.022808, 28.938204, -20.818033 );
-	v( -11.799370, -19.387362, 5.052312 );
-	v( 0.447239, 38.193550, -0.057184 );
-	v( 6.528334, 5.026926, 12.879038 );
-	v( 15.599299, -33.113594, -22.151001 );
-	v( -5.671187, 33.033619, -26.340012 );
-	v( -0.006412, -4.681829, 20.736862 );
-	v( 15.393281, -3.631388, -21.949326 );
-	v( 7.345590, 28.339588, -29.739288 );
-	v( 12.704460, -23.312138, -2.104583 );
-	v( 15.943135, -10.948440, 2.655982 );
-	v( -16.318968, 8.765296, -29.126833 );
-	v( -1.094381, -31.617311, 4.176179 );
-	v( -2.411396, -8.322498, -27.002497 );
-	v( 20.558638, 17.488367, -21.699497 );
-	v( -0.153088, 14.053903, -34.429314 );
-	v( 19.110861, 3.474283, -5.384126 );
-	v( -0.743479, -33.508465, 3.967205 );
-	v( -2.234862, 9.332983, -34.532341 );
-	v( -2.057156, 20.608271, -33.581177 );
-	v( -15.215922, -13.224041, -16.887590 );
-	v( -7.399980, -8.855132, 11.995327 );
-	v( -4.808094, 38.666584, -16.404926 );
-	v( -18.034456, 3.226100, -2.095168 );
-	v( 14.307278, 1.819041, -26.437796 );
-	v( 2.227672, -12.870330, -25.444420 );
-	v( 13.924846, 4.295836, -28.753750 );
-	v( 9.354362, -7.030112, -25.365551 );
-	v( -17.320669, 19.795948, 0.229058 );
-	v( -6.840274, 4.859227, 12.980195 );
-	v( -20.087900, 4.339339, -15.617288 );
-	v( -20.572666, 5.746071, -8.429254 );
-	v( 4.116734, -3.397168, -28.622356 );
-	v( 5.744560, 34.762794, 5.516041 );
-	v( -15.612762, 30.472967, -22.758608 );
-	v( -20.469965, 19.541464, -13.785919 );
-	v( -10.275401, 37.425961, -15.334541 );
-	v( -12.816912, -14.481304, -19.492371 );
-	v( 15.880656, -7.460501, -18.724903 );
-	v( -1.630826, 24.343895, -32.589520 );
-	v( 2.779535, -8.916828, 13.569564 );
-	v( 2.115479, -21.107292, -24.112171 );
-	v( 1.505904, 27.786188, 13.456473 );
-	v( 13.612707, 22.733213, -30.819933 );
-	v( 16.724573, 20.636446, 1.928208 );
-	v( -2.793877, -4.700843, -28.554079 );
-	v( -17.376846, 1.534947, -23.533840 );
-	v( 0.425574, 23.417322, -32.685993 );
-	v( 18.622877, 6.080425, -3.084770 );
-	v( 20.377663, 4.615870, -14.657768 );
-	v( 5.090075, -9.123998, 14.651545 );
-	v( -0.917905, 7.954411, 17.141542 );
-	v( -19.903315, 17.274086, -7.767951 );
-	v( -11.428092, 33.954472, -0.075656 );
-	v( -9.037109, 37.734818, -14.276186 );
-	v( 13.587093, -3.635938, -24.122938 );
-	v( -11.732334, -20.632643, 2.675039 );
-	v( -4.302115, 25.407795, -32.246117 );
-	v( 9.585745, 15.353339, 14.866981 );
-	v( 1.917108, -9.478909, 14.568156 );
-	v( -17.449837, 29.148159, -20.190060 );
-	v( 3.892678, -35.452267, 4.220356 );
-	v( 5.596194, 33.430199, -25.897552 );
-	v( 0.624784, 28.487343, -30.924860 );
-	v( 13.039799, 5.849833, 10.731626 );
-	v( 22.512754, 8.992841, -11.282405 );
-	v( -2.023357, 34.891579, -24.564764 );
-	v( 3.528382, -3.095150, 17.532507 );
-	v( -10.360138, 4.389108, 13.175744 );
-	v( 2.810136, -9.460137, -26.466103 );
-	v( 5.891412, 38.438179, -14.990206 );
-	v( -19.701731, -0.655085, -16.816542 );
-	v( -5.459584, 0.525915, 15.592166 );
-	v( -7.937628, 29.057331, 10.656996 );
-	v( 20.906445, 4.639928, -18.205118 );
-	v( -3.022600, 30.603416, -29.387991 );
-	v( 24.005543, -38.785236, -20.140194 );
-	v( -14.443457, -26.786140, -16.205614 );
-	v( 19.565372, 1.477193, -8.736658 );
-	v( 19.267464, -3.650855, -13.219058 );
-	v( -12.744744, -5.289635, -22.633440 );
-	v( 3.086896, 7.398714, 12.169643 );
-	v( 11.746370, 30.391273, 4.954244 );
-	v( -22.625690, 9.041143, -11.975714 );
-	v( -12.369099, 35.275471, -12.437709 );
-	v( 17.052141, 3.719108, 5.237379 );
-	v( 21.093439, -0.922850, -14.841272 );
-	v( 2.039744, -2.177103, -30.271351 );
-	v( -3.232234, 39.461681, -12.530805 );
-	v( -15.298160, -4.893795, -20.968161 );
-	v( 20.438299, -4.516490, -12.286112 );
-	v( 20.187868, -0.968963, -13.179405 );
-	v( 21.452517, 25.680508, -16.543034 );
-	v( 20.458189, 3.283425, -11.686165 );
-	v( 12.806806, 6.491326, 10.279398 );
-	v( 9.191816, 32.492744, 5.908338 );
-	v( 17.288481, 30.821247, -19.303205 );
-	v( -7.155559, 30.034328, -28.733904 );
-	v( 12.510767, 36.002842, -14.982883 );
-	v( -11.832023, 3.664623, 13.211122 );
-	v( 19.272045, 5.820183, -4.918344 );
-	v( -5.778794, 23.897680, -32.513615 );
-	v( 6.128465, 23.545982, -32.497921 );
-	v( -18.879230, 0.293795, -10.343363 );
-	v( -0.749933, 32.389534, 11.516363 );
-	v( -9.995539, 30.139214, 7.906653 );
-	v( -6.146479, -23.166212, 7.631345 );
-	v( -13.935486, 30.271814, 2.646759 );
-	v( -23.206373, 6.849253, -14.397429 );
-	v( 9.964589, 34.988708, -21.978258 );
-	v( 2.201582, 39.439716, -12.113432 );
-	v( 19.951582, 29.563002, -12.643061 );
-	v( 13.099891, -7.488329, 10.407920 );
-	v( -3.384090, 30.133081, 12.342259 );
-	v( -3.681450, -21.158188, 13.595244 );
-	v( -9.488798, 20.492502, -32.751556 );
-	v( -9.400620, 10.082211, 13.815988 );
-	v( -4.072455, -5.601073, -27.447374 );
-	v( 21.324183, 14.418547, -8.201639 );
-	v( -18.291260, 2.076501, -3.320615 );
-	v( 27.660252, -38.736256, -15.154171 );
-	v( 8.677389, -1.722874, 15.101128 );
-	v( -16.791050, 14.508793, -28.093803 );
-	v( -1.722749, -2.891108, 17.805319 );
-	v( -6.753522, 28.670677, 11.472855 );
-	v( -1.928981, -20.233244, -24.149553 );
-	v( 14.901220, -34.228142, -4.217482 );
-	v( 20.727005, 4.254540, -17.168421 );
-	v( -5.578673, 18.192617, -33.582592 );
-	v( 5.304892, -8.290724, -26.065184 );
-	v( -20.665258, 6.595772, -9.839897 );
-	v( -14.209968, -17.020308, -4.495411 );
-	v( 6.404477, 11.363809, -33.825989 );
-	v( 5.676895, 7.166011, -33.185894 );
-	v( -8.474251, 34.446930, -23.786966 );
-	v( -20.503687, 14.740643, -20.622280 );
-	v( 1.547192, 9.230257, -34.108425 );
-	v( -19.571669, 15.825480, -6.092746 );
-	v( 13.205998, 27.247723, -28.317469 );
-	v( 17.254894, -38.741356, -25.538567 );
-	v( -0.593157, -36.113979, 5.095028 );
-	v( -8.977049, 23.523193, -31.986952 );
-	v( 9.294970, -38.708015, 2.624284 );
-	v( 12.902189, 14.544610, 12.958309 );
-	v( 9.826420, 36.819019, -16.422115 );
-	v( -19.525972, 5.567776, -6.655829 );
-	v( 9.236887, 36.243263, -7.782094 );
-	v( 5.675691, 37.535698, -19.132309 );
-	v( -17.362160, 7.663712, 2.759467 );
-	v( -12.312527, -24.241297, -1.455389 );
-	v( -11.511230, 21.997242, 12.326801 );
-	v( -20.033142, 22.941347, -8.675917 );
-	v( -10.231247, 0.074802, -28.269127 );
-	v( -14.861975, -13.042705, -17.733795 );
-	v( 0.980205, -15.709897, -25.080017 );
-	v( -18.839088, -5.598772, -6.813427 );
-	v( -2.824446, -3.045817, -29.758488 );
-	v( 7.462587, 3.796460, 13.597816 );
-	v( 14.581715, -15.174260, -17.145941 );
-	v( 8.263047, 19.456146, -32.897610 );
-	v( -16.350088, 29.787210, -4.113075 );
-	v( 20.645418, 19.558825, -6.127245 );
-	v( 9.611525, 4.223338, 13.307433 );
-	v( 16.975311, -10.239564, -15.085300 );
-	v( 3.190030, -3.605621, 16.252222 );
-	v( 1.549256, 9.867864, 16.169193 );
-	v( 7.133428, 9.551876, -33.603008 );
-	v( 11.255096, -0.701283, 13.824272 );
-	v( -5.758227, 33.075275, 8.029169 );
-	v( -0.646134, -6.993670, -28.039164 );
-	v( -4.756613, -11.855499, -25.272202 );
-	v( -9.483953, 5.875422, 13.144169 );
-	v( 11.273256, -12.054273, -22.018377 );
-	v( -9.077969, 11.577650, -33.198246 );
-	v( -6.585948, -4.182364, -28.114252 );
-	v( 9.261274, 6.819365, 13.075745 );
-	v( 8.861070, 7.051889, 11.771091 );
-	v( 19.591997, 5.018021, -11.327893 );
-	v( 14.772625, 27.644333, 2.924836 );
-	v( 7.145863, 30.271854, -28.506338 );
-	v( -0.578840, 3.717314, -33.044468 );
-	v( -0.816810, 39.187145, -15.759536 );
-	v( 17.117247, 26.383875, 0.807978 );
-	v( 3.672040, 27.909739, -30.944555 );
-	v( -19.637989, -2.149621, -8.986880 );
-	v( -7.659419, 27.179609, -31.142460 );
-	v( -18.203402, 16.263180, -1.123624 );
-	v( -5.132670, -6.410047, 14.908851 );
-	v( -12.902215, 6.516311, 10.364899 );
-	v( 2.482445, -10.795836, 13.994788 );
-	v( 2.291548, 38.707932, -17.816803 );
-	v( 5.864590, -28.006763, 2.252405 );
-	v( 13.336439, 34.671986, -17.726309 );
-	v( 12.030360, -15.136822, -20.229446 );
-	v( -18.571333, -2.288243, -18.255190 );
-	v( 21.359264, 5.376670, -10.151074 );
-	v( -13.961287, 34.864445, -11.850157 );
-	v( 19.087170, 0.148977, -18.205847 );
-	v( -15.015428, -2.407374, -22.678534 );
-	v( -15.451838, -5.122579, 6.140439 );
-	v( -19.537569, 28.398836, -15.333007 );
-	v( 1.498233, -4.136227, 20.614573 );
-	v( -17.975901, 17.592707, 0.110664 );
-	v( 22.602961, 11.659599, -16.854916 );
-	v( 13.839207, -5.322902, -22.395130 );
-	v( 1.131122, -2.623440, -30.413010 );
-	v( -9.297797, -8.562042, -24.180849 );
-	v( 21.910816, 0.919388, -12.528266 );
-	v( 3.267059, -6.684251, -27.106569 );
-	v( 11.698756, -28.636711, -2.747236 );
-	v( 23.192247, 7.054102, -14.238251 );
-	v( 19.452288, -0.835650, -16.071053 );
-	v( 11.386288, 31.552111, -25.553143 );
-	v( -14.864713, 15.106971, -31.057905 );
-	v( 0.637627, 21.218725, -33.397179 );
-	v( 2.481637, -26.309738, -24.626919 );
-	v( 18.596241, 5.744229, -1.805470 );
-	v( 19.487484, 5.252291, -11.680073 );
-	v( 0.296321, -4.924295, -28.906946 );
-	v( 10.889995, 25.672653, -30.336182 );
-	v( 16.528540, 3.801785, -24.102386 );
-	v( -7.033135, 2.149403, -31.210066 );
-	v( -1.473831, 21.728079, 16.283407 );
-	v( -5.738906, -9.852535, -25.196682 );
-	v( 15.263243, 14.231567, -30.834139 );
-	v( -4.167071, -1.069790, -30.062288 );
-	v( 12.632528, 1.415631, -27.224598 );
-	v( 2.427388, 7.520368, 13.253142 );
-	v( 12.418620, 6.828774, 10.909624 );
-	v( -8.022268, 37.955120, -16.248880 );
-	v( -15.407054, -7.086525, -19.699671 );
-	v( -3.222292, -3.439042, 16.472837 );
-	v( -16.638737, -10.452306, -15.250580 );
-	v( -19.494827, 20.846228, -6.041484 );
-	v( -20.542397, 16.673344, -23.687202 );
-	v( 21.237610, 6.385890, -10.313189 );
-	v( 7.919337, -12.157380, -24.280602 );
-	v( 5.284235, -10.925192, -25.346697 );
-	v( 0.303665, 1.704051, -32.457661 );
-	v( 4.494793, -15.107576, 14.126169 );
-	v( -12.017452, -8.157805, 11.146460 );
-	v( 19.213734, 9.000839, -3.869195 );
-	v( -5.033079, -1.219317, 15.479133 );
-	v( 7.134366, -8.602556, 11.223702 );
-	v( 16.989111, -2.009663, -21.339996 );
-	v( 19.454876, -3.931713, -13.776350 );
-	v( -4.677523, -2.616273, -28.970419 );
-	v( -17.711340, 21.365955, -27.551147 );
-	v( -4.020952, -2.730959, 17.757032 );
-	v( 4.008438, 21.894037, -33.182381 );
-	v( 6.555612, 37.620407, -8.677326 );
-	v( 7.285149, 20.243128, 15.434821 );
-	v( -26.309700, -36.735889, -11.454939 );
-	v( 9.840492, 34.902264, 0.316683 );
-	v( 10.217066, 34.065533, 2.488272 );
-	v( 12.423445, -12.387414, -20.550760 );
-	v( 18.256262, 11.962549, 0.032429 );
-	v( -13.272279, 22.345442, 9.526750 );
-	v( 2.854892, 0.991795, 17.559006 );
-	v( 2.230325, -38.718853, 5.506923 );
-	v( -5.022696, 6.491615, 12.048278 );
-	v( 15.048934, -25.896229, -13.518192 );
-	v( -14.809203, 23.468973, 4.109572 );
-	v( -19.801838, 3.075171, -14.034295 );
-	v( -19.985029, 3.637844, -19.345217 );
-	v( 15.917845, 23.056833, -28.426048 );
-	v( 13.153367, 7.648338, -30.578938 );
-	v( 19.611923, 20.736801, -4.319719 );
-	v( -6.932128, 37.570255, -7.035744 );
-	v( -22.676096, 10.059157, -12.524346 );
-	v( -4.814193, -17.695734, -23.251013 );
-	v( -19.325678, 27.536936, -19.696053 );
-	v( -19.594629, -3.841564, -14.627506 );
-	v( -11.412773, -7.476874, -22.380007 );
-	v( -14.061838, -31.698833, -21.931316 );
-	v( 13.958481, 34.187290, -9.358459 );
-	v( -18.783865, 10.770070, -1.009154 );
-	v( -5.866805, -8.396197, 14.356128 );
-	v( -18.707399, 23.528637, -4.132745 );
-	v( 18.894194, -36.590023, -23.241703 );
-	v( 3.947426, -0.649783, 16.154997 );
-	v( 0.198933, -2.645401, 22.818651 );
-	v( 17.058886, 18.781107, 1.898826 );
-	v( -22.014851, 2.260443, -12.526030 );
-	v( -17.372723, 30.749821, -13.564593 );
-	v( 3.625967, 10.673781, -34.194893 );
-	v( -1.491923, 26.200193, 14.641587 );
-	v( -13.258434, 19.527937, 11.291594 );
-	v( 19.644718, 4.869963, -9.521158 );
-	v( 23.870430, 9.206355, -12.837187 );
-	v( -5.093804, 3.272468, -31.983721 );
-	v( -5.531929, 31.477007, 9.705803 );
-	v( 7.323093, 36.309296, -4.035630 );
-	v( 8.928281, 30.838850, -27.267607 );
-	v( 0.106983, 10.255565, 16.934380 );
-	v( -9.095379, -12.312137, -22.685183 );
-	v( 0.069294, -20.565926, 15.651780 );
-	v( -9.548110, 25.320215, -31.178545 );
-	v( -14.472395, 32.473061, -21.283625 );
-	v( -13.957398, 10.055820, -30.378492 );
-	v( -18.524672, 17.446461, -25.109972 );
-	v( 5.297080, 28.872660, -30.061361 );
-	v( -17.014204, -38.719978, -25.619236 );
-	v( 9.778087, 14.135963, 15.103014 );
-	v( -3.704094, 11.478427, 15.289406 );
-	v( 18.406973, 2.173267, -8.542216 );
-	v( -7.464017, -8.944356, 12.127934 );
-	v( 18.625162, 9.348104, -0.963977 );
-	v( 20.312393, -38.767044, -23.696526 );
-	v( 13.127926, 33.439442, -2.675207 );
-	v( 0.761118, -15.398376, 15.265581 );
-	v( -10.232532, -4.306198, -25.579756 );
-	v( -18.749119, 2.575892, -5.948876 );
-	v( 18.383188, -5.640810, -6.818431 );
-	v( 8.276611, -8.259902, 12.483235 );
-	v( -15.161558, 0.058236, -24.495562 );
-	v( 1.901027, -8.632419, -27.024488 );
-	v( -19.633101, 12.304642, -4.974372 );
-	v( 0.574934, -8.583528, -26.977308 );
-	v( 0.706877, 27.364185, 13.840668 );
-	v( 12.083782, 28.930899, -27.931244 );
-	v( 4.023611, 35.847202, -22.255405 );
-	v( 4.509839, -3.230171, 15.360171 );
-	v( -1.132182, 34.844601, -25.030975 );
-	v( 14.750584, -5.369838, -22.294811 );
-	v( -8.152007, 33.204948, 5.371097 );
-	v( -0.013718, -22.249388, 12.640237 );
-	v( 15.053319, -23.681871, -10.390623 );
-	v( 10.133559, -8.858856, -23.839640 );
-	v( -19.917906, 2.413620, -16.347628 );
-	v( -11.330462, -3.484356, -24.995169 );
-	v( 18.996874, 9.008018, -2.464709 );
-	v( 10.649562, 11.864837, 13.646205 );
-	v( 15.482513, 33.553913, -14.821810 );
-	v( 21.971079, 13.110613, -10.226805 );
-	v( 15.041213, 30.223291, 0.177536 );
-	v( -17.806641, -2.773629, -1.652299 );
-	v( 10.596556, 15.327195, -33.047649 );
-	v( 6.146731, 36.758293, -4.806519 );
-	v( 6.200684, 27.966190, -30.324915 );
-	v( -18.388670, -32.882988, -16.834782 );
-	v( 22.281628, 16.459761, -10.661052 );
-	v( 1.818479, 6.755233, -33.300739 );
-	v( -0.715213, 26.732443, 14.682856 );
-	v( 17.545767, -8.815377, -14.649751 );
-	v( -11.359170, -16.385918, -20.028189 );
-	v( 17.060495, -9.335290, -12.807665 );
-	v( 16.236284, 28.621376, -2.634394 );
-	v( 10.279469, -8.029368, 11.685425 );
-	v( 17.357801, 3.708559, 0.578241 );
-	v( -1.100450, -4.699231, 17.294096 );
-	v( 16.854925, -8.823085, -16.412054 );
-	v( -20.539825, -38.768005, -23.674046 );
-	v( 0.255221, 9.793259, -33.755047 );
-	v( -15.827226, -10.703557, 3.115142 );
-	v( -18.933254, -36.820122, -3.998646 );
-	v( -13.607592, 23.108154, -30.633162 );
-	v( -19.067814, 13.976374, -2.711295 );
-	v( -6.483180, 38.712666, -14.672739 );
-	v( 7.971313, -33.719212, 0.387676 );
-	v( -2.540337, 17.331837, -33.772812 );
-	v( 12.502049, 23.678764, 10.086133 );
-	v( 6.959664, -11.951001, 12.253743 );
-	v( 8.352103, -20.937317, 9.002209 );
-	v( -21.482710, 0.640640, -12.413937 );
-	v( 1.607467, 1.012534, 20.456682 );
-	v( 15.530207, -0.764164, 8.662857 );
-	v( 21.544708, 0.116183, -12.625384 );
-	v( 17.875130, -31.572870, -14.058199 );
-	v( -2.495547, -2.040301, 21.550365 );
-	v( -18.455219, -4.250947, -8.531452 );
-	v( -4.320163, -4.016191, -28.279203 );
-	v( 17.428276, -7.557345, -12.003884 );
-	v( -13.774629, -14.955014, -18.259424 );
-	v( 20.743448, 20.971096, -21.177055 );
-	v( 9.449162, 37.190186, -12.301309 );
-	v( -9.784924, 32.251663, 5.598059 );
-	v( 19.986643, 23.309454, -4.642916 );
-	v( 6.552337, 36.094406, -0.398950 );
-	v( 17.328442, 5.639255, -25.178099 );
-	v( 14.858373, 9.580029, 10.709662 );
-	v( 1.991843, 19.201456, -34.036781 );
-	v( -0.766410, 28.238758, 14.210715 );
-	v( 3.690714, -15.025083, -25.144615 );
-	v( 5.372797, -5.981539, 14.711186 );
-	v( -22.473385, 6.893461, -12.104945 );
-	v( 16.833557, 23.878716, 1.404808 );
-	v( 15.126023, 26.935825, -26.828959 );
-	v( 7.457063, -7.318916, 13.099199 );
-	v( -18.213129, 0.497653, -2.448590 );
-	v( -4.511073, 37.318592, -19.530443 );
-	v( 17.871717, -6.010423, -7.293527 );
-	v( -0.581846, -7.228153, 17.243868 );
-	v( -18.879120, 6.535440, -2.430132 );
-	v( -4.768904, -8.988539, -26.691479 );
-	v( 7.896627, 5.011254, -32.056881 );
-	v( 11.412470, 7.355723, 11.728360 );
-	v( 22.134367, 18.139526, -13.825299 );
-	v( 6.479674, 25.409258, 13.778257 );
-	v( 8.600494, -1.719619, -28.279701 );
-	v( -11.797843, 6.615065, 11.717417 );
-	v( -2.068892, -2.758308, 17.348869 );
-	v( -4.540421, 36.204605, -21.997118 );
-	v( -19.945713, 5.381324, -8.566768 );
-	v( 1.481402, -11.324782, -26.128040 );
-	v( 1.230818, 26.060041, -32.099129 );
-	v( 20.084148, 22.188690, -21.563221 );
-	v( 19.347246, 16.019857, -4.147568 );
-	v( -5.295300, 25.065903, 14.436374 );
-	v( 8.236973, 36.478722, -6.361847 );
-	v( -19.792860, 5.154595, -9.921582 );
-	v( -20.805313, 13.769246, -8.114810 );
-	v( -0.113907, 32.664124, -27.591200 );
-	v( -21.142262, 4.990270, -10.697101 );
-	v( -4.056022, -9.565405, 13.619352 );
-	v( -3.368468, -0.984697, -30.873930 );
-	v( -15.610883, 23.732796, 2.548242 );
-	v( -18.920103, 8.075624, -1.896260 );
-	v( -9.511944, -34.101265, -0.556825 );
-	v( -14.048468, 29.007866, 3.455981 );
-	v( -9.685773, 35.226295, -21.133327 );
-	v( -7.614191, 20.785402, -32.877365 );
-	v( 16.714832, -10.835006, -15.948791 );
-	v( 23.530746, 4.440732, -14.571528 );
-	v( -6.223069, -5.283308, 14.334502 );
-	v( -4.531507, 14.053160, -33.802696 );
-	v( -20.171204, 3.914497, -11.539110 );
-	v( -20.986565, 11.627583, -18.659134 );
-	v( -0.717739, 21.431417, -33.206768 );
-	v( -5.145364, 25.483421, -32.183723 );
-	v( 5.502090, 17.767494, -34.184944 );
-	v( -7.967140, -3.667833, -27.037016 );
-	v( 20.738058, 15.821542, -6.600136 );
-	v( -4.625110, -11.437722, 14.121337 );
-	v( -4.050469, -26.115238, 5.317846 );
-	v( 11.065423, -11.293047, 11.066301 );
-	v( 1.991846, -4.492856, -28.899632 );
-	v( 8.375410, 9.931764, 13.498536 );
-	v( 0.904947, -6.063964, 17.010605 );
-	v( -2.675761, -25.550901, -24.423565 );
-	v( -6.850724, 7.127490, 11.970325 );
-	v( -10.321750, -10.523026, -22.624033 );
-	v( -18.772997, 3.572333, -7.938657 );
-	v( -15.731754, 6.735471, -28.398081 );
-	v( 15.578675, 10.468714, -29.506557 );
-	v( 2.216058, 38.393074, -6.128984 );
-	v( -8.336805, 31.798365, -26.802235 );
-	v( -16.307734, 21.956079, -29.652626 );
-	v( -13.474611, 12.599000, 13.023260 );
-	v( 2.007231, -25.091173, 8.626558 );
-	v( -18.036514, 18.819382, -1.547987 );
-	v( 13.955257, 6.482913, 10.311580 );
-	v( -1.228282, 8.085597, -34.343464 );
-	v( 9.388319, 29.648853, -28.589947 );
-	v( 17.517187, 8.087501, 2.441697 );
-	v( -14.073661, -10.236182, -19.878899 );
-	v( -9.340177, -28.256531, 1.001652 );
-	v( -6.263105, -6.545275, -26.568773 );
-	v( -16.425241, 21.599098, 2.061574 );
-	v( 6.946173, -9.834195, -25.215801 );
-	v( 1.211402, 4.712627, -33.067318 );
-	v( 18.939779, -1.498810, -18.448481 );
-	v( -17.431826, -4.957342, -18.730148 );
-	v( -8.925577, 6.097939, -31.826828 );
-	v( 14.804413, 28.628836, -25.721607 );
-	v( -9.418953, 19.298008, 14.592644 );
-	v( -17.806034, 29.515045, -7.041538 );
-	v( -1.527424, 28.772583, -30.706482 );
-	v( 16.127781, 16.452057, 4.611994 );
-	v( 0.013467, -9.108784, -26.976397 );
-	v( -12.285675, -27.565212, -3.469559 );
-	v( 13.610662, 12.568259, 12.825396 );
-	v( -13.024258, 25.172773, -30.083313 );
-	v( -17.892521, 4.509764, -25.304623 );
-	v( 12.487321, -16.559763, -19.240530 );
-	v( -7.310274, -7.122024, 13.190941 );
-	v( -18.342972, 14.531242, -0.681957 );
-	v( -17.637619, -3.434403, -7.082188 );
-	v( 19.904669, 25.055187, -22.146839 );
-	v( 8.184443, 6.120287, 13.253221 );
-	v( 15.168239, 32.501724, -5.020982 );
-	v( -5.969962, 7.030210, 12.839790 );
-	v( -9.099298, 34.200150, 2.695474 );
-	v( 7.707335, 35.405655, 1.269907 );
-	v( 0.657790, 38.848522, -5.639893 );
-	v( 6.274085, -8.635345, 11.184876 );
-	v( 18.495144, 12.373608, -0.802690 );
-	v( -4.583100, 38.743874, -10.868259 );
-	v( 5.807947, 11.231808, 14.315434 );
-	v( 0.953676, 35.243954, -24.536869 );
-	v( 19.312590, 3.668818, -9.089181 );
-	v( 15.609801, -15.333127, -13.177547 );
-	v( -4.553720, 27.815865, -30.913055 );
-	v( 5.517442, 1.004455, -31.198107 );
-	v( -20.941702, 10.551443, -20.623907 );
-	v( 1.863341, 36.393826, 4.676507 );
-	v( -0.418783, 0.475095, -31.924528 );
-	v( 13.098290, 29.493076, 4.370241 );
-	v( -0.914106, -4.485943, 18.299015 );
-	v( 0.668662, 30.665518, -29.415155 );
-	v( 17.427357, -9.927782, -14.416476 );
-	v( -3.398775, 21.785431, -33.163609 );
-	v( -2.897803, 6.002866, -33.398006 );
-	v( -20.568729, 14.558046, -10.565802 );
-	v( -12.125072, 33.989067, -21.153582 );
-	v( -6.067649, -8.693000, 11.236831 );
-	v( -20.196869, 7.920941, -13.060639 );
-	v( 3.278148, -12.072558, 15.133630 );
-	v( 9.769251, 32.469791, -25.312803 );
-	v( -20.314487, 9.966805, -8.931033 );
-	v( 2.593694, 33.893219, 8.757407 );
-	v( -5.666910, -1.834561, -29.277674 );
-	v( 5.657514, 9.963427, 13.097920 );
-	v( 19.024343, -3.462076, -16.740347 );
-	v( 8.914016, 31.411818, 7.804191 );
-	v( -18.021070, -5.891148, -8.927808 );
-	v( 17.735491, -5.505367, -7.713966 );
-	v( 0.340070, 7.122990, -33.755501 );
-	v( 11.934280, 36.019424, -11.643272 );
-	v( 18.763777, -6.537712, -7.800447 );
-	v( -20.977993, 13.188881, -10.047018 );
-	v( -8.881050, -6.115794, -25.603344 );
-	v( 6.458931, 25.625019, -31.170088 );
-	v( -15.305037, -13.971543, 1.013587 );
-	v( 19.560335, 0.793733, -17.371735 );
-	v( -17.416344, 18.486265, 0.871185 );
-	v( -8.711454, -8.962641, 12.315125 );
-	v( -0.067624, -18.870020, 15.999091 );
-	v( 19.556639, 5.622459, -7.541325 );
-	v( 11.225321, 29.766529, 7.036225 );
-	v( 12.609044, 20.239042, -31.852875 );
-	v( -12.650283, 27.754526, -28.799471 );
-	v( 7.609082, 24.555035, -31.717039 );
-	v( -8.048412, -12.913550, -23.137747 );
-	v( -6.174876, -36.848694, 3.065367 );
-	v( -1.701580, 24.275341, 15.755748 );
-	v( 16.145893, -10.369273, -16.990395 );
-	v( 13.503568, 28.379013, 4.962630 );
-	v( -18.800291, 2.566712, -10.165762 );
-	v( -17.559870, 26.780918, -6.646280 );
-	v( -12.071990, 7.361310, -30.915335 );
-	v( 4.885745, 7.818913, 11.298312 );
-	v( -3.730125, 27.661089, 13.258503 );
-	v( 13.122206, -38.740742, -0.575728 );
-	v( 18.935518, 3.496349, -7.896363 );
-	v( 0.864079, 33.724636, -26.403860 );
-	v( -1.946857, 29.831711, 13.431522 );
-	v( -12.474003, 7.825178, 11.755260 );
-	v( 21.323977, 10.722650, -11.056945 );
-	v( -14.098132, 0.253251, -25.781866 );
-	v( 14.129022, -17.165098, -4.323264 );
-	v( 19.551428, 2.810664, -13.016442 );
-	v( 22.472858, 3.872814, -15.558374 );
-	v( 10.536188, 21.710302, -32.104851 );
-	v( 5.598803, -36.751881, -27.559984 );
-	v( 1.842779, -16.349827, -25.058569 );
-	v( 15.125737, 33.328403, -7.477111 );
-	v( 22.548916, 15.251615, -17.338610 );
-	v( 2.858497, 14.852420, -34.210747 );
-	v( -7.949250, 37.868488, -10.860645 );
-	v( 3.745228, 37.001682, -20.023348 );
-	v( -14.242812, 32.805244, -3.693859 );
-	v( 22.587278, 10.727121, -14.402749 );
-	v( 20.154385, 5.185550, -8.560456 );
-	v( 15.441644, -13.753881, -0.125124 );
-	v( -0.950797, -17.693617, -24.824295 );
-	v( -3.191905, -11.471381, 15.034394 );
-	v( 7.419312, -8.925420, 12.107625 );
-
-	f3( 71, 1599, 1260 );
-	f3( 1442, 805, 1078 );
-	f3( 380, 149, 790 );
-	f3( 1161, 621, 121 );
-	f3( 517, 570, 363 );
-	f3( 908, 1106, 1161 );
-	f3( 739, 10, 794 );
-	f3( 291, 212, 396 );
-	f3( 1100, 1300, 473 );
-	f3( 1353, 1078, 805 );
-	f3( 1061, 1001, 204 );
-	f3( 789, 1254, 1570 );
-	f3( 974, 1497, 503 );
-	f3( 847, 1374, 669 );
-	f3( 835, 168, 1451 );
-	f3( 1148, 1201, 1598 );
-	f3( 1486, 1573, 856 );
-	f3( 127, 298, 1563 );
-	f3( 1298, 429, 489 );
-	f3( 1386, 525, 819 );
-	f3( 24, 1113, 286 );
-	f3( 676, 746, 344 );
-	f3( 382, 614, 1396 );
-	f3( 1109, 947, 527 );
-	f3( 1584, 554, 443 );
-	f3( 482, 410, 774 );
-	f3( 362, 604, 1323 );
-	f3( 583, 1615, 308 );
-	f3( 416, 1205, 728 );
-	f3( 288, 460, 1117 );
-	f3( 1147, 1198, 130 );
-	f3( 821, 549, 1624 );
-	f3( 925, 1466, 77 );
-	f3( 811, 475, 722 );
-	f3( 688, 1269, 1281 );
-	f3( 146, 438, 33 );
-	f3( 534, 1376, 1348 );
-	f3( 1602, 1564, 67 );
-	f3( 594, 54, 1452 );
-	f3( 1565, 106, 1401 );
-	f3( 1337, 630, 217 );
-	f3( 1461, 1538, 709 );
-	f3( 715, 1406, 1377 );
-	f3( 786, 131, 404 );
-	f3( 53, 554, 939 );
-	f3( 1539, 649, 816 );
-	f3( 989, 1061, 204 );
-	f3( 404, 323, 753 );
-	f3( 1539, 482, 774 );
-	f3( 162, 960, 317 );
-	f3( 871, 1554, 1383 );
-	f3( 1130, 294, 726 );
-	f3( 154, 381, 357 );
-	f3( 289, 1325, 1042 );
-	f3( 764, 1475, 1305 );
-	f3( 827, 1321, 6 );
-	f3( 331, 601, 459 );
-	f3( 972, 798, 673 );
-	f3( 1296, 263, 1609 );
-	f3( 637, 1060, 631 );
-	f3( 1029, 279, 1607 );
-	f3( 808, 1592, 888 );
-	f3( 962, 1497, 1284 );
-	f3( 1182, 1157, 339 );
-	f3( 51, 274, 1162 );
-	f3( 253, 1348, 1025 );
-	f3( 577, 735, 6 );
-	f3( 899, 693, 616 );
-	f3( 220, 430, 1302 );
-	f3( 458, 1389, 1272 );
-	f3( 352, 1137, 282 );
-	f3( 1045, 211, 1064 );
-	f3( 1337, 1104, 1346 );
-	f3( 661, 863, 390 );
-	f3( 1566, 1131, 1503 );
-	f3( 224, 6, 1321 );
-	f3( 1201, 1148, 50 );
-	f3( 952, 1158, 918 );
-	f3( 536, 1378, 411 );
-	f3( 170, 759, 466 );
-	f3( 1317, 1641, 1559 );
-	f3( 1536, 89, 80 );
-	f3( 1498, 235, 1549 );
-	f3( 324, 1046, 1151 );
-	f3( 782, 1289, 1628 );
-	f3( 256, 290, 796 );
-	f3( 151, 207, 1195 );
-	f3( 959, 1087, 248 );
-	f3( 758, 817, 1628 );
-	f3( 423, 1163, 1272 );
-	f3( 236, 197, 1590 );
-	f3( 469, 230, 1017 );
-	f3( 943, 578, 144 );
-	f3( 1510, 1106, 1282 );
-	f3( 539, 414, 124 );
-	f3( 293, 720, 1458 );
-	f3( 1185, 368, 512 );
-	f3( 1517, 112, 530 );
-	f3( 994, 1336, 556 );
-	f3( 583, 201, 200 );
-	f3( 53, 1116, 1393 );
-	f3( 1014, 872, 697 );
-	f3( 218, 1032, 1617 );
-	f3( 838, 955, 1501 );
-	f3( 356, 1219, 144 );
-	f3( 995, 1466, 46 );
-	f3( 538, 539, 124 );
-	f3( 988, 1462, 419 );
-	f3( 103, 1274, 379 );
-	f3( 1595, 307, 1280 );
-	f3( 1216, 1617, 302 );
-	f3( 1231, 1000, 151 );
-	f3( 1428, 769, 1597 );
-	f3( 229, 534, 593 );
-	f3( 1359, 152, 1206 );
-	f3( 325, 13, 1001 );
-	f3( 210, 510, 96 );
-	f3( 271, 758, 1115 );
-	f3( 1257, 1413, 661 );
-	f3( 959, 977, 1087 );
-	f3( 261, 771, 1290 );
-	f3( 1599, 1102, 1524 );
-	f3( 1329, 1267, 626 );
-	f3( 99, 916, 304 );
-	f3( 175, 1186, 413 );
-	f3( 457, 338, 733 );
-	f3( 689, 1227, 710 );
-	f3( 1012, 1612, 81 );
-	f3( 621, 1279, 1570 );
-	f3( 537, 1306, 656 );
-	f3( 1594, 1485, 1577 );
-	f3( 987, 190, 399 );
-	f3( 1089, 600, 1427 );
-	f3( 1560, 149, 814 );
-	f3( 734, 172, 615 );
-	f3( 686, 1408, 1192 );
-	f3( 350, 479, 1543 );
-	f3( 268, 1314, 406 );
-	f3( 1279, 1292, 269 );
-	f3( 47, 316, 1631 );
-	f3( 1075, 561, 897 );
-	f3( 1458, 1238, 293 );
-	f3( 1452, 54, 1557 );
-	f3( 898, 645, 28 );
-	f3( 16, 920, 681 );
-	f3( 1133, 961, 1124 );
-	f3( 85, 661, 264 );
-	f3( 1447, 762, 1111 );
-	f3( 310, 40, 1174 );
-	f3( 889, 1556, 231 );
-	f3( 1351, 766, 995 );
-	f3( 225, 545, 1285 );
-	f3( 308, 74, 583 );
-	f3( 410, 1361, 994 );
-	f3( 1218, 372, 1015 );
-	f3( 746, 823, 344 );
-	f3( 14, 93, 1399 );
-	f3( 150, 541, 68 );
-	f3( 412, 664, 688 );
-	f3( 825, 1611, 157 );
-	f3( 388, 63, 226 );
-	f3( 306, 17, 847 );
-	f3( 415, 1132, 1042 );
-	f3( 884, 678, 476 );
-	f3( 734, 70, 1174 );
-	f3( 662, 1582, 1183 );
-	f3( 1608, 886, 1492 );
-	f3( 824, 1363, 1139 );
-	f3( 484, 1154, 423 );
-	f3( 1616, 1360, 206 );
-	f3( 566, 488, 179 );
-	f3( 178, 1006, 12 );
-	f3( 453, 537, 656 );
-	f3( 412, 962, 1284 );
-	f3( 891, 1425, 501 );
-	f3( 1155, 1301, 1000 );
-	f3( 1600, 177, 582 );
-	f3( 1485, 52, 768 );
-	f3( 1002, 31, 295 );
-	f3( 908, 1161, 121 );
-	f3( 984, 1414, 1027 );
-	f3( 1333, 845, 1135 );
-	f3( 1228, 629, 1629 );
-	f3( 598, 1059, 1521 );
-	f3( 770, 525, 591 );
-	f3( 1534, 303, 621 );
-	f3( 675, 1056, 1303 );
-	f3( 1362, 1564, 485 );
-	f3( 683, 787, 1252 );
-	f3( 11, 271, 1031 );
-	f3( 1478, 1143, 1099 );
-	f3( 1296, 1067, 816 );
-	f3( 287, 1041, 1562 );
-	f3( 1458, 1462, 337 );
-	f3( 1101, 114, 467 );
-	f3( 1410, 525, 1551 );
-	f3( 391, 438, 663 );
-	f3( 705, 306, 1547 );
-	f3( 1190, 558, 1045 );
-	f3( 1449, 102, 714 );
-	f3( 471, 438, 391 );
-	f3( 253, 324, 1151 );
-	f3( 1571, 1611, 1252 );
-	f3( 198, 1369, 358 );
-	f3( 506, 890, 528 );
-	f3( 1518, 982, 297 );
-	f3( 1286, 1394, 147 );
-	f3( 93, 14, 1365 );
-	f3( 1138, 942, 436 );
-	f3( 1512, 341, 1466 );
-	f3( 38, 360, 1402 );
-	f3( 858, 826, 1268 );
-	f3( 1378, 211, 558 );
-	f3( 1275, 678, 998 );
-	f3( 628, 1610, 1496 );
-	f3( 18, 381, 920 );
-	f3( 320, 689, 1529 );
-	f3( 483, 1088, 569 );
-	f3( 821, 1638, 549 );
-	f3( 1062, 488, 750 );
-	f3( 1193, 90, 803 );
-	f3( 1142, 979, 266 );
-	f3( 613, 134, 374 );
-	f3( 1363, 975, 1139 );
-	f3( 652, 293, 1063 );
-	f3( 929, 1581, 1436 );
-	f3( 809, 1614, 586 );
-	f3( 526, 18, 16 );
-	f3( 1007, 1131, 24 );
-	f3( 667, 173, 1388 );
-	f3( 650, 231, 75 );
-	f3( 1211, 52, 1260 );
-	f3( 92, 1630, 512 );
-	f3( 136, 95, 354 );
-	f3( 135, 727, 1217 );
-	f3( 591, 1386, 1516 );
-	f3( 1545, 1454, 135 );
-	f3( 1539, 816, 1067 );
-	f3( 169, 1323, 1176 );
-	f3( 966, 110, 1391 );
-	f3( 218, 179, 917 );
-	f3( 777, 1483, 1366 );
-	f3( 1458, 1396, 1238 );
-	f3( 1317, 929, 1641 );
-	f3( 811, 1046, 475 );
-	f3( 702, 582, 174 );
-	f3( 957, 83, 1493 );
-	f3( 46, 873, 995 );
-	f3( 1054, 434, 1355 );
-	f3( 346, 1350, 748 );
-	f3( 1044, 1255, 219 );
-	f3( 1188, 12, 1006 );
-	f3( 229, 593, 1419 );
-	f3( 1054, 1080, 434 );
-	f3( 888, 1592, 914 );
-	f3( 639, 951, 155 );
-	f3( 402, 941, 968 );
-	f3( 817, 1078, 1213 );
-	f3( 1295, 276, 426 );
-	f3( 494, 397, 1513 );
-	f3( 227, 161, 567 );
-	f3( 439, 1493, 552 );
-	f3( 1260, 1431, 1550 );
-	f3( 1207, 1206, 1240 );
-	f3( 565, 927, 106 );
-	f3( 431, 844, 19 );
-	f3( 1541, 393, 1149 );
-	f3( 1009, 338, 1519 );
-	f3( 180, 435, 1127 );
-	f3( 462, 1094, 722 );
-	f3( 163, 1060, 1411 );
-	f3( 1362, 1637, 1564 );
-	f3( 1534, 1416, 1037 );
-	f3( 536, 1018, 649 );
-	f3( 247, 873, 1261 );
-	f3( 1032, 302, 1617 );
-	f3( 1143, 260, 1099 );
-	f3( 622, 94, 1352 );
-	f3( 1412, 1366, 1483 );
-	f3( 1537, 606, 367 );
-	f3( 1625, 635, 1165 );
-	f3( 977, 1119, 701 );
-	f3( 122, 1322, 764 );
-	f3( 1259, 427, 696 );
-	f3( 814, 924, 1330 );
-	f3( 1007, 1175, 1503 );
-	f3( 635, 1160, 1165 );
-	f3( 1282, 1143, 1510 );
-	f3( 933, 1333, 1214 );
-	f3( 1071, 18, 956 );
-	f3( 1246, 425, 1329 );
-	f3( 1001, 1375, 672 );
-	f3( 951, 1565, 1232 );
-	f3( 1469, 982, 666 );
-	f3( 374, 650, 75 );
-	f3( 1439, 1332, 232 );
-	f3( 680, 1551, 770 );
-	f3( 737, 712, 6 );
-	f3( 1286, 162, 1394 );
-	f3( 1279, 269, 1570 );
-	f3( 1286, 1367, 1582 );
-	f3( 1512, 1466, 925 );
-	f3( 1478, 350, 1392 );
-	f3( 145, 963, 1581 );
-	f3( 957, 1181, 69 );
-	f3( 840, 1630, 92 );
-	f3( 1364, 1299, 276 );
-	f3( 1334, 1017, 1555 );
-	f3( 793, 143, 1178 );
-	f3( 68, 594, 150 );
-	f3( 870, 387, 112 );
-	f3( 426, 407, 1226 );
-	f3( 78, 260, 851 );
-	f3( 1164, 936, 1593 );
-	f3( 538, 589, 500 );
-	f3( 149, 1, 790 );
-	f3( 518, 728, 1205 );
-	f3( 409, 98, 1450 );
-	f3( 1433, 8, 1135 );
-	f3( 1502, 1113, 282 );
-	f3( 1515, 1369, 1021 );
-	f3( 158, 275, 901 );
-	f3( 735, 300, 1345 );
-	f3( 1211, 1260, 926 );
-	f3( 78, 335, 165 );
-	f3( 399, 1159, 1528 );
-	f3( 893, 472, 490 );
-	f3( 838, 624, 955 );
-	f3( 1503, 1131, 1007 );
-	f3( 486, 1036, 1419 );
-	f3( 879, 1103, 1142 );
-	f3( 1020, 458, 1272 );
-	f3( 1153, 236, 1446 );
-	f3( 1266, 775, 213 );
-	f3( 1519, 57, 749 );
-	f3( 145, 349, 861 );
-	f3( 1149, 883, 1079 );
-	f3( 814, 508, 924 );
-	f3( 762, 1094, 1227 );
-	f3( 328, 181, 1126 );
-	f3( 418, 535, 456 );
-	f3( 445, 816, 1018 );
-	f3( 984, 1046, 324 );
-	f3( 442, 788, 891 );
-	f3( 1407, 522, 842 );
-	f3( 241, 214, 1429 );
-	f3( 1338, 1104, 832 );
-	f3( 795, 605, 126 );
-	f3( 1029, 1607, 22 );
-	f3( 831, 1169, 540 );
-	f3( 1286, 1527, 1367 );
-	f3( 116, 1404, 729 );
-	f3( 627, 1552, 1074 );
-	f3( 884, 998, 678 );
-	f3( 272, 208, 1070 );
-	f3( 1234, 584, 957 );
-	f3( 224, 577, 6 );
-	f3( 1400, 911, 245 );
-	f3( 1451, 544, 322 );
-	f3( 1310, 165, 335 );
-	f3( 782, 983, 946 );
-	f3( 938, 358, 724 );
-	f3( 759, 1265, 521 );
-	f3( 605, 1144, 126 );
-	f3( 775, 1538, 317 );
-	f3( 200, 1250, 1039 );
-	f3( 2, 38, 184 );
-	f3( 913, 1631, 441 );
-	f3( 64, 1187, 1620 );
-	f3( 3, 1444, 1589 );
-	f3( 1580, 144, 1583 );
-	f3( 159, 483, 1050 );
-	f3( 1170, 23, 522 );
-	f3( 603, 868, 1625 );
-	f3( 1523, 682, 466 );
-	f3( 1340, 1100, 473 );
-	f3( 104, 588, 408 );
-	f3( 562, 658, 1277 );
-	f3( 667, 1388, 988 );
-	f3( 1177, 1612, 39 );
-	f3( 1185, 512, 60 );
-	f3( 1146, 879, 251 );
-	f3( 907, 651, 542 );
-	f3( 1337, 1346, 792 );
-	f3( 592, 984, 214 );
-	f3( 205, 1206, 1207 );
-	f3( 559, 674, 249 );
-	f3( 1060, 1233, 1627 );
-	f3( 1513, 579, 62 );
-	f3( 470, 1510, 1390 );
-	f3( 198, 378, 277 );
-	f3( 1538, 1074, 709 );
-	f3( 1080, 652, 1275 );
-	f3( 163, 152, 602 );
-	f3( 394, 986, 1141 );
-	f3( 293, 1238, 1063 );
-	f3( 597, 283, 731 );
-	f3( 1616, 1482, 1609 );
-	f3( 854, 1311, 1143 );
-	f3( 274, 34, 1068 );
-	f3( 123, 992, 553 );
-	f3( 1318, 20, 1003 );
-	f3( 49, 436, 942 );
-	f3( 1148, 196, 882 );
-	f3( 221, 63, 1472 );
-	f3( 202, 843, 119 );
-	f3( 725, 398, 19 );
-	f3( 1641, 929, 1436 );
-	f3( 1513, 1289, 579 );
-	f3( 474, 1616, 1198 );
-	f3( 1010, 71, 556 );
-	f3( 995, 77, 1466 );
-	f3( 660, 226, 63 );
-	f3( 57, 541, 749 );
-	f3( 613, 374, 64 );
-	f3( 1236, 894, 454 );
-	f3( 505, 1129, 885 );
-	f3( 1494, 285, 967 );
-	f3( 367, 586, 1614 );
-	f3( 1217, 727, 812 );
-	f3( 887, 1110, 967 );
-	f3( 955, 498, 674 );
-	f3( 436, 865, 1138 );
-	f3( 412, 824, 664 );
-	f3( 402, 1577, 1126 );
-	f3( 321, 601, 1159 );
-	f3( 302, 845, 1216 );
-	f3( 283, 1343, 538 );
-	f3( 1476, 1079, 547 );
-	f3( 1312, 371, 621 );
-	f3( 1520, 806, 785 );
-	f3( 761, 709, 216 );
-	f3( 288, 1627, 511 );
-	f3( 628, 951, 639 );
-	f3( 1263, 756, 349 );
-	f3( 1091, 1214, 560 );
-	f3( 574, 802, 1196 );
-	f3( 79, 887, 967 );
-	f3( 695, 1048, 670 );
-	f3( 169, 1176, 511 );
-	f3( 991, 828, 1463 );
-	f3( 1070, 1306, 537 );
-	f3( 1240, 1206, 637 );
-	f3( 1424, 1475, 46 );
-	f3( 895, 570, 166 );
-	f3( 565, 948, 1083 );
-	f3( 784, 521, 188 );
-	f3( 1021, 1369, 198 );
-	f3( 918, 1158, 1052 );
-	f3( 485, 1564, 153 );
-	f3( 268, 866, 1314 );
-	f3( 271, 11, 1457 );
-	f3( 166, 570, 1043 );
-	f3( 299, 1569, 867 );
-	f3( 1062, 30, 133 );
-	f3( 1015, 1144, 102 );
-	f3( 79, 967, 1578 );
-	f3( 1479, 1137, 672 );
-	f3( 828, 698, 1491 );
-	f3( 222, 118, 1347 );
-	f3( 546, 366, 1178 );
-	f3( 86, 832, 1580 );
-	f3( 965, 571, 406 );
-	f3( 1086, 682, 859 );
-	f3( 62, 849, 494 );
-	f3( 705, 437, 1038 );
-	f3( 1274, 103, 843 );
-	f3( 1313, 468, 970 );
-	f3( 1337, 217, 1028 );
-	f3( 283, 538, 364 );
-	f3( 727, 135, 1542 );
-	f3( 1345, 408, 1134 );
-	f3( 558, 211, 1045 );
-	f3( 698, 748, 1350 );
-	f3( 405, 909, 781 );
-	f3( 468, 138, 970 );
-	f3( 513, 1468, 1297 );
-	f3( 1420, 557, 1446 );
-	f3( 1420, 853, 747 );
-	f3( 177, 866, 582 );
-	f3( 683, 825, 1435 );
-	f3( 892, 164, 363 );
-	f3( 431, 1169, 194 );
-	f3( 133, 1283, 1433 );
-	f3( 127, 1044, 219 );
-	f3( 1043, 517, 585 );
-	f3( 10, 777, 794 );
-	f3( 1381, 1330, 1528 );
-	f3( 115, 1536, 1004 );
-	f3( 1524, 926, 1276 );
-	f3( 901, 928, 1090 );
-	f3( 620, 654, 932 );
-	f3( 94, 1234, 1540 );
-	f3( 1415, 754, 1506 );
-	f3( 1006, 178, 509 );
-	f3( 100, 156, 641 );
-	f3( 1280, 1029, 22 );
-	f3( 1380, 1488, 529 );
-	f3( 922, 1220, 452 );
-	f3( 1296, 329, 263 );
-	f3( 1618, 1379, 1564 );
-	f3( 1532, 622, 1102 );
-	f3( 1412, 215, 980 );
-	f3( 86, 1580, 1583 );
-	f3( 1423, 275, 771 );
-	f3( 706, 1562, 715 );
-	f3( 155, 281, 639 );
-	f3( 979, 1142, 1103 );
-	f3( 493, 784, 549 );
-	f3( 1043, 503, 1026 );
-	f3( 593, 1447, 1419 );
-	f3( 602, 1504, 1233 );
-	f3( 1128, 1110, 869 );
-	f3( 215, 1412, 1324 );
-	f3( 1409, 1252, 655 );
-	f3( 311, 1579, 1095 );
-	f3( 1560, 814, 1330 );
-	f3( 1512, 293, 848 );
-	f3( 738, 507, 1578 );
-	f3( 243, 1363, 974 );
-	f3( 56, 939, 1057 );
-	f3( 656, 1306, 462 );
-	f3( 696, 738, 97 );
-	f3( 424, 1632, 87 );
-	f3( 70, 1122, 1174 );
-	f3( 1507, 1095, 359 );
-	f3( 1363, 1284, 1497 );
-	f3( 144, 301, 1073 );
-	f3( 1358, 408, 1345 );
-	f3( 1137, 332, 856 );
-	f3( 962, 1026, 503 );
-	f3( 406, 1314, 965 );
-	f3( 772, 1151, 1046 );
-	f3( 1266, 773, 864 );
-	f3( 554, 388, 443 );
-	f3( 192, 1140, 332 );
-	f3( 1440, 519, 555 );
-	f3( 518, 140, 1597 );
-	f3( 334, 913, 373 );
-	f3( 1173, 1142, 323 );
-	f3( 255, 1616, 206 );
-	f3( 1480, 1448, 159 );
-	f3( 1406, 715, 1562 );
-	f3( 567, 1079, 1476 );
-	f3( 1511, 1586, 645 );
-	f3( 1166, 334, 373 );
-	f3( 1252, 787, 1256 );
-	f3( 486, 1419, 7 );
-	f3( 331, 459, 1590 );
-	f3( 1069, 1258, 563 );
-	f3( 1125, 35, 304 );
-	f3( 1223, 1530, 610 );
-	f3( 1567, 191, 210 );
-	f3( 283, 364, 731 );
-	f3( 1107, 725, 19 );
-	f3( 1625, 868, 101 );
-	f3( 796, 1181, 1493 );
-	f3( 193, 999, 100 );
-	f3( 427, 1495, 1215 );
-	f3( 542, 1080, 1054 );
-	f3( 1551, 1229, 33 );
-	f3( 1001, 672, 833 );
-	f3( 441, 658, 45 );
-	f3( 958, 1156, 142 );
-	f3( 585, 331, 1590 );
-	f3( 116, 1272, 1389 );
-	f3( 108, 637, 631 );
-	f3( 559, 862, 674 );
-	f3( 1288, 309, 1502 );
-	f3( 180, 889, 596 );
-	f3( 438, 471, 340 );
-	f3( 780, 1179, 98 );
-	f3( 1474, 1262, 1049 );
-	f3( 553, 819, 1193 );
-	f3( 556, 71, 748 );
-	f3( 405, 383, 909 );
-	f3( 240, 1297, 1244 );
-	f3( 331, 65, 901 );
-	f3( 874, 758, 141 );
-	f3( 598, 31, 1002 );
-	f3( 1451, 1341, 137 );
-	f3( 990, 30, 750 );
-	f3( 393, 883, 1149 );
-	f3( 185, 1324, 714 );
-	f3( 414, 391, 665 );
-	f3( 1452, 150, 594 );
-	f3( 867, 68, 541 );
-	f3( 559, 810, 300 );
-	f3( 390, 1323, 1455 );
-	f3( 212, 20, 1294 );
-	f3( 1188, 1370, 182 );
-	f3( 132, 574, 669 );
-	f3( 1069, 414, 665 );
-	f3( 447, 1287, 1048 );
-	f3( 796, 439, 256 );
-	f3( 1096, 880, 1464 );
-	f3( 153, 892, 403 );
-	f3( 587, 183, 890 );
-	f3( 446, 910, 418 );
-	f3( 69, 409, 1127 );
-	f3( 34, 274, 1255 );
-	f3( 346, 1431, 171 );
-	f3( 1047, 546, 1178 );
-	f3( 325, 1023, 1136 );
-	f3( 579, 782, 946 );
-	f3( 1071, 813, 18 );
-	f3( 1066, 620, 343 );
-	f3( 581, 836, 1639 );
-	f3( 1528, 244, 399 );
-	f3( 1124, 961, 395 );
-	f3( 848, 1572, 1424 );
-	f3( 764, 736, 122 );
-	f3( 641, 1329, 100 );
-	f3( 1046, 811, 772 );
-	f3( 881, 1009, 185 );
-	f3( 707, 1293, 590 );
-	f3( 610, 199, 726 );
-	f3( 34, 444, 1068 );
-	f3( 1260, 1276, 926 );
-	f3( 144, 1028, 301 );
-	f3( 642, 518, 294 );
-	f3( 1523, 72, 911 );
-	f3( 1108, 1134, 408 );
-	f3( 30, 1401, 927 );
-	f3( 1162, 681, 51 );
-	f3( 775, 842, 23 );
-	f3( 1065, 1381, 1405 );
-	f3( 1321, 669, 1016 );
-	f3( 689, 292, 1111 );
-	f3( 523, 826, 187 );
-	f3( 535, 724, 456 );
-	f3( 289, 954, 812 );
-	f3( 539, 471, 414 );
-	f3( 1498, 1261, 764 );
-	f3( 1312, 621, 1570 );
-	f3( 424, 87, 600 );
-	f3( 987, 1168, 1138 );
-	f3( 1012, 770, 27 );
-	f3( 1223, 610, 726 );
-	f3( 343, 912, 940 );
-	f3( 1041, 287, 1239 );
-	f3( 705, 523, 187 );
-	f3( 704, 978, 949 );
-	f3( 885, 1098, 893 );
-	f3( 1075, 140, 1130 );
-	f3( 591, 1516, 27 );
-	f3( 1515, 905, 118 );
-	f3( 1479, 282, 1137 );
-	f3( 45, 658, 291 );
-	f3( 1411, 1206, 152 );
-	f3( 816, 649, 1018 );
-	f3( 785, 1208, 1520 );
-	f3( 1413, 264, 661 );
-	f3( 1094, 568, 1227 );
-	f3( 858, 1268, 1145 );
-	f3( 1111, 7, 1419 );
-	f3( 66, 908, 303 );
-	f3( 1622, 1636, 316 );
-	f3( 1634, 981, 1395 );
-	f3( 1138, 1168, 942 );
-	f3( 389, 1247, 648 );
-	f3( 634, 698, 171 );
-	f3( 1305, 736, 764 );
-	f3( 471, 391, 414 );
-	f3( 183, 67, 975 );
-	f3( 30, 1335, 1401 );
-	f3( 1331, 1361, 1224 );
-	f3( 1534, 371, 1591 );
-	f3( 105, 1339, 417 );
-	f3( 1513, 397, 1199 );
-	f3( 612, 790, 1 );
-	f3( 662, 773, 960 );
-	f3( 867, 1076, 326 );
-	f3( 1448, 1088, 159 );
-	f3( 288, 590, 460 );
-	f3( 367, 695, 932 );
-	f3( 109, 1501, 1568 );
-	f3( 952, 918, 435 );
-	f3( 113, 111, 1017 );
-	f3( 1493, 83, 552 );
-	f3( 403, 892, 895 );
-	f3( 255, 206, 1620 );
-	f3( 53, 1417, 1472 );
-	f3( 882, 1053, 291 );
-	f3( 174, 384, 702 );
-	f3( 723, 222, 1347 );
-	f3( 992, 1219, 1386 );
-	f3( 1011, 730, 295 );
-	f3( 433, 1546, 125 );
-	f3( 1505, 307, 1595 );
-	f3( 945, 653, 138 );
-	f3( 0, 340, 630 );
-	f3( 258, 11, 1629 );
-	f3( 835, 322, 315 );
-	f3( 202, 1613, 1540 );
-	f3( 3, 518, 769 );
-	f3( 1092, 699, 1526 );
-	f3( 1034, 142, 871 );
-	f3( 553, 992, 819 );
-	f3( 614, 678, 1396 );
-	f3( 504, 589, 217 );
-	f3( 948, 1624, 188 );
-	f3( 868, 1123, 1291 );
-	f3( 220, 167, 1406 );
-	f3( 238, 1633, 1342 );
-	f3( 1070, 385, 931 );
-	f3( 891, 1587, 978 );
-	f3( 772, 1348, 253 );
-	f3( 694, 178, 859 );
-	f3( 640, 618, 945 );
-	f3( 930, 794, 777 );
-	f3( 1548, 1267, 155 );
-	f3( 402, 1109, 498 );
-	f3( 1415, 137, 754 );
-	f3( 1476, 227, 567 );
-	f3( 1145, 44, 1403 );
-	f3( 9, 826, 160 );
-	f3( 1518, 297, 429 );
-	f3( 1628, 983, 782 );
-	f3( 60, 512, 254 );
-	f3( 707, 41, 147 );
-	f3( 270, 1536, 115 );
-	f3( 201, 904, 200 );
-	f3( 573, 566, 179 );
-	f3( 299, 632, 143 );
-	f3( 118, 1280, 1515 );
-	f3( 1041, 74, 308 );
-	f3( 1055, 1247, 389 );
-	f3( 1023, 981, 1221 );
-	f3( 1408, 316, 47 );
-	f3( 13, 1136, 401 );
-	f3( 1456, 1620, 206 );
-	f3( 664, 1139, 934 );
-	f3( 444, 34, 1397 );
-	f3( 144, 1073, 860 );
-	f3( 977, 701, 319 );
-	f3( 631, 1060, 804 );
-	f3( 1273, 370, 1428 );
-	f3( 422, 47, 1631 );
-	f3( 1461, 259, 1212 );
-	f3( 112, 327, 1623 );
-	f3( 990, 750, 1442 );
-	f3( 625, 547, 1079 );
-	f3( 1225, 947, 1307 );
-	f3( 1435, 727, 683 );
-	f3( 1603, 540, 157 );
-	f3( 1057, 1584, 921 );
-	f3( 1539, 1067, 1224 );
-	f3( 759, 1523, 466 );
-	f3( 1531, 513, 307 );
-	f3( 1015, 864, 1218 );
-	f3( 4, 389, 1499 );
-	f3( 1125, 84, 684 );
-	f3( 1574, 1418, 743 );
-	f3( 501, 1610, 1022 );
-	f3( 1592, 36, 914 );
-	f3( 1359, 205, 1210 );
-	f3( 146, 663, 438 );
-	f3( 1636, 1622, 50 );
-	f3( 136, 878, 1402 );
-	f3( 1344, 397, 1036 );
-	f3( 1005, 837, 668 );
-	f3( 999, 193, 1398 );
-	f3( 223, 728, 518 );
-	f3( 575, 1185, 852 );
-	f3( 744, 797, 985 );
-	f3( 798, 972, 230 );
-	f3( 791, 1011, 1189 );
-	f3( 1316, 318, 1146 );
-	f3( 164, 892, 153 );
-	f3( 1498, 1316, 348 );
-	f3( 1498, 348, 235 );
-	f3( 1370, 1188, 245 );
-	f3( 370, 1273, 991 );
-	f3( 457, 51, 154 );
-	f3( 506, 868, 1291 );
-	f3( 788, 442, 1003 );
-	f3( 132, 1002, 1287 );
-	f3( 532, 337, 679 );
-	f3( 488, 566, 805 );
-	f3( 1554, 871, 254 );
-	f3( 123, 451, 779 );
-	f3( 126, 875, 1221 );
-	f3( 1174, 1090, 734 );
-	f3( 409, 69, 780 );
-	f3( 190, 1159, 399 );
-	f3( 524, 211, 1378 );
-	f3( 1573, 1486, 204 );
-	f3( 891, 978, 1425 );
-	f3( 1634, 1221, 981 );
-	f3( 1181, 957, 1493 );
-	f3( 1606, 85, 1596 );
-	f3( 338, 1184, 219 );
-	f3( 1241, 555, 519 );
-	f3( 623, 397, 494 );
-	f3( 171, 698, 1350 );
-	f3( 1012, 81, 857 );
-	f3( 1232, 1548, 155 );
-	f3( 751, 1434, 309 );
-	f3( 35, 684, 420 );
-	f3( 255, 937, 130 );
-	f3( 517, 1043, 570 );
-	f3( 730, 791, 450 );
-	f3( 10, 1349, 452 );
-	f3( 1523, 911, 1400 );
-	f3( 675, 547, 1208 );
-	f3( 1423, 1528, 1159 );
-	f3( 677, 713, 208 );
-	f3( 16, 238, 526 );
-	f3( 530, 1547, 306 );
-	f3( 1359, 1210, 87 );
-	f3( 354, 141, 1058 );
-	f3( 648, 670, 37 );
-	f3( 520, 1322, 915 );
-	f3( 991, 1463, 1410 );
-	f3( 461, 897, 561 );
-	f3( 603, 197, 1153 );
-	f3( 1498, 1549, 1261 );
-	f3( 1622, 172, 186 );
-	f3( 491, 626, 209 );
-	f3( 1413, 800, 1596 );
-	f3( 960, 775, 317 );
-	f3( 213, 960, 773 );
-	f3( 209, 874, 141 );
-	f3( 1591, 1526, 1427 );
-	f3( 1312, 1570, 1254 );
-	f3( 563, 1258, 857 );
-	f3( 1003, 1053, 788 );
-	f3( 26, 1189, 58 );
-	f3( 1442, 750, 488 );
-	f3( 1231, 151, 421 );
-	f3( 312, 1265, 560 );
-	f3( 1407, 842, 888 );
-	f3( 1521, 712, 1430 );
-	f3( 322, 608, 315 );
-	f3( 1133, 1114, 1559 );
-	f3( 418, 456, 1244 );
-	f3( 1020, 1272, 1163 );
-	f3( 216, 1552, 807 );
-	f3( 727, 1435, 700 );
-	f3( 531, 91, 1234 );
-	f3( 1020, 1163, 80 );
-	f3( 1434, 533, 309 );
-	f3( 1631, 658, 441 );
-	f3( 161, 1068, 444 );
-	f3( 1111, 1419, 1447 );
-	f3( 182, 384, 1188 );
-	f3( 891, 788, 1535 );
-	f3( 864, 808, 1172 );
-	f3( 419, 1124, 395 );
-	f3( 1483, 777, 1220 );
-	f3( 352, 282, 1113 );
-	f3( 358, 938, 486 );
-	f3( 847, 1196, 306 );
-	f3( 500, 589, 504 );
-	f3( 302, 1032, 1200 );
-	f3( 548, 1639, 479 );
-	f3( 38, 1246, 360 );
-	f3( 1178, 56, 793 );
-	f3( 1221, 1634, 126 );
-	f3( 1627, 169, 511 );
-	f3( 267, 1575, 29 );
-	f3( 1025, 1426, 969 );
-	f3( 268, 1273, 877 );
-	f3( 1149, 192, 1541 );
-	f3( 884, 342, 998 );
-	f3( 114, 1533, 1203 );
-	f3( 1086, 170, 682 );
-	f3( 1397, 55, 1486 );
-	f3( 500, 504, 471 );
-	f3( 1398, 193, 1278 );
-	f3( 1308, 306, 1038 );
-	f3( 1196, 246, 306 );
-	f3( 117, 1195, 614 );
-	f3( 1610, 628, 639 );
-	f3( 258, 1629, 1099 );
-	f3( 759, 262, 72 );
-	f3( 1417, 263, 1472 );
-	f3( 502, 1043, 936 );
-	f3( 1071, 650, 657 );
-	f3( 791, 1495, 29 );
-	f3( 1042, 1018, 1368 );
-	f3( 1518, 834, 472 );
-	f3( 403, 485, 153 );
-	f3( 1450, 98, 937 );
-	f3( 1384, 1601, 468 );
-	f3( 308, 645, 1586 );
-	f3( 1068, 880, 1162 );
-	f3( 891, 1022, 1112 );
-	f3( 1130, 140, 642 );
-	f3( 740, 972, 801 );
-	f3( 756, 823, 746 );
-	f3( 1412, 150, 1366 );
-	f3( 1624, 948, 565 );
-	f3( 702, 384, 1507 );
-	f3( 44, 855, 1346 );
-	f3( 1172, 1266, 864 );
-	f3( 133, 30, 927 );
-	f3( 627, 373, 1448 );
-	f3( 613, 64, 546 );
-	f3( 1588, 660, 671 );
-	f3( 377, 475, 1046 );
-	f3( 457, 1558, 1519 );
-	f3( 538, 500, 539 );
-	f3( 1527, 800, 1082 );
-	f3( 485, 1167, 647 );
-	f3( 830, 32, 1179 );
-	f3( 160, 1120, 1020 );
-	f3( 679, 970, 653 );
-	f3( 1123, 1622, 1291 );
-	f3( 981, 325, 1061 );
-	f3( 1092, 4, 76 );
-	f3( 1569, 299, 428 );
-	f3( 619, 176, 1402 );
-	f3( 1005, 1529, 837 );
-	f3( 960, 213, 775 );
-	f3( 1520, 1208, 625 );
-	f3( 964, 479, 1639 );
-	f3( 1200, 1433, 302 );
-	f3( 368, 840, 92 );
-	f3( 1231, 1236, 1077 );
-	f3( 724, 1036, 938 );
-	f3( 1129, 505, 1278 );
-	f3( 1167, 1281, 1269 );
-	f3( 349, 145, 1263 );
-	f3( 358, 486, 7 );
-	f3( 669, 1321, 1059 );
-	f3( 1392, 350, 1543 );
-	f3( 1547, 523, 705 );
-	f3( 1274, 1345, 379 );
-	f3( 1461, 105, 259 );
-	f3( 1193, 228, 553 );
-	f3( 693, 789, 1570 );
-	f3( 1638, 1084, 493 );
-	f3( 171, 1350, 346 );
-	f3( 160, 826, 523 );
-	f3( 1104, 1403, 1346 );
-	f3( 1632, 1504, 602 );
-	f3( 1404, 327, 387 );
-	f3( 1585, 1320, 1248 );
-	f3( 576, 410, 1522 );
-	f3( 1269, 688, 664 );
-	f3( 1476, 1464, 227 );
-	f3( 529, 247, 1549 );
-	f3( 629, 1099, 1629 );
-	f3( 471, 539, 500 );
-	f3( 1248, 1320, 1445 );
-	f3( 1125, 684, 35 );
-	f3( 1378, 314, 411 );
-	f3( 1354, 614, 207 );
-	f3( 1530, 763, 610 );
-	f3( 1239, 287, 415 );
-	f3( 1008, 596, 465 );
-	f3( 1010, 313, 1599 );
-	f3( 1129, 2, 184 );
-	f3( 707, 511, 1606 );
-	f3( 340, 504, 630 );
-	f3( 195, 1379, 1618 );
-	f3( 1531, 1191, 1468 );
-	f3( 1460, 835, 315 );
-	f3( 528, 514, 120 );
-	f3( 52, 1431, 1260 );
-	f3( 382, 1458, 337 );
-	f3( 191, 1567, 580 );
-	f3( 25, 545, 1319 );
-	f3( 475, 537, 453 );
-	f3( 358, 1369, 1607 );
-	f3( 597, 144, 578 );
-	f3( 1270, 1052, 1158 );
-	f3( 1179, 780, 830 );
-	f3( 687, 627, 284 );
-	f3( 1522, 1064, 576 );
-	f3( 1101, 619, 1402 );
-	f3( 603, 1165, 197 );
-	f3( 595, 1344, 910 );
-	f3( 1000, 1077, 1155 );
-	f3( 1624, 481, 821 );
-	f3( 749, 541, 150 );
-	f3( 953, 811, 722 );
-	f3( 240, 724, 279 );
-	f3( 797, 993, 1183 );
-	f3( 221, 157, 671 );
-	f3( 738, 1605, 507 );
-	f3( 748, 698, 1222 );
-	f3( 1613, 119, 1352 );
-	f3( 1013, 309, 1288 );
-	f3( 890, 183, 514 );
-	f3( 1551, 1444, 3 );
-	f3( 222, 729, 1404 );
-	f3( 738, 785, 97 );
-	f3( 659, 8, 718 );
-	f3( 900, 386, 666 );
-	f3( 620, 1055, 343 );
-	f3( 430, 220, 1511 );
-	f3( 696, 1215, 1546 );
-	f3( 400, 1112, 107 );
-	f3( 497, 455, 79 );
-	f3( 114, 1203, 96 );
-	f3( 11, 1031, 1629 );
-	f3( 1353, 1150, 1382 );
-	f3( 1193, 1097, 228 );
-	f3( 1315, 615, 1405 );
-	f3( 298, 989, 1563 );
-	f3( 1336, 499, 439 );
-	f3( 1167, 403, 1281 );
-	f3( 224, 1016, 347 );
-	f3( 387, 407, 1385 );
-	f3( 717, 612, 1 );
-	f3( 1343, 597, 578 );
-	f3( 695, 1614, 447 );
-	f3( 1101, 1533, 114 );
-	f3( 536, 774, 1064 );
-	f3( 957, 69, 1635 );
-	f3( 570, 895, 363 );
-	f3( 1337, 1580, 1104 );
-	f3( 329, 1296, 445 );
-	f3( 831, 540, 1603 );
-	f3( 247, 778, 995 );
-	f3( 330, 994, 543 );
-	f3( 1223, 416, 377 );
-	f3( 1420, 481, 951 );
-	f3( 1624, 549, 1072 );
-	f3( 495, 236, 1590 );
-	f3( 1445, 1119, 1191 );
-	f3( 803, 90, 1463 );
-	f3( 760, 1429, 839 );
-	f3( 980, 1519, 749 );
-	f3( 943, 144, 860 );
-	f3( 1225, 119, 843 );
-	f3( 924, 1542, 1528 );
-	f3( 1637, 1362, 1269 );
-	f3( 48, 1239, 1368 );
-	f3( 1041, 1586, 1562 );
-	f3( 505, 1294, 20 );
-	f3( 953, 722, 1094 );
-	f3( 65, 331, 585 );
-	f3( 1380, 1095, 1579 );
-	f3( 1055, 234, 1247 );
-	f3( 1381, 1065, 1330 );
-	f3( 375, 1589, 691 );
-	f3( 1096, 1432, 355 );
-	f3( 959, 1119, 977 );
-	f3( 505, 1081, 1398 );
-	f3( 450, 1202, 336 );
-	f3( 1024, 1125, 304 );
-	f3( 910, 1344, 535 );
-	f3( 789, 693, 912 );
-	f3( 439, 552, 1336 );
-	f3( 578, 301, 1028 );
-	f3( 366, 1456, 56 );
-	f3( 1264, 219, 795 );
-	f3( 144, 597, 356 );
-	f3( 1271, 1598, 1587 );
-	f3( 295, 31, 1011 );
-	f3( 899, 616, 1292 );
-	f3( 853, 628, 716 );
-	f3( 1109, 181, 947 );
-	f3( 397, 595, 1199 );
-	f3( 480, 708, 1327 );
-	f3( 189, 923, 1263 );
-	f3( 1592, 1449, 922 );
-	f3( 964, 242, 745 );
-	f3( 1469, 666, 191 );
-	f3( 288, 511, 590 );
-	f3( 955, 624, 498 );
-	f3( 588, 1372, 408 );
-	f3( 302, 1433, 845 );
-	f3( 1440, 321, 1159 );
-	f3( 761, 807, 732 );
-	f3( 1196, 802, 246 );
-	f3( 1520, 625, 1171 );
-	f3( 435, 1008, 952 );
-	f3( 1265, 759, 170 );
-	f3( 385, 537, 475 );
-	f3( 1407, 888, 914 );
-	f3( 723, 1347, 668 );
-	f3( 1134, 735, 1345 );
-	f3( 973, 472, 834 );
-	f3( 429, 1298, 1518 );
-	f3( 1245, 266, 979 );
-	f3( 638, 5, 487 );
-	f3( 221, 825, 157 );
-	f3( 1521, 1430, 598 );
-	f3( 168, 1118, 697 );
-	f3( 190, 1440, 1159 );
-	f3( 495, 1638, 821 );
-	f3( 568, 462, 713 );
-	f3( 1479, 661, 390 );
-	f3( 35, 420, 1146 );
-	f3( 1415, 1192, 1408 );
-	f3( 217, 630, 504 );
-	f3( 120, 635, 528 );
-	f3( 1274, 1358, 1345 );
-	f3( 835, 1451, 322 );
-	f3( 1185, 60, 852 );
-	f3( 1587, 1285, 545 );
-	f3( 1471, 422, 1033 );
-	f3( 235, 177, 1600 );
-	f3( 1626, 974, 503 );
-	f3( 1016, 1374, 1308 );
-	f3( 4, 1055, 389 );
-	f3( 1039, 1615, 583 );
-	f3( 422, 1471, 47 );
-	f3( 503, 1160, 1626 );
-	f3( 242, 836, 248 );
-	f3( 533, 1202, 29 );
-	f3( 647, 1362, 485 );
-	f3( 1633, 869, 465 );
-	f3( 1366, 150, 1452 );
-	f3( 1433, 1135, 845 );
-	f3( 1387, 1465, 1593 );
-	f3( 780, 1181, 830 );
-	f3( 310, 275, 158 );
-	f3( 480, 1383, 708 );
-	f3( 755, 839, 1326 );
-	f3( 13, 401, 1253 );
-	f3( 1274, 843, 202 );
-	f3( 975, 1363, 183 );
-	f3( 116, 729, 484 );
-	f3( 1552, 607, 807 );
-	f3( 957, 531, 1234 );
-	f3( 578, 1073, 301 );
-	f3( 1237, 978, 1418 );
-	f3( 1108, 1372, 737 );
-	f3( 943, 1073, 217 );
-	f3( 907, 1322, 122 );
-	f3( 839, 214, 1326 );
-	f3( 1613, 1352, 94 );
-	f3( 1557, 54, 844 );
-	f3( 677, 208, 115 );
-	f3( 1324, 1483, 714 );
-	f3( 80, 1004, 1536 );
-	f3( 1240, 108, 1207 );
-	f3( 607, 1552, 841 );
-	f3( 1173, 404, 131 );
-	f3( 1253, 1001, 13 );
-	f3( 1450, 1556, 611 );
-	f3( 21, 659, 1083 );
-	f3( 220, 1406, 1562 );
-	f3( 700, 1325, 812 );
-	f3( 457, 154, 357 );
-	f3( 141, 950, 1058 );
-	f3( 1169, 1588, 540 );
-	f3( 1015, 808, 864 );
-	f3( 1507, 365, 1640 );
-	f3( 1248, 1191, 1531 );
-	f3( 1152, 1618, 65 );
-	f3( 1516, 1386, 1219 );
-	f3( 442, 1112, 400 );
-	f3( 321, 1084, 459 );
-	f3( 187, 437, 705 );
-	f3( 1198, 1616, 130 );
-	f3( 343, 1576, 912 );
-	f3( 933, 1214, 886 );
-	f3( 1005, 905, 903 );
-	f3( 665, 391, 1258 );
-	f3( 524, 1064, 211 );
-	f3( 1381, 1528, 771 );
-	f3( 663, 1258, 391 );
-	f3( 954, 1217, 812 );
-	f3( 1248, 1531, 307 );
-	f3( 993, 864, 773 );
-	f3( 45, 569, 441 );
-	f3( 784, 783, 262 );
-	f3( 888, 1172, 808 );
-	f3( 1490, 1532, 1336 );
-	f3( 1311, 851, 1143 );
-	f3( 637, 108, 1240 );
-	f3( 775, 1170, 1538 );
-	f3( 1582, 401, 797 );
-	f3( 1534, 621, 371 );
-	f3( 1152, 164, 195 );
-	f3( 1507, 384, 365 );
-	f3( 1110, 887, 952 );
-	f3( 567, 1149, 1079 );
-	f3( 1591, 1312, 1254 );
-	f3( 580, 1567, 944 );
-	f3( 249, 674, 498 );
-	f3( 1569, 1035, 867 );
-	f3( 689, 1111, 762 );
-	f3( 104, 1358, 91 );
-	f3( 260, 141, 271 );
-	f3( 1458, 720, 1462 );
-	f3( 1025, 1376, 1426 );
-	f3( 244, 1528, 1542 );
-	f3( 612, 1481, 790 );
-	f3( 951, 1232, 155 );
-	f3( 680, 663, 633 );
-	f3( 37, 1002, 295 );
-	f3( 831, 1328, 194 );
-	f3( 1171, 1503, 1259 );
-	f3( 1180, 561, 1075 );
-	f3( 444, 1397, 1140 );
-	f3( 1415, 129, 137 );
-	f3( 1537, 1295, 606 );
-	f3( 788, 1053, 196 );
-	f3( 16, 18, 920 );
-	f3( 1224, 474, 499 );
-	f3( 1171, 1259, 806 );
-	f3( 1640, 746, 676 );
-	f3( 916, 342, 304 );
-	f3( 676, 1095, 1640 );
-	f3( 629, 1478, 1099 );
-	f3( 78, 851, 1311 );
-	f3( 764, 46, 1475 );
-	f3( 1405, 717, 1065 );
-	f3( 1295, 426, 586 );
-	f3( 779, 110, 966 );
-	f3( 222, 723, 1154 );
-	f3( 799, 237, 1470 );
-	f3( 838, 1501, 86 );
-	f3( 1621, 673, 351 );
-	f3( 1532, 1490, 94 );
-	f3( 33, 1229, 146 );
-	f3( 77, 572, 550 );
-	f3( 1636, 562, 1277 );
-	f3( 25, 1319, 703 );
-	f3( 1551, 680, 633 );
-	f3( 1138, 865, 987 );
-	f3( 469, 1019, 230 );
-	f3( 27, 770, 591 );
-	f3( 354, 1310, 878 );
-	f3( 1328, 1327, 1557 );
-	f3( 752, 720, 293 );
-	f3( 743, 1418, 704 );
-	f3( 1597, 140, 897 );
-	f3( 1568, 187, 109 );
-	f3( 1488, 1579, 345 );
-	f3( 1068, 1464, 880 );
-	f3( 533, 1093, 309 );
-	f3( 508, 814, 380 );
-	f3( 974, 1363, 1497 );
-	f3( 91, 202, 1540 );
-	f3( 1353, 1382, 1213 );
-	f3( 745, 242, 319 );
-	f3( 850, 1245, 1555 );
-	f3( 419, 550, 1124 );
-	f3( 61, 976, 314 );
-	f3( 655, 871, 142 );
-	f3( 686, 305, 1408 );
-	f3( 1160, 502, 1164 );
-	f3( 1233, 362, 169 );
-	f3( 1439, 884, 476 );
-	f3( 1591, 1416, 1534 );
-	f3( 171, 52, 1391 );
-	f3( 243, 120, 514 );
-	f3( 612, 1506, 1481 );
-	f3( 1280, 118, 222 );
-	f3( 583, 200, 1039 );
-	f3( 529, 235, 1600 );
-	f3( 58, 31, 1430 );
-	f3( 741, 330, 543 );
-	f3( 397, 1344, 595 );
-	f3( 14, 937, 1365 );
-	f3( 1632, 776, 1504 );
-	f3( 964, 1639, 836 );
-	f3( 115, 272, 270 );
-	f3( 950, 165, 1058 );
-	f3( 1166, 1040, 334 );
-	f3( 708, 930, 1327 );
-	f3( 373, 1088, 1448 );
-	f3( 1570, 269, 616 );
-	f3( 463, 128, 394 );
-	f3( 737, 1372, 507 );
-	f3( 1442, 488, 805 );
-	f3( 532, 382, 337 );
-	f3( 181, 1307, 947 );
-	f3( 1641, 667, 395 );
-	f3( 1532, 1010, 1336 );
-	f3( 1459, 239, 1182 );
-	f3( 1484, 1487, 1500 );
-	f3( 772, 593, 534 );
-	f3( 226, 443, 388 );
-	f3( 505, 1398, 1278 );
-	f3( 718, 1083, 659 );
-	f3( 983, 1628, 551 );
-	f3( 991, 1410, 370 );
-	f3( 100, 107, 156 );
-	f3( 1580, 1028, 144 );
-	f3( 1012, 857, 770 );
-	f3( 124, 339, 538 );
-	f3( 1502, 1093, 286 );
-	f3( 829, 717, 615 );
-	f3( 1423, 1159, 601 );
-	f3( 1042, 1368, 415 );
-	f3( 176, 1300, 1098 );
-	f3( 1145, 1268, 270 );
-	f3( 375, 223, 518 );
-	f3( 73, 447, 1373 );
-	f3( 435, 180, 1008 );
-	f3( 314, 469, 61 );
-	f3( 493, 549, 1638 );
-	f3( 657, 374, 134 );
-	f3( 681, 381, 154 );
-	f3( 437, 187, 1568 );
-	f3( 38, 2, 425 );
-	f3( 1551, 3, 1410 );
-	f3( 739, 794, 708 );
-	f3( 1470, 1302, 799 );
-	f3( 908, 210, 1106 );
-	f3( 654, 620, 1364 );
-	f3( 46, 1261, 873 );
-	f3( 1546, 433, 1605 );
-	f3( 1215, 1495, 26 );
-	f3( 1434, 76, 336 );
-	f3( 762, 1447, 953 );
-	f3( 459, 601, 321 );
-	f3( 1135, 1214, 1333 );
-	f3( 1230, 701, 1119 );
-	f3( 686, 829, 305 );
-	f3( 1199, 595, 1639 );
-	f3( 1541, 1137, 352 );
-	f3( 1287, 1002, 1048 );
-	f3( 129, 47, 1471 );
-	f3( 1179, 32, 492 );
-	f3( 1570, 616, 693 );
-	f3( 825, 221, 1435 );
-	f3( 123, 1219, 992 );
-	f3( 1117, 804, 1604 );
-	f3( 427, 1371, 696 );
-	f3( 318, 1322, 520 );
-	f3( 712, 1546, 1430 );
-	f3( 792, 630, 1337 );
-	f3( 157, 1611, 1603 );
-	f3( 250, 841, 159 );
-	f3( 901, 601, 331 );
-	f3( 1017, 850, 1555 );
-	f3( 248, 836, 581 );
-	f3( 844, 1107, 19 );
-	f3( 251, 1173, 406 );
-	f3( 1574, 743, 1420 );
-	f3( 1210, 1416, 1591 );
-	f3( 1356, 697, 1118 );
-	f3( 256, 1147, 32 );
-	f3( 741, 753, 1049 );
-	f3( 393, 352, 1113 );
-	f3( 247, 1261, 1549 );
-	f3( 1170, 522, 687 );
-	f3( 1480, 627, 1448 );
-	f3( 72, 262, 1437 );
-	f3( 1482, 1067, 1296 );
-	f3( 555, 1241, 413 );
-	f3( 1236, 421, 894 );
-	f3( 226, 660, 398 );
-	f3( 501, 1425, 1610 );
-	f3( 190, 987, 865 );
-	f3( 1049, 323, 1474 );
-	f3( 1222, 543, 994 );
-	f3( 818, 821, 481 );
-	f3( 679, 337, 173 );
-	f3( 280, 1370, 245 );
-	f3( 1177, 857, 81 );
-	f3( 265, 1102, 622 );
-	f3( 1513, 1115, 1289 );
-	f3( 779, 634, 110 );
-	f3( 1565, 951, 481 );
-	f3( 757, 1040, 575 );
-	f3( 688, 1281, 412 );
-	f3( 504, 340, 471 );
-	f3( 5, 1232, 690 );
-	f3( 940, 1489, 1066 );
-	f3( 177, 235, 965 );
-	f3( 648, 295, 730 );
-	f3( 153, 1564, 1379 );
-	f3( 742, 1051, 1091 );
-	f3( 78, 165, 950 );
-	f3( 1107, 361, 820 );
-	f3( 544, 757, 575 );
-	f3( 1069, 563, 1438 );
-	f3( 5, 209, 1548 );
-	f3( 1444, 33, 438 );
-	f3( 250, 1050, 472 );
-	f3( 66, 944, 908 );
-	f3( 1473, 210, 191 );
-	f3( 1200, 488, 1062 );
-	f3( 1220, 714, 1483 );
-	f3( 702, 896, 582 );
-	f3( 1453, 711, 396 );
-	f3( 869, 1633, 1303 );
-	f3( 506, 1625, 101 );
-	f3( 1637, 1309, 934 );
-	f3( 1516, 356, 1012 );
-	f3( 785, 1494, 1208 );
-	f3( 426, 1226, 809 );
-	f3( 846, 640, 333 );
-	f3( 1341, 1235, 137 );
-	f3( 585, 1465, 1387 );
-	f3( 379, 810, 103 );
-	f3( 347, 1308, 862 );
-	f3( 328, 926, 1524 );
-	f3( 631, 721, 982 );
-	f3( 1270, 1158, 455 );
-	f3( 557, 703, 1446 );
-	f3( 462, 369, 713 );
-	f3( 1087, 319, 242 );
-	f3( 383, 515, 850 );
-	f3( 653, 945, 618 );
-	f3( 1583, 968, 941 );
-	f3( 1561, 1096, 355 );
-	f3( 222, 1595, 1280 );
-	f3( 712, 737, 125 );
-	f3( 899, 1292, 1543 );
-	f3( 158, 1090, 40 );
-	f3( 1459, 906, 239 );
-	f3( 267, 29, 427 );
-	f3( 1502, 1121, 1288 );
-	f3( 710, 713, 644 );
-	f3( 604, 362, 1504 );
-	f3( 232, 1024, 342 );
-	f3( 289, 812, 1325 );
-	f3( 928, 734, 1090 );
-	f3( 363, 895, 892 );
-	f3( 799, 1302, 430 );
-	f3( 1021, 905, 1515 );
-	f3( 477, 50, 1148 );
-	f3( 350, 1228, 548 );
-	f3( 430, 1511, 237 );
-	f3( 1459, 1182, 971 );
-	f3( 1537, 654, 1295 );
-	f3( 51, 681, 154 );
-	f3( 1494, 1110, 1128 );
-	f3( 872, 1014, 754 );
-	f3( 534, 1348, 772 );
-	f3( 337, 1388, 173 );
-	f3( 234, 1055, 620 );
-	f3( 1110, 952, 869 );
-	f3( 1060, 163, 1233 );
-	f3( 763, 1530, 1051 );
-	f3( 1007, 1575, 267 );
-	f3( 1482, 1616, 474 );
-	f3( 704, 949, 25 );
-	f3( 1378, 536, 524 );
-	f3( 1505, 426, 1248 );
-	f3( 849, 62, 946 );
-	f3( 958, 480, 1328 );
-	f3( 1482, 1296, 1609 );
-	f3( 1304, 423, 837 );
-	f3( 798, 1190, 673 );
-	f3( 1242, 374, 75 );
-	f3( 1473, 510, 210 );
-	f3( 1627, 288, 1604 );
-	f3( 903, 277, 292 );
-	f3( 505, 20, 1081 );
-	f3( 212, 1003, 20 );
-	f3( 1410, 3, 370 );
-	f3( 1437, 945, 911 );
-	f3( 447, 1614, 1373 );
-	f3( 692, 575, 1166 );
-	f3( 474, 1198, 256 );
-	f3( 1455, 604, 776 );
-	f3( 1318, 442, 400 );
-	f3( 265, 328, 1524 );
-	f3( 494, 42, 623 );
-	f3( 635, 1626, 1160 );
-	f3( 390, 1455, 1288 );
-	f3( 1596, 264, 1413 );
-	f3( 176, 619, 386 );
-	f3( 1566, 1113, 24 );
-	f3( 1259, 97, 806 );
-	f3( 1120, 523, 1547 );
-	f3( 1188, 384, 174 );
-	f3( 453, 656, 722 );
-	f3( 1194, 1150, 805 );
-	f3( 317, 1538, 162 );
-	f3( 1433, 1283, 8 );
-	f3( 687, 368, 1185 );
-	f3( 1441, 1281, 403 );
-	f3( 65, 1618, 901 );
-	f3( 234, 620, 932 );
-	f3( 1548, 1232, 5 );
-	f3( 1177, 81, 1612 );
-	f3( 1, 1560, 1065 );
-	f3( 760, 392, 241 );
-	f3( 84, 411, 314 );
-	f3( 1269, 1309, 1637 );
-	f3( 767, 148, 1470 );
-	f3( 628, 853, 951 );
-	f3( 376, 1263, 923 );
-	f3( 1397, 332, 1140 );
-	f3( 122, 651, 907 );
-	f3( 1233, 163, 602 );
-	f3( 98, 130, 937 );
-	f3( 1189, 26, 1495 );
-	f3( 1191, 1248, 1445 );
-	f3( 136, 360, 491 );
-	f3( 359, 1095, 1380 );
-	f3( 1502, 286, 1113 );
-	f3( 1420, 747, 1574 );
-	f3( 523, 1120, 160 );
-	f3( 328, 265, 1307 );
-	f3( 1200, 1062, 133 );
-	f3( 1404, 387, 1385 );
-	f3( 655, 1252, 1421 );
-	f3( 519, 1440, 190 );
-	f3( 562, 50, 477 );
-	f3( 56, 1178, 366 );
-	f3( 1122, 1290, 233 );
-	f3( 1116, 1456, 1393 );
-	f3( 536, 411, 1368 );
-	f3( 162, 1286, 662 );
-	f3( 1035, 361, 54 );
-	f3( 468, 280, 138 );
-	f3( 1591, 371, 1312 );
-	f3( 85, 863, 661 );
-	f3( 400, 107, 100 );
-	f3( 364, 538, 339 );
-	f3( 1523, 694, 682 );
-	f3( 1200, 917, 488 );
-	f3( 1420, 951, 853 );
-	f3( 1427, 1210, 1591 );
-	f3( 21, 521, 1265 );
-	f3( 189, 929, 1317 );
-	f3( 1207, 108, 1469 );
-	f3( 1422, 1509, 175 );
-	f3( 327, 1404, 116 );
-	f3( 229, 1036, 397 );
-	f3( 170, 466, 682 );
-	f3( 250, 607, 841 );
-	f3( 1080, 1275, 434 );
-	f3( 422, 913, 334 );
-	f3( 185, 980, 215 );
-	f3( 1492, 241, 564 );
-	f3( 1612, 356, 1030 );
-	f3( 678, 1354, 476 );
-	f3( 1301, 1041, 1239 );
-	f3( 1465, 1164, 1593 );
-	f3( 496, 987, 1525 );
-	f3( 808, 1015, 1449 );
-	f3( 51, 733, 274 );
-	f3( 286, 1575, 1007 );
-	f3( 101, 186, 1602 );
-	f3( 793, 1057, 921 );
-	f3( 1622, 316, 1408 );
-	f3( 41, 707, 1606 );
-	f3( 67, 934, 975 );
-	f3( 1360, 1616, 1609 );
-	f3( 137, 129, 1033 );
-	f3( 1435, 221, 700 );
-	f3( 399, 167, 1525 );
-	f3( 1237, 1425, 978 );
-	f3( 320, 292, 689 );
-	f3( 1553, 139, 1249 );
-	f3( 1269, 664, 1309 );
-	f3( 1437, 783, 945 );
-	f3( 396, 212, 1453 );
-	f3( 942, 1168, 1302 );
-	f3( 1292, 470, 1392 );
-	f3( 1359, 1206, 205 );
-	f3( 446, 248, 581 );
-	f3( 46, 341, 1424 );
-	f3( 57, 1076, 541 );
-	f3( 921, 1584, 299 );
-	f3( 1012, 449, 1516 );
-	f3( 544, 82, 757 );
-	f3( 1300, 900, 473 );
-	f3( 1414, 324, 253 );
-	f3( 457, 733, 51 );
-	f3( 878, 1310, 1533 );
-	f3( 266, 323, 1142 );
-	f3( 943, 217, 578 );
-	f3( 382, 532, 117 );
-	f3( 928, 1618, 1602 );
-	f3( 200, 1553, 1249 );
-	f3( 602, 87, 1632 );
-	f3( 1612, 1030, 1477 );
-	f3( 890, 506, 101 );
-	f3( 1243, 745, 319 );
-	f3( 554, 53, 388 );
-	f3( 208, 272, 115 );
-	f3( 356, 1105, 1030 );
-	f3( 1278, 425, 2 );
-	f3( 1551, 33, 1444 );
-	f3( 1512, 848, 1424 );
-	f3( 1333, 1216, 845 );
-	f3( 1547, 458, 1120 );
-	f3( 1101, 467, 619 );
-	f3( 711, 1050, 396 );
-	f3( 1634, 127, 1264 );
-	f3( 1204, 902, 239 );
-	f3( 1564, 1602, 1618 );
-	f3( 1410, 90, 525 );
-	f3( 1256, 1421, 1252 );
-	f3( 1542, 135, 244 );
-	f3( 1376, 1025, 1348 );
-	f3( 133, 927, 1283 );
-	f3( 837, 644, 1304 );
-	f3( 1610, 639, 281 );
-	f3( 276, 1585, 426 );
-	f3( 1580, 1337, 1028 );
-	f3( 965, 348, 571 );
-	f3( 1127, 409, 1450 );
-	f3( 574, 447, 802 );
-	f3( 652, 128, 463 );
-	f3( 1081, 1318, 400 );
-	f3( 1038, 306, 705 );
-	f3( 310, 158, 40 );
-	f3( 433, 507, 1605 );
-	f3( 1422, 532, 679 );
-	f3( 59, 766, 1351 );
-	f3( 1620, 546, 64 );
-	f3( 596, 526, 465 );
-	f3( 909, 801, 972 );
-	f3( 608, 575, 852 );
-	f3( 421, 1195, 1241 );
-	f3( 327, 116, 1623 );
-	f3( 1355, 342, 916 );
-	f3( 175, 1509, 846 );
-	f3( 386, 1300, 176 );
-	f3( 490, 257, 893 );
-	f3( 554, 1057, 939 );
-	f3( 1597, 769, 518 );
-	f3( 268, 406, 131 );
-	f3( 1621, 330, 741 );
-	f3( 654, 1364, 1295 );
-	f3( 304, 35, 99 );
-	f3( 658, 562, 477 );
-	f3( 1375, 1253, 1413 );
-	f3( 368, 92, 512 );
-	f3( 1308, 1209, 43 );
-	f3( 1057, 793, 56 );
-	f3( 1225, 1307, 265 );
-	f3( 1299, 1489, 1230 );
-	f3( 120, 1626, 635 );
-	f3( 1203, 1311, 854 );
-	f3( 252, 1332, 1000 );
-	f3( 1239, 48, 1301 );
-	f3( 767, 1470, 237 );
-	f3( 1571, 1252, 142 );
-	f3( 462, 722, 656 );
-	f3( 1365, 937, 1187 );
-	f3( 266, 1245, 1474 );
-	f3( 1561, 16, 681 );
-	f3( 1115, 758, 1289 );
-	f3( 1072, 188, 1624 );
-	f3( 1489, 1299, 1066 );
-	f3( 93, 75, 231 );
-	f3( 1386, 591, 525 );
-	f3( 878, 1533, 1101 );
-	f3( 1422, 413, 532 );
-	f3( 560, 1086, 1091 );
-	f3( 1313, 1436, 1581 );
-	f3( 900, 1340, 473 );
-	f3( 575, 1040, 1166 );
-	f3( 1331, 1224, 499 );
-	f3( 212, 1053, 1003 );
-	f3( 279, 358, 1607 );
-	f3( 1353, 805, 1150 );
-	f3( 1575, 1093, 533 );
-	f3( 1183, 773, 662 );
-	f3( 1012, 27, 449 );
-	f3( 1229, 633, 146 );
-	f3( 84, 1125, 411 );
-	f3( 815, 850, 1514 );
-	f3( 1280, 22, 1515 );
-	f3( 657, 650, 374 );
-	f3( 915, 1146, 520 );
-	f3( 104, 408, 1358 );
-	f3( 1024, 304, 342 );
-	f3( 734, 928, 186 );
-	f3( 419, 395, 988 );
-	f3( 1354, 678, 614 );
-	f3( 1266, 213, 773 );
-	f3( 577, 300, 735 );
-	f3( 1338, 109, 187 );
-	f3( 1561, 880, 1096 );
-	f3( 185, 714, 102 );
-	f3( 240, 1244, 456 );
-	f3( 672, 1257, 661 );
-	f3( 80, 160, 1020 );
-	f3( 1615, 28, 308 );
-	f3( 1082, 800, 1413 );
-	f3( 634, 451, 1467 );
-	f3( 826, 89, 1268 );
-	f3( 303, 121, 621 );
-	f3( 917, 1200, 1032 );
-	f3( 609, 17, 306 );
-	f3( 135, 1454, 244 );
-	f3( 470, 1390, 1478 );
-	f3( 819, 992, 1386 );
-	f3( 881, 185, 1144 );
-	f3( 1273, 1428, 877 );
-	f3( 1007, 267, 1175 );
-	f3( 659, 1265, 8 );
-	f3( 1364, 1066, 1299 );
-	f3( 1096, 440, 1432 );
-	f3( 398, 660, 1588 );
-	f3( 974, 1626, 120 );
-	f3( 530, 306, 246 );
-	f3( 604, 1455, 1323 );
-	f3( 1316, 1498, 318 );
-	f3( 1042, 445, 1018 );
-	f3( 834, 1518, 489 );
-	f3( 1316, 571, 348 );
-	f3( 36, 1407, 914 );
-	f3( 291, 1053, 212 );
-	f3( 1639, 548, 1031 );
-	f3( 709, 732, 1339 );
-	f3( 723, 668, 1154 );
-	f3( 1145, 270, 44 );
-	f3( 53, 1472, 63 );
-	f3( 1313, 1581, 963 );
-	f3( 843, 810, 249 );
-	f3( 543, 753, 741 );
-	f3( 982, 1340, 900 );
-	f3( 326, 381, 18 );
-	f3( 1484, 906, 1487 );
-	f3( 119, 1225, 1352 );
-	f3( 125, 737, 433 );
-	f3( 1187, 64, 1365 );
-	f3( 1618, 1152, 195 );
-	f3( 234, 932, 1247 );
-	f3( 1225, 843, 527 );
-	f3( 1411, 152, 163 );
-	f3( 1238, 1396, 1141 );
-	f3( 1506, 754, 1481 );
-	f3( 877, 897, 461 );
-	f3( 418, 876, 248 );
-	f3( 1421, 1256, 315 );
-	f3( 1314, 177, 965 );
-	f3( 307, 513, 1029 );
-	f3( 672, 1375, 1257 );
-	f3( 788, 1271, 1535 );
-	f3( 367, 1614, 695 );
-	f3( 865, 454, 519 );
-	f3( 396, 719, 291 );
-	f3( 1562, 1586, 220 );
-	f3( 1074, 1538, 1170 );
-	f3( 732, 973, 203 );
-	f3( 1550, 71, 1260 );
-	f3( 1176, 1606, 511 );
-	f3( 752, 1512, 925 );
-	f3( 437, 1568, 1209 );
-	f3( 1170, 687, 284 );
-	f3( 903, 905, 1021 );
-	f3( 36, 840, 1407 );
-	f3( 1390, 1143, 1478 );
-	f3( 828, 1097, 1463 );
-	f3( 881, 605, 795 );
-	f3( 1611, 683, 1252 );
-	f3( 405, 781, 1262 );
-	f3( 1123, 868, 1319 );
-	f3( 744, 875, 372 );
-	f3( 99, 35, 915 );
-	f3( 1621, 1262, 673 );
-	f3( 294, 1205, 726 );
-	f3( 199, 610, 763 );
-	f3( 594, 68, 1035 );
-	f3( 1026, 1281, 1441 );
-	f3( 568, 710, 1227 );
-	f3( 110, 634, 171 );
-	f3( 70, 261, 1122 );
-	f3( 214, 984, 1027 );
-	f3( 1249, 1250, 200 );
-	f3( 1498, 764, 318 );
-	f3( 419, 1462, 720 );
-	f3( 1016, 224, 1321 );
-	f3( 1195, 207, 614 );
-	f3( 1457, 11, 258 );
-	f3( 663, 146, 633 );
-	f3( 668, 423, 1154 );
-	f3( 1359, 87, 152 );
-	f3( 467, 1473, 619 );
-	f3( 1381, 261, 1405 );
-	f3( 850, 815, 383 );
-	f3( 1576, 789, 912 );
-	f3( 470, 1292, 1279 );
-	f3( 15, 1526, 699 );
-	f3( 1061, 325, 1001 );
-	f3( 804, 429, 721 );
-	f3( 1482, 474, 1067 );
-	f3( 1059, 1321, 1521 );
-	f3( 584, 1490, 83 );
-	f3( 518, 642, 140 );
-	f3( 749, 1412, 980 );
-	f3( 776, 424, 1455 );
-	f3( 462, 1306, 369 );
-	f3( 98, 409, 780 );
-	f3( 544, 137, 1033 );
-	f3( 1508, 763, 1086 );
-	f3( 1414, 969, 478 );
-	f3( 1544, 377, 592 );
-	f3( 1553, 200, 904 );
-	f3( 1326, 478, 643 );
-	f3( 156, 107, 281 );
-	f3( 683, 727, 1542 );
-	f3( 1140, 192, 567 );
-	f3( 1249, 139, 1470 );
-	f3( 70, 1315, 261 );
-	f3( 1316, 251, 571 );
-	f3( 1027, 1414, 478 );
-	f3( 1274, 202, 1358 );
-	f3( 677, 115, 1004 );
-	f3( 779, 451, 634 );
-	f3( 287, 1562, 706 );
-	f3( 238, 1432, 1633 );
-	f3( 1273, 786, 991 );
-	f3( 367, 606, 586 );
-	f3( 1301, 252, 1000 );
-	f3( 1445, 1299, 1230 );
-	f3( 641, 1267, 1329 );
-	f3( 1285, 599, 225 );
-	f3( 751, 309, 1089 );
-	f3( 1254, 789, 617 );
-	f3( 1509, 1422, 679 );
-	f3( 1257, 1375, 1413 );
-	f3( 1545, 135, 1217 );
-	f3( 1613, 94, 1540 );
-	f3( 1630, 739, 1554 );
-	f3( 1338, 826, 858 );
-	f3( 1085, 802, 73 );
-	f3( 1444, 0, 792 );
-	f3( 574, 1287, 447 );
-	f3( 899, 1243, 997 );
-	f3( 1192, 717, 829 );
-	f3( 1144, 185, 102 );
-	f3( 903, 292, 320 );
-	f3( 229, 397, 534 );
-	f3( 1398, 1081, 999 );
-	f3( 506, 1251, 868 );
-	f3( 1328, 1557, 431 );
-	f3( 220, 1302, 496 );
-	f3( 1067, 474, 1224 );
-	f3( 547, 675, 440 );
-	f3( 1246, 38, 425 );
-	f3( 217, 589, 578 );
-	f3( 1506, 717, 1192 );
-	f3( 1125, 48, 1368 );
-	f3( 1267, 209, 626 );
-	f3( 198, 358, 7 );
-	f3( 1249, 1470, 148 );
-	f3( 387, 1226, 407 );
-	f3( 1137, 1573, 833 );
-	f3( 250, 159, 1050 );
-	f3( 25, 1587, 545 );
-	f3( 290, 32, 796 );
-	f3( 1265, 659, 21 );
-	f3( 265, 622, 1352 );
-	f3( 0, 630, 792 );
-	f3( 1187, 255, 1620 );
-	f3( 271, 1457, 260 );
-	f3( 550, 572, 1124 );
-	f3( 1145, 1403, 858 );
-	f3( 854, 1143, 1282 );
-	f3( 111, 1514, 1017 );
-	f3( 835, 1460, 168 );
-	f3( 63, 221, 671 );
-	f3( 296, 559, 300 );
-	f3( 1230, 940, 997 );
-	f3( 660, 63, 671 );
-	f3( 590, 1293, 460 );
-	f3( 314, 976, 684 );
-	f3( 1578, 967, 285 );
-	f3( 434, 998, 1355 );
-	f3( 1277, 1631, 316 );
-	f3( 1164, 502, 936 );
-	f3( 499, 474, 256 );
-	f3( 1494, 967, 1110 );
-	f3( 1052, 1127, 435 );
-	f3( 147, 800, 1527 );
-	f3( 87, 1210, 600 );
-	f3( 1318, 1081, 20 );
-	f3( 1402, 878, 1101 );
-	f3( 638, 758, 874 );
-	f3( 436, 454, 865 );
-	f3( 1079, 883, 625 );
-	f3( 1621, 741, 1262 );
-	f3( 1360, 1417, 206 );
-	f3( 933, 1608, 996 );
-	f3( 1521, 1321, 827 );
-	f3( 968, 966, 1594 );
-	f3( 1158, 952, 887 );
-	f3( 700, 1472, 263 );
-	f3( 1343, 578, 589 );
-	f3( 1451, 137, 544 );
-	f3( 351, 1045, 1522 );
-	f3( 1334, 976, 1017 );
-	f3( 747, 1237, 1574 );
-	f3( 472, 973, 607 );
-	f3( 891, 1112, 442 );
-	f3( 223, 475, 728 );
-	f3( 1076, 685, 357 );
-	f3( 730, 1011, 791 );
-	f3( 766, 77, 995 );
-	f3( 1014, 697, 1356 );
-	f3( 270, 272, 855 );
-	f3( 450, 1499, 389 );
-	f3( 489, 429, 203 );
-	f3( 908, 1567, 210 );
-	f3( 1523, 509, 694 );
-	f3( 227, 1068, 161 );
-	f3( 898, 767, 237 );
-	f3( 696, 1605, 738 );
-	f3( 619, 1473, 386 );
-	f3( 486, 938, 1036 );
-	f3( 1486, 1563, 1619 );
-	f3( 1082, 1413, 1253 );
-	f3( 1590, 459, 495 );
-	f3( 105, 709, 1339 );
-	f3( 437, 1209, 1038 );
-	f3( 1319, 868, 603 );
-	f3( 1144, 1015, 372 );
-	f3( 1237, 716, 1496 );
-	f3( 1301, 1155, 1041 );
-	f3( 203, 429, 417 );
-	f3( 230, 1190, 798 );
-	f3( 869, 1303, 1128 );
-	f3( 783, 493, 640 );
-	f3( 1153, 703, 1319 );
-	f3( 1093, 1502, 309 );
-	f3( 1103, 1334, 979 );
-	f3( 900, 666, 982 );
-	f3( 80, 9, 160 );
-	f3( 1157, 902, 364 );
-	f3( 600, 1013, 424 );
-	f3( 164, 1152, 65 );
-	f3( 817, 551, 1628 );
-	f3( 543, 646, 753 );
-	f3( 731, 364, 902 );
-	f3( 1056, 1494, 1128 );
-	f3( 526, 596, 956 );
-	f3( 1475, 1572, 1197 );
-	f3( 1182, 339, 124 );
-	f3( 1086, 742, 1091 );
-	f3( 404, 753, 646 );
-	f3( 328, 1211, 926 );
-	f3( 1449, 714, 922 );
-	f3( 1599, 313, 1102 );
-	f3( 1236, 904, 1077 );
-	f3( 1077, 1000, 1231 );
-	f3( 651, 122, 736 );
-	f3( 575, 692, 1185 );
-	f3( 185, 215, 1324 );
-	f3( 1264, 795, 1634 );
-	f3( 956, 18, 526 );
-	f3( 1535, 1587, 891 );
-	f3( 78, 1311, 335 );
-	f3( 1485, 1594, 966 );
-	f3( 382, 1396, 1458 );
-	f3( 385, 1070, 537 );
-	f3( 882, 291, 477 );
-	f3( 970, 173, 1436 );
-	f3( 1157, 364, 339 );
-	f3( 1245, 850, 515 );
-	f3( 305, 172, 1622 );
-	f3( 361, 1107, 54 );
-	f3( 966, 1391, 1485 );
-	f3( 305, 1622, 1408 );
-	f3( 1089, 1427, 15 );
-	f3( 78, 950, 260 );
-	f3( 976, 1334, 879 );
-	f3( 941, 624, 838 );
-	f3( 218, 573, 179 );
-	f3( 700, 263, 1325 );
-	f3( 1270, 104, 531 );
-	f3( 1243, 1543, 745 );
-	f3( 1019, 314, 1378 );
-	f3( 687, 1166, 627 );
-	f3( 332, 1541, 192 );
-	f3( 390, 1288, 1121 );
-	f3( 197, 1164, 1465 );
-	f3( 340, 0, 438 );
-	f3( 1547, 1389, 458 );
-	f3( 275, 310, 771 );
-	f3( 1300, 1100, 1098 );
-	f3( 475, 375, 691 );
-	f3( 1556, 889, 611 );
-	f3( 8, 312, 1135 );
-	f3( 418, 248, 446 );
-	f3( 974, 120, 243 );
-	f3( 1129, 184, 176 );
-	f3( 1094, 462, 568 );
-	f3( 427, 1215, 1371 );
-	f3( 402, 498, 624 );
-	f3( 557, 743, 704 );
-	f3( 557, 1420, 743 );
-	f3( 1479, 390, 1121 );
-	f3( 556, 748, 1222 );
-	f3( 905, 668, 1347 );
-	f3( 614, 382, 117 );
-	f3( 1406, 432, 1377 );
-	f3( 393, 1541, 352 );
-	f3( 1248, 307, 1505 );
-	f3( 695, 670, 932 );
-	f3( 617, 4, 1092 );
-	f3( 1246, 1329, 626 );
-	f3( 1052, 1270, 1635 );
-	f3( 546, 1620, 366 );
-	f3( 1041, 1155, 74 );
-	f3( 969, 1414, 253 );
-	f3( 711, 490, 472 );
-	f3( 625, 1208, 547 );
-	f3( 1019, 1190, 230 );
-	f3( 785, 285, 1494 );
-	f3( 1402, 184, 38 );
-	f3( 320, 1529, 1005 );
-	f3( 588, 1270, 497 );
-	f3( 1476, 440, 1464 );
-	f3( 1013, 1288, 1455 );
-	f3( 476, 1332, 1439 );
-	f3( 1511, 645, 237 );
-	f3( 1444, 792, 1589 );
-	f3( 1256, 787, 1460 );
-	f3( 810, 843, 103 );
-	f3( 509, 1400, 1006 );
-	f3( 197, 1465, 585 );
-	f3( 508, 1356, 924 );
-	f3( 260, 1457, 1099 );
-	f3( 713, 710, 568 );
-	f3( 1572, 542, 1197 );
-	f3( 1604, 1060, 1627 );
-	f3( 673, 1262, 781 );
-	f3( 1612, 1484, 1500 );
-	f3( 561, 12, 461 );
-	f3( 1031, 1115, 1199 );
-	f3( 477, 1148, 882 );
-	f3( 1031, 1199, 1639 );
-	f3( 508, 1014, 1356 );
-	f3( 1636, 50, 562 );
-	f3( 851, 260, 1143 );
-	f3( 506, 1291, 1251 );
-	f3( 1550, 748, 273 );
-	f3( 689, 762, 1227 );
-	f3( 481, 1420, 818 );
-	f3( 1481, 380, 790 );
-	f3( 957, 1635, 531 );
-	f3( 124, 414, 1182 );
-	f3( 1467, 1491, 634 );
-	f3( 903, 198, 277 );
-	f3( 817, 1213, 551 );
-	f3( 59, 1488, 516 );
-	f3( 748, 71, 273 );
-	f3( 140, 1075, 897 );
-	f3( 1302, 1470, 139 );
-	f3( 402, 181, 1109 );
-	f3( 964, 836, 242 );
-	f3( 516, 1488, 345 );
-	f3( 1167, 1269, 647 );
-	f3( 881, 795, 1184 );
-	f3( 971, 1182, 414 );
-	f3( 595, 910, 581 );
-	f3( 147, 1394, 1293 );
-	f3( 971, 414, 1069 );
-	f3( 94, 1490, 584 );
-	f3( 487, 5, 690 );
-	f3( 483, 719, 1050 );
-	f3( 842, 522, 23 );
-	f3( 765, 683, 1118 );
-	f3( 842, 1172, 888 );
-	f3( 1373, 1614, 1085 );
-	f3( 1059, 598, 1002 );
-	f3( 1298, 489, 1518 );
-	f3( 1123, 225, 599 );
-	f3( 680, 770, 857 );
-	f3( 1420, 1446, 818 );
-	f3( 534, 397, 623 );
-	f3( 410, 994, 351 );
-	f3( 80, 89, 9 );
-	f3( 1280, 307, 1029 );
-	f3( 27, 1516, 449 );
-	f3( 935, 1578, 507 );
-	f3( 726, 1205, 416 );
-	f3( 881, 1184, 1009 );
-	f3( 1072, 549, 784 );
-	f3( 1552, 1480, 841 );
-	f3( 615, 1315, 70 );
-	f3( 1141, 678, 463 );
-	f3( 53, 1393, 1417 );
-	f3( 1040, 757, 1033 );
-	f3( 275, 1423, 601 );
-	f3( 755, 1326, 643 );
-	f3( 699, 76, 1434 );
-	f3( 1313, 1384, 468 );
-	f3( 1265, 312, 8 );
-	f3( 1085, 246, 802 );
-	f3( 440, 675, 1303 );
-	f3( 1522, 410, 351 );
-	f3( 733, 219, 1255 );
-	f3( 1381, 771, 261 );
-	f3( 572, 516, 1133 );
-	f3( 690, 1232, 464 );
-	f3( 1349, 840, 36 );
-	f3( 608, 852, 315 );
-	f3( 840, 522, 1407 );
-	f3( 1071, 956, 650 );
-	f3( 1515, 22, 1369 );
-	f3( 1165, 1160, 1164 );
-	f3( 1415, 1506, 1192 );
-	f3( 547, 440, 1476 );
-	f3( 640, 493, 333 );
-	f3( 695, 447, 1048 );
-	f3( 1137, 833, 672 );
-	f3( 728, 377, 416 );
-	f3( 1585, 276, 1299 );
-	f3( 1268, 1536, 270 );
-	f3( 1130, 199, 1180 );
-	f3( 1584, 361, 1569 );
-	f3( 916, 99, 1443 );
-	f3( 1205, 294, 518 );
-	f3( 228, 1467, 451 );
-	f3( 1049, 1262, 741 );
-	f3( 867, 1035, 68 );
-	f3( 756, 746, 349 );
-	f3( 1522, 1045, 1064 );
-	f3( 1080, 1572, 848 );
-	f3( 784, 188, 1072 );
-	f3( 448, 516, 345 );
-	f3( 645, 308, 28 );
-	f3( 167, 496, 1525 );
-	f3( 1434, 336, 533 );
-	f3( 502, 1160, 503 );
-	f3( 1571, 1156, 1603 );
-	f3( 45, 719, 483 );
-	f3( 1308, 43, 862 );
-	f3( 1233, 1504, 362 );
-	f3( 1069, 665, 1258 );
-	f3( 763, 1051, 742 );
-	f3( 830, 1181, 796 );
-	f3( 158, 901, 1090 );
-	f3( 427, 29, 1495 );
-	f3( 1155, 1077, 74 );
-	f3( 180, 1127, 611 );
-	f3( 545, 225, 1319 );
-	f3( 41, 1606, 800 );
-	f3( 1492, 278, 592 );
-	f3( 1484, 1612, 1477 );
-	f3( 1223, 1544, 1530 );
-	f3( 108, 631, 1469 );
-	f3( 1283, 927, 1083 );
-	f3( 772, 253, 1151 );
-	f3( 1015, 102, 1449 );
-	f3( 593, 772, 1447 );
-	f3( 479, 350, 548 );
-	f3( 168, 697, 872 );
-	f3( 423, 1304, 1163 );
-	f3( 101, 1291, 186 );
-	f3( 454, 436, 49 );
-	f3( 802, 447, 73 );
-	f3( 1052, 1635, 1127 );
-	f3( 15, 1427, 1526 );
-	f3( 1623, 530, 112 );
-	f3( 1558, 685, 57 );
-	f3( 1108, 636, 1134 );
-	f3( 1047, 632, 1071 );
-	f3( 293, 652, 848 );
-	f3( 1461, 709, 105 );
-	f3( 313, 1532, 1102 );
-	f3( 678, 1275, 463 );
-	f3( 731, 902, 1477 );
-	f3( 828, 1491, 1097 );
-	f3( 278, 1530, 1544 );
-	f3( 663, 680, 1258 );
-	f3( 1641, 961, 1559 );
-	f3( 1010, 1599, 71 );
-	f3( 1417, 1456, 206 );
-	f3( 235, 348, 965 );
-	f3( 384, 182, 365 );
-	f3( 1146, 318, 520 );
-	f3( 1153, 1319, 603 );
-	f3( 1542, 924, 1356 );
-	f3( 214, 241, 1492 );
-	f3( 1508, 1180, 199 );
-	f3( 566, 1194, 805 );
-	f3( 131, 406, 1173 );
-	f3( 1023, 325, 981 );
-	f3( 168, 1341, 1451 );
-	f3( 463, 394, 1141 );
-	f3( 214, 1027, 1326 );
-	f3( 80, 1163, 1304 );
-	f3( 683, 1542, 1356 );
-	f3( 66, 205, 1207 );
-	f3( 1268, 89, 1536 );
-	f3( 1329, 425, 100 );
-	f3( 1496, 1610, 1425 );
-	f3( 998, 342, 1355 );
-	f3( 1385, 1505, 1595 );
-	f3( 935, 507, 1372 );
-	f3( 680, 857, 1258 );
-	f3( 222, 1154, 729 );
-	f3( 1433, 1200, 133 );
-	f3( 178, 694, 509 );
-	f3( 1071, 657, 134 );
-	f3( 1550, 346, 748 );
-	f3( 1222, 646, 543 );
-	f3( 1043, 1026, 166 );
-	f3( 1169, 19, 398 );
-	f3( 984, 324, 1414 );
-	f3( 1237, 1496, 1425 );
-	f3( 249, 527, 843 );
-	f3( 281, 1022, 1610 );
-	f3( 1473, 191, 386 );
-	f3( 1576, 343, 1055 );
-	f3( 915, 35, 1146 );
-	f3( 574, 132, 1287 );
-	f3( 764, 1261, 46 );
-	f3( 256, 1198, 1147 );
-	f3( 1313, 963, 1384 );
-	f3( 555, 1186, 1440 );
-	f3( 184, 1402, 176 );
-	f3( 326, 357, 381 );
-	f3( 106, 481, 565 );
-	f3( 638, 817, 758 );
-	f3( 886, 1051, 278 );
-	f3( 1247, 670, 648 );
-	f3( 402, 624, 941 );
-	f3( 774, 576, 1064 );
-	f3( 239, 906, 1204 );
-	f3( 107, 1112, 281 );
-	f3( 217, 1073, 1028 );
-	f3( 647, 1269, 1362 );
-	f3( 127, 55, 34 );
-	f3( 1086, 859, 1508 );
-	f3( 6, 735, 1134 );
-	f3( 658, 477, 291 );
-	f3( 1278, 193, 425 );
-	f3( 8, 1283, 718 );
-	f3( 1037, 205, 66 );
-	f3( 181, 328, 1307 );
-	f3( 1276, 1260, 1599 );
-	f3( 586, 426, 809 );
-	f3( 719, 45, 291 );
-	f3( 166, 1441, 895 );
-	f3( 924, 1528, 1330 );
-	f3( 618, 679, 653 );
-	f3( 481, 106, 1565 );
-	f3( 275, 601, 901 );
-	f3( 1170, 284, 1074 );
-	f3( 993, 797, 372 );
-	f3( 618, 846, 679 );
-	f3( 193, 100, 425 );
-	f3( 1214, 1051, 886 );
-	f3( 1388, 337, 1462 );
-	f3( 1582, 1367, 401 );
-	f3( 1374, 609, 1308 );
-	f3( 668, 905, 1005 );
-	f3( 1561, 238, 16 );
-	f3( 308, 1586, 1041 );
-	f3( 1019, 469, 314 );
-	f3( 279, 1029, 513 );
-	f3( 441, 569, 913 );
-	f3( 745, 1543, 479 );
-	f3( 1125, 1024, 48 );
-	f3( 796, 1493, 439 );
-	f3( 553, 451, 123 );
-	f3( 1165, 1164, 197 );
-	f3( 1186, 175, 846 );
-	f3( 787, 765, 168 );
-	f3( 1035, 54, 594 );
-	f3( 1203, 1533, 1311 );
-	f3( 417, 259, 105 );
-	f3( 300, 810, 379 );
-	f3( 826, 9, 89 );
-	f3( 879, 1142, 1173 );
-	f3( 730, 389, 648 );
-	f3( 61, 1017, 976 );
-	f3( 1439, 342, 884 );
-	f3( 1211, 768, 52 );
-	f3( 1245, 515, 1474 );
-	f3( 1, 149, 1560 );
-	f3( 1558, 457, 357 );
-	f3( 96, 510, 114 );
-	f3( 744, 1221, 875 );
-	f3( 1161, 1510, 1279 );
-	f3( 1244, 876, 418 );
-	f3( 1008, 180, 596 );
-	f3( 859, 682, 694 );
-	f3( 847, 609, 1374 );
-	f3( 870, 1517, 1085 );
-	f3( 1511, 220, 1586 );
-	f3( 183, 1363, 514 );
-	f3( 99, 915, 1322 );
-	f3( 1499, 450, 336 );
-	f3( 330, 1621, 351 );
-	f3( 902, 1157, 239 );
-	f3( 646, 786, 404 );
-	f3( 356, 597, 731 );
-	f3( 792, 385, 691 );
-	f3( 300, 577, 224 );
-	f3( 1102, 265, 1524 );
-	f3( 1627, 1233, 169 );
-	f3( 1584, 1569, 428 );
-	f3( 1202, 791, 29 );
-	f3( 521, 784, 759 );
-	f3( 310, 233, 771 );
-	f3( 204, 1001, 833 );
-	f3( 375, 518, 3 );
-	f3( 584, 1234, 94 );
-	f3( 410, 482, 1361 );
-	f3( 877, 461, 866 );
-	f3( 579, 1289, 782 );
-	f3( 1080, 848, 652 );
-	f3( 712, 125, 1546 );
-	f3( 220, 496, 167 );
-	f3( 387, 327, 112 );
-	f3( 121, 303, 908 );
-	f3( 1519, 1558, 57 );
-	f3( 710, 644, 1529 );
-	f3( 690, 990, 487 );
-	f3( 65, 363, 164 );
-	f3( 259, 417, 1117 );
-	f3( 1450, 14, 1556 );
-	f3( 809, 1085, 1614 );
-	f3( 641, 156, 155 );
-	f3( 247, 995, 873 );
-	f3( 446, 581, 910 );
-	f3( 1602, 67, 183 );
-	f3( 977, 319, 1087 );
-	f3( 1065, 1560, 1330 );
-	f3( 1535, 1271, 1587 );
-	f3( 573, 1194, 566 );
-	f3( 1188, 1006, 1400 );
-	f3( 1336, 994, 1331 );
-	f3( 419, 752, 550 );
-	f3( 12, 1188, 174 );
-	f3( 1552, 627, 1480 );
-	f3( 1081, 400, 999 );
-	f3( 632, 813, 1071 );
-	f3( 93, 231, 1399 );
-	f3( 1056, 1128, 1303 );
-	f3( 1460, 787, 168 );
-	f3( 460, 1212, 259 );
-	f3( 205, 1037, 1416 );
-	f3( 76, 699, 1092 );
-	f3( 1301, 48, 252 );
-	f3( 899, 997, 693 );
-	f3( 491, 209, 354 );
-	f3( 963, 365, 1384 );
-	f3( 1267, 1548, 209 );
-	f3( 17, 609, 847 );
-	f3( 666, 386, 191 );
-	f3( 1507, 359, 702 );
-	f3( 161, 1140, 567 );
-	f3( 1418, 978, 704 );
-	f3( 98, 492, 130 );
-	f3( 959, 876, 1468 );
-	f3( 127, 219, 1264 );
-	f3( 1388, 1462, 988 );
-	f3( 1551, 633, 1229 );
-	f3( 278, 1051, 1530 );
-	f3( 187, 826, 1338 );
-	f3( 59, 529, 1488 );
-	f3( 1284, 1363, 824 );
-	f3( 1300, 386, 900 );
-	f3( 519, 894, 1241 );
-	f3( 1392, 470, 1478 );
-	f3( 452, 1592, 922 );
-	f3( 129, 1471, 1033 );
-	f3( 72, 1523, 759 );
-	f3( 144, 123, 1583 );
-	f3( 800, 147, 41 );
-	f3( 1158, 887, 455 );
-	f3( 2, 1129, 1278 );
-	f3( 168, 765, 1118 );
-	f3( 1246, 626, 491 );
-	f3( 1048, 37, 670 );
-	f3( 1575, 533, 29 );
-	f3( 1552, 216, 1074 );
-	f3( 514, 528, 890 );
-	f3( 925, 77, 550 );
-	f3( 777, 452, 1220 );
-	f3( 1469, 191, 580 );
-	f3( 91, 1358, 202 );
-	f3( 415, 1368, 1239 );
-	f3( 54, 1107, 844 );
-	f3( 958, 1328, 831 );
-	f3( 310, 1174, 233 );
-	f3( 116, 484, 1272 );
-	f3( 692, 687, 1185 );
-	f3( 1459, 971, 1357 );
-	f3( 544, 575, 608 );
-	f3( 636, 737, 6 );
-	f3( 1047, 1178, 143 );
-	f3( 1528, 1423, 771 );
-	f3( 731, 1477, 1105 );
-	f3( 1635, 1270, 531 );
-	f3( 1380, 529, 1600 );
-	f3( 644, 1004, 1304 );
-	f3( 1405, 261, 1315 );
-	f3( 773, 1183, 993 );
-	f3( 1587, 1598, 1285 );
-	f3( 516, 448, 1133 );
-	f3( 861, 963, 145 );
-	f3( 1016, 669, 1374 );
-	f3( 893, 1098, 1100 );
-	f3( 1186, 846, 333 );
-	f3( 1338, 858, 1104 );
-	f3( 906, 1484, 1477 );
-	f3( 959, 248, 876 );
-	f3( 862, 559, 296 );
-	f3( 1563, 55, 127 );
-	f3( 233, 1174, 1122 );
-	f3( 621, 1161, 1279 );
-	f3( 968, 1594, 1577 );
-	f3( 367, 932, 1537 );
-	f3( 450, 791, 1202 );
-	f3( 1103, 879, 1334 );
-	f3( 278, 1544, 592 );
-	f3( 1169, 831, 194 );
-	f3( 1601, 280, 468 );
-	f3( 1605, 696, 1546 );
-	f3( 724, 240, 456 );
-	f3( 740, 822, 113 );
-	f3( 623, 1376, 534 );
-	f3( 1199, 1115, 1513 );
-	f3( 1221, 985, 1136 );
-	f3( 299, 143, 921 );
-	f3( 467, 510, 1473 );
-	f3( 854, 1106, 96 );
-	f3( 424, 1013, 1455 );
-	f3( 1323, 863, 1176 );
-	f3( 1453, 257, 490 );
-	f3( 1547, 530, 1389 );
-	f3( 1139, 975, 934 );
-	f3( 1566, 1503, 1171 );
-	f3( 1416, 1210, 205 );
-	f3( 1622, 186, 1291 );
-	f3( 1054, 1355, 916 );
-	f3( 1598, 1201, 599 );
-	f3( 572, 766, 59 );
-	f3( 1625, 528, 635 );
-	f3( 387, 870, 809 );
-	f3( 119, 1613, 202 );
-	f3( 1341, 872, 1235 );
-	f3( 991, 1222, 828 );
-	f3( 360, 136, 1402 );
-	f3( 1131, 1566, 24 );
-	f3( 906, 1459, 1357 );
-	f3( 544, 1033, 82 );
-	f3( 1206, 1411, 637 );
-	f3( 285, 785, 738 );
-	f3( 175, 413, 1422 );
-	f3( 1124, 572, 1133 );
-	f3( 1236, 1231, 421 );
-	f3( 1033, 422, 1040 );
-	f3( 517, 65, 585 );
-	f3( 711, 1453, 490 );
-	f3( 1394, 162, 1212 );
-	f3( 1517, 870, 112 );
-	f3( 1225, 265, 1352 );
-	f3( 584, 83, 957 );
-	f3( 941, 838, 1583 );
-	f3( 774, 410, 576 );
-	f3( 764, 1322, 318 );
-	f3( 445, 1296, 816 );
-	f3( 1283, 1083, 718 );
-	f3( 1510, 1161, 1106 );
-	f3( 359, 896, 702 );
-	f3( 716, 628, 1496 );
-	f3( 417, 804, 1117 );
-	f3( 1022, 891, 501 );
-	f3( 1612, 1012, 356 );
-	f3( 592, 214, 1492 );
-	f3( 85, 1176, 863 );
-	f3( 1144, 875, 126 );
-	f3( 167, 244, 1454 );
-	f3( 1271, 196, 1148 );
-	f3( 1505, 407, 426 );
-	f3( 819, 525, 1193 );
-	f3( 1421, 254, 655 );
-	f3( 459, 1084, 1638 );
-	f3( 1036, 229, 1419 );
-	f3( 623, 42, 1376 );
-	f3( 1286, 1582, 662 );
-	f3( 739, 708, 88 );
-	f3( 377, 1544, 1223 );
-	f3( 982, 721, 297 );
-	f3( 1167, 485, 403 );
-	f3( 1275, 652, 463 );
-	f3( 1109, 527, 249 );
-	f3( 151, 1332, 207 );
-	f3( 1456, 1116, 56 );
-	f3( 1628, 1289, 758 );
-	f3( 998, 434, 1275 );
-	f3( 1162, 880, 1561 );
-	f3( 930, 777, 1366 );
-	f3( 343, 940, 1066 );
-	f3( 919, 976, 879 );
-	f3( 856, 1397, 1486 );
-	f3( 1135, 560, 1214 );
-	f3( 1126, 1577, 768 );
-	f3( 1619, 989, 204 );
-	f3( 1190, 1019, 558 );
-	f3( 1064, 524, 536 );
-	f3( 883, 1566, 1171 );
-	f3( 766, 572, 77 );
-	f3( 231, 650, 596 );
-	f3( 1037, 66, 303 );
-	f3( 411, 1125, 1368 );
-	f3( 674, 43, 1209 );
-	f3( 1246, 491, 360 );
-	f3( 669, 574, 1196 );
-	f3( 488, 917, 179 );
-	f3( 1086, 763, 742 );
-	f3( 716, 747, 853 );
-	f3( 1351, 995, 778 );
-	f3( 161, 444, 1140 );
-	f3( 460, 259, 1117 );
-	f3( 1421, 315, 60 );
-	f3( 1412, 749, 150 );
-	f3( 392, 564, 241 );
-	f3( 1294, 505, 1453 );
-	f3( 325, 1136, 13 );
-	f3( 1077, 201, 74 );
-	f3( 1584, 443, 820 );
-	f3( 281, 155, 156 );
-	f3( 496, 1168, 987 );
-	f3( 1063, 1238, 986 );
-	f3( 940, 693, 997 );
-	f3( 919, 1146, 420 );
-	f3( 613, 546, 1047 );
-	f3( 1408, 47, 1415 );
-	f3( 1392, 1543, 1292 );
-	f3( 692, 1166, 687 );
-	f3( 422, 334, 1040 );
-	f3( 867, 326, 299 );
-	f3( 1409, 142, 1252 );
-	f3( 608, 322, 544 );
-	f3( 830, 796, 32 );
-	f3( 402, 968, 1577 );
-	f3( 820, 361, 1584 );
-	f3( 1598, 599, 1285 );
-	f3( 1346, 855, 931 );
-	f3( 472, 607, 250 );
-	f3( 498, 1109, 249 );
-	f3( 993, 372, 1218 );
-	f3( 932, 670, 1247 );
-	f3( 1377, 1132, 715 );
-	f3( 1127, 1635, 69 );
-	f3( 690, 1335, 990 );
-	f3( 418, 910, 535 );
-	f3( 854, 96, 1203 );
-	f3( 1474, 405, 1262 );
-	f3( 373, 627, 1166 );
-	f3( 1527, 1286, 147 );
-	f3( 1023, 1221, 1136 );
-	f3( 558, 1019, 1378 );
-	f3( 430, 237, 799 );
-	f3( 1527, 1253, 1367 );
-	f3( 1009, 1184, 338 );
-	f3( 525, 90, 1193 );
-	f3( 114, 510, 467 );
-	f3( 829, 615, 305 );
-	f3( 1034, 958, 142 );
-	f3( 1201, 50, 599 );
-	f3( 912, 693, 940 );
-	f3( 1341, 168, 872 );
-	f3( 709, 761, 732 );
-	f3( 1003, 442, 1318 );
-	f3( 744, 372, 797 );
-	f3( 101, 1251, 1291 );
-	f3( 952, 1008, 869 );
-	f3( 328, 1126, 1211 );
-	f3( 1357, 971, 1069 );
-	f3( 311, 676, 344 );
-	f3( 1002, 37, 1048 );
-	f3( 901, 1618, 928 );
-	f3( 955, 674, 1209 );
-	f3( 117, 532, 413 );
-	f3( 904, 1236, 49 );
-	f3( 1241, 1195, 413 );
-	f3( 1249, 148, 1250 );
-	f3( 226, 398, 725 );
-	f3( 401, 985, 797 );
-	f3( 617, 1092, 1526 );
-	f3( 226, 725, 443 );
-	f3( 1555, 1245, 979 );
-	f3( 422, 1631, 913 );
-	f3( 515, 405, 1474 );
-	f3( 763, 1508, 199 );
-	f3( 372, 875, 1144 );
-	f3( 243, 514, 1363 );
-	f3( 1640, 963, 861 );
-	f3( 1340, 1518, 1100 );
-	f3( 153, 1379, 164 );
-	f3( 7, 292, 378 );
-	f3( 911, 72, 1437 );
-	f3( 176, 1098, 1129 );
-	f3( 88, 1383, 739 );
-	f3( 906, 1357, 1438 );
-	f3( 132, 1059, 1002 );
-	f3( 1319, 225, 1123 );
-	f3( 733, 1255, 274 );
-	f3( 277, 378, 292 );
-	f3( 420, 684, 919 );
-	f3( 734, 615, 70 );
-	f3( 280, 245, 911 );
-	f3( 681, 1162, 1561 );
-	f3( 452, 36, 1592 );
-	f3( 369, 208, 713 );
-	f3( 980, 1009, 1519 );
-	f3( 1223, 726, 416 );
-	f3( 955, 1209, 1501 );
-	f3( 1342, 1633, 465 );
-	f3( 1191, 959, 1468 );
-	f3( 1438, 1357, 1069 );
-	f3( 1512, 752, 293 );
-	f3( 1242, 64, 374 );
-	f3( 58, 1011, 31 );
-	f3( 737, 507, 433 );
-	f3( 1443, 1054, 916 );
-	f3( 423, 1272, 484 );
-	f3( 91, 531, 104 );
-	f3( 561, 178, 12 );
-	f3( 55, 1563, 1486 );
-	f3( 1, 1065, 717 );
-	f3( 1576, 617, 789 );
-	f3( 877, 1597, 897 );
-	f3( 1156, 1571, 142 );
-	f3( 708, 1383, 88 );
-	f3( 1438, 39, 1487 );
-	f3( 104, 1270, 588 );
-	f3( 1143, 1390, 1510 );
-	f3( 517, 363, 65 );
-	f3( 612, 717, 1506 );
-	f3( 710, 1529, 689 );
-	f3( 1372, 497, 935 );
-	f3( 196, 1271, 788 );
-	f3( 1543, 1243, 899 );
-	f3( 1564, 1637, 67 );
-	f3( 890, 101, 1602 );
-	f3( 99, 1322, 1443 );
-	f3( 700, 221, 1472 );
-	f3( 1106, 210, 96 );
-	f3( 1537, 932, 654 );
-	f3( 145, 1581, 929 );
-	f3( 806, 97, 785 );
-	f3( 552, 1490, 1336 );
-	f3( 600, 1089, 1013 );
-	f3( 631, 804, 721 );
-	f3( 622, 1532, 94 );
-	f3( 39, 1500, 1487 );
-	f3( 674, 862, 43 );
-	f3( 1608, 1492, 564 );
-	f3( 896, 1380, 1600 );
-	f3( 683, 1611, 825 );
-	f3( 1293, 1394, 1212 );
-	f3( 637, 1411, 1060 );
-	f3( 918, 1052, 435 );
-	f3( 1310, 335, 1533 );
-	f3( 255, 130, 1616 );
-	f3( 268, 786, 1273 );
-	f3( 499, 256, 439 );
-	f3( 948, 188, 21 );
-	f3( 222, 1404, 1385 );
-	f3( 1485, 768, 1577 );
-	f3( 373, 913, 569 );
-	f3( 832, 1104, 1580 );
-	f3( 299, 326, 632 );
-	f3( 615, 172, 305 );
-	f3( 587, 890, 1602 );
-	f3( 753, 323, 1049 );
-	f3( 369, 1306, 208 );
-	f3( 696, 97, 1259 );
-	f3( 1529, 644, 837 );
-	f3( 752, 419, 720 );
-	f3( 424, 776, 1632 );
-	f3( 757, 82, 1033 );
-	f3( 717, 1405, 615 );
-	f3( 839, 1429, 214 );
-	f3( 762, 953, 1094 );
-	f3( 230, 353, 1017 );
-	f3( 1042, 1132, 954 );
-	f3( 817, 638, 1078 );
-	f3( 39, 1612, 1500 );
-	f3( 1383, 1554, 739 );
-	f3( 535, 1344, 1036 );
-	f3( 461, 582, 866 );
-	f3( 1588, 1169, 398 );
-	f3( 260, 950, 141 );
-	f3( 792, 1346, 385 );
-	f3( 1266, 842, 775 );
-	f3( 341, 46, 1466 );
-	f3( 1503, 1175, 1259 );
-	f3( 151, 1195, 421 );
-	f3( 920, 381, 681 );
-	f3( 653, 970, 138 );
-	f3( 1062, 750, 30 );
-	f3( 1127, 1450, 611 );
-	f3( 1518, 1340, 982 );
-	f3( 582, 896, 1600 );
-	f3( 458, 1020, 1120 );
-	f3( 513, 1297, 279 );
-	f3( 1017, 61, 469 );
-	f3( 1123, 50, 1622 );
-	f3( 540, 671, 157 );
-	f3( 300, 224, 347 );
-	f3( 330, 351, 994 );
-	f3( 536, 1368, 1018 );
-	f3( 1254, 1526, 1591 );
-	f3( 1032, 218, 917 );
-	f3( 42, 494, 849 );
-	f3( 769, 370, 3 );
-	f3( 1539, 774, 649 );
-	f3( 1477, 1030, 1105 );
-	f3( 401, 1136, 985 );
-	f3( 962, 503, 1497 );
-	f3( 1173, 323, 404 );
-	f3( 86, 1501, 109 );
-	f3( 1181, 780, 69 );
-	f3( 861, 746, 1640 );
-	f3( 350, 629, 1228 );
-	f3( 1527, 1082, 1253 );
-	f3( 1193, 1463, 1097 );
-	f3( 989, 298, 1061 );
-	f3( 460, 1293, 1212 );
-	f3( 1545, 1406, 1454 );
-	f3( 1641, 1436, 667 );
-	f3( 1507, 1640, 1095 );
-	f3( 629, 350, 1478 );
-	f3( 255, 1187, 937 );
-	f3( 1602, 186, 928 );
-	f3( 15, 699, 1089 );
-	f3( 1625, 506, 528 );
-	f3( 361, 1035, 1569 );
-	f3( 1254, 617, 1526 );
-	f3( 515, 383, 405 );
-	f3( 1316, 1146, 251 );
-	f3( 429, 804, 417 );
-	f3( 1372, 1108, 408 );
-	f3( 700, 812, 727 );
-	f3( 678, 1141, 1396 );
-	f3( 311, 1095, 676 );
-	f3( 502, 503, 1043 );
-	f3( 270, 855, 44 );
-	f3( 1224, 1361, 482 );
-	f3( 683, 765, 787 );
-	f3( 1351, 247, 529 );
-	f3( 729, 1154, 484 );
-	f3( 165, 354, 1058 );
-	f3( 1336, 1331, 499 );
-	f3( 525, 770, 1551 );
-	f3( 1492, 886, 278 );
-	f3( 1619, 204, 1486 );
-	f3( 155, 1267, 641 );
-	f3( 241, 1429, 760 );
-	f3( 346, 1550, 1431 );
-	f3( 540, 1588, 671 );
-	f3( 1625, 1165, 603 );
-	f3( 1116, 53, 939 );
-	f3( 999, 400, 100 );
-	f3( 1395, 981, 298 );
-	f3( 495, 818, 236 );
-	f3( 1026, 412, 1281 );
-	f3( 1044, 127, 34 );
-	f3( 1084, 321, 333 );
-	f3( 440, 1096, 1464 );
-	f3( 1406, 167, 1454 );
-	f3( 786, 646, 991 );
-	f3( 820, 443, 725 );
-	f3( 636, 1108, 737 );
-	f3( 783, 640, 945 );
-	f3( 940, 1230, 1489 );
-	f3( 136, 354, 878 );
-	f3( 377, 984, 592 );
-	f3( 811, 1447, 772 );
-	f3( 49, 1236, 454 );
-	f3( 1184, 795, 219 );
-	f3( 1601, 365, 182 );
-	f3( 239, 1157, 1182 );
-	f3( 80, 1304, 1004 );
-	f3( 1177, 1438, 563 );
-	f3( 1013, 1089, 309 );
-	f3( 320, 1005, 903 );
-	f3( 1592, 808, 1449 );
-	f3( 1421, 60, 254 );
-	f3( 263, 1360, 1609 );
-	f3( 91, 1540, 1234 );
-	f3( 831, 1156, 958 );
-	f3( 942, 1302, 139 );
-	f3( 93, 1365, 1242 );
-	f3( 461, 174, 582 );
-	f3( 703, 557, 25 );
-	f3( 1259, 1175, 427 );
-	f3( 1461, 1212, 1538 );
-	f3( 895, 1441, 403 );
-	f3( 936, 1043, 585 );
-	f3( 1024, 232, 48 );
-	f3( 565, 1083, 927 );
-	f3( 596, 650, 956 );
-	f3( 249, 810, 559 );
-	f3( 1322, 907, 542 );
-	f3( 970, 679, 173 );
-	f3( 455, 497, 1270 );
-	f3( 171, 1431, 52 );
-	f3( 731, 1105, 356 );
-	f3( 1475, 1424, 1572 );
-	f3( 1177, 39, 1438 );
-	f3( 791, 1189, 1495 );
-	f3( 752, 925, 550 );
-	f3( 856, 332, 1397 );
-	f3( 1324, 1412, 1483 );
-	f3( 962, 412, 1026 );
-	f3( 599, 50, 1123 );
-	f3( 684, 976, 919 );
-	f3( 864, 993, 1218 );
-	f3( 824, 1139, 664 );
-	f3( 1051, 1214, 1091 );
-	f3( 1585, 1299, 1320 );
-	f3( 1623, 116, 1389 );
-	f3( 1010, 1532, 313 );
-	f3( 1391, 52, 1485 );
-	f3( 1538, 1212, 162 );
-	f3( 652, 1063, 128 );
-	f3( 406, 571, 251 );
-	f3( 1241, 894, 421 );
-	f3( 1202, 533, 336 );
-	f3( 1607, 1369, 22 );
-	f3( 919, 879, 1146 );
-	f3( 1520, 1171, 806 );
-	f3( 261, 1290, 1122 );
-	f3( 1263, 376, 756 );
-	f3( 34, 1255, 1044 );
-	f3( 1192, 829, 686 );
-	f3( 893, 257, 885 );
-	f3( 1345, 300, 379 );
-	f3( 1237, 1418, 1574 );
-	f3( 1401, 106, 927 );
-	f3( 1221, 744, 985 );
-	f3( 982, 1469, 631 );
-	f3( 298, 127, 1634 );
-	f3( 1353, 1213, 1078 );
-	f3( 989, 1619, 1563 );
-	f3( 803, 1463, 1193 );
-	f3( 464, 1401, 1335 );
-	f3( 904, 49, 1553 );
-	f3( 1153, 1446, 703 );
-	f3( 739, 1630, 10 );
-	f3( 1606, 1176, 85 );
-	f3( 1083, 948, 21 );
-	f3( 1366, 1452, 930 );
-	f3( 553, 228, 451 );
-	f3( 1479, 1121, 282 );
-	f3( 857, 1177, 563 );
-	f3( 706, 415, 287 );
-	f3( 464, 1565, 1401 );
-	f3( 169, 362, 1323 );
-	f3( 246, 1085, 1517 );
-	f3( 1311, 1533, 335 );
-	f3( 889, 231, 596 );
-	f3( 1244, 1468, 876 );
-	f3( 883, 393, 1566 );
-	f3( 298, 1634, 1395 );
-	f3( 648, 37, 295 );
-	f3( 185, 1009, 980 );
-	f3( 279, 1297, 240 );
-	f3( 32, 1147, 492 );
-	f3( 380, 1014, 508 );
-	f3( 1445, 1230, 1119 );
-	f3( 75, 93, 1242 );
-	f3( 480, 958, 1034 );
-	f3( 769, 1428, 370 );
-	f3( 207, 476, 1354 );
-	f3( 25, 557, 704 );
-	f3( 79, 1578, 935 );
-	f3( 1608, 564, 996 );
-	f3( 1232, 1565, 464 );
-	f3( 640, 846, 618 );
-	f3( 607, 973, 807 );
-	f3( 1000, 1332, 151 );
-	f3( 1328, 431, 194 );
-	f3( 254, 1630, 1554 );
-	f3( 947, 1225, 527 );
-	f3( 316, 1636, 1277 );
-	f3( 1168, 496, 1302 );
-	f3( 440, 1303, 1432 );
-	f3( 658, 1631, 1277 );
-	f3( 347, 296, 300 );
-	f3( 667, 1436, 173 );
-	f3( 14, 1450, 937 );
-	f3( 850, 1017, 1514 );
-	f3( 1228, 1629, 1031 );
-	f3( 561, 1180, 178 );
-	f3( 1477, 902, 1204 );
-	f3( 1557, 844, 431 );
-	f3( 279, 724, 358 );
-	f3( 713, 1004, 644 );
-	f3( 1584, 1057, 554 );
-	f3( 141, 354, 209 );
-	f3( 1508, 859, 178 );
-	f3( 131, 786, 268 );
-	f3( 143, 793, 921 );
-	f3( 263, 329, 1325 );
-	f3( 58, 1546, 1215 );
-	f3( 552, 83, 1490 );
-	f3( 1284, 824, 412 );
-	f3( 1409, 655, 142 );
-	f3( 1342, 526, 238 );
-	f3( 1365, 64, 1242 );
-	f3( 516, 572, 59 );
-	f3( 256, 32, 290 );
-	f3( 57, 685, 1076 );
-	f3( 1370, 1601, 182 );
-	f3( 472, 1050, 711 );
-	f3( 581, 1639, 595 );
-	f3( 1027, 478, 1326 );
-	f3( 814, 149, 380 );
-	f3( 792, 691, 1589 );
-	f3( 939, 56, 1116 );
-	f3( 602, 152, 87 );
-	f3( 696, 1371, 1215 );
-	f3( 137, 1235, 754 );
-	f3( 1517, 530, 246 );
-	f3( 691, 385, 475 );
-	f3( 216, 709, 1074 );
-	f3( 1576, 1055, 4 );
-	f3( 754, 1014, 1481 );
-	f3( 1292, 616, 269 );
-	f3( 1640, 365, 963 );
-	f3( 1477, 1204, 906 );
-	f3( 1295, 1364, 276 );
-	f3( 1031, 548, 1228 );
-	f3( 1620, 1456, 366 );
-	f3( 1098, 885, 1129 );
-	f3( 1114, 1133, 448 );
-	f3( 294, 1130, 642 );
-	f3( 893, 1100, 1518 );
-	f3( 712, 827, 6 );
-	f3( 706, 715, 1132 );
-	f3( 1217, 954, 1132 );
-	f3( 1180, 1075, 1130 );
-	f3( 1050, 719, 396 );
-	f3( 357, 326, 1076 );
-	f3( 319, 997, 1243 );
-	f3( 351, 673, 1045 );
-	f3( 698, 828, 1222 );
-	f3( 1430, 1546, 58 );
-	f3( 10, 452, 777 );
-	f3( 286, 1007, 24 );
-	f3( 929, 1263, 145 );
-	f3( 347, 1016, 1308 );
-	f3( 598, 1430, 31 );
-	f3( 242, 248, 1087 );
-	f3( 401, 1367, 1253 );
-	f3( 1310, 354, 165 );
-	f3( 1556, 14, 1399 );
-	f3( 707, 147, 1293 );
-	f3( 1584, 428, 299 );
-	f3( 5, 874, 209 );
-	f3( 1078, 990, 1442 );
-	f3( 464, 1335, 690 );
-	f3( 375, 3, 1589 );
-	f3( 12, 174, 461 );
-	f3( 1084, 333, 493 );
-	f3( 968, 1583, 966 );
-	f3( 197, 236, 1153 );
-	f3( 1508, 178, 1180 );
-	f3( 936, 1387, 1593 );
-	f3( 188, 521, 21 );
-	f3( 1437, 262, 783 );
-	f3( 450, 389, 730 );
-	f3( 638, 487, 1078 );
-	f3( 893, 1518, 472 );
-	f3( 1531, 1468, 513 );
-	f3( 988, 395, 667 );
-	f3( 664, 934, 1309 );
-	f3( 863, 1323, 390 );
-	f3( 966, 1583, 779 );
-	f3( 354, 95, 491 );
-	f3( 303, 1534, 1037 );
-	f3( 832, 109, 1338 );
-	f3( 1080, 542, 1572 );
-	f3( 267, 427, 1175 );
-	f3( 1068, 1162, 274 );
-	f3( 1501, 1209, 1568 );
-	f3( 257, 1453, 885 );
-	f3( 349, 746, 861 );
-	f3( 1415, 47, 129 );
-	f3( 813, 326, 18 );
-	f3( 905, 1347, 118 );
-	f3( 1447, 811, 953 );
-	f3( 994, 1361, 1331 );
-	f3( 1022, 281, 1112 );
-	f3( 945, 280, 911 );
-	f3( 314, 684, 84 );
-	f3( 117, 413, 1195 );
-	f3( 457, 1519, 338 );
-	f3( 1074, 284, 627 );
-	f3( 1502, 282, 1121 );
-	f3( 832, 86, 109 );
-	f3( 930, 708, 794 );
-	f3( 820, 725, 1107 );
-	f3( 312, 560, 1135 );
-	f3( 606, 1295, 586 );
-	f3( 881, 1144, 605 );
-	f3( 40, 1090, 1174 );
-	f3( 180, 611, 889 );
-	f3( 779, 1583, 123 );
-	f3( 1149, 567, 192 );
-	f3( 167, 399, 244 );
-	f3( 1322, 542, 1443 );
-	f3( 1557, 930, 1452 );
-	f3( 1441, 166, 1026 );
-	f3( 813, 632, 326 );
-	f3( 1494, 1056, 1208 );
-	f3( 1559, 961, 1133 );
-	f3( 359, 1380, 896 );
-	f3( 903, 1021, 198 );
-	f3( 1045, 673, 1190 );
-	f3( 482, 1539, 1224 );
-	f3( 283, 597, 1343 );
-	f3( 972, 740, 353 );
-	f3( 1349, 10, 1630 );
-	f3( 266, 1474, 323 );
-	f3( 298, 981, 1061 );
-	f3( 1220, 922, 714 );
-	f3( 636, 6, 1134 );
-	f3( 945, 138, 280 );
-	f3( 1325, 329, 445 );
-	f3( 492, 98, 1179 );
-	f3( 1332, 476, 207 );
-	f3( 321, 1186, 333 );
-	f3( 1480, 159, 841 );
-	f3( 872, 754, 1235 );
-	f3( 1488, 1380, 1579 );
-	f3( 368, 687, 522 );
-	f3( 1370, 280, 1601 );
-	f3( 1308, 609, 306 );
-	f3( 62, 579, 946 );
-	f3( 470, 1279, 1510 );
-	f3( 1339, 203, 417 );
-	f3( 1434, 751, 699 );
-	f3( 560, 170, 1086 );
-	f3( 569, 1088, 373 );
-	f3( 1445, 1320, 1299 );
-	f3( 1611, 1571, 1603 );
-	f3( 491, 95, 136 );
-	f3( 223, 375, 475 );
-	f3( 1010, 556, 1336 );
-	f3( 1230, 997, 701 );
-	f3( 535, 1036, 724 );
-	f3( 536, 649, 774 );
-	f3( 53, 63, 388 );
-	f3( 1244, 1297, 1468 );
-	f3( 233, 1290, 771 );
-	f3( 1271, 1148, 1598 );
-	f3( 338, 219, 733 );
-	f3( 432, 1545, 1217 );
-	f3( 4, 1499, 76 );
-	f3( 1335, 30, 990 );
-	f3( 1375, 1001, 1253 );
-	f3( 530, 1623, 1389 );
-	f3( 181, 402, 1126 );
-	f3( 1137, 856, 1573 );
-	f3( 1460, 315, 1256 );
-	f3( 1047, 134, 613 );
-	f3( 253, 1025, 969 );
-	f3( 186, 172, 734 );
-	f3( 655, 254, 871 );
-	f3( 721, 429, 297 );
-	f3( 1438, 1487, 906 );
-	f3( 775, 23, 1170 );
-	f3( 1303, 1633, 1432 );
-	f3( 76, 1499, 336 );
-	f3( 1188, 1400, 245 );
-	f3( 143, 632, 1047 );
-	f3( 1077, 904, 201 );
-	f3( 1314, 866, 177 );
-	f3( 1364, 620, 1066 );
-	f3( 1427, 600, 1210 );
-	f3( 886, 1608, 933 );
-	f3( 1391, 110, 171 );
-	f3( 1207, 944, 66 );
-	f3( 833, 1573, 204 );
-	f3( 1008, 465, 869 );
-	f3( 431, 19, 1169 );
-	f3( 565, 481, 1624 );
-	f3( 251, 879, 1173 );
-	f3( 1137, 1541, 332 );
-	f3( 1356, 1118, 683 );
-	f3( 519, 190, 865 );
-	f3( 139, 1553, 49 );
-	f3( 197, 585, 1590 );
-	f3( 885, 1453, 505 );
-	f3( 1053, 882, 196 );
-	f3( 1457, 258, 1099 );
-	f3( 1097, 1491, 1467 );
-	f3( 1343, 589, 538 );
-	f3( 235, 529, 1549 );
-	f3( 1556, 1399, 231 );
-	f3( 1237, 747, 716 );
-	f3( 604, 1504, 776 );
-	f3( 1453, 212, 1294 );
-	f3( 1509, 679, 846 );
-	f3( 870, 1085, 809 );
-	f3( 542, 1054, 1443 );
-	f3( 288, 1117, 1604 );
-	f3( 1481, 1014, 380 );
-	f3( 580, 944, 1469 );
-	f3( 438, 0, 1444 );
-	f3( 1156, 831, 1603 );
-	f3( 972, 353, 230 );
-	f3( 262, 759, 784 );
-	f3( 1226, 387, 809 );
-	f3( 1523, 1400, 509 );
-	f3( 1068, 227, 1464 );
-	f3( 1070, 208, 1306 );
-	f3( 342, 1439, 232 );
-	f3( 1104, 858, 1403 );
-	f3( 736, 1305, 1475 );
-	f3( 1186, 555, 413 );
-	f3( 1248, 426, 1585 );
-	f3( 840, 1349, 1630 );
-	f3( 512, 1630, 254 );
-	f3( 1587, 949, 978 );
-	f3( 423, 668, 837 );
-	f3( 673, 781, 972 );
-	f3( 807, 761, 216 );
-	f3( 1385, 1595, 222 );
-	f3( 818, 495, 821 );
-	f3( 465, 526, 1342 );
-	f3( 60, 315, 852 );
-	f3( 1578, 285, 738 );
-	f3( 969, 643, 478 );
-	f3( 480, 1327, 1328 );
-	f3( 1351, 529, 59 );
-	f3( 271, 1115, 1031 );
-	f3( 1606, 1596, 800 );
-	f3( 638, 874, 5 );
-	f3( 979, 1334, 1555 );
-	f3( 585, 1387, 936 );
-	f3( 1172, 842, 1266 );
-	f3( 48, 232, 252 );
-	f3( 795, 126, 1634 );
-	f3( 357, 685, 1558 );
-	f3( 783, 784, 493 );
-	f3( 1056, 675, 1208 );
-	f3( 90, 1410, 1463 );
-	f3( 365, 1601, 1384 );
-	f3( 1186, 321, 1440 );
-	f3( 1126, 768, 1211 );
-	f3( 1545, 432, 1406 );
-	f3( 898, 237, 645 );
-	f3( 855, 272, 931 );
-	f3( 355, 1432, 238 );
-	f3( 1276, 1599, 1524 );
-	f3( 228, 1097, 1467 );
-	f3( 778, 247, 1351 );
-	f3( 1191, 1119, 959 );
-	f3( 1602, 183, 587 );
-	f3( 272, 1070, 931 );
-	f3( 415, 706, 1132 );
-	f3( 973, 489, 203 );
-	f3( 732, 807, 973 );
-	f3( 1313, 970, 1436 );
-	f3( 55, 1397, 34 );
-	f3( 1034, 1383, 480 );
-	f3( 1417, 1393, 1456 );
-	f3( 1282, 1106, 854 );
-	f3( 497, 79, 935 );
-	f3( 264, 1596, 85 );
-	f3( 1557, 1327, 930 );
-	f3( 1197, 542, 651 );
-	f3( 511, 707, 590 );
-	f3( 44, 1346, 1403 );
-	f3( 1567, 908, 944 );
-	f3( 1525, 987, 399 );
-	f3( 728, 475, 377 );
-	f3( 1550, 273, 71 );
-	f3( 74, 201, 583 );
-	f3( 141, 758, 271 );
-	f3( 722, 475, 453 );
-	f3( 487, 990, 1078 );
-	f3( 1034, 871, 1383 );
-	f3( 931, 385, 1346 );
-	f3( 827, 712, 1521 );
-	f3( 1566, 393, 1113 );
-	f3( 130, 492, 1147 );
-	f3( 818, 1446, 236 );
-	f3( 495, 459, 1638 );
-	f3( 994, 556, 1222 );
-	f3( 617, 1576, 4 );
-	f3( 1512, 1424, 341 );
-	f3( 483, 159, 1088 );
-	f3( 189, 1263, 929 );
-	f3( 139, 49, 942 );
-	f3( 1505, 1385, 407 );
-	f3( 67, 1637, 934 );
-	f3( 1017, 353, 113 );
-	f3( 560, 1265, 170 );
-	f3( 677, 1004, 713 );
-	f3( 867, 541, 1076 );
-	f3( 1339, 732, 203 );
-	f3( 86, 1583, 838 );
-	f3( 699, 751, 1089 );
-	f3( 432, 1132, 1377 );
-	f3( 669, 1059, 132 );
-	f3( 961, 1641, 395 );
-	f3( 701, 997, 319 );
-	f3( 804, 1060, 1604 );
-	f3( 377, 1046, 984 );
-	f3( 698, 634, 1491 );
-	f3( 455, 887, 79 );
-	f3( 263, 1417, 1360 );
-	f3( 355, 238, 1561 );
-	f3( 781, 909, 972 );
-	f3( 964, 745, 479 );
-	f3( 986, 1238, 1141 );
-	f3( 588, 497, 1372 );
-	f3( 195, 164, 1379 );
-	f3( 368, 522, 840 );
-	f3( 378, 198, 7 );
-	f3( 726, 199, 1130 );
-	f3( 625, 883, 1171 );
-	f3( 36, 452, 1349 );
-	f3( 347, 862, 296 );
-	f3( 58, 1189, 1011 );
-	f3( 123, 144, 1219 );
-	f3( 1308, 1038, 1209 );
-	f3( 1132, 432, 1217 );
-	f3( 847, 669, 1196 );
-	f3( 1373, 1085, 73 );
-	f3( 489, 973, 834 );
-	f3( 877, 1428, 1597 );
-	f3( 45, 483, 569 );
-	f3( 1582, 797, 1183 );
-	f3( 445, 1042, 1325 );
-	f3( 578, 1028, 1073 );
-	f3( 494, 1513, 62 );
-	f3( 1469, 944, 1207 );
-	f3( 960, 162, 662 );
-	f3( 1516, 1219, 356 );
-	f3( 1575, 286, 1093 );
-	f3( 454, 894, 519 );
-	f3( 232, 1332, 252 );
-	f3( 1071, 134, 1047 );
-	f3( 292, 7, 1111 );
-	f3( 866, 268, 877 );
-	f3( 672, 661, 1479 );
-	f3( 954, 289, 1042 );
-	f3( 25, 949, 1587 );
-	f3( 113, 353, 740 );
-	f3( 58, 1215, 26 );
-	f3( 1222, 991, 646 );
-
-	this.computeCentroids();
-	this.computeFaceNormals();
-
-	function v( x, y, z ) {
-
-		scope.vertices.push( new THREE.Vertex( new THREE.Vector3( x, y, z ) ) );
-
-	}
-
-	function f3( a, b, c ) {
-
-		scope.faces.push( new THREE.Face3( a, b, c ) );
-
-	}
-
-}
-
-WaltHead.prototype = new THREE.Geometry();
-WaltHead.prototype.constructor = WaltHead;

File diff suppressed because it is too large
+ 23 - 0
examples/obj/WaltHeadLo.js


+ 1 - 8
examples/webgl_geometry_subdivison.html

@@ -28,9 +28,6 @@
 
 		<script src="fonts/helvetiker_regular.typeface.js"></script>
 
-		<script src="obj/WaltHead.js"></script>
-		<!-- -->
-
 		<script>
 
 			var container, stats;
@@ -76,8 +73,6 @@
 
 			}
 
-			THREE.WaltHead = WaltHead;
-
 			var geometriesParams = [
 
 				{type: 'CubeGeometry', args: [ 200, 200, 200, 2, 2, 2, materials ] },
@@ -92,9 +87,7 @@
 										font: "helvetiker"
 
 									}]},
-				{type: 'PlaneGeometry', args: [ 200, 200, 4, 4 ] },
-
-				{type: 'WaltHead', args: [ ], scale: 6 }
+				{type: 'PlaneGeometry', args: [ 200, 200, 4, 4 ] }
 
 			];
 

+ 25 - 25
gui/index.html

@@ -38,7 +38,7 @@
 		<script type="text/javascript" src="js/libs/signals.min.js"></script>
 
 		<script type="text/javascript" src="js/UI.js"></script>
-		<script type="text/javascript" src="js/UI.Viewports.js"></script>
+		<script type="text/javascript" src="js/UI.Viewport.js"></script>
 		<script type="text/javascript" src="js/UI.Toolbar.js"></script>
 		<script type="text/javascript" src="js/Code.js"></script>
 		<script type="text/javascript" src="js/Code.Templates.js"></script>
@@ -69,8 +69,6 @@
 			xr.style.position = 'absolute';
 			xr.style.top = '0px';
 			xr.style.width = '1px';
-			xr.style.borderLeft = '1px solid #e0e0e0';
-			// xr.style.backgroundColor = '#ffffff';
 			xr.style.cursor = 'col-resize';
 			xr.addEventListener( 'mousedown', function ( event ) {
 
@@ -133,22 +131,6 @@
 
 					switch ( extension ) {
 
-						case 'dae':
-
-							var parser = new DOMParser();
-							var xml = parser.parseFromString( contents, 'text/xml' );
-
-							var loader = new THREE.ColladaLoader();
-							loader.parse( xml, function ( collada ) {
-
-								// console.log( collada );
-
-								signals.added.dispatch( collada.scene );
-
-							} );
-
-							break;
-
 						case 'js':
 
 							var blob = new BlobBuilder();
@@ -157,7 +139,7 @@
 							var url = URL.createObjectURL( blob.getBlob() );
 
 							var loader = new THREE.JSONLoader();
-							loader.load( { model: url, callback: function ( geometry ) {
+							loader.load( url, function ( geometry ) {
 
 								geometry.gui = {
 									paremeters: {
@@ -174,10 +156,28 @@
 
 								signals.added.dispatch( mesh );
 
-							} } );
+							} );
 
 							break;
 
+						case 'dae':
+
+							var parser = new DOMParser();
+							var xml = parser.parseFromString( contents, 'text/xml' );
+
+							var loader = new THREE.ColladaLoader();
+							loader.parse( xml, function ( collada ) {
+
+								// console.log( collada );
+
+								signals.added.dispatch( collada.scene );
+
+							} );
+
+							break;
+
+
+
 					}
 
 				};
@@ -201,12 +201,12 @@
 
 			function update() {
 
-				ui.setSize( window.innerWidth * xhalf, window.innerHeight );
+				ui.setSize( Math.floor( window.innerWidth * xhalf ), window.innerHeight );
 
-				code.setPosition( window.innerWidth * xhalf, 0 );
-				code.setSize( window.innerWidth - ( window.innerWidth * xhalf ), window.innerHeight );
+				code.setPosition( Math.floor( window.innerWidth * xhalf ), 0 );
+				code.setSize( window.innerWidth - Math.floor( window.innerWidth * xhalf ), window.innerHeight );
 
-				xr.style.left = ( window.innerWidth * xhalf )  + 'px';
+				xr.style.left = Math.floor( window.innerWidth * xhalf )  + 'px';
 				xr.style.height = window.innerHeight + 'px';
 
 			}

+ 2 - 2
gui/js/Code.js

@@ -28,7 +28,7 @@ var Code = function () {
 			temp = temp.firstChild.nodeValue;
 			temp = temp.replace("js/Three.js", "../build/Three.js");
 			temp = temp.replace("js/RequestAnimationFrame.js", "../examples/js/RequestAnimationFrame.js");
-			aaa = temp;
+
 			console.log('test', temp);
 
 			var opener = window.open('','myconsole',
@@ -97,6 +97,7 @@ var Code = function () {
 
 			'',
 			'\trenderer = new THREE.WebGLRenderer()',
+			'\trenderer.setSize( window.innerWidth, window.innerHeight );',
 			'\tdocument.body.appendChild( renderer.domElement );',
 			'',
 			'}',
@@ -111,7 +112,6 @@ var Code = function () {
 			'function render() {',
 			'',
 			'\trenderer.render( scene, camera );',
-			'\trenderer.setSize( window.innerWidth, window.innerHeight );',
 			'',
 			'}'
 

+ 254 - 0
gui/js/UI.Viewport.js

@@ -0,0 +1,254 @@
+UI.Viewport = function () {
+
+	var _width, _height;
+	var _isMouseDown = false;
+	var _snapToAxis = null;
+
+	var _HOVERED, _SELECTED;
+	var _offset = new THREE.Vector3();
+
+	//
+
+	var _domElement = document.createElement( 'div' );
+	_domElement.style.position = 'absolute';
+	_domElement.style.backgroundColor = '#808080';
+
+	//
+
+	var _camera = new THREE.PerspectiveCamera( 50, 1, 1, 5000 );
+	_camera.position.x = 500;
+	_camera.position.y = 250;
+	_camera.position.z = 500;
+	_camera.lookAt( new THREE.Vector3() );
+
+	var _controls = new THREE.TrackballControls( _camera );
+	_controls.rotateSpeed = 1.0;
+	_controls.zoomSpeed = 1.2;
+	_controls.panSpeed = 0.8;
+	_controls.noZoom = false;
+	_controls.noPan = false;
+	_controls.staticMoving = true;
+	_controls.dynamicDampingFactor = 0.3;
+
+	// guides
+
+	var _sceneHelpers = new THREE.Scene();
+
+	var _grid = new THREE.Mesh( new THREE.PlaneGeometry( 1000, 1000, 20, 20 ), new THREE.MeshBasicMaterial( { color: 0x606060, wireframe: true, transparent: true } ) );
+	_grid.rotation.x = Math.PI / 2;
+	_sceneHelpers.add( _grid );
+
+	//
+
+	var _scene = new THREE.Scene();
+
+	/*
+	var light = new THREE.AmbientLight( 0x404040 );
+	_scene.add( light );
+
+	var light = new THREE.DirectionalLight( 0xffffff );
+	light.position.set( 1000, 1000, - 1000 );
+	light.position.normalize();
+	_scene.add( light );
+	*/
+
+	var _plane = new THREE.Mesh( new THREE.PlaneGeometry( 2000, 2000, 8, 8 ), new THREE.MeshBasicMaterial( { color: 0x000000, opacity: 0.25, transparent: true, wireframe: true } ) );
+	_plane.visible = false;
+	_sceneHelpers.add( _plane );
+
+	var _projector = new THREE.Projector();
+
+	var _renderer = new THREE.WebGLRenderer();
+	_renderer.autoClear = false;
+	_renderer.domElement.addEventListener( 'mousedown', function ( event ) {
+
+		event.preventDefault();
+
+		_isMouseDown = true;
+
+		var vector = new THREE.Vector3( ( event.clientX / _width ) * 2 - 1, - ( event.clientY / _height ) * 2 + 1, 0.5 );
+		_projector.unprojectVector( vector, _camera );
+
+		var ray = new THREE.Ray( _camera.position, vector.subSelf( _camera.position ).normalize() );
+		var intersects = ray.intersectScene( _scene );
+
+		if ( intersects.length ) {
+
+			_SELECTED = intersects[ 0 ].object;
+
+			_controls.enabled = false;
+
+			var intersects = ray.intersectObject( _plane );
+			_offset.copy( intersects[ 0 ].point ).subSelf( _plane.position );
+
+		}
+
+	}, false );
+	_renderer.domElement.addEventListener( 'mousemove', function ( event ) {
+
+		event.preventDefault();
+
+		var vector = new THREE.Vector3( ( event.clientX / _width ) * 2 - 1, - ( event.clientY / _height ) * 2 + 1, 0.5 );
+		_projector.unprojectVector( vector, _camera );
+
+		var ray = new THREE.Ray( _camera.position, vector.subSelf( _camera.position ).normalize() );
+		var intersects = ray.intersectScene( _scene );
+
+		if ( _SELECTED ) {
+
+			var intersects = ray.intersectObject( _plane );
+			_SELECTED.position.copy( intersects[ 0 ].point.subSelf( _offset ) );
+
+			switch ( _snapToAxis ) {
+
+				case 'x':
+					_SELECTED.position.y = _plane.position.y;
+					_SELECTED.position.z = _plane.position.z;
+					break;
+
+				case 'y':
+					_SELECTED.position.x = _plane.position.x;
+					_SELECTED.position.z = _plane.position.z;
+					break;
+
+				case 'z':
+					_SELECTED.position.x = _plane.position.x;
+					_SELECTED.position.y = _plane.position.y;
+					break;
+
+			}
+
+			_render();
+
+			signals.updated.dispatch( _scene );
+
+			return;
+
+		}
+
+		if ( intersects.length ) {
+
+			_HOVERED = intersects[ 0 ].object;
+
+			_plane.position.set( 0, 0, 0 );
+			_plane.lookAt( _camera.position );
+			_plane.position.copy( _HOVERED.position );
+
+		} else {
+
+			_HOVERED = null;
+
+		}
+
+		_render();
+
+	}, false );
+	_renderer.domElement.addEventListener( 'mouseup', function ( event ) {
+
+		// event.preventDefault();
+
+		_isMouseDown = false; 
+		_snapToAxis = null;
+
+		_controls.enabled = true;
+
+		if ( _SELECTED ) {
+
+			_plane.position.copy( _SELECTED.position );
+			_SELECTED = null;
+
+		}
+
+	}, false );
+	/*
+	_renderer.domElement.addEventListener( 'mousewheel', function ( event ) {
+
+		if ( event.wheelDeltaY ) {
+
+			event.preventDefault();
+
+			var vector = _camera.position.clone();
+			var amount = event.wheelDeltaY * 0.2;
+
+			if ( vector.length() - amount < 10 ) return;
+
+			vector.normalize().multiplyScalar( amount );
+			_camera.position.subSelf( vector );
+
+			_render();
+
+		}
+
+	}, false );
+	*/
+	document.addEventListener( 'keydown', function ( event ) {
+
+		if ( _isMouseDown ) {
+
+			// console.log( event.keyCode );
+
+			switch ( event.keyCode ) {
+
+				case 88: // x
+					_snapToAxis = 'x';
+					break;
+
+				case 89: // y
+					_snapToAxis = 'y';
+					break;
+
+				case 90: // z
+					_snapToAxis = 'z';
+					break;
+
+			}
+
+		}
+
+	}, false );
+	_domElement.appendChild( _renderer.domElement );
+
+	// signals
+
+	signals.added.add( function ( object ) {
+
+		_scene.add( object );
+		_render();
+
+		signals.updated.dispatch( _scene );
+
+	} );
+
+	//
+
+	this.getDOMElement = function () {
+
+		return _domElement;
+
+	};
+
+	this.setSize = function ( width, height ) {
+
+		_width = width;
+		_height = height;
+
+		_camera.aspect = width / height;
+		_camera.updateProjectionMatrix();
+
+		_renderer.setSize( width, height );
+
+		_render();
+
+	};
+
+	var _render = function () {
+
+		_controls.update();
+
+		_renderer.clear();
+		_renderer.render( _sceneHelpers, _camera );
+		_renderer.render( _scene, _camera );
+
+	};
+
+}

+ 0 - 432
gui/js/UI.Viewports.js

@@ -1,432 +0,0 @@
-UI.Viewports = function () {
-
-	var _width, _height;
-	var _xhalf = 0.5, _yhalf = 0.5;
-
-	var _HOVERED, _SELECTED;
-	var _offset = new THREE.Vector3();
-
-	//
-
-	var _domElement = document.createElement( 'div' );
-	_domElement.style.position = 'absolute';
-	_domElement.style.backgroundColor = '#808080';
-
-	//
-
-	var _views = [
-		{ x: null, y: null, width: null, height: null, camera: null },
-		{ x: null, y: null, width: null, height: null, camera: null },
-		{ x: null, y: null, width: null, height: null, camera: null },
-		{ x: null, y: null, width: null, height: null, camera: null }
-	];
-
-	_views[ 0 ].camera = new THREE.OrthographicCamera( - 1, 1, 1, - 1, - 2000, 2000 ); // top
-	_views[ 0 ].camera.position.y = 1000;
-	_views[ 0 ].camera.rotation.x = - Math.PI / 2;
-
-	_views[ 1 ].camera = new THREE.OrthographicCamera( - 1, 1, 1, - 1, - 2000, 2000 ); // front
-	_views[ 1 ].camera.position.z = 1000;
-
-	_views[ 2 ].camera = new THREE.OrthographicCamera( - 1, 1, 1, - 1, - 2000, 2000 ); // left
-	_views[ 2 ].camera.position.x = - 1000;
-	_views[ 2 ].camera.rotation.y = - Math.PI / 2;
-
-	_views[ 3 ].camera = new THREE.PerspectiveCamera( 50, 1, 1, 5000 ); // perspective
-	_views[ 3 ].camera.position.x = 1000;
-	_views[ 3 ].camera.position.y = 1000;
-	_views[ 3 ].camera.position.z = 1000;
-
-	// guides
-
-	var _sceneHelpers = new THREE.Scene();
-
-	var _grid = new THREE.Mesh( new THREE.PlaneGeometry( 1000, 1000, 20, 20 ), new THREE.MeshBasicMaterial( { color: 0x606060, wireframe: true, transparent: true } ) );
-	_grid.rotation.x = Math.PI / 2;
-	_sceneHelpers.add( _grid );
-
-	//
-
-	var _scene = new THREE.Scene();
-
-	/*
-	var light = new THREE.AmbientLight( 0x404040 );
-	_scene.add( light );
-
-	var light = new THREE.DirectionalLight( 0xffffff );
-	light.position.set( 1000, 1000, - 1000 );
-	light.position.normalize();
-	_scene.add( light );
-	*/
-
-	var _plane = new THREE.Mesh( new THREE.PlaneGeometry( 2000, 2000, 8, 8 ), new THREE.MeshBasicMaterial( { color: 0x000000, opacity: 0.25, transparent: true, wireframe: true } ) );
-	_plane.visible = false;
-	_sceneHelpers.add( _plane );
-
-	var _projector = new THREE.Projector();
-
-	var _renderer = new THREE.WebGLRenderer( /*{ antialias: true }*/ );
-	_renderer.autoClear = false;
-	_renderer.domElement.addEventListener( 'mousedown', function ( event ) {
-
-		event.preventDefault();
-
-		var mouse = getViewportMouse( event.clientX, event.clientY );
-
-		var camera = _views[ mouse.view ].camera;
-		var vector = new THREE.Vector3( mouse.x * 2 - 1, - mouse.y * 2 + 1, 0.5 );
-		_projector.unprojectVector( vector, camera );
-
-		var ray = new THREE.Ray( camera.position, vector.subSelf( camera.position ).normalize() );
-		var intersects = ray.intersectScene( _scene );
-
-		if ( intersects.length ) {
-
-			_SELECTED = intersects[ 0 ].object;
-
-			var intersects = ray.intersectObject( _plane );
-			_offset.copy( intersects[ 0 ].point ).subSelf( _plane.position );
-
-		}
-
-	}, false );
-	_renderer.domElement.addEventListener( 'mousemove', function ( event ) {
-
-		event.preventDefault();
-
-		var mouse = getViewportMouse( event.clientX, event.clientY );
-
-		var camera = _views[ mouse.view ].camera;
-		var vector = new THREE.Vector3( mouse.x * 2 - 1, - mouse.y * 2 + 1, 0.5 );
-		_projector.unprojectVector( vector, camera );
-
-		var ray = new THREE.Ray( camera.position, vector.subSelf( camera.position ).normalize() );
-		var intersects = ray.intersectScene( _scene );
-
-		if ( _SELECTED ) {
-
-			var intersects = ray.intersectObject( _plane );
-			_SELECTED.position.copy( intersects[ 0 ].point.subSelf( _offset ) );
-
-			_render();
-
-			signals.updated.dispatch( _scene );
-
-			return;
-
-		}
-
-		if ( intersects.length ) {
-
-			_HOVERED = intersects[ 0 ].object;
-
-			_plane.position.set( 0, 0, 0 );
-			_plane.lookAt( camera.position );
-			_plane.position.copy( _HOVERED.position );
-
-			_render();
-
-		} else {
-
-			_HOVERED = null;
-
-		}
-
-	}, false );
-	_renderer.domElement.addEventListener( 'mouseup', function ( event ) {
-
-		event.preventDefault();
-
-		if ( _SELECTED ) {
-
-			_plane.position.copy( _SELECTED.position );
-			_SELECTED = null;
-
-		}
-
-	}, false );
-	_renderer.domElement.addEventListener( 'mousewheel', function ( event ) {
-
-		if ( event.wheelDeltaY ) {
-
-			event.preventDefault();
-
-			var mouse = getViewportMouse( event.clientX, event.clientY );
-			var camera = _views[ mouse.view ].camera;
-			var vector = camera.position.clone();
-			var amount = event.wheelDeltaY * 0.2;
-
-			if ( vector.length() - amount < 10 ) return;
-
-			vector.normalize().multiplyScalar( amount );
-			camera.position.subSelf( vector );
-
-			_render();
-
-		}
-
-	}, false );
-	_domElement.appendChild( _renderer.domElement );
-
-	//
-
-	var _xr = document.createElement( 'div' );
-	_xr.style.position = 'absolute';
-	_xr.style.top = '0px';
-	_xr.style.width = '1px';
-	_xr.style.borderLeft = '1px solid #808080';
-	_xr.style.borderRight = '1px solid #808080';
-	_xr.style.backgroundColor = '#404040';
-	_xr.style.cursor = 'col-resize';
-	_xr.addEventListener( 'mousedown', function ( event ) {
-
-		event.preventDefault();
-
-		document.body.style.cursor = 'col-resize';
-		document.addEventListener( 'mousemove', onMouseMove, false );
-		document.addEventListener( 'mouseup', onMouseUp, false );
-
-		function onMouseMove( event ) {
-
-			event.preventDefault();
-
-			_xhalf = Math.max( 0, Math.min( 1, event.clientX / _width ) );
-
-			_updateViews();
-			_updateCameras();
-			_render();
-
-		}
-
-		function onMouseUp( event ) {
-
-			document.body.style.cursor = 'auto';
-			document.removeEventListener( 'mousemove', onMouseMove, false );
-			document.removeEventListener( 'mouseup', onMouseUp, false );
-
-		}
-
-	}, false );
-	_xr.addEventListener( 'dblclick', function ( event ) {
-
-		_xhalf = 0.5;
-
-		_updateViews();
-		_updateCameras();
-		_render();
-
-	}, false );
-	_domElement.appendChild( _xr );
-
-	var _yr = document.createElement( 'div' );
-	_yr.style.position = 'absolute';
-	_yr.style.height = '1px';
-	_yr.style.borderTop = '1px solid #808080';
-	_yr.style.borderBottom = '1px solid #808080';
-	_yr.style.backgroundColor = '#404040';
-	_yr.style.cursor = 'row-resize';
-	_yr.addEventListener( 'mousedown', function ( event ) {
-
-		event.preventDefault();
-
-		document.body.style.cursor = 'row-resize';
-		document.addEventListener( 'mousemove', onMouseMove, false );
-		document.addEventListener( 'mouseup', onMouseUp, false );
-
-		function onMouseMove( event ) {
-
-			event.preventDefault();
-
-			_yhalf = Math.max( 0, Math.min( 1, event.clientY / _height ) );
-
-			_updateViews();
-			_updateCameras();
-			_render();
-
-		}
-
-		function onMouseUp( event ) {
-
-			document.body.style.cursor = 'auto';
-			document.removeEventListener( 'mousemove', onMouseMove, false );
-			document.removeEventListener( 'mouseup', onMouseUp, false );
-
-		}
-
-	}, false );
-	_yr.addEventListener( 'dblclick', function ( event ) {
-
-		_yhalf = 0.5;
-
-		_updateViews();
-		_updateCameras();
-		_render();
-
-	}, false );
-	_domElement.appendChild( _yr );
-
-	function getViewportMouse( x, y ) {
-
-		var width = _views[ 0 ].width;
-		var height = _views[ 0 ].height;
-
-		if ( x < width && y < height ) {
-
-			return {
-
-				view: 0,
-				x: x / _views[ 0 ].width,
-				y: y / _views[ 0 ].height
-
-			};
-
-		} else if ( x > width && y < height ) {
-
-			return {
-
-				view: 1,
-				x: ( x - _views[ 1 ].x ) / _views[ 1 ].width,
-				y: y / _views[ 1 ].height
-
-			};
-
-		} else if ( x < width && y > height ) {
-
-			return {
-
-				view: 2,
-				x: x / _views[ 2 ].width,
-				y: ( y - _views[ 2 ].y ) / _views[ 2 ].height
-
-			};
-
-		} else if ( x > width && y > height ) {
-
-			return {
-
-				view: 3,
-				x: ( x - _views[ 3 ].x ) / _views[ 3 ].width,
-				y: ( y - _views[ 3 ].y ) / _views[ 3 ].height
-
-			};
-
-		}
-
-	}
-
-	// signals
-
-	signals.added.add( function ( object ) {
-
-		_scene.add( object );
-		_render();
-
-		signals.updated.dispatch( _scene );
-
-	} );
-
-	//
-
-	this.getDOMElement = function () {
-
-		return _domElement;
-
-	};
-
-	this.setSize = function ( width, height ) {
-
-		_width = width;
-		_height = height;
-
-		_updateViews();
-		_updateCameras();
-
-		_renderer.setSize( _width, _height );
-
-		_render();
-
-	};
-
-	var _updateViews = function () {
-
-		_views[ 0 ].x = 0;
-		_views[ 0 ].y = 0;
-		_views[ 0 ].width = _width * _xhalf;
-		_views[ 0 ].height = _height * _yhalf;
-
-		_views[ 1 ].x = _width * _xhalf;
-		_views[ 1 ].y = 0;
-		_views[ 1 ].width = _width - _width * _xhalf;
-		_views[ 1 ].height = _height * _yhalf;
-
-		_views[ 2 ].x = 0;
-		_views[ 2 ].y = _height * _yhalf;
-		_views[ 2 ].width = _width * _xhalf;
-		_views[ 2 ].height = _height - _height * _yhalf;
-
-		_views[ 3 ].x = _width * _xhalf;
-		_views[ 3 ].y = _height * _yhalf;
-		_views[ 3 ].width = _width - _width * _xhalf;
-		_views[ 3 ].height = _height - _height * _yhalf;
-
-	};
-
-	var _updateCameras = function () {
-
-		_views[ 0 ].camera.left = _views[ 0 ].width / - 2;
-		_views[ 0 ].camera.right = _views[ 0 ].width / 2;
-		_views[ 0 ].camera.top = _views[ 0 ].height / 2;
-		_views[ 0 ].camera.bottom = _views[ 0 ].height / - 2;
-		_views[ 0 ].camera.updateProjectionMatrix();
-
-		_views[ 1 ].camera.left = _views[ 1 ].width / - 2;
-		_views[ 1 ].camera.right = _views[ 1 ].width / 2;
-		_views[ 1 ].camera.top = _views[ 1 ].height / 2;
-		_views[ 1 ].camera.bottom = _views[ 1 ].height / - 2;
-		_views[ 1 ].camera.updateProjectionMatrix();
-
-		_views[ 2 ].camera.left = _views[ 2 ].width / - 2;
-		_views[ 2 ].camera.right = _views[ 2 ].width / 2;
-		_views[ 2 ].camera.top = _views[ 2 ].height / 2;
-		_views[ 2 ].camera.bottom = _views[ 2 ].height / - 2;
-		_views[ 2 ].camera.updateProjectionMatrix();
-
-		_views[ 3 ].camera.aspect = _views[ 3 ].width / _views[ 3 ].height;
-		_views[ 3 ].camera.updateProjectionMatrix();
-
-
-	};
-
-	var _render = function () {
-
-		_xr.style.left = ( _width * _xhalf ) + 'px';
-		_xr.style.height = _height + 'px';
-
-		_yr.style.top = ( _height * _yhalf ) + 'px';
-		_yr.style.width = _width + 'px';
-
-		//
-
-		_views[ 3 ].camera.lookAt( _scene.position );
-
-		_renderer.clear();
-
-		_renderer.setViewport( 0, _height - _height * _yhalf, _views[ 0 ].width, _views[ 0 ].height );
-		_renderer.render( _sceneHelpers, _views[ 0 ].camera );
-		_renderer.render( _scene, _views[ 0 ].camera );
-
-		_renderer.setViewport( _width * _xhalf, _height - _height * _yhalf, _views[ 1 ].width, _views[ 1 ].height );
-		_renderer.render( _sceneHelpers, _views[ 1 ].camera );
-		_renderer.render( _scene, _views[ 1 ].camera );
-
-		_renderer.setViewport( 0, 0, _views[ 2 ].width, _views[ 2 ].height );
-		_renderer.render( _sceneHelpers, _views[ 2 ].camera );
-		_renderer.render( _scene, _views[ 2 ].camera );
-
-		_renderer.setViewport( _width * _xhalf, 0, _views[ 3 ].width, _views[ 3 ].height );
-		_renderer.render( _sceneHelpers, _views[ 3 ].camera );
-		_renderer.render( _scene, _views[ 3 ].camera );
-
-	};
-
-}

+ 3 - 3
gui/js/UI.js

@@ -3,8 +3,8 @@ var UI = function () {
 	var _domElement = document.createElement( 'div' );
 	_domElement.style.position = 'absolute';
 
-	var _viewports = new UI.Viewports();
-	_domElement.appendChild( _viewports.getDOMElement() );
+	var _viewport = new UI.Viewport();
+	_domElement.appendChild( _viewport.getDOMElement() );
 
 	var _toolbar = new UI.Toolbar();
 	_domElement.appendChild( _toolbar.getDOMElement() );
@@ -20,7 +20,7 @@ var UI = function () {
 		_domElement.style.width = width + 'px';
 		_domElement.style.height = height + 'px';
 
-		_viewports.setSize( width, height - 50 );
+		_viewport.setSize( width, height - 50 );
 
 		_toolbar.setPosition( 0, height - 50 );
 		_toolbar.setSize( width, 50 );

+ 3 - 34
src/cameras/Camera.js

@@ -15,7 +15,10 @@ THREE.Camera = function () {
 	THREE.Object3D.call( this );
 
 	this.matrixWorldInverse = new THREE.Matrix4();
+
 	this.projectionMatrix = new THREE.Matrix4();
+	this.projectionMatrixInverse = new THREE.Matrix4();
+
 
 };
 
@@ -34,38 +37,4 @@ THREE.Camera.prototype.lookAt = function ( vector ) {
 
 	}
 
-}
-
-THREE.Camera.prototype.update = function ( parentMatrixWorld, forceUpdate, camera ) {
-
-	this.matrixAutoUpdate && this.updateMatrix();
-
-	if ( forceUpdate || this.matrixWorldNeedsUpdate ) {
-
-		if ( parentMatrixWorld ) {
-
-			this.matrixWorld.multiply( parentMatrixWorld, this.matrix );
-
-		} else {
-
-			this.matrixWorld.copy( this.matrix );
-
-		}
-
-		this.matrixWorldNeedsUpdate = false;
-		forceUpdate = true;
-
-		THREE.Matrix4.makeInvert( this.matrixWorld, this.matrixWorldInverse );
-
-	}
-
-
-	// update children
-
-	for ( var i = 0; i < this.children.length; i ++ ) {
-
-		this.children[ i ].update( this.matrixWorld, forceUpdate, camera );
-
-	}
-
 };

+ 112 - 139
src/core/Matrix4.js

@@ -102,60 +102,6 @@ THREE.Matrix4.prototype = {
 
 	},
 
-	multiplyVector3: function ( v ) {
-
-		var vx = v.x, vy = v.y, vz = v.z,
-		d = 1 / ( this.n41 * vx + this.n42 * vy + this.n43 * vz + this.n44 );
-
-		v.x = ( this.n11 * vx + this.n12 * vy + this.n13 * vz + this.n14 ) * d;
-		v.y = ( this.n21 * vx + this.n22 * vy + this.n23 * vz + this.n24 ) * d;
-		v.z = ( this.n31 * vx + this.n32 * vy + this.n33 * vz + this.n34 ) * d;
-
-		return v;
-
-	},
-
-	multiplyVector4: function ( v ) {
-
-		var vx = v.x, vy = v.y, vz = v.z, vw = v.w;
-
-		v.x = this.n11 * vx + this.n12 * vy + this.n13 * vz + this.n14 * vw;
-		v.y = this.n21 * vx + this.n22 * vy + this.n23 * vz + this.n24 * vw;
-		v.z = this.n31 * vx + this.n32 * vy + this.n33 * vz + this.n34 * vw;
-		v.w = this.n41 * vx + this.n42 * vy + this.n43 * vz + this.n44 * vw;
-
-		return v;
-
-	},
-
-	rotateAxis: function ( v ) {
-
-		var vx = v.x, vy = v.y, vz = v.z;
-
-		v.x = vx * this.n11 + vy * this.n12 + vz * this.n13;
-		v.y = vx * this.n21 + vy * this.n22 + vz * this.n23;
-		v.z = vx * this.n31 + vy * this.n32 + vz * this.n33;
-
-		v.normalize();
-
-		return v;
-
-	},
-
-	crossVector: function ( a ) {
-
-		var v = new THREE.Vector4();
-
-		v.x = this.n11 * a.x + this.n12 * a.y + this.n13 * a.z + this.n14 * a.w;
-		v.y = this.n21 * a.x + this.n22 * a.y + this.n23 * a.z + this.n24 * a.w;
-		v.z = this.n31 * a.x + this.n32 * a.y + this.n33 * a.z + this.n34 * a.w;
-
-		v.w = ( a.w ) ? this.n41 * a.x + this.n42 * a.y + this.n43 * a.z + this.n44 * a.w : 1;
-
-		return v;
-
-	},
-
 	multiply: function ( a, b ) {
 
 		var a11 = a.n11, a12 = a.n12, a13 = a.n13, a14 = a.n14,
@@ -192,6 +138,12 @@ THREE.Matrix4.prototype = {
 
 	},
 
+	multiplySelf: function ( m ) {
+
+		return this.multiply( this, m );
+
+	},
+
 	multiplyToArray: function ( a, b, r ) {
 
 		this.multiply( a, b );
@@ -205,14 +157,6 @@ THREE.Matrix4.prototype = {
 
 	},
 
-	multiplySelf: function ( m ) {
-
-		this.multiply( this, m );
-
-		return this;
-
-	},
-
 	multiplyScalar: function ( s ) {
 
 		this.n11 *= s; this.n12 *= s; this.n13 *= s; this.n14 *= s;
@@ -224,6 +168,60 @@ THREE.Matrix4.prototype = {
 
 	},
 
+	multiplyVector3: function ( v ) {
+
+		var vx = v.x, vy = v.y, vz = v.z,
+		d = 1 / ( this.n41 * vx + this.n42 * vy + this.n43 * vz + this.n44 );
+
+		v.x = ( this.n11 * vx + this.n12 * vy + this.n13 * vz + this.n14 ) * d;
+		v.y = ( this.n21 * vx + this.n22 * vy + this.n23 * vz + this.n24 ) * d;
+		v.z = ( this.n31 * vx + this.n32 * vy + this.n33 * vz + this.n34 ) * d;
+
+		return v;
+
+	},
+
+	multiplyVector4: function ( v ) {
+
+		var vx = v.x, vy = v.y, vz = v.z, vw = v.w;
+
+		v.x = this.n11 * vx + this.n12 * vy + this.n13 * vz + this.n14 * vw;
+		v.y = this.n21 * vx + this.n22 * vy + this.n23 * vz + this.n24 * vw;
+		v.z = this.n31 * vx + this.n32 * vy + this.n33 * vz + this.n34 * vw;
+		v.w = this.n41 * vx + this.n42 * vy + this.n43 * vz + this.n44 * vw;
+
+		return v;
+
+	},
+
+	rotateAxis: function ( v ) {
+
+		var vx = v.x, vy = v.y, vz = v.z;
+
+		v.x = vx * this.n11 + vy * this.n12 + vz * this.n13;
+		v.y = vx * this.n21 + vy * this.n22 + vz * this.n23;
+		v.z = vx * this.n31 + vy * this.n32 + vz * this.n33;
+
+		v.normalize();
+
+		return v;
+
+	},
+
+	crossVector: function ( a ) {
+
+		var v = new THREE.Vector4();
+
+		v.x = this.n11 * a.x + this.n12 * a.y + this.n13 * a.z + this.n14 * a.w;
+		v.y = this.n21 * a.x + this.n22 * a.y + this.n23 * a.z + this.n24 * a.w;
+		v.z = this.n31 * a.x + this.n32 * a.y + this.n33 * a.z + this.n34 * a.w;
+
+		v.w = ( a.w ) ? this.n41 * a.x + this.n42 * a.y + this.n43 * a.z + this.n44 * a.w : 1;
+
+		return v;
+
+	},
+
 	determinant: function () {
 
 		var n11 = this.n11, n12 = this.n12, n13 = this.n13, n14 = this.n14,
@@ -448,7 +446,7 @@ THREE.Matrix4.prototype = {
 
 	},
 
-	setPosition: function( v ) {
+	setPosition: function ( v ) {
 
 		this.n14 = v.x;
 		this.n24 = v.y;
@@ -458,58 +456,58 @@ THREE.Matrix4.prototype = {
 
 	},
 
-	getPosition: function() {
+	getPosition: function () {
 
-		if ( ! this.position ) {
-
-			this.position = new THREE.Vector3();
-
-		}
-
-		this.position.set( this.n14, this.n24, this.n34 );
-
-		return this.position;
+		return THREE.Matrix4.__v1.set( this.n14, this.n24, this.n34 );
 
 	},
 
-	getColumnX: function() {
-
-		if ( ! this.columnX ) {
+	getColumnX: function () {
 
-			this.columnX = new THREE.Vector3();
+		return THREE.Matrix4.__v1.set( this.n11, this.n21, this.n31 );
 
-		}
-
-		this.columnX.set( this.n11, this.n21, this.n31 );
-
-		return this.columnX;
 	},
 
-	getColumnY: function() {
+	getColumnY: function () {
 
-		if ( ! this.columnY ) {
+		return THREE.Matrix4.__v1.set( this.n12, this.n22, this.n32 );
 
-			this.columnY = new THREE.Vector3();
-
-		}
+	},
 
-		this.columnY.set( this.n12, this.n22, this.n32 );
+	getColumnZ: function() {
 
-		return this.columnY;
+		return THREE.Matrix4.__v1.set( this.n13, this.n23, this.n33 );
 
 	},
 
-	getColumnZ: function() {
+	getInverse: function ( m ) {
 
-		if ( ! this.columnZ ) {
+		// based on http://www.euclideanspace.com/maths/algebra/matrix/functions/inverse/fourD/index.htm
 
-			this.columnZ = new THREE.Vector3();
+		var n11 = m.n11, n12 = m.n12, n13 = m.n13, n14 = m.n14,
+		n21 = m.n21, n22 = m.n22, n23 = m.n23, n24 = m.n24,
+		n31 = m.n31, n32 = m.n32, n33 = m.n33, n34 = m.n34,
+		n41 = m.n41, n42 = m.n42, n43 = m.n43, n44 = m.n44;
 
-		}
+		this.n11 = n23*n34*n42 - n24*n33*n42 + n24*n32*n43 - n22*n34*n43 - n23*n32*n44 + n22*n33*n44;
+		this.n12 = n14*n33*n42 - n13*n34*n42 - n14*n32*n43 + n12*n34*n43 + n13*n32*n44 - n12*n33*n44;
+		this.n13 = n13*n24*n42 - n14*n23*n42 + n14*n22*n43 - n12*n24*n43 - n13*n22*n44 + n12*n23*n44;
+		this.n14 = n14*n23*n32 - n13*n24*n32 - n14*n22*n33 + n12*n24*n33 + n13*n22*n34 - n12*n23*n34;
+		this.n21 = n24*n33*n41 - n23*n34*n41 - n24*n31*n43 + n21*n34*n43 + n23*n31*n44 - n21*n33*n44;
+		this.n22 = n13*n34*n41 - n14*n33*n41 + n14*n31*n43 - n11*n34*n43 - n13*n31*n44 + n11*n33*n44;
+		this.n23 = n14*n23*n41 - n13*n24*n41 - n14*n21*n43 + n11*n24*n43 + n13*n21*n44 - n11*n23*n44;
+		this.n24 = n13*n24*n31 - n14*n23*n31 + n14*n21*n33 - n11*n24*n33 - n13*n21*n34 + n11*n23*n34;
+		this.n31 = n22*n34*n41 - n24*n32*n41 + n24*n31*n42 - n21*n34*n42 - n22*n31*n44 + n21*n32*n44;
+		this.n32 = n14*n32*n41 - n12*n34*n41 - n14*n31*n42 + n11*n34*n42 + n12*n31*n44 - n11*n32*n44;
+		this.n33 = n13*n24*n41 - n14*n22*n41 + n14*n21*n42 - n11*n24*n42 - n12*n21*n44 + n11*n22*n44;
+		this.n34 = n14*n22*n31 - n12*n24*n31 - n14*n21*n32 + n11*n24*n32 + n12*n21*n34 - n11*n22*n34;
+		this.n41 = n23*n32*n41 - n22*n33*n41 - n23*n31*n42 + n21*n33*n42 + n22*n31*n43 - n21*n32*n43;
+		this.n42 = n12*n33*n41 - n13*n32*n41 + n13*n31*n42 - n11*n33*n42 - n12*n31*n43 + n11*n32*n43;
+		this.n43 = n13*n22*n41 - n12*n23*n41 - n13*n21*n42 + n11*n23*n42 + n12*n21*n43 - n11*n22*n43;
+		this.n44 = n12*n23*n31 - n13*n22*n31 + n13*n21*n32 - n11*n23*n32 - n12*n21*n33 + n11*n22*n33;
+		this.multiplyScalar( 1 / m.determinant() );
 
-		this.columnZ.set( this.n13, this.n23, this.n33 );
-
-		return this.columnZ;
+		return this;
 
 	},
 
@@ -742,58 +740,33 @@ THREE.Matrix4.prototype = {
 		this.n24 = m.n24;
 		this.n34 = m.n34;
 
+		return this;
+
 	},
 
-	extractRotation: function ( m, s ) {
+	extractRotation: function ( m ) {
 
-		var invScaleX = 1 / s.x, invScaleY = 1 / s.y, invScaleZ = 1 / s.z;
+		var vector = THREE.Matrix4.__v1;
 
-		this.n11 = m.n11 * invScaleX;
-		this.n21 = m.n21 * invScaleX;
-		this.n31 = m.n31 * invScaleX;
+		var scaleX = 1 / vector.set( m.n11, m.n21, m.n31 ).length();
+		var scaleY = 1 / vector.set( m.n12, m.n22, m.n32 ).length();
+		var scaleZ = 1 / vector.set( m.n13, m.n23, m.n33 ).length();
 
-		this.n12 = m.n12 * invScaleY;
-		this.n22 = m.n22 * invScaleY;
-		this.n32 = m.n32 * invScaleY;
+		this.n11 = m.n11 * scaleX;
+		this.n21 = m.n21 * scaleX;
+		this.n31 = m.n31 * scaleX;
 
-		this.n13 = m.n13 * invScaleZ;
-		this.n23 = m.n23 * invScaleZ;
-		this.n33 = m.n33 * invScaleZ;
+		this.n12 = m.n12 * scaleY;
+		this.n22 = m.n22 * scaleY;
+		this.n32 = m.n32 * scaleY;
 
-	}
+		this.n13 = m.n13 * scaleZ;
+		this.n23 = m.n23 * scaleZ;
+		this.n33 = m.n33 * scaleZ;
 
-};
+		return this;
 
-THREE.Matrix4.makeInvert = function ( m1, m2 ) {
-
-	// based on http://www.euclideanspace.com/maths/algebra/matrix/functions/inverse/fourD/index.htm
-
-	var n11 = m1.n11, n12 = m1.n12, n13 = m1.n13, n14 = m1.n14,
-	n21 = m1.n21, n22 = m1.n22, n23 = m1.n23, n24 = m1.n24,
-	n31 = m1.n31, n32 = m1.n32, n33 = m1.n33, n34 = m1.n34,
-	n41 = m1.n41, n42 = m1.n42, n43 = m1.n43, n44 = m1.n44;
-
-	if ( m2 === undefined ) m2 = new THREE.Matrix4();
-
-	m2.n11 = n23*n34*n42 - n24*n33*n42 + n24*n32*n43 - n22*n34*n43 - n23*n32*n44 + n22*n33*n44;
-	m2.n12 = n14*n33*n42 - n13*n34*n42 - n14*n32*n43 + n12*n34*n43 + n13*n32*n44 - n12*n33*n44;
-	m2.n13 = n13*n24*n42 - n14*n23*n42 + n14*n22*n43 - n12*n24*n43 - n13*n22*n44 + n12*n23*n44;
-	m2.n14 = n14*n23*n32 - n13*n24*n32 - n14*n22*n33 + n12*n24*n33 + n13*n22*n34 - n12*n23*n34;
-	m2.n21 = n24*n33*n41 - n23*n34*n41 - n24*n31*n43 + n21*n34*n43 + n23*n31*n44 - n21*n33*n44;
-	m2.n22 = n13*n34*n41 - n14*n33*n41 + n14*n31*n43 - n11*n34*n43 - n13*n31*n44 + n11*n33*n44;
-	m2.n23 = n14*n23*n41 - n13*n24*n41 - n14*n21*n43 + n11*n24*n43 + n13*n21*n44 - n11*n23*n44;
-	m2.n24 = n13*n24*n31 - n14*n23*n31 + n14*n21*n33 - n11*n24*n33 - n13*n21*n34 + n11*n23*n34;
-	m2.n31 = n22*n34*n41 - n24*n32*n41 + n24*n31*n42 - n21*n34*n42 - n22*n31*n44 + n21*n32*n44;
-	m2.n32 = n14*n32*n41 - n12*n34*n41 - n14*n31*n42 + n11*n34*n42 + n12*n31*n44 - n11*n32*n44;
-	m2.n33 = n13*n24*n41 - n14*n22*n41 + n14*n21*n42 - n11*n24*n42 - n12*n21*n44 + n11*n22*n44;
-	m2.n34 = n14*n22*n31 - n12*n24*n31 - n14*n21*n32 + n11*n24*n32 + n12*n21*n34 - n11*n22*n34;
-	m2.n41 = n23*n32*n41 - n22*n33*n41 - n23*n31*n42 + n21*n33*n42 + n22*n31*n43 - n21*n32*n43;
-	m2.n42 = n12*n33*n41 - n13*n32*n41 + n13*n31*n42 - n11*n33*n42 - n12*n31*n43 + n11*n32*n43;
-	m2.n43 = n13*n22*n41 - n12*n23*n41 - n13*n21*n42 + n11*n23*n42 + n12*n21*n43 - n11*n22*n43;
-	m2.n44 = n12*n23*n31 - n13*n22*n31 + n13*n21*n32 - n11*n23*n32 - n12*n21*n33 + n11*n22*n33;
-	m2.multiplyScalar( 1 / m1.determinant() );
-
-	return m2;
+	}
 
 };
 

+ 11 - 61
src/core/Object3D.js

@@ -4,7 +4,7 @@
  * @author alteredq / http://alteredqualia.com/
  */
 
-THREE.Object3D = function() {
+THREE.Object3D = function () {
 
 	this.name = '';
 
@@ -101,7 +101,7 @@ THREE.Object3D.prototype = {
 
 		if ( this.children.indexOf( object ) === - 1 ) {
 
-			if( object.parent !== undefined ) {
+			if ( object.parent !== undefined ) {
 
 				object.parent.remove( object );
 
@@ -110,50 +110,18 @@ THREE.Object3D.prototype = {
 			object.parent = this;
 			this.children.push( object );
 
-			// add to scene
-
-			var scene = this;
-
-			while ( scene.parent !== undefined ) {
-
-				scene = scene.parent;
-
-			}
-
-			if ( scene !== undefined && scene instanceof THREE.Scene )  {
-
-				scene.addChildRecurse( object );
-
-			}
-
 		}
 
 	},
 
 	remove: function ( object ) {
 
-		var scene = this;
+		var index = this.children.indexOf( object );
 
-		var childIndex = this.children.indexOf( object );
-
-		if ( childIndex !== - 1 ) {
+		if ( index !== - 1 ) {
 
 			object.parent = undefined;
-			this.children.splice( childIndex, 1 );
-
-			// remove from scene
-
-			while ( scene.parent !== undefined ) {
-
-				scene = scene.parent;
-
-			}
-
-			if ( scene !== undefined && scene instanceof THREE.Scene ) {
-
-				scene.removeChildRecurse( object );
-
-			}
+			this.children.splice( index, 1 );
 
 		}
 
@@ -216,17 +184,17 @@ THREE.Object3D.prototype = {
 
 	},
 
-	update: function ( parentMatrixWorld, forceUpdate, camera ) {
+	updateMatrixWorld: function ( force ) {
 
 		this.matrixAutoUpdate && this.updateMatrix();
 
 		// update matrixWorld
 
-		if ( this.matrixWorldNeedsUpdate || forceUpdate ) {
+		if ( this.matrixWorldNeedsUpdate || force ) {
 
-			if ( parentMatrixWorld ) {
+			if ( this.parent ) {
 
-				this.matrixWorld.multiply( parentMatrixWorld, this.matrix );
+				this.matrixWorld.multiply( this.parent.matrixWorld, this.matrix );
 
 			} else {
 
@@ -234,11 +202,9 @@ THREE.Object3D.prototype = {
 
 			}
 
-			this.matrixRotationWorld.extractRotation( this.matrixWorld, this.scale );
-
 			this.matrixWorldNeedsUpdate = false;
 
-			forceUpdate = true;
+			force = true;
 
 		}
 
@@ -246,26 +212,10 @@ THREE.Object3D.prototype = {
 
 		for ( var i = 0, l = this.children.length; i < l; i ++ ) {
 
-			this.children[ i ].update( this.matrixWorld, forceUpdate, camera );
+			this.children[ i ].updateMatrixWorld( force );
 
 		}
 
-	},
-
-	// DEPRECATED
-
-	addChild: function ( child ) {
-
-		console.warn( 'DEPRECATED: Object3D.addChild() is now Object3D.add().' );
-		this.add( child );
-
-	},
-
-	removeChild: function ( child ) {
-
-		console.warn( 'DEPRECATED: Object3D.removeChild() is now Object3D.remove().' );
-		this.remove( child );
-
 	}
 
 };

+ 53 - 53
src/core/Projector.js

@@ -6,16 +6,16 @@
 
 THREE.Projector = function() {
 
-	var _object, _objectCount, _objectPool = [],
-	_vertex, _vertexCount, _vertexPool = [],
+	var _vertex, _vertexCount, _vertexPool = [],
 	_face, _face3Count, _face3Pool = [], _face4Count, _face4Pool = [],
 	_line, _lineCount, _linePool = [],
 	_particle, _particleCount, _particlePool = [],
 
-	_objectList = [], _renderList = [],
+	_renderData = { objects: [], lights: [], elements: [] },
 
-	_vector3 = new THREE.Vector4(),
+	_vector3 = new THREE.Vector3(),
 	_vector4 = new THREE.Vector4(),
+
 	_projScreenMatrix = new THREE.Matrix4(),
 	_projScreenObjectMatrix = new THREE.Matrix4(),
 
@@ -36,20 +36,24 @@ THREE.Projector = function() {
 
 	this.projectVector = function ( vector, camera ) {
 
+		camera.matrixWorldInverse.getInverse( camera.matrixWorld );
+
 		_projScreenMatrix.multiply( camera.projectionMatrix, camera.matrixWorldInverse );
 		_projScreenMatrix.multiplyVector3( vector );
 
 		return vector;
-		
+
 	};
 
 	this.unprojectVector = function ( vector, camera ) {
 
-		_projScreenMatrix.multiply( camera.matrixWorld, THREE.Matrix4.makeInvert( camera.projectionMatrix ) );
+		camera.projectionMatrixInverse.getInverse( camera.projectionMatrix );
+
+		_projScreenMatrix.multiply( camera.matrixWorld, camera.projectionMatrixInverse );
 		_projScreenMatrix.multiplyVector3( vector );
 
 		return vector;
-		
+
 	};
 
 	/**
@@ -73,77 +77,81 @@ THREE.Projector = function() {
 		end.subSelf( vector ).normalize();
 
 		return new THREE.Ray( vector, end );
-		
+
 	};
 
-	this.projectObjects = function ( scene, camera, sort ) {
+	this.projectGraph = function ( object ) {
 
-		var o, ol, objects, object, matrix;
+		_renderData.objects.length = 0;
+		_renderData.lights.length = 0;
 
-		_objectList.length = 0;
-		_objectCount = 0;
+		var projectObject = function ( object ) {
 
-		objects = scene.objects;
+			if ( object.visible == false ) return;
 
-		for ( o = 0, ol = objects.length; o < ol; o ++ ) {
+			if ( object instanceof THREE.Particle || object instanceof THREE.Line ||
+			( object instanceof THREE.Mesh && ( !object.frustumCulled || isInFrustum( object ) ) ) ) {
 
-			object = objects[ o ];
+				_renderData.objects.push( object );
 
-			if ( !object.visible || ( object instanceof THREE.Mesh && ( object.frustumCulled && !isInFrustum( object ) ) ) ) continue;
+			} else if ( object instanceof THREE.Light ) {
 
-			_object = getNextObjectInPool();
+				_renderData.lights.push( object );
 
-			_vector3.copy( object.position );
-			_projScreenMatrix.multiplyVector3( _vector3 );
+			}
 
-			_object.object = object;
-			_object.z = _vector3.z;
+			for ( var c = 0, cl = object.children.length; c < cl; c ++ ) {
 
-			_objectList.push( _object );
+				projectObject( object.children[ c ] );
 
-		}
+			}
 
-		sort && _objectList.sort( painterSort );
+		};
 
-		return _objectList;
+		projectObject( object );
 
-	};
+		return _renderData;
 
-	// TODO: Rename to projectElements?
+	};
 
 	this.projectScene = function ( scene, camera, sort ) {
 
 		var near = camera.near, far = camera.far,
-		o, ol, v, vl, f, fl, n, nl, c, cl, u, ul, objects, object,
+		o, ol, v, vl, f, fl, n, nl, c, cl, u, ul, object,
 		objectMatrix, objectMatrixRotation, objectMaterials, objectOverdraw,
 		geometry, vertices, vertex, vertexPositionScreen,
 		faces, face, faceVertexNormals, normal, faceVertexUvs, uvs,
 		v1, v2, v3, v4;
 
-		_renderList.length = 0;
-
 		_face3Count = 0;
 		_face4Count = 0;
 		_lineCount = 0;
 		_particleCount = 0;
 
-		camera.matrixAutoUpdate && camera.update( undefined, true );
+		_renderData.elements.length = 0;
+
+		if ( camera.parent == null ) {
 
-		scene.update( undefined, false, camera );
+			console.warn( "Camera is not on the Scene. Adding it..." );
+			scene.add( camera );
+
+		}
+
+		scene.updateMatrixWorld();
+
+		camera.matrixWorldInverse.getInverse( camera.matrixWorld );
 
 		_projScreenMatrix.multiply( camera.projectionMatrix, camera.matrixWorldInverse );
-		computeFrustum( _projScreenMatrix );
 
-		objects = this.projectObjects( scene, camera, true );
+		computeFrustum( _projScreenMatrix );
 
-		for ( o = 0, ol = objects.length; o < ol; o++ ) {
+		_renderData = this.projectGraph( scene );
 
-			object = objects[ o ].object;
+		for ( o = 0, ol = _renderData.objects.length; o < ol; o++ ) {
 
-			if ( !object.visible ) continue;
+			object = _renderData.objects[ o ];
 
 			objectMatrix = object.matrixWorld;
-			objectMatrixRotation = object.matrixRotationWorld;
 
 			objectMaterials = object.materials;
 			objectOverdraw = object.overdraw;
@@ -157,6 +165,8 @@ THREE.Projector = function() {
 				faces = geometry.faces;
 				faceVertexUvs = geometry.faceVertexUvs;
 
+				objectMatrixRotation = object.matrixRotationWorld.extractRotation( object.matrixWorld );
+
 				for ( v = 0, vl = vertices.length; v < vl; v ++ ) {
 
 					_vertex = getNextVertexInPool();
@@ -269,7 +279,7 @@ THREE.Projector = function() {
 
 					_face.z = _face.centroidScreen.z;
 
-					_renderList.push( _face );
+					_renderData.elements.push( _face );
 
 				}
 
@@ -308,7 +318,7 @@ THREE.Projector = function() {
 
 						_line.materials = object.materials;
 
-						_renderList.push( _line );
+						_renderData.elements.push( _line );
 
 					}
 				}
@@ -334,7 +344,7 @@ THREE.Projector = function() {
 
 					_particle.materials = object.materials;
 
-					_renderList.push( _particle );
+					_renderData.elements.push( _particle );
 
 				}
 
@@ -342,24 +352,14 @@ THREE.Projector = function() {
 
 		}
 
-		sort && _renderList.sort( painterSort );
+		sort && _renderData.elements.sort( painterSort );
 
-		return _renderList;
+		return _renderData;
 
 	};
 
 	// Pools
 
-	function getNextObjectInPool() {
-
-		var object = _objectPool[ _objectCount ] = _objectPool[ _objectCount ] || new THREE.RenderableObject();
-
-		_objectCount ++;
-
-		return object;
-
-	}
-
 	function getNextVertexInPool() {
 
 		var vertex = _vertexPool[ _vertexCount ] = _vertexPool[ _vertexCount ] || new THREE.RenderableVertex();

+ 13 - 4
src/core/Quaternion.js

@@ -207,8 +207,17 @@ THREE.Quaternion.prototype = {
 
 THREE.Quaternion.slerp = function ( qa, qb, qm, t ) {
 
+	// http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/slerp/
+
 	var cosHalfTheta = qa.w * qb.w + qa.x * qb.x + qa.y * qb.y + qa.z * qb.z;
 
+	if (cosHalfTheta < 0) {
+		qm.w = -qb.w; qm.x = -qb.x; qm.y = -qb.y; qm.z = -qb.z;
+		cosHalfTheta = -cosHalfTheta;
+	} else {
+		qm.copy(qb);
+	}
+
 	if ( Math.abs( cosHalfTheta ) >= 1.0 ) {
 
 		qm.w = qa.w; qm.x = qa.x; qm.y = qa.y; qm.z = qa.z;
@@ -233,10 +242,10 @@ THREE.Quaternion.slerp = function ( qa, qb, qm, t ) {
 	var ratioA = Math.sin( ( 1 - t ) * halfTheta ) / sinHalfTheta,
 	ratioB = Math.sin( t * halfTheta ) / sinHalfTheta; 
 
-	qm.w = ( qa.w * ratioA + qb.w * ratioB );
-	qm.x = ( qa.x * ratioA + qb.x * ratioB );
-	qm.y = ( qa.y * ratioA + qb.y * ratioB );
-	qm.z = ( qa.z * ratioA + qb.z * ratioB );
+	qm.w = ( qa.w * ratioA + qm.w * ratioB );
+	qm.x = ( qa.x * ratioA + qm.x * ratioB );
+	qm.y = ( qa.y * ratioA + qm.y * ratioB );
+	qm.z = ( qa.z * ratioA + qm.z * ratioB );
 
 	return qm;
 

+ 3 - 1
src/core/Ray.js

@@ -15,7 +15,7 @@ THREE.Ray.prototype = {
 
 	intersectScene: function ( scene ) {
 
-		return this.intersectObjects( scene.objects );
+		return this.intersectObjects( scene.children );
 
 	},
 
@@ -90,6 +90,8 @@ THREE.Ray.prototype = {
 			objMatrix,
 			intersectPoint;
 
+			object.matrixRotationWorld.extractRotation( object.matrixWorld );
+
 			for ( f = 0, fl = geometry.faces.length; f < fl; f ++ ) {
 
 				face = geometry.faces[ f ];

+ 82 - 80
src/extras/controls/TrackballControls.js

@@ -4,12 +4,16 @@
 
 THREE.TrackballControls = function ( object, domElement ) {
 
-	this.object = object;
+	var _this = this,
+	STATE = { NONE : -1, ROTATE : 0, ZOOM : 1, PAN : 2 };
 
+	this.object = object;
 	this.domElement = ( domElement !== undefined ) ? domElement : document;
 
 	// API
 
+	this.enabled = true;
+
 	this.screen = { width: window.innerWidth, height: window.innerHeight, offsetLeft: 0, offsetTop: 0 };
 	this.radius = ( this.screen.width + this.screen.height ) / 4;
 
@@ -33,7 +37,7 @@ THREE.TrackballControls = function ( object, domElement ) {
 	this.target = new THREE.Vector3( 0, 0, 0 );
 
 	var _keyPressed = false,
-	_state = this.STATE.NONE,
+	_state = STATE.NONE,
 
 	_eye = new THREE.Vector3(),
 
@@ -62,8 +66,8 @@ THREE.TrackballControls = function ( object, domElement ) {
 	this.getMouseOnScreen = function( clientX, clientY ) {
 
 		return new THREE.Vector2(
-			( clientX - this.screen.offsetLeft ) / this.radius * 0.5,
-			( clientY - this.screen.offsetTop ) / this.radius * 0.5
+			( clientX - _this.screen.offsetLeft ) / _this.radius * 0.5,
+			( clientY - _this.screen.offsetTop ) / _this.radius * 0.5
 		);
 
 	};
@@ -71,8 +75,8 @@ THREE.TrackballControls = function ( object, domElement ) {
 	this.getMouseProjectionOnBall = function( clientX, clientY ) {
 
 		var mouseOnBall = new THREE.Vector3(
-			( clientX - this.screen.width * 0.5 - this.screen.offsetLeft ) / this.radius,
-			( this.screen.height * 0.5 + this.screen.offsetTop - clientY ) / this.radius,
+			( clientX - _this.screen.width * 0.5 - _this.screen.offsetLeft ) / _this.radius,
+			( _this.screen.height * 0.5 + _this.screen.offsetTop - clientY ) / _this.radius,
 			0.0
 		);
 
@@ -88,10 +92,10 @@ THREE.TrackballControls = function ( object, domElement ) {
 
 		}
 
-		_eye.copy( this.object.position ).subSelf( this.target );
+		_eye.copy( _this.object.position ).subSelf( _this.target );
 
-		var projection = this.object.up.clone().setLength( mouseOnBall.y );
-		projection.addSelf( this.object.up.clone().crossSelf( _eye ).setLength( mouseOnBall.x ) );
+		var projection = _this.object.up.clone().setLength( mouseOnBall.y );
+		projection.addSelf( _this.object.up.clone().crossSelf( _eye ).setLength( mouseOnBall.x ) );
 		projection.addSelf( _eye.setLength( mouseOnBall.z ) );
 
 		return projection;
@@ -107,22 +111,22 @@ THREE.TrackballControls = function ( object, domElement ) {
 			var axis = ( new THREE.Vector3() ).cross( _rotateStart, _rotateEnd ).normalize(),
 				quaternion = new THREE.Quaternion();
 
-			angle *= this.rotateSpeed;
+			angle *= _this.rotateSpeed;
 
 			quaternion.setFromAxisAngle( axis, -angle );
 
 			quaternion.multiplyVector3( _eye );
-			quaternion.multiplyVector3( this.object.up );
+			quaternion.multiplyVector3( _this.object.up );
 
 			quaternion.multiplyVector3( _rotateEnd );
 
-			if ( this.staticMoving ) {
+			if ( _this.staticMoving ) {
 
 				_rotateStart = _rotateEnd;
 
 			} else {
 
-				quaternion.setFromAxisAngle( axis, angle * ( this.dynamicDampingFactor - 1.0 ) );
+				quaternion.setFromAxisAngle( axis, angle * ( _this.dynamicDampingFactor - 1.0 ) );
 				quaternion.multiplyVector3( _rotateStart );
 
 			}
@@ -133,13 +137,13 @@ THREE.TrackballControls = function ( object, domElement ) {
 
 	this.zoomCamera = function() {
 
-		var factor = 1.0 + ( _zoomEnd.y - _zoomStart.y ) * this.zoomSpeed;
+		var factor = 1.0 + ( _zoomEnd.y - _zoomStart.y ) * _this.zoomSpeed;
 
 		if ( factor !== 1.0 && factor > 0.0 ) {
 
 			_eye.multiplyScalar( factor );
 
-			if ( this.staticMoving ) {
+			if ( _this.staticMoving ) {
 
 				_zoomStart = _zoomEnd;
 
@@ -159,21 +163,21 @@ THREE.TrackballControls = function ( object, domElement ) {
 
 		if ( mouseChange.lengthSq() ) {
 
-			mouseChange.multiplyScalar( _eye.length() * this.panSpeed );
+			mouseChange.multiplyScalar( _eye.length() * _this.panSpeed );
 
-			var pan = _eye.clone().crossSelf( this.object.up ).setLength( mouseChange.x );
-			pan.addSelf( this.object.up.clone().setLength( mouseChange.y ) );
+			var pan = _eye.clone().crossSelf( _this.object.up ).setLength( mouseChange.x );
+			pan.addSelf( _this.object.up.clone().setLength( mouseChange.y ) );
 
-			this.object.position.addSelf( pan );
-			this.target.addSelf( pan );
+			_this.object.position.addSelf( pan );
+			_this.target.addSelf( pan );
 
-			if ( this.staticMoving ) {
+			if ( _this.staticMoving ) {
 
 				_panStart = _panEnd;
 
 			} else {
 
-				_panStart.addSelf( mouseChange.sub( _panEnd, _panStart ).multiplyScalar( this.dynamicDampingFactor ) );
+				_panStart.addSelf( mouseChange.sub( _panEnd, _panStart ).multiplyScalar( _this.dynamicDampingFactor ) );
 
 			}
 
@@ -183,17 +187,17 @@ THREE.TrackballControls = function ( object, domElement ) {
 
 	this.checkDistances = function() {
 
-		if ( !this.noZoom || !this.noPan ) {
+		if ( !_this.noZoom || !_this.noPan ) {
 
-			if ( this.object.position.lengthSq() > this.maxDistance * this.maxDistance ) {
+			if ( _this.object.position.lengthSq() > _this.maxDistance * _this.maxDistance ) {
 
-				this.object.position.setLength( this.maxDistance );
+				_this.object.position.setLength( _this.maxDistance );
 
 			}
 
-			if ( _eye.lengthSq() < this.minDistance * this.minDistance ) {
+			if ( _eye.lengthSq() < _this.minDistance * _this.minDistance ) {
 
-				this.object.position.add( this.target, _eye.setLength( this.minDistance ) );
+				_this.object.position.add( _this.target, _eye.setLength( _this.minDistance ) );
 
 			}
 
@@ -203,27 +207,27 @@ THREE.TrackballControls = function ( object, domElement ) {
 
 	this.update = function() {
 
-		_eye.copy( this.object.position ).subSelf( this.target );
+		_eye.copy( _this.object.position ).subSelf( this.target );
 
-		this.rotateCamera();
+		_this.rotateCamera();
 
-		if ( !this.noZoom ) {
+		if ( !_this.noZoom ) {
 
-			this.zoomCamera();
+			_this.zoomCamera();
 
 		}
 
-		if ( !this.noPan ) {
+		if ( !_this.noPan ) {
 
-			this.panCamera();
+			_this.panCamera();
 
 		}
 
-		this.object.position.add( this.target, _eye );
+		_this.object.position.add( _this.target, _eye );
 
-		this.checkDistances();
+		_this.checkDistances();
 
-		this.object.lookAt( this.target );
+		_this.object.lookAt( _this.target );
 
 	};
 
@@ -232,25 +236,27 @@ THREE.TrackballControls = function ( object, domElement ) {
 
 	function keydown( event ) {
 
-		if ( _state !== this.STATE.NONE ) {
+		if ( ! _this.enabled ) return;
+
+		if ( _state !== STATE.NONE ) {
 
 			return;
 
-		} else if ( event.keyCode === this.keys[ this.STATE.ROTATE ] ) {
+		} else if ( event.keyCode === _this.keys[ STATE.ROTATE ] ) {
 
-			_state = this.STATE.ROTATE;
+			_state = STATE.ROTATE;
 
-		} else if ( event.keyCode === this.keys[ this.STATE.ZOOM ] && !this.noZoom ) {
+		} else if ( event.keyCode === _this.keys[ STATE.ZOOM ] && !_this.noZoom ) {
 
-			_state = this.STATE.ZOOM;
+			_state = STATE.ZOOM;
 
-		} else if ( event.keyCode === this.keys[ this.STATE.PAN ] && !this.noPan ) {
+		} else if ( event.keyCode === _this.keys[ STATE.PAN ] && !_this.noPan ) {
 
-			_state = this.STATE.PAN;
+			_state = STATE.PAN;
 
 		}
 
-		if ( _state !== this.STATE.NONE ) {
+		if ( _state !== STATE.NONE ) {
 
 			_keyPressed = true;
 
@@ -260,9 +266,11 @@ THREE.TrackballControls = function ( object, domElement ) {
 
 	function keyup( event ) {
 
-		if ( _state !== this.STATE.NONE ) {
+		if ( ! _this.enabled ) return;
 
-			_state = this.STATE.NONE;
+		if ( _state !== STATE.NONE ) {
+
+			_state = STATE.NONE;
 
 		}
 
@@ -270,24 +278,26 @@ THREE.TrackballControls = function ( object, domElement ) {
 
 	function mousedown( event ) {
 
+		if ( ! _this.enabled ) return;
+
 		event.preventDefault();
 		event.stopPropagation();
 
-		if ( _state === this.STATE.NONE ) {
+		if ( _state === STATE.NONE ) {
 
 			_state = event.button;
 
-			if ( _state === this.STATE.ROTATE ) {
+			if ( _state === STATE.ROTATE ) {
 
-				_rotateStart = _rotateEnd = this.getMouseProjectionOnBall( event.clientX, event.clientY );
+				_rotateStart = _rotateEnd = _this.getMouseProjectionOnBall( event.clientX, event.clientY );
 
-			} else if ( _state === this.STATE.ZOOM && !this.noZoom ) {
+			} else if ( _state === STATE.ZOOM && !_this.noZoom ) {
 
-				_zoomStart = _zoomEnd = this.getMouseOnScreen( event.clientX, event.clientY );
+				_zoomStart = _zoomEnd = _this.getMouseOnScreen( event.clientX, event.clientY );
 
 			} else if ( !this.noPan ) {
 
-				_panStart = _panEnd = this.getMouseOnScreen( event.clientX, event.clientY );
+				_panStart = _panEnd = _this.getMouseOnScreen( event.clientX, event.clientY );
 
 			}
 
@@ -297,31 +307,33 @@ THREE.TrackballControls = function ( object, domElement ) {
 
 	function mousemove( event ) {
 
+		if ( ! _this.enabled ) return;
+
 		if ( _keyPressed ) {
 
-			_rotateStart = _rotateEnd = this.getMouseProjectionOnBall( event.clientX, event.clientY );
-			_zoomStart = _zoomEnd = this.getMouseOnScreen( event.clientX, event.clientY );
-			_panStart = _panEnd = this.getMouseOnScreen( event.clientX, event.clientY );
+			_rotateStart = _rotateEnd = _this.getMouseProjectionOnBall( event.clientX, event.clientY );
+			_zoomStart = _zoomEnd = _this.getMouseOnScreen( event.clientX, event.clientY );
+			_panStart = _panEnd = _this.getMouseOnScreen( event.clientX, event.clientY );
 
 			_keyPressed = false;
 
 		}
 
-		if ( _state === this.STATE.NONE ) {
+		if ( _state === STATE.NONE ) {
 
 			return;
 
-		} else if ( _state === this.STATE.ROTATE ) {
+		} else if ( _state === STATE.ROTATE ) {
 
-			_rotateEnd = this.getMouseProjectionOnBall( event.clientX, event.clientY );
+			_rotateEnd = _this.getMouseProjectionOnBall( event.clientX, event.clientY );
 
-		} else if ( _state === this.STATE.ZOOM && !this.noZoom ) {
+		} else if ( _state === STATE.ZOOM && !_this.noZoom ) {
 
-			_zoomEnd = this.getMouseOnScreen( event.clientX, event.clientY );
+			_zoomEnd = _this.getMouseOnScreen( event.clientX, event.clientY );
 
-		} else if ( _state === this.STATE.PAN && !this.noPan ) {
+		} else if ( _state === STATE.PAN && !_this.noPan ) {
 
-			_panEnd = this.getMouseOnScreen( event.clientX, event.clientY );
+			_panEnd = _this.getMouseOnScreen( event.clientX, event.clientY );
 
 		}
 
@@ -329,32 +341,22 @@ THREE.TrackballControls = function ( object, domElement ) {
 
 	function mouseup( event ) {
 
+		if ( ! _this.enabled ) return;
+
 		event.preventDefault();
 		event.stopPropagation();
 
-		_state = this.STATE.NONE;
-
-	};
-
-	function bind( scope, fn ) {
-
-		return function () {
-
-			fn.apply( scope, arguments );
-
-		};
+		_state = STATE.NONE;
 
 	};
 
 	this.domElement.addEventListener( 'contextmenu', function ( event ) { event.preventDefault(); }, false );
 
-	this.domElement.addEventListener( 'mousemove', bind( this, mousemove ), false );
-	this.domElement.addEventListener( 'mousedown', bind( this, mousedown ), false );
-	this.domElement.addEventListener( 'mouseup',   bind( this, mouseup ), false );
+	this.domElement.addEventListener( 'mousemove', mousemove, false );
+	this.domElement.addEventListener( 'mousedown', mousedown, false );
+	this.domElement.addEventListener( 'mouseup', mouseup, false );
 
-	window.addEventListener( 'keydown', bind( this, keydown ), false );
-	window.addEventListener( 'keyup',   bind( this, keyup ), false );
+	window.addEventListener( 'keydown', keydown, false );
+	window.addEventListener( 'keyup', keyup, false );
 
 };
-
-THREE.TrackballControls.prototype.STATE = { NONE : -1, ROTATE : 0, ZOOM : 1, PAN : 2 };

+ 1 - 1
src/extras/geometries/OctahedronGeometry.js

@@ -13,7 +13,7 @@ THREE.OctahedronGeometry = function ( radius, detail ) {
 
 	THREE.Geometry.call( this );
 
-	detail = isFinite(detail) ? detail : 3; // allow a zero value
+	detail = detail || 0;
 
 	var that = this; // ugly scope hack
 

+ 5 - 5
src/extras/loaders/ColladaLoader.js

@@ -517,10 +517,6 @@ THREE.ColladaLoader = function () {
 		var morphController;
 		var i;
 
-		obj.name = node.id || "";
-		obj.matrixAutoUpdate = false;
-		obj.matrix = node.matrix;
-
 		// FIXME: controllers
 
 		for ( i = 0; i < node.controllers.length; i ++ ) {
@@ -676,15 +672,19 @@ THREE.ColladaLoader = function () {
 				} else {
 
 					mesh = new THREE.Mesh( geom, material );
+					// mesh.geom.name = geometry.id;
 
 				}
 
-				obj.add( mesh );
+				node.geometries.length > 1 ? obj.add( mesh ) : obj = mesh;
 
 			}
 
 		}
 
+		obj.name = node.id || "";
+		node.matrix.decompose( obj.position, obj.rotation, obj.scale );
+
 		for ( i = 0; i < node.nodes.length; i ++ ) {
 
 			obj.add( createSceneGraph( node.nodes[i], node ) );

+ 3 - 0
src/extras/loaders/SceneLoader.js

@@ -760,6 +760,9 @@ THREE.SceneLoader.prototype = {
 
 			scope.callbackSync( result );
 
+			// just in case there are no async elements:
+			async_callback_gate();
+
 		};
 
 	},

+ 48 - 45
src/renderers/CanvasRenderer.js

@@ -5,7 +5,7 @@
 THREE.CanvasRenderer = function ( parameters ) {
 
 	var _this = this,
-	_renderList = null,
+	_renderData, _elements, _lights,
 	_projector = new THREE.Projector(),
 
 	parameters = parameters || {},
@@ -33,11 +33,11 @@ THREE.CanvasRenderer = function ( parameters ) {
 	_v1x, _v1y, _v2x, _v2y, _v3x, _v3y,
 	_v4x, _v4y, _v5x, _v5y, _v6x, _v6y,
 
-	_color = new THREE.Color( 0x000000 ),
-	_color1 = new THREE.Color( 0x000000 ),
-	_color2 = new THREE.Color( 0x000000 ),
-	_color3 = new THREE.Color( 0x000000 ),
-	_color4 = new THREE.Color( 0x000000 ),
+	_color = new THREE.Color(),
+	_color1 = new THREE.Color(),
+	_color2 = new THREE.Color(),
+	_color3 = new THREE.Color(),
+	_color4 = new THREE.Color(),
 
 	_patterns = [],
 
@@ -51,7 +51,6 @@ THREE.CanvasRenderer = function ( parameters ) {
 	_bboxRect = new THREE.Rectangle(),
 
 	_enableLighting = false,
-	_light = new THREE.Color(),
 	_ambientLight = new THREE.Color(),
 	_directionalLights = new THREE.Color(),
 	_pointLights = new THREE.Color(),
@@ -181,24 +180,26 @@ THREE.CanvasRenderer = function ( parameters ) {
 		_this.info.render.vertices = 0;
 		_this.info.render.faces = 0;
 
-		_renderList = _projector.projectScene( scene, camera, this.sortElements );
+		_renderData = _projector.projectScene( scene, camera, this.sortElements );
+		_elements = _renderData.elements;
+		_lights = _renderData.lights;
 
 		/* DEBUG
 		_context.fillStyle = 'rgba( 0, 255, 255, 0.5 )';
 		_context.fillRect( _clipRect.getX(), _clipRect.getY(), _clipRect.getWidth(), _clipRect.getHeight() );
 		*/
 
-		_enableLighting = scene.lights.length > 0;
+		_enableLighting = _lights.length > 0;
 
 		if ( _enableLighting ) {
 
-			 calculateLights( scene );
+			 calculateLights( _lights );
 
 		}
 
-		for ( e = 0, el = _renderList.length; e < el; e++ ) {
+		for ( e = 0, el = _elements.length; e < el; e++ ) {
 
-			element = _renderList[ e ];
+			element = _elements[ e ];
 
 			_bboxRect.empty();
 
@@ -369,10 +370,9 @@ THREE.CanvasRenderer = function ( parameters ) {
 
 		//
 
-		function calculateLights( scene ) {
+		function calculateLights( lights ) {
 
-			var l, ll, light, lightColor,
-			lights = scene.lights;
+			var l, ll, light, lightColor;
 
 			_ambientLight.setRGB( 0, 0, 0 );
 			_directionalLights.setRGB( 0, 0, 0 );
@@ -411,10 +411,9 @@ THREE.CanvasRenderer = function ( parameters ) {
 
 		}
 
-		function calculateLight( scene, position, normal, color ) {
+		function calculateLight( lights, position, normal, color ) {
 
-			var l, ll, light, lightColor,
-			amount, lights = scene.lights;
+			var l, ll, light, lightColor, lightPosition, amount;
 
 			for ( l = 0, ll = lights.length; l < ll; l ++ ) {
 
@@ -423,7 +422,9 @@ THREE.CanvasRenderer = function ( parameters ) {
 
 				if ( light instanceof THREE.DirectionalLight ) {
 
-					amount = normal.dot( light.position );
+					lightPosition = light.matrixWorld.getPosition();
+
+					amount = normal.dot( lightPosition );
 
 					if ( amount <= 0 ) continue;
 
@@ -435,11 +436,13 @@ THREE.CanvasRenderer = function ( parameters ) {
 
 				} else if ( light instanceof THREE.PointLight ) {
 
-					amount = normal.dot( _vector3.sub( light.position, position ).normalize() );
+					lightPosition = light.matrixWorld.getPosition();
+
+					amount = normal.dot( _vector3.sub( lightPosition, position ).normalize() );
 
 					if ( amount <= 0 ) continue;
 
-					amount *= light.distance == 0 ? 1 : 1 - Math.min( position.distanceTo( light.position ) / light.distance, 1 );
+					amount *= light.distance == 0 ? 1 : 1 - Math.min( position.distanceTo( lightPosition ) / light.distance, 1 );
 
 					if ( amount == 0 ) continue;
 
@@ -595,15 +598,15 @@ THREE.CanvasRenderer = function ( parameters ) {
 
 						var cameraMatrix = camera.matrixWorldInverse;
 
-						_vector3.copy( element.vertexNormalsWorld[ 0 ] );
+						_vector3.copy( element.vertexNormalsWorld[ uv1 ] );
 						_uv1x = ( _vector3.x * cameraMatrix.n11 + _vector3.y * cameraMatrix.n12 + _vector3.z * cameraMatrix.n13 ) * 0.5 + 0.5;
 						_uv1y = - ( _vector3.x * cameraMatrix.n21 + _vector3.y * cameraMatrix.n22 + _vector3.z * cameraMatrix.n23 ) * 0.5 + 0.5;
 
-						_vector3.copy( element.vertexNormalsWorld[ 1 ] );
+						_vector3.copy( element.vertexNormalsWorld[ uv2 ] );
 						_uv2x = ( _vector3.x * cameraMatrix.n11 + _vector3.y * cameraMatrix.n12 + _vector3.z * cameraMatrix.n13 ) * 0.5 + 0.5;
 						_uv2y = - ( _vector3.x * cameraMatrix.n21 + _vector3.y * cameraMatrix.n22 + _vector3.z * cameraMatrix.n23 ) * 0.5 + 0.5;
 
-						_vector3.copy( element.vertexNormalsWorld[ 2 ] );
+						_vector3.copy( element.vertexNormalsWorld[ uv3 ] );
 						_uv3x = ( _vector3.x * cameraMatrix.n11 + _vector3.y * cameraMatrix.n12 + _vector3.z * cameraMatrix.n13 ) * 0.5 + 0.5;
 						_uv3y = - ( _vector3.x * cameraMatrix.n21 + _vector3.y * cameraMatrix.n22 + _vector3.z * cameraMatrix.n23 ) * 0.5 + 0.5;
 
@@ -645,9 +648,9 @@ THREE.CanvasRenderer = function ( parameters ) {
 						_color1.g = _color2.g = _color3.g = _ambientLight.g;
 						_color1.b = _color2.b = _color3.b = _ambientLight.b;
 
-						calculateLight( scene, element.v1.positionWorld, element.vertexNormalsWorld[ 0 ], _color1 );
-						calculateLight( scene, element.v2.positionWorld, element.vertexNormalsWorld[ 1 ], _color2 );
-						calculateLight( scene, element.v3.positionWorld, element.vertexNormalsWorld[ 2 ], _color3 );
+						calculateLight( _lights, element.v1.positionWorld, element.vertexNormalsWorld[ 0 ], _color1 );
+						calculateLight( _lights, element.v2.positionWorld, element.vertexNormalsWorld[ 1 ], _color2 );
+						calculateLight( _lights, element.v3.positionWorld, element.vertexNormalsWorld[ 2 ], _color3 );
 
 						_color1.r = Math.max( 0, Math.min( material.color.r * _color1.r, 1 ) );
 						_color1.g = Math.max( 0, Math.min( material.color.g * _color1.g, 1 ) );
@@ -671,15 +674,15 @@ THREE.CanvasRenderer = function ( parameters ) {
 
 					} else {
 
-						_light.r = _ambientLight.r;
-						_light.g = _ambientLight.g;
-						_light.b = _ambientLight.b;
+						_color.r = _ambientLight.r;
+						_color.g = _ambientLight.g;
+						_color.b = _ambientLight.b;
 
-						calculateLight( scene, element.centroidWorld, element.normalWorld, _light );
+						calculateLight( _lights, element.centroidWorld, element.normalWorld, _color );
 
-						_color.r = Math.max( 0, Math.min( material.color.r * _light.r, 1 ) );
-						_color.g = Math.max( 0, Math.min( material.color.g * _light.g, 1 ) );
-						_color.b = Math.max( 0, Math.min( material.color.b * _light.b, 1 ) );
+						_color.r = Math.max( 0, Math.min( material.color.r * _color.r, 1 ) );
+						_color.g = Math.max( 0, Math.min( material.color.g * _color.g, 1 ) );
+						_color.b = Math.max( 0, Math.min( material.color.b * _color.b, 1 ) );
 
 						material.wireframe ? strokePath( _color, material.wireframeLinewidth, material.wireframeLinecap, material.wireframeLinejoin ) : fillPath( _color );
 
@@ -762,10 +765,10 @@ THREE.CanvasRenderer = function ( parameters ) {
 						_color1.g = _color2.g = _color3.g = _color4.g = _ambientLight.g;
 						_color1.b = _color2.b = _color3.b = _color4.b = _ambientLight.b;
 
-						calculateLight( scene, element.v1.positionWorld, element.vertexNormalsWorld[ 0 ], _color1 );
-						calculateLight( scene, element.v2.positionWorld, element.vertexNormalsWorld[ 1 ], _color2 );
-						calculateLight( scene, element.v4.positionWorld, element.vertexNormalsWorld[ 3 ], _color3 );
-						calculateLight( scene, element.v3.positionWorld, element.vertexNormalsWorld[ 2 ], _color4 );
+						calculateLight( _lights, element.v1.positionWorld, element.vertexNormalsWorld[ 0 ], _color1 );
+						calculateLight( _lights, element.v2.positionWorld, element.vertexNormalsWorld[ 1 ], _color2 );
+						calculateLight( _lights, element.v4.positionWorld, element.vertexNormalsWorld[ 3 ], _color3 );
+						calculateLight( _lights, element.v3.positionWorld, element.vertexNormalsWorld[ 2 ], _color4 );
 
 						_color1.r = Math.max( 0, Math.min( material.color.r * _color1.r, 1 ) );
 						_color1.g = Math.max( 0, Math.min( material.color.g * _color1.g, 1 ) );
@@ -795,15 +798,15 @@ THREE.CanvasRenderer = function ( parameters ) {
 
 					} else {
 
-						_light.r = _ambientLight.r;
-						_light.g = _ambientLight.g;
-						_light.b = _ambientLight.b;
+						_color.r = _ambientLight.r;
+						_color.g = _ambientLight.g;
+						_color.b = _ambientLight.b;
 
-						calculateLight( scene, element.centroidWorld, element.normalWorld, _light );
+						calculateLight( _lights, element.centroidWorld, element.normalWorld, _color );
 
-						_color.r = Math.max( 0, Math.min( material.color.r * _light.r, 1 ) );
-						_color.g = Math.max( 0, Math.min( material.color.g * _light.g, 1 ) );
-						_color.b = Math.max( 0, Math.min( material.color.b * _light.b, 1 ) );
+						_color.r = Math.max( 0, Math.min( material.color.r * _color.r, 1 ) );
+						_color.g = Math.max( 0, Math.min( material.color.g * _color.g, 1 ) );
+						_color.b = Math.max( 0, Math.min( material.color.b * _color.b, 1 ) );
 
 						drawQuad( _v1x, _v1y, _v2x, _v2y, _v3x, _v3y, _v4x, _v4y );
 

+ 0 - 499
src/renderers/Projector.js

@@ -1,499 +0,0 @@
-/**
- * @author mr.doob / http://mrdoob.com/
- * @author supereggbert / http://www.paulbrunt.co.uk/
- * @author julianwa / https://github.com/julianwa
- */
-
-THREE.Projector = function() {
-
-	var _object, _objectCount, _objectPool = [],
-	_vertex, _vertexCount, _vertexPool = [],
-	_face, _face3Count, _face3Pool = [], _face4Count, _face4Pool = [],
-	_line, _lineCount, _linePool = [],
-	_particle, _particleCount, _particlePool = [],
-
-	_objectList = [], _renderList = [],
-
-	_vector3 = new THREE.Vector4(),
-	_vector4 = new THREE.Vector4(),
-	_projScreenMatrix = new THREE.Matrix4(),
-	_projScreenObjectMatrix = new THREE.Matrix4(),
-
-	_frustum = [
-		new THREE.Vector4(),
-		new THREE.Vector4(),
-		new THREE.Vector4(),
-		new THREE.Vector4(),
-		new THREE.Vector4(),
-		new THREE.Vector4()
-	 ],
-
-	_clippedVertex1PositionScreen = new THREE.Vector4(),
-	_clippedVertex2PositionScreen = new THREE.Vector4(),
-
-	_face3VertexNormals;
-
-
-	this.projectVector = function ( vector, camera ) {
-
-		_projScreenMatrix.multiply( camera.projectionMatrix, camera.matrixWorldInverse );
-		_projScreenMatrix.multiplyVector3( vector );
-
-		return vector;
-
-	};
-
-	this.unprojectVector = function ( vector, camera ) {
-
-		_projScreenMatrix.multiply( camera.matrixWorld, THREE.Matrix4.makeInvert( camera.projectionMatrix ) );
-		_projScreenMatrix.multiplyVector3( vector );
-
-		return vector;
-
-	};
-
-	this.projectObjects = function ( scene, camera, sort ) {
-
-		var o, ol, objects, object, matrix;
-
-		_objectList.length = 0;
-		_objectCount = 0;
-
-		objects = scene.objects;
-
-		for ( o = 0, ol = objects.length; o < ol; o ++ ) {
-
-			object = objects[ o ];
-
-			if ( !object.visible || ( object instanceof THREE.Mesh && !( object.frustumCulled && isInFrustum( object ) ) ) ) continue;
-
-			_object = getNextObjectInPool();
-
-			_vector3.copy( object.position );
-			_projScreenMatrix.multiplyVector3( _vector3 );
-
-			_object.object = object;
-			_object.z = _vector3.z;
-
-			_objectList.push( _object );
-
-		}
-
-		sort && _objectList.sort( painterSort );
-
-		return _objectList;
-
-	};
-
-	// TODO: Rename to projectElements?
-
-	this.projectScene = function ( scene, camera, sort ) {
-
-		var near = camera.near, far = camera.far,
-		o, ol, v, vl, f, fl, n, nl, c, cl, u, ul, objects, object,
-		objectMatrix, objectMatrixRotation, objectMaterials, objectOverdraw,
-		geometry, vertices, vertex, vertexPositionScreen,
-		faces, face, faceVertexNormals, normal, faceVertexUvs, uvs,
-		v1, v2, v3, v4;
-
-		_renderList.length = 0;
-
-		_face3Count = 0;
-		_face4Count = 0;
-		_lineCount = 0;
-		_particleCount = 0;
-
-		camera.matrixAutoUpdate && camera.update( undefined, true );
-
-		scene.update( undefined, false, camera );
-
-		_projScreenMatrix.multiply( camera.projectionMatrix, camera.matrixWorldInverse );
-		computeFrustum( _projScreenMatrix );
-
-		objects = this.projectObjects( scene, camera, true );
-
-		for ( o = 0, ol = objects.length; o < ol; o++ ) {
-
-			object = objects[ o ].object;
-
-			if ( !object.visible ) continue;
-
-			objectMatrix = object.matrixWorld;
-			objectMatrixRotation = object.matrixRotationWorld;
-
-			objectMaterials = object.materials;
-			objectOverdraw = object.overdraw;
-
-			_vertexCount = 0;
-
-			if ( object instanceof THREE.Mesh ) {
-
-				geometry = object.geometry;
-				vertices = geometry.vertices;
-				faces = geometry.faces;
-				faceVertexUvs = geometry.faceVertexUvs;
-
-				for ( v = 0, vl = vertices.length; v < vl; v ++ ) {
-
-					_vertex = getNextVertexInPool();
-					_vertex.positionWorld.copy( vertices[ v ].position );
-
-					objectMatrix.multiplyVector3( _vertex.positionWorld );
-
-					_vertex.positionScreen.copy( _vertex.positionWorld );
-					_projScreenMatrix.multiplyVector4( _vertex.positionScreen );
-
-					_vertex.positionScreen.x /= _vertex.positionScreen.w;
-					_vertex.positionScreen.y /= _vertex.positionScreen.w;
-
-					_vertex.visible = _vertex.positionScreen.z > near && _vertex.positionScreen.z < far;
-
-				}
-
-				for ( f = 0, fl = faces.length; f < fl; f ++ ) {
-
-					face = faces[ f ];
-
-					if ( face instanceof THREE.Face3 ) {
-
-						v1 = _vertexPool[ face.a ];
-						v2 = _vertexPool[ face.b ];
-						v3 = _vertexPool[ face.c ];
-
-						if ( v1.visible && v2.visible && v3.visible &&
-							( object.doubleSided || ( object.flipSided !=
-							( v3.positionScreen.x - v1.positionScreen.x ) * ( v2.positionScreen.y - v1.positionScreen.y ) -
-							( v3.positionScreen.y - v1.positionScreen.y ) * ( v2.positionScreen.x - v1.positionScreen.x ) < 0 ) ) ) {
-
-							_face = getNextFace3InPool();
-
-							_face.v1.copy( v1 );
-							_face.v2.copy( v2 );
-							_face.v3.copy( v3 );
-
-						} else {
-
-							continue;
-
-						}
-
-					} else if ( face instanceof THREE.Face4 ) {
-
-						v1 = _vertexPool[ face.a ];
-						v2 = _vertexPool[ face.b ];
-						v3 = _vertexPool[ face.c ];
-						v4 = _vertexPool[ face.d ];
-
-						if ( v1.visible && v2.visible && v3.visible && v4.visible &&
-							( object.doubleSided || ( object.flipSided !=
-							( ( v4.positionScreen.x - v1.positionScreen.x ) * ( v2.positionScreen.y - v1.positionScreen.y ) -
-							( v4.positionScreen.y - v1.positionScreen.y ) * ( v2.positionScreen.x - v1.positionScreen.x ) < 0 ||
-							( v2.positionScreen.x - v3.positionScreen.x ) * ( v4.positionScreen.y - v3.positionScreen.y ) -
-							( v2.positionScreen.y - v3.positionScreen.y ) * ( v4.positionScreen.x - v3.positionScreen.x ) < 0 ) ) ) ) {
-
-							_face = getNextFace4InPool();
-
-							_face.v1.copy( v1 );
-							_face.v2.copy( v2 );
-							_face.v3.copy( v3 );
-							_face.v4.copy( v4 );
-
-						} else {
-
-							continue;
-
-						}
-
-					}
-
-					_face.normalWorld.copy( face.normal );
-					objectMatrixRotation.multiplyVector3( _face.normalWorld );
-
-					_face.centroidWorld.copy( face.centroid );
-					objectMatrix.multiplyVector3( _face.centroidWorld );
-
-					_face.centroidScreen.copy( _face.centroidWorld );
-					_projScreenMatrix.multiplyVector3( _face.centroidScreen );
-
-					faceVertexNormals = face.vertexNormals;
-
-					for ( n = 0, nl = faceVertexNormals.length; n < nl; n ++ ) {
-
-						normal = _face.vertexNormalsWorld[ n ];
-						normal.copy( faceVertexNormals[ n ] );
-						objectMatrixRotation.multiplyVector3( normal );
-
-					}
-
-					for ( c = 0, cl = faceVertexUvs.length; c < cl; c ++ ) {
-
-						uvs = faceVertexUvs[ c ][ f ];
-
-						if ( !uvs ) continue;
-
-						for ( u = 0, ul = uvs.length; u < ul; u ++ ) {
-
-							_face.uvs[ c ][ u ] = uvs[ u ];
-
-						}
-
-					}
-
-					_face.meshMaterials = objectMaterials;
-					_face.faceMaterials = face.materials;
-					_face.overdraw = objectOverdraw;
-
-					_face.z = _face.centroidScreen.z;
-
-					_renderList.push( _face );
-
-				}
-
-			} else if ( object instanceof THREE.Line ) {
-
-				_projScreenObjectMatrix.multiply( _projScreenMatrix, objectMatrix );
-
-				vertices = object.geometry.vertices;
-
-				v1 = getNextVertexInPool();
-				v1.positionScreen.copy( vertices[ 0 ].position );
-				_projScreenObjectMatrix.multiplyVector4( v1.positionScreen );
-
-				for ( v = 1, vl = vertices.length; v < vl; v++ ) {
-
-					v1 = getNextVertexInPool();
-					v1.positionScreen.copy( vertices[ v ].position );
-					_projScreenObjectMatrix.multiplyVector4( v1.positionScreen );
-
-					v2 = _vertexPool[ _vertexCount - 2 ];
-
-					_clippedVertex1PositionScreen.copy( v1.positionScreen );
-					_clippedVertex2PositionScreen.copy( v2.positionScreen );
-
-					if ( clipLine( _clippedVertex1PositionScreen, _clippedVertex2PositionScreen ) ) {
-
-						// Perform the perspective divide
-						_clippedVertex1PositionScreen.multiplyScalar( 1 / _clippedVertex1PositionScreen.w );
-						_clippedVertex2PositionScreen.multiplyScalar( 1 / _clippedVertex2PositionScreen.w );
-
-						_line = getNextLineInPool();
-						_line.v1.positionScreen.copy( _clippedVertex1PositionScreen );
-						_line.v2.positionScreen.copy( _clippedVertex2PositionScreen );
-
-						_line.z = Math.max( _clippedVertex1PositionScreen.z, _clippedVertex2PositionScreen.z );
-
-						_line.materials = object.materials;
-
-						_renderList.push( _line );
-
-					}
-				}
-
-			} else if ( object instanceof THREE.Particle ) {
-
-				_vector4.set( object.matrixWorld.n14, object.matrixWorld.n24, object.matrixWorld.n34, 1 );
-				_projScreenMatrix.multiplyVector4( _vector4 );
-
-				_vector4.z /= _vector4.w;
-
-				if ( _vector4.z > 0 && _vector4.z < 1 ) {
-
-					_particle = getNextParticleInPool();
-					_particle.x = _vector4.x / _vector4.w;
-					_particle.y = _vector4.y / _vector4.w;
-					_particle.z = _vector4.z;
-
-					_particle.rotation = object.rotation.z;
-
-					_particle.scale.x = object.scale.x * Math.abs( _particle.x - ( _vector4.x + camera.projectionMatrix.n11 ) / ( _vector4.w + camera.projectionMatrix.n14 ) );
-					_particle.scale.y = object.scale.y * Math.abs( _particle.y - ( _vector4.y + camera.projectionMatrix.n22 ) / ( _vector4.w + camera.projectionMatrix.n24 ) );
-
-					_particle.materials = object.materials;
-
-					_renderList.push( _particle );
-
-				}
-
-			}
-
-		}
-
-		sort && _renderList.sort( painterSort );
-
-		return _renderList;
-
-	};
-
-	// Pools
-
-	function getNextObjectInPool() {
-
-		var object = _objectPool[ _objectCount ] = _objectPool[ _objectCount ] || new THREE.RenderableObject();
-
-		_objectCount ++;
-
-		return object;
-
-	}
-
-	function getNextVertexInPool() {
-
-		var vertex = _vertexPool[ _vertexCount ] = _vertexPool[ _vertexCount ] || new THREE.RenderableVertex();
-
-		_vertexCount ++;
-
-		return vertex;
-
-	}
-
-	function getNextFace3InPool() {
-
-		var face = _face3Pool[ _face3Count ] = _face3Pool[ _face3Count ] || new THREE.RenderableFace3();
-
-		_face3Count ++;
-
-		return face;
-
-	}
-
-	function getNextFace4InPool() {
-
-		var face = _face4Pool[ _face4Count ] = _face4Pool[ _face4Count ] || new THREE.RenderableFace4();
-
-		_face4Count ++;
-
-		return face;
-
-	}
-
-	function getNextLineInPool() {
-
-		var line = _linePool[ _lineCount ] = _linePool[ _lineCount ] || new THREE.RenderableLine();
-
-		_lineCount ++;
-
-		return line;
-
-	}
-
-	function getNextParticleInPool() {
-
-		var particle = _particlePool[ _particleCount ] = _particlePool[ _particleCount ] || new THREE.RenderableParticle();
-		_particleCount ++;
-		return particle;
-
-	}
-
-	//
-
-	function painterSort( a, b ) {
-
-		return b.z - a.z;
-
-	}
-
-	function computeFrustum( m ) {
-
-		_frustum[ 0 ].set( m.n41 - m.n11, m.n42 - m.n12, m.n43 - m.n13, m.n44 - m.n14 );
-		_frustum[ 1 ].set( m.n41 + m.n11, m.n42 + m.n12, m.n43 + m.n13, m.n44 + m.n14 );
-		_frustum[ 2 ].set( m.n41 + m.n21, m.n42 + m.n22, m.n43 + m.n23, m.n44 + m.n24 );
-		_frustum[ 3 ].set( m.n41 - m.n21, m.n42 - m.n22, m.n43 - m.n23, m.n44 - m.n24 );
-		_frustum[ 4 ].set( m.n41 - m.n31, m.n42 - m.n32, m.n43 - m.n33, m.n44 - m.n34 );
-		_frustum[ 5 ].set( m.n41 + m.n31, m.n42 + m.n32, m.n43 + m.n33, m.n44 + m.n34 );
-
-		for ( var i = 0; i < 6; i ++ ) {
-
-			var plane = _frustum[ i ];
-			plane.divideScalar( Math.sqrt( plane.x * plane.x + plane.y * plane.y + plane.z * plane.z ) );
-
-		}
-
-	}
-
-	function isInFrustum( object ) {
-
-		var distance, matrix = object.matrixWorld,
-		radius = - object.geometry.boundingSphere.radius * Math.max( object.scale.x, Math.max( object.scale.y, object.scale.z ) );
-
-		for ( var i = 0; i < 6; i ++ ) {
-
-			distance = _frustum[ i ].x * matrix.n14 + _frustum[ i ].y * matrix.n24 + _frustum[ i ].z * matrix.n34 + _frustum[ i ].w;
-			if ( distance <= radius ) return false;
-
-		}
-
-		return true;
-
-	};
-
-	function clipLine( s1, s2 ) {
-
-		var alpha1 = 0, alpha2 = 1,
-
-		// Calculate the boundary coordinate of each vertex for the near and far clip planes,
-		// Z = -1 and Z = +1, respectively.
-		bc1near =  s1.z + s1.w,
-		bc2near =  s2.z + s2.w,
-		bc1far =  - s1.z + s1.w,
-		bc2far =  - s2.z + s2.w;
-
-		if ( bc1near >= 0 && bc2near >= 0 && bc1far >= 0 && bc2far >= 0 ) {
-
-			// Both vertices lie entirely within all clip planes.
-			return true;
-
-		} else if ( ( bc1near < 0 && bc2near < 0) || (bc1far < 0 && bc2far < 0 ) ) {
-
-			// Both vertices lie entirely outside one of the clip planes.
-			return false;
-
-		} else {
-
-			// The line segment spans at least one clip plane.
-
-			if ( bc1near < 0 ) {
-
-				// v1 lies outside the near plane, v2 inside
-				alpha1 = Math.max( alpha1, bc1near / ( bc1near - bc2near ) );
-
-			} else if ( bc2near < 0 ) {
-
-				// v2 lies outside the near plane, v1 inside
-				alpha2 = Math.min( alpha2, bc1near / ( bc1near - bc2near ) );
-
-			}
-
-			if ( bc1far < 0 ) {
-
-				// v1 lies outside the far plane, v2 inside
-				alpha1 = Math.max( alpha1, bc1far / ( bc1far - bc2far ) );
-
-			} else if ( bc2far < 0 ) {
-
-				// v2 lies outside the far plane, v2 inside
-				alpha2 = Math.min( alpha2, bc1far / ( bc1far - bc2far ) );
-
-			}
-
-			if ( alpha2 < alpha1 ) {
-
-				// The line segment spans two boundaries, but is outside both of them.
-				// (This can't happen when we're only clipping against just near/far but good
-				//  to leave the check here for future usage if other clip planes are added.)
-				return false;
-
-			} else {
-
-				// Update the s1 and s2 vertices to match the clipped line segment.
-				s1.lerpSelf( s2, alpha1 );
-				s2.lerpSelf( s1, 1 - alpha2 );
-
-				return true;
-
-			}
-
-		}
-
-	}
-
-};

+ 59 - 53
src/renderers/SVGRenderer.js

@@ -5,7 +5,7 @@
 THREE.SVGRenderer = function () {
 
 	var _this = this,
-	_renderList = null,
+	_renderData, _elements, _lights,
 	_projector = new THREE.Projector(),
 	_svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg'),
 	_svgWidth, _svgHeight, _svgWidthHalf, _svgHeightHalf,
@@ -16,11 +16,10 @@ THREE.SVGRenderer = function () {
 	_bboxRect = new THREE.Rectangle(),
 
 	_enableLighting = false,
-	_color = new THREE.Color( 0xffffff ),
-	_light = new THREE.Color( 0xffffff ),
-	_ambientLight = new THREE.Color( 0x000000 ),
-	_directionalLights = new THREE.Color( 0x000000 ),
-	_pointLights = new THREE.Color( 0x000000 ),
+	_color = new THREE.Color(),
+	_ambientLight = new THREE.Color(),
+	_directionalLights = new THREE.Color(),
+	_pointLights = new THREE.Color(),
 
 	_w, // z-buffer to w-buffer
 	_vector3 = new THREE.Vector3(), // Needed for PointLight
@@ -80,7 +79,7 @@ THREE.SVGRenderer = function () {
 
 	};
 
-	this.render = function( scene, camera ) {
+	this.render = function ( scene, camera ) {
 
 		var e, el, m, ml, fm, fml, element, material;
 
@@ -89,21 +88,23 @@ THREE.SVGRenderer = function () {
 		_this.info.render.vertices = 0;
 		_this.info.render.faces = 0;
 
-		_renderList = _projector.projectScene( scene, camera, this.sortElements );
+		_renderData = _projector.projectScene( scene, camera, this.sortElements );
+		_elements = _renderData.elements;
+		_lights = _renderData.lights;
 
 		_pathCount = 0; _circleCount = 0; _lineCount = 0;
 
-		_enableLighting = scene.lights.length > 0;
+		_enableLighting = _lights.length > 0;
 
 		if ( _enableLighting ) {
 
-			calculateLights( scene );
+			 calculateLights( _lights );
 
 		}
 
-		for ( e = 0, el = _renderList.length; e < el; e ++ ) {
+		for ( e = 0, el = _elements.length; e < el; e ++ ) {
 
-			element = _renderList[ e ];
+			element = _elements[ e ];
 
 			_bboxRect.empty();
 
@@ -240,10 +241,9 @@ THREE.SVGRenderer = function () {
 
 	};
 
-	function calculateLights( scene ) {
+	function calculateLights( lights ) {
 
-		var l, ll, light, lightColor,
-		lights = scene.lights;
+		var l, ll, light, lightColor;
 
 		_ambientLight.setRGB( 0, 0, 0 );
 		_directionalLights.setRGB( 0, 0, 0 );
@@ -278,40 +278,46 @@ THREE.SVGRenderer = function () {
 
 	}
 
-	function calculateFaceLight( scene, element, color ) {
+	function calculateLight( lights, position, normal, color ) {
 
-		var l, ll, light, amount;
+		var l, ll, light, lightColor, lightPosition, amount;
 
-		for ( l = 0, ll = scene.lights.length; l < ll; l++ ) {
+		for ( l = 0, ll = lights.length; l < ll; l ++ ) {
 
-			light = scene.lights[ l ];
+			light = lights[ l ];
+			lightColor = light.color;
 
 			if ( light instanceof THREE.DirectionalLight ) {
 
-				amount = element.normalWorld.dot( light.position ) * light.intensity;
+				lightPosition = light.matrixWorld.getPosition();
 
-				if ( amount > 0 ) {
+				amount = normal.dot( lightPosition );
 
-					color.r += light.color.r * amount;
-					color.g += light.color.g * amount;
-					color.b += light.color.b * amount;
+				if ( amount <= 0 ) continue;
 
-				}
+				amount *= light.intensity;
+
+				color.r += lightColor.r * amount;
+				color.g += lightColor.g * amount;
+				color.b += lightColor.b * amount;
 
 			} else if ( light instanceof THREE.PointLight ) {
 
-				_vector3.sub( light.position, element.centroidWorld );
-				_vector3.normalize();
+				lightPosition = light.matrixWorld.getPosition();
 
-				amount = element.normalWorld.dot( _vector3 ) * light.intensity;
+				amount = normal.dot( _vector3.sub( lightPosition, position ).normalize() );
 
-				if ( amount > 0 ) {
+				if ( amount <= 0 ) continue;
 
-					color.r += light.color.r * amount;
-					color.g += light.color.g * amount;
-					color.b += light.color.b * amount;
+				amount *= light.distance == 0 ? 1 : 1 - Math.min( position.distanceTo( lightPosition ) / light.distance, 1 );
 
-				}
+				if ( amount == 0 ) continue;
+
+				amount *= light.intensity;
+
+				color.r += lightColor.r * amount;
+				color.g += lightColor.g * amount;
+				color.b += lightColor.b * amount;
 
 			}
 
@@ -331,13 +337,13 @@ THREE.SVGRenderer = function () {
 
 			if ( _enableLighting ) {
 
-				_light.r = _ambientLight.r + _directionalLights.r + _pointLights.r;
-				_light.g = _ambientLight.g + _directionalLights.g + _pointLights.g;
-				_light.b = _ambientLight.b + _directionalLights.b + _pointLights.b;
+				_color.r = _ambientLight.r + _directionalLights.r + _pointLights.r;
+				_color.g = _ambientLight.g + _directionalLights.g + _pointLights.g;
+				_color.b = _ambientLight.b + _directionalLights.b + _pointLights.b;
 
-				_color.r = material.color.r * _light.r;
-				_color.g = material.color.g * _light.g;
-				_color.b = material.color.b * _light.b;
+				_color.r = material.color.r * _color.r;
+				_color.g = material.color.g * _color.g;
+				_color.b = material.color.b * _color.b;
 
 				_color.updateStyleString();
 
@@ -391,15 +397,15 @@ THREE.SVGRenderer = function () {
 
 			if ( _enableLighting ) {
 
-				_light.r = _ambientLight.r;
-				_light.g = _ambientLight.g;
-				_light.b = _ambientLight.b;
+				_color.r = _ambientLight.r;
+				_color.g = _ambientLight.g;
+				_color.b = _ambientLight.b;
 
-				calculateFaceLight( scene, element, _light );
+				calculateLight( _lights, element.centroidWorld, element.normalWorld, _color );
 
-				_color.r = Math.max( 0, Math.min( material.color.r * _light.r, 1 ) );
-				_color.g = Math.max( 0, Math.min( material.color.g * _light.g, 1 ) );
-				_color.b = Math.max( 0, Math.min( material.color.b * _light.b, 1 ) );
+				_color.r = Math.max( 0, Math.min( material.color.r * _color.r, 1 ) );
+				_color.g = Math.max( 0, Math.min( material.color.g * _color.g, 1 ) );
+				_color.b = Math.max( 0, Math.min( material.color.b * _color.b, 1 ) );
 
 			} else {
 
@@ -448,15 +454,15 @@ THREE.SVGRenderer = function () {
 
 			if ( _enableLighting ) {
 
-				_light.r = _ambientLight.r;
-				_light.g = _ambientLight.g;
-				_light.b = _ambientLight.b;
+				_color.r = _ambientLight.r;
+				_color.g = _ambientLight.g;
+				_color.b = _ambientLight.b;
 
-				calculateFaceLight( scene, element, _light );
+				calculateLight( _lights, element.centroidWorld, element.normalWorld, _color );
 
-				_color.r = Math.max( 0, Math.min( material.color.r * _light.r, 1 ) );
-				_color.g = Math.max( 0, Math.min( material.color.g * _light.g, 1 ) );
-				_color.b = Math.max( 0, Math.min( material.color.b * _light.b, 1 ) );
+				_color.r = Math.max( 0, Math.min( material.color.r * _color.r, 1 ) );
+				_color.g = Math.max( 0, Math.min( material.color.g * _color.g, 1 ) );
+				_color.b = Math.max( 0, Math.min( material.color.b * _color.b, 1 ) );
 
 			} else {
 

+ 11 - 4
src/renderers/WebGLRenderer.js

@@ -3524,12 +3524,16 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 				scene.update( undefined, false, _cameraLight );
 
+				THREE.Matrix4.makeInvert( _cameraLight.matrixWorld, _cameraLight.matrixWorldInverse );
+
 				// compute shadow matrix
 
-				shadowMatrix.set( 0.5, 0.0, 0.0, 0.5,
-								  0.0, 0.5, 0.0, 0.5,
-								  0.0, 0.0, 0.5, 0.5,
-								  0.0, 0.0, 0.0, 1.0 );
+				shadowMatrix.set(
+					0.5, 0.0, 0.0, 0.5,
+					0.0, 0.5, 0.0, 0.5,
+					0.0, 0.0, 0.5, 0.5,
+					0.0, 0.0, 0.0, 1.0
+				);
 
 				shadowMatrix.multiplySelf( _cameraLight.projectionMatrix );
 				shadowMatrix.multiplySelf( _cameraLight.matrixWorldInverse );
@@ -3540,6 +3544,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 				_cameraLight.projectionMatrix.flattenToArray( _projectionMatrixArray );
 
 				_projScreenMatrix.multiply( _cameraLight.projectionMatrix, _cameraLight.matrixWorldInverse );
+
 				computeFrustum( _projScreenMatrix );
 
 				_this.initWebGLObjects( scene );
@@ -3713,6 +3718,8 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 		scene.update( undefined, false, camera );
 
+		THREE.Matrix4.makeInvert( camera.matrixWorld, camera.matrixWorldInverse );
+
 		camera.matrixWorldInverse.flattenToArray( _viewMatrixArray );
 		camera.projectionMatrix.flattenToArray( _projectionMatrixArray );
 

+ 0 - 10
src/renderers/renderables/RenderableObject.js

@@ -1,10 +0,0 @@
-/**
- * @author mr.doob / http://mrdoob.com/
- */
-
-THREE.RenderableObject = function () {
-
-	this.object = null;
-	this.z = null;
-
-};

+ 1 - 151
src/scenes/Scene.js

@@ -1,6 +1,5 @@
 /**
  * @author mr.doob / http://mrdoob.com/
- * @author mikael emtinger / http://gomo.se/
  */
 
 THREE.Scene = function () {
@@ -8,160 +7,11 @@ THREE.Scene = function () {
 	THREE.Object3D.call( this );
 
 	this.fog = null;
-
-	this.matrixAutoUpdate = false;
-
 	this.overrideMaterial = null;
 
-	this.collisions = null;
-
-	this.objects = [];
-	this.lights = [];
-
-	this.__objectsAdded = [];
-	this.__objectsRemoved = [];
+	this.matrixAutoUpdate = false;
 
 };
 
 THREE.Scene.prototype = new THREE.Object3D();
 THREE.Scene.prototype.constructor = THREE.Scene;
-THREE.Scene.prototype.supr = THREE.Object3D.prototype;
-
-THREE.Scene.prototype.add = function ( object ) {
-
-	this.supr.add.call( this, object );
-	this.addChildRecurse( object );
-
-}
-
-THREE.Scene.prototype.addChildRecurse = function ( child ) {
-
-	if ( child instanceof THREE.Light ) {
-
-		if ( this.lights.indexOf( child ) === - 1 ) {
-
-			this.lights.push( child );
-
-		}
-
-	} else if ( !( child instanceof THREE.Camera || child instanceof THREE.Bone ) ) {
-
-		if ( this.objects.indexOf( child ) === - 1 ) {
-
-			this.objects.push( child );
-			this.__objectsAdded.push( child );
-
-			// check if previously removed
-
-			var i = this.__objectsRemoved.indexOf( child );
-
-			if ( i !== -1 ) {
-
-				this.__objectsRemoved.splice( i, 1 );
-
-			}
-
-		}
-
-	}
-
-	for ( var c = 0; c < child.children.length; c ++ ) {
-
-		this.addChildRecurse( child.children[ c ] );
-
-	}
-
-}
-
-THREE.Scene.prototype.remove = function ( object ) {
-
-	this.supr.remove.call( this, object );
-	this.removeChildRecurse( object );
-
-}
-
-THREE.Scene.prototype.removeChildRecurse = function ( child ) {
-
-	if ( child instanceof THREE.Light ) {
-
-		var i = this.lights.indexOf( child );
-
-		if ( i !== -1 ) {
-
-			this.lights.splice( i, 1 );
-
-		}
-
-	} else if ( !( child instanceof THREE.Camera ) ) {
-
-		var i = this.objects.indexOf( child );
-
-		if( i !== -1 ) {
-
-			this.objects.splice( i, 1 );
-			this.__objectsRemoved.push( child );
-
-			// check if previously added
-
-			var ai = this.__objectsAdded.indexOf( child );
-
-			if ( ai !== -1 ) {
-
-				this.__objectsAdded.splice( ai, 1 );
-
-			}
-		}
-
-	}
-
-	for ( var c = 0; c < child.children.length; c ++ ) {
-
-		this.removeChildRecurse( child.children[ c ] );
-
-	}
-
-}
-
-// DEPRECATED
-
-THREE.Scene.prototype.addChild = function ( child ) {
-
-	console.warn( 'DEPRECATED: Scene.addChild() is now Scene.add().' );
-	this.add( child );
-
-}
-
-THREE.Scene.prototype.addObject = function ( child ) {
-
-	console.warn( 'DEPRECATED: Scene.addObject() is now Scene.add().' );
-	this.add( child );
-
-}
-
-THREE.Scene.prototype.addLight = function ( child ) {
-
-	console.warn( 'DEPRECATED: Scene.addLight() is now Scene.add().' );
-	this.add( child );
-
-}
-
-THREE.Scene.prototype.removeChild = function ( child ) {
-
-	console.warn( 'DEPRECATED: Scene.removeChild() is now Scene.remove().' );
-	this.remove( child );
-
-}
-
-THREE.Scene.prototype.removeObject = function ( child ) {
-
-	console.warn( 'DEPRECATED: Scene.removeObject() is now Scene.remove().' );
-	this.remove( child );
-
-}
-
-THREE.Scene.prototype.removeLight = function ( child ) {
-
-	console.warn( 'DEPRECATED: Scene.removeLight() is now Scene.remove().' );
-	this.remove( child );
-
-}

+ 0 - 3
utils/build.py

@@ -76,7 +76,6 @@ COMMON_FILES = [
 'renderers/renderables/RenderableVertex.js',
 'renderers/renderables/RenderableFace3.js',
 'renderers/renderables/RenderableFace4.js',
-'renderers/renderables/RenderableObject.js',
 'renderers/renderables/RenderableParticle.js',
 'renderers/renderables/RenderableLine.js'
 ]
@@ -177,7 +176,6 @@ CANVAS_FILES = [
 'renderers/renderables/RenderableVertex.js',
 'renderers/renderables/RenderableFace3.js',
 'renderers/renderables/RenderableFace4.js',
-'renderers/renderables/RenderableObject.js',
 'renderers/renderables/RenderableParticle.js',
 'renderers/renderables/RenderableLine.js'
 ]
@@ -253,7 +251,6 @@ SVG_FILES = [
 'renderers/renderables/RenderableVertex.js',
 'renderers/renderables/RenderableFace3.js',
 'renderers/renderables/RenderableFace4.js',
-'renderers/renderables/RenderableObject.js',
 'renderers/renderables/RenderableParticle.js',
 'renderers/renderables/RenderableLine.js'
 ]

BIN
utils/exporters/utf8/objcompress


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