Browse Source

Merge remote-tracking branch 'mrdoob/dev'

zz85 13 years ago
parent
commit
273f96b854
57 changed files with 3204 additions and 1843 deletions
  1. 477 473
      build/Three.js
  2. 93 91
      build/custom/ThreeCanvas.js
  3. 60 58
      build/custom/ThreeDOM.js
  4. 296 295
      build/custom/ThreeExtras.js
  5. 72 70
      build/custom/ThreeSVG.js
  6. 223 219
      build/custom/ThreeWebGL.js
  7. 29 9
      docs/api/materials/LineBasicMaterial.html
  8. 25 7
      docs/api/objects/Line.html
  9. 18 6
      docs/api/objects/Mesh.html
  10. 299 6
      docs/api/renderers/WebGLRenderer.html
  11. 1 1
      examples/canvas_camera_orthographic.html
  12. 1 1
      examples/canvas_camera_orthographic2.html
  13. 3 3
      examples/canvas_geometry_hierarchy.html
  14. 1 1
      examples/canvas_lights_pointlights.html
  15. 1 1
      examples/canvas_lights_pointlights_smooth.html
  16. 1 1
      examples/canvas_materials.html
  17. 1 1
      examples/canvas_materials_normal.html
  18. 1 1
      examples/canvas_materials_reflection.html
  19. 1 2
      examples/canvas_particles_waves.html
  20. 1 1
      examples/js/postprocessing/EffectComposer.js
  21. 2 2
      examples/models/monster.dae
  22. 1 0
      examples/models/readme.txt
  23. BIN
      examples/textures/2294472375_24a3b8ef46_o.jpg
  24. BIN
      examples/textures/lensflare/lensflare0_alpha.png
  25. BIN
      examples/textures/sprites/snowflake7_alpha.png
  26. 4 4
      examples/webgl_geometry_subdivison.html
  27. 1 1
      examples/webgl_interactive_draggablecubes.html
  28. 18 0
      examples/webgl_loader_collada.html
  29. 18 0
      examples/webgl_loader_json_blender.html
  30. 181 0
      examples/webgl_materials_blending.html
  31. 455 0
      examples/webgl_materials_blending_custom.html
  32. 2 4
      examples/webgl_materials_cubemap_dynamic.html
  33. 217 0
      examples/webgl_materials_cubemap_dynamic2.html
  34. 2 2
      examples/webgl_materials_normalmap2.html
  35. 1 1
      examples/webgl_panorama_equirectangular.html
  36. 2 2
      examples/webgl_postprocessing_dof.html
  37. 2 2
      examples/webgl_shader.html
  38. 2 2
      examples/webgl_shading_physical.html
  39. 1 1
      examples/webgl_terrain_dynamic.html
  40. 1 1
      src/cameras/OrthographicCamera.js
  41. 4 3
      src/cameras/PerspectiveCamera.js
  42. 1 1
      src/core/Geometry.js
  43. 37 0
      src/core/Matrix3.js
  44. 272 328
      src/core/Matrix4.js
  45. 1 1
      src/extras/GeometryUtils.js
  46. 39 76
      src/extras/cameras/CubeCamera.js
  47. 1 1
      src/extras/geometries/LatheGeometry.js
  48. 3 3
      src/extras/geometries/TubeGeometry.js
  49. 1 1
      src/extras/helpers/ArrowHelper.js
  50. 185 125
      src/extras/loaders/ColladaLoader.js
  51. 1 1
      src/extras/renderers/plugins/LensFlarePlugin.js
  52. 1 1
      src/extras/renderers/plugins/SpritePlugin.js
  53. 44 0
      src/materials/Material.js
  54. 5 0
      src/objects/Sprite.js
  55. 4 4
      src/renderers/CanvasRenderer.js
  56. 88 24
      src/renderers/WebGLRenderer.js
  57. 3 5
      src/textures/Texture.js

+ 477 - 473
build/Three.js

@@ -14,49 +14,49 @@ THREE.Vector3.prototype={constructor:THREE.Vector3,set:function(a,b,c){this.x=a;
 sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;return this},multiply:function(a,b){this.x=a.x*b.x;this.y=a.y*b.y;this.z=a.z*b.z;return this},multiplySelf:function(a){this.x*=a.x;this.y*=a.y;this.z*=a.z;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;return this},divideSelf:function(a){this.x/=a.x;this.y/=a.y;this.z/=a.z;return this},divideScalar:function(a){a?(this.x/=a,this.y/=a,this.z/=a):
 this.z=this.y=this.x=0;return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.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 Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},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;return this},cross:function(a,b){this.x=a.y*b.z-a.z*b.y;this.y=a.z*b.x-a.x*b.z;this.z=a.x*b.y-a.y*b.x;return this},crossSelf:function(a){var b=this.x,c=this.y,d=this.z;this.x=c*a.z-d*a.y;this.y=d*a.x-b*a.z;this.z=b*a.y-c*a.x;return this},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){return(new THREE.Vector3).sub(this,a).lengthSq()},getPositionFromMatrix:function(a){this.x=a.n14;this.y=
-a.n24;this.z=a.n34;return this},getRotationFromMatrix:function(a,b){var c=b?b.x:1,d=b?b.y:1,e=b?b.z:1,f=a.n11/c,g=a.n12/d,c=a.n21/c,d=a.n22/d,h=a.n23/e,i=a.n33/e;this.y=Math.asin(a.n13/e);e=Math.cos(this.y);1.0E-5<Math.abs(e)?(this.x=Math.atan2(-h/e,i/e),this.z=Math.atan2(-g/e,f/e)):(this.x=0,this.z=Math.atan2(c,d));return this},getScaleFromMatrix:function(a){var b=this.set(a.n11,a.n21,a.n31).length(),c=this.set(a.n12,a.n22,a.n32).length(),a=this.set(a.n13,a.n23,a.n33).length();this.x=b;this.y=c;
+a.n24;this.z=a.n34;return this},getRotationFromMatrix:function(a,b){var c=b?b.x:1,d=b?b.y:1,e=b?b.z:1,f=a.n11/c,g=a.n12/d,c=a.n21/c,d=a.n22/d,h=a.n23/e,l=a.n33/e;this.y=Math.asin(a.n13/e);e=Math.cos(this.y);1.0E-5<Math.abs(e)?(this.x=Math.atan2(-h/e,l/e),this.z=Math.atan2(-g/e,f/e)):(this.x=0,this.z=Math.atan2(c,d));return this},getScaleFromMatrix:function(a){var b=this.set(a.n11,a.n21,a.n31).length(),c=this.set(a.n12,a.n22,a.n32).length(),a=this.set(a.n13,a.n23,a.n33).length();this.x=b;this.y=c;
 this.z=a},equals:function(a){return a.x===this.x&&a.y===this.y&&a.z===this.z},isZero:function(){return 1.0E-4>this.lengthSq()},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};THREE.Vector4=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=void 0!==d?d:1};
 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=void 0!==a.w?a.w:1;return this},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},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Frustum=function(){this.planes=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4]};
 THREE.Frustum.prototype.setFromMatrix=function(a){var b,c=this.planes;c[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);c[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);c[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+a.n23,a.n44+a.n24);c[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);c[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);c[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+a.n33,a.n44+a.n34);for(a=0;6>a;a++)b=c[a],b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))};
 THREE.Frustum.prototype.contains=function(a){for(var b=this.planes,c=a.matrixWorld,d=THREE.Frustum.__v1.set(c.getColumnX().length(),c.getColumnY().length(),c.getColumnZ().length()),d=-a.geometry.boundingSphere.radius*Math.max(d.x,Math.max(d.y,d.z)),e=0;6>e;e++)if(a=b[e].x*c.n14+b[e].y*c.n24+b[e].z*c.n34+b[e].w,a<=d)return!1;return!0};THREE.Frustum.__v1=new THREE.Vector3;
-THREE.Ray=function(a,b){function c(a,b,c){q.sub(c,a);s=q.dot(b);u=l.add(a,r.copy(b).multiplyScalar(s));return v=c.distanceTo(u)}function d(a,b,c,d){q.sub(d,b);l.sub(c,b);r.sub(a,b);t=q.dot(q);w=q.dot(l);A=q.dot(r);G=l.dot(l);F=l.dot(r);D=1/(t*G-w*w);J=(G*A-w*F)*D;O=(t*F-w*A)*D;return 0<=J&&0<=O&&1>J+O}this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3;var e=1.0E-4;this.setPrecision=function(a){e=a};var f=new THREE.Vector3,g=new THREE.Vector3,h=new THREE.Vector3,i=new THREE.Vector3,
-m=new THREE.Vector3,k=new THREE.Vector3,p=new THREE.Vector3,n=new THREE.Vector3,o=new THREE.Vector3;this.intersectObject=function(a){var b,l=[];if(a instanceof THREE.Particle){var q=c(this.origin,this.direction,a.matrixWorld.getPosition());if(q>a.scale.x)return[];b={distance:q,point:a.position,face:null,object:a};l.push(b)}else if(a instanceof THREE.Mesh){var q=c(this.origin,this.direction,a.matrixWorld.getPosition()),r=THREE.Frustum.__v1.set(a.matrixWorld.getColumnX().length(),a.matrixWorld.getColumnY().length(),
-a.matrixWorld.getColumnZ().length());if(q>a.geometry.boundingSphere.radius*Math.max(r.x,Math.max(r.y,r.z)))return l;var s,j,t=a.geometry,v=t.vertices,z;a.matrixRotationWorld.extractRotation(a.matrixWorld);for(q=0,r=t.faces.length;q<r;q++)if(b=t.faces[q],m.copy(this.origin),k.copy(this.direction),z=a.matrixWorld,p=z.multiplyVector3(p.copy(b.centroid)).subSelf(m),n=a.matrixRotationWorld.multiplyVector3(n.copy(b.normal)),s=k.dot(n),!(Math.abs(s)<e)&&(j=n.dot(p)/s,!(0>j)&&(a.doubleSided||(a.flipSided?
-0<s:0>s))))if(o.add(m,k.multiplyScalar(j)),b instanceof THREE.Face3)f=z.multiplyVector3(f.copy(v[b.a].position)),g=z.multiplyVector3(g.copy(v[b.b].position)),h=z.multiplyVector3(h.copy(v[b.c].position)),d(o,f,g,h)&&(b={distance:m.distanceTo(o),point:o.clone(),face:b,object:a},l.push(b));else if(b instanceof THREE.Face4&&(f=z.multiplyVector3(f.copy(v[b.a].position)),g=z.multiplyVector3(g.copy(v[b.b].position)),h=z.multiplyVector3(h.copy(v[b.c].position)),i=z.multiplyVector3(i.copy(v[b.d].position)),
-d(o,f,g,i)||d(o,g,h,i)))b={distance:m.distanceTo(o),point:o.clone(),face:b,object:a},l.push(b)}return l};this.intersectObjects=function(a){for(var b=[],c=0,d=a.length;c<d;c++)Array.prototype.push.apply(b,this.intersectObject(a[c]));b.sort(function(a,b){return a.distance-b.distance});return b};var q=new THREE.Vector3,l=new THREE.Vector3,r=new THREE.Vector3,s,u,v,t,w,A,G,F,D,J,O};
+THREE.Ray=function(a,b){function c(a,b,c){r.sub(c,a);s=r.dot(b);u=n.add(a,q.copy(b).multiplyScalar(s));return v=c.distanceTo(u)}function d(a,b,c,d){r.sub(d,b);n.sub(c,b);q.sub(a,b);t=r.dot(r);w=r.dot(n);z=r.dot(q);F=n.dot(n);C=n.dot(q);G=1/(t*F-w*w);K=(F*z-w*C)*G;N=(t*C-w*z)*G;return 0<=K&&0<=N&&1>K+N}this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3;var e=1.0E-4;this.setPrecision=function(a){e=a};var f=new THREE.Vector3,g=new THREE.Vector3,h=new THREE.Vector3,l=new THREE.Vector3,
+j=new THREE.Vector3,k=new THREE.Vector3,p=new THREE.Vector3,m=new THREE.Vector3,o=new THREE.Vector3;this.intersectObject=function(a){var b,n=[];if(a instanceof THREE.Particle){var r=c(this.origin,this.direction,a.matrixWorld.getPosition());if(r>a.scale.x)return[];b={distance:r,point:a.position,face:null,object:a};n.push(b)}else if(a instanceof THREE.Mesh){var r=c(this.origin,this.direction,a.matrixWorld.getPosition()),q=THREE.Frustum.__v1.set(a.matrixWorld.getColumnX().length(),a.matrixWorld.getColumnY().length(),
+a.matrixWorld.getColumnZ().length());if(r>a.geometry.boundingSphere.radius*Math.max(q.x,Math.max(q.y,q.z)))return n;var s,i,t=a.geometry,v=t.vertices,A;a.matrixRotationWorld.extractRotation(a.matrixWorld);for(r=0,q=t.faces.length;r<q;r++)if(b=t.faces[r],j.copy(this.origin),k.copy(this.direction),A=a.matrixWorld,p=A.multiplyVector3(p.copy(b.centroid)).subSelf(j),m=a.matrixRotationWorld.multiplyVector3(m.copy(b.normal)),s=k.dot(m),!(Math.abs(s)<e)&&(i=m.dot(p)/s,!(0>i)&&(a.doubleSided||(a.flipSided?
+0<s:0>s))))if(o.add(j,k.multiplyScalar(i)),b instanceof THREE.Face3)f=A.multiplyVector3(f.copy(v[b.a].position)),g=A.multiplyVector3(g.copy(v[b.b].position)),h=A.multiplyVector3(h.copy(v[b.c].position)),d(o,f,g,h)&&(b={distance:j.distanceTo(o),point:o.clone(),face:b,object:a},n.push(b));else if(b instanceof THREE.Face4&&(f=A.multiplyVector3(f.copy(v[b.a].position)),g=A.multiplyVector3(g.copy(v[b.b].position)),h=A.multiplyVector3(h.copy(v[b.c].position)),l=A.multiplyVector3(l.copy(v[b.d].position)),
+d(o,f,g,l)||d(o,g,h,l)))b={distance:j.distanceTo(o),point:o.clone(),face:b,object:a},n.push(b)}return n};this.intersectObjects=function(a){for(var b=[],c=0,d=a.length;c<d;c++)Array.prototype.push.apply(b,this.intersectObject(a[c]));b.sort(function(a,b){return a.distance-b.distance});return b};var r=new THREE.Vector3,n=new THREE.Vector3,q=new THREE.Vector3,s,u,v,t,w,z,F,C,G,K,N};
 THREE.Rectangle=function(){function a(){f=d-b;g=e-c}var b,c,d,e,f,g,h=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return f};this.getHeight=function(){return g};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return e};this.set=function(f,g,k,p){h=!1;b=f;c=g;d=k;e=p;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,k,p,n,o){h?(h=!1,b=f<k?f<n?f:n:k<n?k:n,c=g<p?g<o?g:o:p<o?p:o,d=f>k?f>n?f:n:k>n?k:n,e=g>p?g>o?g:o:p>o?p:o):(b=f<k?f<n?f<b?f:b:n<b?n:b:k<n?k<b?k:b:n<b?n:b,c=g<p?g<o?g<c?g:c:o<c?o:c:p<o?p<c?p:c:o<c?o:c,d=f>k?f>n?f>d?f:d:n>d?n:d:k>n?k>d?k:d:n>d?n:d,e=g>p?g>o?g>e?g:e:o>e?o:e:p>o?p>e?p:e:o>e?o: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>
+function(f,g,k,p,m,o){h?(h=!1,b=f<k?f<m?f:m:k<m?k:m,c=g<p?g<o?g:o:p<o?p:o,d=f>k?f>m?f:m:k>m?k:m,e=g>p?g>o?g:o:p>o?p:o):(b=f<k?f<m?f<b?f:b:m<b?m:b:k<m?k<b?k:b:m<b?m:b,c=g<p?g<o?g<c?g:c:o<c?o:c:p<o?p<c?p:c:o<c?o:c,d=f>k?f>m?f>d?f:d:m>d?m:d:k>m?k>d?k:d:m>d?m:d,e=g>p?g>o?g>e?g:e:o>e?o:e:p>o?p>e?p:e:o>e?o: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 d<a.getLeft()||b>a.getRight()||e<a.getTop()||c>a.getBottom()?!1:!0};this.empty=function(){h=!0;e=d=c=b=0;a()};this.isEmpty=function(){return h}};
 THREE.Math={clamp:function(a,b,c){return a<b?b:a>c?c:a},clampBottom:function(a,b){return a<b?b:a},mapLinear:function(a,b,c,d,e){return d+(a-b)*(e-d)/(c-b)},random16:function(){return(65280*Math.random()+255*Math.random())/65535},randInt:function(a,b){return a+Math.floor(Math.random()*(b-a+1))},randFloat:function(a,b){return a+Math.random()*(b-a)},randFloatSpread:function(a){return a*(0.5-Math.random())},sign:function(a){return 0>a?-1:0<a?1:0}};THREE.Matrix3=function(){this.m=[]};
-THREE.Matrix3.prototype={constructor:THREE.Matrix3,transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}};THREE.Matrix4=function(a,b,c,d,e,f,g,h,i,m,k,p,n,o,q,l){this.set(void 0!==a?a:1,b||0,c||0,d||0,e||0,void 0!==f?f:1,g||0,h||0,i||0,m||0,void 0!==k?k:1,p||0,n||0,o||0,q||0,void 0!==l?l:1);this.m33=new THREE.Matrix3};
-THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,e,f,g,h,i,m,k,p,n,o,q,l){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=e;this.n22=f;this.n23=g;this.n24=h;this.n31=i;this.n32=m;this.n33=k;this.n34=p;this.n41=n;this.n42=o;this.n43=q;this.n44=l;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,
-b,c){var d=THREE.Matrix4.__v1,e=THREE.Matrix4.__v2,f=THREE.Matrix4.__v3;f.sub(a,b).normalize();if(0===f.length())f.z=1;d.cross(c,f).normalize();0===d.length()&&(f.x+=1.0E-4,d.cross(c,f).normalize());e.cross(f,d);this.n11=d.x;this.n12=e.x;this.n13=f.x;this.n21=d.y;this.n22=e.y;this.n23=f.y;this.n31=d.z;this.n32=e.z;this.n33=f.z;return this},multiply:function(a,b){var c=a.n11,d=a.n12,e=a.n13,f=a.n14,g=a.n21,h=a.n22,i=a.n23,m=a.n24,k=a.n31,p=a.n32,n=a.n33,o=a.n34,q=a.n41,l=a.n42,r=a.n43,s=a.n44,u=b.n11,
-v=b.n12,t=b.n13,w=b.n14,A=b.n21,G=b.n22,F=b.n23,D=b.n24,J=b.n31,O=b.n32,P=b.n33,U=b.n34,L=b.n41,I=b.n42,M=b.n43,B=b.n44;this.n11=c*u+d*A+e*J+f*L;this.n12=c*v+d*G+e*O+f*I;this.n13=c*t+d*F+e*P+f*M;this.n14=c*w+d*D+e*U+f*B;this.n21=g*u+h*A+i*J+m*L;this.n22=g*v+h*G+i*O+m*I;this.n23=g*t+h*F+i*P+m*M;this.n24=g*w+h*D+i*U+m*B;this.n31=k*u+p*A+n*J+o*L;this.n32=k*v+p*G+n*O+o*I;this.n33=k*t+p*F+n*P+o*M;this.n34=k*w+p*D+n*U+o*B;this.n41=q*u+l*A+r*J+s*L;this.n42=q*v+l*G+r*O+s*I;this.n43=q*t+l*F+r*P+s*M;this.n44=
-q*w+l*D+r*U+s*B;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;
+THREE.Matrix3.prototype={constructor:THREE.Matrix3,getInverse:function(a){var b=a.n33*a.n22-a.n32*a.n23,c=-a.n33*a.n21+a.n31*a.n23,d=a.n32*a.n21-a.n31*a.n22,e=-a.n33*a.n12+a.n32*a.n13,f=a.n33*a.n11-a.n31*a.n13,g=-a.n32*a.n11+a.n31*a.n12,h=a.n23*a.n12-a.n22*a.n13,l=-a.n23*a.n11+a.n21*a.n13,j=a.n22*a.n11-a.n21*a.n12,a=a.n11*b+a.n21*e+a.n31*h;0===a&&console.warn("Matrix3.getInverse(): determinant == 0");var a=1/a,k=this.m;k[0]=a*b;k[1]=a*c;k[2]=a*d;k[3]=a*e;k[4]=a*f;k[5]=a*g;k[6]=a*h;k[7]=a*l;k[8]=a*
+j;return this},transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}};THREE.Matrix4=function(a,b,c,d,e,f,g,h,l,j,k,p,m,o,r,n){this.set(void 0!==a?a:1,b||0,c||0,d||0,e||0,void 0!==f?f:1,g||0,h||0,l||0,j||0,void 0!==k?k:1,p||0,m||0,o||0,r||0,void 0!==n?n:1)};
+THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,e,f,g,h,l,j,k,p,m,o,r,n){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=e;this.n22=f;this.n23=g;this.n24=h;this.n31=l;this.n32=j;this.n33=k;this.n34=p;this.n41=m;this.n42=o;this.n43=r;this.n44=n;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,
+b,c){var d=THREE.Matrix4.__v1,e=THREE.Matrix4.__v2,f=THREE.Matrix4.__v3;f.sub(a,b).normalize();if(0===f.length())f.z=1;d.cross(c,f).normalize();0===d.length()&&(f.x+=1.0E-4,d.cross(c,f).normalize());e.cross(f,d);this.n11=d.x;this.n12=e.x;this.n13=f.x;this.n21=d.y;this.n22=e.y;this.n23=f.y;this.n31=d.z;this.n32=e.z;this.n33=f.z;return this},multiply:function(a,b){var c=a.n11,d=a.n12,e=a.n13,f=a.n14,g=a.n21,h=a.n22,l=a.n23,j=a.n24,k=a.n31,p=a.n32,m=a.n33,o=a.n34,r=a.n41,n=a.n42,q=a.n43,s=a.n44,u=b.n11,
+v=b.n12,t=b.n13,w=b.n14,z=b.n21,F=b.n22,C=b.n23,G=b.n24,K=b.n31,N=b.n32,P=b.n33,T=b.n34,O=b.n41,J=b.n42,I=b.n43,D=b.n44;this.n11=c*u+d*z+e*K+f*O;this.n12=c*v+d*F+e*N+f*J;this.n13=c*t+d*C+e*P+f*I;this.n14=c*w+d*G+e*T+f*D;this.n21=g*u+h*z+l*K+j*O;this.n22=g*v+h*F+l*N+j*J;this.n23=g*t+h*C+l*P+j*I;this.n24=g*w+h*G+l*T+j*D;this.n31=k*u+p*z+m*K+o*O;this.n32=k*v+p*F+m*N+o*J;this.n33=k*t+p*C+m*P+o*I;this.n34=k*w+p*G+m*T+o*D;this.n41=r*u+n*z+q*K+s*O;this.n42=r*v+n*F+q*N+s*J;this.n43=r*t+n*C+q*P+s*I;this.n44=
+r*w+n*G+q*T+s*D;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,f=this.n22,g=this.n23,h=this.n24,i=this.n31,m=this.n32,k=this.n33,p=this.n34,n=this.n41,o=this.n42,q=this.n43,l=this.n44;return d*g*m*n-c*h*m*n-d*f*k*n+b*h*k*n+c*f*p*n-b*g*p*n-d*g*i*o+c*h*i*o+d*e*k*o-a*h*k*o-c*e*p*o+a*g*p*o+d*f*i*q-b*h*i*q-d*e*m*q+a*h*m*q+b*e*p*q-a*f*p*q-c*f*i*l+b*g*i*l+c*e*m*l-a*g*m*l-b*e*k*l+a*f*k*l},transpose:function(){var a;
+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,f=this.n22,g=this.n23,h=this.n24,l=this.n31,j=this.n32,k=this.n33,p=this.n34,m=this.n41,o=this.n42,r=this.n43,n=this.n44;return d*g*j*m-c*h*j*m-d*f*k*m+b*h*k*m+c*f*p*m-b*g*p*m-d*g*l*o+c*h*l*o+d*e*k*o-a*h*k*o-c*e*p*o+a*g*p*o+d*f*l*r-b*h*l*r-d*e*j*r+a*h*j*r+b*e*p*r-a*f*p*r-c*f*l*n+b*g*l*n+c*e*j*n-a*g*j*n-b*e*k*n+a*f*k*n},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.n34=a;return this},flattenToArray:function(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=
-this.n44;return a},flattenToArrayOffset:function(a,b){a[b]=this.n11;a[b+1]=this.n21;a[b+2]=this.n31;a[b+3]=this.n41;a[b+4]=this.n12;a[b+5]=this.n22;a[b+6]=this.n32;a[b+7]=this.n42;a[b+8]=this.n13;a[b+9]=this.n23;a[b+10]=this.n33;a[b+11]=this.n43;a[b+12]=this.n14;a[b+13]=this.n24;a[b+14]=this.n34;a[b+15]=this.n44;return a},setTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},setScale:function(a,b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},setRotationX:function(a){var b=
-Math.cos(a),a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},setRotationY:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},setRotationZ:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),e=1-c,f=a.x,g=a.y,h=a.z,i=e*f,m=e*g;this.set(i*f+c,i*g-d*h,i*h+d*g,0,i*g+d*h,m*g+c,m*h-d*f,0,i*h-d*g,m*h+d*f,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,f=a.n21,g=a.n22,h=a.n23,i=a.n24,m=a.n31,k=
-a.n32,p=a.n33,n=a.n34,o=a.n41,q=a.n42,l=a.n43,r=a.n44;this.n11=h*n*q-i*p*q+i*k*l-g*n*l-h*k*r+g*p*r;this.n12=e*p*q-d*n*q-e*k*l+c*n*l+d*k*r-c*p*r;this.n13=d*i*q-e*h*q+e*g*l-c*i*l-d*g*r+c*h*r;this.n14=e*h*k-d*i*k-e*g*p+c*i*p+d*g*n-c*h*n;this.n21=i*p*o-h*n*o-i*m*l+f*n*l+h*m*r-f*p*r;this.n22=d*n*o-e*p*o+e*m*l-b*n*l-d*m*r+b*p*r;this.n23=e*h*o-d*i*o-e*f*l+b*i*l+d*f*r-b*h*r;this.n24=d*i*m-e*h*m+e*f*p-b*i*p-d*f*n+b*h*n;this.n31=g*n*o-i*k*o+i*m*q-f*n*q-g*m*r+f*k*r;this.n32=e*k*o-c*n*o-e*m*q+b*n*q+c*m*r-b*k*
-r;this.n33=c*i*o-e*g*o+e*f*q-b*i*q-c*f*r+b*g*r;this.n34=e*g*m-c*i*m-e*f*k+b*i*k+c*f*n-b*g*n;this.n41=h*k*o-g*p*o-h*m*q+f*p*q+g*m*l-f*k*l;this.n42=c*p*o-d*k*o+d*m*q-b*p*q-c*m*l+b*k*l;this.n43=d*g*o-c*h*o-d*f*q+b*h*q+c*f*l-b*g*l;this.n44=c*h*m-d*g*m+d*f*k-b*h*k-c*f*p+b*g*p;this.multiplyScalar(1/a.determinant());return this},setRotationFromEuler:function(a,b){var c=a.x,d=a.y,e=a.z,f=Math.cos(c),c=Math.sin(c),g=Math.cos(d),d=Math.sin(d),h=Math.cos(e),e=Math.sin(e);switch(b){case "YXZ":var i=g*h,m=g*e,
-k=d*h,p=d*e;this.n11=i+p*c;this.n12=k*c-m;this.n13=f*d;this.n21=f*e;this.n22=f*h;this.n23=-c;this.n31=m*c-k;this.n32=p+i*c;this.n33=f*g;break;case "ZXY":i=g*h;m=g*e;k=d*h;p=d*e;this.n11=i-p*c;this.n12=-f*e;this.n13=k+m*c;this.n21=m+k*c;this.n22=f*h;this.n23=p-i*c;this.n31=-f*d;this.n32=c;this.n33=f*g;break;case "ZYX":i=f*h;m=f*e;k=c*h;p=c*e;this.n11=g*h;this.n12=k*d-m;this.n13=i*d+p;this.n21=g*e;this.n22=p*d+i;this.n23=m*d-k;this.n31=-d;this.n32=c*g;this.n33=f*g;break;case "YZX":i=f*g;m=f*d;k=c*g;
-p=c*d;this.n11=g*h;this.n12=p-i*e;this.n13=k*e+m;this.n21=e;this.n22=f*h;this.n23=-c*h;this.n31=-d*h;this.n32=m*e+k;this.n33=i-p*e;break;case "XZY":i=f*g;m=f*d;k=c*g;p=c*d;this.n11=g*h;this.n12=-e;this.n13=d*h;this.n21=i*e+p;this.n22=f*h;this.n23=m*e-k;this.n31=k*e-m;this.n32=c*h;this.n33=p*e+i;break;default:i=f*h,m=f*e,k=c*h,p=c*e,this.n11=g*h,this.n12=-g*e,this.n13=d,this.n21=m+k*d,this.n22=i-p*d,this.n23=-c*g,this.n31=p-i*d,this.n32=k+m*d,this.n33=f*g}return this},setRotationFromQuaternion:function(a){var b=
-a.x,c=a.y,d=a.z,e=a.w,f=b+b,g=c+c,h=d+d,a=b*f,i=b*g,b=b*h,m=c*g,c=c*h,d=d*h,f=e*f,g=e*g,e=e*h;this.n11=1-(m+d);this.n12=i-e;this.n13=b+g;this.n21=i+e;this.n22=1-(a+d);this.n23=c-f;this.n31=b-g;this.n32=c+f;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,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,f=THREE.Matrix4.__v3;d.set(this.n11,this.n21,this.n31);e.set(this.n12,this.n22,this.n32);f.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=f.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},rotateByAxis:function(a,b){if(1===a.x&&0===a.y&&0===a.z)return this.rotateX(b);if(0===a.x&&1===a.y&&0===a.z)return this.rotateY(b);if(0===a.x&&0===a.y&&1===a.z)return this.rotateZ(b);var c=a.x,d=a.y,e=a.z,f=Math.sqrt(c*c+d*d+e*e),c=c/f,d=d/f,e=e/f,f=c*c,g=d*d,h=e*e,i=Math.cos(b),m=Math.sin(b),k=1-i,p=c*d*k,n=c*e*k,k=d*e*k,c=c*m,o=d*m,m=e*m,e=
-f+(1-f)*i,f=p+m,d=n-o,p=p-m,g=g+(1-g)*i,m=k+c,n=n+o,k=k-c,h=h+(1-h)*i,i=this.n11,c=this.n21,o=this.n31,q=this.n41,l=this.n12,r=this.n22,s=this.n32,u=this.n42,v=this.n13,t=this.n23,w=this.n33,A=this.n43;this.n11=e*i+f*l+d*v;this.n21=e*c+f*r+d*t;this.n31=e*o+f*s+d*w;this.n41=e*q+f*u+d*A;this.n12=p*i+g*l+m*v;this.n22=p*c+g*r+m*t;this.n32=p*o+g*s+m*w;this.n42=p*q+g*u+m*A;this.n13=n*i+k*l+h*v;this.n23=n*c+k*r+h*t;this.n33=n*o+k*s+h*w;this.n43=n*q+k*u+h*A;return this},rotateX:function(a){var b=this.n12,
-c=this.n22,d=this.n32,e=this.n42,f=this.n13,g=this.n23,h=this.n33,i=this.n43,m=Math.cos(a),a=Math.sin(a);this.n12=m*b+a*f;this.n22=m*c+a*g;this.n32=m*d+a*h;this.n42=m*e+a*i;this.n13=m*f-a*b;this.n23=m*g-a*c;this.n33=m*h-a*d;this.n43=m*i-a*e;return this},rotateY:function(a){var b=this.n11,c=this.n21,d=this.n31,e=this.n41,f=this.n13,g=this.n23,h=this.n33,i=this.n43,m=Math.cos(a),a=Math.sin(a);this.n11=m*b-a*f;this.n21=m*c-a*g;this.n31=m*d-a*h;this.n41=m*e-a*i;this.n13=m*f+a*b;this.n23=m*g+a*c;this.n33=
-m*h+a*d;this.n43=m*i+a*e;return this},rotateZ:function(a){var b=this.n11,c=this.n21,d=this.n31,e=this.n41,f=this.n12,g=this.n22,h=this.n32,i=this.n42,m=Math.cos(a),a=Math.sin(a);this.n11=m*b+a*f;this.n21=m*c+a*g;this.n31=m*d+a*h;this.n41=m*e+a*i;this.n12=m*f-a*b;this.n22=m*g-a*c;this.n32=m*h-a*d;this.n42=m*i-a*e;return this},translate:function(a){var b=a.x,c=a.y,a=a.z;this.n14=this.n11*b+this.n12*c+this.n13*a+this.n14;this.n24=this.n21*b+this.n22*c+this.n23*a+this.n24;this.n34=this.n31*b+this.n32*
-c+this.n33*a+this.n34;this.n44=this.n41*b+this.n42*c+this.n43*a+this.n44;return this},clone:function(){return new THREE.Matrix4(this.n11,this.n12,this.n13,this.n14,this.n21,this.n22,this.n23,this.n24,this.n31,this.n32,this.n33,this.n34,this.n41,this.n42,this.n43,this.n44)}};
-THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,d=a.n33*a.n22-a.n32*a.n23,e=-a.n33*a.n21+a.n31*a.n23,f=a.n32*a.n21-a.n31*a.n22,g=-a.n33*a.n12+a.n32*a.n13,h=a.n33*a.n11-a.n31*a.n13,i=-a.n32*a.n11+a.n31*a.n12,m=a.n23*a.n12-a.n22*a.n13,k=-a.n23*a.n11+a.n21*a.n13,p=a.n22*a.n11-a.n21*a.n12,a=a.n11*d+a.n21*g+a.n31*m;if(0===a)return null;a=1/a;c[0]=a*d;c[1]=a*e;c[2]=a*f;c[3]=a*g;c[4]=a*h;c[5]=a*i;c[6]=a*m;c[7]=a*k;c[8]=a*p;return b};
-THREE.Matrix4.makeFrustum=function(a,b,c,d,e,f){var g;g=new THREE.Matrix4;g.n11=2*e/(b-a);g.n12=0;g.n13=(b+a)/(b-a);g.n14=0;g.n21=0;g.n22=2*e/(d-c);g.n23=(d+c)/(d-c);g.n24=0;g.n31=0;g.n32=0;g.n33=-(f+e)/(f-e);g.n34=-2*f*e/(f-e);g.n41=0;g.n42=0;g.n43=-1;g.n44=0;return g};THREE.Matrix4.makePerspective=function(a,b,c,d){var e,a=c*Math.tan(a*Math.PI/360);e=-a;return THREE.Matrix4.makeFrustum(e*b,a*b,e,a,c,d)};
-THREE.Matrix4.makeOrtho=function(a,b,c,d,e,f){var g,h,i,m;g=new THREE.Matrix4;h=b-a;i=c-d;m=f-e;g.n11=2/h;g.n12=0;g.n13=0;g.n14=-((b+a)/h);g.n21=0;g.n22=2/i;g.n23=0;g.n24=-((c+d)/i);g.n31=0;g.n32=0;g.n33=-2/m;g.n34=-((f+e)/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;
+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},getPosition:function(){return THREE.Matrix4.__v1.set(this.n14,this.n24,this.n34)},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},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,f=a.n21,g=a.n22,h=a.n23,l=a.n24,j=a.n31,k=a.n32,p=a.n33,m=a.n34,o=a.n41,r=a.n42,n=a.n43,q=a.n44;this.n11=h*m*r-l*p*r+l*k*n-g*m*n-h*k*q+g*p*q;this.n12=e*p*r-d*m*r-e*k*n+c*m*n+d*k*q-c*p*q;this.n13=d*l*r-e*h*r+e*g*n-c*l*n-d*g*q+c*h*q;this.n14=e*h*k-d*l*k-e*g*p+c*
+l*p+d*g*m-c*h*m;this.n21=l*p*o-h*m*o-l*j*n+f*m*n+h*j*q-f*p*q;this.n22=d*m*o-e*p*o+e*j*n-b*m*n-d*j*q+b*p*q;this.n23=e*h*o-d*l*o-e*f*n+b*l*n+d*f*q-b*h*q;this.n24=d*l*j-e*h*j+e*f*p-b*l*p-d*f*m+b*h*m;this.n31=g*m*o-l*k*o+l*j*r-f*m*r-g*j*q+f*k*q;this.n32=e*k*o-c*m*o-e*j*r+b*m*r+c*j*q-b*k*q;this.n33=c*l*o-e*g*o+e*f*r-b*l*r-c*f*q+b*g*q;this.n34=e*g*j-c*l*j-e*f*k+b*l*k+c*f*m-b*g*m;this.n41=h*k*o-g*p*o-h*j*r+f*p*r+g*j*n-f*k*n;this.n42=c*p*o-d*k*o+d*j*r-b*p*r-c*j*n+b*k*n;this.n43=d*g*o-c*h*o-d*f*r+b*h*r+c*
+f*n-b*g*n;this.n44=c*h*j-d*g*j+d*f*k-b*h*k-c*f*p+b*g*p;this.multiplyScalar(1/a.determinant());return this},setRotationFromEuler:function(a,b){var c=a.x,d=a.y,e=a.z,f=Math.cos(c),c=Math.sin(c),g=Math.cos(d),d=Math.sin(d),h=Math.cos(e),e=Math.sin(e);switch(b){case "YXZ":var l=g*h,j=g*e,k=d*h,p=d*e;this.n11=l+p*c;this.n12=k*c-j;this.n13=f*d;this.n21=f*e;this.n22=f*h;this.n23=-c;this.n31=j*c-k;this.n32=p+l*c;this.n33=f*g;break;case "ZXY":l=g*h;j=g*e;k=d*h;p=d*e;this.n11=l-p*c;this.n12=-f*e;this.n13=k+
+j*c;this.n21=j+k*c;this.n22=f*h;this.n23=p-l*c;this.n31=-f*d;this.n32=c;this.n33=f*g;break;case "ZYX":l=f*h;j=f*e;k=c*h;p=c*e;this.n11=g*h;this.n12=k*d-j;this.n13=l*d+p;this.n21=g*e;this.n22=p*d+l;this.n23=j*d-k;this.n31=-d;this.n32=c*g;this.n33=f*g;break;case "YZX":l=f*g;j=f*d;k=c*g;p=c*d;this.n11=g*h;this.n12=p-l*e;this.n13=k*e+j;this.n21=e;this.n22=f*h;this.n23=-c*h;this.n31=-d*h;this.n32=j*e+k;this.n33=l-p*e;break;case "XZY":l=f*g;j=f*d;k=c*g;p=c*d;this.n11=g*h;this.n12=-e;this.n13=d*h;this.n21=
+l*e+p;this.n22=f*h;this.n23=j*e-k;this.n31=k*e-j;this.n32=c*h;this.n33=p*e+l;break;default:l=f*h,j=f*e,k=c*h,p=c*e,this.n11=g*h,this.n12=-g*e,this.n13=d,this.n21=j+k*d,this.n22=l-p*d,this.n23=-c*g,this.n31=p-l*d,this.n32=k+j*d,this.n33=f*g}return this},setRotationFromQuaternion:function(a){var b=a.x,c=a.y,d=a.z,e=a.w,f=b+b,g=c+c,h=d+d,a=b*f,l=b*g,b=b*h,j=c*g,c=c*h,d=d*h,f=e*f,g=e*g,e=e*h;this.n11=1-(j+d);this.n12=l-e;this.n13=b+g;this.n21=l+e;this.n22=1-(a+d);this.n23=c-f;this.n31=b-g;this.n32=c+
+f;this.n33=1-(a+j);return this},compose:function(a,b,c){var d=THREE.Matrix4.__m1,e=THREE.Matrix4.__m2;d.identity();d.setRotationFromQuaternion(b);e.makeScale(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,f=THREE.Matrix4.__v3;d.set(this.n11,this.n21,this.n31);e.set(this.n12,this.n22,this.n32);f.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=f.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},translate:function(a){var b=a.x,c=a.y,a=a.z;this.n14=this.n11*b+this.n12*c+this.n13*a+this.n14;this.n24=this.n21*b+this.n22*c+this.n23*a+this.n24;this.n34=this.n31*b+this.n32*c+this.n33*a+this.n34;this.n44=this.n41*b+this.n42*c+this.n43*a+this.n44;return this},
+rotateX:function(a){var b=this.n12,c=this.n22,d=this.n32,e=this.n42,f=this.n13,g=this.n23,h=this.n33,l=this.n43,j=Math.cos(a),a=Math.sin(a);this.n12=j*b+a*f;this.n22=j*c+a*g;this.n32=j*d+a*h;this.n42=j*e+a*l;this.n13=j*f-a*b;this.n23=j*g-a*c;this.n33=j*h-a*d;this.n43=j*l-a*e;return this},rotateY:function(a){var b=this.n11,c=this.n21,d=this.n31,e=this.n41,f=this.n13,g=this.n23,h=this.n33,l=this.n43,j=Math.cos(a),a=Math.sin(a);this.n11=j*b-a*f;this.n21=j*c-a*g;this.n31=j*d-a*h;this.n41=j*e-a*l;this.n13=
+j*f+a*b;this.n23=j*g+a*c;this.n33=j*h+a*d;this.n43=j*l+a*e;return this},rotateZ:function(a){var b=this.n11,c=this.n21,d=this.n31,e=this.n41,f=this.n12,g=this.n22,h=this.n32,l=this.n42,j=Math.cos(a),a=Math.sin(a);this.n11=j*b+a*f;this.n21=j*c+a*g;this.n31=j*d+a*h;this.n41=j*e+a*l;this.n12=j*f-a*b;this.n22=j*g-a*c;this.n32=j*h-a*d;this.n42=j*l-a*e;return this},rotateByAxis:function(a,b){if(1===a.x&&0===a.y&&0===a.z)return this.rotateX(b);if(0===a.x&&1===a.y&&0===a.z)return this.rotateY(b);if(0===a.x&&
+0===a.y&&1===a.z)return this.rotateZ(b);var c=a.x,d=a.y,e=a.z,f=Math.sqrt(c*c+d*d+e*e),c=c/f,d=d/f,e=e/f,f=c*c,g=d*d,h=e*e,l=Math.cos(b),j=Math.sin(b),k=1-l,p=c*d*k,m=c*e*k,k=d*e*k,c=c*j,o=d*j,j=e*j,e=f+(1-f)*l,f=p+j,d=m-o,p=p-j,g=g+(1-g)*l,j=k+c,m=m+o,k=k-c,h=h+(1-h)*l,l=this.n11,c=this.n21,o=this.n31,r=this.n41,n=this.n12,q=this.n22,s=this.n32,u=this.n42,v=this.n13,t=this.n23,w=this.n33,z=this.n43;this.n11=e*l+f*n+d*v;this.n21=e*c+f*q+d*t;this.n31=e*o+f*s+d*w;this.n41=e*r+f*u+d*z;this.n12=p*l+g*
+n+j*v;this.n22=p*c+g*q+j*t;this.n32=p*o+g*s+j*w;this.n42=p*r+g*u+j*z;this.n13=m*l+k*n+h*v;this.n23=m*c+k*q+h*t;this.n33=m*o+k*s+h*w;this.n43=m*r+k*u+h*z;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},makeTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},makeRotationX: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},makeRotationY: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},makeRotationZ: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},makeRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),e=1-c,f=a.x,g=a.y,h=a.z,l=e*f,j=e*g;this.set(l*f+c,l*g-d*h,l*h+d*g,0,l*g+d*h,j*g+c,j*h-d*f,0,l*h-d*g,j*h+d*f,e*h*h+c,0,0,0,0,1);return this},makeScale:function(a,
+b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},makeFrustum:function(a,b,c,d,e,f){this.n11=2*e/(b-a);this.n12=0;this.n13=(b+a)/(b-a);this.n21=this.n14=0;this.n22=2*e/(d-c);this.n23=(d+c)/(d-c);this.n32=this.n31=this.n24=0;this.n33=-(f+e)/(f-e);this.n34=-2*f*e/(f-e);this.n42=this.n41=0;this.n43=-1;this.n44=0;return this},makePerspective:function(a,b,c,d){var a=c*Math.tan(a*Math.PI/360),e=-a;return this.makeFrustum(e*b,a*b,e,a,c,d)},makeOrthographic:function(a,b,c,d,e,f){var g=b-a,h=c-d,
+l=f-e;this.n11=2/g;this.n13=this.n12=0;this.n14=-((b+a)/g);this.n21=0;this.n22=2/h;this.n23=0;this.n24=-((c+d)/h);this.n32=this.n31=0;this.n33=-2/l;this.n34=-((f+e)/l);this.n43=this.n42=this.n41=0;this.n44=1;return this},clone:function(){return new THREE.Matrix4(this.n11,this.n12,this.n13,this.n14,this.n21,this.n22,this.n23,this.n24,this.n31,this.n32,this.n33,this.n34,this.n41,this.n42,this.n43,this.n44)}};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.id=THREE.Object3DCount++;this.name="";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=!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,applyMatrix:function(a){this.matrix.multiply(a,this.matrix);this.scale.getScaleFromMatrix(this.matrix);this.rotation.getRotationFromMatrix(this.matrix,this.scale);this.position.getPositionFromMatrix(this.matrix)},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,
@@ -64,23 +64,23 @@ this._vector.set(0,0,1))},lookAt:function(a){this.matrix.lookAt(a,this.position,
 this.children.indexOf(a);if(-1!==b){a.parent=void 0;this.children.splice(b,1);for(b=this;void 0!==b.parent;)b=b.parent;void 0!==b&&b instanceof THREE.Scene&&b.__removeObject(a)}},getChildByName:function(a,b){var c,d,e;for(c=0,d=this.children.length;c<d;c++){e=this.children[c];if(e.name===a||b&&(e=e.getChildByName(a,b),void 0!==e))return e}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,
 this.eulerOrder);if(1!==this.scale.x||1!==this.scale.y||1!==this.scale.z)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[f]=g[f]||new THREE.RenderableObject;f++;return a}function b(){var a=m[i]=m[i]||new THREE.RenderableVertex;i++;return a}function c(a,b){return b.z-a.z}function d(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;if(0<=e&&0<=f&&0<=g&&0<=h)return!0;if(0>e&&0>f||0>g&&0>h)return!1;0>e?c=Math.max(c,e/(e-f)):0>f&&(d=Math.min(d,e/(e-f)));0>g?c=Math.max(c,g/(g-h)):0>h&&(d=Math.min(d,g/(g-h)));if(d<c)return!1;a.lerpSelf(b,c);b.lerpSelf(a,1-d);return!0}
-var e,f,g=[],h,i,m=[],k,p,n=[],o,q=[],l,r,s=[],u,v,t=[],w={objects:[],sprites:[],lights:[],elements:[]},A=new THREE.Vector3,G=new THREE.Vector4,F=new THREE.Matrix4,D=new THREE.Matrix4,J=new THREE.Frustum,O=new THREE.Vector4,P=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);F.multiply(b.projectionMatrix,b.matrixWorldInverse);F.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);F.multiply(b.matrixWorld,
-b.projectionMatrixInverse);F.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(b,d){f=0;w.objects.length=0;w.sprites.length=0;w.lights.length=0;var g=function(b){if(!1!==b.visible){(b instanceof THREE.Mesh||b instanceof THREE.Line)&&(!1===b.frustumCulled||J.contains(b))?(A.copy(b.matrixWorld.getPosition()),F.multiplyVector3(A),
-e=a(),e.object=b,e.z=A.z,w.objects.push(e)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(A.copy(b.matrixWorld.getPosition()),F.multiplyVector3(A),e=a(),e.object=b,e.z=A.z,w.sprites.push(e)):b instanceof THREE.Light&&w.lights.push(b);for(var c=0,d=b.children.length;c<d;c++)g(b.children[c])}};g(b);d&&w.objects.sort(c);return w};this.projectScene=function(a,e,f){var g=e.near,B=e.far,j=!1,A,C,z,R,E,ga,ea,ca,S,Q,W,aa,ia,Sa,na;v=r=o=p=0;w.elements.length=0;void 0===e.parent&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),
-a.add(e));a.updateMatrixWorld();e.matrixWorldInverse.getInverse(e.matrixWorld);F.multiply(e.projectionMatrix,e.matrixWorldInverse);J.setFromMatrix(F);w=this.projectGraph(a,!1);for(a=0,A=w.objects.length;a<A;a++)if(S=w.objects[a].object,Q=S.matrixWorld,i=0,S instanceof THREE.Mesh){W=S.geometry;aa=S.geometry.materials;R=W.vertices;ia=W.faces;Sa=W.faceVertexUvs;W=S.matrixRotationWorld.extractRotation(Q);for(C=0,z=R.length;C<z;C++)h=b(),h.positionWorld.copy(R[C].position),Q.multiplyVector3(h.positionWorld),
-h.positionScreen.copy(h.positionWorld),F.multiplyVector4(h.positionScreen),h.positionScreen.x/=h.positionScreen.w,h.positionScreen.y/=h.positionScreen.w,h.visible=h.positionScreen.z>g&&h.positionScreen.z<B;for(R=0,C=ia.length;R<C;R++){z=ia[R];if(z instanceof THREE.Face3)if(E=m[z.a],ga=m[z.b],ea=m[z.c],E.visible&&ga.visible&&ea.visible)if(j=0>(ea.positionScreen.x-E.positionScreen.x)*(ga.positionScreen.y-E.positionScreen.y)-(ea.positionScreen.y-E.positionScreen.y)*(ga.positionScreen.x-E.positionScreen.x),
-S.doubleSided||j!=S.flipSided)ca=n[p]=n[p]||new THREE.RenderableFace3,p++,k=ca,k.v1.copy(E),k.v2.copy(ga),k.v3.copy(ea);else continue;else continue;else if(z instanceof THREE.Face4)if(E=m[z.a],ga=m[z.b],ea=m[z.c],ca=m[z.d],E.visible&&ga.visible&&ea.visible&&ca.visible)if(j=0>(ca.positionScreen.x-E.positionScreen.x)*(ga.positionScreen.y-E.positionScreen.y)-(ca.positionScreen.y-E.positionScreen.y)*(ga.positionScreen.x-E.positionScreen.x)||0>(ga.positionScreen.x-ea.positionScreen.x)*(ca.positionScreen.y-
-ea.positionScreen.y)-(ga.positionScreen.y-ea.positionScreen.y)*(ca.positionScreen.x-ea.positionScreen.x),S.doubleSided||j!=S.flipSided)na=q[o]=q[o]||new THREE.RenderableFace4,o++,k=na,k.v1.copy(E),k.v2.copy(ga),k.v3.copy(ea),k.v4.copy(ca);else continue;else continue;k.normalWorld.copy(z.normal);!j&&(S.flipSided||S.doubleSided)&&k.normalWorld.negate();W.multiplyVector3(k.normalWorld);k.centroidWorld.copy(z.centroid);Q.multiplyVector3(k.centroidWorld);k.centroidScreen.copy(k.centroidWorld);F.multiplyVector3(k.centroidScreen);
-ea=z.vertexNormals;for(E=0,ga=ea.length;E<ga;E++)ca=k.vertexNormalsWorld[E],ca.copy(ea[E]),!j&&(S.flipSided||S.doubleSided)&&ca.negate(),W.multiplyVector3(ca);for(E=0,ga=Sa.length;E<ga;E++)if(na=Sa[E][R])for(ea=0,ca=na.length;ea<ca;ea++)k.uvs[E][ea]=na[ea];k.material=S.material;k.faceMaterial=null!==z.materialIndex?aa[z.materialIndex]:null;k.z=k.centroidScreen.z;w.elements.push(k)}}else if(S instanceof THREE.Line){D.multiply(F,Q);R=S.geometry.vertices;E=b();E.positionScreen.copy(R[0].position);D.multiplyVector4(E.positionScreen);
-for(C=1,z=R.length;C<z;C++)if(E=b(),E.positionScreen.copy(R[C].position),D.multiplyVector4(E.positionScreen),ga=m[i-2],O.copy(E.positionScreen),P.copy(ga.positionScreen),d(O,P))O.multiplyScalar(1/O.w),P.multiplyScalar(1/P.w),Q=s[r]=s[r]||new THREE.RenderableLine,r++,l=Q,l.v1.positionScreen.copy(O),l.v2.positionScreen.copy(P),l.z=Math.max(O.z,P.z),l.material=S.material,w.elements.push(l)}for(a=0,A=w.sprites.length;a<A;a++)if(S=w.sprites[a].object,Q=S.matrixWorld,S instanceof THREE.Particle&&(G.set(Q.n14,
-Q.n24,Q.n34,1),F.multiplyVector4(G),G.z/=G.w,0<G.z&&1>G.z))g=t[v]=t[v]||new THREE.RenderableParticle,v++,u=g,u.x=G.x/G.w,u.y=G.y/G.w,u.z=G.z,u.rotation=S.rotation.z,u.scale.x=S.scale.x*Math.abs(u.x-(G.x+e.projectionMatrix.n11)/(G.w+e.projectionMatrix.n14)),u.scale.y=S.scale.y*Math.abs(u.y-(G.y+e.projectionMatrix.n22)/(G.w+e.projectionMatrix.n24)),u.material=S.material,w.elements.push(u);f&&w.elements.sort(c);return w}};
+THREE.Projector=function(){function a(){var a=g[f]=g[f]||new THREE.RenderableObject;f++;return a}function b(){var a=j[l]=j[l]||new THREE.RenderableVertex;l++;return a}function c(a,b){return b.z-a.z}function d(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;if(0<=e&&0<=f&&0<=g&&0<=h)return!0;if(0>e&&0>f||0>g&&0>h)return!1;0>e?c=Math.max(c,e/(e-f)):0>f&&(d=Math.min(d,e/(e-f)));0>g?c=Math.max(c,g/(g-h)):0>h&&(d=Math.min(d,g/(g-h)));if(d<c)return!1;a.lerpSelf(b,c);b.lerpSelf(a,1-d);return!0}
+var e,f,g=[],h,l,j=[],k,p,m=[],o,r=[],n,q,s=[],u,v,t=[],w={objects:[],sprites:[],lights:[],elements:[]},z=new THREE.Vector3,F=new THREE.Vector4,C=new THREE.Matrix4,G=new THREE.Matrix4,K=new THREE.Frustum,N=new THREE.Vector4,P=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);C.multiply(b.projectionMatrix,b.matrixWorldInverse);C.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);C.multiply(b.matrixWorld,
+b.projectionMatrixInverse);C.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(b,d){f=0;w.objects.length=0;w.sprites.length=0;w.lights.length=0;var g=function(b){if(!1!==b.visible){(b instanceof THREE.Mesh||b instanceof THREE.Line)&&(!1===b.frustumCulled||K.contains(b))?(z.copy(b.matrixWorld.getPosition()),C.multiplyVector3(z),
+e=a(),e.object=b,e.z=z.z,w.objects.push(e)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(z.copy(b.matrixWorld.getPosition()),C.multiplyVector3(z),e=a(),e.object=b,e.z=z.z,w.sprites.push(e)):b instanceof THREE.Light&&w.lights.push(b);for(var c=0,d=b.children.length;c<d;c++)g(b.children[c])}};g(b);d&&w.objects.sort(c);return w};this.projectScene=function(a,e,f){var g=e.near,D=e.far,i=!1,z,B,A,V,E,aa,ea,ia,R,$,ba,Z,ja,Ga,oa;v=q=o=p=0;w.elements.length=0;void 0===e.parent&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),
+a.add(e));a.updateMatrixWorld();e.matrixWorldInverse.getInverse(e.matrixWorld);C.multiply(e.projectionMatrix,e.matrixWorldInverse);K.setFromMatrix(C);w=this.projectGraph(a,!1);for(a=0,z=w.objects.length;a<z;a++)if(R=w.objects[a].object,$=R.matrixWorld,l=0,R instanceof THREE.Mesh){ba=R.geometry;Z=R.geometry.materials;V=ba.vertices;ja=ba.faces;Ga=ba.faceVertexUvs;ba=R.matrixRotationWorld.extractRotation($);for(B=0,A=V.length;B<A;B++)h=b(),h.positionWorld.copy(V[B].position),$.multiplyVector3(h.positionWorld),
+h.positionScreen.copy(h.positionWorld),C.multiplyVector4(h.positionScreen),h.positionScreen.x/=h.positionScreen.w,h.positionScreen.y/=h.positionScreen.w,h.visible=h.positionScreen.z>g&&h.positionScreen.z<D;for(V=0,B=ja.length;V<B;V++){A=ja[V];if(A instanceof THREE.Face3)if(E=j[A.a],aa=j[A.b],ea=j[A.c],E.visible&&aa.visible&&ea.visible)if(i=0>(ea.positionScreen.x-E.positionScreen.x)*(aa.positionScreen.y-E.positionScreen.y)-(ea.positionScreen.y-E.positionScreen.y)*(aa.positionScreen.x-E.positionScreen.x),
+R.doubleSided||i!=R.flipSided)ia=m[p]=m[p]||new THREE.RenderableFace3,p++,k=ia,k.v1.copy(E),k.v2.copy(aa),k.v3.copy(ea);else continue;else continue;else if(A instanceof THREE.Face4)if(E=j[A.a],aa=j[A.b],ea=j[A.c],ia=j[A.d],E.visible&&aa.visible&&ea.visible&&ia.visible)if(i=0>(ia.positionScreen.x-E.positionScreen.x)*(aa.positionScreen.y-E.positionScreen.y)-(ia.positionScreen.y-E.positionScreen.y)*(aa.positionScreen.x-E.positionScreen.x)||0>(aa.positionScreen.x-ea.positionScreen.x)*(ia.positionScreen.y-
+ea.positionScreen.y)-(aa.positionScreen.y-ea.positionScreen.y)*(ia.positionScreen.x-ea.positionScreen.x),R.doubleSided||i!=R.flipSided)oa=r[o]=r[o]||new THREE.RenderableFace4,o++,k=oa,k.v1.copy(E),k.v2.copy(aa),k.v3.copy(ea),k.v4.copy(ia);else continue;else continue;k.normalWorld.copy(A.normal);!i&&(R.flipSided||R.doubleSided)&&k.normalWorld.negate();ba.multiplyVector3(k.normalWorld);k.centroidWorld.copy(A.centroid);$.multiplyVector3(k.centroidWorld);k.centroidScreen.copy(k.centroidWorld);C.multiplyVector3(k.centroidScreen);
+ea=A.vertexNormals;for(E=0,aa=ea.length;E<aa;E++)ia=k.vertexNormalsWorld[E],ia.copy(ea[E]),!i&&(R.flipSided||R.doubleSided)&&ia.negate(),ba.multiplyVector3(ia);for(E=0,aa=Ga.length;E<aa;E++)if(oa=Ga[E][V])for(ea=0,ia=oa.length;ea<ia;ea++)k.uvs[E][ea]=oa[ea];k.material=R.material;k.faceMaterial=null!==A.materialIndex?Z[A.materialIndex]:null;k.z=k.centroidScreen.z;w.elements.push(k)}}else if(R instanceof THREE.Line){G.multiply(C,$);V=R.geometry.vertices;E=b();E.positionScreen.copy(V[0].position);G.multiplyVector4(E.positionScreen);
+for(B=1,A=V.length;B<A;B++)if(E=b(),E.positionScreen.copy(V[B].position),G.multiplyVector4(E.positionScreen),aa=j[l-2],N.copy(E.positionScreen),P.copy(aa.positionScreen),d(N,P))N.multiplyScalar(1/N.w),P.multiplyScalar(1/P.w),$=s[q]=s[q]||new THREE.RenderableLine,q++,n=$,n.v1.positionScreen.copy(N),n.v2.positionScreen.copy(P),n.z=Math.max(N.z,P.z),n.material=R.material,w.elements.push(n)}for(a=0,z=w.sprites.length;a<z;a++)if(R=w.sprites[a].object,$=R.matrixWorld,R instanceof THREE.Particle&&(F.set($.n14,
+$.n24,$.n34,1),C.multiplyVector4(F),F.z/=F.w,0<F.z&&1>F.z))g=t[v]=t[v]||new THREE.RenderableParticle,v++,u=g,u.x=F.x/F.w,u.y=F.y/F.w,u.z=F.z,u.rotation=R.rotation.z,u.scale.x=R.scale.x*Math.abs(u.x-(F.x+e.projectionMatrix.n11)/(F.w+e.projectionMatrix.n14)),u.scale.y=R.scale.y*Math.abs(u.y-(F.y+e.projectionMatrix.n22)/(F.w+e.projectionMatrix.n24)),u.material=R.material,w.elements.push(u);f&&w.elements.sort(c);return w}};
 THREE.Quaternion=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=void 0!==d?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),f=Math.cos(c),c=Math.sin(c),g=a*b,h=d*e;this.w=g*f-h*c;this.x=g*c+h*f;this.y=d*b*f+a*e*c;this.z=a*e*f-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=0>a.n32-a.n23?-Math.abs(this.x):Math.abs(this.x);this.y=0>a.n13-a.n31?-Math.abs(this.y):Math.abs(this.y);this.z=0>a.n21-a.n12?-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);0===a?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},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},multiplySelf:function(a){var b=this.x,c=this.y,d=this.z,e=this.w,f=a.x,g=a.y,h=a.z,a=a.w;this.x=b*a+e*f+c*h-d*g;this.y=c*a+e*g+d*f-b*h;this.z=d*a+e*h+b*g-c*f;this.w=e*a-b*f-c*g-d*h;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,f=this.x,g=this.y,h=this.z,i=this.w,m=i*c+g*e-h*d,k=i*d+h*c-f*e,p=i*e+f*
-d-g*c,c=-f*c-g*d-h*e;b.x=m*i+c*-f+k*-h-p*-g;b.y=k*i+c*-g+p*-f-m*-h;b.z=p*i+c*-h+m*-g-k*-f;return b},clone:function(){return new THREE.Quaternion(this.x,this.y,this.z,this.w)}};
+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},multiplySelf:function(a){var b=this.x,c=this.y,d=this.z,e=this.w,f=a.x,g=a.y,h=a.z,a=a.w;this.x=b*a+e*f+c*h-d*g;this.y=c*a+e*g+d*f-b*h;this.z=d*a+e*h+b*g-c*f;this.w=e*a-b*f-c*g-d*h;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,f=this.x,g=this.y,h=this.z,l=this.w,j=l*c+g*e-h*d,k=l*d+h*c-f*e,p=l*e+f*
+d-g*c,c=-f*c-g*d-h*e;b.x=j*l+c*-f+k*-h-p*-g;b.y=k*l+c*-g+p*-f-j*-h;b.z=p*l+c*-h+j*-g-k*-f;return b},clone:function(){return new THREE.Quaternion(this.x,this.y,this.z,this.w)}};
 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;0>e?(c.w=-b.w,c.x=-b.x,c.y=-b.y,c.z=-b.z,e=-e):c.copy(b);if(1<=Math.abs(e))return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var f=Math.acos(e),e=Math.sqrt(1-e*e);if(0.001>Math.abs(e))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)*f)/e;d=Math.sin(d*f)/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.Vertex.prototype={constructor:THREE.Vertex,clone:function(){return new THREE.Vertex(this.position.clone())}};THREE.Face3=function(a,b,c,d,e,f){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.materialIndex=f;this.centroid=new THREE.Vector3};
 THREE.Face3.prototype={constructor:THREE.Face3,clone:function(){var a=new THREE.Face3(this.a,this.b,this.c);a.normal.copy(this.normal);a.color.copy(this.color);a.centroid.copy(this.centroid);a.materialIndex=this.materialIndex;var b,c;for(b=0,c=this.vertexNormals.length;b<c;b++)a.vertexNormals[b]=this.vertexNormals[b].clone();for(b=0,c=this.vertexColors.length;b<c;b++)a.vertexColors[b]=this.vertexColors[b].clone();for(b=0,c=this.vertexTangents.length;b<c;b++)a.vertexTangents[b]=this.vertexTangents[b].clone();
@@ -94,29 +94,31 @@ h=new THREE.Vector3;for(a=0,b=this.faces.length;a<b;a++)c=this.faces[a],d=this.v
 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;for(a=0,b=this.vertices.length;a<b;a++)d[a].set(0,0,0)}for(a=0,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));for(a=0,b=this.vertices.length;a<b;a++)d[a].normalize();for(a=0,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]))},computeMorphNormals:function(){var a,b,c,d,e;for(c=0,d=this.faces.length;c<
 d;c++){e=this.faces[c];e.__originalFaceNormal?e.__originalFaceNormal.copy(e.normal):e.__originalFaceNormal=e.normal.clone();if(!e.__originalVertexNormals)e.__originalVertexNormals=[];for(a=0,b=e.vertexNormals.length;a<b;a++)e.__originalVertexNormals[a]?e.__originalVertexNormals[a].copy(e.vertexNormals[a]):e.__originalVertexNormals[a]=e.vertexNormals[a].clone()}var f=new THREE.Geometry;f.faces=this.faces;for(a=0,b=this.morphTargets.length;a<b;a++){if(!this.morphNormals[a]){this.morphNormals[a]={};
-this.morphNormals[a].faceNormals=[];this.morphNormals[a].vertexNormals=[];var g=this.morphNormals[a].faceNormals,h=this.morphNormals[a].vertexNormals,i,m;for(c=0,d=this.faces.length;c<d;c++)e=this.faces[c],i=new THREE.Vector3,m=e instanceof THREE.Face3?{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3}:{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3,d:new THREE.Vector3},g.push(i),h.push(m)}g=this.morphNormals[a];f.vertices=this.morphTargets[a].vertices;f.computeFaceNormals();
-f.computeVertexNormals();for(c=0,d=this.faces.length;c<d;c++)e=this.faces[c],i=g.faceNormals[c],m=g.vertexNormals[c],i.copy(e.normal),e instanceof THREE.Face3?(m.a.copy(e.vertexNormals[0]),m.b.copy(e.vertexNormals[1]),m.c.copy(e.vertexNormals[2])):(m.a.copy(e.vertexNormals[0]),m.b.copy(e.vertexNormals[1]),m.c.copy(e.vertexNormals[2]),m.d.copy(e.vertexNormals[3]))}for(c=0,d=this.faces.length;c<d;c++)e=this.faces[c],e.normal=e.__originalFaceNormal,e.vertexNormals=e.__originalVertexNormals},computeTangents:function(){function a(a,
-b,c,d,e,f,E){h=a.vertices[b].position;i=a.vertices[c].position;m=a.vertices[d].position;k=g[e];p=g[f];n=g[E];o=i.x-h.x;q=m.x-h.x;l=i.y-h.y;r=m.y-h.y;s=i.z-h.z;u=m.z-h.z;v=p.u-k.u;t=n.u-k.u;w=p.v-k.v;A=n.v-k.v;G=1/(v*A-t*w);O.set((A*o-w*q)*G,(A*l-w*r)*G,(A*s-w*u)*G);P.set((v*q-t*o)*G,(v*r-t*l)*G,(v*u-t*s)*G);D[b].addSelf(O);D[c].addSelf(O);D[d].addSelf(O);J[b].addSelf(P);J[c].addSelf(P);J[d].addSelf(P)}var b,c,d,e,f,g,h,i,m,k,p,n,o,q,l,r,s,u,v,t,w,A,G,F,D=[],J=[],O=new THREE.Vector3,P=new THREE.Vector3,
-U=new THREE.Vector3,L=new THREE.Vector3,I=new THREE.Vector3;for(b=0,c=this.vertices.length;b<c;b++)D[b]=new THREE.Vector3,J[b]=new THREE.Vector3;for(b=0,c=this.faces.length;b<c;b++)f=this.faces[b],g=this.faceVertexUvs[0][b],f instanceof THREE.Face3?a(this,f.a,f.b,f.c,0,1,2):f instanceof THREE.Face4&&(a(this,f.a,f.b,f.c,0,1,2),a(this,f.a,f.b,f.d,0,1,3));var M=["a","b","c","d"];for(b=0,c=this.faces.length;b<c;b++){f=this.faces[b];for(d=0;d<f.vertexNormals.length;d++)I.copy(f.vertexNormals[d]),e=f[M[d]],
-F=D[e],U.copy(F),U.subSelf(I.multiplyScalar(I.dot(F))).normalize(),L.cross(f.vertexNormals[d],F),e=L.dot(J[e]),e=0>e?-1:1,f.vertexTangents[d]=new THREE.Vector4(U.x,U.y,U.z,e)}this.hasTangents=!0},computeBoundingBox:function(){if(!this.boundingBox)this.boundingBox={min:new THREE.Vector3,max:new THREE.Vector3};if(0<this.vertices.length){var a;a=this.vertices[0].position;this.boundingBox.min.copy(a);this.boundingBox.max.copy(a);for(var b=this.boundingBox.min,c=this.boundingBox.max,d=1,e=this.vertices.length;d<
+this.morphNormals[a].faceNormals=[];this.morphNormals[a].vertexNormals=[];var g=this.morphNormals[a].faceNormals,h=this.morphNormals[a].vertexNormals,l,j;for(c=0,d=this.faces.length;c<d;c++)e=this.faces[c],l=new THREE.Vector3,j=e instanceof THREE.Face3?{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3}:{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3,d:new THREE.Vector3},g.push(l),h.push(j)}g=this.morphNormals[a];f.vertices=this.morphTargets[a].vertices;f.computeFaceNormals();
+f.computeVertexNormals();for(c=0,d=this.faces.length;c<d;c++)e=this.faces[c],l=g.faceNormals[c],j=g.vertexNormals[c],l.copy(e.normal),e instanceof THREE.Face3?(j.a.copy(e.vertexNormals[0]),j.b.copy(e.vertexNormals[1]),j.c.copy(e.vertexNormals[2])):(j.a.copy(e.vertexNormals[0]),j.b.copy(e.vertexNormals[1]),j.c.copy(e.vertexNormals[2]),j.d.copy(e.vertexNormals[3]))}for(c=0,d=this.faces.length;c<d;c++)e=this.faces[c],e.normal=e.__originalFaceNormal,e.vertexNormals=e.__originalVertexNormals},computeTangents:function(){function a(a,
+b,c,d,e,f,E){h=a.vertices[b].position;l=a.vertices[c].position;j=a.vertices[d].position;k=g[e];p=g[f];m=g[E];o=l.x-h.x;r=j.x-h.x;n=l.y-h.y;q=j.y-h.y;s=l.z-h.z;u=j.z-h.z;v=p.u-k.u;t=m.u-k.u;w=p.v-k.v;z=m.v-k.v;F=1/(v*z-t*w);N.set((z*o-w*r)*F,(z*n-w*q)*F,(z*s-w*u)*F);P.set((v*r-t*o)*F,(v*q-t*n)*F,(v*u-t*s)*F);G[b].addSelf(N);G[c].addSelf(N);G[d].addSelf(N);K[b].addSelf(P);K[c].addSelf(P);K[d].addSelf(P)}var b,c,d,e,f,g,h,l,j,k,p,m,o,r,n,q,s,u,v,t,w,z,F,C,G=[],K=[],N=new THREE.Vector3,P=new THREE.Vector3,
+T=new THREE.Vector3,O=new THREE.Vector3,J=new THREE.Vector3;for(b=0,c=this.vertices.length;b<c;b++)G[b]=new THREE.Vector3,K[b]=new THREE.Vector3;for(b=0,c=this.faces.length;b<c;b++)f=this.faces[b],g=this.faceVertexUvs[0][b],f instanceof THREE.Face3?a(this,f.a,f.b,f.c,0,1,2):f instanceof THREE.Face4&&(a(this,f.a,f.b,f.d,0,1,3),a(this,f.b,f.c,f.d,1,2,3));var I=["a","b","c","d"];for(b=0,c=this.faces.length;b<c;b++){f=this.faces[b];for(d=0;d<f.vertexNormals.length;d++)J.copy(f.vertexNormals[d]),e=f[I[d]],
+C=G[e],T.copy(C),T.subSelf(J.multiplyScalar(J.dot(C))).normalize(),O.cross(f.vertexNormals[d],C),e=O.dot(K[e]),e=0>e?-1:1,f.vertexTangents[d]=new THREE.Vector4(T.x,T.y,T.z,e)}this.hasTangents=!0},computeBoundingBox:function(){if(!this.boundingBox)this.boundingBox={min:new THREE.Vector3,max:new THREE.Vector3};if(0<this.vertices.length){var a;a=this.vertices[0].position;this.boundingBox.min.copy(a);this.boundingBox.max.copy(a);for(var b=this.boundingBox.min,c=this.boundingBox.max,d=1,e=this.vertices.length;d<
 e;d++){a=this.vertices[d].position;if(a.x<b.x)b.x=a.x;else if(a.x>c.x)c.x=a.x;if(a.y<b.y)b.y=a.y;else if(a.y>c.y)c.y=a.y;if(a.z<b.z)b.z=a.z;else if(a.z>c.z)c.z=a.z}}else this.boundingBox.min.set(0,0,0),this.boundingBox.max.set(0,0,0)},computeBoundingSphere:function(){if(!this.boundingSphere)this.boundingSphere={radius:0};for(var a,b=0,c=0,d=this.vertices.length;c<d;c++)a=this.vertices[c].position.length(),a>b&&(b=a);this.boundingSphere.radius=b},mergeVertices:function(){var a={},b=[],c=[],d,e=Math.pow(10,
 4),f,g;for(f=0,g=this.vertices.length;f<g;f++)d=this.vertices[f].position,d=[Math.round(d.x*e),Math.round(d.y*e),Math.round(d.z*e)].join("_"),void 0===a[d]?(a[d]=f,b.push(this.vertices[f]),c[f]=b.length-1):c[f]=c[a[d]];for(f=0,g=this.faces.length;f<g;f++)if(a=this.faces[f],a instanceof THREE.Face3)a.a=c[a.a],a.b=c[a.b],a.c=c[a.c];else 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.Spline=function(a){function b(a,b,c,d,e,f,g){a=0.5*(c-a);d=0.5*(d-b);return(2*(b-c)+a+d)*g+(-3*(b-c)-2*a-d)*f+a*e+b}this.points=a;var c=[],d={x:0,y:0,z:0},e,f,g,h,i,m,k,p,n;this.initFromArray=function(a){this.points=[];for(var b=0;b<a.length;b++)this.points[b]={x:a[b][0],y:a[b][1],z:a[b][2]}};this.getPoint=function(a){e=(this.points.length-1)*a;f=Math.floor(e);g=e-f;c[0]=0===f?f:f-1;c[1]=f;c[2]=f>this.points.length-2?this.points.length-1:f+1;c[3]=f>this.points.length-3?this.points.length-1:
-f+2;m=this.points[c[0]];k=this.points[c[1]];p=this.points[c[2]];n=this.points[c[3]];h=g*g;i=g*h;d.x=b(m.x,k.x,p.x,n.x,g,h,i);d.y=b(m.y,k.y,p.y,n.y,g,h,i);d.z=b(m.z,k.z,p.z,n.z,g,h,i);return d};this.getControlPointsArray=function(){var a,b,c=this.points.length,d=[];for(a=0;a<c;a++)b=this.points[a],d[a]=[b.x,b.y,b.z];return d};this.getLength=function(a){var b,c,d,e=b=b=0,f=new THREE.Vector3,g=new THREE.Vector3,h=[],i=0;h[0]=0;a||(a=100);c=this.points.length*a;f.copy(this.points[0]);for(a=1;a<c;a++)b=
-a/c,d=this.getPoint(b),g.copy(d),i+=g.distanceTo(f),f.copy(d),b*=this.points.length-1,b=Math.floor(b),b!=e&&(h[b]=i,e=b);h[h.length]=i;return{chunks:h,total:i}};this.reparametrizeByArcLength=function(a){var b,c,d,e,f,g,h=[],i=new THREE.Vector3,m=this.getLength();h.push(i.copy(this.points[0]).clone());for(b=1;b<this.points.length;b++){c=m.chunks[b]-m.chunks[b-1];g=Math.ceil(a*c/m.total);e=(b-1)/(this.points.length-1);f=b/(this.points.length-1);for(c=1;c<g-1;c++)d=e+c*(1/g)*(f-e),d=this.getPoint(d),
-h.push(i.copy(d).clone());h.push(i.copy(this.points[b]).clone())}this.points=h}};THREE.Camera=function(){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.getRotationFromMatrix(this.matrix)};
-THREE.OrthographicCamera=function(a,b,c,d,e,f){THREE.Camera.call(this);this.left=a;this.right=b;this.top=c;this.bottom=d;this.near=void 0!==e?e:0.1;this.far=void 0!==f?f: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.Spline=function(a){function b(a,b,c,d,e,f,g){a=0.5*(c-a);d=0.5*(d-b);return(2*(b-c)+a+d)*g+(-3*(b-c)-2*a-d)*f+a*e+b}this.points=a;var c=[],d={x:0,y:0,z:0},e,f,g,h,l,j,k,p,m;this.initFromArray=function(a){this.points=[];for(var b=0;b<a.length;b++)this.points[b]={x:a[b][0],y:a[b][1],z:a[b][2]}};this.getPoint=function(a){e=(this.points.length-1)*a;f=Math.floor(e);g=e-f;c[0]=0===f?f:f-1;c[1]=f;c[2]=f>this.points.length-2?this.points.length-1:f+1;c[3]=f>this.points.length-3?this.points.length-1:
+f+2;j=this.points[c[0]];k=this.points[c[1]];p=this.points[c[2]];m=this.points[c[3]];h=g*g;l=g*h;d.x=b(j.x,k.x,p.x,m.x,g,h,l);d.y=b(j.y,k.y,p.y,m.y,g,h,l);d.z=b(j.z,k.z,p.z,m.z,g,h,l);return d};this.getControlPointsArray=function(){var a,b,c=this.points.length,d=[];for(a=0;a<c;a++)b=this.points[a],d[a]=[b.x,b.y,b.z];return d};this.getLength=function(a){var b,c,d,e=b=b=0,f=new THREE.Vector3,g=new THREE.Vector3,h=[],l=0;h[0]=0;a||(a=100);c=this.points.length*a;f.copy(this.points[0]);for(a=1;a<c;a++)b=
+a/c,d=this.getPoint(b),g.copy(d),l+=g.distanceTo(f),f.copy(d),b*=this.points.length-1,b=Math.floor(b),b!=e&&(h[b]=l,e=b);h[h.length]=l;return{chunks:h,total:l}};this.reparametrizeByArcLength=function(a){var b,c,d,e,f,g,h=[],l=new THREE.Vector3,j=this.getLength();h.push(l.copy(this.points[0]).clone());for(b=1;b<this.points.length;b++){c=j.chunks[b]-j.chunks[b-1];g=Math.ceil(a*c/j.total);e=(b-1)/(this.points.length-1);f=b/(this.points.length-1);for(c=1;c<g-1;c++)d=e+c*(1/g)*(f-e),d=this.getPoint(d),
+h.push(l.copy(d).clone());h.push(l.copy(this.points[b]).clone())}this.points=h}};THREE.Camera=function(){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.getRotationFromMatrix(this.matrix)};
+THREE.OrthographicCamera=function(a,b,c,d,e,f){THREE.Camera.call(this);this.left=a;this.right=b;this.top=c;this.bottom=d;this.near=void 0!==e?e:0.1;this.far=void 0!==f?f:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=new THREE.Camera;THREE.OrthographicCamera.prototype.constructor=THREE.OrthographicCamera;THREE.OrthographicCamera.prototype.updateProjectionMatrix=function(){this.projectionMatrix.makeOrthographic(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=void 0!==a?a:50;this.aspect=void 0!==b?b:1;this.near=void 0!==c?c:0.1;this.far=void 0!==d?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((void 0!==b?b:24)/(2*a))*(180/Math.PI);this.updateProjectionMatrix()};
 THREE.PerspectiveCamera.prototype.setViewOffset=function(a,b,c,d,e,f){this.fullWidth=a;this.fullHeight=b;this.x=c;this.y=d;this.width=e;this.height=f;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.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.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.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.target=new THREE.Object3D;this.intensity=void 0!==b?b:1;this.distance=void 0!==c?c:0;this.onlyShadow=this.castShadow=!1;this.shadowCameraNear=50;this.shadowCameraFar=5E3;this.shadowCameraLeft=-500;this.shadowCameraTop=this.shadowCameraRight=500;this.shadowCameraBottom=-500;this.shadowCameraVisible=!1;this.shadowBias=0;this.shadowDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowCascade=
 !1;this.shadowCascadeOffset=new THREE.Vector3(0,0,-1E3);this.shadowCascadeCount=2;this.shadowCascadeBias=[0,0,0];this.shadowCascadeWidth=[512,512,512];this.shadowCascadeHeight=[512,512,512];this.shadowCascadeNearZ=[-1,0.99,0.998];this.shadowCascadeFarZ=[0.99,0.998,1];this.shadowCascadeArray=[];this.shadowMatrix=this.shadowCamera=this.shadowMapSize=this.shadowMap=null};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=void 0!==b?b:1;this.distance=void 0!==c?c:0};THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight;
 THREE.SpotLight=function(a,b,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.target=new THREE.Object3D;this.intensity=void 0!==b?b:1;this.distance=void 0!==c?c:0;this.onlyShadow=this.castShadow=!1;this.shadowCameraNear=50;this.shadowCameraFar=5E3;this.shadowCameraFov=50;this.shadowCameraVisible=!1;this.shadowBias=0;this.shadowDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowMatrix=this.shadowCamera=this.shadowMapSize=this.shadowMap=null};
 THREE.SpotLight.prototype=new THREE.Light;THREE.SpotLight.prototype.constructor=THREE.SpotLight;
-THREE.Material=function(a){a=a||{};this.id=THREE.MaterialCount++;this.name="";this.opacity=void 0!==a.opacity?a.opacity:1;this.transparent=void 0!==a.transparent?a.transparent:!1;this.blending=void 0!==a.blending?a.blending:THREE.NormalBlending;this.depthTest=void 0!==a.depthTest?a.depthTest:!0;this.depthWrite=void 0!==a.depthWrite?a.depthWrite:!0;this.polygonOffset=void 0!==a.polygonOffset?a.polygonOffset:!1;this.polygonOffsetFactor=void 0!==a.polygonOffsetFactor?a.polygonOffsetFactor:0;this.polygonOffsetUnits=
-void 0!==a.polygonOffsetUnits?a.polygonOffsetUnits:0;this.alphaTest=void 0!==a.alphaTest?a.alphaTest:0;this.overdraw=void 0!==a.overdraw?a.overdraw:!1;this.needsUpdate=!0};THREE.MaterialCount=0;THREE.NoShading=0;THREE.FlatShading=1;THREE.SmoothShading=2;THREE.NoColors=0;THREE.FaceColors=1;THREE.VertexColors=2;THREE.NoBlending=0;THREE.NormalBlending=1;THREE.AdditiveBlending=2;THREE.SubtractiveBlending=3;THREE.MultiplyBlending=4;THREE.AdditiveAlphaBlending=5;
+THREE.Material=function(a){a=a||{};this.id=THREE.MaterialCount++;this.name="";this.opacity=void 0!==a.opacity?a.opacity:1;this.transparent=void 0!==a.transparent?a.transparent:!1;this.blending=void 0!==a.blending?a.blending:THREE.NormalBlending;this.blendSrc=void 0!==a.blendSrc?a.blendSrc:THREE.SrcAlphaFactor;this.blendDst=void 0!==a.blendDst?a.blendDst:THREE.OneMinusSrcAlphaFactor;this.blendEquation=void 0!==a.blendEquation?a.blendEquation:THREE.AddEquation;this.depthTest=void 0!==a.depthTest?a.depthTest:
+!0;this.depthWrite=void 0!==a.depthWrite?a.depthWrite:!0;this.polygonOffset=void 0!==a.polygonOffset?a.polygonOffset:!1;this.polygonOffsetFactor=void 0!==a.polygonOffsetFactor?a.polygonOffsetFactor:0;this.polygonOffsetUnits=void 0!==a.polygonOffsetUnits?a.polygonOffsetUnits:0;this.alphaTest=void 0!==a.alphaTest?a.alphaTest:0;this.overdraw=void 0!==a.overdraw?a.overdraw:!1;this.needsUpdate=!0};THREE.MaterialCount=0;THREE.NoShading=0;THREE.FlatShading=1;THREE.SmoothShading=2;THREE.NoColors=0;
+THREE.FaceColors=1;THREE.VertexColors=2;THREE.NoBlending=0;THREE.NormalBlending=1;THREE.AdditiveBlending=2;THREE.SubtractiveBlending=3;THREE.MultiplyBlending=4;THREE.AdditiveAlphaBlending=5;THREE.CustomBlending=6;THREE.AddEquation=100;THREE.SubtractEquation=101;THREE.ReverseSubtractEquation=102;THREE.ZeroFactor=200;THREE.OneFactor=201;THREE.SrcColorFactor=202;THREE.OneMinusSrcColorFactor=203;THREE.SrcAlphaFactor=204;THREE.OneMinusSrcAlphaFactor=205;THREE.DstAlphaFactor=206;
+THREE.OneMinusDstAlphaFactor=207;THREE.DstColorFactor=208;THREE.OneMinusDstColorFactor=209;THREE.SrcAlphaSaturateFactor=210;
 THREE.LineBasicMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=void 0!==a.color?new THREE.Color(a.color):new THREE.Color(16777215);this.linewidth=void 0!==a.linewidth?a.linewidth:1;this.linecap=void 0!==a.linecap?a.linecap:"round";this.linejoin=void 0!==a.linejoin?a.linejoin:"round";this.vertexColors=a.vertexColors?a.vertexColors:!1;this.fog=void 0!==a.fog?a.fog:!0};THREE.LineBasicMaterial.prototype=new THREE.Material;THREE.LineBasicMaterial.prototype.constructor=THREE.LineBasicMaterial;
 THREE.MeshBasicMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=void 0!==a.color?new THREE.Color(a.color):new THREE.Color(16777215);this.map=void 0!==a.map?a.map:null;this.lightMap=void 0!==a.lightMap?a.lightMap:null;this.envMap=void 0!==a.envMap?a.envMap:null;this.combine=void 0!==a.combine?a.combine:THREE.MultiplyOperation;this.reflectivity=void 0!==a.reflectivity?a.reflectivity:1;this.refractionRatio=void 0!==a.refractionRatio?a.refractionRatio:0.98;this.fog=void 0!==a.fog?a.fog:
 !0;this.shading=void 0!==a.shading?a.shading:THREE.SmoothShading;this.wireframe=void 0!==a.wireframe?a.wireframe:!1;this.wireframeLinewidth=void 0!==a.wireframeLinewidth?a.wireframeLinewidth:1;this.wireframeLinecap=void 0!==a.wireframeLinecap?a.wireframeLinecap:"round";this.wireframeLinejoin=void 0!==a.wireframeLinejoin?a.wireframeLinejoin:"round";this.vertexColors=void 0!==a.vertexColors?a.vertexColors:THREE.NoColors;this.skinning=void 0!==a.skinning?a.skinning:!1;this.morphTargets=void 0!==a.morphTargets?
@@ -134,9 +136,9 @@ THREE.ParticleCanvasMaterial=function(a){THREE.Material.call(this,a);a=a||{};thi
 THREE.ShaderMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.fragmentShader=void 0!==a.fragmentShader?a.fragmentShader:"void main() {}";this.vertexShader=void 0!==a.vertexShader?a.vertexShader:"void main() {}";this.uniforms=void 0!==a.uniforms?a.uniforms:{};this.attributes=a.attributes;this.shading=void 0!==a.shading?a.shading:THREE.SmoothShading;this.wireframe=void 0!==a.wireframe?a.wireframe:!1;this.wireframeLinewidth=void 0!==a.wireframeLinewidth?a.wireframeLinewidth:1;this.fog=void 0!==
 a.fog?a.fog:!1;this.lights=void 0!==a.lights?a.lights:!1;this.vertexColors=void 0!==a.vertexColors?a.vertexColors:THREE.NoColors;this.skinning=void 0!==a.skinning?a.skinning:!1;this.morphTargets=void 0!==a.morphTargets?a.morphTargets:!1;this.morphNormals=void 0!==a.morphNormals?a.morphNormals:!1};THREE.ShaderMaterial.prototype=new THREE.Material;THREE.ShaderMaterial.prototype.constructor=THREE.ShaderMaterial;
 THREE.Texture=function(a,b,c,d,e,f,g,h){this.id=THREE.TextureCount++;this.image=a;this.mapping=void 0!==b?b:new THREE.UVMapping;this.wrapS=void 0!==c?c:THREE.ClampToEdgeWrapping;this.wrapT=void 0!==d?d:THREE.ClampToEdgeWrapping;this.magFilter=void 0!==e?e:THREE.LinearFilter;this.minFilter=void 0!==f?f:THREE.LinearMipMapLinearFilter;this.format=void 0!==g?g:THREE.RGBAFormat;this.type=void 0!==h?h:THREE.UnsignedByteType;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.generateMipmaps=
-!0;this.needsUpdate=!1;this.onUpdate=null};THREE.Texture.prototype={constructor:THREE.Texture,clone:function(){var a=new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter,this.format,this.type);a.offset.copy(this.offset);a.repeat.copy(this.repeat);return a}};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(a,b,c,d,e,f,g,h,i,m){THREE.Texture.call(this,null,f,g,h,i,m,d,e);this.image={data:a,width:b,height:c}};THREE.DataTexture.prototype=new THREE.Texture;THREE.DataTexture.prototype.constructor=THREE.DataTexture;
+!0;this.needsUpdate=this.premultiplyAlpha=!1;this.onUpdate=null};THREE.Texture.prototype={constructor:THREE.Texture,clone:function(){var a=new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter,this.format,this.type);a.offset.copy(this.offset);a.repeat.copy(this.repeat);return a}};THREE.TextureCount=0;THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.UVMapping=function(){};THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};
+THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=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(a,b,c,d,e,f,g,h,l,j){THREE.Texture.call(this,null,f,g,h,l,j,d,e);this.image={data:a,width:b,height:c}};THREE.DataTexture.prototype=new THREE.Texture;THREE.DataTexture.prototype.constructor=THREE.DataTexture;
 THREE.DataTexture.prototype.clone=function(){var a=new THREE.DataTexture(this.image.data,this.image.width,this.image.height,this.format,this.type,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter);a.offset.copy(this.offset);a.repeat.copy(this.repeat);return a};THREE.Particle=function(a){THREE.Object3D.call(this);this.material=a};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;
 THREE.ParticleSystem=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material=void 0!==b?b:new THREE.ParticleBasicMaterial({color:16777215*Math.random()});this.sortParticles=!1;if(this.geometry)this.geometry.boundingSphere||this.geometry.computeBoundingSphere(),this.boundRadius=a.boundingSphere.radius;this.frustumCulled=!1};THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem;
 THREE.Line=function(a,b,c){THREE.Object3D.call(this);this.geometry=a;this.material=void 0!==b?b:new THREE.LineBasicMaterial({color:16777215*Math.random()});this.type=void 0!==c?c:THREE.LineStrip;this.geometry&&(this.geometry.boundingSphere||this.geometry.computeBoundingSphere())};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;
@@ -158,56 +160,56 @@ THREE.MorphAnimMesh.prototype.updateAnimation=function(a){var b=this.duration/th
 0,this.morphTargetInfluences[this.currentKeyframe]=1,this.morphTargetInfluences[a]=0,this.lastKeyframe=this.currentKeyframe,this.currentKeyframe=a;b=this.time%b/b;this.directionBackwards&&(b=1-b);this.morphTargetInfluences[this.currentKeyframe]=b;this.morphTargetInfluences[this.lastKeyframe]=1-b};THREE.Ribbon=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material=b};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(a,b){void 0===b&&(b=0);for(var b=Math.abs(b),c=0;c<this.LODs.length&&!(b<this.LODs[c].visibleAtDistance);c++);this.LODs.splice(c,0,{visibleAtDistance:b,object3D:a});this.add(a)};
 THREE.LOD.prototype.update=function(a){if(1<this.LODs.length){a.matrixWorldInverse.getInverse(a.matrixWorld);a=a.matrixWorldInverse;a=-(a.n31*this.matrixWorld.n14+a.n32*this.matrixWorld.n24+a.n33*this.matrixWorld.n34+a.n34);this.LODs[0].object3D.visible=!0;for(var b=1;b<this.LODs.length;b++)if(a>=this.LODs[b].visibleAtDistance)this.LODs[b-1].object3D.visible=!1,this.LODs[b].object3D.visible=!0;else break;for(;b<this.LODs.length;b++)this.LODs[b].object3D.visible=!1}};
-THREE.Sprite=function(a){THREE.Object3D.call(this);this.color=void 0!==a.color?new THREE.Color(a.color):new THREE.Color(16777215);this.map=void 0!==a.map?a.map:new THREE.Texture;this.blending=void 0!==a.blending?a.blending:THREE.NormalBlending;this.useScreenCoordinates=void 0!==a.useScreenCoordinates?a.useScreenCoordinates:!0;this.mergeWith3D=void 0!==a.mergeWith3D?a.mergeWith3D:!this.useScreenCoordinates;this.affectedByDistance=void 0!==a.affectedByDistance?a.affectedByDistance:!this.useScreenCoordinates;
-this.scaleByViewport=void 0!==a.scaleByViewport?a.scaleByViewport:!this.affectedByDistance;this.alignment=a.alignment instanceof THREE.Vector2?a.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.updateMatrix=function(){this.matrix.setPosition(this.position);this.rotation3d.set(0,0,this.rotation);this.matrix.setRotationFromEuler(this.rotation3d);if(1!==this.scale.x||1!==this.scale.y)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.overrideMaterial=this.fog=null;this.matrixAutoUpdate=!1;this.__objects=[];this.__lights=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;
+THREE.Sprite=function(a){THREE.Object3D.call(this);this.color=void 0!==a.color?new THREE.Color(a.color):new THREE.Color(16777215);this.map=void 0!==a.map?a.map:new THREE.Texture;this.blending=void 0!==a.blending?a.blending:THREE.NormalBlending;this.blendSrc=void 0!==a.blendSrc?a.blendSrc:THREE.SrcAlphaFactor;this.blendDst=void 0!==a.blendDst?a.blendDst:THREE.OneMinusSrcAlphaFactor;this.blendEquation=void 0!==a.blendEquation?a.blendEquation:THREE.AddEquation;this.useScreenCoordinates=void 0!==a.useScreenCoordinates?
+a.useScreenCoordinates:!0;this.mergeWith3D=void 0!==a.mergeWith3D?a.mergeWith3D:!this.useScreenCoordinates;this.affectedByDistance=void 0!==a.affectedByDistance?a.affectedByDistance:!this.useScreenCoordinates;this.scaleByViewport=void 0!==a.scaleByViewport?a.scaleByViewport:!this.affectedByDistance;this.alignment=a.alignment instanceof THREE.Vector2?a.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.updateMatrix=function(){this.matrix.setPosition(this.position);this.rotation3d.set(0,0,this.rotation);this.matrix.setRotationFromEuler(this.rotation3d);if(1!==this.scale.x||1!==this.scale.y)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.overrideMaterial=this.fog=null;this.matrixAutoUpdate=!1;this.__objects=[];this.__lights=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;
 THREE.Scene.prototype.__addObject=function(a){if(a instanceof THREE.Light)-1===this.__lights.indexOf(a)&&this.__lights.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&-1===this.__objects.indexOf(a)){this.__objects.push(a);this.__objectsAdded.push(a);var b=this.__objectsRemoved.indexOf(a);-1!==b&&this.__objectsRemoved.splice(b,1)}for(b=0;b<a.children.length;b++)this.__addObject(a.children[b])};
 THREE.Scene.prototype.__removeObject=function(a){if(a instanceof THREE.Light){var b=this.__lights.indexOf(a);-1!==b&&this.__lights.splice(b,1)}else a instanceof THREE.Camera||(b=this.__objects.indexOf(a),-1!==b&&(this.__objects.splice(b,1),this.__objectsRemoved.push(a),b=this.__objectsAdded.indexOf(a),-1!==b&&this.__objectsAdded.splice(b,1)));for(b=0;b<a.children.length;b++)this.__removeObject(a.children[b])};
 THREE.Fog=function(a,b,c){this.color=new THREE.Color(a);this.near=void 0!==b?b:1;this.far=void 0!==c?c:1E3};THREE.FogExp2=function(a,b){this.color=new THREE.Color(a);this.density=void 0!==b?b:2.5E-4};
-THREE.DOMRenderer=function(){var a,b,c,d,e,f,g,h=new THREE.Projector;g=function(a){for(var b=document.documentElement,c=0;c<a.length;c++)if("string"===typeof b.style[a[c]])return a[c];return null}(["transform","MozTransform","WebkitTransform","msTransform","OTransform"]);this.domElement=document.createElement("div");this.setSize=function(a,b){c=a;d=b;e=c/2;f=d/2};this.render=function(c,d){var k,p,n,o,q,l;a=h.projectScene(c,d);b=a.elements;for(k=0,p=b.length;k<p;k++)if(n=b[k],n instanceof THREE.RenderableParticle&&
-n.material instanceof THREE.ParticleDOMMaterial)o=n.material.domElement,q=n.x*e+e-(o.offsetWidth>>1),l=n.y*f+f-(o.offsetHeight>>1),o.style.left=q+"px",o.style.top=l+"px",o.style.zIndex=Math.abs(Math.floor((1-n.z)*d.far/d.near)),g&&(o.style[g]="scale("+n.scale.x*e+","+n.scale.y*f+")")}};
-THREE.CanvasRenderer=function(a){function b(a){if(u!=a)l.globalAlpha=u=a}function c(a){if(v!=a){switch(a){case THREE.NormalBlending:l.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:l.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:l.globalCompositeOperation="darker"}v=a}}function d(a){if(t!=a)l.strokeStyle=t=a}function e(a){if(w!=a)l.fillStyle=w=a}var a=a||{},f=this,g,h,i,m=new THREE.Projector,k=void 0!==a.canvas?a.canvas:document.createElement("canvas"),
-p,n,o,q,l=k.getContext("2d"),r=new THREE.Color(0),s=0,u=1,v=0,t=null,w=null,A=null,G=null,F=null,D,J,O,P,U=new THREE.RenderableVertex,L=new THREE.RenderableVertex,I,M,B,j,T,C,z,R,E,ga,ea,ca,S=new THREE.Color,Q=new THREE.Color,W=new THREE.Color,aa=new THREE.Color,ia=new THREE.Color,Sa=[],na=[],Ka,Aa,Ba,ra,bb,jb,Va,cb,eb,db,Ga=new THREE.Rectangle,oa=new THREE.Rectangle,Ca=new THREE.Rectangle,Oa=!1,sa=new THREE.Color,Wa=new THREE.Color,mb=new THREE.Color,ba=new THREE.Vector3,X,Fb,Tc,fb,pc,Cc,a=16;X=
-document.createElement("canvas");X.width=X.height=2;Fb=X.getContext("2d");Fb.fillStyle="rgba(0,0,0,1)";Fb.fillRect(0,0,2,2);Tc=Fb.getImageData(0,0,2,2);fb=Tc.data;pc=document.createElement("canvas");pc.width=pc.height=a;Cc=pc.getContext("2d");Cc.translate(-a/2,-a/2);Cc.scale(a,a);a--;this.domElement=k;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setSize=function(a,b){p=a;n=b;o=Math.floor(p/2);q=Math.floor(n/2);k.width=p;k.height=n;Ga.set(-o,-q,
-o,q);oa.set(-o,-q,o,q);u=1;v=0;F=G=A=w=t=null};this.setClearColor=function(a,b){r.copy(a);s=b;oa.set(-o,-q,o,q)};this.setClearColorHex=function(a,b){r.setHex(a);s=b;oa.set(-o,-q,o,q)};this.clear=function(){l.setTransform(1,0,0,-1,o,q);oa.isEmpty()||(oa.minSelf(Ga),oa.inflate(2),1>s&&l.clearRect(Math.floor(oa.getX()),Math.floor(oa.getY()),Math.floor(oa.getWidth()),Math.floor(oa.getHeight())),0<s&&(c(THREE.NormalBlending),b(1),e("rgba("+Math.floor(255*r.r)+","+Math.floor(255*r.g)+","+Math.floor(255*
-r.b)+","+s+")"),l.fillRect(Math.floor(oa.getX()),Math.floor(oa.getY()),Math.floor(oa.getWidth()),Math.floor(oa.getHeight()))),oa.empty())};this.render=function(a,k){function n(a){var b,c,d,e;sa.setRGB(0,0,0);Wa.setRGB(0,0,0);mb.setRGB(0,0,0);for(b=0,c=a.length;b<c;b++)d=a[b],e=d.color,d instanceof THREE.AmbientLight?(sa.r+=e.r,sa.g+=e.g,sa.b+=e.b):d instanceof THREE.DirectionalLight?(Wa.r+=e.r,Wa.g+=e.g,Wa.b+=e.b):d instanceof THREE.PointLight&&(mb.r+=e.r,mb.g+=e.g,mb.b+=e.b)}function p(a,b,c,d){var e,
-f,g,h,j,X;for(e=0,f=a.length;e<f;e++)g=a[e],h=g.color,g instanceof THREE.DirectionalLight?(j=g.matrixWorld.getPosition(),X=c.dot(j),0>=X||(X*=g.intensity,d.r+=h.r*X,d.g+=h.g*X,d.b+=h.b*X)):g instanceof THREE.PointLight&&(j=g.matrixWorld.getPosition(),X=c.dot(ba.sub(j,b).normalize()),0>=X||(X*=0==g.distance?1:1-Math.min(b.distanceTo(j)/g.distance,1),0!=X&&(X*=g.intensity,d.r+=h.r*X,d.g+=h.g*X,d.b+=h.b*X)))}function r(a,f,g){b(g.opacity);c(g.blending);var ba,h,j,X,i,m;if(g instanceof THREE.ParticleBasicMaterial){if(g.map)X=
-g.map.image,i=X.width>>1,m=X.height>>1,g=f.scale.x*o,j=f.scale.y*q,ba=g*i,h=j*m,Ca.set(a.x-ba,a.y-h,a.x+ba,a.y+h),Ga.intersects(Ca)&&(l.save(),l.translate(a.x,a.y),l.rotate(-f.rotation),l.scale(g,-j),l.translate(-i,-m),l.drawImage(X,0,0),l.restore())}else g instanceof THREE.ParticleCanvasMaterial&&(ba=f.scale.x*o,h=f.scale.y*q,Ca.set(a.x-ba,a.y-h,a.x+ba,a.y+h),Ga.intersects(Ca)&&(d(g.color.getContextStyle()),e(g.color.getContextStyle()),l.save(),l.translate(a.x,a.y),l.rotate(-f.rotation),l.scale(ba,
-h),g.program(l),l.restore()))}function s(a,e,f,g){b(g.opacity);c(g.blending);l.beginPath();l.moveTo(a.positionScreen.x,a.positionScreen.y);l.lineTo(e.positionScreen.x,e.positionScreen.y);l.closePath();if(g instanceof THREE.LineBasicMaterial){a=g.linewidth;if(A!=a)l.lineWidth=A=a;a=g.linecap;if(G!=a)l.lineCap=G=a;a=g.linejoin;if(F!=a)l.lineJoin=F=a;d(g.color.getContextStyle());l.stroke();Ca.inflate(2*g.linewidth)}}function t(a,d,e,g,h,X,m,l){f.info.render.vertices+=3;f.info.render.faces++;b(l.opacity);
-c(l.blending);I=a.positionScreen.x;M=a.positionScreen.y;B=d.positionScreen.x;j=d.positionScreen.y;T=e.positionScreen.x;C=e.positionScreen.y;u(I,M,B,j,T,C);if(l instanceof THREE.MeshBasicMaterial)if(l.map)l.map.mapping instanceof THREE.UVMapping&&(ra=m.uvs[0],Uc(I,M,B,j,T,C,ra[g].u,ra[g].v,ra[h].u,ra[h].v,ra[X].u,ra[X].v,l.map));else if(l.envMap){if(l.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=k.matrixWorldInverse,ba.copy(m.vertexNormalsWorld[g]),bb=0.5*(ba.x*a.n11+ba.y*a.n12+ba.z*
-a.n13)+0.5,jb=0.5*-(ba.x*a.n21+ba.y*a.n22+ba.z*a.n23)+0.5,ba.copy(m.vertexNormalsWorld[h]),Va=0.5*(ba.x*a.n11+ba.y*a.n12+ba.z*a.n13)+0.5,cb=0.5*-(ba.x*a.n21+ba.y*a.n22+ba.z*a.n23)+0.5,ba.copy(m.vertexNormalsWorld[X]),eb=0.5*(ba.x*a.n11+ba.y*a.n12+ba.z*a.n13)+0.5,db=0.5*-(ba.x*a.n21+ba.y*a.n22+ba.z*a.n23)+0.5,Uc(I,M,B,j,T,C,bb,jb,Va,cb,eb,db,l.envMap)}else l.wireframe?Mb(l.color,l.wireframeLinewidth,l.wireframeLinecap,l.wireframeLinejoin):Gb(l.color);else if(l instanceof THREE.MeshLambertMaterial)l.map&&
-!l.wireframe&&(l.map.mapping instanceof THREE.UVMapping&&(ra=m.uvs[0],Uc(I,M,B,j,T,C,ra[g].u,ra[g].v,ra[h].u,ra[h].v,ra[X].u,ra[X].v,l.map)),c(THREE.SubtractiveBlending)),Oa?!l.wireframe&&l.shading==THREE.SmoothShading&&3==m.vertexNormalsWorld.length?(Q.r=W.r=aa.r=sa.r,Q.g=W.g=aa.g=sa.g,Q.b=W.b=aa.b=sa.b,p(i,m.v1.positionWorld,m.vertexNormalsWorld[0],Q),p(i,m.v2.positionWorld,m.vertexNormalsWorld[1],W),p(i,m.v3.positionWorld,m.vertexNormalsWorld[2],aa),Q.r=Math.max(0,Math.min(l.color.r*Q.r,1)),Q.g=
-Math.max(0,Math.min(l.color.g*Q.g,1)),Q.b=Math.max(0,Math.min(l.color.b*Q.b,1)),W.r=Math.max(0,Math.min(l.color.r*W.r,1)),W.g=Math.max(0,Math.min(l.color.g*W.g,1)),W.b=Math.max(0,Math.min(l.color.b*W.b,1)),aa.r=Math.max(0,Math.min(l.color.r*aa.r,1)),aa.g=Math.max(0,Math.min(l.color.g*aa.g,1)),aa.b=Math.max(0,Math.min(l.color.b*aa.b,1)),ia.r=0.5*(W.r+aa.r),ia.g=0.5*(W.g+aa.g),ia.b=0.5*(W.b+aa.b),Ba=Dc(Q,W,aa,ia),gc(I,M,B,j,T,C,0,0,1,0,0,1,Ba)):(S.r=sa.r,S.g=sa.g,S.b=sa.b,p(i,m.centroidWorld,m.normalWorld,
-S),S.r=Math.max(0,Math.min(l.color.r*S.r,1)),S.g=Math.max(0,Math.min(l.color.g*S.g,1)),S.b=Math.max(0,Math.min(l.color.b*S.b,1)),l.wireframe?Mb(S,l.wireframeLinewidth,l.wireframeLinecap,l.wireframeLinejoin):Gb(S)):l.wireframe?Mb(l.color,l.wireframeLinewidth,l.wireframeLinecap,l.wireframeLinejoin):Gb(l.color);else if(l instanceof THREE.MeshDepthMaterial)Ka=k.near,Aa=k.far,Q.r=Q.g=Q.b=1-ac(a.positionScreen.z,Ka,Aa),W.r=W.g=W.b=1-ac(d.positionScreen.z,Ka,Aa),aa.r=aa.g=aa.b=1-ac(e.positionScreen.z,Ka,
-Aa),ia.r=0.5*(W.r+aa.r),ia.g=0.5*(W.g+aa.g),ia.b=0.5*(W.b+aa.b),Ba=Dc(Q,W,aa,ia),gc(I,M,B,j,T,C,0,0,1,0,0,1,Ba);else if(l instanceof THREE.MeshNormalMaterial)S.r=hc(m.normalWorld.x),S.g=hc(m.normalWorld.y),S.b=hc(m.normalWorld.z),l.wireframe?Mb(S,l.wireframeLinewidth,l.wireframeLinecap,l.wireframeLinejoin):Gb(S)}function v(a,d,e,g,h,ba,X,l,m){f.info.render.vertices+=4;f.info.render.faces++;b(l.opacity);c(l.blending);if(l.map||l.envMap)t(a,d,g,0,1,3,X,l,m),t(h,e,ba,1,2,3,X,l,m);else if(I=a.positionScreen.x,
-M=a.positionScreen.y,B=d.positionScreen.x,j=d.positionScreen.y,T=e.positionScreen.x,C=e.positionScreen.y,z=g.positionScreen.x,R=g.positionScreen.y,E=h.positionScreen.x,ga=h.positionScreen.y,ea=ba.positionScreen.x,ca=ba.positionScreen.y,l instanceof THREE.MeshBasicMaterial)w(I,M,B,j,T,C,z,R),l.wireframe?Mb(l.color,l.wireframeLinewidth,l.wireframeLinecap,l.wireframeLinejoin):Gb(l.color);else if(l instanceof THREE.MeshLambertMaterial)Oa?!l.wireframe&&l.shading==THREE.SmoothShading&&4==X.vertexNormalsWorld.length?
-(Q.r=W.r=aa.r=ia.r=sa.r,Q.g=W.g=aa.g=ia.g=sa.g,Q.b=W.b=aa.b=ia.b=sa.b,p(i,X.v1.positionWorld,X.vertexNormalsWorld[0],Q),p(i,X.v2.positionWorld,X.vertexNormalsWorld[1],W),p(i,X.v4.positionWorld,X.vertexNormalsWorld[3],aa),p(i,X.v3.positionWorld,X.vertexNormalsWorld[2],ia),Q.r=Math.max(0,Math.min(l.color.r*Q.r,1)),Q.g=Math.max(0,Math.min(l.color.g*Q.g,1)),Q.b=Math.max(0,Math.min(l.color.b*Q.b,1)),W.r=Math.max(0,Math.min(l.color.r*W.r,1)),W.g=Math.max(0,Math.min(l.color.g*W.g,1)),W.b=Math.max(0,Math.min(l.color.b*
-W.b,1)),aa.r=Math.max(0,Math.min(l.color.r*aa.r,1)),aa.g=Math.max(0,Math.min(l.color.g*aa.g,1)),aa.b=Math.max(0,Math.min(l.color.b*aa.b,1)),ia.r=Math.max(0,Math.min(l.color.r*ia.r,1)),ia.g=Math.max(0,Math.min(l.color.g*ia.g,1)),ia.b=Math.max(0,Math.min(l.color.b*ia.b,1)),Ba=Dc(Q,W,aa,ia),u(I,M,B,j,z,R),gc(I,M,B,j,z,R,0,0,1,0,0,1,Ba),u(E,ga,T,C,ea,ca),gc(E,ga,T,C,ea,ca,1,0,1,1,0,1,Ba)):(S.r=sa.r,S.g=sa.g,S.b=sa.b,p(i,X.centroidWorld,X.normalWorld,S),S.r=Math.max(0,Math.min(l.color.r*S.r,1)),S.g=Math.max(0,
-Math.min(l.color.g*S.g,1)),S.b=Math.max(0,Math.min(l.color.b*S.b,1)),w(I,M,B,j,T,C,z,R),l.wireframe?Mb(S,l.wireframeLinewidth,l.wireframeLinecap,l.wireframeLinejoin):Gb(S)):(w(I,M,B,j,T,C,z,R),l.wireframe?Mb(l.color,l.wireframeLinewidth,l.wireframeLinecap,l.wireframeLinejoin):Gb(l.color));else if(l instanceof THREE.MeshNormalMaterial)S.r=hc(X.normalWorld.x),S.g=hc(X.normalWorld.y),S.b=hc(X.normalWorld.z),w(I,M,B,j,T,C,z,R),l.wireframe?Mb(S,l.wireframeLinewidth,l.wireframeLinecap,l.wireframeLinejoin):
-Gb(S);else if(l instanceof THREE.MeshDepthMaterial)Ka=k.near,Aa=k.far,Q.r=Q.g=Q.b=1-ac(a.positionScreen.z,Ka,Aa),W.r=W.g=W.b=1-ac(d.positionScreen.z,Ka,Aa),aa.r=aa.g=aa.b=1-ac(g.positionScreen.z,Ka,Aa),ia.r=ia.g=ia.b=1-ac(e.positionScreen.z,Ka,Aa),Ba=Dc(Q,W,aa,ia),u(I,M,B,j,z,R),gc(I,M,B,j,z,R,0,0,1,0,0,1,Ba),u(E,ga,T,C,ea,ca),gc(E,ga,T,C,ea,ca,1,0,1,1,0,1,Ba)}function u(a,b,c,d,e,f){l.beginPath();l.moveTo(a,b);l.lineTo(c,d);l.lineTo(e,f);l.lineTo(a,b);l.closePath()}function w(a,b,c,d,e,f,g,h){l.beginPath();
-l.moveTo(a,b);l.lineTo(c,d);l.lineTo(e,f);l.lineTo(g,h);l.lineTo(a,b);l.closePath()}function Mb(a,b,c,e){if(A!=b)l.lineWidth=A=b;if(G!=c)l.lineCap=G=c;if(F!=e)l.lineJoin=F=e;d(a.getContextStyle());l.stroke();Ca.inflate(2*b)}function Gb(a){e(a.getContextStyle());l.fill()}function Uc(a,b,c,d,f,g,h,ba,X,j,i,m,k){if(0!=k.image.width){if(!0==k.needsUpdate||void 0==Sa[k.id]){var n=k.wrapS==THREE.RepeatWrapping,o=k.wrapT==THREE.RepeatWrapping;Sa[k.id]=l.createPattern(k.image,n&&o?"repeat":n&&!o?"repeat-x":
-!n&&o?"repeat-y":"no-repeat");k.needsUpdate=!1}e(Sa[k.id]);var n=k.offset.x/k.repeat.x,o=k.offset.y/k.repeat.y,Fb=k.image.width*k.repeat.x,p=k.image.height*k.repeat.y,h=(h+n)*Fb,ba=(ba+o)*p,c=c-a,d=d-b,f=f-a,g=g-b,X=(X+n)*Fb-h,j=(j+o)*p-ba,i=(i+n)*Fb-h,m=(m+o)*p-ba,n=X*m-i*j;if(0==n){if(void 0===na[k.id])b=document.createElement("canvas"),b.width=k.image.width,b.height=k.image.height,b=b.getContext("2d"),b.drawImage(k.image,0,0),na[k.id]=b.getImageData(0,0,k.image.width,k.image.height).data;b=na[k.id];
-h=4*(Math.floor(h)+Math.floor(ba)*k.image.width);S.setRGB(b[h]/255,b[h+1]/255,b[h+2]/255);Gb(S)}else n=1/n,k=(m*c-j*f)*n,j=(m*d-j*g)*n,c=(X*f-i*c)*n,d=(X*g-i*d)*n,a=a-k*h-c*ba,h=b-j*h-d*ba,l.save(),l.transform(k,j,c,d,a,h),l.fill(),l.restore()}}function gc(a,b,c,d,e,f,g,h,ba,X,j,i,m){var k,n;k=m.width-1;n=m.height-1;g*=k;h*=n;c-=a;d-=b;e-=a;f-=b;ba=ba*k-g;X=X*n-h;j=j*k-g;i=i*n-h;n=1/(ba*i-j*X);k=(i*c-X*e)*n;X=(i*d-X*f)*n;c=(ba*e-j*c)*n;d=(ba*f-j*d)*n;a=a-k*g-c*h;b=b-X*g-d*h;l.save();l.transform(k,
-X,c,d,a,b);l.clip();l.drawImage(m,0,0);l.restore()}function Dc(a,b,c,d){var e=~~(255*a.r),f=~~(255*a.g),a=~~(255*a.b),g=~~(255*b.r),h=~~(255*b.g),b=~~(255*b.b),ba=~~(255*c.r),j=~~(255*c.g),c=~~(255*c.b),l=~~(255*d.r),i=~~(255*d.g),d=~~(255*d.b);fb[0]=0>e?0:255<e?255:e;fb[1]=0>f?0:255<f?255:f;fb[2]=0>a?0:255<a?255:a;fb[4]=0>g?0:255<g?255:g;fb[5]=0>h?0:255<h?255:h;fb[6]=0>b?0:255<b?255:b;fb[8]=0>ba?0:255<ba?255:ba;fb[9]=0>j?0:255<j?255:j;fb[10]=0>c?0:255<c?255:c;fb[12]=0>l?0:255<l?255:l;fb[13]=0>i?
-0:255<i?255:i;fb[14]=0>d?0:255<d?255:d;Fb.putImageData(Tc,0,0);Cc.drawImage(X,0,0);return pc}function ac(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function hc(a){a=0.5*(a+1);return 0>a?0:1<a?1:a}function Nb(a,b){var c=b.x-a.x,d=b.y-a.y,e=c*c+d*d;0!=e&&(e=1/Math.sqrt(e),c*=e,d*=e,b.x+=c,b.y+=d,a.x-=c,a.y-=d)}var Ec,ed,Pa,kb;this.autoClear?this.clear():l.setTransform(1,0,0,-1,o,q);f.info.render.vertices=0;f.info.render.faces=0;g=m.projectScene(a,k,this.sortElements);h=g.elements;i=g.lights;(Oa=0<i.length)&&
-n(i);for(Ec=0,ed=h.length;Ec<ed;Ec++)if(Pa=h[Ec],kb=Pa.material,kb=kb instanceof THREE.MeshFaceMaterial?Pa.faceMaterial:kb,!(null==kb||0==kb.opacity)){Ca.empty();if(Pa instanceof THREE.RenderableParticle)D=Pa,D.x*=o,D.y*=q,r(D,Pa,kb,a);else if(Pa instanceof THREE.RenderableLine)D=Pa.v1,J=Pa.v2,D.positionScreen.x*=o,D.positionScreen.y*=q,J.positionScreen.x*=o,J.positionScreen.y*=q,Ca.addPoint(D.positionScreen.x,D.positionScreen.y),Ca.addPoint(J.positionScreen.x,J.positionScreen.y),Ga.intersects(Ca)&&
-s(D,J,Pa,kb,a);else if(Pa instanceof THREE.RenderableFace3)D=Pa.v1,J=Pa.v2,O=Pa.v3,D.positionScreen.x*=o,D.positionScreen.y*=q,J.positionScreen.x*=o,J.positionScreen.y*=q,O.positionScreen.x*=o,O.positionScreen.y*=q,kb.overdraw&&(Nb(D.positionScreen,J.positionScreen),Nb(J.positionScreen,O.positionScreen),Nb(O.positionScreen,D.positionScreen)),Ca.add3Points(D.positionScreen.x,D.positionScreen.y,J.positionScreen.x,J.positionScreen.y,O.positionScreen.x,O.positionScreen.y),Ga.intersects(Ca)&&t(D,J,O,0,
-1,2,Pa,kb,a);else if(Pa instanceof THREE.RenderableFace4)D=Pa.v1,J=Pa.v2,O=Pa.v3,P=Pa.v4,D.positionScreen.x*=o,D.positionScreen.y*=q,J.positionScreen.x*=o,J.positionScreen.y*=q,O.positionScreen.x*=o,O.positionScreen.y*=q,P.positionScreen.x*=o,P.positionScreen.y*=q,U.positionScreen.copy(J.positionScreen),L.positionScreen.copy(P.positionScreen),kb.overdraw&&(Nb(D.positionScreen,J.positionScreen),Nb(J.positionScreen,P.positionScreen),Nb(P.positionScreen,D.positionScreen),Nb(O.positionScreen,U.positionScreen),
-Nb(O.positionScreen,L.positionScreen)),Ca.addPoint(D.positionScreen.x,D.positionScreen.y),Ca.addPoint(J.positionScreen.x,J.positionScreen.y),Ca.addPoint(O.positionScreen.x,O.positionScreen.y),Ca.addPoint(P.positionScreen.x,P.positionScreen.y),Ga.intersects(Ca)&&v(D,J,O,P,U,L,Pa,kb,a);oa.addRectangle(Ca)}l.setTransform(1,0,0,1,0,0)}};
-THREE.SVGRenderer=function(){function a(a,b,c,d){var e,f,g,h,l,i;for(e=0,f=a.length;e<f;e++)g=a[e],h=g.color,g instanceof THREE.DirectionalLight?(l=g.matrixWorld.getPosition(),i=c.dot(l),0>=i||(i*=g.intensity,d.r+=h.r*i,d.g+=h.g*i,d.b+=h.b*i)):g instanceof THREE.PointLight&&(l=g.matrixWorld.getPosition(),i=c.dot(D.sub(l,b).normalize()),0>=i||(i*=0==g.distance?1:1-Math.min(b.distanceTo(l)/g.distance,1),0!=i&&(i*=g.intensity,d.r+=h.r*i,d.g+=h.g*i,d.b+=h.b*i)))}function b(a){null==J[a]&&(J[a]=document.createElementNS("http://www.w3.org/2000/svg",
-"path"),0==I&&J[a].setAttribute("shape-rendering","crispEdges"));return J[a]}function c(a){a=0.5*(a+1);return 0>a?0:1<a?1:a}var d=this,e,f,g,h=new THREE.Projector,i=document.createElementNS("http://www.w3.org/2000/svg","svg"),m,k,p,n,o,q,l,r,s=new THREE.Rectangle,u=new THREE.Rectangle,v=!1,t=new THREE.Color,w=new THREE.Color,A=new THREE.Color,G=new THREE.Color,F,D=new THREE.Vector3,J=[],O=[],P,U,L,I=1;this.domElement=i;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,
-faces:0}};this.setQuality=function(a){switch(a){case "high":I=1;break;case "low":I=0}};this.setSize=function(a,b){m=a;k=b;p=m/2;n=k/2;i.setAttribute("viewBox",-p+" "+-n+" "+m+" "+k);i.setAttribute("width",m);i.setAttribute("height",k);s.set(-p,-n,p,n)};this.clear=function(){for(;0<i.childNodes.length;)i.removeChild(i.childNodes[0])};this.render=function(m,k){var j,D,C,z;this.autoClear&&this.clear();d.info.render.vertices=0;d.info.render.faces=0;e=h.projectScene(m,k,this.sortElements);f=e.elements;
-g=e.lights;L=U=0;if(v=0<g.length){w.setRGB(0,0,0);A.setRGB(0,0,0);G.setRGB(0,0,0);for(j=0,D=g.length;j<D;j++)z=g[j],C=z.color,z instanceof THREE.AmbientLight?(w.r+=C.r,w.g+=C.g,w.b+=C.b):z instanceof THREE.DirectionalLight?(A.r+=C.r,A.g+=C.g,A.b+=C.b):z instanceof THREE.PointLight&&(G.r+=C.r,G.g+=C.g,G.b+=C.b)}for(j=0,D=f.length;j<D;j++)if(C=f[j],z=C.material,z=z instanceof THREE.MeshFaceMaterial?C.faceMaterial:z,!(null==z||0==z.opacity))if(u.empty(),C instanceof THREE.RenderableParticle)o=C,o.x*=
-p,o.y*=-n;else if(C instanceof THREE.RenderableLine){if(o=C.v1,q=C.v2,o.positionScreen.x*=p,o.positionScreen.y*=-n,q.positionScreen.x*=p,q.positionScreen.y*=-n,u.addPoint(o.positionScreen.x,o.positionScreen.y),u.addPoint(q.positionScreen.x,q.positionScreen.y),s.intersects(u)){C=o;var R=q,E=L++;null==O[E]&&(O[E]=document.createElementNS("http://www.w3.org/2000/svg","line"),0==I&&O[E].setAttribute("shape-rendering","crispEdges"));P=O[E];P.setAttribute("x1",C.positionScreen.x);P.setAttribute("y1",C.positionScreen.y);
-P.setAttribute("x2",R.positionScreen.x);P.setAttribute("y2",R.positionScreen.y);z instanceof THREE.LineBasicMaterial&&(P.setAttribute("style","fill: none; stroke: "+z.color.getContextStyle()+"; stroke-width: "+z.linewidth+"; stroke-opacity: "+z.opacity+"; stroke-linecap: "+z.linecap+"; stroke-linejoin: "+z.linejoin),i.appendChild(P))}}else if(C instanceof THREE.RenderableFace3){if(o=C.v1,q=C.v2,l=C.v3,o.positionScreen.x*=p,o.positionScreen.y*=-n,q.positionScreen.x*=p,q.positionScreen.y*=-n,l.positionScreen.x*=
-p,l.positionScreen.y*=-n,u.addPoint(o.positionScreen.x,o.positionScreen.y),u.addPoint(q.positionScreen.x,q.positionScreen.y),u.addPoint(l.positionScreen.x,l.positionScreen.y),s.intersects(u)){var R=o,E=q,J=l;d.info.render.vertices+=3;d.info.render.faces++;P=b(U++);P.setAttribute("d","M "+R.positionScreen.x+" "+R.positionScreen.y+" L "+E.positionScreen.x+" "+E.positionScreen.y+" L "+J.positionScreen.x+","+J.positionScreen.y+"z");z instanceof THREE.MeshBasicMaterial?t.copy(z.color):z instanceof THREE.MeshLambertMaterial?
-v?(t.r=w.r,t.g=w.g,t.b=w.b,a(g,C.centroidWorld,C.normalWorld,t),t.r=Math.max(0,Math.min(z.color.r*t.r,1)),t.g=Math.max(0,Math.min(z.color.g*t.g,1)),t.b=Math.max(0,Math.min(z.color.b*t.b,1))):t.copy(z.color):z instanceof THREE.MeshDepthMaterial?(F=1-z.__2near/(z.__farPlusNear-C.z*z.__farMinusNear),t.setRGB(F,F,F)):z instanceof THREE.MeshNormalMaterial&&t.setRGB(c(C.normalWorld.x),c(C.normalWorld.y),c(C.normalWorld.z));z.wireframe?P.setAttribute("style","fill: none; stroke: "+t.getContextStyle()+"; stroke-width: "+
-z.wireframeLinewidth+"; stroke-opacity: "+z.opacity+"; stroke-linecap: "+z.wireframeLinecap+"; stroke-linejoin: "+z.wireframeLinejoin):P.setAttribute("style","fill: "+t.getContextStyle()+"; fill-opacity: "+z.opacity);i.appendChild(P)}}else if(C instanceof THREE.RenderableFace4&&(o=C.v1,q=C.v2,l=C.v3,r=C.v4,o.positionScreen.x*=p,o.positionScreen.y*=-n,q.positionScreen.x*=p,q.positionScreen.y*=-n,l.positionScreen.x*=p,l.positionScreen.y*=-n,r.positionScreen.x*=p,r.positionScreen.y*=-n,u.addPoint(o.positionScreen.x,
-o.positionScreen.y),u.addPoint(q.positionScreen.x,q.positionScreen.y),u.addPoint(l.positionScreen.x,l.positionScreen.y),u.addPoint(r.positionScreen.x,r.positionScreen.y),s.intersects(u))){var R=o,E=q,J=l,ea=r;d.info.render.vertices+=4;d.info.render.faces++;P=b(U++);P.setAttribute("d","M "+R.positionScreen.x+" "+R.positionScreen.y+" L "+E.positionScreen.x+" "+E.positionScreen.y+" L "+J.positionScreen.x+","+J.positionScreen.y+" L "+ea.positionScreen.x+","+ea.positionScreen.y+"z");z instanceof THREE.MeshBasicMaterial?
-t.copy(z.color):z instanceof THREE.MeshLambertMaterial?v?(t.r=w.r,t.g=w.g,t.b=w.b,a(g,C.centroidWorld,C.normalWorld,t),t.r=Math.max(0,Math.min(z.color.r*t.r,1)),t.g=Math.max(0,Math.min(z.color.g*t.g,1)),t.b=Math.max(0,Math.min(z.color.b*t.b,1))):t.copy(z.color):z instanceof THREE.MeshDepthMaterial?(F=1-z.__2near/(z.__farPlusNear-C.z*z.__farMinusNear),t.setRGB(F,F,F)):z instanceof THREE.MeshNormalMaterial&&t.setRGB(c(C.normalWorld.x),c(C.normalWorld.y),c(C.normalWorld.z));z.wireframe?P.setAttribute("style",
-"fill: none; stroke: "+t.getContextStyle()+"; stroke-width: "+z.wireframeLinewidth+"; stroke-opacity: "+z.opacity+"; stroke-linecap: "+z.wireframeLinecap+"; stroke-linejoin: "+z.wireframeLinejoin):P.setAttribute("style","fill: "+t.getContextStyle()+"; fill-opacity: "+z.opacity);i.appendChild(P)}}};
+THREE.DOMRenderer=function(){var a,b,c,d,e,f,g,h=new THREE.Projector;g=function(a){for(var b=document.documentElement,c=0;c<a.length;c++)if("string"===typeof b.style[a[c]])return a[c];return null}(["transform","MozTransform","WebkitTransform","msTransform","OTransform"]);this.domElement=document.createElement("div");this.setSize=function(a,b){c=a;d=b;e=c/2;f=d/2};this.render=function(c,d){var k,p,m,o,r,n;a=h.projectScene(c,d);b=a.elements;for(k=0,p=b.length;k<p;k++)if(m=b[k],m instanceof THREE.RenderableParticle&&
+m.material instanceof THREE.ParticleDOMMaterial)o=m.material.domElement,r=m.x*e+e-(o.offsetWidth>>1),n=m.y*f+f-(o.offsetHeight>>1),o.style.left=r+"px",o.style.top=n+"px",o.style.zIndex=Math.abs(Math.floor((1-m.z)*d.far/d.near)),g&&(o.style[g]="scale("+m.scale.x*e+","+m.scale.y*f+")")}};
+THREE.CanvasRenderer=function(a){function b(a){if(u!=a)n.globalAlpha=u=a}function c(a){if(v!=a){switch(a){case THREE.NormalBlending:n.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:n.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:n.globalCompositeOperation="darker"}v=a}}function d(a){if(t!=a)n.strokeStyle=t=a}function e(a){if(w!=a)n.fillStyle=w=a}var a=a||{},f=this,g,h,l,j=new THREE.Projector,k=void 0!==a.canvas?a.canvas:document.createElement("canvas"),
+p,m,o,r,n=k.getContext("2d"),q=new THREE.Color(0),s=0,u=1,v=0,t=null,w=null,z=null,F=null,C=null,G,K,N,P,T=new THREE.RenderableVertex,O=new THREE.RenderableVertex,J,I,D,i,S,B,A,V,E,aa,ea,ia,R=new THREE.Color,$=new THREE.Color,ba=new THREE.Color,Z=new THREE.Color,ja=new THREE.Color,Ga=[],oa=[],Ka,Ua,Da,pa,$a,ab,kb,db,hb,nb,Wa=new THREE.Rectangle,qa=new THREE.Rectangle,va=new THREE.Rectangle,Ea=!1,ga=new THREE.Color,Xa=new THREE.Color,La=new THREE.Color,ra=new THREE.Vector3,ca,Q,sa,Ra,pc,Cc,a=16;ca=
+document.createElement("canvas");ca.width=ca.height=2;Q=ca.getContext("2d");Q.fillStyle="rgba(0,0,0,1)";Q.fillRect(0,0,2,2);sa=Q.getImageData(0,0,2,2);Ra=sa.data;pc=document.createElement("canvas");pc.width=pc.height=a;Cc=pc.getContext("2d");Cc.translate(-a/2,-a/2);Cc.scale(a,a);a--;this.domElement=k;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setSize=function(a,b){p=a;m=b;o=Math.floor(p/2);r=Math.floor(m/2);k.width=p;k.height=m;Wa.set(-o,-r,o,
+r);qa.set(-o,-r,o,r);u=1;v=0;C=F=z=w=t=null};this.setClearColor=function(a,b){q.copy(a);s=void 0!==b?b:1;qa.set(-o,-r,o,r)};this.setClearColorHex=function(a,b){q.setHex(a);s=void 0!==b?b:1;qa.set(-o,-r,o,r)};this.clear=function(){n.setTransform(1,0,0,-1,o,r);qa.isEmpty()||(qa.minSelf(Wa),qa.inflate(2),1>s&&n.clearRect(Math.floor(qa.getX()),Math.floor(qa.getY()),Math.floor(qa.getWidth()),Math.floor(qa.getHeight())),0<s&&(c(THREE.NormalBlending),b(1),e("rgba("+Math.floor(255*q.r)+","+Math.floor(255*
+q.g)+","+Math.floor(255*q.b)+","+s+")"),n.fillRect(Math.floor(qa.getX()),Math.floor(qa.getY()),Math.floor(qa.getWidth()),Math.floor(qa.getHeight()))),qa.empty())};this.render=function(a,k){function m(a){var b,c,d,e;ga.setRGB(0,0,0);Xa.setRGB(0,0,0);La.setRGB(0,0,0);for(b=0,c=a.length;b<c;b++)d=a[b],e=d.color,d instanceof THREE.AmbientLight?(ga.r+=e.r,ga.g+=e.g,ga.b+=e.b):d instanceof THREE.DirectionalLight?(Xa.r+=e.r,Xa.g+=e.g,Xa.b+=e.b):d instanceof THREE.PointLight&&(La.r+=e.r,La.g+=e.g,La.b+=e.b)}
+function p(a,b,c,d){var e,f,g,ca,h,i;for(e=0,f=a.length;e<f;e++)g=a[e],ca=g.color,g instanceof THREE.DirectionalLight?(h=g.matrixWorld.getPosition(),i=c.dot(h),0>=i||(i*=g.intensity,d.r+=ca.r*i,d.g+=ca.g*i,d.b+=ca.b*i)):g instanceof THREE.PointLight&&(h=g.matrixWorld.getPosition(),i=c.dot(ra.sub(h,b).normalize()),0>=i||(i*=0==g.distance?1:1-Math.min(b.distanceTo(h)/g.distance,1),0!=i&&(i*=g.intensity,d.r+=ca.r*i,d.g+=ca.g*i,d.b+=ca.b*i)))}function q(a,f,g){b(g.opacity);c(g.blending);var ca,h,i,l,
+Q,k;if(g instanceof THREE.ParticleBasicMaterial){if(g.map)l=g.map.image,Q=l.width>>1,k=l.height>>1,g=f.scale.x*o,i=f.scale.y*r,ca=g*Q,h=i*k,va.set(a.x-ca,a.y-h,a.x+ca,a.y+h),Wa.intersects(va)&&(n.save(),n.translate(a.x,a.y),n.rotate(-f.rotation),n.scale(g,-i),n.translate(-Q,-k),n.drawImage(l,0,0),n.restore())}else g instanceof THREE.ParticleCanvasMaterial&&(ca=f.scale.x*o,h=f.scale.y*r,va.set(a.x-ca,a.y-h,a.x+ca,a.y+h),Wa.intersects(va)&&(d(g.color.getContextStyle()),e(g.color.getContextStyle()),
+n.save(),n.translate(a.x,a.y),n.rotate(-f.rotation),n.scale(ca,h),g.program(n),n.restore()))}function s(a,e,f,g){b(g.opacity);c(g.blending);n.beginPath();n.moveTo(a.positionScreen.x,a.positionScreen.y);n.lineTo(e.positionScreen.x,e.positionScreen.y);n.closePath();if(g instanceof THREE.LineBasicMaterial){a=g.linewidth;if(z!=a)n.lineWidth=z=a;a=g.linecap;if(F!=a)n.lineCap=F=a;a=g.linejoin;if(C!=a)n.lineJoin=C=a;d(g.color.getContextStyle());n.stroke();va.inflate(2*g.linewidth)}}function t(a,d,e,g,ca,
+h,Q,j){f.info.render.vertices+=3;f.info.render.faces++;b(j.opacity);c(j.blending);J=a.positionScreen.x;I=a.positionScreen.y;D=d.positionScreen.x;i=d.positionScreen.y;S=e.positionScreen.x;B=e.positionScreen.y;u(J,I,D,i,S,B);if(j instanceof THREE.MeshBasicMaterial)if(j.map)j.map.mapping instanceof THREE.UVMapping&&(pa=Q.uvs[0],Tc(J,I,D,i,S,B,pa[g].u,pa[g].v,pa[ca].u,pa[ca].v,pa[h].u,pa[h].v,j.map));else if(j.envMap){if(j.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=k.matrixWorldInverse,
+ra.copy(Q.vertexNormalsWorld[g]),$a=0.5*(ra.x*a.n11+ra.y*a.n12+ra.z*a.n13)+0.5,ab=0.5*-(ra.x*a.n21+ra.y*a.n22+ra.z*a.n23)+0.5,ra.copy(Q.vertexNormalsWorld[ca]),kb=0.5*(ra.x*a.n11+ra.y*a.n12+ra.z*a.n13)+0.5,db=0.5*-(ra.x*a.n21+ra.y*a.n22+ra.z*a.n23)+0.5,ra.copy(Q.vertexNormalsWorld[h]),hb=0.5*(ra.x*a.n11+ra.y*a.n12+ra.z*a.n13)+0.5,nb=0.5*-(ra.x*a.n21+ra.y*a.n22+ra.z*a.n23)+0.5,Tc(J,I,D,i,S,B,$a,ab,kb,db,hb,nb,j.envMap)}else j.wireframe?Mb(j.color,j.wireframeLinewidth,j.wireframeLinecap,j.wireframeLinejoin):
+Gb(j.color);else if(j instanceof THREE.MeshLambertMaterial)j.map&&!j.wireframe&&(j.map.mapping instanceof THREE.UVMapping&&(pa=Q.uvs[0],Tc(J,I,D,i,S,B,pa[g].u,pa[g].v,pa[ca].u,pa[ca].v,pa[h].u,pa[h].v,j.map)),c(THREE.SubtractiveBlending)),Ea?!j.wireframe&&j.shading==THREE.SmoothShading&&3==Q.vertexNormalsWorld.length?($.r=ba.r=Z.r=ga.r,$.g=ba.g=Z.g=ga.g,$.b=ba.b=Z.b=ga.b,p(l,Q.v1.positionWorld,Q.vertexNormalsWorld[0],$),p(l,Q.v2.positionWorld,Q.vertexNormalsWorld[1],ba),p(l,Q.v3.positionWorld,Q.vertexNormalsWorld[2],
+Z),$.r=Math.max(0,Math.min(j.color.r*$.r,1)),$.g=Math.max(0,Math.min(j.color.g*$.g,1)),$.b=Math.max(0,Math.min(j.color.b*$.b,1)),ba.r=Math.max(0,Math.min(j.color.r*ba.r,1)),ba.g=Math.max(0,Math.min(j.color.g*ba.g,1)),ba.b=Math.max(0,Math.min(j.color.b*ba.b,1)),Z.r=Math.max(0,Math.min(j.color.r*Z.r,1)),Z.g=Math.max(0,Math.min(j.color.g*Z.g,1)),Z.b=Math.max(0,Math.min(j.color.b*Z.b,1)),ja.r=0.5*(ba.r+Z.r),ja.g=0.5*(ba.g+Z.g),ja.b=0.5*(ba.b+Z.b),Da=Dc($,ba,Z,ja),gc(J,I,D,i,S,B,0,0,1,0,0,1,Da)):(R.r=
+ga.r,R.g=ga.g,R.b=ga.b,p(l,Q.centroidWorld,Q.normalWorld,R),R.r=Math.max(0,Math.min(j.color.r*R.r,1)),R.g=Math.max(0,Math.min(j.color.g*R.g,1)),R.b=Math.max(0,Math.min(j.color.b*R.b,1)),j.wireframe?Mb(R,j.wireframeLinewidth,j.wireframeLinecap,j.wireframeLinejoin):Gb(R)):j.wireframe?Mb(j.color,j.wireframeLinewidth,j.wireframeLinecap,j.wireframeLinejoin):Gb(j.color);else if(j instanceof THREE.MeshDepthMaterial)Ka=k.near,Ua=k.far,$.r=$.g=$.b=1-ac(a.positionScreen.z,Ka,Ua),ba.r=ba.g=ba.b=1-ac(d.positionScreen.z,
+Ka,Ua),Z.r=Z.g=Z.b=1-ac(e.positionScreen.z,Ka,Ua),ja.r=0.5*(ba.r+Z.r),ja.g=0.5*(ba.g+Z.g),ja.b=0.5*(ba.b+Z.b),Da=Dc($,ba,Z,ja),gc(J,I,D,i,S,B,0,0,1,0,0,1,Da);else if(j instanceof THREE.MeshNormalMaterial)R.r=hc(Q.normalWorld.x),R.g=hc(Q.normalWorld.y),R.b=hc(Q.normalWorld.z),j.wireframe?Mb(R,j.wireframeLinewidth,j.wireframeLinecap,j.wireframeLinejoin):Gb(R)}function v(a,d,e,g,ca,h,j,Q,sa){f.info.render.vertices+=4;f.info.render.faces++;b(Q.opacity);c(Q.blending);if(Q.map||Q.envMap)t(a,d,g,0,1,3,j,
+Q,sa),t(ca,e,h,1,2,3,j,Q,sa);else if(J=a.positionScreen.x,I=a.positionScreen.y,D=d.positionScreen.x,i=d.positionScreen.y,S=e.positionScreen.x,B=e.positionScreen.y,A=g.positionScreen.x,V=g.positionScreen.y,E=ca.positionScreen.x,aa=ca.positionScreen.y,ea=h.positionScreen.x,ia=h.positionScreen.y,Q instanceof THREE.MeshBasicMaterial)w(J,I,D,i,S,B,A,V),Q.wireframe?Mb(Q.color,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):Gb(Q.color);else if(Q instanceof THREE.MeshLambertMaterial)Ea?!Q.wireframe&&
+Q.shading==THREE.SmoothShading&&4==j.vertexNormalsWorld.length?($.r=ba.r=Z.r=ja.r=ga.r,$.g=ba.g=Z.g=ja.g=ga.g,$.b=ba.b=Z.b=ja.b=ga.b,p(l,j.v1.positionWorld,j.vertexNormalsWorld[0],$),p(l,j.v2.positionWorld,j.vertexNormalsWorld[1],ba),p(l,j.v4.positionWorld,j.vertexNormalsWorld[3],Z),p(l,j.v3.positionWorld,j.vertexNormalsWorld[2],ja),$.r=Math.max(0,Math.min(Q.color.r*$.r,1)),$.g=Math.max(0,Math.min(Q.color.g*$.g,1)),$.b=Math.max(0,Math.min(Q.color.b*$.b,1)),ba.r=Math.max(0,Math.min(Q.color.r*ba.r,
+1)),ba.g=Math.max(0,Math.min(Q.color.g*ba.g,1)),ba.b=Math.max(0,Math.min(Q.color.b*ba.b,1)),Z.r=Math.max(0,Math.min(Q.color.r*Z.r,1)),Z.g=Math.max(0,Math.min(Q.color.g*Z.g,1)),Z.b=Math.max(0,Math.min(Q.color.b*Z.b,1)),ja.r=Math.max(0,Math.min(Q.color.r*ja.r,1)),ja.g=Math.max(0,Math.min(Q.color.g*ja.g,1)),ja.b=Math.max(0,Math.min(Q.color.b*ja.b,1)),Da=Dc($,ba,Z,ja),u(J,I,D,i,A,V),gc(J,I,D,i,A,V,0,0,1,0,0,1,Da),u(E,aa,S,B,ea,ia),gc(E,aa,S,B,ea,ia,1,0,1,1,0,1,Da)):(R.r=ga.r,R.g=ga.g,R.b=ga.b,p(l,j.centroidWorld,
+j.normalWorld,R),R.r=Math.max(0,Math.min(Q.color.r*R.r,1)),R.g=Math.max(0,Math.min(Q.color.g*R.g,1)),R.b=Math.max(0,Math.min(Q.color.b*R.b,1)),w(J,I,D,i,S,B,A,V),Q.wireframe?Mb(R,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):Gb(R)):(w(J,I,D,i,S,B,A,V),Q.wireframe?Mb(Q.color,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):Gb(Q.color));else if(Q instanceof THREE.MeshNormalMaterial)R.r=hc(j.normalWorld.x),R.g=hc(j.normalWorld.y),R.b=hc(j.normalWorld.z),w(J,I,D,i,S,B,A,V),
+Q.wireframe?Mb(R,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):Gb(R);else if(Q instanceof THREE.MeshDepthMaterial)Ka=k.near,Ua=k.far,$.r=$.g=$.b=1-ac(a.positionScreen.z,Ka,Ua),ba.r=ba.g=ba.b=1-ac(d.positionScreen.z,Ka,Ua),Z.r=Z.g=Z.b=1-ac(g.positionScreen.z,Ka,Ua),ja.r=ja.g=ja.b=1-ac(e.positionScreen.z,Ka,Ua),Da=Dc($,ba,Z,ja),u(J,I,D,i,A,V),gc(J,I,D,i,A,V,0,0,1,0,0,1,Da),u(E,aa,S,B,ea,ia),gc(E,aa,S,B,ea,ia,1,0,1,1,0,1,Da)}function u(a,b,c,d,e,f){n.beginPath();n.moveTo(a,b);n.lineTo(c,
+d);n.lineTo(e,f);n.lineTo(a,b);n.closePath()}function w(a,b,c,d,e,f,g,ca){n.beginPath();n.moveTo(a,b);n.lineTo(c,d);n.lineTo(e,f);n.lineTo(g,ca);n.lineTo(a,b);n.closePath()}function Mb(a,b,c,e){if(z!=b)n.lineWidth=z=b;if(F!=c)n.lineCap=F=c;if(C!=e)n.lineJoin=C=e;d(a.getContextStyle());n.stroke();va.inflate(2*b)}function Gb(a){e(a.getContextStyle());n.fill()}function Tc(a,b,c,d,f,g,ca,h,i,Q,j,l,k){if(0!=k.image.width){if(!0==k.needsUpdate||void 0==Ga[k.id]){var sa=k.wrapS==THREE.RepeatWrapping,Ra=
+k.wrapT==THREE.RepeatWrapping;Ga[k.id]=n.createPattern(k.image,sa&&Ra?"repeat":sa&&!Ra?"repeat-x":!sa&&Ra?"repeat-y":"no-repeat");k.needsUpdate=!1}e(Ga[k.id]);var sa=k.offset.x/k.repeat.x,Ra=k.offset.y/k.repeat.y,m=k.image.width*k.repeat.x,o=k.image.height*k.repeat.y,ca=(ca+sa)*m,h=(h+Ra)*o,c=c-a,d=d-b,f=f-a,g=g-b,i=(i+sa)*m-ca,Q=(Q+Ra)*o-h,j=(j+sa)*m-ca,l=(l+Ra)*o-h,sa=i*l-j*Q;if(0==sa){if(void 0===oa[k.id])b=document.createElement("canvas"),b.width=k.image.width,b.height=k.image.height,b=b.getContext("2d"),
+b.drawImage(k.image,0,0),oa[k.id]=b.getImageData(0,0,k.image.width,k.image.height).data;b=oa[k.id];ca=4*(Math.floor(ca)+Math.floor(h)*k.image.width);R.setRGB(b[ca]/255,b[ca+1]/255,b[ca+2]/255);Gb(R)}else sa=1/sa,k=(l*c-Q*f)*sa,Q=(l*d-Q*g)*sa,c=(i*f-j*c)*sa,d=(i*g-j*d)*sa,a=a-k*ca-c*h,ca=b-Q*ca-d*h,n.save(),n.transform(k,Q,c,d,a,ca),n.fill(),n.restore()}}function gc(a,b,c,d,e,f,g,ca,h,i,Q,j,l){var k,sa;k=l.width-1;sa=l.height-1;g*=k;ca*=sa;c-=a;d-=b;e-=a;f-=b;h=h*k-g;i=i*sa-ca;Q=Q*k-g;j=j*sa-ca;sa=
+1/(h*j-Q*i);k=(j*c-i*e)*sa;i=(j*d-i*f)*sa;c=(h*e-Q*c)*sa;d=(h*f-Q*d)*sa;a=a-k*g-c*ca;b=b-i*g-d*ca;n.save();n.transform(k,i,c,d,a,b);n.clip();n.drawImage(l,0,0);n.restore()}function Dc(a,b,c,d){var e=~~(255*a.r),f=~~(255*a.g),a=~~(255*a.b),g=~~(255*b.r),h=~~(255*b.g),b=~~(255*b.b),i=~~(255*c.r),j=~~(255*c.g),c=~~(255*c.b),l=~~(255*d.r),k=~~(255*d.g),d=~~(255*d.b);Ra[0]=0>e?0:255<e?255:e;Ra[1]=0>f?0:255<f?255:f;Ra[2]=0>a?0:255<a?255:a;Ra[4]=0>g?0:255<g?255:g;Ra[5]=0>h?0:255<h?255:h;Ra[6]=0>b?0:255<
+b?255:b;Ra[8]=0>i?0:255<i?255:i;Ra[9]=0>j?0:255<j?255:j;Ra[10]=0>c?0:255<c?255:c;Ra[12]=0>l?0:255<l?255:l;Ra[13]=0>k?0:255<k?255:k;Ra[14]=0>d?0:255<d?255:d;Q.putImageData(sa,0,0);Cc.drawImage(ca,0,0);return pc}function ac(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function hc(a){a=0.5*(a+1);return 0>a?0:1<a?1:a}function Nb(a,b){var c=b.x-a.x,d=b.y-a.y,e=c*c+d*d;0!=e&&(e=1/Math.sqrt(e),c*=e,d*=e,b.x+=c,b.y+=d,a.x-=c,a.y-=d)}var Ec,cd,Sa,lb;this.autoClear?this.clear():n.setTransform(1,0,0,-1,o,r);f.info.render.vertices=
+0;f.info.render.faces=0;g=j.projectScene(a,k,this.sortElements);h=g.elements;l=g.lights;(Ea=0<l.length)&&m(l);for(Ec=0,cd=h.length;Ec<cd;Ec++)if(Sa=h[Ec],lb=Sa.material,lb=lb instanceof THREE.MeshFaceMaterial?Sa.faceMaterial:lb,!(null==lb||0==lb.opacity)){va.empty();if(Sa instanceof THREE.RenderableParticle)G=Sa,G.x*=o,G.y*=r,q(G,Sa,lb,a);else if(Sa instanceof THREE.RenderableLine)G=Sa.v1,K=Sa.v2,G.positionScreen.x*=o,G.positionScreen.y*=r,K.positionScreen.x*=o,K.positionScreen.y*=r,va.addPoint(G.positionScreen.x,
+G.positionScreen.y),va.addPoint(K.positionScreen.x,K.positionScreen.y),Wa.intersects(va)&&s(G,K,Sa,lb,a);else if(Sa instanceof THREE.RenderableFace3)G=Sa.v1,K=Sa.v2,N=Sa.v3,G.positionScreen.x*=o,G.positionScreen.y*=r,K.positionScreen.x*=o,K.positionScreen.y*=r,N.positionScreen.x*=o,N.positionScreen.y*=r,lb.overdraw&&(Nb(G.positionScreen,K.positionScreen),Nb(K.positionScreen,N.positionScreen),Nb(N.positionScreen,G.positionScreen)),va.add3Points(G.positionScreen.x,G.positionScreen.y,K.positionScreen.x,
+K.positionScreen.y,N.positionScreen.x,N.positionScreen.y),Wa.intersects(va)&&t(G,K,N,0,1,2,Sa,lb,a);else if(Sa instanceof THREE.RenderableFace4)G=Sa.v1,K=Sa.v2,N=Sa.v3,P=Sa.v4,G.positionScreen.x*=o,G.positionScreen.y*=r,K.positionScreen.x*=o,K.positionScreen.y*=r,N.positionScreen.x*=o,N.positionScreen.y*=r,P.positionScreen.x*=o,P.positionScreen.y*=r,T.positionScreen.copy(K.positionScreen),O.positionScreen.copy(P.positionScreen),lb.overdraw&&(Nb(G.positionScreen,K.positionScreen),Nb(K.positionScreen,
+P.positionScreen),Nb(P.positionScreen,G.positionScreen),Nb(N.positionScreen,T.positionScreen),Nb(N.positionScreen,O.positionScreen)),va.addPoint(G.positionScreen.x,G.positionScreen.y),va.addPoint(K.positionScreen.x,K.positionScreen.y),va.addPoint(N.positionScreen.x,N.positionScreen.y),va.addPoint(P.positionScreen.x,P.positionScreen.y),Wa.intersects(va)&&v(G,K,N,P,T,O,Sa,lb,a);qa.addRectangle(va)}n.setTransform(1,0,0,1,0,0)}};
+THREE.SVGRenderer=function(){function a(a,b,c,d){var e,f,g,h,j,l;for(e=0,f=a.length;e<f;e++)g=a[e],h=g.color,g instanceof THREE.DirectionalLight?(j=g.matrixWorld.getPosition(),l=c.dot(j),0>=l||(l*=g.intensity,d.r+=h.r*l,d.g+=h.g*l,d.b+=h.b*l)):g instanceof THREE.PointLight&&(j=g.matrixWorld.getPosition(),l=c.dot(G.sub(j,b).normalize()),0>=l||(l*=0==g.distance?1:1-Math.min(b.distanceTo(j)/g.distance,1),0!=l&&(l*=g.intensity,d.r+=h.r*l,d.g+=h.g*l,d.b+=h.b*l)))}function b(a){null==K[a]&&(K[a]=document.createElementNS("http://www.w3.org/2000/svg",
+"path"),0==J&&K[a].setAttribute("shape-rendering","crispEdges"));return K[a]}function c(a){a=0.5*(a+1);return 0>a?0:1<a?1:a}var d=this,e,f,g,h=new THREE.Projector,l=document.createElementNS("http://www.w3.org/2000/svg","svg"),j,k,p,m,o,r,n,q,s=new THREE.Rectangle,u=new THREE.Rectangle,v=!1,t=new THREE.Color,w=new THREE.Color,z=new THREE.Color,F=new THREE.Color,C,G=new THREE.Vector3,K=[],N=[],P,T,O,J=1;this.domElement=l;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,
+faces:0}};this.setQuality=function(a){switch(a){case "high":J=1;break;case "low":J=0}};this.setSize=function(a,b){j=a;k=b;p=j/2;m=k/2;l.setAttribute("viewBox",-p+" "+-m+" "+j+" "+k);l.setAttribute("width",j);l.setAttribute("height",k);s.set(-p,-m,p,m)};this.clear=function(){for(;0<l.childNodes.length;)l.removeChild(l.childNodes[0])};this.render=function(j,k){var i,G,B,A;this.autoClear&&this.clear();d.info.render.vertices=0;d.info.render.faces=0;e=h.projectScene(j,k,this.sortElements);f=e.elements;
+g=e.lights;O=T=0;if(v=0<g.length){w.setRGB(0,0,0);z.setRGB(0,0,0);F.setRGB(0,0,0);for(i=0,G=g.length;i<G;i++)A=g[i],B=A.color,A instanceof THREE.AmbientLight?(w.r+=B.r,w.g+=B.g,w.b+=B.b):A instanceof THREE.DirectionalLight?(z.r+=B.r,z.g+=B.g,z.b+=B.b):A instanceof THREE.PointLight&&(F.r+=B.r,F.g+=B.g,F.b+=B.b)}for(i=0,G=f.length;i<G;i++)if(B=f[i],A=B.material,A=A instanceof THREE.MeshFaceMaterial?B.faceMaterial:A,!(null==A||0==A.opacity))if(u.empty(),B instanceof THREE.RenderableParticle)o=B,o.x*=
+p,o.y*=-m;else if(B instanceof THREE.RenderableLine){if(o=B.v1,r=B.v2,o.positionScreen.x*=p,o.positionScreen.y*=-m,r.positionScreen.x*=p,r.positionScreen.y*=-m,u.addPoint(o.positionScreen.x,o.positionScreen.y),u.addPoint(r.positionScreen.x,r.positionScreen.y),s.intersects(u)){B=o;var V=r,E=O++;null==N[E]&&(N[E]=document.createElementNS("http://www.w3.org/2000/svg","line"),0==J&&N[E].setAttribute("shape-rendering","crispEdges"));P=N[E];P.setAttribute("x1",B.positionScreen.x);P.setAttribute("y1",B.positionScreen.y);
+P.setAttribute("x2",V.positionScreen.x);P.setAttribute("y2",V.positionScreen.y);A instanceof THREE.LineBasicMaterial&&(P.setAttribute("style","fill: none; stroke: "+A.color.getContextStyle()+"; stroke-width: "+A.linewidth+"; stroke-opacity: "+A.opacity+"; stroke-linecap: "+A.linecap+"; stroke-linejoin: "+A.linejoin),l.appendChild(P))}}else if(B instanceof THREE.RenderableFace3){if(o=B.v1,r=B.v2,n=B.v3,o.positionScreen.x*=p,o.positionScreen.y*=-m,r.positionScreen.x*=p,r.positionScreen.y*=-m,n.positionScreen.x*=
+p,n.positionScreen.y*=-m,u.addPoint(o.positionScreen.x,o.positionScreen.y),u.addPoint(r.positionScreen.x,r.positionScreen.y),u.addPoint(n.positionScreen.x,n.positionScreen.y),s.intersects(u)){var V=o,E=r,K=n;d.info.render.vertices+=3;d.info.render.faces++;P=b(T++);P.setAttribute("d","M "+V.positionScreen.x+" "+V.positionScreen.y+" L "+E.positionScreen.x+" "+E.positionScreen.y+" L "+K.positionScreen.x+","+K.positionScreen.y+"z");A instanceof THREE.MeshBasicMaterial?t.copy(A.color):A instanceof THREE.MeshLambertMaterial?
+v?(t.r=w.r,t.g=w.g,t.b=w.b,a(g,B.centroidWorld,B.normalWorld,t),t.r=Math.max(0,Math.min(A.color.r*t.r,1)),t.g=Math.max(0,Math.min(A.color.g*t.g,1)),t.b=Math.max(0,Math.min(A.color.b*t.b,1))):t.copy(A.color):A instanceof THREE.MeshDepthMaterial?(C=1-A.__2near/(A.__farPlusNear-B.z*A.__farMinusNear),t.setRGB(C,C,C)):A instanceof THREE.MeshNormalMaterial&&t.setRGB(c(B.normalWorld.x),c(B.normalWorld.y),c(B.normalWorld.z));A.wireframe?P.setAttribute("style","fill: none; stroke: "+t.getContextStyle()+"; stroke-width: "+
+A.wireframeLinewidth+"; stroke-opacity: "+A.opacity+"; stroke-linecap: "+A.wireframeLinecap+"; stroke-linejoin: "+A.wireframeLinejoin):P.setAttribute("style","fill: "+t.getContextStyle()+"; fill-opacity: "+A.opacity);l.appendChild(P)}}else if(B instanceof THREE.RenderableFace4&&(o=B.v1,r=B.v2,n=B.v3,q=B.v4,o.positionScreen.x*=p,o.positionScreen.y*=-m,r.positionScreen.x*=p,r.positionScreen.y*=-m,n.positionScreen.x*=p,n.positionScreen.y*=-m,q.positionScreen.x*=p,q.positionScreen.y*=-m,u.addPoint(o.positionScreen.x,
+o.positionScreen.y),u.addPoint(r.positionScreen.x,r.positionScreen.y),u.addPoint(n.positionScreen.x,n.positionScreen.y),u.addPoint(q.positionScreen.x,q.positionScreen.y),s.intersects(u))){var V=o,E=r,K=n,ea=q;d.info.render.vertices+=4;d.info.render.faces++;P=b(T++);P.setAttribute("d","M "+V.positionScreen.x+" "+V.positionScreen.y+" L "+E.positionScreen.x+" "+E.positionScreen.y+" L "+K.positionScreen.x+","+K.positionScreen.y+" L "+ea.positionScreen.x+","+ea.positionScreen.y+"z");A instanceof THREE.MeshBasicMaterial?
+t.copy(A.color):A instanceof THREE.MeshLambertMaterial?v?(t.r=w.r,t.g=w.g,t.b=w.b,a(g,B.centroidWorld,B.normalWorld,t),t.r=Math.max(0,Math.min(A.color.r*t.r,1)),t.g=Math.max(0,Math.min(A.color.g*t.g,1)),t.b=Math.max(0,Math.min(A.color.b*t.b,1))):t.copy(A.color):A instanceof THREE.MeshDepthMaterial?(C=1-A.__2near/(A.__farPlusNear-B.z*A.__farMinusNear),t.setRGB(C,C,C)):A instanceof THREE.MeshNormalMaterial&&t.setRGB(c(B.normalWorld.x),c(B.normalWorld.y),c(B.normalWorld.z));A.wireframe?P.setAttribute("style",
+"fill: none; stroke: "+t.getContextStyle()+"; stroke-width: "+A.wireframeLinewidth+"; stroke-opacity: "+A.opacity+"; stroke-linecap: "+A.wireframeLinecap+"; stroke-linejoin: "+A.wireframeLinejoin):P.setAttribute("style","fill: "+t.getContextStyle()+"; fill-opacity: "+A.opacity);l.appendChild(P)}}};
 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\n#ifdef DOUBLE_SIDED\nfloat flipNormal = ( -1.0 + 2.0 * float( gl_FrontFacing ) );\nvec4 cubeColor = textureCube( envMap, flipNormal * vec3( flipEnvMap * vReflect.x, vReflect.yz ) );\n#else\nvec4 cubeColor = textureCube( envMap, vec3( flipEnvMap * vReflect.x, vReflect.yz ) );\n#endif\n#ifdef GAMMA_INPUT\ncubeColor.xyz *= cubeColor.xyz;\n#endif\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",
@@ -242,130 +244,132 @@ THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_pars_fragment,THREE.
 THREE.ShaderChunk.envmap_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.linear_to_gamma_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(a){function b(a,b){var c=a.vertices.length,d=b.material;if(d.attributes){if(void 0===a.__webglCustomAttributesList)a.__webglCustomAttributesList=[];for(var e in d.attributes){var f=d.attributes[e];if(!f.__webglInitialized||f.createUniqueBuffers){f.__webglInitialized=!0;var g=1;"v2"===f.type?g=2:"v3"===f.type?g=3:"v4"===f.type?g=4:"c"===f.type&&(g=3);f.size=g;f.array=new Float32Array(c*g);f.buffer=j.createBuffer();f.buffer.belongsToAttribute=e;f.needsUpdate=!0}a.__webglCustomAttributesList.push(f)}}}
+THREE.WebGLRenderer=function(a){function b(a,b){var c=a.vertices.length,d=b.material;if(d.attributes){if(void 0===a.__webglCustomAttributesList)a.__webglCustomAttributesList=[];for(var e in d.attributes){var f=d.attributes[e];if(!f.__webglInitialized||f.createUniqueBuffers){f.__webglInitialized=!0;var g=1;"v2"===f.type?g=2:"v3"===f.type?g=3:"v4"===f.type?g=4:"c"===f.type&&(g=3);f.size=g;f.array=new Float32Array(c*g);f.buffer=i.createBuffer();f.buffer.belongsToAttribute=e;f.needsUpdate=!0}a.__webglCustomAttributesList.push(f)}}}
 function c(a,b){if(a.material&&!(a.material instanceof THREE.MeshFaceMaterial))return a.material;if(0<=b.materialIndex)return a.geometry.materials[b.materialIndex]}function d(a){return a instanceof THREE.MeshBasicMaterial&&!a.envMap||a instanceof THREE.MeshDepthMaterial?!1:a&&void 0!==a.shading&&a.shading===THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading}function e(a){return a.map||a.lightMap||a instanceof THREE.ShaderMaterial?!0:!1}function f(a,b,c){var d,e,f,g,h=a.vertices;g=h.length;
-var l=a.colors,i=l.length,m=a.__vertexArray,k=a.__colorArray,n=a.__sortArray,o=a.__dirtyVertices,p=a.__dirtyColors,q=a.__webglCustomAttributesList;if(c.sortParticles){db.copy(eb);db.multiplySelf(c.matrixWorld);for(d=0;d<g;d++)e=h[d].position,Ga.copy(e),db.multiplyVector3(Ga),n[d]=[Ga.z,d];n.sort(function(a,b){return b[0]-a[0]});for(d=0;d<g;d++)e=h[n[d][1]].position,f=3*d,m[f]=e.x,m[f+1]=e.y,m[f+2]=e.z;for(d=0;d<i;d++)f=3*d,e=l[n[d][1]],k[f]=e.r,k[f+1]=e.g,k[f+2]=e.b;if(q)for(l=0,i=q.length;l<i;l++)if(h=
-q[l],void 0===h.boundTo||"vertices"===h.boundTo)if(f=0,e=h.value.length,1===h.size)for(d=0;d<e;d++)g=n[d][1],h.array[d]=h.value[g];else if(2===h.size)for(d=0;d<e;d++)g=n[d][1],g=h.value[g],h.array[f]=g.x,h.array[f+1]=g.y,f+=2;else if(3===h.size)if("c"===h.type)for(d=0;d<e;d++)g=n[d][1],g=h.value[g],h.array[f]=g.r,h.array[f+1]=g.g,h.array[f+2]=g.b,f+=3;else for(d=0;d<e;d++)g=n[d][1],g=h.value[g],h.array[f]=g.x,h.array[f+1]=g.y,h.array[f+2]=g.z,f+=3;else if(4===h.size)for(d=0;d<e;d++)g=n[d][1],g=h.value[g],
-h.array[f]=g.x,h.array[f+1]=g.y,h.array[f+2]=g.z,h.array[f+3]=g.w,f+=4}else{if(o)for(d=0;d<g;d++)e=h[d].position,f=3*d,m[f]=e.x,m[f+1]=e.y,m[f+2]=e.z;if(p)for(d=0;d<i;d++)e=l[d],f=3*d,k[f]=e.r,k[f+1]=e.g,k[f+2]=e.b;if(q)for(l=0,i=q.length;l<i;l++)if(h=q[l],h.needsUpdate&&(void 0===h.boundTo||"vertices"===h.boundTo))if(e=h.value.length,f=0,1===h.size)for(d=0;d<e;d++)h.array[d]=h.value[d];else if(2===h.size)for(d=0;d<e;d++)g=h.value[d],h.array[f]=g.x,h.array[f+1]=g.y,f+=2;else if(3===h.size)if("c"===
-h.type)for(d=0;d<e;d++)g=h.value[d],h.array[f]=g.r,h.array[f+1]=g.g,h.array[f+2]=g.b,f+=3;else for(d=0;d<e;d++)g=h.value[d],h.array[f]=g.x,h.array[f+1]=g.y,h.array[f+2]=g.z,f+=3;else if(4===h.size)for(d=0;d<e;d++)g=h.value[d],h.array[f]=g.x,h.array[f+1]=g.y,h.array[f+2]=g.z,h.array[f+3]=g.w,f+=4}if(o||c.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,a.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,m,b);if(p||c.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,a.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,
-k,b);if(q)for(l=0,i=q.length;l<i;l++)if(h=q[l],h.needsUpdate||c.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,h.buffer),j.bufferData(j.ARRAY_BUFFER,h.array,b)}function g(a,b){return b.z-a.z}function h(a,b,c){if(a.length)for(var d=0,e=a.length;d<e;d++)ga=C=null,R=E=aa=W=Q=-1,a[d].render(b,c,jb,Va),ga=C=null,R=E=aa=W=Q=-1}function i(a,b,c,d,e,f,g,h){var j,l,i,m;b?(l=a.length-1,m=b=-1):(l=0,b=a.length,m=1);for(var k=l;k!==b;k+=m)if(j=a[k],j.render){l=j.object;i=j.buffer;if(h)j=h;else{j=j[c];if(!j)continue;
-g&&B.setBlending(j.blending);B.setDepthTest(j.depthTest);B.setDepthWrite(j.depthWrite);s(j.polygonOffset,j.polygonOffsetFactor,j.polygonOffsetUnits)}B.setObjectFaces(l);i instanceof THREE.BufferGeometry?B.renderBufferDirect(d,e,f,j,i,l):B.renderBuffer(d,e,f,j,i,l)}}function m(a,b,c,d,e,f,g){for(var h,j,l=0,i=a.length;l<i;l++)if(h=a[l],j=h.object,j.visible){if(g)h=g;else{h=h[b];if(!h)continue;f&&B.setBlending(h.blending);B.setDepthTest(h.depthTest);B.setDepthWrite(h.depthWrite);s(h.polygonOffset,h.polygonOffsetFactor,
-h.polygonOffsetUnits)}B.renderImmediateObject(c,d,e,h,j)}}function k(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})}function p(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function n(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function o(a,b){for(var c=a.length-1;0<=c;c--)a[c].object===b&&a.splice(c,1)}function q(a,b){for(var c=a.length-1;0<=c;c--)a[c]===b&&a.splice(c,1)}function l(a,b,c,d,e){if(!d.program||d.needsUpdate)B.initMaterial(d,
-b,c,e),d.needsUpdate=!1;if(d.morphTargets&&!e.__webglMorphTargetInfluences){e.__webglMorphTargetInfluences=new Float32Array(B.maxMorphTargets);for(var f=0,g=B.maxMorphTargets;f<g;f++)e.__webglMorphTargetInfluences[f]=0}var h=!1,f=d.program,g=f.uniforms,l=d.uniforms;f!==C&&(j.useProgram(f),C=f,h=!0);if(d.id!==R)R=d.id,h=!0;if(h||a!==ga)j.uniformMatrix4fv(g.projectionMatrix,!1,a._projectionMatrixArray),a!==ga&&(ga=a);if(h){if(c&&d.fog)if(l.fogColor.value=c.color,c instanceof THREE.Fog)l.fogNear.value=
-c.near,l.fogFar.value=c.far;else if(c instanceof THREE.FogExp2)l.fogDensity.value=c.density;if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){var i,m=0,k=0,n=0,o,p,q,r=Ca,s=r.directional.colors,t=r.directional.positions,z=r.point.colors,u=r.point.positions,E=r.point.distances,w=0,F=0,D=q=0;for(c=0,h=b.length;c<h;c++)if(i=b[c],!i.onlyShadow)if(o=i.color,p=i.intensity,q=i.distance,i instanceof THREE.AmbientLight)B.gammaInput?(m+=o.r*o.r,k+=o.g*o.g,n+=o.b*o.b):
-(m+=o.r,k+=o.g,n+=o.b);else if(i instanceof THREE.DirectionalLight)q=3*w,B.gammaInput?(s[q]=o.r*o.r*p*p,s[q+1]=o.g*o.g*p*p,s[q+2]=o.b*o.b*p*p):(s[q]=o.r*p,s[q+1]=o.g*p,s[q+2]=o.b*p),oa.copy(i.matrixWorld.getPosition()),oa.subSelf(i.target.matrixWorld.getPosition()),oa.normalize(),t[q]=oa.x,t[q+1]=oa.y,t[q+2]=oa.z,w+=1;else if(i instanceof THREE.PointLight||i instanceof THREE.SpotLight)D=3*F,B.gammaInput?(z[D]=o.r*o.r*p*p,z[D+1]=o.g*o.g*p*p,z[D+2]=o.b*o.b*p*p):(z[D]=o.r*p,z[D+1]=o.g*p,z[D+2]=o.b*p),
-i=i.matrixWorld.getPosition(),u[D]=i.x,u[D+1]=i.y,u[D+2]=i.z,E[F]=q,F+=1;for(c=3*w,h=s.length;c<h;c++)s[c]=0;for(c=3*F,h=z.length;c<h;c++)z[c]=0;r.point.length=F;r.directional.length=w;r.ambient[0]=m;r.ambient[1]=k;r.ambient[2]=n;c=Ca;l.ambientLightColor.value=c.ambient;l.directionalLightColor.value=c.directional.colors;l.directionalLightDirection.value=c.directional.positions;l.pointLightColor.value=c.point.colors;l.pointLightPosition.value=c.point.positions;l.pointLightDistance.value=c.point.distances}if(d instanceof
-THREE.MeshBasicMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.MeshPhongMaterial)l.opacity.value=d.opacity,B.gammaInput?l.diffuse.value.copyGammaToLinear(d.color):l.diffuse.value=d.color,(l.map.texture=d.map)&&l.offsetRepeat.value.set(d.map.offset.x,d.map.offset.y,d.map.repeat.x,d.map.repeat.y),l.lightMap.texture=d.lightMap,l.envMap.texture=d.envMap,l.flipEnvMap.value=d.envMap instanceof THREE.WebGLRenderTargetCube?1:-1,l.reflectivity.value=d.reflectivity,l.refractionRatio.value=
-d.refractionRatio,l.combine.value=d.combine,l.useRefract.value=d.envMap&&d.envMap.mapping instanceof THREE.CubeRefractionMapping;if(d instanceof THREE.LineBasicMaterial)l.diffuse.value=d.color,l.opacity.value=d.opacity;else if(d instanceof THREE.ParticleBasicMaterial)l.psColor.value=d.color,l.opacity.value=d.opacity,l.size.value=d.size,l.scale.value=G.height/2,l.map.texture=d.map;else if(d instanceof THREE.MeshPhongMaterial)l.shininess.value=d.shininess,B.gammaInput?(l.ambient.value.copyGammaToLinear(d.ambient),
-l.emissive.value.copyGammaToLinear(d.emissive),l.specular.value.copyGammaToLinear(d.specular)):(l.ambient.value=d.ambient,l.emissive.value=d.emissive,l.specular.value=d.specular),d.wrapAround&&l.wrapRGB.value.copy(d.wrapRGB);else if(d instanceof THREE.MeshLambertMaterial)B.gammaInput?(l.ambient.value.copyGammaToLinear(d.ambient),l.emissive.value.copyGammaToLinear(d.emissive)):(l.ambient.value=d.ambient,l.emissive.value=d.emissive),d.wrapAround&&l.wrapRGB.value.copy(d.wrapRGB);else if(d instanceof
-THREE.MeshDepthMaterial)l.mNear.value=a.near,l.mFar.value=a.far,l.opacity.value=d.opacity;else if(d instanceof THREE.MeshNormalMaterial)l.opacity.value=d.opacity;if(e.receiveShadow&&!d._shadowPass&&l.shadowMatrix){h=c=0;for(m=b.length;h<m;h++)if(k=b[h],k.castShadow&&(k instanceof THREE.SpotLight||k instanceof THREE.DirectionalLight&&!k.shadowCascade))l.shadowMap.texture[c]=k.shadowMap,l.shadowMapSize.value[c]=k.shadowMapSize,l.shadowMatrix.value[c]=k.shadowMatrix,l.shadowDarkness.value[c]=k.shadowDarkness,
-l.shadowBias.value[c]=k.shadowBias,c++}b=d.uniformsList;for(l=0,c=b.length;l<c;l++)if(k=f.uniforms[b[l][1]])if(h=b[l][0],n=h.type,m=h.value,"i"===n)j.uniform1i(k,m);else if("f"===n)j.uniform1f(k,m);else if("v2"===n)j.uniform2f(k,m.x,m.y);else if("v3"===n)j.uniform3f(k,m.x,m.y,m.z);else if("v4"===n)j.uniform4f(k,m.x,m.y,m.z,m.w);else if("c"===n)j.uniform3f(k,m.r,m.g,m.b);else if("fv1"===n)j.uniform1fv(k,m);else if("fv"===n)j.uniform3fv(k,m);else if("v2v"===n){if(!h._array)h._array=new Float32Array(2*
-m.length);for(n=0,r=m.length;n<r;n++)s=2*n,h._array[s]=m[n].x,h._array[s+1]=m[n].y;j.uniform2fv(k,h._array)}else if("v3v"===n){if(!h._array)h._array=new Float32Array(3*m.length);for(n=0,r=m.length;n<r;n++)s=3*n,h._array[s]=m[n].x,h._array[s+1]=m[n].y,h._array[s+2]=m[n].z;j.uniform3fv(k,h._array)}else if("v4v"==n){if(!h._array)h._array=new Float32Array(4*m.length);for(n=0,r=m.length;n<r;n++)s=4*n,h._array[s]=m[n].x,h._array[s+1]=m[n].y,h._array[s+2]=m[n].z,h._array[s+3]=m[n].w;j.uniform4fv(k,h._array)}else if("m4"===
-n){if(!h._array)h._array=new Float32Array(16);m.flattenToArray(h._array);j.uniformMatrix4fv(k,!1,h._array)}else if("m4v"===n){if(!h._array)h._array=new Float32Array(16*m.length);for(n=0,r=m.length;n<r;n++)m[n].flattenToArrayOffset(h._array,16*n);j.uniformMatrix4fv(k,!1,h._array)}else if("t"===n){if(j.uniform1i(k,m),k=h.texture)if(k.image instanceof Array&&6===k.image.length){if(h=k,6===h.image.length)if(h.needsUpdate){if(!h.image.__webglTextureCube)h.image.__webglTextureCube=j.createTexture();j.activeTexture(j.TEXTURE0+
-m);j.bindTexture(j.TEXTURE_CUBE_MAP,h.image.__webglTextureCube);m=[];for(k=0;6>k;k++){n=m;r=k;if(B.autoScaleCubemaps){if(s=h.image[k],z=sa,!(s.width<=z&&s.height<=z))u=Math.max(s.width,s.height),t=Math.floor(s.width*z/u),z=Math.floor(s.height*z/u),u=document.createElement("canvas"),u.width=t,u.height=z,u.getContext("2d").drawImage(s,0,0,s.width,s.height,0,0,t,z),s=u}else s=h.image[k];n[r]=s}k=m[0];n=0===(k.width&k.width-1)&&0===(k.height&k.height-1);r=A(h.format);s=A(h.type);v(j.TEXTURE_CUBE_MAP,
-h,n);for(k=0;6>k;k++)j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+k,0,r,r,s,m[k]);h.generateMipmaps&&n&&j.generateMipmap(j.TEXTURE_CUBE_MAP);h.needsUpdate=!1;if(h.onUpdate)h.onUpdate()}else j.activeTexture(j.TEXTURE0+m),j.bindTexture(j.TEXTURE_CUBE_MAP,h.image.__webglTextureCube)}else k instanceof THREE.WebGLRenderTargetCube?(h=k,j.activeTexture(j.TEXTURE0+m),j.bindTexture(j.TEXTURE_CUBE_MAP,h.__webglTexture)):B.setTexture(k,m)}else if("tv"===n){if(!h._array){h._array=[];for(n=0,r=h.texture.length;n<
-r;n++)h._array[n]=m+n}j.uniform1iv(k,h._array);for(n=0,r=h.texture.length;n<r;n++)(k=h.texture[n])&&B.setTexture(k,h._array[n])}if((d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&null!==g.cameraPosition)b=a.matrixWorld.getPosition(),j.uniform3f(g.cameraPosition,b.x,b.y,b.z);(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.ShaderMaterial||d.skinning)&&null!==g.viewMatrix&&j.uniformMatrix4fv(g.viewMatrix,!1,a._viewMatrixArray);
-d.skinning&&j.uniformMatrix4fv(g.boneGlobalMatrices,!1,e.boneMatrices)}j.uniformMatrix4fv(g.modelViewMatrix,!1,e._modelViewMatrixArray);g.normalMatrix&&j.uniformMatrix3fv(g.normalMatrix,!1,e._normalMatrixArray);(d instanceof THREE.ShaderMaterial||d.envMap||d.skinning||e.receiveShadow)&&null!==g.objectMatrix&&j.uniformMatrix4fv(g.objectMatrix,!1,e._objectMatrixArray);return f}function r(a,b){a._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,a.matrixWorld,a._modelViewMatrixArray);var c=THREE.Matrix4.makeInvert3x3(a._modelViewMatrix);
-c&&c.transposeIntoArray(a._normalMatrixArray)}function s(a,b,c){ia!==a&&(a?j.enable(j.POLYGON_OFFSET_FILL):j.disable(j.POLYGON_OFFSET_FILL),ia=a);if(a&&(Sa!==b||na!==c))j.polygonOffset(b,c),Sa=b,na=c}function u(a,b){var c;"fragment"===a?c=j.createShader(j.FRAGMENT_SHADER):"vertex"===a&&(c=j.createShader(j.VERTEX_SHADER));j.shaderSource(c,b);j.compileShader(c);return!j.getShaderParameter(c,j.COMPILE_STATUS)?(console.error(j.getShaderInfoLog(c)),console.error(b),null):c}function v(a,b,c){c?(j.texParameteri(a,
-j.TEXTURE_WRAP_S,A(b.wrapS)),j.texParameteri(a,j.TEXTURE_WRAP_T,A(b.wrapT)),j.texParameteri(a,j.TEXTURE_MAG_FILTER,A(b.magFilter)),j.texParameteri(a,j.TEXTURE_MIN_FILTER,A(b.minFilter))):(j.texParameteri(a,j.TEXTURE_WRAP_S,j.CLAMP_TO_EDGE),j.texParameteri(a,j.TEXTURE_WRAP_T,j.CLAMP_TO_EDGE),j.texParameteri(a,j.TEXTURE_MAG_FILTER,w(b.magFilter)),j.texParameteri(a,j.TEXTURE_MIN_FILTER,w(b.minFilter)))}function t(a,b){j.bindRenderbuffer(j.RENDERBUFFER,a);b.depthBuffer&&!b.stencilBuffer?(j.renderbufferStorage(j.RENDERBUFFER,
-j.DEPTH_COMPONENT16,b.width,b.height),j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_ATTACHMENT,j.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(j.renderbufferStorage(j.RENDERBUFFER,j.DEPTH_STENCIL,b.width,b.height),j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_STENCIL_ATTACHMENT,j.RENDERBUFFER,a)):j.renderbufferStorage(j.RENDERBUFFER,j.RGBA4,b.width,b.height)}function w(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return j.NEAREST;
-default:return j.LINEAR}}function A(a){switch(a){case THREE.RepeatWrapping:return j.REPEAT;case THREE.ClampToEdgeWrapping:return j.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return j.MIRRORED_REPEAT;case THREE.NearestFilter:return j.NEAREST;case THREE.NearestMipMapNearestFilter:return j.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return j.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return j.LINEAR;case THREE.LinearMipMapNearestFilter:return j.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return j.LINEAR_MIPMAP_LINEAR;
-case THREE.ByteType:return j.BYTE;case THREE.UnsignedByteType:return j.UNSIGNED_BYTE;case THREE.ShortType:return j.SHORT;case THREE.UnsignedShortType:return j.UNSIGNED_SHORT;case THREE.IntType:return j.INT;case THREE.UnsignedIntType:return j.UNSIGNED_INT;case THREE.FloatType:return j.FLOAT;case THREE.AlphaFormat:return j.ALPHA;case THREE.RGBFormat:return j.RGB;case THREE.RGBAFormat:return j.RGBA;case THREE.LuminanceFormat:return j.LUMINANCE;case THREE.LuminanceAlphaFormat:return j.LUMINANCE_ALPHA}return 0}
-var a=a||{},G=void 0!==a.canvas?a.canvas:document.createElement("canvas"),F=void 0!==a.precision?a.precision:"highp",D=void 0!==a.alpha?a.alpha:!0,J=void 0!==a.premultipliedAlpha?a.premultipliedAlpha:!0,O=void 0!==a.antialias?a.antialias:!1,P=void 0!==a.stencil?a.stencil:!0,U=void 0!==a.preserveDrawingBuffer?a.preserveDrawingBuffer:!1,L=void 0!==a.clearColor?new THREE.Color(a.clearColor):new THREE.Color(0),I=void 0!==a.clearAlpha?a.clearAlpha:0,M=void 0!==a.maxLights?a.maxLights:4;this.domElement=
-G;this.context=null;this.autoUpdateScene=this.autoUpdateObjects=this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.shadowMapEnabled=this.physicallyBasedShading=this.gammaOutput=this.gammaInput=!1;this.shadowMapCullFrontFaces=this.shadowMapSoft=this.shadowMapAutoUpdate=!0;this.shadowMapCascade=this.shadowMapDebug=!1;this.maxMorphTargets=8;this.maxMorphNormals=4;this.autoScaleCubemaps=!0;this.renderPluginsPre=[];this.renderPluginsPost=[];this.info=
-{memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0,points:0}};var B=this,j,T=[],C=null,z=null,R=-1,E=null,ga=null,ea=0,ca=null,S=null,Q=null,W=null,aa=null,ia=null,Sa=null,na=null,Ka=null,Aa=0,Ba=0,ra=0,bb=0,jb=0,Va=0,cb=new THREE.Frustum,eb=new THREE.Matrix4,db=new THREE.Matrix4,Ga=new THREE.Vector4,oa=new THREE.Vector3,Ca={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}};j=function(){var a;try{if(!(a=
-G.getContext("experimental-webgl",{alpha:D,premultipliedAlpha:J,antialias:O,stencil:P,preserveDrawingBuffer:U})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+a.getParameter(a.VERSION)+" | "+a.getParameter(a.VENDOR)+" | "+a.getParameter(a.RENDERER)+" | "+a.getParameter(a.SHADING_LANGUAGE_VERSION))}catch(b){console.error(b)}return a}();j.clearColor(0,0,0,1);j.clearDepth(1);j.clearStencil(0);j.enable(j.DEPTH_TEST);j.depthFunc(j.LEQUAL);j.frontFace(j.CCW);j.cullFace(j.BACK);
-j.enable(j.CULL_FACE);j.enable(j.BLEND);j.blendEquation(j.FUNC_ADD);j.blendFunc(j.SRC_ALPHA,j.ONE_MINUS_SRC_ALPHA);j.clearColor(L.r,L.g,L.b,I);this.context=j;var Oa=j.getParameter(j.MAX_VERTEX_TEXTURE_IMAGE_UNITS);j.getParameter(j.MAX_TEXTURE_SIZE);var sa=j.getParameter(j.MAX_CUBE_MAP_TEXTURE_SIZE);this.getContext=function(){return j};this.supportsVertexTextures=function(){return 0<Oa};this.setSize=function(a,b){G.width=a;G.height=b;this.setViewport(0,0,G.width,G.height)};this.setViewport=function(a,
-b,c,d){Aa=a;Ba=b;ra=c;bb=d;j.viewport(Aa,Ba,ra,bb)};this.setScissor=function(a,b,c,d){j.scissor(a,b,c,d)};this.enableScissorTest=function(a){a?j.enable(j.SCISSOR_TEST):j.disable(j.SCISSOR_TEST)};this.setClearColorHex=function(a,b){L.setHex(a);I=b;j.clearColor(L.r,L.g,L.b,I)};this.setClearColor=function(a,b){L.copy(a);I=b;j.clearColor(L.r,L.g,L.b,I)};this.getClearColor=function(){return L};this.getClearAlpha=function(){return I};this.clear=function(a,b,c){var d=0;if(void 0===a||a)d|=j.COLOR_BUFFER_BIT;
-if(void 0===b||b)d|=j.DEPTH_BUFFER_BIT;if(void 0===c||c)d|=j.STENCIL_BUFFER_BIT;j.clear(d)};this.clearTarget=function(a,b,c,d){this.setRenderTarget(a);this.clear(b,c,d)};this.addPostPlugin=function(a){a.init(this);this.renderPluginsPost.push(a)};this.addPrePlugin=function(a){a.init(this);this.renderPluginsPre.push(a)};this.deallocateObject=function(a){if(a.__webglInit)if(a.__webglInit=!1,delete a._modelViewMatrix,delete a._normalMatrixArray,delete a._modelViewMatrixArray,delete a._objectMatrixArray,
-a instanceof THREE.Mesh)for(var b in a.geometry.geometryGroups){var c=a.geometry.geometryGroups[b];j.deleteBuffer(c.__webglVertexBuffer);j.deleteBuffer(c.__webglNormalBuffer);j.deleteBuffer(c.__webglTangentBuffer);j.deleteBuffer(c.__webglColorBuffer);j.deleteBuffer(c.__webglUVBuffer);j.deleteBuffer(c.__webglUV2Buffer);j.deleteBuffer(c.__webglSkinVertexABuffer);j.deleteBuffer(c.__webglSkinVertexBBuffer);j.deleteBuffer(c.__webglSkinIndicesBuffer);j.deleteBuffer(c.__webglSkinWeightsBuffer);j.deleteBuffer(c.__webglFaceBuffer);
-j.deleteBuffer(c.__webglLineBuffer);var d=void 0,e=void 0;if(c.numMorphTargets)for(d=0,e=c.numMorphTargets;d<e;d++)j.deleteBuffer(c.__webglMorphTargetsBuffers[d]);if(c.numMorphNormals)for(d=0,e=c.numMorphNormals;d<e;d++)j.deleteBuffer(c.__webglMorphNormalsBuffers[d]);if(c.__webglCustomAttributesList)for(d in d=void 0,c.__webglCustomAttributesList)j.deleteBuffer(c.__webglCustomAttributesList[d].buffer);B.info.memory.geometries--}else if(a instanceof THREE.Ribbon)a=a.geometry,j.deleteBuffer(a.__webglVertexBuffer),
-j.deleteBuffer(a.__webglColorBuffer),B.info.memory.geometries--;else if(a instanceof THREE.Line)a=a.geometry,j.deleteBuffer(a.__webglVertexBuffer),j.deleteBuffer(a.__webglColorBuffer),B.info.memory.geometries--;else if(a instanceof THREE.ParticleSystem)a=a.geometry,j.deleteBuffer(a.__webglVertexBuffer),j.deleteBuffer(a.__webglColorBuffer),B.info.memory.geometries--};this.deallocateTexture=function(a){if(a.__webglInit)a.__webglInit=!1,j.deleteTexture(a.__webglTexture),B.info.memory.textures--};this.deallocateRenderTarget=
-function(a){if(a&&a.__webglTexture)if(j.deleteTexture(a.__webglTexture),a instanceof THREE.WebGLRenderTargetCube)for(var b=0;6>b;b++)j.deleteFramebuffer(a.__webglFramebuffer[b]),j.deleteRenderbuffer(a.__webglRenderbuffer[b]);else j.deleteFramebuffer(a.__webglFramebuffer),j.deleteRenderbuffer(a.__webglRenderbuffer)};this.updateShadowMap=function(a,b){C=null;R=E=aa=W=Q=-1;this.shadowMapPlugin.update(a,b)};this.renderBufferImmediate=function(a,b,c){if(!a.__webglVertexBuffer)a.__webglVertexBuffer=j.createBuffer();
-if(!a.__webglNormalBuffer)a.__webglNormalBuffer=j.createBuffer();a.hasPos&&(j.bindBuffer(j.ARRAY_BUFFER,a.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,a.positionArray,j.DYNAMIC_DRAW),j.enableVertexAttribArray(b.attributes.position),j.vertexAttribPointer(b.attributes.position,3,j.FLOAT,!1,0,0));if(a.hasNormal){j.bindBuffer(j.ARRAY_BUFFER,a.__webglNormalBuffer);if(c===THREE.FlatShading){var d,e,f,g,h,l,i,m,k,n,o=3*a.count;for(n=0;n<o;n+=9)c=a.normalArray,d=c[n],e=c[n+1],f=c[n+2],g=c[n+3],l=c[n+
-4],m=c[n+5],h=c[n+6],i=c[n+7],k=c[n+8],d=(d+g+h)/3,e=(e+l+i)/3,f=(f+m+k)/3,c[n]=d,c[n+1]=e,c[n+2]=f,c[n+3]=d,c[n+4]=e,c[n+5]=f,c[n+6]=d,c[n+7]=e,c[n+8]=f}j.bufferData(j.ARRAY_BUFFER,a.normalArray,j.DYNAMIC_DRAW);j.enableVertexAttribArray(b.attributes.normal);j.vertexAttribPointer(b.attributes.normal,3,j.FLOAT,!1,0,0)}j.drawArrays(j.TRIANGLES,0,a.count);a.count=0};this.renderBufferDirect=function(a,b,c,d,e,f){if(0!==d.opacity&&(c=l(a,b,c,d,f),a=c.attributes,b=!1,d=16777215*e.id+2*c.id+(d.wireframe?
-1:0),d!==E&&(E=d,b=!0),f instanceof THREE.Mesh)){f=e.offsets;d=0;for(c=f.length;d<c;++d)b&&(j.bindBuffer(j.ARRAY_BUFFER,e.vertexPositionBuffer),j.vertexAttribPointer(a.position,e.vertexPositionBuffer.itemSize,j.FLOAT,!1,0,12*f[d].index),0<=a.normal&&e.vertexNormalBuffer&&(j.bindBuffer(j.ARRAY_BUFFER,e.vertexNormalBuffer),j.vertexAttribPointer(a.normal,e.vertexNormalBuffer.itemSize,j.FLOAT,!1,0,12*f[d].index)),0<=a.uv&&e.vertexUvBuffer&&(e.vertexUvBuffer?(j.bindBuffer(j.ARRAY_BUFFER,e.vertexUvBuffer),
-j.vertexAttribPointer(a.uv,e.vertexUvBuffer.itemSize,j.FLOAT,!1,0,8*f[d].index),j.enableVertexAttribArray(a.uv)):j.disableVertexAttribArray(a.uv)),0<=a.color&&e.vertexColorBuffer&&(j.bindBuffer(j.ARRAY_BUFFER,e.vertexColorBuffer),j.vertexAttribPointer(a.color,e.vertexColorBuffer.itemSize,j.FLOAT,!1,0,16*f[d].index)),j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,e.vertexIndexBuffer)),j.drawElements(j.TRIANGLES,f[d].count,j.UNSIGNED_SHORT,2*f[d].start),B.info.render.calls++,B.info.render.vertices+=f[d].count,
-B.info.render.faces+=f[d].count/3}};this.renderBuffer=function(a,b,c,d,e,f){if(0!==d.opacity){var g,h,c=l(a,b,c,d,f),b=c.attributes,a=!1,c=16777215*e.id+2*c.id+(d.wireframe?1:0);c!==E&&(E=c,a=!0);if(!d.morphTargets&&0<=b.position)a&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglVertexBuffer),j.vertexAttribPointer(b.position,3,j.FLOAT,!1,0,0));else if(f.morphTargetBase){c=d.program.attributes;-1!==f.morphTargetBase?(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[f.morphTargetBase]),j.vertexAttribPointer(c.position,
-3,j.FLOAT,!1,0,0)):0<=c.position&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglVertexBuffer),j.vertexAttribPointer(c.position,3,j.FLOAT,!1,0,0));if(f.morphTargetForcedOrder.length){g=0;var i=f.morphTargetForcedOrder;for(h=f.morphTargetInfluences;g<d.numSupportedMorphTargets&&g<i.length;)j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[i[g]]),j.vertexAttribPointer(c["morphTarget"+g],3,j.FLOAT,!1,0,0),d.morphNormals&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[i[g]]),j.vertexAttribPointer(c["morphNormal"+
-g],3,j.FLOAT,!1,0,0)),f.__webglMorphTargetInfluences[g]=h[i[g]],g++}else{var i=[],m=-1,k=0;h=f.morphTargetInfluences;var n,o=h.length;g=0;for(-1!==f.morphTargetBase&&(i[f.morphTargetBase]=!0);g<d.numSupportedMorphTargets;){for(n=0;n<o;n++)!i[n]&&h[n]>m&&(k=n,m=h[k]);j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[k]);j.vertexAttribPointer(c["morphTarget"+g],3,j.FLOAT,!1,0,0);d.morphNormals&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[k]),j.vertexAttribPointer(c["morphNormal"+
-g],3,j.FLOAT,!1,0,0));f.__webglMorphTargetInfluences[g]=m;i[k]=1;m=-1;g++}}null!==d.program.uniforms.morphTargetInfluences&&j.uniform1fv(d.program.uniforms.morphTargetInfluences,f.__webglMorphTargetInfluences)}if(a){if(e.__webglCustomAttributesList)for(g=0,h=e.__webglCustomAttributesList.length;g<h;g++)c=e.__webglCustomAttributesList[g],0<=b[c.buffer.belongsToAttribute]&&(j.bindBuffer(j.ARRAY_BUFFER,c.buffer),j.vertexAttribPointer(b[c.buffer.belongsToAttribute],c.size,j.FLOAT,!1,0,0));0<=b.color&&
-(j.bindBuffer(j.ARRAY_BUFFER,e.__webglColorBuffer),j.vertexAttribPointer(b.color,3,j.FLOAT,!1,0,0));0<=b.normal&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglNormalBuffer),j.vertexAttribPointer(b.normal,3,j.FLOAT,!1,0,0));0<=b.tangent&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglTangentBuffer),j.vertexAttribPointer(b.tangent,4,j.FLOAT,!1,0,0));0<=b.uv&&(e.__webglUVBuffer?(j.bindBuffer(j.ARRAY_BUFFER,e.__webglUVBuffer),j.vertexAttribPointer(b.uv,2,j.FLOAT,!1,0,0),j.enableVertexAttribArray(b.uv)):j.disableVertexAttribArray(b.uv));
-0<=b.uv2&&(e.__webglUV2Buffer?(j.bindBuffer(j.ARRAY_BUFFER,e.__webglUV2Buffer),j.vertexAttribPointer(b.uv2,2,j.FLOAT,!1,0,0),j.enableVertexAttribArray(b.uv2)):j.disableVertexAttribArray(b.uv2));d.skinning&&0<=b.skinVertexA&&0<=b.skinVertexB&&0<=b.skinIndex&&0<=b.skinWeight&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinVertexABuffer),j.vertexAttribPointer(b.skinVertexA,4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinVertexBBuffer),j.vertexAttribPointer(b.skinVertexB,4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,
-e.__webglSkinIndicesBuffer),j.vertexAttribPointer(b.skinIndex,4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinWeightsBuffer),j.vertexAttribPointer(b.skinWeight,4,j.FLOAT,!1,0,0))}f instanceof THREE.Mesh?(d.wireframe?(d=d.wireframeLinewidth,d!==Ka&&(j.lineWidth(d),Ka=d),a&&j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,e.__webglLineBuffer),j.drawElements(j.LINES,e.__webglLineCount,j.UNSIGNED_SHORT,0)):(a&&j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,e.__webglFaceBuffer),j.drawElements(j.TRIANGLES,e.__webglFaceCount,
-j.UNSIGNED_SHORT,0)),B.info.render.calls++,B.info.render.vertices+=e.__webglFaceCount,B.info.render.faces+=e.__webglFaceCount/3):f instanceof THREE.Line?(f=f.type===THREE.LineStrip?j.LINE_STRIP:j.LINES,d=d.linewidth,d!==Ka&&(j.lineWidth(d),Ka=d),j.drawArrays(f,0,e.__webglLineCount),B.info.render.calls++):f instanceof THREE.ParticleSystem?(j.drawArrays(j.POINTS,0,e.__webglParticleCount),B.info.render.calls++,B.info.render.points+=e.__webglParticleCount):f instanceof THREE.Ribbon&&(j.drawArrays(j.TRIANGLE_STRIP,
-0,e.__webglVertexCount),B.info.render.calls++)}};this.render=function(a,b,c,d){var e,f,l,k,n=a.__lights,o=a.fog;R=-1;void 0===b.parent&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),a.add(b));this.autoUpdateScene&&a.updateMatrixWorld();if(!b._viewMatrixArray)b._viewMatrixArray=new Float32Array(16);if(!b._projectionMatrixArray)b._projectionMatrixArray=new Float32Array(16);b.matrixWorldInverse.getInverse(b.matrixWorld);b.matrixWorldInverse.flattenToArray(b._viewMatrixArray);
-b.projectionMatrix.flattenToArray(b._projectionMatrixArray);eb.multiply(b.projectionMatrix,b.matrixWorldInverse);cb.setFromMatrix(eb);this.autoUpdateObjects&&this.initWebGLObjects(a);h(this.renderPluginsPre,a,b);B.info.render.calls=0;B.info.render.vertices=0;B.info.render.faces=0;B.info.render.points=0;this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);k=a.__webglObjects;for(d=0,e=k.length;d<e;d++)if(f=k[d],l=f.object,f.render=!1,
-l.visible&&(!(l instanceof THREE.Mesh||l instanceof THREE.ParticleSystem)||!l.frustumCulled||cb.contains(l))){l.matrixWorld.flattenToArray(l._objectMatrixArray);r(l,b);var p=f,q=p.object,t=p.buffer,z=void 0,z=z=void 0,z=q.material;if(z instanceof THREE.MeshFaceMaterial){if(z=t.materialIndex,0<=z)z=q.geometry.materials[z],z.transparent?(p.transparent=z,p.opaque=null):(p.opaque=z,p.transparent=null)}else if(z)z.transparent?(p.transparent=z,p.opaque=null):(p.opaque=z,p.transparent=null);f.render=!0;
-if(this.sortObjects)l.renderDepth?f.z=l.renderDepth:(Ga.copy(l.matrixWorld.getPosition()),eb.multiplyVector3(Ga),f.z=Ga.z)}this.sortObjects&&k.sort(g);k=a.__webglObjectsImmediate;for(d=0,e=k.length;d<e;d++)if(f=k[d],l=f.object,l.visible)l.matrixAutoUpdate&&l.matrixWorld.flattenToArray(l._objectMatrixArray),r(l,b),l=f.object.material,l.transparent?(f.transparent=l,f.opaque=null):(f.opaque=l,f.transparent=null);a.overrideMaterial?(this.setBlending(a.overrideMaterial.blending),this.setDepthTest(a.overrideMaterial.depthTest),
-this.setDepthWrite(a.overrideMaterial.depthWrite),s(a.overrideMaterial.polygonOffset,a.overrideMaterial.polygonOffsetFactor,a.overrideMaterial.polygonOffsetUnits),i(a.__webglObjects,!1,"",b,n,o,!0,a.overrideMaterial),m(a.__webglObjectsImmediate,"",b,n,o,!1,a.overrideMaterial)):(this.setBlending(THREE.NormalBlending),i(a.__webglObjects,!0,"opaque",b,n,o,!1),m(a.__webglObjectsImmediate,"opaque",b,n,o,!1),i(a.__webglObjects,!1,"transparent",b,n,o,!0),m(a.__webglObjectsImmediate,"transparent",b,n,o,!0));
-h(this.renderPluginsPost,a,b);c&&c.generateMipmaps&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&(c instanceof THREE.WebGLRenderTargetCube?(j.bindTexture(j.TEXTURE_CUBE_MAP,c.__webglTexture),j.generateMipmap(j.TEXTURE_CUBE_MAP),j.bindTexture(j.TEXTURE_CUBE_MAP,null)):(j.bindTexture(j.TEXTURE_2D,c.__webglTexture),j.generateMipmap(j.TEXTURE_2D),j.bindTexture(j.TEXTURE_2D,null)));this.setDepthTest(!0);this.setDepthWrite(!0)};this.renderImmediateObject=function(a,b,c,d,e){var f=
-l(a,b,c,d,e);E=-1;B.setObjectFaces(e);e.immediateRenderCallback?e.immediateRenderCallback(f,j,cb):e.render(function(a){B.renderBufferImmediate(a,f,d.shading)})};this.initWebGLObjects=function(a){if(!a.__webglObjects)a.__webglObjects=[],a.__webglObjectsImmediate=[],a.__webglSprites=[],a.__webglFlares=[];for(;a.__objectsAdded.length;){var g=a.__objectsAdded[0],h=a,l=void 0,i=void 0,m=void 0;if(!g.__webglInit)if(g.__webglInit=!0,g._modelViewMatrix=new THREE.Matrix4,g._normalMatrixArray=new Float32Array(9),
-g._modelViewMatrixArray=new Float32Array(16),g._objectMatrixArray=new Float32Array(16),g.matrixWorld.flattenToArray(g._objectMatrixArray),g instanceof THREE.Mesh){if(i=g.geometry,i instanceof THREE.Geometry){if(void 0===i.geometryGroups){var r=i,s=void 0,z=void 0,t=void 0,u=void 0,v=void 0,E=void 0,w=void 0,C={},D=r.morphTargets.length,F=r.morphNormals.length;r.geometryGroups={};for(s=0,z=r.faces.length;s<z;s++)t=r.faces[s],u=t.materialIndex,E=void 0!==u?u:-1,void 0===C[E]&&(C[E]={hash:E,counter:0}),
-w=C[E].hash+"_"+C[E].counter,void 0===r.geometryGroups[w]&&(r.geometryGroups[w]={faces3:[],faces4:[],materialIndex:u,vertices:0,numMorphTargets:D,numMorphNormals:F}),v=t instanceof THREE.Face3?3:4,65535<r.geometryGroups[w].vertices+v&&(C[E].counter+=1,w=C[E].hash+"_"+C[E].counter,void 0===r.geometryGroups[w]&&(r.geometryGroups[w]={faces3:[],faces4:[],materialIndex:u,vertices:0,numMorphTargets:D,numMorphNormals:F})),t instanceof THREE.Face3?r.geometryGroups[w].faces3.push(s):r.geometryGroups[w].faces4.push(s),
-r.geometryGroups[w].vertices+=v;r.geometryGroupsList=[];var A=void 0;for(A in r.geometryGroups)r.geometryGroups[A].id=ea++,r.geometryGroupsList.push(r.geometryGroups[A])}for(l in i.geometryGroups)if(m=i.geometryGroups[l],!m.__webglVertexBuffer){var R=m;R.__webglVertexBuffer=j.createBuffer();R.__webglNormalBuffer=j.createBuffer();R.__webglTangentBuffer=j.createBuffer();R.__webglColorBuffer=j.createBuffer();R.__webglUVBuffer=j.createBuffer();R.__webglUV2Buffer=j.createBuffer();R.__webglSkinVertexABuffer=
-j.createBuffer();R.__webglSkinVertexBBuffer=j.createBuffer();R.__webglSkinIndicesBuffer=j.createBuffer();R.__webglSkinWeightsBuffer=j.createBuffer();R.__webglFaceBuffer=j.createBuffer();R.__webglLineBuffer=j.createBuffer();var G=void 0,I=void 0;if(R.numMorphTargets){R.__webglMorphTargetsBuffers=[];for(G=0,I=R.numMorphTargets;G<I;G++)R.__webglMorphTargetsBuffers.push(j.createBuffer())}if(R.numMorphNormals){R.__webglMorphNormalsBuffers=[];for(G=0,I=R.numMorphNormals;G<I;G++)R.__webglMorphNormalsBuffers.push(j.createBuffer())}B.info.memory.geometries++;
-var Q=m,M=g,J=M.geometry,ga=Q.faces3,W=Q.faces4,L=3*ga.length+4*W.length,O=1*ga.length+2*W.length,S=3*ga.length+4*W.length,P=c(M,Q),aa=e(P),ia=d(P),U=P.vertexColors?P.vertexColors:!1;Q.__vertexArray=new Float32Array(3*L);if(ia)Q.__normalArray=new Float32Array(3*L);if(J.hasTangents)Q.__tangentArray=new Float32Array(4*L);if(U)Q.__colorArray=new Float32Array(3*L);if(aa){if(0<J.faceUvs.length||0<J.faceVertexUvs.length)Q.__uvArray=new Float32Array(2*L);if(1<J.faceUvs.length||1<J.faceVertexUvs.length)Q.__uv2Array=
-new Float32Array(2*L)}if(M.geometry.skinWeights.length&&M.geometry.skinIndices.length)Q.__skinVertexAArray=new Float32Array(4*L),Q.__skinVertexBArray=new Float32Array(4*L),Q.__skinIndexArray=new Float32Array(4*L),Q.__skinWeightArray=new Float32Array(4*L);Q.__faceArray=new Uint16Array(3*O);Q.__lineArray=new Uint16Array(2*S);var T=void 0,ca=void 0;if(Q.numMorphTargets){Q.__morphTargetsArrays=[];for(T=0,ca=Q.numMorphTargets;T<ca;T++)Q.__morphTargetsArrays.push(new Float32Array(3*L))}if(Q.numMorphNormals){Q.__morphNormalsArrays=
-[];for(T=0,ca=Q.numMorphNormals;T<ca;T++)Q.__morphNormalsArrays.push(new Float32Array(3*L))}Q.__webglFaceCount=3*O;Q.__webglLineCount=2*S;if(P.attributes){if(void 0===Q.__webglCustomAttributesList)Q.__webglCustomAttributesList=[];var Ka=void 0;for(Ka in P.attributes){var Sa=P.attributes[Ka],na={},Ba;for(Ba in Sa)na[Ba]=Sa[Ba];if(!na.__webglInitialized||na.createUniqueBuffers){na.__webglInitialized=!0;var Aa=1;"v2"===na.type?Aa=2:"v3"===na.type?Aa=3:"v4"===na.type?Aa=4:"c"===na.type&&(Aa=3);na.size=
-Aa;na.array=new Float32Array(L*Aa);na.buffer=j.createBuffer();na.buffer.belongsToAttribute=Ka;Sa.needsUpdate=!0;na.__original=Sa}Q.__webglCustomAttributesList.push(na)}}Q.__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(g instanceof THREE.Ribbon){if(i=g.geometry,!i.__webglVertexBuffer){var ra=i;ra.__webglVertexBuffer=j.createBuffer();ra.__webglColorBuffer=j.createBuffer();B.info.memory.geometries++;
-var oa=i,sa=oa.vertices.length;oa.__vertexArray=new Float32Array(3*sa);oa.__colorArray=new Float32Array(3*sa);oa.__webglVertexCount=sa;i.__dirtyVertices=!0;i.__dirtyColors=!0}}else if(g instanceof THREE.Line){if(i=g.geometry,!i.__webglVertexBuffer){var Ca=i;Ca.__webglVertexBuffer=j.createBuffer();Ca.__webglColorBuffer=j.createBuffer();B.info.memory.geometries++;var Ga=i,Oa=g,bb=Ga.vertices.length;Ga.__vertexArray=new Float32Array(3*bb);Ga.__colorArray=new Float32Array(3*bb);Ga.__webglLineCount=bb;
-b(Ga,Oa);i.__dirtyVertices=!0;i.__dirtyColors=!0}}else if(g instanceof THREE.ParticleSystem&&(i=g.geometry,!i.__webglVertexBuffer)){var jb=i;jb.__webglVertexBuffer=j.createBuffer();jb.__webglColorBuffer=j.createBuffer();B.info.geometries++;var Va=i,eb=g,cb=Va.vertices.length;Va.__vertexArray=new Float32Array(3*cb);Va.__colorArray=new Float32Array(3*cb);Va.__sortArray=[];Va.__webglParticleCount=cb;b(Va,eb);i.__dirtyVertices=!0;i.__dirtyColors=!0}if(!g.__webglActive){if(g instanceof THREE.Mesh)if(i=
-g.geometry,i instanceof THREE.BufferGeometry)k(h.__webglObjects,i,g);else for(l in i.geometryGroups)m=i.geometryGroups[l],k(h.__webglObjects,m,g);else g instanceof THREE.Ribbon||g instanceof THREE.Line||g instanceof THREE.ParticleSystem?(i=g.geometry,k(h.__webglObjects,i,g)):g instanceof THREE.ImmediateRenderObject||g.immediateRenderCallback?h.__webglObjectsImmediate.push({object:g,opaque:null,transparent:null}):g instanceof THREE.Sprite?h.__webglSprites.push(g):g instanceof THREE.LensFlare&&h.__webglFlares.push(g);
-g.__webglActive=!0}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;){var gb=a.__objectsRemoved[0],db=a;gb instanceof THREE.Mesh||gb instanceof THREE.ParticleSystem||gb instanceof THREE.Ribbon||gb instanceof THREE.Line?o(db.__webglObjects,gb):gb instanceof THREE.Sprite?q(db.__webglSprites,gb):gb instanceof THREE.LensFlare?q(db.__webglFlares,gb):(gb instanceof THREE.ImmediateRenderObject||gb.immediateRenderCallback)&&o(db.__webglObjectsImmediate,gb);gb.__webglActive=!1;a.__objectsRemoved.splice(0,
-1)}for(var Vc=0,qd=a.__webglObjects.length;Vc<qd;Vc++){var nb=a.__webglObjects[Vc].object,ja=nb.geometry,qc=void 0,ic=void 0,Xa=void 0;if(nb instanceof THREE.Mesh)if(ja instanceof THREE.BufferGeometry)ja.__dirtyVertices=!1,ja.__dirtyElements=!1,ja.__dirtyUvs=!1,ja.__dirtyNormals=!1,ja.__dirtyColors=!1;else{for(var Wc=0,rd=ja.geometryGroupsList.length;Wc<rd;Wc++)if(qc=ja.geometryGroupsList[Wc],Xa=c(nb,qc),ic=Xa.attributes&&p(Xa),ja.__dirtyVertices||ja.__dirtyMorphTargets||ja.__dirtyElements||ja.__dirtyUvs||
-ja.__dirtyNormals||ja.__dirtyColors||ja.__dirtyTangents||ic){var fa=qc,sd=nb,Za=j.DYNAMIC_DRAW,td=!ja.dynamic,bc=Xa;if(fa.__inittedArrays){var fd=d(bc),Xc=bc.vertexColors?bc.vertexColors:!1,gd=e(bc),Fc=fd===THREE.SmoothShading,H=void 0,V=void 0,lb=void 0,N=void 0,jc=void 0,Ob=void 0,ob=void 0,Gc=void 0,Hb=void 0,kc=void 0,lc=void 0,Y=void 0,Z=void 0,$=void 0,pa=void 0,pb=void 0,qb=void 0,rb=void 0,rc=void 0,sb=void 0,tb=void 0,ub=void 0,sc=void 0,vb=void 0,wb=void 0,xb=void 0,tc=void 0,yb=void 0,
-zb=void 0,Ab=void 0,uc=void 0,Bb=void 0,Cb=void 0,Db=void 0,vc=void 0,Pb=void 0,Qb=void 0,Rb=void 0,Hc=void 0,Sb=void 0,Tb=void 0,Ub=void 0,Ic=void 0,ka=void 0,hd=void 0,Vb=void 0,mc=void 0,nc=void 0,La=void 0,id=void 0,Ia=void 0,Ja=void 0,Wb=void 0,Ib=void 0,Da=0,Ha=0,Jb=0,Kb=0,hb=0,Ra=0,qa=0,Ta=0,Ea=0,K=0,da=0,y=0,$a=void 0,Ma=fa.__vertexArray,wc=fa.__uvArray,xc=fa.__uv2Array,ib=fa.__normalArray,ua=fa.__tangentArray,Na=fa.__colorArray,va=fa.__skinVertexAArray,wa=fa.__skinVertexBArray,xa=fa.__skinIndexArray,
-ya=fa.__skinWeightArray,Yc=fa.__morphTargetsArrays,Zc=fa.__morphNormalsArrays,$c=fa.__webglCustomAttributesList,x=void 0,Eb=fa.__faceArray,ab=fa.__lineArray,Ua=sd.geometry,ud=Ua.__dirtyElements,jd=Ua.__dirtyUvs,vd=Ua.__dirtyNormals,wd=Ua.__dirtyTangents,xd=Ua.__dirtyColors,yd=Ua.__dirtyMorphTargets,cc=Ua.vertices,la=fa.faces3,ma=fa.faces4,Fa=Ua.faces,ad=Ua.faceVertexUvs[0],bd=Ua.faceVertexUvs[1],dc=Ua.skinVerticesA,ec=Ua.skinVerticesB,fc=Ua.skinIndices,Xb=Ua.skinWeights,Yb=Ua.morphTargets,Jc=Ua.morphNormals;
-if(Ua.__dirtyVertices){for(H=0,V=la.length;H<V;H++)N=Fa[la[H]],Y=cc[N.a].position,Z=cc[N.b].position,$=cc[N.c].position,Ma[Ha]=Y.x,Ma[Ha+1]=Y.y,Ma[Ha+2]=Y.z,Ma[Ha+3]=Z.x,Ma[Ha+4]=Z.y,Ma[Ha+5]=Z.z,Ma[Ha+6]=$.x,Ma[Ha+7]=$.y,Ma[Ha+8]=$.z,Ha+=9;for(H=0,V=ma.length;H<V;H++)N=Fa[ma[H]],Y=cc[N.a].position,Z=cc[N.b].position,$=cc[N.c].position,pa=cc[N.d].position,Ma[Ha]=Y.x,Ma[Ha+1]=Y.y,Ma[Ha+2]=Y.z,Ma[Ha+3]=Z.x,Ma[Ha+4]=Z.y,Ma[Ha+5]=Z.z,Ma[Ha+6]=$.x,Ma[Ha+7]=$.y,Ma[Ha+8]=$.z,Ma[Ha+9]=pa.x,Ma[Ha+10]=pa.y,
-Ma[Ha+11]=pa.z,Ha+=12;j.bindBuffer(j.ARRAY_BUFFER,fa.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,Ma,Za)}if(yd)for(La=0,id=Yb.length;La<id;La++){da=0;for(H=0,V=la.length;H<V;H++){Wb=la[H];N=Fa[Wb];Y=Yb[La].vertices[N.a].position;Z=Yb[La].vertices[N.b].position;$=Yb[La].vertices[N.c].position;Ia=Yc[La];Ia[da]=Y.x;Ia[da+1]=Y.y;Ia[da+2]=Y.z;Ia[da+3]=Z.x;Ia[da+4]=Z.y;Ia[da+5]=Z.z;Ia[da+6]=$.x;Ia[da+7]=$.y;Ia[da+8]=$.z;if(bc.morphNormals)Fc?(Ib=Jc[La].vertexNormals[Wb],sb=Ib.a,tb=Ib.b,ub=Ib.c):ub=
-tb=sb=Jc[La].faceNormals[Wb],Ja=Zc[La],Ja[da]=sb.x,Ja[da+1]=sb.y,Ja[da+2]=sb.z,Ja[da+3]=tb.x,Ja[da+4]=tb.y,Ja[da+5]=tb.z,Ja[da+6]=ub.x,Ja[da+7]=ub.y,Ja[da+8]=ub.z;da+=9}for(H=0,V=ma.length;H<V;H++){Wb=ma[H];N=Fa[Wb];Y=Yb[La].vertices[N.a].position;Z=Yb[La].vertices[N.b].position;$=Yb[La].vertices[N.c].position;pa=Yb[La].vertices[N.d].position;Ia=Yc[La];Ia[da]=Y.x;Ia[da+1]=Y.y;Ia[da+2]=Y.z;Ia[da+3]=Z.x;Ia[da+4]=Z.y;Ia[da+5]=Z.z;Ia[da+6]=$.x;Ia[da+7]=$.y;Ia[da+8]=$.z;Ia[da+9]=pa.x;Ia[da+10]=pa.y;Ia[da+
-11]=pa.z;if(bc.morphNormals)Fc?(Ib=Jc[La].vertexNormals[Wb],sb=Ib.a,tb=Ib.b,ub=Ib.c,sc=Ib.d):sc=ub=tb=sb=Jc[La].faceNormals[Wb],Ja=Zc[La],Ja[da]=sb.x,Ja[da+1]=sb.y,Ja[da+2]=sb.z,Ja[da+3]=tb.x,Ja[da+4]=tb.y,Ja[da+5]=tb.z,Ja[da+6]=ub.x,Ja[da+7]=ub.y,Ja[da+8]=ub.z,Ja[da+9]=sc.x,Ja[da+10]=sc.y,Ja[da+11]=sc.z;da+=12}j.bindBuffer(j.ARRAY_BUFFER,fa.__webglMorphTargetsBuffers[La]);j.bufferData(j.ARRAY_BUFFER,Yc[La],Za);bc.morphNormals&&(j.bindBuffer(j.ARRAY_BUFFER,fa.__webglMorphNormalsBuffers[La]),j.bufferData(j.ARRAY_BUFFER,
-Zc[La],Za))}if(Xb.length){for(H=0,V=la.length;H<V;H++)N=Fa[la[H]],yb=Xb[N.a],zb=Xb[N.b],Ab=Xb[N.c],ya[K]=yb.x,ya[K+1]=yb.y,ya[K+2]=yb.z,ya[K+3]=yb.w,ya[K+4]=zb.x,ya[K+5]=zb.y,ya[K+6]=zb.z,ya[K+7]=zb.w,ya[K+8]=Ab.x,ya[K+9]=Ab.y,ya[K+10]=Ab.z,ya[K+11]=Ab.w,Bb=fc[N.a],Cb=fc[N.b],Db=fc[N.c],xa[K]=Bb.x,xa[K+1]=Bb.y,xa[K+2]=Bb.z,xa[K+3]=Bb.w,xa[K+4]=Cb.x,xa[K+5]=Cb.y,xa[K+6]=Cb.z,xa[K+7]=Cb.w,xa[K+8]=Db.x,xa[K+9]=Db.y,xa[K+10]=Db.z,xa[K+11]=Db.w,Pb=dc[N.a],Qb=dc[N.b],Rb=dc[N.c],va[K]=Pb.x,va[K+1]=Pb.y,
-va[K+2]=Pb.z,va[K+3]=1,va[K+4]=Qb.x,va[K+5]=Qb.y,va[K+6]=Qb.z,va[K+7]=1,va[K+8]=Rb.x,va[K+9]=Rb.y,va[K+10]=Rb.z,va[K+11]=1,Sb=ec[N.a],Tb=ec[N.b],Ub=ec[N.c],wa[K]=Sb.x,wa[K+1]=Sb.y,wa[K+2]=Sb.z,wa[K+3]=1,wa[K+4]=Tb.x,wa[K+5]=Tb.y,wa[K+6]=Tb.z,wa[K+7]=1,wa[K+8]=Ub.x,wa[K+9]=Ub.y,wa[K+10]=Ub.z,wa[K+11]=1,K+=12;for(H=0,V=ma.length;H<V;H++)N=Fa[ma[H]],yb=Xb[N.a],zb=Xb[N.b],Ab=Xb[N.c],uc=Xb[N.d],ya[K]=yb.x,ya[K+1]=yb.y,ya[K+2]=yb.z,ya[K+3]=yb.w,ya[K+4]=zb.x,ya[K+5]=zb.y,ya[K+6]=zb.z,ya[K+7]=zb.w,ya[K+8]=
-Ab.x,ya[K+9]=Ab.y,ya[K+10]=Ab.z,ya[K+11]=Ab.w,ya[K+12]=uc.x,ya[K+13]=uc.y,ya[K+14]=uc.z,ya[K+15]=uc.w,Bb=fc[N.a],Cb=fc[N.b],Db=fc[N.c],vc=fc[N.d],xa[K]=Bb.x,xa[K+1]=Bb.y,xa[K+2]=Bb.z,xa[K+3]=Bb.w,xa[K+4]=Cb.x,xa[K+5]=Cb.y,xa[K+6]=Cb.z,xa[K+7]=Cb.w,xa[K+8]=Db.x,xa[K+9]=Db.y,xa[K+10]=Db.z,xa[K+11]=Db.w,xa[K+12]=vc.x,xa[K+13]=vc.y,xa[K+14]=vc.z,xa[K+15]=vc.w,Pb=dc[N.a],Qb=dc[N.b],Rb=dc[N.c],Hc=dc[N.d],va[K]=Pb.x,va[K+1]=Pb.y,va[K+2]=Pb.z,va[K+3]=1,va[K+4]=Qb.x,va[K+5]=Qb.y,va[K+6]=Qb.z,va[K+7]=1,va[K+
-8]=Rb.x,va[K+9]=Rb.y,va[K+10]=Rb.z,va[K+11]=1,va[K+12]=Hc.x,va[K+13]=Hc.y,va[K+14]=Hc.z,va[K+15]=1,Sb=ec[N.a],Tb=ec[N.b],Ub=ec[N.c],Ic=ec[N.d],wa[K]=Sb.x,wa[K+1]=Sb.y,wa[K+2]=Sb.z,wa[K+3]=1,wa[K+4]=Tb.x,wa[K+5]=Tb.y,wa[K+6]=Tb.z,wa[K+7]=1,wa[K+8]=Ub.x,wa[K+9]=Ub.y,wa[K+10]=Ub.z,wa[K+11]=1,wa[K+12]=Ic.x,wa[K+13]=Ic.y,wa[K+14]=Ic.z,wa[K+15]=1,K+=16;0<K&&(j.bindBuffer(j.ARRAY_BUFFER,fa.__webglSkinVertexABuffer),j.bufferData(j.ARRAY_BUFFER,va,Za),j.bindBuffer(j.ARRAY_BUFFER,fa.__webglSkinVertexBBuffer),
-j.bufferData(j.ARRAY_BUFFER,wa,Za),j.bindBuffer(j.ARRAY_BUFFER,fa.__webglSkinIndicesBuffer),j.bufferData(j.ARRAY_BUFFER,xa,Za),j.bindBuffer(j.ARRAY_BUFFER,fa.__webglSkinWeightsBuffer),j.bufferData(j.ARRAY_BUFFER,ya,Za))}if(xd&&Xc){for(H=0,V=la.length;H<V;H++)N=Fa[la[H]],ob=N.vertexColors,Gc=N.color,3===ob.length&&Xc===THREE.VertexColors?(vb=ob[0],wb=ob[1],xb=ob[2]):xb=wb=vb=Gc,Na[Ea]=vb.r,Na[Ea+1]=vb.g,Na[Ea+2]=vb.b,Na[Ea+3]=wb.r,Na[Ea+4]=wb.g,Na[Ea+5]=wb.b,Na[Ea+6]=xb.r,Na[Ea+7]=xb.g,Na[Ea+8]=xb.b,
-Ea+=9;for(H=0,V=ma.length;H<V;H++)N=Fa[ma[H]],ob=N.vertexColors,Gc=N.color,4===ob.length&&Xc===THREE.VertexColors?(vb=ob[0],wb=ob[1],xb=ob[2],tc=ob[3]):tc=xb=wb=vb=Gc,Na[Ea]=vb.r,Na[Ea+1]=vb.g,Na[Ea+2]=vb.b,Na[Ea+3]=wb.r,Na[Ea+4]=wb.g,Na[Ea+5]=wb.b,Na[Ea+6]=xb.r,Na[Ea+7]=xb.g,Na[Ea+8]=xb.b,Na[Ea+9]=tc.r,Na[Ea+10]=tc.g,Na[Ea+11]=tc.b,Ea+=12;0<Ea&&(j.bindBuffer(j.ARRAY_BUFFER,fa.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,Na,Za))}if(wd&&Ua.hasTangents){for(H=0,V=la.length;H<V;H++)N=Fa[la[H]],Hb=
-N.vertexTangents,pb=Hb[0],qb=Hb[1],rb=Hb[2],ua[qa]=pb.x,ua[qa+1]=pb.y,ua[qa+2]=pb.z,ua[qa+3]=pb.w,ua[qa+4]=qb.x,ua[qa+5]=qb.y,ua[qa+6]=qb.z,ua[qa+7]=qb.w,ua[qa+8]=rb.x,ua[qa+9]=rb.y,ua[qa+10]=rb.z,ua[qa+11]=rb.w,qa+=12;for(H=0,V=ma.length;H<V;H++)N=Fa[ma[H]],Hb=N.vertexTangents,pb=Hb[0],qb=Hb[1],rb=Hb[2],rc=Hb[3],ua[qa]=pb.x,ua[qa+1]=pb.y,ua[qa+2]=pb.z,ua[qa+3]=pb.w,ua[qa+4]=qb.x,ua[qa+5]=qb.y,ua[qa+6]=qb.z,ua[qa+7]=qb.w,ua[qa+8]=rb.x,ua[qa+9]=rb.y,ua[qa+10]=rb.z,ua[qa+11]=rb.w,ua[qa+12]=rc.x,ua[qa+
-13]=rc.y,ua[qa+14]=rc.z,ua[qa+15]=rc.w,qa+=16;j.bindBuffer(j.ARRAY_BUFFER,fa.__webglTangentBuffer);j.bufferData(j.ARRAY_BUFFER,ua,Za)}if(vd&&fd){for(H=0,V=la.length;H<V;H++)if(N=Fa[la[H]],jc=N.vertexNormals,Ob=N.normal,3===jc.length&&Fc)for(ka=0;3>ka;ka++)Vb=jc[ka],ib[Ra]=Vb.x,ib[Ra+1]=Vb.y,ib[Ra+2]=Vb.z,Ra+=3;else for(ka=0;3>ka;ka++)ib[Ra]=Ob.x,ib[Ra+1]=Ob.y,ib[Ra+2]=Ob.z,Ra+=3;for(H=0,V=ma.length;H<V;H++)if(N=Fa[ma[H]],jc=N.vertexNormals,Ob=N.normal,4===jc.length&&Fc)for(ka=0;4>ka;ka++)Vb=jc[ka],
-ib[Ra]=Vb.x,ib[Ra+1]=Vb.y,ib[Ra+2]=Vb.z,Ra+=3;else for(ka=0;4>ka;ka++)ib[Ra]=Ob.x,ib[Ra+1]=Ob.y,ib[Ra+2]=Ob.z,Ra+=3;j.bindBuffer(j.ARRAY_BUFFER,fa.__webglNormalBuffer);j.bufferData(j.ARRAY_BUFFER,ib,Za)}if(jd&&ad&&gd){for(H=0,V=la.length;H<V;H++)if(lb=la[H],N=Fa[lb],kc=ad[lb],void 0!==kc)for(ka=0;3>ka;ka++)mc=kc[ka],wc[Jb]=mc.u,wc[Jb+1]=mc.v,Jb+=2;for(H=0,V=ma.length;H<V;H++)if(lb=ma[H],N=Fa[lb],kc=ad[lb],void 0!==kc)for(ka=0;4>ka;ka++)mc=kc[ka],wc[Jb]=mc.u,wc[Jb+1]=mc.v,Jb+=2;0<Jb&&(j.bindBuffer(j.ARRAY_BUFFER,
-fa.__webglUVBuffer),j.bufferData(j.ARRAY_BUFFER,wc,Za))}if(jd&&bd&&gd){for(H=0,V=la.length;H<V;H++)if(lb=la[H],N=Fa[lb],lc=bd[lb],void 0!==lc)for(ka=0;3>ka;ka++)nc=lc[ka],xc[Kb]=nc.u,xc[Kb+1]=nc.v,Kb+=2;for(H=0,V=ma.length;H<V;H++)if(lb=ma[H],N=Fa[lb],lc=bd[lb],void 0!==lc)for(ka=0;4>ka;ka++)nc=lc[ka],xc[Kb]=nc.u,xc[Kb+1]=nc.v,Kb+=2;0<Kb&&(j.bindBuffer(j.ARRAY_BUFFER,fa.__webglUV2Buffer),j.bufferData(j.ARRAY_BUFFER,xc,Za))}if(ud){for(H=0,V=la.length;H<V;H++)N=Fa[la[H]],Eb[hb]=Da,Eb[hb+1]=Da+1,Eb[hb+
-2]=Da+2,hb+=3,ab[Ta]=Da,ab[Ta+1]=Da+1,ab[Ta+2]=Da,ab[Ta+3]=Da+2,ab[Ta+4]=Da+1,ab[Ta+5]=Da+2,Ta+=6,Da+=3;for(H=0,V=ma.length;H<V;H++)N=Fa[ma[H]],Eb[hb]=Da,Eb[hb+1]=Da+1,Eb[hb+2]=Da+3,Eb[hb+3]=Da+1,Eb[hb+4]=Da+2,Eb[hb+5]=Da+3,hb+=6,ab[Ta]=Da,ab[Ta+1]=Da+1,ab[Ta+2]=Da,ab[Ta+3]=Da+3,ab[Ta+4]=Da+1,ab[Ta+5]=Da+2,ab[Ta+6]=Da+2,ab[Ta+7]=Da+3,Ta+=8,Da+=4;j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,fa.__webglFaceBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,Eb,Za);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,fa.__webglLineBuffer);
-j.bufferData(j.ELEMENT_ARRAY_BUFFER,ab,Za)}if($c)for(ka=0,hd=$c.length;ka<hd;ka++)if(x=$c[ka],x.__original.needsUpdate){y=0;if(1===x.size)if(void 0===x.boundTo||"vertices"===x.boundTo){for(H=0,V=la.length;H<V;H++)N=Fa[la[H]],x.array[y]=x.value[N.a],x.array[y+1]=x.value[N.b],x.array[y+2]=x.value[N.c],y+=3;for(H=0,V=ma.length;H<V;H++)N=Fa[ma[H]],x.array[y]=x.value[N.a],x.array[y+1]=x.value[N.b],x.array[y+2]=x.value[N.c],x.array[y+3]=x.value[N.d],y+=4}else{if("faces"===x.boundTo){for(H=0,V=la.length;H<
-V;H++)$a=x.value[la[H]],x.array[y]=$a,x.array[y+1]=$a,x.array[y+2]=$a,y+=3;for(H=0,V=ma.length;H<V;H++)$a=x.value[ma[H]],x.array[y]=$a,x.array[y+1]=$a,x.array[y+2]=$a,x.array[y+3]=$a,y+=4}}else if(2===x.size)if(void 0===x.boundTo||"vertices"===x.boundTo){for(H=0,V=la.length;H<V;H++)N=Fa[la[H]],Y=x.value[N.a],Z=x.value[N.b],$=x.value[N.c],x.array[y]=Y.x,x.array[y+1]=Y.y,x.array[y+2]=Z.x,x.array[y+3]=Z.y,x.array[y+4]=$.x,x.array[y+5]=$.y,y+=6;for(H=0,V=ma.length;H<V;H++)N=Fa[ma[H]],Y=x.value[N.a],Z=
-x.value[N.b],$=x.value[N.c],pa=x.value[N.d],x.array[y]=Y.x,x.array[y+1]=Y.y,x.array[y+2]=Z.x,x.array[y+3]=Z.y,x.array[y+4]=$.x,x.array[y+5]=$.y,x.array[y+6]=pa.x,x.array[y+7]=pa.y,y+=8}else{if("faces"===x.boundTo){for(H=0,V=la.length;H<V;H++)$=Z=Y=$a=x.value[la[H]],x.array[y]=Y.x,x.array[y+1]=Y.y,x.array[y+2]=Z.x,x.array[y+3]=Z.y,x.array[y+4]=$.x,x.array[y+5]=$.y,y+=6;for(H=0,V=ma.length;H<V;H++)pa=$=Z=Y=$a=x.value[ma[H]],x.array[y]=Y.x,x.array[y+1]=Y.y,x.array[y+2]=Z.x,x.array[y+3]=Z.y,x.array[y+
-4]=$.x,x.array[y+5]=$.y,x.array[y+6]=pa.x,x.array[y+7]=pa.y,y+=8}}else if(3===x.size){var ha;ha="c"===x.type?["r","g","b"]:["x","y","z"];if(void 0===x.boundTo||"vertices"===x.boundTo){for(H=0,V=la.length;H<V;H++)N=Fa[la[H]],Y=x.value[N.a],Z=x.value[N.b],$=x.value[N.c],x.array[y]=Y[ha[0]],x.array[y+1]=Y[ha[1]],x.array[y+2]=Y[ha[2]],x.array[y+3]=Z[ha[0]],x.array[y+4]=Z[ha[1]],x.array[y+5]=Z[ha[2]],x.array[y+6]=$[ha[0]],x.array[y+7]=$[ha[1]],x.array[y+8]=$[ha[2]],y+=9;for(H=0,V=ma.length;H<V;H++)N=Fa[ma[H]],
-Y=x.value[N.a],Z=x.value[N.b],$=x.value[N.c],pa=x.value[N.d],x.array[y]=Y[ha[0]],x.array[y+1]=Y[ha[1]],x.array[y+2]=Y[ha[2]],x.array[y+3]=Z[ha[0]],x.array[y+4]=Z[ha[1]],x.array[y+5]=Z[ha[2]],x.array[y+6]=$[ha[0]],x.array[y+7]=$[ha[1]],x.array[y+8]=$[ha[2]],x.array[y+9]=pa[ha[0]],x.array[y+10]=pa[ha[1]],x.array[y+11]=pa[ha[2]],y+=12}else if("faces"===x.boundTo){for(H=0,V=la.length;H<V;H++)$=Z=Y=$a=x.value[la[H]],x.array[y]=Y[ha[0]],x.array[y+1]=Y[ha[1]],x.array[y+2]=Y[ha[2]],x.array[y+3]=Z[ha[0]],
-x.array[y+4]=Z[ha[1]],x.array[y+5]=Z[ha[2]],x.array[y+6]=$[ha[0]],x.array[y+7]=$[ha[1]],x.array[y+8]=$[ha[2]],y+=9;for(H=0,V=ma.length;H<V;H++)pa=$=Z=Y=$a=x.value[ma[H]],x.array[y]=Y[ha[0]],x.array[y+1]=Y[ha[1]],x.array[y+2]=Y[ha[2]],x.array[y+3]=Z[ha[0]],x.array[y+4]=Z[ha[1]],x.array[y+5]=Z[ha[2]],x.array[y+6]=$[ha[0]],x.array[y+7]=$[ha[1]],x.array[y+8]=$[ha[2]],x.array[y+9]=pa[ha[0]],x.array[y+10]=pa[ha[1]],x.array[y+11]=pa[ha[2]],y+=12}}else if(4===x.size)if(void 0===x.boundTo||"vertices"===x.boundTo){for(H=
-0,V=la.length;H<V;H++)N=Fa[la[H]],Y=x.value[N.a],Z=x.value[N.b],$=x.value[N.c],x.array[y]=Y.x,x.array[y+1]=Y.y,x.array[y+2]=Y.z,x.array[y+3]=Y.w,x.array[y+4]=Z.x,x.array[y+5]=Z.y,x.array[y+6]=Z.z,x.array[y+7]=Z.w,x.array[y+8]=$.x,x.array[y+9]=$.y,x.array[y+10]=$.z,x.array[y+11]=$.w,y+=12;for(H=0,V=ma.length;H<V;H++)N=Fa[ma[H]],Y=x.value[N.a],Z=x.value[N.b],$=x.value[N.c],pa=x.value[N.d],x.array[y]=Y.x,x.array[y+1]=Y.y,x.array[y+2]=Y.z,x.array[y+3]=Y.w,x.array[y+4]=Z.x,x.array[y+5]=Z.y,x.array[y+6]=
-Z.z,x.array[y+7]=Z.w,x.array[y+8]=$.x,x.array[y+9]=$.y,x.array[y+10]=$.z,x.array[y+11]=$.w,x.array[y+12]=pa.x,x.array[y+13]=pa.y,x.array[y+14]=pa.z,x.array[y+15]=pa.w,y+=16}else if("faces"===x.boundTo){for(H=0,V=la.length;H<V;H++)$=Z=Y=$a=x.value[la[H]],x.array[y]=Y.x,x.array[y+1]=Y.y,x.array[y+2]=Y.z,x.array[y+3]=Y.w,x.array[y+4]=Z.x,x.array[y+5]=Z.y,x.array[y+6]=Z.z,x.array[y+7]=Z.w,x.array[y+8]=$.x,x.array[y+9]=$.y,x.array[y+10]=$.z,x.array[y+11]=$.w,y+=12;for(H=0,V=ma.length;H<V;H++)pa=$=Z=Y=
-$a=x.value[ma[H]],x.array[y]=Y.x,x.array[y+1]=Y.y,x.array[y+2]=Y.z,x.array[y+3]=Y.w,x.array[y+4]=Z.x,x.array[y+5]=Z.y,x.array[y+6]=Z.z,x.array[y+7]=Z.w,x.array[y+8]=$.x,x.array[y+9]=$.y,x.array[y+10]=$.z,x.array[y+11]=$.w,x.array[y+12]=pa.x,x.array[y+13]=pa.y,x.array[y+14]=pa.z,x.array[y+15]=pa.w,y+=16}j.bindBuffer(j.ARRAY_BUFFER,x.buffer);j.bufferData(j.ARRAY_BUFFER,x.array,Za)}td&&(delete fa.__inittedArrays,delete fa.__colorArray,delete fa.__normalArray,delete fa.__tangentArray,delete fa.__uvArray,
-delete fa.__uv2Array,delete fa.__faceArray,delete fa.__vertexArray,delete fa.__lineArray,delete fa.__skinVertexAArray,delete fa.__skinVertexBArray,delete fa.__skinIndexArray,delete fa.__skinWeightArray)}}ja.__dirtyVertices=!1;ja.__dirtyMorphTargets=!1;ja.__dirtyElements=!1;ja.__dirtyUvs=!1;ja.__dirtyNormals=!1;ja.__dirtyColors=!1;ja.__dirtyTangents=!1;Xa.attributes&&n(Xa)}else if(nb instanceof THREE.Ribbon){if(ja.__dirtyVertices||ja.__dirtyColors){var Zb=ja,kd=j.DYNAMIC_DRAW,yc=void 0,zc=void 0,Kc=
-void 0,$b=void 0,Lc=void 0,ld=Zb.vertices,md=Zb.colors,zd=ld.length,Ad=md.length,Mc=Zb.__vertexArray,Nc=Zb.__colorArray,Bd=Zb.__dirtyColors;if(Zb.__dirtyVertices){for(yc=0;yc<zd;yc++)Kc=ld[yc].position,$b=3*yc,Mc[$b]=Kc.x,Mc[$b+1]=Kc.y,Mc[$b+2]=Kc.z;j.bindBuffer(j.ARRAY_BUFFER,Zb.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,Mc,kd)}if(Bd){for(zc=0;zc<Ad;zc++)Lc=md[zc],$b=3*zc,Nc[$b]=Lc.r,Nc[$b+1]=Lc.g,Nc[$b+2]=Lc.b;j.bindBuffer(j.ARRAY_BUFFER,Zb.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,
-Nc,kd)}}ja.__dirtyVertices=!1;ja.__dirtyColors=!1}else if(nb instanceof THREE.Line){Xa=c(nb,qc);ic=Xa.attributes&&p(Xa);if(ja.__dirtyVertices||ja.__dirtyColors||ic){var Lb=ja,cd=j.DYNAMIC_DRAW,Ac=void 0,Bc=void 0,Oc=void 0,za=void 0,Pc=void 0,nd=Lb.vertices,od=Lb.colors,Cd=nd.length,Dd=od.length,Qc=Lb.__vertexArray,Rc=Lb.__colorArray,Ed=Lb.__dirtyColors,dd=Lb.__webglCustomAttributesList,Sc=void 0,pd=void 0,Qa=void 0,oc=void 0,Ya=void 0,ta=void 0;if(Lb.__dirtyVertices){for(Ac=0;Ac<Cd;Ac++)Oc=nd[Ac].position,
-za=3*Ac,Qc[za]=Oc.x,Qc[za+1]=Oc.y,Qc[za+2]=Oc.z;j.bindBuffer(j.ARRAY_BUFFER,Lb.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,Qc,cd)}if(Ed){for(Bc=0;Bc<Dd;Bc++)Pc=od[Bc],za=3*Bc,Rc[za]=Pc.r,Rc[za+1]=Pc.g,Rc[za+2]=Pc.b;j.bindBuffer(j.ARRAY_BUFFER,Lb.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,Rc,cd)}if(dd)for(Sc=0,pd=dd.length;Sc<pd;Sc++)if(ta=dd[Sc],ta.needsUpdate&&(void 0===ta.boundTo||"vertices"===ta.boundTo)){za=0;oc=ta.value.length;if(1===ta.size)for(Qa=0;Qa<oc;Qa++)ta.array[Qa]=ta.value[Qa];
-else if(2===ta.size)for(Qa=0;Qa<oc;Qa++)Ya=ta.value[Qa],ta.array[za]=Ya.x,ta.array[za+1]=Ya.y,za+=2;else if(3===ta.size)if("c"===ta.type)for(Qa=0;Qa<oc;Qa++)Ya=ta.value[Qa],ta.array[za]=Ya.r,ta.array[za+1]=Ya.g,ta.array[za+2]=Ya.b,za+=3;else for(Qa=0;Qa<oc;Qa++)Ya=ta.value[Qa],ta.array[za]=Ya.x,ta.array[za+1]=Ya.y,ta.array[za+2]=Ya.z,za+=3;else if(4===ta.size)for(Qa=0;Qa<oc;Qa++)Ya=ta.value[Qa],ta.array[za]=Ya.x,ta.array[za+1]=Ya.y,ta.array[za+2]=Ya.z,ta.array[za+3]=Ya.w,za+=4;j.bindBuffer(j.ARRAY_BUFFER,
-ta.buffer);j.bufferData(j.ARRAY_BUFFER,ta.array,cd)}}ja.__dirtyVertices=!1;ja.__dirtyColors=!1;Xa.attributes&&n(Xa)}else if(nb instanceof THREE.ParticleSystem)Xa=c(nb,qc),ic=Xa.attributes&&p(Xa),(ja.__dirtyVertices||ja.__dirtyColors||nb.sortParticles||ic)&&f(ja,j.DYNAMIC_DRAW,nb),ja.__dirtyVertices=!1,ja.__dirtyColors=!1,Xa.attributes&&n(Xa)}};this.initMaterial=function(a,b,c,d){var e,f,g,h,l;a instanceof THREE.MeshDepthMaterial?l="depth":a instanceof THREE.MeshNormalMaterial?l="normal":a instanceof
-THREE.MeshBasicMaterial?l="basic":a instanceof THREE.MeshLambertMaterial?l="lambert":a instanceof THREE.MeshPhongMaterial?l="phong":a instanceof THREE.LineBasicMaterial?l="basic":a instanceof THREE.ParticleBasicMaterial&&(l="particle_basic");if(l){var i=THREE.ShaderLib[l];a.uniforms=THREE.UniformsUtils.clone(i.uniforms);a.vertexShader=i.vertexShader;a.fragmentShader=i.fragmentShader}var k,m;f=i=0;for(k=0,m=b.length;k<m;k++)e=b[k],e.onlyShadow||(e instanceof THREE.DirectionalLight&&f++,e instanceof
-THREE.PointLight&&i++,e instanceof THREE.SpotLight&&i++);i+f<=M?k=f:(k=Math.ceil(M*f/(i+f)),i=M-k);e=k;f=i;var n=0;for(i=0,k=b.length;i<k;i++)m=b[i],m.castShadow&&(m instanceof THREE.SpotLight&&n++,m instanceof THREE.DirectionalLight&&!m.shadowCascade&&n++);var o=50;if(void 0!==d&&d instanceof THREE.SkinnedMesh)o=d.bones.length;var p;a:{k=a.fragmentShader;m=a.vertexShader;var i=a.uniforms,b=a.attributes,c={map:!!a.map,envMap:!!a.envMap,lightMap:!!a.lightMap,vertexColors:a.vertexColors,fog:c,useFog:a.fog,
+var j=a.colors,l=j.length,k=a.__vertexArray,n=a.__colorArray,m=a.__sortArray,o=a.__dirtyVertices,p=a.__dirtyColors,r=a.__webglCustomAttributesList;if(c.sortParticles){va.copy(qa);va.multiplySelf(c.matrixWorld);for(d=0;d<g;d++)e=h[d].position,Ea.copy(e),va.multiplyVector3(Ea),m[d]=[Ea.z,d];m.sort(function(a,b){return b[0]-a[0]});for(d=0;d<g;d++)e=h[m[d][1]].position,f=3*d,k[f]=e.x,k[f+1]=e.y,k[f+2]=e.z;for(d=0;d<l;d++)f=3*d,e=j[m[d][1]],n[f]=e.r,n[f+1]=e.g,n[f+2]=e.b;if(r)for(j=0,l=r.length;j<l;j++)if(h=
+r[j],void 0===h.boundTo||"vertices"===h.boundTo)if(f=0,e=h.value.length,1===h.size)for(d=0;d<e;d++)g=m[d][1],h.array[d]=h.value[g];else if(2===h.size)for(d=0;d<e;d++)g=m[d][1],g=h.value[g],h.array[f]=g.x,h.array[f+1]=g.y,f+=2;else if(3===h.size)if("c"===h.type)for(d=0;d<e;d++)g=m[d][1],g=h.value[g],h.array[f]=g.r,h.array[f+1]=g.g,h.array[f+2]=g.b,f+=3;else for(d=0;d<e;d++)g=m[d][1],g=h.value[g],h.array[f]=g.x,h.array[f+1]=g.y,h.array[f+2]=g.z,f+=3;else if(4===h.size)for(d=0;d<e;d++)g=m[d][1],g=h.value[g],
+h.array[f]=g.x,h.array[f+1]=g.y,h.array[f+2]=g.z,h.array[f+3]=g.w,f+=4}else{if(o)for(d=0;d<g;d++)e=h[d].position,f=3*d,k[f]=e.x,k[f+1]=e.y,k[f+2]=e.z;if(p)for(d=0;d<l;d++)e=j[d],f=3*d,n[f]=e.r,n[f+1]=e.g,n[f+2]=e.b;if(r)for(j=0,l=r.length;j<l;j++)if(h=r[j],h.needsUpdate&&(void 0===h.boundTo||"vertices"===h.boundTo))if(e=h.value.length,f=0,1===h.size)for(d=0;d<e;d++)h.array[d]=h.value[d];else if(2===h.size)for(d=0;d<e;d++)g=h.value[d],h.array[f]=g.x,h.array[f+1]=g.y,f+=2;else if(3===h.size)if("c"===
+h.type)for(d=0;d<e;d++)g=h.value[d],h.array[f]=g.r,h.array[f+1]=g.g,h.array[f+2]=g.b,f+=3;else for(d=0;d<e;d++)g=h.value[d],h.array[f]=g.x,h.array[f+1]=g.y,h.array[f+2]=g.z,f+=3;else if(4===h.size)for(d=0;d<e;d++)g=h.value[d],h.array[f]=g.x,h.array[f+1]=g.y,h.array[f+2]=g.z,h.array[f+3]=g.w,f+=4}if(o||c.sortParticles)i.bindBuffer(i.ARRAY_BUFFER,a.__webglVertexBuffer),i.bufferData(i.ARRAY_BUFFER,k,b);if(p||c.sortParticles)i.bindBuffer(i.ARRAY_BUFFER,a.__webglColorBuffer),i.bufferData(i.ARRAY_BUFFER,
+n,b);if(r)for(j=0,l=r.length;j<l;j++)if(h=r[j],h.needsUpdate||c.sortParticles)i.bindBuffer(i.ARRAY_BUFFER,h.buffer),i.bufferData(i.ARRAY_BUFFER,h.array,b)}function g(a,b){return b.z-a.z}function h(a,b,c){if(a.length)for(var d=0,e=a.length;d<e;d++)aa=B=null,V=E=oa=Ga=$=-1,a[d].render(b,c,hb,nb),aa=B=null,V=E=oa=Ga=$=-1}function l(a,b,c,d,e,f,g,h){var i,j,l,k;b?(j=a.length-1,k=b=-1):(j=0,b=a.length,k=1);for(var n=j;n!==b;n+=k)if(i=a[n],i.render){j=i.object;l=i.buffer;if(h)i=h;else{i=i[c];if(!i)continue;
+g&&D.setBlending(i.blending,i.blendEquation,i.blendSrc,i.blendDst);D.setDepthTest(i.depthTest);D.setDepthWrite(i.depthWrite);s(i.polygonOffset,i.polygonOffsetFactor,i.polygonOffsetUnits)}D.setObjectFaces(j);l instanceof THREE.BufferGeometry?D.renderBufferDirect(d,e,f,i,l,j):D.renderBuffer(d,e,f,i,l,j)}}function j(a,b,c,d,e,f,g){for(var h,i,j=0,l=a.length;j<l;j++)if(h=a[j],i=h.object,i.visible){if(g)h=g;else{h=h[b];if(!h)continue;f&&D.setBlending(h.blending,h.blendEquation,h.blendSrc,h.blendDst);D.setDepthTest(h.depthTest);
+D.setDepthWrite(h.depthWrite);s(h.polygonOffset,h.polygonOffsetFactor,h.polygonOffsetUnits)}D.renderImmediateObject(c,d,e,h,i)}}function k(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})}function p(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function m(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function o(a,b){for(var c=a.length-1;0<=c;c--)a[c].object===b&&a.splice(c,1)}function r(a,b){for(var c=a.length-1;0<=c;c--)a[c]===b&&a.splice(c,
+1)}function n(a,b,c,d,e){if(!d.program||d.needsUpdate)D.initMaterial(d,b,c,e),d.needsUpdate=!1;if(d.morphTargets&&!e.__webglMorphTargetInfluences){e.__webglMorphTargetInfluences=new Float32Array(D.maxMorphTargets);for(var f=0,g=D.maxMorphTargets;f<g;f++)e.__webglMorphTargetInfluences[f]=0}var h=!1,f=d.program,g=f.uniforms,j=d.uniforms;f!==B&&(i.useProgram(f),B=f,h=!0);if(d.id!==V)V=d.id,h=!0;if(h||a!==aa)i.uniformMatrix4fv(g.projectionMatrix,!1,a._projectionMatrixArray),a!==aa&&(aa=a);if(h){if(c&&
+d.fog)if(j.fogColor.value=c.color,c instanceof THREE.Fog)j.fogNear.value=c.near,j.fogFar.value=c.far;else if(c instanceof THREE.FogExp2)j.fogDensity.value=c.density;if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){var l,k=0,n=0,m=0,o,p,r,q=Xa,s=q.directional.colors,t=q.directional.positions,A=q.point.colors,u=q.point.positions,E=q.point.distances,w=0,C=0,G=r=0;for(c=0,h=b.length;c<h;c++)if(l=b[c],!l.onlyShadow)if(o=l.color,p=l.intensity,r=l.distance,l instanceof
+THREE.AmbientLight)D.gammaInput?(k+=o.r*o.r,n+=o.g*o.g,m+=o.b*o.b):(k+=o.r,n+=o.g,m+=o.b);else if(l instanceof THREE.DirectionalLight)r=3*w,D.gammaInput?(s[r]=o.r*o.r*p*p,s[r+1]=o.g*o.g*p*p,s[r+2]=o.b*o.b*p*p):(s[r]=o.r*p,s[r+1]=o.g*p,s[r+2]=o.b*p),ga.copy(l.matrixWorld.getPosition()),ga.subSelf(l.target.matrixWorld.getPosition()),ga.normalize(),t[r]=ga.x,t[r+1]=ga.y,t[r+2]=ga.z,w+=1;else if(l instanceof THREE.PointLight||l instanceof THREE.SpotLight)G=3*C,D.gammaInput?(A[G]=o.r*o.r*p*p,A[G+1]=o.g*
+o.g*p*p,A[G+2]=o.b*o.b*p*p):(A[G]=o.r*p,A[G+1]=o.g*p,A[G+2]=o.b*p),l=l.matrixWorld.getPosition(),u[G]=l.x,u[G+1]=l.y,u[G+2]=l.z,E[C]=r,C+=1;for(c=3*w,h=s.length;c<h;c++)s[c]=0;for(c=3*C,h=A.length;c<h;c++)A[c]=0;q.point.length=C;q.directional.length=w;q.ambient[0]=k;q.ambient[1]=n;q.ambient[2]=m;c=Xa;j.ambientLightColor.value=c.ambient;j.directionalLightColor.value=c.directional.colors;j.directionalLightDirection.value=c.directional.positions;j.pointLightColor.value=c.point.colors;j.pointLightPosition.value=
+c.point.positions;j.pointLightDistance.value=c.point.distances}if(d instanceof THREE.MeshBasicMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.MeshPhongMaterial)j.opacity.value=d.opacity,D.gammaInput?j.diffuse.value.copyGammaToLinear(d.color):j.diffuse.value=d.color,(j.map.texture=d.map)&&j.offsetRepeat.value.set(d.map.offset.x,d.map.offset.y,d.map.repeat.x,d.map.repeat.y),j.lightMap.texture=d.lightMap,j.envMap.texture=d.envMap,j.flipEnvMap.value=d.envMap instanceof THREE.WebGLRenderTargetCube?
+1:-1,j.reflectivity.value=d.reflectivity,j.refractionRatio.value=d.refractionRatio,j.combine.value=d.combine,j.useRefract.value=d.envMap&&d.envMap.mapping instanceof THREE.CubeRefractionMapping;if(d instanceof THREE.LineBasicMaterial)j.diffuse.value=d.color,j.opacity.value=d.opacity;else if(d instanceof THREE.ParticleBasicMaterial)j.psColor.value=d.color,j.opacity.value=d.opacity,j.size.value=d.size,j.scale.value=F.height/2,j.map.texture=d.map;else if(d instanceof THREE.MeshPhongMaterial)j.shininess.value=
+d.shininess,D.gammaInput?(j.ambient.value.copyGammaToLinear(d.ambient),j.emissive.value.copyGammaToLinear(d.emissive),j.specular.value.copyGammaToLinear(d.specular)):(j.ambient.value=d.ambient,j.emissive.value=d.emissive,j.specular.value=d.specular),d.wrapAround&&j.wrapRGB.value.copy(d.wrapRGB);else if(d instanceof THREE.MeshLambertMaterial)D.gammaInput?(j.ambient.value.copyGammaToLinear(d.ambient),j.emissive.value.copyGammaToLinear(d.emissive)):(j.ambient.value=d.ambient,j.emissive.value=d.emissive),
+d.wrapAround&&j.wrapRGB.value.copy(d.wrapRGB);else if(d instanceof THREE.MeshDepthMaterial)j.mNear.value=a.near,j.mFar.value=a.far,j.opacity.value=d.opacity;else if(d instanceof THREE.MeshNormalMaterial)j.opacity.value=d.opacity;if(e.receiveShadow&&!d._shadowPass&&j.shadowMatrix){h=c=0;for(k=b.length;h<k;h++)if(n=b[h],n.castShadow&&(n instanceof THREE.SpotLight||n instanceof THREE.DirectionalLight&&!n.shadowCascade))j.shadowMap.texture[c]=n.shadowMap,j.shadowMapSize.value[c]=n.shadowMapSize,j.shadowMatrix.value[c]=
+n.shadowMatrix,j.shadowDarkness.value[c]=n.shadowDarkness,j.shadowBias.value[c]=n.shadowBias,c++}b=d.uniformsList;for(j=0,c=b.length;j<c;j++)if(n=f.uniforms[b[j][1]])if(h=b[j][0],m=h.type,k=h.value,"i"===m)i.uniform1i(n,k);else if("f"===m)i.uniform1f(n,k);else if("v2"===m)i.uniform2f(n,k.x,k.y);else if("v3"===m)i.uniform3f(n,k.x,k.y,k.z);else if("v4"===m)i.uniform4f(n,k.x,k.y,k.z,k.w);else if("c"===m)i.uniform3f(n,k.r,k.g,k.b);else if("fv1"===m)i.uniform1fv(n,k);else if("fv"===m)i.uniform3fv(n,k);
+else if("v2v"===m){if(!h._array)h._array=new Float32Array(2*k.length);for(m=0,q=k.length;m<q;m++)s=2*m,h._array[s]=k[m].x,h._array[s+1]=k[m].y;i.uniform2fv(n,h._array)}else if("v3v"===m){if(!h._array)h._array=new Float32Array(3*k.length);for(m=0,q=k.length;m<q;m++)s=3*m,h._array[s]=k[m].x,h._array[s+1]=k[m].y,h._array[s+2]=k[m].z;i.uniform3fv(n,h._array)}else if("v4v"==m){if(!h._array)h._array=new Float32Array(4*k.length);for(m=0,q=k.length;m<q;m++)s=4*m,h._array[s]=k[m].x,h._array[s+1]=k[m].y,h._array[s+
+2]=k[m].z,h._array[s+3]=k[m].w;i.uniform4fv(n,h._array)}else if("m4"===m){if(!h._array)h._array=new Float32Array(16);k.flattenToArray(h._array);i.uniformMatrix4fv(n,!1,h._array)}else if("m4v"===m){if(!h._array)h._array=new Float32Array(16*k.length);for(m=0,q=k.length;m<q;m++)k[m].flattenToArrayOffset(h._array,16*m);i.uniformMatrix4fv(n,!1,h._array)}else if("t"===m){if(i.uniform1i(n,k),n=h.texture)if(n.image instanceof Array&&6===n.image.length){if(h=n,6===h.image.length)if(h.needsUpdate){if(!h.image.__webglTextureCube)h.image.__webglTextureCube=
+i.createTexture();i.activeTexture(i.TEXTURE0+k);i.bindTexture(i.TEXTURE_CUBE_MAP,h.image.__webglTextureCube);k=[];for(n=0;6>n;n++){m=k;q=n;if(D.autoScaleCubemaps){if(s=h.image[n],A=ra,!(s.width<=A&&s.height<=A))u=Math.max(s.width,s.height),t=Math.floor(s.width*A/u),A=Math.floor(s.height*A/u),u=document.createElement("canvas"),u.width=t,u.height=A,u.getContext("2d").drawImage(s,0,0,s.width,s.height,0,0,t,A),s=u}else s=h.image[n];m[q]=s}n=k[0];m=0===(n.width&n.width-1)&&0===(n.height&n.height-1);q=
+z(h.format);s=z(h.type);v(i.TEXTURE_CUBE_MAP,h,m);for(n=0;6>n;n++)i.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+n,0,q,q,s,k[n]);h.generateMipmaps&&m&&i.generateMipmap(i.TEXTURE_CUBE_MAP);h.needsUpdate=!1;if(h.onUpdate)h.onUpdate()}else i.activeTexture(i.TEXTURE0+k),i.bindTexture(i.TEXTURE_CUBE_MAP,h.image.__webglTextureCube)}else n instanceof THREE.WebGLRenderTargetCube?(h=n,i.activeTexture(i.TEXTURE0+k),i.bindTexture(i.TEXTURE_CUBE_MAP,h.__webglTexture)):D.setTexture(n,k)}else if("tv"===m){if(!h._array){h._array=
+[];for(m=0,q=h.texture.length;m<q;m++)h._array[m]=k+m}i.uniform1iv(n,h._array);for(m=0,q=h.texture.length;m<q;m++)(n=h.texture[m])&&D.setTexture(n,h._array[m])}if((d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&null!==g.cameraPosition)b=a.matrixWorld.getPosition(),i.uniform3f(g.cameraPosition,b.x,b.y,b.z);(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.ShaderMaterial||d.skinning)&&null!==g.viewMatrix&&i.uniformMatrix4fv(g.viewMatrix,
+!1,a._viewMatrixArray);d.skinning&&i.uniformMatrix4fv(g.boneGlobalMatrices,!1,e.boneMatrices)}i.uniformMatrix4fv(g.modelViewMatrix,!1,e._modelViewMatrixArray);g.normalMatrix&&i.uniformMatrix3fv(g.normalMatrix,!1,e._normalMatrixArray);(d instanceof THREE.ShaderMaterial||d.envMap||d.skinning||e.receiveShadow)&&null!==g.objectMatrix&&i.uniformMatrix4fv(g.objectMatrix,!1,e._objectMatrixArray);return f}function q(a,b){a._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,a.matrixWorld,a._modelViewMatrixArray);
+a._normalMatrix.getInverse(a._modelViewMatrix);a._normalMatrix.transposeIntoArray(a._normalMatrixArray)}function s(a,b,c){Ka!==a&&(a?i.enable(i.POLYGON_OFFSET_FILL):i.disable(i.POLYGON_OFFSET_FILL),Ka=a);if(a&&(Ua!==b||Da!==c))i.polygonOffset(b,c),Ua=b,Da=c}function u(a,b){var c;"fragment"===a?c=i.createShader(i.FRAGMENT_SHADER):"vertex"===a&&(c=i.createShader(i.VERTEX_SHADER));i.shaderSource(c,b);i.compileShader(c);return!i.getShaderParameter(c,i.COMPILE_STATUS)?(console.error(i.getShaderInfoLog(c)),
+console.error(b),null):c}function v(a,b,c){c?(i.texParameteri(a,i.TEXTURE_WRAP_S,z(b.wrapS)),i.texParameteri(a,i.TEXTURE_WRAP_T,z(b.wrapT)),i.texParameteri(a,i.TEXTURE_MAG_FILTER,z(b.magFilter)),i.texParameteri(a,i.TEXTURE_MIN_FILTER,z(b.minFilter))):(i.texParameteri(a,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(a,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE),i.texParameteri(a,i.TEXTURE_MAG_FILTER,w(b.magFilter)),i.texParameteri(a,i.TEXTURE_MIN_FILTER,w(b.minFilter)))}function t(a,b){i.bindRenderbuffer(i.RENDERBUFFER,
+a);b.depthBuffer&&!b.stencilBuffer?(i.renderbufferStorage(i.RENDERBUFFER,i.DEPTH_COMPONENT16,b.width,b.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(i.renderbufferStorage(i.RENDERBUFFER,i.DEPTH_STENCIL,b.width,b.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.DEPTH_STENCIL_ATTACHMENT,i.RENDERBUFFER,a)):i.renderbufferStorage(i.RENDERBUFFER,i.RGBA4,b.width,b.height)}function w(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return i.NEAREST;
+default:return i.LINEAR}}function z(a){switch(a){case THREE.RepeatWrapping:return i.REPEAT;case THREE.ClampToEdgeWrapping:return i.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return i.MIRRORED_REPEAT;case THREE.NearestFilter:return i.NEAREST;case THREE.NearestMipMapNearestFilter:return i.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return i.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return i.LINEAR;case THREE.LinearMipMapNearestFilter:return i.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return i.LINEAR_MIPMAP_LINEAR;
+case THREE.ByteType:return i.BYTE;case THREE.UnsignedByteType:return i.UNSIGNED_BYTE;case THREE.ShortType:return i.SHORT;case THREE.UnsignedShortType:return i.UNSIGNED_SHORT;case THREE.IntType:return i.INT;case THREE.UnsignedIntType:return i.UNSIGNED_INT;case THREE.FloatType:return i.FLOAT;case THREE.AlphaFormat:return i.ALPHA;case THREE.RGBFormat:return i.RGB;case THREE.RGBAFormat:return i.RGBA;case THREE.LuminanceFormat:return i.LUMINANCE;case THREE.LuminanceAlphaFormat:return i.LUMINANCE_ALPHA;
+case THREE.AddEquation:return i.FUNC_ADD;case THREE.SubtractEquation:return i.FUNC_SUBTRACT;case THREE.ReverseSubtractEquation:return i.FUNC_REVERSE_SUBTRACT;case THREE.ZeroFactor:return i.ZERO;case THREE.OneFactor:return i.ONE;case THREE.SrcColorFactor:return i.SRC_COLOR;case THREE.OneMinusSrcColorFactor:return i.ONE_MINUS_SRC_COLOR;case THREE.SrcAlphaFactor:return i.SRC_ALPHA;case THREE.OneMinusSrcAlphaFactor:return i.ONE_MINUS_SRC_ALPHA;case THREE.DstAlphaFactor:return i.DST_ALPHA;case THREE.OneMinusDstAlphaFactor:return i.ONE_MINUS_DST_ALPHA;
+case THREE.DstColorFactor:return i.DST_COLOR;case THREE.OneMinusDstColorFactor:return i.ONE_MINUS_DST_COLOR;case THREE.SrcAlphaSaturateFactor:return i.SRC_ALPHA_SATURATE}return 0}var a=a||{},F=void 0!==a.canvas?a.canvas:document.createElement("canvas"),C=void 0!==a.precision?a.precision:"highp",G=void 0!==a.alpha?a.alpha:!0,K=void 0!==a.premultipliedAlpha?a.premultipliedAlpha:!0,N=void 0!==a.antialias?a.antialias:!1,P=void 0!==a.stencil?a.stencil:!0,T=void 0!==a.preserveDrawingBuffer?a.preserveDrawingBuffer:
+!1,O=void 0!==a.clearColor?new THREE.Color(a.clearColor):new THREE.Color(0),J=void 0!==a.clearAlpha?a.clearAlpha:0,I=void 0!==a.maxLights?a.maxLights:4;this.domElement=F;this.context=null;this.autoUpdateScene=this.autoUpdateObjects=this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.shadowMapEnabled=this.physicallyBasedShading=this.gammaOutput=this.gammaInput=!1;this.shadowMapCullFrontFaces=this.shadowMapSoft=this.shadowMapAutoUpdate=!0;this.shadowMapCascade=
+this.shadowMapDebug=!1;this.maxMorphTargets=8;this.maxMorphNormals=4;this.autoScaleCubemaps=!0;this.renderPluginsPre=[];this.renderPluginsPost=[];this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0,points:0}};var D=this,i,S=[],B=null,A=null,V=-1,E=null,aa=null,ea=0,ia=null,R=null,$=null,ba=null,Z=null,ja=null,Ga=null,oa=null,Ka=null,Ua=null,Da=null,pa=null,$a=0,ab=0,kb=0,db=0,hb=0,nb=0,Wa=new THREE.Frustum,qa=new THREE.Matrix4,va=new THREE.Matrix4,Ea=new THREE.Vector4,
+ga=new THREE.Vector3,Xa={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}};i=function(){var a;try{if(!(a=F.getContext("experimental-webgl",{alpha:G,premultipliedAlpha:K,antialias:N,stencil:P,preserveDrawingBuffer:T})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+a.getParameter(a.VERSION)+" | "+a.getParameter(a.VENDOR)+" | "+a.getParameter(a.RENDERER)+" | "+a.getParameter(a.SHADING_LANGUAGE_VERSION))}catch(b){console.error(b)}return a}();
+i.clearColor(0,0,0,1);i.clearDepth(1);i.clearStencil(0);i.enable(i.DEPTH_TEST);i.depthFunc(i.LEQUAL);i.frontFace(i.CCW);i.cullFace(i.BACK);i.enable(i.CULL_FACE);i.enable(i.BLEND);i.blendEquation(i.FUNC_ADD);i.blendFunc(i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA);i.clearColor(O.r,O.g,O.b,J);this.context=i;var La=i.getParameter(i.MAX_VERTEX_TEXTURE_IMAGE_UNITS);i.getParameter(i.MAX_TEXTURE_SIZE);var ra=i.getParameter(i.MAX_CUBE_MAP_TEXTURE_SIZE);this.getContext=function(){return i};this.supportsVertexTextures=
+function(){return 0<La};this.setSize=function(a,b){F.width=a;F.height=b;this.setViewport(0,0,F.width,F.height)};this.setViewport=function(a,b,c,d){$a=a;ab=b;kb=c;db=d;i.viewport($a,ab,kb,db)};this.setScissor=function(a,b,c,d){i.scissor(a,b,c,d)};this.enableScissorTest=function(a){a?i.enable(i.SCISSOR_TEST):i.disable(i.SCISSOR_TEST)};this.setClearColorHex=function(a,b){O.setHex(a);J=b;i.clearColor(O.r,O.g,O.b,J)};this.setClearColor=function(a,b){O.copy(a);J=b;i.clearColor(O.r,O.g,O.b,J)};this.getClearColor=
+function(){return O};this.getClearAlpha=function(){return J};this.clear=function(a,b,c){var d=0;if(void 0===a||a)d|=i.COLOR_BUFFER_BIT;if(void 0===b||b)d|=i.DEPTH_BUFFER_BIT;if(void 0===c||c)d|=i.STENCIL_BUFFER_BIT;i.clear(d)};this.clearTarget=function(a,b,c,d){this.setRenderTarget(a);this.clear(b,c,d)};this.addPostPlugin=function(a){a.init(this);this.renderPluginsPost.push(a)};this.addPrePlugin=function(a){a.init(this);this.renderPluginsPre.push(a)};this.deallocateObject=function(a){if(a.__webglInit)if(a.__webglInit=
+!1,delete a._modelViewMatrix,delete a._normalMatrix,delete a._normalMatrixArray,delete a._modelViewMatrixArray,delete a._objectMatrixArray,a instanceof THREE.Mesh)for(var b in a.geometry.geometryGroups){var c=a.geometry.geometryGroups[b];i.deleteBuffer(c.__webglVertexBuffer);i.deleteBuffer(c.__webglNormalBuffer);i.deleteBuffer(c.__webglTangentBuffer);i.deleteBuffer(c.__webglColorBuffer);i.deleteBuffer(c.__webglUVBuffer);i.deleteBuffer(c.__webglUV2Buffer);i.deleteBuffer(c.__webglSkinVertexABuffer);
+i.deleteBuffer(c.__webglSkinVertexBBuffer);i.deleteBuffer(c.__webglSkinIndicesBuffer);i.deleteBuffer(c.__webglSkinWeightsBuffer);i.deleteBuffer(c.__webglFaceBuffer);i.deleteBuffer(c.__webglLineBuffer);var d=void 0,e=void 0;if(c.numMorphTargets)for(d=0,e=c.numMorphTargets;d<e;d++)i.deleteBuffer(c.__webglMorphTargetsBuffers[d]);if(c.numMorphNormals)for(d=0,e=c.numMorphNormals;d<e;d++)i.deleteBuffer(c.__webglMorphNormalsBuffers[d]);if(c.__webglCustomAttributesList)for(d in d=void 0,c.__webglCustomAttributesList)i.deleteBuffer(c.__webglCustomAttributesList[d].buffer);
+D.info.memory.geometries--}else if(a instanceof THREE.Ribbon)a=a.geometry,i.deleteBuffer(a.__webglVertexBuffer),i.deleteBuffer(a.__webglColorBuffer),D.info.memory.geometries--;else if(a instanceof THREE.Line)a=a.geometry,i.deleteBuffer(a.__webglVertexBuffer),i.deleteBuffer(a.__webglColorBuffer),D.info.memory.geometries--;else if(a instanceof THREE.ParticleSystem)a=a.geometry,i.deleteBuffer(a.__webglVertexBuffer),i.deleteBuffer(a.__webglColorBuffer),D.info.memory.geometries--};this.deallocateTexture=
+function(a){if(a.__webglInit)a.__webglInit=!1,i.deleteTexture(a.__webglTexture),D.info.memory.textures--};this.deallocateRenderTarget=function(a){if(a&&a.__webglTexture)if(i.deleteTexture(a.__webglTexture),a instanceof THREE.WebGLRenderTargetCube)for(var b=0;6>b;b++)i.deleteFramebuffer(a.__webglFramebuffer[b]),i.deleteRenderbuffer(a.__webglRenderbuffer[b]);else i.deleteFramebuffer(a.__webglFramebuffer),i.deleteRenderbuffer(a.__webglRenderbuffer)};this.updateShadowMap=function(a,b){B=null;V=E=oa=Ga=
+$=-1;this.shadowMapPlugin.update(a,b)};this.renderBufferImmediate=function(a,b,c){if(!a.__webglVertexBuffer)a.__webglVertexBuffer=i.createBuffer();if(!a.__webglNormalBuffer)a.__webglNormalBuffer=i.createBuffer();a.hasPos&&(i.bindBuffer(i.ARRAY_BUFFER,a.__webglVertexBuffer),i.bufferData(i.ARRAY_BUFFER,a.positionArray,i.DYNAMIC_DRAW),i.enableVertexAttribArray(b.attributes.position),i.vertexAttribPointer(b.attributes.position,3,i.FLOAT,!1,0,0));if(a.hasNormal){i.bindBuffer(i.ARRAY_BUFFER,a.__webglNormalBuffer);
+if(c===THREE.FlatShading){var d,e,f,g,h,j,k,l,n,m,o=3*a.count;for(m=0;m<o;m+=9)c=a.normalArray,d=c[m],e=c[m+1],f=c[m+2],g=c[m+3],j=c[m+4],l=c[m+5],h=c[m+6],k=c[m+7],n=c[m+8],d=(d+g+h)/3,e=(e+j+k)/3,f=(f+l+n)/3,c[m]=d,c[m+1]=e,c[m+2]=f,c[m+3]=d,c[m+4]=e,c[m+5]=f,c[m+6]=d,c[m+7]=e,c[m+8]=f}i.bufferData(i.ARRAY_BUFFER,a.normalArray,i.DYNAMIC_DRAW);i.enableVertexAttribArray(b.attributes.normal);i.vertexAttribPointer(b.attributes.normal,3,i.FLOAT,!1,0,0)}i.drawArrays(i.TRIANGLES,0,a.count);a.count=0};
+this.renderBufferDirect=function(a,b,c,d,e,f){if(0!==d.opacity&&(c=n(a,b,c,d,f),a=c.attributes,b=!1,d=16777215*e.id+2*c.id+(d.wireframe?1:0),d!==E&&(E=d,b=!0),f instanceof THREE.Mesh)){f=e.offsets;d=0;for(c=f.length;d<c;++d)b&&(i.bindBuffer(i.ARRAY_BUFFER,e.vertexPositionBuffer),i.vertexAttribPointer(a.position,e.vertexPositionBuffer.itemSize,i.FLOAT,!1,0,12*f[d].index),0<=a.normal&&e.vertexNormalBuffer&&(i.bindBuffer(i.ARRAY_BUFFER,e.vertexNormalBuffer),i.vertexAttribPointer(a.normal,e.vertexNormalBuffer.itemSize,
+i.FLOAT,!1,0,12*f[d].index)),0<=a.uv&&e.vertexUvBuffer&&(e.vertexUvBuffer?(i.bindBuffer(i.ARRAY_BUFFER,e.vertexUvBuffer),i.vertexAttribPointer(a.uv,e.vertexUvBuffer.itemSize,i.FLOAT,!1,0,8*f[d].index),i.enableVertexAttribArray(a.uv)):i.disableVertexAttribArray(a.uv)),0<=a.color&&e.vertexColorBuffer&&(i.bindBuffer(i.ARRAY_BUFFER,e.vertexColorBuffer),i.vertexAttribPointer(a.color,e.vertexColorBuffer.itemSize,i.FLOAT,!1,0,16*f[d].index)),i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,e.vertexIndexBuffer)),i.drawElements(i.TRIANGLES,
+f[d].count,i.UNSIGNED_SHORT,2*f[d].start),D.info.render.calls++,D.info.render.vertices+=f[d].count,D.info.render.faces+=f[d].count/3}};this.renderBuffer=function(a,b,c,d,e,f){if(0!==d.opacity){var g,h,c=n(a,b,c,d,f),b=c.attributes,a=!1,c=16777215*e.id+2*c.id+(d.wireframe?1:0);c!==E&&(E=c,a=!0);if(!d.morphTargets&&0<=b.position)a&&(i.bindBuffer(i.ARRAY_BUFFER,e.__webglVertexBuffer),i.vertexAttribPointer(b.position,3,i.FLOAT,!1,0,0));else if(f.morphTargetBase){c=d.program.attributes;-1!==f.morphTargetBase?
+(i.bindBuffer(i.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[f.morphTargetBase]),i.vertexAttribPointer(c.position,3,i.FLOAT,!1,0,0)):0<=c.position&&(i.bindBuffer(i.ARRAY_BUFFER,e.__webglVertexBuffer),i.vertexAttribPointer(c.position,3,i.FLOAT,!1,0,0));if(f.morphTargetForcedOrder.length){g=0;var j=f.morphTargetForcedOrder;for(h=f.morphTargetInfluences;g<d.numSupportedMorphTargets&&g<j.length;)i.bindBuffer(i.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[j[g]]),i.vertexAttribPointer(c["morphTarget"+g],3,i.FLOAT,
+!1,0,0),d.morphNormals&&(i.bindBuffer(i.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[j[g]]),i.vertexAttribPointer(c["morphNormal"+g],3,i.FLOAT,!1,0,0)),f.__webglMorphTargetInfluences[g]=h[j[g]],g++}else{var j=[],k=-1,l=0;h=f.morphTargetInfluences;var m,o=h.length;g=0;for(-1!==f.morphTargetBase&&(j[f.morphTargetBase]=!0);g<d.numSupportedMorphTargets;){for(m=0;m<o;m++)!j[m]&&h[m]>k&&(l=m,k=h[l]);i.bindBuffer(i.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[l]);i.vertexAttribPointer(c["morphTarget"+g],3,i.FLOAT,
+!1,0,0);d.morphNormals&&(i.bindBuffer(i.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[l]),i.vertexAttribPointer(c["morphNormal"+g],3,i.FLOAT,!1,0,0));f.__webglMorphTargetInfluences[g]=k;j[l]=1;k=-1;g++}}null!==d.program.uniforms.morphTargetInfluences&&i.uniform1fv(d.program.uniforms.morphTargetInfluences,f.__webglMorphTargetInfluences)}if(a){if(e.__webglCustomAttributesList)for(g=0,h=e.__webglCustomAttributesList.length;g<h;g++)c=e.__webglCustomAttributesList[g],0<=b[c.buffer.belongsToAttribute]&&(i.bindBuffer(i.ARRAY_BUFFER,
+c.buffer),i.vertexAttribPointer(b[c.buffer.belongsToAttribute],c.size,i.FLOAT,!1,0,0));0<=b.color&&(i.bindBuffer(i.ARRAY_BUFFER,e.__webglColorBuffer),i.vertexAttribPointer(b.color,3,i.FLOAT,!1,0,0));0<=b.normal&&(i.bindBuffer(i.ARRAY_BUFFER,e.__webglNormalBuffer),i.vertexAttribPointer(b.normal,3,i.FLOAT,!1,0,0));0<=b.tangent&&(i.bindBuffer(i.ARRAY_BUFFER,e.__webglTangentBuffer),i.vertexAttribPointer(b.tangent,4,i.FLOAT,!1,0,0));0<=b.uv&&(e.__webglUVBuffer?(i.bindBuffer(i.ARRAY_BUFFER,e.__webglUVBuffer),
+i.vertexAttribPointer(b.uv,2,i.FLOAT,!1,0,0),i.enableVertexAttribArray(b.uv)):i.disableVertexAttribArray(b.uv));0<=b.uv2&&(e.__webglUV2Buffer?(i.bindBuffer(i.ARRAY_BUFFER,e.__webglUV2Buffer),i.vertexAttribPointer(b.uv2,2,i.FLOAT,!1,0,0),i.enableVertexAttribArray(b.uv2)):i.disableVertexAttribArray(b.uv2));d.skinning&&0<=b.skinVertexA&&0<=b.skinVertexB&&0<=b.skinIndex&&0<=b.skinWeight&&(i.bindBuffer(i.ARRAY_BUFFER,e.__webglSkinVertexABuffer),i.vertexAttribPointer(b.skinVertexA,4,i.FLOAT,!1,0,0),i.bindBuffer(i.ARRAY_BUFFER,
+e.__webglSkinVertexBBuffer),i.vertexAttribPointer(b.skinVertexB,4,i.FLOAT,!1,0,0),i.bindBuffer(i.ARRAY_BUFFER,e.__webglSkinIndicesBuffer),i.vertexAttribPointer(b.skinIndex,4,i.FLOAT,!1,0,0),i.bindBuffer(i.ARRAY_BUFFER,e.__webglSkinWeightsBuffer),i.vertexAttribPointer(b.skinWeight,4,i.FLOAT,!1,0,0))}f instanceof THREE.Mesh?(d.wireframe?(d=d.wireframeLinewidth,d!==pa&&(i.lineWidth(d),pa=d),a&&i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,e.__webglLineBuffer),i.drawElements(i.LINES,e.__webglLineCount,i.UNSIGNED_SHORT,
+0)):(a&&i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,e.__webglFaceBuffer),i.drawElements(i.TRIANGLES,e.__webglFaceCount,i.UNSIGNED_SHORT,0)),D.info.render.calls++,D.info.render.vertices+=e.__webglFaceCount,D.info.render.faces+=e.__webglFaceCount/3):f instanceof THREE.Line?(f=f.type===THREE.LineStrip?i.LINE_STRIP:i.LINES,d=d.linewidth,d!==pa&&(i.lineWidth(d),pa=d),i.drawArrays(f,0,e.__webglLineCount),D.info.render.calls++):f instanceof THREE.ParticleSystem?(i.drawArrays(i.POINTS,0,e.__webglParticleCount),D.info.render.calls++,
+D.info.render.points+=e.__webglParticleCount):f instanceof THREE.Ribbon&&(i.drawArrays(i.TRIANGLE_STRIP,0,e.__webglVertexCount),D.info.render.calls++)}};this.render=function(a,b,c,d){var e,f,k,m,n=a.__lights,o=a.fog;V=-1;void 0===b.parent&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),a.add(b));this.autoUpdateScene&&a.updateMatrixWorld();if(!b._viewMatrixArray)b._viewMatrixArray=new Float32Array(16);if(!b._projectionMatrixArray)b._projectionMatrixArray=new Float32Array(16);
+b.matrixWorldInverse.getInverse(b.matrixWorld);b.matrixWorldInverse.flattenToArray(b._viewMatrixArray);b.projectionMatrix.flattenToArray(b._projectionMatrixArray);qa.multiply(b.projectionMatrix,b.matrixWorldInverse);Wa.setFromMatrix(qa);this.autoUpdateObjects&&this.initWebGLObjects(a);h(this.renderPluginsPre,a,b);D.info.render.calls=0;D.info.render.vertices=0;D.info.render.faces=0;D.info.render.points=0;this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,
+this.autoClearStencil);m=a.__webglObjects;for(d=0,e=m.length;d<e;d++)if(f=m[d],k=f.object,f.render=!1,k.visible&&(!(k instanceof THREE.Mesh||k instanceof THREE.ParticleSystem)||!k.frustumCulled||Wa.contains(k))){k.matrixWorld.flattenToArray(k._objectMatrixArray);q(k,b);var p=f,r=p.object,t=p.buffer,A=void 0,A=A=void 0,A=r.material;if(A instanceof THREE.MeshFaceMaterial){if(A=t.materialIndex,0<=A)A=r.geometry.materials[A],A.transparent?(p.transparent=A,p.opaque=null):(p.opaque=A,p.transparent=null)}else if(A)A.transparent?
+(p.transparent=A,p.opaque=null):(p.opaque=A,p.transparent=null);f.render=!0;if(this.sortObjects)k.renderDepth?f.z=k.renderDepth:(Ea.copy(k.matrixWorld.getPosition()),qa.multiplyVector3(Ea),f.z=Ea.z)}this.sortObjects&&m.sort(g);m=a.__webglObjectsImmediate;for(d=0,e=m.length;d<e;d++)if(f=m[d],k=f.object,k.visible)k.matrixAutoUpdate&&k.matrixWorld.flattenToArray(k._objectMatrixArray),q(k,b),k=f.object.material,k.transparent?(f.transparent=k,f.opaque=null):(f.opaque=k,f.transparent=null);a.overrideMaterial?
+(d=a.overrideMaterial,this.setBlending(d.blending,d.blendEquation,d.blendSrc,d.blendDst),this.setDepthTest(d.depthTest),this.setDepthWrite(d.depthWrite),s(d.polygonOffset,d.polygonOffsetFactor,d.polygonOffsetUnits),l(a.__webglObjects,!1,"",b,n,o,!0,d),j(a.__webglObjectsImmediate,"",b,n,o,!1,d)):(this.setBlending(THREE.NormalBlending),l(a.__webglObjects,!0,"opaque",b,n,o,!1),j(a.__webglObjectsImmediate,"opaque",b,n,o,!1),l(a.__webglObjects,!1,"transparent",b,n,o,!0),j(a.__webglObjectsImmediate,"transparent",
+b,n,o,!0));h(this.renderPluginsPost,a,b);c&&c.generateMipmaps&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&(c instanceof THREE.WebGLRenderTargetCube?(i.bindTexture(i.TEXTURE_CUBE_MAP,c.__webglTexture),i.generateMipmap(i.TEXTURE_CUBE_MAP),i.bindTexture(i.TEXTURE_CUBE_MAP,null)):(i.bindTexture(i.TEXTURE_2D,c.__webglTexture),i.generateMipmap(i.TEXTURE_2D),i.bindTexture(i.TEXTURE_2D,null)));this.setDepthTest(!0);this.setDepthWrite(!0)};this.renderImmediateObject=function(a,b,
+c,d,e){var f=n(a,b,c,d,e);E=-1;D.setObjectFaces(e);e.immediateRenderCallback?e.immediateRenderCallback(f,i,Wa):e.render(function(a){D.renderBufferImmediate(a,f,d.shading)})};this.initWebGLObjects=function(a){if(!a.__webglObjects)a.__webglObjects=[],a.__webglObjectsImmediate=[],a.__webglSprites=[],a.__webglFlares=[];for(;a.__objectsAdded.length;){var g=a.__objectsAdded[0],h=a,j=void 0,l=void 0,n=void 0;if(!g.__webglInit)if(g.__webglInit=!0,g._modelViewMatrix=new THREE.Matrix4,g._normalMatrix=new THREE.Matrix3,
+g._normalMatrixArray=new Float32Array(9),g._modelViewMatrixArray=new Float32Array(16),g._objectMatrixArray=new Float32Array(16),g.matrixWorld.flattenToArray(g._objectMatrixArray),g instanceof THREE.Mesh){if(l=g.geometry,l instanceof THREE.Geometry){if(void 0===l.geometryGroups){var q=l,s=void 0,t=void 0,A=void 0,u=void 0,v=void 0,E=void 0,w=void 0,B={},C=q.morphTargets.length,G=q.morphNormals.length;q.geometryGroups={};for(s=0,t=q.faces.length;s<t;s++)A=q.faces[s],u=A.materialIndex,E=void 0!==u?u:
+-1,void 0===B[E]&&(B[E]={hash:E,counter:0}),w=B[E].hash+"_"+B[E].counter,void 0===q.geometryGroups[w]&&(q.geometryGroups[w]={faces3:[],faces4:[],materialIndex:u,vertices:0,numMorphTargets:C,numMorphNormals:G}),v=A instanceof THREE.Face3?3:4,65535<q.geometryGroups[w].vertices+v&&(B[E].counter+=1,w=B[E].hash+"_"+B[E].counter,void 0===q.geometryGroups[w]&&(q.geometryGroups[w]={faces3:[],faces4:[],materialIndex:u,vertices:0,numMorphTargets:C,numMorphNormals:G})),A instanceof THREE.Face3?q.geometryGroups[w].faces3.push(s):
+q.geometryGroups[w].faces4.push(s),q.geometryGroups[w].vertices+=v;q.geometryGroupsList=[];var V=void 0;for(V in q.geometryGroups)q.geometryGroups[V].id=ea++,q.geometryGroupsList.push(q.geometryGroups[V])}for(j in l.geometryGroups)if(n=l.geometryGroups[j],!n.__webglVertexBuffer){var z=n;z.__webglVertexBuffer=i.createBuffer();z.__webglNormalBuffer=i.createBuffer();z.__webglTangentBuffer=i.createBuffer();z.__webglColorBuffer=i.createBuffer();z.__webglUVBuffer=i.createBuffer();z.__webglUV2Buffer=i.createBuffer();
+z.__webglSkinVertexABuffer=i.createBuffer();z.__webglSkinVertexBBuffer=i.createBuffer();z.__webglSkinIndicesBuffer=i.createBuffer();z.__webglSkinWeightsBuffer=i.createBuffer();z.__webglFaceBuffer=i.createBuffer();z.__webglLineBuffer=i.createBuffer();var F=void 0,J=void 0;if(z.numMorphTargets){z.__webglMorphTargetsBuffers=[];for(F=0,J=z.numMorphTargets;F<J;F++)z.__webglMorphTargetsBuffers.push(i.createBuffer())}if(z.numMorphNormals){z.__webglMorphNormalsBuffers=[];for(F=0,J=z.numMorphNormals;F<J;F++)z.__webglMorphNormalsBuffers.push(i.createBuffer())}D.info.memory.geometries++;
+var I=n,$=g,K=$.geometry,O=I.faces3,R=I.faces4,aa=3*O.length+4*R.length,N=1*O.length+2*R.length,Z=3*O.length+4*R.length,P=c($,I),ba=e(P),S=d(P),ja=P.vertexColors?P.vertexColors:!1;I.__vertexArray=new Float32Array(3*aa);if(S)I.__normalArray=new Float32Array(3*aa);if(K.hasTangents)I.__tangentArray=new Float32Array(4*aa);if(ja)I.__colorArray=new Float32Array(3*aa);if(ba){if(0<K.faceUvs.length||0<K.faceVertexUvs.length)I.__uvArray=new Float32Array(2*aa);if(1<K.faceUvs.length||1<K.faceVertexUvs.length)I.__uv2Array=
+new Float32Array(2*aa)}if($.geometry.skinWeights.length&&$.geometry.skinIndices.length)I.__skinVertexAArray=new Float32Array(4*aa),I.__skinVertexBArray=new Float32Array(4*aa),I.__skinIndexArray=new Float32Array(4*aa),I.__skinWeightArray=new Float32Array(4*aa);I.__faceArray=new Uint16Array(3*N);I.__lineArray=new Uint16Array(2*Z);var T=void 0,ia=void 0;if(I.numMorphTargets){I.__morphTargetsArrays=[];for(T=0,ia=I.numMorphTargets;T<ia;T++)I.__morphTargetsArrays.push(new Float32Array(3*aa))}if(I.numMorphNormals){I.__morphNormalsArrays=
+[];for(T=0,ia=I.numMorphNormals;T<ia;T++)I.__morphNormalsArrays.push(new Float32Array(3*aa))}I.__webglFaceCount=3*N;I.__webglLineCount=2*Z;if(P.attributes){if(void 0===I.__webglCustomAttributesList)I.__webglCustomAttributesList=[];var Ga=void 0;for(Ga in P.attributes){var Ka=P.attributes[Ga],oa={},ga;for(ga in Ka)oa[ga]=Ka[ga];if(!oa.__webglInitialized||oa.createUniqueBuffers){oa.__webglInitialized=!0;var Da=1;"v2"===oa.type?Da=2:"v3"===oa.type?Da=3:"v4"===oa.type?Da=4:"c"===oa.type&&(Da=3);oa.size=
+Da;oa.array=new Float32Array(aa*Da);oa.buffer=i.createBuffer();oa.buffer.belongsToAttribute=Ga;Ka.needsUpdate=!0;oa.__original=Ka}I.__webglCustomAttributesList.push(oa)}}I.__inittedArrays=!0;l.__dirtyVertices=!0;l.__dirtyMorphTargets=!0;l.__dirtyElements=!0;l.__dirtyUvs=!0;l.__dirtyNormals=!0;l.__dirtyTangents=!0;l.__dirtyColors=!0}}}else if(g instanceof THREE.Ribbon){if(l=g.geometry,!l.__webglVertexBuffer){var Ua=l;Ua.__webglVertexBuffer=i.createBuffer();Ua.__webglColorBuffer=i.createBuffer();D.info.memory.geometries++;
+var pa=l,ra=pa.vertices.length;pa.__vertexArray=new Float32Array(3*ra);pa.__colorArray=new Float32Array(3*ra);pa.__webglVertexCount=ra;l.__dirtyVertices=!0;l.__dirtyColors=!0}}else if(g instanceof THREE.Line){if(l=g.geometry,!l.__webglVertexBuffer){var va=l;va.__webglVertexBuffer=i.createBuffer();va.__webglColorBuffer=i.createBuffer();D.info.memory.geometries++;var qa=l,$a=g,La=qa.vertices.length;qa.__vertexArray=new Float32Array(3*La);qa.__colorArray=new Float32Array(3*La);qa.__webglLineCount=La;
+b(qa,$a);l.__dirtyVertices=!0;l.__dirtyColors=!0}}else if(g instanceof THREE.ParticleSystem&&(l=g.geometry,!l.__webglVertexBuffer)){var Xa=l;Xa.__webglVertexBuffer=i.createBuffer();Xa.__webglColorBuffer=i.createBuffer();D.info.geometries++;var ab=l,kb=g,Wa=ab.vertices.length;ab.__vertexArray=new Float32Array(3*Wa);ab.__colorArray=new Float32Array(3*Wa);ab.__sortArray=[];ab.__webglParticleCount=Wa;b(ab,kb);l.__dirtyVertices=!0;l.__dirtyColors=!0}if(!g.__webglActive){if(g instanceof THREE.Mesh)if(l=
+g.geometry,l instanceof THREE.BufferGeometry)k(h.__webglObjects,l,g);else for(j in l.geometryGroups)n=l.geometryGroups[j],k(h.__webglObjects,n,g);else g instanceof THREE.Ribbon||g instanceof THREE.Line||g instanceof THREE.ParticleSystem?(l=g.geometry,k(h.__webglObjects,l,g)):g instanceof THREE.ImmediateRenderObject||g.immediateRenderCallback?h.__webglObjectsImmediate.push({object:g,opaque:null,transparent:null}):g instanceof THREE.Sprite?h.__webglSprites.push(g):g instanceof THREE.LensFlare&&h.__webglFlares.push(g);
+g.__webglActive=!0}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;){var Ea=a.__objectsRemoved[0],db=a;Ea instanceof THREE.Mesh||Ea instanceof THREE.ParticleSystem||Ea instanceof THREE.Ribbon||Ea instanceof THREE.Line?o(db.__webglObjects,Ea):Ea instanceof THREE.Sprite?r(db.__webglSprites,Ea):Ea instanceof THREE.LensFlare?r(db.__webglFlares,Ea):(Ea instanceof THREE.ImmediateRenderObject||Ea.immediateRenderCallback)&&o(db.__webglObjectsImmediate,Ea);Ea.__webglActive=!1;a.__objectsRemoved.splice(0,
+1)}for(var hb=0,nb=a.__webglObjects.length;hb<nb;hb++){var ob=a.__webglObjects[hb].object,ka=ob.geometry,qc=void 0,ic=void 0,bb=void 0;if(ob instanceof THREE.Mesh)if(ka instanceof THREE.BufferGeometry)ka.__dirtyVertices=!1,ka.__dirtyElements=!1,ka.__dirtyUvs=!1,ka.__dirtyNormals=!1,ka.__dirtyColors=!1;else{for(var Uc=0,od=ka.geometryGroupsList.length;Uc<od;Uc++)if(qc=ka.geometryGroupsList[Uc],bb=c(ob,qc),ic=bb.attributes&&p(bb),ka.__dirtyVertices||ka.__dirtyMorphTargets||ka.__dirtyElements||ka.__dirtyUvs||
+ka.__dirtyNormals||ka.__dirtyColors||ka.__dirtyTangents||ic){var fa=qc,pd=ob,eb=i.DYNAMIC_DRAW,qd=!ka.dynamic,bc=bb;if(fa.__inittedArrays){var dd=d(bc),Vc=bc.vertexColors?bc.vertexColors:!1,ed=e(bc),Fc=dd===THREE.SmoothShading,H=void 0,U=void 0,mb=void 0,M=void 0,jc=void 0,Ob=void 0,pb=void 0,Gc=void 0,Hb=void 0,kc=void 0,lc=void 0,W=void 0,X=void 0,Y=void 0,ta=void 0,qb=void 0,rb=void 0,sb=void 0,rc=void 0,tb=void 0,ub=void 0,vb=void 0,sc=void 0,wb=void 0,xb=void 0,yb=void 0,tc=void 0,zb=void 0,
+Ab=void 0,Bb=void 0,uc=void 0,Cb=void 0,Db=void 0,Eb=void 0,vc=void 0,Pb=void 0,Qb=void 0,Rb=void 0,Hc=void 0,Sb=void 0,Tb=void 0,Ub=void 0,Ic=void 0,la=void 0,fd=void 0,Vb=void 0,mc=void 0,nc=void 0,Oa=void 0,gd=void 0,Ma=void 0,Na=void 0,Wb=void 0,Ib=void 0,Fa=0,Ja=0,Jb=0,Kb=0,ib=0,Va=0,ua=0,Ya=0,Ha=0,L=0,da=0,y=0,fb=void 0,Pa=fa.__vertexArray,wc=fa.__uvArray,xc=fa.__uv2Array,jb=fa.__normalArray,xa=fa.__tangentArray,Qa=fa.__colorArray,ya=fa.__skinVertexAArray,za=fa.__skinVertexBArray,Aa=fa.__skinIndexArray,
+Ba=fa.__skinWeightArray,Wc=fa.__morphTargetsArrays,Xc=fa.__morphNormalsArrays,Yc=fa.__webglCustomAttributesList,x=void 0,Fb=fa.__faceArray,gb=fa.__lineArray,Za=pd.geometry,rd=Za.__dirtyElements,hd=Za.__dirtyUvs,sd=Za.__dirtyNormals,td=Za.__dirtyTangents,ud=Za.__dirtyColors,vd=Za.__dirtyMorphTargets,cc=Za.vertices,ma=fa.faces3,na=fa.faces4,Ia=Za.faces,Zc=Za.faceVertexUvs[0],$c=Za.faceVertexUvs[1],dc=Za.skinVerticesA,ec=Za.skinVerticesB,fc=Za.skinIndices,Xb=Za.skinWeights,Yb=Za.morphTargets,Jc=Za.morphNormals;
+if(Za.__dirtyVertices){for(H=0,U=ma.length;H<U;H++)M=Ia[ma[H]],W=cc[M.a].position,X=cc[M.b].position,Y=cc[M.c].position,Pa[Ja]=W.x,Pa[Ja+1]=W.y,Pa[Ja+2]=W.z,Pa[Ja+3]=X.x,Pa[Ja+4]=X.y,Pa[Ja+5]=X.z,Pa[Ja+6]=Y.x,Pa[Ja+7]=Y.y,Pa[Ja+8]=Y.z,Ja+=9;for(H=0,U=na.length;H<U;H++)M=Ia[na[H]],W=cc[M.a].position,X=cc[M.b].position,Y=cc[M.c].position,ta=cc[M.d].position,Pa[Ja]=W.x,Pa[Ja+1]=W.y,Pa[Ja+2]=W.z,Pa[Ja+3]=X.x,Pa[Ja+4]=X.y,Pa[Ja+5]=X.z,Pa[Ja+6]=Y.x,Pa[Ja+7]=Y.y,Pa[Ja+8]=Y.z,Pa[Ja+9]=ta.x,Pa[Ja+10]=ta.y,
+Pa[Ja+11]=ta.z,Ja+=12;i.bindBuffer(i.ARRAY_BUFFER,fa.__webglVertexBuffer);i.bufferData(i.ARRAY_BUFFER,Pa,eb)}if(vd)for(Oa=0,gd=Yb.length;Oa<gd;Oa++){da=0;for(H=0,U=ma.length;H<U;H++){Wb=ma[H];M=Ia[Wb];W=Yb[Oa].vertices[M.a].position;X=Yb[Oa].vertices[M.b].position;Y=Yb[Oa].vertices[M.c].position;Ma=Wc[Oa];Ma[da]=W.x;Ma[da+1]=W.y;Ma[da+2]=W.z;Ma[da+3]=X.x;Ma[da+4]=X.y;Ma[da+5]=X.z;Ma[da+6]=Y.x;Ma[da+7]=Y.y;Ma[da+8]=Y.z;if(bc.morphNormals)Fc?(Ib=Jc[Oa].vertexNormals[Wb],tb=Ib.a,ub=Ib.b,vb=Ib.c):vb=
+ub=tb=Jc[Oa].faceNormals[Wb],Na=Xc[Oa],Na[da]=tb.x,Na[da+1]=tb.y,Na[da+2]=tb.z,Na[da+3]=ub.x,Na[da+4]=ub.y,Na[da+5]=ub.z,Na[da+6]=vb.x,Na[da+7]=vb.y,Na[da+8]=vb.z;da+=9}for(H=0,U=na.length;H<U;H++){Wb=na[H];M=Ia[Wb];W=Yb[Oa].vertices[M.a].position;X=Yb[Oa].vertices[M.b].position;Y=Yb[Oa].vertices[M.c].position;ta=Yb[Oa].vertices[M.d].position;Ma=Wc[Oa];Ma[da]=W.x;Ma[da+1]=W.y;Ma[da+2]=W.z;Ma[da+3]=X.x;Ma[da+4]=X.y;Ma[da+5]=X.z;Ma[da+6]=Y.x;Ma[da+7]=Y.y;Ma[da+8]=Y.z;Ma[da+9]=ta.x;Ma[da+10]=ta.y;Ma[da+
+11]=ta.z;if(bc.morphNormals)Fc?(Ib=Jc[Oa].vertexNormals[Wb],tb=Ib.a,ub=Ib.b,vb=Ib.c,sc=Ib.d):sc=vb=ub=tb=Jc[Oa].faceNormals[Wb],Na=Xc[Oa],Na[da]=tb.x,Na[da+1]=tb.y,Na[da+2]=tb.z,Na[da+3]=ub.x,Na[da+4]=ub.y,Na[da+5]=ub.z,Na[da+6]=vb.x,Na[da+7]=vb.y,Na[da+8]=vb.z,Na[da+9]=sc.x,Na[da+10]=sc.y,Na[da+11]=sc.z;da+=12}i.bindBuffer(i.ARRAY_BUFFER,fa.__webglMorphTargetsBuffers[Oa]);i.bufferData(i.ARRAY_BUFFER,Wc[Oa],eb);bc.morphNormals&&(i.bindBuffer(i.ARRAY_BUFFER,fa.__webglMorphNormalsBuffers[Oa]),i.bufferData(i.ARRAY_BUFFER,
+Xc[Oa],eb))}if(Xb.length){for(H=0,U=ma.length;H<U;H++)M=Ia[ma[H]],zb=Xb[M.a],Ab=Xb[M.b],Bb=Xb[M.c],Ba[L]=zb.x,Ba[L+1]=zb.y,Ba[L+2]=zb.z,Ba[L+3]=zb.w,Ba[L+4]=Ab.x,Ba[L+5]=Ab.y,Ba[L+6]=Ab.z,Ba[L+7]=Ab.w,Ba[L+8]=Bb.x,Ba[L+9]=Bb.y,Ba[L+10]=Bb.z,Ba[L+11]=Bb.w,Cb=fc[M.a],Db=fc[M.b],Eb=fc[M.c],Aa[L]=Cb.x,Aa[L+1]=Cb.y,Aa[L+2]=Cb.z,Aa[L+3]=Cb.w,Aa[L+4]=Db.x,Aa[L+5]=Db.y,Aa[L+6]=Db.z,Aa[L+7]=Db.w,Aa[L+8]=Eb.x,Aa[L+9]=Eb.y,Aa[L+10]=Eb.z,Aa[L+11]=Eb.w,Pb=dc[M.a],Qb=dc[M.b],Rb=dc[M.c],ya[L]=Pb.x,ya[L+1]=Pb.y,
+ya[L+2]=Pb.z,ya[L+3]=1,ya[L+4]=Qb.x,ya[L+5]=Qb.y,ya[L+6]=Qb.z,ya[L+7]=1,ya[L+8]=Rb.x,ya[L+9]=Rb.y,ya[L+10]=Rb.z,ya[L+11]=1,Sb=ec[M.a],Tb=ec[M.b],Ub=ec[M.c],za[L]=Sb.x,za[L+1]=Sb.y,za[L+2]=Sb.z,za[L+3]=1,za[L+4]=Tb.x,za[L+5]=Tb.y,za[L+6]=Tb.z,za[L+7]=1,za[L+8]=Ub.x,za[L+9]=Ub.y,za[L+10]=Ub.z,za[L+11]=1,L+=12;for(H=0,U=na.length;H<U;H++)M=Ia[na[H]],zb=Xb[M.a],Ab=Xb[M.b],Bb=Xb[M.c],uc=Xb[M.d],Ba[L]=zb.x,Ba[L+1]=zb.y,Ba[L+2]=zb.z,Ba[L+3]=zb.w,Ba[L+4]=Ab.x,Ba[L+5]=Ab.y,Ba[L+6]=Ab.z,Ba[L+7]=Ab.w,Ba[L+8]=
+Bb.x,Ba[L+9]=Bb.y,Ba[L+10]=Bb.z,Ba[L+11]=Bb.w,Ba[L+12]=uc.x,Ba[L+13]=uc.y,Ba[L+14]=uc.z,Ba[L+15]=uc.w,Cb=fc[M.a],Db=fc[M.b],Eb=fc[M.c],vc=fc[M.d],Aa[L]=Cb.x,Aa[L+1]=Cb.y,Aa[L+2]=Cb.z,Aa[L+3]=Cb.w,Aa[L+4]=Db.x,Aa[L+5]=Db.y,Aa[L+6]=Db.z,Aa[L+7]=Db.w,Aa[L+8]=Eb.x,Aa[L+9]=Eb.y,Aa[L+10]=Eb.z,Aa[L+11]=Eb.w,Aa[L+12]=vc.x,Aa[L+13]=vc.y,Aa[L+14]=vc.z,Aa[L+15]=vc.w,Pb=dc[M.a],Qb=dc[M.b],Rb=dc[M.c],Hc=dc[M.d],ya[L]=Pb.x,ya[L+1]=Pb.y,ya[L+2]=Pb.z,ya[L+3]=1,ya[L+4]=Qb.x,ya[L+5]=Qb.y,ya[L+6]=Qb.z,ya[L+7]=1,ya[L+
+8]=Rb.x,ya[L+9]=Rb.y,ya[L+10]=Rb.z,ya[L+11]=1,ya[L+12]=Hc.x,ya[L+13]=Hc.y,ya[L+14]=Hc.z,ya[L+15]=1,Sb=ec[M.a],Tb=ec[M.b],Ub=ec[M.c],Ic=ec[M.d],za[L]=Sb.x,za[L+1]=Sb.y,za[L+2]=Sb.z,za[L+3]=1,za[L+4]=Tb.x,za[L+5]=Tb.y,za[L+6]=Tb.z,za[L+7]=1,za[L+8]=Ub.x,za[L+9]=Ub.y,za[L+10]=Ub.z,za[L+11]=1,za[L+12]=Ic.x,za[L+13]=Ic.y,za[L+14]=Ic.z,za[L+15]=1,L+=16;0<L&&(i.bindBuffer(i.ARRAY_BUFFER,fa.__webglSkinVertexABuffer),i.bufferData(i.ARRAY_BUFFER,ya,eb),i.bindBuffer(i.ARRAY_BUFFER,fa.__webglSkinVertexBBuffer),
+i.bufferData(i.ARRAY_BUFFER,za,eb),i.bindBuffer(i.ARRAY_BUFFER,fa.__webglSkinIndicesBuffer),i.bufferData(i.ARRAY_BUFFER,Aa,eb),i.bindBuffer(i.ARRAY_BUFFER,fa.__webglSkinWeightsBuffer),i.bufferData(i.ARRAY_BUFFER,Ba,eb))}if(ud&&Vc){for(H=0,U=ma.length;H<U;H++)M=Ia[ma[H]],pb=M.vertexColors,Gc=M.color,3===pb.length&&Vc===THREE.VertexColors?(wb=pb[0],xb=pb[1],yb=pb[2]):yb=xb=wb=Gc,Qa[Ha]=wb.r,Qa[Ha+1]=wb.g,Qa[Ha+2]=wb.b,Qa[Ha+3]=xb.r,Qa[Ha+4]=xb.g,Qa[Ha+5]=xb.b,Qa[Ha+6]=yb.r,Qa[Ha+7]=yb.g,Qa[Ha+8]=yb.b,
+Ha+=9;for(H=0,U=na.length;H<U;H++)M=Ia[na[H]],pb=M.vertexColors,Gc=M.color,4===pb.length&&Vc===THREE.VertexColors?(wb=pb[0],xb=pb[1],yb=pb[2],tc=pb[3]):tc=yb=xb=wb=Gc,Qa[Ha]=wb.r,Qa[Ha+1]=wb.g,Qa[Ha+2]=wb.b,Qa[Ha+3]=xb.r,Qa[Ha+4]=xb.g,Qa[Ha+5]=xb.b,Qa[Ha+6]=yb.r,Qa[Ha+7]=yb.g,Qa[Ha+8]=yb.b,Qa[Ha+9]=tc.r,Qa[Ha+10]=tc.g,Qa[Ha+11]=tc.b,Ha+=12;0<Ha&&(i.bindBuffer(i.ARRAY_BUFFER,fa.__webglColorBuffer),i.bufferData(i.ARRAY_BUFFER,Qa,eb))}if(td&&Za.hasTangents){for(H=0,U=ma.length;H<U;H++)M=Ia[ma[H]],Hb=
+M.vertexTangents,qb=Hb[0],rb=Hb[1],sb=Hb[2],xa[ua]=qb.x,xa[ua+1]=qb.y,xa[ua+2]=qb.z,xa[ua+3]=qb.w,xa[ua+4]=rb.x,xa[ua+5]=rb.y,xa[ua+6]=rb.z,xa[ua+7]=rb.w,xa[ua+8]=sb.x,xa[ua+9]=sb.y,xa[ua+10]=sb.z,xa[ua+11]=sb.w,ua+=12;for(H=0,U=na.length;H<U;H++)M=Ia[na[H]],Hb=M.vertexTangents,qb=Hb[0],rb=Hb[1],sb=Hb[2],rc=Hb[3],xa[ua]=qb.x,xa[ua+1]=qb.y,xa[ua+2]=qb.z,xa[ua+3]=qb.w,xa[ua+4]=rb.x,xa[ua+5]=rb.y,xa[ua+6]=rb.z,xa[ua+7]=rb.w,xa[ua+8]=sb.x,xa[ua+9]=sb.y,xa[ua+10]=sb.z,xa[ua+11]=sb.w,xa[ua+12]=rc.x,xa[ua+
+13]=rc.y,xa[ua+14]=rc.z,xa[ua+15]=rc.w,ua+=16;i.bindBuffer(i.ARRAY_BUFFER,fa.__webglTangentBuffer);i.bufferData(i.ARRAY_BUFFER,xa,eb)}if(sd&&dd){for(H=0,U=ma.length;H<U;H++)if(M=Ia[ma[H]],jc=M.vertexNormals,Ob=M.normal,3===jc.length&&Fc)for(la=0;3>la;la++)Vb=jc[la],jb[Va]=Vb.x,jb[Va+1]=Vb.y,jb[Va+2]=Vb.z,Va+=3;else for(la=0;3>la;la++)jb[Va]=Ob.x,jb[Va+1]=Ob.y,jb[Va+2]=Ob.z,Va+=3;for(H=0,U=na.length;H<U;H++)if(M=Ia[na[H]],jc=M.vertexNormals,Ob=M.normal,4===jc.length&&Fc)for(la=0;4>la;la++)Vb=jc[la],
+jb[Va]=Vb.x,jb[Va+1]=Vb.y,jb[Va+2]=Vb.z,Va+=3;else for(la=0;4>la;la++)jb[Va]=Ob.x,jb[Va+1]=Ob.y,jb[Va+2]=Ob.z,Va+=3;i.bindBuffer(i.ARRAY_BUFFER,fa.__webglNormalBuffer);i.bufferData(i.ARRAY_BUFFER,jb,eb)}if(hd&&Zc&&ed){for(H=0,U=ma.length;H<U;H++)if(mb=ma[H],M=Ia[mb],kc=Zc[mb],void 0!==kc)for(la=0;3>la;la++)mc=kc[la],wc[Jb]=mc.u,wc[Jb+1]=mc.v,Jb+=2;for(H=0,U=na.length;H<U;H++)if(mb=na[H],M=Ia[mb],kc=Zc[mb],void 0!==kc)for(la=0;4>la;la++)mc=kc[la],wc[Jb]=mc.u,wc[Jb+1]=mc.v,Jb+=2;0<Jb&&(i.bindBuffer(i.ARRAY_BUFFER,
+fa.__webglUVBuffer),i.bufferData(i.ARRAY_BUFFER,wc,eb))}if(hd&&$c&&ed){for(H=0,U=ma.length;H<U;H++)if(mb=ma[H],M=Ia[mb],lc=$c[mb],void 0!==lc)for(la=0;3>la;la++)nc=lc[la],xc[Kb]=nc.u,xc[Kb+1]=nc.v,Kb+=2;for(H=0,U=na.length;H<U;H++)if(mb=na[H],M=Ia[mb],lc=$c[mb],void 0!==lc)for(la=0;4>la;la++)nc=lc[la],xc[Kb]=nc.u,xc[Kb+1]=nc.v,Kb+=2;0<Kb&&(i.bindBuffer(i.ARRAY_BUFFER,fa.__webglUV2Buffer),i.bufferData(i.ARRAY_BUFFER,xc,eb))}if(rd){for(H=0,U=ma.length;H<U;H++)M=Ia[ma[H]],Fb[ib]=Fa,Fb[ib+1]=Fa+1,Fb[ib+
+2]=Fa+2,ib+=3,gb[Ya]=Fa,gb[Ya+1]=Fa+1,gb[Ya+2]=Fa,gb[Ya+3]=Fa+2,gb[Ya+4]=Fa+1,gb[Ya+5]=Fa+2,Ya+=6,Fa+=3;for(H=0,U=na.length;H<U;H++)M=Ia[na[H]],Fb[ib]=Fa,Fb[ib+1]=Fa+1,Fb[ib+2]=Fa+3,Fb[ib+3]=Fa+1,Fb[ib+4]=Fa+2,Fb[ib+5]=Fa+3,ib+=6,gb[Ya]=Fa,gb[Ya+1]=Fa+1,gb[Ya+2]=Fa,gb[Ya+3]=Fa+3,gb[Ya+4]=Fa+1,gb[Ya+5]=Fa+2,gb[Ya+6]=Fa+2,gb[Ya+7]=Fa+3,Ya+=8,Fa+=4;i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,fa.__webglFaceBuffer);i.bufferData(i.ELEMENT_ARRAY_BUFFER,Fb,eb);i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,fa.__webglLineBuffer);
+i.bufferData(i.ELEMENT_ARRAY_BUFFER,gb,eb)}if(Yc)for(la=0,fd=Yc.length;la<fd;la++)if(x=Yc[la],x.__original.needsUpdate){y=0;if(1===x.size)if(void 0===x.boundTo||"vertices"===x.boundTo){for(H=0,U=ma.length;H<U;H++)M=Ia[ma[H]],x.array[y]=x.value[M.a],x.array[y+1]=x.value[M.b],x.array[y+2]=x.value[M.c],y+=3;for(H=0,U=na.length;H<U;H++)M=Ia[na[H]],x.array[y]=x.value[M.a],x.array[y+1]=x.value[M.b],x.array[y+2]=x.value[M.c],x.array[y+3]=x.value[M.d],y+=4}else{if("faces"===x.boundTo){for(H=0,U=ma.length;H<
+U;H++)fb=x.value[ma[H]],x.array[y]=fb,x.array[y+1]=fb,x.array[y+2]=fb,y+=3;for(H=0,U=na.length;H<U;H++)fb=x.value[na[H]],x.array[y]=fb,x.array[y+1]=fb,x.array[y+2]=fb,x.array[y+3]=fb,y+=4}}else if(2===x.size)if(void 0===x.boundTo||"vertices"===x.boundTo){for(H=0,U=ma.length;H<U;H++)M=Ia[ma[H]],W=x.value[M.a],X=x.value[M.b],Y=x.value[M.c],x.array[y]=W.x,x.array[y+1]=W.y,x.array[y+2]=X.x,x.array[y+3]=X.y,x.array[y+4]=Y.x,x.array[y+5]=Y.y,y+=6;for(H=0,U=na.length;H<U;H++)M=Ia[na[H]],W=x.value[M.a],X=
+x.value[M.b],Y=x.value[M.c],ta=x.value[M.d],x.array[y]=W.x,x.array[y+1]=W.y,x.array[y+2]=X.x,x.array[y+3]=X.y,x.array[y+4]=Y.x,x.array[y+5]=Y.y,x.array[y+6]=ta.x,x.array[y+7]=ta.y,y+=8}else{if("faces"===x.boundTo){for(H=0,U=ma.length;H<U;H++)Y=X=W=fb=x.value[ma[H]],x.array[y]=W.x,x.array[y+1]=W.y,x.array[y+2]=X.x,x.array[y+3]=X.y,x.array[y+4]=Y.x,x.array[y+5]=Y.y,y+=6;for(H=0,U=na.length;H<U;H++)ta=Y=X=W=fb=x.value[na[H]],x.array[y]=W.x,x.array[y+1]=W.y,x.array[y+2]=X.x,x.array[y+3]=X.y,x.array[y+
+4]=Y.x,x.array[y+5]=Y.y,x.array[y+6]=ta.x,x.array[y+7]=ta.y,y+=8}}else if(3===x.size){var ha;ha="c"===x.type?["r","g","b"]:["x","y","z"];if(void 0===x.boundTo||"vertices"===x.boundTo){for(H=0,U=ma.length;H<U;H++)M=Ia[ma[H]],W=x.value[M.a],X=x.value[M.b],Y=x.value[M.c],x.array[y]=W[ha[0]],x.array[y+1]=W[ha[1]],x.array[y+2]=W[ha[2]],x.array[y+3]=X[ha[0]],x.array[y+4]=X[ha[1]],x.array[y+5]=X[ha[2]],x.array[y+6]=Y[ha[0]],x.array[y+7]=Y[ha[1]],x.array[y+8]=Y[ha[2]],y+=9;for(H=0,U=na.length;H<U;H++)M=Ia[na[H]],
+W=x.value[M.a],X=x.value[M.b],Y=x.value[M.c],ta=x.value[M.d],x.array[y]=W[ha[0]],x.array[y+1]=W[ha[1]],x.array[y+2]=W[ha[2]],x.array[y+3]=X[ha[0]],x.array[y+4]=X[ha[1]],x.array[y+5]=X[ha[2]],x.array[y+6]=Y[ha[0]],x.array[y+7]=Y[ha[1]],x.array[y+8]=Y[ha[2]],x.array[y+9]=ta[ha[0]],x.array[y+10]=ta[ha[1]],x.array[y+11]=ta[ha[2]],y+=12}else if("faces"===x.boundTo){for(H=0,U=ma.length;H<U;H++)Y=X=W=fb=x.value[ma[H]],x.array[y]=W[ha[0]],x.array[y+1]=W[ha[1]],x.array[y+2]=W[ha[2]],x.array[y+3]=X[ha[0]],
+x.array[y+4]=X[ha[1]],x.array[y+5]=X[ha[2]],x.array[y+6]=Y[ha[0]],x.array[y+7]=Y[ha[1]],x.array[y+8]=Y[ha[2]],y+=9;for(H=0,U=na.length;H<U;H++)ta=Y=X=W=fb=x.value[na[H]],x.array[y]=W[ha[0]],x.array[y+1]=W[ha[1]],x.array[y+2]=W[ha[2]],x.array[y+3]=X[ha[0]],x.array[y+4]=X[ha[1]],x.array[y+5]=X[ha[2]],x.array[y+6]=Y[ha[0]],x.array[y+7]=Y[ha[1]],x.array[y+8]=Y[ha[2]],x.array[y+9]=ta[ha[0]],x.array[y+10]=ta[ha[1]],x.array[y+11]=ta[ha[2]],y+=12}}else if(4===x.size)if(void 0===x.boundTo||"vertices"===x.boundTo){for(H=
+0,U=ma.length;H<U;H++)M=Ia[ma[H]],W=x.value[M.a],X=x.value[M.b],Y=x.value[M.c],x.array[y]=W.x,x.array[y+1]=W.y,x.array[y+2]=W.z,x.array[y+3]=W.w,x.array[y+4]=X.x,x.array[y+5]=X.y,x.array[y+6]=X.z,x.array[y+7]=X.w,x.array[y+8]=Y.x,x.array[y+9]=Y.y,x.array[y+10]=Y.z,x.array[y+11]=Y.w,y+=12;for(H=0,U=na.length;H<U;H++)M=Ia[na[H]],W=x.value[M.a],X=x.value[M.b],Y=x.value[M.c],ta=x.value[M.d],x.array[y]=W.x,x.array[y+1]=W.y,x.array[y+2]=W.z,x.array[y+3]=W.w,x.array[y+4]=X.x,x.array[y+5]=X.y,x.array[y+6]=
+X.z,x.array[y+7]=X.w,x.array[y+8]=Y.x,x.array[y+9]=Y.y,x.array[y+10]=Y.z,x.array[y+11]=Y.w,x.array[y+12]=ta.x,x.array[y+13]=ta.y,x.array[y+14]=ta.z,x.array[y+15]=ta.w,y+=16}else if("faces"===x.boundTo){for(H=0,U=ma.length;H<U;H++)Y=X=W=fb=x.value[ma[H]],x.array[y]=W.x,x.array[y+1]=W.y,x.array[y+2]=W.z,x.array[y+3]=W.w,x.array[y+4]=X.x,x.array[y+5]=X.y,x.array[y+6]=X.z,x.array[y+7]=X.w,x.array[y+8]=Y.x,x.array[y+9]=Y.y,x.array[y+10]=Y.z,x.array[y+11]=Y.w,y+=12;for(H=0,U=na.length;H<U;H++)ta=Y=X=W=
+fb=x.value[na[H]],x.array[y]=W.x,x.array[y+1]=W.y,x.array[y+2]=W.z,x.array[y+3]=W.w,x.array[y+4]=X.x,x.array[y+5]=X.y,x.array[y+6]=X.z,x.array[y+7]=X.w,x.array[y+8]=Y.x,x.array[y+9]=Y.y,x.array[y+10]=Y.z,x.array[y+11]=Y.w,x.array[y+12]=ta.x,x.array[y+13]=ta.y,x.array[y+14]=ta.z,x.array[y+15]=ta.w,y+=16}i.bindBuffer(i.ARRAY_BUFFER,x.buffer);i.bufferData(i.ARRAY_BUFFER,x.array,eb)}qd&&(delete fa.__inittedArrays,delete fa.__colorArray,delete fa.__normalArray,delete fa.__tangentArray,delete fa.__uvArray,
+delete fa.__uv2Array,delete fa.__faceArray,delete fa.__vertexArray,delete fa.__lineArray,delete fa.__skinVertexAArray,delete fa.__skinVertexBArray,delete fa.__skinIndexArray,delete fa.__skinWeightArray)}}ka.__dirtyVertices=!1;ka.__dirtyMorphTargets=!1;ka.__dirtyElements=!1;ka.__dirtyUvs=!1;ka.__dirtyNormals=!1;ka.__dirtyColors=!1;ka.__dirtyTangents=!1;bb.attributes&&m(bb)}else if(ob instanceof THREE.Ribbon){if(ka.__dirtyVertices||ka.__dirtyColors){var Zb=ka,id=i.DYNAMIC_DRAW,yc=void 0,zc=void 0,Kc=
+void 0,$b=void 0,Lc=void 0,jd=Zb.vertices,kd=Zb.colors,wd=jd.length,xd=kd.length,Mc=Zb.__vertexArray,Nc=Zb.__colorArray,yd=Zb.__dirtyColors;if(Zb.__dirtyVertices){for(yc=0;yc<wd;yc++)Kc=jd[yc].position,$b=3*yc,Mc[$b]=Kc.x,Mc[$b+1]=Kc.y,Mc[$b+2]=Kc.z;i.bindBuffer(i.ARRAY_BUFFER,Zb.__webglVertexBuffer);i.bufferData(i.ARRAY_BUFFER,Mc,id)}if(yd){for(zc=0;zc<xd;zc++)Lc=kd[zc],$b=3*zc,Nc[$b]=Lc.r,Nc[$b+1]=Lc.g,Nc[$b+2]=Lc.b;i.bindBuffer(i.ARRAY_BUFFER,Zb.__webglColorBuffer);i.bufferData(i.ARRAY_BUFFER,
+Nc,id)}}ka.__dirtyVertices=!1;ka.__dirtyColors=!1}else if(ob instanceof THREE.Line){bb=c(ob,qc);ic=bb.attributes&&p(bb);if(ka.__dirtyVertices||ka.__dirtyColors||ic){var Lb=ka,ad=i.DYNAMIC_DRAW,Ac=void 0,Bc=void 0,Oc=void 0,Ca=void 0,Pc=void 0,ld=Lb.vertices,md=Lb.colors,zd=ld.length,Ad=md.length,Qc=Lb.__vertexArray,Rc=Lb.__colorArray,Bd=Lb.__dirtyColors,bd=Lb.__webglCustomAttributesList,Sc=void 0,nd=void 0,Ta=void 0,oc=void 0,cb=void 0,wa=void 0;if(Lb.__dirtyVertices){for(Ac=0;Ac<zd;Ac++)Oc=ld[Ac].position,
+Ca=3*Ac,Qc[Ca]=Oc.x,Qc[Ca+1]=Oc.y,Qc[Ca+2]=Oc.z;i.bindBuffer(i.ARRAY_BUFFER,Lb.__webglVertexBuffer);i.bufferData(i.ARRAY_BUFFER,Qc,ad)}if(Bd){for(Bc=0;Bc<Ad;Bc++)Pc=md[Bc],Ca=3*Bc,Rc[Ca]=Pc.r,Rc[Ca+1]=Pc.g,Rc[Ca+2]=Pc.b;i.bindBuffer(i.ARRAY_BUFFER,Lb.__webglColorBuffer);i.bufferData(i.ARRAY_BUFFER,Rc,ad)}if(bd)for(Sc=0,nd=bd.length;Sc<nd;Sc++)if(wa=bd[Sc],wa.needsUpdate&&(void 0===wa.boundTo||"vertices"===wa.boundTo)){Ca=0;oc=wa.value.length;if(1===wa.size)for(Ta=0;Ta<oc;Ta++)wa.array[Ta]=wa.value[Ta];
+else if(2===wa.size)for(Ta=0;Ta<oc;Ta++)cb=wa.value[Ta],wa.array[Ca]=cb.x,wa.array[Ca+1]=cb.y,Ca+=2;else if(3===wa.size)if("c"===wa.type)for(Ta=0;Ta<oc;Ta++)cb=wa.value[Ta],wa.array[Ca]=cb.r,wa.array[Ca+1]=cb.g,wa.array[Ca+2]=cb.b,Ca+=3;else for(Ta=0;Ta<oc;Ta++)cb=wa.value[Ta],wa.array[Ca]=cb.x,wa.array[Ca+1]=cb.y,wa.array[Ca+2]=cb.z,Ca+=3;else if(4===wa.size)for(Ta=0;Ta<oc;Ta++)cb=wa.value[Ta],wa.array[Ca]=cb.x,wa.array[Ca+1]=cb.y,wa.array[Ca+2]=cb.z,wa.array[Ca+3]=cb.w,Ca+=4;i.bindBuffer(i.ARRAY_BUFFER,
+wa.buffer);i.bufferData(i.ARRAY_BUFFER,wa.array,ad)}}ka.__dirtyVertices=!1;ka.__dirtyColors=!1;bb.attributes&&m(bb)}else if(ob instanceof THREE.ParticleSystem)bb=c(ob,qc),ic=bb.attributes&&p(bb),(ka.__dirtyVertices||ka.__dirtyColors||ob.sortParticles||ic)&&f(ka,i.DYNAMIC_DRAW,ob),ka.__dirtyVertices=!1,ka.__dirtyColors=!1,bb.attributes&&m(bb)}};this.initMaterial=function(a,b,c,d){var e,f,g,h,j;a instanceof THREE.MeshDepthMaterial?j="depth":a instanceof THREE.MeshNormalMaterial?j="normal":a instanceof
+THREE.MeshBasicMaterial?j="basic":a instanceof THREE.MeshLambertMaterial?j="lambert":a instanceof THREE.MeshPhongMaterial?j="phong":a instanceof THREE.LineBasicMaterial?j="basic":a instanceof THREE.ParticleBasicMaterial&&(j="particle_basic");if(j){var l=THREE.ShaderLib[j];a.uniforms=THREE.UniformsUtils.clone(l.uniforms);a.vertexShader=l.vertexShader;a.fragmentShader=l.fragmentShader}var k,m;f=l=0;for(k=0,m=b.length;k<m;k++)e=b[k],e.onlyShadow||(e instanceof THREE.DirectionalLight&&f++,e instanceof
+THREE.PointLight&&l++,e instanceof THREE.SpotLight&&l++);l+f<=I?k=f:(k=Math.ceil(I*f/(l+f)),l=I-k);e=k;f=l;var n=0;for(l=0,k=b.length;l<k;l++)m=b[l],m.castShadow&&(m instanceof THREE.SpotLight&&n++,m instanceof THREE.DirectionalLight&&!m.shadowCascade&&n++);var o=50;if(void 0!==d&&d instanceof THREE.SkinnedMesh)o=d.bones.length;var p;a:{k=a.fragmentShader;m=a.vertexShader;var l=a.uniforms,b=a.attributes,c={map:!!a.map,envMap:!!a.envMap,lightMap:!!a.lightMap,vertexColors:a.vertexColors,fog:c,useFog:a.fog,
 sizeAttenuation:a.sizeAttenuation,skinning:a.skinning,morphTargets:a.morphTargets,morphNormals:a.morphNormals,maxMorphTargets:this.maxMorphTargets,maxMorphNormals:this.maxMorphNormals,maxDirLights:e,maxPointLights:f,maxBones:o,shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapDebug:this.shadowMapDebug,shadowMapCascade:this.shadowMapCascade,maxShadows:n,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel,wrapAround:a.wrapAround,doubleSided:d&&d.doubleSided},
-q,d=[];l?d.push(l):(d.push(k),d.push(m));for(q in c)d.push(q),d.push(c[q]);l=d.join();for(q=0,d=T.length;q<d;q++)if(T[q].code===l){p=T[q].program;break a}q=j.createProgram();d=["precision "+F+" float;",0<Oa?"#define VERTEX_TEXTURES":"",B.gammaInput?"#define GAMMA_INPUT":"",B.gammaOutput?"#define GAMMA_OUTPUT":"",B.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,"#define MAX_BONES "+
+r,d=[];j?d.push(j):(d.push(k),d.push(m));for(r in c)d.push(r),d.push(c[r]);j=d.join();for(r=0,d=S.length;r<d;r++)if(S[r].code===j){p=S[r].program;break a}r=i.createProgram();d=["precision "+C+" float;",0<La?"#define VERTEX_TEXTURES":"",D.gammaInput?"#define GAMMA_INPUT":"",D.gammaOutput?"#define GAMMA_OUTPUT":"",D.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,"#define MAX_BONES "+
 c.maxBones,c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.skinning?"#define USE_SKINNING":"",c.morphTargets?"#define USE_MORPHTARGETS":"",c.morphNormals?"#define USE_MORPHNORMALS":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.wrapAround?"#define WRAP_AROUND":"",c.doubleSided?"#define DOUBLE_SIDED":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":
 "",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"",c.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\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;\n#ifdef USE_MORPHNORMALS\nattribute vec3 morphNormal0;\nattribute vec3 morphNormal1;\nattribute vec3 morphNormal2;\nattribute vec3 morphNormal3;\n#else\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
-e=["precision "+F+" float;","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",B.gammaInput?"#define GAMMA_INPUT":"",B.gammaOutput?"#define GAMMA_OUTPUT":"",B.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"",c.useFog&&c.fog?"#define USE_FOG":"",c.useFog&&c.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?
-"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.metal?"#define METAL":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.wrapAround?"#define WRAP_AROUND":"",c.doubleSided?"#define DOUBLE_SIDED":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");j.attachShader(q,u("fragment",e+k));
-j.attachShader(q,u("vertex",d+m));j.linkProgram(q);j.getProgramParameter(q,j.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+j.getProgramParameter(q,j.VALIDATE_STATUS)+", gl error ["+j.getError()+"]");q.uniforms={};q.attributes={};var r,d="viewMatrix,modelViewMatrix,projectionMatrix,normalMatrix,objectMatrix,cameraPosition,boneGlobalMatrices,morphTargetInfluences".split(",");for(r in i)d.push(r);r=d;for(d=0,i=r.length;d<i;d++)k=r[d],q.uniforms[k]=j.getUniformLocation(q,
-k);d="position,normal,uv,uv2,tangent,color,skinVertexA,skinVertexB,skinIndex,skinWeight".split(",");for(r=0;r<c.maxMorphTargets;r++)d.push("morphTarget"+r);for(r=0;r<c.maxMorphNormals;r++)d.push("morphNormal"+r);for(p in b)d.push(p);p=d;for(r=0,b=p.length;r<b;r++)c=p[r],q.attributes[c]=j.getAttribLocation(q,c);q.id=T.length;T.push({program:q,code:l});B.info.memory.programs=T.length;p=q}a.program=p;p=a.program.attributes;0<=p.position&&j.enableVertexAttribArray(p.position);0<=p.color&&j.enableVertexAttribArray(p.color);
-0<=p.normal&&j.enableVertexAttribArray(p.normal);0<=p.tangent&&j.enableVertexAttribArray(p.tangent);a.skinning&&0<=p.skinVertexA&&0<=p.skinVertexB&&0<=p.skinIndex&&0<=p.skinWeight&&(j.enableVertexAttribArray(p.skinVertexA),j.enableVertexAttribArray(p.skinVertexB),j.enableVertexAttribArray(p.skinIndex),j.enableVertexAttribArray(p.skinWeight));if(a.attributes)for(h in a.attributes)void 0!==p[h]&&0<=p[h]&&j.enableVertexAttribArray(p[h]);if(a.morphTargets){a.numSupportedMorphTargets=0;q="morphTarget";
-for(h=0;h<this.maxMorphTargets;h++)r=q+h,0<=p[r]&&(j.enableVertexAttribArray(p[r]),a.numSupportedMorphTargets++)}if(a.morphNormals){a.numSupportedMorphNormals=0;q="morphNormal";for(h=0;h<this.maxMorphNormals;h++)r=q+h,0<=p[r]&&(j.enableVertexAttribArray(p[r]),a.numSupportedMorphNormals++)}a.uniformsList=[];for(g in a.uniforms)a.uniformsList.push([a.uniforms[g],g])};this.setFaceCulling=function(a,b){a?(!b||"ccw"===b?j.frontFace(j.CCW):j.frontFace(j.CW),"back"===a?j.cullFace(j.BACK):"front"===a?j.cullFace(j.FRONT):
-j.cullFace(j.FRONT_AND_BACK),j.enable(j.CULL_FACE)):j.disable(j.CULL_FACE)};this.setObjectFaces=function(a){if(ca!==a.doubleSided)a.doubleSided?j.disable(j.CULL_FACE):j.enable(j.CULL_FACE),ca=a.doubleSided;if(S!==a.flipSided)a.flipSided?j.frontFace(j.CW):j.frontFace(j.CCW),S=a.flipSided};this.setDepthTest=function(a){W!==a&&(a?j.enable(j.DEPTH_TEST):j.disable(j.DEPTH_TEST),W=a)};this.setDepthWrite=function(a){aa!==a&&(j.depthMask(a),aa=a)};this.setBlending=function(a){if(a!==Q){switch(a){case THREE.NoBlending:j.disable(j.BLEND);
-break;case THREE.AdditiveBlending:j.enable(j.BLEND);j.blendEquation(j.FUNC_ADD);j.blendFunc(j.SRC_ALPHA,j.ONE);break;case THREE.SubtractiveBlending:j.enable(j.BLEND);j.blendEquation(j.FUNC_ADD);j.blendFunc(j.ZERO,j.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:j.enable(j.BLEND);j.blendEquation(j.FUNC_ADD);j.blendFunc(j.ZERO,j.SRC_COLOR);break;default:j.enable(j.BLEND),j.blendEquationSeparate(j.FUNC_ADD,j.FUNC_ADD),j.blendFuncSeparate(j.SRC_ALPHA,j.ONE_MINUS_SRC_ALPHA,j.ONE,j.ONE_MINUS_SRC_ALPHA)}Q=
-a}};this.setTexture=function(a,b){if(a.needsUpdate){if(!a.__webglInit)a.__webglInit=!0,a.__webglTexture=j.createTexture(),B.info.memory.textures++;j.activeTexture(j.TEXTURE0+b);j.bindTexture(j.TEXTURE_2D,a.__webglTexture);var c=a.image,d=0===(c.width&c.width-1)&&0===(c.height&c.height-1),e=A(a.format),f=A(a.type);v(j.TEXTURE_2D,a,d);a instanceof THREE.DataTexture?j.texImage2D(j.TEXTURE_2D,0,e,c.width,c.height,0,e,f,c.data):j.texImage2D(j.TEXTURE_2D,0,e,e,f,a.image);a.generateMipmaps&&d&&j.generateMipmap(j.TEXTURE_2D);
-a.needsUpdate=!1;if(a.onUpdate)a.onUpdate()}else j.activeTexture(j.TEXTURE0+b),j.bindTexture(j.TEXTURE_2D,a.__webglTexture)};this.setRenderTarget=function(a){var b=a instanceof THREE.WebGLRenderTargetCube;if(a&&!a.__webglFramebuffer){if(void 0===a.depthBuffer)a.depthBuffer=!0;if(void 0===a.stencilBuffer)a.stencilBuffer=!0;a.__webglTexture=j.createTexture();var c=0===(a.width&a.width-1)&&0===(a.height&a.height-1),d=A(a.format),e=A(a.type);if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];j.bindTexture(j.TEXTURE_CUBE_MAP,
-a.__webglTexture);v(j.TEXTURE_CUBE_MAP,a,c);for(c=0;6>c;c++){a.__webglFramebuffer[c]=j.createFramebuffer();a.__webglRenderbuffer[c]=j.createRenderbuffer();j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+c,0,d,a.width,a.height,0,d,e,null);var f=a,g=j.TEXTURE_CUBE_MAP_POSITIVE_X+c;j.bindFramebuffer(j.FRAMEBUFFER,a.__webglFramebuffer[c]);j.framebufferTexture2D(j.FRAMEBUFFER,j.COLOR_ATTACHMENT0,g,f.__webglTexture,0);t(a.__webglRenderbuffer[c],a)}}else a.__webglFramebuffer=j.createFramebuffer(),a.__webglRenderbuffer=
-j.createRenderbuffer(),j.bindTexture(j.TEXTURE_2D,a.__webglTexture),v(j.TEXTURE_2D,a,c),j.texImage2D(j.TEXTURE_2D,0,d,a.width,a.height,0,d,e,null),d=j.TEXTURE_2D,j.bindFramebuffer(j.FRAMEBUFFER,a.__webglFramebuffer),j.framebufferTexture2D(j.FRAMEBUFFER,j.COLOR_ATTACHMENT0,d,a.__webglTexture,0),t(a.__webglRenderbuffer,a);b?j.bindTexture(j.TEXTURE_CUBE_MAP,null):j.bindTexture(j.TEXTURE_2D,null);j.bindRenderbuffer(j.RENDERBUFFER,null);j.bindFramebuffer(j.FRAMEBUFFER,null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:
-a.__webglFramebuffer,d=a.width,a=a.height,c=e=0):(b=null,d=ra,a=bb,e=Aa,c=Ba);b!==z&&(j.bindFramebuffer(j.FRAMEBUFFER,b),j.viewport(e,c,d,a),z=b);jb=d;Va=a};this.shadowMapPlugin=new THREE.ShadowMapPlugin;this.addPrePlugin(this.shadowMapPlugin);this.addPostPlugin(new THREE.SpritePlugin);this.addPostPlugin(new THREE.LensFlarePlugin)};
+e=["precision "+C+" float;","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",D.gammaInput?"#define GAMMA_INPUT":"",D.gammaOutput?"#define GAMMA_OUTPUT":"",D.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"",c.useFog&&c.fog?"#define USE_FOG":"",c.useFog&&c.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?
+"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.metal?"#define METAL":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.wrapAround?"#define WRAP_AROUND":"",c.doubleSided?"#define DOUBLE_SIDED":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");i.attachShader(r,u("fragment",e+k));
+i.attachShader(r,u("vertex",d+m));i.linkProgram(r);i.getProgramParameter(r,i.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+i.getProgramParameter(r,i.VALIDATE_STATUS)+", gl error ["+i.getError()+"]");r.uniforms={};r.attributes={};var q,d="viewMatrix,modelViewMatrix,projectionMatrix,normalMatrix,objectMatrix,cameraPosition,boneGlobalMatrices,morphTargetInfluences".split(",");for(q in l)d.push(q);q=d;for(d=0,l=q.length;d<l;d++)k=q[d],r.uniforms[k]=i.getUniformLocation(r,
+k);d="position,normal,uv,uv2,tangent,color,skinVertexA,skinVertexB,skinIndex,skinWeight".split(",");for(q=0;q<c.maxMorphTargets;q++)d.push("morphTarget"+q);for(q=0;q<c.maxMorphNormals;q++)d.push("morphNormal"+q);for(p in b)d.push(p);p=d;for(q=0,b=p.length;q<b;q++)c=p[q],r.attributes[c]=i.getAttribLocation(r,c);r.id=S.length;S.push({program:r,code:j});D.info.memory.programs=S.length;p=r}a.program=p;p=a.program.attributes;0<=p.position&&i.enableVertexAttribArray(p.position);0<=p.color&&i.enableVertexAttribArray(p.color);
+0<=p.normal&&i.enableVertexAttribArray(p.normal);0<=p.tangent&&i.enableVertexAttribArray(p.tangent);a.skinning&&0<=p.skinVertexA&&0<=p.skinVertexB&&0<=p.skinIndex&&0<=p.skinWeight&&(i.enableVertexAttribArray(p.skinVertexA),i.enableVertexAttribArray(p.skinVertexB),i.enableVertexAttribArray(p.skinIndex),i.enableVertexAttribArray(p.skinWeight));if(a.attributes)for(h in a.attributes)void 0!==p[h]&&0<=p[h]&&i.enableVertexAttribArray(p[h]);if(a.morphTargets){a.numSupportedMorphTargets=0;r="morphTarget";
+for(h=0;h<this.maxMorphTargets;h++)q=r+h,0<=p[q]&&(i.enableVertexAttribArray(p[q]),a.numSupportedMorphTargets++)}if(a.morphNormals){a.numSupportedMorphNormals=0;r="morphNormal";for(h=0;h<this.maxMorphNormals;h++)q=r+h,0<=p[q]&&(i.enableVertexAttribArray(p[q]),a.numSupportedMorphNormals++)}a.uniformsList=[];for(g in a.uniforms)a.uniformsList.push([a.uniforms[g],g])};this.setFaceCulling=function(a,b){a?(!b||"ccw"===b?i.frontFace(i.CCW):i.frontFace(i.CW),"back"===a?i.cullFace(i.BACK):"front"===a?i.cullFace(i.FRONT):
+i.cullFace(i.FRONT_AND_BACK),i.enable(i.CULL_FACE)):i.disable(i.CULL_FACE)};this.setObjectFaces=function(a){if(ia!==a.doubleSided)a.doubleSided?i.disable(i.CULL_FACE):i.enable(i.CULL_FACE),ia=a.doubleSided;if(R!==a.flipSided)a.flipSided?i.frontFace(i.CW):i.frontFace(i.CCW),R=a.flipSided};this.setDepthTest=function(a){Ga!==a&&(a?i.enable(i.DEPTH_TEST):i.disable(i.DEPTH_TEST),Ga=a)};this.setDepthWrite=function(a){oa!==a&&(i.depthMask(a),oa=a)};this.setBlending=function(a,b,c,d){if(a!==$){switch(a){case THREE.NoBlending:i.disable(i.BLEND);
+break;case THREE.AdditiveBlending:i.enable(i.BLEND);i.blendEquation(i.FUNC_ADD);i.blendFunc(i.SRC_ALPHA,i.ONE);break;case THREE.SubtractiveBlending:i.enable(i.BLEND);i.blendEquation(i.FUNC_ADD);i.blendFunc(i.ZERO,i.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:i.enable(i.BLEND);i.blendEquation(i.FUNC_ADD);i.blendFunc(i.ZERO,i.SRC_COLOR);break;case THREE.CustomBlending:i.enable(i.BLEND);break;default:i.enable(i.BLEND),i.blendEquationSeparate(i.FUNC_ADD,i.FUNC_ADD),i.blendFuncSeparate(i.SRC_ALPHA,
+i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA)}$=a}if(a===THREE.CustomBlending){if(b!==ba&&(i.blendEquation(z(b)),ba=b),c!==Z||d!==ja)i.blendFunc(z(c),z(d)),Z=c,ja=d}else ja=Z=ba=null};this.setTexture=function(a,b){if(a.needsUpdate){if(!a.__webglInit)a.__webglInit=!0,a.__webglTexture=i.createTexture(),D.info.memory.textures++;i.activeTexture(i.TEXTURE0+b);i.bindTexture(i.TEXTURE_2D,a.__webglTexture);i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,a.premultiplyAlpha);var c=a.image,d=0===(c.width&
+c.width-1)&&0===(c.height&c.height-1),e=z(a.format),f=z(a.type);v(i.TEXTURE_2D,a,d);a instanceof THREE.DataTexture?i.texImage2D(i.TEXTURE_2D,0,e,c.width,c.height,0,e,f,c.data):i.texImage2D(i.TEXTURE_2D,0,e,e,f,a.image);a.generateMipmaps&&d&&i.generateMipmap(i.TEXTURE_2D);a.needsUpdate=!1;if(a.onUpdate)a.onUpdate()}else i.activeTexture(i.TEXTURE0+b),i.bindTexture(i.TEXTURE_2D,a.__webglTexture)};this.setRenderTarget=function(a){var b=a instanceof THREE.WebGLRenderTargetCube;if(a&&!a.__webglFramebuffer){if(void 0===
+a.depthBuffer)a.depthBuffer=!0;if(void 0===a.stencilBuffer)a.stencilBuffer=!0;a.__webglTexture=i.createTexture();var c=0===(a.width&a.width-1)&&0===(a.height&a.height-1),d=z(a.format),e=z(a.type);if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];i.bindTexture(i.TEXTURE_CUBE_MAP,a.__webglTexture);v(i.TEXTURE_CUBE_MAP,a,c);for(var f=0;6>f;f++){a.__webglFramebuffer[f]=i.createFramebuffer();a.__webglRenderbuffer[f]=i.createRenderbuffer();i.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+f,0,d,a.width,a.height,
+0,d,e,null);var g=a,h=i.TEXTURE_CUBE_MAP_POSITIVE_X+f;i.bindFramebuffer(i.FRAMEBUFFER,a.__webglFramebuffer[f]);i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,h,g.__webglTexture,0);t(a.__webglRenderbuffer[f],a)}c&&i.generateMipmap(i.TEXTURE_CUBE_MAP)}else a.__webglFramebuffer=i.createFramebuffer(),a.__webglRenderbuffer=i.createRenderbuffer(),i.bindTexture(i.TEXTURE_2D,a.__webglTexture),v(i.TEXTURE_2D,a,c),i.texImage2D(i.TEXTURE_2D,0,d,a.width,a.height,0,d,e,null),d=i.TEXTURE_2D,i.bindFramebuffer(i.FRAMEBUFFER,
+a.__webglFramebuffer),i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,d,a.__webglTexture,0),t(a.__webglRenderbuffer,a),c&&i.generateMipmap(i.TEXTURE_2D);b?i.bindTexture(i.TEXTURE_CUBE_MAP,null):i.bindTexture(i.TEXTURE_2D,null);i.bindRenderbuffer(i.RENDERBUFFER,null);i.bindFramebuffer(i.FRAMEBUFFER,null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,c=a.width,a=a.height,e=d=0):(b=null,c=kb,a=db,d=$a,e=ab);b!==A&&(i.bindFramebuffer(i.FRAMEBUFFER,b),i.viewport(d,e,c,a),
+A=b);hb=c;nb=a};this.shadowMapPlugin=new THREE.ShadowMapPlugin;this.addPrePlugin(this.shadowMapPlugin);this.addPostPlugin(new THREE.SpritePlugin);this.addPostPlugin(new THREE.LensFlarePlugin)};
 THREE.WebGLRenderTarget=function(a,b,c){this.width=a;this.height=b;c=c||{};this.wrapS=void 0!==c.wrapS?c.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=void 0!==c.wrapT?c.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=void 0!==c.magFilter?c.magFilter:THREE.LinearFilter;this.minFilter=void 0!==c.minFilter?c.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=void 0!==c.format?c.format:THREE.RGBAFormat;this.type=void 0!==c.type?c.type:
 THREE.UnsignedByteType;this.depthBuffer=void 0!==c.depthBuffer?c.depthBuffer:!0;this.stencilBuffer=void 0!==c.stencilBuffer?c.stencilBuffer:!0;this.generateMipmaps=!0};
 THREE.WebGLRenderTarget.prototype.clone=function(){var a=new THREE.WebGLRenderTarget(this.width,this.height);a.wrapS=this.wrapS;a.wrapT=this.wrapT;a.magFilter=this.magFilter;a.minFilter=this.minFilter;a.offset.copy(this.offset);a.repeat.copy(this.repeat);a.format=this.format;a.type=this.type;a.depthBuffer=this.depthBuffer;a.stencilBuffer=this.stencilBuffer;return a};THREE.WebGLRenderTargetCube=function(a,b,c){THREE.WebGLRenderTarget.call(this,a,b,c);this.activeCubeFace=0};
@@ -375,31 +379,31 @@ THREE.RenderableFace4=function(){this.v1=new THREE.RenderableVertex;this.v2=new
 THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.material=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.material=null};
 THREE.ColorUtils={adjustHSV:function(a,b,c,d){var e=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(a,e);e.h=THREE.Math.clamp(e.h+b,0,1);e.s=THREE.Math.clamp(e.s+c,0,1);e.v=THREE.Math.clamp(e.v+d,0,1);a.setHSV(e.h,e.s,e.v)},rgbToHsv:function(a,b){var c=a.r,d=a.g,e=a.b,f=Math.max(Math.max(c,d),e),g=Math.min(Math.min(c,d),e);if(g===f)g=c=0;else{var h=f-g,g=h/f,c=(c===f?(d-e)/h:d===f?2+(e-c)/h:4+(c-d)/h)/6;0>c&&(c+=1);1<c&&(c-=1)}void 0===b&&(b={h:0,s:0,v:0});b.h=c;b.s=g;b.v=f;return b}};
 THREE.ColorUtils.__hsv={h:0,s:0,v:0};
-THREE.GeometryUtils={merge:function(a,b){for(var c,d,e=a.vertices.length,f=b instanceof THREE.Mesh?b.geometry:b,g=a.vertices,h=f.vertices,i=a.faces,m=f.faces,k=a.faceVertexUvs[0],p=f.faceVertexUvs[0],n={},o=0;o<a.materials.length;o++)n[a.materials[o].id]=o;if(b instanceof THREE.Mesh)b.matrixAutoUpdate&&b.updateMatrix(),c=b.matrix,d=new THREE.Matrix4,d.extractRotation(c,b.scale);for(var o=0,q=h.length;o<q;o++){var l=h[o].clone();c&&c.multiplyVector3(l.position);g.push(l)}for(o=0,q=m.length;o<q;o++){var g=
-m[o],r,s,u=g.vertexNormals,v=g.vertexColors;g instanceof THREE.Face3?r=new THREE.Face3(g.a+e,g.b+e,g.c+e):g instanceof THREE.Face4&&(r=new THREE.Face4(g.a+e,g.b+e,g.c+e,g.d+e));r.normal.copy(g.normal);d&&d.multiplyVector3(r.normal);h=0;for(l=u.length;h<l;h++)s=u[h].clone(),d&&d.multiplyVector3(s),r.vertexNormals.push(s);r.color.copy(g.color);h=0;for(l=v.length;h<l;h++)s=v[h],r.vertexColors.push(s.clone());if(void 0!==g.materialIndex){h=f.materials[g.materialIndex];l=h.id;v=n[l];if(void 0===v)v=a.materials.length,
-n[l]=v,a.materials.push(h);r.materialIndex=v}r.centroid.copy(g.centroid);c&&c.multiplyVector3(r.centroid);i.push(r)}for(o=0,q=p.length;o<q;o++){c=p[o];d=[];h=0;for(l=c.length;h<l;h++)d.push(new THREE.UV(c[h].u,c[h].v));k.push(d)}},clone:function(a){var b=new THREE.Geometry,c,d=a.vertices,e=a.faces,f=a.faceVertexUvs[0];if(a.materials)b.materials=a.materials.slice();for(a=0,c=d.length;a<c;a++)b.vertices.push(d[a].clone());for(a=0,c=e.length;a<c;a++)b.faces.push(e[a].clone());for(a=0,c=f.length;a<c;a++){for(var d=
+THREE.GeometryUtils={merge:function(a,b){for(var c,d,e=a.vertices.length,f=b instanceof THREE.Mesh?b.geometry:b,g=a.vertices,h=f.vertices,l=a.faces,j=f.faces,k=a.faceVertexUvs[0],p=f.faceVertexUvs[0],m={},o=0;o<a.materials.length;o++)m[a.materials[o].id]=o;if(b instanceof THREE.Mesh)b.matrixAutoUpdate&&b.updateMatrix(),c=b.matrix,d=new THREE.Matrix4,d.extractRotation(c,b.scale);for(var o=0,r=h.length;o<r;o++){var n=h[o].clone();c&&c.multiplyVector3(n.position);g.push(n)}for(o=0,r=j.length;o<r;o++){var g=
+j[o],q,s,u=g.vertexNormals,v=g.vertexColors;g instanceof THREE.Face3?q=new THREE.Face3(g.a+e,g.b+e,g.c+e):g instanceof THREE.Face4&&(q=new THREE.Face4(g.a+e,g.b+e,g.c+e,g.d+e));q.normal.copy(g.normal);d&&d.multiplyVector3(q.normal);h=0;for(n=u.length;h<n;h++)s=u[h].clone(),d&&d.multiplyVector3(s),q.vertexNormals.push(s);q.color.copy(g.color);h=0;for(n=v.length;h<n;h++)s=v[h],q.vertexColors.push(s.clone());if(void 0!==g.materialIndex){h=f.materials[g.materialIndex];n=h.id;v=m[n];if(void 0===v)v=a.materials.length,
+m[n]=v,a.materials.push(h);q.materialIndex=v}q.centroid.copy(g.centroid);c&&c.multiplyVector3(q.centroid);l.push(q)}for(o=0,r=p.length;o<r;o++){c=p[o];d=[];h=0;for(n=c.length;h<n;h++)d.push(new THREE.UV(c[h].u,c[h].v));k.push(d)}},clone:function(a){var b=new THREE.Geometry,c,d=a.vertices,e=a.faces,f=a.faceVertexUvs[0];if(a.materials)b.materials=a.materials.slice();for(a=0,c=d.length;a<c;a++)b.vertices.push(d[a].clone());for(a=0,c=e.length;a<c;a++)b.faces.push(e[a].clone());for(a=0,c=f.length;a<c;a++){for(var d=
 f[a],e=[],g=0,h=d.length;g<h;g++)e.push(new THREE.UV(d[g].u,d[g].v));b.faceVertexUvs[0].push(e)}return b},randomPointInTriangle:function(a,b,c){var d,e,f,g=new THREE.Vector3,h=THREE.GeometryUtils.__v1;d=THREE.GeometryUtils.random();e=THREE.GeometryUtils.random();1<d+e&&(d=1-d,e=1-e);f=1-d-e;g.copy(a);g.multiplyScalar(d);h.copy(b);h.multiplyScalar(e);g.addSelf(h);h.copy(c);h.multiplyScalar(f);g.addSelf(h);return g},randomPointInFace:function(a,b,c){var d,e,f;if(a instanceof THREE.Face3)return d=b.vertices[a.a].position,
 e=b.vertices[a.b].position,f=b.vertices[a.c].position,THREE.GeometryUtils.randomPointInTriangle(d,e,f);if(a instanceof THREE.Face4){d=b.vertices[a.a].position;e=b.vertices[a.b].position;f=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(d,e,b),g=THREE.GeometryUtils.triangleArea(e,f,b),a._area1=c,a._area2=g):(c=THREE.GeometryUtils.triangleArea(d,e,b),g=THREE.GeometryUtils.triangleArea(e,f,b));return THREE.GeometryUtils.random()*
-(c+g)<c?THREE.GeometryUtils.randomPointInTriangle(d,e,b):THREE.GeometryUtils.randomPointInTriangle(e,f,b)}},randomPointsInGeometry:function(a,b){function c(a){function b(c,d){if(d<c)return c;var e=c+Math.floor((d-c)/2);return m[e]>a?b(c,e-1):m[e]<a?b(e+1,d):e}return b(0,m.length-1)}var d,e,f=a.faces,g=a.vertices,h=f.length,i=0,m=[],k,p,n,o;for(e=0;e<h;e++){d=f[e];if(d instanceof THREE.Face3)k=g[d.a].position,p=g[d.b].position,n=g[d.c].position,d._area=THREE.GeometryUtils.triangleArea(k,p,n);else if(d instanceof
-THREE.Face4)k=g[d.a].position,p=g[d.b].position,n=g[d.c].position,o=g[d.d].position,d._area1=THREE.GeometryUtils.triangleArea(k,p,o),d._area2=THREE.GeometryUtils.triangleArea(p,n,o),d._area=d._area1+d._area2;i+=d._area;m[e]=i}d=[];for(e=0;e<b;e++)g=THREE.GeometryUtils.random()*i,g=c(g),d[e]=THREE.GeometryUtils.randomPointInFace(f[g],a,!0);return d},triangleArea:function(a,b,c){var d,e=THREE.GeometryUtils.__v1;e.sub(a,b);d=e.length();e.sub(a,c);a=e.length();e.sub(b,c);c=e.length();b=0.5*(d+a+c);return Math.sqrt(b*
-(b-d)*(b-a)*(b-c))},center:function(a){a.computeBoundingBox();var b=a.boundingBox,c=new THREE.Vector3;c.add(b.min,b.max);c.multiplyScalar(-0.5);a.applyMatrix((new THREE.Matrix4).setTranslation(c.x,c.y,c.z));a.computeBoundingBox();return c},normalizeUVs:function(a){for(var a=a.faceVertexUvs[0],b=0,c=a.length;b<c;b++)for(var d=a[b],e=0,f=d.length;e<f;e++)1!==d[e].u&&(d[e].u-=Math.floor(d[e].u)),1!==d[e].v&&(d[e].v-=Math.floor(d[e].v))},triangulateQuads:function(a){var b,c,d,e,f=[],g=[],h=[];for(b=0,
-c=a.faceUvs.length;b<c;b++)g[b]=[];for(b=0,c=a.faceVertexUvs.length;b<c;b++)h[b]=[];for(b=0,c=a.faces.length;b<c;b++)if(d=a.faces[b],d instanceof THREE.Face4){e=d.a;var i=d.b,m=d.c,k=d.d,p=new THREE.Face3,n=new THREE.Face3;p.color.copy(d.color);n.color.copy(d.color);p.materialIndex=d.materialIndex;n.materialIndex=d.materialIndex;p.a=e;p.b=i;p.c=k;n.a=i;n.b=m;n.c=k;4===d.vertexColors.length&&(p.vertexColors[0]=d.vertexColors[0].clone(),p.vertexColors[1]=d.vertexColors[1].clone(),p.vertexColors[2]=
-d.vertexColors[3].clone(),n.vertexColors[0]=d.vertexColors[1].clone(),n.vertexColors[1]=d.vertexColors[2].clone(),n.vertexColors[2]=d.vertexColors[3].clone());f.push(p,n);for(d=0,e=a.faceVertexUvs.length;d<e;d++)a.faceVertexUvs[d].length&&(p=a.faceVertexUvs[d][b],i=p[1],m=p[2],k=p[3],p=[p[0].clone(),i.clone(),k.clone()],i=[i.clone(),m.clone(),k.clone()],h[d].push(p,i));for(d=0,e=a.faceUvs.length;d<e;d++)a.faceUvs[d].length&&(i=a.faceUvs[d][b],g[d].push(i,i))}else{f.push(d);for(d=0,e=a.faceUvs.length;d<
-e;d++)g[d].push(a.faceUvs[d]);for(d=0,e=a.faceVertexUvs.length;d<e;d++)h[d].push(a.faceVertexUvs[d])}a.faces=f;a.faceUvs=g;a.faceVertexUvs=h;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals();a.hasTangents&&a.computeTangents()},explode:function(a){for(var b=[],c=0,d=a.faces.length;c<d;c++){var e=b.length,f=a.faces[c];if(f instanceof THREE.Face4){var g=f.a,h=f.b,i=f.c,g=a.vertices[g],h=a.vertices[h],i=a.vertices[i],m=a.vertices[f.d];b.push(g.clone());b.push(h.clone());b.push(i.clone());
-b.push(m.clone());f.a=e;f.b=e+1;f.c=e+2;f.d=e+3}else g=f.a,h=f.b,i=f.c,g=a.vertices[g],h=a.vertices[h],i=a.vertices[i],b.push(g.clone()),b.push(h.clone()),b.push(i.clone()),f.a=e,f.b=e+1,f.c=e+2}a.vertices=b;delete a.__tmpVertices},tessellate:function(a,b){var c,d,e,f,g,h,i,m,k,p,n,o,q,l,r,s,u,v,t,w=[],A=[];for(c=0,d=a.faceVertexUvs.length;c<d;c++)A[c]=[];for(c=0,d=a.faces.length;c<d;c++)if(e=a.faces[c],e instanceof THREE.Face3)if(f=e.a,g=e.b,h=e.c,m=a.vertices[f],k=a.vertices[g],p=a.vertices[h],
-o=m.position.distanceTo(k.position),q=k.position.distanceTo(p.position),n=m.position.distanceTo(p.position),o>b||q>b||n>b){i=a.vertices.length;v=e.clone();t=e.clone();o>=q&&o>=n?(m=m.clone(),m.position.lerpSelf(k.position,0.5),v.a=f,v.b=i,v.c=h,t.a=i,t.b=g,t.c=h,3===e.vertexNormals.length&&(f=e.vertexNormals[0].clone(),f.lerpSelf(e.vertexNormals[1],0.5),v.vertexNormals[1].copy(f),t.vertexNormals[0].copy(f)),3===e.vertexColors.length&&(f=e.vertexColors[0].clone(),f.lerpSelf(e.vertexColors[1],0.5),
-v.vertexColors[1].copy(f),t.vertexColors[0].copy(f)),e=0):q>=o&&q>=n?(m=k.clone(),m.position.lerpSelf(p.position,0.5),v.a=f,v.b=g,v.c=i,t.a=i,t.b=h,t.c=f,3===e.vertexNormals.length&&(f=e.vertexNormals[1].clone(),f.lerpSelf(e.vertexNormals[2],0.5),v.vertexNormals[2].copy(f),t.vertexNormals[0].copy(f),t.vertexNormals[1].copy(e.vertexNormals[2]),t.vertexNormals[2].copy(e.vertexNormals[0])),3===e.vertexColors.length&&(f=e.vertexColors[1].clone(),f.lerpSelf(e.vertexColors[2],0.5),v.vertexColors[2].copy(f),
-t.vertexColors[0].copy(f),t.vertexColors[1].copy(e.vertexColors[2]),t.vertexColors[2].copy(e.vertexColors[0])),e=1):(m=m.clone(),m.position.lerpSelf(p.position,0.5),v.a=f,v.b=g,v.c=i,t.a=i,t.b=g,t.c=h,3===e.vertexNormals.length&&(f=e.vertexNormals[0].clone(),f.lerpSelf(e.vertexNormals[2],0.5),v.vertexNormals[2].copy(f),t.vertexNormals[0].copy(f)),3===e.vertexColors.length&&(f=e.vertexColors[0].clone(),f.lerpSelf(e.vertexColors[2],0.5),v.vertexColors[2].copy(f),t.vertexColors[0].copy(f)),e=2);w.push(v,
-t);a.vertices.push(m);for(f=0,g=a.faceVertexUvs.length;f<g;f++)a.faceVertexUvs[f].length&&(m=a.faceVertexUvs[f][c],t=m[0],h=m[1],v=m[2],0===e?(k=t.clone(),k.lerpSelf(h,0.5),m=[t.clone(),k.clone(),v.clone()],h=[k.clone(),h.clone(),v.clone()]):1===e?(k=h.clone(),k.lerpSelf(v,0.5),m=[t.clone(),h.clone(),k.clone()],h=[k.clone(),v.clone(),t.clone()]):(k=t.clone(),k.lerpSelf(v,0.5),m=[t.clone(),h.clone(),k.clone()],h=[k.clone(),h.clone(),v.clone()]),A[f].push(m,h))}else{w.push(e);for(f=0,g=a.faceVertexUvs.length;f<
-g;f++)A[f].push(a.faceVertexUvs[f])}else if(f=e.a,g=e.b,h=e.c,i=e.d,m=a.vertices[f],k=a.vertices[g],p=a.vertices[h],n=a.vertices[i],o=m.position.distanceTo(k.position),q=k.position.distanceTo(p.position),l=p.position.distanceTo(n.position),r=m.position.distanceTo(n.position),o>b||q>b||l>b||r>b){s=a.vertices.length;u=a.vertices.length+1;v=e.clone();t=e.clone();o>=q&&o>=l&&o>=r||l>=q&&l>=o&&l>=r?(o=m.clone(),o.position.lerpSelf(k.position,0.5),k=p.clone(),k.position.lerpSelf(n.position,0.5),v.a=f,v.b=
-s,v.c=u,v.d=i,t.a=s,t.b=g,t.c=h,t.d=u,4===e.vertexNormals.length&&(f=e.vertexNormals[0].clone(),f.lerpSelf(e.vertexNormals[1],0.5),g=e.vertexNormals[2].clone(),g.lerpSelf(e.vertexNormals[3],0.5),v.vertexNormals[1].copy(f),v.vertexNormals[2].copy(g),t.vertexNormals[0].copy(f),t.vertexNormals[3].copy(g)),4===e.vertexColors.length&&(f=e.vertexColors[0].clone(),f.lerpSelf(e.vertexColors[1],0.5),g=e.vertexColors[2].clone(),g.lerpSelf(e.vertexColors[3],0.5),v.vertexColors[1].copy(f),v.vertexColors[2].copy(g),
-t.vertexColors[0].copy(f),t.vertexColors[3].copy(g)),e=0):(o=k.clone(),o.position.lerpSelf(p.position,0.5),k=n.clone(),k.position.lerpSelf(m.position,0.5),v.a=f,v.b=g,v.c=s,v.d=u,t.a=u,t.b=s,t.c=h,t.d=i,4===e.vertexNormals.length&&(f=e.vertexNormals[1].clone(),f.lerpSelf(e.vertexNormals[2],0.5),g=e.vertexNormals[3].clone(),g.lerpSelf(e.vertexNormals[0],0.5),v.vertexNormals[2].copy(f),v.vertexNormals[3].copy(g),t.vertexNormals[0].copy(g),t.vertexNormals[1].copy(f)),4===e.vertexColors.length&&(f=e.vertexColors[1].clone(),
-f.lerpSelf(e.vertexColors[2],0.5),g=e.vertexColors[3].clone(),g.lerpSelf(e.vertexColors[0],0.5),v.vertexColors[2].copy(f),v.vertexColors[3].copy(g),t.vertexColors[0].copy(g),t.vertexColors[1].copy(f)),e=1);w.push(v,t);a.vertices.push(o,k);for(f=0,g=a.faceVertexUvs.length;f<g;f++)a.faceVertexUvs[f].length&&(m=a.faceVertexUvs[f][c],t=m[0],h=m[1],v=m[2],m=m[3],0===e?(k=t.clone(),k.lerpSelf(h,0.5),p=v.clone(),p.lerpSelf(m,0.5),t=[t.clone(),k.clone(),p.clone(),m.clone()],h=[k.clone(),h.clone(),v.clone(),
-p.clone()]):(k=h.clone(),k.lerpSelf(v,0.5),p=m.clone(),p.lerpSelf(t,0.5),t=[t.clone(),h.clone(),k.clone(),p.clone()],h=[p.clone(),k.clone(),v.clone(),m.clone()]),A[f].push(t,h))}else{w.push(e);for(f=0,g=a.faceVertexUvs.length;f<g;f++)A[f].push(a.faceVertexUvs[f])}a.faces=w;a.faceVertexUvs=A}};THREE.GeometryUtils.random=THREE.Math.random16;THREE.GeometryUtils.__v1=new THREE.Vector3;
+(c+g)<c?THREE.GeometryUtils.randomPointInTriangle(d,e,b):THREE.GeometryUtils.randomPointInTriangle(e,f,b)}},randomPointsInGeometry:function(a,b){function c(a){function b(c,d){if(d<c)return c;var e=c+Math.floor((d-c)/2);return j[e]>a?b(c,e-1):j[e]<a?b(e+1,d):e}return b(0,j.length-1)}var d,e,f=a.faces,g=a.vertices,h=f.length,l=0,j=[],k,p,m,o;for(e=0;e<h;e++){d=f[e];if(d instanceof THREE.Face3)k=g[d.a].position,p=g[d.b].position,m=g[d.c].position,d._area=THREE.GeometryUtils.triangleArea(k,p,m);else if(d instanceof
+THREE.Face4)k=g[d.a].position,p=g[d.b].position,m=g[d.c].position,o=g[d.d].position,d._area1=THREE.GeometryUtils.triangleArea(k,p,o),d._area2=THREE.GeometryUtils.triangleArea(p,m,o),d._area=d._area1+d._area2;l+=d._area;j[e]=l}d=[];for(e=0;e<b;e++)g=THREE.GeometryUtils.random()*l,g=c(g),d[e]=THREE.GeometryUtils.randomPointInFace(f[g],a,!0);return d},triangleArea:function(a,b,c){var d,e=THREE.GeometryUtils.__v1;e.sub(a,b);d=e.length();e.sub(a,c);a=e.length();e.sub(b,c);c=e.length();b=0.5*(d+a+c);return Math.sqrt(b*
+(b-d)*(b-a)*(b-c))},center:function(a){a.computeBoundingBox();var b=a.boundingBox,c=new THREE.Vector3;c.add(b.min,b.max);c.multiplyScalar(-0.5);a.applyMatrix((new THREE.Matrix4).makeTranslation(c.x,c.y,c.z));a.computeBoundingBox();return c},normalizeUVs:function(a){for(var a=a.faceVertexUvs[0],b=0,c=a.length;b<c;b++)for(var d=a[b],e=0,f=d.length;e<f;e++)1!==d[e].u&&(d[e].u-=Math.floor(d[e].u)),1!==d[e].v&&(d[e].v-=Math.floor(d[e].v))},triangulateQuads:function(a){var b,c,d,e,f=[],g=[],h=[];for(b=
+0,c=a.faceUvs.length;b<c;b++)g[b]=[];for(b=0,c=a.faceVertexUvs.length;b<c;b++)h[b]=[];for(b=0,c=a.faces.length;b<c;b++)if(d=a.faces[b],d instanceof THREE.Face4){e=d.a;var l=d.b,j=d.c,k=d.d,p=new THREE.Face3,m=new THREE.Face3;p.color.copy(d.color);m.color.copy(d.color);p.materialIndex=d.materialIndex;m.materialIndex=d.materialIndex;p.a=e;p.b=l;p.c=k;m.a=l;m.b=j;m.c=k;4===d.vertexColors.length&&(p.vertexColors[0]=d.vertexColors[0].clone(),p.vertexColors[1]=d.vertexColors[1].clone(),p.vertexColors[2]=
+d.vertexColors[3].clone(),m.vertexColors[0]=d.vertexColors[1].clone(),m.vertexColors[1]=d.vertexColors[2].clone(),m.vertexColors[2]=d.vertexColors[3].clone());f.push(p,m);for(d=0,e=a.faceVertexUvs.length;d<e;d++)a.faceVertexUvs[d].length&&(p=a.faceVertexUvs[d][b],l=p[1],j=p[2],k=p[3],p=[p[0].clone(),l.clone(),k.clone()],l=[l.clone(),j.clone(),k.clone()],h[d].push(p,l));for(d=0,e=a.faceUvs.length;d<e;d++)a.faceUvs[d].length&&(l=a.faceUvs[d][b],g[d].push(l,l))}else{f.push(d);for(d=0,e=a.faceUvs.length;d<
+e;d++)g[d].push(a.faceUvs[d]);for(d=0,e=a.faceVertexUvs.length;d<e;d++)h[d].push(a.faceVertexUvs[d])}a.faces=f;a.faceUvs=g;a.faceVertexUvs=h;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals();a.hasTangents&&a.computeTangents()},explode:function(a){for(var b=[],c=0,d=a.faces.length;c<d;c++){var e=b.length,f=a.faces[c];if(f instanceof THREE.Face4){var g=f.a,h=f.b,l=f.c,g=a.vertices[g],h=a.vertices[h],l=a.vertices[l],j=a.vertices[f.d];b.push(g.clone());b.push(h.clone());b.push(l.clone());
+b.push(j.clone());f.a=e;f.b=e+1;f.c=e+2;f.d=e+3}else g=f.a,h=f.b,l=f.c,g=a.vertices[g],h=a.vertices[h],l=a.vertices[l],b.push(g.clone()),b.push(h.clone()),b.push(l.clone()),f.a=e,f.b=e+1,f.c=e+2}a.vertices=b;delete a.__tmpVertices},tessellate:function(a,b){var c,d,e,f,g,h,l,j,k,p,m,o,r,n,q,s,u,v,t,w=[],z=[];for(c=0,d=a.faceVertexUvs.length;c<d;c++)z[c]=[];for(c=0,d=a.faces.length;c<d;c++)if(e=a.faces[c],e instanceof THREE.Face3)if(f=e.a,g=e.b,h=e.c,j=a.vertices[f],k=a.vertices[g],p=a.vertices[h],
+o=j.position.distanceTo(k.position),r=k.position.distanceTo(p.position),m=j.position.distanceTo(p.position),o>b||r>b||m>b){l=a.vertices.length;v=e.clone();t=e.clone();o>=r&&o>=m?(j=j.clone(),j.position.lerpSelf(k.position,0.5),v.a=f,v.b=l,v.c=h,t.a=l,t.b=g,t.c=h,3===e.vertexNormals.length&&(f=e.vertexNormals[0].clone(),f.lerpSelf(e.vertexNormals[1],0.5),v.vertexNormals[1].copy(f),t.vertexNormals[0].copy(f)),3===e.vertexColors.length&&(f=e.vertexColors[0].clone(),f.lerpSelf(e.vertexColors[1],0.5),
+v.vertexColors[1].copy(f),t.vertexColors[0].copy(f)),e=0):r>=o&&r>=m?(j=k.clone(),j.position.lerpSelf(p.position,0.5),v.a=f,v.b=g,v.c=l,t.a=l,t.b=h,t.c=f,3===e.vertexNormals.length&&(f=e.vertexNormals[1].clone(),f.lerpSelf(e.vertexNormals[2],0.5),v.vertexNormals[2].copy(f),t.vertexNormals[0].copy(f),t.vertexNormals[1].copy(e.vertexNormals[2]),t.vertexNormals[2].copy(e.vertexNormals[0])),3===e.vertexColors.length&&(f=e.vertexColors[1].clone(),f.lerpSelf(e.vertexColors[2],0.5),v.vertexColors[2].copy(f),
+t.vertexColors[0].copy(f),t.vertexColors[1].copy(e.vertexColors[2]),t.vertexColors[2].copy(e.vertexColors[0])),e=1):(j=j.clone(),j.position.lerpSelf(p.position,0.5),v.a=f,v.b=g,v.c=l,t.a=l,t.b=g,t.c=h,3===e.vertexNormals.length&&(f=e.vertexNormals[0].clone(),f.lerpSelf(e.vertexNormals[2],0.5),v.vertexNormals[2].copy(f),t.vertexNormals[0].copy(f)),3===e.vertexColors.length&&(f=e.vertexColors[0].clone(),f.lerpSelf(e.vertexColors[2],0.5),v.vertexColors[2].copy(f),t.vertexColors[0].copy(f)),e=2);w.push(v,
+t);a.vertices.push(j);for(f=0,g=a.faceVertexUvs.length;f<g;f++)a.faceVertexUvs[f].length&&(j=a.faceVertexUvs[f][c],t=j[0],h=j[1],v=j[2],0===e?(k=t.clone(),k.lerpSelf(h,0.5),j=[t.clone(),k.clone(),v.clone()],h=[k.clone(),h.clone(),v.clone()]):1===e?(k=h.clone(),k.lerpSelf(v,0.5),j=[t.clone(),h.clone(),k.clone()],h=[k.clone(),v.clone(),t.clone()]):(k=t.clone(),k.lerpSelf(v,0.5),j=[t.clone(),h.clone(),k.clone()],h=[k.clone(),h.clone(),v.clone()]),z[f].push(j,h))}else{w.push(e);for(f=0,g=a.faceVertexUvs.length;f<
+g;f++)z[f].push(a.faceVertexUvs[f])}else if(f=e.a,g=e.b,h=e.c,l=e.d,j=a.vertices[f],k=a.vertices[g],p=a.vertices[h],m=a.vertices[l],o=j.position.distanceTo(k.position),r=k.position.distanceTo(p.position),n=p.position.distanceTo(m.position),q=j.position.distanceTo(m.position),o>b||r>b||n>b||q>b){s=a.vertices.length;u=a.vertices.length+1;v=e.clone();t=e.clone();o>=r&&o>=n&&o>=q||n>=r&&n>=o&&n>=q?(o=j.clone(),o.position.lerpSelf(k.position,0.5),k=p.clone(),k.position.lerpSelf(m.position,0.5),v.a=f,v.b=
+s,v.c=u,v.d=l,t.a=s,t.b=g,t.c=h,t.d=u,4===e.vertexNormals.length&&(f=e.vertexNormals[0].clone(),f.lerpSelf(e.vertexNormals[1],0.5),g=e.vertexNormals[2].clone(),g.lerpSelf(e.vertexNormals[3],0.5),v.vertexNormals[1].copy(f),v.vertexNormals[2].copy(g),t.vertexNormals[0].copy(f),t.vertexNormals[3].copy(g)),4===e.vertexColors.length&&(f=e.vertexColors[0].clone(),f.lerpSelf(e.vertexColors[1],0.5),g=e.vertexColors[2].clone(),g.lerpSelf(e.vertexColors[3],0.5),v.vertexColors[1].copy(f),v.vertexColors[2].copy(g),
+t.vertexColors[0].copy(f),t.vertexColors[3].copy(g)),e=0):(o=k.clone(),o.position.lerpSelf(p.position,0.5),k=m.clone(),k.position.lerpSelf(j.position,0.5),v.a=f,v.b=g,v.c=s,v.d=u,t.a=u,t.b=s,t.c=h,t.d=l,4===e.vertexNormals.length&&(f=e.vertexNormals[1].clone(),f.lerpSelf(e.vertexNormals[2],0.5),g=e.vertexNormals[3].clone(),g.lerpSelf(e.vertexNormals[0],0.5),v.vertexNormals[2].copy(f),v.vertexNormals[3].copy(g),t.vertexNormals[0].copy(g),t.vertexNormals[1].copy(f)),4===e.vertexColors.length&&(f=e.vertexColors[1].clone(),
+f.lerpSelf(e.vertexColors[2],0.5),g=e.vertexColors[3].clone(),g.lerpSelf(e.vertexColors[0],0.5),v.vertexColors[2].copy(f),v.vertexColors[3].copy(g),t.vertexColors[0].copy(g),t.vertexColors[1].copy(f)),e=1);w.push(v,t);a.vertices.push(o,k);for(f=0,g=a.faceVertexUvs.length;f<g;f++)a.faceVertexUvs[f].length&&(j=a.faceVertexUvs[f][c],t=j[0],h=j[1],v=j[2],j=j[3],0===e?(k=t.clone(),k.lerpSelf(h,0.5),p=v.clone(),p.lerpSelf(j,0.5),t=[t.clone(),k.clone(),p.clone(),j.clone()],h=[k.clone(),h.clone(),v.clone(),
+p.clone()]):(k=h.clone(),k.lerpSelf(v,0.5),p=j.clone(),p.lerpSelf(t,0.5),t=[t.clone(),h.clone(),k.clone(),p.clone()],h=[p.clone(),k.clone(),v.clone(),j.clone()]),z[f].push(t,h))}else{w.push(e);for(f=0,g=a.faceVertexUvs.length;f<g;f++)z[f].push(a.faceVertexUvs[f])}a.faces=w;a.faceVertexUvs=z}};THREE.GeometryUtils.random=THREE.Math.random16;THREE.GeometryUtils.__v1=new THREE.Vector3;
 THREE.ImageUtils={crossOrigin:"anonymous",loadTexture:function(a,b,c){var d=new Image,e=new THREE.Texture(d,b);d.onload=function(){e.needsUpdate=!0;c&&c(this)};d.crossOrigin=this.crossOrigin;d.src=a;return e},loadTextureCube:function(a,b,c){var d,e=[],f=new THREE.Texture(e,b);e.loadCount=0;for(b=0,d=a.length;b<d;++b)e[b]=new Image,e[b].onload=function(){e.loadCount+=1;if(6===e.loadCount)f.needsUpdate=!0;c&&c(this)},e[b].crossOrigin=this.crossOrigin,e[b].src=a[b];return f},getNormalMap:function(a,
-b){var c=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]},b=b|1,d=a.width,e=a.height,f=document.createElement("canvas");f.width=d;f.height=e;var g=f.getContext("2d");g.drawImage(a,0,0);for(var h=g.getImageData(0,0,d,e).data,i=g.createImageData(d,e),m=i.data,k=0;k<d;k++)for(var p=1;p<e;p++){var n=0>p-1?e-1:p-1,o=(p+1)%e,q=0>k-1?d-1:k-1,l=(k+1)%d,r=[],s=[0,0,h[4*(p*d+k)]/255*b];r.push([-1,0,h[4*(p*d+q)]/255*b]);r.push([-1,-1,h[4*(n*d+q)]/255*b]);r.push([0,-1,
-h[4*(n*d+k)]/255*b]);r.push([1,-1,h[4*(n*d+l)]/255*b]);r.push([1,0,h[4*(p*d+l)]/255*b]);r.push([1,1,h[4*(o*d+l)]/255*b]);r.push([0,1,h[4*(o*d+k)]/255*b]);r.push([-1,1,h[4*(o*d+q)]/255*b]);n=[];q=r.length;for(o=0;o<q;o++){var l=r[o],u=r[(o+1)%q],l=[l[0]-s[0],l[1]-s[1],l[2]-s[2]],u=[u[0]-s[0],u[1]-s[1],u[2]-s[2]];n.push(c([l[1]*u[2]-l[2]*u[1],l[2]*u[0]-l[0]*u[2],l[0]*u[1]-l[1]*u[0]]))}r=[0,0,0];for(o=0;o<n.length;o++)r[0]+=n[o][0],r[1]+=n[o][1],r[2]+=n[o][2];r[0]/=n.length;r[1]/=n.length;r[2]/=n.length;
-s=4*(p*d+k);m[s]=255*((r[0]+1)/2)|0;m[s+1]=255*(r[1]+0.5)|0;m[s+2]=255*r[2]|0;m[s+3]=255}g.putImageData(i,0,0);return f},generateDataTexture:function(a,b,c){for(var d=a*b,e=new Uint8Array(3*d),f=Math.floor(255*c.r),g=Math.floor(255*c.g),c=Math.floor(255*c.b),h=0;h<d;h++)e[3*h]=f,e[3*h+1]=g,e[3*h+2]=c;a=new THREE.DataTexture(e,a,b,THREE.RGBFormat);a.needsUpdate=!0;return a}};
+b){var c=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]},b=b|1,d=a.width,e=a.height,f=document.createElement("canvas");f.width=d;f.height=e;var g=f.getContext("2d");g.drawImage(a,0,0);for(var h=g.getImageData(0,0,d,e).data,l=g.createImageData(d,e),j=l.data,k=0;k<d;k++)for(var p=1;p<e;p++){var m=0>p-1?e-1:p-1,o=(p+1)%e,r=0>k-1?d-1:k-1,n=(k+1)%d,q=[],s=[0,0,h[4*(p*d+k)]/255*b];q.push([-1,0,h[4*(p*d+r)]/255*b]);q.push([-1,-1,h[4*(m*d+r)]/255*b]);q.push([0,-1,
+h[4*(m*d+k)]/255*b]);q.push([1,-1,h[4*(m*d+n)]/255*b]);q.push([1,0,h[4*(p*d+n)]/255*b]);q.push([1,1,h[4*(o*d+n)]/255*b]);q.push([0,1,h[4*(o*d+k)]/255*b]);q.push([-1,1,h[4*(o*d+r)]/255*b]);m=[];r=q.length;for(o=0;o<r;o++){var n=q[o],u=q[(o+1)%r],n=[n[0]-s[0],n[1]-s[1],n[2]-s[2]],u=[u[0]-s[0],u[1]-s[1],u[2]-s[2]];m.push(c([n[1]*u[2]-n[2]*u[1],n[2]*u[0]-n[0]*u[2],n[0]*u[1]-n[1]*u[0]]))}q=[0,0,0];for(o=0;o<m.length;o++)q[0]+=m[o][0],q[1]+=m[o][1],q[2]+=m[o][2];q[0]/=m.length;q[1]/=m.length;q[2]/=m.length;
+s=4*(p*d+k);j[s]=255*((q[0]+1)/2)|0;j[s+1]=255*(q[1]+0.5)|0;j[s+2]=255*q[2]|0;j[s+3]=255}g.putImageData(l,0,0);return f},generateDataTexture:function(a,b,c){for(var d=a*b,e=new Uint8Array(3*d),f=Math.floor(255*c.r),g=Math.floor(255*c.g),c=Math.floor(255*c.b),h=0;h<d;h++)e[3*h]=f,e[3*h+1]=g,e[3*h+2]=c;a=new THREE.DataTexture(e,a,b,THREE.RGBFormat);a.needsUpdate=!0;return a}};
 THREE.SceneUtils={showHierarchy:function(a,b){THREE.SceneUtils.traverseHierarchy(a,function(a){a.visible=b})},traverseHierarchy:function(a,b){var c,d,e=a.children.length;for(d=0;d<e;d++)c=a.children[d],b(c),THREE.SceneUtils.traverseHierarchy(c,b)},createMultiMaterialObject:function(a,b){var c,d=b.length,e=new THREE.Object3D;for(c=0;c<d;c++){var f=new THREE.Mesh(a,b[c]);e.add(f)}return e},cloneObject:function(a){var b;a instanceof THREE.MorphAnimMesh?(b=new THREE.MorphAnimMesh(a.geometry,a.material),
 b.duration=a.duration,b.mirroredLoop=a.mirroredLoop,b.time=a.time,b.lastKeyframe=a.lastKeyframe,b.currentKeyframe=a.currentKeyframe,b.direction=a.direction,b.directionBackwards=a.directionBackwards):a instanceof THREE.SkinnedMesh?b=new THREE.SkinnedMesh(a.geometry,a.material):a instanceof THREE.Mesh?b=new THREE.Mesh(a.geometry,a.material):a instanceof THREE.Line?b=new THREE.Line(a.geometry,a.material,a.type):a instanceof THREE.Ribbon?b=new THREE.Ribbon(a.geometry,a.material):a instanceof THREE.ParticleSystem?
 (b=new THREE.ParticleSystem(a.geometry,a.material),b.sortParticles=a.sortParticles):a instanceof THREE.Particle?b=new THREE.Particle(a.material):a instanceof THREE.Sprite?(b=new THREE.Sprite({}),b.color.copy(a.color),b.map=a.map,b.blending=a.blending,b.useScreenCoordinates=a.useScreenCoordinates,b.mergeWith3D=a.mergeWith3D,b.affectedByDistance=a.affectedByDistance,b.scaleByViewport=a.scaleByViewport,b.alignment=a.alignment,b.rotation3d.copy(a.rotation3d),b.rotation=a.rotation,b.opacity=a.opacity,
@@ -418,7 +422,7 @@ THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n")},cube:{uniforms:{tCube:{type:
 THREE.BufferGeometry=function(){this.id=THREE.GeometryCount++;this.vertexColorArray=this.vertexUvArray=this.vertexNormalArray=this.vertexPositionArray=this.vertexIndexArray=this.vertexColorBuffer=this.vertexUvBuffer=this.vertexNormalBuffer=this.vertexPositionBuffer=this.vertexIndexBuffer=null;this.dynamic=!1;this.boundingSphere=this.boundingBox=null;this.morphTargets=[]};THREE.BufferGeometry.prototype={constructor:THREE.BufferGeometry,computeBoundingBox:function(){},computeBoundingSphere:function(){}};
 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=this.__arcLengthDivisions?this.__arcLengthDivisions:200);if(this.cacheArcLengths&&this.cacheArcLengths.length==a+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var b=[],c,d=this.getPoint(0),e,f=0;b.push(0);for(e=1;e<=a;e++)c=this.getPoint(e/a),f+=c.distanceTo(d),b.push(f),d=c;return this.cacheArcLengths=b};
-THREE.Curve.prototype.updateArcLengths=function(){this.needsUpdate=!0;this.getLengths()};THREE.Curve.prototype.getUtoTmapping=function(a,b){var c=this.getLengths(),d=0,e=c.length,f;f=b?b:a*c[e-1];for(var g=0,h=e-1,i;g<=h;)if(d=Math.floor(g+(h-g)/2),i=c[d]-f,0>i)g=d+1;else if(0<i)h=d-1;else{h=d;break}d=h;if(c[d]==f)return d/(e-1);g=c[d];return c=(d+(f-g)/(c[d+1]-g))/(e-1)};THREE.Curve.prototype.getNormalVector=function(a){a=this.getTangent(a);return new THREE.Vector2(-a.y,a.x)};
+THREE.Curve.prototype.updateArcLengths=function(){this.needsUpdate=!0;this.getLengths()};THREE.Curve.prototype.getUtoTmapping=function(a,b){var c=this.getLengths(),d=0,e=c.length,f;f=b?b:a*c[e-1];for(var g=0,h=e-1,l;g<=h;)if(d=Math.floor(g+(h-g)/2),l=c[d]-f,0>l)g=d+1;else if(0<l)h=d-1;else{h=d;break}d=h;if(c[d]==f)return d/(e-1);g=c[d];return c=(d+(f-g)/(c[d+1]-g))/(e-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=a+1.0E-4;0>b&&(b=0);1<a&&(a=1);b=this.getPoint(b);return this.getPoint(a).clone().subSelf(b).normalize()};THREE.Curve.prototype.getTangentAt=function(a){return this.getTangent(this.getUtoTmapping(a))};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,d){this.constructor(new THREE.Vector2(a,b),new THREE.Vector2(c,d))};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 d=Array.prototype.slice.call(arguments),a=new THREE.Vector2(d[0],d[1]),b=new THREE.Vector2(d[2],d[3]),c=new THREE.Vector2(d[4],d[5]);this.v0=a;this.v1=b;this.v2=c};THREE.QuadraticBezierCurve.prototype=new THREE.Curve;THREE.QuadraticBezierCurve.prototype.constructor=THREE.QuadraticBezierCurve;
@@ -437,10 +441,10 @@ THREE.ClosedSplineCurve3=THREE.Curve.create(function(a){this.points=void 0==a?[]
 d[c[1]].z,d[c[2]].z,d[c[3]].z,e);return b});THREE.CurvePath=function(){this.curves=[];this.bends=[];this.autoClose=!1};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(){var a=this.curves[0].getPoint(0),b=this.curves[this.curves.length-1].getPoint(1);a.equals(b)||this.curves.push(new THREE.LineCurve(b,a))};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,d=this.curves.length;for(c=0;c<d;c++)b+=this.curves[c].getLength(),a.push(b);return this.cacheLengths=a};
-THREE.CurvePath.prototype.getBoundingBox=function(){var a=this.getPoints(),b,c,d,e;b=c=Number.NEGATIVE_INFINITY;d=e=Number.POSITIVE_INFINITY;var f,g,h,i;i=new THREE.Vector2;for(g=0,h=a.length;g<h;g++){f=a[g];if(f.x>b)b=f.x;else if(f.x<d)d=f.x;if(f.y>c)c=f.y;else if(f.y<c)e=f.y;i.addSelf(f.x,f.y)}return{minX:d,minY:e,maxX:b,maxY:c,centroid:i.divideScalar(h)}};THREE.CurvePath.prototype.createPointsGeometry=function(a){return this.createGeometry(this.getPoints(a,!0))};
+THREE.CurvePath.prototype.getBoundingBox=function(){var a=this.getPoints(),b,c,d,e;b=c=Number.NEGATIVE_INFINITY;d=e=Number.POSITIVE_INFINITY;var f,g,h,l;l=new THREE.Vector2;for(g=0,h=a.length;g<h;g++){f=a[g];if(f.x>b)b=f.x;else if(f.x<d)d=f.x;if(f.y>c)c=f.y;else if(f.y<c)e=f.y;l.addSelf(f.x,f.y)}return{minX:d,minY:e,maxX:b,maxY:c,centroid:l.divideScalar(h)}};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),d,e;if(!b)b=this.bends;for(d=0,e=b.length;d<e;d++)c=this.getWrapPoints(c,b[d]);return c};THREE.CurvePath.prototype.getTransformedSpacedPoints=function(a,b){var c=this.getSpacedPoints(a),d,e;if(!b)b=this.bends;for(d=0,e=b.length;d<e;d++)c=this.getWrapPoints(c,b[d]);return c};
-THREE.CurvePath.prototype.getWrapPoints=function(a,b){var c=this.getBoundingBox(),d,e,f,g,h,i;for(d=0,e=a.length;d<e;d++)f=a[d],g=f.x,h=f.y,i=g/c.maxX,i=b.getUtoTmapping(i,g),g=b.getPoint(i),h=b.getNormalVector(i).multiplyScalar(h),f.x=g.x+h.x,f.y=g.y+h.y;return a};
+THREE.CurvePath.prototype.getWrapPoints=function(a,b){var c=this.getBoundingBox(),d,e,f,g,h,l;for(d=0,e=a.length;d<e;d++)f=a[d],g=f.x,h=f.y,l=g/c.maxX,l=b.getUtoTmapping(l,g),g=b.getPoint(l),h=b.getNormalVector(l).multiplyScalar(h),f.x=g.x+h.x,f.y=g.y+h.y;return a};
 THREE.EventTarget=function(){var a={};this.addEventListener=function(b,c){void 0==a[b]&&(a[b]=[]);-1===a[b].indexOf(c)&&a[b].push(c)};this.dispatchEvent=function(b){for(var c in a[b.type])a[b.type][c](b)};this.removeEventListener=function(b,c){var d=a[b].indexOf(c);-1!==d&&a[b].splice(d,1)}};THREE.Gyroscope=function(){THREE.Object3D.call(this)};THREE.Gyroscope.prototype=new THREE.Object3D;THREE.Gyroscope.prototype.constructor=THREE.Gyroscope;
 THREE.Gyroscope.prototype.updateMatrixWorld=function(a){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||a)this.parent?(this.matrixWorld.multiply(this.parent.matrixWorld,this.matrix),this.matrixWorld.decompose(this.translationWorld,this.rotationWorld,this.scaleWorld),this.matrix.decompose(this.translationObject,this.rotationObject,this.scaleObject),this.matrixWorld.compose(this.translationWorld,this.rotationObject,this.scaleWorld)):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.Gyroscope.prototype.translationWorld=new THREE.Vector3;THREE.Gyroscope.prototype.translationObject=new THREE.Vector3;THREE.Gyroscope.prototype.rotationWorld=new THREE.Quaternion;THREE.Gyroscope.prototype.rotationObject=new THREE.Quaternion;THREE.Gyroscope.prototype.scaleWorld=new THREE.Vector3;THREE.Gyroscope.prototype.scaleObject=new THREE.Vector3;
@@ -451,37 +455,37 @@ THREE.Path.prototype.bezierCurveTo=function(a,b,c,d,e,f){var g=Array.prototype.s
 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,d,e,f){var g=Array.prototype.slice.call(arguments),h=this.actions[this.actions.length-1],h=new THREE.ArcCurve(h.x+a,h.y+b,c,d,e,f);this.curves.push(h);h=h.getPoint(f?1:0);g.push(h.x);g.push(h.y);this.actions.push({action:THREE.PathActions.ARC,args:g})};
 THREE.Path.prototype.absarc=function(a,b,c,d,e,f){var g=Array.prototype.slice.call(arguments),h=new THREE.ArcCurve(a,b,c,d,e,f);this.curves.push(h);h=h.getPoint(f?1:0);g.push(h.x);g.push(h.y);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){if(this.useSpacedPoints)return console.log("tata"),this.getSpacedPoints(a,b);var a=a||12,c=[],d,e,f,g,h,i,m,k,p,n,o,q,l;for(d=0,e=this.actions.length;d<e;d++)switch(f=this.actions[d],g=f.action,f=f.args,g){case THREE.PathActions.MOVE_TO:c.push(new THREE.Vector2(f[0],f[1]));break;case THREE.PathActions.LINE_TO:c.push(new THREE.Vector2(f[0],f[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:h=f[2];i=f[3];p=f[0];n=f[1];0<c.length?(g=c[c.length-1],o=g.x,
-q=g.y):(g=this.actions[d-1].args,o=g[g.length-2],q=g[g.length-1]);for(f=1;f<=a;f++)l=f/a,g=THREE.Shape.Utils.b2(l,o,p,h),l=THREE.Shape.Utils.b2(l,q,n,i),c.push(new THREE.Vector2(g,l));break;case THREE.PathActions.BEZIER_CURVE_TO:h=f[4];i=f[5];p=f[0];n=f[1];m=f[2];k=f[3];0<c.length?(g=c[c.length-1],o=g.x,q=g.y):(g=this.actions[d-1].args,o=g[g.length-2],q=g[g.length-1]);for(f=1;f<=a;f++)l=f/a,g=THREE.Shape.Utils.b3(l,o,p,m,h),l=THREE.Shape.Utils.b3(l,q,n,k,i),c.push(new THREE.Vector2(g,l));break;case THREE.PathActions.CSPLINE_THRU:g=
-this.actions[d-1].args;l=[new THREE.Vector2(g[g.length-2],g[g.length-1])];g=a*f[0].length;l=l.concat(f[0]);l=new THREE.SplineCurve(l);for(f=1;f<=g;f++)c.push(l.getPointAt(f/g));break;case THREE.PathActions.ARC:h=f[0];i=f[1];m=f[2];p=f[3];n=!!f[5];k=f[4]-p;o=2*a;for(f=1;f<=o;f++)l=f/o,n||(l=1-l),l=p+l*k,g=h+m*Math.cos(l),l=i+m*Math.sin(l),c.push(new THREE.Vector2(g,l))}d=c[c.length-1];1.0E-10>Math.abs(d.x-c[0].x)&&1.0E-10>Math.abs(d.y-c[0].y)&&c.splice(c.length-1,1);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,d,e,f){var g=this.getPoints(),h,i,m,k,p;for(h=0,i=g.length;h<i;h++)m=g[h],k=m.x,p=m.y,m.x=a*k+b*p+c,m.y=d*p+e*k+f;return g};
+THREE.Path.prototype.getPoints=function(a,b){if(this.useSpacedPoints)return console.log("tata"),this.getSpacedPoints(a,b);var a=a||12,c=[],d,e,f,g,h,l,j,k,p,m,o,r,n;for(d=0,e=this.actions.length;d<e;d++)switch(f=this.actions[d],g=f.action,f=f.args,g){case THREE.PathActions.MOVE_TO:c.push(new THREE.Vector2(f[0],f[1]));break;case THREE.PathActions.LINE_TO:c.push(new THREE.Vector2(f[0],f[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:h=f[2];l=f[3];p=f[0];m=f[1];0<c.length?(g=c[c.length-1],o=g.x,
+r=g.y):(g=this.actions[d-1].args,o=g[g.length-2],r=g[g.length-1]);for(f=1;f<=a;f++)n=f/a,g=THREE.Shape.Utils.b2(n,o,p,h),n=THREE.Shape.Utils.b2(n,r,m,l),c.push(new THREE.Vector2(g,n));break;case THREE.PathActions.BEZIER_CURVE_TO:h=f[4];l=f[5];p=f[0];m=f[1];j=f[2];k=f[3];0<c.length?(g=c[c.length-1],o=g.x,r=g.y):(g=this.actions[d-1].args,o=g[g.length-2],r=g[g.length-1]);for(f=1;f<=a;f++)n=f/a,g=THREE.Shape.Utils.b3(n,o,p,j,h),n=THREE.Shape.Utils.b3(n,r,m,k,l),c.push(new THREE.Vector2(g,n));break;case THREE.PathActions.CSPLINE_THRU:g=
+this.actions[d-1].args;n=[new THREE.Vector2(g[g.length-2],g[g.length-1])];g=a*f[0].length;n=n.concat(f[0]);n=new THREE.SplineCurve(n);for(f=1;f<=g;f++)c.push(n.getPointAt(f/g));break;case THREE.PathActions.ARC:h=f[0];l=f[1];j=f[2];p=f[3];m=!!f[5];k=f[4]-p;o=2*a;for(f=1;f<=o;f++)n=f/o,m||(n=1-n),n=p+n*k,g=h+j*Math.cos(n),n=l+j*Math.sin(n),c.push(new THREE.Vector2(g,n))}d=c[c.length-1];1.0E-10>Math.abs(d.x-c[0].x)&&1.0E-10>Math.abs(d.y-c[0].y)&&c.splice(c.length-1,1);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,d,e,f){var g=this.getPoints(),h,l,j,k,p;for(h=0,l=g.length;h<l;h++)j=g[h],k=j.x,p=j.y,j.x=a*k+b*p+c,j.y=d*p+e*k+f;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,d,e;for(a=0,c=this.actions.length;a<c;a++)d=this.actions[a],e=d.args,d=d.action,d!=THREE.PathActions.CSPLINE_THRU&&b[d].apply(b,e);b.stroke();b.closePath();b.strokeStyle="red";d=
 this.getPoints();for(a=0,c=d.length;a<c;a++)e=d[a],b.beginPath(),b.arc(e.x,e.y,1.5,0,2*Math.PI,!1),b.stroke(),b.closePath()};
 THREE.Path.prototype.toShapes=function(){var a,b,c,d,e=[],f=new THREE.Path;for(a=0,b=this.actions.length;a<b;a++)c=this.actions[a],d=c.args,c=c.action,c==THREE.PathActions.MOVE_TO&&0!=f.actions.length&&(e.push(f),f=new THREE.Path),f[c].apply(f,d);0!=f.actions.length&&e.push(f);if(0==e.length)return[];var g;d=[];a=!THREE.Shape.Utils.isClockWise(e[0].getPoints());if(1==e.length)return f=e[0],g=new THREE.Shape,g.actions=f.actions,g.curves=f.curves,d.push(g),d;if(a){g=new THREE.Shape;for(a=0,b=e.length;a<
 b;a++)f=e[a],THREE.Shape.Utils.isClockWise(f.getPoints())?(g.actions=f.actions,g.curves=f.curves,d.push(g),g=new THREE.Shape):g.holes.push(f)}else{for(a=0,b=e.length;a<b;a++)f=e[a],THREE.Shape.Utils.isClockWise(f.getPoints())?(g&&d.push(g),g=new THREE.Shape,g.actions=f.actions,g.curves=f.curves):g.holes.push(f);d.push(g)}return d};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,d=[];for(b=0;b<c;b++)d[b]=this.holes[b].getTransformedPoints(a,this.bends);return d};THREE.Shape.prototype.getSpacedPointsHoles=function(a){var b,c=this.holes.length,d=[];for(b=0;b<c;b++)d[b]=this.holes[b].getTransformedSpacedPoints(a,this.bends);return d};
 THREE.Shape.prototype.extractAllPoints=function(a){return{shape:this.getTransformedPoints(a),holes:this.getPointsHoles(a)}};THREE.Shape.prototype.extractPoints=function(a){return this.useSpacedPoints?this.extractAllSpacedPoints(a):this.extractAllPoints(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(),d=c.concat(),e,f,g,h,i,m,k,p,n,o,q=[];for(i=0;i<b.length;i++){m=b[i];Array.prototype.push.apply(d,m);f=Number.POSITIVE_INFINITY;for(e=0;e<m.length;e++){n=m[e];o=[];for(p=0;p<c.length;p++)k=c[p],k=n.distanceToSquared(k),o.push(k),k<f&&(f=k,g=e,h=p)}e=0<=h-1?h-1:c.length-1;f=0<=g-1?g-1:m.length-1;var l=[m[g],c[h],c[e]];p=THREE.FontUtils.Triangulate.area(l);var r=[m[g],m[f],c[h]];n=THREE.FontUtils.Triangulate.area(r);o=h;k=g;h+=1;g+=-1;0>
-h&&(h+=c.length);h%=c.length;0>g&&(g+=m.length);g%=m.length;e=0<=h-1?h-1:c.length-1;f=0<=g-1?g-1:m.length-1;l=[m[g],c[h],c[e]];l=THREE.FontUtils.Triangulate.area(l);r=[m[g],m[f],c[h]];r=THREE.FontUtils.Triangulate.area(r);p+n>l+r&&(h=o,g=k,0>h&&(h+=c.length),h%=c.length,0>g&&(g+=m.length),g%=m.length,e=0<=h-1?h-1:c.length-1,f=0<=g-1?g-1:m.length-1);p=c.slice(0,h);n=c.slice(h);o=m.slice(g);k=m.slice(0,g);f=[m[g],m[f],c[h]];q.push([m[g],c[h],c[e]]);q.push(f);c=p.concat(o).concat(k).concat(n)}return{shape:c,
-isolatedPts:q,allpoints:d}},triangulateShape:function(a,b){var c=THREE.Shape.Utils.removeHoles(a,b),d=c.allpoints,e=c.isolatedPts,c=THREE.FontUtils.Triangulate(c.shape,!1),f,g,h,i,m={};for(f=0,g=d.length;f<g;f++)i=d[f].x+":"+d[f].y,void 0!==m[i]&&console.log("Duplicate point",i),m[i]=f;for(f=0,g=c.length;f<g;f++){h=c[f];for(d=0;3>d;d++)i=h[d].x+":"+h[d].y,i=m[i],void 0!==i&&(h[d]=i)}for(f=0,g=e.length;f<g;f++){h=e[f];for(d=0;3>d;d++)i=h[d].x+":"+h[d].y,i=m[i],void 0!==i&&(h[d]=i)}return c.concat(e)},
+THREE.Shape.Utils={removeHoles:function(a,b){var c=a.concat(),d=c.concat(),e,f,g,h,l,j,k,p,m,o,r=[];for(l=0;l<b.length;l++){j=b[l];Array.prototype.push.apply(d,j);f=Number.POSITIVE_INFINITY;for(e=0;e<j.length;e++){m=j[e];o=[];for(p=0;p<c.length;p++)k=c[p],k=m.distanceToSquared(k),o.push(k),k<f&&(f=k,g=e,h=p)}e=0<=h-1?h-1:c.length-1;f=0<=g-1?g-1:j.length-1;var n=[j[g],c[h],c[e]];p=THREE.FontUtils.Triangulate.area(n);var q=[j[g],j[f],c[h]];m=THREE.FontUtils.Triangulate.area(q);o=h;k=g;h+=1;g+=-1;0>
+h&&(h+=c.length);h%=c.length;0>g&&(g+=j.length);g%=j.length;e=0<=h-1?h-1:c.length-1;f=0<=g-1?g-1:j.length-1;n=[j[g],c[h],c[e]];n=THREE.FontUtils.Triangulate.area(n);q=[j[g],j[f],c[h]];q=THREE.FontUtils.Triangulate.area(q);p+m>n+q&&(h=o,g=k,0>h&&(h+=c.length),h%=c.length,0>g&&(g+=j.length),g%=j.length,e=0<=h-1?h-1:c.length-1,f=0<=g-1?g-1:j.length-1);p=c.slice(0,h);m=c.slice(h);o=j.slice(g);k=j.slice(0,g);f=[j[g],j[f],c[h]];r.push([j[g],c[h],c[e]]);r.push(f);c=p.concat(o).concat(k).concat(m)}return{shape:c,
+isolatedPts:r,allpoints:d}},triangulateShape:function(a,b){var c=THREE.Shape.Utils.removeHoles(a,b),d=c.allpoints,e=c.isolatedPts,c=THREE.FontUtils.Triangulate(c.shape,!1),f,g,h,l,j={};for(f=0,g=d.length;f<g;f++)l=d[f].x+":"+d[f].y,void 0!==j[l]&&console.log("Duplicate point",l),j[l]=f;for(f=0,g=c.length;f<g;f++){h=c[f];for(d=0;3>d;d++)l=h[d].x+":"+h[d].y,l=j[l],void 0!==l&&(h[d]=l)}for(f=0,g=e.length;f<g;f++){h=e[f];for(d=0;3>d;d++)l=h[d].x+":"+h[d].y,l=j[l],void 0!==l&&(h[d]=l)}return c.concat(e)},
 isClockWise:function(a){return 0>THREE.FontUtils.Triangulate.area(a)},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,d){return this.b2p0(a,b)+this.b2p1(a,c)+this.b2p2(a,d)},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,d,e){return this.b3p0(a,b)+this.b3p1(a,c)+this.b3p2(a,d)+
 this.b3p3(a,e)}};THREE.TextPath=function(a,b){THREE.Path.call(this);this.parameters=b||{};this.set(a)};THREE.TextPath.prototype.set=function(a,b){b=b||this.parameters;this.text=a;var c=void 0!==b.curveSegments?b.curveSegments:4,d=void 0!==b.font?b.font:"helvetiker",e=void 0!==b.weight?b.weight:"normal",f=void 0!==b.style?b.style:"normal";THREE.FontUtils.size=void 0!==b.size?b.size:100;THREE.FontUtils.divisions=c;THREE.FontUtils.face=d;THREE.FontUtils.weight=e;THREE.FontUtils.style=f};
 THREE.TextPath.prototype.toShapes=function(){for(var a=THREE.FontUtils.drawText(this.text).paths,b=[],c=0,d=a.length;c<d;c++)Array.prototype.push.apply(b,a[c].toShapes());return b};
 THREE.AnimationHandler=function(){var a=[],b={},c={update:function(b){for(var c=0;c<a.length;c++)a[c].update(b)},addToUpdate:function(b){-1===a.indexOf(b)&&a.push(b)},removeFromUpdate:function(b){b=a.indexOf(b);-1!==b&&a.splice(b,1)},add:function(a){void 0!==b[a.name]&&console.log("THREE.AnimationHandler.add: Warning! "+a.name+" already exists in library. Overwriting.");b[a.name]=a;if(!0!==a.initialized){for(var c=0;c<a.hierarchy.length;c++){for(var d=0;d<a.hierarchy[c].keys.length;d++){if(0>a.hierarchy[c].keys[d].time)a.hierarchy[c].keys[d].time=
-0;if(void 0!==a.hierarchy[c].keys[d].rot&&!(a.hierarchy[c].keys[d].rot instanceof THREE.Quaternion)){var h=a.hierarchy[c].keys[d].rot;a.hierarchy[c].keys[d].rot=new THREE.Quaternion(h[0],h[1],h[2],h[3])}}if(a.hierarchy[c].keys.length&&void 0!==a.hierarchy[c].keys[0].morphTargets){h={};for(d=0;d<a.hierarchy[c].keys.length;d++)for(var i=0;i<a.hierarchy[c].keys[d].morphTargets.length;i++){var m=a.hierarchy[c].keys[d].morphTargets[i];h[m]=-1}a.hierarchy[c].usedMorphTargets=h;for(d=0;d<a.hierarchy[c].keys.length;d++){var k=
-{};for(m in h){for(i=0;i<a.hierarchy[c].keys[d].morphTargets.length;i++)if(a.hierarchy[c].keys[d].morphTargets[i]===m){k[m]=a.hierarchy[c].keys[d].morphTargetsInfluences[i];break}i===a.hierarchy[c].keys[d].morphTargets.length&&(k[m]=0)}a.hierarchy[c].keys[d].morphTargetsInfluences=k}}for(d=1;d<a.hierarchy[c].keys.length;d++)a.hierarchy[c].keys[d].time===a.hierarchy[c].keys[d-1].time&&(a.hierarchy[c].keys.splice(d,1),d--);for(d=0;d<a.hierarchy[c].keys.length;d++)a.hierarchy[c].keys[d].index=d}d=parseInt(a.length*
+0;if(void 0!==a.hierarchy[c].keys[d].rot&&!(a.hierarchy[c].keys[d].rot instanceof THREE.Quaternion)){var h=a.hierarchy[c].keys[d].rot;a.hierarchy[c].keys[d].rot=new THREE.Quaternion(h[0],h[1],h[2],h[3])}}if(a.hierarchy[c].keys.length&&void 0!==a.hierarchy[c].keys[0].morphTargets){h={};for(d=0;d<a.hierarchy[c].keys.length;d++)for(var l=0;l<a.hierarchy[c].keys[d].morphTargets.length;l++){var j=a.hierarchy[c].keys[d].morphTargets[l];h[j]=-1}a.hierarchy[c].usedMorphTargets=h;for(d=0;d<a.hierarchy[c].keys.length;d++){var k=
+{};for(j in h){for(l=0;l<a.hierarchy[c].keys[d].morphTargets.length;l++)if(a.hierarchy[c].keys[d].morphTargets[l]===j){k[j]=a.hierarchy[c].keys[d].morphTargetsInfluences[l];break}l===a.hierarchy[c].keys[d].morphTargets.length&&(k[j]=0)}a.hierarchy[c].keys[d].morphTargetsInfluences=k}}for(d=1;d<a.hierarchy[c].keys.length;d++)a.hierarchy[c].keys[d].time===a.hierarchy[c].keys[d-1].time&&(a.hierarchy[c].keys.splice(d,1),d--);for(d=0;d<a.hierarchy[c].keys.length;d++)a.hierarchy[c].keys[d].index=d}d=parseInt(a.length*
 a.fps,10);a.JIT={};a.JIT.hierarchy=[];for(c=0;c<a.hierarchy.length;c++)a.JIT.hierarchy.push(Array(d));a.initialized=!0}},get:function(a){if("string"===typeof a){if(b[a])return b[a];console.log("THREE.AnimationHandler.get: Couldn't find animation "+a);return 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 d(a,b);return b}},d=function(a,b){b.push(a);for(var c=0;c<a.children.length;c++)d(a.children[c],b)};c.LINEAR=0;c.CATMULLROM=
 1;c.CATMULLROM_FORWARD=2;return c}();THREE.Animation=function(a,b,c,d){this.root=a;this.data=THREE.AnimationHandler.get(b);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.loop=this.isPaused=!0;this.interpolationType=void 0!==c?c:THREE.AnimationHandler.LINEAR;this.JITCompile=void 0!==d?d:!0;this.points=[];this.target=new THREE.Vector3};
 THREE.Animation.prototype.play=function(a,b){if(!this.isPlaying){this.isPlaying=!0;this.loop=void 0!==a?a:!0;this.currentTime=void 0!==b?b:0;var c,d=this.hierarchy.length,e;for(c=0;c<d;c++){e=this.hierarchy[c];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)e.useQuaternion=!0;e.matrixAutoUpdate=!0;if(void 0===e.animationCache)e.animationCache={},e.animationCache.prevKey={pos:0,rot:0,scl:0},e.animationCache.nextKey={pos:0,rot:0,scl:0},e.animationCache.originalMatrix=e instanceof
 THREE.Bone?e.skinMatrix:e.matrix;var f=e.animationCache.prevKey;e=e.animationCache.nextKey;f.pos=this.data.hierarchy[c].keys[0];f.rot=this.data.hierarchy[c].keys[0];f.scl=this.data.hierarchy[c].keys[0];e.pos=this.getNextKeyWith("pos",c,1);e.rot=this.getNextKeyWith("rot",c,1);e.scl=this.getNextKeyWith("scl",c,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
 THREE.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
 THREE.Animation.prototype.stop=function(){this.isPaused=this.isPlaying=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.hierarchy.length;a++)if(void 0!==this.hierarchy[a].animationCache)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,d,e,f,g,h,i,m,k=this.data.JIT.hierarchy,p,n;n=this.currentTime+=a*this.timeScale;p=this.currentTime%=this.data.length;m=parseInt(Math.min(p*this.data.fps,this.data.length*this.data.fps),10);for(var o=0,q=this.hierarchy.length;o<q;o++)if(a=this.hierarchy[o],i=a.animationCache,this.JITCompile&&void 0!==k[o][m])a instanceof THREE.Bone?(a.skinMatrix=k[o][m],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=!1):(a.matrix=
-k[o][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 l=0;3>l;l++){c=b[l];g=i.prevKey[c];h=i.nextKey[c];if(h.time<=n){if(p<n)if(this.loop){g=this.data.hierarchy[o].keys[0];for(h=this.getNextKeyWith(c,o,1);h.time<p;)g=h,h=this.getNextKeyWith(c,o,h.index+1)}else{this.stop();return}else{do g=h,h=this.getNextKeyWith(c,o,h.index+1);while(h.time<p)}i.prevKey[c]=
-g;i.nextKey[c]=h}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;d=(p-g.time)/(h.time-g.time);e=g[c];f=h[c];if(0>d||1<d)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+d+" on bone "+o),d=0>d?0:1;if("pos"===c)if(c=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)c.x=e[0]+(f[0]-e[0])*d,c.y=e[1]+(f[1]-e[1])*d,c.z=e[2]+(f[2]-e[2])*d;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
+THREE.Animation.prototype.update=function(a){if(this.isPlaying){var b=["pos","rot","scl"],c,d,e,f,g,h,l,j,k=this.data.JIT.hierarchy,p,m;m=this.currentTime+=a*this.timeScale;p=this.currentTime%=this.data.length;j=parseInt(Math.min(p*this.data.fps,this.data.length*this.data.fps),10);for(var o=0,r=this.hierarchy.length;o<r;o++)if(a=this.hierarchy[o],l=a.animationCache,this.JITCompile&&void 0!==k[o][j])a instanceof THREE.Bone?(a.skinMatrix=k[o][j],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=!1):(a.matrix=
+k[o][j],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 n=0;3>n;n++){c=b[n];g=l.prevKey[c];h=l.nextKey[c];if(h.time<=m){if(p<m)if(this.loop){g=this.data.hierarchy[o].keys[0];for(h=this.getNextKeyWith(c,o,1);h.time<p;)g=h,h=this.getNextKeyWith(c,o,h.index+1)}else{this.stop();return}else{do g=h,h=this.getNextKeyWith(c,o,h.index+1);while(h.time<p)}l.prevKey[c]=
+g;l.nextKey[c]=h}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;d=(p-g.time)/(h.time-g.time);e=g[c];f=h[c];if(0>d||1<d)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+d+" on bone "+o),d=0>d?0:1;if("pos"===c)if(c=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)c.x=e[0]+(f[0]-e[0])*d,c.y=e[1]+(f[1]-e[1])*d,c.z=e[2]+(f[2]-e[2])*d;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
 this.getPrevKeyWith("pos",o,g.index-1).pos,this.points[1]=e,this.points[2]=f,this.points[3]=this.getNextKeyWith("pos",o,h.index+1).pos,d=0.33*d+0.33,e=this.interpolateCatmullRom(this.points,d),c.x=e[0],c.y=e[1],c.z=e[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)d=this.interpolateCatmullRom(this.points,1.01*d),this.target.set(d[0],d[1],d[2]),this.target.subSelf(c),this.target.y=0,this.target.normalize(),d=Math.atan2(this.target.x,this.target.z),a.rotation.set(0,d,0)}else if("rot"===
-c)THREE.Quaternion.slerp(e,f,a.quaternion,d);else if("scl"===c)c=a.scale,c.x=e[0]+(f[0]-e[0])*d,c.y=e[1]+(f[1]-e[1])*d,c.z=e[2]+(f[2]-e[2])*d}}if(this.JITCompile&&void 0===k[0][m]){this.hierarchy[0].updateMatrixWorld(!0);for(o=0;o<this.hierarchy.length;o++)k[o][m]=this.hierarchy[o]instanceof THREE.Bone?this.hierarchy[o].skinMatrix.clone():this.hierarchy[o].matrix.clone()}}};
-THREE.Animation.prototype.interpolateCatmullRom=function(a,b){var c=[],d=[],e,f,g,h,i,m;e=(a.length-1)*b;f=Math.floor(e);e-=f;c[0]=0===f?f:f-1;c[1]=f;c[2]=f>a.length-2?f:f+1;c[3]=f>a.length-3?f:f+2;f=a[c[0]];h=a[c[1]];i=a[c[2]];m=a[c[3]];c=e*e;g=e*c;d[0]=this.interpolate(f[0],h[0],i[0],m[0],e,c,g);d[1]=this.interpolate(f[1],h[1],i[1],m[1],e,c,g);d[2]=this.interpolate(f[2],h[2],i[2],m[2],e,c,g);return d};
+c)THREE.Quaternion.slerp(e,f,a.quaternion,d);else if("scl"===c)c=a.scale,c.x=e[0]+(f[0]-e[0])*d,c.y=e[1]+(f[1]-e[1])*d,c.z=e[2]+(f[2]-e[2])*d}}if(this.JITCompile&&void 0===k[0][j]){this.hierarchy[0].updateMatrixWorld(!0);for(o=0;o<this.hierarchy.length;o++)k[o][j]=this.hierarchy[o]instanceof THREE.Bone?this.hierarchy[o].skinMatrix.clone():this.hierarchy[o].matrix.clone()}}};
+THREE.Animation.prototype.interpolateCatmullRom=function(a,b){var c=[],d=[],e,f,g,h,l,j;e=(a.length-1)*b;f=Math.floor(e);e-=f;c[0]=0===f?f:f-1;c[1]=f;c[2]=f>a.length-2?f:f+1;c[3]=f>a.length-3?f:f+2;f=a[c[0]];h=a[c[1]];l=a[c[2]];j=a[c[3]];c=e*e;g=e*c;d[0]=this.interpolate(f[0],h[0],l[0],j[0],e,c,g);d[1]=this.interpolate(f[1],h[1],l[1],j[1],e,c,g);d[2]=this.interpolate(f[2],h[2],l[2],j[2],e,c,g);return d};
 THREE.Animation.prototype.interpolate=function(a,b,c,d,e,f,g){a=0.5*(c-a);d=0.5*(d-b);return(2*(b-c)+a+d)*g+(-3*(b-c)-2*a-d)*f+a*e+b};THREE.Animation.prototype.getNextKeyWith=function(a,b,c){for(var d=this.data.hierarchy[b].keys,c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c<d.length-1?c:d.length-1:c%d.length;c<d.length;c++)if(void 0!==d[c][a])return d[c];return this.data.hierarchy[b].keys[0]};
 THREE.Animation.prototype.getPrevKeyWith=function(a,b,c){for(var d=this.data.hierarchy[b].keys,c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?0<c?c:0:0<=c?c:c+d.length;0<=c;c--)if(void 0!==d[c][a])return d[c];return this.data.hierarchy[b].keys[d.length-1]};
 THREE.KeyFrameAnimation=function(a,b,c){this.root=a;this.data=THREE.AnimationHandler.get(b);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=0.001;this.isPlaying=!1;this.loop=this.isPaused=!0;this.JITCompile=void 0!==c?c:!0;a=0;for(b=this.hierarchy.length;a<b;a++){var c=this.data.hierarchy[a].sids,d=this.hierarchy[a];if(this.data.hierarchy[a].keys.length&&c){for(var e=0;e<c.length;e++){var f=c[e],g=this.getNextKeyWith(f,a,0);g&&g.apply(f)}d.matrixAutoUpdate=!1;this.data.hierarchy[a].node.updateMatrix();
@@ -489,15 +493,14 @@ d.matrixWorldNeedsUpdate=!0}}};
 THREE.KeyFrameAnimation.prototype.play=function(a,b){if(!this.isPlaying){this.isPlaying=!0;this.loop=void 0!==a?a:!0;this.currentTime=void 0!==b?b:0;this.startTimeMs=b;this.startTime=1E7;this.endTime=-this.startTime;var c,d=this.hierarchy.length,e,f;for(c=0;c<d;c++){e=this.hierarchy[c];f=this.data.hierarchy[c];e.useQuaternion=!0;if(void 0===f.animationCache)f.animationCache={},f.animationCache.prevKey=null,f.animationCache.nextKey=null,f.animationCache.originalMatrix=e instanceof THREE.Bone?e.skinMatrix:
 e.matrix;e=this.data.hierarchy[c].keys;if(e.length)f.animationCache.prevKey=e[0],f.animationCache.nextKey=e[1],this.startTime=Math.min(e[0].time,this.startTime),this.endTime=Math.max(e[e.length-1].time,this.endTime)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};THREE.KeyFrameAnimation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
 THREE.KeyFrameAnimation.prototype.stop=function(){this.isPaused=this.isPlaying=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.data.hierarchy.length;a++){var b=this.hierarchy[a],c=this.data.hierarchy[a];if(void 0!==c.animationCache){var d=c.animationCache.originalMatrix;b instanceof THREE.Bone?(d.copy(b.skinMatrix),b.skinMatrix=d):(d.copy(b.matrix),b.matrix=d);delete c.animationCache}}};
-THREE.KeyFrameAnimation.prototype.update=function(a){if(this.isPlaying){var b,c,d,e,f=this.data.JIT.hierarchy,g,h,i;h=this.currentTime+=a*this.timeScale;g=this.currentTime%=this.data.length;if(g<this.startTimeMs)g=this.currentTime=this.startTimeMs+g;e=parseInt(Math.min(g*this.data.fps,this.data.length*this.data.fps),10);if((i=g<h)&&!this.loop){for(var a=0,m=this.hierarchy.length;a<m;a++){var k=this.data.hierarchy[a].keys,f=this.data.hierarchy[a].sids;d=k.length-1;e=this.hierarchy[a];if(k.length){for(k=
-0;k<f.length;k++)g=f[k],(h=this.getPrevKeyWith(g,a,d))&&h.apply(g);this.data.hierarchy[a].node.updateMatrix();e.matrixWorldNeedsUpdate=!0}}this.stop()}else if(!(g<this.startTime)){a=0;for(m=this.hierarchy.length;a<m;a++){d=this.hierarchy[a];b=this.data.hierarchy[a];var k=b.keys,p=b.animationCache;if(this.JITCompile&&void 0!==f[a][e])d instanceof THREE.Bone?(d.skinMatrix=f[a][e],d.matrixWorldNeedsUpdate=!1):(d.matrix=f[a][e],d.matrixWorldNeedsUpdate=!0);else if(k.length){if(this.JITCompile&&p)d instanceof
-THREE.Bone?d.skinMatrix=p.originalMatrix:d.matrix=p.originalMatrix;b=p.prevKey;c=p.nextKey;if(b&&c){if(c.time<=h){if(i&&this.loop){b=k[0];for(c=k[1];c.time<g;)b=c,c=k[b.index+1]}else if(!i)for(var n=k.length-1;c.time<g&&c.index!==n;)b=c,c=k[b.index+1];p.prevKey=b;p.nextKey=c}c.time>=g?b.interpolate(c,g):b.interpolate(c,c.time)}this.data.hierarchy[a].node.updateMatrix();d.matrixWorldNeedsUpdate=!0}}if(this.JITCompile&&void 0===f[0][e]){this.hierarchy[0].updateMatrixWorld(!0);for(a=0;a<this.hierarchy.length;a++)f[a][e]=
+THREE.KeyFrameAnimation.prototype.update=function(a){if(this.isPlaying){var b,c,d,e,f=this.data.JIT.hierarchy,g,h,l;h=this.currentTime+=a*this.timeScale;g=this.currentTime%=this.data.length;if(g<this.startTimeMs)g=this.currentTime=this.startTimeMs+g;e=parseInt(Math.min(g*this.data.fps,this.data.length*this.data.fps),10);if((l=g<h)&&!this.loop){for(var a=0,j=this.hierarchy.length;a<j;a++){var k=this.data.hierarchy[a].keys,f=this.data.hierarchy[a].sids;d=k.length-1;e=this.hierarchy[a];if(k.length){for(k=
+0;k<f.length;k++)g=f[k],(h=this.getPrevKeyWith(g,a,d))&&h.apply(g);this.data.hierarchy[a].node.updateMatrix();e.matrixWorldNeedsUpdate=!0}}this.stop()}else if(!(g<this.startTime)){a=0;for(j=this.hierarchy.length;a<j;a++){d=this.hierarchy[a];b=this.data.hierarchy[a];var k=b.keys,p=b.animationCache;if(this.JITCompile&&void 0!==f[a][e])d instanceof THREE.Bone?(d.skinMatrix=f[a][e],d.matrixWorldNeedsUpdate=!1):(d.matrix=f[a][e],d.matrixWorldNeedsUpdate=!0);else if(k.length){if(this.JITCompile&&p)d instanceof
+THREE.Bone?d.skinMatrix=p.originalMatrix:d.matrix=p.originalMatrix;b=p.prevKey;c=p.nextKey;if(b&&c){if(c.time<=h){if(l&&this.loop){b=k[0];for(c=k[1];c.time<g;)b=c,c=k[b.index+1]}else if(!l)for(var m=k.length-1;c.time<g&&c.index!==m;)b=c,c=k[b.index+1];p.prevKey=b;p.nextKey=c}c.time>=g?b.interpolate(c,g):b.interpolate(c,c.time)}this.data.hierarchy[a].node.updateMatrix();d.matrixWorldNeedsUpdate=!0}}if(this.JITCompile&&void 0===f[0][e]){this.hierarchy[0].updateMatrixWorld(!0);for(a=0;a<this.hierarchy.length;a++)f[a][e]=
 this.hierarchy[a]instanceof THREE.Bone?this.hierarchy[a].skinMatrix.clone():this.hierarchy[a].matrix.clone()}}}};THREE.KeyFrameAnimation.prototype.getNextKeyWith=function(a,b,c){b=this.data.hierarchy[b].keys;for(c%=b.length;c<b.length;c++)if(b[c].hasTarget(a))return b[c];return b[0]};THREE.KeyFrameAnimation.prototype.getPrevKeyWith=function(a,b,c){b=this.data.hierarchy[b].keys;for(c=0<=c?c:c+b.length;0<=c;c--)if(b[c].hasTarget(a))return b[c];return b[b.length-1]};
-THREE.CubeCamera=function(a,b,c,d){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=
-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(d,d,{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,b){var c=this.renderTarget;c.activeCubeFace=0;a.render(b,this.cameraPX,c);c.activeCubeFace=1;a.render(b,this.cameraNX,c);c.activeCubeFace=2;a.render(b,this.cameraPY,c);c.activeCubeFace=3;a.render(b,
-this.cameraNY,c);c.activeCubeFace=4;a.render(b,this.cameraPZ,c);c.activeCubeFace=5;a.render(b,this.cameraNZ,c)}};THREE.CombinedCamera=function(a,b,c,d,e,f,g){THREE.Camera.call(this);this.fov=c;this.left=-a/2;this.right=a/2;this.top=b/2;this.bottom=-b/2;this.cameraO=new THREE.OrthographicCamera(a/-2,a/2,b/2,b/-2,f,g);this.cameraP=new THREE.PerspectiveCamera(c,a/b,d,e);this.zoom=1;this.toPerspective()};THREE.CombinedCamera.prototype=new THREE.Camera;THREE.CombinedCamera.prototype.constructor=THREE.CoolCamera;
+THREE.CubeCamera=function(a,b,c){this.position=new THREE.Vector3;var d=new THREE.PerspectiveCamera(90,1,a,b),e=new THREE.PerspectiveCamera(90,1,a,b),f=new THREE.PerspectiveCamera(90,1,a,b),g=new THREE.PerspectiveCamera(90,1,a,b),h=new THREE.PerspectiveCamera(90,1,a,b),l=new THREE.PerspectiveCamera(90,1,a,b);d.position=this.position;d.up.set(0,-1,0);d.lookAt(new THREE.Vector3(1,0,0));e.position=this.position;e.up.set(0,-1,0);e.lookAt(new THREE.Vector3(-1,0,0));f.position=this.position;f.up.set(0,0,
+1);f.lookAt(new THREE.Vector3(0,1,0));g.position=this.position;g.up.set(0,0,-1);g.lookAt(new THREE.Vector3(0,-1,0));h.position=this.position;h.up.set(0,-1,0);h.lookAt(new THREE.Vector3(0,0,1));l.position=this.position;l.up.set(0,-1,0);l.lookAt(new THREE.Vector3(0,0,-1));this.renderTarget=new THREE.WebGLRenderTargetCube(c,c,{format:THREE.RGBFormat,magFilter:THREE.LinearFilter,minFilter:THREE.LinearFilter});this.updateCubeMap=function(a,b){var c=this.renderTarget,m=c.generateMipmaps;c.generateMipmaps=
+!1;c.activeCubeFace=0;a.render(b,d,c);c.activeCubeFace=1;a.render(b,e,c);c.activeCubeFace=2;a.render(b,f,c);c.activeCubeFace=3;a.render(b,g,c);c.activeCubeFace=4;a.render(b,h,c);c.generateMipmaps=m;c.activeCubeFace=5;a.render(b,l,c)}};
+THREE.CombinedCamera=function(a,b,c,d,e,f,g){THREE.Camera.call(this);this.fov=c;this.left=-a/2;this.right=a/2;this.top=b/2;this.bottom=-b/2;this.cameraO=new THREE.OrthographicCamera(a/-2,a/2,b/2,b/-2,f,g);this.cameraP=new THREE.PerspectiveCamera(c,a/b,d,e);this.zoom=1;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.cameraP.fov=this.fov/this.zoom;this.cameraP.updateProjectionMatrix();this.projectionMatrix=this.cameraP.projectionMatrix;this.inPersepectiveMode=!0;this.inOrthographicMode=!1};
 THREE.CombinedCamera.prototype.toOrthographic=function(){var a=this.cameraP.aspect,b=(this.cameraP.near+this.cameraP.far)/2,b=Math.tan(this.fov/2)*b,a=2*b*a/2,b=b/this.zoom,a=a/this.zoom;this.cameraO.left=-a;this.cameraO.right=a;this.cameraO.top=b;this.cameraO.bottom=-b;this.cameraO.updateProjectionMatrix();this.near=this.cameraO.near;this.far=this.cameraO.far;this.projectionMatrix=this.cameraO.projectionMatrix;this.inPersepectiveMode=!1;this.inOrthographicMode=!0};
 THREE.CombinedCamera.prototype.setFov=function(a){this.fov=a;this.inPersepectiveMode?this.toPerspective():this.toOrthographic()};THREE.CombinedCamera.prototype.setLens=function(a,b){var c=2*Math.atan((void 0!==b?b:24)/(2*a))*(180/Math.PI);this.setFov(c);return c};THREE.CombinedCamera.prototype.setZoom=function(a){this.zoom=a;this.inPersepectiveMode?this.toPerspective():this.toOrthographic()};
@@ -511,7 +514,7 @@ function(a){switch(a.keyCode){case 38:case 87:this.moveForward=!0;break;case 37:
 this.moveUp&&this.object.translateY(b);this.moveDown&&this.object.translateY(-b);a*=this.lookSpeed;this.activeLook||(a=0);this.lon+=this.mouseX*a;this.lookVertical&&(this.lat-=this.mouseY*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;var b=this.target,c=this.object.position;b.x=c.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=c.y+100*Math.cos(this.phi);b.z=c.z+100*Math.sin(this.phi)*Math.sin(this.theta);b=1;this.constrainVertical&&
 (b=Math.PI/(this.verticalMax-this.verticalMin));this.lon+=this.mouseX*a;this.lookVertical&&(this.lat-=this.mouseY*a*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;if(this.constrainVertical)this.phi=THREE.Math.mapLinear(this.phi,0,Math.PI,this.verticalMin,this.verticalMax);b=this.target;c=this.object.position;b.x=c.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=c.y+100*Math.cos(this.phi);b.z=c.z+100*Math.sin(this.phi)*Math.sin(this.theta);
 this.object.lookAt(b)}};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){return 1>(a*=2)?0.5*a*a:-0.5*(--a*(a-2)-1)}function d(a,b){return function(){b.apply(a,arguments)}}function e(a,b,c,d){var e={name:c,fps:0.6,length:d,hierarchy:[]},f,g=b.getControlPointsArray(),h=b.getLength(),r=g.length,s=0;f=r-1;b={parent:-1,keys:[]};b.keys[0]={time:0,pos:g[0],rot:[0,0,0,1],scl:[1,1,1]};b.keys[f]={time:d,pos:g[f],rot:[0,0,0,1],scl:[1,1,1]};for(f=1;f<r-1;f++)s=d*h.chunks[f]/h.total,b.keys[f]={time:s,pos:g[f]};e.hierarchy[0]=b;THREE.AnimationHandler.add(e);
+THREE.PathControls=function(a,b){function c(a){return 1>(a*=2)?0.5*a*a:-0.5*(--a*(a-2)-1)}function d(a,b){return function(){b.apply(a,arguments)}}function e(a,b,c,d){var e={name:c,fps:0.6,length:d,hierarchy:[]},f,g=b.getControlPointsArray(),h=b.getLength(),q=g.length,s=0;f=q-1;b={parent:-1,keys:[]};b.keys[0]={time:0,pos:g[0],rot:[0,0,0,1],scl:[1,1,1]};b.keys[f]={time:d,pos:g[f],rot:[0,0,0,1],scl:[1,1,1]};for(f=1;f<q-1;f++)s=d*h.chunks[f]/h.total,b.keys[f]={time:s,pos:g[f]};e.hierarchy[0]=b;THREE.AnimationHandler.add(e);
 return new THREE.Animation(a,c,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function f(a,b){var c,d,e=new THREE.Geometry;for(c=0;c<a.points.length*b;c++)d=c/(a.points.length*b),d=a.getPoint(d),e.vertices[c]=new THREE.Vertex(new THREE.Vector3(d.x,d.y,d.z));return e}this.object=a;this.domElement=void 0!==b?b: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.005;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=2*Math.PI,h=Math.PI/180;this.update=function(a){var b;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed*a);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed*a);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)*h;this.theta=this.lon*h;a=this.phi%g;this.phi=0<=a?a:a+g;b=this.verticalAngleMap.srcRange;a=this.verticalAngleMap.dstRange;
@@ -529,72 +532,72 @@ THREE.FlyControls=function(a,b){function c(a,b){return function(){b.apply(a,argu
 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=void 0!==b?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;var c=new THREE.Vector3,d=new THREE.Vector3,e=new THREE.Vector3,f=new THREE.Matrix4,g=!1,h=1,i=0,m=0,k=0,p=0,n=0,o=window.innerWidth/2,q=window.innerHeight/2;this.update=function(a){if(this.mouseLook){var b=a*this.lookSpeed;
-this.rotateHorizontally(b*p);this.rotateVertically(b*n)}b=a*this.movementSpeed;this.object.translateZ(-b*(0<i||this.autoForward&&!(0>i)?1:i));this.object.translateX(b*m);this.object.translateY(b*k);g&&(this.roll+=this.rollSpeed*a*h);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();e.copy(this.forward);d.set(0,1,0);c.cross(d,
+THREE.RollControls=function(a,b){this.object=a;this.domElement=void 0!==b?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;var c=new THREE.Vector3,d=new THREE.Vector3,e=new THREE.Vector3,f=new THREE.Matrix4,g=!1,h=1,l=0,j=0,k=0,p=0,m=0,o=window.innerWidth/2,r=window.innerHeight/2;this.update=function(a){if(this.mouseLook){var b=a*this.lookSpeed;
+this.rotateHorizontally(b*p);this.rotateVertically(b*m)}b=a*this.movementSpeed;this.object.translateZ(-b*(0<l||this.autoForward&&!(0>l)?1:l));this.object.translateX(b*j);this.object.translateY(b*k);g&&(this.roll+=this.rollSpeed*a*h);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();e.copy(this.forward);d.set(0,1,0);c.cross(d,
 e).normalize();d.cross(e,c).normalize();this.object.matrix.n11=c.x;this.object.matrix.n12=d.x;this.object.matrix.n13=e.x;this.object.matrix.n21=c.y;this.object.matrix.n22=d.y;this.object.matrix.n23=e.y;this.object.matrix.n31=c.z;this.object.matrix.n32=d.z;this.object.matrix.n33=e.z;f.identity();f.n11=Math.cos(this.roll);f.n12=-Math.sin(this.roll);f.n21=Math.sin(this.roll);f.n22=Math.cos(this.roll);this.object.matrix.multiplySelf(f);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){d.set(this.object.matrix.n12,this.object.matrix.n22,this.object.matrix.n32);d.multiplyScalar(a);this.forward.addSelf(d);this.forward.normalize()};this.domElement.addEventListener("contextmenu",
-function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){p=(a.clientX-o)/window.innerWidth;n=(a.clientY-q)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:i=1;break;case 2:i=-1}},!1);this.domElement.addEventListener("mouseup",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:i=0;break;case 2:i=0}},!1);this.domElement.addEventListener("keydown",
-function(a){switch(a.keyCode){case 38:case 87:i=1;break;case 37:case 65:m=-1;break;case 40:case 83:i=-1;break;case 39:case 68:m=1;break;case 81:g=!0;h=1;break;case 69:g=!0;h=-1;break;case 82:k=1;break;case 70:k=-1}},!1);this.domElement.addEventListener("keyup",function(a){switch(a.keyCode){case 38:case 87:i=0;break;case 37:case 65:m=0;break;case 40:case 83:i=0;break;case 39:case 68:m=0;break;case 81:g=!1;break;case 69:g=!1;break;case 82:k=0;break;case 70:k=0}},!1)};
+function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){p=(a.clientX-o)/window.innerWidth;m=(a.clientY-r)/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:j=-1;break;case 40:case 83:l=-1;break;case 39:case 68:j=1;break;case 81:g=!0;h=1;break;case 69:g=!0;h=-1;break;case 82:k=1;break;case 70:k=-1}},!1);this.domElement.addEventListener("keyup",function(a){switch(a.keyCode){case 38:case 87:l=0;break;case 37:case 65:j=0;break;case 40:case 83:l=0;break;case 39:case 68:j=0;break;case 81:g=!1;break;case 69:g=!1;break;case 82:k=0;break;case 70:k=0}},!1)};
 THREE.TrackballControls=function(a,b){THREE.EventTarget.call(this);var c=this;this.object=a;this.domElement=void 0!==b?b: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=this.noRotate=!1;this.dynamicDampingFactor=0.2;this.minDistance=0;this.maxDistance=Infinity;this.keys=[65,83,68];this.target=
-new THREE.Vector3;var d=new THREE.Vector3,e=!1,f=-1,g=new THREE.Vector3,h=new THREE.Vector3,i=new THREE.Vector3,m=new THREE.Vector2,k=new THREE.Vector2,p=new THREE.Vector2,n=new THREE.Vector2,o={type:"change"};this.handleEvent=function(a){if("function"==typeof this[a.type])this[a.type](a)};this.getMouseOnScreen=function(a,b){return new THREE.Vector2(0.5*((a-c.screen.offsetLeft)/c.radius),0.5*((b-c.screen.offsetTop)/c.radius))};this.getMouseProjectionOnBall=function(a,b){var d=new THREE.Vector3((a-
-0.5*c.screen.width-c.screen.offsetLeft)/c.radius,(0.5*c.screen.height+c.screen.offsetTop-b)/c.radius,0),e=d.length();1<e?d.normalize():d.z=Math.sqrt(1-e*e);g.copy(c.object.position).subSelf(c.target);e=c.object.up.clone().setLength(d.y);e.addSelf(c.object.up.clone().crossSelf(g).setLength(d.x));e.addSelf(g.setLength(d.z));return e};this.rotateCamera=function(){var a=Math.acos(h.dot(i)/h.length()/i.length());if(a){var b=(new THREE.Vector3).cross(h,i).normalize(),d=new THREE.Quaternion,a=a*c.rotateSpeed;
-d.setFromAxisAngle(b,-a);d.multiplyVector3(g);d.multiplyVector3(c.object.up);d.multiplyVector3(i);c.staticMoving?h=i:(d.setFromAxisAngle(b,a*(c.dynamicDampingFactor-1)),d.multiplyVector3(h))}};this.zoomCamera=function(){var a=1+(k.y-m.y)*c.zoomSpeed;1!==a&&0<a&&(g.multiplyScalar(a),c.staticMoving?m=k:m.y+=(k.y-m.y)*this.dynamicDampingFactor)};this.panCamera=function(){var a=n.clone().subSelf(p);if(a.lengthSq()){a.multiplyScalar(g.length()*c.panSpeed);var b=g.clone().crossSelf(c.object.up).setLength(a.x);
-b.addSelf(c.object.up.clone().setLength(a.y));c.object.position.addSelf(b);c.target.addSelf(b);c.staticMoving?p=n:p.addSelf(a.sub(n,p).multiplyScalar(c.dynamicDampingFactor))}};this.checkDistances=function(){if(!c.noZoom||!c.noPan)c.object.position.lengthSq()>c.maxDistance*c.maxDistance&&c.object.position.setLength(c.maxDistance),g.lengthSq()<c.minDistance*c.minDistance&&c.object.position.add(c.target,g.setLength(c.minDistance))};this.update=function(){g.copy(c.object.position).subSelf(c.target);
-c.noRotate||c.rotateCamera();c.noZoom||c.zoomCamera();c.noPan||c.panCamera();c.object.position.add(c.target,g);c.checkDistances();c.object.lookAt(c.target);0<d.distanceTo(c.object.position)&&(c.dispatchEvent(o),d.copy(c.object.position))};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){c.enabled&&(e&&(h=i=c.getMouseProjectionOnBall(a.clientX,a.clientY),m=k=c.getMouseOnScreen(a.clientX,a.clientY),p=n=c.getMouseOnScreen(a.clientX,
-a.clientY),e=!1),-1!==f&&(0===f&&!c.noRotate?i=c.getMouseProjectionOnBall(a.clientX,a.clientY):1===f&&!c.noZoom?k=c.getMouseOnScreen(a.clientX,a.clientY):2===f&&!c.noPan&&(n=c.getMouseOnScreen(a.clientX,a.clientY))))},!1);this.domElement.addEventListener("mousedown",function(a){if(c.enabled&&(a.preventDefault(),a.stopPropagation(),-1===f))f=a.button,0===f&&!c.noRotate?h=i=c.getMouseProjectionOnBall(a.clientX,a.clientY):1===f&&!c.noZoom?m=k=c.getMouseOnScreen(a.clientX,a.clientY):this.noPan||(p=n=
+new THREE.Vector3;var d=new THREE.Vector3,e=!1,f=-1,g=new THREE.Vector3,h=new THREE.Vector3,l=new THREE.Vector3,j=new THREE.Vector2,k=new THREE.Vector2,p=new THREE.Vector2,m=new THREE.Vector2,o={type:"change"};this.handleEvent=function(a){if("function"==typeof this[a.type])this[a.type](a)};this.getMouseOnScreen=function(a,b){return new THREE.Vector2(0.5*((a-c.screen.offsetLeft)/c.radius),0.5*((b-c.screen.offsetTop)/c.radius))};this.getMouseProjectionOnBall=function(a,b){var d=new THREE.Vector3((a-
+0.5*c.screen.width-c.screen.offsetLeft)/c.radius,(0.5*c.screen.height+c.screen.offsetTop-b)/c.radius,0),e=d.length();1<e?d.normalize():d.z=Math.sqrt(1-e*e);g.copy(c.object.position).subSelf(c.target);e=c.object.up.clone().setLength(d.y);e.addSelf(c.object.up.clone().crossSelf(g).setLength(d.x));e.addSelf(g.setLength(d.z));return e};this.rotateCamera=function(){var a=Math.acos(h.dot(l)/h.length()/l.length());if(a){var b=(new THREE.Vector3).cross(h,l).normalize(),d=new THREE.Quaternion,a=a*c.rotateSpeed;
+d.setFromAxisAngle(b,-a);d.multiplyVector3(g);d.multiplyVector3(c.object.up);d.multiplyVector3(l);c.staticMoving?h=l:(d.setFromAxisAngle(b,a*(c.dynamicDampingFactor-1)),d.multiplyVector3(h))}};this.zoomCamera=function(){var a=1+(k.y-j.y)*c.zoomSpeed;1!==a&&0<a&&(g.multiplyScalar(a),c.staticMoving?j=k:j.y+=(k.y-j.y)*this.dynamicDampingFactor)};this.panCamera=function(){var a=m.clone().subSelf(p);if(a.lengthSq()){a.multiplyScalar(g.length()*c.panSpeed);var b=g.clone().crossSelf(c.object.up).setLength(a.x);
+b.addSelf(c.object.up.clone().setLength(a.y));c.object.position.addSelf(b);c.target.addSelf(b);c.staticMoving?p=m:p.addSelf(a.sub(m,p).multiplyScalar(c.dynamicDampingFactor))}};this.checkDistances=function(){if(!c.noZoom||!c.noPan)c.object.position.lengthSq()>c.maxDistance*c.maxDistance&&c.object.position.setLength(c.maxDistance),g.lengthSq()<c.minDistance*c.minDistance&&c.object.position.add(c.target,g.setLength(c.minDistance))};this.update=function(){g.copy(c.object.position).subSelf(c.target);
+c.noRotate||c.rotateCamera();c.noZoom||c.zoomCamera();c.noPan||c.panCamera();c.object.position.add(c.target,g);c.checkDistances();c.object.lookAt(c.target);0<d.distanceTo(c.object.position)&&(c.dispatchEvent(o),d.copy(c.object.position))};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){c.enabled&&(e&&(h=l=c.getMouseProjectionOnBall(a.clientX,a.clientY),j=k=c.getMouseOnScreen(a.clientX,a.clientY),p=m=c.getMouseOnScreen(a.clientX,
+a.clientY),e=!1),-1!==f&&(0===f&&!c.noRotate?l=c.getMouseProjectionOnBall(a.clientX,a.clientY):1===f&&!c.noZoom?k=c.getMouseOnScreen(a.clientX,a.clientY):2===f&&!c.noPan&&(m=c.getMouseOnScreen(a.clientX,a.clientY))))},!1);this.domElement.addEventListener("mousedown",function(a){if(c.enabled&&(a.preventDefault(),a.stopPropagation(),-1===f))f=a.button,0===f&&!c.noRotate?h=l=c.getMouseProjectionOnBall(a.clientX,a.clientY):1===f&&!c.noZoom?j=k=c.getMouseOnScreen(a.clientX,a.clientY):this.noPan||(p=m=
 c.getMouseOnScreen(a.clientX,a.clientY))},!1);this.domElement.addEventListener("mouseup",function(a){c.enabled&&(a.preventDefault(),a.stopPropagation(),f=-1)},!1);window.addEventListener("keydown",function(a){c.enabled&&-1===f&&(a.keyCode===c.keys[0]&&!c.noRotate?f=0:a.keyCode===c.keys[1]&&!c.noZoom?f=1:a.keyCode===c.keys[2]&&!c.noPan&&(f=2),-1!==f&&(e=!0))},!1);window.addEventListener("keyup",function(){c.enabled&&-1!==f&&(f=-1)},!1)};
-THREE.CubeGeometry=function(a,b,c,d,e,f,g,h){function i(a,b,c,g,h,l,i,k){var n,o=d||1,p=e||1,q=h/2,r=l/2,s=m.vertices.length;if("x"===a&&"y"===b||"y"===a&&"x"===b)n="z";else if("x"===a&&"z"===b||"z"===a&&"x"===b)n="y",p=f||1;else if("z"===a&&"y"===b||"y"===a&&"z"===b)n="x",o=f||1;var j=o+1,u=p+1,v=h/o,z=l/p,R=new THREE.Vector3;R[n]=0<i?1:-1;for(h=0;h<u;h++)for(l=0;l<j;l++){var E=new THREE.Vector3;E[a]=(l*v-q)*c;E[b]=(h*z-r)*g;E[n]=i;m.vertices.push(new THREE.Vertex(E))}for(h=0;h<p;h++)for(l=0;l<o;l++)a=
-new THREE.Face4(l+j*h+s,l+j*(h+1)+s,l+1+j*(h+1)+s,l+1+j*h+s),a.normal.copy(R),a.vertexNormals.push(R.clone(),R.clone(),R.clone(),R.clone()),a.materialIndex=k,m.faces.push(a),m.faceVertexUvs[0].push([new THREE.UV(l/o,h/p),new THREE.UV(l/o,(h+1)/p),new THREE.UV((l+1)/o,(h+1)/p),new THREE.UV((l+1)/o,h/p)])}THREE.Geometry.call(this);var m=this,k=a/2,p=b/2,n=c/2,o,q,l,r,s,u;if(void 0!==g){if(g instanceof Array)this.materials=g;else{this.materials=[];for(o=0;6>o;o++)this.materials.push(g)}o=0;r=1;q=2;s=
-3;l=4;u=5}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(void 0!=h)for(var v in h)void 0!==this.sides[v]&&(this.sides[v]=h[v]);this.sides.px&&i("z","y",-1,-1,c,b,k,o);this.sides.nx&&i("z","y",1,-1,c,b,-k,r);this.sides.py&&i("x","z",1,1,a,c,p,q);this.sides.ny&&i("x","z",1,-1,a,c,-p,s);this.sides.pz&&i("x","y",1,-1,a,b,n,l);this.sides.nz&&i("x","y",-1,-1,a,b,-n,u);this.computeCentroids();this.mergeVertices()};THREE.CubeGeometry.prototype=new THREE.Geometry;
+THREE.CubeGeometry=function(a,b,c,d,e,f,g,h){function l(a,b,c,g,h,k,l,m){var n,o=d||1,p=e||1,r=h/2,q=k/2,s=j.vertices.length;if("x"===a&&"y"===b||"y"===a&&"x"===b)n="z";else if("x"===a&&"z"===b||"z"===a&&"x"===b)n="y",p=f||1;else if("z"===a&&"y"===b||"y"===a&&"z"===b)n="x",o=f||1;var i=o+1,u=p+1,v=h/o,A=k/p,V=new THREE.Vector3;V[n]=0<l?1:-1;for(h=0;h<u;h++)for(k=0;k<i;k++){var E=new THREE.Vector3;E[a]=(k*v-r)*c;E[b]=(h*A-q)*g;E[n]=l;j.vertices.push(new THREE.Vertex(E))}for(h=0;h<p;h++)for(k=0;k<o;k++)a=
+new THREE.Face4(k+i*h+s,k+i*(h+1)+s,k+1+i*(h+1)+s,k+1+i*h+s),a.normal.copy(V),a.vertexNormals.push(V.clone(),V.clone(),V.clone(),V.clone()),a.materialIndex=m,j.faces.push(a),j.faceVertexUvs[0].push([new THREE.UV(k/o,h/p),new THREE.UV(k/o,(h+1)/p),new THREE.UV((k+1)/o,(h+1)/p),new THREE.UV((k+1)/o,h/p)])}THREE.Geometry.call(this);var j=this,k=a/2,p=b/2,m=c/2,o,r,n,q,s,u;if(void 0!==g){if(g instanceof Array)this.materials=g;else{this.materials=[];for(o=0;6>o;o++)this.materials.push(g)}o=0;q=1;r=2;s=
+3;n=4;u=5}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(void 0!=h)for(var v in h)void 0!==this.sides[v]&&(this.sides[v]=h[v]);this.sides.px&&l("z","y",-1,-1,c,b,k,o);this.sides.nx&&l("z","y",1,-1,c,b,-k,q);this.sides.py&&l("x","z",1,1,a,c,p,r);this.sides.ny&&l("x","z",1,-1,a,c,-p,s);this.sides.pz&&l("x","y",1,-1,a,b,m,n);this.sides.nz&&l("x","y",-1,-1,a,b,-m,u);this.computeCentroids();this.mergeVertices()};THREE.CubeGeometry.prototype=new THREE.Geometry;
 THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
-THREE.CylinderGeometry=function(a,b,c,d,e,f){THREE.Geometry.call(this);var a=void 0!==a?a:20,b=void 0!==b?b:20,c=void 0!==c?c:100,g=c/2,d=d||8,e=e||1,h,i,m=[],k=[];for(i=0;i<=e;i++){var p=[],n=[],o=i/e,q=o*(b-a)+a;for(h=0;h<=d;h++){var l=h/d,r=q*Math.sin(2*l*Math.PI),s=-o*c+g,u=q*Math.cos(2*l*Math.PI);this.vertices.push(new THREE.Vertex(new THREE.Vector3(r,s,u)));p.push(this.vertices.length-1);n.push(new THREE.UV(l,o))}m.push(p);k.push(n)}for(i=0;i<e;i++)for(h=0;h<d;h++){var c=m[i][h],p=m[i+1][h],
-n=m[i+1][h+1],o=m[i][h+1],q=this.vertices[c].position.clone().setY(0).normalize(),l=this.vertices[p].position.clone().setY(0).normalize(),r=this.vertices[n].position.clone().setY(0).normalize(),s=this.vertices[o].position.clone().setY(0).normalize(),u=k[i][h].clone(),v=k[i+1][h].clone(),t=k[i+1][h+1].clone(),w=k[i][h+1].clone();this.faces.push(new THREE.Face4(c,p,n,o,[q,l,r,s]));this.faceVertexUvs[0].push([u,v,t,w])}if(!f&&0<a){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,g,0)));for(h=
-0;h<d;h++)c=m[0][h],p=m[0][h+1],n=this.vertices.length-1,q=new THREE.Vector3(0,1,0),l=new THREE.Vector3(0,1,0),r=new THREE.Vector3(0,1,0),u=k[0][h].clone(),v=k[0][h+1].clone(),t=new THREE.UV(v.u,0),this.faces.push(new THREE.Face3(c,p,n,[q,l,r])),this.faceVertexUvs[0].push([u,v,t])}if(!f&&0<b){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-g,0)));for(h=0;h<d;h++)c=m[i][h+1],p=m[i][h],n=this.vertices.length-1,q=new THREE.Vector3(0,-1,0),l=new THREE.Vector3(0,-1,0),r=new THREE.Vector3(0,-1,
-0),u=k[i][h+1].clone(),v=k[i][h].clone(),t=new THREE.UV(v.u,1),this.faces.push(new THREE.Face3(c,p,n,[q,l,r])),this.faceVertexUvs[0].push([u,v,t])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
+THREE.CylinderGeometry=function(a,b,c,d,e,f){THREE.Geometry.call(this);var a=void 0!==a?a:20,b=void 0!==b?b:20,c=void 0!==c?c:100,g=c/2,d=d||8,e=e||1,h,l,j=[],k=[];for(l=0;l<=e;l++){var p=[],m=[],o=l/e,r=o*(b-a)+a;for(h=0;h<=d;h++){var n=h/d,q=r*Math.sin(2*n*Math.PI),s=-o*c+g,u=r*Math.cos(2*n*Math.PI);this.vertices.push(new THREE.Vertex(new THREE.Vector3(q,s,u)));p.push(this.vertices.length-1);m.push(new THREE.UV(n,o))}j.push(p);k.push(m)}for(l=0;l<e;l++)for(h=0;h<d;h++){var c=j[l][h],p=j[l+1][h],
+m=j[l+1][h+1],o=j[l][h+1],r=this.vertices[c].position.clone().setY(0).normalize(),n=this.vertices[p].position.clone().setY(0).normalize(),q=this.vertices[m].position.clone().setY(0).normalize(),s=this.vertices[o].position.clone().setY(0).normalize(),u=k[l][h].clone(),v=k[l+1][h].clone(),t=k[l+1][h+1].clone(),w=k[l][h+1].clone();this.faces.push(new THREE.Face4(c,p,m,o,[r,n,q,s]));this.faceVertexUvs[0].push([u,v,t,w])}if(!f&&0<a){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,g,0)));for(h=
+0;h<d;h++)c=j[0][h],p=j[0][h+1],m=this.vertices.length-1,r=new THREE.Vector3(0,1,0),n=new THREE.Vector3(0,1,0),q=new THREE.Vector3(0,1,0),u=k[0][h].clone(),v=k[0][h+1].clone(),t=new THREE.UV(v.u,0),this.faces.push(new THREE.Face3(c,p,m,[r,n,q])),this.faceVertexUvs[0].push([u,v,t])}if(!f&&0<b){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-g,0)));for(h=0;h<d;h++)c=j[l][h+1],p=j[l][h],m=this.vertices.length-1,r=new THREE.Vector3(0,-1,0),n=new THREE.Vector3(0,-1,0),q=new THREE.Vector3(0,-1,
+0),u=k[l][h+1].clone(),v=k[l][h].clone(),t=new THREE.UV(v.u,1),this.faces.push(new THREE.Face3(c,p,m,[r,n,q])),this.faceVertexUvs[0].push([u,v,t])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
 THREE.ExtrudeGeometry=function(a,b){if("undefined"!==typeof a)THREE.Geometry.call(this),a=a instanceof Array?a:[a],this.shapebb=a[a.length-1].getBoundingBox(),this.addShapeList(a,b),this.computeCentroids(),this.computeFaceNormals()};THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;THREE.ExtrudeGeometry.prototype.addShapeList=function(a,b){for(var c=a.length,d=0;d<c;d++)this.addShape(a[d],b)};
-THREE.ExtrudeGeometry.prototype.addShape=function(a,b){function c(a,b,c){b||console.log("die");return b.clone().multiplyScalar(c).addSelf(a)}function d(a,b,c){var d=THREE.ExtrudeGeometry.__v1,e=THREE.ExtrudeGeometry.__v2,f=THREE.ExtrudeGeometry.__v3,g=THREE.ExtrudeGeometry.__v4,h=THREE.ExtrudeGeometry.__v5,l=THREE.ExtrudeGeometry.__v6;d.set(a.x-b.x,a.y-b.y);e.set(a.x-c.x,a.y-c.y);d=d.normalize();e=e.normalize();f.set(-d.y,d.x);g.set(e.y,-e.x);h.copy(a).addSelf(f);l.copy(a).addSelf(g);if(h.equals(l))return g.clone();
-h.copy(b).addSelf(f);l.copy(c).addSelf(g);f=d.dot(g);g=l.subSelf(h).dot(g);0===f&&(console.log("Either infinite or no solutions!"),0===g?console.log("Its finite solutions."):console.log("Too bad, no solutions."));g/=f;return 0>g?(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+=2*Math.PI),c=(b+a)/2,a=-Math.cos(c),c=-Math.sin(c),new THREE.Vector2(a,c)):d.multiplyScalar(g).addSelf(h).subSelf(a).clone()}function e(c,d){var e,f;for(E=c.length;0<=--E;){e=E;f=E-1;0>f&&(f=c.length-1);
-for(var g=0,h=n+2*k,g=0;g<h;g++){var l=C*g,j=C*(g+1),i=d+e+l,l=d+f+l,m=d+f+j,j=d+e+j,o=c,p=g,q=h,i=i+O,l=l+O,m=m+O,j=j+O;J.faces.push(new THREE.Face4(i,l,m,j,null,null,u));i=S.generateSideWallUV(J,a,o,b,i,l,m,j,p,q);J.faceVertexUvs[0].push(i)}}}function f(a,b,c){J.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function g(c,d,e,f){c+=O;d+=O;e+=O;J.faces.push(new THREE.Face3(c,d,e,null,null,s));c=f?S.generateBottomUV(J,a,b,c,d,e):S.generateTopUV(J,a,b,c,d,e);J.faceVertexUvs[0].push(c)}var h=
-void 0!==b.amount?b.amount:100,i=void 0!==b.bevelThickness?b.bevelThickness:6,m=void 0!==b.bevelSize?b.bevelSize:i-2,k=void 0!==b.bevelSegments?b.bevelSegments:3,p=void 0!==b.bevelEnabled?b.bevelEnabled:!0,n=void 0!==b.steps?b.steps:1,o=b.bendPath,q=b.extrudePath,l,r=!1,s=b.material,u=b.extrudeMaterial,v,t,w,A;q&&(l=q.getSpacedPoints(n),r=!0,p=!1,v=new THREE.TubeGeometry(q,n,1,1,!1,!1),t=new THREE.Vector3,w=new THREE.Vector3,A=new THREE.Vector3);p||(m=i=k=0);var G,F,D,J=this,O=this.vertices.length;
-o&&a.addWrapPath(o);var q=a.extractPoints(),o=q.shape,P=q.holes;if(q=!THREE.Shape.Utils.isClockWise(o)){o=o.reverse();for(F=0,D=P.length;F<D;F++)G=P[F],THREE.Shape.Utils.isClockWise(G)&&(P[F]=G.reverse());q=!1}var U=THREE.Shape.Utils.triangulateShape(o,P),L=o;for(F=0,D=P.length;F<D;F++)G=P[F],o=o.concat(G);var I,M,B,j,T,C=o.length,z,R=U.length,q=[],E=0;B=L.length;I=B-1;for(M=E+1;E<B;E++,I++,M++)I===B&&(I=0),M===B&&(M=0),q[E]=d(L[E],L[I],L[M]);var ga=[],ea,ca=q.concat();for(F=0,D=P.length;F<D;F++){G=
-P[F];ea=[];for(E=0,B=G.length,I=B-1,M=E+1;E<B;E++,I++,M++)I===B&&(I=0),M===B&&(M=0),ea[E]=d(G[E],G[I],G[M]);ga.push(ea);ca=ca.concat(ea)}for(I=0;I<k;I++){B=I/k;j=i*(1-B);M=m*Math.sin(B*Math.PI/2);for(E=0,B=L.length;E<B;E++)T=c(L[E],q[E],M),f(T.x,T.y,-j);for(F=0,D=P.length;F<D;F++){G=P[F];ea=ga[F];for(E=0,B=G.length;E<B;E++)T=c(G[E],ea[E],M),f(T.x,T.y,-j)}}M=m;for(E=0;E<C;E++)T=p?c(o[E],ca[E],M):o[E],r?(w.copy(v.normals[0]).multiplyScalar(T.x),t.copy(v.binormals[0]).multiplyScalar(T.y),A.copy(l[0]).addSelf(w).addSelf(t),
-f(A.x,A.y,A.z)):f(T.x,T.y,0);for(B=1;B<=n;B++)for(E=0;E<C;E++)T=p?c(o[E],ca[E],M):o[E],r?(w.copy(v.normals[B]).multiplyScalar(T.x),t.copy(v.binormals[B]).multiplyScalar(T.y),A.copy(l[B]).addSelf(w).addSelf(t),f(A.x,A.y,A.z)):f(T.x,T.y,h/n*B);for(I=k-1;0<=I;I--){B=I/k;j=i*(1-B);M=m*Math.sin(B*Math.PI/2);for(E=0,B=L.length;E<B;E++)T=c(L[E],q[E],M),f(T.x,T.y,h+j);for(F=0,D=P.length;F<D;F++){G=P[F];ea=ga[F];for(E=0,B=G.length;E<B;E++)T=c(G[E],ea[E],M),r?f(T.x,T.y+l[n-1].y,l[n-1].x+j):f(T.x,T.y,h+j)}}var S=
-THREE.ExtrudeGeometry.WorldUVGenerator;(function(){if(p){var a;a=0*C;for(E=0;E<R;E++)z=U[E],g(z[2]+a,z[1]+a,z[0]+a,!0);a=n+2*k;a*=C;for(E=0;E<R;E++)z=U[E],g(z[0]+a,z[1]+a,z[2]+a,!1)}else{for(E=0;E<R;E++)z=U[E],g(z[2],z[1],z[0],!0);for(E=0;E<R;E++)z=U[E],g(z[0]+C*n,z[1]+C*n,z[2]+C*n,!1)}})();(function(){var a=0;e(L,a);a+=L.length;for(F=0,D=P.length;F<D;F++)G=P[F],e(G,a),a+=G.length})()};
+THREE.ExtrudeGeometry.prototype.addShape=function(a,b){function c(a,b,c){b||console.log("die");return b.clone().multiplyScalar(c).addSelf(a)}function d(a,b,c){var d=THREE.ExtrudeGeometry.__v1,e=THREE.ExtrudeGeometry.__v2,f=THREE.ExtrudeGeometry.__v3,g=THREE.ExtrudeGeometry.__v4,h=THREE.ExtrudeGeometry.__v5,i=THREE.ExtrudeGeometry.__v6;d.set(a.x-b.x,a.y-b.y);e.set(a.x-c.x,a.y-c.y);d=d.normalize();e=e.normalize();f.set(-d.y,d.x);g.set(e.y,-e.x);h.copy(a).addSelf(f);i.copy(a).addSelf(g);if(h.equals(i))return g.clone();
+h.copy(b).addSelf(f);i.copy(c).addSelf(g);f=d.dot(g);g=i.subSelf(h).dot(g);0===f&&(console.log("Either infinite or no solutions!"),0===g?console.log("Its finite solutions."):console.log("Too bad, no solutions."));g/=f;return 0>g?(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+=2*Math.PI),c=(b+a)/2,a=-Math.cos(c),c=-Math.sin(c),new THREE.Vector2(a,c)):d.multiplyScalar(g).addSelf(h).subSelf(a).clone()}function e(c,d){var e,f;for(E=c.length;0<=--E;){e=E;f=E-1;0>f&&(f=c.length-1);
+for(var g=0,h=m+2*k,g=0;g<h;g++){var i=B*g,j=B*(g+1),l=d+e+i,i=d+f+i,n=d+f+j,j=d+e+j,o=c,p=g,r=h,l=l+N,i=i+N,n=n+N,j=j+N;K.faces.push(new THREE.Face4(l,i,n,j,null,null,u));l=R.generateSideWallUV(K,a,o,b,l,i,n,j,p,r);K.faceVertexUvs[0].push(l)}}}function f(a,b,c){K.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function g(c,d,e,f){c+=N;d+=N;e+=N;K.faces.push(new THREE.Face3(c,d,e,null,null,s));c=f?R.generateBottomUV(K,a,b,c,d,e):R.generateTopUV(K,a,b,c,d,e);K.faceVertexUvs[0].push(c)}var h=
+void 0!==b.amount?b.amount:100,l=void 0!==b.bevelThickness?b.bevelThickness:6,j=void 0!==b.bevelSize?b.bevelSize:l-2,k=void 0!==b.bevelSegments?b.bevelSegments:3,p=void 0!==b.bevelEnabled?b.bevelEnabled:!0,m=void 0!==b.steps?b.steps:1,o=b.bendPath,r=b.extrudePath,n,q=!1,s=b.material,u=b.extrudeMaterial,v,t,w,z;r&&(n=r.getSpacedPoints(m),q=!0,p=!1,v=new THREE.TubeGeometry(r,m,1,1,!1,!1),t=new THREE.Vector3,w=new THREE.Vector3,z=new THREE.Vector3);p||(j=l=k=0);var F,C,G,K=this,N=this.vertices.length;
+o&&a.addWrapPath(o);var r=a.extractPoints(),o=r.shape,P=r.holes;if(r=!THREE.Shape.Utils.isClockWise(o)){o=o.reverse();for(C=0,G=P.length;C<G;C++)F=P[C],THREE.Shape.Utils.isClockWise(F)&&(P[C]=F.reverse());r=!1}var T=THREE.Shape.Utils.triangulateShape(o,P),O=o;for(C=0,G=P.length;C<G;C++)F=P[C],o=o.concat(F);var J,I,D,i,S,B=o.length,A,V=T.length,r=[],E=0;D=O.length;J=D-1;for(I=E+1;E<D;E++,J++,I++)J===D&&(J=0),I===D&&(I=0),r[E]=d(O[E],O[J],O[I]);var aa=[],ea,ia=r.concat();for(C=0,G=P.length;C<G;C++){F=
+P[C];ea=[];for(E=0,D=F.length,J=D-1,I=E+1;E<D;E++,J++,I++)J===D&&(J=0),I===D&&(I=0),ea[E]=d(F[E],F[J],F[I]);aa.push(ea);ia=ia.concat(ea)}for(J=0;J<k;J++){D=J/k;i=l*(1-D);I=j*Math.sin(D*Math.PI/2);for(E=0,D=O.length;E<D;E++)S=c(O[E],r[E],I),f(S.x,S.y,-i);for(C=0,G=P.length;C<G;C++){F=P[C];ea=aa[C];for(E=0,D=F.length;E<D;E++)S=c(F[E],ea[E],I),f(S.x,S.y,-i)}}I=j;for(E=0;E<B;E++)S=p?c(o[E],ia[E],I):o[E],q?(w.copy(v.normals[0]).multiplyScalar(S.x),t.copy(v.binormals[0]).multiplyScalar(S.y),z.copy(n[0]).addSelf(w).addSelf(t),
+f(z.x,z.y,z.z)):f(S.x,S.y,0);for(D=1;D<=m;D++)for(E=0;E<B;E++)S=p?c(o[E],ia[E],I):o[E],q?(w.copy(v.normals[D]).multiplyScalar(S.x),t.copy(v.binormals[D]).multiplyScalar(S.y),z.copy(n[D]).addSelf(w).addSelf(t),f(z.x,z.y,z.z)):f(S.x,S.y,h/m*D);for(J=k-1;0<=J;J--){D=J/k;i=l*(1-D);I=j*Math.sin(D*Math.PI/2);for(E=0,D=O.length;E<D;E++)S=c(O[E],r[E],I),f(S.x,S.y,h+i);for(C=0,G=P.length;C<G;C++){F=P[C];ea=aa[C];for(E=0,D=F.length;E<D;E++)S=c(F[E],ea[E],I),q?f(S.x,S.y+n[m-1].y,n[m-1].x+i):f(S.x,S.y,h+i)}}var R=
+THREE.ExtrudeGeometry.WorldUVGenerator;(function(){if(p){var a;a=0*B;for(E=0;E<V;E++)A=T[E],g(A[2]+a,A[1]+a,A[0]+a,!0);a=m+2*k;a*=B;for(E=0;E<V;E++)A=T[E],g(A[0]+a,A[1]+a,A[2]+a,!1)}else{for(E=0;E<V;E++)A=T[E],g(A[2],A[1],A[0],!0);for(E=0;E<V;E++)A=T[E],g(A[0]+B*m,A[1]+B*m,A[2]+B*m,!1)}})();(function(){var a=0;e(O,a);a+=O.length;for(C=0,G=P.length;C<G;C++)F=P[C],e(F,a),a+=F.length})()};
 THREE.ExtrudeGeometry.WorldUVGenerator={generateTopUV:function(a,b,c,d,e,f){b=a.vertices[e].position.x;e=a.vertices[e].position.y;c=a.vertices[f].position.x;f=a.vertices[f].position.y;return[new THREE.UV(a.vertices[d].position.x,1-a.vertices[d].position.y),new THREE.UV(b,1-e),new THREE.UV(c,1-f)]},generateBottomUV:function(a,b,c,d,e,f){return this.generateTopUV(a,b,c,d,e,f)},generateSideWallUV:function(a,b,c,d,e,f,g,h){var b=a.vertices[e].position.x,c=a.vertices[e].position.y,e=a.vertices[e].position.z,
-d=a.vertices[f].position.x,i=a.vertices[f].position.y,f=a.vertices[f].position.z,m=a.vertices[g].position.x,k=a.vertices[g].position.y,g=a.vertices[g].position.z,p=a.vertices[h].position.x,n=a.vertices[h].position.y,a=a.vertices[h].position.z;return 0.01>Math.abs(c-i)?[new THREE.UV(b,e),new THREE.UV(d,f),new THREE.UV(m,g),new THREE.UV(p,a)]:[new THREE.UV(c,e),new THREE.UV(i,f),new THREE.UV(k,g),new THREE.UV(n,a)]}};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;THREE.ExtrudeGeometry.__v2=new THREE.Vector2;
+d=a.vertices[f].position.x,l=a.vertices[f].position.y,f=a.vertices[f].position.z,j=a.vertices[g].position.x,k=a.vertices[g].position.y,g=a.vertices[g].position.z,p=a.vertices[h].position.x,m=a.vertices[h].position.y,a=a.vertices[h].position.z;return 0.01>Math.abs(c-l)?[new THREE.UV(b,e),new THREE.UV(d,f),new THREE.UV(j,g),new THREE.UV(p,a)]:[new THREE.UV(c,e),new THREE.UV(l,f),new THREE.UV(k,g),new THREE.UV(m,a)]}};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.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=[],d=[],e=[],f=[],g=(new THREE.Matrix4).setRotationZ(b),h=0;h<a.length;h++)this.vertices.push(new THREE.Vertex(a[h])),c[h]=a[h].clone(),d[h]=this.vertices.length-1;for(var i=0;i<=this.angle+0.001;i+=b){for(h=0;h<c.length;h++)i<this.angle?(c[h]=g.multiplyVector3(c[h].clone()),this.vertices.push(new THREE.Vertex(c[h])),e[h]=this.vertices.length-1):e=f;0==i&&(f=d);
-for(h=0;h<d.length-1;h++)this.faces.push(new THREE.Face4(e[h],e[h+1],d[h+1],d[h])),this.faceVertexUvs[0].push([new THREE.UV(1-i/this.angle,h/a.length),new THREE.UV(1-i/this.angle,(h+1)/a.length),new THREE.UV(1-(i-b)/this.angle,(h+1)/a.length),new THREE.UV(1-(i-b)/this.angle,h/a.length)]);d=e;e=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=new THREE.Geometry;THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry;
-THREE.PlaneGeometry=function(a,b,c,d){THREE.Geometry.call(this);for(var e=a/2,f=b/2,c=c||1,d=d||1,g=c+1,h=d+1,i=a/c,m=b/d,k=new THREE.Vector3(0,1,0),a=0;a<h;a++)for(b=0;b<g;b++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(b*i-e,0,a*m-f)));for(a=0;a<d;a++)for(b=0;b<c;b++)e=new THREE.Face4(b+g*a,b+g*(a+1),b+1+g*(a+1),b+1+g*a),e.normal.copy(k),e.vertexNormals.push(k.clone(),k.clone(),k.clone(),k.clone()),this.faces.push(e),this.faceVertexUvs[0].push([new THREE.UV(b/c,a/d),new THREE.UV(b/c,(a+
+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=[],d=[],e=[],f=[],g=(new THREE.Matrix4).makeRotationZ(b),h=0;h<a.length;h++)this.vertices.push(new THREE.Vertex(a[h])),c[h]=a[h].clone(),d[h]=this.vertices.length-1;for(var l=0;l<=this.angle+0.001;l+=b){for(h=0;h<c.length;h++)l<this.angle?(c[h]=g.multiplyVector3(c[h].clone()),this.vertices.push(new THREE.Vertex(c[h])),e[h]=this.vertices.length-1):e=f;0==l&&(f=d);
+for(h=0;h<d.length-1;h++)this.faces.push(new THREE.Face4(e[h],e[h+1],d[h+1],d[h])),this.faceVertexUvs[0].push([new THREE.UV(1-l/this.angle,h/a.length),new THREE.UV(1-l/this.angle,(h+1)/a.length),new THREE.UV(1-(l-b)/this.angle,(h+1)/a.length),new THREE.UV(1-(l-b)/this.angle,h/a.length)]);d=e;e=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=new THREE.Geometry;THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry;
+THREE.PlaneGeometry=function(a,b,c,d){THREE.Geometry.call(this);for(var e=a/2,f=b/2,c=c||1,d=d||1,g=c+1,h=d+1,l=a/c,j=b/d,k=new THREE.Vector3(0,1,0),a=0;a<h;a++)for(b=0;b<g;b++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(b*l-e,0,a*j-f)));for(a=0;a<d;a++)for(b=0;b<c;b++)e=new THREE.Face4(b+g*a,b+g*(a+1),b+1+g*(a+1),b+1+g*a),e.normal.copy(k),e.vertexNormals.push(k.clone(),k.clone(),k.clone(),k.clone()),this.faces.push(e),this.faceVertexUvs[0].push([new THREE.UV(b/c,a/d),new THREE.UV(b/c,(a+
 1)/d),new THREE.UV((b+1)/c,(a+1)/d),new THREE.UV((b+1)/c,a/d)]);this.computeCentroids()};THREE.PlaneGeometry.prototype=new THREE.Geometry;THREE.PlaneGeometry.prototype.constructor=THREE.PlaneGeometry;
-THREE.SphereGeometry=function(a,b,c,d,e,f,g){THREE.Geometry.call(this);var a=a||50,d=void 0!==d?d:0,e=void 0!==e?e:2*Math.PI,f=void 0!==f?f:0,g=void 0!==g?g:Math.PI,b=Math.max(3,Math.floor(b)||8),c=Math.max(2,Math.floor(c)||6),h,i,m=[],k=[];for(i=0;i<=c;i++){var p=[],n=[];for(h=0;h<=b;h++){var o=h/b,q=i/c,l=-a*Math.cos(d+o*e)*Math.sin(f+q*g),r=a*Math.cos(f+q*g),s=a*Math.sin(d+o*e)*Math.sin(f+q*g);this.vertices.push(new THREE.Vertex(new THREE.Vector3(l,r,s)));p.push(this.vertices.length-1);n.push(new THREE.UV(o,
-q))}m.push(p);k.push(n)}for(i=0;i<c;i++)for(h=0;h<b;h++){var d=m[i][h+1],e=m[i][h],f=m[i+1][h],g=m[i+1][h+1],p=this.vertices[d].position.clone().normalize(),n=this.vertices[e].position.clone().normalize(),o=this.vertices[f].position.clone().normalize(),q=this.vertices[g].position.clone().normalize(),l=k[i][h+1].clone(),r=k[i][h].clone(),s=k[i+1][h].clone(),u=k[i+1][h+1].clone();Math.abs(this.vertices[d].position.y)==a?(this.faces.push(new THREE.Face3(d,f,g,[p,o,q])),this.faceVertexUvs[0].push([l,
-s,u])):Math.abs(this.vertices[f].position.y)==a?(this.faces.push(new THREE.Face3(d,e,f,[p,n,o])),this.faceVertexUvs[0].push([l,r,s])):(this.faces.push(new THREE.Face4(d,e,f,g,[p,n,o,q])),this.faceVertexUvs[0].push([l,r,s,u]))}this.computeCentroids();this.computeFaceNormals();this.boundingSphere={radius:a}};THREE.SphereGeometry.prototype=new THREE.Geometry;THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry;
+THREE.SphereGeometry=function(a,b,c,d,e,f,g){THREE.Geometry.call(this);var a=a||50,d=void 0!==d?d:0,e=void 0!==e?e:2*Math.PI,f=void 0!==f?f:0,g=void 0!==g?g:Math.PI,b=Math.max(3,Math.floor(b)||8),c=Math.max(2,Math.floor(c)||6),h,l,j=[],k=[];for(l=0;l<=c;l++){var p=[],m=[];for(h=0;h<=b;h++){var o=h/b,r=l/c,n=-a*Math.cos(d+o*e)*Math.sin(f+r*g),q=a*Math.cos(f+r*g),s=a*Math.sin(d+o*e)*Math.sin(f+r*g);this.vertices.push(new THREE.Vertex(new THREE.Vector3(n,q,s)));p.push(this.vertices.length-1);m.push(new THREE.UV(o,
+r))}j.push(p);k.push(m)}for(l=0;l<c;l++)for(h=0;h<b;h++){var d=j[l][h+1],e=j[l][h],f=j[l+1][h],g=j[l+1][h+1],p=this.vertices[d].position.clone().normalize(),m=this.vertices[e].position.clone().normalize(),o=this.vertices[f].position.clone().normalize(),r=this.vertices[g].position.clone().normalize(),n=k[l][h+1].clone(),q=k[l][h].clone(),s=k[l+1][h].clone(),u=k[l+1][h+1].clone();Math.abs(this.vertices[d].position.y)==a?(this.faces.push(new THREE.Face3(d,f,g,[p,o,r])),this.faceVertexUvs[0].push([n,
+s,u])):Math.abs(this.vertices[f].position.y)==a?(this.faces.push(new THREE.Face3(d,e,f,[p,m,o])),this.faceVertexUvs[0].push([n,q,s])):(this.faces.push(new THREE.Face4(d,e,f,g,[p,m,o,r])),this.faceVertexUvs[0].push([n,q,s,u]))}this.computeCentroids();this.computeFaceNormals();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=void 0!==b.height?b.height:50;if(void 0===b.bevelThickness)b.bevelThickness=10;if(void 0===b.bevelSize)b.bevelSize=8;if(void 0===b.bevelEnabled)b.bevelEnabled=!1;if(b.bend){var d=c[c.length-1].getBoundingBox().maxX;b.bendPath=new THREE.QuadraticBezierCurve(new THREE.Vector2(0,0),new THREE.Vector2(d/2,120),new THREE.Vector2(d,0))}THREE.ExtrudeGeometry.call(this,c,b)};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]},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,d=
-0,e=(""+a).split(""),f=e.length,g=[],a=0;a<f;a++){var h=new THREE.Path,h=this.extractGlyphPoints(e[a],b,c,d,h),d=d+h.offset;g.push(h.path)}return{paths:g,offset:d/2}},extractGlyphPoints:function(a,b,c,d,e){var f=[],g,h,i,m,k,p,n,o,q,l,r,s=b.glyphs[a]||b.glyphs["?"];if(s){if(s.o){b=s._cachedOutline||(s._cachedOutline=s.o.split(" "));m=b.length;for(a=0;a<m;)switch(i=b[a++],i){case "m":i=b[a++]*c+d;k=b[a++]*c;f.push(new THREE.Vector2(i,k));e.moveTo(i,k);break;case "l":i=b[a++]*c+d;k=b[a++]*c;f.push(new THREE.Vector2(i,
-k));e.lineTo(i,k);break;case "q":i=b[a++]*c+d;k=b[a++]*c;o=b[a++]*c+d;q=b[a++]*c;e.quadraticCurveTo(o,q,i,k);if(g=f[f.length-1]){p=g.x;n=g.y;for(g=1,h=this.divisions;g<=h;g++){var u=g/h,v=THREE.Shape.Utils.b2(u,p,o,i),u=THREE.Shape.Utils.b2(u,n,q,k);f.push(new THREE.Vector2(v,u))}}break;case "b":if(i=b[a++]*c+d,k=b[a++]*c,o=b[a++]*c+d,q=b[a++]*-c,l=b[a++]*c+d,r=b[a++]*-c,e.bezierCurveTo(i,k,o,q,l,r),g=f[f.length-1]){p=g.x;n=g.y;for(g=1,h=this.divisions;g<=h;g++)u=g/h,v=THREE.Shape.Utils.b3(u,p,o,
-l,i),u=THREE.Shape.Utils.b3(u,n,q,r,k),f.push(new THREE.Vector2(v,u))}}}return{offset:s.ha*c,points:f,path:e}}}};
-(function(a){var b=function(a){for(var b=a.length,e=0,f=b-1,g=0;g<b;f=g++)e+=a[f].x*a[g].y-a[g].x*a[f].y;return 0.5*e};a.Triangulate=function(a,d){var e=a.length;if(3>e)return null;var f=[],g=[],h=[],i,m,k;if(0<b(a))for(m=0;m<e;m++)g[m]=m;else for(m=0;m<e;m++)g[m]=e-1-m;var p=2*e;for(m=e-1;2<e;){if(0>=p--){console.log("Warning, unable to triangulate polygon!");break}i=m;e<=i&&(i=0);m=i+1;e<=m&&(m=0);k=m+1;e<=k&&(k=0);var n;a:{n=a;var o=i,q=m,l=k,r=e,s=g,u=void 0,v=void 0,t=void 0,w=void 0,A=void 0,
-G=void 0,F=void 0,D=void 0,J=void 0,v=n[s[o]].x,t=n[s[o]].y,w=n[s[q]].x,A=n[s[q]].y,G=n[s[l]].x,F=n[s[l]].y;if(1.0E-10>(w-v)*(F-t)-(A-t)*(G-v))n=!1;else{for(u=0;u<r;u++)if(!(u==o||u==q||u==l)){var D=n[s[u]].x,J=n[s[u]].y,O=void 0,P=void 0,U=void 0,L=void 0,I=void 0,M=void 0,B=void 0,j=void 0,T=void 0,C=void 0,z=void 0,R=void 0,O=U=I=void 0,O=G-w,P=F-A,U=v-G,L=t-F,I=w-v,M=A-t,B=D-v,j=J-t,T=D-w,C=J-A,z=D-G,R=J-F,O=O*C-P*T,I=I*j-M*B,U=U*R-L*z;if(0<=O&&0<=U&&0<=I){n=!1;break a}}n=!0}}if(n){f.push([a[g[i]],
-a[g[m]],a[g[k]]]);h.push([g[i],g[m],g[k]]);for(i=m,k=m+1;k<e;i++,k++)g[i]=g[k];e--;p=2*e}}return d?h:f};a.Triangulate.area=b;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
+0,e=(""+a).split(""),f=e.length,g=[],a=0;a<f;a++){var h=new THREE.Path,h=this.extractGlyphPoints(e[a],b,c,d,h),d=d+h.offset;g.push(h.path)}return{paths:g,offset:d/2}},extractGlyphPoints:function(a,b,c,d,e){var f=[],g,h,l,j,k,p,m,o,r,n,q,s=b.glyphs[a]||b.glyphs["?"];if(s){if(s.o){b=s._cachedOutline||(s._cachedOutline=s.o.split(" "));j=b.length;for(a=0;a<j;)switch(l=b[a++],l){case "m":l=b[a++]*c+d;k=b[a++]*c;f.push(new THREE.Vector2(l,k));e.moveTo(l,k);break;case "l":l=b[a++]*c+d;k=b[a++]*c;f.push(new THREE.Vector2(l,
+k));e.lineTo(l,k);break;case "q":l=b[a++]*c+d;k=b[a++]*c;o=b[a++]*c+d;r=b[a++]*c;e.quadraticCurveTo(o,r,l,k);if(g=f[f.length-1]){p=g.x;m=g.y;for(g=1,h=this.divisions;g<=h;g++){var u=g/h,v=THREE.Shape.Utils.b2(u,p,o,l),u=THREE.Shape.Utils.b2(u,m,r,k);f.push(new THREE.Vector2(v,u))}}break;case "b":if(l=b[a++]*c+d,k=b[a++]*c,o=b[a++]*c+d,r=b[a++]*-c,n=b[a++]*c+d,q=b[a++]*-c,e.bezierCurveTo(l,k,o,r,n,q),g=f[f.length-1]){p=g.x;m=g.y;for(g=1,h=this.divisions;g<=h;g++)u=g/h,v=THREE.Shape.Utils.b3(u,p,o,
+n,l),u=THREE.Shape.Utils.b3(u,m,r,q,k),f.push(new THREE.Vector2(v,u))}}}return{offset:s.ha*c,points:f,path:e}}}};
+(function(a){var b=function(a){for(var b=a.length,e=0,f=b-1,g=0;g<b;f=g++)e+=a[f].x*a[g].y-a[g].x*a[f].y;return 0.5*e};a.Triangulate=function(a,d){var e=a.length;if(3>e)return null;var f=[],g=[],h=[],l,j,k;if(0<b(a))for(j=0;j<e;j++)g[j]=j;else for(j=0;j<e;j++)g[j]=e-1-j;var p=2*e;for(j=e-1;2<e;){if(0>=p--){console.log("Warning, unable to triangulate polygon!");break}l=j;e<=l&&(l=0);j=l+1;e<=j&&(j=0);k=j+1;e<=k&&(k=0);var m;a:{m=a;var o=l,r=j,n=k,q=e,s=g,u=void 0,v=void 0,t=void 0,w=void 0,z=void 0,
+F=void 0,C=void 0,G=void 0,K=void 0,v=m[s[o]].x,t=m[s[o]].y,w=m[s[r]].x,z=m[s[r]].y,F=m[s[n]].x,C=m[s[n]].y;if(1.0E-10>(w-v)*(C-t)-(z-t)*(F-v))m=!1;else{for(u=0;u<q;u++)if(!(u==o||u==r||u==n)){var G=m[s[u]].x,K=m[s[u]].y,N=void 0,P=void 0,T=void 0,O=void 0,J=void 0,I=void 0,D=void 0,i=void 0,S=void 0,B=void 0,A=void 0,V=void 0,N=T=J=void 0,N=F-w,P=C-z,T=v-F,O=t-C,J=w-v,I=z-t,D=G-v,i=K-t,S=G-w,B=K-z,A=G-F,V=K-C,N=N*B-P*S,J=J*i-I*D,T=T*V-O*A;if(0<=N&&0<=T&&0<=J){m=!1;break a}}m=!0}}if(m){f.push([a[g[l]],
+a[g[j]],a[g[k]]]);h.push([g[l],g[j],g[k]]);for(l=j,k=j+1;k<e;l++,k++)g[l]=g[k];e--;p=2*e}}return d?h:f};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,d,e){THREE.Geometry.call(this);this.radius=a||100;this.tube=b||40;this.segmentsR=c||8;this.segmentsT=d||6;this.arc=e||2*Math.PI;e=new THREE.Vector3;a=[];b=[];for(c=0;c<=this.segmentsR;c++)for(d=0;d<=this.segmentsT;d++){var f=d/this.segmentsT*this.arc,g=2*c/this.segmentsR*Math.PI;e.x=this.radius*Math.cos(f);e.y=this.radius*Math.sin(f);var h=new THREE.Vector3;h.x=(this.radius+this.tube*Math.cos(g))*Math.cos(f);h.y=(this.radius+this.tube*Math.cos(g))*Math.sin(f);h.z=
-this.tube*Math.sin(g);this.vertices.push(new THREE.Vertex(h));a.push(new THREE.UV(d/this.segmentsT,1-c/this.segmentsR));b.push(h.clone().subSelf(e).normalize())}for(c=1;c<=this.segmentsR;c++)for(d=1;d<=this.segmentsT;d++){var e=(this.segmentsT+1)*c+d-1,f=(this.segmentsT+1)*(c-1)+d-1,g=(this.segmentsT+1)*(c-1)+d,h=(this.segmentsT+1)*c+d,i=new THREE.Face4(e,f,g,h,[b[e],b[f],b[g],b[h]]);i.normal.addSelf(b[e]);i.normal.addSelf(b[f]);i.normal.addSelf(b[g]);i.normal.addSelf(b[h]);i.normal.normalize();this.faces.push(i);
+this.tube*Math.sin(g);this.vertices.push(new THREE.Vertex(h));a.push(new THREE.UV(d/this.segmentsT,1-c/this.segmentsR));b.push(h.clone().subSelf(e).normalize())}for(c=1;c<=this.segmentsR;c++)for(d=1;d<=this.segmentsT;d++){var e=(this.segmentsT+1)*c+d-1,f=(this.segmentsT+1)*(c-1)+d-1,g=(this.segmentsT+1)*(c-1)+d,h=(this.segmentsT+1)*c+d,l=new THREE.Face4(e,f,g,h,[b[e],b[f],b[g],b[h]]);l.normal.addSelf(b[e]);l.normal.addSelf(b[f]);l.normal.addSelf(b[g]);l.normal.addSelf(b[h]);l.normal.normalize();this.faces.push(l);
 this.faceVertexUvs[0].push([a[e].clone(),a[f].clone(),a[g].clone(),a[h].clone()])}this.computeCentroids()};THREE.TorusGeometry.prototype=new THREE.Geometry;THREE.TorusGeometry.prototype.constructor=THREE.TorusGeometry;
 THREE.TorusKnotGeometry=function(a,b,c,d,e,f,g){function h(a,b,c,d,e,f){var g=Math.cos(a);Math.cos(b);b=Math.sin(a);a*=c/d;c=Math.cos(a);g*=0.5*e*(2+c);b=0.5*e*(2+c)*b;e=0.5*f*e*Math.sin(a);return new THREE.Vector3(g,b,e)}THREE.Geometry.call(this);this.radius=a||200;this.tube=b||40;this.segmentsR=c||64;this.segmentsT=d||8;this.p=e||2;this.q=f||3;this.heightScale=g||1;this.grid=Array(this.segmentsR);c=new THREE.Vector3;d=new THREE.Vector3;e=new THREE.Vector3;for(a=0;a<this.segmentsR;++a){this.grid[a]=
-Array(this.segmentsT);for(b=0;b<this.segmentsT;++b){var i=2*(a/this.segmentsR)*this.p*Math.PI,g=2*(b/this.segmentsT)*Math.PI,f=h(i,g,this.q,this.p,this.radius,this.heightScale),i=h(i+0.01,g,this.q,this.p,this.radius,this.heightScale);c.sub(i,f);d.add(i,f);e.cross(c,d);d.cross(e,c);e.normalize();d.normalize();i=-this.tube*Math.cos(g);g=this.tube*Math.sin(g);f.x+=i*d.x+g*e.x;f.y+=i*d.y+g*e.y;f.z+=i*d.z+g*e.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,f=(b+1)%this.segmentsT,c=this.grid[a][b],d=this.grid[e][b],e=this.grid[e][f],f=this.grid[a][f],g=new THREE.UV(a/this.segmentsR,b/this.segmentsT),i=new THREE.UV((a+1)/this.segmentsR,b/this.segmentsT),m=new THREE.UV((a+1)/this.segmentsR,(b+1)/this.segmentsT),k=new THREE.UV(a/this.segmentsR,(b+1)/this.segmentsT);this.faces.push(new THREE.Face4(c,d,e,f));this.faceVertexUvs[0].push([g,i,m,k])}this.computeCentroids();this.computeFaceNormals();
+Array(this.segmentsT);for(b=0;b<this.segmentsT;++b){var l=2*(a/this.segmentsR)*this.p*Math.PI,g=2*(b/this.segmentsT)*Math.PI,f=h(l,g,this.q,this.p,this.radius,this.heightScale),l=h(l+0.01,g,this.q,this.p,this.radius,this.heightScale);c.sub(l,f);d.add(l,f);e.cross(c,d);d.cross(e,c);e.normalize();d.normalize();l=-this.tube*Math.cos(g);g=this.tube*Math.sin(g);f.x+=l*d.x+g*e.x;f.y+=l*d.y+g*e.y;f.z+=l*d.z+g*e.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,f=(b+1)%this.segmentsT,c=this.grid[a][b],d=this.grid[e][b],e=this.grid[e][f],f=this.grid[a][f],g=new THREE.UV(a/this.segmentsR,b/this.segmentsT),l=new THREE.UV((a+1)/this.segmentsR,b/this.segmentsT),j=new THREE.UV((a+1)/this.segmentsR,(b+1)/this.segmentsT),k=new THREE.UV(a/this.segmentsR,(b+1)/this.segmentsT);this.faces.push(new THREE.Face4(c,d,e,f));this.faceVertexUvs[0].push([g,l,j,k])}this.computeCentroids();this.computeFaceNormals();
 this.computeVertexNormals()};THREE.TorusKnotGeometry.prototype=new THREE.Geometry;THREE.TorusKnotGeometry.prototype.constructor=THREE.TorusKnotGeometry;
-THREE.TubeGeometry=function(a,b,c,d,e,f){THREE.Geometry.call(this);this.path=a;this.segments=b||64;this.radius=c||1;this.segmentsRadius=d||8;this.closed=e||!1;if(f)this.debug=new THREE.Object3D;this.grid=[];var b=new THREE.Vector3,g=new THREE.Vector3,h=new THREE.Vector3,b=new THREE.Vector3,g=new THREE.Matrix4,d=[],f=[],i=[],m=this.segments+1,k,p,n,o;this.tangents=d;this.normals=f;this.binormals=i;for(a=0;a<m;a++)h=a/(m-1),d[a]=this.path.getTangentAt(h),d[a].normalize();f[0]=new THREE.Vector3;i[0]=
-new THREE.Vector3;a=Number.MAX_VALUE;h=Math.abs(d[0].x);k=Math.abs(d[0].y);p=Math.abs(d[0].z);h<=a&&(a=h,b.set(1,0,0));k<=a&&(a=k,b.set(0,1,0));p<=a&&b.set(0,0,1);f[0].cross(d[0],b);i[0].cross(d[0],f[0]);for(a=1;a<m;a++)f[a]=f[a-1].clone(),i[a]=i[a-1].clone(),b.cross(d[a-1],d[a]),1.0E-4<b.length()&&(b.normalize(),h=Math.acos(d[a-1].dot(d[a])),g.setRotationAxis(b,h).multiplyVector3(f[a])),i[a].cross(d[a],f[a]);if(this.closed){h=Math.acos(f[0].dot(f[m-1]));h/=m-1;0<d[0].dot(b.cross(f[0],f[m-1]))&&(h=
--h);for(a=1;a<m;a++)g.setRotationAxis(d[a],h*a).multiplyVector3(f[a]),i[a].cross(d[a],f[a])}for(a=0;a<m;a++){this.grid[a]=[];h=a/(m-1);k=this.path.getPointAt(h);b=d[a];g=f[a];h=i[a];this.debug&&(this.debug.add(new THREE.ArrowHelper(b,k,c,255)),this.debug.add(new THREE.ArrowHelper(g,k,c,16711680)),this.debug.add(new THREE.ArrowHelper(h,k,c,65280)));for(b=0;b<this.segmentsRadius;b++)n=2*(b/this.segmentsRadius)*Math.PI,p=-this.radius*Math.cos(n),n=this.radius*Math.sin(n),o=(new THREE.Vector3).copy(k),
-o.x+=p*g.x+n*h.x,o.y+=p*g.y+n*h.y,o.z+=p*g.z+n*h.z,this.grid[a][b]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(o.x,o.y,o.z)))-1}for(a=0;a<this.segments;a++)for(b=0;b<this.segmentsRadius;b++)f=e?(a+1)%this.segments:a+1,i=(b+1)%this.segmentsRadius,c=this.grid[a][b],d=this.grid[f][b],f=this.grid[f][i],i=this.grid[a][i],m=new THREE.UV(a/this.segments,b/this.segmentsRadius),g=new THREE.UV((a+1)/this.segments,b/this.segmentsRadius),h=new THREE.UV((a+1)/this.segments,(b+1)/this.segmentsRadius),
-k=new THREE.UV(a/this.segments,(b+1)/this.segmentsRadius),this.faces.push(new THREE.Face4(c,d,f,i)),this.faceVertexUvs[0].push([m,g,h,k]);this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.TubeGeometry.prototype=new THREE.Geometry;THREE.TubeGeometry.prototype.constructor=THREE.TubeGeometry;
-THREE.PolyhedronGeometry=function(a,b,c,d){function e(a){var b=new THREE.Vertex(a.normalize());b.index=i.vertices.push(b)-1;var c=Math.atan2(a.z,-a.x)/2/Math.PI+0.5,a=Math.atan2(-a.y,Math.sqrt(a.x*a.x+a.z*a.z))/Math.PI+0.5;b.uv=new THREE.UV(c,a);return b}function f(a,b,c,d){1>d?(d=new THREE.Face3(a.index,b.index,c.index,[a.position.clone(),b.position.clone(),c.position.clone()]),d.centroid.addSelf(a.position).addSelf(b.position).addSelf(c.position).divideScalar(3),d.normal=d.centroid.clone().normalize(),
-i.faces.push(d),d=Math.atan2(d.centroid.z,-d.centroid.x),i.faceVertexUvs[0].push([h(a.uv,a.position,d),h(b.uv,b.position,d),h(c.uv,c.position,d)])):(d-=1,f(a,g(a,b),g(a,c),d),f(g(a,b),b,g(b,c),d),f(g(a,c),g(b,c),c,d),f(g(a,b),g(b,c),g(a,c),d))}function g(a,b){p[a.index]||(p[a.index]=[]);p[b.index]||(p[b.index]=[]);var c=p[a.index][b.index];void 0===c&&(p[a.index][b.index]=p[b.index][a.index]=c=e((new THREE.Vector3).add(a.position,b.position).divideScalar(2)));return c}function h(a,b,c){0>c&&1===a.u&&
-(a=new THREE.UV(a.u-1,a.v));0===b.x&&0===b.z&&(a=new THREE.UV(c/2/Math.PI+0.5,a.v));return a}THREE.Geometry.call(this);for(var c=c||1,d=d||0,i=this,m=0,k=a.length;m<k;m++)e(new THREE.Vector3(a[m][0],a[m][1],a[m][2]));for(var p=[],a=this.vertices,m=0,k=b.length;m<k;m++)f(a[b[m][0]],a[b[m][1]],a[b[m][2]],d);this.mergeVertices();m=0;for(k=this.vertices.length;m<k;m++)this.vertices[m].position.multiplyScalar(c);this.computeCentroids();this.boundingSphere={radius:c}};
+THREE.TubeGeometry=function(a,b,c,d,e,f){THREE.Geometry.call(this);this.path=a;this.segments=b||64;this.radius=c||1;this.segmentsRadius=d||8;this.closed=e||!1;if(f)this.debug=new THREE.Object3D;this.grid=[];var b=new THREE.Vector3,g=new THREE.Vector3,h=new THREE.Vector3,b=new THREE.Vector3,g=new THREE.Matrix4,d=[],f=[],l=[],j=this.segments+1,k,p,m,o;this.tangents=d;this.normals=f;this.binormals=l;for(a=0;a<j;a++)h=a/(j-1),d[a]=this.path.getTangentAt(h),d[a].normalize();f[0]=new THREE.Vector3;l[0]=
+new THREE.Vector3;a=Number.MAX_VALUE;h=Math.abs(d[0].x);k=Math.abs(d[0].y);p=Math.abs(d[0].z);h<=a&&(a=h,b.set(1,0,0));k<=a&&(a=k,b.set(0,1,0));p<=a&&b.set(0,0,1);f[0].cross(d[0],b);l[0].cross(d[0],f[0]);for(a=1;a<j;a++)f[a]=f[a-1].clone(),l[a]=l[a-1].clone(),b.cross(d[a-1],d[a]),1.0E-4<b.length()&&(b.normalize(),h=Math.acos(d[a-1].dot(d[a])),g.makeRotationAxis(b,h).multiplyVector3(f[a])),l[a].cross(d[a],f[a]);if(this.closed){h=Math.acos(f[0].dot(f[j-1]));h/=j-1;0<d[0].dot(b.cross(f[0],f[j-1]))&&
+(h=-h);for(a=1;a<j;a++)g.makeRotationAxis(d[a],h*a).multiplyVector3(f[a]),l[a].cross(d[a],f[a])}for(a=0;a<j;a++){this.grid[a]=[];h=a/(j-1);k=this.path.getPointAt(h);b=d[a];g=f[a];h=l[a];this.debug&&(this.debug.add(new THREE.ArrowHelper(b,k,c,255)),this.debug.add(new THREE.ArrowHelper(g,k,c,16711680)),this.debug.add(new THREE.ArrowHelper(h,k,c,65280)));for(b=0;b<this.segmentsRadius;b++)m=2*(b/this.segmentsRadius)*Math.PI,p=-this.radius*Math.cos(m),m=this.radius*Math.sin(m),o=(new THREE.Vector3).copy(k),
+o.x+=p*g.x+m*h.x,o.y+=p*g.y+m*h.y,o.z+=p*g.z+m*h.z,this.grid[a][b]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(o.x,o.y,o.z)))-1}for(a=0;a<this.segments;a++)for(b=0;b<this.segmentsRadius;b++)f=e?(a+1)%this.segments:a+1,l=(b+1)%this.segmentsRadius,c=this.grid[a][b],d=this.grid[f][b],f=this.grid[f][l],l=this.grid[a][l],j=new THREE.UV(a/this.segments,b/this.segmentsRadius),g=new THREE.UV((a+1)/this.segments,b/this.segmentsRadius),h=new THREE.UV((a+1)/this.segments,(b+1)/this.segmentsRadius),
+k=new THREE.UV(a/this.segments,(b+1)/this.segmentsRadius),this.faces.push(new THREE.Face4(c,d,f,l)),this.faceVertexUvs[0].push([j,g,h,k]);this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.TubeGeometry.prototype=new THREE.Geometry;THREE.TubeGeometry.prototype.constructor=THREE.TubeGeometry;
+THREE.PolyhedronGeometry=function(a,b,c,d){function e(a){var b=new THREE.Vertex(a.normalize());b.index=l.vertices.push(b)-1;var c=Math.atan2(a.z,-a.x)/2/Math.PI+0.5,a=Math.atan2(-a.y,Math.sqrt(a.x*a.x+a.z*a.z))/Math.PI+0.5;b.uv=new THREE.UV(c,a);return b}function f(a,b,c,d){1>d?(d=new THREE.Face3(a.index,b.index,c.index,[a.position.clone(),b.position.clone(),c.position.clone()]),d.centroid.addSelf(a.position).addSelf(b.position).addSelf(c.position).divideScalar(3),d.normal=d.centroid.clone().normalize(),
+l.faces.push(d),d=Math.atan2(d.centroid.z,-d.centroid.x),l.faceVertexUvs[0].push([h(a.uv,a.position,d),h(b.uv,b.position,d),h(c.uv,c.position,d)])):(d-=1,f(a,g(a,b),g(a,c),d),f(g(a,b),b,g(b,c),d),f(g(a,c),g(b,c),c,d),f(g(a,b),g(b,c),g(a,c),d))}function g(a,b){p[a.index]||(p[a.index]=[]);p[b.index]||(p[b.index]=[]);var c=p[a.index][b.index];void 0===c&&(p[a.index][b.index]=p[b.index][a.index]=c=e((new THREE.Vector3).add(a.position,b.position).divideScalar(2)));return c}function h(a,b,c){0>c&&1===a.u&&
+(a=new THREE.UV(a.u-1,a.v));0===b.x&&0===b.z&&(a=new THREE.UV(c/2/Math.PI+0.5,a.v));return a}THREE.Geometry.call(this);for(var c=c||1,d=d||0,l=this,j=0,k=a.length;j<k;j++)e(new THREE.Vector3(a[j][0],a[j][1],a[j][2]));for(var p=[],a=this.vertices,j=0,k=b.length;j<k;j++)f(a[b[j][0]],a[b[j][1]],a[b[j][2]],d);this.mergeVertices();j=0;for(k=this.vertices.length;j<k;j++)this.vertices[j].position.multiplyScalar(c);this.computeCentroids();this.boundingSphere={radius:c}};
 THREE.PolyhedronGeometry.prototype=new THREE.Geometry;THREE.PolyhedronGeometry.prototype.constructor=THREE.PolyhedronGeometry;
 THREE.IcosahedronGeometry=function(a,b){var c=(1+Math.sqrt(5))/2;THREE.PolyhedronGeometry.call(this,[[-1,c,0],[1,c,0],[-1,-c,0],[1,-c,0],[0,-1,c],[0,1,c],[0,-1,-c],[0,1,-c],[c,0,-1],[c,0,1],[-c,0,-1],[-c,0,1]],[[0,11,5],[0,5,1],[0,1,7],[0,7,10],[0,10,11],[1,5,9],[5,11,4],[11,10,2],[10,7,6],[7,1,8],[3,9,4],[3,4,2],[3,2,6],[3,6,8],[3,8,9],[4,9,5],[2,4,11],[6,2,10],[8,6,7],[9,8,1]],a,b)};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;
 THREE.OctahedronGeometry=function(a,b){THREE.PolyhedronGeometry.call(this,[[1,0,0],[-1,0,0],[0,1,0],[0,-1,0],[0,0,1],[0,0,-1]],[[0,2,4],[0,4,3],[0,3,5],[0,5,2],[1,2,5],[1,5,3],[1,3,4],[1,4,2]],a,b)};THREE.OctahedronGeometry.prototype=new THREE.Geometry;THREE.OctahedronGeometry.prototype.constructor=THREE.OctahedronGeometry;THREE.TetrahedronGeometry=function(a,b){THREE.PolyhedronGeometry.call(this,[[1,1,1],[-1,-1,1],[-1,1,-1],[1,-1,-1]],[[2,1,0],[0,3,2],[1,3,0],[2,3,1]],a,b)};
@@ -602,7 +605,7 @@ THREE.TetrahedronGeometry.prototype=new THREE.Geometry;THREE.TetrahedronGeometry
 THREE.AxisHelper=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;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.AxisHelper.prototype=new THREE.Object3D;THREE.AxisHelper.prototype.constructor=THREE.AxisHelper;
 THREE.ArrowHelper=function(a,b,c,d){THREE.Object3D.call(this);void 0===d&&(d=16776960);void 0===c&&(c=20);var e=new THREE.Geometry;e.vertices.push(new THREE.Vertex(new THREE.Vector3(0,0,0)));e.vertices.push(new THREE.Vertex(new THREE.Vector3(0,1,0)));this.line=new THREE.Line(e,new THREE.LineBasicMaterial({color:d}));this.add(this.line);e=new THREE.CylinderGeometry(0,0.05,0.25,5,1);this.cone=new THREE.Mesh(e,new THREE.MeshBasicMaterial({color:d}));this.cone.position.set(0,1,0);this.add(this.cone);
-if(b instanceof THREE.Vector3)this.position=b;this.setDirection(a);this.setLength(c)};THREE.ArrowHelper.prototype=new THREE.Object3D;THREE.ArrowHelper.prototype.constructor=THREE.ArrowHelper;THREE.ArrowHelper.prototype.setDirection=function(a){var b=(new THREE.Vector3(0,1,0)).crossSelf(a),a=Math.acos((new THREE.Vector3(0,1,0)).dot(a.clone().normalize()));this.matrix=(new THREE.Matrix4).setRotationAxis(b.normalize(),a);this.rotation.getRotationFromMatrix(this.matrix,this.scale)};
+if(b instanceof THREE.Vector3)this.position=b;this.setDirection(a);this.setLength(c)};THREE.ArrowHelper.prototype=new THREE.Object3D;THREE.ArrowHelper.prototype.constructor=THREE.ArrowHelper;THREE.ArrowHelper.prototype.setDirection=function(a){var b=(new THREE.Vector3(0,1,0)).crossSelf(a),a=Math.acos((new THREE.Vector3(0,1,0)).dot(a.clone().normalize()));this.matrix=(new THREE.Matrix4).makeRotationAxis(b.normalize(),a);this.rotation.getRotationFromMatrix(this.matrix,this.scale)};
 THREE.ArrowHelper.prototype.setLength=function(a){this.scale.set(a,a,a)};THREE.ArrowHelper.prototype.setColor=function(a){this.line.material.color.setHex(a);this.cone.material.color.setHex(a)};
 THREE.CameraHelper=function(a){function b(a,b,d){c(a,d);c(b,d)}function c(a,b){d.lineGeometry.vertices.push(new THREE.Vertex(new THREE.Vector3));d.lineGeometry.colors.push(new THREE.Color(b));void 0===d.pointMap[a]&&(d.pointMap[a]=[]);d.pointMap[a].push(d.lineGeometry.vertices.length-1)}THREE.Object3D.call(this);var d=this;this.lineGeometry=new THREE.Geometry;this.lineMaterial=new THREE.LineBasicMaterial({color:16777215,vertexColors:THREE.FaceColors});this.pointMap={};b("n1","n2",16755200);b("n2",
 "n4",16755200);b("n4","n3",16755200);b("n3","n1",16755200);b("f1","f2",16755200);b("f2","f4",16755200);b("f4","f3",16755200);b("f3","f1",16755200);b("n1","f1",16755200);b("n2","f2",16755200);b("n3","f3",16755200);b("n4","f4",16755200);b("p","n1",16711680);b("p","n2",16711680);b("p","n3",16711680);b("p","n4",16711680);b("u1","u2",43775);b("u2","u3",43775);b("u3","u1",43775);b("c","t",16777215);b("p","c",3355443);b("cn1","cn2",3355443);b("cn3","cn4",3355443);b("cf1","cf2",3355443);b("cf3","cf4",3355443);
@@ -610,180 +613,181 @@ this.camera=a;this.update(a);this.lines=new THREE.Line(this.lineGeometry,this.li
 THREE.CameraHelper.prototype.update=function(){function a(a,d,e,f){THREE.CameraHelper.__v.set(d,e,f);THREE.CameraHelper.__projector.unprojectVector(THREE.CameraHelper.__v,THREE.CameraHelper.__c);a=b.pointMap[a];if(void 0!==a){d=0;for(e=a.length;d<e;d++)b.lineGeometry.vertices[a[d]].position.copy(THREE.CameraHelper.__v)}}var b=this;THREE.CameraHelper.__c.projectionMatrix.copy(this.camera.projectionMatrix);a("c",0,0,-1);a("t",0,0,1);a("n1",-1,-1,-1);a("n2",1,-1,-1);a("n3",-1,1,-1);a("n4",1,1,-1);a("f1",
 -1,-1,1);a("f2",1,-1,1);a("f3",-1,1,1);a("f4",1,1,1);a("u1",0.7,1.1,-1);a("u2",-0.7,1.1,-1);a("u3",0,2,-1);a("cf1",-1,0,1);a("cf2",1,0,1);a("cf3",0,-1,1);a("cf4",0,1,1);a("cn1",-1,0,-1);a("cn2",1,0,-1);a("cn3",0,-1,-1);a("cn4",0,1,-1);this.lineGeometry.__dirtyVertices=!0};THREE.CameraHelper.__projector=new THREE.Projector;THREE.CameraHelper.__v=new THREE.Vector3;THREE.CameraHelper.__c=new THREE.Camera;
 THREE.SubdivisionModifier=function(a){this.subdivisions=void 0===a?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;0<b--;)this.smooth(a)};
-THREE.SubdivisionModifier.prototype.smooth=function(a){function b(a,b,c,d,h,l){var i=new THREE.Face4(a,b,c,d,null,h.color,h.material);if(g.useOldVertexColors){i.vertexColors=[];for(var k,m,o,p=0;4>p;p++){o=l[p];k=new THREE.Color;k.setRGB(0,0,0);for(var q=0;q<o.length;q++)m=h.vertexColors[o[q]-1],k.r+=m.r,k.g+=m.g,k.b+=m.b;k.r/=o.length;k.g/=o.length;k.b/=o.length;i.vertexColors[p]=k}}e.push(i);(!g.supportUVs||0!=n.length)&&f.push([n[a],n[b],n[c],n[d]])}function c(a,b){return Math.min(a,b)+"_"+Math.max(a,
-b)}var d=[],e=[],f=[],g=this,h=a.vertices,d=a.faces,i=h.concat(),m=[],k={},p={},n=[],o,q,l,r,s,u=a.faceVertexUvs[0];for(o=0,q=u.length;o<q;o++)for(l=0,r=u[o].length;l<r;l++)s=d[o]["abcd".charAt(l)],n[s]||(n[s]=u[o][l]);var v;for(o=0,q=d.length;o<q;o++)if(s=d[o],m.push(s.centroid),i.push(new THREE.Vertex(s.centroid)),g.supportUVs&&0!=n.length){v=new THREE.UV;if(s instanceof THREE.Face3)v.u=n[s.a].u+n[s.b].u+n[s.c].u,v.v=n[s.a].v+n[s.b].v+n[s.c].v,v.u/=3,v.v/=3;else if(s instanceof THREE.Face4)v.u=
-n[s.a].u+n[s.b].u+n[s.c].u+n[s.d].u,v.v=n[s.a].v+n[s.b].v+n[s.c].v+n[s.d].v,v.u/=4,v.v/=4;n.push(v)}q=function(a){function b(a,c,d){void 0===a[c]&&(a[c]=[]);a[c].push(d)}var d,e,f,g,h={};for(d=0,e=a.faces.length;d<e;d++)f=a.faces[d],f instanceof THREE.Face3?(g=c(f.a,f.b),b(h,g,d),g=c(f.b,f.c),b(h,g,d),g=c(f.c,f.a),b(h,g,d)):f instanceof THREE.Face4&&(g=c(f.a,f.b),b(h,g,d),g=c(f.b,f.c),b(h,g,d),g=c(f.c,f.d),b(h,g,d),g=c(f.d,f.a),b(h,g,d));return h}(a);var t=0,u=h.length,w,A,G={},F={},D=function(a,
-b){void 0===G[a]&&(G[a]=[]);G[a].push(b)},J=function(a,b){void 0===F[a]&&(F[a]={});F[a][b]=null};for(o in q){v=q[o];w=o.split("_");A=w[0];w=w[1];D(A,[A,w]);D(w,[A,w]);for(l=0,r=v.length;l<r;l++)s=v[l],J(A,s,o),J(w,s,o);2>v.length&&(p[o]=!0)}for(o in q)if(v=q[o],s=v[0],v=v[1],w=o.split("_"),A=w[0],w=w[1],r=new THREE.Vector3,p[o]?(r.addSelf(h[A].position),r.addSelf(h[w].position),r.multiplyScalar(0.5)):(r.addSelf(m[s]),r.addSelf(m[v]),r.addSelf(h[A].position),r.addSelf(h[w].position),r.multiplyScalar(0.25)),
-k[o]=u+d.length+t,i.push(new THREE.Vertex(r)),t++,g.supportUVs&&0!=n.length)v=new THREE.UV,v.u=n[A].u+n[w].u,v.v=n[A].v+n[w].v,v.u/=2,v.v/=2,n.push(v);var O,P;w=["123","12","2","23"];r=["123","23","3","31"];var D=["123","31","1","12"],J=["1234","12","2","23"],U=["1234","23","3","34"],L=["1234","34","4","41"],I=["1234","41","1","12"];for(o=0,q=m.length;o<q;o++)s=d[o],v=u+o,s instanceof THREE.Face3?(t=c(s.a,s.b),A=c(s.b,s.c),O=c(s.c,s.a),b(v,k[t],s.b,k[A],s,w),b(v,k[A],s.c,k[O],s,r),b(v,k[O],s.a,k[t],
-s,D)):s instanceof THREE.Face4?(t=c(s.a,s.b),A=c(s.b,s.c),O=c(s.c,s.d),P=c(s.d,s.a),b(v,k[t],s.b,k[A],s,J),b(v,k[A],s.c,k[O],s,U),b(v,k[O],s.d,k[P],s,L),b(v,k[P],s.a,k[t],s,I)):console.log("face should be a face!",s);d=i;i=new THREE.Vector3;k=new THREE.Vector3;for(o=0,q=h.length;o<q;o++)if(void 0!==G[o]){i.set(0,0,0);k.set(0,0,0);s=new THREE.Vector3(0,0,0);v=0;for(l in F[o])i.addSelf(m[l]),v++;t=0;u=G[o].length;for(l=0;l<u;l++)p[c(G[o][l][0],G[o][l][1])]&&t++;if(2!=t){i.divideScalar(v);for(l=0;l<
-u;l++)v=G[o][l],v=h[v[0]].position.clone().addSelf(h[v[1]].position).divideScalar(2),k.addSelf(v);k.divideScalar(u);s.addSelf(h[o].position);s.multiplyScalar(u-3);s.addSelf(i);s.addSelf(k.multiplyScalar(2));s.divideScalar(u);d[o].position=s}}a.vertices=d;a.faces=e;a.faceVertexUvs[0]=f;delete a.__tmpVertices;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals()};
+THREE.SubdivisionModifier.prototype.smooth=function(a){function b(a,b,c,d,h,j){var k=new THREE.Face4(a,b,c,d,null,h.color,h.material);if(g.useOldVertexColors){k.vertexColors=[];for(var l,n,o,p=0;4>p;p++){o=j[p];l=new THREE.Color;l.setRGB(0,0,0);for(var r=0;r<o.length;r++)n=h.vertexColors[o[r]-1],l.r+=n.r,l.g+=n.g,l.b+=n.b;l.r/=o.length;l.g/=o.length;l.b/=o.length;k.vertexColors[p]=l}}e.push(k);(!g.supportUVs||0!=m.length)&&f.push([m[a],m[b],m[c],m[d]])}function c(a,b){return Math.min(a,b)+"_"+Math.max(a,
+b)}var d=[],e=[],f=[],g=this,h=a.vertices,d=a.faces,l=h.concat(),j=[],k={},p={},m=[],o,r,n,q,s,u=a.faceVertexUvs[0];for(o=0,r=u.length;o<r;o++)for(n=0,q=u[o].length;n<q;n++)s=d[o]["abcd".charAt(n)],m[s]||(m[s]=u[o][n]);var v;for(o=0,r=d.length;o<r;o++)if(s=d[o],j.push(s.centroid),l.push(new THREE.Vertex(s.centroid)),g.supportUVs&&0!=m.length){v=new THREE.UV;if(s instanceof THREE.Face3)v.u=m[s.a].u+m[s.b].u+m[s.c].u,v.v=m[s.a].v+m[s.b].v+m[s.c].v,v.u/=3,v.v/=3;else if(s instanceof THREE.Face4)v.u=
+m[s.a].u+m[s.b].u+m[s.c].u+m[s.d].u,v.v=m[s.a].v+m[s.b].v+m[s.c].v+m[s.d].v,v.u/=4,v.v/=4;m.push(v)}r=function(a){function b(a,c,d){void 0===a[c]&&(a[c]=[]);a[c].push(d)}var d,e,f,g,h={};for(d=0,e=a.faces.length;d<e;d++)f=a.faces[d],f instanceof THREE.Face3?(g=c(f.a,f.b),b(h,g,d),g=c(f.b,f.c),b(h,g,d),g=c(f.c,f.a),b(h,g,d)):f instanceof THREE.Face4&&(g=c(f.a,f.b),b(h,g,d),g=c(f.b,f.c),b(h,g,d),g=c(f.c,f.d),b(h,g,d),g=c(f.d,f.a),b(h,g,d));return h}(a);var t=0,u=h.length,w,z,F={},C={},G=function(a,
+b){void 0===F[a]&&(F[a]=[]);F[a].push(b)},K=function(a,b){void 0===C[a]&&(C[a]={});C[a][b]=null};for(o in r){v=r[o];w=o.split("_");z=w[0];w=w[1];G(z,[z,w]);G(w,[z,w]);for(n=0,q=v.length;n<q;n++)s=v[n],K(z,s,o),K(w,s,o);2>v.length&&(p[o]=!0)}for(o in r)if(v=r[o],s=v[0],v=v[1],w=o.split("_"),z=w[0],w=w[1],q=new THREE.Vector3,p[o]?(q.addSelf(h[z].position),q.addSelf(h[w].position),q.multiplyScalar(0.5)):(q.addSelf(j[s]),q.addSelf(j[v]),q.addSelf(h[z].position),q.addSelf(h[w].position),q.multiplyScalar(0.25)),
+k[o]=u+d.length+t,l.push(new THREE.Vertex(q)),t++,g.supportUVs&&0!=m.length)v=new THREE.UV,v.u=m[z].u+m[w].u,v.v=m[z].v+m[w].v,v.u/=2,v.v/=2,m.push(v);var N,P;w=["123","12","2","23"];q=["123","23","3","31"];var G=["123","31","1","12"],K=["1234","12","2","23"],T=["1234","23","3","34"],O=["1234","34","4","41"],J=["1234","41","1","12"];for(o=0,r=j.length;o<r;o++)s=d[o],v=u+o,s instanceof THREE.Face3?(t=c(s.a,s.b),z=c(s.b,s.c),N=c(s.c,s.a),b(v,k[t],s.b,k[z],s,w),b(v,k[z],s.c,k[N],s,q),b(v,k[N],s.a,k[t],
+s,G)):s instanceof THREE.Face4?(t=c(s.a,s.b),z=c(s.b,s.c),N=c(s.c,s.d),P=c(s.d,s.a),b(v,k[t],s.b,k[z],s,K),b(v,k[z],s.c,k[N],s,T),b(v,k[N],s.d,k[P],s,O),b(v,k[P],s.a,k[t],s,J)):console.log("face should be a face!",s);d=l;l=new THREE.Vector3;k=new THREE.Vector3;for(o=0,r=h.length;o<r;o++)if(void 0!==F[o]){l.set(0,0,0);k.set(0,0,0);s=new THREE.Vector3(0,0,0);v=0;for(n in C[o])l.addSelf(j[n]),v++;t=0;u=F[o].length;for(n=0;n<u;n++)p[c(F[o][n][0],F[o][n][1])]&&t++;if(2!=t){l.divideScalar(v);for(n=0;n<
+u;n++)v=F[o][n],v=h[v[0]].position.clone().addSelf(h[v[1]].position).divideScalar(2),k.addSelf(v);k.divideScalar(u);s.addSelf(h[o].position);s.multiplyScalar(u-3);s.addSelf(l);s.addSelf(k.multiplyScalar(2));s.divideScalar(u);d[o].position=s}}a.vertices=d;a.faces=e;a.faceVertexUvs[0]=f;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,crossOrigin:"anonymous",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?b+((100*a.loaded/
 a.total).toFixed(0)+"%"):b+((a.loaded/1E3).toFixed(2)+" KB");this.statusDomElement.innerHTML=b},extractUrlBase:function(a){a=a.split("/");a.pop();return(1>a.length?".":a.join("/"))+"/"},initMaterials:function(a,b,c){a.materials=[];for(var d=0;d<b.length;++d)a.materials[d]=THREE.Loader.prototype.createMaterial(b[d],c)},hasNormals:function(a){var b,c,d=a.materials.length;for(c=0;c<d;c++)if(b=a.materials[c],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 d(a){a=Math.log(a)/Math.LN2;return Math.pow(2,Math.round(a))}function e(a,b){var e=new Image;e.onload=function(){if(!c(this.width)||!c(this.height)){var b=d(this.width),e=d(this.height);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.crossOrigin=h.crossOrigin;e.src=b}function f(a,c,d,f,g,h){var i=document.createElement("canvas");a[c]=new THREE.Texture(i);a[c].sourceFile=d;
-if(f){a[c].repeat.set(f[0],f[1]);if(1!=f[0])a[c].wrapS=THREE.RepeatWrapping;if(1!=f[1])a[c].wrapT=THREE.RepeatWrapping}g&&a[c].offset.set(g[0],g[1]);if(h){f={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(void 0!==f[h[0]])a[c].wrapS=f[h[0]];if(void 0!==f[h[1]])a[c].wrapT=f[h[1]]}e(a[c],b+"/"+d)}function g(a){return(255*a[0]<<16)+(255*a[1]<<8)+255*a[2]}var h=this,i="MeshLambertMaterial",m={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:a.wireframe};if(a.shading){var k=
-a.shading.toLowerCase();"phong"===k?i="MeshPhongMaterial":"basic"===k&&(i="MeshBasicMaterial")}if(void 0!==a.blending&&void 0!==THREE[a.blending])m.blending=THREE[a.blending];if(void 0!==a.transparent||1>a.opacity)m.transparent=a.transparent;if(void 0!==a.depthTest)m.depthTest=a.depthTest;if(void 0!==a.depthWrite)m.depthWrite=a.depthWrite;if(void 0!==a.vertexColors)if("face"==a.vertexColors)m.vertexColors=THREE.FaceColors;else if(a.vertexColors)m.vertexColors=THREE.VertexColors;if(a.colorDiffuse)m.color=
-g(a.colorDiffuse);else if(a.DbgColor)m.color=a.DbgColor;if(a.colorSpecular)m.specular=g(a.colorSpecular);if(a.colorAmbient)m.ambient=g(a.colorAmbient);if(a.transparency)m.opacity=a.transparency;if(a.specularCoef)m.shininess=a.specularCoef;a.mapDiffuse&&b&&f(m,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap);a.mapLight&&b&&f(m,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap);a.mapNormal&&b&&f(m,"normalMap",a.mapNormal,a.mapNormalRepeat,a.mapNormalOffset,
-a.mapNormalWrap);a.mapSpecular&&b&&f(m,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){i=THREE.ShaderUtils.lib.normal;k=THREE.UniformsUtils.clone(i.uniforms);k.tNormal.texture=m.normalMap;if(a.mapNormalFactor)k.uNormalScale.value=a.mapNormalFactor;if(m.map)k.tDiffuse.texture=m.map,k.enableDiffuse.value=!0;if(m.specularMap)k.tSpecular.texture=m.specularMap,k.enableSpecular.value=!0;if(m.lightMap)k.tAO.texture=m.lightMap,k.enableAO.value=!0;k.uDiffuseColor.value.setHex(m.color);
-k.uSpecularColor.value.setHex(m.specular);k.uAmbientColor.value.setHex(m.ambient);k.uShininess.value=m.shininess;if(void 0!==m.opacity)k.uOpacity.value=m.opacity;m=new THREE.ShaderMaterial({fragmentShader:i.fragmentShader,vertexShader:i.vertexShader,uniforms:k,lights:!0,fog:!0})}else m=new THREE[i](m);if(void 0!==a.DbgName)m.name=a.DbgName;return m}};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;
+Math.log(a)/Math.LN2;return Math.floor(a)==a}function d(a){a=Math.log(a)/Math.LN2;return Math.pow(2,Math.round(a))}function e(a,b){var e=new Image;e.onload=function(){if(!c(this.width)||!c(this.height)){var b=d(this.width),e=d(this.height);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.crossOrigin=h.crossOrigin;e.src=b}function f(a,c,d,f,g,h){var j=document.createElement("canvas");a[c]=new THREE.Texture(j);a[c].sourceFile=d;
+if(f){a[c].repeat.set(f[0],f[1]);if(1!=f[0])a[c].wrapS=THREE.RepeatWrapping;if(1!=f[1])a[c].wrapT=THREE.RepeatWrapping}g&&a[c].offset.set(g[0],g[1]);if(h){f={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(void 0!==f[h[0]])a[c].wrapS=f[h[0]];if(void 0!==f[h[1]])a[c].wrapT=f[h[1]]}e(a[c],b+"/"+d)}function g(a){return(255*a[0]<<16)+(255*a[1]<<8)+255*a[2]}var h=this,l="MeshLambertMaterial",j={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:a.wireframe};if(a.shading){var k=
+a.shading.toLowerCase();"phong"===k?l="MeshPhongMaterial":"basic"===k&&(l="MeshBasicMaterial")}if(void 0!==a.blending&&void 0!==THREE[a.blending])j.blending=THREE[a.blending];if(void 0!==a.transparent||1>a.opacity)j.transparent=a.transparent;if(void 0!==a.depthTest)j.depthTest=a.depthTest;if(void 0!==a.depthWrite)j.depthWrite=a.depthWrite;if(void 0!==a.vertexColors)if("face"==a.vertexColors)j.vertexColors=THREE.FaceColors;else if(a.vertexColors)j.vertexColors=THREE.VertexColors;if(a.colorDiffuse)j.color=
+g(a.colorDiffuse);else if(a.DbgColor)j.color=a.DbgColor;if(a.colorSpecular)j.specular=g(a.colorSpecular);if(a.colorAmbient)j.ambient=g(a.colorAmbient);if(a.transparency)j.opacity=a.transparency;if(a.specularCoef)j.shininess=a.specularCoef;a.mapDiffuse&&b&&f(j,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap);a.mapLight&&b&&f(j,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap);a.mapNormal&&b&&f(j,"normalMap",a.mapNormal,a.mapNormalRepeat,a.mapNormalOffset,
+a.mapNormalWrap);a.mapSpecular&&b&&f(j,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){l=THREE.ShaderUtils.lib.normal;k=THREE.UniformsUtils.clone(l.uniforms);k.tNormal.texture=j.normalMap;if(a.mapNormalFactor)k.uNormalScale.value=a.mapNormalFactor;if(j.map)k.tDiffuse.texture=j.map,k.enableDiffuse.value=!0;if(j.specularMap)k.tSpecular.texture=j.specularMap,k.enableSpecular.value=!0;if(j.lightMap)k.tAO.texture=j.lightMap,k.enableAO.value=!0;k.uDiffuseColor.value.setHex(j.color);
+k.uSpecularColor.value.setHex(j.specular);k.uAmbientColor.value.setHex(j.ambient);k.uShininess.value=j.shininess;if(void 0!==j.opacity)k.uOpacity.value=j.opacity;j=new THREE.ShaderMaterial({fragmentShader:l.fragmentShader,vertexShader:l.vertexShader,uniforms:k,lights:!0,fog:!0})}else j=new THREE[l](j);if(void 0!==a.DbgName)j.name=a.DbgName;return j}};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,b,c,d){var c=c?c:this.extractUrlBase(a),d=d?d:this.extractUrlBase(a),e=this.showProgress?THREE.Loader.prototype.updateProgress:null;this.onLoadStart();this.loadAjaxJSON(this,a,b,c,d,e)};
 THREE.BinaryLoader.prototype.loadAjaxJSON=function(a,b,c,d,e,f){var g=new XMLHttpRequest;g.onreadystatechange=function(){if(4==g.readyState)if(200==g.status||0==g.status){var h=JSON.parse(g.responseText);a.loadAjaxBuffers(h,c,e,d,f)}else console.error("THREE.BinaryLoader: Couldn't load ["+b+"] ["+g.status+"]")};g.open("GET",b,!0);g.overrideMimeType&&g.overrideMimeType("text/plain; charset=x-user-defined");g.setRequestHeader("Content-Type","text/plain");g.send(null)};
 THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,b,c,d,e){var f=new XMLHttpRequest,g=c+"/"+a.buffers,h=0;f.onreadystatechange=function(){4==f.readyState?200==f.status||0==f.status?THREE.BinaryLoader.prototype.createBinModel(f.response,b,d,a.materials):console.error("THREE.BinaryLoader: Couldn't load ["+g+"] ["+f.status+"]"):3==f.readyState?e&&(0==h&&(h=f.getResponseHeader("Content-Length")),e({total:h,loaded:f.responseText.length})):2==f.readyState&&(h=f.getResponseHeader("Content-Length"))};
 f.open("GET",g,!0);f.responseType="arraybuffer";f.send(null)};
-THREE.BinaryLoader.prototype.createBinModel=function(a,b,c,d){var e=function(b){var c,e,i,m,k,p,n,o,q,l,r,s,u,v,t;function w(a){return a%4?4-a%4:0}function A(a,b){return(new Uint8Array(a,b,1))[0]}function G(a,b){return(new Uint32Array(a,b,1))[0]}function F(b,c){var d,e,f,g,h,l,j,i,k=new Uint32Array(a,c,3*b);for(d=0;d<b;d++){e=k[3*d];f=k[3*d+1];g=k[3*d+2];h=B[2*e];e=B[2*e+1];l=B[2*f];j=B[2*f+1];f=B[2*g];i=B[2*g+1];g=L.faceVertexUvs[0];var m=[];m.push(new THREE.UV(h,e));m.push(new THREE.UV(l,j));m.push(new THREE.UV(f,
-i));g.push(m)}}function D(b,c){var d,e,f,g,h,l,j,i,k,m,n=new Uint32Array(a,c,4*b);for(d=0;d<b;d++){e=n[4*d];f=n[4*d+1];g=n[4*d+2];h=n[4*d+3];l=B[2*e];e=B[2*e+1];j=B[2*f];k=B[2*f+1];i=B[2*g];m=B[2*g+1];g=B[2*h];f=B[2*h+1];h=L.faceVertexUvs[0];var o=[];o.push(new THREE.UV(l,e));o.push(new THREE.UV(j,k));o.push(new THREE.UV(i,m));o.push(new THREE.UV(g,f));h.push(o)}}function J(b,c,d){for(var e,f,g,h,c=new Uint32Array(a,c,3*b),l=new Uint16Array(a,d,b),d=0;d<b;d++)e=c[3*d],f=c[3*d+1],g=c[3*d+2],h=l[d],
-L.faces.push(new THREE.Face3(e,f,g,null,null,h))}function O(b,c,d){for(var e,f,g,h,l,c=new Uint32Array(a,c,4*b),j=new Uint16Array(a,d,b),d=0;d<b;d++)e=c[4*d],f=c[4*d+1],g=c[4*d+2],h=c[4*d+3],l=j[d],L.faces.push(new THREE.Face4(e,f,g,h,null,null,l))}function P(b,c,d,e){for(var f,g,h,l,j,i,k,c=new Uint32Array(a,c,3*b),d=new Uint32Array(a,d,3*b),m=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[3*e];g=c[3*e+1];h=c[3*e+2];j=d[3*e];i=d[3*e+1];k=d[3*e+2];l=m[e];var n=M[3*i],o=M[3*i+1];i=M[3*i+2];var p=M[3*k],q=
-M[3*k+1];k=M[3*k+2];L.faces.push(new THREE.Face3(f,g,h,[new THREE.Vector3(M[3*j],M[3*j+1],M[3*j+2]),new THREE.Vector3(n,o,i),new THREE.Vector3(p,q,k)],null,l))}}function U(b,c,d,e){for(var f,g,h,l,j,i,k,m,n,c=new Uint32Array(a,c,4*b),d=new Uint32Array(a,d,4*b),o=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[4*e];g=c[4*e+1];h=c[4*e+2];l=c[4*e+3];i=d[4*e];k=d[4*e+1];m=d[4*e+2];n=d[4*e+3];j=o[e];var p=M[3*k],q=M[3*k+1];k=M[3*k+2];var r=M[3*m],s=M[3*m+1];m=M[3*m+2];var t=M[3*n],u=M[3*n+1];n=M[3*n+2];L.faces.push(new THREE.Face4(f,
-g,h,l,[new THREE.Vector3(M[3*i],M[3*i+1],M[3*i+2]),new THREE.Vector3(p,q,k),new THREE.Vector3(r,s,m),new THREE.Vector3(t,u,n)],null,j))}}var L=this,I=0,M=[],B=[],j,T,C;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(L,d,b);(function(a,b,c){for(var a=new Uint8Array(a,b,c),d="",e=0;e<c;e++)d+=String.fromCharCode(a[b+e]);return d})(a,I,12);c=A(a,I+12);A(a,I+13);A(a,I+14);A(a,I+15);e=A(a,I+16);i=A(a,I+17);m=A(a,I+18);k=A(a,I+19);p=G(a,I+20);n=G(a,I+20+4);o=G(a,I+20+8);b=G(a,I+20+12);q=
-G(a,I+20+16);l=G(a,I+20+20);r=G(a,I+20+24);s=G(a,I+20+28);u=G(a,I+20+32);v=G(a,I+20+36);t=G(a,I+20+40);I+=c;c=3*e+k;C=4*e+k;j=b*c;T=q*(c+3*i);e=l*(c+3*m);k=r*(c+3*i+3*m);c=s*C;i=u*(C+4*i);m=v*(C+4*m);I+=function(b){var b=new Float32Array(a,b,3*p),c,d,e,f;for(c=0;c<p;c++)d=b[3*c],e=b[3*c+1],f=b[3*c+2],L.vertices.push(new THREE.Vertex(new THREE.Vector3(d,e,f)));return 3*p*Float32Array.BYTES_PER_ELEMENT}(I);I+=function(b){if(n){var b=new Int8Array(a,b,3*n),c,d,e,f;for(c=0;c<n;c++)d=b[3*c],e=b[3*c+1],
-f=b[3*c+2],M.push(d/127,e/127,f/127)}return 3*n*Int8Array.BYTES_PER_ELEMENT}(I);I+=w(3*n);I+=function(b){if(o){var b=new Float32Array(a,b,2*o),c,d,e;for(c=0;c<o;c++)d=b[2*c],e=b[2*c+1],B.push(d,e)}return 2*o*Float32Array.BYTES_PER_ELEMENT}(I);j=I+j+w(2*b);T=j+T+w(2*q);e=T+e+w(2*l);k=e+k+w(2*r);c=k+c+w(2*s);i=c+i+w(2*u);m=i+m+w(2*v);(function(a){if(l){var b=a+3*l*Uint32Array.BYTES_PER_ELEMENT;J(l,a,b+3*l*Uint32Array.BYTES_PER_ELEMENT);F(l,b)}})(T);(function(a){if(r){var b=a+3*r*Uint32Array.BYTES_PER_ELEMENT,
-c=b+3*r*Uint32Array.BYTES_PER_ELEMENT;P(r,a,b,c+3*r*Uint32Array.BYTES_PER_ELEMENT);F(r,c)}})(e);(function(a){if(v){var b=a+4*v*Uint32Array.BYTES_PER_ELEMENT;O(v,a,b+4*v*Uint32Array.BYTES_PER_ELEMENT);D(v,b)}})(i);(function(a){if(t){var b=a+4*t*Uint32Array.BYTES_PER_ELEMENT,c=b+4*t*Uint32Array.BYTES_PER_ELEMENT;U(t,a,b,c+4*t*Uint32Array.BYTES_PER_ELEMENT);D(t,c)}})(m);b&&J(b,I,I+3*b*Uint32Array.BYTES_PER_ELEMENT);(function(a){if(q){var b=a+3*q*Uint32Array.BYTES_PER_ELEMENT;P(q,a,b,b+3*q*Uint32Array.BYTES_PER_ELEMENT)}})(j);
-s&&O(s,k,k+4*s*Uint32Array.BYTES_PER_ELEMENT);(function(a){if(u){var b=a+4*u*Uint32Array.BYTES_PER_ELEMENT;U(u,a,b,b+4*u*Uint32Array.BYTES_PER_ELEMENT)}})(c);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};e.prototype=new THREE.Geometry;e.prototype.constructor=e;b(new e(c))};
-THREE.ColladaLoader=function(){function a(a,d,e){W=a;d=d||Sa;void 0!==e&&(a=e.split("/"),a.pop(),db=(1>a.length?".":a.join("/"))+"/");if((a=W.evaluate("//dae:asset",W,z,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&a.childNodes)for(e=0;e<a.childNodes.length;e++){var l=a.childNodes[e];switch(l.nodeName){case "unit":(l=l.getAttribute("meter"))&&parseFloat(l);break;case "up_axis":sa=l.textContent.charAt(0)}}if(!Oa.convertUpAxis||sa===Oa.upAxis)Wa=null;else switch(sa){case "X":Wa="Y"===
-Oa.upAxis?"XtoY":"XtoZ";break;case "Y":Wa="X"===Oa.upAxis?"YtoX":"YtoZ";break;case "Z":Wa="X"===Oa.upAxis?"ZtoX":"ZtoY"}Ka=b("//dae:library_images/dae:image",g,"image");bb=b("//dae:library_materials/dae:material",F,"material");jb=b("//dae:library_effects/dae:effect",U,"effect");ra=b("//dae:library_geometries/dae:geometry",r,"geometry");Va=b(".//dae:library_cameras/dae:camera",T,"camera");Ba=b("//dae:library_controllers/dae:controller",h,"controller");Aa=b("//dae:library_animations/dae:animation",
-I,"animation");eb=b(".//dae:library_visual_scenes/dae:visual_scene",k,"visual_scene");Ga=[];oa=[];(a=W.evaluate(".//dae:scene/dae:instance_visual_scene",W,z,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(a=a.getAttribute("url").replace(/^#/,""),ia=eb[0<a.length?a:"visual_scene0"]):ia=null;aa=new THREE.Object3D;for(a=0;a<ia.nodes.length;a++)aa.add(f(ia.nodes[a]));cb=[];c(aa);a={scene:aa,morphs:Ga,skins:oa,animations:cb,dae:{images:Ka,materials:bb,cameras:Va,effects:jb,geometries:ra,controllers:Ba,
-animations:Aa,visualScenes:eb,scene:ia}};d&&d(a);return a}function b(a,b,c){for(var a=W.evaluate(a,W,z,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null),d={},e=a.iterateNext(),f=0;e;){e=(new b).parse(e);if(!e.id||0==e.id.length)e.id=c+f++;d[e.id]=e;e=a.iterateNext()}return d}function c(a){var b=ia.getChildById(a.name,!0),d=null;if(b&&b.keys){d={fps:60,hierarchy:[{node:b,keys:b.keys,sids:b.sids}],node:a,name:"animation_"+a.name,length:0};cb.push(d);for(var e=0,f=b.keys.length;e<f;e++)d.length=Math.max(d.length,
+THREE.BinaryLoader.prototype.createBinModel=function(a,b,c,d){var e=function(b){var c,e,l,j,k,p,m,o,r,n,q,s,u,v,t;function w(a){return a%4?4-a%4:0}function z(a,b){return(new Uint8Array(a,b,1))[0]}function F(a,b){return(new Uint32Array(a,b,1))[0]}function C(b,c){var d,e,f,g,h,i,j,k,l=new Uint32Array(a,c,3*b);for(d=0;d<b;d++){e=l[3*d];f=l[3*d+1];g=l[3*d+2];h=D[2*e];e=D[2*e+1];i=D[2*f];j=D[2*f+1];f=D[2*g];k=D[2*g+1];g=O.faceVertexUvs[0];var m=[];m.push(new THREE.UV(h,e));m.push(new THREE.UV(i,j));m.push(new THREE.UV(f,
+k));g.push(m)}}function G(b,c){var d,e,f,g,h,i,j,k,l,m,n=new Uint32Array(a,c,4*b);for(d=0;d<b;d++){e=n[4*d];f=n[4*d+1];g=n[4*d+2];h=n[4*d+3];i=D[2*e];e=D[2*e+1];j=D[2*f];l=D[2*f+1];k=D[2*g];m=D[2*g+1];g=D[2*h];f=D[2*h+1];h=O.faceVertexUvs[0];var o=[];o.push(new THREE.UV(i,e));o.push(new THREE.UV(j,l));o.push(new THREE.UV(k,m));o.push(new THREE.UV(g,f));h.push(o)}}function K(b,c,d){for(var e,f,g,h,c=new Uint32Array(a,c,3*b),i=new Uint16Array(a,d,b),d=0;d<b;d++)e=c[3*d],f=c[3*d+1],g=c[3*d+2],h=i[d],
+O.faces.push(new THREE.Face3(e,f,g,null,null,h))}function N(b,c,d){for(var e,f,g,h,i,c=new Uint32Array(a,c,4*b),j=new Uint16Array(a,d,b),d=0;d<b;d++)e=c[4*d],f=c[4*d+1],g=c[4*d+2],h=c[4*d+3],i=j[d],O.faces.push(new THREE.Face4(e,f,g,h,null,null,i))}function P(b,c,d,e){for(var f,g,h,i,j,k,l,c=new Uint32Array(a,c,3*b),d=new Uint32Array(a,d,3*b),m=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[3*e];g=c[3*e+1];h=c[3*e+2];j=d[3*e];k=d[3*e+1];l=d[3*e+2];i=m[e];var n=I[3*k],o=I[3*k+1];k=I[3*k+2];var p=I[3*l],r=
+I[3*l+1];l=I[3*l+2];O.faces.push(new THREE.Face3(f,g,h,[new THREE.Vector3(I[3*j],I[3*j+1],I[3*j+2]),new THREE.Vector3(n,o,k),new THREE.Vector3(p,r,l)],null,i))}}function T(b,c,d,e){for(var f,g,h,i,j,k,l,m,n,c=new Uint32Array(a,c,4*b),d=new Uint32Array(a,d,4*b),o=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[4*e];g=c[4*e+1];h=c[4*e+2];i=c[4*e+3];k=d[4*e];l=d[4*e+1];m=d[4*e+2];n=d[4*e+3];j=o[e];var p=I[3*l],r=I[3*l+1];l=I[3*l+2];var q=I[3*m],s=I[3*m+1];m=I[3*m+2];var t=I[3*n],u=I[3*n+1];n=I[3*n+2];O.faces.push(new THREE.Face4(f,
+g,h,i,[new THREE.Vector3(I[3*k],I[3*k+1],I[3*k+2]),new THREE.Vector3(p,r,l),new THREE.Vector3(q,s,m),new THREE.Vector3(t,u,n)],null,j))}}var O=this,J=0,I=[],D=[],i,S,B;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(O,d,b);(function(a,b,c){for(var a=new Uint8Array(a,b,c),d="",e=0;e<c;e++)d+=String.fromCharCode(a[b+e]);return d})(a,J,12);c=z(a,J+12);z(a,J+13);z(a,J+14);z(a,J+15);e=z(a,J+16);l=z(a,J+17);j=z(a,J+18);k=z(a,J+19);p=F(a,J+20);m=F(a,J+20+4);o=F(a,J+20+8);b=F(a,J+20+12);r=
+F(a,J+20+16);n=F(a,J+20+20);q=F(a,J+20+24);s=F(a,J+20+28);u=F(a,J+20+32);v=F(a,J+20+36);t=F(a,J+20+40);J+=c;c=3*e+k;B=4*e+k;i=b*c;S=r*(c+3*l);e=n*(c+3*j);k=q*(c+3*l+3*j);c=s*B;l=u*(B+4*l);j=v*(B+4*j);J+=function(b){var b=new Float32Array(a,b,3*p),c,d,e,f;for(c=0;c<p;c++)d=b[3*c],e=b[3*c+1],f=b[3*c+2],O.vertices.push(new THREE.Vertex(new THREE.Vector3(d,e,f)));return 3*p*Float32Array.BYTES_PER_ELEMENT}(J);J+=function(b){if(m){var b=new Int8Array(a,b,3*m),c,d,e,f;for(c=0;c<m;c++)d=b[3*c],e=b[3*c+1],
+f=b[3*c+2],I.push(d/127,e/127,f/127)}return 3*m*Int8Array.BYTES_PER_ELEMENT}(J);J+=w(3*m);J+=function(b){if(o){var b=new Float32Array(a,b,2*o),c,d,e;for(c=0;c<o;c++)d=b[2*c],e=b[2*c+1],D.push(d,e)}return 2*o*Float32Array.BYTES_PER_ELEMENT}(J);i=J+i+w(2*b);S=i+S+w(2*r);e=S+e+w(2*n);k=e+k+w(2*q);c=k+c+w(2*s);l=c+l+w(2*u);j=l+j+w(2*v);(function(a){if(n){var b=a+3*n*Uint32Array.BYTES_PER_ELEMENT;K(n,a,b+3*n*Uint32Array.BYTES_PER_ELEMENT);C(n,b)}})(S);(function(a){if(q){var b=a+3*q*Uint32Array.BYTES_PER_ELEMENT,
+c=b+3*q*Uint32Array.BYTES_PER_ELEMENT;P(q,a,b,c+3*q*Uint32Array.BYTES_PER_ELEMENT);C(q,c)}})(e);(function(a){if(v){var b=a+4*v*Uint32Array.BYTES_PER_ELEMENT;N(v,a,b+4*v*Uint32Array.BYTES_PER_ELEMENT);G(v,b)}})(l);(function(a){if(t){var b=a+4*t*Uint32Array.BYTES_PER_ELEMENT,c=b+4*t*Uint32Array.BYTES_PER_ELEMENT;T(t,a,b,c+4*t*Uint32Array.BYTES_PER_ELEMENT);G(t,c)}})(j);b&&K(b,J,J+3*b*Uint32Array.BYTES_PER_ELEMENT);(function(a){if(r){var b=a+3*r*Uint32Array.BYTES_PER_ELEMENT;P(r,a,b,b+3*r*Uint32Array.BYTES_PER_ELEMENT)}})(i);
+s&&N(s,k,k+4*s*Uint32Array.BYTES_PER_ELEMENT);(function(a){if(u){var b=a+4*u*Uint32Array.BYTES_PER_ELEMENT;T(u,a,b,b+4*u*Uint32Array.BYTES_PER_ELEMENT)}})(c);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};e.prototype=new THREE.Geometry;e.prototype.constructor=e;b(new e(c))};
+THREE.ColladaLoader=function(){function a(a,d,e){Z=a;d=d||oa;void 0!==e&&(a=e.split("/"),a.pop(),Wa=(1>a.length?".":a.join("/"))+"/");if((a=Z.evaluate("//dae:asset",Z,V,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&a.childNodes)for(e=0;e<a.childNodes.length;e++){var i=a.childNodes[e];switch(i.nodeName){case "unit":(i=i.getAttribute("meter"))&&parseFloat(i);break;case "up_axis":Xa=i.textContent.charAt(0)}}if(!ga.convertUpAxis||Xa===ga.upAxis)La=null;else switch(Xa){case "X":La="Y"===
+ga.upAxis?"XtoY":"XtoZ";break;case "Y":La="X"===ga.upAxis?"YtoX":"YtoZ";break;case "Z":La="X"===ga.upAxis?"ZtoX":"ZtoY"}Ua=b("//dae:library_images/dae:image",g,"image");ab=b("//dae:library_materials/dae:material",G,"material");kb=b("//dae:library_effects/dae:effect",O,"effect");$a=b("//dae:library_geometries/dae:geometry",q,"geometry");db=b(".//dae:library_cameras/dae:camera",B,"camera");pa=b("//dae:library_controllers/dae:controller",h,"controller");Da=b("//dae:library_animations/dae:animation",
+I,"animation");nb=b(".//dae:library_visual_scenes/dae:visual_scene",k,"visual_scene");qa=[];va=[];(a=Z.evaluate(".//dae:scene/dae:instance_visual_scene",Z,V,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(a=a.getAttribute("url").replace(/^#/,""),Ga=nb[0<a.length?a:"visual_scene0"]):Ga=null;ja=new THREE.Object3D;for(a=0;a<Ga.nodes.length;a++)ja.add(f(Ga.nodes[a]));hb=[];c(ja);a={scene:ja,morphs:qa,skins:va,animations:hb,dae:{images:Ua,materials:ab,cameras:db,effects:kb,geometries:$a,controllers:pa,
+animations:Da,visualScenes:nb,scene:Ga}};d&&d(a);return a}function b(a,b,c){for(var a=Z.evaluate(a,Z,V,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null),d={},e=a.iterateNext(),f=0;e;){e=(new b).parse(e);if(!e.id||0==e.id.length)e.id=c+f++;d[e.id]=e;e=a.iterateNext()}return d}function c(a){var b=Ga.getChildById(a.name,!0),d=null;if(b&&b.keys){d={fps:60,hierarchy:[{node:b,keys:b.keys,sids:b.sids}],node:a,name:"animation_"+a.name,length:0};hb.push(d);for(var e=0,f=b.keys.length;e<f;e++)d.length=Math.max(d.length,
 b.keys[e].time)}else d={hierarchy:[{keys:[],sids:[]}]};e=0;for(f=a.children.length;e<f;e++)for(var b=0,g=c(a.children[e]).hierarchy.length;b<g;b++)d.hierarchy.push({keys:[],sids:[]});return d}function d(a,b,c,e){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[c];f instanceof THREE.Matrix4&&a.world.copy(f)}e&&a.world.multiply(e,a.world);b.push(a);for(e=0;e<a.nodes.length;e++)d(a.nodes[e],b,c,a.world)}function e(a,b,c){var e,
-f=Ba[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 c=1E6,g=-c,h=0;for(e in Aa)for(var l=Aa[e],j=0;j<l.sampler.length;j++){var i=l.sampler[j];i.create();c=Math.min(c,i.startTime);g=Math.max(g,i.endTime);h=Math.max(h,i.input.length)}e=h;for(var b=ia.getChildById(b.skeleton[0],!0)||ia.getChildBySid(b.skeleton[0],!0),k,m,g=new THREE.Vector3,n,
-j=0;j<a.vertices.length;j++)f.skin.bindShapeMatrix.multiplyVector3(a.vertices[j].position);for(c=0;c<e;c++){h=[];l=[];for(j=0;j<a.vertices.length;j++)l.push(new THREE.Vertex(new THREE.Vector3));d(b,h,c);j=h;i=f.skin;for(m=0;m<j.length;m++)if(k=j[m],n=-1,"JOINT"==k.type){for(var o=0;o<i.joints.length;o++)if(k.sid==i.joints[o]){n=o;break}if(0<=n){o=i.invBindMatrices[n];k.invBindMatrix=o;k.skinningMatrix=new THREE.Matrix4;k.skinningMatrix.multiply(k.world,o);k.weights=[];for(o=0;o<i.weights.length;o++)for(var p=
-0;p<i.weights[o].length;p++){var q=i.weights[o][p];q.joint==n&&k.weights.push(q)}}else throw"ColladaLoader: Could not find joint '"+k.sid+"'.";}for(j=0;j<h.length;j++)if("JOINT"==h[j].type)for(i=0;i<h[j].weights.length;i++)k=h[j].weights[i],m=k.index,k=k.weight,n=a.vertices[m],m=l[m],g.x=n.position.x,g.y=n.position.y,g.z=n.position.z,h[j].skinningMatrix.multiplyVector3(g),m.position.x+=g.x*k,m.position.y+=g.y*k,m.position.z+=g.z*k;a.morphTargets.push({name:"target_"+c,vertices:l})}}}function f(a){var b=
-new THREE.Object3D,c,d,g,h;for(g=0;g<a.controllers.length;g++){var j=Ba[a.controllers[g].url];switch(j.type){case "skin":if(ra[j.skin.source]){var i=new l;i.url=j.skin.source;i.instance_material=a.controllers[g].instance_material;a.geometries.push(i);c=a.controllers[g]}else if(Ba[j.skin.source]&&(d=j=Ba[j.skin.source],j.morph&&ra[j.morph.source]))i=new l,i.url=j.morph.source,i.instance_material=a.controllers[g].instance_material,a.geometries.push(i);break;case "morph":if(ra[j.morph.source])i=new l,
-i.url=j.morph.source,i.instance_material=a.controllers[g].instance_material,a.geometries.push(i),d=a.controllers[g];console.log("ColladaLoader: Morph-controller partially supported.")}}for(g=0;g<a.geometries.length;g++){var j=a.geometries[g],i=j.instance_material,j=ra[j.url],k={},m=[],n=0,p;if(j&&j.mesh&&j.mesh.primitives){if(0==b.name.length)b.name=j.id;if(i)for(h=0;h<i.length;h++){p=i[h];var q=bb[p.target],r=jb[q.instance_effect.url].shader;r.material.opacity=!r.material.opacity?1:r.material.opacity;
-k[p.symbol]=n;m.push(r.material);p=r.material;p.name=null==q.name||""===q.name?q.id:q.name;n++}i=p||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});j=j.mesh.geometry3js;if(1<n){i=new THREE.MeshFaceMaterial;j.materials=m;for(h=0;h<j.faces.length;h++)m=j.faces[h],m.materialIndex=k[m.daeMaterial]}if(void 0!==c)e(j,c),i.morphTargets=!0,i=new THREE.SkinnedMesh(j,i),i.skeleton=c.skeleton,i.skinController=Ba[c.url],i.skinInstanceController=c,i.name="skin_"+oa.length,oa.push(i);
-else if(void 0!==d){h=j;k=d instanceof o?Ba[d.url]:d;if(!k||!k.morph)console.log("could not find morph controller!");else{k=k.morph;for(m=0;m<k.targets.length;m++)if(n=ra[k.targets[m]],n.mesh&&n.mesh.primitives&&n.mesh.primitives.length)n=n.mesh.primitives[0].geometry,n.vertices.length===h.vertices.length&&h.morphTargets.push({name:"target_1",vertices:n.vertices});h.morphTargets.push({name:"target_Z",vertices:h.vertices})}i.morphTargets=!0;i=new THREE.Mesh(j,i);i.name="morph_"+Ga.length;Ga.push(i)}else i=
-new THREE.Mesh(j,i);1<a.geometries.length?b.add(i):b=i}}for(g=0;g<a.cameras.length;g++)b=Va[a.cameras[g].url],b=new THREE.PerspectiveCamera(b.fov,b.aspect_ratio,b.znear,b.zfar);b.name=a.id||"";b.matrix=a.matrix;g=a.matrix.decompose();b.position=g[0];b.quaternion=g[1];b.useQuaternion=!0;b.scale=g[2];Oa.centerGeometry&&b.geometry&&(g=THREE.GeometryUtils.center(b.geometry),b.quaternion.multiplyVector3(g.multiplySelf(b.scale)),b.position.subSelf(g));for(g=0;g<a.nodes.length;g++)b.add(f(a.nodes[g],a));
-return b}function g(){this.init_from=this.id=""}function h(){this.type=this.name=this.id="";this.morph=this.skin=null}function i(){this.weights=this.targets=this.source=this.method=null}function m(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function k(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function p(){this.sid=this.name=this.id="";this.nodes=[];this.controllers=[];this.transforms=[];this.geometries=[];this.channels=
-[];this.matrix=new THREE.Matrix4}function n(){this.type=this.sid="";this.data=[];this.obj=null}function o(){this.url="";this.skeleton=[];this.instance_material=[]}function q(){this.target=this.symbol=""}function l(){this.url="";this.instance_material=[]}function r(){this.id="";this.mesh=null}function s(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function u(){}function v(){this.material="";this.count=0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}
-function t(){this.source="";this.stride=this.count=0;this.params=[]}function w(){this.input={}}function A(){this.semantic="";this.offset=0;this.source="";this.set=0}function G(a){this.id=a;this.type=null}function F(){this.name=this.id="";this.instance_effect=null}function D(){this.color=new THREE.Color(0);this.color.setRGB(Math.random(),Math.random(),Math.random());this.color.a=1;this.texOpts=this.texcoord=this.texture=null}function J(a,b){this.type=a;this.effect=b;this.material=null}function O(a){this.effect=
-a;this.format=this.init_from=null}function P(a){this.effect=a;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=this.source=null}function U(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function L(){this.url=""}function I(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function M(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=this.dotSyntax=this.sid=this.fullSid=null}function B(a){this.id="";this.animation=
-a;this.inputs=[];this.endTime=this.startTime=this.interpolation=this.strideOut=this.output=this.input=null;this.duration=0}function j(a){this.targets=[];this.time=a}function T(){this.name=this.id=""}function C(){this.url=""}function z(a){return"dae"==a?"http://www.collada.org/2005/11/COLLADASchema":null}function R(a){for(var a=ga(a),b=[],c=0,d=a.length;c<d;c++)b.push(parseFloat(a[c]));return b}function E(a){for(var a=ga(a),b=[],c=0,d=a.length;c<d;c++)b.push(parseInt(a[c],10));return b}function ga(a){return 0<
-a.length?a.replace(/^\s+/,"").replace(/\s+$/,"").split(/\s+/):[]}function ea(a,b,c){return a.hasAttribute(b)?parseInt(a.getAttribute(b),10):c}function ca(a,b){if(Oa.convertUpAxis&&sa!==Oa.upAxis)switch(Wa){case "XtoY":var c=a[0];a[0]=b*a[1];a[1]=c;break;case "XtoZ":c=a[2];a[2]=a[1];a[1]=a[0];a[0]=c;break;case "YtoX":c=a[0];a[0]=a[1];a[1]=b*c;break;case "YtoZ":c=a[1];a[1]=b*a[2];a[2]=c;break;case "ZtoX":c=a[0];a[0]=a[1];a[1]=a[2];a[2]=c;break;case "ZtoY":c=a[1],a[1]=a[2],a[2]=b*c}}function S(a,b){var c=
-[a[b],a[b+1],a[b+2]];ca(c,-1);return new THREE.Vector3(c[0],c[1],c[2])}function Q(a){if(Oa.convertUpAxis){var b=[a[0],a[4],a[8]];ca(b,-1);a[0]=b[0];a[4]=b[1];a[8]=b[2];b=[a[1],a[5],a[9]];ca(b,-1);a[1]=b[0];a[5]=b[1];a[9]=b[2];b=[a[2],a[6],a[10]];ca(b,-1);a[2]=b[0];a[6]=b[1];a[10]=b[2];b=[a[0],a[1],a[2]];ca(b,-1);a[0]=b[0];a[1]=b[1];a[2]=b[2];b=[a[4],a[5],a[6]];ca(b,-1);a[4]=b[0];a[5]=b[1];a[6]=b[2];b=[a[8],a[9],a[10]];ca(b,-1);a[8]=b[0];a[9]=b[1];a[10]=b[2];b=[a[3],a[7],a[11]];ca(b,-1);a[3]=b[0];
-a[7]=b[1];a[11]=b[2]}return new THREE.Matrix4(a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8],a[9],a[10],a[11],a[12],a[13],a[14],a[15])}var W=null,aa=null,ia,Sa=null,na={},Ka={},Aa={},Ba={},ra={},bb={},jb={},Va={},cb,eb,db,Ga,oa,Ca=THREE.SmoothShading,Oa={centerGeometry:!1,convertUpAxis:!1,subdivideFaces:!0,upAxis:"Y"},sa="Y",Wa=null,mb=Math.PI/180;g.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if("init_from"==c.nodeName)this.init_from=
-c.textContent}return this};h.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 i).parse(c),this.type=c.nodeName}}return this};i.prototype.parse=function(a){var b={},c=[],d;this.method=a.getAttribute("method");this.source=a.getAttribute("source").replace(/^#/,"");for(d=
-0;d<a.childNodes.length;d++){var e=a.childNodes[d];if(1==e.nodeType)switch(e.nodeName){case "source":e=(new G).parse(e);b[e.id]=e;break;case "targets":c=this.parseInputs(e);break;default:console.log(e.nodeName)}}for(d=0;d<c.length;d++)switch(a=c[d],e=b[a.source],a.semantic){case "MORPH_TARGET":this.targets=e.read();break;case "MORPH_WEIGHT":this.weights=e.read()}return this};i.prototype.parseInputs=function(a){for(var b=[],c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(1==d.nodeType)switch(d.nodeName){case "input":b.push((new A).parse(d))}}return b};
-m.prototype.parse=function(a){var b={},c,d;this.source=a.getAttribute("source").replace(/^#/,"");this.invBindMatrices=[];this.joints=[];this.weights=[];for(var e=0;e<a.childNodes.length;e++){var f=a.childNodes[e];if(1==f.nodeType)switch(f.nodeName){case "bind_shape_matrix":f=R(f.textContent);this.bindShapeMatrix=Q(f);break;case "source":f=(new G).parse(f);b[f.id]=f;break;case "joints":c=f;break;case "vertex_weights":d=f;break;default:console.log(f.nodeName)}}this.parseJoints(c,b);this.parseWeights(d,
-b);return this};m.prototype.parseJoints=function(a,b){for(var c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(1==d.nodeType)switch(d.nodeName){case "input":var d=(new A).parse(d),e=b[d.source];if("JOINT"==d.semantic)this.joints=e.read();else if("INV_BIND_MATRIX"==d.semantic)this.invBindMatrices=e.read()}}};m.prototype.parseWeights=function(a,b){for(var c,d,e=[],f=0;f<a.childNodes.length;f++){var g=a.childNodes[f];if(1==g.nodeType)switch(g.nodeName){case "input":e.push((new A).parse(g));break;
-case "v":c=E(g.textContent);break;case "vcount":d=E(g.textContent)}}for(f=g=0;f<d.length;f++){for(var h=d[f],j=[],i=0;i<h;i++){for(var l={},k=0;k<e.length;k++){var m=e[k],n=c[g+m.offset];switch(m.semantic){case "JOINT":l.joint=n;break;case "WEIGHT":l.weight=b[m.source].data[n]}}j.push(l);g+=e.length}for(i=0;i<j.length;i++)j[i].index=f;this.weights.push(j)}};k.prototype.getChildById=function(a,b){for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildById(a,b);if(d)return d}return null};
-k.prototype.getChildBySid=function(a,b){for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildBySid(a,b);if(d)return d}return null};k.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(1==c.nodeType)switch(c.nodeName){case "node":this.nodes.push((new p).parse(c))}}return this};p.prototype.getChannelForTransform=function(a){for(var b=0;b<this.channels.length;b++){var c=this.channels[b],
-d=c.target.split("/");d.shift();var e=d.shift(),f=0<=e.indexOf("."),g=0<=e.indexOf("("),h;if(f)d=e.split("."),e=d.shift(),d.shift();else if(g){h=e.split("(");e=h.shift();for(d=0;d<h.length;d++)h[d]=parseInt(h[d].replace(/\)/,""))}if(e==a)return c.info={sid:e,dotSyntax:f,arrSyntax:g,arrIndices:h},c}return null};p.prototype.getChildById=function(a,b){if(this.id==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildById(a,b);if(d)return d}return null};p.prototype.getChildBySid=
-function(a,b){if(this.sid==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildBySid(a,b);if(d)return d}return null};p.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};p.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="JOINT"==this.type?this.type:
-"NODE";this.nodes=[];this.transforms=[];this.geometries=[];this.cameras=[];this.controllers=[];this.matrix=new THREE.Matrix4;for(var c=0;c<a.childNodes.length;c++)if(b=a.childNodes[c],1==b.nodeType)switch(b.nodeName){case "node":this.nodes.push((new p).parse(b));break;case "instance_camera":this.cameras.push((new C).parse(b));break;case "instance_controller":this.controllers.push((new o).parse(b));break;case "instance_geometry":this.geometries.push((new l).parse(b));break;case "instance_light":break;
-case "instance_node":b=b.getAttribute("url").replace(/^#/,"");(b=W.evaluate(".//dae:library_nodes//dae:node[@id='"+b+"']",W,z,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new p).parse(b));break;case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new n).parse(b));break;case "extra":break;default:console.log(b.nodeName)}a=[];c=1E6;b=-1E6;for(var d in Aa)for(var e=Aa[d],f=0;f<e.channel.length;f++){var g=e.channel[f],
-h=e.sampler[f];d=g.target.split("/")[0];if(d==this.id)h.create(),g.sampler=h,c=Math.min(c,h.startTime),b=Math.max(b,h.endTime),a.push(g)}if(a.length)this.startTime=c,this.endTime=b;if((this.channels=a)&&this.channels.length){d=[];a=[];c=0;for(e=this.channels.length;c<e;c++){b=this.channels[c];f=b.fullSid;g=b.member;if(Oa.convertUpAxis)switch(g){case "X":switch(Wa){case "XtoY":case "XtoZ":case "YtoX":g="Y";break;case "ZtoX":g="Z"}break;case "Y":switch(Wa){case "XtoY":case "YtoX":case "ZtoX":g="X";
-break;case "XtoZ":case "YtoZ":case "ZtoY":g="Z"}break;case "Z":switch(Wa){case "XtoZ":g="X";break;case "YtoZ":case "ZtoX":case "ZtoY":g="Y"}}var h=b.sampler,i=h.input,k=this.getTransformBySid(b.sid);if(k){-1===a.indexOf(f)&&a.push(f);b=0;for(var m=i.length;b<m;b++){var q=i[b],r=h.getData(k.type,b),s;s=null;for(var t=0,u=d.length;t<u&&null==s;t++){var v=d[t];if(v.time===q)s=v;else if(v.time>q)break}if(!s){s=new j(q);t=-1;u=0;for(v=d.length;u<v&&-1==t;u++)d[u].time>=q&&(t=u);q=t;d.splice(-1==q?d.length:
-q,0,s)}s.addTarget(f,k,g,r)}}else console.log('Could not find transform "'+b.sid+'" in node '+this.id)}for(c=0;c<a.length;c++){e=a[c];for(b=0;b<d.length;b++)if(s=d[b],!s.hasTarget(e)){h=d;f=s;k=b;g=e;i=void 0;a:{i=k?k-1:0;for(i=0<=i?i:i+h.length;0<=i;i--)if(m=h[i],m.hasTarget(g)){i=m;break a}i=null}m=void 0;a:{for(k+=1;k<h.length;k++)if(m=h[k],m.hasTarget(g))break a;m=null}if(i&&m){h=(f.time-i.time)/(m.time-i.time);i=i.getTarget(g);k=m.getTarget(g).data;m=i.data;r=void 0;if(m.length){r=[];for(q=0;q<
-m.length;++q)r[q]=m[q]+(k[q]-m[q])*h}else r=m+(k-m)*h;f.addTarget(g,i.transform,i.member,r)}}}this.keys=d;this.sids=a}this.updateMatrix();return this};p.prototype.updateMatrix=function(){this.matrix.identity();for(var a=0;a<this.transforms.length;a++)this.transforms[a].apply(this.matrix)};n.prototype.parse=function(a){this.sid=a.getAttribute("sid");this.type=a.nodeName;this.data=R(a.textContent);this.convert();return this};n.prototype.convert=function(){switch(this.type){case "matrix":this.obj=Q(this.data);
-break;case "rotate":this.angle=this.data[3]*mb;case "translate":ca(this.data,-1);this.obj=new THREE.Vector3(this.data[0],this.data[1],this.data[2]);break;case "scale":ca(this.data,1);this.obj=new THREE.Vector3(this.data[0],this.data[1],this.data[2]);break;default:console.log("Can not convert Transform of type "+this.type)}};n.prototype.apply=function(a){switch(this.type){case "matrix":a.multiplySelf(this.obj);break;case "translate":a.translate(this.obj);break;case "rotate":a.rotateByAxis(this.obj,
-this.angle);break;case "scale":a.scale(this.obj)}};n.prototype.update=function(a,b){switch(this.type){case "matrix":console.log("Currently not handling matrix transform updates");break;case "translate":case "scale":switch(b){case "X":this.obj.x=a;break;case "Y":this.obj.y=a;break;case "Z":this.obj.z=a;break;default:this.obj.x=a[0],this.obj.y=a[1],this.obj.z=a[2]}break;case "rotate":switch(b){case "X":this.obj.x=a;break;case "Y":this.obj.y=a;break;case "Z":this.obj.z=a;break;case "ANGLE":this.angle=
-a*mb;break;default:this.obj.x=a[0],this.obj.y=a[1],this.obj.z=a[2],this.angle=a[3]*mb}}};o.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(1==c.nodeType)switch(c.nodeName){case "skeleton":this.skeleton.push(c.textContent.replace(/^#/,""));break;case "bind_material":if(c=W.evaluate(".//dae:instance_material",c,z,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(var d=
-c.iterateNext();d;)this.instance_material.push((new q).parse(d)),d=c.iterateNext()}}return this};q.prototype.parse=function(a){this.symbol=a.getAttribute("symbol");this.target=a.getAttribute("target").replace(/^#/,"");return this};l.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(1==c.nodeType&&"bind_material"==c.nodeName){if(a=W.evaluate(".//dae:instance_material",c,z,XPathResult.ORDERED_NODE_ITERATOR_TYPE,
-null))for(b=a.iterateNext();b;)this.instance_material.push((new q).parse(b)),b=a.iterateNext();break}}return this};r.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 s(this)).parse(c)}}return this};s.prototype.parse=function(a){this.primitives=[];var b;for(b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "source":var d=c.getAttribute("id");void 0==na[d]&&(na[d]=
-(new G(d)).parse(c));break;case "vertices":this.vertices=(new w).parse(c);break;case "triangles":this.primitives.push((new v).parse(c));break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new u).parse(c))}}this.geometry3js=new THREE.Geometry;a=na[this.vertices.input.POSITION.source].data;for(b=0;b<a.length;b+=3)this.geometry3js.vertices.push(new THREE.Vertex(S(a,b)));for(b=0;b<this.primitives.length;b++)a=this.primitives[b],a.setVertices(this.vertices),
-this.handlePrimitive(a,this.geometry3js);this.geometry3js.computeCentroids();this.geometry3js.computeFaceNormals();this.geometry3js.calcNormals&&(this.geometry3js.computeVertexNormals(),delete this.geometry3js.calcNormals);this.geometry3js.computeBoundingBox();return this};s.prototype.handlePrimitive=function(a,b){var c=0,d,e,f=a.p,g=a.inputs,h,i,j,l,k=0,m=3,n=0,o=[];for(d=0;d<g.length;d++){h=g[d];var p=h.offset+1,n=n<p?p:n;switch(h.semantic){case "TEXCOORD":o.push(h.set)}}for(;c<f.length;){var q=
-[],r=[],p={},s=[];a.vcount&&(m=a.vcount[k++]);for(d=0;d<m;d++)for(e=0;e<g.length;e++)switch(h=g[e],l=na[h.source],i=f[c+d*n+h.offset],j=l.accessor.params.length,j*=i,h.semantic){case "VERTEX":q.push(i);break;case "NORMAL":r.push(S(l.data,j));break;case "TEXCOORD":void 0===p[h.set]&&(p[h.set]=[]);p[h.set].push(new THREE.UV(l.data[j],1-l.data[j+1]));break;case "COLOR":s.push((new THREE.Color).setRGB(l.data[j],l.data[j+1],l.data[j+2]))}e=null;d=[];if(0==r.length)if(h=this.vertices.input.NORMAL){l=na[h.source];
-j=l.accessor.params.length;h=0;for(i=q.length;h<i;h++)r.push(S(l.data,q[h]*j))}else b.calcNormals=!0;if(3===m)d.push(new THREE.Face3(q[0],q[1],q[2],r,s.length?s:new THREE.Color));else if(4===m)d.push(new THREE.Face4(q[0],q[1],q[2],q[3],r,s.length?s:new THREE.Color));else if(4<m&&Oa.subdivideFaces){s=s.length?s:new THREE.Color;for(e=1;e<m-1;)d.push(new THREE.Face3(q[0],q[e],q[e+1],[r[0],r[e++],r[e]],s))}if(d.length){h=0;for(i=d.length;h<i;h++){e=d[h];e.daeMaterial=a.material;b.faces.push(e);for(e=
-0;e<o.length;e++)q=p[o[e]],q=4<m?[q[0],q[h+1],q[h+2]]:4===m?[q[0],q[1],q[2],q[3]]:[q[0],q[1],q[2]],b.faceVertexUvs[e]||(b.faceVertexUvs[e]=[]),b.faceVertexUvs[e].push(q)}}else console.log("dropped face with vcount "+m+" for geometry with id: "+b.id);c+=n*m}};u.prototype=new v;u.prototype.constructor=u;v.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};v.prototype.parse=function(a){this.inputs=[];this.material=
-a.getAttribute("material");this.count=ea(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 A).parse(a.childNodes[b]));break;case "vcount":this.vcount=E(c.textContent);break;case "p":this.p=E(c.textContent)}}return this};t.prototype.parse=function(a){this.params=[];this.source=a.getAttribute("source");this.count=ea(a,"count",0);this.stride=ea(a,"stride",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if("param"==
-c.nodeName){var d={};d.name=c.getAttribute("name");d.type=c.getAttribute("type");this.params.push(d)}}return this};w.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++)if("input"==a.childNodes[b].nodeName){var c=(new A).parse(a.childNodes[b]);this.input[c.semantic]=c}return this};A.prototype.parse=function(a){this.semantic=a.getAttribute("semantic");this.source=a.getAttribute("source").replace(/^#/,"");this.set=ea(a,"set",-1);this.offset=ea(a,"offset",0);
-if("TEXCOORD"==this.semantic&&0>this.set)this.set=0;return this};G.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 d=ga(c.textContent),e=[],f=0,g=d.length;f<g;f++)e.push("true"==d[f]||"1"==d[f]?!0:!1);this.data=e;this.type=c.nodeName;break;case "float_array":this.data=R(c.textContent);this.type=c.nodeName;break;case "int_array":this.data=E(c.textContent);this.type=c.nodeName;break;case "IDREF_array":case "Name_array":this.data=
-ga(c.textContent);this.type=c.nodeName;break;case "technique_common":for(d=0;d<c.childNodes.length;d++)if("accessor"==c.childNodes[d].nodeName){this.accessor=(new t).parse(c.childNodes[d]);break}}}return this};G.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),c=Q(c);a.push(c)}break;default:console.log("ColladaLoader: Source: Read dont know how to read "+
-b.type+".")}return a};F.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");for(var b=0;b<a.childNodes.length;b++)if("instance_effect"==a.childNodes[b].nodeName){this.instance_effect=(new L).parse(a.childNodes[b]);break}return this};D.prototype.isColor=function(){return null==this.texture};D.prototype.isTexture=function(){return null!=this.texture};D.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "color":c=
-R(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"),this.texOpts={offsetU:0,offsetV:0,repeatU:1,repeatV:1,wrapU:1,wrapV:1},this.parseTexture(c)}}return this};D.prototype.parseTexture=function(a){if(!a.childNodes)return this;a.childNodes[1]&&"extra"===a.childNodes[1].nodeName&&(a=a.childNodes[1],a.childNodes[1]&&"technique"===a.childNodes[1].nodeName&&
-(a=a.childNodes[1]));for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "offsetU":case "offsetV":case "repeatU":case "repeatV":this.texOpts[c.nodeName]=parseFloat(c.textContent);break;case "wrapU":case "wrapV":this.texOpts[c.nodeName]=parseInt(c.textContent);break;default:this.texOpts[c.nodeName]=c.textContent}}return this};J.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[c.nodeName]=
-(new D).parse(c);break;case "shininess":case "reflectivity":case "transparency":var d;d=W.evaluate(".//dae:float",c,z,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);for(var e=d.iterateNext(),f=[];e;)f.push(e),e=d.iterateNext();d=f;0<d.length&&(this[c.nodeName]=parseFloat(d[0].textContent))}}this.create();return this};J.prototype.create=function(){var a={},b=void 0!==this.transparency&&1>this.transparency,c;for(c in this)switch(c){case "ambient":case "emission":case "diffuse":case "specular":var d=this[c];
-if(d instanceof D)if(d.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid){var e=Ka[this.effect.surface.init_from];if(e)e=THREE.ImageUtils.loadTexture(db+e.init_from),e.wrapS=d.texOpts.wrapU?THREE.RepeatWrapping:THREE.ClampToEdgeWrapping,e.wrapT=d.texOpts.wrapV?THREE.RepeatWrapping:THREE.ClampToEdgeWrapping,e.offset.x=d.texOpts.offsetU,e.offset.y=d.texOpts.offsetV,e.repeat.x=d.texOpts.repeatU,e.repeat.y=d.texOpts.repeatV,a.map=e}}else"diffuse"==
-c?a.color=d.color.getHex():b||(a[c]=d.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=Ca;return this.material=new THREE.MeshLambertMaterial(a)};O.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)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};P.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)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};
-U.prototype.create=function(){if(null==this.shader)return null};U.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(1==c.nodeType)switch(c.nodeName){case "profile_COMMON":this.parseTechnique(this.parseProfileCOMMON(c))}}return this};U.prototype.parseNewparam=function(a){for(var b=a.getAttribute("sid"),c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(1==d.nodeType)switch(d.nodeName){case "surface":this.surface=
-(new O(this)).parse(d);this.surface.sid=b;break;case "sampler2D":this.sampler=(new P(this)).parse(d);this.sampler.sid=b;break;case "extra":break;default:console.log(d.nodeName)}}};U.prototype.parseProfileCOMMON=function(a){for(var b,c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(1==d.nodeType)switch(d.nodeName){case "profile_COMMON":this.parseProfileCOMMON(d);break;case "technique":b=d;break;case "newparam":this.parseNewparam(d);break;case "extra":break;default:console.log(d.nodeName)}}return b};
-U.prototype.parseTechnique=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "constant":case "lambert":case "blinn":case "phong":this.shader=(new J(c.nodeName,this)).parse(c)}}};L.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");return this};I.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(1==c.nodeType)switch(c.nodeName){case "source":c=(new G).parse(c);this.source[c.id]=c;break;case "sampler":this.sampler.push((new B(this)).parse(c));break;case "channel":this.channel.push((new M(this)).parse(c))}}return this};M.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=0<=a.indexOf("."),d=0<=a.indexOf("(");if(c)b=a.split("."),this.sid=b.shift(),this.member=b.shift();
-else if(d){b=a.split("(");this.sid=b.shift();for(var e=0;e<b.length;e++)b[e]=parseInt(b[e].replace(/\)/,""));this.arrIndices=b}else this.sid=a;this.fullSid=a;this.dotSyntax=c;this.arrSyntax=d;return this};B.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(1==c.nodeType)switch(c.nodeName){case "input":this.inputs.push((new A).parse(c))}}return this};B.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();this.strideOut=c.accessor.stride;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}};B.prototype.getData=function(a,b){var c;if(1<this.strideOut){c=[];for(var b=b*this.strideOut,d=0;d<this.strideOut;++d)c[d]=this.output[b+d];if(3===this.strideOut)switch(a){case "rotate":case "translate":ca(c,-1);break;case "scale":ca(c,1)}}else c=this.output[b];return c};j.prototype.addTarget=function(a,b,c,d){this.targets.push({sid:a,member:c,transform:b,data:d})};j.prototype.apply=function(a){for(var b=
-0;b<this.targets.length;++b){var c=this.targets[b];(!a||c.sid===a)&&c.transform.update(c.data,c.member)}};j.prototype.getTarget=function(a){for(var b=0;b<this.targets.length;++b)if(this.targets[b].sid===a)return this.targets[b];return null};j.prototype.hasTarget=function(a){for(var b=0;b<this.targets.length;++b)if(this.targets[b].sid===a)return!0;return!1};j.prototype.interpolate=function(a,b){for(var c=0;c<this.targets.length;++c){var d=this.targets[c],e=a.getTarget(d.sid);if(e){var f=(b-this.time)/
-(a.time-this.time),g=e.data,h=d.data;if(0>f||1<f)console.log("Key.interpolate: Warning! Scale out of bounds:"+f),f=0>f?0:1;if(h.length)for(var e=[],i=0;i<h.length;++i)e[i]=h[i]+(g[i]-h[i])*f;else e=h+(g-h)*f}else e=d.data;d.transform.update(e,d.member)}};T.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "optics":this.parseOptics(c)}}return this};T.prototype.parseOptics=
-function(a){for(var b=0;b<a.childNodes.length;b++)if("technique_common"==a.childNodes[b].nodeName)for(var c=a.childNodes[b],d=0;d<c.childNodes.length;d++)if("perspective"==c.childNodes[d].nodeName)for(var e=c.childNodes[d],f=0;f<e.childNodes.length;f++){var g=e.childNodes[f];switch(g.nodeName){case "xfov":this.fov=g.textContent;break;case "znear":this.znear=0.4;break;case "zfar":this.zfar=1E15;break;case "aspect_ratio":this.aspect_ratio=g.textContent}}return this};C.prototype.parse=function(a){this.url=
-a.getAttribute("url").replace(/^#/,"");return this};return{load:function(b,c,d){var e=0;if(document.implementation&&document.implementation.createDocument){var f=new XMLHttpRequest;f.overrideMimeType&&f.overrideMimeType("text/xml");f.onreadystatechange=function(){if(4==f.readyState){if(0==f.status||200==f.status)f.responseXML?(Sa=c,a(f.responseXML,void 0,b)):console.error("ColladaLoader: Empty or non-existing file ("+b+")")}else 3==f.readyState&&d&&(0==e&&(e=f.getResponseHeader("Content-Length")),
-d({total:e,loaded:f.responseText.length}))};f.open("GET",b,!0);f.send(null)}else alert("Don't know how to parse XML!")},parse:a,setPreferredShading:function(a){Ca=a},applySkin:e,geometries:ra,options:Oa}};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){c=c?c:this.extractUrlBase(a);this.onLoadStart();this.loadAjaxJSON(this,a,b,c)};
+f=pa[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 c=1E6,g=-c,h=0;for(e in Da)for(var i=Da[e],j=0;j<i.sampler.length;j++){var k=i.sampler[j];k.create();c=Math.min(c,k.startTime);g=Math.max(g,k.endTime);h=Math.max(h,k.input.length)}e=h;for(var b=Ga.getChildById(b.skeleton[0],!0)||Ga.getChildBySid(b.skeleton[0],!0),l,m,g=new THREE.Vector3,n,
+j=0;j<a.vertices.length;j++)f.skin.bindShapeMatrix.multiplyVector3(a.vertices[j].position);for(c=0;c<e;c++){h=[];i=[];for(j=0;j<a.vertices.length;j++)i.push(new THREE.Vertex(new THREE.Vector3));d(b,h,c);j=h;k=f.skin;for(m=0;m<j.length;m++)if(l=j[m],n=-1,"JOINT"==l.type){for(var o=0;o<k.joints.length;o++)if(l.sid==k.joints[o]){n=o;break}if(0<=n){o=k.invBindMatrices[n];l.invBindMatrix=o;l.skinningMatrix=new THREE.Matrix4;l.skinningMatrix.multiply(l.world,o);l.weights=[];for(o=0;o<k.weights.length;o++)for(var p=
+0;p<k.weights[o].length;p++){var r=k.weights[o][p];r.joint==n&&l.weights.push(r)}}else throw"ColladaLoader: Could not find joint '"+l.sid+"'.";}for(j=0;j<h.length;j++)if("JOINT"==h[j].type)for(k=0;k<h[j].weights.length;k++)l=h[j].weights[k],m=l.index,l=l.weight,n=a.vertices[m],m=i[m],g.x=n.position.x,g.y=n.position.y,g.z=n.position.z,h[j].skinningMatrix.multiplyVector3(g),m.position.x+=g.x*l,m.position.y+=g.y*l,m.position.z+=g.z*l;a.morphTargets.push({name:"target_"+c,vertices:i})}}}function f(a){var b=
+new THREE.Object3D,c,d,g,h;for(g=0;g<a.controllers.length;g++){var j=pa[a.controllers[g].url];switch(j.type){case "skin":if($a[j.skin.source]){var i=new n;i.url=j.skin.source;i.instance_material=a.controllers[g].instance_material;a.geometries.push(i);c=a.controllers[g]}else if(pa[j.skin.source]&&(d=j=pa[j.skin.source],j.morph&&$a[j.morph.source]))i=new n,i.url=j.morph.source,i.instance_material=a.controllers[g].instance_material,a.geometries.push(i);break;case "morph":if($a[j.morph.source])i=new n,
+i.url=j.morph.source,i.instance_material=a.controllers[g].instance_material,a.geometries.push(i),d=a.controllers[g];console.log("ColladaLoader: Morph-controller partially supported.")}}for(g=0;g<a.geometries.length;g++){var j=a.geometries[g],i=j.instance_material,j=$a[j.url],l={},k=[],m=0,p;if(j&&j.mesh&&j.mesh.primitives){if(0==b.name.length)b.name=j.id;if(i)for(h=0;h<i.length;h++){p=i[h];var r=ab[p.target],q=kb[r.instance_effect.url].shader;q.material.opacity=!q.material.opacity?1:q.material.opacity;
+l[p.symbol]=m;k.push(q.material);p=q.material;p.name=null==r.name||""===r.name?r.id:r.name;m++}i=p||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});j=j.mesh.geometry3js;if(1<m){i=new THREE.MeshFaceMaterial;j.materials=k;for(h=0;h<j.faces.length;h++)k=j.faces[h],k.materialIndex=l[k.daeMaterial]}if(void 0!==c)e(j,c),i.morphTargets=!0,i=new THREE.SkinnedMesh(j,i),i.skeleton=c.skeleton,i.skinController=pa[c.url],i.skinInstanceController=c,i.name="skin_"+va.length,va.push(i);
+else if(void 0!==d){h=j;l=d instanceof o?pa[d.url]:d;if(!l||!l.morph)console.log("could not find morph controller!");else{l=l.morph;for(k=0;k<l.targets.length;k++)if(m=$a[l.targets[k]],m.mesh&&m.mesh.primitives&&m.mesh.primitives.length)m=m.mesh.primitives[0].geometry,m.vertices.length===h.vertices.length&&h.morphTargets.push({name:"target_1",vertices:m.vertices});h.morphTargets.push({name:"target_Z",vertices:h.vertices})}i.morphTargets=!0;i=new THREE.Mesh(j,i);i.name="morph_"+qa.length;qa.push(i)}else i=
+new THREE.Mesh(j,i);1<a.geometries.length?b.add(i):b=i}}for(g=0;g<a.cameras.length;g++)b=db[a.cameras[g].url],b=new THREE.PerspectiveCamera(b.fov,b.aspect_ratio,b.znear,b.zfar);b.name=a.id||"";b.matrix=a.matrix;g=a.matrix.decompose();b.position=g[0];b.quaternion=g[1];b.useQuaternion=!0;b.scale=g[2];ga.centerGeometry&&b.geometry&&(g=THREE.GeometryUtils.center(b.geometry),b.quaternion.multiplyVector3(g.multiplySelf(b.scale)),b.position.subSelf(g));for(g=0;g<a.nodes.length;g++)b.add(f(a.nodes[g],a));
+return b}function g(){this.init_from=this.id=""}function h(){this.type=this.name=this.id="";this.morph=this.skin=null}function l(){this.weights=this.targets=this.source=this.method=null}function j(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function k(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function p(){this.sid=this.name=this.id="";this.nodes=[];this.controllers=[];this.transforms=[];this.geometries=[];this.channels=
+[];this.matrix=new THREE.Matrix4}function m(){this.type=this.sid="";this.data=[];this.obj=null}function o(){this.url="";this.skeleton=[];this.instance_material=[]}function r(){this.target=this.symbol=""}function n(){this.url="";this.instance_material=[]}function q(){this.id="";this.mesh=null}function s(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function u(){this.material="";this.count=0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function v(){u.call(this);
+this.vcount=[]}function t(){u.call(this);this.vcount=3}function w(){this.source="";this.stride=this.count=0;this.params=[]}function z(){this.input={}}function F(){this.semantic="";this.offset=0;this.source="";this.set=0}function C(a){this.id=a;this.type=null}function G(){this.name=this.id="";this.instance_effect=null}function K(){this.color=new THREE.Color(0);this.color.setRGB(Math.random(),Math.random(),Math.random());this.color.a=1;this.texOpts=this.texcoord=this.texture=null}function N(a,b){this.type=
+a;this.effect=b;this.material=null}function P(a){this.effect=a;this.format=this.init_from=null}function T(a){this.effect=a;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=this.source=null}function O(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function J(){this.url=""}function I(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function D(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=this.dotSyntax=
+this.sid=this.fullSid=null}function i(a){this.id="";this.animation=a;this.inputs=[];this.endTime=this.startTime=this.interpolation=this.strideOut=this.output=this.input=null;this.duration=0}function S(a){this.targets=[];this.time=a}function B(){this.technique=this.name=this.id=""}function A(){this.url=""}function V(a){return"dae"==a?"http://www.collada.org/2005/11/COLLADASchema":null}function E(a){for(var a=ea(a),b=[],c=0,d=a.length;c<d;c++)b.push(parseFloat(a[c]));return b}function aa(a){for(var a=
+ea(a),b=[],c=0,d=a.length;c<d;c++)b.push(parseInt(a[c],10));return b}function ea(a){return 0<a.length?a.replace(/^\s+/,"").replace(/\s+$/,"").split(/\s+/):[]}function ia(a,b,c){return a.hasAttribute(b)?parseInt(a.getAttribute(b),10):c}function R(a,b){if(ga.convertUpAxis&&Xa!==ga.upAxis)switch(La){case "XtoY":var c=a[0];a[0]=b*a[1];a[1]=c;break;case "XtoZ":c=a[2];a[2]=a[1];a[1]=a[0];a[0]=c;break;case "YtoX":c=a[0];a[0]=a[1];a[1]=b*c;break;case "YtoZ":c=a[1];a[1]=b*a[2];a[2]=c;break;case "ZtoX":c=a[0];
+a[0]=a[1];a[1]=a[2];a[2]=c;break;case "ZtoY":c=a[1],a[1]=a[2],a[2]=b*c}}function $(a,b){var c=[a[b],a[b+1],a[b+2]];R(c,-1);return new THREE.Vector3(c[0],c[1],c[2])}function ba(a){if(ga.convertUpAxis){var b=[a[0],a[4],a[8]];R(b,-1);a[0]=b[0];a[4]=b[1];a[8]=b[2];b=[a[1],a[5],a[9]];R(b,-1);a[1]=b[0];a[5]=b[1];a[9]=b[2];b=[a[2],a[6],a[10]];R(b,-1);a[2]=b[0];a[6]=b[1];a[10]=b[2];b=[a[0],a[1],a[2]];R(b,-1);a[0]=b[0];a[1]=b[1];a[2]=b[2];b=[a[4],a[5],a[6]];R(b,-1);a[4]=b[0];a[5]=b[1];a[6]=b[2];b=[a[8],a[9],
+a[10]];R(b,-1);a[8]=b[0];a[9]=b[1];a[10]=b[2];b=[a[3],a[7],a[11]];R(b,-1);a[3]=b[0];a[7]=b[1];a[11]=b[2]}return new THREE.Matrix4(a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8],a[9],a[10],a[11],a[12],a[13],a[14],a[15])}var Z=null,ja=null,Ga,oa=null,Ka={},Ua={},Da={},pa={},$a={},ab={},kb={},db={},hb,nb,Wa,qa,va,Ea=THREE.SmoothShading,ga={centerGeometry:!1,convertUpAxis:!1,subdivideFaces:!0,upAxis:"Y"},Xa="Y",La=null,ra=Math.PI/180;g.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=
+0;b<a.childNodes.length;b++){var c=a.childNodes[b];if("init_from"==c.nodeName)this.init_from=c.textContent}return this};h.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 j).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=[],d;this.method=
+a.getAttribute("method");this.source=a.getAttribute("source").replace(/^#/,"");for(d=0;d<a.childNodes.length;d++){var e=a.childNodes[d];if(1==e.nodeType)switch(e.nodeName){case "source":e=(new C).parse(e);b[e.id]=e;break;case "targets":c=this.parseInputs(e);break;default:console.log(e.nodeName)}}for(d=0;d<c.length;d++)switch(a=c[d],e=b[a.source],a.semantic){case "MORPH_TARGET":this.targets=e.read();break;case "MORPH_WEIGHT":this.weights=e.read()}return this};l.prototype.parseInputs=function(a){for(var b=
+[],c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(1==d.nodeType)switch(d.nodeName){case "input":b.push((new F).parse(d))}}return b};j.prototype.parse=function(a){var b={},c,d;this.source=a.getAttribute("source").replace(/^#/,"");this.invBindMatrices=[];this.joints=[];this.weights=[];for(var e=0;e<a.childNodes.length;e++){var f=a.childNodes[e];if(1==f.nodeType)switch(f.nodeName){case "bind_shape_matrix":f=E(f.textContent);this.bindShapeMatrix=ba(f);break;case "source":f=(new C).parse(f);b[f.id]=
+f;break;case "joints":c=f;break;case "vertex_weights":d=f;break;default:console.log(f.nodeName)}}this.parseJoints(c,b);this.parseWeights(d,b);return this};j.prototype.parseJoints=function(a,b){for(var c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(1==d.nodeType)switch(d.nodeName){case "input":var d=(new F).parse(d),e=b[d.source];if("JOINT"==d.semantic)this.joints=e.read();else if("INV_BIND_MATRIX"==d.semantic)this.invBindMatrices=e.read()}}};j.prototype.parseWeights=function(a,b){for(var c,
+d,e=[],f=0;f<a.childNodes.length;f++){var g=a.childNodes[f];if(1==g.nodeType)switch(g.nodeName){case "input":e.push((new F).parse(g));break;case "v":c=aa(g.textContent);break;case "vcount":d=aa(g.textContent)}}for(f=g=0;f<d.length;f++){for(var h=d[f],i=[],j=0;j<h;j++){for(var l={},k=0;k<e.length;k++){var m=e[k],n=c[g+m.offset];switch(m.semantic){case "JOINT":l.joint=n;break;case "WEIGHT":l.weight=b[m.source].data[n]}}i.push(l);g+=e.length}for(j=0;j<i.length;j++)i[j].index=f;this.weights.push(i)}};
+k.prototype.getChildById=function(a,b){for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildById(a,b);if(d)return d}return null};k.prototype.getChildBySid=function(a,b){for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildBySid(a,b);if(d)return d}return null};k.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(1==c.nodeType)switch(c.nodeName){case "node":this.nodes.push((new p).parse(c))}}return this};
+p.prototype.getChannelForTransform=function(a){for(var b=0;b<this.channels.length;b++){var c=this.channels[b],d=c.target.split("/");d.shift();var e=d.shift(),f=0<=e.indexOf("."),g=0<=e.indexOf("("),h;if(f)d=e.split("."),e=d.shift(),d.shift();else if(g){h=e.split("(");e=h.shift();for(d=0;d<h.length;d++)h[d]=parseInt(h[d].replace(/\)/,""))}if(e==a)return c.info={sid:e,dotSyntax:f,arrSyntax:g,arrIndices:h},c}return null};p.prototype.getChildById=function(a,b){if(this.id==a)return this;if(b)for(var c=
+0;c<this.nodes.length;c++){var d=this.nodes[c].getChildById(a,b);if(d)return d}return null};p.prototype.getChildBySid=function(a,b){if(this.sid==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildBySid(a,b);if(d)return d}return null};p.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};p.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="JOINT"==this.type?this.type:"NODE";this.nodes=[];this.transforms=[];this.geometries=[];this.cameras=[];this.controllers=[];this.matrix=new THREE.Matrix4;for(var c=0;c<a.childNodes.length;c++)if(b=a.childNodes[c],1==b.nodeType)switch(b.nodeName){case "node":this.nodes.push((new p).parse(b));break;case "instance_camera":this.cameras.push((new A).parse(b));break;case "instance_controller":this.controllers.push((new o).parse(b));
+break;case "instance_geometry":this.geometries.push((new n).parse(b));break;case "instance_light":break;case "instance_node":b=b.getAttribute("url").replace(/^#/,"");(b=Z.evaluate(".//dae:library_nodes//dae:node[@id='"+b+"']",Z,V,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new p).parse(b));break;case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new m).parse(b));break;case "extra":break;default:console.log(b.nodeName)}a=
+[];c=1E6;b=-1E6;for(var d in Da)for(var e=Da[d],f=0;f<e.channel.length;f++){var g=e.channel[f],h=e.sampler[f];d=g.target.split("/")[0];if(d==this.id)h.create(),g.sampler=h,c=Math.min(c,h.startTime),b=Math.max(b,h.endTime),a.push(g)}if(a.length)this.startTime=c,this.endTime=b;if((this.channels=a)&&this.channels.length){d=[];a=[];c=0;for(e=this.channels.length;c<e;c++){b=this.channels[c];f=b.fullSid;g=b.member;if(ga.convertUpAxis)switch(g){case "X":switch(La){case "XtoY":case "XtoZ":case "YtoX":g="Y";
+break;case "ZtoX":g="Z"}break;case "Y":switch(La){case "XtoY":case "YtoX":case "ZtoX":g="X";break;case "XtoZ":case "YtoZ":case "ZtoY":g="Z"}break;case "Z":switch(La){case "XtoZ":g="X";break;case "YtoZ":case "ZtoX":case "ZtoY":g="Y"}}var h=b.sampler,i=h.input,j=this.getTransformBySid(b.sid);if(j){-1===a.indexOf(f)&&a.push(f);b=0;for(var l=i.length;b<l;b++){var k=i[b],r=h.getData(j.type,b),q;q=null;for(var s=0,t=d.length;s<t&&null==q;s++){var u=d[s];if(u.time===k)q=u;else if(u.time>k)break}if(!q){q=
+new S(k);s=-1;t=0;for(u=d.length;t<u&&-1==s;t++)d[t].time>=k&&(s=t);k=s;d.splice(-1==k?d.length:k,0,q)}q.addTarget(f,j,g,r)}}else console.log('Could not find transform "'+b.sid+'" in node '+this.id)}for(c=0;c<a.length;c++){e=a[c];for(b=0;b<d.length;b++)if(q=d[b],!q.hasTarget(e)){h=d;f=q;j=b;g=e;i=void 0;a:{i=j?j-1:0;for(i=0<=i?i:i+h.length;0<=i;i--)if(l=h[i],l.hasTarget(g)){i=l;break a}i=null}l=void 0;a:{for(j+=1;j<h.length;j++)if(l=h[j],l.hasTarget(g))break a;l=null}if(i&&l){h=(f.time-i.time)/(l.time-
+i.time);i=i.getTarget(g);j=l.getTarget(g).data;l=i.data;r=void 0;if(l.length){r=[];for(k=0;k<l.length;++k)r[k]=l[k]+(j[k]-l[k])*h}else r=l+(j-l)*h;f.addTarget(g,i.transform,i.member,r)}}}this.keys=d;this.sids=a}this.updateMatrix();return this};p.prototype.updateMatrix=function(){this.matrix.identity();for(var a=0;a<this.transforms.length;a++)this.transforms[a].apply(this.matrix)};m.prototype.parse=function(a){this.sid=a.getAttribute("sid");this.type=a.nodeName;this.data=E(a.textContent);this.convert();
+return this};m.prototype.convert=function(){switch(this.type){case "matrix":this.obj=ba(this.data);break;case "rotate":this.angle=this.data[3]*ra;case "translate":R(this.data,-1);this.obj=new THREE.Vector3(this.data[0],this.data[1],this.data[2]);break;case "scale":R(this.data,1);this.obj=new THREE.Vector3(this.data[0],this.data[1],this.data[2]);break;default:console.log("Can not convert Transform of type "+this.type)}};m.prototype.apply=function(a){switch(this.type){case "matrix":a.multiplySelf(this.obj);
+break;case "translate":a.translate(this.obj);break;case "rotate":a.rotateByAxis(this.obj,this.angle);break;case "scale":a.scale(this.obj)}};m.prototype.update=function(a,b){switch(this.type){case "matrix":console.log("Currently not handling matrix transform updates");break;case "translate":case "scale":switch(b){case "X":this.obj.x=a;break;case "Y":this.obj.y=a;break;case "Z":this.obj.z=a;break;default:this.obj.x=a[0],this.obj.y=a[1],this.obj.z=a[2]}break;case "rotate":switch(b){case "X":this.obj.x=
+a;break;case "Y":this.obj.y=a;break;case "Z":this.obj.z=a;break;case "ANGLE":this.angle=a*ra;break;default:this.obj.x=a[0],this.obj.y=a[1],this.obj.z=a[2],this.angle=a[3]*ra}}};o.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(1==c.nodeType)switch(c.nodeName){case "skeleton":this.skeleton.push(c.textContent.replace(/^#/,""));break;case "bind_material":if(c=Z.evaluate(".//dae:instance_material",
+c,V,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(var d=c.iterateNext();d;)this.instance_material.push((new r).parse(d)),d=c.iterateNext()}}return this};r.prototype.parse=function(a){this.symbol=a.getAttribute("symbol");this.target=a.getAttribute("target").replace(/^#/,"");return this};n.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(1==c.nodeType&&"bind_material"==c.nodeName){if(a=
+Z.evaluate(".//dae:instance_material",c,V,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(b=a.iterateNext();b;)this.instance_material.push((new r).parse(b)),b=a.iterateNext();break}}return this};q.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 s(this)).parse(c)}}return this};s.prototype.parse=function(a){this.primitives=[];var b;for(b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];
+switch(c.nodeName){case "source":var d=c.getAttribute("id");void 0==Ka[d]&&(Ka[d]=(new C(d)).parse(c));break;case "vertices":this.vertices=(new z).parse(c);break;case "triangles":this.primitives.push((new t).parse(c));break;case "polygons":this.primitives.push((new u).parse(c));break;case "polylist":this.primitives.push((new v).parse(c))}}this.geometry3js=new THREE.Geometry;a=Ka[this.vertices.input.POSITION.source].data;for(b=0;b<a.length;b+=3)this.geometry3js.vertices.push(new THREE.Vertex($(a,b)));
+for(b=0;b<this.primitives.length;b++)a=this.primitives[b],a.setVertices(this.vertices),this.handlePrimitive(a,this.geometry3js);this.geometry3js.computeCentroids();this.geometry3js.computeFaceNormals();this.geometry3js.calcNormals&&(this.geometry3js.computeVertexNormals(),delete this.geometry3js.calcNormals);this.geometry3js.computeBoundingBox();return this};s.prototype.handlePrimitive=function(a,b){var c,d,e=a.p,f=a.inputs,g,h,i,j,l=0,k=3,m=0,n=[];for(c=0;c<f.length;c++)switch(g=f[c],k=g.offset+
+1,m=m<k?k:m,g.semantic){case "TEXCOORD":n.push(g.set)}for(var o=0;o<e.length;++o)for(var p=e[o],r=0;r<p.length;){var q=[],s=[],t={},u=[],k=a.vcount?a.vcount.length?a.vcount[l++]:a.vcount:p.length/m;for(c=0;c<k;c++)for(d=0;d<f.length;d++)switch(g=f[d],j=Ka[g.source],h=p[r+c*m+g.offset],i=j.accessor.params.length,i*=h,g.semantic){case "VERTEX":q.push(h);break;case "NORMAL":s.push($(j.data,i));break;case "TEXCOORD":void 0===t[g.set]&&(t[g.set]=[]);t[g.set].push(new THREE.UV(j.data[i],1-j.data[i+1]));
+break;case "COLOR":u.push((new THREE.Color).setRGB(j.data[i],j.data[i+1],j.data[i+2]))}d=null;c=[];if(0==s.length)if(g=this.vertices.input.NORMAL){j=Ka[g.source];i=j.accessor.params.length;g=0;for(h=q.length;g<h;g++)s.push($(j.data,q[g]*i))}else b.calcNormals=!0;if(3===k)c.push(new THREE.Face3(q[0],q[1],q[2],s,u.length?u:new THREE.Color));else if(4===k)c.push(new THREE.Face4(q[0],q[1],q[2],q[3],s,u.length?u:new THREE.Color));else if(4<k&&ga.subdivideFaces){u=u.length?u:new THREE.Color;for(d=1;d<k-
+1;)c.push(new THREE.Face3(q[0],q[d],q[d+1],[s[0],s[d++],s[d]],u))}if(c.length){g=0;for(h=c.length;g<h;g++){d=c[g];d.daeMaterial=a.material;b.faces.push(d);for(d=0;d<n.length;d++)q=t[n[d]],q=4<k?[q[0],q[g+1],q[g+2]]:4===k?[q[0],q[1],q[2],q[3]]:[q[0],q[1],q[2]],b.faceVertexUvs[d]||(b.faceVertexUvs[d]=[]),b.faceVertexUvs[d].push(q)}}else console.log("dropped face with vcount "+k+" for geometry with id: "+b.id);r+=m*k}};u.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};u.prototype.parse=function(a){this.material=a.getAttribute("material");this.count=ia(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 F).parse(a.childNodes[b]));break;case "vcount":this.vcount=aa(c.textContent);break;case "p":this.p.push(aa(c.textContent));break;case "ph":console.warn("polygon holes not yet supported!")}}return this};v.prototype=new u;v.prototype.constructor=
+v;t.prototype=new u;t.prototype.constructor=t;w.prototype.parse=function(a){this.params=[];this.source=a.getAttribute("source");this.count=ia(a,"count",0);this.stride=ia(a,"stride",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if("param"==c.nodeName){var d={};d.name=c.getAttribute("name");d.type=c.getAttribute("type");this.params.push(d)}}return this};z.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++)if("input"==a.childNodes[b].nodeName){var c=
+(new F).parse(a.childNodes[b]);this.input[c.semantic]=c}return this};F.prototype.parse=function(a){this.semantic=a.getAttribute("semantic");this.source=a.getAttribute("source").replace(/^#/,"");this.set=ia(a,"set",-1);this.offset=ia(a,"offset",0);if("TEXCOORD"==this.semantic&&0>this.set)this.set=0;return this};C.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 d=ea(c.textContent),e=[],
+f=0,g=d.length;f<g;f++)e.push("true"==d[f]||"1"==d[f]?!0:!1);this.data=e;this.type=c.nodeName;break;case "float_array":this.data=E(c.textContent);this.type=c.nodeName;break;case "int_array":this.data=aa(c.textContent);this.type=c.nodeName;break;case "IDREF_array":case "Name_array":this.data=ea(c.textContent);this.type=c.nodeName;break;case "technique_common":for(d=0;d<c.childNodes.length;d++)if("accessor"==c.childNodes[d].nodeName){this.accessor=(new w).parse(c.childNodes[d]);break}}}return this};
+C.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),c=ba(c);a.push(c)}break;default:console.log("ColladaLoader: Source: Read dont know how to read "+b.type+".")}return a};G.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");for(var b=0;b<a.childNodes.length;b++)if("instance_effect"==a.childNodes[b].nodeName){this.instance_effect=
+(new J).parse(a.childNodes[b]);break}return this};K.prototype.isColor=function(){return null==this.texture};K.prototype.isTexture=function(){return null!=this.texture};K.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "color":c=E(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"),
+this.texOpts={offsetU:0,offsetV:0,repeatU:1,repeatV:1,wrapU:1,wrapV:1},this.parseTexture(c)}}return this};K.prototype.parseTexture=function(a){if(!a.childNodes)return this;a.childNodes[1]&&"extra"===a.childNodes[1].nodeName&&(a=a.childNodes[1],a.childNodes[1]&&"technique"===a.childNodes[1].nodeName&&(a=a.childNodes[1]));for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "offsetU":case "offsetV":case "repeatU":case "repeatV":this.texOpts[c.nodeName]=parseFloat(c.textContent);
+break;case "wrapU":case "wrapV":this.texOpts[c.nodeName]=parseInt(c.textContent);break;default:this.texOpts[c.nodeName]=c.textContent}}return this};N.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[c.nodeName]=(new K).parse(c);break;case "shininess":case "reflectivity":case "transparency":var d;d=Z.evaluate(".//dae:float",c,V,XPathResult.ORDERED_NODE_ITERATOR_TYPE,
+null);for(var e=d.iterateNext(),f=[];e;)f.push(e),e=d.iterateNext();d=f;0<d.length&&(this[c.nodeName]=parseFloat(d[0].textContent))}}this.create();return this};N.prototype.create=function(){var a={},b=void 0!==this.transparency&&1>this.transparency,c;for(c in this)switch(c){case "ambient":case "emission":case "diffuse":case "specular":var d=this[c];if(d instanceof K)if(d.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid){var e=Ua[this.effect.surface.init_from];
+if(e)e=THREE.ImageUtils.loadTexture(Wa+e.init_from),e.wrapS=d.texOpts.wrapU?THREE.RepeatWrapping:THREE.ClampToEdgeWrapping,e.wrapT=d.texOpts.wrapV?THREE.RepeatWrapping:THREE.ClampToEdgeWrapping,e.offset.x=d.texOpts.offsetU,e.offset.y=d.texOpts.offsetV,e.repeat.x=d.texOpts.repeatU,e.repeat.y=d.texOpts.repeatV,a.map=e}}else if("diffuse"==c||!b)a[c]=d.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=
+Ea;switch(this.type){case "constant":a.color=a.emission;this.material=new THREE.MeshBasicMaterial(a);break;case "phong":case "blinn":a.color=a.diffuse;this.material=new THREE.MeshPhongMaterial(a);break;default:a.color=a.diffuse,this.material=new THREE.MeshLambertMaterial(a)}return this.material};P.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)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};T.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)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};O.prototype.create=function(){if(null==this.shader)return null};O.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(1==c.nodeType)switch(c.nodeName){case "profile_COMMON":this.parseTechnique(this.parseProfileCOMMON(c))}}return this};O.prototype.parseNewparam=function(a){for(var b=a.getAttribute("sid"),
+c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(1==d.nodeType)switch(d.nodeName){case "surface":this.surface=(new P(this)).parse(d);this.surface.sid=b;break;case "sampler2D":this.sampler=(new T(this)).parse(d);this.sampler.sid=b;break;case "extra":break;default:console.log(d.nodeName)}}};O.prototype.parseProfileCOMMON=function(a){for(var b,c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(1==d.nodeType)switch(d.nodeName){case "profile_COMMON":this.parseProfileCOMMON(d);break;case "technique":b=
+d;break;case "newparam":this.parseNewparam(d);break;case "image":d=(new g).parse(d);Ua[d.id]=d;break;case "extra":break;default:console.log(d.nodeName)}}return b};O.prototype.parseTechnique=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "constant":case "lambert":case "blinn":case "phong":this.shader=(new N(c.nodeName,this)).parse(c)}}};J.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");return this};I.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(1==c.nodeType)switch(c.nodeName){case "source":c=(new C).parse(c);this.source[c.id]=c;break;case "sampler":this.sampler.push((new i(this)).parse(c));break;case "channel":this.channel.push((new D(this)).parse(c))}}return this};D.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=0<=a.indexOf("."),d=0<=a.indexOf("(");if(c)b=a.split("."),this.sid=b.shift(),this.member=b.shift();else if(d){b=a.split("(");this.sid=b.shift();for(var e=0;e<b.length;e++)b[e]=parseInt(b[e].replace(/\)/,""));this.arrIndices=b}else this.sid=a;this.fullSid=a;this.dotSyntax=c;this.arrSyntax=d;return this};i.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(1==c.nodeType)switch(c.nodeName){case "input":this.inputs.push((new F).parse(c))}}return this};
+i.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();this.strideOut=c.accessor.stride;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}};i.prototype.getData=function(a,b){var c;if(1<this.strideOut){c=[];for(var b=b*this.strideOut,d=0;d<this.strideOut;++d)c[d]=this.output[b+d];if(3===this.strideOut)switch(a){case "rotate":case "translate":R(c,-1);break;case "scale":R(c,1)}}else c=this.output[b];return c};S.prototype.addTarget=function(a,b,c,d){this.targets.push({sid:a,
+member:c,transform:b,data:d})};S.prototype.apply=function(a){for(var b=0;b<this.targets.length;++b){var c=this.targets[b];(!a||c.sid===a)&&c.transform.update(c.data,c.member)}};S.prototype.getTarget=function(a){for(var b=0;b<this.targets.length;++b)if(this.targets[b].sid===a)return this.targets[b];return null};S.prototype.hasTarget=function(a){for(var b=0;b<this.targets.length;++b)if(this.targets[b].sid===a)return!0;return!1};S.prototype.interpolate=function(a,b){for(var c=0;c<this.targets.length;++c){var d=
+this.targets[c],e=a.getTarget(d.sid);if(e){var f=(b-this.time)/(a.time-this.time),g=e.data,h=d.data;if(0>f||1<f)console.log("Key.interpolate: Warning! Scale out of bounds:"+f),f=0>f?0:1;if(h.length)for(var e=[],i=0;i<h.length;++i)e[i]=h[i]+(g[i]-h[i])*f;else e=h+(g-h)*f}else e=d.data;d.transform.update(e,d.member)}};B.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "optics":this.parseOptics(c)}}return this};
+B.prototype.parseOptics=function(a){for(var b=0;b<a.childNodes.length;b++)if("technique_common"==a.childNodes[b].nodeName)for(var c=a.childNodes[b],d=0;d<c.childNodes.length;d++)if(this.technique=c.childNodes[d].nodeName,"perspective"==this.technique)for(var e=c.childNodes[d],f=0;f<e.childNodes.length;f++){var g=e.childNodes[f];switch(g.nodeName){case "yfov":this.yfov=g.textContent;break;case "xfov":this.xfov=g.textContent;break;case "znear":this.znear=g.textContent;break;case "zfar":this.zfar=g.textContent;
+break;case "aspect_ratio":this.aspect_ratio=g.textContent}}else if("orthographic"==this.technique){e=c.childNodes[d];for(f=0;f<e.childNodes.length;f++)switch(g=e.childNodes[f],g.nodeName){case "xmag":this.xmag=g.textContent;break;case "ymag":this.ymag=g.textContent;break;case "znear":this.znear=g.textContent;break;case "zfar":this.zfar=g.textContent;break;case "aspect_ratio":this.aspect_ratio=g.textContent}}return this};A.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");
+return this};return{load:function(b,c,d){var e=0;if(document.implementation&&document.implementation.createDocument){var f=new XMLHttpRequest;f.overrideMimeType&&f.overrideMimeType("text/xml");f.onreadystatechange=function(){if(4==f.readyState){if(0==f.status||200==f.status)f.responseXML?(oa=c,a(f.responseXML,void 0,b)):console.error("ColladaLoader: Empty or non-existing file ("+b+")")}else 3==f.readyState&&d&&(0==e&&(e=f.getResponseHeader("Content-Length")),d({total:e,loaded:f.responseText.length}))};
+f.open("GET",b,!0);f.send(null)}else alert("Don't know how to parse XML!")},parse:a,setPreferredShading:function(a){Ea=a},applySkin:e,geometries:$a,options:ga}};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){c=c?c:this.extractUrlBase(a);this.onLoadStart();this.loadAjaxJSON(this,a,b,c)};
 THREE.JSONLoader.prototype.loadAjaxJSON=function(a,b,c,d,e){var f=new XMLHttpRequest,g=0;f.onreadystatechange=function(){if(f.readyState===f.DONE)if(200===f.status||0===f.status){if(f.responseText){var h=JSON.parse(f.responseText);a.createModel(h,c,d)}else console.warn("THREE.JSONLoader: ["+b+"] seems to be unreachable or file there is empty");a.onLoadComplete()}else console.error("THREE.JSONLoader: Couldn't load ["+b+"] ["+f.status+"]");else f.readyState===f.LOADING?e&&(0===g&&(g=f.getResponseHeader("Content-Length")),
 e({total:g,loaded:f.responseText.length})):f.readyState===f.HEADERS_RECEIVED&&(g=f.getResponseHeader("Content-Length"))};f.open("GET",b,!0);f.overrideMimeType&&f.overrideMimeType("text/plain; charset=x-user-defined");f.setRequestHeader("Content-Type","text/plain");f.send(null)};
-THREE.JSONLoader.prototype.createModel=function(a,b,c){var d=new THREE.Geometry,e=void 0!==a.scale?1/a.scale:1;this.initMaterials(d,a.materials,c);(function(b){var c,e,i,m,k,p,n,o,q,l,r,s,u,v,t=a.faces;p=a.vertices;var w=a.normals,A=a.colors,G=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&G++;for(c=0;c<G;c++)d.faceUvs[c]=[],d.faceVertexUvs[c]=[];m=0;for(k=p.length;m<k;)n=new THREE.Vertex,n.position.x=p[m++]*b,n.position.y=p[m++]*b,n.position.z=p[m++]*b,d.vertices.push(n);m=0;for(k=t.length;m<k;){b=
-t[m++];p=b&1;i=b&2;c=b&4;e=b&8;o=b&16;n=b&32;l=b&64;b&=128;p?(r=new THREE.Face4,r.a=t[m++],r.b=t[m++],r.c=t[m++],r.d=t[m++],p=4):(r=new THREE.Face3,r.a=t[m++],r.b=t[m++],r.c=t[m++],p=3);if(i)i=t[m++],r.materialIndex=i;i=d.faces.length;if(c)for(c=0;c<G;c++)s=a.uvs[c],q=t[m++],v=s[2*q],q=s[2*q+1],d.faceUvs[c][i]=new THREE.UV(v,q);if(e)for(c=0;c<G;c++){s=a.uvs[c];u=[];for(e=0;e<p;e++)q=t[m++],v=s[2*q],q=s[2*q+1],u[e]=new THREE.UV(v,q);d.faceVertexUvs[c][i]=u}if(o)o=3*t[m++],e=new THREE.Vector3,e.x=w[o++],
-e.y=w[o++],e.z=w[o],r.normal=e;if(n)for(c=0;c<p;c++)o=3*t[m++],e=new THREE.Vector3,e.x=w[o++],e.y=w[o++],e.z=w[o],r.vertexNormals.push(e);if(l)n=t[m++],n=new THREE.Color(A[n]),r.color=n;if(b)for(c=0;c<p;c++)n=t[m++],n=new THREE.Color(A[n]),r.vertexColors.push(n);d.faces.push(r)}})(e);(function(){var b,c,e,i;if(a.skinWeights)for(b=0,c=a.skinWeights.length;b<c;b+=2)e=a.skinWeights[b],i=a.skinWeights[b+1],d.skinWeights.push(new THREE.Vector4(e,i,0,0));if(a.skinIndices)for(b=0,c=a.skinIndices.length;b<
-c;b+=2)e=a.skinIndices[b],i=a.skinIndices[b+1],d.skinIndices.push(new THREE.Vector4(e,i,0,0));d.bones=a.bones;d.animation=a.animation})();(function(b){if(void 0!==a.morphTargets){var c,e,i,m,k,p,n,o,q;for(c=0,e=a.morphTargets.length;c<e;c++){d.morphTargets[c]={};d.morphTargets[c].name=a.morphTargets[c].name;d.morphTargets[c].vertices=[];o=d.morphTargets[c].vertices;q=a.morphTargets[c].vertices;for(i=0,m=q.length;i<m;i+=3)k=q[i]*b,p=q[i+1]*b,n=q[i+2]*b,o.push(new THREE.Vertex(new THREE.Vector3(k,p,
-n)))}}if(void 0!==a.morphColors)for(c=0,e=a.morphColors.length;c<e;c++){d.morphColors[c]={};d.morphColors[c].name=a.morphColors[c].name;d.morphColors[c].colors=[];m=d.morphColors[c].colors;k=a.morphColors[c].colors;for(b=0,i=k.length;b<i;b+=3)p=new THREE.Color(16755200),p.setRGB(k[b],k[b+1],k[b+2]),m.push(p)}})(e);d.computeCentroids();d.computeFaceNormals();this.hasNormals(d)&&d.computeTangents();b(d)};
+THREE.JSONLoader.prototype.createModel=function(a,b,c){var d=new THREE.Geometry,e=void 0!==a.scale?1/a.scale:1;this.initMaterials(d,a.materials,c);(function(b){var c,e,l,j,k,p,m,o,r,n,q,s,u,v,t=a.faces;p=a.vertices;var w=a.normals,z=a.colors,F=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&F++;for(c=0;c<F;c++)d.faceUvs[c]=[],d.faceVertexUvs[c]=[];j=0;for(k=p.length;j<k;)m=new THREE.Vertex,m.position.x=p[j++]*b,m.position.y=p[j++]*b,m.position.z=p[j++]*b,d.vertices.push(m);j=0;for(k=t.length;j<k;){b=
+t[j++];p=b&1;l=b&2;c=b&4;e=b&8;o=b&16;m=b&32;n=b&64;b&=128;p?(q=new THREE.Face4,q.a=t[j++],q.b=t[j++],q.c=t[j++],q.d=t[j++],p=4):(q=new THREE.Face3,q.a=t[j++],q.b=t[j++],q.c=t[j++],p=3);if(l)l=t[j++],q.materialIndex=l;l=d.faces.length;if(c)for(c=0;c<F;c++)s=a.uvs[c],r=t[j++],v=s[2*r],r=s[2*r+1],d.faceUvs[c][l]=new THREE.UV(v,r);if(e)for(c=0;c<F;c++){s=a.uvs[c];u=[];for(e=0;e<p;e++)r=t[j++],v=s[2*r],r=s[2*r+1],u[e]=new THREE.UV(v,r);d.faceVertexUvs[c][l]=u}if(o)o=3*t[j++],e=new THREE.Vector3,e.x=w[o++],
+e.y=w[o++],e.z=w[o],q.normal=e;if(m)for(c=0;c<p;c++)o=3*t[j++],e=new THREE.Vector3,e.x=w[o++],e.y=w[o++],e.z=w[o],q.vertexNormals.push(e);if(n)m=t[j++],m=new THREE.Color(z[m]),q.color=m;if(b)for(c=0;c<p;c++)m=t[j++],m=new THREE.Color(z[m]),q.vertexColors.push(m);d.faces.push(q)}})(e);(function(){var b,c,e,l;if(a.skinWeights)for(b=0,c=a.skinWeights.length;b<c;b+=2)e=a.skinWeights[b],l=a.skinWeights[b+1],d.skinWeights.push(new THREE.Vector4(e,l,0,0));if(a.skinIndices)for(b=0,c=a.skinIndices.length;b<
+c;b+=2)e=a.skinIndices[b],l=a.skinIndices[b+1],d.skinIndices.push(new THREE.Vector4(e,l,0,0));d.bones=a.bones;d.animation=a.animation})();(function(b){if(void 0!==a.morphTargets){var c,e,l,j,k,p,m,o,r;for(c=0,e=a.morphTargets.length;c<e;c++){d.morphTargets[c]={};d.morphTargets[c].name=a.morphTargets[c].name;d.morphTargets[c].vertices=[];o=d.morphTargets[c].vertices;r=a.morphTargets[c].vertices;for(l=0,j=r.length;l<j;l+=3)k=r[l]*b,p=r[l+1]*b,m=r[l+2]*b,o.push(new THREE.Vertex(new THREE.Vector3(k,p,
+m)))}}if(void 0!==a.morphColors)for(c=0,e=a.morphColors.length;c<e;c++){d.morphColors[c]={};d.morphColors[c].name=a.morphColors[c].name;d.morphColors[c].colors=[];j=d.morphColors[c].colors;k=a.morphColors[c].colors;for(b=0,l=k.length;b<l;b+=3)p=new THREE.Color(16755200),p.setRGB(k[b],k[b+1],k[b+2]),j.push(p)}})(e);d.computeCentroids();d.computeFaceNormals();this.hasNormals(d)&&d.computeTangents();b(d)};
 THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};THREE.SceneLoader.prototype.constructor=THREE.SceneLoader;
 THREE.SceneLoader.prototype.load=function(a,b){var c=this,d=new XMLHttpRequest;d.onreadystatechange=function(){if(4==d.readyState)if(200==d.status||0==d.status){var e=JSON.parse(d.responseText);c.createScene(e,b,a)}else console.error("THREE.SceneLoader: Couldn't load ["+a+"] ["+d.status+"]")};d.open("GET",a,!0);d.overrideMimeType&&d.overrideMimeType("text/plain; charset=x-user-defined");d.setRequestHeader("Content-Type","text/plain");d.send(null)};
-THREE.SceneLoader.prototype.createScene=function(a,b,c){function d(a,b){return"relativeToHTML"==b?a:m+"/"+a}function e(){var a;for(n in L.objects)if(!C.objects[n])if(s=L.objects[n],void 0!==s.geometry){if(J=C.geometries[s.geometry])a=!1,O=C.materials[s.materials[0]],(a=O instanceof THREE.ShaderMaterial)&&J.computeTangents(),t=s.position,w=s.rotation,A=s.quaternion,G=s.scale,A=0,0==s.materials.length&&(O=new THREE.MeshFaceMaterial),1<s.materials.length&&(O=new THREE.MeshFaceMaterial),a=new THREE.Mesh(J,
-O),a.name=n,a.position.set(t[0],t[1],t[2]),A?(a.quaternion.set(A[0],A[1],A[2],A[3]),a.useQuaternion=!0):a.rotation.set(w[0],w[1],w[2]),a.scale.set(G[0],G[1],G[2]),a.visible=s.visible,a.doubleSided=s.doubleSided,a.castShadow=s.castShadow,a.receiveShadow=s.receiveShadow,C.scene.add(a),C.objects[n]=a}else t=s.position,w=s.rotation,A=s.quaternion,G=s.scale,A=0,a=new THREE.Object3D,a.name=n,a.position.set(t[0],t[1],t[2]),A?(a.quaternion.set(A[0],A[1],A[2],A[3]),a.useQuaternion=!0):a.rotation.set(w[0],
-w[1],w[2]),a.scale.set(G[0],G[1],G[2]),a.visible=void 0!==s.visible?s.visible:!1,C.scene.add(a),C.objects[n]=a,C.empties[n]=a}function f(a){return function(b){C.geometries[a]=b;e();M-=1;i.onLoadComplete();h()}}function g(a){return function(b){C.geometries[a]=b}}function h(){i.callbackProgress({totalModels:j,totalTextures:T,loadedModels:j-M,loadedTextures:T-B},C);i.onLoadProgress();0==M&&0==B&&b(C)}var i=this,m=THREE.Loader.prototype.extractUrlBase(c),k,p,n,o,q,l,r,s,u,v,t,w,A,G,F,D,J,O,P,U,L,I,M,
-B,j,T,C;L=a;c=new THREE.BinaryLoader;I=new THREE.JSONLoader;B=M=0;C={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},empties:{}};if(L.transform&&(a=L.transform.position,u=L.transform.rotation,F=L.transform.scale,a&&C.scene.position.set(a[0],a[1],a[2]),u&&C.scene.rotation.set(u[0],u[1],u[2]),F&&C.scene.scale.set(F[0],F[1],F[2]),a||u||F))C.scene.updateMatrix(),C.scene.updateMatrixWorld();a=function(){B-=1;h();i.onLoadComplete()};for(q in L.cameras)F=
-L.cameras[q],"perspective"==F.type?P=new THREE.PerspectiveCamera(F.fov,F.aspect,F.near,F.far):"ortho"==F.type&&(P=new THREE.OrthographicCamera(F.left,F.right,F.top,F.bottom,F.near,F.far)),t=F.position,u=F.target,F=F.up,P.position.set(t[0],t[1],t[2]),P.target=new THREE.Vector3(u[0],u[1],u[2]),F&&P.up.set(F[0],F[1],F[2]),C.cameras[q]=P;for(o in L.lights)u=L.lights[o],q=void 0!==u.color?u.color:16777215,P=void 0!==u.intensity?u.intensity:1,"directional"==u.type?(t=u.direction,v=new THREE.DirectionalLight(q,
-P),v.position.set(t[0],t[1],t[2]),v.position.normalize()):"point"==u.type?(t=u.position,v=u.distance,v=new THREE.PointLight(q,P,v),v.position.set(t[0],t[1],t[2])):"ambient"==u.type&&(v=new THREE.AmbientLight(q)),C.scene.add(v),C.lights[o]=v;for(l in L.fogs)o=L.fogs[l],"linear"==o.type?U=new THREE.Fog(0,o.near,o.far):"exp2"==o.type&&(U=new THREE.FogExp2(0,o.density)),F=o.color,U.color.setRGB(F[0],F[1],F[2]),C.fogs[l]=U;if(C.cameras&&L.defaults.camera)C.currentCamera=C.cameras[L.defaults.camera];if(C.fogs&&
-L.defaults.fog)C.scene.fog=C.fogs[L.defaults.fog];F=L.defaults.bgcolor;C.bgColor=new THREE.Color;C.bgColor.setRGB(F[0],F[1],F[2]);C.bgColorAlpha=L.defaults.bgalpha;for(k in L.geometries)if(l=L.geometries[k],"bin_mesh"==l.type||"ascii_mesh"==l.type)M+=1,i.onLoadStart();j=M;for(k in L.geometries)if(l=L.geometries[k],"cube"==l.type)J=new THREE.CubeGeometry(l.width,l.height,l.depth,l.segmentsWidth,l.segmentsHeight,l.segmentsDepth,null,l.flipped,l.sides),C.geometries[k]=J;else if("plane"==l.type)J=new THREE.PlaneGeometry(l.width,
-l.height,l.segmentsWidth,l.segmentsHeight),C.geometries[k]=J;else if("sphere"==l.type)J=new THREE.SphereGeometry(l.radius,l.segmentsWidth,l.segmentsHeight),C.geometries[k]=J;else if("cylinder"==l.type)J=new THREE.CylinderGeometry(l.topRad,l.botRad,l.height,l.radSegs,l.heightSegs),C.geometries[k]=J;else if("torus"==l.type)J=new THREE.TorusGeometry(l.radius,l.tube,l.segmentsR,l.segmentsT),C.geometries[k]=J;else if("icosahedron"==l.type)J=new THREE.IcosahedronGeometry(l.radius,l.subdivisions),C.geometries[k]=
-J;else if("bin_mesh"==l.type)c.load(d(l.url,L.urlBaseType),f(k));else if("ascii_mesh"==l.type)I.load(d(l.url,L.urlBaseType),f(k));else if("embedded_mesh"==l.type)l=L.embeds[l.id],l.metadata=L.metadata,l&&I.createModel(l,g(k),"");for(r in L.textures)if(k=L.textures[r],k.url instanceof Array){B+=k.url.length;for(l=0;l<k.url.length;l++)i.onLoadStart()}else B+=1,i.onLoadStart();T=B;for(r in L.textures){k=L.textures[r];if(void 0!=k.mapping&&void 0!=THREE[k.mapping])k.mapping=new THREE[k.mapping];if(k.url instanceof
-Array){l=[];for(U=0;U<k.url.length;U++)l[U]=d(k.url[U],L.urlBaseType);l=THREE.ImageUtils.loadTextureCube(l,k.mapping,a)}else{l=THREE.ImageUtils.loadTexture(d(k.url,L.urlBaseType),k.mapping,a);if(void 0!=THREE[k.minFilter])l.minFilter=THREE[k.minFilter];if(void 0!=THREE[k.magFilter])l.magFilter=THREE[k.magFilter];if(k.repeat){l.repeat.set(k.repeat[0],k.repeat[1]);if(1!=k.repeat[0])l.wrapS=THREE.RepeatWrapping;if(1!=k.repeat[1])l.wrapT=THREE.RepeatWrapping}k.offset&&l.offset.set(k.offset[0],k.offset[1]);
-if(k.wrap){U={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(void 0!==U[k.wrap[0]])l.wrapS=U[k.wrap[0]];if(void 0!==U[k.wrap[1]])l.wrapT=U[k.wrap[1]]}}C.textures[r]=l}for(p in L.materials){r=L.materials[p];for(D in r.parameters)if("envMap"==D||"map"==D||"lightMap"==D)r.parameters[D]=C.textures[r.parameters[D]];else if("shading"==D)r.parameters[D]="flat"==r.parameters[D]?THREE.FlatShading:THREE.SmoothShading;else if("blending"==D)r.parameters[D]=THREE[r.parameters[D]]?THREE[r.parameters[D]]:
-THREE.NormalBlending;else if("combine"==D)r.parameters[D]="MixOperation"==r.parameters[D]?THREE.MixOperation:THREE.MultiplyOperation;else if("vertexColors"==D)if("face"==r.parameters[D])r.parameters[D]=THREE.FaceColors;else if(r.parameters[D])r.parameters[D]=THREE.VertexColors;if(void 0!==r.parameters.opacity&&1>r.parameters.opacity)r.parameters.transparent=!0;if(r.parameters.normalMap){a=THREE.ShaderUtils.lib.normal;k=THREE.UniformsUtils.clone(a.uniforms);l=r.parameters.color;U=r.parameters.specular;
-c=r.parameters.ambient;I=r.parameters.shininess;k.tNormal.texture=C.textures[r.parameters.normalMap];if(r.parameters.normalMapFactor)k.uNormalScale.value=r.parameters.normalMapFactor;if(r.parameters.map)k.tDiffuse.texture=r.parameters.map,k.enableDiffuse.value=!0;if(r.parameters.lightMap)k.tAO.texture=r.parameters.lightMap,k.enableAO.value=!0;if(r.parameters.specularMap)k.tSpecular.texture=C.textures[r.parameters.specularMap],k.enableSpecular.value=!0;k.uDiffuseColor.value.setHex(l);k.uSpecularColor.value.setHex(U);
-k.uAmbientColor.value.setHex(c);k.uShininess.value=I;if(r.parameters.opacity)k.uOpacity.value=r.parameters.opacity;O=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:k,lights:!0,fog:!0})}else O=new THREE[r.type](r.parameters);C.materials[p]=O}e();i.callbackSync(C);h()};THREE.UTF8Loader=function(){};
+THREE.SceneLoader.prototype.createScene=function(a,b,c){function d(a,b){return"relativeToHTML"==b?a:j+"/"+a}function e(){var a;for(m in O.objects)if(!B.objects[m])if(s=O.objects[m],void 0!==s.geometry){if(K=B.geometries[s.geometry])a=!1,N=B.materials[s.materials[0]],(a=N instanceof THREE.ShaderMaterial)&&K.computeTangents(),t=s.position,w=s.rotation,z=s.quaternion,F=s.scale,z=0,0==s.materials.length&&(N=new THREE.MeshFaceMaterial),1<s.materials.length&&(N=new THREE.MeshFaceMaterial),a=new THREE.Mesh(K,
+N),a.name=m,a.position.set(t[0],t[1],t[2]),z?(a.quaternion.set(z[0],z[1],z[2],z[3]),a.useQuaternion=!0):a.rotation.set(w[0],w[1],w[2]),a.scale.set(F[0],F[1],F[2]),a.visible=s.visible,a.doubleSided=s.doubleSided,a.castShadow=s.castShadow,a.receiveShadow=s.receiveShadow,B.scene.add(a),B.objects[m]=a}else t=s.position,w=s.rotation,z=s.quaternion,F=s.scale,z=0,a=new THREE.Object3D,a.name=m,a.position.set(t[0],t[1],t[2]),z?(a.quaternion.set(z[0],z[1],z[2],z[3]),a.useQuaternion=!0):a.rotation.set(w[0],
+w[1],w[2]),a.scale.set(F[0],F[1],F[2]),a.visible=void 0!==s.visible?s.visible:!1,B.scene.add(a),B.objects[m]=a,B.empties[m]=a}function f(a){return function(b){B.geometries[a]=b;e();I-=1;l.onLoadComplete();h()}}function g(a){return function(b){B.geometries[a]=b}}function h(){l.callbackProgress({totalModels:i,totalTextures:S,loadedModels:i-I,loadedTextures:S-D},B);l.onLoadProgress();0==I&&0==D&&b(B)}var l=this,j=THREE.Loader.prototype.extractUrlBase(c),k,p,m,o,r,n,q,s,u,v,t,w,z,F,C,G,K,N,P,T,O,J,I,
+D,i,S,B;O=a;c=new THREE.BinaryLoader;J=new THREE.JSONLoader;D=I=0;B={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},empties:{}};if(O.transform&&(a=O.transform.position,u=O.transform.rotation,C=O.transform.scale,a&&B.scene.position.set(a[0],a[1],a[2]),u&&B.scene.rotation.set(u[0],u[1],u[2]),C&&B.scene.scale.set(C[0],C[1],C[2]),a||u||C))B.scene.updateMatrix(),B.scene.updateMatrixWorld();a=function(){D-=1;h();l.onLoadComplete()};for(r in O.cameras)C=
+O.cameras[r],"perspective"==C.type?P=new THREE.PerspectiveCamera(C.fov,C.aspect,C.near,C.far):"ortho"==C.type&&(P=new THREE.OrthographicCamera(C.left,C.right,C.top,C.bottom,C.near,C.far)),t=C.position,u=C.target,C=C.up,P.position.set(t[0],t[1],t[2]),P.target=new THREE.Vector3(u[0],u[1],u[2]),C&&P.up.set(C[0],C[1],C[2]),B.cameras[r]=P;for(o in O.lights)u=O.lights[o],r=void 0!==u.color?u.color:16777215,P=void 0!==u.intensity?u.intensity:1,"directional"==u.type?(t=u.direction,v=new THREE.DirectionalLight(r,
+P),v.position.set(t[0],t[1],t[2]),v.position.normalize()):"point"==u.type?(t=u.position,v=u.distance,v=new THREE.PointLight(r,P,v),v.position.set(t[0],t[1],t[2])):"ambient"==u.type&&(v=new THREE.AmbientLight(r)),B.scene.add(v),B.lights[o]=v;for(n in O.fogs)o=O.fogs[n],"linear"==o.type?T=new THREE.Fog(0,o.near,o.far):"exp2"==o.type&&(T=new THREE.FogExp2(0,o.density)),C=o.color,T.color.setRGB(C[0],C[1],C[2]),B.fogs[n]=T;if(B.cameras&&O.defaults.camera)B.currentCamera=B.cameras[O.defaults.camera];if(B.fogs&&
+O.defaults.fog)B.scene.fog=B.fogs[O.defaults.fog];C=O.defaults.bgcolor;B.bgColor=new THREE.Color;B.bgColor.setRGB(C[0],C[1],C[2]);B.bgColorAlpha=O.defaults.bgalpha;for(k in O.geometries)if(n=O.geometries[k],"bin_mesh"==n.type||"ascii_mesh"==n.type)I+=1,l.onLoadStart();i=I;for(k in O.geometries)if(n=O.geometries[k],"cube"==n.type)K=new THREE.CubeGeometry(n.width,n.height,n.depth,n.segmentsWidth,n.segmentsHeight,n.segmentsDepth,null,n.flipped,n.sides),B.geometries[k]=K;else if("plane"==n.type)K=new THREE.PlaneGeometry(n.width,
+n.height,n.segmentsWidth,n.segmentsHeight),B.geometries[k]=K;else if("sphere"==n.type)K=new THREE.SphereGeometry(n.radius,n.segmentsWidth,n.segmentsHeight),B.geometries[k]=K;else if("cylinder"==n.type)K=new THREE.CylinderGeometry(n.topRad,n.botRad,n.height,n.radSegs,n.heightSegs),B.geometries[k]=K;else if("torus"==n.type)K=new THREE.TorusGeometry(n.radius,n.tube,n.segmentsR,n.segmentsT),B.geometries[k]=K;else if("icosahedron"==n.type)K=new THREE.IcosahedronGeometry(n.radius,n.subdivisions),B.geometries[k]=
+K;else if("bin_mesh"==n.type)c.load(d(n.url,O.urlBaseType),f(k));else if("ascii_mesh"==n.type)J.load(d(n.url,O.urlBaseType),f(k));else if("embedded_mesh"==n.type)n=O.embeds[n.id],n.metadata=O.metadata,n&&J.createModel(n,g(k),"");for(q in O.textures)if(k=O.textures[q],k.url instanceof Array){D+=k.url.length;for(n=0;n<k.url.length;n++)l.onLoadStart()}else D+=1,l.onLoadStart();S=D;for(q in O.textures){k=O.textures[q];if(void 0!=k.mapping&&void 0!=THREE[k.mapping])k.mapping=new THREE[k.mapping];if(k.url instanceof
+Array){n=[];for(T=0;T<k.url.length;T++)n[T]=d(k.url[T],O.urlBaseType);n=THREE.ImageUtils.loadTextureCube(n,k.mapping,a)}else{n=THREE.ImageUtils.loadTexture(d(k.url,O.urlBaseType),k.mapping,a);if(void 0!=THREE[k.minFilter])n.minFilter=THREE[k.minFilter];if(void 0!=THREE[k.magFilter])n.magFilter=THREE[k.magFilter];if(k.repeat){n.repeat.set(k.repeat[0],k.repeat[1]);if(1!=k.repeat[0])n.wrapS=THREE.RepeatWrapping;if(1!=k.repeat[1])n.wrapT=THREE.RepeatWrapping}k.offset&&n.offset.set(k.offset[0],k.offset[1]);
+if(k.wrap){T={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(void 0!==T[k.wrap[0]])n.wrapS=T[k.wrap[0]];if(void 0!==T[k.wrap[1]])n.wrapT=T[k.wrap[1]]}}B.textures[q]=n}for(p in O.materials){q=O.materials[p];for(G in q.parameters)if("envMap"==G||"map"==G||"lightMap"==G)q.parameters[G]=B.textures[q.parameters[G]];else if("shading"==G)q.parameters[G]="flat"==q.parameters[G]?THREE.FlatShading:THREE.SmoothShading;else if("blending"==G)q.parameters[G]=THREE[q.parameters[G]]?THREE[q.parameters[G]]:
+THREE.NormalBlending;else if("combine"==G)q.parameters[G]="MixOperation"==q.parameters[G]?THREE.MixOperation:THREE.MultiplyOperation;else if("vertexColors"==G)if("face"==q.parameters[G])q.parameters[G]=THREE.FaceColors;else if(q.parameters[G])q.parameters[G]=THREE.VertexColors;if(void 0!==q.parameters.opacity&&1>q.parameters.opacity)q.parameters.transparent=!0;if(q.parameters.normalMap){a=THREE.ShaderUtils.lib.normal;k=THREE.UniformsUtils.clone(a.uniforms);n=q.parameters.color;T=q.parameters.specular;
+c=q.parameters.ambient;J=q.parameters.shininess;k.tNormal.texture=B.textures[q.parameters.normalMap];if(q.parameters.normalMapFactor)k.uNormalScale.value=q.parameters.normalMapFactor;if(q.parameters.map)k.tDiffuse.texture=q.parameters.map,k.enableDiffuse.value=!0;if(q.parameters.lightMap)k.tAO.texture=q.parameters.lightMap,k.enableAO.value=!0;if(q.parameters.specularMap)k.tSpecular.texture=B.textures[q.parameters.specularMap],k.enableSpecular.value=!0;k.uDiffuseColor.value.setHex(n);k.uSpecularColor.value.setHex(T);
+k.uAmbientColor.value.setHex(c);k.uShininess.value=J;if(q.parameters.opacity)k.uOpacity.value=q.parameters.opacity;N=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:k,lights:!0,fog:!0})}else N=new THREE[q.type](q.parameters);B.materials[p]=N}e();l.callbackSync(B);h()};THREE.UTF8Loader=function(){};
 THREE.UTF8Loader.prototype.load=function(a,b,c){var d=new XMLHttpRequest,e=void 0!==c.scale?c.scale:1,f=void 0!==c.offsetX?c.offsetX:0,g=void 0!==c.offsetY?c.offsetY:0,h=void 0!==c.offsetZ?c.offsetZ:0;d.onreadystatechange=function(){4==d.readyState?200==d.status||0==d.status?THREE.UTF8Loader.prototype.createModel(d.responseText,b,e,f,g,h):console.error("THREE.UTF8Loader: Couldn't load ["+a+"] ["+d.status+"]"):3!=d.readyState&&2==d.readyState&&d.getResponseHeader("Content-Length")};d.open("GET",a,
 !0);d.send(null)};THREE.UTF8Loader.prototype.decompressMesh=function(a){var b=a.charCodeAt(0);57344<=b&&(b-=2048);b++;for(var c=new Float32Array(8*b),d=1,e=0;8>e;e++){for(var f=0,g=0;g<b;++g){var h=a.charCodeAt(g+d),f=f+(h>>1^-(h&1));c[8*g+e]=f}d+=b}b=a.length-d;f=new Uint16Array(b);for(e=g=0;e<b;e++)h=a.charCodeAt(e+d),f[e]=g-h,0==h&&g++;return[c,f]};
-THREE.UTF8Loader.prototype.createModel=function(a,b,c,d,e,f){var g=function(){var b=this;b.materials=[];THREE.Geometry.call(this);var g=THREE.UTF8Loader.prototype.decompressMesh(a),m=[],k=[];(function(a,g,i){for(var k,l,m,s=a.length;i<s;i+=g)k=a[i],l=a[i+1],m=a[i+2],k=k/16383*c,l=l/16383*c,m=m/16383*c,k+=d,l+=e,m+=f,b.vertices.push(new THREE.Vertex(new THREE.Vector3(k,l,m)))})(g[0],8,0);(function(a,b,c){for(var d,e,f=a.length;c<f;c+=b)d=a[c],e=a[c+1],d/=1023,e/=1023,k.push(d,1-e)})(g[0],8,3);(function(a,
-b,c){for(var d,e,f,g=a.length;c<g;c+=b)d=a[c],e=a[c+1],f=a[c+2],d=(d-512)/511,e=(e-512)/511,f=(f-512)/511,m.push(d,e,f)})(g[0],8,5);(function(a){var c,d,e,f,g,i,u,v,t,w=a.length;for(c=0;c<w;c+=3){d=a[c];e=a[c+1];f=a[c+2];g=b;v=d;t=e;i=f;var A=m[3*e],G=m[3*e+1],F=m[3*e+2],D=m[3*f],J=m[3*f+1],O=m[3*f+2];u=new THREE.Vector3(m[3*d],m[3*d+1],m[3*d+2]);A=new THREE.Vector3(A,G,F);D=new THREE.Vector3(D,J,O);g.faces.push(new THREE.Face3(v,t,i,[u,A,D],null,0));g=k[2*d];d=k[2*d+1];i=k[2*e];u=k[2*e+1];v=k[2*
-f];t=k[2*f+1];f=b.faceVertexUvs[0];e=i;i=u;u=[];u.push(new THREE.UV(g,d));u.push(new THREE.UV(e,i));u.push(new THREE.UV(v,t));f.push(u)}})(g[1]);this.computeCentroids();this.computeFaceNormals()};g.prototype=new THREE.Geometry;g.prototype.constructor=g;b(new g)};THREE.ImmediateRenderObject=function(){THREE.Object3D.call(this);this.render=function(){}};THREE.ImmediateRenderObject.prototype=new THREE.Object3D;THREE.ImmediateRenderObject.prototype.constructor=THREE.ImmediateRenderObject;
+THREE.UTF8Loader.prototype.createModel=function(a,b,c,d,e,f){var g=function(){var b=this;b.materials=[];THREE.Geometry.call(this);var g=THREE.UTF8Loader.prototype.decompressMesh(a),j=[],k=[];(function(a,g,j){for(var k,l,q,s=a.length;j<s;j+=g)k=a[j],l=a[j+1],q=a[j+2],k=k/16383*c,l=l/16383*c,q=q/16383*c,k+=d,l+=e,q+=f,b.vertices.push(new THREE.Vertex(new THREE.Vector3(k,l,q)))})(g[0],8,0);(function(a,b,c){for(var d,e,f=a.length;c<f;c+=b)d=a[c],e=a[c+1],d/=1023,e/=1023,k.push(d,1-e)})(g[0],8,3);(function(a,
+b,c){for(var d,e,f,g=a.length;c<g;c+=b)d=a[c],e=a[c+1],f=a[c+2],d=(d-512)/511,e=(e-512)/511,f=(f-512)/511,j.push(d,e,f)})(g[0],8,5);(function(a){var c,d,e,f,g,l,u,v,t,w=a.length;for(c=0;c<w;c+=3){d=a[c];e=a[c+1];f=a[c+2];g=b;v=d;t=e;l=f;var z=j[3*e],F=j[3*e+1],C=j[3*e+2],G=j[3*f],K=j[3*f+1],N=j[3*f+2];u=new THREE.Vector3(j[3*d],j[3*d+1],j[3*d+2]);z=new THREE.Vector3(z,F,C);G=new THREE.Vector3(G,K,N);g.faces.push(new THREE.Face3(v,t,l,[u,z,G],null,0));g=k[2*d];d=k[2*d+1];l=k[2*e];u=k[2*e+1];v=k[2*
+f];t=k[2*f+1];f=b.faceVertexUvs[0];e=l;l=u;u=[];u.push(new THREE.UV(g,d));u.push(new THREE.UV(e,l));u.push(new THREE.UV(v,t));f.push(u)}})(g[1]);this.computeCentroids();this.computeFaceNormals()};g.prototype=new THREE.Geometry;g.prototype.constructor=g;b(new g)};THREE.ImmediateRenderObject=function(){THREE.Object3D.call(this);this.render=function(){}};THREE.ImmediateRenderObject.prototype=new THREE.Object3D;THREE.ImmediateRenderObject.prototype.constructor=THREE.ImmediateRenderObject;
 THREE.LensFlare=function(a,b,c,d,e){THREE.Object3D.call(this);this.lensFlares=[];this.positionScreen=new THREE.Vector3;this.customUpdateCallback=void 0;void 0!==a&&this.add(a,b,c,d,e)};THREE.LensFlare.prototype=new THREE.Object3D;THREE.LensFlare.prototype.constructor=THREE.LensFlare;THREE.LensFlare.prototype.supr=THREE.Object3D.prototype;
 THREE.LensFlare.prototype.add=function(a,b,c,d,e,f){void 0===b&&(b=-1);void 0===c&&(c=0);void 0===f&&(f=1);void 0===e&&(e=new THREE.Color(16777215));if(void 0===d)d=THREE.NormalBlending;c=Math.min(c,Math.max(0,c));this.lensFlares.push({texture:a,size:b,distance:c,x:0,y:0,z:0,scale:1,rotation:1,opacity:f,color:e,blending:d})};
 THREE.LensFlare.prototype.updateLensFlares=function(){var a,b=this.lensFlares.length,c,d=2*-this.positionScreen.x,e=2*-this.positionScreen.y;for(a=0;a<b;a++)c=this.lensFlares[a],c.x=this.positionScreen.x+d*c.distance,c.y=this.positionScreen.y+e*c.distance,c.wantedRotation=0.25*c.x*Math.PI,c.rotation+=0.25*(c.wantedRotation-c.rotation)};
 THREE.MorphBlendMesh=function(a,b){THREE.Mesh.call(this,a,b);this.animationsMap={};this.animationsList=[];var c=this.geometry.morphTargets.length;this.createAnimation("__default",0,c-1,c/1);this.setAnimationWeight("__default",1)};THREE.MorphBlendMesh.prototype=new THREE.Mesh;THREE.MorphBlendMesh.prototype.constructor=THREE.MorphBlendMesh;
 THREE.MorphBlendMesh.prototype.createAnimation=function(a,b,c,d){b={startFrame:b,endFrame:c,length:c-b+1,fps:d,duration:(c-b)/d,lastFrame:0,currentFrame:0,active:!1,time:0,direction:1,weight:1,directionBackwards:!1,mirroredLoop:!1};this.animationsMap[a]=b;this.animationsList.push(b)};
-THREE.MorphBlendMesh.prototype.autoCreateAnimations=function(a){for(var b=/([a-z]+)(\d+)/,c,d={},e=this.geometry,f=0,g=e.morphTargets.length;f<g;f++){var h=e.morphTargets[f].name.match(b);if(h&&1<h.length){var i=h[1];d[i]||(d[i]={start:Infinity,end:-Infinity});h=d[i];if(f<h.start)h.start=f;if(f>h.end)h.end=f;c||(c=i)}}for(i in d)h=d[i],this.createAnimation(i,h.start,h.end,a);this.firstAnimation=c};
+THREE.MorphBlendMesh.prototype.autoCreateAnimations=function(a){for(var b=/([a-z]+)(\d+)/,c,d={},e=this.geometry,f=0,g=e.morphTargets.length;f<g;f++){var h=e.morphTargets[f].name.match(b);if(h&&1<h.length){var l=h[1];d[l]||(d[l]={start:Infinity,end:-Infinity});h=d[l];if(f<h.start)h.start=f;if(f>h.end)h.end=f;c||(c=l)}}for(l in d)h=d[l],this.createAnimation(l,h.start,h.end,a);this.firstAnimation=c};
 THREE.MorphBlendMesh.prototype.setAnimationDirectionForward=function(a){if(a=this.animationsMap[a])a.direction=1,a.directionBackwards=!1};THREE.MorphBlendMesh.prototype.setAnimationDirectionBackward=function(a){if(a=this.animationsMap[a])a.direction=-1,a.directionBackwards=!0};THREE.MorphBlendMesh.prototype.setAnimationFPS=function(a,b){var c=this.animationsMap[a];if(c)c.fps=b,c.duration=(c.end-c.start)/c.fps};
 THREE.MorphBlendMesh.prototype.setAnimationDuration=function(a,b){var c=this.animationsMap[a];if(c)c.duration=b,c.fps=(c.end-c.start)/c.duration};THREE.MorphBlendMesh.prototype.setAnimationWeight=function(a,b){var c=this.animationsMap[a];if(c)c.weight=b};THREE.MorphBlendMesh.prototype.setAnimationTime=function(a,b){var c=this.animationsMap[a];if(c)c.time=b};THREE.MorphBlendMesh.prototype.getAnimationTime=function(a){var b=0;if(a=this.animationsMap[a])b=a.time;return b};
 THREE.MorphBlendMesh.prototype.getAnimationDuration=function(a){var b=-1;if(a=this.animationsMap[a])b=a.duration;return b};THREE.MorphBlendMesh.prototype.playAnimation=function(a){var b=this.animationsMap[a];b?(b.time=0,b.active=!0):console.warn("animation["+a+"] undefined")};THREE.MorphBlendMesh.prototype.stopAnimation=function(a){if(a=this.animationsMap[a])a.active=!1};
 THREE.MorphBlendMesh.prototype.update=function(a){for(var b=0,c=this.animationsList.length;b<c;b++){var d=this.animationsList[b];if(d.active){var e=d.duration/d.length;d.time+=d.direction*a;if(d.mirroredLoop){if(d.time>d.duration||0>d.time){d.direction*=-1;if(d.time>d.duration)d.time=d.duration,d.directionBackwards=!0;if(0>d.time)d.time=0,d.directionBackwards=!1}}else d.time%=d.duration,0>d.time&&(d.time+=d.duration);var f=d.startFrame+THREE.Math.clamp(Math.floor(d.time/e),0,d.length-1),g=d.weight;
 if(f!==d.currentFrame)this.morphTargetInfluences[d.lastFrame]=0,this.morphTargetInfluences[d.currentFrame]=1*g,this.morphTargetInfluences[f]=0,d.lastFrame=d.currentFrame,d.currentFrame=f;e=d.time%e/e;d.directionBackwards&&(e=1-e);this.morphTargetInfluences[d.currentFrame]=e*g;this.morphTargetInfluences[d.lastFrame]=(1-e)*g}}};
-THREE.LensFlarePlugin=function(){function a(a){var c=b.createProgram(),d=b.createShader(b.FRAGMENT_SHADER),e=b.createShader(b.VERTEX_SHADER);b.shaderSource(d,a.fragmentShader);b.shaderSource(e,a.vertexShader);b.compileShader(d);b.compileShader(e);b.attachShader(c,d);b.attachShader(c,e);b.linkProgram(c);return c}var b,c,d,e,f,g,h,i,m,k,p,n,o;this.init=function(q){b=q.context;c=q;d=new Float32Array(16);e=new Uint16Array(6);q=0;d[q++]=-1;d[q++]=-1;d[q++]=0;d[q++]=0;d[q++]=1;d[q++]=-1;d[q++]=1;d[q++]=
-0;d[q++]=1;d[q++]=1;d[q++]=1;d[q++]=1;d[q++]=-1;d[q++]=1;d[q++]=0;d[q++]=1;q=0;e[q++]=0;e[q++]=1;e[q++]=2;e[q++]=0;e[q++]=2;e[q++]=3;f=b.createBuffer();g=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,f);b.bufferData(b.ARRAY_BUFFER,d,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.bufferData(b.ELEMENT_ARRAY_BUFFER,e,b.STATIC_DRAW);h=b.createTexture();i=b.createTexture();b.bindTexture(b.TEXTURE_2D,h);b.texImage2D(b.TEXTURE_2D,0,b.RGB,16,16,0,b.RGB,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,
-b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);b.bindTexture(b.TEXTURE_2D,i);b.texImage2D(b.TEXTURE_2D,0,b.RGBA,16,16,0,b.RGBA,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);
-b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);0>=b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)?(m=!1,k=a(THREE.ShaderFlares.lensFlare)):(m=!0,k=a(THREE.ShaderFlares.lensFlareVertexTexture));p={};n={};p.vertex=b.getAttribLocation(k,"position");p.uv=b.getAttribLocation(k,"uv");n.renderType=b.getUniformLocation(k,"renderType");n.map=b.getUniformLocation(k,"map");n.occlusionMap=b.getUniformLocation(k,"occlusionMap");n.opacity=b.getUniformLocation(k,"opacity");n.color=b.getUniformLocation(k,
-"color");n.scale=b.getUniformLocation(k,"scale");n.rotation=b.getUniformLocation(k,"rotation");n.screenPosition=b.getUniformLocation(k,"screenPosition");o=!1};this.render=function(a,d,e,s){var a=a.__webglFlares,u=a.length;if(u){var v=new THREE.Vector3,t=s/e,w=0.5*e,A=0.5*s,G=16/s,F=new THREE.Vector2(G*t,G),D=new THREE.Vector3(1,1,0),J=new THREE.Vector2(1,1),O=n,G=p;b.useProgram(k);o||(b.enableVertexAttribArray(p.vertex),b.enableVertexAttribArray(p.uv),o=!0);b.uniform1i(O.occlusionMap,0);b.uniform1i(O.map,
-1);b.bindBuffer(b.ARRAY_BUFFER,f);b.vertexAttribPointer(G.vertex,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(G.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.disable(b.CULL_FACE);b.depthMask(!1);var P,U,L,I,M;for(P=0;P<u;P++)if(G=16/s,F.set(G*t,G),I=a[P],v.set(I.matrixWorld.n14,I.matrixWorld.n24,I.matrixWorld.n34),d.matrixWorldInverse.multiplyVector3(v),d.projectionMatrix.multiplyVector3(v),D.copy(v),J.x=D.x*w+w,J.y=D.y*A+A,m||0<J.x&&J.x<e&&0<J.y&&J.y<s){b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,
-h);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,J.x-8,J.y-8,16,16,0);b.uniform1i(O.renderType,0);b.uniform2f(O.scale,F.x,F.y);b.uniform3f(O.screenPosition,D.x,D.y,D.z);b.disable(b.BLEND);b.enable(b.DEPTH_TEST);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);b.activeTexture(b.TEXTURE0);b.bindTexture(b.TEXTURE_2D,i);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGBA,J.x-8,J.y-8,16,16,0);b.uniform1i(O.renderType,1);b.disable(b.DEPTH_TEST);b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,h);b.drawElements(b.TRIANGLES,
-6,b.UNSIGNED_SHORT,0);I.positionScreen.copy(D);I.customUpdateCallback?I.customUpdateCallback(I):I.updateLensFlares();b.uniform1i(O.renderType,2);b.enable(b.BLEND);for(U=0,L=I.lensFlares.length;U<L;U++)if(M=I.lensFlares[U],0.001<M.opacity&&0.001<M.scale)D.x=M.x,D.y=M.y,D.z=M.z,G=M.size*M.scale/s,F.x=G*t,F.y=G,b.uniform3f(O.screenPosition,D.x,D.y,D.z),b.uniform2f(O.scale,F.x,F.y),b.uniform1f(O.rotation,M.rotation),b.uniform1f(O.opacity,M.opacity),b.uniform3f(O.color,M.color.r,M.color.g,M.color.b),c.setBlending(M.blending),
-c.setTexture(M.texture,1),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0)}b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(!0)}}};
+THREE.LensFlarePlugin=function(){function a(a){var c=b.createProgram(),d=b.createShader(b.FRAGMENT_SHADER),e=b.createShader(b.VERTEX_SHADER);b.shaderSource(d,a.fragmentShader);b.shaderSource(e,a.vertexShader);b.compileShader(d);b.compileShader(e);b.attachShader(c,d);b.attachShader(c,e);b.linkProgram(c);return c}var b,c,d,e,f,g,h,l,j,k,p,m,o;this.init=function(r){b=r.context;c=r;d=new Float32Array(16);e=new Uint16Array(6);r=0;d[r++]=-1;d[r++]=-1;d[r++]=0;d[r++]=0;d[r++]=1;d[r++]=-1;d[r++]=1;d[r++]=
+0;d[r++]=1;d[r++]=1;d[r++]=1;d[r++]=1;d[r++]=-1;d[r++]=1;d[r++]=0;d[r++]=1;r=0;e[r++]=0;e[r++]=1;e[r++]=2;e[r++]=0;e[r++]=2;e[r++]=3;f=b.createBuffer();g=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,f);b.bufferData(b.ARRAY_BUFFER,d,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.bufferData(b.ELEMENT_ARRAY_BUFFER,e,b.STATIC_DRAW);h=b.createTexture();l=b.createTexture();b.bindTexture(b.TEXTURE_2D,h);b.texImage2D(b.TEXTURE_2D,0,b.RGB,16,16,0,b.RGB,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,
+b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);b.bindTexture(b.TEXTURE_2D,l);b.texImage2D(b.TEXTURE_2D,0,b.RGBA,16,16,0,b.RGBA,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);
+b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);0>=b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)?(j=!1,k=a(THREE.ShaderFlares.lensFlare)):(j=!0,k=a(THREE.ShaderFlares.lensFlareVertexTexture));p={};m={};p.vertex=b.getAttribLocation(k,"position");p.uv=b.getAttribLocation(k,"uv");m.renderType=b.getUniformLocation(k,"renderType");m.map=b.getUniformLocation(k,"map");m.occlusionMap=b.getUniformLocation(k,"occlusionMap");m.opacity=b.getUniformLocation(k,"opacity");m.color=b.getUniformLocation(k,
+"color");m.scale=b.getUniformLocation(k,"scale");m.rotation=b.getUniformLocation(k,"rotation");m.screenPosition=b.getUniformLocation(k,"screenPosition");o=!1};this.render=function(a,d,e,s){var a=a.__webglFlares,u=a.length;if(u){var v=new THREE.Vector3,t=s/e,w=0.5*e,z=0.5*s,F=16/s,C=new THREE.Vector2(F*t,F),G=new THREE.Vector3(1,1,0),K=new THREE.Vector2(1,1),N=m,F=p;b.useProgram(k);o||(b.enableVertexAttribArray(p.vertex),b.enableVertexAttribArray(p.uv),o=!0);b.uniform1i(N.occlusionMap,0);b.uniform1i(N.map,
+1);b.bindBuffer(b.ARRAY_BUFFER,f);b.vertexAttribPointer(F.vertex,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(F.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.disable(b.CULL_FACE);b.depthMask(!1);var P,T,O,J,I;for(P=0;P<u;P++)if(F=16/s,C.set(F*t,F),J=a[P],v.set(J.matrixWorld.n14,J.matrixWorld.n24,J.matrixWorld.n34),d.matrixWorldInverse.multiplyVector3(v),d.projectionMatrix.multiplyVector3(v),G.copy(v),K.x=G.x*w+w,K.y=G.y*z+z,j||0<K.x&&K.x<e&&0<K.y&&K.y<s){b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,
+h);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,K.x-8,K.y-8,16,16,0);b.uniform1i(N.renderType,0);b.uniform2f(N.scale,C.x,C.y);b.uniform3f(N.screenPosition,G.x,G.y,G.z);b.disable(b.BLEND);b.enable(b.DEPTH_TEST);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);b.activeTexture(b.TEXTURE0);b.bindTexture(b.TEXTURE_2D,l);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGBA,K.x-8,K.y-8,16,16,0);b.uniform1i(N.renderType,1);b.disable(b.DEPTH_TEST);b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,h);b.drawElements(b.TRIANGLES,
+6,b.UNSIGNED_SHORT,0);J.positionScreen.copy(G);J.customUpdateCallback?J.customUpdateCallback(J):J.updateLensFlares();b.uniform1i(N.renderType,2);b.enable(b.BLEND);for(T=0,O=J.lensFlares.length;T<O;T++)if(I=J.lensFlares[T],0.001<I.opacity&&0.001<I.scale)G.x=I.x,G.y=I.y,G.z=I.z,F=I.size*I.scale/s,C.x=F*t,C.y=F,b.uniform3f(N.screenPosition,G.x,G.y,G.z),b.uniform2f(N.scale,C.x,C.y),b.uniform1f(N.rotation,I.rotation),b.uniform1f(N.opacity,I.opacity),b.uniform3f(N.color,I.color.r,I.color.g,I.color.b),c.setBlending(I.blending,
+I.blendEquation,I.blendSrc,I.blendDst),c.setTexture(I.texture,1),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0)}b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(!0)}}};
 THREE.ShadowMapPlugin=function(){var a,b,c,d,e=new THREE.Frustum,f=new THREE.Matrix4,g=new THREE.Vector3,h=new THREE.Vector3;this.init=function(e){a=e.context;b=e;var e=THREE.ShaderLib.depthRGBA,f=THREE.UniformsUtils.clone(e.uniforms);c=new THREE.ShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:f});d=new THREE.ShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:f,morphTargets:!0});c._shadowPass=!0;d._shadowPass=!0};this.render=function(a,
-c){b.shadowMapEnabled&&b.shadowMapAutoUpdate&&this.update(a,c)};this.update=function(i,m){var k,p,n,o,q,l,r,s,u,v=[];o=0;a.clearColor(1,1,1,1);a.disable(a.BLEND);b.shadowMapCullFrontFaces&&a.cullFace(a.FRONT);b.setDepthTest(!0);for(k=0,p=i.__lights.length;k<p;k++)if(n=i.__lights[k],n.castShadow)if(n instanceof THREE.DirectionalLight&&n.shadowCascade)for(q=0;q<n.shadowCascadeCount;q++){var t;if(n.shadowCascadeArray[q])t=n.shadowCascadeArray[q];else{u=n;r=q;t=new THREE.DirectionalLight;t.isVirtual=
-!0;t.onlyShadow=!0;t.castShadow=!0;t.shadowCameraNear=u.shadowCameraNear;t.shadowCameraFar=u.shadowCameraFar;t.shadowCameraLeft=u.shadowCameraLeft;t.shadowCameraRight=u.shadowCameraRight;t.shadowCameraBottom=u.shadowCameraBottom;t.shadowCameraTop=u.shadowCameraTop;t.shadowCameraVisible=u.shadowCameraVisible;t.shadowDarkness=u.shadowDarkness;t.shadowBias=u.shadowCascadeBias[r];t.shadowMapWidth=u.shadowCascadeWidth[r];t.shadowMapHeight=u.shadowCascadeHeight[r];t.pointsWorld=[];t.pointsFrustum=[];s=
-t.pointsWorld;l=t.pointsFrustum;for(var w=0;8>w;w++)s[w]=new THREE.Vector3,l[w]=new THREE.Vector3;s=u.shadowCascadeNearZ[r];u=u.shadowCascadeFarZ[r];l[0].set(-1,-1,s);l[1].set(1,-1,s);l[2].set(-1,1,s);l[3].set(1,1,s);l[4].set(-1,-1,u);l[5].set(1,-1,u);l[6].set(-1,1,u);l[7].set(1,1,u);t.originalCamera=m;l=new THREE.Gyroscope;l.position=n.shadowCascadeOffset;l.add(t);l.add(t.target);m.add(l);n.shadowCascadeArray[q]=t;console.log("Created virtualLight",t)}r=n;s=q;u=r.shadowCascadeArray[s];u.position.copy(r.position);
-u.target.position.copy(r.target.position);u.lookAt(u.target);u.shadowCameraVisible=r.shadowCameraVisible;u.shadowDarkness=r.shadowDarkness;u.shadowBias=r.shadowCascadeBias[s];l=r.shadowCascadeNearZ[s];r=r.shadowCascadeFarZ[s];u=u.pointsFrustum;u[0].z=l;u[1].z=l;u[2].z=l;u[3].z=l;u[4].z=r;u[5].z=r;u[6].z=r;u[7].z=r;v[o]=t;o++}else v[o]=n,o++;for(k=0,p=v.length;k<p;k++){n=v[k];if(!n.shadowMap)n.shadowMap=new THREE.WebGLRenderTarget(n.shadowMapWidth,n.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,
-format:THREE.RGBAFormat}),n.shadowMapSize=new THREE.Vector2(n.shadowMapWidth,n.shadowMapHeight),n.shadowMatrix=new THREE.Matrix4;if(!n.shadowCamera){if(n instanceof THREE.SpotLight)n.shadowCamera=new THREE.PerspectiveCamera(n.shadowCameraFov,n.shadowMapWidth/n.shadowMapHeight,n.shadowCameraNear,n.shadowCameraFar);else if(n instanceof THREE.DirectionalLight)n.shadowCamera=new THREE.OrthographicCamera(n.shadowCameraLeft,n.shadowCameraRight,n.shadowCameraTop,n.shadowCameraBottom,n.shadowCameraNear,n.shadowCameraFar);
-else{console.error("Unsupported light type for shadow");continue}i.add(n.shadowCamera);b.autoUpdateScene&&i.updateMatrixWorld()}if(n.shadowCameraVisible&&!n.cameraHelper)n.cameraHelper=new THREE.CameraHelper(n.shadowCamera),n.shadowCamera.add(n.cameraHelper);if(n.isVirtual&&t.originalCamera==m){q=m;o=n.shadowCamera;l=n.pointsFrustum;u=n.pointsWorld;g.set(Infinity,Infinity,Infinity);h.set(-Infinity,-Infinity,-Infinity);for(r=0;8>r;r++){s=u[r];s.copy(l[r]);THREE.ShadowMapPlugin.__projector.unprojectVector(s,
-q);o.matrixWorldInverse.multiplyVector3(s);if(s.x<g.x)g.x=s.x;if(s.x>h.x)h.x=s.x;if(s.y<g.y)g.y=s.y;if(s.y>h.y)h.y=s.y;if(s.z<g.z)g.z=s.z;if(s.z>h.z)h.z=s.z}o.left=g.x;o.right=h.x;o.top=h.y;o.bottom=g.y;o.updateProjectionMatrix()}o=n.shadowMap;l=n.shadowMatrix;q=n.shadowCamera;q.position.copy(n.matrixWorld.getPosition());q.lookAt(n.target.matrixWorld.getPosition());q.updateMatrixWorld();q.matrixWorldInverse.getInverse(q.matrixWorld);if(n.cameraHelper)n.cameraHelper.lines.visible=n.shadowCameraVisible;
-n.shadowCameraVisible&&n.cameraHelper.update();l.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);l.multiplySelf(q.projectionMatrix);l.multiplySelf(q.matrixWorldInverse);if(!q._viewMatrixArray)q._viewMatrixArray=new Float32Array(16);if(!q._projectionMatrixArray)q._projectionMatrixArray=new Float32Array(16);q.matrixWorldInverse.flattenToArray(q._viewMatrixArray);q.projectionMatrix.flattenToArray(q._projectionMatrixArray);f.multiply(q.projectionMatrix,q.matrixWorldInverse);e.setFromMatrix(f);b.setRenderTarget(o);
-b.clear();u=i.__webglObjects;for(n=0,o=u.length;n<o;n++)if(r=u[n],l=r.object,r.render=!1,l.visible&&l.castShadow&&(!(l instanceof THREE.Mesh)||!l.frustumCulled||e.contains(l)))l.matrixWorld.flattenToArray(l._objectMatrixArray),l._modelViewMatrix.multiplyToArray(q.matrixWorldInverse,l.matrixWorld,l._modelViewMatrixArray),r.render=!0;for(n=0,o=u.length;n<o;n++)if(r=u[n],r.render)l=r.object,r=r.buffer,b.setObjectFaces(l),s=l.customDepthMaterial?l.customDepthMaterial:l.geometry.morphTargets.length?d:
-c,r instanceof THREE.BufferGeometry?b.renderBufferDirect(q,i.__lights,null,s,r,l):b.renderBuffer(q,i.__lights,null,s,r,l);u=i.__webglObjectsImmediate;for(n=0,o=u.length;n<o;n++)r=u[n],l=r.object,l.visible&&l.castShadow&&(l.matrixAutoUpdate&&l.matrixWorld.flattenToArray(l._objectMatrixArray),l._modelViewMatrix.multiplyToArray(q.matrixWorldInverse,l.matrixWorld,l._modelViewMatrixArray),b.renderImmediateObject(q,i.__lights,null,c,l))}k=b.getClearColor();p=b.getClearAlpha();a.clearColor(k.r,k.g,k.b,p);
+c){b.shadowMapEnabled&&b.shadowMapAutoUpdate&&this.update(a,c)};this.update=function(l,j){var k,p,m,o,r,n,q,s,u,v=[];o=0;a.clearColor(1,1,1,1);a.disable(a.BLEND);b.shadowMapCullFrontFaces&&a.cullFace(a.FRONT);b.setDepthTest(!0);for(k=0,p=l.__lights.length;k<p;k++)if(m=l.__lights[k],m.castShadow)if(m instanceof THREE.DirectionalLight&&m.shadowCascade)for(r=0;r<m.shadowCascadeCount;r++){var t;if(m.shadowCascadeArray[r])t=m.shadowCascadeArray[r];else{u=m;q=r;t=new THREE.DirectionalLight;t.isVirtual=
+!0;t.onlyShadow=!0;t.castShadow=!0;t.shadowCameraNear=u.shadowCameraNear;t.shadowCameraFar=u.shadowCameraFar;t.shadowCameraLeft=u.shadowCameraLeft;t.shadowCameraRight=u.shadowCameraRight;t.shadowCameraBottom=u.shadowCameraBottom;t.shadowCameraTop=u.shadowCameraTop;t.shadowCameraVisible=u.shadowCameraVisible;t.shadowDarkness=u.shadowDarkness;t.shadowBias=u.shadowCascadeBias[q];t.shadowMapWidth=u.shadowCascadeWidth[q];t.shadowMapHeight=u.shadowCascadeHeight[q];t.pointsWorld=[];t.pointsFrustum=[];s=
+t.pointsWorld;n=t.pointsFrustum;for(var w=0;8>w;w++)s[w]=new THREE.Vector3,n[w]=new THREE.Vector3;s=u.shadowCascadeNearZ[q];u=u.shadowCascadeFarZ[q];n[0].set(-1,-1,s);n[1].set(1,-1,s);n[2].set(-1,1,s);n[3].set(1,1,s);n[4].set(-1,-1,u);n[5].set(1,-1,u);n[6].set(-1,1,u);n[7].set(1,1,u);t.originalCamera=j;n=new THREE.Gyroscope;n.position=m.shadowCascadeOffset;n.add(t);n.add(t.target);j.add(n);m.shadowCascadeArray[r]=t;console.log("Created virtualLight",t)}q=m;s=r;u=q.shadowCascadeArray[s];u.position.copy(q.position);
+u.target.position.copy(q.target.position);u.lookAt(u.target);u.shadowCameraVisible=q.shadowCameraVisible;u.shadowDarkness=q.shadowDarkness;u.shadowBias=q.shadowCascadeBias[s];n=q.shadowCascadeNearZ[s];q=q.shadowCascadeFarZ[s];u=u.pointsFrustum;u[0].z=n;u[1].z=n;u[2].z=n;u[3].z=n;u[4].z=q;u[5].z=q;u[6].z=q;u[7].z=q;v[o]=t;o++}else v[o]=m,o++;for(k=0,p=v.length;k<p;k++){m=v[k];if(!m.shadowMap)m.shadowMap=new THREE.WebGLRenderTarget(m.shadowMapWidth,m.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,
+format:THREE.RGBAFormat}),m.shadowMapSize=new THREE.Vector2(m.shadowMapWidth,m.shadowMapHeight),m.shadowMatrix=new THREE.Matrix4;if(!m.shadowCamera){if(m instanceof THREE.SpotLight)m.shadowCamera=new THREE.PerspectiveCamera(m.shadowCameraFov,m.shadowMapWidth/m.shadowMapHeight,m.shadowCameraNear,m.shadowCameraFar);else if(m instanceof THREE.DirectionalLight)m.shadowCamera=new THREE.OrthographicCamera(m.shadowCameraLeft,m.shadowCameraRight,m.shadowCameraTop,m.shadowCameraBottom,m.shadowCameraNear,m.shadowCameraFar);
+else{console.error("Unsupported light type for shadow");continue}l.add(m.shadowCamera);b.autoUpdateScene&&l.updateMatrixWorld()}if(m.shadowCameraVisible&&!m.cameraHelper)m.cameraHelper=new THREE.CameraHelper(m.shadowCamera),m.shadowCamera.add(m.cameraHelper);if(m.isVirtual&&t.originalCamera==j){r=j;o=m.shadowCamera;n=m.pointsFrustum;u=m.pointsWorld;g.set(Infinity,Infinity,Infinity);h.set(-Infinity,-Infinity,-Infinity);for(q=0;8>q;q++){s=u[q];s.copy(n[q]);THREE.ShadowMapPlugin.__projector.unprojectVector(s,
+r);o.matrixWorldInverse.multiplyVector3(s);if(s.x<g.x)g.x=s.x;if(s.x>h.x)h.x=s.x;if(s.y<g.y)g.y=s.y;if(s.y>h.y)h.y=s.y;if(s.z<g.z)g.z=s.z;if(s.z>h.z)h.z=s.z}o.left=g.x;o.right=h.x;o.top=h.y;o.bottom=g.y;o.updateProjectionMatrix()}o=m.shadowMap;n=m.shadowMatrix;r=m.shadowCamera;r.position.copy(m.matrixWorld.getPosition());r.lookAt(m.target.matrixWorld.getPosition());r.updateMatrixWorld();r.matrixWorldInverse.getInverse(r.matrixWorld);if(m.cameraHelper)m.cameraHelper.lines.visible=m.shadowCameraVisible;
+m.shadowCameraVisible&&m.cameraHelper.update();n.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);n.multiplySelf(r.projectionMatrix);n.multiplySelf(r.matrixWorldInverse);if(!r._viewMatrixArray)r._viewMatrixArray=new Float32Array(16);if(!r._projectionMatrixArray)r._projectionMatrixArray=new Float32Array(16);r.matrixWorldInverse.flattenToArray(r._viewMatrixArray);r.projectionMatrix.flattenToArray(r._projectionMatrixArray);f.multiply(r.projectionMatrix,r.matrixWorldInverse);e.setFromMatrix(f);b.setRenderTarget(o);
+b.clear();u=l.__webglObjects;for(m=0,o=u.length;m<o;m++)if(q=u[m],n=q.object,q.render=!1,n.visible&&n.castShadow&&(!(n instanceof THREE.Mesh)||!n.frustumCulled||e.contains(n)))n.matrixWorld.flattenToArray(n._objectMatrixArray),n._modelViewMatrix.multiplyToArray(r.matrixWorldInverse,n.matrixWorld,n._modelViewMatrixArray),q.render=!0;for(m=0,o=u.length;m<o;m++)if(q=u[m],q.render)n=q.object,q=q.buffer,b.setObjectFaces(n),s=n.customDepthMaterial?n.customDepthMaterial:n.geometry.morphTargets.length?d:
+c,q instanceof THREE.BufferGeometry?b.renderBufferDirect(r,l.__lights,null,s,q,n):b.renderBuffer(r,l.__lights,null,s,q,n);u=l.__webglObjectsImmediate;for(m=0,o=u.length;m<o;m++)q=u[m],n=q.object,n.visible&&n.castShadow&&(n.matrixAutoUpdate&&n.matrixWorld.flattenToArray(n._objectMatrixArray),n._modelViewMatrix.multiplyToArray(r.matrixWorldInverse,n.matrixWorld,n._modelViewMatrixArray),b.renderImmediateObject(r,l.__lights,null,c,n))}k=b.getClearColor();p=b.getClearAlpha();a.clearColor(k.r,k.g,k.b,p);
 a.enable(a.BLEND);b.shadowMapCullFrontFaces&&a.cullFace(a.BACK)}};THREE.ShadowMapPlugin.__projector=new THREE.Projector;
-THREE.SpritePlugin=function(){function a(a,b){return b.z-a.z}var b,c,d,e,f,g,h,i,m,k;this.init=function(a){b=a.context;c=a;d=new Float32Array(16);e=new Uint16Array(6);a=0;d[a++]=-1;d[a++]=-1;d[a++]=0;d[a++]=1;d[a++]=1;d[a++]=-1;d[a++]=1;d[a++]=1;d[a++]=1;d[a++]=1;d[a++]=1;d[a++]=0;d[a++]=-1;d[a++]=1;d[a++]=0;a=d[a++]=0;e[a++]=0;e[a++]=1;e[a++]=2;e[a++]=0;e[a++]=2;e[a++]=3;f=b.createBuffer();g=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,f);b.bufferData(b.ARRAY_BUFFER,d,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,
-g);b.bufferData(b.ELEMENT_ARRAY_BUFFER,e,b.STATIC_DRAW);var a=THREE.ShaderSprite.sprite,n=b.createProgram(),o=b.createShader(b.FRAGMENT_SHADER),q=b.createShader(b.VERTEX_SHADER);b.shaderSource(o,a.fragmentShader);b.shaderSource(q,a.vertexShader);b.compileShader(o);b.compileShader(q);b.attachShader(n,o);b.attachShader(n,q);b.linkProgram(n);h=n;i={};m={};i.position=b.getAttribLocation(h,"position");i.uv=b.getAttribLocation(h,"uv");m.uvOffset=b.getUniformLocation(h,"uvOffset");m.uvScale=b.getUniformLocation(h,
-"uvScale");m.rotation=b.getUniformLocation(h,"rotation");m.scale=b.getUniformLocation(h,"scale");m.alignment=b.getUniformLocation(h,"alignment");m.color=b.getUniformLocation(h,"color");m.map=b.getUniformLocation(h,"map");m.opacity=b.getUniformLocation(h,"opacity");m.useScreenCoordinates=b.getUniformLocation(h,"useScreenCoordinates");m.affectedByDistance=b.getUniformLocation(h,"affectedByDistance");m.screenPosition=b.getUniformLocation(h,"screenPosition");m.modelViewMatrix=b.getUniformLocation(h,"modelViewMatrix");
-m.projectionMatrix=b.getUniformLocation(h,"projectionMatrix");k=!1};this.render=function(d,e,o,q){var d=d.__webglSprites,l=d.length;if(l){var r=i,s=m,u=q/o,o=0.5*o,v=0.5*q,t=!0;b.useProgram(h);k||(b.enableVertexAttribArray(r.position),b.enableVertexAttribArray(r.uv),k=!0);b.disable(b.CULL_FACE);b.enable(b.BLEND);b.depthMask(!0);b.bindBuffer(b.ARRAY_BUFFER,f);b.vertexAttribPointer(r.position,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(r.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.uniformMatrix4fv(s.projectionMatrix,
-!1,e._projectionMatrixArray);b.activeTexture(b.TEXTURE0);b.uniform1i(s.map,0);for(var w,A=[],r=0;r<l;r++)if(w=d[r],w.visible&&0!==w.opacity)w.useScreenCoordinates?w.z=-w.position.z:(w._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,w.matrixWorld,w._modelViewMatrixArray),w.z=-w._modelViewMatrix.n34);d.sort(a);for(r=0;r<l;r++)w=d[r],w.visible&&0!==w.opacity&&w.map&&w.map.image&&w.map.image.width&&(w.useScreenCoordinates?(b.uniform1i(s.useScreenCoordinates,1),b.uniform3f(s.screenPosition,(w.position.x-
-o)/o,(v-w.position.y)/v,Math.max(0,Math.min(1,w.position.z)))):(b.uniform1i(s.useScreenCoordinates,0),b.uniform1i(s.affectedByDistance,w.affectedByDistance?1:0),b.uniformMatrix4fv(s.modelViewMatrix,!1,w._modelViewMatrixArray)),e=w.map.image.width/(w.scaleByViewport?q:1),A[0]=e*u*w.scale.x,A[1]=e*w.scale.y,b.uniform2f(s.uvScale,w.uvScale.x,w.uvScale.y),b.uniform2f(s.uvOffset,w.uvOffset.x,w.uvOffset.y),b.uniform2f(s.alignment,w.alignment.x,w.alignment.y),b.uniform1f(s.opacity,w.opacity),b.uniform3f(s.color,
-w.color.r,w.color.g,w.color.b),b.uniform1f(s.rotation,w.rotation),b.uniform2fv(s.scale,A),w.mergeWith3D&&!t?(b.enable(b.DEPTH_TEST),t=!0):!w.mergeWith3D&&t&&(b.disable(b.DEPTH_TEST),t=!1),c.setBlending(w.blending),c.setTexture(w.map,0),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0));b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(!0)}}};
+THREE.SpritePlugin=function(){function a(a,b){return b.z-a.z}var b,c,d,e,f,g,h,l,j,k;this.init=function(a){b=a.context;c=a;d=new Float32Array(16);e=new Uint16Array(6);a=0;d[a++]=-1;d[a++]=-1;d[a++]=0;d[a++]=1;d[a++]=1;d[a++]=-1;d[a++]=1;d[a++]=1;d[a++]=1;d[a++]=1;d[a++]=1;d[a++]=0;d[a++]=-1;d[a++]=1;d[a++]=0;a=d[a++]=0;e[a++]=0;e[a++]=1;e[a++]=2;e[a++]=0;e[a++]=2;e[a++]=3;f=b.createBuffer();g=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,f);b.bufferData(b.ARRAY_BUFFER,d,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,
+g);b.bufferData(b.ELEMENT_ARRAY_BUFFER,e,b.STATIC_DRAW);var a=THREE.ShaderSprite.sprite,m=b.createProgram(),o=b.createShader(b.FRAGMENT_SHADER),r=b.createShader(b.VERTEX_SHADER);b.shaderSource(o,a.fragmentShader);b.shaderSource(r,a.vertexShader);b.compileShader(o);b.compileShader(r);b.attachShader(m,o);b.attachShader(m,r);b.linkProgram(m);h=m;l={};j={};l.position=b.getAttribLocation(h,"position");l.uv=b.getAttribLocation(h,"uv");j.uvOffset=b.getUniformLocation(h,"uvOffset");j.uvScale=b.getUniformLocation(h,
+"uvScale");j.rotation=b.getUniformLocation(h,"rotation");j.scale=b.getUniformLocation(h,"scale");j.alignment=b.getUniformLocation(h,"alignment");j.color=b.getUniformLocation(h,"color");j.map=b.getUniformLocation(h,"map");j.opacity=b.getUniformLocation(h,"opacity");j.useScreenCoordinates=b.getUniformLocation(h,"useScreenCoordinates");j.affectedByDistance=b.getUniformLocation(h,"affectedByDistance");j.screenPosition=b.getUniformLocation(h,"screenPosition");j.modelViewMatrix=b.getUniformLocation(h,"modelViewMatrix");
+j.projectionMatrix=b.getUniformLocation(h,"projectionMatrix");k=!1};this.render=function(d,e,o,r){var d=d.__webglSprites,n=d.length;if(n){var q=l,s=j,u=r/o,o=0.5*o,v=0.5*r,t=!0;b.useProgram(h);k||(b.enableVertexAttribArray(q.position),b.enableVertexAttribArray(q.uv),k=!0);b.disable(b.CULL_FACE);b.enable(b.BLEND);b.depthMask(!0);b.bindBuffer(b.ARRAY_BUFFER,f);b.vertexAttribPointer(q.position,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(q.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.uniformMatrix4fv(s.projectionMatrix,
+!1,e._projectionMatrixArray);b.activeTexture(b.TEXTURE0);b.uniform1i(s.map,0);for(var w,z=[],q=0;q<n;q++)if(w=d[q],w.visible&&0!==w.opacity)w.useScreenCoordinates?w.z=-w.position.z:(w._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,w.matrixWorld,w._modelViewMatrixArray),w.z=-w._modelViewMatrix.n34);d.sort(a);for(q=0;q<n;q++)w=d[q],w.visible&&0!==w.opacity&&w.map&&w.map.image&&w.map.image.width&&(w.useScreenCoordinates?(b.uniform1i(s.useScreenCoordinates,1),b.uniform3f(s.screenPosition,(w.position.x-
+o)/o,(v-w.position.y)/v,Math.max(0,Math.min(1,w.position.z)))):(b.uniform1i(s.useScreenCoordinates,0),b.uniform1i(s.affectedByDistance,w.affectedByDistance?1:0),b.uniformMatrix4fv(s.modelViewMatrix,!1,w._modelViewMatrixArray)),e=w.map.image.width/(w.scaleByViewport?r:1),z[0]=e*u*w.scale.x,z[1]=e*w.scale.y,b.uniform2f(s.uvScale,w.uvScale.x,w.uvScale.y),b.uniform2f(s.uvOffset,w.uvOffset.x,w.uvOffset.y),b.uniform2f(s.alignment,w.alignment.x,w.alignment.y),b.uniform1f(s.opacity,w.opacity),b.uniform3f(s.color,
+w.color.r,w.color.g,w.color.b),b.uniform1f(s.rotation,w.rotation),b.uniform2fv(s.scale,z),w.mergeWith3D&&!t?(b.enable(b.DEPTH_TEST),t=!0):!w.mergeWith3D&&t&&(b.disable(b.DEPTH_TEST),t=!1),c.setBlending(w.blending,w.blendEquation,w.blendSrc,w.blendDst),c.setTexture(w.map,0),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0));b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(!0)}}};
 THREE.DepthPassPlugin=function(){this.enabled=!1;this.renderTarget=null;var a,b,c,d,e=new THREE.Frustum,f=new THREE.Matrix4;this.init=function(e){a=e.context;b=e;var e=THREE.ShaderLib.depthRGBA,f=THREE.UniformsUtils.clone(e.uniforms);c=new THREE.ShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:f});d=new THREE.ShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:f,morphTargets:!0});c._shadowPass=!0;d._shadowPass=!0};this.render=function(a,
-b){this.enabled&&this.update(a,b)};this.update=function(g,h){var i,m,k,p,n,o;a.clearColor(1,1,1,1);a.disable(a.BLEND);b.setDepthTest(!0);b.autoUpdateScene&&g.updateMatrixWorld();if(!h._viewMatrixArray)h._viewMatrixArray=new Float32Array(16);if(!h._projectionMatrixArray)h._projectionMatrixArray=new Float32Array(16);h.matrixWorldInverse.getInverse(h.matrixWorld);h.matrixWorldInverse.flattenToArray(h._viewMatrixArray);h.projectionMatrix.flattenToArray(h._projectionMatrixArray);f.multiply(h.projectionMatrix,
-h.matrixWorldInverse);e.setFromMatrix(f);b.setRenderTarget(this.renderTarget);b.clear();o=g.__webglObjects;for(i=0,m=o.length;i<m;i++)if(k=o[i],n=k.object,k.render=!1,n.visible&&(!(n instanceof THREE.Mesh)||!n.frustumCulled||e.contains(n)))n.matrixWorld.flattenToArray(n._objectMatrixArray),n._modelViewMatrix.multiplyToArray(h.matrixWorldInverse,n.matrixWorld,n._modelViewMatrixArray),k.render=!0;for(i=0,m=o.length;i<m;i++)if(k=o[i],k.render)n=k.object,k=k.buffer,b.setObjectFaces(n),p=n.customDepthMaterial?
-n.customDepthMaterial:n.geometry.morphTargets.length?d:c,k instanceof THREE.BufferGeometry?b.renderBufferDirect(h,g.__lights,null,p,k,n):b.renderBuffer(h,g.__lights,null,p,k,n);o=g.__webglObjectsImmediate;for(i=0,m=o.length;i<m;i++)k=o[i],n=k.object,n.visible&&n.castShadow&&(n.matrixAutoUpdate&&n.matrixWorld.flattenToArray(n._objectMatrixArray),n._modelViewMatrix.multiplyToArray(h.matrixWorldInverse,n.matrixWorld,n._modelViewMatrixArray),b.renderImmediateObject(h,g.__lights,null,c,n));i=b.getClearColor();
-m=b.getClearAlpha();a.clearColor(i.r,i.g,i.b,m);a.enable(a.BLEND)}};
-if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoUpdateScene=!1;var b=this,c=this.setSize,d=this.render,e=new THREE.PerspectiveCamera,f=new THREE.PerspectiveCamera,g=new THREE.Matrix4,h=new THREE.Matrix4,i,m,k,p;e.matrixAutoUpdate=f.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},n=new THREE.WebGLRenderTarget(512,512,a),o=new THREE.WebGLRenderTarget(512,512,a),q=new THREE.PerspectiveCamera(53,
-1,1,1E4);q.position.z=2;var a=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:n},mapRight:{type:"t",value:1,texture:o}},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}"}),
-l=new THREE.Scene,a=new THREE.Mesh(new THREE.PlaneGeometry(2,2),a);a.rotation.x=Math.PI/2;l.add(a);l.add(q);this.setSize=function(a,d){c.call(b,a,d);n.width=a;n.height=d;o.width=a;o.height=d};this.render=function(a,c){a.updateMatrixWorld();if(i!==c.aspect||m!==c.near||k!==c.far||p!==c.fov){i=c.aspect;m=c.near;k=c.far;p=c.fov;var u=c.projectionMatrix.clone(),v=0.5*(125/30),t=v*m/125,w=m*Math.tan(p*Math.PI/360),A;g.n14=v;h.n14=-v;v=-w*i+t;A=w*i+t;u.n11=2*m/(A-v);u.n13=(A+v)/(A-v);e.projectionMatrix.copy(u);
-v=-w*i-t;A=w*i-t;u.n11=2*m/(A-v);u.n13=(A+v)/(A-v);f.projectionMatrix.copy(u)}e.matrixWorld.copy(c.matrixWorld).multiplySelf(h);e.position.copy(c.position);e.near=c.near;e.far=c.far;d.call(b,a,e,n,!0);f.matrixWorld.copy(c.matrixWorld).multiplySelf(g);f.position.copy(c.position);f.near=c.near;f.far=c.far;d.call(b,a,f,o,!0);l.updateMatrixWorld();d.call(b,l,q)}};
+b){this.enabled&&this.update(a,b)};this.update=function(g,h){var l,j,k,p,m,o;a.clearColor(1,1,1,1);a.disable(a.BLEND);b.setDepthTest(!0);b.autoUpdateScene&&g.updateMatrixWorld();if(!h._viewMatrixArray)h._viewMatrixArray=new Float32Array(16);if(!h._projectionMatrixArray)h._projectionMatrixArray=new Float32Array(16);h.matrixWorldInverse.getInverse(h.matrixWorld);h.matrixWorldInverse.flattenToArray(h._viewMatrixArray);h.projectionMatrix.flattenToArray(h._projectionMatrixArray);f.multiply(h.projectionMatrix,
+h.matrixWorldInverse);e.setFromMatrix(f);b.setRenderTarget(this.renderTarget);b.clear();o=g.__webglObjects;for(l=0,j=o.length;l<j;l++)if(k=o[l],m=k.object,k.render=!1,m.visible&&(!(m instanceof THREE.Mesh)||!m.frustumCulled||e.contains(m)))m.matrixWorld.flattenToArray(m._objectMatrixArray),m._modelViewMatrix.multiplyToArray(h.matrixWorldInverse,m.matrixWorld,m._modelViewMatrixArray),k.render=!0;for(l=0,j=o.length;l<j;l++)if(k=o[l],k.render)m=k.object,k=k.buffer,b.setObjectFaces(m),p=m.customDepthMaterial?
+m.customDepthMaterial:m.geometry.morphTargets.length?d:c,k instanceof THREE.BufferGeometry?b.renderBufferDirect(h,g.__lights,null,p,k,m):b.renderBuffer(h,g.__lights,null,p,k,m);o=g.__webglObjectsImmediate;for(l=0,j=o.length;l<j;l++)k=o[l],m=k.object,m.visible&&m.castShadow&&(m.matrixAutoUpdate&&m.matrixWorld.flattenToArray(m._objectMatrixArray),m._modelViewMatrix.multiplyToArray(h.matrixWorldInverse,m.matrixWorld,m._modelViewMatrixArray),b.renderImmediateObject(h,g.__lights,null,c,m));l=b.getClearColor();
+j=b.getClearAlpha();a.clearColor(l.r,l.g,l.b,j);a.enable(a.BLEND)}};
+if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoUpdateScene=!1;var b=this,c=this.setSize,d=this.render,e=new THREE.PerspectiveCamera,f=new THREE.PerspectiveCamera,g=new THREE.Matrix4,h=new THREE.Matrix4,l,j,k,p;e.matrixAutoUpdate=f.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},m=new THREE.WebGLRenderTarget(512,512,a),o=new THREE.WebGLRenderTarget(512,512,a),r=new THREE.PerspectiveCamera(53,
+1,1,1E4);r.position.z=2;var a=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:m},mapRight:{type:"t",value:1,texture:o}},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}"}),
+n=new THREE.Scene,a=new THREE.Mesh(new THREE.PlaneGeometry(2,2),a);a.rotation.x=Math.PI/2;n.add(a);n.add(r);this.setSize=function(a,d){c.call(b,a,d);m.width=a;m.height=d;o.width=a;o.height=d};this.render=function(a,c){a.updateMatrixWorld();if(l!==c.aspect||j!==c.near||k!==c.far||p!==c.fov){l=c.aspect;j=c.near;k=c.far;p=c.fov;var u=c.projectionMatrix.clone(),v=0.5*(125/30),t=v*j/125,w=j*Math.tan(p*Math.PI/360),z;g.n14=v;h.n14=-v;v=-w*l+t;z=w*l+t;u.n11=2*j/(z-v);u.n13=(z+v)/(z-v);e.projectionMatrix.copy(u);
+v=-w*l-t;z=w*l-t;u.n11=2*j/(z-v);u.n13=(z+v)/(z-v);f.projectionMatrix.copy(u)}e.matrixWorld.copy(c.matrixWorld).multiplySelf(h);e.position.copy(c.position);e.near=c.near;e.far=c.far;d.call(b,a,e,m,!0);f.matrixWorld.copy(c.matrixWorld).multiplySelf(g);f.position.copy(c.position);f.near=c.near;f.far=c.far;d.call(b,a,f,o,!0);n.updateMatrixWorld();d.call(b,n,r)}};
 if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoClear=!1;var b=this,c=this.setSize,d=this.render,e,f,g=new THREE.PerspectiveCamera;g.target=new THREE.Vector3(0,0,0);var h=new THREE.PerspectiveCamera;h.target=new THREE.Vector3(0,0,0);b.separation=10;if(a&&void 0!==a.separation)b.separation=a.separation;this.setSize=function(a,d){c.call(b,a,d);e=a/2;f=d};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);h.projectionMatrix=g.projectionMatrix;h.position.copy(c.position);h.target.copy(c.target);h.translateX(-b.separation);h.lookAt(h.target);this.setViewport(0,0,e,f);d.call(b,a,g);this.setViewport(e,0,e,f);d.call(b,a,h,!1)}};
 THREE.ShaderFlares={lensFlareVertexTexture:{vertexShader:"uniform vec3 screenPosition;\nuniform vec2 scale;\nuniform float rotation;\nuniform int renderType;\nuniform sampler2D occlusionMap;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nvUV = uv;\nvec2 pos = position;\nif( renderType == 2 ) {\nvec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.5 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.1, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.1, 0.5 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.5 ) );\nvVisibility = (       visibility.r / 9.0 ) *\n( 1.0 - visibility.g / 9.0 ) *\n(       visibility.b / 9.0 ) *\n( 1.0 - visibility.a / 9.0 );\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",fragmentShader:"precision mediump float;\nuniform sampler2D map;\nuniform float opacity;\nuniform int renderType;\nuniform vec3 color;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nif( renderType == 0 ) {\ngl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );\n} else if( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nvec4 texture = texture2D( map, vUV );\ntexture.a *= opacity * vVisibility;\ngl_FragColor = texture;\ngl_FragColor.rgb *= color;\n}\n}"},

+ 93 - 91
build/custom/ThreeCanvas.js

@@ -13,49 +13,49 @@ THREE.Vector3.prototype={constructor:THREE.Vector3,set:function(a,b,c){this.x=a;
 sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;return this},multiply:function(a,b){this.x=a.x*b.x;this.y=a.y*b.y;this.z=a.z*b.z;return this},multiplySelf:function(a){this.x*=a.x;this.y*=a.y;this.z*=a.z;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;return this},divideSelf:function(a){this.x/=a.x;this.y/=a.y;this.z/=a.z;return this},divideScalar:function(a){a?(this.x/=a,this.y/=a,this.z/=a):
 this.z=this.y=this.x=0;return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.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 Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},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;return this},cross:function(a,b){this.x=a.y*b.z-a.z*b.y;this.y=a.z*b.x-a.x*b.z;this.z=a.x*b.y-a.y*b.x;return this},crossSelf:function(a){var b=this.x,c=this.y,d=this.z;this.x=c*a.z-d*a.y;this.y=d*a.x-b*a.z;this.z=b*a.y-c*a.x;return this},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){return(new THREE.Vector3).sub(this,a).lengthSq()},getPositionFromMatrix:function(a){this.x=a.n14;this.y=
-a.n24;this.z=a.n34;return this},getRotationFromMatrix:function(a,b){var c=b?b.x:1,d=b?b.y:1,e=b?b.z:1,f=a.n11/c,g=a.n12/d,c=a.n21/c,d=a.n22/d,h=a.n23/e,l=a.n33/e;this.y=Math.asin(a.n13/e);e=Math.cos(this.y);1.0E-5<Math.abs(e)?(this.x=Math.atan2(-h/e,l/e),this.z=Math.atan2(-g/e,f/e)):(this.x=0,this.z=Math.atan2(c,d));return this},getScaleFromMatrix:function(a){var b=this.set(a.n11,a.n21,a.n31).length(),c=this.set(a.n12,a.n22,a.n32).length(),a=this.set(a.n13,a.n23,a.n33).length();this.x=b;this.y=c;
+a.n24;this.z=a.n34;return this},getRotationFromMatrix:function(a,b){var c=b?b.x:1,d=b?b.y:1,e=b?b.z:1,f=a.n11/c,g=a.n12/d,c=a.n21/c,d=a.n22/d,i=a.n23/e,j=a.n33/e;this.y=Math.asin(a.n13/e);e=Math.cos(this.y);1.0E-5<Math.abs(e)?(this.x=Math.atan2(-i/e,j/e),this.z=Math.atan2(-g/e,f/e)):(this.x=0,this.z=Math.atan2(c,d));return this},getScaleFromMatrix:function(a){var b=this.set(a.n11,a.n21,a.n31).length(),c=this.set(a.n12,a.n22,a.n32).length(),a=this.set(a.n13,a.n23,a.n33).length();this.x=b;this.y=c;
 this.z=a},equals:function(a){return a.x===this.x&&a.y===this.y&&a.z===this.z},isZero:function(){return 1.0E-4>this.lengthSq()},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};THREE.Vector4=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=void 0!==d?d:1};
 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=void 0!==a.w?a.w:1;return this},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},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Frustum=function(){this.planes=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4]};
 THREE.Frustum.prototype.setFromMatrix=function(a){var b,c=this.planes;c[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);c[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);c[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+a.n23,a.n44+a.n24);c[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);c[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);c[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+a.n33,a.n44+a.n34);for(a=0;6>a;a++)b=c[a],b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))};
 THREE.Frustum.prototype.contains=function(a){for(var b=this.planes,c=a.matrixWorld,d=THREE.Frustum.__v1.set(c.getColumnX().length(),c.getColumnY().length(),c.getColumnZ().length()),d=-a.geometry.boundingSphere.radius*Math.max(d.x,Math.max(d.y,d.z)),e=0;6>e;e++)if(a=b[e].x*c.n14+b[e].y*c.n24+b[e].z*c.n34+b[e].w,a<=d)return!1;return!0};THREE.Frustum.__v1=new THREE.Vector3;
-THREE.Ray=function(a,b){function c(a,b,c){p.sub(c,a);H=p.dot(b);C=k.add(a,u.copy(b).multiplyScalar(H));return L=c.distanceTo(C)}function d(a,b,c,d){p.sub(d,b);k.sub(c,b);u.sub(a,b);G=p.dot(p);t=p.dot(k);E=p.dot(u);z=k.dot(k);F=k.dot(u);r=1/(G*z-t*t);v=(z*E-t*F)*r;y=(G*F-t*E)*r;return 0<=v&&0<=y&&1>v+y}this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3;var e=1.0E-4;this.setPrecision=function(a){e=a};var f=new THREE.Vector3,g=new THREE.Vector3,h=new THREE.Vector3,l=new THREE.Vector3,
-i=new THREE.Vector3,j=new THREE.Vector3,n=new THREE.Vector3,m=new THREE.Vector3,o=new THREE.Vector3;this.intersectObject=function(a){var b,k=[];if(a instanceof THREE.Particle){var p=c(this.origin,this.direction,a.matrixWorld.getPosition());if(p>a.scale.x)return[];b={distance:p,point:a.position,face:null,object:a};k.push(b)}else if(a instanceof THREE.Mesh){var p=c(this.origin,this.direction,a.matrixWorld.getPosition()),I=THREE.Frustum.__v1.set(a.matrixWorld.getColumnX().length(),a.matrixWorld.getColumnY().length(),
-a.matrixWorld.getColumnZ().length());if(p>a.geometry.boundingSphere.radius*Math.max(I.x,Math.max(I.y,I.z)))return k;var r,u,v=a.geometry,D=v.vertices,t;a.matrixRotationWorld.extractRotation(a.matrixWorld);for(p=0,I=v.faces.length;p<I;p++)if(b=v.faces[p],i.copy(this.origin),j.copy(this.direction),t=a.matrixWorld,n=t.multiplyVector3(n.copy(b.centroid)).subSelf(i),m=a.matrixRotationWorld.multiplyVector3(m.copy(b.normal)),r=j.dot(m),!(Math.abs(r)<e)&&(u=m.dot(n)/r,!(0>u)&&(a.doubleSided||(a.flipSided?
-0<r:0>r))))if(o.add(i,j.multiplyScalar(u)),b instanceof THREE.Face3)f=t.multiplyVector3(f.copy(D[b.a].position)),g=t.multiplyVector3(g.copy(D[b.b].position)),h=t.multiplyVector3(h.copy(D[b.c].position)),d(o,f,g,h)&&(b={distance:i.distanceTo(o),point:o.clone(),face:b,object:a},k.push(b));else if(b instanceof THREE.Face4&&(f=t.multiplyVector3(f.copy(D[b.a].position)),g=t.multiplyVector3(g.copy(D[b.b].position)),h=t.multiplyVector3(h.copy(D[b.c].position)),l=t.multiplyVector3(l.copy(D[b.d].position)),
-d(o,f,g,l)||d(o,g,h,l)))b={distance:i.distanceTo(o),point:o.clone(),face:b,object:a},k.push(b)}return k};this.intersectObjects=function(a){for(var b=[],c=0,d=a.length;c<d;c++)Array.prototype.push.apply(b,this.intersectObject(a[c]));b.sort(function(a,b){return a.distance-b.distance});return b};var p=new THREE.Vector3,k=new THREE.Vector3,u=new THREE.Vector3,H,C,L,G,t,E,z,F,r,v,y};
-THREE.Rectangle=function(){function a(){f=d-b;g=e-c}var b,c,d,e,f,g,h=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return f};this.getHeight=function(){return g};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return e};this.set=function(f,g,j,n){h=!1;b=f;c=g;d=j;e=n;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,n,m,o){h?(h=!1,b=f<j?f<m?f:m:j<m?j:m,c=g<n?g<o?g:o:n<o?n:o,d=f>j?f>m?f:m:j>m?j:m,e=g>n?g>o?g:o:n>o?n:o):(b=f<j?f<m?f<b?f:b:m<b?m:b:j<m?j<b?j:b:m<b?m:b,c=g<n?g<o?g<c?g:c:o<c?o:c:n<o?n<c?n:c:o<c?o:c,d=f>j?f>m?f>d?f:d:m>d?m:d:j>m?j>d?j:d:m>d?m:d,e=g>n?g>o?g>e?g:e:o>e?o:e:n>o?n>e?n:e:o>e?o: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 d<a.getLeft()||b>a.getRight()||e<a.getTop()||c>a.getBottom()?!1:!0};this.empty=function(){h=!0;e=d=c=b=0;a()};this.isEmpty=function(){return h}};
+THREE.Ray=function(a,b){function c(a,b,c){p.sub(c,a);H=p.dot(b);C=k.add(a,u.copy(b).multiplyScalar(H));return L=c.distanceTo(C)}function d(a,b,c,d){p.sub(d,b);k.sub(c,b);u.sub(a,b);G=p.dot(p);t=p.dot(k);E=p.dot(u);z=k.dot(k);F=k.dot(u);r=1/(G*z-t*t);v=(z*E-t*F)*r;y=(G*F-t*E)*r;return 0<=v&&0<=y&&1>v+y}this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3;var e=1.0E-4;this.setPrecision=function(a){e=a};var f=new THREE.Vector3,g=new THREE.Vector3,i=new THREE.Vector3,j=new THREE.Vector3,
+h=new THREE.Vector3,l=new THREE.Vector3,o=new THREE.Vector3,m=new THREE.Vector3,n=new THREE.Vector3;this.intersectObject=function(a){var b,k=[];if(a instanceof THREE.Particle){var p=c(this.origin,this.direction,a.matrixWorld.getPosition());if(p>a.scale.x)return[];b={distance:p,point:a.position,face:null,object:a};k.push(b)}else if(a instanceof THREE.Mesh){var p=c(this.origin,this.direction,a.matrixWorld.getPosition()),I=THREE.Frustum.__v1.set(a.matrixWorld.getColumnX().length(),a.matrixWorld.getColumnY().length(),
+a.matrixWorld.getColumnZ().length());if(p>a.geometry.boundingSphere.radius*Math.max(I.x,Math.max(I.y,I.z)))return k;var r,u,v=a.geometry,D=v.vertices,t;a.matrixRotationWorld.extractRotation(a.matrixWorld);for(p=0,I=v.faces.length;p<I;p++)if(b=v.faces[p],h.copy(this.origin),l.copy(this.direction),t=a.matrixWorld,o=t.multiplyVector3(o.copy(b.centroid)).subSelf(h),m=a.matrixRotationWorld.multiplyVector3(m.copy(b.normal)),r=l.dot(m),!(Math.abs(r)<e)&&(u=m.dot(o)/r,!(0>u)&&(a.doubleSided||(a.flipSided?
+0<r:0>r))))if(n.add(h,l.multiplyScalar(u)),b instanceof THREE.Face3)f=t.multiplyVector3(f.copy(D[b.a].position)),g=t.multiplyVector3(g.copy(D[b.b].position)),i=t.multiplyVector3(i.copy(D[b.c].position)),d(n,f,g,i)&&(b={distance:h.distanceTo(n),point:n.clone(),face:b,object:a},k.push(b));else if(b instanceof THREE.Face4&&(f=t.multiplyVector3(f.copy(D[b.a].position)),g=t.multiplyVector3(g.copy(D[b.b].position)),i=t.multiplyVector3(i.copy(D[b.c].position)),j=t.multiplyVector3(j.copy(D[b.d].position)),
+d(n,f,g,j)||d(n,g,i,j)))b={distance:h.distanceTo(n),point:n.clone(),face:b,object:a},k.push(b)}return k};this.intersectObjects=function(a){for(var b=[],c=0,d=a.length;c<d;c++)Array.prototype.push.apply(b,this.intersectObject(a[c]));b.sort(function(a,b){return a.distance-b.distance});return b};var p=new THREE.Vector3,k=new THREE.Vector3,u=new THREE.Vector3,H,C,L,G,t,E,z,F,r,v,y};
+THREE.Rectangle=function(){function a(){f=d-b;g=e-c}var b,c,d,e,f,g,i=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return f};this.getHeight=function(){return g};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return e};this.set=function(f,h,g,o){i=!1;b=f;c=h;d=g;e=o;a()};this.addPoint=function(f,h){i?(i=!1,b=f,c=h,d=f,e=h):(b=b<f?b:f,c=c<h?c:h,d=d>f?d:f,e=e>h?e:h);a()};this.add3Points=
+function(f,h,g,o,m,n){i?(i=!1,b=f<g?f<m?f:m:g<m?g:m,c=h<o?h<n?h:n:o<n?o:n,d=f>g?f>m?f:m:g>m?g:m,e=h>o?h>n?h:n:o>n?o:n):(b=f<g?f<m?f<b?f:b:m<b?m:b:g<m?g<b?g:b:m<b?m:b,c=h<o?h<n?h<c?h:c:n<c?n:c:o<n?o<c?o:c:n<c?n:c,d=f>g?f>m?f>d?f:d:m>d?m:d:g>m?g>d?g:d:m>d?m:d,e=h>o?h>n?h>e?h:e:n>e?n:e:o>n?o>e?o:e:n>e?n:e);a()};this.addRectangle=function(f){i?(i=!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 d<a.getLeft()||b>a.getRight()||e<a.getTop()||c>a.getBottom()?!1:!0};this.empty=function(){i=!0;e=d=c=b=0;a()};this.isEmpty=function(){return i}};
 THREE.Math={clamp:function(a,b,c){return a<b?b:a>c?c:a},clampBottom:function(a,b){return a<b?b:a},mapLinear:function(a,b,c,d,e){return d+(a-b)*(e-d)/(c-b)},random16:function(){return(65280*Math.random()+255*Math.random())/65535},randInt:function(a,b){return a+Math.floor(Math.random()*(b-a+1))},randFloat:function(a,b){return a+Math.random()*(b-a)},randFloatSpread:function(a){return a*(0.5-Math.random())},sign:function(a){return 0>a?-1:0<a?1:0}};THREE.Matrix3=function(){this.m=[]};
-THREE.Matrix3.prototype={constructor:THREE.Matrix3,transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}};THREE.Matrix4=function(a,b,c,d,e,f,g,h,l,i,j,n,m,o,p,k){this.set(void 0!==a?a:1,b||0,c||0,d||0,e||0,void 0!==f?f:1,g||0,h||0,l||0,i||0,void 0!==j?j:1,n||0,m||0,o||0,p||0,void 0!==k?k:1);this.m33=new THREE.Matrix3};
-THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,e,f,g,h,l,i,j,n,m,o,p,k){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=e;this.n22=f;this.n23=g;this.n24=h;this.n31=l;this.n32=i;this.n33=j;this.n34=n;this.n41=m;this.n42=o;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,e=THREE.Matrix4.__v2,f=THREE.Matrix4.__v3;f.sub(a,b).normalize();if(0===f.length())f.z=1;d.cross(c,f).normalize();0===d.length()&&(f.x+=1.0E-4,d.cross(c,f).normalize());e.cross(f,d);this.n11=d.x;this.n12=e.x;this.n13=f.x;this.n21=d.y;this.n22=e.y;this.n23=f.y;this.n31=d.z;this.n32=e.z;this.n33=f.z;return this},multiply:function(a,b){var c=a.n11,d=a.n12,e=a.n13,f=a.n14,g=a.n21,h=a.n22,l=a.n23,i=a.n24,j=a.n31,n=a.n32,m=a.n33,o=a.n34,p=a.n41,k=a.n42,u=a.n43,H=a.n44,C=b.n11,
-L=b.n12,G=b.n13,t=b.n14,E=b.n21,z=b.n22,F=b.n23,r=b.n24,v=b.n31,y=b.n32,K=b.n33,$=b.n34,da=b.n41,O=b.n42,I=b.n43,T=b.n44;this.n11=c*C+d*E+e*v+f*da;this.n12=c*L+d*z+e*y+f*O;this.n13=c*G+d*F+e*K+f*I;this.n14=c*t+d*r+e*$+f*T;this.n21=g*C+h*E+l*v+i*da;this.n22=g*L+h*z+l*y+i*O;this.n23=g*G+h*F+l*K+i*I;this.n24=g*t+h*r+l*$+i*T;this.n31=j*C+n*E+m*v+o*da;this.n32=j*L+n*z+m*y+o*O;this.n33=j*G+n*F+m*K+o*I;this.n34=j*t+n*r+m*$+o*T;this.n41=p*C+k*E+u*v+H*da;this.n42=p*L+k*z+u*y+H*O;this.n43=p*G+k*F+u*K+H*I;this.n44=
+THREE.Matrix3.prototype={constructor:THREE.Matrix3,getInverse:function(a){var b=a.n33*a.n22-a.n32*a.n23,c=-a.n33*a.n21+a.n31*a.n23,d=a.n32*a.n21-a.n31*a.n22,e=-a.n33*a.n12+a.n32*a.n13,f=a.n33*a.n11-a.n31*a.n13,g=-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,h=a.n22*a.n11-a.n21*a.n12,a=a.n11*b+a.n21*e+a.n31*i;0===a&&console.warn("Matrix3.getInverse(): determinant == 0");var a=1/a,l=this.m;l[0]=a*b;l[1]=a*c;l[2]=a*d;l[3]=a*e;l[4]=a*f;l[5]=a*g;l[6]=a*i;l[7]=a*j;l[8]=a*
+h;return this},transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}};THREE.Matrix4=function(a,b,c,d,e,f,g,i,j,h,l,o,m,n,p,k){this.set(void 0!==a?a:1,b||0,c||0,d||0,e||0,void 0!==f?f:1,g||0,i||0,j||0,h||0,void 0!==l?l:1,o||0,m||0,n||0,p||0,void 0!==k?k:1)};
+THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,e,f,g,i,j,h,l,o,m,n,p,k){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=e;this.n22=f;this.n23=g;this.n24=i;this.n31=j;this.n32=h;this.n33=l;this.n34=o;this.n41=m;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,e=THREE.Matrix4.__v2,f=THREE.Matrix4.__v3;f.sub(a,b).normalize();if(0===f.length())f.z=1;d.cross(c,f).normalize();0===d.length()&&(f.x+=1.0E-4,d.cross(c,f).normalize());e.cross(f,d);this.n11=d.x;this.n12=e.x;this.n13=f.x;this.n21=d.y;this.n22=e.y;this.n23=f.y;this.n31=d.z;this.n32=e.z;this.n33=f.z;return this},multiply:function(a,b){var c=a.n11,d=a.n12,e=a.n13,f=a.n14,g=a.n21,i=a.n22,j=a.n23,h=a.n24,l=a.n31,o=a.n32,m=a.n33,n=a.n34,p=a.n41,k=a.n42,u=a.n43,H=a.n44,C=b.n11,
+L=b.n12,G=b.n13,t=b.n14,E=b.n21,z=b.n22,F=b.n23,r=b.n24,v=b.n31,y=b.n32,K=b.n33,$=b.n34,da=b.n41,O=b.n42,I=b.n43,T=b.n44;this.n11=c*C+d*E+e*v+f*da;this.n12=c*L+d*z+e*y+f*O;this.n13=c*G+d*F+e*K+f*I;this.n14=c*t+d*r+e*$+f*T;this.n21=g*C+i*E+j*v+h*da;this.n22=g*L+i*z+j*y+h*O;this.n23=g*G+i*F+j*K+h*I;this.n24=g*t+i*r+j*$+h*T;this.n31=l*C+o*E+m*v+n*da;this.n32=l*L+o*z+m*y+n*O;this.n33=l*G+o*F+m*K+n*I;this.n34=l*t+o*r+m*$+n*T;this.n41=p*C+k*E+u*v+H*da;this.n42=p*L+k*z+u*y+H*O;this.n43=p*G+k*F+u*K+H*I;this.n44=
 p*t+k*r+u*$+H*T;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,f=this.n22,g=this.n23,h=this.n24,l=this.n31,i=this.n32,j=this.n33,n=this.n34,m=this.n41,o=this.n42,p=this.n43,k=this.n44;return d*g*i*m-c*h*i*m-d*f*j*m+b*h*j*m+c*f*n*m-b*g*n*m-d*g*l*o+c*h*l*o+d*e*j*o-a*h*j*o-c*e*n*o+a*g*n*o+d*f*l*p-b*h*l*p-d*e*i*p+a*h*i*p+b*e*n*p-a*f*n*p-c*f*l*k+b*g*l*k+c*e*i*k-a*g*i*k-b*e*j*k+a*f*j*k},transpose:function(){var a;
+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,f=this.n22,g=this.n23,i=this.n24,j=this.n31,h=this.n32,l=this.n33,o=this.n34,m=this.n41,n=this.n42,p=this.n43,k=this.n44;return d*g*h*m-c*i*h*m-d*f*l*m+b*i*l*m+c*f*o*m-b*g*o*m-d*g*j*n+c*i*j*n+d*e*l*n-a*i*l*n-c*e*o*n+a*g*o*n+d*f*j*p-b*i*j*p-d*e*h*p+a*i*h*p+b*e*o*p-a*f*o*p-c*f*j*k+b*g*j*k+c*e*h*k-a*g*h*k-b*e*l*k+a*f*l*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.n34=a;return this},flattenToArray:function(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=
-this.n44;return a},flattenToArrayOffset:function(a,b){a[b]=this.n11;a[b+1]=this.n21;a[b+2]=this.n31;a[b+3]=this.n41;a[b+4]=this.n12;a[b+5]=this.n22;a[b+6]=this.n32;a[b+7]=this.n42;a[b+8]=this.n13;a[b+9]=this.n23;a[b+10]=this.n33;a[b+11]=this.n43;a[b+12]=this.n14;a[b+13]=this.n24;a[b+14]=this.n34;a[b+15]=this.n44;return a},setTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},setScale:function(a,b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},setRotationX:function(a){var b=
-Math.cos(a),a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},setRotationY:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},setRotationZ:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),e=1-c,f=a.x,g=a.y,h=a.z,l=e*f,i=e*g;this.set(l*f+c,l*g-d*h,l*h+d*g,0,l*g+d*h,i*g+c,i*h-d*f,0,l*h-d*g,i*h+d*f,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,f=a.n21,g=a.n22,h=a.n23,l=a.n24,i=a.n31,j=
-a.n32,n=a.n33,m=a.n34,o=a.n41,p=a.n42,k=a.n43,u=a.n44;this.n11=h*m*p-l*n*p+l*j*k-g*m*k-h*j*u+g*n*u;this.n12=e*n*p-d*m*p-e*j*k+c*m*k+d*j*u-c*n*u;this.n13=d*l*p-e*h*p+e*g*k-c*l*k-d*g*u+c*h*u;this.n14=e*h*j-d*l*j-e*g*n+c*l*n+d*g*m-c*h*m;this.n21=l*n*o-h*m*o-l*i*k+f*m*k+h*i*u-f*n*u;this.n22=d*m*o-e*n*o+e*i*k-b*m*k-d*i*u+b*n*u;this.n23=e*h*o-d*l*o-e*f*k+b*l*k+d*f*u-b*h*u;this.n24=d*l*i-e*h*i+e*f*n-b*l*n-d*f*m+b*h*m;this.n31=g*m*o-l*j*o+l*i*p-f*m*p-g*i*u+f*j*u;this.n32=e*j*o-c*m*o-e*i*p+b*m*p+c*i*u-b*j*
-u;this.n33=c*l*o-e*g*o+e*f*p-b*l*p-c*f*u+b*g*u;this.n34=e*g*i-c*l*i-e*f*j+b*l*j+c*f*m-b*g*m;this.n41=h*j*o-g*n*o-h*i*p+f*n*p+g*i*k-f*j*k;this.n42=c*n*o-d*j*o+d*i*p-b*n*p-c*i*k+b*j*k;this.n43=d*g*o-c*h*o-d*f*p+b*h*p+c*f*k-b*g*k;this.n44=c*h*i-d*g*i+d*f*j-b*h*j-c*f*n+b*g*n;this.multiplyScalar(1/a.determinant());return this},setRotationFromEuler:function(a,b){var c=a.x,d=a.y,e=a.z,f=Math.cos(c),c=Math.sin(c),g=Math.cos(d),d=Math.sin(d),h=Math.cos(e),e=Math.sin(e);switch(b){case "YXZ":var l=g*h,i=g*e,
-j=d*h,n=d*e;this.n11=l+n*c;this.n12=j*c-i;this.n13=f*d;this.n21=f*e;this.n22=f*h;this.n23=-c;this.n31=i*c-j;this.n32=n+l*c;this.n33=f*g;break;case "ZXY":l=g*h;i=g*e;j=d*h;n=d*e;this.n11=l-n*c;this.n12=-f*e;this.n13=j+i*c;this.n21=i+j*c;this.n22=f*h;this.n23=n-l*c;this.n31=-f*d;this.n32=c;this.n33=f*g;break;case "ZYX":l=f*h;i=f*e;j=c*h;n=c*e;this.n11=g*h;this.n12=j*d-i;this.n13=l*d+n;this.n21=g*e;this.n22=n*d+l;this.n23=i*d-j;this.n31=-d;this.n32=c*g;this.n33=f*g;break;case "YZX":l=f*g;i=f*d;j=c*g;
-n=c*d;this.n11=g*h;this.n12=n-l*e;this.n13=j*e+i;this.n21=e;this.n22=f*h;this.n23=-c*h;this.n31=-d*h;this.n32=i*e+j;this.n33=l-n*e;break;case "XZY":l=f*g;i=f*d;j=c*g;n=c*d;this.n11=g*h;this.n12=-e;this.n13=d*h;this.n21=l*e+n;this.n22=f*h;this.n23=i*e-j;this.n31=j*e-i;this.n32=c*h;this.n33=n*e+l;break;default:l=f*h,i=f*e,j=c*h,n=c*e,this.n11=g*h,this.n12=-g*e,this.n13=d,this.n21=i+j*d,this.n22=l-n*d,this.n23=-c*g,this.n31=n-l*d,this.n32=j+i*d,this.n33=f*g}return this},setRotationFromQuaternion:function(a){var b=
-a.x,c=a.y,d=a.z,e=a.w,f=b+b,g=c+c,h=d+d,a=b*f,l=b*g,b=b*h,i=c*g,c=c*h,d=d*h,f=e*f,g=e*g,e=e*h;this.n11=1-(i+d);this.n12=l-e;this.n13=b+g;this.n21=l+e;this.n22=1-(a+d);this.n23=c-f;this.n31=b-g;this.n32=c+f;this.n33=1-(a+i);return this},scale:function(a){var b=a.x,c=a.y,a=a.z;this.n11*=b;this.n12*=c;this.n13*=a;this.n21*=b;this.n22*=c;this.n23*=a;this.n31*=b;this.n32*=c;this.n33*=a;this.n41*=b;this.n42*=c;this.n43*=a;return this},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,f=THREE.Matrix4.__v3;d.set(this.n11,this.n21,this.n31);e.set(this.n12,this.n22,this.n32);f.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=f.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},rotateByAxis:function(a,b){if(1===a.x&&0===a.y&&0===a.z)return this.rotateX(b);if(0===a.x&&1===a.y&&0===a.z)return this.rotateY(b);if(0===a.x&&0===a.y&&1===a.z)return this.rotateZ(b);var c=a.x,d=a.y,e=a.z,f=Math.sqrt(c*c+d*d+e*e),c=c/f,d=d/f,e=e/f,f=c*c,g=d*d,h=e*e,l=Math.cos(b),i=Math.sin(b),j=1-l,n=c*d*j,m=c*e*j,j=d*e*j,c=c*i,o=d*i,i=e*i,e=
-f+(1-f)*l,f=n+i,d=m-o,n=n-i,g=g+(1-g)*l,i=j+c,m=m+o,j=j-c,h=h+(1-h)*l,l=this.n11,c=this.n21,o=this.n31,p=this.n41,k=this.n12,u=this.n22,H=this.n32,C=this.n42,L=this.n13,G=this.n23,t=this.n33,E=this.n43;this.n11=e*l+f*k+d*L;this.n21=e*c+f*u+d*G;this.n31=e*o+f*H+d*t;this.n41=e*p+f*C+d*E;this.n12=n*l+g*k+i*L;this.n22=n*c+g*u+i*G;this.n32=n*o+g*H+i*t;this.n42=n*p+g*C+i*E;this.n13=m*l+j*k+h*L;this.n23=m*c+j*u+h*G;this.n33=m*o+j*H+h*t;this.n43=m*p+j*C+h*E;return this},rotateX:function(a){var b=this.n12,
-c=this.n22,d=this.n32,e=this.n42,f=this.n13,g=this.n23,h=this.n33,l=this.n43,i=Math.cos(a),a=Math.sin(a);this.n12=i*b+a*f;this.n22=i*c+a*g;this.n32=i*d+a*h;this.n42=i*e+a*l;this.n13=i*f-a*b;this.n23=i*g-a*c;this.n33=i*h-a*d;this.n43=i*l-a*e;return this},rotateY:function(a){var b=this.n11,c=this.n21,d=this.n31,e=this.n41,f=this.n13,g=this.n23,h=this.n33,l=this.n43,i=Math.cos(a),a=Math.sin(a);this.n11=i*b-a*f;this.n21=i*c-a*g;this.n31=i*d-a*h;this.n41=i*e-a*l;this.n13=i*f+a*b;this.n23=i*g+a*c;this.n33=
-i*h+a*d;this.n43=i*l+a*e;return this},rotateZ:function(a){var b=this.n11,c=this.n21,d=this.n31,e=this.n41,f=this.n12,g=this.n22,h=this.n32,l=this.n42,i=Math.cos(a),a=Math.sin(a);this.n11=i*b+a*f;this.n21=i*c+a*g;this.n31=i*d+a*h;this.n41=i*e+a*l;this.n12=i*f-a*b;this.n22=i*g-a*c;this.n32=i*h-a*d;this.n42=i*l-a*e;return this},translate:function(a){var b=a.x,c=a.y,a=a.z;this.n14=this.n11*b+this.n12*c+this.n13*a+this.n14;this.n24=this.n21*b+this.n22*c+this.n23*a+this.n24;this.n34=this.n31*b+this.n32*
-c+this.n33*a+this.n34;this.n44=this.n41*b+this.n42*c+this.n43*a+this.n44;return this},clone:function(){return new THREE.Matrix4(this.n11,this.n12,this.n13,this.n14,this.n21,this.n22,this.n23,this.n24,this.n31,this.n32,this.n33,this.n34,this.n41,this.n42,this.n43,this.n44)}};
-THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,d=a.n33*a.n22-a.n32*a.n23,e=-a.n33*a.n21+a.n31*a.n23,f=a.n32*a.n21-a.n31*a.n22,g=-a.n33*a.n12+a.n32*a.n13,h=a.n33*a.n11-a.n31*a.n13,l=-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,n=a.n22*a.n11-a.n21*a.n12,a=a.n11*d+a.n21*g+a.n31*i;if(0===a)return null;a=1/a;c[0]=a*d;c[1]=a*e;c[2]=a*f;c[3]=a*g;c[4]=a*h;c[5]=a*l;c[6]=a*i;c[7]=a*j;c[8]=a*n;return b};
-THREE.Matrix4.makeFrustum=function(a,b,c,d,e,f){var g;g=new THREE.Matrix4;g.n11=2*e/(b-a);g.n12=0;g.n13=(b+a)/(b-a);g.n14=0;g.n21=0;g.n22=2*e/(d-c);g.n23=(d+c)/(d-c);g.n24=0;g.n31=0;g.n32=0;g.n33=-(f+e)/(f-e);g.n34=-2*f*e/(f-e);g.n41=0;g.n42=0;g.n43=-1;g.n44=0;return g};THREE.Matrix4.makePerspective=function(a,b,c,d){var e,a=c*Math.tan(a*Math.PI/360);e=-a;return THREE.Matrix4.makeFrustum(e*b,a*b,e,a,c,d)};
-THREE.Matrix4.makeOrtho=function(a,b,c,d,e,f){var g,h,l,i;g=new THREE.Matrix4;h=b-a;l=c-d;i=f-e;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/i;g.n34=-((f+e)/i);g.n41=0;g.n42=0;g.n43=0;g.n44=1;return g};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
+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},getPosition:function(){return THREE.Matrix4.__v1.set(this.n14,this.n24,this.n34)},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},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,f=a.n21,g=a.n22,i=a.n23,j=a.n24,h=a.n31,l=a.n32,o=a.n33,m=a.n34,n=a.n41,p=a.n42,k=a.n43,u=a.n44;this.n11=i*m*p-j*o*p+j*l*k-g*m*k-i*l*u+g*o*u;this.n12=e*o*p-d*m*p-e*l*k+c*m*k+d*l*u-c*o*u;this.n13=d*j*p-e*i*p+e*g*k-c*j*k-d*g*u+c*i*u;this.n14=e*i*l-d*j*l-e*g*o+c*
+j*o+d*g*m-c*i*m;this.n21=j*o*n-i*m*n-j*h*k+f*m*k+i*h*u-f*o*u;this.n22=d*m*n-e*o*n+e*h*k-b*m*k-d*h*u+b*o*u;this.n23=e*i*n-d*j*n-e*f*k+b*j*k+d*f*u-b*i*u;this.n24=d*j*h-e*i*h+e*f*o-b*j*o-d*f*m+b*i*m;this.n31=g*m*n-j*l*n+j*h*p-f*m*p-g*h*u+f*l*u;this.n32=e*l*n-c*m*n-e*h*p+b*m*p+c*h*u-b*l*u;this.n33=c*j*n-e*g*n+e*f*p-b*j*p-c*f*u+b*g*u;this.n34=e*g*h-c*j*h-e*f*l+b*j*l+c*f*m-b*g*m;this.n41=i*l*n-g*o*n-i*h*p+f*o*p+g*h*k-f*l*k;this.n42=c*o*n-d*l*n+d*h*p-b*o*p-c*h*k+b*l*k;this.n43=d*g*n-c*i*n-d*f*p+b*i*p+c*
+f*k-b*g*k;this.n44=c*i*h-d*g*h+d*f*l-b*i*l-c*f*o+b*g*o;this.multiplyScalar(1/a.determinant());return this},setRotationFromEuler:function(a,b){var c=a.x,d=a.y,e=a.z,f=Math.cos(c),c=Math.sin(c),g=Math.cos(d),d=Math.sin(d),i=Math.cos(e),e=Math.sin(e);switch(b){case "YXZ":var j=g*i,h=g*e,l=d*i,o=d*e;this.n11=j+o*c;this.n12=l*c-h;this.n13=f*d;this.n21=f*e;this.n22=f*i;this.n23=-c;this.n31=h*c-l;this.n32=o+j*c;this.n33=f*g;break;case "ZXY":j=g*i;h=g*e;l=d*i;o=d*e;this.n11=j-o*c;this.n12=-f*e;this.n13=l+
+h*c;this.n21=h+l*c;this.n22=f*i;this.n23=o-j*c;this.n31=-f*d;this.n32=c;this.n33=f*g;break;case "ZYX":j=f*i;h=f*e;l=c*i;o=c*e;this.n11=g*i;this.n12=l*d-h;this.n13=j*d+o;this.n21=g*e;this.n22=o*d+j;this.n23=h*d-l;this.n31=-d;this.n32=c*g;this.n33=f*g;break;case "YZX":j=f*g;h=f*d;l=c*g;o=c*d;this.n11=g*i;this.n12=o-j*e;this.n13=l*e+h;this.n21=e;this.n22=f*i;this.n23=-c*i;this.n31=-d*i;this.n32=h*e+l;this.n33=j-o*e;break;case "XZY":j=f*g;h=f*d;l=c*g;o=c*d;this.n11=g*i;this.n12=-e;this.n13=d*i;this.n21=
+j*e+o;this.n22=f*i;this.n23=h*e-l;this.n31=l*e-h;this.n32=c*i;this.n33=o*e+j;break;default:j=f*i,h=f*e,l=c*i,o=c*e,this.n11=g*i,this.n12=-g*e,this.n13=d,this.n21=h+l*d,this.n22=j-o*d,this.n23=-c*g,this.n31=o-j*d,this.n32=l+h*d,this.n33=f*g}return this},setRotationFromQuaternion:function(a){var b=a.x,c=a.y,d=a.z,e=a.w,f=b+b,g=c+c,i=d+d,a=b*f,j=b*g,b=b*i,h=c*g,c=c*i,d=d*i,f=e*f,g=e*g,e=e*i;this.n11=1-(h+d);this.n12=j-e;this.n13=b+g;this.n21=j+e;this.n22=1-(a+d);this.n23=c-f;this.n31=b-g;this.n32=c+
+f;this.n33=1-(a+h);return this},compose:function(a,b,c){var d=THREE.Matrix4.__m1,e=THREE.Matrix4.__m2;d.identity();d.setRotationFromQuaternion(b);e.makeScale(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,f=THREE.Matrix4.__v3;d.set(this.n11,this.n21,this.n31);e.set(this.n12,this.n22,this.n32);f.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=f.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},translate:function(a){var b=a.x,c=a.y,a=a.z;this.n14=this.n11*b+this.n12*c+this.n13*a+this.n14;this.n24=this.n21*b+this.n22*c+this.n23*a+this.n24;this.n34=this.n31*b+this.n32*c+this.n33*a+this.n34;this.n44=this.n41*b+this.n42*c+this.n43*a+this.n44;return this},
+rotateX:function(a){var b=this.n12,c=this.n22,d=this.n32,e=this.n42,f=this.n13,g=this.n23,i=this.n33,j=this.n43,h=Math.cos(a),a=Math.sin(a);this.n12=h*b+a*f;this.n22=h*c+a*g;this.n32=h*d+a*i;this.n42=h*e+a*j;this.n13=h*f-a*b;this.n23=h*g-a*c;this.n33=h*i-a*d;this.n43=h*j-a*e;return this},rotateY:function(a){var b=this.n11,c=this.n21,d=this.n31,e=this.n41,f=this.n13,g=this.n23,i=this.n33,j=this.n43,h=Math.cos(a),a=Math.sin(a);this.n11=h*b-a*f;this.n21=h*c-a*g;this.n31=h*d-a*i;this.n41=h*e-a*j;this.n13=
+h*f+a*b;this.n23=h*g+a*c;this.n33=h*i+a*d;this.n43=h*j+a*e;return this},rotateZ:function(a){var b=this.n11,c=this.n21,d=this.n31,e=this.n41,f=this.n12,g=this.n22,i=this.n32,j=this.n42,h=Math.cos(a),a=Math.sin(a);this.n11=h*b+a*f;this.n21=h*c+a*g;this.n31=h*d+a*i;this.n41=h*e+a*j;this.n12=h*f-a*b;this.n22=h*g-a*c;this.n32=h*i-a*d;this.n42=h*j-a*e;return this},rotateByAxis:function(a,b){if(1===a.x&&0===a.y&&0===a.z)return this.rotateX(b);if(0===a.x&&1===a.y&&0===a.z)return this.rotateY(b);if(0===a.x&&
+0===a.y&&1===a.z)return this.rotateZ(b);var c=a.x,d=a.y,e=a.z,f=Math.sqrt(c*c+d*d+e*e),c=c/f,d=d/f,e=e/f,f=c*c,g=d*d,i=e*e,j=Math.cos(b),h=Math.sin(b),l=1-j,o=c*d*l,m=c*e*l,l=d*e*l,c=c*h,n=d*h,h=e*h,e=f+(1-f)*j,f=o+h,d=m-n,o=o-h,g=g+(1-g)*j,h=l+c,m=m+n,l=l-c,i=i+(1-i)*j,j=this.n11,c=this.n21,n=this.n31,p=this.n41,k=this.n12,u=this.n22,H=this.n32,C=this.n42,L=this.n13,G=this.n23,t=this.n33,E=this.n43;this.n11=e*j+f*k+d*L;this.n21=e*c+f*u+d*G;this.n31=e*n+f*H+d*t;this.n41=e*p+f*C+d*E;this.n12=o*j+g*
+k+h*L;this.n22=o*c+g*u+h*G;this.n32=o*n+g*H+h*t;this.n42=o*p+g*C+h*E;this.n13=m*j+l*k+i*L;this.n23=m*c+l*u+i*G;this.n33=m*n+l*H+i*t;this.n43=m*p+l*C+i*E;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},makeTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},makeRotationX: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},makeRotationY: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},makeRotationZ: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},makeRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),e=1-c,f=a.x,g=a.y,i=a.z,j=e*f,h=e*g;this.set(j*f+c,j*g-d*i,j*i+d*g,0,j*g+d*i,h*g+c,h*i-d*f,0,j*i-d*g,h*i+d*f,e*i*i+c,0,0,0,0,1);return this},makeScale:function(a,
+b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},makeFrustum:function(a,b,c,d,e,f){this.n11=2*e/(b-a);this.n12=0;this.n13=(b+a)/(b-a);this.n21=this.n14=0;this.n22=2*e/(d-c);this.n23=(d+c)/(d-c);this.n32=this.n31=this.n24=0;this.n33=-(f+e)/(f-e);this.n34=-2*f*e/(f-e);this.n42=this.n41=0;this.n43=-1;this.n44=0;return this},makePerspective:function(a,b,c,d){var a=c*Math.tan(a*Math.PI/360),e=-a;return this.makeFrustum(e*b,a*b,e,a,c,d)},makeOrthographic:function(a,b,c,d,e,f){var g=b-a,i=c-d,
+j=f-e;this.n11=2/g;this.n13=this.n12=0;this.n14=-((b+a)/g);this.n21=0;this.n22=2/i;this.n23=0;this.n24=-((c+d)/i);this.n32=this.n31=0;this.n33=-2/j;this.n34=-((f+e)/j);this.n43=this.n42=this.n41=0;this.n44=1;return this},clone:function(){return new THREE.Matrix4(this.n11,this.n12,this.n13,this.n14,this.n21,this.n22,this.n23,this.n24,this.n31,this.n32,this.n33,this.n34,this.n41,this.n42,this.n43,this.n44)}};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.id=THREE.Object3DCount++;this.name="";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=!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,applyMatrix:function(a){this.matrix.multiply(a,this.matrix);this.scale.getScaleFromMatrix(this.matrix);this.rotation.getRotationFromMatrix(this.matrix,this.scale);this.position.getPositionFromMatrix(this.matrix)},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,
@@ -63,23 +63,23 @@ this._vector.set(0,0,1))},lookAt:function(a){this.matrix.lookAt(a,this.position,
 this.children.indexOf(a);if(-1!==b){a.parent=void 0;this.children.splice(b,1);for(b=this;void 0!==b.parent;)b=b.parent;void 0!==b&&b instanceof THREE.Scene&&b.__removeObject(a)}},getChildByName:function(a,b){var c,d,e;for(c=0,d=this.children.length;c<d;c++){e=this.children[c];if(e.name===a||b&&(e=e.getChildByName(a,b),void 0!==e))return e}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,
 this.eulerOrder);if(1!==this.scale.x||1!==this.scale.y||1!==this.scale.z)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[f]=g[f]||new THREE.RenderableObject;f++;return a}function b(){var a=i[l]=i[l]||new THREE.RenderableVertex;l++;return a}function c(a,b){return b.z-a.z}function d(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;if(0<=e&&0<=f&&0<=g&&0<=h)return!0;if(0>e&&0>f||0>g&&0>h)return!1;0>e?c=Math.max(c,e/(e-f)):0>f&&(d=Math.min(d,e/(e-f)));0>g?c=Math.max(c,g/(g-h)):0>h&&(d=Math.min(d,g/(g-h)));if(d<c)return!1;a.lerpSelf(b,c);b.lerpSelf(a,1-d);return!0}
-var e,f,g=[],h,l,i=[],j,n,m=[],o,p=[],k,u,H=[],C,L,G=[],t={objects:[],sprites:[],lights:[],elements:[]},E=new THREE.Vector3,z=new THREE.Vector4,F=new THREE.Matrix4,r=new THREE.Matrix4,v=new THREE.Frustum,y=new THREE.Vector4,K=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);F.multiply(b.projectionMatrix,b.matrixWorldInverse);F.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);F.multiply(b.matrixWorld,
+THREE.Projector=function(){function a(){var a=g[f]=g[f]||new THREE.RenderableObject;f++;return a}function b(){var a=h[j]=h[j]||new THREE.RenderableVertex;j++;return a}function c(a,b){return b.z-a.z}function d(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;if(0<=e&&0<=f&&0<=g&&0<=h)return!0;if(0>e&&0>f||0>g&&0>h)return!1;0>e?c=Math.max(c,e/(e-f)):0>f&&(d=Math.min(d,e/(e-f)));0>g?c=Math.max(c,g/(g-h)):0>h&&(d=Math.min(d,g/(g-h)));if(d<c)return!1;a.lerpSelf(b,c);b.lerpSelf(a,1-d);return!0}
+var e,f,g=[],i,j,h=[],l,o,m=[],n,p=[],k,u,H=[],C,L,G=[],t={objects:[],sprites:[],lights:[],elements:[]},E=new THREE.Vector3,z=new THREE.Vector4,F=new THREE.Matrix4,r=new THREE.Matrix4,v=new THREE.Frustum,y=new THREE.Vector4,K=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);F.multiply(b.projectionMatrix,b.matrixWorldInverse);F.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);F.multiply(b.matrixWorld,
 b.projectionMatrixInverse);F.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(b,d){f=0;t.objects.length=0;t.sprites.length=0;t.lights.length=0;var g=function(b){if(!1!==b.visible){(b instanceof THREE.Mesh||b instanceof THREE.Line)&&(!1===b.frustumCulled||v.contains(b))?(E.copy(b.matrixWorld.getPosition()),F.multiplyVector3(E),
-e=a(),e.object=b,e.z=E.z,t.objects.push(e)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(E.copy(b.matrixWorld.getPosition()),F.multiplyVector3(E),e=a(),e.object=b,e.z=E.z,t.sprites.push(e)):b instanceof THREE.Light&&t.lights.push(b);for(var c=0,d=b.children.length;c<d;c++)g(b.children[c])}};g(b);d&&t.objects.sort(c);return t};this.projectScene=function(a,e,f){var g=e.near,E=e.far,Q=!1,U,D,J,R,A,P,N,V,s,x,w,B,M,la,fa;L=u=o=n=0;t.elements.length=0;void 0===e.parent&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),
-a.add(e));a.updateMatrixWorld();e.matrixWorldInverse.getInverse(e.matrixWorld);F.multiply(e.projectionMatrix,e.matrixWorldInverse);v.setFromMatrix(F);t=this.projectGraph(a,!1);for(a=0,U=t.objects.length;a<U;a++)if(s=t.objects[a].object,x=s.matrixWorld,l=0,s instanceof THREE.Mesh){w=s.geometry;B=s.geometry.materials;R=w.vertices;M=w.faces;la=w.faceVertexUvs;w=s.matrixRotationWorld.extractRotation(x);for(D=0,J=R.length;D<J;D++)h=b(),h.positionWorld.copy(R[D].position),x.multiplyVector3(h.positionWorld),
-h.positionScreen.copy(h.positionWorld),F.multiplyVector4(h.positionScreen),h.positionScreen.x/=h.positionScreen.w,h.positionScreen.y/=h.positionScreen.w,h.visible=h.positionScreen.z>g&&h.positionScreen.z<E;for(R=0,D=M.length;R<D;R++){J=M[R];if(J instanceof THREE.Face3)if(A=i[J.a],P=i[J.b],N=i[J.c],A.visible&&P.visible&&N.visible)if(Q=0>(N.positionScreen.x-A.positionScreen.x)*(P.positionScreen.y-A.positionScreen.y)-(N.positionScreen.y-A.positionScreen.y)*(P.positionScreen.x-A.positionScreen.x),s.doubleSided||
-Q!=s.flipSided)V=m[n]=m[n]||new THREE.RenderableFace3,n++,j=V,j.v1.copy(A),j.v2.copy(P),j.v3.copy(N);else continue;else continue;else if(J instanceof THREE.Face4)if(A=i[J.a],P=i[J.b],N=i[J.c],V=i[J.d],A.visible&&P.visible&&N.visible&&V.visible)if(Q=0>(V.positionScreen.x-A.positionScreen.x)*(P.positionScreen.y-A.positionScreen.y)-(V.positionScreen.y-A.positionScreen.y)*(P.positionScreen.x-A.positionScreen.x)||0>(P.positionScreen.x-N.positionScreen.x)*(V.positionScreen.y-N.positionScreen.y)-(P.positionScreen.y-
-N.positionScreen.y)*(V.positionScreen.x-N.positionScreen.x),s.doubleSided||Q!=s.flipSided)fa=p[o]=p[o]||new THREE.RenderableFace4,o++,j=fa,j.v1.copy(A),j.v2.copy(P),j.v3.copy(N),j.v4.copy(V);else continue;else continue;j.normalWorld.copy(J.normal);!Q&&(s.flipSided||s.doubleSided)&&j.normalWorld.negate();w.multiplyVector3(j.normalWorld);j.centroidWorld.copy(J.centroid);x.multiplyVector3(j.centroidWorld);j.centroidScreen.copy(j.centroidWorld);F.multiplyVector3(j.centroidScreen);N=J.vertexNormals;for(A=
-0,P=N.length;A<P;A++)V=j.vertexNormalsWorld[A],V.copy(N[A]),!Q&&(s.flipSided||s.doubleSided)&&V.negate(),w.multiplyVector3(V);for(A=0,P=la.length;A<P;A++)if(fa=la[A][R])for(N=0,V=fa.length;N<V;N++)j.uvs[A][N]=fa[N];j.material=s.material;j.faceMaterial=null!==J.materialIndex?B[J.materialIndex]:null;j.z=j.centroidScreen.z;t.elements.push(j)}}else if(s instanceof THREE.Line){r.multiply(F,x);R=s.geometry.vertices;A=b();A.positionScreen.copy(R[0].position);r.multiplyVector4(A.positionScreen);for(D=1,J=
-R.length;D<J;D++)if(A=b(),A.positionScreen.copy(R[D].position),r.multiplyVector4(A.positionScreen),P=i[l-2],y.copy(A.positionScreen),K.copy(P.positionScreen),d(y,K))y.multiplyScalar(1/y.w),K.multiplyScalar(1/K.w),x=H[u]=H[u]||new THREE.RenderableLine,u++,k=x,k.v1.positionScreen.copy(y),k.v2.positionScreen.copy(K),k.z=Math.max(y.z,K.z),k.material=s.material,t.elements.push(k)}for(a=0,U=t.sprites.length;a<U;a++)if(s=t.sprites[a].object,x=s.matrixWorld,s instanceof THREE.Particle&&(z.set(x.n14,x.n24,
+e=a(),e.object=b,e.z=E.z,t.objects.push(e)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(E.copy(b.matrixWorld.getPosition()),F.multiplyVector3(E),e=a(),e.object=b,e.z=E.z,t.sprites.push(e)):b instanceof THREE.Light&&t.lights.push(b);for(var c=0,d=b.children.length;c<d;c++)g(b.children[c])}};g(b);d&&t.objects.sort(c);return t};this.projectScene=function(a,e,f){var g=e.near,E=e.far,Q=!1,U,D,J,R,A,P,N,V,s,x,w,B,M,la,fa;L=u=n=o=0;t.elements.length=0;void 0===e.parent&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),
+a.add(e));a.updateMatrixWorld();e.matrixWorldInverse.getInverse(e.matrixWorld);F.multiply(e.projectionMatrix,e.matrixWorldInverse);v.setFromMatrix(F);t=this.projectGraph(a,!1);for(a=0,U=t.objects.length;a<U;a++)if(s=t.objects[a].object,x=s.matrixWorld,j=0,s instanceof THREE.Mesh){w=s.geometry;B=s.geometry.materials;R=w.vertices;M=w.faces;la=w.faceVertexUvs;w=s.matrixRotationWorld.extractRotation(x);for(D=0,J=R.length;D<J;D++)i=b(),i.positionWorld.copy(R[D].position),x.multiplyVector3(i.positionWorld),
+i.positionScreen.copy(i.positionWorld),F.multiplyVector4(i.positionScreen),i.positionScreen.x/=i.positionScreen.w,i.positionScreen.y/=i.positionScreen.w,i.visible=i.positionScreen.z>g&&i.positionScreen.z<E;for(R=0,D=M.length;R<D;R++){J=M[R];if(J instanceof THREE.Face3)if(A=h[J.a],P=h[J.b],N=h[J.c],A.visible&&P.visible&&N.visible)if(Q=0>(N.positionScreen.x-A.positionScreen.x)*(P.positionScreen.y-A.positionScreen.y)-(N.positionScreen.y-A.positionScreen.y)*(P.positionScreen.x-A.positionScreen.x),s.doubleSided||
+Q!=s.flipSided)V=m[o]=m[o]||new THREE.RenderableFace3,o++,l=V,l.v1.copy(A),l.v2.copy(P),l.v3.copy(N);else continue;else continue;else if(J instanceof THREE.Face4)if(A=h[J.a],P=h[J.b],N=h[J.c],V=h[J.d],A.visible&&P.visible&&N.visible&&V.visible)if(Q=0>(V.positionScreen.x-A.positionScreen.x)*(P.positionScreen.y-A.positionScreen.y)-(V.positionScreen.y-A.positionScreen.y)*(P.positionScreen.x-A.positionScreen.x)||0>(P.positionScreen.x-N.positionScreen.x)*(V.positionScreen.y-N.positionScreen.y)-(P.positionScreen.y-
+N.positionScreen.y)*(V.positionScreen.x-N.positionScreen.x),s.doubleSided||Q!=s.flipSided)fa=p[n]=p[n]||new THREE.RenderableFace4,n++,l=fa,l.v1.copy(A),l.v2.copy(P),l.v3.copy(N),l.v4.copy(V);else continue;else continue;l.normalWorld.copy(J.normal);!Q&&(s.flipSided||s.doubleSided)&&l.normalWorld.negate();w.multiplyVector3(l.normalWorld);l.centroidWorld.copy(J.centroid);x.multiplyVector3(l.centroidWorld);l.centroidScreen.copy(l.centroidWorld);F.multiplyVector3(l.centroidScreen);N=J.vertexNormals;for(A=
+0,P=N.length;A<P;A++)V=l.vertexNormalsWorld[A],V.copy(N[A]),!Q&&(s.flipSided||s.doubleSided)&&V.negate(),w.multiplyVector3(V);for(A=0,P=la.length;A<P;A++)if(fa=la[A][R])for(N=0,V=fa.length;N<V;N++)l.uvs[A][N]=fa[N];l.material=s.material;l.faceMaterial=null!==J.materialIndex?B[J.materialIndex]:null;l.z=l.centroidScreen.z;t.elements.push(l)}}else if(s instanceof THREE.Line){r.multiply(F,x);R=s.geometry.vertices;A=b();A.positionScreen.copy(R[0].position);r.multiplyVector4(A.positionScreen);for(D=1,J=
+R.length;D<J;D++)if(A=b(),A.positionScreen.copy(R[D].position),r.multiplyVector4(A.positionScreen),P=h[j-2],y.copy(A.positionScreen),K.copy(P.positionScreen),d(y,K))y.multiplyScalar(1/y.w),K.multiplyScalar(1/K.w),x=H[u]=H[u]||new THREE.RenderableLine,u++,k=x,k.v1.positionScreen.copy(y),k.v2.positionScreen.copy(K),k.z=Math.max(y.z,K.z),k.material=s.material,t.elements.push(k)}for(a=0,U=t.sprites.length;a<U;a++)if(s=t.sprites[a].object,x=s.matrixWorld,s instanceof THREE.Particle&&(z.set(x.n14,x.n24,
 x.n34,1),F.multiplyVector4(z),z.z/=z.w,0<z.z&&1>z.z))g=G[L]=G[L]||new THREE.RenderableParticle,L++,C=g,C.x=z.x/z.w,C.y=z.y/z.w,C.z=z.z,C.rotation=s.rotation.z,C.scale.x=s.scale.x*Math.abs(C.x-(z.x+e.projectionMatrix.n11)/(z.w+e.projectionMatrix.n14)),C.scale.y=s.scale.y*Math.abs(C.y-(z.y+e.projectionMatrix.n22)/(z.w+e.projectionMatrix.n24)),C.material=s.material,t.elements.push(C);f&&t.elements.sort(c);return t}};
 THREE.Quaternion=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=void 0!==d?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),f=Math.cos(c),c=Math.sin(c),g=a*b,h=d*e;this.w=g*f-h*c;this.x=g*c+h*f;this.y=d*b*f+a*e*c;this.z=a*e*f-d*b*c;return this},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);
+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),f=Math.cos(c),c=Math.sin(c),g=a*b,i=d*e;this.w=g*f-i*c;this.x=g*c+i*f;this.y=d*b*f+a*e*c;this.z=a*e*f-d*b*c;return this},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=0>a.n32-a.n23?-Math.abs(this.x):Math.abs(this.x);this.y=0>a.n13-a.n31?-Math.abs(this.y):Math.abs(this.y);this.z=0>a.n21-a.n12?-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);0===a?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},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},multiplySelf:function(a){var b=this.x,c=this.y,d=this.z,e=this.w,f=a.x,g=a.y,h=a.z,a=a.w;this.x=b*a+e*f+c*h-d*g;this.y=c*a+e*g+d*f-b*h;this.z=d*a+e*h+b*g-c*f;this.w=e*a-b*f-c*g-d*h;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,f=this.x,g=this.y,h=this.z,l=this.w,i=l*c+g*e-h*d,j=l*d+h*c-f*e,n=l*e+f*
-d-g*c,c=-f*c-g*d-h*e;b.x=i*l+c*-f+j*-h-n*-g;b.y=j*l+c*-g+n*-f-i*-h;b.z=n*l+c*-h+i*-g-j*-f;return b},clone:function(){return new THREE.Quaternion(this.x,this.y,this.z,this.w)}};
+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},multiplySelf:function(a){var b=this.x,c=this.y,d=this.z,e=this.w,f=a.x,g=a.y,i=a.z,a=a.w;this.x=b*a+e*f+c*i-d*g;this.y=c*a+e*g+d*f-b*i;this.z=d*a+e*i+b*g-c*f;this.w=e*a-b*f-c*g-d*i;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,f=this.x,g=this.y,i=this.z,j=this.w,h=j*c+g*e-i*d,l=j*d+i*c-f*e,o=j*e+f*
+d-g*c,c=-f*c-g*d-i*e;b.x=h*j+c*-f+l*-i-o*-g;b.y=l*j+c*-g+o*-f-h*-i;b.z=o*j+c*-i+h*-g-l*-f;return b},clone:function(){return new THREE.Quaternion(this.x,this.y,this.z,this.w)}};
 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;0>e?(c.w=-b.w,c.x=-b.x,c.y=-b.y,c.z=-b.z,e=-e):c.copy(b);if(1<=Math.abs(e))return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var f=Math.acos(e),e=Math.sqrt(1-e*e);if(0.001>Math.abs(e))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)*f)/e;d=Math.sin(d*f)/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.Vertex.prototype={constructor:THREE.Vertex,clone:function(){return new THREE.Vertex(this.position.clone())}};THREE.Face3=function(a,b,c,d,e,f){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.materialIndex=f;this.centroid=new THREE.Vector3};
 THREE.Face3.prototype={constructor:THREE.Face3,clone:function(){var a=new THREE.Face3(this.a,this.b,this.c);a.normal.copy(this.normal);a.color.copy(this.color);a.centroid.copy(this.centroid);a.materialIndex=this.materialIndex;var b,c;for(b=0,c=this.vertexNormals.length;b<c;b++)a.vertexNormals[b]=this.vertexNormals[b].clone();for(b=0,c=this.vertexColors.length;b<c;b++)a.vertexColors[b]=this.vertexColors[b].clone();for(b=0,c=this.vertexTangents.length;b<c;b++)a.vertexTangents[b]=this.vertexTangents[b].clone();
@@ -89,28 +89,30 @@ return a}};THREE.UV=function(a,b){this.u=a||0;this.v=b||0};THREE.UV.prototype={c
 THREE.Geometry=function(){this.id=THREE.GeometryCount++;this.vertices=[];this.colors=[];this.materials=[];this.faces=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.morphNormals=[];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);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 e=this.faces[c];b.multiplyVector3(e.normal);for(var f=0,g=e.vertexNormals.length;f<g;f++)b.multiplyVector3(e.vertexNormals[f]);a.multiplyVector3(e.centroid)}},computeCentroids:function(){var a,b,c;for(a=0,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(){var a,b,c,d,e,f,g=new THREE.Vector3,
-h=new THREE.Vector3;for(a=0,b=this.faces.length;a<b;a++)c=this.faces[a],d=this.vertices[c.a],e=this.vertices[c.b],f=this.vertices[c.c],g.sub(f.position,e.position),h.sub(d.position,e.position),g.crossSelf(h),g.isZero()||g.normalize(),c.normal.copy(g)},computeVertexNormals:function(){var a,b,c,d;if(void 0===this.__tmpVertices){d=this.__tmpVertices=Array(this.vertices.length);for(a=0,b=this.vertices.length;a<b;a++)d[a]=new THREE.Vector3;for(a=0,b=this.faces.length;a<b;a++)if(c=this.faces[a],c instanceof
+i=new THREE.Vector3;for(a=0,b=this.faces.length;a<b;a++)c=this.faces[a],d=this.vertices[c.a],e=this.vertices[c.b],f=this.vertices[c.c],g.sub(f.position,e.position),i.sub(d.position,e.position),g.crossSelf(i),g.isZero()||g.normalize(),c.normal.copy(g)},computeVertexNormals:function(){var a,b,c,d;if(void 0===this.__tmpVertices){d=this.__tmpVertices=Array(this.vertices.length);for(a=0,b=this.vertices.length;a<b;a++)d[a]=new THREE.Vector3;for(a=0,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;for(a=0,b=this.vertices.length;a<b;a++)d[a].set(0,0,0)}for(a=0,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));for(a=0,b=this.vertices.length;a<b;a++)d[a].normalize();for(a=0,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]))},computeMorphNormals:function(){var a,b,c,d,e;for(c=0,d=this.faces.length;c<
 d;c++){e=this.faces[c];e.__originalFaceNormal?e.__originalFaceNormal.copy(e.normal):e.__originalFaceNormal=e.normal.clone();if(!e.__originalVertexNormals)e.__originalVertexNormals=[];for(a=0,b=e.vertexNormals.length;a<b;a++)e.__originalVertexNormals[a]?e.__originalVertexNormals[a].copy(e.vertexNormals[a]):e.__originalVertexNormals[a]=e.vertexNormals[a].clone()}var f=new THREE.Geometry;f.faces=this.faces;for(a=0,b=this.morphTargets.length;a<b;a++){if(!this.morphNormals[a]){this.morphNormals[a]={};
-this.morphNormals[a].faceNormals=[];this.morphNormals[a].vertexNormals=[];var g=this.morphNormals[a].faceNormals,h=this.morphNormals[a].vertexNormals,l,i;for(c=0,d=this.faces.length;c<d;c++)e=this.faces[c],l=new THREE.Vector3,i=e instanceof THREE.Face3?{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3}:{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3,d:new THREE.Vector3},g.push(l),h.push(i)}g=this.morphNormals[a];f.vertices=this.morphTargets[a].vertices;f.computeFaceNormals();
-f.computeVertexNormals();for(c=0,d=this.faces.length;c<d;c++)e=this.faces[c],l=g.faceNormals[c],i=g.vertexNormals[c],l.copy(e.normal),e instanceof THREE.Face3?(i.a.copy(e.vertexNormals[0]),i.b.copy(e.vertexNormals[1]),i.c.copy(e.vertexNormals[2])):(i.a.copy(e.vertexNormals[0]),i.b.copy(e.vertexNormals[1]),i.c.copy(e.vertexNormals[2]),i.d.copy(e.vertexNormals[3]))}for(c=0,d=this.faces.length;c<d;c++)e=this.faces[c],e.normal=e.__originalFaceNormal,e.vertexNormals=e.__originalVertexNormals},computeTangents:function(){function a(a,
-b,c,d,e,f,A){h=a.vertices[b].position;l=a.vertices[c].position;i=a.vertices[d].position;j=g[e];n=g[f];m=g[A];o=l.x-h.x;p=i.x-h.x;k=l.y-h.y;u=i.y-h.y;H=l.z-h.z;C=i.z-h.z;L=n.u-j.u;G=m.u-j.u;t=n.v-j.v;E=m.v-j.v;z=1/(L*E-G*t);y.set((E*o-t*p)*z,(E*k-t*u)*z,(E*H-t*C)*z);K.set((L*p-G*o)*z,(L*u-G*k)*z,(L*C-G*H)*z);r[b].addSelf(y);r[c].addSelf(y);r[d].addSelf(y);v[b].addSelf(K);v[c].addSelf(K);v[d].addSelf(K)}var b,c,d,e,f,g,h,l,i,j,n,m,o,p,k,u,H,C,L,G,t,E,z,F,r=[],v=[],y=new THREE.Vector3,K=new THREE.Vector3,
-$=new THREE.Vector3,da=new THREE.Vector3,O=new THREE.Vector3;for(b=0,c=this.vertices.length;b<c;b++)r[b]=new THREE.Vector3,v[b]=new THREE.Vector3;for(b=0,c=this.faces.length;b<c;b++)f=this.faces[b],g=this.faceVertexUvs[0][b],f instanceof THREE.Face3?a(this,f.a,f.b,f.c,0,1,2):f instanceof THREE.Face4&&(a(this,f.a,f.b,f.c,0,1,2),a(this,f.a,f.b,f.d,0,1,3));var I=["a","b","c","d"];for(b=0,c=this.faces.length;b<c;b++){f=this.faces[b];for(d=0;d<f.vertexNormals.length;d++)O.copy(f.vertexNormals[d]),e=f[I[d]],
+this.morphNormals[a].faceNormals=[];this.morphNormals[a].vertexNormals=[];var g=this.morphNormals[a].faceNormals,i=this.morphNormals[a].vertexNormals,j,h;for(c=0,d=this.faces.length;c<d;c++)e=this.faces[c],j=new THREE.Vector3,h=e instanceof THREE.Face3?{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3}:{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3,d:new THREE.Vector3},g.push(j),i.push(h)}g=this.morphNormals[a];f.vertices=this.morphTargets[a].vertices;f.computeFaceNormals();
+f.computeVertexNormals();for(c=0,d=this.faces.length;c<d;c++)e=this.faces[c],j=g.faceNormals[c],h=g.vertexNormals[c],j.copy(e.normal),e instanceof THREE.Face3?(h.a.copy(e.vertexNormals[0]),h.b.copy(e.vertexNormals[1]),h.c.copy(e.vertexNormals[2])):(h.a.copy(e.vertexNormals[0]),h.b.copy(e.vertexNormals[1]),h.c.copy(e.vertexNormals[2]),h.d.copy(e.vertexNormals[3]))}for(c=0,d=this.faces.length;c<d;c++)e=this.faces[c],e.normal=e.__originalFaceNormal,e.vertexNormals=e.__originalVertexNormals},computeTangents:function(){function a(a,
+b,c,d,e,f,A){i=a.vertices[b].position;j=a.vertices[c].position;h=a.vertices[d].position;l=g[e];o=g[f];m=g[A];n=j.x-i.x;p=h.x-i.x;k=j.y-i.y;u=h.y-i.y;H=j.z-i.z;C=h.z-i.z;L=o.u-l.u;G=m.u-l.u;t=o.v-l.v;E=m.v-l.v;z=1/(L*E-G*t);y.set((E*n-t*p)*z,(E*k-t*u)*z,(E*H-t*C)*z);K.set((L*p-G*n)*z,(L*u-G*k)*z,(L*C-G*H)*z);r[b].addSelf(y);r[c].addSelf(y);r[d].addSelf(y);v[b].addSelf(K);v[c].addSelf(K);v[d].addSelf(K)}var b,c,d,e,f,g,i,j,h,l,o,m,n,p,k,u,H,C,L,G,t,E,z,F,r=[],v=[],y=new THREE.Vector3,K=new THREE.Vector3,
+$=new THREE.Vector3,da=new THREE.Vector3,O=new THREE.Vector3;for(b=0,c=this.vertices.length;b<c;b++)r[b]=new THREE.Vector3,v[b]=new THREE.Vector3;for(b=0,c=this.faces.length;b<c;b++)f=this.faces[b],g=this.faceVertexUvs[0][b],f instanceof THREE.Face3?a(this,f.a,f.b,f.c,0,1,2):f instanceof THREE.Face4&&(a(this,f.a,f.b,f.d,0,1,3),a(this,f.b,f.c,f.d,1,2,3));var I=["a","b","c","d"];for(b=0,c=this.faces.length;b<c;b++){f=this.faces[b];for(d=0;d<f.vertexNormals.length;d++)O.copy(f.vertexNormals[d]),e=f[I[d]],
 F=r[e],$.copy(F),$.subSelf(O.multiplyScalar(O.dot(F))).normalize(),da.cross(f.vertexNormals[d],F),e=da.dot(v[e]),e=0>e?-1:1,f.vertexTangents[d]=new THREE.Vector4($.x,$.y,$.z,e)}this.hasTangents=!0},computeBoundingBox:function(){if(!this.boundingBox)this.boundingBox={min:new THREE.Vector3,max:new THREE.Vector3};if(0<this.vertices.length){var a;a=this.vertices[0].position;this.boundingBox.min.copy(a);this.boundingBox.max.copy(a);for(var b=this.boundingBox.min,c=this.boundingBox.max,d=1,e=this.vertices.length;d<
 e;d++){a=this.vertices[d].position;if(a.x<b.x)b.x=a.x;else if(a.x>c.x)c.x=a.x;if(a.y<b.y)b.y=a.y;else if(a.y>c.y)c.y=a.y;if(a.z<b.z)b.z=a.z;else if(a.z>c.z)c.z=a.z}}else this.boundingBox.min.set(0,0,0),this.boundingBox.max.set(0,0,0)},computeBoundingSphere:function(){if(!this.boundingSphere)this.boundingSphere={radius:0};for(var a,b=0,c=0,d=this.vertices.length;c<d;c++)a=this.vertices[c].position.length(),a>b&&(b=a);this.boundingSphere.radius=b},mergeVertices:function(){var a={},b=[],c=[],d,e=Math.pow(10,
 4),f,g;for(f=0,g=this.vertices.length;f<g;f++)d=this.vertices[f].position,d=[Math.round(d.x*e),Math.round(d.y*e),Math.round(d.z*e)].join("_"),void 0===a[d]?(a[d]=f,b.push(this.vertices[f]),c[f]=b.length-1):c[f]=c[a[d]];for(f=0,g=this.faces.length;f<g;f++)if(a=this.faces[f],a instanceof THREE.Face3)a.a=c[a.a],a.b=c[a.b],a.c=c[a.c];else 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(){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.getRotationFromMatrix(this.matrix)};
-THREE.OrthographicCamera=function(a,b,c,d,e,f){THREE.Camera.call(this);this.left=a;this.right=b;this.top=c;this.bottom=d;this.near=void 0!==e?e:0.1;this.far=void 0!==f?f: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.OrthographicCamera=function(a,b,c,d,e,f){THREE.Camera.call(this);this.left=a;this.right=b;this.top=c;this.bottom=d;this.near=void 0!==e?e:0.1;this.far=void 0!==f?f:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=new THREE.Camera;THREE.OrthographicCamera.prototype.constructor=THREE.OrthographicCamera;THREE.OrthographicCamera.prototype.updateProjectionMatrix=function(){this.projectionMatrix.makeOrthographic(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=void 0!==a?a:50;this.aspect=void 0!==b?b:1;this.near=void 0!==c?c:0.1;this.far=void 0!==d?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((void 0!==b?b:24)/(2*a))*(180/Math.PI);this.updateProjectionMatrix()};
 THREE.PerspectiveCamera.prototype.setViewOffset=function(a,b,c,d,e,f){this.fullWidth=a;this.fullHeight=b;this.x=c;this.y=d;this.width=e;this.height=f;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.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.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.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.target=new THREE.Object3D;this.intensity=void 0!==b?b:1;this.distance=void 0!==c?c:0;this.onlyShadow=this.castShadow=!1;this.shadowCameraNear=50;this.shadowCameraFar=5E3;this.shadowCameraLeft=-500;this.shadowCameraTop=this.shadowCameraRight=500;this.shadowCameraBottom=-500;this.shadowCameraVisible=!1;this.shadowBias=0;this.shadowDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowCascade=
 !1;this.shadowCascadeOffset=new THREE.Vector3(0,0,-1E3);this.shadowCascadeCount=2;this.shadowCascadeBias=[0,0,0];this.shadowCascadeWidth=[512,512,512];this.shadowCascadeHeight=[512,512,512];this.shadowCascadeNearZ=[-1,0.99,0.998];this.shadowCascadeFarZ=[0.99,0.998,1];this.shadowCascadeArray=[];this.shadowMatrix=this.shadowCamera=this.shadowMapSize=this.shadowMap=null};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=void 0!==b?b:1;this.distance=void 0!==c?c:0};THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight;
-THREE.Material=function(a){a=a||{};this.id=THREE.MaterialCount++;this.name="";this.opacity=void 0!==a.opacity?a.opacity:1;this.transparent=void 0!==a.transparent?a.transparent:!1;this.blending=void 0!==a.blending?a.blending:THREE.NormalBlending;this.depthTest=void 0!==a.depthTest?a.depthTest:!0;this.depthWrite=void 0!==a.depthWrite?a.depthWrite:!0;this.polygonOffset=void 0!==a.polygonOffset?a.polygonOffset:!1;this.polygonOffsetFactor=void 0!==a.polygonOffsetFactor?a.polygonOffsetFactor:0;this.polygonOffsetUnits=
-void 0!==a.polygonOffsetUnits?a.polygonOffsetUnits:0;this.alphaTest=void 0!==a.alphaTest?a.alphaTest:0;this.overdraw=void 0!==a.overdraw?a.overdraw:!1;this.needsUpdate=!0};THREE.MaterialCount=0;THREE.NoShading=0;THREE.FlatShading=1;THREE.SmoothShading=2;THREE.NoColors=0;THREE.FaceColors=1;THREE.VertexColors=2;THREE.NoBlending=0;THREE.NormalBlending=1;THREE.AdditiveBlending=2;THREE.SubtractiveBlending=3;THREE.MultiplyBlending=4;THREE.AdditiveAlphaBlending=5;
+THREE.Material=function(a){a=a||{};this.id=THREE.MaterialCount++;this.name="";this.opacity=void 0!==a.opacity?a.opacity:1;this.transparent=void 0!==a.transparent?a.transparent:!1;this.blending=void 0!==a.blending?a.blending:THREE.NormalBlending;this.blendSrc=void 0!==a.blendSrc?a.blendSrc:THREE.SrcAlphaFactor;this.blendDst=void 0!==a.blendDst?a.blendDst:THREE.OneMinusSrcAlphaFactor;this.blendEquation=void 0!==a.blendEquation?a.blendEquation:THREE.AddEquation;this.depthTest=void 0!==a.depthTest?a.depthTest:
+!0;this.depthWrite=void 0!==a.depthWrite?a.depthWrite:!0;this.polygonOffset=void 0!==a.polygonOffset?a.polygonOffset:!1;this.polygonOffsetFactor=void 0!==a.polygonOffsetFactor?a.polygonOffsetFactor:0;this.polygonOffsetUnits=void 0!==a.polygonOffsetUnits?a.polygonOffsetUnits:0;this.alphaTest=void 0!==a.alphaTest?a.alphaTest:0;this.overdraw=void 0!==a.overdraw?a.overdraw:!1;this.needsUpdate=!0};THREE.MaterialCount=0;THREE.NoShading=0;THREE.FlatShading=1;THREE.SmoothShading=2;THREE.NoColors=0;
+THREE.FaceColors=1;THREE.VertexColors=2;THREE.NoBlending=0;THREE.NormalBlending=1;THREE.AdditiveBlending=2;THREE.SubtractiveBlending=3;THREE.MultiplyBlending=4;THREE.AdditiveAlphaBlending=5;THREE.CustomBlending=6;THREE.AddEquation=100;THREE.SubtractEquation=101;THREE.ReverseSubtractEquation=102;THREE.ZeroFactor=200;THREE.OneFactor=201;THREE.SrcColorFactor=202;THREE.OneMinusSrcColorFactor=203;THREE.SrcAlphaFactor=204;THREE.OneMinusSrcAlphaFactor=205;THREE.DstAlphaFactor=206;
+THREE.OneMinusDstAlphaFactor=207;THREE.DstColorFactor=208;THREE.OneMinusDstColorFactor=209;THREE.SrcAlphaSaturateFactor=210;
 THREE.LineBasicMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=void 0!==a.color?new THREE.Color(a.color):new THREE.Color(16777215);this.linewidth=void 0!==a.linewidth?a.linewidth:1;this.linecap=void 0!==a.linecap?a.linecap:"round";this.linejoin=void 0!==a.linejoin?a.linejoin:"round";this.vertexColors=a.vertexColors?a.vertexColors:!1;this.fog=void 0!==a.fog?a.fog:!0};THREE.LineBasicMaterial.prototype=new THREE.Material;THREE.LineBasicMaterial.prototype.constructor=THREE.LineBasicMaterial;
 THREE.MeshBasicMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=void 0!==a.color?new THREE.Color(a.color):new THREE.Color(16777215);this.map=void 0!==a.map?a.map:null;this.lightMap=void 0!==a.lightMap?a.lightMap:null;this.envMap=void 0!==a.envMap?a.envMap:null;this.combine=void 0!==a.combine?a.combine:THREE.MultiplyOperation;this.reflectivity=void 0!==a.reflectivity?a.reflectivity:1;this.refractionRatio=void 0!==a.refractionRatio?a.refractionRatio:0.98;this.fog=void 0!==a.fog?a.fog:
 !0;this.shading=void 0!==a.shading?a.shading:THREE.SmoothShading;this.wireframe=void 0!==a.wireframe?a.wireframe:!1;this.wireframeLinewidth=void 0!==a.wireframeLinewidth?a.wireframeLinewidth:1;this.wireframeLinecap=void 0!==a.wireframeLinecap?a.wireframeLinecap:"round";this.wireframeLinejoin=void 0!==a.wireframeLinejoin?a.wireframeLinejoin:"round";this.vertexColors=void 0!==a.vertexColors?a.vertexColors:THREE.NoColors;this.skinning=void 0!==a.skinning?a.skinning:!1;this.morphTargets=void 0!==a.morphTargets?
@@ -125,51 +127,51 @@ a.shading?a.shading:THREE.SmoothShading;this.wireframe=void 0!==a.wireframe?a.wi
 THREE.MeshDepthMaterial.prototype.constructor=THREE.MeshDepthMaterial;THREE.MeshNormalMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.shading=a.shading?a.shading:THREE.FlatShading;this.wireframe=a.wireframe?a.wireframe:!1;this.wireframeLinewidth=a.wireframeLinewidth?a.wireframeLinewidth:1};THREE.MeshNormalMaterial.prototype=new THREE.Material;THREE.MeshNormalMaterial.prototype.constructor=THREE.MeshNormalMaterial;THREE.MeshFaceMaterial=function(){};
 THREE.ParticleBasicMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=void 0!==a.color?new THREE.Color(a.color):new THREE.Color(16777215);this.map=void 0!==a.map?a.map:null;this.size=void 0!==a.size?a.size:1;this.sizeAttenuation=void 0!==a.sizeAttenuation?a.sizeAttenuation:!0;this.vertexColors=void 0!==a.vertexColors?a.vertexColors:!1;this.fog=void 0!==a.fog?a.fog:!0};THREE.ParticleBasicMaterial.prototype=new THREE.Material;THREE.ParticleBasicMaterial.prototype.constructor=THREE.ParticleBasicMaterial;
 THREE.ParticleCanvasMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=void 0!==a.color?new THREE.Color(a.color):new THREE.Color(16777215);this.program=void 0!==a.program?a.program:function(){}};THREE.ParticleCanvasMaterial.prototype=new THREE.Material;THREE.ParticleCanvasMaterial.prototype.constructor=THREE.ParticleCanvasMaterial;
-THREE.Texture=function(a,b,c,d,e,f,g,h){this.id=THREE.TextureCount++;this.image=a;this.mapping=void 0!==b?b:new THREE.UVMapping;this.wrapS=void 0!==c?c:THREE.ClampToEdgeWrapping;this.wrapT=void 0!==d?d:THREE.ClampToEdgeWrapping;this.magFilter=void 0!==e?e:THREE.LinearFilter;this.minFilter=void 0!==f?f:THREE.LinearMipMapLinearFilter;this.format=void 0!==g?g:THREE.RGBAFormat;this.type=void 0!==h?h:THREE.UnsignedByteType;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.generateMipmaps=
-!0;this.needsUpdate=!1;this.onUpdate=null};THREE.Texture.prototype={constructor:THREE.Texture,clone:function(){var a=new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter,this.format,this.type);a.offset.copy(this.offset);a.repeat.copy(this.repeat);return a}};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(a,b,c,d,e,f,g,h,l,i){THREE.Texture.call(this,null,f,g,h,l,i,d,e);this.image={data:a,width:b,height:c}};THREE.DataTexture.prototype=new THREE.Texture;THREE.DataTexture.prototype.constructor=THREE.DataTexture;
+THREE.Texture=function(a,b,c,d,e,f,g,i){this.id=THREE.TextureCount++;this.image=a;this.mapping=void 0!==b?b:new THREE.UVMapping;this.wrapS=void 0!==c?c:THREE.ClampToEdgeWrapping;this.wrapT=void 0!==d?d:THREE.ClampToEdgeWrapping;this.magFilter=void 0!==e?e:THREE.LinearFilter;this.minFilter=void 0!==f?f:THREE.LinearMipMapLinearFilter;this.format=void 0!==g?g:THREE.RGBAFormat;this.type=void 0!==i?i:THREE.UnsignedByteType;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.generateMipmaps=
+!0;this.needsUpdate=this.premultiplyAlpha=!1;this.onUpdate=null};THREE.Texture.prototype={constructor:THREE.Texture,clone:function(){var a=new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter,this.format,this.type);a.offset.copy(this.offset);a.repeat.copy(this.repeat);return a}};THREE.TextureCount=0;THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.UVMapping=function(){};THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};
+THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=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(a,b,c,d,e,f,g,i,j,h){THREE.Texture.call(this,null,f,g,i,j,h,d,e);this.image={data:a,width:b,height:c}};THREE.DataTexture.prototype=new THREE.Texture;THREE.DataTexture.prototype.constructor=THREE.DataTexture;
 THREE.DataTexture.prototype.clone=function(){var a=new THREE.DataTexture(this.image.data,this.image.width,this.image.height,this.format,this.type,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter);a.offset.copy(this.offset);a.repeat.copy(this.repeat);return a};THREE.Particle=function(a){THREE.Object3D.call(this);this.material=a};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;
 THREE.Line=function(a,b,c){THREE.Object3D.call(this);this.geometry=a;this.material=void 0!==b?b:new THREE.LineBasicMaterial({color:16777215*Math.random()});this.type=void 0!==c?c:THREE.LineStrip;this.geometry&&(this.geometry.boundingSphere||this.geometry.computeBoundingSphere())};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;
 THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material=void 0!==b?b:new THREE.MeshBasicMaterial({color:16777215*Math.random(),wireframe:!0});if(this.geometry&&(this.geometry.boundingSphere||this.geometry.computeBoundingSphere(),this.boundRadius=a.boundingSphere.radius,this.geometry.morphTargets.length)){this.morphTargetBase=-1;this.morphTargetForcedOrder=[];this.morphTargetInfluences=[];this.morphTargetDictionary={};for(var c=0;c<this.geometry.morphTargets.length;c++)this.morphTargetInfluences.push(0),
 this.morphTargetDictionary[this.geometry.morphTargets[c].name]=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(void 0!==this.morphTargetDictionary[a])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};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){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 c,d=this.children.length;for(c=0;c<d;c++)this.children[c].update(this.skinMatrix,b)};
-THREE.Sprite=function(a){THREE.Object3D.call(this);this.color=void 0!==a.color?new THREE.Color(a.color):new THREE.Color(16777215);this.map=void 0!==a.map?a.map:new THREE.Texture;this.blending=void 0!==a.blending?a.blending:THREE.NormalBlending;this.useScreenCoordinates=void 0!==a.useScreenCoordinates?a.useScreenCoordinates:!0;this.mergeWith3D=void 0!==a.mergeWith3D?a.mergeWith3D:!this.useScreenCoordinates;this.affectedByDistance=void 0!==a.affectedByDistance?a.affectedByDistance:!this.useScreenCoordinates;
-this.scaleByViewport=void 0!==a.scaleByViewport?a.scaleByViewport:!this.affectedByDistance;this.alignment=a.alignment instanceof THREE.Vector2?a.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.updateMatrix=function(){this.matrix.setPosition(this.position);this.rotation3d.set(0,0,this.rotation);this.matrix.setRotationFromEuler(this.rotation3d);if(1!==this.scale.x||1!==this.scale.y)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.overrideMaterial=this.fog=null;this.matrixAutoUpdate=!1;this.__objects=[];this.__lights=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;
+THREE.Sprite=function(a){THREE.Object3D.call(this);this.color=void 0!==a.color?new THREE.Color(a.color):new THREE.Color(16777215);this.map=void 0!==a.map?a.map:new THREE.Texture;this.blending=void 0!==a.blending?a.blending:THREE.NormalBlending;this.blendSrc=void 0!==a.blendSrc?a.blendSrc:THREE.SrcAlphaFactor;this.blendDst=void 0!==a.blendDst?a.blendDst:THREE.OneMinusSrcAlphaFactor;this.blendEquation=void 0!==a.blendEquation?a.blendEquation:THREE.AddEquation;this.useScreenCoordinates=void 0!==a.useScreenCoordinates?
+a.useScreenCoordinates:!0;this.mergeWith3D=void 0!==a.mergeWith3D?a.mergeWith3D:!this.useScreenCoordinates;this.affectedByDistance=void 0!==a.affectedByDistance?a.affectedByDistance:!this.useScreenCoordinates;this.scaleByViewport=void 0!==a.scaleByViewport?a.scaleByViewport:!this.affectedByDistance;this.alignment=a.alignment instanceof THREE.Vector2?a.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.updateMatrix=function(){this.matrix.setPosition(this.position);this.rotation3d.set(0,0,this.rotation);this.matrix.setRotationFromEuler(this.rotation3d);if(1!==this.scale.x||1!==this.scale.y)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.overrideMaterial=this.fog=null;this.matrixAutoUpdate=!1;this.__objects=[];this.__lights=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;
 THREE.Scene.prototype.__addObject=function(a){if(a instanceof THREE.Light)-1===this.__lights.indexOf(a)&&this.__lights.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&-1===this.__objects.indexOf(a)){this.__objects.push(a);this.__objectsAdded.push(a);var b=this.__objectsRemoved.indexOf(a);-1!==b&&this.__objectsRemoved.splice(b,1)}for(b=0;b<a.children.length;b++)this.__addObject(a.children[b])};
 THREE.Scene.prototype.__removeObject=function(a){if(a instanceof THREE.Light){var b=this.__lights.indexOf(a);-1!==b&&this.__lights.splice(b,1)}else a instanceof THREE.Camera||(b=this.__objects.indexOf(a),-1!==b&&(this.__objects.splice(b,1),this.__objectsRemoved.push(a),b=this.__objectsAdded.indexOf(a),-1!==b&&this.__objectsAdded.splice(b,1)));for(b=0;b<a.children.length;b++)this.__removeObject(a.children[b])};
-THREE.CanvasRenderer=function(a){function b(a){if(C!=a)k.globalAlpha=C=a}function c(a){if(L!=a){switch(a){case THREE.NormalBlending:k.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:k.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:k.globalCompositeOperation="darker"}L=a}}function d(a){if(G!=a)k.strokeStyle=G=a}function e(a){if(t!=a)k.fillStyle=t=a}var a=a||{},f=this,g,h,l,i=new THREE.Projector,j=void 0!==a.canvas?a.canvas:document.createElement("canvas"),
-n,m,o,p,k=j.getContext("2d"),u=new THREE.Color(0),H=0,C=1,L=0,G=null,t=null,E=null,z=null,F=null,r,v,y,K,$=new THREE.RenderableVertex,da=new THREE.RenderableVertex,O,I,T,Q,U,D,J,R,A,P,N,V,s=new THREE.Color,x=new THREE.Color,w=new THREE.Color,B=new THREE.Color,M=new THREE.Color,la=[],fa=[],ga,ha,ea,aa,Ba,Ca,Da,Ea,Fa,Ga,ma=new THREE.Rectangle,Z=new THREE.Rectangle,Y=new THREE.Rectangle,ya=!1,X=new THREE.Color,na=new THREE.Color,oa=new THREE.Color,S=new THREE.Vector3,sa,ta,za,ba,ua,va,a=16;sa=document.createElement("canvas");
-sa.width=sa.height=2;ta=sa.getContext("2d");ta.fillStyle="rgba(0,0,0,1)";ta.fillRect(0,0,2,2);za=ta.getImageData(0,0,2,2);ba=za.data;ua=document.createElement("canvas");ua.width=ua.height=a;va=ua.getContext("2d");va.translate(-a/2,-a/2);va.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){n=a;m=b;o=Math.floor(n/2);p=Math.floor(m/2);j.width=n;j.height=m;ma.set(-o,-p,o,p);Z.set(-o,-p,o,p);C=1;L=0;
-F=z=E=t=G=null};this.setClearColor=function(a,b){u.copy(a);H=b;Z.set(-o,-p,o,p)};this.setClearColorHex=function(a,b){u.setHex(a);H=b;Z.set(-o,-p,o,p)};this.clear=function(){k.setTransform(1,0,0,-1,o,p);Z.isEmpty()||(Z.minSelf(ma),Z.inflate(2),1>H&&k.clearRect(Math.floor(Z.getX()),Math.floor(Z.getY()),Math.floor(Z.getWidth()),Math.floor(Z.getHeight())),0<H&&(c(THREE.NormalBlending),b(1),e("rgba("+Math.floor(255*u.r)+","+Math.floor(255*u.g)+","+Math.floor(255*u.b)+","+H+")"),k.fillRect(Math.floor(Z.getX()),
-Math.floor(Z.getY()),Math.floor(Z.getWidth()),Math.floor(Z.getHeight()))),Z.empty())};this.render=function(a,j){function n(a){var b,c,d,e;X.setRGB(0,0,0);na.setRGB(0,0,0);oa.setRGB(0,0,0);for(b=0,c=a.length;b<c;b++)d=a[b],e=d.color,d instanceof THREE.AmbientLight?(X.r+=e.r,X.g+=e.g,X.b+=e.b):d instanceof THREE.DirectionalLight?(na.r+=e.r,na.g+=e.g,na.b+=e.b):d instanceof THREE.PointLight&&(oa.r+=e.r,oa.g+=e.g,oa.b+=e.b)}function m(a,b,c,d){var e,f,g,h,i,j;for(e=0,f=a.length;e<f;e++)g=a[e],h=g.color,
-g instanceof THREE.DirectionalLight?(i=g.matrixWorld.getPosition(),j=c.dot(i),0>=j||(j*=g.intensity,d.r+=h.r*j,d.g+=h.g*j,d.b+=h.b*j)):g instanceof THREE.PointLight&&(i=g.matrixWorld.getPosition(),j=c.dot(S.sub(i,b).normalize()),0>=j||(j*=0==g.distance?1:1-Math.min(b.distanceTo(i)/g.distance,1),0!=j&&(j*=g.intensity,d.r+=h.r*j,d.g+=h.g*j,d.b+=h.b*j)))}function t(a,f,g){b(g.opacity);c(g.blending);var h,j,i,l,q,n;if(g instanceof THREE.ParticleBasicMaterial){if(g.map)l=g.map.image,q=l.width>>1,n=l.height>>
-1,g=f.scale.x*o,i=f.scale.y*p,h=g*q,j=i*n,Y.set(a.x-h,a.y-j,a.x+h,a.y+j),ma.intersects(Y)&&(k.save(),k.translate(a.x,a.y),k.rotate(-f.rotation),k.scale(g,-i),k.translate(-q,-n),k.drawImage(l,0,0),k.restore())}else g instanceof THREE.ParticleCanvasMaterial&&(h=f.scale.x*o,j=f.scale.y*p,Y.set(a.x-h,a.y-j,a.x+h,a.y+j),ma.intersects(Y)&&(d(g.color.getContextStyle()),e(g.color.getContextStyle()),k.save(),k.translate(a.x,a.y),k.rotate(-f.rotation),k.scale(h,j),g.program(k),k.restore()))}function u(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(E!=a)k.lineWidth=E=a;a=g.linecap;if(z!=a)k.lineCap=z=a;a=g.linejoin;if(F!=a)k.lineJoin=F=a;d(g.color.getContextStyle());k.stroke();Y.inflate(2*g.linewidth)}}function C(a,d,e,g,h,i,k,q){f.info.render.vertices+=3;f.info.render.faces++;b(q.opacity);c(q.blending);O=a.positionScreen.x;I=a.positionScreen.y;
-T=d.positionScreen.x;Q=d.positionScreen.y;U=e.positionScreen.x;D=e.positionScreen.y;G(O,I,T,Q,U,D);if(q instanceof THREE.MeshBasicMaterial)if(q.map)q.map.mapping instanceof THREE.UVMapping&&(aa=k.uvs[0],Aa(O,I,T,Q,U,D,aa[g].u,aa[g].v,aa[h].u,aa[h].v,aa[i].u,aa[i].v,q.map));else if(q.envMap){if(q.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=j.matrixWorldInverse,S.copy(k.vertexNormalsWorld[g]),Ba=0.5*(S.x*a.n11+S.y*a.n12+S.z*a.n13)+0.5,Ca=0.5*-(S.x*a.n21+S.y*a.n22+S.z*a.n23)+0.5,S.copy(k.vertexNormalsWorld[h]),
-Da=0.5*(S.x*a.n11+S.y*a.n12+S.z*a.n13)+0.5,Ea=0.5*-(S.x*a.n21+S.y*a.n22+S.z*a.n23)+0.5,S.copy(k.vertexNormalsWorld[i]),Fa=0.5*(S.x*a.n11+S.y*a.n12+S.z*a.n13)+0.5,Ga=0.5*-(S.x*a.n21+S.y*a.n22+S.z*a.n23)+0.5,Aa(O,I,T,Q,U,D,Ba,Ca,Da,Ea,Fa,Ga,q.envMap)}else q.wireframe?ja(q.color,q.wireframeLinewidth,q.wireframeLinecap,q.wireframeLinejoin):ia(q.color);else if(q instanceof THREE.MeshLambertMaterial)q.map&&!q.wireframe&&(q.map.mapping instanceof THREE.UVMapping&&(aa=k.uvs[0],Aa(O,I,T,Q,U,D,aa[g].u,aa[g].v,
-aa[h].u,aa[h].v,aa[i].u,aa[i].v,q.map)),c(THREE.SubtractiveBlending)),ya?!q.wireframe&&q.shading==THREE.SmoothShading&&3==k.vertexNormalsWorld.length?(x.r=w.r=B.r=X.r,x.g=w.g=B.g=X.g,x.b=w.b=B.b=X.b,m(l,k.v1.positionWorld,k.vertexNormalsWorld[0],x),m(l,k.v2.positionWorld,k.vertexNormalsWorld[1],w),m(l,k.v3.positionWorld,k.vertexNormalsWorld[2],B),x.r=Math.max(0,Math.min(q.color.r*x.r,1)),x.g=Math.max(0,Math.min(q.color.g*x.g,1)),x.b=Math.max(0,Math.min(q.color.b*x.b,1)),w.r=Math.max(0,Math.min(q.color.r*
-w.r,1)),w.g=Math.max(0,Math.min(q.color.g*w.g,1)),w.b=Math.max(0,Math.min(q.color.b*w.b,1)),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)),M.r=0.5*(w.r+B.r),M.g=0.5*(w.g+B.g),M.b=0.5*(w.b+B.b),ea=wa(x,w,B,M),qa(O,I,T,Q,U,D,0,0,1,0,0,1,ea)):(s.r=X.r,s.g=X.g,s.b=X.b,m(l,k.centroidWorld,k.normalWorld,s),s.r=Math.max(0,Math.min(q.color.r*s.r,1)),s.g=Math.max(0,Math.min(q.color.g*s.g,1)),s.b=Math.max(0,Math.min(q.color.b*s.b,
-1)),q.wireframe?ja(s,q.wireframeLinewidth,q.wireframeLinecap,q.wireframeLinejoin):ia(s)):q.wireframe?ja(q.color,q.wireframeLinewidth,q.wireframeLinecap,q.wireframeLinejoin):ia(q.color);else if(q instanceof THREE.MeshDepthMaterial)ga=j.near,ha=j.far,x.r=x.g=x.b=1-pa(a.positionScreen.z,ga,ha),w.r=w.g=w.b=1-pa(d.positionScreen.z,ga,ha),B.r=B.g=B.b=1-pa(e.positionScreen.z,ga,ha),M.r=0.5*(w.r+B.r),M.g=0.5*(w.g+B.g),M.b=0.5*(w.b+B.b),ea=wa(x,w,B,M),qa(O,I,T,Q,U,D,0,0,1,0,0,1,ea);else if(q instanceof THREE.MeshNormalMaterial)s.r=
-ra(k.normalWorld.x),s.g=ra(k.normalWorld.y),s.b=ra(k.normalWorld.z),q.wireframe?ja(s,q.wireframeLinewidth,q.wireframeLinecap,q.wireframeLinejoin):ia(s)}function L(a,d,e,g,h,i,k,q,n){f.info.render.vertices+=4;f.info.render.faces++;b(q.opacity);c(q.blending);if(q.map||q.envMap)C(a,d,g,0,1,3,k,q,n),C(h,e,i,1,2,3,k,q,n);else if(O=a.positionScreen.x,I=a.positionScreen.y,T=d.positionScreen.x,Q=d.positionScreen.y,U=e.positionScreen.x,D=e.positionScreen.y,J=g.positionScreen.x,R=g.positionScreen.y,A=h.positionScreen.x,
-P=h.positionScreen.y,N=i.positionScreen.x,V=i.positionScreen.y,q instanceof THREE.MeshBasicMaterial)H(O,I,T,Q,U,D,J,R),q.wireframe?ja(q.color,q.wireframeLinewidth,q.wireframeLinecap,q.wireframeLinejoin):ia(q.color);else if(q instanceof THREE.MeshLambertMaterial)ya?!q.wireframe&&q.shading==THREE.SmoothShading&&4==k.vertexNormalsWorld.length?(x.r=w.r=B.r=M.r=X.r,x.g=w.g=B.g=M.g=X.g,x.b=w.b=B.b=M.b=X.b,m(l,k.v1.positionWorld,k.vertexNormalsWorld[0],x),m(l,k.v2.positionWorld,k.vertexNormalsWorld[1],w),
-m(l,k.v4.positionWorld,k.vertexNormalsWorld[3],B),m(l,k.v3.positionWorld,k.vertexNormalsWorld[2],M),x.r=Math.max(0,Math.min(q.color.r*x.r,1)),x.g=Math.max(0,Math.min(q.color.g*x.g,1)),x.b=Math.max(0,Math.min(q.color.b*x.b,1)),w.r=Math.max(0,Math.min(q.color.r*w.r,1)),w.g=Math.max(0,Math.min(q.color.g*w.g,1)),w.b=Math.max(0,Math.min(q.color.b*w.b,1)),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)),M.r=Math.max(0,Math.min(q.color.r*
-M.r,1)),M.g=Math.max(0,Math.min(q.color.g*M.g,1)),M.b=Math.max(0,Math.min(q.color.b*M.b,1)),ea=wa(x,w,B,M),G(O,I,T,Q,J,R),qa(O,I,T,Q,J,R,0,0,1,0,0,1,ea),G(A,P,U,D,N,V),qa(A,P,U,D,N,V,1,0,1,1,0,1,ea)):(s.r=X.r,s.g=X.g,s.b=X.b,m(l,k.centroidWorld,k.normalWorld,s),s.r=Math.max(0,Math.min(q.color.r*s.r,1)),s.g=Math.max(0,Math.min(q.color.g*s.g,1)),s.b=Math.max(0,Math.min(q.color.b*s.b,1)),H(O,I,T,Q,U,D,J,R),q.wireframe?ja(s,q.wireframeLinewidth,q.wireframeLinecap,q.wireframeLinejoin):ia(s)):(H(O,I,T,
-Q,U,D,J,R),q.wireframe?ja(q.color,q.wireframeLinewidth,q.wireframeLinecap,q.wireframeLinejoin):ia(q.color));else if(q instanceof THREE.MeshNormalMaterial)s.r=ra(k.normalWorld.x),s.g=ra(k.normalWorld.y),s.b=ra(k.normalWorld.z),H(O,I,T,Q,U,D,J,R),q.wireframe?ja(s,q.wireframeLinewidth,q.wireframeLinecap,q.wireframeLinejoin):ia(s);else if(q instanceof THREE.MeshDepthMaterial)ga=j.near,ha=j.far,x.r=x.g=x.b=1-pa(a.positionScreen.z,ga,ha),w.r=w.g=w.b=1-pa(d.positionScreen.z,ga,ha),B.r=B.g=B.b=1-pa(g.positionScreen.z,
-ga,ha),M.r=M.g=M.b=1-pa(e.positionScreen.z,ga,ha),ea=wa(x,w,B,M),G(O,I,T,Q,J,R),qa(O,I,T,Q,J,R,0,0,1,0,0,1,ea),G(A,P,U,D,N,V),qa(A,P,U,D,N,V,1,0,1,1,0,1,ea)}function G(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 H(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 ja(a,b,c,e){if(E!=b)k.lineWidth=E=b;if(z!=c)k.lineCap=z=c;if(F!=e)k.lineJoin=F=e;d(a.getContextStyle());
-k.stroke();Y.inflate(2*b)}function ia(a){e(a.getContextStyle());k.fill()}function Aa(a,b,c,d,f,g,h,i,j,l,n,o,m){if(0!=m.image.width){if(!0==m.needsUpdate||void 0==la[m.id]){var p=m.wrapS==THREE.RepeatWrapping,r=m.wrapT==THREE.RepeatWrapping;la[m.id]=k.createPattern(m.image,p&&r?"repeat":p&&!r?"repeat-x":!p&&r?"repeat-y":"no-repeat");m.needsUpdate=!1}e(la[m.id]);var p=m.offset.x/m.repeat.x,r=m.offset.y/m.repeat.y,t=m.image.width*m.repeat.x,u=m.image.height*m.repeat.y,h=(h+p)*t,i=(i+r)*u,c=c-a,d=d-
-b,f=f-a,g=g-b,j=(j+p)*t-h,l=(l+r)*u-i,n=(n+p)*t-h,o=(o+r)*u-i,p=j*o-n*l;if(0==p){if(void 0===fa[m.id])b=document.createElement("canvas"),b.width=m.image.width,b.height=m.image.height,b=b.getContext("2d"),b.drawImage(m.image,0,0),fa[m.id]=b.getImageData(0,0,m.image.width,m.image.height).data;b=fa[m.id];h=4*(Math.floor(h)+Math.floor(i)*m.image.width);s.setRGB(b[h]/255,b[h+1]/255,b[h+2]/255);ia(s)}else p=1/p,m=(o*c-l*f)*p,l=(o*d-l*g)*p,c=(j*f-n*c)*p,d=(j*g-n*d)*p,a=a-m*h-c*i,h=b-l*h-d*i,k.save(),k.transform(m,
-l,c,d,a,h),k.fill(),k.restore()}}function qa(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;c-=a;d-=b;e-=a;f-=b;i=i*o-g;j=j*p-h;l=l*o-g;m=m*p-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 wa(a,b,c,d){var e=~~(255*a.r),f=~~(255*a.g),a=~~(255*a.b),g=~~(255*b.r),h=~~(255*b.g),b=~~(255*b.b),i=~~(255*c.r),j=~~(255*c.g),c=~~(255*c.b),k=~~(255*d.r),l=
-~~(255*d.g),d=~~(255*d.b);ba[0]=0>e?0:255<e?255:e;ba[1]=0>f?0:255<f?255:f;ba[2]=0>a?0:255<a?255:a;ba[4]=0>g?0:255<g?255:g;ba[5]=0>h?0:255<h?255:h;ba[6]=0>b?0:255<b?255:b;ba[8]=0>i?0:255<i?255:i;ba[9]=0>j?0:255<j?255:j;ba[10]=0>c?0:255<c?255:c;ba[12]=0>k?0:255<k?255:k;ba[13]=0>l?0:255<l?255:l;ba[14]=0>d?0:255<d?255:d;ta.putImageData(za,0,0);va.drawImage(sa,0,0);return ua}function pa(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function ra(a){a=0.5*(a+1);return 0>a?0:1<a?1:a}function ka(a,b){var c=b.x-a.x,
-d=b.y-a.y,e=c*c+d*d;0!=e&&(e=1/Math.sqrt(e),c*=e,d*=e,b.x+=c,b.y+=d,a.x-=c,a.y-=d)}var xa,Ha,W,ca;this.autoClear?this.clear():k.setTransform(1,0,0,-1,o,p);f.info.render.vertices=0;f.info.render.faces=0;g=i.projectScene(a,j,this.sortElements);h=g.elements;l=g.lights;(ya=0<l.length)&&n(l);for(xa=0,Ha=h.length;xa<Ha;xa++)if(W=h[xa],ca=W.material,ca=ca instanceof THREE.MeshFaceMaterial?W.faceMaterial:ca,!(null==ca||0==ca.opacity)){Y.empty();if(W instanceof THREE.RenderableParticle)r=W,r.x*=o,r.y*=p,t(r,
-W,ca,a);else if(W instanceof THREE.RenderableLine)r=W.v1,v=W.v2,r.positionScreen.x*=o,r.positionScreen.y*=p,v.positionScreen.x*=o,v.positionScreen.y*=p,Y.addPoint(r.positionScreen.x,r.positionScreen.y),Y.addPoint(v.positionScreen.x,v.positionScreen.y),ma.intersects(Y)&&u(r,v,W,ca,a);else if(W instanceof THREE.RenderableFace3)r=W.v1,v=W.v2,y=W.v3,r.positionScreen.x*=o,r.positionScreen.y*=p,v.positionScreen.x*=o,v.positionScreen.y*=p,y.positionScreen.x*=o,y.positionScreen.y*=p,ca.overdraw&&(ka(r.positionScreen,
-v.positionScreen),ka(v.positionScreen,y.positionScreen),ka(y.positionScreen,r.positionScreen)),Y.add3Points(r.positionScreen.x,r.positionScreen.y,v.positionScreen.x,v.positionScreen.y,y.positionScreen.x,y.positionScreen.y),ma.intersects(Y)&&C(r,v,y,0,1,2,W,ca,a);else if(W instanceof THREE.RenderableFace4)r=W.v1,v=W.v2,y=W.v3,K=W.v4,r.positionScreen.x*=o,r.positionScreen.y*=p,v.positionScreen.x*=o,v.positionScreen.y*=p,y.positionScreen.x*=o,y.positionScreen.y*=p,K.positionScreen.x*=o,K.positionScreen.y*=
-p,$.positionScreen.copy(v.positionScreen),da.positionScreen.copy(K.positionScreen),ca.overdraw&&(ka(r.positionScreen,v.positionScreen),ka(v.positionScreen,K.positionScreen),ka(K.positionScreen,r.positionScreen),ka(y.positionScreen,$.positionScreen),ka(y.positionScreen,da.positionScreen)),Y.addPoint(r.positionScreen.x,r.positionScreen.y),Y.addPoint(v.positionScreen.x,v.positionScreen.y),Y.addPoint(y.positionScreen.x,y.positionScreen.y),Y.addPoint(K.positionScreen.x,K.positionScreen.y),ma.intersects(Y)&&
-L(r,v,y,K,$,da,W,ca,a);Z.addRectangle(Y)}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.CanvasRenderer=function(a){function b(a){if(C!=a)k.globalAlpha=C=a}function c(a){if(L!=a){switch(a){case THREE.NormalBlending:k.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:k.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:k.globalCompositeOperation="darker"}L=a}}function d(a){if(G!=a)k.strokeStyle=G=a}function e(a){if(t!=a)k.fillStyle=t=a}var a=a||{},f=this,g,i,j,h=new THREE.Projector,l=void 0!==a.canvas?a.canvas:document.createElement("canvas"),
+o,m,n,p,k=l.getContext("2d"),u=new THREE.Color(0),H=0,C=1,L=0,G=null,t=null,E=null,z=null,F=null,r,v,y,K,$=new THREE.RenderableVertex,da=new THREE.RenderableVertex,O,I,T,Q,U,D,J,R,A,P,N,V,s=new THREE.Color,x=new THREE.Color,w=new THREE.Color,B=new THREE.Color,M=new THREE.Color,la=[],fa=[],ga,ha,ea,aa,Ba,Ca,Da,Ea,Fa,Ga,ma=new THREE.Rectangle,Z=new THREE.Rectangle,Y=new THREE.Rectangle,ya=!1,X=new THREE.Color,na=new THREE.Color,oa=new THREE.Color,S=new THREE.Vector3,sa,ta,za,ba,ua,va,a=16;sa=document.createElement("canvas");
+sa.width=sa.height=2;ta=sa.getContext("2d");ta.fillStyle="rgba(0,0,0,1)";ta.fillRect(0,0,2,2);za=ta.getImageData(0,0,2,2);ba=za.data;ua=document.createElement("canvas");ua.width=ua.height=a;va=ua.getContext("2d");va.translate(-a/2,-a/2);va.scale(a,a);a--;this.domElement=l;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setSize=function(a,b){o=a;m=b;n=Math.floor(o/2);p=Math.floor(m/2);l.width=o;l.height=m;ma.set(-n,-p,n,p);Z.set(-n,-p,n,p);C=1;L=0;
+F=z=E=t=G=null};this.setClearColor=function(a,b){u.copy(a);H=void 0!==b?b:1;Z.set(-n,-p,n,p)};this.setClearColorHex=function(a,b){u.setHex(a);H=void 0!==b?b:1;Z.set(-n,-p,n,p)};this.clear=function(){k.setTransform(1,0,0,-1,n,p);Z.isEmpty()||(Z.minSelf(ma),Z.inflate(2),1>H&&k.clearRect(Math.floor(Z.getX()),Math.floor(Z.getY()),Math.floor(Z.getWidth()),Math.floor(Z.getHeight())),0<H&&(c(THREE.NormalBlending),b(1),e("rgba("+Math.floor(255*u.r)+","+Math.floor(255*u.g)+","+Math.floor(255*u.b)+","+H+")"),
+k.fillRect(Math.floor(Z.getX()),Math.floor(Z.getY()),Math.floor(Z.getWidth()),Math.floor(Z.getHeight()))),Z.empty())};this.render=function(a,l){function o(a){var b,c,d,e;X.setRGB(0,0,0);na.setRGB(0,0,0);oa.setRGB(0,0,0);for(b=0,c=a.length;b<c;b++)d=a[b],e=d.color,d instanceof THREE.AmbientLight?(X.r+=e.r,X.g+=e.g,X.b+=e.b):d instanceof THREE.DirectionalLight?(na.r+=e.r,na.g+=e.g,na.b+=e.b):d instanceof THREE.PointLight&&(oa.r+=e.r,oa.g+=e.g,oa.b+=e.b)}function m(a,b,c,d){var e,f,g,h,i,j;for(e=0,f=
+a.length;e<f;e++)g=a[e],h=g.color,g instanceof THREE.DirectionalLight?(i=g.matrixWorld.getPosition(),j=c.dot(i),0>=j||(j*=g.intensity,d.r+=h.r*j,d.g+=h.g*j,d.b+=h.b*j)):g instanceof THREE.PointLight&&(i=g.matrixWorld.getPosition(),j=c.dot(S.sub(i,b).normalize()),0>=j||(j*=0==g.distance?1:1-Math.min(b.distanceTo(i)/g.distance,1),0!=j&&(j*=g.intensity,d.r+=h.r*j,d.g+=h.g*j,d.b+=h.b*j)))}function t(a,f,g){b(g.opacity);c(g.blending);var h,i,j,l,q,o;if(g instanceof THREE.ParticleBasicMaterial){if(g.map)l=
+g.map.image,q=l.width>>1,o=l.height>>1,g=f.scale.x*n,j=f.scale.y*p,h=g*q,i=j*o,Y.set(a.x-h,a.y-i,a.x+h,a.y+i),ma.intersects(Y)&&(k.save(),k.translate(a.x,a.y),k.rotate(-f.rotation),k.scale(g,-j),k.translate(-q,-o),k.drawImage(l,0,0),k.restore())}else g instanceof THREE.ParticleCanvasMaterial&&(h=f.scale.x*n,i=f.scale.y*p,Y.set(a.x-h,a.y-i,a.x+h,a.y+i),ma.intersects(Y)&&(d(g.color.getContextStyle()),e(g.color.getContextStyle()),k.save(),k.translate(a.x,a.y),k.rotate(-f.rotation),k.scale(h,i),g.program(k),
+k.restore()))}function u(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(E!=a)k.lineWidth=E=a;a=g.linecap;if(z!=a)k.lineCap=z=a;a=g.linejoin;if(F!=a)k.lineJoin=F=a;d(g.color.getContextStyle());k.stroke();Y.inflate(2*g.linewidth)}}function C(a,d,e,g,h,i,k,q){f.info.render.vertices+=3;f.info.render.faces++;b(q.opacity);c(q.blending);
+O=a.positionScreen.x;I=a.positionScreen.y;T=d.positionScreen.x;Q=d.positionScreen.y;U=e.positionScreen.x;D=e.positionScreen.y;G(O,I,T,Q,U,D);if(q instanceof THREE.MeshBasicMaterial)if(q.map)q.map.mapping instanceof THREE.UVMapping&&(aa=k.uvs[0],Aa(O,I,T,Q,U,D,aa[g].u,aa[g].v,aa[h].u,aa[h].v,aa[i].u,aa[i].v,q.map));else if(q.envMap){if(q.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=l.matrixWorldInverse,S.copy(k.vertexNormalsWorld[g]),Ba=0.5*(S.x*a.n11+S.y*a.n12+S.z*a.n13)+0.5,Ca=0.5*
+-(S.x*a.n21+S.y*a.n22+S.z*a.n23)+0.5,S.copy(k.vertexNormalsWorld[h]),Da=0.5*(S.x*a.n11+S.y*a.n12+S.z*a.n13)+0.5,Ea=0.5*-(S.x*a.n21+S.y*a.n22+S.z*a.n23)+0.5,S.copy(k.vertexNormalsWorld[i]),Fa=0.5*(S.x*a.n11+S.y*a.n12+S.z*a.n13)+0.5,Ga=0.5*-(S.x*a.n21+S.y*a.n22+S.z*a.n23)+0.5,Aa(O,I,T,Q,U,D,Ba,Ca,Da,Ea,Fa,Ga,q.envMap)}else q.wireframe?ja(q.color,q.wireframeLinewidth,q.wireframeLinecap,q.wireframeLinejoin):ia(q.color);else if(q instanceof THREE.MeshLambertMaterial)q.map&&!q.wireframe&&(q.map.mapping instanceof
+THREE.UVMapping&&(aa=k.uvs[0],Aa(O,I,T,Q,U,D,aa[g].u,aa[g].v,aa[h].u,aa[h].v,aa[i].u,aa[i].v,q.map)),c(THREE.SubtractiveBlending)),ya?!q.wireframe&&q.shading==THREE.SmoothShading&&3==k.vertexNormalsWorld.length?(x.r=w.r=B.r=X.r,x.g=w.g=B.g=X.g,x.b=w.b=B.b=X.b,m(j,k.v1.positionWorld,k.vertexNormalsWorld[0],x),m(j,k.v2.positionWorld,k.vertexNormalsWorld[1],w),m(j,k.v3.positionWorld,k.vertexNormalsWorld[2],B),x.r=Math.max(0,Math.min(q.color.r*x.r,1)),x.g=Math.max(0,Math.min(q.color.g*x.g,1)),x.b=Math.max(0,
+Math.min(q.color.b*x.b,1)),w.r=Math.max(0,Math.min(q.color.r*w.r,1)),w.g=Math.max(0,Math.min(q.color.g*w.g,1)),w.b=Math.max(0,Math.min(q.color.b*w.b,1)),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)),M.r=0.5*(w.r+B.r),M.g=0.5*(w.g+B.g),M.b=0.5*(w.b+B.b),ea=wa(x,w,B,M),qa(O,I,T,Q,U,D,0,0,1,0,0,1,ea)):(s.r=X.r,s.g=X.g,s.b=X.b,m(j,k.centroidWorld,k.normalWorld,s),s.r=Math.max(0,Math.min(q.color.r*s.r,1)),s.g=Math.max(0,Math.min(q.color.g*
+s.g,1)),s.b=Math.max(0,Math.min(q.color.b*s.b,1)),q.wireframe?ja(s,q.wireframeLinewidth,q.wireframeLinecap,q.wireframeLinejoin):ia(s)):q.wireframe?ja(q.color,q.wireframeLinewidth,q.wireframeLinecap,q.wireframeLinejoin):ia(q.color);else if(q instanceof THREE.MeshDepthMaterial)ga=l.near,ha=l.far,x.r=x.g=x.b=1-pa(a.positionScreen.z,ga,ha),w.r=w.g=w.b=1-pa(d.positionScreen.z,ga,ha),B.r=B.g=B.b=1-pa(e.positionScreen.z,ga,ha),M.r=0.5*(w.r+B.r),M.g=0.5*(w.g+B.g),M.b=0.5*(w.b+B.b),ea=wa(x,w,B,M),qa(O,I,T,
+Q,U,D,0,0,1,0,0,1,ea);else if(q instanceof THREE.MeshNormalMaterial)s.r=ra(k.normalWorld.x),s.g=ra(k.normalWorld.y),s.b=ra(k.normalWorld.z),q.wireframe?ja(s,q.wireframeLinewidth,q.wireframeLinecap,q.wireframeLinejoin):ia(s)}function L(a,d,e,g,h,i,k,q,o){f.info.render.vertices+=4;f.info.render.faces++;b(q.opacity);c(q.blending);if(q.map||q.envMap)C(a,d,g,0,1,3,k,q,o),C(h,e,i,1,2,3,k,q,o);else if(O=a.positionScreen.x,I=a.positionScreen.y,T=d.positionScreen.x,Q=d.positionScreen.y,U=e.positionScreen.x,
+D=e.positionScreen.y,J=g.positionScreen.x,R=g.positionScreen.y,A=h.positionScreen.x,P=h.positionScreen.y,N=i.positionScreen.x,V=i.positionScreen.y,q instanceof THREE.MeshBasicMaterial)H(O,I,T,Q,U,D,J,R),q.wireframe?ja(q.color,q.wireframeLinewidth,q.wireframeLinecap,q.wireframeLinejoin):ia(q.color);else if(q instanceof THREE.MeshLambertMaterial)ya?!q.wireframe&&q.shading==THREE.SmoothShading&&4==k.vertexNormalsWorld.length?(x.r=w.r=B.r=M.r=X.r,x.g=w.g=B.g=M.g=X.g,x.b=w.b=B.b=M.b=X.b,m(j,k.v1.positionWorld,
+k.vertexNormalsWorld[0],x),m(j,k.v2.positionWorld,k.vertexNormalsWorld[1],w),m(j,k.v4.positionWorld,k.vertexNormalsWorld[3],B),m(j,k.v3.positionWorld,k.vertexNormalsWorld[2],M),x.r=Math.max(0,Math.min(q.color.r*x.r,1)),x.g=Math.max(0,Math.min(q.color.g*x.g,1)),x.b=Math.max(0,Math.min(q.color.b*x.b,1)),w.r=Math.max(0,Math.min(q.color.r*w.r,1)),w.g=Math.max(0,Math.min(q.color.g*w.g,1)),w.b=Math.max(0,Math.min(q.color.b*w.b,1)),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)),M.r=Math.max(0,Math.min(q.color.r*M.r,1)),M.g=Math.max(0,Math.min(q.color.g*M.g,1)),M.b=Math.max(0,Math.min(q.color.b*M.b,1)),ea=wa(x,w,B,M),G(O,I,T,Q,J,R),qa(O,I,T,Q,J,R,0,0,1,0,0,1,ea),G(A,P,U,D,N,V),qa(A,P,U,D,N,V,1,0,1,1,0,1,ea)):(s.r=X.r,s.g=X.g,s.b=X.b,m(j,k.centroidWorld,k.normalWorld,s),s.r=Math.max(0,Math.min(q.color.r*s.r,1)),s.g=Math.max(0,Math.min(q.color.g*s.g,1)),s.b=Math.max(0,Math.min(q.color.b*s.b,1)),H(O,I,T,Q,U,D,J,R),q.wireframe?
+ja(s,q.wireframeLinewidth,q.wireframeLinecap,q.wireframeLinejoin):ia(s)):(H(O,I,T,Q,U,D,J,R),q.wireframe?ja(q.color,q.wireframeLinewidth,q.wireframeLinecap,q.wireframeLinejoin):ia(q.color));else if(q instanceof THREE.MeshNormalMaterial)s.r=ra(k.normalWorld.x),s.g=ra(k.normalWorld.y),s.b=ra(k.normalWorld.z),H(O,I,T,Q,U,D,J,R),q.wireframe?ja(s,q.wireframeLinewidth,q.wireframeLinecap,q.wireframeLinejoin):ia(s);else if(q instanceof THREE.MeshDepthMaterial)ga=l.near,ha=l.far,x.r=x.g=x.b=1-pa(a.positionScreen.z,
+ga,ha),w.r=w.g=w.b=1-pa(d.positionScreen.z,ga,ha),B.r=B.g=B.b=1-pa(g.positionScreen.z,ga,ha),M.r=M.g=M.b=1-pa(e.positionScreen.z,ga,ha),ea=wa(x,w,B,M),G(O,I,T,Q,J,R),qa(O,I,T,Q,J,R,0,0,1,0,0,1,ea),G(A,P,U,D,N,V),qa(A,P,U,D,N,V,1,0,1,1,0,1,ea)}function G(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 H(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 ja(a,b,c,e){if(E!=
+b)k.lineWidth=E=b;if(z!=c)k.lineCap=z=c;if(F!=e)k.lineJoin=F=e;d(a.getContextStyle());k.stroke();Y.inflate(2*b)}function ia(a){e(a.getContextStyle());k.fill()}function Aa(a,b,c,d,f,g,h,i,j,l,o,n,m){if(0!=m.image.width){if(!0==m.needsUpdate||void 0==la[m.id]){var p=m.wrapS==THREE.RepeatWrapping,r=m.wrapT==THREE.RepeatWrapping;la[m.id]=k.createPattern(m.image,p&&r?"repeat":p&&!r?"repeat-x":!p&&r?"repeat-y":"no-repeat");m.needsUpdate=!1}e(la[m.id]);var p=m.offset.x/m.repeat.x,r=m.offset.y/m.repeat.y,
+t=m.image.width*m.repeat.x,u=m.image.height*m.repeat.y,h=(h+p)*t,i=(i+r)*u,c=c-a,d=d-b,f=f-a,g=g-b,j=(j+p)*t-h,l=(l+r)*u-i,o=(o+p)*t-h,n=(n+r)*u-i,p=j*n-o*l;if(0==p){if(void 0===fa[m.id])b=document.createElement("canvas"),b.width=m.image.width,b.height=m.image.height,b=b.getContext("2d"),b.drawImage(m.image,0,0),fa[m.id]=b.getImageData(0,0,m.image.width,m.image.height).data;b=fa[m.id];h=4*(Math.floor(h)+Math.floor(i)*m.image.width);s.setRGB(b[h]/255,b[h+1]/255,b[h+2]/255);ia(s)}else p=1/p,m=(n*c-
+l*f)*p,l=(n*d-l*g)*p,c=(j*f-o*c)*p,d=(j*g-o*d)*p,a=a-m*h-c*i,h=b-l*h-d*i,k.save(),k.transform(m,l,c,d,a,h),k.fill(),k.restore()}}function qa(a,b,c,d,e,f,g,h,i,j,l,m,o){var n,p;n=o.width-1;p=o.height-1;g*=n;h*=p;c-=a;d-=b;e-=a;f-=b;i=i*n-g;j=j*p-h;l=l*n-g;m=m*p-h;p=1/(i*m-l*j);n=(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-n*g-c*h;b=b-j*g-d*h;k.save();k.transform(n,j,c,d,a,b);k.clip();k.drawImage(o,0,0);k.restore()}function wa(a,b,c,d){var e=~~(255*a.r),f=~~(255*a.g),a=~~(255*a.b),g=~~(255*
+b.r),h=~~(255*b.g),b=~~(255*b.b),i=~~(255*c.r),j=~~(255*c.g),c=~~(255*c.b),k=~~(255*d.r),l=~~(255*d.g),d=~~(255*d.b);ba[0]=0>e?0:255<e?255:e;ba[1]=0>f?0:255<f?255:f;ba[2]=0>a?0:255<a?255:a;ba[4]=0>g?0:255<g?255:g;ba[5]=0>h?0:255<h?255:h;ba[6]=0>b?0:255<b?255:b;ba[8]=0>i?0:255<i?255:i;ba[9]=0>j?0:255<j?255:j;ba[10]=0>c?0:255<c?255:c;ba[12]=0>k?0:255<k?255:k;ba[13]=0>l?0:255<l?255:l;ba[14]=0>d?0:255<d?255:d;ta.putImageData(za,0,0);va.drawImage(sa,0,0);return ua}function pa(a,b,c){a=(a-b)/(c-b);return a*
+a*(3-2*a)}function ra(a){a=0.5*(a+1);return 0>a?0:1<a?1:a}function ka(a,b){var c=b.x-a.x,d=b.y-a.y,e=c*c+d*d;0!=e&&(e=1/Math.sqrt(e),c*=e,d*=e,b.x+=c,b.y+=d,a.x-=c,a.y-=d)}var xa,Ha,W,ca;this.autoClear?this.clear():k.setTransform(1,0,0,-1,n,p);f.info.render.vertices=0;f.info.render.faces=0;g=h.projectScene(a,l,this.sortElements);i=g.elements;j=g.lights;(ya=0<j.length)&&o(j);for(xa=0,Ha=i.length;xa<Ha;xa++)if(W=i[xa],ca=W.material,ca=ca instanceof THREE.MeshFaceMaterial?W.faceMaterial:ca,!(null==ca||
+0==ca.opacity)){Y.empty();if(W instanceof THREE.RenderableParticle)r=W,r.x*=n,r.y*=p,t(r,W,ca,a);else if(W instanceof THREE.RenderableLine)r=W.v1,v=W.v2,r.positionScreen.x*=n,r.positionScreen.y*=p,v.positionScreen.x*=n,v.positionScreen.y*=p,Y.addPoint(r.positionScreen.x,r.positionScreen.y),Y.addPoint(v.positionScreen.x,v.positionScreen.y),ma.intersects(Y)&&u(r,v,W,ca,a);else if(W instanceof THREE.RenderableFace3)r=W.v1,v=W.v2,y=W.v3,r.positionScreen.x*=n,r.positionScreen.y*=p,v.positionScreen.x*=
+n,v.positionScreen.y*=p,y.positionScreen.x*=n,y.positionScreen.y*=p,ca.overdraw&&(ka(r.positionScreen,v.positionScreen),ka(v.positionScreen,y.positionScreen),ka(y.positionScreen,r.positionScreen)),Y.add3Points(r.positionScreen.x,r.positionScreen.y,v.positionScreen.x,v.positionScreen.y,y.positionScreen.x,y.positionScreen.y),ma.intersects(Y)&&C(r,v,y,0,1,2,W,ca,a);else if(W instanceof THREE.RenderableFace4)r=W.v1,v=W.v2,y=W.v3,K=W.v4,r.positionScreen.x*=n,r.positionScreen.y*=p,v.positionScreen.x*=n,
+v.positionScreen.y*=p,y.positionScreen.x*=n,y.positionScreen.y*=p,K.positionScreen.x*=n,K.positionScreen.y*=p,$.positionScreen.copy(v.positionScreen),da.positionScreen.copy(K.positionScreen),ca.overdraw&&(ka(r.positionScreen,v.positionScreen),ka(v.positionScreen,K.positionScreen),ka(K.positionScreen,r.positionScreen),ka(y.positionScreen,$.positionScreen),ka(y.positionScreen,da.positionScreen)),Y.addPoint(r.positionScreen.x,r.positionScreen.y),Y.addPoint(v.positionScreen.x,v.positionScreen.y),Y.addPoint(y.positionScreen.x,
+y.positionScreen.y),Y.addPoint(K.positionScreen.x,K.positionScreen.y),ma.intersects(Y)&&L(r,v,y,K,$,da,W,ca,a);Z.addRectangle(Y)}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.faceMaterial=this.material=null;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.faceMaterial=this.material=null;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.material=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.material=null};

+ 60 - 58
build/custom/ThreeDOM.js

@@ -13,49 +13,49 @@ THREE.Vector3.prototype={constructor:THREE.Vector3,set:function(a,b,c){this.x=a;
 sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;return this},multiply:function(a,b){this.x=a.x*b.x;this.y=a.y*b.y;this.z=a.z*b.z;return this},multiplySelf:function(a){this.x*=a.x;this.y*=a.y;this.z*=a.z;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;return this},divideSelf:function(a){this.x/=a.x;this.y/=a.y;this.z/=a.z;return this},divideScalar:function(a){a?(this.x/=a,this.y/=a,this.z/=a):
 this.z=this.y=this.x=0;return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.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 Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},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;return this},cross:function(a,b){this.x=a.y*b.z-a.z*b.y;this.y=a.z*b.x-a.x*b.z;this.z=a.x*b.y-a.y*b.x;return this},crossSelf:function(a){var b=this.x,c=this.y,d=this.z;this.x=c*a.z-d*a.y;this.y=d*a.x-b*a.z;this.z=b*a.y-c*a.x;return this},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){return(new THREE.Vector3).sub(this,a).lengthSq()},getPositionFromMatrix:function(a){this.x=a.n14;this.y=
-a.n24;this.z=a.n34;return this},getRotationFromMatrix:function(a,b){var c=b?b.x:1,d=b?b.y:1,e=b?b.z:1,f=a.n11/c,g=a.n12/d,c=a.n21/c,d=a.n22/d,h=a.n23/e,k=a.n33/e;this.y=Math.asin(a.n13/e);e=Math.cos(this.y);1.0E-5<Math.abs(e)?(this.x=Math.atan2(-h/e,k/e),this.z=Math.atan2(-g/e,f/e)):(this.x=0,this.z=Math.atan2(c,d));return this},getScaleFromMatrix:function(a){var b=this.set(a.n11,a.n21,a.n31).length(),c=this.set(a.n12,a.n22,a.n32).length(),a=this.set(a.n13,a.n23,a.n33).length();this.x=b;this.y=c;
+a.n24;this.z=a.n34;return this},getRotationFromMatrix:function(a,b){var c=b?b.x:1,d=b?b.y:1,e=b?b.z:1,f=a.n11/c,g=a.n12/d,c=a.n21/c,d=a.n22/d,i=a.n23/e,k=a.n33/e;this.y=Math.asin(a.n13/e);e=Math.cos(this.y);1.0E-5<Math.abs(e)?(this.x=Math.atan2(-i/e,k/e),this.z=Math.atan2(-g/e,f/e)):(this.x=0,this.z=Math.atan2(c,d));return this},getScaleFromMatrix:function(a){var b=this.set(a.n11,a.n21,a.n31).length(),c=this.set(a.n12,a.n22,a.n32).length(),a=this.set(a.n13,a.n23,a.n33).length();this.x=b;this.y=c;
 this.z=a},equals:function(a){return a.x===this.x&&a.y===this.y&&a.z===this.z},isZero:function(){return 1.0E-4>this.lengthSq()},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};THREE.Vector4=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=void 0!==d?d:1};
 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=void 0!==a.w?a.w:1;return this},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},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Frustum=function(){this.planes=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4]};
 THREE.Frustum.prototype.setFromMatrix=function(a){var b,c=this.planes;c[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);c[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);c[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+a.n23,a.n44+a.n24);c[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);c[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);c[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+a.n33,a.n44+a.n34);for(a=0;6>a;a++)b=c[a],b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))};
 THREE.Frustum.prototype.contains=function(a){for(var b=this.planes,c=a.matrixWorld,d=THREE.Frustum.__v1.set(c.getColumnX().length(),c.getColumnY().length(),c.getColumnZ().length()),d=-a.geometry.boundingSphere.radius*Math.max(d.x,Math.max(d.y,d.z)),e=0;6>e;e++)if(a=b[e].x*c.n14+b[e].y*c.n24+b[e].z*c.n34+b[e].w,a<=d)return!1;return!0};THREE.Frustum.__v1=new THREE.Vector3;
-THREE.Ray=function(a,b){function c(a,b,c){p.sub(c,a);G=p.dot(b);w=o.add(a,q.copy(b).multiplyScalar(G));return C=c.distanceTo(w)}function d(a,b,c,d){p.sub(d,b);o.sub(c,b);q.sub(a,b);D=p.dot(p);r=p.dot(o);x=p.dot(q);t=o.dot(o);y=o.dot(q);H=1/(D*t-r*r);K=(t*x-r*y)*H;E=(D*y-r*x)*H;return 0<=K&&0<=E&&1>K+E}this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3;var e=1.0E-4;this.setPrecision=function(a){e=a};var f=new THREE.Vector3,g=new THREE.Vector3,h=new THREE.Vector3,k=new THREE.Vector3,
-i=new THREE.Vector3,j=new THREE.Vector3,l=new THREE.Vector3,n=new THREE.Vector3,m=new THREE.Vector3;this.intersectObject=function(a){var b,o=[];if(a instanceof THREE.Particle){var p=c(this.origin,this.direction,a.matrixWorld.getPosition());if(p>a.scale.x)return[];b={distance:p,point:a.position,face:null,object:a};o.push(b)}else if(a instanceof THREE.Mesh){var p=c(this.origin,this.direction,a.matrixWorld.getPosition()),M=THREE.Frustum.__v1.set(a.matrixWorld.getColumnX().length(),a.matrixWorld.getColumnY().length(),
-a.matrixWorld.getColumnZ().length());if(p>a.geometry.boundingSphere.radius*Math.max(M.x,Math.max(M.y,M.z)))return o;var q,r,t=a.geometry,A=t.vertices,u;a.matrixRotationWorld.extractRotation(a.matrixWorld);for(p=0,M=t.faces.length;p<M;p++)if(b=t.faces[p],i.copy(this.origin),j.copy(this.direction),u=a.matrixWorld,l=u.multiplyVector3(l.copy(b.centroid)).subSelf(i),n=a.matrixRotationWorld.multiplyVector3(n.copy(b.normal)),q=j.dot(n),!(Math.abs(q)<e)&&(r=n.dot(l)/q,!(0>r)&&(a.doubleSided||(a.flipSided?
-0<q:0>q))))if(m.add(i,j.multiplyScalar(r)),b instanceof THREE.Face3)f=u.multiplyVector3(f.copy(A[b.a].position)),g=u.multiplyVector3(g.copy(A[b.b].position)),h=u.multiplyVector3(h.copy(A[b.c].position)),d(m,f,g,h)&&(b={distance:i.distanceTo(m),point:m.clone(),face:b,object:a},o.push(b));else if(b instanceof THREE.Face4&&(f=u.multiplyVector3(f.copy(A[b.a].position)),g=u.multiplyVector3(g.copy(A[b.b].position)),h=u.multiplyVector3(h.copy(A[b.c].position)),k=u.multiplyVector3(k.copy(A[b.d].position)),
-d(m,f,g,k)||d(m,g,h,k)))b={distance:i.distanceTo(m),point:m.clone(),face:b,object:a},o.push(b)}return o};this.intersectObjects=function(a){for(var b=[],c=0,d=a.length;c<d;c++)Array.prototype.push.apply(b,this.intersectObject(a[c]));b.sort(function(a,b){return a.distance-b.distance});return b};var p=new THREE.Vector3,o=new THREE.Vector3,q=new THREE.Vector3,G,w,C,D,r,x,t,y,H,K,E};
-THREE.Rectangle=function(){function a(){f=d-b;g=e-c}var b,c,d,e,f,g,h=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return f};this.getHeight=function(){return g};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return e};this.set=function(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>
-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 d<a.getLeft()||b>a.getRight()||e<a.getTop()||c>a.getBottom()?!1:!0};this.empty=function(){h=!0;e=d=c=b=0;a()};this.isEmpty=function(){return h}};
+THREE.Ray=function(a,b){function c(a,b,c){p.sub(c,a);G=p.dot(b);w=o.add(a,q.copy(b).multiplyScalar(G));return C=c.distanceTo(w)}function d(a,b,c,d){p.sub(d,b);o.sub(c,b);q.sub(a,b);D=p.dot(p);r=p.dot(o);x=p.dot(q);t=o.dot(o);y=o.dot(q);H=1/(D*t-r*r);K=(t*x-r*y)*H;E=(D*y-r*x)*H;return 0<=K&&0<=E&&1>K+E}this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3;var e=1.0E-4;this.setPrecision=function(a){e=a};var f=new THREE.Vector3,g=new THREE.Vector3,i=new THREE.Vector3,k=new THREE.Vector3,
+h=new THREE.Vector3,j=new THREE.Vector3,l=new THREE.Vector3,n=new THREE.Vector3,m=new THREE.Vector3;this.intersectObject=function(a){var b,o=[];if(a instanceof THREE.Particle){var p=c(this.origin,this.direction,a.matrixWorld.getPosition());if(p>a.scale.x)return[];b={distance:p,point:a.position,face:null,object:a};o.push(b)}else if(a instanceof THREE.Mesh){var p=c(this.origin,this.direction,a.matrixWorld.getPosition()),M=THREE.Frustum.__v1.set(a.matrixWorld.getColumnX().length(),a.matrixWorld.getColumnY().length(),
+a.matrixWorld.getColumnZ().length());if(p>a.geometry.boundingSphere.radius*Math.max(M.x,Math.max(M.y,M.z)))return o;var q,r,t=a.geometry,A=t.vertices,u;a.matrixRotationWorld.extractRotation(a.matrixWorld);for(p=0,M=t.faces.length;p<M;p++)if(b=t.faces[p],h.copy(this.origin),j.copy(this.direction),u=a.matrixWorld,l=u.multiplyVector3(l.copy(b.centroid)).subSelf(h),n=a.matrixRotationWorld.multiplyVector3(n.copy(b.normal)),q=j.dot(n),!(Math.abs(q)<e)&&(r=n.dot(l)/q,!(0>r)&&(a.doubleSided||(a.flipSided?
+0<q:0>q))))if(m.add(h,j.multiplyScalar(r)),b instanceof THREE.Face3)f=u.multiplyVector3(f.copy(A[b.a].position)),g=u.multiplyVector3(g.copy(A[b.b].position)),i=u.multiplyVector3(i.copy(A[b.c].position)),d(m,f,g,i)&&(b={distance:h.distanceTo(m),point:m.clone(),face:b,object:a},o.push(b));else if(b instanceof THREE.Face4&&(f=u.multiplyVector3(f.copy(A[b.a].position)),g=u.multiplyVector3(g.copy(A[b.b].position)),i=u.multiplyVector3(i.copy(A[b.c].position)),k=u.multiplyVector3(k.copy(A[b.d].position)),
+d(m,f,g,k)||d(m,g,i,k)))b={distance:h.distanceTo(m),point:m.clone(),face:b,object:a},o.push(b)}return o};this.intersectObjects=function(a){for(var b=[],c=0,d=a.length;c<d;c++)Array.prototype.push.apply(b,this.intersectObject(a[c]));b.sort(function(a,b){return a.distance-b.distance});return b};var p=new THREE.Vector3,o=new THREE.Vector3,q=new THREE.Vector3,G,w,C,D,r,x,t,y,H,K,E};
+THREE.Rectangle=function(){function a(){f=d-b;g=e-c}var b,c,d,e,f,g,i=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return f};this.getHeight=function(){return g};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return e};this.set=function(f,h,g,l){i=!1;b=f;c=h;d=g;e=l;a()};this.addPoint=function(f,h){i?(i=!1,b=f,c=h,d=f,e=h):(b=b<f?b:f,c=c<h?c:h,d=d>f?d:f,e=e>h?e:h);a()};this.add3Points=
+function(f,h,g,l,n,m){i?(i=!1,b=f<g?f<n?f:n:g<n?g:n,c=h<l?h<m?h:m:l<m?l:m,d=f>g?f>n?f:n:g>n?g:n,e=h>l?h>m?h:m:l>m?l:m):(b=f<g?f<n?f<b?f:b:n<b?n:b:g<n?g<b?g:b:n<b?n:b,c=h<l?h<m?h<c?h:c:m<c?m:c:l<m?l<c?l:c:m<c?m:c,d=f>g?f>n?f>d?f:d:n>d?n:d:g>n?g>d?g:d:n>d?n:d,e=h>l?h>m?h>e?h:e:m>e?m:e:l>m?l>e?l:e:m>e?m:e);a()};this.addRectangle=function(f){i?(i=!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 d<a.getLeft()||b>a.getRight()||e<a.getTop()||c>a.getBottom()?!1:!0};this.empty=function(){i=!0;e=d=c=b=0;a()};this.isEmpty=function(){return i}};
 THREE.Math={clamp:function(a,b,c){return a<b?b:a>c?c:a},clampBottom:function(a,b){return a<b?b:a},mapLinear:function(a,b,c,d,e){return d+(a-b)*(e-d)/(c-b)},random16:function(){return(65280*Math.random()+255*Math.random())/65535},randInt:function(a,b){return a+Math.floor(Math.random()*(b-a+1))},randFloat:function(a,b){return a+Math.random()*(b-a)},randFloatSpread:function(a){return a*(0.5-Math.random())},sign:function(a){return 0>a?-1:0<a?1:0}};THREE.Matrix3=function(){this.m=[]};
-THREE.Matrix3.prototype={constructor:THREE.Matrix3,transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}};THREE.Matrix4=function(a,b,c,d,e,f,g,h,k,i,j,l,n,m,p,o){this.set(void 0!==a?a:1,b||0,c||0,d||0,e||0,void 0!==f?f:1,g||0,h||0,k||0,i||0,void 0!==j?j:1,l||0,n||0,m||0,p||0,void 0!==o?o:1);this.m33=new THREE.Matrix3};
-THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,e,f,g,h,k,i,j,l,n,m,p,o){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=e;this.n22=f;this.n23=g;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=o;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,
-b,c){var d=THREE.Matrix4.__v1,e=THREE.Matrix4.__v2,f=THREE.Matrix4.__v3;f.sub(a,b).normalize();if(0===f.length())f.z=1;d.cross(c,f).normalize();0===d.length()&&(f.x+=1.0E-4,d.cross(c,f).normalize());e.cross(f,d);this.n11=d.x;this.n12=e.x;this.n13=f.x;this.n21=d.y;this.n22=e.y;this.n23=f.y;this.n31=d.z;this.n32=e.z;this.n33=f.z;return this},multiply:function(a,b){var c=a.n11,d=a.n12,e=a.n13,f=a.n14,g=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,o=a.n42,q=a.n43,G=a.n44,w=b.n11,
-C=b.n12,D=b.n13,r=b.n14,x=b.n21,t=b.n22,y=b.n23,H=b.n24,K=b.n31,E=b.n32,J=b.n33,Q=b.n34,R=b.n41,S=b.n42,M=b.n43,T=b.n44;this.n11=c*w+d*x+e*K+f*R;this.n12=c*C+d*t+e*E+f*S;this.n13=c*D+d*y+e*J+f*M;this.n14=c*r+d*H+e*Q+f*T;this.n21=g*w+h*x+k*K+i*R;this.n22=g*C+h*t+k*E+i*S;this.n23=g*D+h*y+k*J+i*M;this.n24=g*r+h*H+k*Q+i*T;this.n31=j*w+l*x+n*K+m*R;this.n32=j*C+l*t+n*E+m*S;this.n33=j*D+l*y+n*J+m*M;this.n34=j*r+l*H+n*Q+m*T;this.n41=p*w+o*x+q*K+G*R;this.n42=p*C+o*t+q*E+G*S;this.n43=p*D+o*y+q*J+G*M;this.n44=
+THREE.Matrix3.prototype={constructor:THREE.Matrix3,getInverse:function(a){var b=a.n33*a.n22-a.n32*a.n23,c=-a.n33*a.n21+a.n31*a.n23,d=a.n32*a.n21-a.n31*a.n22,e=-a.n33*a.n12+a.n32*a.n13,f=a.n33*a.n11-a.n31*a.n13,g=-a.n32*a.n11+a.n31*a.n12,i=a.n23*a.n12-a.n22*a.n13,k=-a.n23*a.n11+a.n21*a.n13,h=a.n22*a.n11-a.n21*a.n12,a=a.n11*b+a.n21*e+a.n31*i;0===a&&console.warn("Matrix3.getInverse(): determinant == 0");var a=1/a,j=this.m;j[0]=a*b;j[1]=a*c;j[2]=a*d;j[3]=a*e;j[4]=a*f;j[5]=a*g;j[6]=a*i;j[7]=a*k;j[8]=a*
+h;return this},transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}};THREE.Matrix4=function(a,b,c,d,e,f,g,i,k,h,j,l,n,m,p,o){this.set(void 0!==a?a:1,b||0,c||0,d||0,e||0,void 0!==f?f:1,g||0,i||0,k||0,h||0,void 0!==j?j:1,l||0,n||0,m||0,p||0,void 0!==o?o:1)};
+THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,e,f,g,i,k,h,j,l,n,m,p,o){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=e;this.n22=f;this.n23=g;this.n24=i;this.n31=k;this.n32=h;this.n33=j;this.n34=l;this.n41=n;this.n42=m;this.n43=p;this.n44=o;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,
+b,c){var d=THREE.Matrix4.__v1,e=THREE.Matrix4.__v2,f=THREE.Matrix4.__v3;f.sub(a,b).normalize();if(0===f.length())f.z=1;d.cross(c,f).normalize();0===d.length()&&(f.x+=1.0E-4,d.cross(c,f).normalize());e.cross(f,d);this.n11=d.x;this.n12=e.x;this.n13=f.x;this.n21=d.y;this.n22=e.y;this.n23=f.y;this.n31=d.z;this.n32=e.z;this.n33=f.z;return this},multiply:function(a,b){var c=a.n11,d=a.n12,e=a.n13,f=a.n14,g=a.n21,i=a.n22,k=a.n23,h=a.n24,j=a.n31,l=a.n32,n=a.n33,m=a.n34,p=a.n41,o=a.n42,q=a.n43,G=a.n44,w=b.n11,
+C=b.n12,D=b.n13,r=b.n14,x=b.n21,t=b.n22,y=b.n23,H=b.n24,K=b.n31,E=b.n32,J=b.n33,Q=b.n34,R=b.n41,S=b.n42,M=b.n43,T=b.n44;this.n11=c*w+d*x+e*K+f*R;this.n12=c*C+d*t+e*E+f*S;this.n13=c*D+d*y+e*J+f*M;this.n14=c*r+d*H+e*Q+f*T;this.n21=g*w+i*x+k*K+h*R;this.n22=g*C+i*t+k*E+h*S;this.n23=g*D+i*y+k*J+h*M;this.n24=g*r+i*H+k*Q+h*T;this.n31=j*w+l*x+n*K+m*R;this.n32=j*C+l*t+n*E+m*S;this.n33=j*D+l*y+n*J+m*M;this.n34=j*r+l*H+n*Q+m*T;this.n41=p*w+o*x+q*K+G*R;this.n42=p*C+o*t+q*E+G*S;this.n43=p*D+o*y+q*J+G*M;this.n44=
 p*r+o*H+q*Q+G*T;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,f=this.n22,g=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,o=this.n44;return d*g*i*n-c*h*i*n-d*f*j*n+b*h*j*n+c*f*l*n-b*g*l*n-d*g*k*m+c*h*k*m+d*e*j*m-a*h*j*m-c*e*l*m+a*g*l*m+d*f*k*p-b*h*k*p-d*e*i*p+a*h*i*p+b*e*l*p-a*f*l*p-c*f*k*o+b*g*k*o+c*e*i*o-a*g*i*o-b*e*j*o+a*f*j*o},transpose:function(){var a;
+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,f=this.n22,g=this.n23,i=this.n24,k=this.n31,h=this.n32,j=this.n33,l=this.n34,n=this.n41,m=this.n42,p=this.n43,o=this.n44;return d*g*h*n-c*i*h*n-d*f*j*n+b*i*j*n+c*f*l*n-b*g*l*n-d*g*k*m+c*i*k*m+d*e*j*m-a*i*j*m-c*e*l*m+a*g*l*m+d*f*k*p-b*i*k*p-d*e*h*p+a*i*h*p+b*e*l*p-a*f*l*p-c*f*k*o+b*g*k*o+c*e*h*o-a*g*h*o-b*e*j*o+a*f*j*o},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.n34=a;return this},flattenToArray:function(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=
-this.n44;return a},flattenToArrayOffset:function(a,b){a[b]=this.n11;a[b+1]=this.n21;a[b+2]=this.n31;a[b+3]=this.n41;a[b+4]=this.n12;a[b+5]=this.n22;a[b+6]=this.n32;a[b+7]=this.n42;a[b+8]=this.n13;a[b+9]=this.n23;a[b+10]=this.n33;a[b+11]=this.n43;a[b+12]=this.n14;a[b+13]=this.n24;a[b+14]=this.n34;a[b+15]=this.n44;return a},setTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},setScale:function(a,b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},setRotationX:function(a){var b=
-Math.cos(a),a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},setRotationY:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},setRotationZ:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),e=1-c,f=a.x,g=a.y,h=a.z,k=e*f,i=e*g;this.set(k*f+c,k*g-d*h,k*h+d*g,0,k*g+d*h,i*g+c,i*h-d*f,0,k*h-d*g,i*h+d*f,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,f=a.n21,g=a.n22,h=a.n23,k=a.n24,i=a.n31,j=
-a.n32,l=a.n33,n=a.n34,m=a.n41,p=a.n42,o=a.n43,q=a.n44;this.n11=h*n*p-k*l*p+k*j*o-g*n*o-h*j*q+g*l*q;this.n12=e*l*p-d*n*p-e*j*o+c*n*o+d*j*q-c*l*q;this.n13=d*k*p-e*h*p+e*g*o-c*k*o-d*g*q+c*h*q;this.n14=e*h*j-d*k*j-e*g*l+c*k*l+d*g*n-c*h*n;this.n21=k*l*m-h*n*m-k*i*o+f*n*o+h*i*q-f*l*q;this.n22=d*n*m-e*l*m+e*i*o-b*n*o-d*i*q+b*l*q;this.n23=e*h*m-d*k*m-e*f*o+b*k*o+d*f*q-b*h*q;this.n24=d*k*i-e*h*i+e*f*l-b*k*l-d*f*n+b*h*n;this.n31=g*n*m-k*j*m+k*i*p-f*n*p-g*i*q+f*j*q;this.n32=e*j*m-c*n*m-e*i*p+b*n*p+c*i*q-b*j*
-q;this.n33=c*k*m-e*g*m+e*f*p-b*k*p-c*f*q+b*g*q;this.n34=e*g*i-c*k*i-e*f*j+b*k*j+c*f*n-b*g*n;this.n41=h*j*m-g*l*m-h*i*p+f*l*p+g*i*o-f*j*o;this.n42=c*l*m-d*j*m+d*i*p-b*l*p-c*i*o+b*j*o;this.n43=d*g*m-c*h*m-d*f*p+b*h*p+c*f*o-b*g*o;this.n44=c*h*i-d*g*i+d*f*j-b*h*j-c*f*l+b*g*l;this.multiplyScalar(1/a.determinant());return this},setRotationFromEuler:function(a,b){var c=a.x,d=a.y,e=a.z,f=Math.cos(c),c=Math.sin(c),g=Math.cos(d),d=Math.sin(d),h=Math.cos(e),e=Math.sin(e);switch(b){case "YXZ":var k=g*h,i=g*e,
-j=d*h,l=d*e;this.n11=k+l*c;this.n12=j*c-i;this.n13=f*d;this.n21=f*e;this.n22=f*h;this.n23=-c;this.n31=i*c-j;this.n32=l+k*c;this.n33=f*g;break;case "ZXY":k=g*h;i=g*e;j=d*h;l=d*e;this.n11=k-l*c;this.n12=-f*e;this.n13=j+i*c;this.n21=i+j*c;this.n22=f*h;this.n23=l-k*c;this.n31=-f*d;this.n32=c;this.n33=f*g;break;case "ZYX":k=f*h;i=f*e;j=c*h;l=c*e;this.n11=g*h;this.n12=j*d-i;this.n13=k*d+l;this.n21=g*e;this.n22=l*d+k;this.n23=i*d-j;this.n31=-d;this.n32=c*g;this.n33=f*g;break;case "YZX":k=f*g;i=f*d;j=c*g;
-l=c*d;this.n11=g*h;this.n12=l-k*e;this.n13=j*e+i;this.n21=e;this.n22=f*h;this.n23=-c*h;this.n31=-d*h;this.n32=i*e+j;this.n33=k-l*e;break;case "XZY":k=f*g;i=f*d;j=c*g;l=c*d;this.n11=g*h;this.n12=-e;this.n13=d*h;this.n21=k*e+l;this.n22=f*h;this.n23=i*e-j;this.n31=j*e-i;this.n32=c*h;this.n33=l*e+k;break;default:k=f*h,i=f*e,j=c*h,l=c*e,this.n11=g*h,this.n12=-g*e,this.n13=d,this.n21=i+j*d,this.n22=k-l*d,this.n23=-c*g,this.n31=l-k*d,this.n32=j+i*d,this.n33=f*g}return this},setRotationFromQuaternion:function(a){var b=
-a.x,c=a.y,d=a.z,e=a.w,f=b+b,g=c+c,h=d+d,a=b*f,k=b*g,b=b*h,i=c*g,c=c*h,d=d*h,f=e*f,g=e*g,e=e*h;this.n11=1-(i+d);this.n12=k-e;this.n13=b+g;this.n21=k+e;this.n22=1-(a+d);this.n23=c-f;this.n31=b-g;this.n32=c+f;this.n33=1-(a+i);return this},scale:function(a){var b=a.x,c=a.y,a=a.z;this.n11*=b;this.n12*=c;this.n13*=a;this.n21*=b;this.n22*=c;this.n23*=a;this.n31*=b;this.n32*=c;this.n33*=a;this.n41*=b;this.n42*=c;this.n43*=a;return this},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,f=THREE.Matrix4.__v3;d.set(this.n11,this.n21,this.n31);e.set(this.n12,this.n22,this.n32);f.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=f.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},rotateByAxis:function(a,b){if(1===a.x&&0===a.y&&0===a.z)return this.rotateX(b);if(0===a.x&&1===a.y&&0===a.z)return this.rotateY(b);if(0===a.x&&0===a.y&&1===a.z)return this.rotateZ(b);var c=a.x,d=a.y,e=a.z,f=Math.sqrt(c*c+d*d+e*e),c=c/f,d=d/f,e=e/f,f=c*c,g=d*d,h=e*e,k=Math.cos(b),i=Math.sin(b),j=1-k,l=c*d*j,n=c*e*j,j=d*e*j,c=c*i,m=d*i,i=e*i,e=
-f+(1-f)*k,f=l+i,d=n-m,l=l-i,g=g+(1-g)*k,i=j+c,n=n+m,j=j-c,h=h+(1-h)*k,k=this.n11,c=this.n21,m=this.n31,p=this.n41,o=this.n12,q=this.n22,G=this.n32,w=this.n42,C=this.n13,D=this.n23,r=this.n33,x=this.n43;this.n11=e*k+f*o+d*C;this.n21=e*c+f*q+d*D;this.n31=e*m+f*G+d*r;this.n41=e*p+f*w+d*x;this.n12=l*k+g*o+i*C;this.n22=l*c+g*q+i*D;this.n32=l*m+g*G+i*r;this.n42=l*p+g*w+i*x;this.n13=n*k+j*o+h*C;this.n23=n*c+j*q+h*D;this.n33=n*m+j*G+h*r;this.n43=n*p+j*w+h*x;return this},rotateX:function(a){var b=this.n12,
-c=this.n22,d=this.n32,e=this.n42,f=this.n13,g=this.n23,h=this.n33,k=this.n43,i=Math.cos(a),a=Math.sin(a);this.n12=i*b+a*f;this.n22=i*c+a*g;this.n32=i*d+a*h;this.n42=i*e+a*k;this.n13=i*f-a*b;this.n23=i*g-a*c;this.n33=i*h-a*d;this.n43=i*k-a*e;return this},rotateY:function(a){var b=this.n11,c=this.n21,d=this.n31,e=this.n41,f=this.n13,g=this.n23,h=this.n33,k=this.n43,i=Math.cos(a),a=Math.sin(a);this.n11=i*b-a*f;this.n21=i*c-a*g;this.n31=i*d-a*h;this.n41=i*e-a*k;this.n13=i*f+a*b;this.n23=i*g+a*c;this.n33=
-i*h+a*d;this.n43=i*k+a*e;return this},rotateZ:function(a){var b=this.n11,c=this.n21,d=this.n31,e=this.n41,f=this.n12,g=this.n22,h=this.n32,k=this.n42,i=Math.cos(a),a=Math.sin(a);this.n11=i*b+a*f;this.n21=i*c+a*g;this.n31=i*d+a*h;this.n41=i*e+a*k;this.n12=i*f-a*b;this.n22=i*g-a*c;this.n32=i*h-a*d;this.n42=i*k-a*e;return this},translate:function(a){var b=a.x,c=a.y,a=a.z;this.n14=this.n11*b+this.n12*c+this.n13*a+this.n14;this.n24=this.n21*b+this.n22*c+this.n23*a+this.n24;this.n34=this.n31*b+this.n32*
-c+this.n33*a+this.n34;this.n44=this.n41*b+this.n42*c+this.n43*a+this.n44;return this},clone:function(){return new THREE.Matrix4(this.n11,this.n12,this.n13,this.n14,this.n21,this.n22,this.n23,this.n24,this.n31,this.n32,this.n33,this.n34,this.n41,this.n42,this.n43,this.n44)}};
-THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,d=a.n33*a.n22-a.n32*a.n23,e=-a.n33*a.n21+a.n31*a.n23,f=a.n32*a.n21-a.n31*a.n22,g=-a.n33*a.n12+a.n32*a.n13,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*g+a.n31*i;if(0===a)return null;a=1/a;c[0]=a*d;c[1]=a*e;c[2]=a*f;c[3]=a*g;c[4]=a*h;c[5]=a*k;c[6]=a*i;c[7]=a*j;c[8]=a*l;return b};
-THREE.Matrix4.makeFrustum=function(a,b,c,d,e,f){var g;g=new THREE.Matrix4;g.n11=2*e/(b-a);g.n12=0;g.n13=(b+a)/(b-a);g.n14=0;g.n21=0;g.n22=2*e/(d-c);g.n23=(d+c)/(d-c);g.n24=0;g.n31=0;g.n32=0;g.n33=-(f+e)/(f-e);g.n34=-2*f*e/(f-e);g.n41=0;g.n42=0;g.n43=-1;g.n44=0;return g};THREE.Matrix4.makePerspective=function(a,b,c,d){var e,a=c*Math.tan(a*Math.PI/360);e=-a;return THREE.Matrix4.makeFrustum(e*b,a*b,e,a,c,d)};
-THREE.Matrix4.makeOrtho=function(a,b,c,d,e,f){var g,h,k,i;g=new THREE.Matrix4;h=b-a;k=c-d;i=f-e;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/i;g.n34=-((f+e)/i);g.n41=0;g.n42=0;g.n43=0;g.n44=1;return g};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
+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},getPosition:function(){return THREE.Matrix4.__v1.set(this.n14,this.n24,this.n34)},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},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,f=a.n21,g=a.n22,i=a.n23,k=a.n24,h=a.n31,j=a.n32,l=a.n33,n=a.n34,m=a.n41,p=a.n42,o=a.n43,q=a.n44;this.n11=i*n*p-k*l*p+k*j*o-g*n*o-i*j*q+g*l*q;this.n12=e*l*p-d*n*p-e*j*o+c*n*o+d*j*q-c*l*q;this.n13=d*k*p-e*i*p+e*g*o-c*k*o-d*g*q+c*i*q;this.n14=e*i*j-d*k*j-e*g*l+c*
+k*l+d*g*n-c*i*n;this.n21=k*l*m-i*n*m-k*h*o+f*n*o+i*h*q-f*l*q;this.n22=d*n*m-e*l*m+e*h*o-b*n*o-d*h*q+b*l*q;this.n23=e*i*m-d*k*m-e*f*o+b*k*o+d*f*q-b*i*q;this.n24=d*k*h-e*i*h+e*f*l-b*k*l-d*f*n+b*i*n;this.n31=g*n*m-k*j*m+k*h*p-f*n*p-g*h*q+f*j*q;this.n32=e*j*m-c*n*m-e*h*p+b*n*p+c*h*q-b*j*q;this.n33=c*k*m-e*g*m+e*f*p-b*k*p-c*f*q+b*g*q;this.n34=e*g*h-c*k*h-e*f*j+b*k*j+c*f*n-b*g*n;this.n41=i*j*m-g*l*m-i*h*p+f*l*p+g*h*o-f*j*o;this.n42=c*l*m-d*j*m+d*h*p-b*l*p-c*h*o+b*j*o;this.n43=d*g*m-c*i*m-d*f*p+b*i*p+c*
+f*o-b*g*o;this.n44=c*i*h-d*g*h+d*f*j-b*i*j-c*f*l+b*g*l;this.multiplyScalar(1/a.determinant());return this},setRotationFromEuler:function(a,b){var c=a.x,d=a.y,e=a.z,f=Math.cos(c),c=Math.sin(c),g=Math.cos(d),d=Math.sin(d),i=Math.cos(e),e=Math.sin(e);switch(b){case "YXZ":var k=g*i,h=g*e,j=d*i,l=d*e;this.n11=k+l*c;this.n12=j*c-h;this.n13=f*d;this.n21=f*e;this.n22=f*i;this.n23=-c;this.n31=h*c-j;this.n32=l+k*c;this.n33=f*g;break;case "ZXY":k=g*i;h=g*e;j=d*i;l=d*e;this.n11=k-l*c;this.n12=-f*e;this.n13=j+
+h*c;this.n21=h+j*c;this.n22=f*i;this.n23=l-k*c;this.n31=-f*d;this.n32=c;this.n33=f*g;break;case "ZYX":k=f*i;h=f*e;j=c*i;l=c*e;this.n11=g*i;this.n12=j*d-h;this.n13=k*d+l;this.n21=g*e;this.n22=l*d+k;this.n23=h*d-j;this.n31=-d;this.n32=c*g;this.n33=f*g;break;case "YZX":k=f*g;h=f*d;j=c*g;l=c*d;this.n11=g*i;this.n12=l-k*e;this.n13=j*e+h;this.n21=e;this.n22=f*i;this.n23=-c*i;this.n31=-d*i;this.n32=h*e+j;this.n33=k-l*e;break;case "XZY":k=f*g;h=f*d;j=c*g;l=c*d;this.n11=g*i;this.n12=-e;this.n13=d*i;this.n21=
+k*e+l;this.n22=f*i;this.n23=h*e-j;this.n31=j*e-h;this.n32=c*i;this.n33=l*e+k;break;default:k=f*i,h=f*e,j=c*i,l=c*e,this.n11=g*i,this.n12=-g*e,this.n13=d,this.n21=h+j*d,this.n22=k-l*d,this.n23=-c*g,this.n31=l-k*d,this.n32=j+h*d,this.n33=f*g}return this},setRotationFromQuaternion:function(a){var b=a.x,c=a.y,d=a.z,e=a.w,f=b+b,g=c+c,i=d+d,a=b*f,k=b*g,b=b*i,h=c*g,c=c*i,d=d*i,f=e*f,g=e*g,e=e*i;this.n11=1-(h+d);this.n12=k-e;this.n13=b+g;this.n21=k+e;this.n22=1-(a+d);this.n23=c-f;this.n31=b-g;this.n32=c+
+f;this.n33=1-(a+h);return this},compose:function(a,b,c){var d=THREE.Matrix4.__m1,e=THREE.Matrix4.__m2;d.identity();d.setRotationFromQuaternion(b);e.makeScale(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,f=THREE.Matrix4.__v3;d.set(this.n11,this.n21,this.n31);e.set(this.n12,this.n22,this.n32);f.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=f.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},translate:function(a){var b=a.x,c=a.y,a=a.z;this.n14=this.n11*b+this.n12*c+this.n13*a+this.n14;this.n24=this.n21*b+this.n22*c+this.n23*a+this.n24;this.n34=this.n31*b+this.n32*c+this.n33*a+this.n34;this.n44=this.n41*b+this.n42*c+this.n43*a+this.n44;return this},
+rotateX:function(a){var b=this.n12,c=this.n22,d=this.n32,e=this.n42,f=this.n13,g=this.n23,i=this.n33,k=this.n43,h=Math.cos(a),a=Math.sin(a);this.n12=h*b+a*f;this.n22=h*c+a*g;this.n32=h*d+a*i;this.n42=h*e+a*k;this.n13=h*f-a*b;this.n23=h*g-a*c;this.n33=h*i-a*d;this.n43=h*k-a*e;return this},rotateY:function(a){var b=this.n11,c=this.n21,d=this.n31,e=this.n41,f=this.n13,g=this.n23,i=this.n33,k=this.n43,h=Math.cos(a),a=Math.sin(a);this.n11=h*b-a*f;this.n21=h*c-a*g;this.n31=h*d-a*i;this.n41=h*e-a*k;this.n13=
+h*f+a*b;this.n23=h*g+a*c;this.n33=h*i+a*d;this.n43=h*k+a*e;return this},rotateZ:function(a){var b=this.n11,c=this.n21,d=this.n31,e=this.n41,f=this.n12,g=this.n22,i=this.n32,k=this.n42,h=Math.cos(a),a=Math.sin(a);this.n11=h*b+a*f;this.n21=h*c+a*g;this.n31=h*d+a*i;this.n41=h*e+a*k;this.n12=h*f-a*b;this.n22=h*g-a*c;this.n32=h*i-a*d;this.n42=h*k-a*e;return this},rotateByAxis:function(a,b){if(1===a.x&&0===a.y&&0===a.z)return this.rotateX(b);if(0===a.x&&1===a.y&&0===a.z)return this.rotateY(b);if(0===a.x&&
+0===a.y&&1===a.z)return this.rotateZ(b);var c=a.x,d=a.y,e=a.z,f=Math.sqrt(c*c+d*d+e*e),c=c/f,d=d/f,e=e/f,f=c*c,g=d*d,i=e*e,k=Math.cos(b),h=Math.sin(b),j=1-k,l=c*d*j,n=c*e*j,j=d*e*j,c=c*h,m=d*h,h=e*h,e=f+(1-f)*k,f=l+h,d=n-m,l=l-h,g=g+(1-g)*k,h=j+c,n=n+m,j=j-c,i=i+(1-i)*k,k=this.n11,c=this.n21,m=this.n31,p=this.n41,o=this.n12,q=this.n22,G=this.n32,w=this.n42,C=this.n13,D=this.n23,r=this.n33,x=this.n43;this.n11=e*k+f*o+d*C;this.n21=e*c+f*q+d*D;this.n31=e*m+f*G+d*r;this.n41=e*p+f*w+d*x;this.n12=l*k+g*
+o+h*C;this.n22=l*c+g*q+h*D;this.n32=l*m+g*G+h*r;this.n42=l*p+g*w+h*x;this.n13=n*k+j*o+i*C;this.n23=n*c+j*q+i*D;this.n33=n*m+j*G+i*r;this.n43=n*p+j*w+i*x;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},makeTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},makeRotationX: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},makeRotationY: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},makeRotationZ: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},makeRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),e=1-c,f=a.x,g=a.y,i=a.z,k=e*f,h=e*g;this.set(k*f+c,k*g-d*i,k*i+d*g,0,k*g+d*i,h*g+c,h*i-d*f,0,k*i-d*g,h*i+d*f,e*i*i+c,0,0,0,0,1);return this},makeScale:function(a,
+b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},makeFrustum:function(a,b,c,d,e,f){this.n11=2*e/(b-a);this.n12=0;this.n13=(b+a)/(b-a);this.n21=this.n14=0;this.n22=2*e/(d-c);this.n23=(d+c)/(d-c);this.n32=this.n31=this.n24=0;this.n33=-(f+e)/(f-e);this.n34=-2*f*e/(f-e);this.n42=this.n41=0;this.n43=-1;this.n44=0;return this},makePerspective:function(a,b,c,d){var a=c*Math.tan(a*Math.PI/360),e=-a;return this.makeFrustum(e*b,a*b,e,a,c,d)},makeOrthographic:function(a,b,c,d,e,f){var g=b-a,i=c-d,
+k=f-e;this.n11=2/g;this.n13=this.n12=0;this.n14=-((b+a)/g);this.n21=0;this.n22=2/i;this.n23=0;this.n24=-((c+d)/i);this.n32=this.n31=0;this.n33=-2/k;this.n34=-((f+e)/k);this.n43=this.n42=this.n41=0;this.n44=1;return this},clone:function(){return new THREE.Matrix4(this.n11,this.n12,this.n13,this.n14,this.n21,this.n22,this.n23,this.n24,this.n31,this.n32,this.n33,this.n34,this.n41,this.n42,this.n43,this.n44)}};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.id=THREE.Object3DCount++;this.name="";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=!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,applyMatrix:function(a){this.matrix.multiply(a,this.matrix);this.scale.getScaleFromMatrix(this.matrix);this.rotation.getRotationFromMatrix(this.matrix,this.scale);this.position.getPositionFromMatrix(this.matrix)},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,
@@ -63,22 +63,22 @@ this._vector.set(0,0,1))},lookAt:function(a){this.matrix.lookAt(a,this.position,
 this.children.indexOf(a);if(-1!==b){a.parent=void 0;this.children.splice(b,1);for(b=this;void 0!==b.parent;)b=b.parent;void 0!==b&&b instanceof THREE.Scene&&b.__removeObject(a)}},getChildByName:function(a,b){var c,d,e;for(c=0,d=this.children.length;c<d;c++){e=this.children[c];if(e.name===a||b&&(e=e.getChildByName(a,b),void 0!==e))return e}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,
 this.eulerOrder);if(1!==this.scale.x||1!==this.scale.y||1!==this.scale.z)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[f]=g[f]||new THREE.RenderableObject;f++;return a}function b(){var a=i[k]=i[k]||new THREE.RenderableVertex;k++;return a}function c(a,b){return b.z-a.z}function d(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;if(0<=e&&0<=f&&0<=g&&0<=h)return!0;if(0>e&&0>f||0>g&&0>h)return!1;0>e?c=Math.max(c,e/(e-f)):0>f&&(d=Math.min(d,e/(e-f)));0>g?c=Math.max(c,g/(g-h)):0>h&&(d=Math.min(d,g/(g-h)));if(d<c)return!1;a.lerpSelf(b,c);b.lerpSelf(a,1-d);return!0}
-var e,f,g=[],h,k,i=[],j,l,n=[],m,p=[],o,q,G=[],w,C,D=[],r={objects:[],sprites:[],lights:[],elements:[]},x=new THREE.Vector3,t=new THREE.Vector4,y=new THREE.Matrix4,H=new THREE.Matrix4,K=new THREE.Frustum,E=new THREE.Vector4,J=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);y.multiply(b.projectionMatrix,b.matrixWorldInverse);y.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);y.multiply(b.matrixWorld,
-b.projectionMatrixInverse);y.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(b,d){f=0;r.objects.length=0;r.sprites.length=0;r.lights.length=0;var g=function(b){if(!1!==b.visible){(b instanceof THREE.Mesh||b instanceof THREE.Line)&&(!1===b.frustumCulled||K.contains(b))?(x.copy(b.matrixWorld.getPosition()),y.multiplyVector3(x),
-e=a(),e.object=b,e.z=x.z,r.objects.push(e)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(x.copy(b.matrixWorld.getPosition()),y.multiplyVector3(x),e=a(),e.object=b,e.z=x.z,r.sprites.push(e)):b instanceof THREE.Light&&r.lights.push(b);for(var c=0,d=b.children.length;c<d;c++)g(b.children[c])}};g(b);d&&r.objects.sort(c);return r};this.projectScene=function(a,e,f){var g=e.near,x=e.far,O=!1,U,A,u,I,s,B,z,F,v,L,N,X,V,W,P;C=q=m=l=0;r.elements.length=0;void 0===e.parent&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),
-a.add(e));a.updateMatrixWorld();e.matrixWorldInverse.getInverse(e.matrixWorld);y.multiply(e.projectionMatrix,e.matrixWorldInverse);K.setFromMatrix(y);r=this.projectGraph(a,!1);for(a=0,U=r.objects.length;a<U;a++)if(v=r.objects[a].object,L=v.matrixWorld,k=0,v instanceof THREE.Mesh){N=v.geometry;X=v.geometry.materials;I=N.vertices;V=N.faces;W=N.faceVertexUvs;N=v.matrixRotationWorld.extractRotation(L);for(A=0,u=I.length;A<u;A++)h=b(),h.positionWorld.copy(I[A].position),L.multiplyVector3(h.positionWorld),
-h.positionScreen.copy(h.positionWorld),y.multiplyVector4(h.positionScreen),h.positionScreen.x/=h.positionScreen.w,h.positionScreen.y/=h.positionScreen.w,h.visible=h.positionScreen.z>g&&h.positionScreen.z<x;for(I=0,A=V.length;I<A;I++){u=V[I];if(u instanceof THREE.Face3)if(s=i[u.a],B=i[u.b],z=i[u.c],s.visible&&B.visible&&z.visible)if(O=0>(z.positionScreen.x-s.positionScreen.x)*(B.positionScreen.y-s.positionScreen.y)-(z.positionScreen.y-s.positionScreen.y)*(B.positionScreen.x-s.positionScreen.x),v.doubleSided||
-O!=v.flipSided)F=n[l]=n[l]||new THREE.RenderableFace3,l++,j=F,j.v1.copy(s),j.v2.copy(B),j.v3.copy(z);else continue;else continue;else if(u instanceof THREE.Face4)if(s=i[u.a],B=i[u.b],z=i[u.c],F=i[u.d],s.visible&&B.visible&&z.visible&&F.visible)if(O=0>(F.positionScreen.x-s.positionScreen.x)*(B.positionScreen.y-s.positionScreen.y)-(F.positionScreen.y-s.positionScreen.y)*(B.positionScreen.x-s.positionScreen.x)||0>(B.positionScreen.x-z.positionScreen.x)*(F.positionScreen.y-z.positionScreen.y)-(B.positionScreen.y-
+THREE.Projector=function(){function a(){var a=g[f]=g[f]||new THREE.RenderableObject;f++;return a}function b(){var a=h[k]=h[k]||new THREE.RenderableVertex;k++;return a}function c(a,b){return b.z-a.z}function d(a,b){var c=0,d=1,e=a.z+a.w,f=b.z+b.w,h=-a.z+a.w,g=-b.z+b.w;if(0<=e&&0<=f&&0<=h&&0<=g)return!0;if(0>e&&0>f||0>h&&0>g)return!1;0>e?c=Math.max(c,e/(e-f)):0>f&&(d=Math.min(d,e/(e-f)));0>h?c=Math.max(c,h/(h-g)):0>g&&(d=Math.min(d,h/(h-g)));if(d<c)return!1;a.lerpSelf(b,c);b.lerpSelf(a,1-d);return!0}
+var e,f,g=[],i,k,h=[],j,l,n=[],m,p=[],o,q,G=[],w,C,D=[],r={objects:[],sprites:[],lights:[],elements:[]},x=new THREE.Vector3,t=new THREE.Vector4,y=new THREE.Matrix4,H=new THREE.Matrix4,K=new THREE.Frustum,E=new THREE.Vector4,J=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);y.multiply(b.projectionMatrix,b.matrixWorldInverse);y.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);y.multiply(b.matrixWorld,
+b.projectionMatrixInverse);y.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(b,d){f=0;r.objects.length=0;r.sprites.length=0;r.lights.length=0;var h=function(b){if(!1!==b.visible){(b instanceof THREE.Mesh||b instanceof THREE.Line)&&(!1===b.frustumCulled||K.contains(b))?(x.copy(b.matrixWorld.getPosition()),y.multiplyVector3(x),
+e=a(),e.object=b,e.z=x.z,r.objects.push(e)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(x.copy(b.matrixWorld.getPosition()),y.multiplyVector3(x),e=a(),e.object=b,e.z=x.z,r.sprites.push(e)):b instanceof THREE.Light&&r.lights.push(b);for(var c=0,d=b.children.length;c<d;c++)h(b.children[c])}};h(b);d&&r.objects.sort(c);return r};this.projectScene=function(a,e,f){var g=e.near,x=e.far,O=!1,U,A,u,I,s,B,z,F,v,L,N,X,V,W,P;C=q=m=l=0;r.elements.length=0;void 0===e.parent&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),
+a.add(e));a.updateMatrixWorld();e.matrixWorldInverse.getInverse(e.matrixWorld);y.multiply(e.projectionMatrix,e.matrixWorldInverse);K.setFromMatrix(y);r=this.projectGraph(a,!1);for(a=0,U=r.objects.length;a<U;a++)if(v=r.objects[a].object,L=v.matrixWorld,k=0,v instanceof THREE.Mesh){N=v.geometry;X=v.geometry.materials;I=N.vertices;V=N.faces;W=N.faceVertexUvs;N=v.matrixRotationWorld.extractRotation(L);for(A=0,u=I.length;A<u;A++)i=b(),i.positionWorld.copy(I[A].position),L.multiplyVector3(i.positionWorld),
+i.positionScreen.copy(i.positionWorld),y.multiplyVector4(i.positionScreen),i.positionScreen.x/=i.positionScreen.w,i.positionScreen.y/=i.positionScreen.w,i.visible=i.positionScreen.z>g&&i.positionScreen.z<x;for(I=0,A=V.length;I<A;I++){u=V[I];if(u instanceof THREE.Face3)if(s=h[u.a],B=h[u.b],z=h[u.c],s.visible&&B.visible&&z.visible)if(O=0>(z.positionScreen.x-s.positionScreen.x)*(B.positionScreen.y-s.positionScreen.y)-(z.positionScreen.y-s.positionScreen.y)*(B.positionScreen.x-s.positionScreen.x),v.doubleSided||
+O!=v.flipSided)F=n[l]=n[l]||new THREE.RenderableFace3,l++,j=F,j.v1.copy(s),j.v2.copy(B),j.v3.copy(z);else continue;else continue;else if(u instanceof THREE.Face4)if(s=h[u.a],B=h[u.b],z=h[u.c],F=h[u.d],s.visible&&B.visible&&z.visible&&F.visible)if(O=0>(F.positionScreen.x-s.positionScreen.x)*(B.positionScreen.y-s.positionScreen.y)-(F.positionScreen.y-s.positionScreen.y)*(B.positionScreen.x-s.positionScreen.x)||0>(B.positionScreen.x-z.positionScreen.x)*(F.positionScreen.y-z.positionScreen.y)-(B.positionScreen.y-
 z.positionScreen.y)*(F.positionScreen.x-z.positionScreen.x),v.doubleSided||O!=v.flipSided)P=p[m]=p[m]||new THREE.RenderableFace4,m++,j=P,j.v1.copy(s),j.v2.copy(B),j.v3.copy(z),j.v4.copy(F);else continue;else continue;j.normalWorld.copy(u.normal);!O&&(v.flipSided||v.doubleSided)&&j.normalWorld.negate();N.multiplyVector3(j.normalWorld);j.centroidWorld.copy(u.centroid);L.multiplyVector3(j.centroidWorld);j.centroidScreen.copy(j.centroidWorld);y.multiplyVector3(j.centroidScreen);z=u.vertexNormals;for(s=
 0,B=z.length;s<B;s++)F=j.vertexNormalsWorld[s],F.copy(z[s]),!O&&(v.flipSided||v.doubleSided)&&F.negate(),N.multiplyVector3(F);for(s=0,B=W.length;s<B;s++)if(P=W[s][I])for(z=0,F=P.length;z<F;z++)j.uvs[s][z]=P[z];j.material=v.material;j.faceMaterial=null!==u.materialIndex?X[u.materialIndex]:null;j.z=j.centroidScreen.z;r.elements.push(j)}}else if(v instanceof THREE.Line){H.multiply(y,L);I=v.geometry.vertices;s=b();s.positionScreen.copy(I[0].position);H.multiplyVector4(s.positionScreen);for(A=1,u=I.length;A<
-u;A++)if(s=b(),s.positionScreen.copy(I[A].position),H.multiplyVector4(s.positionScreen),B=i[k-2],E.copy(s.positionScreen),J.copy(B.positionScreen),d(E,J))E.multiplyScalar(1/E.w),J.multiplyScalar(1/J.w),L=G[q]=G[q]||new THREE.RenderableLine,q++,o=L,o.v1.positionScreen.copy(E),o.v2.positionScreen.copy(J),o.z=Math.max(E.z,J.z),o.material=v.material,r.elements.push(o)}for(a=0,U=r.sprites.length;a<U;a++)if(v=r.sprites[a].object,L=v.matrixWorld,v instanceof THREE.Particle&&(t.set(L.n14,L.n24,L.n34,1),y.multiplyVector4(t),
+u;A++)if(s=b(),s.positionScreen.copy(I[A].position),H.multiplyVector4(s.positionScreen),B=h[k-2],E.copy(s.positionScreen),J.copy(B.positionScreen),d(E,J))E.multiplyScalar(1/E.w),J.multiplyScalar(1/J.w),L=G[q]=G[q]||new THREE.RenderableLine,q++,o=L,o.v1.positionScreen.copy(E),o.v2.positionScreen.copy(J),o.z=Math.max(E.z,J.z),o.material=v.material,r.elements.push(o)}for(a=0,U=r.sprites.length;a<U;a++)if(v=r.sprites[a].object,L=v.matrixWorld,v instanceof THREE.Particle&&(t.set(L.n14,L.n24,L.n34,1),y.multiplyVector4(t),
 t.z/=t.w,0<t.z&&1>t.z))g=D[C]=D[C]||new THREE.RenderableParticle,C++,w=g,w.x=t.x/t.w,w.y=t.y/t.w,w.z=t.z,w.rotation=v.rotation.z,w.scale.x=v.scale.x*Math.abs(w.x-(t.x+e.projectionMatrix.n11)/(t.w+e.projectionMatrix.n14)),w.scale.y=v.scale.y*Math.abs(w.y-(t.y+e.projectionMatrix.n22)/(t.w+e.projectionMatrix.n24)),w.material=v.material,r.elements.push(w);f&&r.elements.sort(c);return r}};THREE.Quaternion=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=void 0!==d?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),f=Math.cos(c),c=Math.sin(c),g=a*b,h=d*e;this.w=g*f-h*c;this.x=g*c+h*f;this.y=d*b*f+a*e*c;this.z=a*e*f-d*b*c;return this},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);
+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),f=Math.cos(c),c=Math.sin(c),g=a*b,i=d*e;this.w=g*f-i*c;this.x=g*c+i*f;this.y=d*b*f+a*e*c;this.z=a*e*f-d*b*c;return this},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=0>a.n32-a.n23?-Math.abs(this.x):Math.abs(this.x);this.y=0>a.n13-a.n31?-Math.abs(this.y):Math.abs(this.y);this.z=0>a.n21-a.n12?-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);0===a?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},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},multiplySelf:function(a){var b=this.x,c=this.y,d=this.z,e=this.w,f=a.x,g=a.y,h=a.z,a=a.w;this.x=b*a+e*f+c*h-d*g;this.y=c*a+e*g+d*f-b*h;this.z=d*a+e*h+b*g-c*f;this.w=e*a-b*f-c*g-d*h;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,f=this.x,g=this.y,h=this.z,k=this.w,i=k*c+g*e-h*d,j=k*d+h*c-f*e,l=k*e+f*
-d-g*c,c=-f*c-g*d-h*e;b.x=i*k+c*-f+j*-h-l*-g;b.y=j*k+c*-g+l*-f-i*-h;b.z=l*k+c*-h+i*-g-j*-f;return b},clone:function(){return new THREE.Quaternion(this.x,this.y,this.z,this.w)}};
+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},multiplySelf:function(a){var b=this.x,c=this.y,d=this.z,e=this.w,f=a.x,g=a.y,i=a.z,a=a.w;this.x=b*a+e*f+c*i-d*g;this.y=c*a+e*g+d*f-b*i;this.z=d*a+e*i+b*g-c*f;this.w=e*a-b*f-c*g-d*i;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,f=this.x,g=this.y,i=this.z,k=this.w,h=k*c+g*e-i*d,j=k*d+i*c-f*e,l=k*e+f*
+d-g*c,c=-f*c-g*d-i*e;b.x=h*k+c*-f+j*-i-l*-g;b.y=j*k+c*-g+l*-f-h*-i;b.z=l*k+c*-i+h*-g-j*-f;return b},clone:function(){return new THREE.Quaternion(this.x,this.y,this.z,this.w)}};
 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;0>e?(c.w=-b.w,c.x=-b.x,c.y=-b.y,c.z=-b.z,e=-e):c.copy(b);if(1<=Math.abs(e))return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var f=Math.acos(e),e=Math.sqrt(1-e*e);if(0.001>Math.abs(e))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)*f)/e;d=Math.sin(d*f)/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.Vertex.prototype={constructor:THREE.Vertex,clone:function(){return new THREE.Vertex(this.position.clone())}};THREE.Face3=function(a,b,c,d,e,f){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.materialIndex=f;this.centroid=new THREE.Vector3};
 THREE.Face3.prototype={constructor:THREE.Face3,clone:function(){var a=new THREE.Face3(this.a,this.b,this.c);a.normal.copy(this.normal);a.color.copy(this.color);a.centroid.copy(this.centroid);a.materialIndex=this.materialIndex;var b,c;for(b=0,c=this.vertexNormals.length;b<c;b++)a.vertexNormals[b]=this.vertexNormals[b].clone();for(b=0,c=this.vertexColors.length;b<c;b++)a.vertexColors[b]=this.vertexColors[b].clone();for(b=0,c=this.vertexTangents.length;b<c;b++)a.vertexTangents[b]=this.vertexTangents[b].clone();
@@ -86,35 +86,37 @@ return a}};THREE.Face4=function(a,b,c,d,e,f,g){this.a=a;this.b=b;this.c=c;this.d
 THREE.Face4.prototype={constructor:THREE.Face4,clone:function(){var a=new THREE.Face4(this.a,this.b,this.c,this.d);a.normal.copy(this.normal);a.color.copy(this.color);a.centroid.copy(this.centroid);a.materialIndex=this.materialIndex;var b,c;for(b=0,c=this.vertexNormals.length;b<c;b++)a.vertexNormals[b]=this.vertexNormals[b].clone();for(b=0,c=this.vertexColors.length;b<c;b++)a.vertexColors[b]=this.vertexColors[b].clone();for(b=0,c=this.vertexTangents.length;b<c;b++)a.vertexTangents[b]=this.vertexTangents[b].clone();
 return a}};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},lerpSelf:function(a,b){this.u+=(a.u-this.u)*b;this.v+=(a.v-this.v)*b;return this},clone:function(){return new THREE.UV(this.u,this.v)}};THREE.Camera=function(){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.getRotationFromMatrix(this.matrix)};THREE.OrthographicCamera=function(a,b,c,d,e,f){THREE.Camera.call(this);this.left=a;this.right=b;this.top=c;this.bottom=d;this.near=void 0!==e?e:0.1;this.far=void 0!==f?f: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=void 0!==a?a:50;this.aspect=void 0!==b?b:1;this.near=void 0!==c?c:0.1;this.far=void 0!==d?d:2E3;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype=new THREE.Camera;
+THREE.OrthographicCamera.prototype.constructor=THREE.OrthographicCamera;THREE.OrthographicCamera.prototype.updateProjectionMatrix=function(){this.projectionMatrix.makeOrthographic(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=void 0!==a?a:50;this.aspect=void 0!==b?b:1;this.near=void 0!==c?c:0.1;this.far=void 0!==d?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((void 0!==b?b:24)/(2*a))*(180/Math.PI);this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype.setViewOffset=function(a,b,c,d,e,f){this.fullWidth=a;this.fullHeight=b;this.x=c;this.y=d;this.width=e;this.height=f;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.Material=function(a){a=a||{};this.id=THREE.MaterialCount++;this.name="";this.opacity=void 0!==a.opacity?a.opacity:1;this.transparent=void 0!==a.transparent?a.transparent:!1;this.blending=void 0!==a.blending?a.blending:THREE.NormalBlending;this.depthTest=void 0!==a.depthTest?a.depthTest:!0;this.depthWrite=void 0!==a.depthWrite?a.depthWrite:!0;this.polygonOffset=void 0!==a.polygonOffset?a.polygonOffset:!1;this.polygonOffsetFactor=void 0!==a.polygonOffsetFactor?a.polygonOffsetFactor:0;this.polygonOffsetUnits=
-void 0!==a.polygonOffsetUnits?a.polygonOffsetUnits:0;this.alphaTest=void 0!==a.alphaTest?a.alphaTest:0;this.overdraw=void 0!==a.overdraw?a.overdraw:!1;this.needsUpdate=!0};THREE.MaterialCount=0;THREE.NoShading=0;THREE.FlatShading=1;THREE.SmoothShading=2;THREE.NoColors=0;THREE.FaceColors=1;THREE.VertexColors=2;THREE.NoBlending=0;THREE.NormalBlending=1;THREE.AdditiveBlending=2;THREE.SubtractiveBlending=3;THREE.MultiplyBlending=4;THREE.AdditiveAlphaBlending=5;
+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.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.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.Material=function(a){a=a||{};this.id=THREE.MaterialCount++;this.name="";this.opacity=void 0!==a.opacity?a.opacity:1;this.transparent=void 0!==a.transparent?a.transparent:!1;this.blending=void 0!==a.blending?a.blending:THREE.NormalBlending;this.blendSrc=void 0!==a.blendSrc?a.blendSrc:THREE.SrcAlphaFactor;this.blendDst=void 0!==a.blendDst?a.blendDst:THREE.OneMinusSrcAlphaFactor;this.blendEquation=void 0!==a.blendEquation?a.blendEquation:THREE.AddEquation;this.depthTest=void 0!==a.depthTest?a.depthTest:
+!0;this.depthWrite=void 0!==a.depthWrite?a.depthWrite:!0;this.polygonOffset=void 0!==a.polygonOffset?a.polygonOffset:!1;this.polygonOffsetFactor=void 0!==a.polygonOffsetFactor?a.polygonOffsetFactor:0;this.polygonOffsetUnits=void 0!==a.polygonOffsetUnits?a.polygonOffsetUnits:0;this.alphaTest=void 0!==a.alphaTest?a.alphaTest:0;this.overdraw=void 0!==a.overdraw?a.overdraw:!1;this.needsUpdate=!0};THREE.MaterialCount=0;THREE.NoShading=0;THREE.FlatShading=1;THREE.SmoothShading=2;THREE.NoColors=0;
+THREE.FaceColors=1;THREE.VertexColors=2;THREE.NoBlending=0;THREE.NormalBlending=1;THREE.AdditiveBlending=2;THREE.SubtractiveBlending=3;THREE.MultiplyBlending=4;THREE.AdditiveAlphaBlending=5;THREE.CustomBlending=6;THREE.AddEquation=100;THREE.SubtractEquation=101;THREE.ReverseSubtractEquation=102;THREE.ZeroFactor=200;THREE.OneFactor=201;THREE.SrcColorFactor=202;THREE.OneMinusSrcColorFactor=203;THREE.SrcAlphaFactor=204;THREE.OneMinusSrcAlphaFactor=205;THREE.DstAlphaFactor=206;
+THREE.OneMinusDstAlphaFactor=207;THREE.DstColorFactor=208;THREE.OneMinusDstColorFactor=209;THREE.SrcAlphaSaturateFactor=210;
 THREE.LineBasicMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=void 0!==a.color?new THREE.Color(a.color):new THREE.Color(16777215);this.linewidth=void 0!==a.linewidth?a.linewidth:1;this.linecap=void 0!==a.linecap?a.linecap:"round";this.linejoin=void 0!==a.linejoin?a.linejoin:"round";this.vertexColors=a.vertexColors?a.vertexColors:!1;this.fog=void 0!==a.fog?a.fog:!0};THREE.LineBasicMaterial.prototype=new THREE.Material;THREE.LineBasicMaterial.prototype.constructor=THREE.LineBasicMaterial;
 THREE.MeshBasicMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=void 0!==a.color?new THREE.Color(a.color):new THREE.Color(16777215);this.map=void 0!==a.map?a.map:null;this.lightMap=void 0!==a.lightMap?a.lightMap:null;this.envMap=void 0!==a.envMap?a.envMap:null;this.combine=void 0!==a.combine?a.combine:THREE.MultiplyOperation;this.reflectivity=void 0!==a.reflectivity?a.reflectivity:1;this.refractionRatio=void 0!==a.refractionRatio?a.refractionRatio:0.98;this.fog=void 0!==a.fog?a.fog:
 !0;this.shading=void 0!==a.shading?a.shading:THREE.SmoothShading;this.wireframe=void 0!==a.wireframe?a.wireframe:!1;this.wireframeLinewidth=void 0!==a.wireframeLinewidth?a.wireframeLinewidth:1;this.wireframeLinecap=void 0!==a.wireframeLinecap?a.wireframeLinecap:"round";this.wireframeLinejoin=void 0!==a.wireframeLinejoin?a.wireframeLinejoin:"round";this.vertexColors=void 0!==a.vertexColors?a.vertexColors:THREE.NoColors;this.skinning=void 0!==a.skinning?a.skinning:!1;this.morphTargets=void 0!==a.morphTargets?
 a.morphTargets:!1};THREE.MeshBasicMaterial.prototype=new THREE.Material;THREE.MeshBasicMaterial.prototype.constructor=THREE.MeshBasicMaterial;
 THREE.ParticleBasicMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=void 0!==a.color?new THREE.Color(a.color):new THREE.Color(16777215);this.map=void 0!==a.map?a.map:null;this.size=void 0!==a.size?a.size:1;this.sizeAttenuation=void 0!==a.sizeAttenuation?a.sizeAttenuation:!0;this.vertexColors=void 0!==a.vertexColors?a.vertexColors:!1;this.fog=void 0!==a.fog?a.fog:!0};THREE.ParticleBasicMaterial.prototype=new THREE.Material;THREE.ParticleBasicMaterial.prototype.constructor=THREE.ParticleBasicMaterial;
 THREE.ParticleDOMMaterial=function(a){THREE.Material.call(this);this.domElement=a};
-THREE.Texture=function(a,b,c,d,e,f,g,h){this.id=THREE.TextureCount++;this.image=a;this.mapping=void 0!==b?b:new THREE.UVMapping;this.wrapS=void 0!==c?c:THREE.ClampToEdgeWrapping;this.wrapT=void 0!==d?d:THREE.ClampToEdgeWrapping;this.magFilter=void 0!==e?e:THREE.LinearFilter;this.minFilter=void 0!==f?f:THREE.LinearMipMapLinearFilter;this.format=void 0!==g?g:THREE.RGBAFormat;this.type=void 0!==h?h:THREE.UnsignedByteType;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.generateMipmaps=
-!0;this.needsUpdate=!1;this.onUpdate=null};THREE.Texture.prototype={constructor:THREE.Texture,clone:function(){var a=new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter,this.format,this.type);a.offset.copy(this.offset);a.repeat.copy(this.repeat);return a}};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(a,b,c,d,e,f,g,h,k,i){THREE.Texture.call(this,null,f,g,h,k,i,d,e);this.image={data:a,width:b,height:c}};THREE.DataTexture.prototype=new THREE.Texture;THREE.DataTexture.prototype.constructor=THREE.DataTexture;
+THREE.Texture=function(a,b,c,d,e,f,g,i){this.id=THREE.TextureCount++;this.image=a;this.mapping=void 0!==b?b:new THREE.UVMapping;this.wrapS=void 0!==c?c:THREE.ClampToEdgeWrapping;this.wrapT=void 0!==d?d:THREE.ClampToEdgeWrapping;this.magFilter=void 0!==e?e:THREE.LinearFilter;this.minFilter=void 0!==f?f:THREE.LinearMipMapLinearFilter;this.format=void 0!==g?g:THREE.RGBAFormat;this.type=void 0!==i?i:THREE.UnsignedByteType;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.generateMipmaps=
+!0;this.needsUpdate=this.premultiplyAlpha=!1;this.onUpdate=null};THREE.Texture.prototype={constructor:THREE.Texture,clone:function(){var a=new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter,this.format,this.type);a.offset.copy(this.offset);a.repeat.copy(this.repeat);return a}};THREE.TextureCount=0;THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.UVMapping=function(){};THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};
+THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=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(a,b,c,d,e,f,g,i,k,h){THREE.Texture.call(this,null,f,g,i,k,h,d,e);this.image={data:a,width:b,height:c}};THREE.DataTexture.prototype=new THREE.Texture;THREE.DataTexture.prototype.constructor=THREE.DataTexture;
 THREE.DataTexture.prototype.clone=function(){var a=new THREE.DataTexture(this.image.data,this.image.width,this.image.height,this.format,this.type,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter);a.offset.copy(this.offset);a.repeat.copy(this.repeat);return a};THREE.Particle=function(a){THREE.Object3D.call(this);this.material=a};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;
 THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material=void 0!==b?b:new THREE.MeshBasicMaterial({color:16777215*Math.random(),wireframe:!0});if(this.geometry&&(this.geometry.boundingSphere||this.geometry.computeBoundingSphere(),this.boundRadius=a.boundingSphere.radius,this.geometry.morphTargets.length)){this.morphTargetBase=-1;this.morphTargetForcedOrder=[];this.morphTargetInfluences=[];this.morphTargetDictionary={};for(var c=0;c<this.geometry.morphTargets.length;c++)this.morphTargetInfluences.push(0),
 this.morphTargetDictionary[this.geometry.morphTargets[c].name]=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(void 0!==this.morphTargetDictionary[a])return this.morphTargetDictionary[a];console.log("THREE.Mesh.getMorphTargetIndexByName: morph target "+a+" does not exist. Returning 0.");return 0};
 THREE.Line=function(a,b,c){THREE.Object3D.call(this);this.geometry=a;this.material=void 0!==b?b:new THREE.LineBasicMaterial({color:16777215*Math.random()});this.type=void 0!==c?c:THREE.LineStrip;this.geometry&&(this.geometry.boundingSphere||this.geometry.computeBoundingSphere())};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;THREE.Bone=function(a){THREE.Object3D.call(this);this.skin=a;this.skinMatrix=new THREE.Matrix4};
 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){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 c,d=this.children.length;for(c=0;c<d;c++)this.children[c].update(this.skinMatrix,b)};
-THREE.Sprite=function(a){THREE.Object3D.call(this);this.color=void 0!==a.color?new THREE.Color(a.color):new THREE.Color(16777215);this.map=void 0!==a.map?a.map:new THREE.Texture;this.blending=void 0!==a.blending?a.blending:THREE.NormalBlending;this.useScreenCoordinates=void 0!==a.useScreenCoordinates?a.useScreenCoordinates:!0;this.mergeWith3D=void 0!==a.mergeWith3D?a.mergeWith3D:!this.useScreenCoordinates;this.affectedByDistance=void 0!==a.affectedByDistance?a.affectedByDistance:!this.useScreenCoordinates;
-this.scaleByViewport=void 0!==a.scaleByViewport?a.scaleByViewport:!this.affectedByDistance;this.alignment=a.alignment instanceof THREE.Vector2?a.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.updateMatrix=function(){this.matrix.setPosition(this.position);this.rotation3d.set(0,0,this.rotation);this.matrix.setRotationFromEuler(this.rotation3d);if(1!==this.scale.x||1!==this.scale.y)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.overrideMaterial=this.fog=null;this.matrixAutoUpdate=!1;this.__objects=[];this.__lights=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;
+THREE.Sprite=function(a){THREE.Object3D.call(this);this.color=void 0!==a.color?new THREE.Color(a.color):new THREE.Color(16777215);this.map=void 0!==a.map?a.map:new THREE.Texture;this.blending=void 0!==a.blending?a.blending:THREE.NormalBlending;this.blendSrc=void 0!==a.blendSrc?a.blendSrc:THREE.SrcAlphaFactor;this.blendDst=void 0!==a.blendDst?a.blendDst:THREE.OneMinusSrcAlphaFactor;this.blendEquation=void 0!==a.blendEquation?a.blendEquation:THREE.AddEquation;this.useScreenCoordinates=void 0!==a.useScreenCoordinates?
+a.useScreenCoordinates:!0;this.mergeWith3D=void 0!==a.mergeWith3D?a.mergeWith3D:!this.useScreenCoordinates;this.affectedByDistance=void 0!==a.affectedByDistance?a.affectedByDistance:!this.useScreenCoordinates;this.scaleByViewport=void 0!==a.scaleByViewport?a.scaleByViewport:!this.affectedByDistance;this.alignment=a.alignment instanceof THREE.Vector2?a.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.updateMatrix=function(){this.matrix.setPosition(this.position);this.rotation3d.set(0,0,this.rotation);this.matrix.setRotationFromEuler(this.rotation3d);if(1!==this.scale.x||1!==this.scale.y)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.overrideMaterial=this.fog=null;this.matrixAutoUpdate=!1;this.__objects=[];this.__lights=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;
 THREE.Scene.prototype.__addObject=function(a){if(a instanceof THREE.Light)-1===this.__lights.indexOf(a)&&this.__lights.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&-1===this.__objects.indexOf(a)){this.__objects.push(a);this.__objectsAdded.push(a);var b=this.__objectsRemoved.indexOf(a);-1!==b&&this.__objectsRemoved.splice(b,1)}for(b=0;b<a.children.length;b++)this.__addObject(a.children[b])};
 THREE.Scene.prototype.__removeObject=function(a){if(a instanceof THREE.Light){var b=this.__lights.indexOf(a);-1!==b&&this.__lights.splice(b,1)}else a instanceof THREE.Camera||(b=this.__objects.indexOf(a),-1!==b&&(this.__objects.splice(b,1),this.__objectsRemoved.push(a),b=this.__objectsAdded.indexOf(a),-1!==b&&this.__objectsAdded.splice(b,1)));for(b=0;b<a.children.length;b++)this.__removeObject(a.children[b])};
-THREE.DOMRenderer=function(){var a,b,c,d,e,f,g,h=new THREE.Projector;g=function(a){for(var b=document.documentElement,c=0;c<a.length;c++)if("string"===typeof b.style[a[c]])return a[c];return null}(["transform","MozTransform","WebkitTransform","msTransform","OTransform"]);this.domElement=document.createElement("div");this.setSize=function(a,b){c=a;d=b;e=c/2;f=d/2};this.render=function(c,d){var j,l,n,m,p,o;a=h.projectScene(c,d);b=a.elements;for(j=0,l=b.length;j<l;j++)if(n=b[j],n instanceof THREE.RenderableParticle&&
+THREE.DOMRenderer=function(){var a,b,c,d,e,f,g,i=new THREE.Projector;g=function(a){for(var b=document.documentElement,c=0;c<a.length;c++)if("string"===typeof b.style[a[c]])return a[c];return null}(["transform","MozTransform","WebkitTransform","msTransform","OTransform"]);this.domElement=document.createElement("div");this.setSize=function(a,b){c=a;d=b;e=c/2;f=d/2};this.render=function(c,d){var j,l,n,m,p,o;a=i.projectScene(c,d);b=a.elements;for(j=0,l=b.length;j<l;j++)if(n=b[j],n instanceof THREE.RenderableParticle&&
 n.material instanceof THREE.ParticleDOMMaterial)m=n.material.domElement,p=n.x*e+e-(m.offsetWidth>>1),o=n.y*f+f-(m.offsetHeight>>1),m.style.left=p+"px",m.style.top=o+"px",m.style.zIndex=Math.abs(Math.floor((1-n.z)*d.far/d.near)),g&&(m.style[g]="scale("+n.scale.x*e+","+n.scale.y*f+")")}};THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.material=null};
 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.faceMaterial=this.material=null;this.uvs=[[]];this.z=null};

+ 296 - 295
build/custom/ThreeExtras.js

@@ -1,32 +1,32 @@
 // ThreeExtras.js - http://github.com/mrdoob/three.js
-'use strict';THREE.ColorUtils={adjustHSV:function(a,b,c,d){var f=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(a,f);f.h=THREE.Math.clamp(f.h+b,0,1);f.s=THREE.Math.clamp(f.s+c,0,1);f.v=THREE.Math.clamp(f.v+d,0,1);a.setHSV(f.h,f.s,f.v)},rgbToHsv:function(a,b){var c=a.r,d=a.g,f=a.b,e=Math.max(Math.max(c,d),f),g=Math.min(Math.min(c,d),f);if(g===e)g=c=0;else{var h=e-g,g=h/e,c=(c===e?(d-f)/h:d===e?2+(f-c)/h:4+(c-d)/h)/6;0>c&&(c+=1);1<c&&(c-=1)}void 0===b&&(b={h:0,s:0,v:0});b.h=c;b.s=g;b.v=e;return b}};
+'use strict';THREE.ColorUtils={adjustHSV:function(a,b,c,d){var e=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(a,e);e.h=THREE.Math.clamp(e.h+b,0,1);e.s=THREE.Math.clamp(e.s+c,0,1);e.v=THREE.Math.clamp(e.v+d,0,1);a.setHSV(e.h,e.s,e.v)},rgbToHsv:function(a,b){var c=a.r,d=a.g,e=a.b,f=Math.max(Math.max(c,d),e),g=Math.min(Math.min(c,d),e);if(g===f)g=c=0;else{var h=f-g,g=h/f,c=(c===f?(d-e)/h:d===f?2+(e-c)/h:4+(c-d)/h)/6;0>c&&(c+=1);1<c&&(c-=1)}void 0===b&&(b={h:0,s:0,v:0});b.h=c;b.s=g;b.v=f;return b}};
 THREE.ColorUtils.__hsv={h:0,s:0,v:0};
-THREE.GeometryUtils={merge:function(a,b){for(var c,d,f=a.vertices.length,e=b instanceof THREE.Mesh?b.geometry:b,g=a.vertices,h=e.vertices,i=a.faces,j=e.faces,k=a.faceVertexUvs[0],p=e.faceVertexUvs[0],l={},m=0;m<a.materials.length;m++)l[a.materials[m].id]=m;if(b instanceof THREE.Mesh)b.matrixAutoUpdate&&b.updateMatrix(),c=b.matrix,d=new THREE.Matrix4,d.extractRotation(c,b.scale);for(var m=0,r=h.length;m<r;m++){var n=h[m].clone();c&&c.multiplyVector3(n.position);g.push(n)}for(m=0,r=j.length;m<r;m++){var g=
-j[m],o,q,u=g.vertexNormals,s=g.vertexColors;g instanceof THREE.Face3?o=new THREE.Face3(g.a+f,g.b+f,g.c+f):g instanceof THREE.Face4&&(o=new THREE.Face4(g.a+f,g.b+f,g.c+f,g.d+f));o.normal.copy(g.normal);d&&d.multiplyVector3(o.normal);h=0;for(n=u.length;h<n;h++)q=u[h].clone(),d&&d.multiplyVector3(q),o.vertexNormals.push(q);o.color.copy(g.color);h=0;for(n=s.length;h<n;h++)q=s[h],o.vertexColors.push(q.clone());if(void 0!==g.materialIndex){h=e.materials[g.materialIndex];n=h.id;s=l[n];if(void 0===s)s=a.materials.length,
-l[n]=s,a.materials.push(h);o.materialIndex=s}o.centroid.copy(g.centroid);c&&c.multiplyVector3(o.centroid);i.push(o)}for(m=0,r=p.length;m<r;m++){c=p[m];d=[];h=0;for(n=c.length;h<n;h++)d.push(new THREE.UV(c[h].u,c[h].v));k.push(d)}},clone:function(a){var b=new THREE.Geometry,c,d=a.vertices,f=a.faces,e=a.faceVertexUvs[0];if(a.materials)b.materials=a.materials.slice();for(a=0,c=d.length;a<c;a++)b.vertices.push(d[a].clone());for(a=0,c=f.length;a<c;a++)b.faces.push(f[a].clone());for(a=0,c=e.length;a<c;a++){for(var d=
-e[a],f=[],g=0,h=d.length;g<h;g++)f.push(new THREE.UV(d[g].u,d[g].v));b.faceVertexUvs[0].push(f)}return b},randomPointInTriangle:function(a,b,c){var d,f,e,g=new THREE.Vector3,h=THREE.GeometryUtils.__v1;d=THREE.GeometryUtils.random();f=THREE.GeometryUtils.random();1<d+f&&(d=1-d,f=1-f);e=1-d-f;g.copy(a);g.multiplyScalar(d);h.copy(b);h.multiplyScalar(f);g.addSelf(h);h.copy(c);h.multiplyScalar(e);g.addSelf(h);return g},randomPointInFace:function(a,b,c){var d,f,e;if(a instanceof THREE.Face3)return d=b.vertices[a.a].position,
-f=b.vertices[a.b].position,e=b.vertices[a.c].position,THREE.GeometryUtils.randomPointInTriangle(d,f,e);if(a instanceof THREE.Face4){d=b.vertices[a.a].position;f=b.vertices[a.b].position;e=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(d,f,b),g=THREE.GeometryUtils.triangleArea(f,e,b),a._area1=c,a._area2=g):(c=THREE.GeometryUtils.triangleArea(d,f,b),g=THREE.GeometryUtils.triangleArea(f,e,b));return THREE.GeometryUtils.random()*
-(c+g)<c?THREE.GeometryUtils.randomPointInTriangle(d,f,b):THREE.GeometryUtils.randomPointInTriangle(f,e,b)}},randomPointsInGeometry:function(a,b){function c(a){function b(c,d){if(d<c)return c;var f=c+Math.floor((d-c)/2);return j[f]>a?b(c,f-1):j[f]<a?b(f+1,d):f}return b(0,j.length-1)}var d,f,e=a.faces,g=a.vertices,h=e.length,i=0,j=[],k,p,l,m;for(f=0;f<h;f++){d=e[f];if(d instanceof THREE.Face3)k=g[d.a].position,p=g[d.b].position,l=g[d.c].position,d._area=THREE.GeometryUtils.triangleArea(k,p,l);else if(d instanceof
-THREE.Face4)k=g[d.a].position,p=g[d.b].position,l=g[d.c].position,m=g[d.d].position,d._area1=THREE.GeometryUtils.triangleArea(k,p,m),d._area2=THREE.GeometryUtils.triangleArea(p,l,m),d._area=d._area1+d._area2;i+=d._area;j[f]=i}d=[];for(f=0;f<b;f++)g=THREE.GeometryUtils.random()*i,g=c(g),d[f]=THREE.GeometryUtils.randomPointInFace(e[g],a,!0);return d},triangleArea:function(a,b,c){var d,f=THREE.GeometryUtils.__v1;f.sub(a,b);d=f.length();f.sub(a,c);a=f.length();f.sub(b,c);c=f.length();b=0.5*(d+a+c);return Math.sqrt(b*
-(b-d)*(b-a)*(b-c))},center:function(a){a.computeBoundingBox();var b=a.boundingBox,c=new THREE.Vector3;c.add(b.min,b.max);c.multiplyScalar(-0.5);a.applyMatrix((new THREE.Matrix4).setTranslation(c.x,c.y,c.z));a.computeBoundingBox();return c},normalizeUVs:function(a){for(var a=a.faceVertexUvs[0],b=0,c=a.length;b<c;b++)for(var d=a[b],f=0,e=d.length;f<e;f++)1!==d[f].u&&(d[f].u-=Math.floor(d[f].u)),1!==d[f].v&&(d[f].v-=Math.floor(d[f].v))},triangulateQuads:function(a){var b,c,d,f,e=[],g=[],h=[];for(b=0,
-c=a.faceUvs.length;b<c;b++)g[b]=[];for(b=0,c=a.faceVertexUvs.length;b<c;b++)h[b]=[];for(b=0,c=a.faces.length;b<c;b++)if(d=a.faces[b],d instanceof THREE.Face4){f=d.a;var i=d.b,j=d.c,k=d.d,p=new THREE.Face3,l=new THREE.Face3;p.color.copy(d.color);l.color.copy(d.color);p.materialIndex=d.materialIndex;l.materialIndex=d.materialIndex;p.a=f;p.b=i;p.c=k;l.a=i;l.b=j;l.c=k;4===d.vertexColors.length&&(p.vertexColors[0]=d.vertexColors[0].clone(),p.vertexColors[1]=d.vertexColors[1].clone(),p.vertexColors[2]=
-d.vertexColors[3].clone(),l.vertexColors[0]=d.vertexColors[1].clone(),l.vertexColors[1]=d.vertexColors[2].clone(),l.vertexColors[2]=d.vertexColors[3].clone());e.push(p,l);for(d=0,f=a.faceVertexUvs.length;d<f;d++)a.faceVertexUvs[d].length&&(p=a.faceVertexUvs[d][b],i=p[1],j=p[2],k=p[3],p=[p[0].clone(),i.clone(),k.clone()],i=[i.clone(),j.clone(),k.clone()],h[d].push(p,i));for(d=0,f=a.faceUvs.length;d<f;d++)a.faceUvs[d].length&&(i=a.faceUvs[d][b],g[d].push(i,i))}else{e.push(d);for(d=0,f=a.faceUvs.length;d<
-f;d++)g[d].push(a.faceUvs[d]);for(d=0,f=a.faceVertexUvs.length;d<f;d++)h[d].push(a.faceVertexUvs[d])}a.faces=e;a.faceUvs=g;a.faceVertexUvs=h;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals();a.hasTangents&&a.computeTangents()},explode:function(a){for(var b=[],c=0,d=a.faces.length;c<d;c++){var f=b.length,e=a.faces[c];if(e instanceof THREE.Face4){var g=e.a,h=e.b,i=e.c,g=a.vertices[g],h=a.vertices[h],i=a.vertices[i],j=a.vertices[e.d];b.push(g.clone());b.push(h.clone());b.push(i.clone());
-b.push(j.clone());e.a=f;e.b=f+1;e.c=f+2;e.d=f+3}else g=e.a,h=e.b,i=e.c,g=a.vertices[g],h=a.vertices[h],i=a.vertices[i],b.push(g.clone()),b.push(h.clone()),b.push(i.clone()),e.a=f,e.b=f+1,e.c=f+2}a.vertices=b;delete a.__tmpVertices},tessellate:function(a,b){var c,d,f,e,g,h,i,j,k,p,l,m,r,n,o,q,u,s,t,v=[],w=[];for(c=0,d=a.faceVertexUvs.length;c<d;c++)w[c]=[];for(c=0,d=a.faces.length;c<d;c++)if(f=a.faces[c],f instanceof THREE.Face3)if(e=f.a,g=f.b,h=f.c,j=a.vertices[e],k=a.vertices[g],p=a.vertices[h],
-m=j.position.distanceTo(k.position),r=k.position.distanceTo(p.position),l=j.position.distanceTo(p.position),m>b||r>b||l>b){i=a.vertices.length;s=f.clone();t=f.clone();m>=r&&m>=l?(j=j.clone(),j.position.lerpSelf(k.position,0.5),s.a=e,s.b=i,s.c=h,t.a=i,t.b=g,t.c=h,3===f.vertexNormals.length&&(e=f.vertexNormals[0].clone(),e.lerpSelf(f.vertexNormals[1],0.5),s.vertexNormals[1].copy(e),t.vertexNormals[0].copy(e)),3===f.vertexColors.length&&(e=f.vertexColors[0].clone(),e.lerpSelf(f.vertexColors[1],0.5),
-s.vertexColors[1].copy(e),t.vertexColors[0].copy(e)),f=0):r>=m&&r>=l?(j=k.clone(),j.position.lerpSelf(p.position,0.5),s.a=e,s.b=g,s.c=i,t.a=i,t.b=h,t.c=e,3===f.vertexNormals.length&&(e=f.vertexNormals[1].clone(),e.lerpSelf(f.vertexNormals[2],0.5),s.vertexNormals[2].copy(e),t.vertexNormals[0].copy(e),t.vertexNormals[1].copy(f.vertexNormals[2]),t.vertexNormals[2].copy(f.vertexNormals[0])),3===f.vertexColors.length&&(e=f.vertexColors[1].clone(),e.lerpSelf(f.vertexColors[2],0.5),s.vertexColors[2].copy(e),
-t.vertexColors[0].copy(e),t.vertexColors[1].copy(f.vertexColors[2]),t.vertexColors[2].copy(f.vertexColors[0])),f=1):(j=j.clone(),j.position.lerpSelf(p.position,0.5),s.a=e,s.b=g,s.c=i,t.a=i,t.b=g,t.c=h,3===f.vertexNormals.length&&(e=f.vertexNormals[0].clone(),e.lerpSelf(f.vertexNormals[2],0.5),s.vertexNormals[2].copy(e),t.vertexNormals[0].copy(e)),3===f.vertexColors.length&&(e=f.vertexColors[0].clone(),e.lerpSelf(f.vertexColors[2],0.5),s.vertexColors[2].copy(e),t.vertexColors[0].copy(e)),f=2);v.push(s,
-t);a.vertices.push(j);for(e=0,g=a.faceVertexUvs.length;e<g;e++)a.faceVertexUvs[e].length&&(j=a.faceVertexUvs[e][c],t=j[0],h=j[1],s=j[2],0===f?(k=t.clone(),k.lerpSelf(h,0.5),j=[t.clone(),k.clone(),s.clone()],h=[k.clone(),h.clone(),s.clone()]):1===f?(k=h.clone(),k.lerpSelf(s,0.5),j=[t.clone(),h.clone(),k.clone()],h=[k.clone(),s.clone(),t.clone()]):(k=t.clone(),k.lerpSelf(s,0.5),j=[t.clone(),h.clone(),k.clone()],h=[k.clone(),h.clone(),s.clone()]),w[e].push(j,h))}else{v.push(f);for(e=0,g=a.faceVertexUvs.length;e<
-g;e++)w[e].push(a.faceVertexUvs[e])}else if(e=f.a,g=f.b,h=f.c,i=f.d,j=a.vertices[e],k=a.vertices[g],p=a.vertices[h],l=a.vertices[i],m=j.position.distanceTo(k.position),r=k.position.distanceTo(p.position),n=p.position.distanceTo(l.position),o=j.position.distanceTo(l.position),m>b||r>b||n>b||o>b){q=a.vertices.length;u=a.vertices.length+1;s=f.clone();t=f.clone();m>=r&&m>=n&&m>=o||n>=r&&n>=m&&n>=o?(m=j.clone(),m.position.lerpSelf(k.position,0.5),k=p.clone(),k.position.lerpSelf(l.position,0.5),s.a=e,s.b=
-q,s.c=u,s.d=i,t.a=q,t.b=g,t.c=h,t.d=u,4===f.vertexNormals.length&&(e=f.vertexNormals[0].clone(),e.lerpSelf(f.vertexNormals[1],0.5),g=f.vertexNormals[2].clone(),g.lerpSelf(f.vertexNormals[3],0.5),s.vertexNormals[1].copy(e),s.vertexNormals[2].copy(g),t.vertexNormals[0].copy(e),t.vertexNormals[3].copy(g)),4===f.vertexColors.length&&(e=f.vertexColors[0].clone(),e.lerpSelf(f.vertexColors[1],0.5),g=f.vertexColors[2].clone(),g.lerpSelf(f.vertexColors[3],0.5),s.vertexColors[1].copy(e),s.vertexColors[2].copy(g),
-t.vertexColors[0].copy(e),t.vertexColors[3].copy(g)),f=0):(m=k.clone(),m.position.lerpSelf(p.position,0.5),k=l.clone(),k.position.lerpSelf(j.position,0.5),s.a=e,s.b=g,s.c=q,s.d=u,t.a=u,t.b=q,t.c=h,t.d=i,4===f.vertexNormals.length&&(e=f.vertexNormals[1].clone(),e.lerpSelf(f.vertexNormals[2],0.5),g=f.vertexNormals[3].clone(),g.lerpSelf(f.vertexNormals[0],0.5),s.vertexNormals[2].copy(e),s.vertexNormals[3].copy(g),t.vertexNormals[0].copy(g),t.vertexNormals[1].copy(e)),4===f.vertexColors.length&&(e=f.vertexColors[1].clone(),
-e.lerpSelf(f.vertexColors[2],0.5),g=f.vertexColors[3].clone(),g.lerpSelf(f.vertexColors[0],0.5),s.vertexColors[2].copy(e),s.vertexColors[3].copy(g),t.vertexColors[0].copy(g),t.vertexColors[1].copy(e)),f=1);v.push(s,t);a.vertices.push(m,k);for(e=0,g=a.faceVertexUvs.length;e<g;e++)a.faceVertexUvs[e].length&&(j=a.faceVertexUvs[e][c],t=j[0],h=j[1],s=j[2],j=j[3],0===f?(k=t.clone(),k.lerpSelf(h,0.5),p=s.clone(),p.lerpSelf(j,0.5),t=[t.clone(),k.clone(),p.clone(),j.clone()],h=[k.clone(),h.clone(),s.clone(),
-p.clone()]):(k=h.clone(),k.lerpSelf(s,0.5),p=j.clone(),p.lerpSelf(t,0.5),t=[t.clone(),h.clone(),k.clone(),p.clone()],h=[p.clone(),k.clone(),s.clone(),j.clone()]),w[e].push(t,h))}else{v.push(f);for(e=0,g=a.faceVertexUvs.length;e<g;e++)w[e].push(a.faceVertexUvs[e])}a.faces=v;a.faceVertexUvs=w}};THREE.GeometryUtils.random=THREE.Math.random16;THREE.GeometryUtils.__v1=new THREE.Vector3;
-THREE.ImageUtils={crossOrigin:"anonymous",loadTexture:function(a,b,c){var d=new Image,f=new THREE.Texture(d,b);d.onload=function(){f.needsUpdate=!0;c&&c(this)};d.crossOrigin=this.crossOrigin;d.src=a;return f},loadTextureCube:function(a,b,c){var d,f=[],e=new THREE.Texture(f,b);f.loadCount=0;for(b=0,d=a.length;b<d;++b)f[b]=new Image,f[b].onload=function(){f.loadCount+=1;if(6===f.loadCount)e.needsUpdate=!0;c&&c(this)},f[b].crossOrigin=this.crossOrigin,f[b].src=a[b];return e},getNormalMap:function(a,
-b){var c=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]},b=b|1,d=a.width,f=a.height,e=document.createElement("canvas");e.width=d;e.height=f;var g=e.getContext("2d");g.drawImage(a,0,0);for(var h=g.getImageData(0,0,d,f).data,i=g.createImageData(d,f),j=i.data,k=0;k<d;k++)for(var p=1;p<f;p++){var l=0>p-1?f-1:p-1,m=(p+1)%f,r=0>k-1?d-1:k-1,n=(k+1)%d,o=[],q=[0,0,h[4*(p*d+k)]/255*b];o.push([-1,0,h[4*(p*d+r)]/255*b]);o.push([-1,-1,h[4*(l*d+r)]/255*b]);o.push([0,-1,
-h[4*(l*d+k)]/255*b]);o.push([1,-1,h[4*(l*d+n)]/255*b]);o.push([1,0,h[4*(p*d+n)]/255*b]);o.push([1,1,h[4*(m*d+n)]/255*b]);o.push([0,1,h[4*(m*d+k)]/255*b]);o.push([-1,1,h[4*(m*d+r)]/255*b]);l=[];r=o.length;for(m=0;m<r;m++){var n=o[m],u=o[(m+1)%r],n=[n[0]-q[0],n[1]-q[1],n[2]-q[2]],u=[u[0]-q[0],u[1]-q[1],u[2]-q[2]];l.push(c([n[1]*u[2]-n[2]*u[1],n[2]*u[0]-n[0]*u[2],n[0]*u[1]-n[1]*u[0]]))}o=[0,0,0];for(m=0;m<l.length;m++)o[0]+=l[m][0],o[1]+=l[m][1],o[2]+=l[m][2];o[0]/=l.length;o[1]/=l.length;o[2]/=l.length;
-q=4*(p*d+k);j[q]=255*((o[0]+1)/2)|0;j[q+1]=255*(o[1]+0.5)|0;j[q+2]=255*o[2]|0;j[q+3]=255}g.putImageData(i,0,0);return e},generateDataTexture:function(a,b,c){for(var d=a*b,f=new Uint8Array(3*d),e=Math.floor(255*c.r),g=Math.floor(255*c.g),c=Math.floor(255*c.b),h=0;h<d;h++)f[3*h]=e,f[3*h+1]=g,f[3*h+2]=c;a=new THREE.DataTexture(f,a,b,THREE.RGBFormat);a.needsUpdate=!0;return a}};
-THREE.SceneUtils={showHierarchy:function(a,b){THREE.SceneUtils.traverseHierarchy(a,function(a){a.visible=b})},traverseHierarchy:function(a,b){var c,d,f=a.children.length;for(d=0;d<f;d++)c=a.children[d],b(c),THREE.SceneUtils.traverseHierarchy(c,b)},createMultiMaterialObject:function(a,b){var c,d=b.length,f=new THREE.Object3D;for(c=0;c<d;c++){var e=new THREE.Mesh(a,b[c]);f.add(e)}return f},cloneObject:function(a){var b;a instanceof THREE.MorphAnimMesh?(b=new THREE.MorphAnimMesh(a.geometry,a.material),
+THREE.GeometryUtils={merge:function(a,b){for(var c,d,e=a.vertices.length,f=b instanceof THREE.Mesh?b.geometry:b,g=a.vertices,h=f.vertices,i=a.faces,j=f.faces,k=a.faceVertexUvs[0],o=f.faceVertexUvs[0],l={},m=0;m<a.materials.length;m++)l[a.materials[m].id]=m;if(b instanceof THREE.Mesh)b.matrixAutoUpdate&&b.updateMatrix(),c=b.matrix,d=new THREE.Matrix4,d.extractRotation(c,b.scale);for(var m=0,q=h.length;m<q;m++){var n=h[m].clone();c&&c.multiplyVector3(n.position);g.push(n)}for(m=0,q=j.length;m<q;m++){var g=
+j[m],p,r,t=g.vertexNormals,s=g.vertexColors;g instanceof THREE.Face3?p=new THREE.Face3(g.a+e,g.b+e,g.c+e):g instanceof THREE.Face4&&(p=new THREE.Face4(g.a+e,g.b+e,g.c+e,g.d+e));p.normal.copy(g.normal);d&&d.multiplyVector3(p.normal);h=0;for(n=t.length;h<n;h++)r=t[h].clone(),d&&d.multiplyVector3(r),p.vertexNormals.push(r);p.color.copy(g.color);h=0;for(n=s.length;h<n;h++)r=s[h],p.vertexColors.push(r.clone());if(void 0!==g.materialIndex){h=f.materials[g.materialIndex];n=h.id;s=l[n];if(void 0===s)s=a.materials.length,
+l[n]=s,a.materials.push(h);p.materialIndex=s}p.centroid.copy(g.centroid);c&&c.multiplyVector3(p.centroid);i.push(p)}for(m=0,q=o.length;m<q;m++){c=o[m];d=[];h=0;for(n=c.length;h<n;h++)d.push(new THREE.UV(c[h].u,c[h].v));k.push(d)}},clone:function(a){var b=new THREE.Geometry,c,d=a.vertices,e=a.faces,f=a.faceVertexUvs[0];if(a.materials)b.materials=a.materials.slice();for(a=0,c=d.length;a<c;a++)b.vertices.push(d[a].clone());for(a=0,c=e.length;a<c;a++)b.faces.push(e[a].clone());for(a=0,c=f.length;a<c;a++){for(var d=
+f[a],e=[],g=0,h=d.length;g<h;g++)e.push(new THREE.UV(d[g].u,d[g].v));b.faceVertexUvs[0].push(e)}return b},randomPointInTriangle:function(a,b,c){var d,e,f,g=new THREE.Vector3,h=THREE.GeometryUtils.__v1;d=THREE.GeometryUtils.random();e=THREE.GeometryUtils.random();1<d+e&&(d=1-d,e=1-e);f=1-d-e;g.copy(a);g.multiplyScalar(d);h.copy(b);h.multiplyScalar(e);g.addSelf(h);h.copy(c);h.multiplyScalar(f);g.addSelf(h);return g},randomPointInFace:function(a,b,c){var d,e,f;if(a instanceof THREE.Face3)return d=b.vertices[a.a].position,
+e=b.vertices[a.b].position,f=b.vertices[a.c].position,THREE.GeometryUtils.randomPointInTriangle(d,e,f);if(a instanceof THREE.Face4){d=b.vertices[a.a].position;e=b.vertices[a.b].position;f=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(d,e,b),g=THREE.GeometryUtils.triangleArea(e,f,b),a._area1=c,a._area2=g):(c=THREE.GeometryUtils.triangleArea(d,e,b),g=THREE.GeometryUtils.triangleArea(e,f,b));return THREE.GeometryUtils.random()*
+(c+g)<c?THREE.GeometryUtils.randomPointInTriangle(d,e,b):THREE.GeometryUtils.randomPointInTriangle(e,f,b)}},randomPointsInGeometry:function(a,b){function c(a){function b(c,d){if(d<c)return c;var e=c+Math.floor((d-c)/2);return j[e]>a?b(c,e-1):j[e]<a?b(e+1,d):e}return b(0,j.length-1)}var d,e,f=a.faces,g=a.vertices,h=f.length,i=0,j=[],k,o,l,m;for(e=0;e<h;e++){d=f[e];if(d instanceof THREE.Face3)k=g[d.a].position,o=g[d.b].position,l=g[d.c].position,d._area=THREE.GeometryUtils.triangleArea(k,o,l);else if(d instanceof
+THREE.Face4)k=g[d.a].position,o=g[d.b].position,l=g[d.c].position,m=g[d.d].position,d._area1=THREE.GeometryUtils.triangleArea(k,o,m),d._area2=THREE.GeometryUtils.triangleArea(o,l,m),d._area=d._area1+d._area2;i+=d._area;j[e]=i}d=[];for(e=0;e<b;e++)g=THREE.GeometryUtils.random()*i,g=c(g),d[e]=THREE.GeometryUtils.randomPointInFace(f[g],a,!0);return d},triangleArea:function(a,b,c){var d,e=THREE.GeometryUtils.__v1;e.sub(a,b);d=e.length();e.sub(a,c);a=e.length();e.sub(b,c);c=e.length();b=0.5*(d+a+c);return Math.sqrt(b*
+(b-d)*(b-a)*(b-c))},center:function(a){a.computeBoundingBox();var b=a.boundingBox,c=new THREE.Vector3;c.add(b.min,b.max);c.multiplyScalar(-0.5);a.applyMatrix((new THREE.Matrix4).makeTranslation(c.x,c.y,c.z));a.computeBoundingBox();return c},normalizeUVs:function(a){for(var a=a.faceVertexUvs[0],b=0,c=a.length;b<c;b++)for(var d=a[b],e=0,f=d.length;e<f;e++)1!==d[e].u&&(d[e].u-=Math.floor(d[e].u)),1!==d[e].v&&(d[e].v-=Math.floor(d[e].v))},triangulateQuads:function(a){var b,c,d,e,f=[],g=[],h=[];for(b=
+0,c=a.faceUvs.length;b<c;b++)g[b]=[];for(b=0,c=a.faceVertexUvs.length;b<c;b++)h[b]=[];for(b=0,c=a.faces.length;b<c;b++)if(d=a.faces[b],d instanceof THREE.Face4){e=d.a;var i=d.b,j=d.c,k=d.d,o=new THREE.Face3,l=new THREE.Face3;o.color.copy(d.color);l.color.copy(d.color);o.materialIndex=d.materialIndex;l.materialIndex=d.materialIndex;o.a=e;o.b=i;o.c=k;l.a=i;l.b=j;l.c=k;4===d.vertexColors.length&&(o.vertexColors[0]=d.vertexColors[0].clone(),o.vertexColors[1]=d.vertexColors[1].clone(),o.vertexColors[2]=
+d.vertexColors[3].clone(),l.vertexColors[0]=d.vertexColors[1].clone(),l.vertexColors[1]=d.vertexColors[2].clone(),l.vertexColors[2]=d.vertexColors[3].clone());f.push(o,l);for(d=0,e=a.faceVertexUvs.length;d<e;d++)a.faceVertexUvs[d].length&&(o=a.faceVertexUvs[d][b],i=o[1],j=o[2],k=o[3],o=[o[0].clone(),i.clone(),k.clone()],i=[i.clone(),j.clone(),k.clone()],h[d].push(o,i));for(d=0,e=a.faceUvs.length;d<e;d++)a.faceUvs[d].length&&(i=a.faceUvs[d][b],g[d].push(i,i))}else{f.push(d);for(d=0,e=a.faceUvs.length;d<
+e;d++)g[d].push(a.faceUvs[d]);for(d=0,e=a.faceVertexUvs.length;d<e;d++)h[d].push(a.faceVertexUvs[d])}a.faces=f;a.faceUvs=g;a.faceVertexUvs=h;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals();a.hasTangents&&a.computeTangents()},explode:function(a){for(var b=[],c=0,d=a.faces.length;c<d;c++){var e=b.length,f=a.faces[c];if(f instanceof THREE.Face4){var g=f.a,h=f.b,i=f.c,g=a.vertices[g],h=a.vertices[h],i=a.vertices[i],j=a.vertices[f.d];b.push(g.clone());b.push(h.clone());b.push(i.clone());
+b.push(j.clone());f.a=e;f.b=e+1;f.c=e+2;f.d=e+3}else g=f.a,h=f.b,i=f.c,g=a.vertices[g],h=a.vertices[h],i=a.vertices[i],b.push(g.clone()),b.push(h.clone()),b.push(i.clone()),f.a=e,f.b=e+1,f.c=e+2}a.vertices=b;delete a.__tmpVertices},tessellate:function(a,b){var c,d,e,f,g,h,i,j,k,o,l,m,q,n,p,r,t,s,u,v=[],x=[];for(c=0,d=a.faceVertexUvs.length;c<d;c++)x[c]=[];for(c=0,d=a.faces.length;c<d;c++)if(e=a.faces[c],e instanceof THREE.Face3)if(f=e.a,g=e.b,h=e.c,j=a.vertices[f],k=a.vertices[g],o=a.vertices[h],
+m=j.position.distanceTo(k.position),q=k.position.distanceTo(o.position),l=j.position.distanceTo(o.position),m>b||q>b||l>b){i=a.vertices.length;s=e.clone();u=e.clone();m>=q&&m>=l?(j=j.clone(),j.position.lerpSelf(k.position,0.5),s.a=f,s.b=i,s.c=h,u.a=i,u.b=g,u.c=h,3===e.vertexNormals.length&&(f=e.vertexNormals[0].clone(),f.lerpSelf(e.vertexNormals[1],0.5),s.vertexNormals[1].copy(f),u.vertexNormals[0].copy(f)),3===e.vertexColors.length&&(f=e.vertexColors[0].clone(),f.lerpSelf(e.vertexColors[1],0.5),
+s.vertexColors[1].copy(f),u.vertexColors[0].copy(f)),e=0):q>=m&&q>=l?(j=k.clone(),j.position.lerpSelf(o.position,0.5),s.a=f,s.b=g,s.c=i,u.a=i,u.b=h,u.c=f,3===e.vertexNormals.length&&(f=e.vertexNormals[1].clone(),f.lerpSelf(e.vertexNormals[2],0.5),s.vertexNormals[2].copy(f),u.vertexNormals[0].copy(f),u.vertexNormals[1].copy(e.vertexNormals[2]),u.vertexNormals[2].copy(e.vertexNormals[0])),3===e.vertexColors.length&&(f=e.vertexColors[1].clone(),f.lerpSelf(e.vertexColors[2],0.5),s.vertexColors[2].copy(f),
+u.vertexColors[0].copy(f),u.vertexColors[1].copy(e.vertexColors[2]),u.vertexColors[2].copy(e.vertexColors[0])),e=1):(j=j.clone(),j.position.lerpSelf(o.position,0.5),s.a=f,s.b=g,s.c=i,u.a=i,u.b=g,u.c=h,3===e.vertexNormals.length&&(f=e.vertexNormals[0].clone(),f.lerpSelf(e.vertexNormals[2],0.5),s.vertexNormals[2].copy(f),u.vertexNormals[0].copy(f)),3===e.vertexColors.length&&(f=e.vertexColors[0].clone(),f.lerpSelf(e.vertexColors[2],0.5),s.vertexColors[2].copy(f),u.vertexColors[0].copy(f)),e=2);v.push(s,
+u);a.vertices.push(j);for(f=0,g=a.faceVertexUvs.length;f<g;f++)a.faceVertexUvs[f].length&&(j=a.faceVertexUvs[f][c],u=j[0],h=j[1],s=j[2],0===e?(k=u.clone(),k.lerpSelf(h,0.5),j=[u.clone(),k.clone(),s.clone()],h=[k.clone(),h.clone(),s.clone()]):1===e?(k=h.clone(),k.lerpSelf(s,0.5),j=[u.clone(),h.clone(),k.clone()],h=[k.clone(),s.clone(),u.clone()]):(k=u.clone(),k.lerpSelf(s,0.5),j=[u.clone(),h.clone(),k.clone()],h=[k.clone(),h.clone(),s.clone()]),x[f].push(j,h))}else{v.push(e);for(f=0,g=a.faceVertexUvs.length;f<
+g;f++)x[f].push(a.faceVertexUvs[f])}else if(f=e.a,g=e.b,h=e.c,i=e.d,j=a.vertices[f],k=a.vertices[g],o=a.vertices[h],l=a.vertices[i],m=j.position.distanceTo(k.position),q=k.position.distanceTo(o.position),n=o.position.distanceTo(l.position),p=j.position.distanceTo(l.position),m>b||q>b||n>b||p>b){r=a.vertices.length;t=a.vertices.length+1;s=e.clone();u=e.clone();m>=q&&m>=n&&m>=p||n>=q&&n>=m&&n>=p?(m=j.clone(),m.position.lerpSelf(k.position,0.5),k=o.clone(),k.position.lerpSelf(l.position,0.5),s.a=f,s.b=
+r,s.c=t,s.d=i,u.a=r,u.b=g,u.c=h,u.d=t,4===e.vertexNormals.length&&(f=e.vertexNormals[0].clone(),f.lerpSelf(e.vertexNormals[1],0.5),g=e.vertexNormals[2].clone(),g.lerpSelf(e.vertexNormals[3],0.5),s.vertexNormals[1].copy(f),s.vertexNormals[2].copy(g),u.vertexNormals[0].copy(f),u.vertexNormals[3].copy(g)),4===e.vertexColors.length&&(f=e.vertexColors[0].clone(),f.lerpSelf(e.vertexColors[1],0.5),g=e.vertexColors[2].clone(),g.lerpSelf(e.vertexColors[3],0.5),s.vertexColors[1].copy(f),s.vertexColors[2].copy(g),
+u.vertexColors[0].copy(f),u.vertexColors[3].copy(g)),e=0):(m=k.clone(),m.position.lerpSelf(o.position,0.5),k=l.clone(),k.position.lerpSelf(j.position,0.5),s.a=f,s.b=g,s.c=r,s.d=t,u.a=t,u.b=r,u.c=h,u.d=i,4===e.vertexNormals.length&&(f=e.vertexNormals[1].clone(),f.lerpSelf(e.vertexNormals[2],0.5),g=e.vertexNormals[3].clone(),g.lerpSelf(e.vertexNormals[0],0.5),s.vertexNormals[2].copy(f),s.vertexNormals[3].copy(g),u.vertexNormals[0].copy(g),u.vertexNormals[1].copy(f)),4===e.vertexColors.length&&(f=e.vertexColors[1].clone(),
+f.lerpSelf(e.vertexColors[2],0.5),g=e.vertexColors[3].clone(),g.lerpSelf(e.vertexColors[0],0.5),s.vertexColors[2].copy(f),s.vertexColors[3].copy(g),u.vertexColors[0].copy(g),u.vertexColors[1].copy(f)),e=1);v.push(s,u);a.vertices.push(m,k);for(f=0,g=a.faceVertexUvs.length;f<g;f++)a.faceVertexUvs[f].length&&(j=a.faceVertexUvs[f][c],u=j[0],h=j[1],s=j[2],j=j[3],0===e?(k=u.clone(),k.lerpSelf(h,0.5),o=s.clone(),o.lerpSelf(j,0.5),u=[u.clone(),k.clone(),o.clone(),j.clone()],h=[k.clone(),h.clone(),s.clone(),
+o.clone()]):(k=h.clone(),k.lerpSelf(s,0.5),o=j.clone(),o.lerpSelf(u,0.5),u=[u.clone(),h.clone(),k.clone(),o.clone()],h=[o.clone(),k.clone(),s.clone(),j.clone()]),x[f].push(u,h))}else{v.push(e);for(f=0,g=a.faceVertexUvs.length;f<g;f++)x[f].push(a.faceVertexUvs[f])}a.faces=v;a.faceVertexUvs=x}};THREE.GeometryUtils.random=THREE.Math.random16;THREE.GeometryUtils.__v1=new THREE.Vector3;
+THREE.ImageUtils={crossOrigin:"anonymous",loadTexture:function(a,b,c){var d=new Image,e=new THREE.Texture(d,b);d.onload=function(){e.needsUpdate=!0;c&&c(this)};d.crossOrigin=this.crossOrigin;d.src=a;return e},loadTextureCube:function(a,b,c){var d,e=[],f=new THREE.Texture(e,b);e.loadCount=0;for(b=0,d=a.length;b<d;++b)e[b]=new Image,e[b].onload=function(){e.loadCount+=1;if(6===e.loadCount)f.needsUpdate=!0;c&&c(this)},e[b].crossOrigin=this.crossOrigin,e[b].src=a[b];return f},getNormalMap:function(a,
+b){var c=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]},b=b|1,d=a.width,e=a.height,f=document.createElement("canvas");f.width=d;f.height=e;var g=f.getContext("2d");g.drawImage(a,0,0);for(var h=g.getImageData(0,0,d,e).data,i=g.createImageData(d,e),j=i.data,k=0;k<d;k++)for(var o=1;o<e;o++){var l=0>o-1?e-1:o-1,m=(o+1)%e,q=0>k-1?d-1:k-1,n=(k+1)%d,p=[],r=[0,0,h[4*(o*d+k)]/255*b];p.push([-1,0,h[4*(o*d+q)]/255*b]);p.push([-1,-1,h[4*(l*d+q)]/255*b]);p.push([0,-1,
+h[4*(l*d+k)]/255*b]);p.push([1,-1,h[4*(l*d+n)]/255*b]);p.push([1,0,h[4*(o*d+n)]/255*b]);p.push([1,1,h[4*(m*d+n)]/255*b]);p.push([0,1,h[4*(m*d+k)]/255*b]);p.push([-1,1,h[4*(m*d+q)]/255*b]);l=[];q=p.length;for(m=0;m<q;m++){var n=p[m],t=p[(m+1)%q],n=[n[0]-r[0],n[1]-r[1],n[2]-r[2]],t=[t[0]-r[0],t[1]-r[1],t[2]-r[2]];l.push(c([n[1]*t[2]-n[2]*t[1],n[2]*t[0]-n[0]*t[2],n[0]*t[1]-n[1]*t[0]]))}p=[0,0,0];for(m=0;m<l.length;m++)p[0]+=l[m][0],p[1]+=l[m][1],p[2]+=l[m][2];p[0]/=l.length;p[1]/=l.length;p[2]/=l.length;
+r=4*(o*d+k);j[r]=255*((p[0]+1)/2)|0;j[r+1]=255*(p[1]+0.5)|0;j[r+2]=255*p[2]|0;j[r+3]=255}g.putImageData(i,0,0);return f},generateDataTexture:function(a,b,c){for(var d=a*b,e=new Uint8Array(3*d),f=Math.floor(255*c.r),g=Math.floor(255*c.g),c=Math.floor(255*c.b),h=0;h<d;h++)e[3*h]=f,e[3*h+1]=g,e[3*h+2]=c;a=new THREE.DataTexture(e,a,b,THREE.RGBFormat);a.needsUpdate=!0;return a}};
+THREE.SceneUtils={showHierarchy:function(a,b){THREE.SceneUtils.traverseHierarchy(a,function(a){a.visible=b})},traverseHierarchy:function(a,b){var c,d,e=a.children.length;for(d=0;d<e;d++)c=a.children[d],b(c),THREE.SceneUtils.traverseHierarchy(c,b)},createMultiMaterialObject:function(a,b){var c,d=b.length,e=new THREE.Object3D;for(c=0;c<d;c++){var f=new THREE.Mesh(a,b[c]);e.add(f)}return e},cloneObject:function(a){var b;a instanceof THREE.MorphAnimMesh?(b=new THREE.MorphAnimMesh(a.geometry,a.material),
 b.duration=a.duration,b.mirroredLoop=a.mirroredLoop,b.time=a.time,b.lastKeyframe=a.lastKeyframe,b.currentKeyframe=a.currentKeyframe,b.direction=a.direction,b.directionBackwards=a.directionBackwards):a instanceof THREE.SkinnedMesh?b=new THREE.SkinnedMesh(a.geometry,a.material):a instanceof THREE.Mesh?b=new THREE.Mesh(a.geometry,a.material):a instanceof THREE.Line?b=new THREE.Line(a.geometry,a.material,a.type):a instanceof THREE.Ribbon?b=new THREE.Ribbon(a.geometry,a.material):a instanceof THREE.ParticleSystem?
 (b=new THREE.ParticleSystem(a.geometry,a.material),b.sortParticles=a.sortParticles):a instanceof THREE.Particle?b=new THREE.Particle(a.material):a instanceof THREE.Sprite?(b=new THREE.Sprite({}),b.color.copy(a.color),b.map=a.map,b.blending=a.blending,b.useScreenCoordinates=a.useScreenCoordinates,b.mergeWith3D=a.mergeWith3D,b.affectedByDistance=a.affectedByDistance,b.scaleByViewport=a.scaleByViewport,b.alignment=a.alignment,b.rotation3d.copy(a.rotation3d),b.rotation=a.rotation,b.opacity=a.opacity,
 b.uvOffset.copy(a.uvOffset),b.uvScale.copy(a.uvScale)):a instanceof THREE.LOD?b=new THREE.LOD:a instanceof THREE.MarchingCubes?(b=new THREE.MarchingCubes(a.resolution,a.material),b.field.set(a.field),b.isolation=a.isolation):a instanceof THREE.Object3D&&(b=new THREE.Object3D);b.name=a.name;b.parent=a.parent;b.up.copy(a.up);b.position.copy(a.position);b.rotation instanceof THREE.Vector3&&b.rotation.copy(a.rotation);b.eulerOrder=a.eulerOrder;b.scale.copy(a.scale);b.dynamic=a.dynamic;b.doubleSided=a.doubleSided;
@@ -43,87 +43,86 @@ THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {\nvec4 mvPosition = modelV
 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.BufferGeometry=function(){this.id=THREE.GeometryCount++;this.vertexColorArray=this.vertexUvArray=this.vertexNormalArray=this.vertexPositionArray=this.vertexIndexArray=this.vertexColorBuffer=this.vertexUvBuffer=this.vertexNormalBuffer=this.vertexPositionBuffer=this.vertexIndexBuffer=null;this.dynamic=!1;this.boundingSphere=this.boundingBox=null;this.morphTargets=[]};THREE.BufferGeometry.prototype={constructor:THREE.BufferGeometry,computeBoundingBox:function(){},computeBoundingSphere:function(){}};
 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=this.__arcLengthDivisions?this.__arcLengthDivisions:200);if(this.cacheArcLengths&&this.cacheArcLengths.length==a+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var b=[],c,d=this.getPoint(0),f,e=0;b.push(0);for(f=1;f<=a;f++)c=this.getPoint(f/a),e+=c.distanceTo(d),b.push(e),d=c;return this.cacheArcLengths=b};
-THREE.Curve.prototype.updateArcLengths=function(){this.needsUpdate=!0;this.getLengths()};THREE.Curve.prototype.getUtoTmapping=function(a,b){var c=this.getLengths(),d=0,f=c.length,e;e=b?b:a*c[f-1];for(var g=0,h=f-1,i;g<=h;)if(d=Math.floor(g+(h-g)/2),i=c[d]-e,0>i)g=d+1;else if(0<i)h=d-1;else{h=d;break}d=h;if(c[d]==e)return d/(f-1);g=c[d];return c=(d+(e-g)/(c[d+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.getLength=function(){var a=this.getLengths();return a[a.length-1]};THREE.Curve.prototype.getLengths=function(a){a||(a=this.__arcLengthDivisions?this.__arcLengthDivisions:200);if(this.cacheArcLengths&&this.cacheArcLengths.length==a+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var b=[],c,d=this.getPoint(0),e,f=0;b.push(0);for(e=1;e<=a;e++)c=this.getPoint(e/a),f+=c.distanceTo(d),b.push(f),d=c;return this.cacheArcLengths=b};
+THREE.Curve.prototype.updateArcLengths=function(){this.needsUpdate=!0;this.getLengths()};THREE.Curve.prototype.getUtoTmapping=function(a,b){var c=this.getLengths(),d=0,e=c.length,f;f=b?b:a*c[e-1];for(var g=0,h=e-1,i;g<=h;)if(d=Math.floor(g+(h-g)/2),i=c[d]-f,0>i)g=d+1;else if(0<i)h=d-1;else{h=d;break}d=h;if(c[d]==f)return d/(e-1);g=c[d];return c=(d+(f-g)/(c[d+1]-g))/(e-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=a+1.0E-4;0>b&&(b=0);1<a&&(a=1);b=this.getPoint(b);return this.getPoint(a).clone().subSelf(b).normalize()};THREE.Curve.prototype.getTangentAt=function(a){return this.getTangent(this.getUtoTmapping(a))};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,d){this.constructor(new THREE.Vector2(a,b),new THREE.Vector2(c,d))};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 d=Array.prototype.slice.call(arguments),a=new THREE.Vector2(d[0],d[1]),b=new THREE.Vector2(d[2],d[3]),c=new THREE.Vector2(d[4],d[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,d){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]),d=new THREE.Vector2(f[6],f[7]);this.v0=a;this.v1=b;this.v2=c;this.v3=d};THREE.CubicBezierCurve.prototype=new THREE.Curve;THREE.CubicBezierCurve.prototype.constructor=THREE.CubicBezierCurve;
+THREE.CubicBezierCurve=function(a,b,c,d){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]),d=new THREE.Vector2(e[6],e[7]);this.v0=a;this.v1=b;this.v2=c;this.v3=d};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.SplineCurve=function(a){this.points=void 0==a?[]: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=[],d=this.points,f;f=(d.length-1)*a;a=Math.floor(f);f-=a;c[0]=0==a?a:a-1;c[1]=a;c[2]=a>d.length-2?d.length-1:a+1;c[3]=a>d.length-3?d.length-1:a+2;b.x=THREE.Curve.Utils.interpolate(d[c[0]].x,d[c[1]].x,d[c[2]].x,d[c[3]].x,f);b.y=THREE.Curve.Utils.interpolate(d[c[0]].y,d[c[1]].y,d[c[2]].y,d[c[3]].y,f);return b};
-THREE.ArcCurve=function(a,b,c,d,f,e){this.aX=a;this.aY=b;this.aRadius=c;this.aStartAngle=d;this.aEndAngle=f;this.aClockwise=e};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);b=this.aStartAngle+a*b;a=this.aX+this.aRadius*Math.cos(b);b=this.aY+this.aRadius*Math.sin(b);return new THREE.Vector2(a,b)};
-THREE.Curve.Utils={tangentQuadraticBezier:function(a,b,c,d){return 2*(1-a)*(c-b)+2*a*(d-c)},tangentCubicBezier:function(a,b,c,d,f){return-3*b*(1-a)*(1-a)+3*c*(1-a)*(1-a)-6*a*c*(1-a)+6*a*d*(1-a)-3*a*a*d+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,d,f){var a=0.5*(c-a),d=0.5*(d-b),e=f*f;return(2*b-2*c+a+d)*f*e+(-3*b+3*c-2*a-d)*e+a*f+b}};
+THREE.SplineCurve.prototype.getPoint=function(a){var b=new THREE.Vector2,c=[],d=this.points,e;e=(d.length-1)*a;a=Math.floor(e);e-=a;c[0]=0==a?a:a-1;c[1]=a;c[2]=a>d.length-2?d.length-1:a+1;c[3]=a>d.length-3?d.length-1:a+2;b.x=THREE.Curve.Utils.interpolate(d[c[0]].x,d[c[1]].x,d[c[2]].x,d[c[3]].x,e);b.y=THREE.Curve.Utils.interpolate(d[c[0]].y,d[c[1]].y,d[c[2]].y,d[c[3]].y,e);return b};
+THREE.ArcCurve=function(a,b,c,d,e,f){this.aX=a;this.aY=b;this.aRadius=c;this.aStartAngle=d;this.aEndAngle=e;this.aClockwise=f};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);b=this.aStartAngle+a*b;a=this.aX+this.aRadius*Math.cos(b);b=this.aY+this.aRadius*Math.sin(b);return new THREE.Vector2(a,b)};
+THREE.Curve.Utils={tangentQuadraticBezier:function(a,b,c,d){return 2*(1-a)*(c-b)+2*a*(d-c)},tangentCubicBezier:function(a,b,c,d,e){return-3*b*(1-a)*(1-a)+3*c*(1-a)*(1-a)-6*a*c*(1-a)+6*a*d*(1-a)-3*a*a*d+3*a*a*e},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,d,e){var a=0.5*(c-a),d=0.5*(d-b),f=e*e;return(2*b-2*c+a+d)*e*f+(-3*b+3*c-2*a-d)*f+a*e+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(this.v2,this.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,d){this.v0=a;this.v1=b;this.v2=c;this.v3=d},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=void 0==a?[]:a},function(a){var b=new THREE.Vector3,c=[],d=this.points,f,a=(d.length-1)*a;f=Math.floor(a);a-=f;c[0]=0==f?f:f-1;c[1]=f;c[2]=f>d.length-2?d.length-1:f+1;c[3]=f>d.length-3?d.length-1:f+2;f=d[c[0]];var e=d[c[1]],g=d[c[2]],c=d[c[3]];b.x=THREE.Curve.Utils.interpolate(f.x,e.x,g.x,c.x,a);b.y=THREE.Curve.Utils.interpolate(f.y,e.y,g.y,c.y,a);b.z=THREE.Curve.Utils.interpolate(f.z,e.z,g.z,c.z,a);return b});
-THREE.ClosedSplineCurve3=THREE.Curve.create(function(a){this.points=void 0==a?[]:a},function(a){var b=new THREE.Vector3,c=[],d=this.points,f;f=(d.length-0)*a;a=Math.floor(f);f-=a;a+=0<a?0:(Math.floor(Math.abs(a)/d.length)+1)*d.length;c[0]=(a-1)%d.length;c[1]=a%d.length;c[2]=(a+1)%d.length;c[3]=(a+2)%d.length;b.x=THREE.Curve.Utils.interpolate(d[c[0]].x,d[c[1]].x,d[c[2]].x,d[c[3]].x,f);b.y=THREE.Curve.Utils.interpolate(d[c[0]].y,d[c[1]].y,d[c[2]].y,d[c[3]].y,f);b.z=THREE.Curve.Utils.interpolate(d[c[0]].z,
-d[c[1]].z,d[c[2]].z,d[c[3]].z,f);return b});THREE.CurvePath=function(){this.curves=[];this.bends=[];this.autoClose=!1};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.SplineCurve3=THREE.Curve.create(function(a){this.points=void 0==a?[]:a},function(a){var b=new THREE.Vector3,c=[],d=this.points,e,a=(d.length-1)*a;e=Math.floor(a);a-=e;c[0]=0==e?e:e-1;c[1]=e;c[2]=e>d.length-2?d.length-1:e+1;c[3]=e>d.length-3?d.length-1:e+2;e=d[c[0]];var f=d[c[1]],g=d[c[2]],c=d[c[3]];b.x=THREE.Curve.Utils.interpolate(e.x,f.x,g.x,c.x,a);b.y=THREE.Curve.Utils.interpolate(e.y,f.y,g.y,c.y,a);b.z=THREE.Curve.Utils.interpolate(e.z,f.z,g.z,c.z,a);return b});
+THREE.ClosedSplineCurve3=THREE.Curve.create(function(a){this.points=void 0==a?[]:a},function(a){var b=new THREE.Vector3,c=[],d=this.points,e;e=(d.length-0)*a;a=Math.floor(e);e-=a;a+=0<a?0:(Math.floor(Math.abs(a)/d.length)+1)*d.length;c[0]=(a-1)%d.length;c[1]=a%d.length;c[2]=(a+1)%d.length;c[3]=(a+2)%d.length;b.x=THREE.Curve.Utils.interpolate(d[c[0]].x,d[c[1]].x,d[c[2]].x,d[c[3]].x,e);b.y=THREE.Curve.Utils.interpolate(d[c[0]].y,d[c[1]].y,d[c[2]].y,d[c[3]].y,e);b.z=THREE.Curve.Utils.interpolate(d[c[0]].z,
+d[c[1]].z,d[c[2]].z,d[c[3]].z,e);return b});THREE.CurvePath=function(){this.curves=[];this.bends=[];this.autoClose=!1};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(){var a=this.curves[0].getPoint(0),b=this.curves[this.curves.length-1].getPoint(1);a.equals(b)||this.curves.push(new THREE.LineCurve(b,a))};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,d=this.curves.length;for(c=0;c<d;c++)b+=this.curves[c].getLength(),a.push(b);return this.cacheLengths=a};
-THREE.CurvePath.prototype.getBoundingBox=function(){var a=this.getPoints(),b,c,d,f;b=c=Number.NEGATIVE_INFINITY;d=f=Number.POSITIVE_INFINITY;var e,g,h,i;i=new THREE.Vector2;for(g=0,h=a.length;g<h;g++){e=a[g];if(e.x>b)b=e.x;else if(e.x<d)d=e.x;if(e.y>c)c=e.y;else if(e.y<c)f=e.y;i.addSelf(e.x,e.y)}return{minX:d,minY:f,maxX:b,maxY:c,centroid:i.divideScalar(h)}};THREE.CurvePath.prototype.createPointsGeometry=function(a){return this.createGeometry(this.getPoints(a,!0))};
+THREE.CurvePath.prototype.getBoundingBox=function(){var a=this.getPoints(),b,c,d,e;b=c=Number.NEGATIVE_INFINITY;d=e=Number.POSITIVE_INFINITY;var f,g,h,i;i=new THREE.Vector2;for(g=0,h=a.length;g<h;g++){f=a[g];if(f.x>b)b=f.x;else if(f.x<d)d=f.x;if(f.y>c)c=f.y;else if(f.y<c)e=f.y;i.addSelf(f.x,f.y)}return{minX:d,minY:e,maxX:b,maxY:c,centroid:i.divideScalar(h)}};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),d,f;if(!b)b=this.bends;for(d=0,f=b.length;d<f;d++)c=this.getWrapPoints(c,b[d]);return c};THREE.CurvePath.prototype.getTransformedSpacedPoints=function(a,b){var c=this.getSpacedPoints(a),d,f;if(!b)b=this.bends;for(d=0,f=b.length;d<f;d++)c=this.getWrapPoints(c,b[d]);return c};
-THREE.CurvePath.prototype.getWrapPoints=function(a,b){var c=this.getBoundingBox(),d,f,e,g,h,i;for(d=0,f=a.length;d<f;d++)e=a[d],g=e.x,h=e.y,i=g/c.maxX,i=b.getUtoTmapping(i,g),g=b.getPoint(i),h=b.getNormalVector(i).multiplyScalar(h),e.x=g.x+h.x,e.y=g.y+h.y;return a};
+THREE.CurvePath.prototype.getTransformedPoints=function(a,b){var c=this.getPoints(a),d,e;if(!b)b=this.bends;for(d=0,e=b.length;d<e;d++)c=this.getWrapPoints(c,b[d]);return c};THREE.CurvePath.prototype.getTransformedSpacedPoints=function(a,b){var c=this.getSpacedPoints(a),d,e;if(!b)b=this.bends;for(d=0,e=b.length;d<e;d++)c=this.getWrapPoints(c,b[d]);return c};
+THREE.CurvePath.prototype.getWrapPoints=function(a,b){var c=this.getBoundingBox(),d,e,f,g,h,i;for(d=0,e=a.length;d<e;d++)f=a[d],g=f.x,h=f.y,i=g/c.maxX,i=b.getUtoTmapping(i,g),g=b.getPoint(i),h=b.getNormalVector(i).multiplyScalar(h),f.x=g.x+h.x,f.y=g.y+h.y;return a};
 THREE.EventTarget=function(){var a={};this.addEventListener=function(b,c){void 0==a[b]&&(a[b]=[]);-1===a[b].indexOf(c)&&a[b].push(c)};this.dispatchEvent=function(b){for(var c in a[b.type])a[b.type][c](b)};this.removeEventListener=function(b,c){var d=a[b].indexOf(c);-1!==d&&a[b].splice(d,1)}};THREE.Gyroscope=function(){THREE.Object3D.call(this)};THREE.Gyroscope.prototype=new THREE.Object3D;THREE.Gyroscope.prototype.constructor=THREE.Gyroscope;
 THREE.Gyroscope.prototype.updateMatrixWorld=function(a){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||a)this.parent?(this.matrixWorld.multiply(this.parent.matrixWorld,this.matrix),this.matrixWorld.decompose(this.translationWorld,this.rotationWorld,this.scaleWorld),this.matrix.decompose(this.translationObject,this.rotationObject,this.scaleObject),this.matrixWorld.compose(this.translationWorld,this.rotationObject,this.scaleWorld)):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.Gyroscope.prototype.translationWorld=new THREE.Vector3;THREE.Gyroscope.prototype.translationObject=new THREE.Vector3;THREE.Gyroscope.prototype.rotationWorld=new THREE.Quaternion;THREE.Gyroscope.prototype.rotationObject=new THREE.Quaternion;THREE.Gyroscope.prototype.scaleWorld=new THREE.Vector3;THREE.Gyroscope.prototype.scaleObject=new THREE.Vector3;
 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);for(var b=1,c=a.length;b<c;b++)this.lineTo(a[b].x,a[b].y)};
 THREE.Path.prototype.moveTo=function(a,b){var c=Array.prototype.slice.call(arguments);this.actions.push({action:THREE.PathActions.MOVE_TO,args:c})};THREE.Path.prototype.lineTo=function(a,b){var c=Array.prototype.slice.call(arguments),d=this.actions[this.actions.length-1].args;this.curves.push(new THREE.LineCurve(new THREE.Vector2(d[d.length-2],d[d.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,d){var f=Array.prototype.slice.call(arguments),e=this.actions[this.actions.length-1].args;this.curves.push(new THREE.QuadraticBezierCurve(new THREE.Vector2(e[e.length-2],e[e.length-1]),new THREE.Vector2(a,b),new THREE.Vector2(c,d)));this.actions.push({action:THREE.PathActions.QUADRATIC_CURVE_TO,args:f})};
-THREE.Path.prototype.bezierCurveTo=function(a,b,c,d,f,e){var g=Array.prototype.slice.call(arguments),h=this.actions[this.actions.length-1].args;this.curves.push(new THREE.CubicBezierCurve(new THREE.Vector2(h[h.length-2],h[h.length-1]),new THREE.Vector2(a,b),new THREE.Vector2(c,d),new THREE.Vector2(f,e)));this.actions.push({action:THREE.PathActions.BEZIER_CURVE_TO,args:g})};
+THREE.Path.prototype.quadraticCurveTo=function(a,b,c,d){var e=Array.prototype.slice.call(arguments),f=this.actions[this.actions.length-1].args;this.curves.push(new THREE.QuadraticBezierCurve(new THREE.Vector2(f[f.length-2],f[f.length-1]),new THREE.Vector2(a,b),new THREE.Vector2(c,d)));this.actions.push({action:THREE.PathActions.QUADRATIC_CURVE_TO,args:e})};
+THREE.Path.prototype.bezierCurveTo=function(a,b,c,d,e,f){var g=Array.prototype.slice.call(arguments),h=this.actions[this.actions.length-1].args;this.curves.push(new THREE.CubicBezierCurve(new THREE.Vector2(h[h.length-2],h[h.length-1]),new THREE.Vector2(a,b),new THREE.Vector2(c,d),new THREE.Vector2(e,f)));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,d,f,e){var g=Array.prototype.slice.call(arguments),h=this.actions[this.actions.length-1],h=new THREE.ArcCurve(h.x+a,h.y+b,c,d,f,e);this.curves.push(h);h=h.getPoint(e?1:0);g.push(h.x);g.push(h.y);this.actions.push({action:THREE.PathActions.ARC,args:g})};
-THREE.Path.prototype.absarc=function(a,b,c,d,f,e){var g=Array.prototype.slice.call(arguments),h=new THREE.ArcCurve(a,b,c,d,f,e);this.curves.push(h);h=h.getPoint(e?1:0);g.push(h.x);g.push(h.y);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){if(this.useSpacedPoints)return console.log("tata"),this.getSpacedPoints(a,b);var a=a||12,c=[],d,f,e,g,h,i,j,k,p,l,m,r,n;for(d=0,f=this.actions.length;d<f;d++)switch(e=this.actions[d],g=e.action,e=e.args,g){case THREE.PathActions.MOVE_TO:c.push(new THREE.Vector2(e[0],e[1]));break;case THREE.PathActions.LINE_TO:c.push(new THREE.Vector2(e[0],e[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:h=e[2];i=e[3];p=e[0];l=e[1];0<c.length?(g=c[c.length-1],m=g.x,
-r=g.y):(g=this.actions[d-1].args,m=g[g.length-2],r=g[g.length-1]);for(e=1;e<=a;e++)n=e/a,g=THREE.Shape.Utils.b2(n,m,p,h),n=THREE.Shape.Utils.b2(n,r,l,i),c.push(new THREE.Vector2(g,n));break;case THREE.PathActions.BEZIER_CURVE_TO:h=e[4];i=e[5];p=e[0];l=e[1];j=e[2];k=e[3];0<c.length?(g=c[c.length-1],m=g.x,r=g.y):(g=this.actions[d-1].args,m=g[g.length-2],r=g[g.length-1]);for(e=1;e<=a;e++)n=e/a,g=THREE.Shape.Utils.b3(n,m,p,j,h),n=THREE.Shape.Utils.b3(n,r,l,k,i),c.push(new THREE.Vector2(g,n));break;case THREE.PathActions.CSPLINE_THRU:g=
-this.actions[d-1].args;n=[new THREE.Vector2(g[g.length-2],g[g.length-1])];g=a*e[0].length;n=n.concat(e[0]);n=new THREE.SplineCurve(n);for(e=1;e<=g;e++)c.push(n.getPointAt(e/g));break;case THREE.PathActions.ARC:h=e[0];i=e[1];j=e[2];p=e[3];l=!!e[5];k=e[4]-p;m=2*a;for(e=1;e<=m;e++)n=e/m,l||(n=1-n),n=p+n*k,g=h+j*Math.cos(n),n=i+j*Math.sin(n),c.push(new THREE.Vector2(g,n))}d=c[c.length-1];1.0E-10>Math.abs(d.x-c[0].x)&&1.0E-10>Math.abs(d.y-c[0].y)&&c.splice(c.length-1,1);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,d,f,e){var g=this.getPoints(),h,i,j,k,p;for(h=0,i=g.length;h<i;h++)j=g[h],k=j.x,p=j.y,j.x=a*k+b*p+c,j.y=d*p+f*k+e;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,d,f;for(a=0,c=this.actions.length;a<c;a++)d=this.actions[a],f=d.args,d=d.action,d!=THREE.PathActions.CSPLINE_THRU&&b[d].apply(b,f);b.stroke();b.closePath();b.strokeStyle="red";d=
-this.getPoints();for(a=0,c=d.length;a<c;a++)f=d[a],b.beginPath(),b.arc(f.x,f.y,1.5,0,2*Math.PI,!1),b.stroke(),b.closePath()};
-THREE.Path.prototype.toShapes=function(){var a,b,c,d,f=[],e=new THREE.Path;for(a=0,b=this.actions.length;a<b;a++)c=this.actions[a],d=c.args,c=c.action,c==THREE.PathActions.MOVE_TO&&0!=e.actions.length&&(f.push(e),e=new THREE.Path),e[c].apply(e,d);0!=e.actions.length&&f.push(e);if(0==f.length)return[];var g;d=[];a=!THREE.Shape.Utils.isClockWise(f[0].getPoints());if(1==f.length)return e=f[0],g=new THREE.Shape,g.actions=e.actions,g.curves=e.curves,d.push(g),d;if(a){g=new THREE.Shape;for(a=0,b=f.length;a<
-b;a++)e=f[a],THREE.Shape.Utils.isClockWise(e.getPoints())?(g.actions=e.actions,g.curves=e.curves,d.push(g),g=new THREE.Shape):g.holes.push(e)}else{for(a=0,b=f.length;a<b;a++)e=f[a],THREE.Shape.Utils.isClockWise(e.getPoints())?(g&&d.push(g),g=new THREE.Shape,g.actions=e.actions,g.curves=e.curves):g.holes.push(e);d.push(g)}return d};THREE.Shape=function(){THREE.Path.apply(this,arguments);this.holes=[]};THREE.Shape.prototype=new THREE.Path;THREE.Shape.prototype.constructor=THREE.Path;
+THREE.Path.prototype.arc=function(a,b,c,d,e,f){var g=Array.prototype.slice.call(arguments),h=this.actions[this.actions.length-1],h=new THREE.ArcCurve(h.x+a,h.y+b,c,d,e,f);this.curves.push(h);h=h.getPoint(f?1:0);g.push(h.x);g.push(h.y);this.actions.push({action:THREE.PathActions.ARC,args:g})};
+THREE.Path.prototype.absarc=function(a,b,c,d,e,f){var g=Array.prototype.slice.call(arguments),h=new THREE.ArcCurve(a,b,c,d,e,f);this.curves.push(h);h=h.getPoint(f?1:0);g.push(h.x);g.push(h.y);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){if(this.useSpacedPoints)return console.log("tata"),this.getSpacedPoints(a,b);var a=a||12,c=[],d,e,f,g,h,i,j,k,o,l,m,q,n;for(d=0,e=this.actions.length;d<e;d++)switch(f=this.actions[d],g=f.action,f=f.args,g){case THREE.PathActions.MOVE_TO:c.push(new THREE.Vector2(f[0],f[1]));break;case THREE.PathActions.LINE_TO:c.push(new THREE.Vector2(f[0],f[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:h=f[2];i=f[3];o=f[0];l=f[1];0<c.length?(g=c[c.length-1],m=g.x,
+q=g.y):(g=this.actions[d-1].args,m=g[g.length-2],q=g[g.length-1]);for(f=1;f<=a;f++)n=f/a,g=THREE.Shape.Utils.b2(n,m,o,h),n=THREE.Shape.Utils.b2(n,q,l,i),c.push(new THREE.Vector2(g,n));break;case THREE.PathActions.BEZIER_CURVE_TO:h=f[4];i=f[5];o=f[0];l=f[1];j=f[2];k=f[3];0<c.length?(g=c[c.length-1],m=g.x,q=g.y):(g=this.actions[d-1].args,m=g[g.length-2],q=g[g.length-1]);for(f=1;f<=a;f++)n=f/a,g=THREE.Shape.Utils.b3(n,m,o,j,h),n=THREE.Shape.Utils.b3(n,q,l,k,i),c.push(new THREE.Vector2(g,n));break;case THREE.PathActions.CSPLINE_THRU:g=
+this.actions[d-1].args;n=[new THREE.Vector2(g[g.length-2],g[g.length-1])];g=a*f[0].length;n=n.concat(f[0]);n=new THREE.SplineCurve(n);for(f=1;f<=g;f++)c.push(n.getPointAt(f/g));break;case THREE.PathActions.ARC:h=f[0];i=f[1];j=f[2];o=f[3];l=!!f[5];k=f[4]-o;m=2*a;for(f=1;f<=m;f++)n=f/m,l||(n=1-n),n=o+n*k,g=h+j*Math.cos(n),n=i+j*Math.sin(n),c.push(new THREE.Vector2(g,n))}d=c[c.length-1];1.0E-10>Math.abs(d.x-c[0].x)&&1.0E-10>Math.abs(d.y-c[0].y)&&c.splice(c.length-1,1);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,d,e,f){var g=this.getPoints(),h,i,j,k,o;for(h=0,i=g.length;h<i;h++)j=g[h],k=j.x,o=j.y,j.x=a*k+b*o+c,j.y=d*o+e*k+f;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,d,e;for(a=0,c=this.actions.length;a<c;a++)d=this.actions[a],e=d.args,d=d.action,d!=THREE.PathActions.CSPLINE_THRU&&b[d].apply(b,e);b.stroke();b.closePath();b.strokeStyle="red";d=
+this.getPoints();for(a=0,c=d.length;a<c;a++)e=d[a],b.beginPath(),b.arc(e.x,e.y,1.5,0,2*Math.PI,!1),b.stroke(),b.closePath()};
+THREE.Path.prototype.toShapes=function(){var a,b,c,d,e=[],f=new THREE.Path;for(a=0,b=this.actions.length;a<b;a++)c=this.actions[a],d=c.args,c=c.action,c==THREE.PathActions.MOVE_TO&&0!=f.actions.length&&(e.push(f),f=new THREE.Path),f[c].apply(f,d);0!=f.actions.length&&e.push(f);if(0==e.length)return[];var g;d=[];a=!THREE.Shape.Utils.isClockWise(e[0].getPoints());if(1==e.length)return f=e[0],g=new THREE.Shape,g.actions=f.actions,g.curves=f.curves,d.push(g),d;if(a){g=new THREE.Shape;for(a=0,b=e.length;a<
+b;a++)f=e[a],THREE.Shape.Utils.isClockWise(f.getPoints())?(g.actions=f.actions,g.curves=f.curves,d.push(g),g=new THREE.Shape):g.holes.push(f)}else{for(a=0,b=e.length;a<b;a++)f=e[a],THREE.Shape.Utils.isClockWise(f.getPoints())?(g&&d.push(g),g=new THREE.Shape,g.actions=f.actions,g.curves=f.curves):g.holes.push(f);d.push(g)}return d};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,d=[];for(b=0;b<c;b++)d[b]=this.holes[b].getTransformedPoints(a,this.bends);return d};THREE.Shape.prototype.getSpacedPointsHoles=function(a){var b,c=this.holes.length,d=[];for(b=0;b<c;b++)d[b]=this.holes[b].getTransformedSpacedPoints(a,this.bends);return d};
 THREE.Shape.prototype.extractAllPoints=function(a){return{shape:this.getTransformedPoints(a),holes:this.getPointsHoles(a)}};THREE.Shape.prototype.extractPoints=function(a){return this.useSpacedPoints?this.extractAllSpacedPoints(a):this.extractAllPoints(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(),d=c.concat(),f,e,g,h,i,j,k,p,l,m,r=[];for(i=0;i<b.length;i++){j=b[i];Array.prototype.push.apply(d,j);e=Number.POSITIVE_INFINITY;for(f=0;f<j.length;f++){l=j[f];m=[];for(p=0;p<c.length;p++)k=c[p],k=l.distanceToSquared(k),m.push(k),k<e&&(e=k,g=f,h=p)}f=0<=h-1?h-1:c.length-1;e=0<=g-1?g-1:j.length-1;var n=[j[g],c[h],c[f]];p=THREE.FontUtils.Triangulate.area(n);var o=[j[g],j[e],c[h]];l=THREE.FontUtils.Triangulate.area(o);m=h;k=g;h+=1;g+=-1;0>
-h&&(h+=c.length);h%=c.length;0>g&&(g+=j.length);g%=j.length;f=0<=h-1?h-1:c.length-1;e=0<=g-1?g-1:j.length-1;n=[j[g],c[h],c[f]];n=THREE.FontUtils.Triangulate.area(n);o=[j[g],j[e],c[h]];o=THREE.FontUtils.Triangulate.area(o);p+l>n+o&&(h=m,g=k,0>h&&(h+=c.length),h%=c.length,0>g&&(g+=j.length),g%=j.length,f=0<=h-1?h-1:c.length-1,e=0<=g-1?g-1:j.length-1);p=c.slice(0,h);l=c.slice(h);m=j.slice(g);k=j.slice(0,g);e=[j[g],j[e],c[h]];r.push([j[g],c[h],c[f]]);r.push(e);c=p.concat(m).concat(k).concat(l)}return{shape:c,
-isolatedPts:r,allpoints:d}},triangulateShape:function(a,b){var c=THREE.Shape.Utils.removeHoles(a,b),d=c.allpoints,f=c.isolatedPts,c=THREE.FontUtils.Triangulate(c.shape,!1),e,g,h,i,j={};for(e=0,g=d.length;e<g;e++)i=d[e].x+":"+d[e].y,void 0!==j[i]&&console.log("Duplicate point",i),j[i]=e;for(e=0,g=c.length;e<g;e++){h=c[e];for(d=0;3>d;d++)i=h[d].x+":"+h[d].y,i=j[i],void 0!==i&&(h[d]=i)}for(e=0,g=f.length;e<g;e++){h=f[e];for(d=0;3>d;d++)i=h[d].x+":"+h[d].y,i=j[i],void 0!==i&&(h[d]=i)}return c.concat(f)},
-isClockWise:function(a){return 0>THREE.FontUtils.Triangulate.area(a)},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,d){return this.b2p0(a,b)+this.b2p1(a,c)+this.b2p2(a,d)},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,d,f){return this.b3p0(a,b)+this.b3p1(a,c)+this.b3p2(a,d)+
-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){b=b||this.parameters;this.text=a;var c=void 0!==b.curveSegments?b.curveSegments:4,d=void 0!==b.font?b.font:"helvetiker",f=void 0!==b.weight?b.weight:"normal",e=void 0!==b.style?b.style:"normal";THREE.FontUtils.size=void 0!==b.size?b.size:100;THREE.FontUtils.divisions=c;THREE.FontUtils.face=d;THREE.FontUtils.weight=f;THREE.FontUtils.style=e};
+THREE.Shape.Utils={removeHoles:function(a,b){var c=a.concat(),d=c.concat(),e,f,g,h,i,j,k,o,l,m,q=[];for(i=0;i<b.length;i++){j=b[i];Array.prototype.push.apply(d,j);f=Number.POSITIVE_INFINITY;for(e=0;e<j.length;e++){l=j[e];m=[];for(o=0;o<c.length;o++)k=c[o],k=l.distanceToSquared(k),m.push(k),k<f&&(f=k,g=e,h=o)}e=0<=h-1?h-1:c.length-1;f=0<=g-1?g-1:j.length-1;var n=[j[g],c[h],c[e]];o=THREE.FontUtils.Triangulate.area(n);var p=[j[g],j[f],c[h]];l=THREE.FontUtils.Triangulate.area(p);m=h;k=g;h+=1;g+=-1;0>
+h&&(h+=c.length);h%=c.length;0>g&&(g+=j.length);g%=j.length;e=0<=h-1?h-1:c.length-1;f=0<=g-1?g-1:j.length-1;n=[j[g],c[h],c[e]];n=THREE.FontUtils.Triangulate.area(n);p=[j[g],j[f],c[h]];p=THREE.FontUtils.Triangulate.area(p);o+l>n+p&&(h=m,g=k,0>h&&(h+=c.length),h%=c.length,0>g&&(g+=j.length),g%=j.length,e=0<=h-1?h-1:c.length-1,f=0<=g-1?g-1:j.length-1);o=c.slice(0,h);l=c.slice(h);m=j.slice(g);k=j.slice(0,g);f=[j[g],j[f],c[h]];q.push([j[g],c[h],c[e]]);q.push(f);c=o.concat(m).concat(k).concat(l)}return{shape:c,
+isolatedPts:q,allpoints:d}},triangulateShape:function(a,b){var c=THREE.Shape.Utils.removeHoles(a,b),d=c.allpoints,e=c.isolatedPts,c=THREE.FontUtils.Triangulate(c.shape,!1),f,g,h,i,j={};for(f=0,g=d.length;f<g;f++)i=d[f].x+":"+d[f].y,void 0!==j[i]&&console.log("Duplicate point",i),j[i]=f;for(f=0,g=c.length;f<g;f++){h=c[f];for(d=0;3>d;d++)i=h[d].x+":"+h[d].y,i=j[i],void 0!==i&&(h[d]=i)}for(f=0,g=e.length;f<g;f++){h=e[f];for(d=0;3>d;d++)i=h[d].x+":"+h[d].y,i=j[i],void 0!==i&&(h[d]=i)}return c.concat(e)},
+isClockWise:function(a){return 0>THREE.FontUtils.Triangulate.area(a)},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,d){return this.b2p0(a,b)+this.b2p1(a,c)+this.b2p2(a,d)},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,d,e){return this.b3p0(a,b)+this.b3p1(a,c)+this.b3p2(a,d)+
+this.b3p3(a,e)}};THREE.TextPath=function(a,b){THREE.Path.call(this);this.parameters=b||{};this.set(a)};THREE.TextPath.prototype.set=function(a,b){b=b||this.parameters;this.text=a;var c=void 0!==b.curveSegments?b.curveSegments:4,d=void 0!==b.font?b.font:"helvetiker",e=void 0!==b.weight?b.weight:"normal",f=void 0!==b.style?b.style:"normal";THREE.FontUtils.size=void 0!==b.size?b.size:100;THREE.FontUtils.divisions=c;THREE.FontUtils.face=d;THREE.FontUtils.weight=e;THREE.FontUtils.style=f};
 THREE.TextPath.prototype.toShapes=function(){for(var a=THREE.FontUtils.drawText(this.text).paths,b=[],c=0,d=a.length;c<d;c++)Array.prototype.push.apply(b,a[c].toShapes());return b};
 THREE.AnimationHandler=function(){var a=[],b={},c={update:function(b){for(var c=0;c<a.length;c++)a[c].update(b)},addToUpdate:function(b){-1===a.indexOf(b)&&a.push(b)},removeFromUpdate:function(b){b=a.indexOf(b);-1!==b&&a.splice(b,1)},add:function(a){void 0!==b[a.name]&&console.log("THREE.AnimationHandler.add: Warning! "+a.name+" already exists in library. Overwriting.");b[a.name]=a;if(!0!==a.initialized){for(var c=0;c<a.hierarchy.length;c++){for(var d=0;d<a.hierarchy[c].keys.length;d++){if(0>a.hierarchy[c].keys[d].time)a.hierarchy[c].keys[d].time=
 0;if(void 0!==a.hierarchy[c].keys[d].rot&&!(a.hierarchy[c].keys[d].rot instanceof THREE.Quaternion)){var h=a.hierarchy[c].keys[d].rot;a.hierarchy[c].keys[d].rot=new THREE.Quaternion(h[0],h[1],h[2],h[3])}}if(a.hierarchy[c].keys.length&&void 0!==a.hierarchy[c].keys[0].morphTargets){h={};for(d=0;d<a.hierarchy[c].keys.length;d++)for(var i=0;i<a.hierarchy[c].keys[d].morphTargets.length;i++){var j=a.hierarchy[c].keys[d].morphTargets[i];h[j]=-1}a.hierarchy[c].usedMorphTargets=h;for(d=0;d<a.hierarchy[c].keys.length;d++){var k=
 {};for(j in h){for(i=0;i<a.hierarchy[c].keys[d].morphTargets.length;i++)if(a.hierarchy[c].keys[d].morphTargets[i]===j){k[j]=a.hierarchy[c].keys[d].morphTargetsInfluences[i];break}i===a.hierarchy[c].keys[d].morphTargets.length&&(k[j]=0)}a.hierarchy[c].keys[d].morphTargetsInfluences=k}}for(d=1;d<a.hierarchy[c].keys.length;d++)a.hierarchy[c].keys[d].time===a.hierarchy[c].keys[d-1].time&&(a.hierarchy[c].keys.splice(d,1),d--);for(d=0;d<a.hierarchy[c].keys.length;d++)a.hierarchy[c].keys[d].index=d}d=parseInt(a.length*
 a.fps,10);a.JIT={};a.JIT.hierarchy=[];for(c=0;c<a.hierarchy.length;c++)a.JIT.hierarchy.push(Array(d));a.initialized=!0}},get:function(a){if("string"===typeof a){if(b[a])return b[a];console.log("THREE.AnimationHandler.get: Couldn't find animation "+a);return 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 d(a,b);return b}},d=function(a,b){b.push(a);for(var c=0;c<a.children.length;c++)d(a.children[c],b)};c.LINEAR=0;c.CATMULLROM=
 1;c.CATMULLROM_FORWARD=2;return c}();THREE.Animation=function(a,b,c,d){this.root=a;this.data=THREE.AnimationHandler.get(b);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.loop=this.isPaused=!0;this.interpolationType=void 0!==c?c:THREE.AnimationHandler.LINEAR;this.JITCompile=void 0!==d?d:!0;this.points=[];this.target=new THREE.Vector3};
-THREE.Animation.prototype.play=function(a,b){if(!this.isPlaying){this.isPlaying=!0;this.loop=void 0!==a?a:!0;this.currentTime=void 0!==b?b:0;var c,d=this.hierarchy.length,f;for(c=0;c<d;c++){f=this.hierarchy[c];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)f.useQuaternion=!0;f.matrixAutoUpdate=!0;if(void 0===f.animationCache)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 e=f.animationCache.prevKey;f=f.animationCache.nextKey;e.pos=this.data.hierarchy[c].keys[0];e.rot=this.data.hierarchy[c].keys[0];e.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.Animation.prototype.play=function(a,b){if(!this.isPlaying){this.isPlaying=!0;this.loop=void 0!==a?a:!0;this.currentTime=void 0!==b?b:0;var c,d=this.hierarchy.length,e;for(c=0;c<d;c++){e=this.hierarchy[c];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)e.useQuaternion=!0;e.matrixAutoUpdate=!0;if(void 0===e.animationCache)e.animationCache={},e.animationCache.prevKey={pos:0,rot:0,scl:0},e.animationCache.nextKey={pos:0,rot:0,scl:0},e.animationCache.originalMatrix=e instanceof
+THREE.Bone?e.skinMatrix:e.matrix;var f=e.animationCache.prevKey;e=e.animationCache.nextKey;f.pos=this.data.hierarchy[c].keys[0];f.rot=this.data.hierarchy[c].keys[0];f.scl=this.data.hierarchy[c].keys[0];e.pos=this.getNextKeyWith("pos",c,1);e.rot=this.getNextKeyWith("rot",c,1);e.scl=this.getNextKeyWith("scl",c,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
 THREE.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
 THREE.Animation.prototype.stop=function(){this.isPaused=this.isPlaying=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.hierarchy.length;a++)if(void 0!==this.hierarchy[a].animationCache)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,d,f,e,g,h,i,j,k=this.data.JIT.hierarchy,p,l;l=this.currentTime+=a*this.timeScale;p=this.currentTime%=this.data.length;j=parseInt(Math.min(p*this.data.fps,this.data.length*this.data.fps),10);for(var m=0,r=this.hierarchy.length;m<r;m++)if(a=this.hierarchy[m],i=a.animationCache,this.JITCompile&&void 0!==k[m][j])a instanceof THREE.Bone?(a.skinMatrix=k[m][j],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=!1):(a.matrix=
-k[m][j],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 n=0;3>n;n++){c=b[n];g=i.prevKey[c];h=i.nextKey[c];if(h.time<=l){if(p<l)if(this.loop){g=this.data.hierarchy[m].keys[0];for(h=this.getNextKeyWith(c,m,1);h.time<p;)g=h,h=this.getNextKeyWith(c,m,h.index+1)}else{this.stop();return}else{do g=h,h=this.getNextKeyWith(c,m,h.index+1);while(h.time<p)}i.prevKey[c]=
-g;i.nextKey[c]=h}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;d=(p-g.time)/(h.time-g.time);f=g[c];e=h[c];if(0>d||1<d)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+d+" on bone "+m),d=0>d?0:1;if("pos"===c)if(c=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)c.x=f[0]+(e[0]-f[0])*d,c.y=f[1]+(e[1]-f[1])*d,c.z=f[2]+(e[2]-f[2])*d;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
-this.getPrevKeyWith("pos",m,g.index-1).pos,this.points[1]=f,this.points[2]=e,this.points[3]=this.getNextKeyWith("pos",m,h.index+1).pos,d=0.33*d+0.33,f=this.interpolateCatmullRom(this.points,d),c.x=f[0],c.y=f[1],c.z=f[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)d=this.interpolateCatmullRom(this.points,1.01*d),this.target.set(d[0],d[1],d[2]),this.target.subSelf(c),this.target.y=0,this.target.normalize(),d=Math.atan2(this.target.x,this.target.z),a.rotation.set(0,d,0)}else if("rot"===
-c)THREE.Quaternion.slerp(f,e,a.quaternion,d);else if("scl"===c)c=a.scale,c.x=f[0]+(e[0]-f[0])*d,c.y=f[1]+(e[1]-f[1])*d,c.z=f[2]+(e[2]-f[2])*d}}if(this.JITCompile&&void 0===k[0][j]){this.hierarchy[0].updateMatrixWorld(!0);for(m=0;m<this.hierarchy.length;m++)k[m][j]=this.hierarchy[m]instanceof THREE.Bone?this.hierarchy[m].skinMatrix.clone():this.hierarchy[m].matrix.clone()}}};
-THREE.Animation.prototype.interpolateCatmullRom=function(a,b){var c=[],d=[],f,e,g,h,i,j;f=(a.length-1)*b;e=Math.floor(f);f-=e;c[0]=0===e?e:e-1;c[1]=e;c[2]=e>a.length-2?e:e+1;c[3]=e>a.length-3?e:e+2;e=a[c[0]];h=a[c[1]];i=a[c[2]];j=a[c[3]];c=f*f;g=f*c;d[0]=this.interpolate(e[0],h[0],i[0],j[0],f,c,g);d[1]=this.interpolate(e[1],h[1],i[1],j[1],f,c,g);d[2]=this.interpolate(e[2],h[2],i[2],j[2],f,c,g);return d};
-THREE.Animation.prototype.interpolate=function(a,b,c,d,f,e,g){a=0.5*(c-a);d=0.5*(d-b);return(2*(b-c)+a+d)*g+(-3*(b-c)-2*a-d)*e+a*f+b};THREE.Animation.prototype.getNextKeyWith=function(a,b,c){for(var d=this.data.hierarchy[b].keys,c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c<d.length-1?c:d.length-1:c%d.length;c<d.length;c++)if(void 0!==d[c][a])return d[c];return this.data.hierarchy[b].keys[0]};
+THREE.Animation.prototype.update=function(a){if(this.isPlaying){var b=["pos","rot","scl"],c,d,e,f,g,h,i,j,k=this.data.JIT.hierarchy,o,l;l=this.currentTime+=a*this.timeScale;o=this.currentTime%=this.data.length;j=parseInt(Math.min(o*this.data.fps,this.data.length*this.data.fps),10);for(var m=0,q=this.hierarchy.length;m<q;m++)if(a=this.hierarchy[m],i=a.animationCache,this.JITCompile&&void 0!==k[m][j])a instanceof THREE.Bone?(a.skinMatrix=k[m][j],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=!1):(a.matrix=
+k[m][j],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 n=0;3>n;n++){c=b[n];g=i.prevKey[c];h=i.nextKey[c];if(h.time<=l){if(o<l)if(this.loop){g=this.data.hierarchy[m].keys[0];for(h=this.getNextKeyWith(c,m,1);h.time<o;)g=h,h=this.getNextKeyWith(c,m,h.index+1)}else{this.stop();return}else{do g=h,h=this.getNextKeyWith(c,m,h.index+1);while(h.time<o)}i.prevKey[c]=
+g;i.nextKey[c]=h}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;d=(o-g.time)/(h.time-g.time);e=g[c];f=h[c];if(0>d||1<d)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+d+" on bone "+m),d=0>d?0:1;if("pos"===c)if(c=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)c.x=e[0]+(f[0]-e[0])*d,c.y=e[1]+(f[1]-e[1])*d,c.z=e[2]+(f[2]-e[2])*d;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
+this.getPrevKeyWith("pos",m,g.index-1).pos,this.points[1]=e,this.points[2]=f,this.points[3]=this.getNextKeyWith("pos",m,h.index+1).pos,d=0.33*d+0.33,e=this.interpolateCatmullRom(this.points,d),c.x=e[0],c.y=e[1],c.z=e[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)d=this.interpolateCatmullRom(this.points,1.01*d),this.target.set(d[0],d[1],d[2]),this.target.subSelf(c),this.target.y=0,this.target.normalize(),d=Math.atan2(this.target.x,this.target.z),a.rotation.set(0,d,0)}else if("rot"===
+c)THREE.Quaternion.slerp(e,f,a.quaternion,d);else if("scl"===c)c=a.scale,c.x=e[0]+(f[0]-e[0])*d,c.y=e[1]+(f[1]-e[1])*d,c.z=e[2]+(f[2]-e[2])*d}}if(this.JITCompile&&void 0===k[0][j]){this.hierarchy[0].updateMatrixWorld(!0);for(m=0;m<this.hierarchy.length;m++)k[m][j]=this.hierarchy[m]instanceof THREE.Bone?this.hierarchy[m].skinMatrix.clone():this.hierarchy[m].matrix.clone()}}};
+THREE.Animation.prototype.interpolateCatmullRom=function(a,b){var c=[],d=[],e,f,g,h,i,j;e=(a.length-1)*b;f=Math.floor(e);e-=f;c[0]=0===f?f:f-1;c[1]=f;c[2]=f>a.length-2?f:f+1;c[3]=f>a.length-3?f:f+2;f=a[c[0]];h=a[c[1]];i=a[c[2]];j=a[c[3]];c=e*e;g=e*c;d[0]=this.interpolate(f[0],h[0],i[0],j[0],e,c,g);d[1]=this.interpolate(f[1],h[1],i[1],j[1],e,c,g);d[2]=this.interpolate(f[2],h[2],i[2],j[2],e,c,g);return d};
+THREE.Animation.prototype.interpolate=function(a,b,c,d,e,f,g){a=0.5*(c-a);d=0.5*(d-b);return(2*(b-c)+a+d)*g+(-3*(b-c)-2*a-d)*f+a*e+b};THREE.Animation.prototype.getNextKeyWith=function(a,b,c){for(var d=this.data.hierarchy[b].keys,c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c<d.length-1?c:d.length-1:c%d.length;c<d.length;c++)if(void 0!==d[c][a])return d[c];return this.data.hierarchy[b].keys[0]};
 THREE.Animation.prototype.getPrevKeyWith=function(a,b,c){for(var d=this.data.hierarchy[b].keys,c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?0<c?c:0:0<=c?c:c+d.length;0<=c;c--)if(void 0!==d[c][a])return d[c];return this.data.hierarchy[b].keys[d.length-1]};
-THREE.KeyFrameAnimation=function(a,b,c){this.root=a;this.data=THREE.AnimationHandler.get(b);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=0.001;this.isPlaying=!1;this.loop=this.isPaused=!0;this.JITCompile=void 0!==c?c:!0;a=0;for(b=this.hierarchy.length;a<b;a++){var c=this.data.hierarchy[a].sids,d=this.hierarchy[a];if(this.data.hierarchy[a].keys.length&&c){for(var f=0;f<c.length;f++){var e=c[f],g=this.getNextKeyWith(e,a,0);g&&g.apply(e)}d.matrixAutoUpdate=!1;this.data.hierarchy[a].node.updateMatrix();
+THREE.KeyFrameAnimation=function(a,b,c){this.root=a;this.data=THREE.AnimationHandler.get(b);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=0.001;this.isPlaying=!1;this.loop=this.isPaused=!0;this.JITCompile=void 0!==c?c:!0;a=0;for(b=this.hierarchy.length;a<b;a++){var c=this.data.hierarchy[a].sids,d=this.hierarchy[a];if(this.data.hierarchy[a].keys.length&&c){for(var e=0;e<c.length;e++){var f=c[e],g=this.getNextKeyWith(f,a,0);g&&g.apply(f)}d.matrixAutoUpdate=!1;this.data.hierarchy[a].node.updateMatrix();
 d.matrixWorldNeedsUpdate=!0}}};
-THREE.KeyFrameAnimation.prototype.play=function(a,b){if(!this.isPlaying){this.isPlaying=!0;this.loop=void 0!==a?a:!0;this.currentTime=void 0!==b?b:0;this.startTimeMs=b;this.startTime=1E7;this.endTime=-this.startTime;var c,d=this.hierarchy.length,f,e;for(c=0;c<d;c++){f=this.hierarchy[c];e=this.data.hierarchy[c];f.useQuaternion=!0;if(void 0===e.animationCache)e.animationCache={},e.animationCache.prevKey=null,e.animationCache.nextKey=null,e.animationCache.originalMatrix=f instanceof THREE.Bone?f.skinMatrix:
-f.matrix;f=this.data.hierarchy[c].keys;if(f.length)e.animationCache.prevKey=f[0],e.animationCache.nextKey=f[1],this.startTime=Math.min(f[0].time,this.startTime),this.endTime=Math.max(f[f.length-1].time,this.endTime)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};THREE.KeyFrameAnimation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
+THREE.KeyFrameAnimation.prototype.play=function(a,b){if(!this.isPlaying){this.isPlaying=!0;this.loop=void 0!==a?a:!0;this.currentTime=void 0!==b?b:0;this.startTimeMs=b;this.startTime=1E7;this.endTime=-this.startTime;var c,d=this.hierarchy.length,e,f;for(c=0;c<d;c++){e=this.hierarchy[c];f=this.data.hierarchy[c];e.useQuaternion=!0;if(void 0===f.animationCache)f.animationCache={},f.animationCache.prevKey=null,f.animationCache.nextKey=null,f.animationCache.originalMatrix=e instanceof THREE.Bone?e.skinMatrix:
+e.matrix;e=this.data.hierarchy[c].keys;if(e.length)f.animationCache.prevKey=e[0],f.animationCache.nextKey=e[1],this.startTime=Math.min(e[0].time,this.startTime),this.endTime=Math.max(e[e.length-1].time,this.endTime)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};THREE.KeyFrameAnimation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
 THREE.KeyFrameAnimation.prototype.stop=function(){this.isPaused=this.isPlaying=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.data.hierarchy.length;a++){var b=this.hierarchy[a],c=this.data.hierarchy[a];if(void 0!==c.animationCache){var d=c.animationCache.originalMatrix;b instanceof THREE.Bone?(d.copy(b.skinMatrix),b.skinMatrix=d):(d.copy(b.matrix),b.matrix=d);delete c.animationCache}}};
-THREE.KeyFrameAnimation.prototype.update=function(a){if(this.isPlaying){var b,c,d,f,e=this.data.JIT.hierarchy,g,h,i;h=this.currentTime+=a*this.timeScale;g=this.currentTime%=this.data.length;if(g<this.startTimeMs)g=this.currentTime=this.startTimeMs+g;f=parseInt(Math.min(g*this.data.fps,this.data.length*this.data.fps),10);if((i=g<h)&&!this.loop){for(var a=0,j=this.hierarchy.length;a<j;a++){var k=this.data.hierarchy[a].keys,e=this.data.hierarchy[a].sids;d=k.length-1;f=this.hierarchy[a];if(k.length){for(k=
-0;k<e.length;k++)g=e[k],(h=this.getPrevKeyWith(g,a,d))&&h.apply(g);this.data.hierarchy[a].node.updateMatrix();f.matrixWorldNeedsUpdate=!0}}this.stop()}else if(!(g<this.startTime)){a=0;for(j=this.hierarchy.length;a<j;a++){d=this.hierarchy[a];b=this.data.hierarchy[a];var k=b.keys,p=b.animationCache;if(this.JITCompile&&void 0!==e[a][f])d instanceof THREE.Bone?(d.skinMatrix=e[a][f],d.matrixWorldNeedsUpdate=!1):(d.matrix=e[a][f],d.matrixWorldNeedsUpdate=!0);else if(k.length){if(this.JITCompile&&p)d instanceof
-THREE.Bone?d.skinMatrix=p.originalMatrix:d.matrix=p.originalMatrix;b=p.prevKey;c=p.nextKey;if(b&&c){if(c.time<=h){if(i&&this.loop){b=k[0];for(c=k[1];c.time<g;)b=c,c=k[b.index+1]}else if(!i)for(var l=k.length-1;c.time<g&&c.index!==l;)b=c,c=k[b.index+1];p.prevKey=b;p.nextKey=c}c.time>=g?b.interpolate(c,g):b.interpolate(c,c.time)}this.data.hierarchy[a].node.updateMatrix();d.matrixWorldNeedsUpdate=!0}}if(this.JITCompile&&void 0===e[0][f]){this.hierarchy[0].updateMatrixWorld(!0);for(a=0;a<this.hierarchy.length;a++)e[a][f]=
+THREE.KeyFrameAnimation.prototype.update=function(a){if(this.isPlaying){var b,c,d,e,f=this.data.JIT.hierarchy,g,h,i;h=this.currentTime+=a*this.timeScale;g=this.currentTime%=this.data.length;if(g<this.startTimeMs)g=this.currentTime=this.startTimeMs+g;e=parseInt(Math.min(g*this.data.fps,this.data.length*this.data.fps),10);if((i=g<h)&&!this.loop){for(var a=0,j=this.hierarchy.length;a<j;a++){var k=this.data.hierarchy[a].keys,f=this.data.hierarchy[a].sids;d=k.length-1;e=this.hierarchy[a];if(k.length){for(k=
+0;k<f.length;k++)g=f[k],(h=this.getPrevKeyWith(g,a,d))&&h.apply(g);this.data.hierarchy[a].node.updateMatrix();e.matrixWorldNeedsUpdate=!0}}this.stop()}else if(!(g<this.startTime)){a=0;for(j=this.hierarchy.length;a<j;a++){d=this.hierarchy[a];b=this.data.hierarchy[a];var k=b.keys,o=b.animationCache;if(this.JITCompile&&void 0!==f[a][e])d instanceof THREE.Bone?(d.skinMatrix=f[a][e],d.matrixWorldNeedsUpdate=!1):(d.matrix=f[a][e],d.matrixWorldNeedsUpdate=!0);else if(k.length){if(this.JITCompile&&o)d instanceof
+THREE.Bone?d.skinMatrix=o.originalMatrix:d.matrix=o.originalMatrix;b=o.prevKey;c=o.nextKey;if(b&&c){if(c.time<=h){if(i&&this.loop){b=k[0];for(c=k[1];c.time<g;)b=c,c=k[b.index+1]}else if(!i)for(var l=k.length-1;c.time<g&&c.index!==l;)b=c,c=k[b.index+1];o.prevKey=b;o.nextKey=c}c.time>=g?b.interpolate(c,g):b.interpolate(c,c.time)}this.data.hierarchy[a].node.updateMatrix();d.matrixWorldNeedsUpdate=!0}}if(this.JITCompile&&void 0===f[0][e]){this.hierarchy[0].updateMatrixWorld(!0);for(a=0;a<this.hierarchy.length;a++)f[a][e]=
 this.hierarchy[a]instanceof THREE.Bone?this.hierarchy[a].skinMatrix.clone():this.hierarchy[a].matrix.clone()}}}};THREE.KeyFrameAnimation.prototype.getNextKeyWith=function(a,b,c){b=this.data.hierarchy[b].keys;for(c%=b.length;c<b.length;c++)if(b[c].hasTarget(a))return b[c];return b[0]};THREE.KeyFrameAnimation.prototype.getPrevKeyWith=function(a,b,c){b=this.data.hierarchy[b].keys;for(c=0<=c?c:c+b.length;0<=c;c--)if(b[c].hasTarget(a))return b[c];return b[b.length-1]};
-THREE.CubeCamera=function(a,b,c,d){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=
-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(d,d,{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,b){var c=this.renderTarget;c.activeCubeFace=0;a.render(b,this.cameraPX,c);c.activeCubeFace=1;a.render(b,this.cameraNX,c);c.activeCubeFace=2;a.render(b,this.cameraPY,c);c.activeCubeFace=3;a.render(b,
-this.cameraNY,c);c.activeCubeFace=4;a.render(b,this.cameraPZ,c);c.activeCubeFace=5;a.render(b,this.cameraNZ,c)}};THREE.CombinedCamera=function(a,b,c,d,f,e,g){THREE.Camera.call(this);this.fov=c;this.left=-a/2;this.right=a/2;this.top=b/2;this.bottom=-b/2;this.cameraO=new THREE.OrthographicCamera(a/-2,a/2,b/2,b/-2,e,g);this.cameraP=new THREE.PerspectiveCamera(c,a/b,d,f);this.zoom=1;this.toPerspective()};THREE.CombinedCamera.prototype=new THREE.Camera;THREE.CombinedCamera.prototype.constructor=THREE.CoolCamera;
+THREE.CubeCamera=function(a,b,c){this.position=new THREE.Vector3;var d=new THREE.PerspectiveCamera(90,1,a,b),e=new THREE.PerspectiveCamera(90,1,a,b),f=new THREE.PerspectiveCamera(90,1,a,b),g=new THREE.PerspectiveCamera(90,1,a,b),h=new THREE.PerspectiveCamera(90,1,a,b),i=new THREE.PerspectiveCamera(90,1,a,b);d.position=this.position;d.up.set(0,-1,0);d.lookAt(new THREE.Vector3(1,0,0));e.position=this.position;e.up.set(0,-1,0);e.lookAt(new THREE.Vector3(-1,0,0));f.position=this.position;f.up.set(0,0,
+1);f.lookAt(new THREE.Vector3(0,1,0));g.position=this.position;g.up.set(0,0,-1);g.lookAt(new THREE.Vector3(0,-1,0));h.position=this.position;h.up.set(0,-1,0);h.lookAt(new THREE.Vector3(0,0,1));i.position=this.position;i.up.set(0,-1,0);i.lookAt(new THREE.Vector3(0,0,-1));this.renderTarget=new THREE.WebGLRenderTargetCube(c,c,{format:THREE.RGBFormat,magFilter:THREE.LinearFilter,minFilter:THREE.LinearFilter});this.updateCubeMap=function(a,b){var c=this.renderTarget,l=c.generateMipmaps;c.generateMipmaps=
+!1;c.activeCubeFace=0;a.render(b,d,c);c.activeCubeFace=1;a.render(b,e,c);c.activeCubeFace=2;a.render(b,f,c);c.activeCubeFace=3;a.render(b,g,c);c.activeCubeFace=4;a.render(b,h,c);c.generateMipmaps=l;c.activeCubeFace=5;a.render(b,i,c)}};
+THREE.CombinedCamera=function(a,b,c,d,e,f,g){THREE.Camera.call(this);this.fov=c;this.left=-a/2;this.right=a/2;this.top=b/2;this.bottom=-b/2;this.cameraO=new THREE.OrthographicCamera(a/-2,a/2,b/2,b/-2,f,g);this.cameraP=new THREE.PerspectiveCamera(c,a/b,d,e);this.zoom=1;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.cameraP.fov=this.fov/this.zoom;this.cameraP.updateProjectionMatrix();this.projectionMatrix=this.cameraP.projectionMatrix;this.inPersepectiveMode=!0;this.inOrthographicMode=!1};
 THREE.CombinedCamera.prototype.toOrthographic=function(){var a=this.cameraP.aspect,b=(this.cameraP.near+this.cameraP.far)/2,b=Math.tan(this.fov/2)*b,a=2*b*a/2,b=b/this.zoom,a=a/this.zoom;this.cameraO.left=-a;this.cameraO.right=a;this.cameraO.top=b;this.cameraO.bottom=-b;this.cameraO.updateProjectionMatrix();this.near=this.cameraO.near;this.far=this.cameraO.far;this.projectionMatrix=this.cameraO.projectionMatrix;this.inPersepectiveMode=!1;this.inOrthographicMode=!0};
 THREE.CombinedCamera.prototype.setFov=function(a){this.fov=a;this.inPersepectiveMode?this.toPerspective():this.toOrthographic()};THREE.CombinedCamera.prototype.setLens=function(a,b){var c=2*Math.atan((void 0!==b?b:24)/(2*a))*(180/Math.PI);this.setFov(c);return c};THREE.CombinedCamera.prototype.setZoom=function(a){this.zoom=a;this.inPersepectiveMode?this.toPerspective():this.toOrthographic()};
@@ -137,14 +136,14 @@ function(a){switch(a.keyCode){case 38:case 87:this.moveForward=!0;break;case 37:
 this.moveUp&&this.object.translateY(b);this.moveDown&&this.object.translateY(-b);a*=this.lookSpeed;this.activeLook||(a=0);this.lon+=this.mouseX*a;this.lookVertical&&(this.lat-=this.mouseY*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;var b=this.target,c=this.object.position;b.x=c.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=c.y+100*Math.cos(this.phi);b.z=c.z+100*Math.sin(this.phi)*Math.sin(this.theta);b=1;this.constrainVertical&&
 (b=Math.PI/(this.verticalMax-this.verticalMin));this.lon+=this.mouseX*a;this.lookVertical&&(this.lat-=this.mouseY*a*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;if(this.constrainVertical)this.phi=THREE.Math.mapLinear(this.phi,0,Math.PI,this.verticalMin,this.verticalMax);b=this.target;c=this.object.position;b.x=c.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=c.y+100*Math.cos(this.phi);b.z=c.z+100*Math.sin(this.phi)*Math.sin(this.theta);
 this.object.lookAt(b)}};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){return 1>(a*=2)?0.5*a*a:-0.5*(--a*(a-2)-1)}function d(a,b){return function(){b.apply(a,arguments)}}function f(a,b,c,d){var e={name:c,fps:0.6,length:d,hierarchy:[]},f,g=b.getControlPointsArray(),h=b.getLength(),o=g.length,q=0;f=o-1;b={parent:-1,keys:[]};b.keys[0]={time:0,pos:g[0],rot:[0,0,0,1],scl:[1,1,1]};b.keys[f]={time:d,pos:g[f],rot:[0,0,0,1],scl:[1,1,1]};for(f=1;f<o-1;f++)q=d*h.chunks[f]/h.total,b.keys[f]={time:q,pos:g[f]};e.hierarchy[0]=b;THREE.AnimationHandler.add(e);
-return new THREE.Animation(a,c,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function e(a,b){var c,d,f=new THREE.Geometry;for(c=0;c<a.points.length*b;c++)d=c/(a.points.length*b),d=a.getPoint(d),f.vertices[c]=new THREE.Vertex(new THREE.Vector3(d.x,d.y,d.z));return f}this.object=a;this.domElement=void 0!==b?b:document;this.id="PathControls"+THREE.PathControlsIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=new THREE.Object3D;this.debugDummy=
+THREE.PathControls=function(a,b){function c(a){return 1>(a*=2)?0.5*a*a:-0.5*(--a*(a-2)-1)}function d(a,b){return function(){b.apply(a,arguments)}}function e(a,b,c,d){var f={name:c,fps:0.6,length:d,hierarchy:[]},e,g=b.getControlPointsArray(),h=b.getLength(),p=g.length,r=0;e=p-1;b={parent:-1,keys:[]};b.keys[0]={time:0,pos:g[0],rot:[0,0,0,1],scl:[1,1,1]};b.keys[e]={time:d,pos:g[e],rot:[0,0,0,1],scl:[1,1,1]};for(e=1;e<p-1;e++)r=d*h.chunks[e]/h.total,b.keys[e]={time:r,pos:g[e]};f.hierarchy[0]=b;THREE.AnimationHandler.add(f);
+return new THREE.Animation(a,c,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function f(a,b){var c,d,e=new THREE.Geometry;for(c=0;c<a.points.length*b;c++)d=c/(a.points.length*b),d=a.getPoint(d),e.vertices[c]=new THREE.Vertex(new THREE.Vector3(d.x,d.y,d.z));return e}this.object=a;this.domElement=void 0!==b?b: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.005;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=2*Math.PI,h=Math.PI/180;this.update=function(a){var b;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed*a);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed*a);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)*h;this.theta=this.lon*h;a=this.phi%g;this.phi=0<=a?a:a+g;b=this.verticalAngleMap.srcRange;a=this.verticalAngleMap.dstRange;
 b=THREE.Math.mapLinear(this.phi,b[0],b[1],a[0],a[1]);var d=a[1]-a[0];this.phi=c((b-a[0])/d)*d+a[0];b=this.horizontalAngleMap.srcRange;a=this.horizontalAngleMap.dstRange;b=THREE.Math.mapLinear(this.theta,b[0],b[1],a[0],a[1]);d=a[1]-a[0];this.theta=c((b-a[0])/d)*d+a[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),g=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(c,a);a=new THREE.Mesh(g,b);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,b=this.spline,g=e(b,10),c=e(b,10),h=new THREE.LineBasicMaterial({color:16711680,linewidth:3}),g=new THREE.Line(g,h),c=new THREE.ParticleSystem(c,new THREE.ParticleBasicMaterial({color:16755200,size:3}));g.scale.set(1,1,1);a.add(g);c.scale.set(1,1,1);a.add(c);for(var g=new THREE.SphereGeometry(1,16,8),h=new THREE.MeshBasicMaterial({color:65280}),m=0;m<b.points.length;m++)c=new THREE.Mesh(g,h),c.position.copy(b.points[m]),a.add(c)}this.domElement.addEventListener("mousemove",d(this,this.onMouseMove),
+c=new THREE.CubeGeometry(10,10,20),g=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(c,a);a=new THREE.Mesh(g,b);a.position.set(0,10,0);this.animation=e(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=e(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,g=f(b,10),c=f(b,10),h=new THREE.LineBasicMaterial({color:16711680,linewidth:3}),g=new THREE.Line(g,h),c=new THREE.ParticleSystem(c,new THREE.ParticleBasicMaterial({color:16755200,size:3}));g.scale.set(1,1,1);a.add(g);c.scale.set(1,1,1);a.add(c);for(var g=new THREE.SphereGeometry(1,16,8),h=new THREE.MeshBasicMaterial({color:65280}),m=0;m<b.points.length;m++)c=new THREE.Mesh(g,h),c.position.copy(b.points[m]),a.add(c)}this.domElement.addEventListener("mousemove",d(this,this.onMouseMove),
 !1)}};THREE.PathControlsIdCounter=0;
 THREE.FlyControls=function(a,b){function c(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.domElement=void 0!==b?b:document;b&&this.domElement.setAttribute("tabindex",-1);this.movementSpeed=1;this.rollSpeed=0.005;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.handleEvent=function(a){if("function"==typeof this[a.type])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=
@@ -155,262 +154,264 @@ THREE.FlyControls=function(a,b){function c(a,b){return function(){b.apply(a,argu
 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=void 0!==b?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;var c=new THREE.Vector3,d=new THREE.Vector3,f=new THREE.Vector3,e=new THREE.Matrix4,g=!1,h=1,i=0,j=0,k=0,p=0,l=0,m=window.innerWidth/2,r=window.innerHeight/2;this.update=function(a){if(this.mouseLook){var b=a*this.lookSpeed;
-this.rotateHorizontally(b*p);this.rotateVertically(b*l)}b=a*this.movementSpeed;this.object.translateZ(-b*(0<i||this.autoForward&&!(0>i)?1:i));this.object.translateX(b*j);this.object.translateY(b*k);g&&(this.roll+=this.rollSpeed*a*h);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);d.set(0,1,0);c.cross(d,
-f).normalize();d.cross(f,c).normalize();this.object.matrix.n11=c.x;this.object.matrix.n12=d.x;this.object.matrix.n13=f.x;this.object.matrix.n21=c.y;this.object.matrix.n22=d.y;this.object.matrix.n23=f.y;this.object.matrix.n31=c.z;this.object.matrix.n32=d.z;this.object.matrix.n33=f.z;e.identity();e.n11=Math.cos(this.roll);e.n12=-Math.sin(this.roll);e.n21=Math.sin(this.roll);e.n22=Math.cos(this.roll);this.object.matrix.multiplySelf(e);this.object.matrixWorldNeedsUpdate=!0;this.object.matrix.n14=this.object.position.x;
+THREE.RollControls=function(a,b){this.object=a;this.domElement=void 0!==b?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;var c=new THREE.Vector3,d=new THREE.Vector3,e=new THREE.Vector3,f=new THREE.Matrix4,g=!1,h=1,i=0,j=0,k=0,o=0,l=0,m=window.innerWidth/2,q=window.innerHeight/2;this.update=function(a){if(this.mouseLook){var b=a*this.lookSpeed;
+this.rotateHorizontally(b*o);this.rotateVertically(b*l)}b=a*this.movementSpeed;this.object.translateZ(-b*(0<i||this.autoForward&&!(0>i)?1:i));this.object.translateX(b*j);this.object.translateY(b*k);g&&(this.roll+=this.rollSpeed*a*h);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();e.copy(this.forward);d.set(0,1,0);c.cross(d,
+e).normalize();d.cross(e,c).normalize();this.object.matrix.n11=c.x;this.object.matrix.n12=d.x;this.object.matrix.n13=e.x;this.object.matrix.n21=c.y;this.object.matrix.n22=d.y;this.object.matrix.n23=e.y;this.object.matrix.n31=c.z;this.object.matrix.n32=d.z;this.object.matrix.n33=e.z;f.identity();f.n11=Math.cos(this.roll);f.n12=-Math.sin(this.roll);f.n21=Math.sin(this.roll);f.n22=Math.cos(this.roll);this.object.matrix.multiplySelf(f);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){d.set(this.object.matrix.n12,this.object.matrix.n22,this.object.matrix.n32);d.multiplyScalar(a);this.forward.addSelf(d);this.forward.normalize()};this.domElement.addEventListener("contextmenu",
-function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){p=(a.clientX-m)/window.innerWidth;l=(a.clientY-r)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:i=1;break;case 2:i=-1}},!1);this.domElement.addEventListener("mouseup",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:i=0;break;case 2:i=0}},!1);this.domElement.addEventListener("keydown",
+function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){o=(a.clientX-m)/window.innerWidth;l=(a.clientY-q)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:i=1;break;case 2:i=-1}},!1);this.domElement.addEventListener("mouseup",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:i=0;break;case 2:i=0}},!1);this.domElement.addEventListener("keydown",
 function(a){switch(a.keyCode){case 38:case 87:i=1;break;case 37:case 65:j=-1;break;case 40:case 83:i=-1;break;case 39:case 68:j=1;break;case 81:g=!0;h=1;break;case 69:g=!0;h=-1;break;case 82:k=1;break;case 70:k=-1}},!1);this.domElement.addEventListener("keyup",function(a){switch(a.keyCode){case 38:case 87:i=0;break;case 37:case 65:j=0;break;case 40:case 83:i=0;break;case 39:case 68:j=0;break;case 81:g=!1;break;case 69:g=!1;break;case 82:k=0;break;case 70:k=0}},!1)};
 THREE.TrackballControls=function(a,b){THREE.EventTarget.call(this);var c=this;this.object=a;this.domElement=void 0!==b?b: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=this.noRotate=!1;this.dynamicDampingFactor=0.2;this.minDistance=0;this.maxDistance=Infinity;this.keys=[65,83,68];this.target=
-new THREE.Vector3;var d=new THREE.Vector3,f=!1,e=-1,g=new THREE.Vector3,h=new THREE.Vector3,i=new THREE.Vector3,j=new THREE.Vector2,k=new THREE.Vector2,p=new THREE.Vector2,l=new THREE.Vector2,m={type:"change"};this.handleEvent=function(a){if("function"==typeof this[a.type])this[a.type](a)};this.getMouseOnScreen=function(a,b){return new THREE.Vector2(0.5*((a-c.screen.offsetLeft)/c.radius),0.5*((b-c.screen.offsetTop)/c.radius))};this.getMouseProjectionOnBall=function(a,b){var d=new THREE.Vector3((a-
-0.5*c.screen.width-c.screen.offsetLeft)/c.radius,(0.5*c.screen.height+c.screen.offsetTop-b)/c.radius,0),e=d.length();1<e?d.normalize():d.z=Math.sqrt(1-e*e);g.copy(c.object.position).subSelf(c.target);e=c.object.up.clone().setLength(d.y);e.addSelf(c.object.up.clone().crossSelf(g).setLength(d.x));e.addSelf(g.setLength(d.z));return e};this.rotateCamera=function(){var a=Math.acos(h.dot(i)/h.length()/i.length());if(a){var b=(new THREE.Vector3).cross(h,i).normalize(),d=new THREE.Quaternion,a=a*c.rotateSpeed;
-d.setFromAxisAngle(b,-a);d.multiplyVector3(g);d.multiplyVector3(c.object.up);d.multiplyVector3(i);c.staticMoving?h=i:(d.setFromAxisAngle(b,a*(c.dynamicDampingFactor-1)),d.multiplyVector3(h))}};this.zoomCamera=function(){var a=1+(k.y-j.y)*c.zoomSpeed;1!==a&&0<a&&(g.multiplyScalar(a),c.staticMoving?j=k:j.y+=(k.y-j.y)*this.dynamicDampingFactor)};this.panCamera=function(){var a=l.clone().subSelf(p);if(a.lengthSq()){a.multiplyScalar(g.length()*c.panSpeed);var b=g.clone().crossSelf(c.object.up).setLength(a.x);
-b.addSelf(c.object.up.clone().setLength(a.y));c.object.position.addSelf(b);c.target.addSelf(b);c.staticMoving?p=l:p.addSelf(a.sub(l,p).multiplyScalar(c.dynamicDampingFactor))}};this.checkDistances=function(){if(!c.noZoom||!c.noPan)c.object.position.lengthSq()>c.maxDistance*c.maxDistance&&c.object.position.setLength(c.maxDistance),g.lengthSq()<c.minDistance*c.minDistance&&c.object.position.add(c.target,g.setLength(c.minDistance))};this.update=function(){g.copy(c.object.position).subSelf(c.target);
-c.noRotate||c.rotateCamera();c.noZoom||c.zoomCamera();c.noPan||c.panCamera();c.object.position.add(c.target,g);c.checkDistances();c.object.lookAt(c.target);0<d.distanceTo(c.object.position)&&(c.dispatchEvent(m),d.copy(c.object.position))};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){c.enabled&&(f&&(h=i=c.getMouseProjectionOnBall(a.clientX,a.clientY),j=k=c.getMouseOnScreen(a.clientX,a.clientY),p=l=c.getMouseOnScreen(a.clientX,
-a.clientY),f=!1),-1!==e&&(0===e&&!c.noRotate?i=c.getMouseProjectionOnBall(a.clientX,a.clientY):1===e&&!c.noZoom?k=c.getMouseOnScreen(a.clientX,a.clientY):2===e&&!c.noPan&&(l=c.getMouseOnScreen(a.clientX,a.clientY))))},!1);this.domElement.addEventListener("mousedown",function(a){if(c.enabled&&(a.preventDefault(),a.stopPropagation(),-1===e))e=a.button,0===e&&!c.noRotate?h=i=c.getMouseProjectionOnBall(a.clientX,a.clientY):1===e&&!c.noZoom?j=k=c.getMouseOnScreen(a.clientX,a.clientY):this.noPan||(p=l=
-c.getMouseOnScreen(a.clientX,a.clientY))},!1);this.domElement.addEventListener("mouseup",function(a){c.enabled&&(a.preventDefault(),a.stopPropagation(),e=-1)},!1);window.addEventListener("keydown",function(a){c.enabled&&-1===e&&(a.keyCode===c.keys[0]&&!c.noRotate?e=0:a.keyCode===c.keys[1]&&!c.noZoom?e=1:a.keyCode===c.keys[2]&&!c.noPan&&(e=2),-1!==e&&(f=!0))},!1);window.addEventListener("keyup",function(){c.enabled&&-1!==e&&(e=-1)},!1)};
-THREE.CubeGeometry=function(a,b,c,d,f,e,g,h){function i(a,b,c,g,h,l,i,k){var m,n=d||1,p=f||1,r=h/2,o=l/2,q=j.vertices.length;if("x"===a&&"y"===b||"y"===a&&"x"===b)m="z";else if("x"===a&&"z"===b||"z"===a&&"x"===b)m="y",p=e||1;else if("z"===a&&"y"===b||"y"===a&&"z"===b)m="x",n=e||1;var s=n+1,u=p+1,F=h/n,L=l/p,N=new THREE.Vector3;N[m]=0<i?1:-1;for(h=0;h<u;h++)for(l=0;l<s;l++){var A=new THREE.Vector3;A[a]=(l*F-r)*c;A[b]=(h*L-o)*g;A[m]=i;j.vertices.push(new THREE.Vertex(A))}for(h=0;h<p;h++)for(l=0;l<n;l++)a=
-new THREE.Face4(l+s*h+q,l+s*(h+1)+q,l+1+s*(h+1)+q,l+1+s*h+q),a.normal.copy(N),a.vertexNormals.push(N.clone(),N.clone(),N.clone(),N.clone()),a.materialIndex=k,j.faces.push(a),j.faceVertexUvs[0].push([new THREE.UV(l/n,h/p),new THREE.UV(l/n,(h+1)/p),new THREE.UV((l+1)/n,(h+1)/p),new THREE.UV((l+1)/n,h/p)])}THREE.Geometry.call(this);var j=this,k=a/2,p=b/2,l=c/2,m,r,n,o,q,u;if(void 0!==g){if(g instanceof Array)this.materials=g;else{this.materials=[];for(m=0;6>m;m++)this.materials.push(g)}m=0;o=1;r=2;q=
-3;n=4;u=5}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(void 0!=h)for(var s in h)void 0!==this.sides[s]&&(this.sides[s]=h[s]);this.sides.px&&i("z","y",-1,-1,c,b,k,m);this.sides.nx&&i("z","y",1,-1,c,b,-k,o);this.sides.py&&i("x","z",1,1,a,c,p,r);this.sides.ny&&i("x","z",1,-1,a,c,-p,q);this.sides.pz&&i("x","y",1,-1,a,b,l,n);this.sides.nz&&i("x","y",-1,-1,a,b,-l,u);this.computeCentroids();this.mergeVertices()};THREE.CubeGeometry.prototype=new THREE.Geometry;
+new THREE.Vector3;var d=new THREE.Vector3,e=!1,f=-1,g=new THREE.Vector3,h=new THREE.Vector3,i=new THREE.Vector3,j=new THREE.Vector2,k=new THREE.Vector2,o=new THREE.Vector2,l=new THREE.Vector2,m={type:"change"};this.handleEvent=function(a){if("function"==typeof this[a.type])this[a.type](a)};this.getMouseOnScreen=function(a,b){return new THREE.Vector2(0.5*((a-c.screen.offsetLeft)/c.radius),0.5*((b-c.screen.offsetTop)/c.radius))};this.getMouseProjectionOnBall=function(a,b){var d=new THREE.Vector3((a-
+0.5*c.screen.width-c.screen.offsetLeft)/c.radius,(0.5*c.screen.height+c.screen.offsetTop-b)/c.radius,0),f=d.length();1<f?d.normalize():d.z=Math.sqrt(1-f*f);g.copy(c.object.position).subSelf(c.target);f=c.object.up.clone().setLength(d.y);f.addSelf(c.object.up.clone().crossSelf(g).setLength(d.x));f.addSelf(g.setLength(d.z));return f};this.rotateCamera=function(){var a=Math.acos(h.dot(i)/h.length()/i.length());if(a){var b=(new THREE.Vector3).cross(h,i).normalize(),d=new THREE.Quaternion,a=a*c.rotateSpeed;
+d.setFromAxisAngle(b,-a);d.multiplyVector3(g);d.multiplyVector3(c.object.up);d.multiplyVector3(i);c.staticMoving?h=i:(d.setFromAxisAngle(b,a*(c.dynamicDampingFactor-1)),d.multiplyVector3(h))}};this.zoomCamera=function(){var a=1+(k.y-j.y)*c.zoomSpeed;1!==a&&0<a&&(g.multiplyScalar(a),c.staticMoving?j=k:j.y+=(k.y-j.y)*this.dynamicDampingFactor)};this.panCamera=function(){var a=l.clone().subSelf(o);if(a.lengthSq()){a.multiplyScalar(g.length()*c.panSpeed);var b=g.clone().crossSelf(c.object.up).setLength(a.x);
+b.addSelf(c.object.up.clone().setLength(a.y));c.object.position.addSelf(b);c.target.addSelf(b);c.staticMoving?o=l:o.addSelf(a.sub(l,o).multiplyScalar(c.dynamicDampingFactor))}};this.checkDistances=function(){if(!c.noZoom||!c.noPan)c.object.position.lengthSq()>c.maxDistance*c.maxDistance&&c.object.position.setLength(c.maxDistance),g.lengthSq()<c.minDistance*c.minDistance&&c.object.position.add(c.target,g.setLength(c.minDistance))};this.update=function(){g.copy(c.object.position).subSelf(c.target);
+c.noRotate||c.rotateCamera();c.noZoom||c.zoomCamera();c.noPan||c.panCamera();c.object.position.add(c.target,g);c.checkDistances();c.object.lookAt(c.target);0<d.distanceTo(c.object.position)&&(c.dispatchEvent(m),d.copy(c.object.position))};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){c.enabled&&(e&&(h=i=c.getMouseProjectionOnBall(a.clientX,a.clientY),j=k=c.getMouseOnScreen(a.clientX,a.clientY),o=l=c.getMouseOnScreen(a.clientX,
+a.clientY),e=!1),-1!==f&&(0===f&&!c.noRotate?i=c.getMouseProjectionOnBall(a.clientX,a.clientY):1===f&&!c.noZoom?k=c.getMouseOnScreen(a.clientX,a.clientY):2===f&&!c.noPan&&(l=c.getMouseOnScreen(a.clientX,a.clientY))))},!1);this.domElement.addEventListener("mousedown",function(a){if(c.enabled&&(a.preventDefault(),a.stopPropagation(),-1===f))f=a.button,0===f&&!c.noRotate?h=i=c.getMouseProjectionOnBall(a.clientX,a.clientY):1===f&&!c.noZoom?j=k=c.getMouseOnScreen(a.clientX,a.clientY):this.noPan||(o=l=
+c.getMouseOnScreen(a.clientX,a.clientY))},!1);this.domElement.addEventListener("mouseup",function(a){c.enabled&&(a.preventDefault(),a.stopPropagation(),f=-1)},!1);window.addEventListener("keydown",function(a){c.enabled&&-1===f&&(a.keyCode===c.keys[0]&&!c.noRotate?f=0:a.keyCode===c.keys[1]&&!c.noZoom?f=1:a.keyCode===c.keys[2]&&!c.noPan&&(f=2),-1!==f&&(e=!0))},!1);window.addEventListener("keyup",function(){c.enabled&&-1!==f&&(f=-1)},!1)};
+THREE.CubeGeometry=function(a,b,c,d,e,f,g,h){function i(a,b,c,g,h,l,i,k){var m,n=d||1,o=e||1,q=h/2,p=l/2,r=j.vertices.length;if("x"===a&&"y"===b||"y"===a&&"x"===b)m="z";else if("x"===a&&"z"===b||"z"===a&&"x"===b)m="y",o=f||1;else if("z"===a&&"y"===b||"y"===a&&"z"===b)m="x",n=f||1;var s=n+1,t=o+1,E=h/n,M=l/o,N=new THREE.Vector3;N[m]=0<i?1:-1;for(h=0;h<t;h++)for(l=0;l<s;l++){var B=new THREE.Vector3;B[a]=(l*E-q)*c;B[b]=(h*M-p)*g;B[m]=i;j.vertices.push(new THREE.Vertex(B))}for(h=0;h<o;h++)for(l=0;l<n;l++)a=
+new THREE.Face4(l+s*h+r,l+s*(h+1)+r,l+1+s*(h+1)+r,l+1+s*h+r),a.normal.copy(N),a.vertexNormals.push(N.clone(),N.clone(),N.clone(),N.clone()),a.materialIndex=k,j.faces.push(a),j.faceVertexUvs[0].push([new THREE.UV(l/n,h/o),new THREE.UV(l/n,(h+1)/o),new THREE.UV((l+1)/n,(h+1)/o),new THREE.UV((l+1)/n,h/o)])}THREE.Geometry.call(this);var j=this,k=a/2,o=b/2,l=c/2,m,q,n,p,r,t;if(void 0!==g){if(g instanceof Array)this.materials=g;else{this.materials=[];for(m=0;6>m;m++)this.materials.push(g)}m=0;p=1;q=2;r=
+3;n=4;t=5}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(void 0!=h)for(var s in h)void 0!==this.sides[s]&&(this.sides[s]=h[s]);this.sides.px&&i("z","y",-1,-1,c,b,k,m);this.sides.nx&&i("z","y",1,-1,c,b,-k,p);this.sides.py&&i("x","z",1,1,a,c,o,q);this.sides.ny&&i("x","z",1,-1,a,c,-o,r);this.sides.pz&&i("x","y",1,-1,a,b,l,n);this.sides.nz&&i("x","y",-1,-1,a,b,-l,t);this.computeCentroids();this.mergeVertices()};THREE.CubeGeometry.prototype=new THREE.Geometry;
 THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
-THREE.CylinderGeometry=function(a,b,c,d,f,e){THREE.Geometry.call(this);var a=void 0!==a?a:20,b=void 0!==b?b:20,c=void 0!==c?c:100,g=c/2,d=d||8,f=f||1,h,i,j=[],k=[];for(i=0;i<=f;i++){var p=[],l=[],m=i/f,r=m*(b-a)+a;for(h=0;h<=d;h++){var n=h/d,o=r*Math.sin(2*n*Math.PI),q=-m*c+g,u=r*Math.cos(2*n*Math.PI);this.vertices.push(new THREE.Vertex(new THREE.Vector3(o,q,u)));p.push(this.vertices.length-1);l.push(new THREE.UV(n,m))}j.push(p);k.push(l)}for(i=0;i<f;i++)for(h=0;h<d;h++){var c=j[i][h],p=j[i+1][h],
-l=j[i+1][h+1],m=j[i][h+1],r=this.vertices[c].position.clone().setY(0).normalize(),n=this.vertices[p].position.clone().setY(0).normalize(),o=this.vertices[l].position.clone().setY(0).normalize(),q=this.vertices[m].position.clone().setY(0).normalize(),u=k[i][h].clone(),s=k[i+1][h].clone(),t=k[i+1][h+1].clone(),v=k[i][h+1].clone();this.faces.push(new THREE.Face4(c,p,l,m,[r,n,o,q]));this.faceVertexUvs[0].push([u,s,t,v])}if(!e&&0<a){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,g,0)));for(h=
-0;h<d;h++)c=j[0][h],p=j[0][h+1],l=this.vertices.length-1,r=new THREE.Vector3(0,1,0),n=new THREE.Vector3(0,1,0),o=new THREE.Vector3(0,1,0),u=k[0][h].clone(),s=k[0][h+1].clone(),t=new THREE.UV(s.u,0),this.faces.push(new THREE.Face3(c,p,l,[r,n,o])),this.faceVertexUvs[0].push([u,s,t])}if(!e&&0<b){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-g,0)));for(h=0;h<d;h++)c=j[i][h+1],p=j[i][h],l=this.vertices.length-1,r=new THREE.Vector3(0,-1,0),n=new THREE.Vector3(0,-1,0),o=new THREE.Vector3(0,-1,
-0),u=k[i][h+1].clone(),s=k[i][h].clone(),t=new THREE.UV(s.u,1),this.faces.push(new THREE.Face3(c,p,l,[r,n,o])),this.faceVertexUvs[0].push([u,s,t])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
+THREE.CylinderGeometry=function(a,b,c,d,e,f){THREE.Geometry.call(this);var a=void 0!==a?a:20,b=void 0!==b?b:20,c=void 0!==c?c:100,g=c/2,d=d||8,e=e||1,h,i,j=[],k=[];for(i=0;i<=e;i++){var o=[],l=[],m=i/e,q=m*(b-a)+a;for(h=0;h<=d;h++){var n=h/d,p=q*Math.sin(2*n*Math.PI),r=-m*c+g,t=q*Math.cos(2*n*Math.PI);this.vertices.push(new THREE.Vertex(new THREE.Vector3(p,r,t)));o.push(this.vertices.length-1);l.push(new THREE.UV(n,m))}j.push(o);k.push(l)}for(i=0;i<e;i++)for(h=0;h<d;h++){var c=j[i][h],o=j[i+1][h],
+l=j[i+1][h+1],m=j[i][h+1],q=this.vertices[c].position.clone().setY(0).normalize(),n=this.vertices[o].position.clone().setY(0).normalize(),p=this.vertices[l].position.clone().setY(0).normalize(),r=this.vertices[m].position.clone().setY(0).normalize(),t=k[i][h].clone(),s=k[i+1][h].clone(),u=k[i+1][h+1].clone(),v=k[i][h+1].clone();this.faces.push(new THREE.Face4(c,o,l,m,[q,n,p,r]));this.faceVertexUvs[0].push([t,s,u,v])}if(!f&&0<a){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,g,0)));for(h=
+0;h<d;h++)c=j[0][h],o=j[0][h+1],l=this.vertices.length-1,q=new THREE.Vector3(0,1,0),n=new THREE.Vector3(0,1,0),p=new THREE.Vector3(0,1,0),t=k[0][h].clone(),s=k[0][h+1].clone(),u=new THREE.UV(s.u,0),this.faces.push(new THREE.Face3(c,o,l,[q,n,p])),this.faceVertexUvs[0].push([t,s,u])}if(!f&&0<b){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-g,0)));for(h=0;h<d;h++)c=j[i][h+1],o=j[i][h],l=this.vertices.length-1,q=new THREE.Vector3(0,-1,0),n=new THREE.Vector3(0,-1,0),p=new THREE.Vector3(0,-1,
+0),t=k[i][h+1].clone(),s=k[i][h].clone(),u=new THREE.UV(s.u,1),this.faces.push(new THREE.Face3(c,o,l,[q,n,p])),this.faceVertexUvs[0].push([t,s,u])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
 THREE.ExtrudeGeometry=function(a,b){if("undefined"!==typeof a)THREE.Geometry.call(this),a=a instanceof Array?a:[a],this.shapebb=a[a.length-1].getBoundingBox(),this.addShapeList(a,b),this.computeCentroids(),this.computeFaceNormals()};THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;THREE.ExtrudeGeometry.prototype.addShapeList=function(a,b){for(var c=a.length,d=0;d<c;d++)this.addShape(a[d],b)};
-THREE.ExtrudeGeometry.prototype.addShape=function(a,b){function c(a,b,c){b||console.log("die");return b.clone().multiplyScalar(c).addSelf(a)}function d(a,b,c){var d=THREE.ExtrudeGeometry.__v1,e=THREE.ExtrudeGeometry.__v2,f=THREE.ExtrudeGeometry.__v3,g=THREE.ExtrudeGeometry.__v4,h=THREE.ExtrudeGeometry.__v5,l=THREE.ExtrudeGeometry.__v6;d.set(a.x-b.x,a.y-b.y);e.set(a.x-c.x,a.y-c.y);d=d.normalize();e=e.normalize();f.set(-d.y,d.x);g.set(e.y,-e.x);h.copy(a).addSelf(f);l.copy(a).addSelf(g);if(h.equals(l))return g.clone();
-h.copy(b).addSelf(f);l.copy(c).addSelf(g);f=d.dot(g);g=l.subSelf(h).dot(g);0===f&&(console.log("Either infinite or no solutions!"),0===g?console.log("Its finite solutions."):console.log("Too bad, no solutions."));g/=f;return 0>g?(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+=2*Math.PI),c=(b+a)/2,a=-Math.cos(c),c=-Math.sin(c),new THREE.Vector2(a,c)):d.multiplyScalar(g).addSelf(h).subSelf(a).clone()}function f(c,d){var e,f;for(A=c.length;0<=--A;){e=A;f=A-1;0>f&&(f=c.length-1);
-for(var g=0,h=l+2*k,g=0;g<h;g++){var i=F*g,j=F*(g+1),m=d+e+i,i=d+f+i,n=d+f+j,j=d+e+j,p=c,r=g,o=h,m=m+H,i=i+H,n=n+H,j=j+H;G.faces.push(new THREE.Face4(m,i,n,j,null,null,u));m=X.generateSideWallUV(G,a,p,b,m,i,n,j,r,o);G.faceVertexUvs[0].push(m)}}}function e(a,b,c){G.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function g(c,d,e,f){c+=H;d+=H;e+=H;G.faces.push(new THREE.Face3(c,d,e,null,null,q));c=f?X.generateBottomUV(G,a,b,c,d,e):X.generateTopUV(G,a,b,c,d,e);G.faceVertexUvs[0].push(c)}var h=
-void 0!==b.amount?b.amount:100,i=void 0!==b.bevelThickness?b.bevelThickness:6,j=void 0!==b.bevelSize?b.bevelSize:i-2,k=void 0!==b.bevelSegments?b.bevelSegments:3,p=void 0!==b.bevelEnabled?b.bevelEnabled:!0,l=void 0!==b.steps?b.steps:1,m=b.bendPath,r=b.extrudePath,n,o=!1,q=b.material,u=b.extrudeMaterial,s,t,v,w;r&&(n=r.getSpacedPoints(l),o=!0,p=!1,s=new THREE.TubeGeometry(r,l,1,1,!1,!1),t=new THREE.Vector3,v=new THREE.Vector3,w=new THREE.Vector3);p||(j=i=k=0);var z,x,C,G=this,H=this.vertices.length;
-m&&a.addWrapPath(m);var r=a.extractPoints(),m=r.shape,J=r.holes;if(r=!THREE.Shape.Utils.isClockWise(m)){m=m.reverse();for(x=0,C=J.length;x<C;x++)z=J[x],THREE.Shape.Utils.isClockWise(z)&&(J[x]=z.reverse());r=!1}var I=THREE.Shape.Utils.triangulateShape(m,J),D=m;for(x=0,C=J.length;x<C;x++)z=J[x],m=m.concat(z);var y,B,E,M,K,F=m.length,L,N=I.length,r=[],A=0;E=D.length;y=E-1;for(B=A+1;A<E;A++,y++,B++)y===E&&(y=0),B===E&&(B=0),r[A]=d(D[A],D[y],D[B]);var V=[],P,O=r.concat();for(x=0,C=J.length;x<C;x++){z=
-J[x];P=[];for(A=0,E=z.length,y=E-1,B=A+1;A<E;A++,y++,B++)y===E&&(y=0),B===E&&(B=0),P[A]=d(z[A],z[y],z[B]);V.push(P);O=O.concat(P)}for(y=0;y<k;y++){E=y/k;M=i*(1-E);B=j*Math.sin(E*Math.PI/2);for(A=0,E=D.length;A<E;A++)K=c(D[A],r[A],B),e(K.x,K.y,-M);for(x=0,C=J.length;x<C;x++){z=J[x];P=V[x];for(A=0,E=z.length;A<E;A++)K=c(z[A],P[A],B),e(K.x,K.y,-M)}}B=j;for(A=0;A<F;A++)K=p?c(m[A],O[A],B):m[A],o?(v.copy(s.normals[0]).multiplyScalar(K.x),t.copy(s.binormals[0]).multiplyScalar(K.y),w.copy(n[0]).addSelf(v).addSelf(t),
-e(w.x,w.y,w.z)):e(K.x,K.y,0);for(E=1;E<=l;E++)for(A=0;A<F;A++)K=p?c(m[A],O[A],B):m[A],o?(v.copy(s.normals[E]).multiplyScalar(K.x),t.copy(s.binormals[E]).multiplyScalar(K.y),w.copy(n[E]).addSelf(v).addSelf(t),e(w.x,w.y,w.z)):e(K.x,K.y,h/l*E);for(y=k-1;0<=y;y--){E=y/k;M=i*(1-E);B=j*Math.sin(E*Math.PI/2);for(A=0,E=D.length;A<E;A++)K=c(D[A],r[A],B),e(K.x,K.y,h+M);for(x=0,C=J.length;x<C;x++){z=J[x];P=V[x];for(A=0,E=z.length;A<E;A++)K=c(z[A],P[A],B),o?e(K.x,K.y+n[l-1].y,n[l-1].x+M):e(K.x,K.y,h+M)}}var X=
-THREE.ExtrudeGeometry.WorldUVGenerator;(function(){if(p){var a;a=0*F;for(A=0;A<N;A++)L=I[A],g(L[2]+a,L[1]+a,L[0]+a,!0);a=l+2*k;a*=F;for(A=0;A<N;A++)L=I[A],g(L[0]+a,L[1]+a,L[2]+a,!1)}else{for(A=0;A<N;A++)L=I[A],g(L[2],L[1],L[0],!0);for(A=0;A<N;A++)L=I[A],g(L[0]+F*l,L[1]+F*l,L[2]+F*l,!1)}})();(function(){var a=0;f(D,a);a+=D.length;for(x=0,C=J.length;x<C;x++)z=J[x],f(z,a),a+=z.length})()};
-THREE.ExtrudeGeometry.WorldUVGenerator={generateTopUV:function(a,b,c,d,f,e){b=a.vertices[f].position.x;f=a.vertices[f].position.y;c=a.vertices[e].position.x;e=a.vertices[e].position.y;return[new THREE.UV(a.vertices[d].position.x,1-a.vertices[d].position.y),new THREE.UV(b,1-f),new THREE.UV(c,1-e)]},generateBottomUV:function(a,b,c,d,f,e){return this.generateTopUV(a,b,c,d,f,e)},generateSideWallUV:function(a,b,c,d,f,e,g,h){var b=a.vertices[f].position.x,c=a.vertices[f].position.y,f=a.vertices[f].position.z,
-d=a.vertices[e].position.x,i=a.vertices[e].position.y,e=a.vertices[e].position.z,j=a.vertices[g].position.x,k=a.vertices[g].position.y,g=a.vertices[g].position.z,p=a.vertices[h].position.x,l=a.vertices[h].position.y,a=a.vertices[h].position.z;return 0.01>Math.abs(c-i)?[new THREE.UV(b,f),new THREE.UV(d,e),new THREE.UV(j,g),new THREE.UV(p,a)]:[new THREE.UV(c,f),new THREE.UV(i,e),new THREE.UV(k,g),new THREE.UV(l,a)]}};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;THREE.ExtrudeGeometry.__v2=new THREE.Vector2;
+THREE.ExtrudeGeometry.prototype.addShape=function(a,b){function c(a,b,c){b||console.log("die");return b.clone().multiplyScalar(c).addSelf(a)}function d(a,b,c){var d=THREE.ExtrudeGeometry.__v1,f=THREE.ExtrudeGeometry.__v2,e=THREE.ExtrudeGeometry.__v3,g=THREE.ExtrudeGeometry.__v4,h=THREE.ExtrudeGeometry.__v5,l=THREE.ExtrudeGeometry.__v6;d.set(a.x-b.x,a.y-b.y);f.set(a.x-c.x,a.y-c.y);d=d.normalize();f=f.normalize();e.set(-d.y,d.x);g.set(f.y,-f.x);h.copy(a).addSelf(e);l.copy(a).addSelf(g);if(h.equals(l))return g.clone();
+h.copy(b).addSelf(e);l.copy(c).addSelf(g);e=d.dot(g);g=l.subSelf(h).dot(g);0===e&&(console.log("Either infinite or no solutions!"),0===g?console.log("Its finite solutions."):console.log("Too bad, no solutions."));g/=e;return 0>g?(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+=2*Math.PI),c=(b+a)/2,a=-Math.cos(c),c=-Math.sin(c),new THREE.Vector2(a,c)):d.multiplyScalar(g).addSelf(h).subSelf(a).clone()}function e(c,d){var f,e;for(B=c.length;0<=--B;){f=B;e=B-1;0>e&&(e=c.length-1);
+for(var g=0,h=l+2*k,g=0;g<h;g++){var i=E*g,j=E*(g+1),m=d+f+i,i=d+e+i,n=d+e+j,j=d+f+j,o=c,q=g,p=h,m=m+H,i=i+H,n=n+H,j=j+H;G.faces.push(new THREE.Face4(m,i,n,j,null,null,t));m=O.generateSideWallUV(G,a,o,b,m,i,n,j,q,p);G.faceVertexUvs[0].push(m)}}}function f(a,b,c){G.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function g(c,d,f,e){c+=H;d+=H;f+=H;G.faces.push(new THREE.Face3(c,d,f,null,null,r));c=e?O.generateBottomUV(G,a,b,c,d,f):O.generateTopUV(G,a,b,c,d,f);G.faceVertexUvs[0].push(c)}var h=
+void 0!==b.amount?b.amount:100,i=void 0!==b.bevelThickness?b.bevelThickness:6,j=void 0!==b.bevelSize?b.bevelSize:i-2,k=void 0!==b.bevelSegments?b.bevelSegments:3,o=void 0!==b.bevelEnabled?b.bevelEnabled:!0,l=void 0!==b.steps?b.steps:1,m=b.bendPath,q=b.extrudePath,n,p=!1,r=b.material,t=b.extrudeMaterial,s,u,v,x;q&&(n=q.getSpacedPoints(l),p=!0,o=!1,s=new THREE.TubeGeometry(q,l,1,1,!1,!1),u=new THREE.Vector3,v=new THREE.Vector3,x=new THREE.Vector3);o||(j=i=k=0);var z,w,D,G=this,H=this.vertices.length;
+m&&a.addWrapPath(m);var q=a.extractPoints(),m=q.shape,J=q.holes;if(q=!THREE.Shape.Utils.isClockWise(m)){m=m.reverse();for(w=0,D=J.length;w<D;w++)z=J[w],THREE.Shape.Utils.isClockWise(z)&&(J[w]=z.reverse());q=!1}var K=THREE.Shape.Utils.triangulateShape(m,J),C=m;for(w=0,D=J.length;w<D;w++)z=J[w],m=m.concat(z);var y,A,F,L,I,E=m.length,M,N=K.length,q=[],B=0;F=C.length;y=F-1;for(A=B+1;B<F;B++,y++,A++)y===F&&(y=0),A===F&&(A=0),q[B]=d(C[B],C[y],C[A]);var T=[],P,S=q.concat();for(w=0,D=J.length;w<D;w++){z=
+J[w];P=[];for(B=0,F=z.length,y=F-1,A=B+1;B<F;B++,y++,A++)y===F&&(y=0),A===F&&(A=0),P[B]=d(z[B],z[y],z[A]);T.push(P);S=S.concat(P)}for(y=0;y<k;y++){F=y/k;L=i*(1-F);A=j*Math.sin(F*Math.PI/2);for(B=0,F=C.length;B<F;B++)I=c(C[B],q[B],A),f(I.x,I.y,-L);for(w=0,D=J.length;w<D;w++){z=J[w];P=T[w];for(B=0,F=z.length;B<F;B++)I=c(z[B],P[B],A),f(I.x,I.y,-L)}}A=j;for(B=0;B<E;B++)I=o?c(m[B],S[B],A):m[B],p?(v.copy(s.normals[0]).multiplyScalar(I.x),u.copy(s.binormals[0]).multiplyScalar(I.y),x.copy(n[0]).addSelf(v).addSelf(u),
+f(x.x,x.y,x.z)):f(I.x,I.y,0);for(F=1;F<=l;F++)for(B=0;B<E;B++)I=o?c(m[B],S[B],A):m[B],p?(v.copy(s.normals[F]).multiplyScalar(I.x),u.copy(s.binormals[F]).multiplyScalar(I.y),x.copy(n[F]).addSelf(v).addSelf(u),f(x.x,x.y,x.z)):f(I.x,I.y,h/l*F);for(y=k-1;0<=y;y--){F=y/k;L=i*(1-F);A=j*Math.sin(F*Math.PI/2);for(B=0,F=C.length;B<F;B++)I=c(C[B],q[B],A),f(I.x,I.y,h+L);for(w=0,D=J.length;w<D;w++){z=J[w];P=T[w];for(B=0,F=z.length;B<F;B++)I=c(z[B],P[B],A),p?f(I.x,I.y+n[l-1].y,n[l-1].x+L):f(I.x,I.y,h+L)}}var O=
+THREE.ExtrudeGeometry.WorldUVGenerator;(function(){if(o){var a;a=0*E;for(B=0;B<N;B++)M=K[B],g(M[2]+a,M[1]+a,M[0]+a,!0);a=l+2*k;a*=E;for(B=0;B<N;B++)M=K[B],g(M[0]+a,M[1]+a,M[2]+a,!1)}else{for(B=0;B<N;B++)M=K[B],g(M[2],M[1],M[0],!0);for(B=0;B<N;B++)M=K[B],g(M[0]+E*l,M[1]+E*l,M[2]+E*l,!1)}})();(function(){var a=0;e(C,a);a+=C.length;for(w=0,D=J.length;w<D;w++)z=J[w],e(z,a),a+=z.length})()};
+THREE.ExtrudeGeometry.WorldUVGenerator={generateTopUV:function(a,b,c,d,e,f){b=a.vertices[e].position.x;e=a.vertices[e].position.y;c=a.vertices[f].position.x;f=a.vertices[f].position.y;return[new THREE.UV(a.vertices[d].position.x,1-a.vertices[d].position.y),new THREE.UV(b,1-e),new THREE.UV(c,1-f)]},generateBottomUV:function(a,b,c,d,e,f){return this.generateTopUV(a,b,c,d,e,f)},generateSideWallUV:function(a,b,c,d,e,f,g,h){var b=a.vertices[e].position.x,c=a.vertices[e].position.y,e=a.vertices[e].position.z,
+d=a.vertices[f].position.x,i=a.vertices[f].position.y,f=a.vertices[f].position.z,j=a.vertices[g].position.x,k=a.vertices[g].position.y,g=a.vertices[g].position.z,o=a.vertices[h].position.x,l=a.vertices[h].position.y,a=a.vertices[h].position.z;return 0.01>Math.abs(c-i)?[new THREE.UV(b,e),new THREE.UV(d,f),new THREE.UV(j,g),new THREE.UV(o,a)]:[new THREE.UV(c,e),new THREE.UV(i,f),new THREE.UV(k,g),new THREE.UV(l,a)]}};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.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=[],d=[],f=[],e=[],g=(new THREE.Matrix4).setRotationZ(b),h=0;h<a.length;h++)this.vertices.push(new THREE.Vertex(a[h])),c[h]=a[h].clone(),d[h]=this.vertices.length-1;for(var i=0;i<=this.angle+0.001;i+=b){for(h=0;h<c.length;h++)i<this.angle?(c[h]=g.multiplyVector3(c[h].clone()),this.vertices.push(new THREE.Vertex(c[h])),f[h]=this.vertices.length-1):f=e;0==i&&(e=d);
-for(h=0;h<d.length-1;h++)this.faces.push(new THREE.Face4(f[h],f[h+1],d[h+1],d[h])),this.faceVertexUvs[0].push([new THREE.UV(1-i/this.angle,h/a.length),new THREE.UV(1-i/this.angle,(h+1)/a.length),new THREE.UV(1-(i-b)/this.angle,(h+1)/a.length),new THREE.UV(1-(i-b)/this.angle,h/a.length)]);d=f;f=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=new THREE.Geometry;THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry;
-THREE.PlaneGeometry=function(a,b,c,d){THREE.Geometry.call(this);for(var f=a/2,e=b/2,c=c||1,d=d||1,g=c+1,h=d+1,i=a/c,j=b/d,k=new THREE.Vector3(0,1,0),a=0;a<h;a++)for(b=0;b<g;b++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(b*i-f,0,a*j-e)));for(a=0;a<d;a++)for(b=0;b<c;b++)f=new THREE.Face4(b+g*a,b+g*(a+1),b+1+g*(a+1),b+1+g*a),f.normal.copy(k),f.vertexNormals.push(k.clone(),k.clone(),k.clone(),k.clone()),this.faces.push(f),this.faceVertexUvs[0].push([new THREE.UV(b/c,a/d),new THREE.UV(b/c,(a+
+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=[],d=[],e=[],f=[],g=(new THREE.Matrix4).makeRotationZ(b),h=0;h<a.length;h++)this.vertices.push(new THREE.Vertex(a[h])),c[h]=a[h].clone(),d[h]=this.vertices.length-1;for(var i=0;i<=this.angle+0.001;i+=b){for(h=0;h<c.length;h++)i<this.angle?(c[h]=g.multiplyVector3(c[h].clone()),this.vertices.push(new THREE.Vertex(c[h])),e[h]=this.vertices.length-1):e=f;0==i&&(f=d);
+for(h=0;h<d.length-1;h++)this.faces.push(new THREE.Face4(e[h],e[h+1],d[h+1],d[h])),this.faceVertexUvs[0].push([new THREE.UV(1-i/this.angle,h/a.length),new THREE.UV(1-i/this.angle,(h+1)/a.length),new THREE.UV(1-(i-b)/this.angle,(h+1)/a.length),new THREE.UV(1-(i-b)/this.angle,h/a.length)]);d=e;e=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=new THREE.Geometry;THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry;
+THREE.PlaneGeometry=function(a,b,c,d){THREE.Geometry.call(this);for(var e=a/2,f=b/2,c=c||1,d=d||1,g=c+1,h=d+1,i=a/c,j=b/d,k=new THREE.Vector3(0,1,0),a=0;a<h;a++)for(b=0;b<g;b++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(b*i-e,0,a*j-f)));for(a=0;a<d;a++)for(b=0;b<c;b++)e=new THREE.Face4(b+g*a,b+g*(a+1),b+1+g*(a+1),b+1+g*a),e.normal.copy(k),e.vertexNormals.push(k.clone(),k.clone(),k.clone(),k.clone()),this.faces.push(e),this.faceVertexUvs[0].push([new THREE.UV(b/c,a/d),new THREE.UV(b/c,(a+
 1)/d),new THREE.UV((b+1)/c,(a+1)/d),new THREE.UV((b+1)/c,a/d)]);this.computeCentroids()};THREE.PlaneGeometry.prototype=new THREE.Geometry;THREE.PlaneGeometry.prototype.constructor=THREE.PlaneGeometry;
-THREE.SphereGeometry=function(a,b,c,d,f,e,g){THREE.Geometry.call(this);var a=a||50,d=void 0!==d?d:0,f=void 0!==f?f:2*Math.PI,e=void 0!==e?e:0,g=void 0!==g?g:Math.PI,b=Math.max(3,Math.floor(b)||8),c=Math.max(2,Math.floor(c)||6),h,i,j=[],k=[];for(i=0;i<=c;i++){var p=[],l=[];for(h=0;h<=b;h++){var m=h/b,r=i/c,n=-a*Math.cos(d+m*f)*Math.sin(e+r*g),o=a*Math.cos(e+r*g),q=a*Math.sin(d+m*f)*Math.sin(e+r*g);this.vertices.push(new THREE.Vertex(new THREE.Vector3(n,o,q)));p.push(this.vertices.length-1);l.push(new THREE.UV(m,
-r))}j.push(p);k.push(l)}for(i=0;i<c;i++)for(h=0;h<b;h++){var d=j[i][h+1],f=j[i][h],e=j[i+1][h],g=j[i+1][h+1],p=this.vertices[d].position.clone().normalize(),l=this.vertices[f].position.clone().normalize(),m=this.vertices[e].position.clone().normalize(),r=this.vertices[g].position.clone().normalize(),n=k[i][h+1].clone(),o=k[i][h].clone(),q=k[i+1][h].clone(),u=k[i+1][h+1].clone();Math.abs(this.vertices[d].position.y)==a?(this.faces.push(new THREE.Face3(d,e,g,[p,m,r])),this.faceVertexUvs[0].push([n,
-q,u])):Math.abs(this.vertices[e].position.y)==a?(this.faces.push(new THREE.Face3(d,f,e,[p,l,m])),this.faceVertexUvs[0].push([n,o,q])):(this.faces.push(new THREE.Face4(d,f,e,g,[p,l,m,r])),this.faceVertexUvs[0].push([n,o,q,u]))}this.computeCentroids();this.computeFaceNormals();this.boundingSphere={radius:a}};THREE.SphereGeometry.prototype=new THREE.Geometry;THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry;
+THREE.SphereGeometry=function(a,b,c,d,e,f,g){THREE.Geometry.call(this);var a=a||50,d=void 0!==d?d:0,e=void 0!==e?e:2*Math.PI,f=void 0!==f?f:0,g=void 0!==g?g:Math.PI,b=Math.max(3,Math.floor(b)||8),c=Math.max(2,Math.floor(c)||6),h,i,j=[],k=[];for(i=0;i<=c;i++){var o=[],l=[];for(h=0;h<=b;h++){var m=h/b,q=i/c,n=-a*Math.cos(d+m*e)*Math.sin(f+q*g),p=a*Math.cos(f+q*g),r=a*Math.sin(d+m*e)*Math.sin(f+q*g);this.vertices.push(new THREE.Vertex(new THREE.Vector3(n,p,r)));o.push(this.vertices.length-1);l.push(new THREE.UV(m,
+q))}j.push(o);k.push(l)}for(i=0;i<c;i++)for(h=0;h<b;h++){var d=j[i][h+1],e=j[i][h],f=j[i+1][h],g=j[i+1][h+1],o=this.vertices[d].position.clone().normalize(),l=this.vertices[e].position.clone().normalize(),m=this.vertices[f].position.clone().normalize(),q=this.vertices[g].position.clone().normalize(),n=k[i][h+1].clone(),p=k[i][h].clone(),r=k[i+1][h].clone(),t=k[i+1][h+1].clone();Math.abs(this.vertices[d].position.y)==a?(this.faces.push(new THREE.Face3(d,f,g,[o,m,q])),this.faceVertexUvs[0].push([n,
+r,t])):Math.abs(this.vertices[f].position.y)==a?(this.faces.push(new THREE.Face3(d,e,f,[o,l,m])),this.faceVertexUvs[0].push([n,p,r])):(this.faces.push(new THREE.Face4(d,e,f,g,[o,l,m,q])),this.faceVertexUvs[0].push([n,p,r,t]))}this.computeCentroids();this.computeFaceNormals();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=void 0!==b.height?b.height:50;if(void 0===b.bevelThickness)b.bevelThickness=10;if(void 0===b.bevelSize)b.bevelSize=8;if(void 0===b.bevelEnabled)b.bevelEnabled=!1;if(b.bend){var d=c[c.length-1].getBoundingBox().maxX;b.bendPath=new THREE.QuadraticBezierCurve(new THREE.Vector2(0,0),new THREE.Vector2(d/2,120),new THREE.Vector2(d,0))}THREE.ExtrudeGeometry.call(this,c,b)};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]},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,d=
-0,f=(""+a).split(""),e=f.length,g=[],a=0;a<e;a++){var h=new THREE.Path,h=this.extractGlyphPoints(f[a],b,c,d,h),d=d+h.offset;g.push(h.path)}return{paths:g,offset:d/2}},extractGlyphPoints:function(a,b,c,d,f){var e=[],g,h,i,j,k,p,l,m,r,n,o,q=b.glyphs[a]||b.glyphs["?"];if(q){if(q.o){b=q._cachedOutline||(q._cachedOutline=q.o.split(" "));j=b.length;for(a=0;a<j;)switch(i=b[a++],i){case "m":i=b[a++]*c+d;k=b[a++]*c;e.push(new THREE.Vector2(i,k));f.moveTo(i,k);break;case "l":i=b[a++]*c+d;k=b[a++]*c;e.push(new THREE.Vector2(i,
-k));f.lineTo(i,k);break;case "q":i=b[a++]*c+d;k=b[a++]*c;m=b[a++]*c+d;r=b[a++]*c;f.quadraticCurveTo(m,r,i,k);if(g=e[e.length-1]){p=g.x;l=g.y;for(g=1,h=this.divisions;g<=h;g++){var u=g/h,s=THREE.Shape.Utils.b2(u,p,m,i),u=THREE.Shape.Utils.b2(u,l,r,k);e.push(new THREE.Vector2(s,u))}}break;case "b":if(i=b[a++]*c+d,k=b[a++]*c,m=b[a++]*c+d,r=b[a++]*-c,n=b[a++]*c+d,o=b[a++]*-c,f.bezierCurveTo(i,k,m,r,n,o),g=e[e.length-1]){p=g.x;l=g.y;for(g=1,h=this.divisions;g<=h;g++)u=g/h,s=THREE.Shape.Utils.b3(u,p,m,
-n,i),u=THREE.Shape.Utils.b3(u,l,r,o,k),e.push(new THREE.Vector2(s,u))}}}return{offset:q.ha*c,points:e,path:f}}}};
-(function(a){var b=function(a){for(var b=a.length,f=0,e=b-1,g=0;g<b;e=g++)f+=a[e].x*a[g].y-a[g].x*a[e].y;return 0.5*f};a.Triangulate=function(a,d){var f=a.length;if(3>f)return null;var e=[],g=[],h=[],i,j,k;if(0<b(a))for(j=0;j<f;j++)g[j]=j;else for(j=0;j<f;j++)g[j]=f-1-j;var p=2*f;for(j=f-1;2<f;){if(0>=p--){console.log("Warning, unable to triangulate polygon!");break}i=j;f<=i&&(i=0);j=i+1;f<=j&&(j=0);k=j+1;f<=k&&(k=0);var l;a:{l=a;var m=i,r=j,n=k,o=f,q=g,u=void 0,s=void 0,t=void 0,v=void 0,w=void 0,
-z=void 0,x=void 0,C=void 0,G=void 0,s=l[q[m]].x,t=l[q[m]].y,v=l[q[r]].x,w=l[q[r]].y,z=l[q[n]].x,x=l[q[n]].y;if(1.0E-10>(v-s)*(x-t)-(w-t)*(z-s))l=!1;else{for(u=0;u<o;u++)if(!(u==m||u==r||u==n)){var C=l[q[u]].x,G=l[q[u]].y,H=void 0,J=void 0,I=void 0,D=void 0,y=void 0,B=void 0,E=void 0,M=void 0,K=void 0,F=void 0,L=void 0,N=void 0,H=I=y=void 0,H=z-v,J=x-w,I=s-z,D=t-x,y=v-s,B=w-t,E=C-s,M=G-t,K=C-v,F=G-w,L=C-z,N=G-x,H=H*F-J*K,y=y*M-B*E,I=I*N-D*L;if(0<=H&&0<=I&&0<=y){l=!1;break a}}l=!0}}if(l){e.push([a[g[i]],
-a[g[j]],a[g[k]]]);h.push([g[i],g[j],g[k]]);for(i=j,k=j+1;k<f;i++,k++)g[i]=g[k];f--;p=2*f}}return d?h:e};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,d,f){THREE.Geometry.call(this);this.radius=a||100;this.tube=b||40;this.segmentsR=c||8;this.segmentsT=d||6;this.arc=f||2*Math.PI;f=new THREE.Vector3;a=[];b=[];for(c=0;c<=this.segmentsR;c++)for(d=0;d<=this.segmentsT;d++){var e=d/this.segmentsT*this.arc,g=2*c/this.segmentsR*Math.PI;f.x=this.radius*Math.cos(e);f.y=this.radius*Math.sin(e);var h=new THREE.Vector3;h.x=(this.radius+this.tube*Math.cos(g))*Math.cos(e);h.y=(this.radius+this.tube*Math.cos(g))*Math.sin(e);h.z=
-this.tube*Math.sin(g);this.vertices.push(new THREE.Vertex(h));a.push(new THREE.UV(d/this.segmentsT,1-c/this.segmentsR));b.push(h.clone().subSelf(f).normalize())}for(c=1;c<=this.segmentsR;c++)for(d=1;d<=this.segmentsT;d++){var f=(this.segmentsT+1)*c+d-1,e=(this.segmentsT+1)*(c-1)+d-1,g=(this.segmentsT+1)*(c-1)+d,h=(this.segmentsT+1)*c+d,i=new THREE.Face4(f,e,g,h,[b[f],b[e],b[g],b[h]]);i.normal.addSelf(b[f]);i.normal.addSelf(b[e]);i.normal.addSelf(b[g]);i.normal.addSelf(b[h]);i.normal.normalize();this.faces.push(i);
-this.faceVertexUvs[0].push([a[f].clone(),a[e].clone(),a[g].clone(),a[h].clone()])}this.computeCentroids()};THREE.TorusGeometry.prototype=new THREE.Geometry;THREE.TorusGeometry.prototype.constructor=THREE.TorusGeometry;
-THREE.TorusKnotGeometry=function(a,b,c,d,f,e,g){function h(a,b,c,d,e,f){var g=Math.cos(a);Math.cos(b);b=Math.sin(a);a*=c/d;c=Math.cos(a);g*=0.5*e*(2+c);b=0.5*e*(2+c)*b;e=0.5*f*e*Math.sin(a);return new THREE.Vector3(g,b,e)}THREE.Geometry.call(this);this.radius=a||200;this.tube=b||40;this.segmentsR=c||64;this.segmentsT=d||8;this.p=f||2;this.q=e||3;this.heightScale=g||1;this.grid=Array(this.segmentsR);c=new THREE.Vector3;d=new THREE.Vector3;f=new THREE.Vector3;for(a=0;a<this.segmentsR;++a){this.grid[a]=
-Array(this.segmentsT);for(b=0;b<this.segmentsT;++b){var i=2*(a/this.segmentsR)*this.p*Math.PI,g=2*(b/this.segmentsT)*Math.PI,e=h(i,g,this.q,this.p,this.radius,this.heightScale),i=h(i+0.01,g,this.q,this.p,this.radius,this.heightScale);c.sub(i,e);d.add(i,e);f.cross(c,d);d.cross(f,c);f.normalize();d.normalize();i=-this.tube*Math.cos(g);g=this.tube*Math.sin(g);e.x+=i*d.x+g*f.x;e.y+=i*d.y+g*f.y;e.z+=i*d.z+g*f.z;this.grid[a][b]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(e.x,e.y,e.z)))-1}}for(a=
-0;a<this.segmentsR;++a)for(b=0;b<this.segmentsT;++b){var f=(a+1)%this.segmentsR,e=(b+1)%this.segmentsT,c=this.grid[a][b],d=this.grid[f][b],f=this.grid[f][e],e=this.grid[a][e],g=new THREE.UV(a/this.segmentsR,b/this.segmentsT),i=new THREE.UV((a+1)/this.segmentsR,b/this.segmentsT),j=new THREE.UV((a+1)/this.segmentsR,(b+1)/this.segmentsT),k=new THREE.UV(a/this.segmentsR,(b+1)/this.segmentsT);this.faces.push(new THREE.Face4(c,d,f,e));this.faceVertexUvs[0].push([g,i,j,k])}this.computeCentroids();this.computeFaceNormals();
+0,e=(""+a).split(""),f=e.length,g=[],a=0;a<f;a++){var h=new THREE.Path,h=this.extractGlyphPoints(e[a],b,c,d,h),d=d+h.offset;g.push(h.path)}return{paths:g,offset:d/2}},extractGlyphPoints:function(a,b,c,d,e){var f=[],g,h,i,j,k,o,l,m,q,n,p,r=b.glyphs[a]||b.glyphs["?"];if(r){if(r.o){b=r._cachedOutline||(r._cachedOutline=r.o.split(" "));j=b.length;for(a=0;a<j;)switch(i=b[a++],i){case "m":i=b[a++]*c+d;k=b[a++]*c;f.push(new THREE.Vector2(i,k));e.moveTo(i,k);break;case "l":i=b[a++]*c+d;k=b[a++]*c;f.push(new THREE.Vector2(i,
+k));e.lineTo(i,k);break;case "q":i=b[a++]*c+d;k=b[a++]*c;m=b[a++]*c+d;q=b[a++]*c;e.quadraticCurveTo(m,q,i,k);if(g=f[f.length-1]){o=g.x;l=g.y;for(g=1,h=this.divisions;g<=h;g++){var t=g/h,s=THREE.Shape.Utils.b2(t,o,m,i),t=THREE.Shape.Utils.b2(t,l,q,k);f.push(new THREE.Vector2(s,t))}}break;case "b":if(i=b[a++]*c+d,k=b[a++]*c,m=b[a++]*c+d,q=b[a++]*-c,n=b[a++]*c+d,p=b[a++]*-c,e.bezierCurveTo(i,k,m,q,n,p),g=f[f.length-1]){o=g.x;l=g.y;for(g=1,h=this.divisions;g<=h;g++)t=g/h,s=THREE.Shape.Utils.b3(t,o,m,
+n,i),t=THREE.Shape.Utils.b3(t,l,q,p,k),f.push(new THREE.Vector2(s,t))}}}return{offset:r.ha*c,points:f,path:e}}}};
+(function(a){var b=function(a){for(var b=a.length,e=0,f=b-1,g=0;g<b;f=g++)e+=a[f].x*a[g].y-a[g].x*a[f].y;return 0.5*e};a.Triangulate=function(a,d){var e=a.length;if(3>e)return null;var f=[],g=[],h=[],i,j,k;if(0<b(a))for(j=0;j<e;j++)g[j]=j;else for(j=0;j<e;j++)g[j]=e-1-j;var o=2*e;for(j=e-1;2<e;){if(0>=o--){console.log("Warning, unable to triangulate polygon!");break}i=j;e<=i&&(i=0);j=i+1;e<=j&&(j=0);k=j+1;e<=k&&(k=0);var l;a:{l=a;var m=i,q=j,n=k,p=e,r=g,t=void 0,s=void 0,u=void 0,v=void 0,x=void 0,
+z=void 0,w=void 0,D=void 0,G=void 0,s=l[r[m]].x,u=l[r[m]].y,v=l[r[q]].x,x=l[r[q]].y,z=l[r[n]].x,w=l[r[n]].y;if(1.0E-10>(v-s)*(w-u)-(x-u)*(z-s))l=!1;else{for(t=0;t<p;t++)if(!(t==m||t==q||t==n)){var D=l[r[t]].x,G=l[r[t]].y,H=void 0,J=void 0,K=void 0,C=void 0,y=void 0,A=void 0,F=void 0,L=void 0,I=void 0,E=void 0,M=void 0,N=void 0,H=K=y=void 0,H=z-v,J=w-x,K=s-z,C=u-w,y=v-s,A=x-u,F=D-s,L=G-u,I=D-v,E=G-x,M=D-z,N=G-w,H=H*E-J*I,y=y*L-A*F,K=K*N-C*M;if(0<=H&&0<=K&&0<=y){l=!1;break a}}l=!0}}if(l){f.push([a[g[i]],
+a[g[j]],a[g[k]]]);h.push([g[i],g[j],g[k]]);for(i=j,k=j+1;k<e;i++,k++)g[i]=g[k];e--;o=2*e}}return d?h:f};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,d,e){THREE.Geometry.call(this);this.radius=a||100;this.tube=b||40;this.segmentsR=c||8;this.segmentsT=d||6;this.arc=e||2*Math.PI;e=new THREE.Vector3;a=[];b=[];for(c=0;c<=this.segmentsR;c++)for(d=0;d<=this.segmentsT;d++){var f=d/this.segmentsT*this.arc,g=2*c/this.segmentsR*Math.PI;e.x=this.radius*Math.cos(f);e.y=this.radius*Math.sin(f);var h=new THREE.Vector3;h.x=(this.radius+this.tube*Math.cos(g))*Math.cos(f);h.y=(this.radius+this.tube*Math.cos(g))*Math.sin(f);h.z=
+this.tube*Math.sin(g);this.vertices.push(new THREE.Vertex(h));a.push(new THREE.UV(d/this.segmentsT,1-c/this.segmentsR));b.push(h.clone().subSelf(e).normalize())}for(c=1;c<=this.segmentsR;c++)for(d=1;d<=this.segmentsT;d++){var e=(this.segmentsT+1)*c+d-1,f=(this.segmentsT+1)*(c-1)+d-1,g=(this.segmentsT+1)*(c-1)+d,h=(this.segmentsT+1)*c+d,i=new THREE.Face4(e,f,g,h,[b[e],b[f],b[g],b[h]]);i.normal.addSelf(b[e]);i.normal.addSelf(b[f]);i.normal.addSelf(b[g]);i.normal.addSelf(b[h]);i.normal.normalize();this.faces.push(i);
+this.faceVertexUvs[0].push([a[e].clone(),a[f].clone(),a[g].clone(),a[h].clone()])}this.computeCentroids()};THREE.TorusGeometry.prototype=new THREE.Geometry;THREE.TorusGeometry.prototype.constructor=THREE.TorusGeometry;
+THREE.TorusKnotGeometry=function(a,b,c,d,e,f,g){function h(a,b,c,d,f,e){var g=Math.cos(a);Math.cos(b);b=Math.sin(a);a*=c/d;c=Math.cos(a);g*=0.5*f*(2+c);b=0.5*f*(2+c)*b;f=0.5*e*f*Math.sin(a);return new THREE.Vector3(g,b,f)}THREE.Geometry.call(this);this.radius=a||200;this.tube=b||40;this.segmentsR=c||64;this.segmentsT=d||8;this.p=e||2;this.q=f||3;this.heightScale=g||1;this.grid=Array(this.segmentsR);c=new THREE.Vector3;d=new THREE.Vector3;e=new THREE.Vector3;for(a=0;a<this.segmentsR;++a){this.grid[a]=
+Array(this.segmentsT);for(b=0;b<this.segmentsT;++b){var i=2*(a/this.segmentsR)*this.p*Math.PI,g=2*(b/this.segmentsT)*Math.PI,f=h(i,g,this.q,this.p,this.radius,this.heightScale),i=h(i+0.01,g,this.q,this.p,this.radius,this.heightScale);c.sub(i,f);d.add(i,f);e.cross(c,d);d.cross(e,c);e.normalize();d.normalize();i=-this.tube*Math.cos(g);g=this.tube*Math.sin(g);f.x+=i*d.x+g*e.x;f.y+=i*d.y+g*e.y;f.z+=i*d.z+g*e.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,f=(b+1)%this.segmentsT,c=this.grid[a][b],d=this.grid[e][b],e=this.grid[e][f],f=this.grid[a][f],g=new THREE.UV(a/this.segmentsR,b/this.segmentsT),i=new THREE.UV((a+1)/this.segmentsR,b/this.segmentsT),j=new THREE.UV((a+1)/this.segmentsR,(b+1)/this.segmentsT),k=new THREE.UV(a/this.segmentsR,(b+1)/this.segmentsT);this.faces.push(new THREE.Face4(c,d,e,f));this.faceVertexUvs[0].push([g,i,j,k])}this.computeCentroids();this.computeFaceNormals();
 this.computeVertexNormals()};THREE.TorusKnotGeometry.prototype=new THREE.Geometry;THREE.TorusKnotGeometry.prototype.constructor=THREE.TorusKnotGeometry;
-THREE.TubeGeometry=function(a,b,c,d,f,e){THREE.Geometry.call(this);this.path=a;this.segments=b||64;this.radius=c||1;this.segmentsRadius=d||8;this.closed=f||!1;if(e)this.debug=new THREE.Object3D;this.grid=[];var b=new THREE.Vector3,g=new THREE.Vector3,h=new THREE.Vector3,b=new THREE.Vector3,g=new THREE.Matrix4,d=[],e=[],i=[],j=this.segments+1,k,p,l,m;this.tangents=d;this.normals=e;this.binormals=i;for(a=0;a<j;a++)h=a/(j-1),d[a]=this.path.getTangentAt(h),d[a].normalize();e[0]=new THREE.Vector3;i[0]=
-new THREE.Vector3;a=Number.MAX_VALUE;h=Math.abs(d[0].x);k=Math.abs(d[0].y);p=Math.abs(d[0].z);h<=a&&(a=h,b.set(1,0,0));k<=a&&(a=k,b.set(0,1,0));p<=a&&b.set(0,0,1);e[0].cross(d[0],b);i[0].cross(d[0],e[0]);for(a=1;a<j;a++)e[a]=e[a-1].clone(),i[a]=i[a-1].clone(),b.cross(d[a-1],d[a]),1.0E-4<b.length()&&(b.normalize(),h=Math.acos(d[a-1].dot(d[a])),g.setRotationAxis(b,h).multiplyVector3(e[a])),i[a].cross(d[a],e[a]);if(this.closed){h=Math.acos(e[0].dot(e[j-1]));h/=j-1;0<d[0].dot(b.cross(e[0],e[j-1]))&&(h=
--h);for(a=1;a<j;a++)g.setRotationAxis(d[a],h*a).multiplyVector3(e[a]),i[a].cross(d[a],e[a])}for(a=0;a<j;a++){this.grid[a]=[];h=a/(j-1);k=this.path.getPointAt(h);b=d[a];g=e[a];h=i[a];this.debug&&(this.debug.add(new THREE.ArrowHelper(b,k,c,255)),this.debug.add(new THREE.ArrowHelper(g,k,c,16711680)),this.debug.add(new THREE.ArrowHelper(h,k,c,65280)));for(b=0;b<this.segmentsRadius;b++)l=2*(b/this.segmentsRadius)*Math.PI,p=-this.radius*Math.cos(l),l=this.radius*Math.sin(l),m=(new THREE.Vector3).copy(k),
-m.x+=p*g.x+l*h.x,m.y+=p*g.y+l*h.y,m.z+=p*g.z+l*h.z,this.grid[a][b]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(m.x,m.y,m.z)))-1}for(a=0;a<this.segments;a++)for(b=0;b<this.segmentsRadius;b++)e=f?(a+1)%this.segments:a+1,i=(b+1)%this.segmentsRadius,c=this.grid[a][b],d=this.grid[e][b],e=this.grid[e][i],i=this.grid[a][i],j=new THREE.UV(a/this.segments,b/this.segmentsRadius),g=new THREE.UV((a+1)/this.segments,b/this.segmentsRadius),h=new THREE.UV((a+1)/this.segments,(b+1)/this.segmentsRadius),
-k=new THREE.UV(a/this.segments,(b+1)/this.segmentsRadius),this.faces.push(new THREE.Face4(c,d,e,i)),this.faceVertexUvs[0].push([j,g,h,k]);this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.TubeGeometry.prototype=new THREE.Geometry;THREE.TubeGeometry.prototype.constructor=THREE.TubeGeometry;
-THREE.PolyhedronGeometry=function(a,b,c,d){function f(a){var b=new THREE.Vertex(a.normalize());b.index=i.vertices.push(b)-1;var c=Math.atan2(a.z,-a.x)/2/Math.PI+0.5,a=Math.atan2(-a.y,Math.sqrt(a.x*a.x+a.z*a.z))/Math.PI+0.5;b.uv=new THREE.UV(c,a);return b}function e(a,b,c,d){1>d?(d=new THREE.Face3(a.index,b.index,c.index,[a.position.clone(),b.position.clone(),c.position.clone()]),d.centroid.addSelf(a.position).addSelf(b.position).addSelf(c.position).divideScalar(3),d.normal=d.centroid.clone().normalize(),
-i.faces.push(d),d=Math.atan2(d.centroid.z,-d.centroid.x),i.faceVertexUvs[0].push([h(a.uv,a.position,d),h(b.uv,b.position,d),h(c.uv,c.position,d)])):(d-=1,e(a,g(a,b),g(a,c),d),e(g(a,b),b,g(b,c),d),e(g(a,c),g(b,c),c,d),e(g(a,b),g(b,c),g(a,c),d))}function g(a,b){p[a.index]||(p[a.index]=[]);p[b.index]||(p[b.index]=[]);var c=p[a.index][b.index];void 0===c&&(p[a.index][b.index]=p[b.index][a.index]=c=f((new THREE.Vector3).add(a.position,b.position).divideScalar(2)));return c}function h(a,b,c){0>c&&1===a.u&&
-(a=new THREE.UV(a.u-1,a.v));0===b.x&&0===b.z&&(a=new THREE.UV(c/2/Math.PI+0.5,a.v));return a}THREE.Geometry.call(this);for(var c=c||1,d=d||0,i=this,j=0,k=a.length;j<k;j++)f(new THREE.Vector3(a[j][0],a[j][1],a[j][2]));for(var p=[],a=this.vertices,j=0,k=b.length;j<k;j++)e(a[b[j][0]],a[b[j][1]],a[b[j][2]],d);this.mergeVertices();j=0;for(k=this.vertices.length;j<k;j++)this.vertices[j].position.multiplyScalar(c);this.computeCentroids();this.boundingSphere={radius:c}};
+THREE.TubeGeometry=function(a,b,c,d,e,f){THREE.Geometry.call(this);this.path=a;this.segments=b||64;this.radius=c||1;this.segmentsRadius=d||8;this.closed=e||!1;if(f)this.debug=new THREE.Object3D;this.grid=[];var b=new THREE.Vector3,g=new THREE.Vector3,h=new THREE.Vector3,b=new THREE.Vector3,g=new THREE.Matrix4,d=[],f=[],i=[],j=this.segments+1,k,o,l,m;this.tangents=d;this.normals=f;this.binormals=i;for(a=0;a<j;a++)h=a/(j-1),d[a]=this.path.getTangentAt(h),d[a].normalize();f[0]=new THREE.Vector3;i[0]=
+new THREE.Vector3;a=Number.MAX_VALUE;h=Math.abs(d[0].x);k=Math.abs(d[0].y);o=Math.abs(d[0].z);h<=a&&(a=h,b.set(1,0,0));k<=a&&(a=k,b.set(0,1,0));o<=a&&b.set(0,0,1);f[0].cross(d[0],b);i[0].cross(d[0],f[0]);for(a=1;a<j;a++)f[a]=f[a-1].clone(),i[a]=i[a-1].clone(),b.cross(d[a-1],d[a]),1.0E-4<b.length()&&(b.normalize(),h=Math.acos(d[a-1].dot(d[a])),g.makeRotationAxis(b,h).multiplyVector3(f[a])),i[a].cross(d[a],f[a]);if(this.closed){h=Math.acos(f[0].dot(f[j-1]));h/=j-1;0<d[0].dot(b.cross(f[0],f[j-1]))&&
+(h=-h);for(a=1;a<j;a++)g.makeRotationAxis(d[a],h*a).multiplyVector3(f[a]),i[a].cross(d[a],f[a])}for(a=0;a<j;a++){this.grid[a]=[];h=a/(j-1);k=this.path.getPointAt(h);b=d[a];g=f[a];h=i[a];this.debug&&(this.debug.add(new THREE.ArrowHelper(b,k,c,255)),this.debug.add(new THREE.ArrowHelper(g,k,c,16711680)),this.debug.add(new THREE.ArrowHelper(h,k,c,65280)));for(b=0;b<this.segmentsRadius;b++)l=2*(b/this.segmentsRadius)*Math.PI,o=-this.radius*Math.cos(l),l=this.radius*Math.sin(l),m=(new THREE.Vector3).copy(k),
+m.x+=o*g.x+l*h.x,m.y+=o*g.y+l*h.y,m.z+=o*g.z+l*h.z,this.grid[a][b]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(m.x,m.y,m.z)))-1}for(a=0;a<this.segments;a++)for(b=0;b<this.segmentsRadius;b++)f=e?(a+1)%this.segments:a+1,i=(b+1)%this.segmentsRadius,c=this.grid[a][b],d=this.grid[f][b],f=this.grid[f][i],i=this.grid[a][i],j=new THREE.UV(a/this.segments,b/this.segmentsRadius),g=new THREE.UV((a+1)/this.segments,b/this.segmentsRadius),h=new THREE.UV((a+1)/this.segments,(b+1)/this.segmentsRadius),
+k=new THREE.UV(a/this.segments,(b+1)/this.segmentsRadius),this.faces.push(new THREE.Face4(c,d,f,i)),this.faceVertexUvs[0].push([j,g,h,k]);this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.TubeGeometry.prototype=new THREE.Geometry;THREE.TubeGeometry.prototype.constructor=THREE.TubeGeometry;
+THREE.PolyhedronGeometry=function(a,b,c,d){function e(a){var b=new THREE.Vertex(a.normalize());b.index=i.vertices.push(b)-1;var c=Math.atan2(a.z,-a.x)/2/Math.PI+0.5,a=Math.atan2(-a.y,Math.sqrt(a.x*a.x+a.z*a.z))/Math.PI+0.5;b.uv=new THREE.UV(c,a);return b}function f(a,b,c,d){1>d?(d=new THREE.Face3(a.index,b.index,c.index,[a.position.clone(),b.position.clone(),c.position.clone()]),d.centroid.addSelf(a.position).addSelf(b.position).addSelf(c.position).divideScalar(3),d.normal=d.centroid.clone().normalize(),
+i.faces.push(d),d=Math.atan2(d.centroid.z,-d.centroid.x),i.faceVertexUvs[0].push([h(a.uv,a.position,d),h(b.uv,b.position,d),h(c.uv,c.position,d)])):(d-=1,f(a,g(a,b),g(a,c),d),f(g(a,b),b,g(b,c),d),f(g(a,c),g(b,c),c,d),f(g(a,b),g(b,c),g(a,c),d))}function g(a,b){o[a.index]||(o[a.index]=[]);o[b.index]||(o[b.index]=[]);var c=o[a.index][b.index];void 0===c&&(o[a.index][b.index]=o[b.index][a.index]=c=e((new THREE.Vector3).add(a.position,b.position).divideScalar(2)));return c}function h(a,b,c){0>c&&1===a.u&&
+(a=new THREE.UV(a.u-1,a.v));0===b.x&&0===b.z&&(a=new THREE.UV(c/2/Math.PI+0.5,a.v));return a}THREE.Geometry.call(this);for(var c=c||1,d=d||0,i=this,j=0,k=a.length;j<k;j++)e(new THREE.Vector3(a[j][0],a[j][1],a[j][2]));for(var o=[],a=this.vertices,j=0,k=b.length;j<k;j++)f(a[b[j][0]],a[b[j][1]],a[b[j][2]],d);this.mergeVertices();j=0;for(k=this.vertices.length;j<k;j++)this.vertices[j].position.multiplyScalar(c);this.computeCentroids();this.boundingSphere={radius:c}};
 THREE.PolyhedronGeometry.prototype=new THREE.Geometry;THREE.PolyhedronGeometry.prototype.constructor=THREE.PolyhedronGeometry;
 THREE.IcosahedronGeometry=function(a,b){var c=(1+Math.sqrt(5))/2;THREE.PolyhedronGeometry.call(this,[[-1,c,0],[1,c,0],[-1,-c,0],[1,-c,0],[0,-1,c],[0,1,c],[0,-1,-c],[0,1,-c],[c,0,-1],[c,0,1],[-c,0,-1],[-c,0,1]],[[0,11,5],[0,5,1],[0,1,7],[0,7,10],[0,10,11],[1,5,9],[5,11,4],[11,10,2],[10,7,6],[7,1,8],[3,9,4],[3,4,2],[3,2,6],[3,6,8],[3,8,9],[4,9,5],[2,4,11],[6,2,10],[8,6,7],[9,8,1]],a,b)};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;
 THREE.OctahedronGeometry=function(a,b){THREE.PolyhedronGeometry.call(this,[[1,0,0],[-1,0,0],[0,1,0],[0,-1,0],[0,0,1],[0,0,-1]],[[0,2,4],[0,4,3],[0,3,5],[0,5,2],[1,2,5],[1,5,3],[1,3,4],[1,4,2]],a,b)};THREE.OctahedronGeometry.prototype=new THREE.Geometry;THREE.OctahedronGeometry.prototype.constructor=THREE.OctahedronGeometry;THREE.TetrahedronGeometry=function(a,b){THREE.PolyhedronGeometry.call(this,[[1,1,1],[-1,-1,1],[-1,1,-1],[1,-1,-1]],[[2,1,0],[0,3,2],[1,3,0],[2,3,1]],a,b)};
 THREE.TetrahedronGeometry.prototype=new THREE.Geometry;THREE.TetrahedronGeometry.prototype.constructor=THREE.TetrahedronGeometry;
 THREE.AxisHelper=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;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.AxisHelper.prototype=new THREE.Object3D;THREE.AxisHelper.prototype.constructor=THREE.AxisHelper;
-THREE.ArrowHelper=function(a,b,c,d){THREE.Object3D.call(this);void 0===d&&(d=16776960);void 0===c&&(c=20);var f=new THREE.Geometry;f.vertices.push(new THREE.Vertex(new THREE.Vector3(0,0,0)));f.vertices.push(new THREE.Vertex(new THREE.Vector3(0,1,0)));this.line=new THREE.Line(f,new THREE.LineBasicMaterial({color:d}));this.add(this.line);f=new THREE.CylinderGeometry(0,0.05,0.25,5,1);this.cone=new THREE.Mesh(f,new THREE.MeshBasicMaterial({color:d}));this.cone.position.set(0,1,0);this.add(this.cone);
-if(b instanceof THREE.Vector3)this.position=b;this.setDirection(a);this.setLength(c)};THREE.ArrowHelper.prototype=new THREE.Object3D;THREE.ArrowHelper.prototype.constructor=THREE.ArrowHelper;THREE.ArrowHelper.prototype.setDirection=function(a){var b=(new THREE.Vector3(0,1,0)).crossSelf(a),a=Math.acos((new THREE.Vector3(0,1,0)).dot(a.clone().normalize()));this.matrix=(new THREE.Matrix4).setRotationAxis(b.normalize(),a);this.rotation.getRotationFromMatrix(this.matrix,this.scale)};
+THREE.ArrowHelper=function(a,b,c,d){THREE.Object3D.call(this);void 0===d&&(d=16776960);void 0===c&&(c=20);var e=new THREE.Geometry;e.vertices.push(new THREE.Vertex(new THREE.Vector3(0,0,0)));e.vertices.push(new THREE.Vertex(new THREE.Vector3(0,1,0)));this.line=new THREE.Line(e,new THREE.LineBasicMaterial({color:d}));this.add(this.line);e=new THREE.CylinderGeometry(0,0.05,0.25,5,1);this.cone=new THREE.Mesh(e,new THREE.MeshBasicMaterial({color:d}));this.cone.position.set(0,1,0);this.add(this.cone);
+if(b instanceof THREE.Vector3)this.position=b;this.setDirection(a);this.setLength(c)};THREE.ArrowHelper.prototype=new THREE.Object3D;THREE.ArrowHelper.prototype.constructor=THREE.ArrowHelper;THREE.ArrowHelper.prototype.setDirection=function(a){var b=(new THREE.Vector3(0,1,0)).crossSelf(a),a=Math.acos((new THREE.Vector3(0,1,0)).dot(a.clone().normalize()));this.matrix=(new THREE.Matrix4).makeRotationAxis(b.normalize(),a);this.rotation.getRotationFromMatrix(this.matrix,this.scale)};
 THREE.ArrowHelper.prototype.setLength=function(a){this.scale.set(a,a,a)};THREE.ArrowHelper.prototype.setColor=function(a){this.line.material.color.setHex(a);this.cone.material.color.setHex(a)};
 THREE.CameraHelper=function(a){function b(a,b,d){c(a,d);c(b,d)}function c(a,b){d.lineGeometry.vertices.push(new THREE.Vertex(new THREE.Vector3));d.lineGeometry.colors.push(new THREE.Color(b));void 0===d.pointMap[a]&&(d.pointMap[a]=[]);d.pointMap[a].push(d.lineGeometry.vertices.length-1)}THREE.Object3D.call(this);var d=this;this.lineGeometry=new THREE.Geometry;this.lineMaterial=new THREE.LineBasicMaterial({color:16777215,vertexColors:THREE.FaceColors});this.pointMap={};b("n1","n2",16755200);b("n2",
 "n4",16755200);b("n4","n3",16755200);b("n3","n1",16755200);b("f1","f2",16755200);b("f2","f4",16755200);b("f4","f3",16755200);b("f3","f1",16755200);b("n1","f1",16755200);b("n2","f2",16755200);b("n3","f3",16755200);b("n4","f4",16755200);b("p","n1",16711680);b("p","n2",16711680);b("p","n3",16711680);b("p","n4",16711680);b("u1","u2",43775);b("u2","u3",43775);b("u3","u1",43775);b("c","t",16777215);b("p","c",3355443);b("cn1","cn2",3355443);b("cn3","cn4",3355443);b("cf1","cf2",3355443);b("cf3","cf4",3355443);
 this.camera=a;this.update(a);this.lines=new THREE.Line(this.lineGeometry,this.lineMaterial,THREE.LinePieces);this.add(this.lines)};THREE.CameraHelper.prototype=new THREE.Object3D;THREE.CameraHelper.prototype.constructor=THREE.CameraHelper;
-THREE.CameraHelper.prototype.update=function(){function a(a,d,f,e){THREE.CameraHelper.__v.set(d,f,e);THREE.CameraHelper.__projector.unprojectVector(THREE.CameraHelper.__v,THREE.CameraHelper.__c);a=b.pointMap[a];if(void 0!==a){d=0;for(f=a.length;d<f;d++)b.lineGeometry.vertices[a[d]].position.copy(THREE.CameraHelper.__v)}}var b=this;THREE.CameraHelper.__c.projectionMatrix.copy(this.camera.projectionMatrix);a("c",0,0,-1);a("t",0,0,1);a("n1",-1,-1,-1);a("n2",1,-1,-1);a("n3",-1,1,-1);a("n4",1,1,-1);a("f1",
+THREE.CameraHelper.prototype.update=function(){function a(a,d,e,f){THREE.CameraHelper.__v.set(d,e,f);THREE.CameraHelper.__projector.unprojectVector(THREE.CameraHelper.__v,THREE.CameraHelper.__c);a=b.pointMap[a];if(void 0!==a){d=0;for(e=a.length;d<e;d++)b.lineGeometry.vertices[a[d]].position.copy(THREE.CameraHelper.__v)}}var b=this;THREE.CameraHelper.__c.projectionMatrix.copy(this.camera.projectionMatrix);a("c",0,0,-1);a("t",0,0,1);a("n1",-1,-1,-1);a("n2",1,-1,-1);a("n3",-1,1,-1);a("n4",1,1,-1);a("f1",
 -1,-1,1);a("f2",1,-1,1);a("f3",-1,1,1);a("f4",1,1,1);a("u1",0.7,1.1,-1);a("u2",-0.7,1.1,-1);a("u3",0,2,-1);a("cf1",-1,0,1);a("cf2",1,0,1);a("cf3",0,-1,1);a("cf4",0,1,1);a("cn1",-1,0,-1);a("cn2",1,0,-1);a("cn3",0,-1,-1);a("cn4",0,1,-1);this.lineGeometry.__dirtyVertices=!0};THREE.CameraHelper.__projector=new THREE.Projector;THREE.CameraHelper.__v=new THREE.Vector3;THREE.CameraHelper.__c=new THREE.Camera;
 THREE.SubdivisionModifier=function(a){this.subdivisions=void 0===a?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;0<b--;)this.smooth(a)};
-THREE.SubdivisionModifier.prototype.smooth=function(a){function b(a,b,c,d,h,i){var k=new THREE.Face4(a,b,c,d,null,h.color,h.material);if(g.useOldVertexColors){k.vertexColors=[];for(var j,n,m,p=0;4>p;p++){m=i[p];j=new THREE.Color;j.setRGB(0,0,0);for(var o=0;o<m.length;o++)n=h.vertexColors[m[o]-1],j.r+=n.r,j.g+=n.g,j.b+=n.b;j.r/=m.length;j.g/=m.length;j.b/=m.length;k.vertexColors[p]=j}}f.push(k);(!g.supportUVs||0!=l.length)&&e.push([l[a],l[b],l[c],l[d]])}function c(a,b){return Math.min(a,b)+"_"+Math.max(a,
-b)}var d=[],f=[],e=[],g=this,h=a.vertices,d=a.faces,i=h.concat(),j=[],k={},p={},l=[],m,r,n,o,q,u=a.faceVertexUvs[0];for(m=0,r=u.length;m<r;m++)for(n=0,o=u[m].length;n<o;n++)q=d[m]["abcd".charAt(n)],l[q]||(l[q]=u[m][n]);var s;for(m=0,r=d.length;m<r;m++)if(q=d[m],j.push(q.centroid),i.push(new THREE.Vertex(q.centroid)),g.supportUVs&&0!=l.length){s=new THREE.UV;if(q instanceof THREE.Face3)s.u=l[q.a].u+l[q.b].u+l[q.c].u,s.v=l[q.a].v+l[q.b].v+l[q.c].v,s.u/=3,s.v/=3;else if(q instanceof THREE.Face4)s.u=
-l[q.a].u+l[q.b].u+l[q.c].u+l[q.d].u,s.v=l[q.a].v+l[q.b].v+l[q.c].v+l[q.d].v,s.u/=4,s.v/=4;l.push(s)}r=function(a){function b(a,c,d){void 0===a[c]&&(a[c]=[]);a[c].push(d)}var d,e,f,g,h={};for(d=0,e=a.faces.length;d<e;d++)f=a.faces[d],f instanceof THREE.Face3?(g=c(f.a,f.b),b(h,g,d),g=c(f.b,f.c),b(h,g,d),g=c(f.c,f.a),b(h,g,d)):f instanceof THREE.Face4&&(g=c(f.a,f.b),b(h,g,d),g=c(f.b,f.c),b(h,g,d),g=c(f.c,f.d),b(h,g,d),g=c(f.d,f.a),b(h,g,d));return h}(a);var t=0,u=h.length,v,w,z={},x={},C=function(a,
-b){void 0===z[a]&&(z[a]=[]);z[a].push(b)},G=function(a,b){void 0===x[a]&&(x[a]={});x[a][b]=null};for(m in r){s=r[m];v=m.split("_");w=v[0];v=v[1];C(w,[w,v]);C(v,[w,v]);for(n=0,o=s.length;n<o;n++)q=s[n],G(w,q,m),G(v,q,m);2>s.length&&(p[m]=!0)}for(m in r)if(s=r[m],q=s[0],s=s[1],v=m.split("_"),w=v[0],v=v[1],o=new THREE.Vector3,p[m]?(o.addSelf(h[w].position),o.addSelf(h[v].position),o.multiplyScalar(0.5)):(o.addSelf(j[q]),o.addSelf(j[s]),o.addSelf(h[w].position),o.addSelf(h[v].position),o.multiplyScalar(0.25)),
-k[m]=u+d.length+t,i.push(new THREE.Vertex(o)),t++,g.supportUVs&&0!=l.length)s=new THREE.UV,s.u=l[w].u+l[v].u,s.v=l[w].v+l[v].v,s.u/=2,s.v/=2,l.push(s);var H,J;v=["123","12","2","23"];o=["123","23","3","31"];var C=["123","31","1","12"],G=["1234","12","2","23"],I=["1234","23","3","34"],D=["1234","34","4","41"],y=["1234","41","1","12"];for(m=0,r=j.length;m<r;m++)q=d[m],s=u+m,q instanceof THREE.Face3?(t=c(q.a,q.b),w=c(q.b,q.c),H=c(q.c,q.a),b(s,k[t],q.b,k[w],q,v),b(s,k[w],q.c,k[H],q,o),b(s,k[H],q.a,k[t],
-q,C)):q instanceof THREE.Face4?(t=c(q.a,q.b),w=c(q.b,q.c),H=c(q.c,q.d),J=c(q.d,q.a),b(s,k[t],q.b,k[w],q,G),b(s,k[w],q.c,k[H],q,I),b(s,k[H],q.d,k[J],q,D),b(s,k[J],q.a,k[t],q,y)):console.log("face should be a face!",q);d=i;i=new THREE.Vector3;k=new THREE.Vector3;for(m=0,r=h.length;m<r;m++)if(void 0!==z[m]){i.set(0,0,0);k.set(0,0,0);q=new THREE.Vector3(0,0,0);s=0;for(n in x[m])i.addSelf(j[n]),s++;t=0;u=z[m].length;for(n=0;n<u;n++)p[c(z[m][n][0],z[m][n][1])]&&t++;if(2!=t){i.divideScalar(s);for(n=0;n<
-u;n++)s=z[m][n],s=h[s[0]].position.clone().addSelf(h[s[1]].position).divideScalar(2),k.addSelf(s);k.divideScalar(u);q.addSelf(h[m].position);q.multiplyScalar(u-3);q.addSelf(i);q.addSelf(k.multiplyScalar(2));q.divideScalar(u);d[m].position=q}}a.vertices=d;a.faces=f;a.faceVertexUvs[0]=e;delete a.__tmpVertices;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals()};
+THREE.SubdivisionModifier.prototype.smooth=function(a){function b(a,b,c,d,h,i){var k=new THREE.Face4(a,b,c,d,null,h.color,h.material);if(g.useOldVertexColors){k.vertexColors=[];for(var j,n,m,o=0;4>o;o++){m=i[o];j=new THREE.Color;j.setRGB(0,0,0);for(var p=0;p<m.length;p++)n=h.vertexColors[m[p]-1],j.r+=n.r,j.g+=n.g,j.b+=n.b;j.r/=m.length;j.g/=m.length;j.b/=m.length;k.vertexColors[o]=j}}e.push(k);(!g.supportUVs||0!=l.length)&&f.push([l[a],l[b],l[c],l[d]])}function c(a,b){return Math.min(a,b)+"_"+Math.max(a,
+b)}var d=[],e=[],f=[],g=this,h=a.vertices,d=a.faces,i=h.concat(),j=[],k={},o={},l=[],m,q,n,p,r,t=a.faceVertexUvs[0];for(m=0,q=t.length;m<q;m++)for(n=0,p=t[m].length;n<p;n++)r=d[m]["abcd".charAt(n)],l[r]||(l[r]=t[m][n]);var s;for(m=0,q=d.length;m<q;m++)if(r=d[m],j.push(r.centroid),i.push(new THREE.Vertex(r.centroid)),g.supportUVs&&0!=l.length){s=new THREE.UV;if(r instanceof THREE.Face3)s.u=l[r.a].u+l[r.b].u+l[r.c].u,s.v=l[r.a].v+l[r.b].v+l[r.c].v,s.u/=3,s.v/=3;else if(r instanceof THREE.Face4)s.u=
+l[r.a].u+l[r.b].u+l[r.c].u+l[r.d].u,s.v=l[r.a].v+l[r.b].v+l[r.c].v+l[r.d].v,s.u/=4,s.v/=4;l.push(s)}q=function(a){function b(a,c,d){void 0===a[c]&&(a[c]=[]);a[c].push(d)}var d,f,e,g,h={};for(d=0,f=a.faces.length;d<f;d++)e=a.faces[d],e instanceof THREE.Face3?(g=c(e.a,e.b),b(h,g,d),g=c(e.b,e.c),b(h,g,d),g=c(e.c,e.a),b(h,g,d)):e instanceof THREE.Face4&&(g=c(e.a,e.b),b(h,g,d),g=c(e.b,e.c),b(h,g,d),g=c(e.c,e.d),b(h,g,d),g=c(e.d,e.a),b(h,g,d));return h}(a);var u=0,t=h.length,v,x,z={},w={},D=function(a,
+b){void 0===z[a]&&(z[a]=[]);z[a].push(b)},G=function(a,b){void 0===w[a]&&(w[a]={});w[a][b]=null};for(m in q){s=q[m];v=m.split("_");x=v[0];v=v[1];D(x,[x,v]);D(v,[x,v]);for(n=0,p=s.length;n<p;n++)r=s[n],G(x,r,m),G(v,r,m);2>s.length&&(o[m]=!0)}for(m in q)if(s=q[m],r=s[0],s=s[1],v=m.split("_"),x=v[0],v=v[1],p=new THREE.Vector3,o[m]?(p.addSelf(h[x].position),p.addSelf(h[v].position),p.multiplyScalar(0.5)):(p.addSelf(j[r]),p.addSelf(j[s]),p.addSelf(h[x].position),p.addSelf(h[v].position),p.multiplyScalar(0.25)),
+k[m]=t+d.length+u,i.push(new THREE.Vertex(p)),u++,g.supportUVs&&0!=l.length)s=new THREE.UV,s.u=l[x].u+l[v].u,s.v=l[x].v+l[v].v,s.u/=2,s.v/=2,l.push(s);var H,J;v=["123","12","2","23"];p=["123","23","3","31"];var D=["123","31","1","12"],G=["1234","12","2","23"],K=["1234","23","3","34"],C=["1234","34","4","41"],y=["1234","41","1","12"];for(m=0,q=j.length;m<q;m++)r=d[m],s=t+m,r instanceof THREE.Face3?(u=c(r.a,r.b),x=c(r.b,r.c),H=c(r.c,r.a),b(s,k[u],r.b,k[x],r,v),b(s,k[x],r.c,k[H],r,p),b(s,k[H],r.a,k[u],
+r,D)):r instanceof THREE.Face4?(u=c(r.a,r.b),x=c(r.b,r.c),H=c(r.c,r.d),J=c(r.d,r.a),b(s,k[u],r.b,k[x],r,G),b(s,k[x],r.c,k[H],r,K),b(s,k[H],r.d,k[J],r,C),b(s,k[J],r.a,k[u],r,y)):console.log("face should be a face!",r);d=i;i=new THREE.Vector3;k=new THREE.Vector3;for(m=0,q=h.length;m<q;m++)if(void 0!==z[m]){i.set(0,0,0);k.set(0,0,0);r=new THREE.Vector3(0,0,0);s=0;for(n in w[m])i.addSelf(j[n]),s++;u=0;t=z[m].length;for(n=0;n<t;n++)o[c(z[m][n][0],z[m][n][1])]&&u++;if(2!=u){i.divideScalar(s);for(n=0;n<
+t;n++)s=z[m][n],s=h[s[0]].position.clone().addSelf(h[s[1]].position).divideScalar(2),k.addSelf(s);k.divideScalar(t);r.addSelf(h[m].position);r.multiplyScalar(t-3);r.addSelf(i);r.addSelf(k.multiplyScalar(2));r.divideScalar(t);d[m].position=r}}a.vertices=d;a.faces=e;a.faceVertexUvs[0]=f;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,crossOrigin:"anonymous",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?b+((100*a.loaded/
 a.total).toFixed(0)+"%"):b+((a.loaded/1E3).toFixed(2)+" KB");this.statusDomElement.innerHTML=b},extractUrlBase:function(a){a=a.split("/");a.pop();return(1>a.length?".":a.join("/"))+"/"},initMaterials:function(a,b,c){a.materials=[];for(var d=0;d<b.length;++d)a.materials[d]=THREE.Loader.prototype.createMaterial(b[d],c)},hasNormals:function(a){var b,c,d=a.materials.length;for(c=0;c<d;c++)if(b=a.materials[c],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 d(a){a=Math.log(a)/Math.LN2;return Math.pow(2,Math.round(a))}function f(a,b){var e=new Image;e.onload=function(){if(!c(this.width)||!c(this.height)){var b=d(this.width),e=d(this.height);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.crossOrigin=h.crossOrigin;e.src=b}function e(a,c,d,e,g,h){var i=document.createElement("canvas");a[c]=new THREE.Texture(i);a[c].sourceFile=d;
-if(e){a[c].repeat.set(e[0],e[1]);if(1!=e[0])a[c].wrapS=THREE.RepeatWrapping;if(1!=e[1])a[c].wrapT=THREE.RepeatWrapping}g&&a[c].offset.set(g[0],g[1]);if(h){e={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(void 0!==e[h[0]])a[c].wrapS=e[h[0]];if(void 0!==e[h[1]])a[c].wrapT=e[h[1]]}f(a[c],b+"/"+d)}function g(a){return(255*a[0]<<16)+(255*a[1]<<8)+255*a[2]}var h=this,i="MeshLambertMaterial",j={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:a.wireframe};if(a.shading){var k=
+Math.log(a)/Math.LN2;return Math.floor(a)==a}function d(a){a=Math.log(a)/Math.LN2;return Math.pow(2,Math.round(a))}function e(a,b){var f=new Image;f.onload=function(){if(!c(this.width)||!c(this.height)){var b=d(this.width),f=d(this.height);a.image.width=b;a.image.height=f;a.image.getContext("2d").drawImage(this,0,0,b,f)}else a.image=this;a.needsUpdate=!0};f.crossOrigin=h.crossOrigin;f.src=b}function f(a,c,d,f,g,h){var i=document.createElement("canvas");a[c]=new THREE.Texture(i);a[c].sourceFile=d;
+if(f){a[c].repeat.set(f[0],f[1]);if(1!=f[0])a[c].wrapS=THREE.RepeatWrapping;if(1!=f[1])a[c].wrapT=THREE.RepeatWrapping}g&&a[c].offset.set(g[0],g[1]);if(h){f={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(void 0!==f[h[0]])a[c].wrapS=f[h[0]];if(void 0!==f[h[1]])a[c].wrapT=f[h[1]]}e(a[c],b+"/"+d)}function g(a){return(255*a[0]<<16)+(255*a[1]<<8)+255*a[2]}var h=this,i="MeshLambertMaterial",j={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:a.wireframe};if(a.shading){var k=
 a.shading.toLowerCase();"phong"===k?i="MeshPhongMaterial":"basic"===k&&(i="MeshBasicMaterial")}if(void 0!==a.blending&&void 0!==THREE[a.blending])j.blending=THREE[a.blending];if(void 0!==a.transparent||1>a.opacity)j.transparent=a.transparent;if(void 0!==a.depthTest)j.depthTest=a.depthTest;if(void 0!==a.depthWrite)j.depthWrite=a.depthWrite;if(void 0!==a.vertexColors)if("face"==a.vertexColors)j.vertexColors=THREE.FaceColors;else if(a.vertexColors)j.vertexColors=THREE.VertexColors;if(a.colorDiffuse)j.color=
-g(a.colorDiffuse);else if(a.DbgColor)j.color=a.DbgColor;if(a.colorSpecular)j.specular=g(a.colorSpecular);if(a.colorAmbient)j.ambient=g(a.colorAmbient);if(a.transparency)j.opacity=a.transparency;if(a.specularCoef)j.shininess=a.specularCoef;a.mapDiffuse&&b&&e(j,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap);a.mapLight&&b&&e(j,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap);a.mapNormal&&b&&e(j,"normalMap",a.mapNormal,a.mapNormalRepeat,a.mapNormalOffset,
-a.mapNormalWrap);a.mapSpecular&&b&&e(j,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){i=THREE.ShaderUtils.lib.normal;k=THREE.UniformsUtils.clone(i.uniforms);k.tNormal.texture=j.normalMap;if(a.mapNormalFactor)k.uNormalScale.value=a.mapNormalFactor;if(j.map)k.tDiffuse.texture=j.map,k.enableDiffuse.value=!0;if(j.specularMap)k.tSpecular.texture=j.specularMap,k.enableSpecular.value=!0;if(j.lightMap)k.tAO.texture=j.lightMap,k.enableAO.value=!0;k.uDiffuseColor.value.setHex(j.color);
+g(a.colorDiffuse);else if(a.DbgColor)j.color=a.DbgColor;if(a.colorSpecular)j.specular=g(a.colorSpecular);if(a.colorAmbient)j.ambient=g(a.colorAmbient);if(a.transparency)j.opacity=a.transparency;if(a.specularCoef)j.shininess=a.specularCoef;a.mapDiffuse&&b&&f(j,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap);a.mapLight&&b&&f(j,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap);a.mapNormal&&b&&f(j,"normalMap",a.mapNormal,a.mapNormalRepeat,a.mapNormalOffset,
+a.mapNormalWrap);a.mapSpecular&&b&&f(j,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){i=THREE.ShaderUtils.lib.normal;k=THREE.UniformsUtils.clone(i.uniforms);k.tNormal.texture=j.normalMap;if(a.mapNormalFactor)k.uNormalScale.value=a.mapNormalFactor;if(j.map)k.tDiffuse.texture=j.map,k.enableDiffuse.value=!0;if(j.specularMap)k.tSpecular.texture=j.specularMap,k.enableSpecular.value=!0;if(j.lightMap)k.tAO.texture=j.lightMap,k.enableAO.value=!0;k.uDiffuseColor.value.setHex(j.color);
 k.uSpecularColor.value.setHex(j.specular);k.uAmbientColor.value.setHex(j.ambient);k.uShininess.value=j.shininess;if(void 0!==j.opacity)k.uOpacity.value=j.opacity;j=new THREE.ShaderMaterial({fragmentShader:i.fragmentShader,vertexShader:i.vertexShader,uniforms:k,lights:!0,fog:!0})}else j=new THREE[i](j);if(void 0!==a.DbgName)j.name=a.DbgName;return j}};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,b,c,d){var c=c?c:this.extractUrlBase(a),d=d?d:this.extractUrlBase(a),f=this.showProgress?THREE.Loader.prototype.updateProgress:null;this.onLoadStart();this.loadAjaxJSON(this,a,b,c,d,f)};
-THREE.BinaryLoader.prototype.loadAjaxJSON=function(a,b,c,d,f,e){var g=new XMLHttpRequest;g.onreadystatechange=function(){if(4==g.readyState)if(200==g.status||0==g.status){var h=JSON.parse(g.responseText);a.loadAjaxBuffers(h,c,f,d,e)}else console.error("THREE.BinaryLoader: Couldn't load ["+b+"] ["+g.status+"]")};g.open("GET",b,!0);g.overrideMimeType&&g.overrideMimeType("text/plain; charset=x-user-defined");g.setRequestHeader("Content-Type","text/plain");g.send(null)};
-THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,b,c,d,f){var e=new XMLHttpRequest,g=c+"/"+a.buffers,h=0;e.onreadystatechange=function(){4==e.readyState?200==e.status||0==e.status?THREE.BinaryLoader.prototype.createBinModel(e.response,b,d,a.materials):console.error("THREE.BinaryLoader: Couldn't load ["+g+"] ["+e.status+"]"):3==e.readyState?f&&(0==h&&(h=e.getResponseHeader("Content-Length")),f({total:h,loaded:e.responseText.length})):2==e.readyState&&(h=e.getResponseHeader("Content-Length"))};
-e.open("GET",g,!0);e.responseType="arraybuffer";e.send(null)};
-THREE.BinaryLoader.prototype.createBinModel=function(a,b,c,d){var f=function(b){var c,f,i,j,k,p,l,m,r,n,o,q,u,s,t;function v(a){return a%4?4-a%4:0}function w(a,b){return(new Uint8Array(a,b,1))[0]}function z(a,b){return(new Uint32Array(a,b,1))[0]}function x(b,c){var d,e,f,g,h,i,j,k,l=new Uint32Array(a,c,3*b);for(d=0;d<b;d++){e=l[3*d];f=l[3*d+1];g=l[3*d+2];h=E[2*e];e=E[2*e+1];i=E[2*f];j=E[2*f+1];f=E[2*g];k=E[2*g+1];g=D.faceVertexUvs[0];var m=[];m.push(new THREE.UV(h,e));m.push(new THREE.UV(i,j));m.push(new THREE.UV(f,
-k));g.push(m)}}function C(b,c){var d,e,f,g,h,i,j,k,l,m,n=new Uint32Array(a,c,4*b);for(d=0;d<b;d++){e=n[4*d];f=n[4*d+1];g=n[4*d+2];h=n[4*d+3];i=E[2*e];e=E[2*e+1];j=E[2*f];l=E[2*f+1];k=E[2*g];m=E[2*g+1];g=E[2*h];f=E[2*h+1];h=D.faceVertexUvs[0];var p=[];p.push(new THREE.UV(i,e));p.push(new THREE.UV(j,l));p.push(new THREE.UV(k,m));p.push(new THREE.UV(g,f));h.push(p)}}function G(b,c,d){for(var e,f,g,h,c=new Uint32Array(a,c,3*b),i=new Uint16Array(a,d,b),d=0;d<b;d++)e=c[3*d],f=c[3*d+1],g=c[3*d+2],h=i[d],
-D.faces.push(new THREE.Face3(e,f,g,null,null,h))}function H(b,c,d){for(var e,f,g,h,i,c=new Uint32Array(a,c,4*b),j=new Uint16Array(a,d,b),d=0;d<b;d++)e=c[4*d],f=c[4*d+1],g=c[4*d+2],h=c[4*d+3],i=j[d],D.faces.push(new THREE.Face4(e,f,g,h,null,null,i))}function J(b,c,d,e){for(var f,g,h,i,j,k,l,c=new Uint32Array(a,c,3*b),d=new Uint32Array(a,d,3*b),m=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[3*e];g=c[3*e+1];h=c[3*e+2];j=d[3*e];k=d[3*e+1];l=d[3*e+2];i=m[e];var n=B[3*k],p=B[3*k+1];k=B[3*k+2];var o=B[3*l],q=
-B[3*l+1];l=B[3*l+2];D.faces.push(new THREE.Face3(f,g,h,[new THREE.Vector3(B[3*j],B[3*j+1],B[3*j+2]),new THREE.Vector3(n,p,k),new THREE.Vector3(o,q,l)],null,i))}}function I(b,c,d,e){for(var f,g,h,i,j,k,l,m,n,c=new Uint32Array(a,c,4*b),d=new Uint32Array(a,d,4*b),p=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[4*e];g=c[4*e+1];h=c[4*e+2];i=c[4*e+3];k=d[4*e];l=d[4*e+1];m=d[4*e+2];n=d[4*e+3];j=p[e];var o=B[3*l],q=B[3*l+1];l=B[3*l+2];var r=B[3*m],s=B[3*m+1];m=B[3*m+2];var t=B[3*n],u=B[3*n+1];n=B[3*n+2];D.faces.push(new THREE.Face4(f,
-g,h,i,[new THREE.Vector3(B[3*k],B[3*k+1],B[3*k+2]),new THREE.Vector3(o,q,l),new THREE.Vector3(r,s,m),new THREE.Vector3(t,u,n)],null,j))}}var D=this,y=0,B=[],E=[],M,K,F;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(D,d,b);(function(a,b,c){for(var a=new Uint8Array(a,b,c),d="",e=0;e<c;e++)d+=String.fromCharCode(a[b+e]);return d})(a,y,12);c=w(a,y+12);w(a,y+13);w(a,y+14);w(a,y+15);f=w(a,y+16);i=w(a,y+17);j=w(a,y+18);k=w(a,y+19);p=z(a,y+20);l=z(a,y+20+4);m=z(a,y+20+8);b=z(a,y+20+12);r=
-z(a,y+20+16);n=z(a,y+20+20);o=z(a,y+20+24);q=z(a,y+20+28);u=z(a,y+20+32);s=z(a,y+20+36);t=z(a,y+20+40);y+=c;c=3*f+k;F=4*f+k;M=b*c;K=r*(c+3*i);f=n*(c+3*j);k=o*(c+3*i+3*j);c=q*F;i=u*(F+4*i);j=s*(F+4*j);y+=function(b){var b=new Float32Array(a,b,3*p),c,d,e,f;for(c=0;c<p;c++)d=b[3*c],e=b[3*c+1],f=b[3*c+2],D.vertices.push(new THREE.Vertex(new THREE.Vector3(d,e,f)));return 3*p*Float32Array.BYTES_PER_ELEMENT}(y);y+=function(b){if(l){var b=new Int8Array(a,b,3*l),c,d,e,f;for(c=0;c<l;c++)d=b[3*c],e=b[3*c+1],
-f=b[3*c+2],B.push(d/127,e/127,f/127)}return 3*l*Int8Array.BYTES_PER_ELEMENT}(y);y+=v(3*l);y+=function(b){if(m){var b=new Float32Array(a,b,2*m),c,d,e;for(c=0;c<m;c++)d=b[2*c],e=b[2*c+1],E.push(d,e)}return 2*m*Float32Array.BYTES_PER_ELEMENT}(y);M=y+M+v(2*b);K=M+K+v(2*r);f=K+f+v(2*n);k=f+k+v(2*o);c=k+c+v(2*q);i=c+i+v(2*u);j=i+j+v(2*s);(function(a){if(n){var b=a+3*n*Uint32Array.BYTES_PER_ELEMENT;G(n,a,b+3*n*Uint32Array.BYTES_PER_ELEMENT);x(n,b)}})(K);(function(a){if(o){var b=a+3*o*Uint32Array.BYTES_PER_ELEMENT,
-c=b+3*o*Uint32Array.BYTES_PER_ELEMENT;J(o,a,b,c+3*o*Uint32Array.BYTES_PER_ELEMENT);x(o,c)}})(f);(function(a){if(s){var b=a+4*s*Uint32Array.BYTES_PER_ELEMENT;H(s,a,b+4*s*Uint32Array.BYTES_PER_ELEMENT);C(s,b)}})(i);(function(a){if(t){var b=a+4*t*Uint32Array.BYTES_PER_ELEMENT,c=b+4*t*Uint32Array.BYTES_PER_ELEMENT;I(t,a,b,c+4*t*Uint32Array.BYTES_PER_ELEMENT);C(t,c)}})(j);b&&G(b,y,y+3*b*Uint32Array.BYTES_PER_ELEMENT);(function(a){if(r){var b=a+3*r*Uint32Array.BYTES_PER_ELEMENT;J(r,a,b,b+3*r*Uint32Array.BYTES_PER_ELEMENT)}})(M);
-q&&H(q,k,k+4*q*Uint32Array.BYTES_PER_ELEMENT);(function(a){if(u){var b=a+4*u*Uint32Array.BYTES_PER_ELEMENT;I(u,a,b,b+4*u*Uint32Array.BYTES_PER_ELEMENT)}})(c);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,d,f){Q=a;d=d||la;void 0!==f&&(a=f.split("/"),a.pop(),ma=(1>a.length?".":a.join("/"))+"/");if((a=Q.evaluate("//dae:asset",Q,L,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&a.childNodes)for(f=0;f<a.childNodes.length;f++){var i=a.childNodes[f];switch(i.nodeName){case "unit":(i=i.getAttribute("meter"))&&parseFloat(i);break;case "up_axis":aa=i.textContent.charAt(0)}}if(!R.convertUpAxis||aa===R.upAxis)W=null;else switch(aa){case "X":W="Y"===R.upAxis?
-"XtoY":"XtoZ";break;case "Y":W="X"===R.upAxis?"YtoX":"YtoZ";break;case "Z":W="X"===R.upAxis?"ZtoX":"ZtoY"}ea=b("//dae:library_images/dae:image",g,"image");fa=b("//dae:library_materials/dae:material",x,"material");ga=b("//dae:library_effects/dae:effect",I,"effect");U=b("//dae:library_geometries/dae:geometry",o,"geometry");ha=b(".//dae:library_cameras/dae:camera",K,"camera");T=b("//dae:library_controllers/dae:controller",h,"controller");Y=b("//dae:library_animations/dae:animation",y,"animation");ia=
-b(".//dae:library_visual_scenes/dae:visual_scene",k,"visual_scene");ba=[];ca=[];(a=Q.evaluate(".//dae:scene/dae:instance_visual_scene",Q,L,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(a=a.getAttribute("url").replace(/^#/,""),S=ia[0<a.length?a:"visual_scene0"]):S=null;$=new THREE.Object3D;for(a=0;a<S.nodes.length;a++)$.add(e(S.nodes[a]));ja=[];c($);a={scene:$,morphs:ba,skins:ca,animations:ja,dae:{images:ea,materials:fa,cameras:ha,effects:ga,geometries:U,controllers:T,animations:Y,visualScenes:ia,
-scene:S}};d&&d(a);return a}function b(a,b,c){for(var a=Q.evaluate(a,Q,L,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null),d={},e=a.iterateNext(),f=0;e;){e=(new b).parse(e);if(!e.id||0==e.id.length)e.id=c+f++;d[e.id]=e;e=a.iterateNext()}return d}function c(a){var b=S.getChildById(a.name,!0),d=null;if(b&&b.keys){d={fps:60,hierarchy:[{node:b,keys:b.keys,sids:b.sids}],node:a,name:"animation_"+a.name,length:0};ja.push(d);for(var e=0,f=b.keys.length;e<f;e++)d.length=Math.max(d.length,b.keys[e].time)}else d=
-{hierarchy:[{keys:[],sids:[]}]};e=0;for(f=a.children.length;e<f;e++)for(var b=0,g=c(a.children[e]).hierarchy.length;b<g;b++)d.hierarchy.push({keys:[],sids:[]});return d}function d(a,b,c,e){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[c];f instanceof THREE.Matrix4&&a.world.copy(f)}e&&a.world.multiply(e,a.world);b.push(a);for(e=0;e<a.nodes.length;e++)d(a.nodes[e],b,c,a.world)}function f(a,b,c){var e,f=T[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 c=1E6,g=-c,h=0;for(e in Y)for(var i=Y[e],j=0;j<i.sampler.length;j++){var k=i.sampler[j];k.create();c=Math.min(c,k.startTime);g=Math.max(g,k.endTime);h=Math.max(h,k.input.length)}e=h;for(var b=S.getChildById(b.skeleton[0],!0)||S.getChildBySid(b.skeleton[0],!0),l,m,g=new THREE.Vector3,n,j=0;j<a.vertices.length;j++)f.skin.bindShapeMatrix.multiplyVector3(a.vertices[j].position);
-for(c=0;c<e;c++){h=[];i=[];for(j=0;j<a.vertices.length;j++)i.push(new THREE.Vertex(new THREE.Vector3));d(b,h,c);j=h;k=f.skin;for(m=0;m<j.length;m++)if(l=j[m],n=-1,"JOINT"==l.type){for(var p=0;p<k.joints.length;p++)if(l.sid==k.joints[p]){n=p;break}if(0<=n){p=k.invBindMatrices[n];l.invBindMatrix=p;l.skinningMatrix=new THREE.Matrix4;l.skinningMatrix.multiply(l.world,p);l.weights=[];for(p=0;p<k.weights.length;p++)for(var o=0;o<k.weights[p].length;o++){var q=k.weights[p][o];q.joint==n&&l.weights.push(q)}}else throw"ColladaLoader: Could not find joint '"+
-l.sid+"'.";}for(j=0;j<h.length;j++)if("JOINT"==h[j].type)for(k=0;k<h[j].weights.length;k++)l=h[j].weights[k],m=l.index,l=l.weight,n=a.vertices[m],m=i[m],g.x=n.position.x,g.y=n.position.y,g.z=n.position.z,h[j].skinningMatrix.multiplyVector3(g),m.position.x+=g.x*l,m.position.y+=g.y*l,m.position.z+=g.z*l;a.morphTargets.push({name:"target_"+c,vertices:i})}}}function e(a){var b=new THREE.Object3D,c,d,g,h;for(g=0;g<a.controllers.length;g++){var i=T[a.controllers[g].url];switch(i.type){case "skin":if(U[i.skin.source]){var j=
-new n;j.url=i.skin.source;j.instance_material=a.controllers[g].instance_material;a.geometries.push(j);c=a.controllers[g]}else if(T[i.skin.source]&&(d=i=T[i.skin.source],i.morph&&U[i.morph.source]))j=new n,j.url=i.morph.source,j.instance_material=a.controllers[g].instance_material,a.geometries.push(j);break;case "morph":if(U[i.morph.source])j=new n,j.url=i.morph.source,j.instance_material=a.controllers[g].instance_material,a.geometries.push(j),d=a.controllers[g];console.log("ColladaLoader: Morph-controller partially supported.")}}for(g=
-0;g<a.geometries.length;g++){var i=a.geometries[g],j=i.instance_material,i=U[i.url],k={},l=[],p=0,o;if(i&&i.mesh&&i.mesh.primitives){if(0==b.name.length)b.name=i.id;if(j)for(h=0;h<j.length;h++){o=j[h];var q=fa[o.target],r=ga[q.instance_effect.url].shader;r.material.opacity=!r.material.opacity?1:r.material.opacity;k[o.symbol]=p;l.push(r.material);o=r.material;o.name=null==q.name||""===q.name?q.id:q.name;p++}j=o||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});i=i.mesh.geometry3js;
-if(1<p){j=new THREE.MeshFaceMaterial;i.materials=l;for(h=0;h<i.faces.length;h++)l=i.faces[h],l.materialIndex=k[l.daeMaterial]}if(void 0!==c)f(i,c),j.morphTargets=!0,j=new THREE.SkinnedMesh(i,j),j.skeleton=c.skeleton,j.skinController=T[c.url],j.skinInstanceController=c,j.name="skin_"+ca.length,ca.push(j);else if(void 0!==d){h=i;k=d instanceof m?T[d.url]:d;if(!k||!k.morph)console.log("could not find morph controller!");else{k=k.morph;for(l=0;l<k.targets.length;l++)if(p=U[k.targets[l]],p.mesh&&p.mesh.primitives&&
-p.mesh.primitives.length)p=p.mesh.primitives[0].geometry,p.vertices.length===h.vertices.length&&h.morphTargets.push({name:"target_1",vertices:p.vertices});h.morphTargets.push({name:"target_Z",vertices:h.vertices})}j.morphTargets=!0;j=new THREE.Mesh(i,j);j.name="morph_"+ba.length;ba.push(j)}else j=new THREE.Mesh(i,j);1<a.geometries.length?b.add(j):b=j}}for(g=0;g<a.cameras.length;g++)b=ha[a.cameras[g].url],b=new THREE.PerspectiveCamera(b.fov,b.aspect_ratio,b.znear,b.zfar);b.name=a.id||"";b.matrix=a.matrix;
-g=a.matrix.decompose();b.position=g[0];b.quaternion=g[1];b.useQuaternion=!0;b.scale=g[2];R.centerGeometry&&b.geometry&&(g=THREE.GeometryUtils.center(b.geometry),b.quaternion.multiplyVector3(g.multiplySelf(b.scale)),b.position.subSelf(g));for(g=0;g<a.nodes.length;g++)b.add(e(a.nodes[g],a));return b}function g(){this.init_from=this.id=""}function h(){this.type=this.name=this.id="";this.morph=this.skin=null}function i(){this.weights=this.targets=this.source=this.method=null}function j(){this.source=
-"";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function k(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function p(){this.sid=this.name=this.id="";this.nodes=[];this.controllers=[];this.transforms=[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function l(){this.type=this.sid="";this.data=[];this.obj=null}function m(){this.url="";this.skeleton=[];this.instance_material=[]}function r(){this.target=this.symbol=""}function n(){this.url=
-"";this.instance_material=[]}function o(){this.id="";this.mesh=null}function q(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function u(){}function s(){this.material="";this.count=0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function t(){this.source="";this.stride=this.count=0;this.params=[]}function v(){this.input={}}function w(){this.semantic="";this.offset=0;this.source="";this.set=0}function z(a){this.id=a;this.type=null}function x(){this.name=
-this.id="";this.instance_effect=null}function C(){this.color=new THREE.Color(0);this.color.setRGB(Math.random(),Math.random(),Math.random());this.color.a=1;this.texOpts=this.texcoord=this.texture=null}function G(a,b){this.type=a;this.effect=b;this.material=null}function H(a){this.effect=a;this.format=this.init_from=null}function J(a){this.effect=a;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=this.source=null}function I(){this.name=this.id="";this.sampler=this.surface=this.shader=
-null}function D(){this.url=""}function y(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function B(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=this.dotSyntax=this.sid=this.fullSid=null}function E(a){this.id="";this.animation=a;this.inputs=[];this.endTime=this.startTime=this.interpolation=this.strideOut=this.output=this.input=null;this.duration=0}function M(a){this.targets=[];this.time=a}function K(){this.name=this.id=""}function F(){this.url=
-""}function L(a){return"dae"==a?"http://www.collada.org/2005/11/COLLADASchema":null}function N(a){for(var a=V(a),b=[],c=0,d=a.length;c<d;c++)b.push(parseFloat(a[c]));return b}function A(a){for(var a=V(a),b=[],c=0,d=a.length;c<d;c++)b.push(parseInt(a[c],10));return b}function V(a){return 0<a.length?a.replace(/^\s+/,"").replace(/\s+$/,"").split(/\s+/):[]}function P(a,b,c){return a.hasAttribute(b)?parseInt(a.getAttribute(b),10):c}function O(a,b){if(R.convertUpAxis&&aa!==R.upAxis)switch(W){case "XtoY":var c=
-a[0];a[0]=b*a[1];a[1]=c;break;case "XtoZ":c=a[2];a[2]=a[1];a[1]=a[0];a[0]=c;break;case "YtoX":c=a[0];a[0]=a[1];a[1]=b*c;break;case "YtoZ":c=a[1];a[1]=b*a[2];a[2]=c;break;case "ZtoX":c=a[0];a[0]=a[1];a[1]=a[2];a[2]=c;break;case "ZtoY":c=a[1],a[1]=a[2],a[2]=b*c}}function X(a,b){var c=[a[b],a[b+1],a[b+2]];O(c,-1);return new THREE.Vector3(c[0],c[1],c[2])}function da(a){if(R.convertUpAxis){var b=[a[0],a[4],a[8]];O(b,-1);a[0]=b[0];a[4]=b[1];a[8]=b[2];b=[a[1],a[5],a[9]];O(b,-1);a[1]=b[0];a[5]=b[1];a[9]=
-b[2];b=[a[2],a[6],a[10]];O(b,-1);a[2]=b[0];a[6]=b[1];a[10]=b[2];b=[a[0],a[1],a[2]];O(b,-1);a[0]=b[0];a[1]=b[1];a[2]=b[2];b=[a[4],a[5],a[6]];O(b,-1);a[4]=b[0];a[5]=b[1];a[6]=b[2];b=[a[8],a[9],a[10]];O(b,-1);a[8]=b[0];a[9]=b[1];a[10]=b[2];b=[a[3],a[7],a[11]];O(b,-1);a[3]=b[0];a[7]=b[1];a[11]=b[2]}return new THREE.Matrix4(a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8],a[9],a[10],a[11],a[12],a[13],a[14],a[15])}var Q=null,$=null,S,la=null,Z={},ea={},Y={},T={},U={},fa={},ga={},ha={},ja,ia,ma,ba,ca,na=THREE.SmoothShading,
-R={centerGeometry:!1,convertUpAxis:!1,subdivideFaces:!0,upAxis:"Y"},aa="Y",W=null,ka=Math.PI/180;g.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if("init_from"==c.nodeName)this.init_from=c.textContent}return this};h.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 j).parse(c);
-this.type=c.nodeName;break;case "morph":this.morph=(new i).parse(c),this.type=c.nodeName}}return this};i.prototype.parse=function(a){var b={},c=[],d;this.method=a.getAttribute("method");this.source=a.getAttribute("source").replace(/^#/,"");for(d=0;d<a.childNodes.length;d++){var e=a.childNodes[d];if(1==e.nodeType)switch(e.nodeName){case "source":e=(new z).parse(e);b[e.id]=e;break;case "targets":c=this.parseInputs(e);break;default:console.log(e.nodeName)}}for(d=0;d<c.length;d++)switch(a=c[d],e=b[a.source],
-a.semantic){case "MORPH_TARGET":this.targets=e.read();break;case "MORPH_WEIGHT":this.weights=e.read()}return this};i.prototype.parseInputs=function(a){for(var b=[],c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(1==d.nodeType)switch(d.nodeName){case "input":b.push((new w).parse(d))}}return b};j.prototype.parse=function(a){var b={},c,d;this.source=a.getAttribute("source").replace(/^#/,"");this.invBindMatrices=[];this.joints=[];this.weights=[];for(var e=0;e<a.childNodes.length;e++){var f=a.childNodes[e];
-if(1==f.nodeType)switch(f.nodeName){case "bind_shape_matrix":f=N(f.textContent);this.bindShapeMatrix=da(f);break;case "source":f=(new z).parse(f);b[f.id]=f;break;case "joints":c=f;break;case "vertex_weights":d=f;break;default:console.log(f.nodeName)}}this.parseJoints(c,b);this.parseWeights(d,b);return this};j.prototype.parseJoints=function(a,b){for(var c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(1==d.nodeType)switch(d.nodeName){case "input":var d=(new w).parse(d),e=b[d.source];if("JOINT"==
-d.semantic)this.joints=e.read();else if("INV_BIND_MATRIX"==d.semantic)this.invBindMatrices=e.read()}}};j.prototype.parseWeights=function(a,b){for(var c,d,e=[],f=0;f<a.childNodes.length;f++){var g=a.childNodes[f];if(1==g.nodeType)switch(g.nodeName){case "input":e.push((new w).parse(g));break;case "v":c=A(g.textContent);break;case "vcount":d=A(g.textContent)}}for(f=g=0;f<d.length;f++){for(var h=d[f],i=[],j=0;j<h;j++){for(var k={},l=0;l<e.length;l++){var m=e[l],n=c[g+m.offset];switch(m.semantic){case "JOINT":k.joint=
-n;break;case "WEIGHT":k.weight=b[m.source].data[n]}}i.push(k);g+=e.length}for(j=0;j<i.length;j++)i[j].index=f;this.weights.push(i)}};k.prototype.getChildById=function(a,b){for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildById(a,b);if(d)return d}return null};k.prototype.getChildBySid=function(a,b){for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildBySid(a,b);if(d)return d}return null};k.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(1==c.nodeType)switch(c.nodeName){case "node":this.nodes.push((new p).parse(c))}}return this};p.prototype.getChannelForTransform=function(a){for(var b=0;b<this.channels.length;b++){var c=this.channels[b],d=c.target.split("/");d.shift();var e=d.shift(),f=0<=e.indexOf("."),g=0<=e.indexOf("("),h;if(f)d=e.split("."),e=d.shift(),d.shift();else if(g){h=e.split("(");e=h.shift();for(d=0;d<h.length;d++)h[d]=parseInt(h[d].replace(/\)/,
-""))}if(e==a)return c.info={sid:e,dotSyntax:f,arrSyntax:g,arrIndices:h},c}return null};p.prototype.getChildById=function(a,b){if(this.id==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildById(a,b);if(d)return d}return null};p.prototype.getChildBySid=function(a,b){if(this.sid==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildBySid(a,b);if(d)return d}return null};p.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};p.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="JOINT"==this.type?this.type:"NODE";this.nodes=[];this.transforms=[];this.geometries=[];this.cameras=[];this.controllers=[];this.matrix=new THREE.Matrix4;for(var c=0;c<a.childNodes.length;c++)if(b=a.childNodes[c],1==b.nodeType)switch(b.nodeName){case "node":this.nodes.push((new p).parse(b));
-break;case "instance_camera":this.cameras.push((new F).parse(b));break;case "instance_controller":this.controllers.push((new m).parse(b));break;case "instance_geometry":this.geometries.push((new n).parse(b));break;case "instance_light":break;case "instance_node":b=b.getAttribute("url").replace(/^#/,"");(b=Q.evaluate(".//dae:library_nodes//dae:node[@id='"+b+"']",Q,L,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new p).parse(b));break;case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new l).parse(b));
-break;case "extra":break;default:console.log(b.nodeName)}a=[];c=1E6;b=-1E6;for(var d in Y)for(var e=Y[d],f=0;f<e.channel.length;f++){var g=e.channel[f],h=e.sampler[f];d=g.target.split("/")[0];if(d==this.id)h.create(),g.sampler=h,c=Math.min(c,h.startTime),b=Math.max(b,h.endTime),a.push(g)}if(a.length)this.startTime=c,this.endTime=b;if((this.channels=a)&&this.channels.length){d=[];a=[];c=0;for(e=this.channels.length;c<e;c++){b=this.channels[c];f=b.fullSid;g=b.member;if(R.convertUpAxis)switch(g){case "X":switch(W){case "XtoY":case "XtoZ":case "YtoX":g=
-"Y";break;case "ZtoX":g="Z"}break;case "Y":switch(W){case "XtoY":case "YtoX":case "ZtoX":g="X";break;case "XtoZ":case "YtoZ":case "ZtoY":g="Z"}break;case "Z":switch(W){case "XtoZ":g="X";break;case "YtoZ":case "ZtoX":case "ZtoY":g="Y"}}var h=b.sampler,i=h.input,j=this.getTransformBySid(b.sid);if(j){-1===a.indexOf(f)&&a.push(f);b=0;for(var k=i.length;b<k;b++){var o=i[b],q=h.getData(j.type,b),r;r=null;for(var s=0,t=d.length;s<t&&null==r;s++){var u=d[s];if(u.time===o)r=u;else if(u.time>o)break}if(!r){r=
-new M(o);s=-1;t=0;for(u=d.length;t<u&&-1==s;t++)d[t].time>=o&&(s=t);o=s;d.splice(-1==o?d.length:o,0,r)}r.addTarget(f,j,g,q)}}else console.log('Could not find transform "'+b.sid+'" in node '+this.id)}for(c=0;c<a.length;c++){e=a[c];for(b=0;b<d.length;b++)if(r=d[b],!r.hasTarget(e)){h=d;f=r;j=b;g=e;i=void 0;a:{i=j?j-1:0;for(i=0<=i?i:i+h.length;0<=i;i--)if(k=h[i],k.hasTarget(g)){i=k;break a}i=null}k=void 0;a:{for(j+=1;j<h.length;j++)if(k=h[j],k.hasTarget(g))break a;k=null}if(i&&k){h=(f.time-i.time)/(k.time-
-i.time);i=i.getTarget(g);j=k.getTarget(g).data;k=i.data;q=void 0;if(k.length){q=[];for(o=0;o<k.length;++o)q[o]=k[o]+(j[o]-k[o])*h}else q=k+(j-k)*h;f.addTarget(g,i.transform,i.member,q)}}}this.keys=d;this.sids=a}this.updateMatrix();return this};p.prototype.updateMatrix=function(){this.matrix.identity();for(var a=0;a<this.transforms.length;a++)this.transforms[a].apply(this.matrix)};l.prototype.parse=function(a){this.sid=a.getAttribute("sid");this.type=a.nodeName;this.data=N(a.textContent);this.convert();
-return this};l.prototype.convert=function(){switch(this.type){case "matrix":this.obj=da(this.data);break;case "rotate":this.angle=this.data[3]*ka;case "translate":O(this.data,-1);this.obj=new THREE.Vector3(this.data[0],this.data[1],this.data[2]);break;case "scale":O(this.data,1);this.obj=new THREE.Vector3(this.data[0],this.data[1],this.data[2]);break;default:console.log("Can not convert Transform of type "+this.type)}};l.prototype.apply=function(a){switch(this.type){case "matrix":a.multiplySelf(this.obj);
-break;case "translate":a.translate(this.obj);break;case "rotate":a.rotateByAxis(this.obj,this.angle);break;case "scale":a.scale(this.obj)}};l.prototype.update=function(a,b){switch(this.type){case "matrix":console.log("Currently not handling matrix transform updates");break;case "translate":case "scale":switch(b){case "X":this.obj.x=a;break;case "Y":this.obj.y=a;break;case "Z":this.obj.z=a;break;default:this.obj.x=a[0],this.obj.y=a[1],this.obj.z=a[2]}break;case "rotate":switch(b){case "X":this.obj.x=
-a;break;case "Y":this.obj.y=a;break;case "Z":this.obj.z=a;break;case "ANGLE":this.angle=a*ka;break;default:this.obj.x=a[0],this.obj.y=a[1],this.obj.z=a[2],this.angle=a[3]*ka}}};m.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(1==c.nodeType)switch(c.nodeName){case "skeleton":this.skeleton.push(c.textContent.replace(/^#/,""));break;case "bind_material":if(c=Q.evaluate(".//dae:instance_material",
-c,L,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(var d=c.iterateNext();d;)this.instance_material.push((new r).parse(d)),d=c.iterateNext()}}return this};r.prototype.parse=function(a){this.symbol=a.getAttribute("symbol");this.target=a.getAttribute("target").replace(/^#/,"");return this};n.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(1==c.nodeType&&"bind_material"==c.nodeName){if(a=
-Q.evaluate(".//dae:instance_material",c,L,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(b=a.iterateNext();b;)this.instance_material.push((new r).parse(b)),b=a.iterateNext();break}}return this};o.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 q(this)).parse(c)}}return this};q.prototype.parse=function(a){this.primitives=[];var b;for(b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];
-switch(c.nodeName){case "source":var d=c.getAttribute("id");void 0==Z[d]&&(Z[d]=(new z(d)).parse(c));break;case "vertices":this.vertices=(new v).parse(c);break;case "triangles":this.primitives.push((new s).parse(c));break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new u).parse(c))}}this.geometry3js=new THREE.Geometry;a=Z[this.vertices.input.POSITION.source].data;for(b=0;b<a.length;b+=3)this.geometry3js.vertices.push(new THREE.Vertex(X(a,
-b)));for(b=0;b<this.primitives.length;b++)a=this.primitives[b],a.setVertices(this.vertices),this.handlePrimitive(a,this.geometry3js);this.geometry3js.computeCentroids();this.geometry3js.computeFaceNormals();this.geometry3js.calcNormals&&(this.geometry3js.computeVertexNormals(),delete this.geometry3js.calcNormals);this.geometry3js.computeBoundingBox();return this};q.prototype.handlePrimitive=function(a,b){var c=0,d,e,f=a.p,g=a.inputs,h,i,j,k,l=0,m=3,n=0,p=[];for(d=0;d<g.length;d++){h=g[d];var o=h.offset+
-1,n=n<o?o:n;switch(h.semantic){case "TEXCOORD":p.push(h.set)}}for(;c<f.length;){var q=[],r=[],o={},s=[];a.vcount&&(m=a.vcount[l++]);for(d=0;d<m;d++)for(e=0;e<g.length;e++)switch(h=g[e],k=Z[h.source],i=f[c+d*n+h.offset],j=k.accessor.params.length,j*=i,h.semantic){case "VERTEX":q.push(i);break;case "NORMAL":r.push(X(k.data,j));break;case "TEXCOORD":void 0===o[h.set]&&(o[h.set]=[]);o[h.set].push(new THREE.UV(k.data[j],1-k.data[j+1]));break;case "COLOR":s.push((new THREE.Color).setRGB(k.data[j],k.data[j+
-1],k.data[j+2]))}e=null;d=[];if(0==r.length)if(h=this.vertices.input.NORMAL){k=Z[h.source];j=k.accessor.params.length;h=0;for(i=q.length;h<i;h++)r.push(X(k.data,q[h]*j))}else b.calcNormals=!0;if(3===m)d.push(new THREE.Face3(q[0],q[1],q[2],r,s.length?s:new THREE.Color));else if(4===m)d.push(new THREE.Face4(q[0],q[1],q[2],q[3],r,s.length?s:new THREE.Color));else if(4<m&&R.subdivideFaces){s=s.length?s:new THREE.Color;for(e=1;e<m-1;)d.push(new THREE.Face3(q[0],q[e],q[e+1],[r[0],r[e++],r[e]],s))}if(d.length){h=
-0;for(i=d.length;h<i;h++){e=d[h];e.daeMaterial=a.material;b.faces.push(e);for(e=0;e<p.length;e++)q=o[p[e]],q=4<m?[q[0],q[h+1],q[h+2]]:4===m?[q[0],q[1],q[2],q[3]]:[q[0],q[1],q[2]],b.faceVertexUvs[e]||(b.faceVertexUvs[e]=[]),b.faceVertexUvs[e].push(q)}}else console.log("dropped face with vcount "+m+" for geometry with id: "+b.id);c+=n*m}};u.prototype=new s;u.prototype.constructor=u;s.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};s.prototype.parse=function(a){this.inputs=[];this.material=a.getAttribute("material");this.count=P(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 w).parse(a.childNodes[b]));break;case "vcount":this.vcount=A(c.textContent);break;case "p":this.p=A(c.textContent)}}return this};t.prototype.parse=function(a){this.params=[];this.source=a.getAttribute("source");this.count=P(a,"count",0);this.stride=
-P(a,"stride",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if("param"==c.nodeName){var d={};d.name=c.getAttribute("name");d.type=c.getAttribute("type");this.params.push(d)}}return this};v.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++)if("input"==a.childNodes[b].nodeName){var c=(new w).parse(a.childNodes[b]);this.input[c.semantic]=c}return this};w.prototype.parse=function(a){this.semantic=a.getAttribute("semantic");this.source=a.getAttribute("source").replace(/^#/,
-"");this.set=P(a,"set",-1);this.offset=P(a,"offset",0);if("TEXCOORD"==this.semantic&&0>this.set)this.set=0;return this};z.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 d=V(c.textContent),e=[],f=0,g=d.length;f<g;f++)e.push("true"==d[f]||"1"==d[f]?!0:!1);this.data=e;this.type=c.nodeName;break;case "float_array":this.data=N(c.textContent);this.type=c.nodeName;break;case "int_array":this.data=
-A(c.textContent);this.type=c.nodeName;break;case "IDREF_array":case "Name_array":this.data=V(c.textContent);this.type=c.nodeName;break;case "technique_common":for(d=0;d<c.childNodes.length;d++)if("accessor"==c.childNodes[d].nodeName){this.accessor=(new t).parse(c.childNodes[d]);break}}}return this};z.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),c=da(c);a.push(c)}break;default:console.log("ColladaLoader: Source: Read dont know how to read "+b.type+".")}return a};x.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");for(var b=0;b<a.childNodes.length;b++)if("instance_effect"==a.childNodes[b].nodeName){this.instance_effect=(new D).parse(a.childNodes[b]);break}return this};C.prototype.isColor=function(){return null==this.texture};C.prototype.isTexture=function(){return null!=this.texture};
-C.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "color":c=N(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"),this.texOpts={offsetU:0,offsetV:0,repeatU:1,repeatV:1,wrapU:1,wrapV:1},this.parseTexture(c)}}return this};C.prototype.parseTexture=function(a){if(!a.childNodes)return this;
-a.childNodes[1]&&"extra"===a.childNodes[1].nodeName&&(a=a.childNodes[1],a.childNodes[1]&&"technique"===a.childNodes[1].nodeName&&(a=a.childNodes[1]));for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "offsetU":case "offsetV":case "repeatU":case "repeatV":this.texOpts[c.nodeName]=parseFloat(c.textContent);break;case "wrapU":case "wrapV":this.texOpts[c.nodeName]=parseInt(c.textContent);break;default:this.texOpts[c.nodeName]=c.textContent}}return this};G.prototype.parse=
-function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[c.nodeName]=(new C).parse(c);break;case "shininess":case "reflectivity":case "transparency":var d;d=Q.evaluate(".//dae:float",c,L,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);for(var e=d.iterateNext(),f=[];e;)f.push(e),e=d.iterateNext();d=f;0<d.length&&(this[c.nodeName]=parseFloat(d[0].textContent))}}this.create();
-return this};G.prototype.create=function(){var a={},b=void 0!==this.transparency&&1>this.transparency,c;for(c in this)switch(c){case "ambient":case "emission":case "diffuse":case "specular":var d=this[c];if(d instanceof C)if(d.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid){var e=ea[this.effect.surface.init_from];if(e)e=THREE.ImageUtils.loadTexture(ma+e.init_from),e.wrapS=d.texOpts.wrapU?THREE.RepeatWrapping:THREE.ClampToEdgeWrapping,
-e.wrapT=d.texOpts.wrapV?THREE.RepeatWrapping:THREE.ClampToEdgeWrapping,e.offset.x=d.texOpts.offsetU,e.offset.y=d.texOpts.offsetV,e.repeat.x=d.texOpts.repeatU,e.repeat.y=d.texOpts.repeatV,a.map=e}}else"diffuse"==c?a.color=d.color.getHex():b||(a[c]=d.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=na;return this.material=new THREE.MeshLambertMaterial(a)};H.prototype.parse=function(a){for(var b=0;b<
-a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)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};J.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)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};I.prototype.create=function(){if(null==this.shader)return null};I.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(1==c.nodeType)switch(c.nodeName){case "profile_COMMON":this.parseTechnique(this.parseProfileCOMMON(c))}}return this};
-I.prototype.parseNewparam=function(a){for(var b=a.getAttribute("sid"),c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(1==d.nodeType)switch(d.nodeName){case "surface":this.surface=(new H(this)).parse(d);this.surface.sid=b;break;case "sampler2D":this.sampler=(new J(this)).parse(d);this.sampler.sid=b;break;case "extra":break;default:console.log(d.nodeName)}}};I.prototype.parseProfileCOMMON=function(a){for(var b,c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(1==d.nodeType)switch(d.nodeName){case "profile_COMMON":this.parseProfileCOMMON(d);
-break;case "technique":b=d;break;case "newparam":this.parseNewparam(d);break;case "extra":break;default:console.log(d.nodeName)}}return b};I.prototype.parseTechnique=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "constant":case "lambert":case "blinn":case "phong":this.shader=(new G(c.nodeName,this)).parse(c)}}};D.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");return this};y.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(1==c.nodeType)switch(c.nodeName){case "source":c=(new z).parse(c);this.source[c.id]=c;break;case "sampler":this.sampler.push((new E(this)).parse(c));break;case "channel":this.channel.push((new B(this)).parse(c))}}return this};B.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=0<=a.indexOf("."),d=0<=a.indexOf("(");if(c)b=a.split("."),this.sid=b.shift(),this.member=b.shift();else if(d){b=a.split("(");this.sid=b.shift();for(var e=0;e<b.length;e++)b[e]=parseInt(b[e].replace(/\)/,""));this.arrIndices=b}else this.sid=a;this.fullSid=a;this.dotSyntax=c;this.arrSyntax=d;return this};E.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(1==c.nodeType)switch(c.nodeName){case "input":this.inputs.push((new w).parse(c))}}return this};
-E.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();this.strideOut=c.accessor.stride;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}};E.prototype.getData=function(a,b){var c;if(1<this.strideOut){c=[];for(var b=b*this.strideOut,d=0;d<this.strideOut;++d)c[d]=this.output[b+d];if(3===this.strideOut)switch(a){case "rotate":case "translate":O(c,-1);break;case "scale":O(c,1)}}else c=this.output[b];return c};M.prototype.addTarget=function(a,b,c,d){this.targets.push({sid:a,
-member:c,transform:b,data:d})};M.prototype.apply=function(a){for(var b=0;b<this.targets.length;++b){var c=this.targets[b];(!a||c.sid===a)&&c.transform.update(c.data,c.member)}};M.prototype.getTarget=function(a){for(var b=0;b<this.targets.length;++b)if(this.targets[b].sid===a)return this.targets[b];return null};M.prototype.hasTarget=function(a){for(var b=0;b<this.targets.length;++b)if(this.targets[b].sid===a)return!0;return!1};M.prototype.interpolate=function(a,b){for(var c=0;c<this.targets.length;++c){var d=
-this.targets[c],e=a.getTarget(d.sid);if(e){var f=(b-this.time)/(a.time-this.time),g=e.data,h=d.data;if(0>f||1<f)console.log("Key.interpolate: Warning! Scale out of bounds:"+f),f=0>f?0:1;if(h.length)for(var e=[],i=0;i<h.length;++i)e[i]=h[i]+(g[i]-h[i])*f;else e=h+(g-h)*f}else e=d.data;d.transform.update(e,d.member)}};K.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "optics":this.parseOptics(c)}}return this};
-K.prototype.parseOptics=function(a){for(var b=0;b<a.childNodes.length;b++)if("technique_common"==a.childNodes[b].nodeName)for(var c=a.childNodes[b],d=0;d<c.childNodes.length;d++)if("perspective"==c.childNodes[d].nodeName)for(var e=c.childNodes[d],f=0;f<e.childNodes.length;f++){var g=e.childNodes[f];switch(g.nodeName){case "xfov":this.fov=g.textContent;break;case "znear":this.znear=0.4;break;case "zfar":this.zfar=1E15;break;case "aspect_ratio":this.aspect_ratio=g.textContent}}return this};F.prototype.parse=
-function(a){this.url=a.getAttribute("url").replace(/^#/,"");return this};return{load:function(b,c,d){var e=0;if(document.implementation&&document.implementation.createDocument){var f=new XMLHttpRequest;f.overrideMimeType&&f.overrideMimeType("text/xml");f.onreadystatechange=function(){if(4==f.readyState){if(0==f.status||200==f.status)f.responseXML?(la=c,a(f.responseXML,void 0,b)):console.error("ColladaLoader: Empty or non-existing file ("+b+")")}else 3==f.readyState&&d&&(0==e&&(e=f.getResponseHeader("Content-Length")),
-d({total:e,loaded:f.responseText.length}))};f.open("GET",b,!0);f.send(null)}else alert("Don't know how to parse XML!")},parse:a,setPreferredShading:function(a){na=a},applySkin:f,geometries:U,options:R}};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.BinaryLoader.prototype.supr=THREE.Loader.prototype;THREE.BinaryLoader.prototype.load=function(a,b,c,d){var c=c?c:this.extractUrlBase(a),d=d?d:this.extractUrlBase(a),e=this.showProgress?THREE.Loader.prototype.updateProgress:null;this.onLoadStart();this.loadAjaxJSON(this,a,b,c,d,e)};
+THREE.BinaryLoader.prototype.loadAjaxJSON=function(a,b,c,d,e,f){var g=new XMLHttpRequest;g.onreadystatechange=function(){if(4==g.readyState)if(200==g.status||0==g.status){var h=JSON.parse(g.responseText);a.loadAjaxBuffers(h,c,e,d,f)}else console.error("THREE.BinaryLoader: Couldn't load ["+b+"] ["+g.status+"]")};g.open("GET",b,!0);g.overrideMimeType&&g.overrideMimeType("text/plain; charset=x-user-defined");g.setRequestHeader("Content-Type","text/plain");g.send(null)};
+THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,b,c,d,e){var f=new XMLHttpRequest,g=c+"/"+a.buffers,h=0;f.onreadystatechange=function(){4==f.readyState?200==f.status||0==f.status?THREE.BinaryLoader.prototype.createBinModel(f.response,b,d,a.materials):console.error("THREE.BinaryLoader: Couldn't load ["+g+"] ["+f.status+"]"):3==f.readyState?e&&(0==h&&(h=f.getResponseHeader("Content-Length")),e({total:h,loaded:f.responseText.length})):2==f.readyState&&(h=f.getResponseHeader("Content-Length"))};
+f.open("GET",g,!0);f.responseType="arraybuffer";f.send(null)};
+THREE.BinaryLoader.prototype.createBinModel=function(a,b,c,d){var e=function(b){var c,e,i,j,k,o,l,m,q,n,p,r,t,s,u;function v(a){return a%4?4-a%4:0}function x(a,b){return(new Uint8Array(a,b,1))[0]}function z(a,b){return(new Uint32Array(a,b,1))[0]}function w(b,c){var d,f,e,g,h,i,j,k,l=new Uint32Array(a,c,3*b);for(d=0;d<b;d++){f=l[3*d];e=l[3*d+1];g=l[3*d+2];h=F[2*f];f=F[2*f+1];i=F[2*e];j=F[2*e+1];e=F[2*g];k=F[2*g+1];g=C.faceVertexUvs[0];var m=[];m.push(new THREE.UV(h,f));m.push(new THREE.UV(i,j));m.push(new THREE.UV(e,
+k));g.push(m)}}function D(b,c){var d,f,e,g,h,i,j,k,l,m,n=new Uint32Array(a,c,4*b);for(d=0;d<b;d++){f=n[4*d];e=n[4*d+1];g=n[4*d+2];h=n[4*d+3];i=F[2*f];f=F[2*f+1];j=F[2*e];l=F[2*e+1];k=F[2*g];m=F[2*g+1];g=F[2*h];e=F[2*h+1];h=C.faceVertexUvs[0];var o=[];o.push(new THREE.UV(i,f));o.push(new THREE.UV(j,l));o.push(new THREE.UV(k,m));o.push(new THREE.UV(g,e));h.push(o)}}function G(b,c,d){for(var f,e,g,h,c=new Uint32Array(a,c,3*b),i=new Uint16Array(a,d,b),d=0;d<b;d++)f=c[3*d],e=c[3*d+1],g=c[3*d+2],h=i[d],
+C.faces.push(new THREE.Face3(f,e,g,null,null,h))}function H(b,c,d){for(var f,e,g,h,i,c=new Uint32Array(a,c,4*b),j=new Uint16Array(a,d,b),d=0;d<b;d++)f=c[4*d],e=c[4*d+1],g=c[4*d+2],h=c[4*d+3],i=j[d],C.faces.push(new THREE.Face4(f,e,g,h,null,null,i))}function J(b,c,d,f){for(var e,g,h,i,j,k,l,c=new Uint32Array(a,c,3*b),d=new Uint32Array(a,d,3*b),m=new Uint16Array(a,f,b),f=0;f<b;f++){e=c[3*f];g=c[3*f+1];h=c[3*f+2];j=d[3*f];k=d[3*f+1];l=d[3*f+2];i=m[f];var n=A[3*k],o=A[3*k+1];k=A[3*k+2];var p=A[3*l],r=
+A[3*l+1];l=A[3*l+2];C.faces.push(new THREE.Face3(e,g,h,[new THREE.Vector3(A[3*j],A[3*j+1],A[3*j+2]),new THREE.Vector3(n,o,k),new THREE.Vector3(p,r,l)],null,i))}}function K(b,c,d,f){for(var e,g,h,i,j,k,l,m,n,c=new Uint32Array(a,c,4*b),d=new Uint32Array(a,d,4*b),o=new Uint16Array(a,f,b),f=0;f<b;f++){e=c[4*f];g=c[4*f+1];h=c[4*f+2];i=c[4*f+3];k=d[4*f];l=d[4*f+1];m=d[4*f+2];n=d[4*f+3];j=o[f];var p=A[3*l],r=A[3*l+1];l=A[3*l+2];var q=A[3*m],s=A[3*m+1];m=A[3*m+2];var u=A[3*n],t=A[3*n+1];n=A[3*n+2];C.faces.push(new THREE.Face4(e,
+g,h,i,[new THREE.Vector3(A[3*k],A[3*k+1],A[3*k+2]),new THREE.Vector3(p,r,l),new THREE.Vector3(q,s,m),new THREE.Vector3(u,t,n)],null,j))}}var C=this,y=0,A=[],F=[],L,I,E;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(C,d,b);(function(a,b,c){for(var a=new Uint8Array(a,b,c),d="",f=0;f<c;f++)d+=String.fromCharCode(a[b+f]);return d})(a,y,12);c=x(a,y+12);x(a,y+13);x(a,y+14);x(a,y+15);e=x(a,y+16);i=x(a,y+17);j=x(a,y+18);k=x(a,y+19);o=z(a,y+20);l=z(a,y+20+4);m=z(a,y+20+8);b=z(a,y+20+12);q=
+z(a,y+20+16);n=z(a,y+20+20);p=z(a,y+20+24);r=z(a,y+20+28);t=z(a,y+20+32);s=z(a,y+20+36);u=z(a,y+20+40);y+=c;c=3*e+k;E=4*e+k;L=b*c;I=q*(c+3*i);e=n*(c+3*j);k=p*(c+3*i+3*j);c=r*E;i=t*(E+4*i);j=s*(E+4*j);y+=function(b){var b=new Float32Array(a,b,3*o),c,d,f,e;for(c=0;c<o;c++)d=b[3*c],f=b[3*c+1],e=b[3*c+2],C.vertices.push(new THREE.Vertex(new THREE.Vector3(d,f,e)));return 3*o*Float32Array.BYTES_PER_ELEMENT}(y);y+=function(b){if(l){var b=new Int8Array(a,b,3*l),c,d,f,e;for(c=0;c<l;c++)d=b[3*c],f=b[3*c+1],
+e=b[3*c+2],A.push(d/127,f/127,e/127)}return 3*l*Int8Array.BYTES_PER_ELEMENT}(y);y+=v(3*l);y+=function(b){if(m){var b=new Float32Array(a,b,2*m),c,d,f;for(c=0;c<m;c++)d=b[2*c],f=b[2*c+1],F.push(d,f)}return 2*m*Float32Array.BYTES_PER_ELEMENT}(y);L=y+L+v(2*b);I=L+I+v(2*q);e=I+e+v(2*n);k=e+k+v(2*p);c=k+c+v(2*r);i=c+i+v(2*t);j=i+j+v(2*s);(function(a){if(n){var b=a+3*n*Uint32Array.BYTES_PER_ELEMENT;G(n,a,b+3*n*Uint32Array.BYTES_PER_ELEMENT);w(n,b)}})(I);(function(a){if(p){var b=a+3*p*Uint32Array.BYTES_PER_ELEMENT,
+c=b+3*p*Uint32Array.BYTES_PER_ELEMENT;J(p,a,b,c+3*p*Uint32Array.BYTES_PER_ELEMENT);w(p,c)}})(e);(function(a){if(s){var b=a+4*s*Uint32Array.BYTES_PER_ELEMENT;H(s,a,b+4*s*Uint32Array.BYTES_PER_ELEMENT);D(s,b)}})(i);(function(a){if(u){var b=a+4*u*Uint32Array.BYTES_PER_ELEMENT,c=b+4*u*Uint32Array.BYTES_PER_ELEMENT;K(u,a,b,c+4*u*Uint32Array.BYTES_PER_ELEMENT);D(u,c)}})(j);b&&G(b,y,y+3*b*Uint32Array.BYTES_PER_ELEMENT);(function(a){if(q){var b=a+3*q*Uint32Array.BYTES_PER_ELEMENT;J(q,a,b,b+3*q*Uint32Array.BYTES_PER_ELEMENT)}})(L);
+r&&H(r,k,k+4*r*Uint32Array.BYTES_PER_ELEMENT);(function(a){if(t){var b=a+4*t*Uint32Array.BYTES_PER_ELEMENT;K(t,a,b,b+4*t*Uint32Array.BYTES_PER_ELEMENT)}})(c);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};e.prototype=new THREE.Geometry;e.prototype.constructor=e;b(new e(c))};
+THREE.ColladaLoader=function(){function a(a,d,e){Q=a;d=d||ma;void 0!==e&&(a=e.split("/"),a.pop(),na=(1>a.length?".":a.join("/"))+"/");if((a=Q.evaluate("//dae:asset",Q,N,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&a.childNodes)for(e=0;e<a.childNodes.length;e++){var i=a.childNodes[e];switch(i.nodeName){case "unit":(i=i.getAttribute("meter"))&&parseFloat(i);break;case "up_axis":ba=i.textContent.charAt(0)}}if(!R.convertUpAxis||ba===R.upAxis)X=null;else switch(ba){case "X":X="Y"===R.upAxis?
+"XtoY":"XtoZ";break;case "Y":X="X"===R.upAxis?"YtoX":"YtoZ";break;case "Z":X="X"===R.upAxis?"ZtoX":"ZtoY"}aa=b("//dae:library_images/dae:image",g,"image");ga=b("//dae:library_materials/dae:material",D,"material");ha=b("//dae:library_effects/dae:effect",C,"effect");W=b("//dae:library_geometries/dae:geometry",p,"geometry");ia=b(".//dae:library_cameras/dae:camera",E,"camera");V=b("//dae:library_controllers/dae:controller",h,"controller");Y=b("//dae:library_animations/dae:animation",A,"animation");ja=
+b(".//dae:library_visual_scenes/dae:visual_scene",k,"visual_scene");ca=[];da=[];(a=Q.evaluate(".//dae:scene/dae:instance_visual_scene",Q,N,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(a=a.getAttribute("url").replace(/^#/,""),U=ja[0<a.length?a:"visual_scene0"]):U=null;$=new THREE.Object3D;for(a=0;a<U.nodes.length;a++)$.add(f(U.nodes[a]));ka=[];c($);a={scene:$,morphs:ca,skins:da,animations:ka,dae:{images:aa,materials:ga,cameras:ia,effects:ha,geometries:W,controllers:V,animations:Y,visualScenes:ja,
+scene:U}};d&&d(a);return a}function b(a,b,c){for(var a=Q.evaluate(a,Q,N,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null),d={},f=a.iterateNext(),e=0;f;){f=(new b).parse(f);if(!f.id||0==f.id.length)f.id=c+e++;d[f.id]=f;f=a.iterateNext()}return d}function c(a){var b=U.getChildById(a.name,!0),d=null;if(b&&b.keys){d={fps:60,hierarchy:[{node:b,keys:b.keys,sids:b.sids}],node:a,name:"animation_"+a.name,length:0};ka.push(d);for(var f=0,e=b.keys.length;f<e;f++)d.length=Math.max(d.length,b.keys[f].time)}else d=
+{hierarchy:[{keys:[],sids:[]}]};f=0;for(e=a.children.length;f<e;f++)for(var b=0,g=c(a.children[f]).hierarchy.length;b<g;b++)d.hierarchy.push({keys:[],sids:[]});return d}function d(a,b,c,f){a.world=a.world||new THREE.Matrix4;a.world.copy(a.matrix);if(a.channels&&a.channels.length){var e=a.channels[0].sampler.output[c];e instanceof THREE.Matrix4&&a.world.copy(e)}f&&a.world.multiply(f,a.world);b.push(a);for(f=0;f<a.nodes.length;f++)d(a.nodes[f],b,c,a.world)}function e(a,b,c){var f,e=V[b.url];if(!e||
+!e.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 c=1E6,g=-c,h=0;for(f in Y)for(var i=Y[f],j=0;j<i.sampler.length;j++){var k=i.sampler[j];k.create();c=Math.min(c,k.startTime);g=Math.max(g,k.endTime);h=Math.max(h,k.input.length)}f=h;for(var b=U.getChildById(b.skeleton[0],!0)||U.getChildBySid(b.skeleton[0],!0),l,m,g=new THREE.Vector3,n,j=0;j<a.vertices.length;j++)e.skin.bindShapeMatrix.multiplyVector3(a.vertices[j].position);
+for(c=0;c<f;c++){h=[];i=[];for(j=0;j<a.vertices.length;j++)i.push(new THREE.Vertex(new THREE.Vector3));d(b,h,c);j=h;k=e.skin;for(m=0;m<j.length;m++)if(l=j[m],n=-1,"JOINT"==l.type){for(var o=0;o<k.joints.length;o++)if(l.sid==k.joints[o]){n=o;break}if(0<=n){o=k.invBindMatrices[n];l.invBindMatrix=o;l.skinningMatrix=new THREE.Matrix4;l.skinningMatrix.multiply(l.world,o);l.weights=[];for(o=0;o<k.weights.length;o++)for(var p=0;p<k.weights[o].length;p++){var r=k.weights[o][p];r.joint==n&&l.weights.push(r)}}else throw"ColladaLoader: Could not find joint '"+
+l.sid+"'.";}for(j=0;j<h.length;j++)if("JOINT"==h[j].type)for(k=0;k<h[j].weights.length;k++)l=h[j].weights[k],m=l.index,l=l.weight,n=a.vertices[m],m=i[m],g.x=n.position.x,g.y=n.position.y,g.z=n.position.z,h[j].skinningMatrix.multiplyVector3(g),m.position.x+=g.x*l,m.position.y+=g.y*l,m.position.z+=g.z*l;a.morphTargets.push({name:"target_"+c,vertices:i})}}}function f(a){var b=new THREE.Object3D,c,d,g,h;for(g=0;g<a.controllers.length;g++){var i=V[a.controllers[g].url];switch(i.type){case "skin":if(W[i.skin.source]){var j=
+new n;j.url=i.skin.source;j.instance_material=a.controllers[g].instance_material;a.geometries.push(j);c=a.controllers[g]}else if(V[i.skin.source]&&(d=i=V[i.skin.source],i.morph&&W[i.morph.source]))j=new n,j.url=i.morph.source,j.instance_material=a.controllers[g].instance_material,a.geometries.push(j);break;case "morph":if(W[i.morph.source])j=new n,j.url=i.morph.source,j.instance_material=a.controllers[g].instance_material,a.geometries.push(j),d=a.controllers[g];console.log("ColladaLoader: Morph-controller partially supported.")}}for(g=
+0;g<a.geometries.length;g++){var i=a.geometries[g],j=i.instance_material,i=W[i.url],k={},l=[],o=0,p;if(i&&i.mesh&&i.mesh.primitives){if(0==b.name.length)b.name=i.id;if(j)for(h=0;h<j.length;h++){p=j[h];var r=ga[p.target],q=ha[r.instance_effect.url].shader;q.material.opacity=!q.material.opacity?1:q.material.opacity;k[p.symbol]=o;l.push(q.material);p=q.material;p.name=null==r.name||""===r.name?r.id:r.name;o++}j=p||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});i=i.mesh.geometry3js;
+if(1<o){j=new THREE.MeshFaceMaterial;i.materials=l;for(h=0;h<i.faces.length;h++)l=i.faces[h],l.materialIndex=k[l.daeMaterial]}if(void 0!==c)e(i,c),j.morphTargets=!0,j=new THREE.SkinnedMesh(i,j),j.skeleton=c.skeleton,j.skinController=V[c.url],j.skinInstanceController=c,j.name="skin_"+da.length,da.push(j);else if(void 0!==d){h=i;k=d instanceof m?V[d.url]:d;if(!k||!k.morph)console.log("could not find morph controller!");else{k=k.morph;for(l=0;l<k.targets.length;l++)if(o=W[k.targets[l]],o.mesh&&o.mesh.primitives&&
+o.mesh.primitives.length)o=o.mesh.primitives[0].geometry,o.vertices.length===h.vertices.length&&h.morphTargets.push({name:"target_1",vertices:o.vertices});h.morphTargets.push({name:"target_Z",vertices:h.vertices})}j.morphTargets=!0;j=new THREE.Mesh(i,j);j.name="morph_"+ca.length;ca.push(j)}else j=new THREE.Mesh(i,j);1<a.geometries.length?b.add(j):b=j}}for(g=0;g<a.cameras.length;g++)b=ia[a.cameras[g].url],b=new THREE.PerspectiveCamera(b.fov,b.aspect_ratio,b.znear,b.zfar);b.name=a.id||"";b.matrix=a.matrix;
+g=a.matrix.decompose();b.position=g[0];b.quaternion=g[1];b.useQuaternion=!0;b.scale=g[2];R.centerGeometry&&b.geometry&&(g=THREE.GeometryUtils.center(b.geometry),b.quaternion.multiplyVector3(g.multiplySelf(b.scale)),b.position.subSelf(g));for(g=0;g<a.nodes.length;g++)b.add(f(a.nodes[g],a));return b}function g(){this.init_from=this.id=""}function h(){this.type=this.name=this.id="";this.morph=this.skin=null}function i(){this.weights=this.targets=this.source=this.method=null}function j(){this.source=
+"";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function k(){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 l(){this.type=this.sid="";this.data=[];this.obj=null}function m(){this.url="";this.skeleton=[];this.instance_material=[]}function q(){this.target=this.symbol=""}function n(){this.url=
+"";this.instance_material=[]}function p(){this.id="";this.mesh=null}function r(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function t(){this.material="";this.count=0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function s(){t.call(this);this.vcount=[]}function u(){t.call(this);this.vcount=3}function v(){this.source="";this.stride=this.count=0;this.params=[]}function x(){this.input={}}function z(){this.semantic="";this.offset=0;this.source=
+"";this.set=0}function w(a){this.id=a;this.type=null}function D(){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.texOpts=this.texcoord=this.texture=null}function H(a,b){this.type=a;this.effect=b;this.material=null}function J(a){this.effect=a;this.format=this.init_from=null}function K(a){this.effect=a;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=this.source=
+null}function C(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function y(){this.url=""}function A(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function F(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=this.dotSyntax=this.sid=this.fullSid=null}function L(a){this.id="";this.animation=a;this.inputs=[];this.endTime=this.startTime=this.interpolation=this.strideOut=this.output=this.input=null;this.duration=0}function I(a){this.targets=
+[];this.time=a}function E(){this.technique=this.name=this.id=""}function M(){this.url=""}function N(a){return"dae"==a?"http://www.collada.org/2005/11/COLLADASchema":null}function B(a){for(var a=P(a),b=[],c=0,d=a.length;c<d;c++)b.push(parseFloat(a[c]));return b}function T(a){for(var a=P(a),b=[],c=0,d=a.length;c<d;c++)b.push(parseInt(a[c],10));return b}function P(a){return 0<a.length?a.replace(/^\s+/,"").replace(/\s+$/,"").split(/\s+/):[]}function S(a,b,c){return a.hasAttribute(b)?parseInt(a.getAttribute(b),
+10):c}function O(a,b){if(R.convertUpAxis&&ba!==R.upAxis)switch(X){case "XtoY":var c=a[0];a[0]=b*a[1];a[1]=c;break;case "XtoZ":c=a[2];a[2]=a[1];a[1]=a[0];a[0]=c;break;case "YtoX":c=a[0];a[0]=a[1];a[1]=b*c;break;case "YtoZ":c=a[1];a[1]=b*a[2];a[2]=c;break;case "ZtoX":c=a[0];a[0]=a[1];a[1]=a[2];a[2]=c;break;case "ZtoY":c=a[1],a[1]=a[2],a[2]=b*c}}function ea(a,b){var c=[a[b],a[b+1],a[b+2]];O(c,-1);return new THREE.Vector3(c[0],c[1],c[2])}function fa(a){if(R.convertUpAxis){var b=[a[0],a[4],a[8]];O(b,-1);
+a[0]=b[0];a[4]=b[1];a[8]=b[2];b=[a[1],a[5],a[9]];O(b,-1);a[1]=b[0];a[5]=b[1];a[9]=b[2];b=[a[2],a[6],a[10]];O(b,-1);a[2]=b[0];a[6]=b[1];a[10]=b[2];b=[a[0],a[1],a[2]];O(b,-1);a[0]=b[0];a[1]=b[1];a[2]=b[2];b=[a[4],a[5],a[6]];O(b,-1);a[4]=b[0];a[5]=b[1];a[6]=b[2];b=[a[8],a[9],a[10]];O(b,-1);a[8]=b[0];a[9]=b[1];a[10]=b[2];b=[a[3],a[7],a[11]];O(b,-1);a[3]=b[0];a[7]=b[1];a[11]=b[2]}return new THREE.Matrix4(a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8],a[9],a[10],a[11],a[12],a[13],a[14],a[15])}var Q=null,
+$=null,U,ma=null,Z={},aa={},Y={},V={},W={},ga={},ha={},ia={},ka,ja,na,ca,da,oa=THREE.SmoothShading,R={centerGeometry:!1,convertUpAxis:!1,subdivideFaces:!0,upAxis:"Y"},ba="Y",X=null,la=Math.PI/180;g.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if("init_from"==c.nodeName)this.init_from=c.textContent}return this};h.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 j).parse(c);this.type=c.nodeName;break;case "morph":this.morph=(new i).parse(c),this.type=c.nodeName}}return this};i.prototype.parse=function(a){var b={},c=[],d;this.method=a.getAttribute("method");this.source=a.getAttribute("source").replace(/^#/,"");for(d=0;d<a.childNodes.length;d++){var f=a.childNodes[d];if(1==f.nodeType)switch(f.nodeName){case "source":f=(new w).parse(f);b[f.id]=f;break;case "targets":c=
+this.parseInputs(f);break;default:console.log(f.nodeName)}}for(d=0;d<c.length;d++)switch(a=c[d],f=b[a.source],a.semantic){case "MORPH_TARGET":this.targets=f.read();break;case "MORPH_WEIGHT":this.weights=f.read()}return this};i.prototype.parseInputs=function(a){for(var b=[],c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(1==d.nodeType)switch(d.nodeName){case "input":b.push((new z).parse(d))}}return b};j.prototype.parse=function(a){var b={},c,d;this.source=a.getAttribute("source").replace(/^#/,
+"");this.invBindMatrices=[];this.joints=[];this.weights=[];for(var f=0;f<a.childNodes.length;f++){var e=a.childNodes[f];if(1==e.nodeType)switch(e.nodeName){case "bind_shape_matrix":e=B(e.textContent);this.bindShapeMatrix=fa(e);break;case "source":e=(new w).parse(e);b[e.id]=e;break;case "joints":c=e;break;case "vertex_weights":d=e;break;default:console.log(e.nodeName)}}this.parseJoints(c,b);this.parseWeights(d,b);return this};j.prototype.parseJoints=function(a,b){for(var c=0;c<a.childNodes.length;c++){var d=
+a.childNodes[c];if(1==d.nodeType)switch(d.nodeName){case "input":var d=(new z).parse(d),f=b[d.source];if("JOINT"==d.semantic)this.joints=f.read();else if("INV_BIND_MATRIX"==d.semantic)this.invBindMatrices=f.read()}}};j.prototype.parseWeights=function(a,b){for(var c,d,f=[],e=0;e<a.childNodes.length;e++){var g=a.childNodes[e];if(1==g.nodeType)switch(g.nodeName){case "input":f.push((new z).parse(g));break;case "v":c=T(g.textContent);break;case "vcount":d=T(g.textContent)}}for(e=g=0;e<d.length;e++){for(var h=
+d[e],i=[],j=0;j<h;j++){for(var k={},l=0;l<f.length;l++){var m=f[l],n=c[g+m.offset];switch(m.semantic){case "JOINT":k.joint=n;break;case "WEIGHT":k.weight=b[m.source].data[n]}}i.push(k);g+=f.length}for(j=0;j<i.length;j++)i[j].index=e;this.weights.push(i)}};k.prototype.getChildById=function(a,b){for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildById(a,b);if(d)return d}return null};k.prototype.getChildBySid=function(a,b){for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildBySid(a,
+b);if(d)return d}return null};k.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(1==c.nodeType)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],d=c.target.split("/");d.shift();var f=d.shift(),e=0<=f.indexOf("."),g=0<=f.indexOf("("),h;if(e)d=f.split("."),
+f=d.shift(),d.shift();else if(g){h=f.split("(");f=h.shift();for(d=0;d<h.length;d++)h[d]=parseInt(h[d].replace(/\)/,""))}if(f==a)return c.info={sid:f,dotSyntax:e,arrSyntax:g,arrIndices:h},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 d=this.nodes[c].getChildById(a,b);if(d)return d}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 d=this.nodes[c].getChildBySid(a,
+b);if(d)return d}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="JOINT"==this.type?this.type:"NODE";this.nodes=[];this.transforms=[];this.geometries=[];this.cameras=[];this.controllers=[];this.matrix=new THREE.Matrix4;
+for(var c=0;c<a.childNodes.length;c++)if(b=a.childNodes[c],1==b.nodeType)switch(b.nodeName){case "node":this.nodes.push((new o).parse(b));break;case "instance_camera":this.cameras.push((new M).parse(b));break;case "instance_controller":this.controllers.push((new m).parse(b));break;case "instance_geometry":this.geometries.push((new n).parse(b));break;case "instance_light":break;case "instance_node":b=b.getAttribute("url").replace(/^#/,"");(b=Q.evaluate(".//dae:library_nodes//dae:node[@id='"+b+"']",
+Q,N,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 l).parse(b));break;case "extra":break;default:console.log(b.nodeName)}a=[];c=1E6;b=-1E6;for(var d in Y)for(var f=Y[d],e=0;e<f.channel.length;e++){var g=f.channel[e],h=f.sampler[e];d=g.target.split("/")[0];if(d==this.id)h.create(),g.sampler=h,c=Math.min(c,h.startTime),b=Math.max(b,h.endTime),
+a.push(g)}if(a.length)this.startTime=c,this.endTime=b;if((this.channels=a)&&this.channels.length){d=[];a=[];c=0;for(f=this.channels.length;c<f;c++){b=this.channels[c];e=b.fullSid;g=b.member;if(R.convertUpAxis)switch(g){case "X":switch(X){case "XtoY":case "XtoZ":case "YtoX":g="Y";break;case "ZtoX":g="Z"}break;case "Y":switch(X){case "XtoY":case "YtoX":case "ZtoX":g="X";break;case "XtoZ":case "YtoZ":case "ZtoY":g="Z"}break;case "Z":switch(X){case "XtoZ":g="X";break;case "YtoZ":case "ZtoX":case "ZtoY":g=
+"Y"}}var h=b.sampler,i=h.input,j=this.getTransformBySid(b.sid);if(j){-1===a.indexOf(e)&&a.push(e);b=0;for(var k=i.length;b<k;b++){var p=i[b],r=h.getData(j.type,b),q;q=null;for(var s=0,u=d.length;s<u&&null==q;s++){var t=d[s];if(t.time===p)q=t;else if(t.time>p)break}if(!q){q=new I(p);s=-1;u=0;for(t=d.length;u<t&&-1==s;u++)d[u].time>=p&&(s=u);p=s;d.splice(-1==p?d.length:p,0,q)}q.addTarget(e,j,g,r)}}else console.log('Could not find transform "'+b.sid+'" in node '+this.id)}for(c=0;c<a.length;c++){f=a[c];
+for(b=0;b<d.length;b++)if(q=d[b],!q.hasTarget(f)){h=d;e=q;j=b;g=f;i=void 0;a:{i=j?j-1:0;for(i=0<=i?i:i+h.length;0<=i;i--)if(k=h[i],k.hasTarget(g)){i=k;break a}i=null}k=void 0;a:{for(j+=1;j<h.length;j++)if(k=h[j],k.hasTarget(g))break a;k=null}if(i&&k){h=(e.time-i.time)/(k.time-i.time);i=i.getTarget(g);j=k.getTarget(g).data;k=i.data;r=void 0;if(k.length){r=[];for(p=0;p<k.length;++p)r[p]=k[p]+(j[p]-k[p])*h}else r=k+(j-k)*h;e.addTarget(g,i.transform,i.member,r)}}}this.keys=d;this.sids=a}this.updateMatrix();
+return this};o.prototype.updateMatrix=function(){this.matrix.identity();for(var a=0;a<this.transforms.length;a++)this.transforms[a].apply(this.matrix)};l.prototype.parse=function(a){this.sid=a.getAttribute("sid");this.type=a.nodeName;this.data=B(a.textContent);this.convert();return this};l.prototype.convert=function(){switch(this.type){case "matrix":this.obj=fa(this.data);break;case "rotate":this.angle=this.data[3]*la;case "translate":O(this.data,-1);this.obj=new THREE.Vector3(this.data[0],this.data[1],
+this.data[2]);break;case "scale":O(this.data,1);this.obj=new THREE.Vector3(this.data[0],this.data[1],this.data[2]);break;default:console.log("Can not convert Transform of type "+this.type)}};l.prototype.apply=function(a){switch(this.type){case "matrix":a.multiplySelf(this.obj);break;case "translate":a.translate(this.obj);break;case "rotate":a.rotateByAxis(this.obj,this.angle);break;case "scale":a.scale(this.obj)}};l.prototype.update=function(a,b){switch(this.type){case "matrix":console.log("Currently not handling matrix transform updates");
+break;case "translate":case "scale":switch(b){case "X":this.obj.x=a;break;case "Y":this.obj.y=a;break;case "Z":this.obj.z=a;break;default:this.obj.x=a[0],this.obj.y=a[1],this.obj.z=a[2]}break;case "rotate":switch(b){case "X":this.obj.x=a;break;case "Y":this.obj.y=a;break;case "Z":this.obj.z=a;break;case "ANGLE":this.angle=a*la;break;default:this.obj.x=a[0],this.obj.y=a[1],this.obj.z=a[2],this.angle=a[3]*la}}};m.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(1==c.nodeType)switch(c.nodeName){case "skeleton":this.skeleton.push(c.textContent.replace(/^#/,""));break;case "bind_material":if(c=Q.evaluate(".//dae:instance_material",c,N,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(var d=c.iterateNext();d;)this.instance_material.push((new q).parse(d)),d=c.iterateNext()}}return this};q.prototype.parse=function(a){this.symbol=a.getAttribute("symbol");this.target=a.getAttribute("target").replace(/^#/,
+"");return this};n.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(1==c.nodeType&&"bind_material"==c.nodeName){if(a=Q.evaluate(".//dae:instance_material",c,N,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(b=a.iterateNext();b;)this.instance_material.push((new q).parse(b)),b=a.iterateNext();break}}return this};p.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 r(this)).parse(c)}}return this};r.prototype.parse=function(a){this.primitives=[];var b;for(b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "source":var d=c.getAttribute("id");void 0==Z[d]&&(Z[d]=(new w(d)).parse(c));break;case "vertices":this.vertices=(new x).parse(c);break;case "triangles":this.primitives.push((new u).parse(c));break;case "polygons":this.primitives.push((new t).parse(c));
+break;case "polylist":this.primitives.push((new s).parse(c))}}this.geometry3js=new THREE.Geometry;a=Z[this.vertices.input.POSITION.source].data;for(b=0;b<a.length;b+=3)this.geometry3js.vertices.push(new THREE.Vertex(ea(a,b)));for(b=0;b<this.primitives.length;b++)a=this.primitives[b],a.setVertices(this.vertices),this.handlePrimitive(a,this.geometry3js);this.geometry3js.computeCentroids();this.geometry3js.computeFaceNormals();this.geometry3js.calcNormals&&(this.geometry3js.computeVertexNormals(),delete this.geometry3js.calcNormals);
+this.geometry3js.computeBoundingBox();return this};r.prototype.handlePrimitive=function(a,b){var c,d,f=a.p,e=a.inputs,g,h,i,j,k=0,l=3,m=0,n=[];for(c=0;c<e.length;c++)switch(g=e[c],l=g.offset+1,m=m<l?l:m,g.semantic){case "TEXCOORD":n.push(g.set)}for(var o=0;o<f.length;++o)for(var p=f[o],r=0;r<p.length;){var q=[],s=[],u={},t=[],l=a.vcount?a.vcount.length?a.vcount[k++]:a.vcount:p.length/m;for(c=0;c<l;c++)for(d=0;d<e.length;d++)switch(g=e[d],j=Z[g.source],h=p[r+c*m+g.offset],i=j.accessor.params.length,
+i*=h,g.semantic){case "VERTEX":q.push(h);break;case "NORMAL":s.push(ea(j.data,i));break;case "TEXCOORD":void 0===u[g.set]&&(u[g.set]=[]);u[g.set].push(new THREE.UV(j.data[i],1-j.data[i+1]));break;case "COLOR":t.push((new THREE.Color).setRGB(j.data[i],j.data[i+1],j.data[i+2]))}d=null;c=[];if(0==s.length)if(g=this.vertices.input.NORMAL){j=Z[g.source];i=j.accessor.params.length;g=0;for(h=q.length;g<h;g++)s.push(ea(j.data,q[g]*i))}else b.calcNormals=!0;if(3===l)c.push(new THREE.Face3(q[0],q[1],q[2],s,
+t.length?t:new THREE.Color));else if(4===l)c.push(new THREE.Face4(q[0],q[1],q[2],q[3],s,t.length?t:new THREE.Color));else if(4<l&&R.subdivideFaces){t=t.length?t:new THREE.Color;for(d=1;d<l-1;)c.push(new THREE.Face3(q[0],q[d],q[d+1],[s[0],s[d++],s[d]],t))}if(c.length){g=0;for(h=c.length;g<h;g++){d=c[g];d.daeMaterial=a.material;b.faces.push(d);for(d=0;d<n.length;d++)q=u[n[d]],q=4<l?[q[0],q[g+1],q[g+2]]:4===l?[q[0],q[1],q[2],q[3]]:[q[0],q[1],q[2]],b.faceVertexUvs[d]||(b.faceVertexUvs[d]=[]),b.faceVertexUvs[d].push(q)}}else console.log("dropped face with vcount "+
+l+" for geometry with id: "+b.id);r+=m*l}};t.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};t.prototype.parse=function(a){this.material=a.getAttribute("material");this.count=S(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 z).parse(a.childNodes[b]));break;case "vcount":this.vcount=T(c.textContent);break;case "p":this.p.push(T(c.textContent));
+break;case "ph":console.warn("polygon holes not yet supported!")}}return this};s.prototype=new t;s.prototype.constructor=s;u.prototype=new t;u.prototype.constructor=u;v.prototype.parse=function(a){this.params=[];this.source=a.getAttribute("source");this.count=S(a,"count",0);this.stride=S(a,"stride",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if("param"==c.nodeName){var d={};d.name=c.getAttribute("name");d.type=c.getAttribute("type");this.params.push(d)}}return this};x.prototype.parse=
+function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++)if("input"==a.childNodes[b].nodeName){var c=(new z).parse(a.childNodes[b]);this.input[c.semantic]=c}return this};z.prototype.parse=function(a){this.semantic=a.getAttribute("semantic");this.source=a.getAttribute("source").replace(/^#/,"");this.set=S(a,"set",-1);this.offset=S(a,"offset",0);if("TEXCOORD"==this.semantic&&0>this.set)this.set=0;return this};w.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 d=P(c.textContent),f=[],e=0,g=d.length;e<g;e++)f.push("true"==d[e]||"1"==d[e]?!0:!1);this.data=f;this.type=c.nodeName;break;case "float_array":this.data=B(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=P(c.textContent);this.type=c.nodeName;break;case "technique_common":for(d=0;d<c.childNodes.length;d++)if("accessor"==
+c.childNodes[d].nodeName){this.accessor=(new v).parse(c.childNodes[d]);break}}}return this};w.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),c=fa(c);a.push(c)}break;default:console.log("ColladaLoader: Source: Read dont know how to read "+b.type+".")}return a};D.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=
+a.getAttribute("name");for(var b=0;b<a.childNodes.length;b++)if("instance_effect"==a.childNodes[b].nodeName){this.instance_effect=(new y).parse(a.childNodes[b]);break}return this};G.prototype.isColor=function(){return null==this.texture};G.prototype.isTexture=function(){return null!=this.texture};G.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "color":c=B(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"),this.texOpts={offsetU:0,offsetV:0,repeatU:1,repeatV:1,wrapU:1,wrapV:1},this.parseTexture(c)}}return this};G.prototype.parseTexture=function(a){if(!a.childNodes)return this;a.childNodes[1]&&"extra"===a.childNodes[1].nodeName&&(a=a.childNodes[1],a.childNodes[1]&&"technique"===a.childNodes[1].nodeName&&(a=a.childNodes[1]));for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];
+switch(c.nodeName){case "offsetU":case "offsetV":case "repeatU":case "repeatV":this.texOpts[c.nodeName]=parseFloat(c.textContent);break;case "wrapU":case "wrapV":this.texOpts[c.nodeName]=parseInt(c.textContent);break;default:this.texOpts[c.nodeName]=c.textContent}}return this};H.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)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 d;d=Q.evaluate(".//dae:float",c,N,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);for(var f=d.iterateNext(),e=[];f;)e.push(f),f=d.iterateNext();d=e;0<d.length&&(this[c.nodeName]=parseFloat(d[0].textContent))}}this.create();return this};H.prototype.create=function(){var a={},b=void 0!==this.transparency&&1>this.transparency,c;for(c in this)switch(c){case "ambient":case "emission":case "diffuse":case "specular":var d=this[c];
+if(d instanceof G)if(d.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid){var f=aa[this.effect.surface.init_from];if(f)f=THREE.ImageUtils.loadTexture(na+f.init_from),f.wrapS=d.texOpts.wrapU?THREE.RepeatWrapping:THREE.ClampToEdgeWrapping,f.wrapT=d.texOpts.wrapV?THREE.RepeatWrapping:THREE.ClampToEdgeWrapping,f.offset.x=d.texOpts.offsetU,f.offset.y=d.texOpts.offsetV,f.repeat.x=d.texOpts.repeatU,f.repeat.y=d.texOpts.repeatV,a.map=f}}else if("diffuse"==
+c||!b)a[c]=d.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=oa;switch(this.type){case "constant":a.color=a.emission;this.material=new THREE.MeshBasicMaterial(a);break;case "phong":case "blinn":a.color=a.diffuse;this.material=new THREE.MeshPhongMaterial(a);break;default:a.color=a.diffuse,this.material=new THREE.MeshLambertMaterial(a)}return this.material};J.prototype.parse=function(a){for(var b=
+0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)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};K.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)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};C.prototype.create=function(){if(null==this.shader)return null};C.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(1==c.nodeType)switch(c.nodeName){case "profile_COMMON":this.parseTechnique(this.parseProfileCOMMON(c))}}return this};
+C.prototype.parseNewparam=function(a){for(var b=a.getAttribute("sid"),c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(1==d.nodeType)switch(d.nodeName){case "surface":this.surface=(new J(this)).parse(d);this.surface.sid=b;break;case "sampler2D":this.sampler=(new K(this)).parse(d);this.sampler.sid=b;break;case "extra":break;default:console.log(d.nodeName)}}};C.prototype.parseProfileCOMMON=function(a){for(var b,c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(1==d.nodeType)switch(d.nodeName){case "profile_COMMON":this.parseProfileCOMMON(d);
+break;case "technique":b=d;break;case "newparam":this.parseNewparam(d);break;case "image":d=(new g).parse(d);aa[d.id]=d;break;case "extra":break;default:console.log(d.nodeName)}}return b};C.prototype.parseTechnique=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "constant":case "lambert":case "blinn":case "phong":this.shader=(new H(c.nodeName,this)).parse(c)}}};y.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,
+"");return this};A.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(1==c.nodeType)switch(c.nodeName){case "source":c=(new w).parse(c);this.source[c.id]=c;break;case "sampler":this.sampler.push((new L(this)).parse(c));break;case "channel":this.channel.push((new F(this)).parse(c))}}return this};F.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=0<=a.indexOf("."),d=0<=a.indexOf("(");if(c)b=a.split("."),this.sid=b.shift(),this.member=b.shift();else if(d){b=a.split("(");this.sid=b.shift();for(var f=0;f<b.length;f++)b[f]=parseInt(b[f].replace(/\)/,""));this.arrIndices=b}else this.sid=a;this.fullSid=a;this.dotSyntax=c;this.arrSyntax=d;return this};L.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(1==c.nodeType)switch(c.nodeName){case "input":this.inputs.push((new z).parse(c))}}return this};L.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();this.strideOut=c.accessor.stride;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}};L.prototype.getData=function(a,b){var c;if(1<this.strideOut){c=[];for(var b=b*this.strideOut,d=0;d<this.strideOut;++d)c[d]=this.output[b+d];if(3===this.strideOut)switch(a){case "rotate":case "translate":O(c,-1);break;case "scale":O(c,
+1)}}else c=this.output[b];return c};I.prototype.addTarget=function(a,b,c,d){this.targets.push({sid:a,member:c,transform:b,data:d})};I.prototype.apply=function(a){for(var b=0;b<this.targets.length;++b){var c=this.targets[b];(!a||c.sid===a)&&c.transform.update(c.data,c.member)}};I.prototype.getTarget=function(a){for(var b=0;b<this.targets.length;++b)if(this.targets[b].sid===a)return this.targets[b];return null};I.prototype.hasTarget=function(a){for(var b=0;b<this.targets.length;++b)if(this.targets[b].sid===
+a)return!0;return!1};I.prototype.interpolate=function(a,b){for(var c=0;c<this.targets.length;++c){var d=this.targets[c],f=a.getTarget(d.sid);if(f){var e=(b-this.time)/(a.time-this.time),g=f.data,h=d.data;if(0>e||1<e)console.log("Key.interpolate: Warning! Scale out of bounds:"+e),e=0>e?0:1;if(h.length)for(var f=[],i=0;i<h.length;++i)f[i]=h[i]+(g[i]-h[i])*e;else f=h+(g-h)*e}else f=d.data;d.transform.update(f,d.member)}};E.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");
+for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "optics":this.parseOptics(c)}}return this};E.prototype.parseOptics=function(a){for(var b=0;b<a.childNodes.length;b++)if("technique_common"==a.childNodes[b].nodeName)for(var c=a.childNodes[b],d=0;d<c.childNodes.length;d++)if(this.technique=c.childNodes[d].nodeName,"perspective"==this.technique)for(var f=c.childNodes[d],e=0;e<f.childNodes.length;e++){var g=f.childNodes[e];switch(g.nodeName){case "yfov":this.yfov=
+g.textContent;break;case "xfov":this.xfov=g.textContent;break;case "znear":this.znear=g.textContent;break;case "zfar":this.zfar=g.textContent;break;case "aspect_ratio":this.aspect_ratio=g.textContent}}else if("orthographic"==this.technique){f=c.childNodes[d];for(e=0;e<f.childNodes.length;e++)switch(g=f.childNodes[e],g.nodeName){case "xmag":this.xmag=g.textContent;break;case "ymag":this.ymag=g.textContent;break;case "znear":this.znear=g.textContent;break;case "zfar":this.zfar=g.textContent;break;case "aspect_ratio":this.aspect_ratio=
+g.textContent}}return this};M.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");return this};return{load:function(b,c,d){var f=0;if(document.implementation&&document.implementation.createDocument){var e=new XMLHttpRequest;e.overrideMimeType&&e.overrideMimeType("text/xml");e.onreadystatechange=function(){if(4==e.readyState){if(0==e.status||200==e.status)e.responseXML?(ma=c,a(e.responseXML,void 0,b)):console.error("ColladaLoader: Empty or non-existing file ("+b+")")}else 3==
+e.readyState&&d&&(0==f&&(f=e.getResponseHeader("Content-Length")),d({total:f,loaded:e.responseText.length}))};e.open("GET",b,!0);e.send(null)}else alert("Don't know how to parse XML!")},parse:a,setPreferredShading:function(a){oa=a},applySkin:e,geometries:W,options:R}};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){c=c?c:this.extractUrlBase(a);this.onLoadStart();this.loadAjaxJSON(this,a,b,c)};
-THREE.JSONLoader.prototype.loadAjaxJSON=function(a,b,c,d,f){var e=new XMLHttpRequest,g=0;e.onreadystatechange=function(){if(e.readyState===e.DONE)if(200===e.status||0===e.status){if(e.responseText){var h=JSON.parse(e.responseText);a.createModel(h,c,d)}else console.warn("THREE.JSONLoader: ["+b+"] seems to be unreachable or file there is empty");a.onLoadComplete()}else console.error("THREE.JSONLoader: Couldn't load ["+b+"] ["+e.status+"]");else e.readyState===e.LOADING?f&&(0===g&&(g=e.getResponseHeader("Content-Length")),
-f({total:g,loaded:e.responseText.length})):e.readyState===e.HEADERS_RECEIVED&&(g=e.getResponseHeader("Content-Length"))};e.open("GET",b,!0);e.overrideMimeType&&e.overrideMimeType("text/plain; charset=x-user-defined");e.setRequestHeader("Content-Type","text/plain");e.send(null)};
-THREE.JSONLoader.prototype.createModel=function(a,b,c){var d=new THREE.Geometry,f=void 0!==a.scale?1/a.scale:1;this.initMaterials(d,a.materials,c);(function(b){var c,f,i,j,k,p,l,m,r,n,o,q,u,s,t=a.faces;p=a.vertices;var v=a.normals,w=a.colors,z=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&z++;for(c=0;c<z;c++)d.faceUvs[c]=[],d.faceVertexUvs[c]=[];j=0;for(k=p.length;j<k;)l=new THREE.Vertex,l.position.x=p[j++]*b,l.position.y=p[j++]*b,l.position.z=p[j++]*b,d.vertices.push(l);j=0;for(k=t.length;j<k;){b=
-t[j++];p=b&1;i=b&2;c=b&4;f=b&8;m=b&16;l=b&32;n=b&64;b&=128;p?(o=new THREE.Face4,o.a=t[j++],o.b=t[j++],o.c=t[j++],o.d=t[j++],p=4):(o=new THREE.Face3,o.a=t[j++],o.b=t[j++],o.c=t[j++],p=3);if(i)i=t[j++],o.materialIndex=i;i=d.faces.length;if(c)for(c=0;c<z;c++)q=a.uvs[c],r=t[j++],s=q[2*r],r=q[2*r+1],d.faceUvs[c][i]=new THREE.UV(s,r);if(f)for(c=0;c<z;c++){q=a.uvs[c];u=[];for(f=0;f<p;f++)r=t[j++],s=q[2*r],r=q[2*r+1],u[f]=new THREE.UV(s,r);d.faceVertexUvs[c][i]=u}if(m)m=3*t[j++],f=new THREE.Vector3,f.x=v[m++],
-f.y=v[m++],f.z=v[m],o.normal=f;if(l)for(c=0;c<p;c++)m=3*t[j++],f=new THREE.Vector3,f.x=v[m++],f.y=v[m++],f.z=v[m],o.vertexNormals.push(f);if(n)l=t[j++],l=new THREE.Color(w[l]),o.color=l;if(b)for(c=0;c<p;c++)l=t[j++],l=new THREE.Color(w[l]),o.vertexColors.push(l);d.faces.push(o)}})(f);(function(){var b,c,f,i;if(a.skinWeights)for(b=0,c=a.skinWeights.length;b<c;b+=2)f=a.skinWeights[b],i=a.skinWeights[b+1],d.skinWeights.push(new THREE.Vector4(f,i,0,0));if(a.skinIndices)for(b=0,c=a.skinIndices.length;b<
-c;b+=2)f=a.skinIndices[b],i=a.skinIndices[b+1],d.skinIndices.push(new THREE.Vector4(f,i,0,0));d.bones=a.bones;d.animation=a.animation})();(function(b){if(void 0!==a.morphTargets){var c,f,i,j,k,p,l,m,r;for(c=0,f=a.morphTargets.length;c<f;c++){d.morphTargets[c]={};d.morphTargets[c].name=a.morphTargets[c].name;d.morphTargets[c].vertices=[];m=d.morphTargets[c].vertices;r=a.morphTargets[c].vertices;for(i=0,j=r.length;i<j;i+=3)k=r[i]*b,p=r[i+1]*b,l=r[i+2]*b,m.push(new THREE.Vertex(new THREE.Vector3(k,p,
-l)))}}if(void 0!==a.morphColors)for(c=0,f=a.morphColors.length;c<f;c++){d.morphColors[c]={};d.morphColors[c].name=a.morphColors[c].name;d.morphColors[c].colors=[];j=d.morphColors[c].colors;k=a.morphColors[c].colors;for(b=0,i=k.length;b<i;b+=3)p=new THREE.Color(16755200),p.setRGB(k[b],k[b+1],k[b+2]),j.push(p)}})(f);d.computeCentroids();d.computeFaceNormals();this.hasNormals(d)&&d.computeTangents();b(d)};
+THREE.JSONLoader.prototype.loadAjaxJSON=function(a,b,c,d,e){var f=new XMLHttpRequest,g=0;f.onreadystatechange=function(){if(f.readyState===f.DONE)if(200===f.status||0===f.status){if(f.responseText){var h=JSON.parse(f.responseText);a.createModel(h,c,d)}else console.warn("THREE.JSONLoader: ["+b+"] seems to be unreachable or file there is empty");a.onLoadComplete()}else console.error("THREE.JSONLoader: Couldn't load ["+b+"] ["+f.status+"]");else f.readyState===f.LOADING?e&&(0===g&&(g=f.getResponseHeader("Content-Length")),
+e({total:g,loaded:f.responseText.length})):f.readyState===f.HEADERS_RECEIVED&&(g=f.getResponseHeader("Content-Length"))};f.open("GET",b,!0);f.overrideMimeType&&f.overrideMimeType("text/plain; charset=x-user-defined");f.setRequestHeader("Content-Type","text/plain");f.send(null)};
+THREE.JSONLoader.prototype.createModel=function(a,b,c){var d=new THREE.Geometry,e=void 0!==a.scale?1/a.scale:1;this.initMaterials(d,a.materials,c);(function(b){var c,e,i,j,k,o,l,m,q,n,p,r,t,s,u=a.faces;o=a.vertices;var v=a.normals,x=a.colors,z=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&z++;for(c=0;c<z;c++)d.faceUvs[c]=[],d.faceVertexUvs[c]=[];j=0;for(k=o.length;j<k;)l=new THREE.Vertex,l.position.x=o[j++]*b,l.position.y=o[j++]*b,l.position.z=o[j++]*b,d.vertices.push(l);j=0;for(k=u.length;j<k;){b=
+u[j++];o=b&1;i=b&2;c=b&4;e=b&8;m=b&16;l=b&32;n=b&64;b&=128;o?(p=new THREE.Face4,p.a=u[j++],p.b=u[j++],p.c=u[j++],p.d=u[j++],o=4):(p=new THREE.Face3,p.a=u[j++],p.b=u[j++],p.c=u[j++],o=3);if(i)i=u[j++],p.materialIndex=i;i=d.faces.length;if(c)for(c=0;c<z;c++)r=a.uvs[c],q=u[j++],s=r[2*q],q=r[2*q+1],d.faceUvs[c][i]=new THREE.UV(s,q);if(e)for(c=0;c<z;c++){r=a.uvs[c];t=[];for(e=0;e<o;e++)q=u[j++],s=r[2*q],q=r[2*q+1],t[e]=new THREE.UV(s,q);d.faceVertexUvs[c][i]=t}if(m)m=3*u[j++],e=new THREE.Vector3,e.x=v[m++],
+e.y=v[m++],e.z=v[m],p.normal=e;if(l)for(c=0;c<o;c++)m=3*u[j++],e=new THREE.Vector3,e.x=v[m++],e.y=v[m++],e.z=v[m],p.vertexNormals.push(e);if(n)l=u[j++],l=new THREE.Color(x[l]),p.color=l;if(b)for(c=0;c<o;c++)l=u[j++],l=new THREE.Color(x[l]),p.vertexColors.push(l);d.faces.push(p)}})(e);(function(){var b,c,e,i;if(a.skinWeights)for(b=0,c=a.skinWeights.length;b<c;b+=2)e=a.skinWeights[b],i=a.skinWeights[b+1],d.skinWeights.push(new THREE.Vector4(e,i,0,0));if(a.skinIndices)for(b=0,c=a.skinIndices.length;b<
+c;b+=2)e=a.skinIndices[b],i=a.skinIndices[b+1],d.skinIndices.push(new THREE.Vector4(e,i,0,0));d.bones=a.bones;d.animation=a.animation})();(function(b){if(void 0!==a.morphTargets){var c,e,i,j,k,o,l,m,q;for(c=0,e=a.morphTargets.length;c<e;c++){d.morphTargets[c]={};d.morphTargets[c].name=a.morphTargets[c].name;d.morphTargets[c].vertices=[];m=d.morphTargets[c].vertices;q=a.morphTargets[c].vertices;for(i=0,j=q.length;i<j;i+=3)k=q[i]*b,o=q[i+1]*b,l=q[i+2]*b,m.push(new THREE.Vertex(new THREE.Vector3(k,o,
+l)))}}if(void 0!==a.morphColors)for(c=0,e=a.morphColors.length;c<e;c++){d.morphColors[c]={};d.morphColors[c].name=a.morphColors[c].name;d.morphColors[c].colors=[];j=d.morphColors[c].colors;k=a.morphColors[c].colors;for(b=0,i=k.length;b<i;b+=3)o=new THREE.Color(16755200),o.setRGB(k[b],k[b+1],k[b+2]),j.push(o)}})(e);d.computeCentroids();d.computeFaceNormals();this.hasNormals(d)&&d.computeTangents();b(d)};
 THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};THREE.SceneLoader.prototype.constructor=THREE.SceneLoader;
-THREE.SceneLoader.prototype.load=function(a,b){var c=this,d=new XMLHttpRequest;d.onreadystatechange=function(){if(4==d.readyState)if(200==d.status||0==d.status){var f=JSON.parse(d.responseText);c.createScene(f,b,a)}else console.error("THREE.SceneLoader: Couldn't load ["+a+"] ["+d.status+"]")};d.open("GET",a,!0);d.overrideMimeType&&d.overrideMimeType("text/plain; charset=x-user-defined");d.setRequestHeader("Content-Type","text/plain");d.send(null)};
-THREE.SceneLoader.prototype.createScene=function(a,b,c){function d(a,b){return"relativeToHTML"==b?a:j+"/"+a}function f(){var a;for(l in D.objects)if(!F.objects[l])if(q=D.objects[l],void 0!==q.geometry){if(G=F.geometries[q.geometry])a=!1,H=F.materials[q.materials[0]],(a=H instanceof THREE.ShaderMaterial)&&G.computeTangents(),t=q.position,v=q.rotation,w=q.quaternion,z=q.scale,w=0,0==q.materials.length&&(H=new THREE.MeshFaceMaterial),1<q.materials.length&&(H=new THREE.MeshFaceMaterial),a=new THREE.Mesh(G,
-H),a.name=l,a.position.set(t[0],t[1],t[2]),w?(a.quaternion.set(w[0],w[1],w[2],w[3]),a.useQuaternion=!0):a.rotation.set(v[0],v[1],v[2]),a.scale.set(z[0],z[1],z[2]),a.visible=q.visible,a.doubleSided=q.doubleSided,a.castShadow=q.castShadow,a.receiveShadow=q.receiveShadow,F.scene.add(a),F.objects[l]=a}else t=q.position,v=q.rotation,w=q.quaternion,z=q.scale,w=0,a=new THREE.Object3D,a.name=l,a.position.set(t[0],t[1],t[2]),w?(a.quaternion.set(w[0],w[1],w[2],w[3]),a.useQuaternion=!0):a.rotation.set(v[0],
-v[1],v[2]),a.scale.set(z[0],z[1],z[2]),a.visible=void 0!==q.visible?q.visible:!1,F.scene.add(a),F.objects[l]=a,F.empties[l]=a}function e(a){return function(b){F.geometries[a]=b;f();B-=1;i.onLoadComplete();h()}}function g(a){return function(b){F.geometries[a]=b}}function h(){i.callbackProgress({totalModels:M,totalTextures:K,loadedModels:M-B,loadedTextures:K-E},F);i.onLoadProgress();0==B&&0==E&&b(F)}var i=this,j=THREE.Loader.prototype.extractUrlBase(c),k,p,l,m,r,n,o,q,u,s,t,v,w,z,x,C,G,H,J,I,D,y,B,
-E,M,K,F;D=a;c=new THREE.BinaryLoader;y=new THREE.JSONLoader;E=B=0;F={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},empties:{}};if(D.transform&&(a=D.transform.position,u=D.transform.rotation,x=D.transform.scale,a&&F.scene.position.set(a[0],a[1],a[2]),u&&F.scene.rotation.set(u[0],u[1],u[2]),x&&F.scene.scale.set(x[0],x[1],x[2]),a||u||x))F.scene.updateMatrix(),F.scene.updateMatrixWorld();a=function(){E-=1;h();i.onLoadComplete()};for(r in D.cameras)x=
-D.cameras[r],"perspective"==x.type?J=new THREE.PerspectiveCamera(x.fov,x.aspect,x.near,x.far):"ortho"==x.type&&(J=new THREE.OrthographicCamera(x.left,x.right,x.top,x.bottom,x.near,x.far)),t=x.position,u=x.target,x=x.up,J.position.set(t[0],t[1],t[2]),J.target=new THREE.Vector3(u[0],u[1],u[2]),x&&J.up.set(x[0],x[1],x[2]),F.cameras[r]=J;for(m in D.lights)u=D.lights[m],r=void 0!==u.color?u.color:16777215,J=void 0!==u.intensity?u.intensity:1,"directional"==u.type?(t=u.direction,s=new THREE.DirectionalLight(r,
-J),s.position.set(t[0],t[1],t[2]),s.position.normalize()):"point"==u.type?(t=u.position,s=u.distance,s=new THREE.PointLight(r,J,s),s.position.set(t[0],t[1],t[2])):"ambient"==u.type&&(s=new THREE.AmbientLight(r)),F.scene.add(s),F.lights[m]=s;for(n in D.fogs)m=D.fogs[n],"linear"==m.type?I=new THREE.Fog(0,m.near,m.far):"exp2"==m.type&&(I=new THREE.FogExp2(0,m.density)),x=m.color,I.color.setRGB(x[0],x[1],x[2]),F.fogs[n]=I;if(F.cameras&&D.defaults.camera)F.currentCamera=F.cameras[D.defaults.camera];if(F.fogs&&
-D.defaults.fog)F.scene.fog=F.fogs[D.defaults.fog];x=D.defaults.bgcolor;F.bgColor=new THREE.Color;F.bgColor.setRGB(x[0],x[1],x[2]);F.bgColorAlpha=D.defaults.bgalpha;for(k in D.geometries)if(n=D.geometries[k],"bin_mesh"==n.type||"ascii_mesh"==n.type)B+=1,i.onLoadStart();M=B;for(k in D.geometries)if(n=D.geometries[k],"cube"==n.type)G=new THREE.CubeGeometry(n.width,n.height,n.depth,n.segmentsWidth,n.segmentsHeight,n.segmentsDepth,null,n.flipped,n.sides),F.geometries[k]=G;else if("plane"==n.type)G=new THREE.PlaneGeometry(n.width,
-n.height,n.segmentsWidth,n.segmentsHeight),F.geometries[k]=G;else if("sphere"==n.type)G=new THREE.SphereGeometry(n.radius,n.segmentsWidth,n.segmentsHeight),F.geometries[k]=G;else if("cylinder"==n.type)G=new THREE.CylinderGeometry(n.topRad,n.botRad,n.height,n.radSegs,n.heightSegs),F.geometries[k]=G;else if("torus"==n.type)G=new THREE.TorusGeometry(n.radius,n.tube,n.segmentsR,n.segmentsT),F.geometries[k]=G;else if("icosahedron"==n.type)G=new THREE.IcosahedronGeometry(n.radius,n.subdivisions),F.geometries[k]=
-G;else if("bin_mesh"==n.type)c.load(d(n.url,D.urlBaseType),e(k));else if("ascii_mesh"==n.type)y.load(d(n.url,D.urlBaseType),e(k));else if("embedded_mesh"==n.type)n=D.embeds[n.id],n.metadata=D.metadata,n&&y.createModel(n,g(k),"");for(o in D.textures)if(k=D.textures[o],k.url instanceof Array){E+=k.url.length;for(n=0;n<k.url.length;n++)i.onLoadStart()}else E+=1,i.onLoadStart();K=E;for(o in D.textures){k=D.textures[o];if(void 0!=k.mapping&&void 0!=THREE[k.mapping])k.mapping=new THREE[k.mapping];if(k.url instanceof
-Array){n=[];for(I=0;I<k.url.length;I++)n[I]=d(k.url[I],D.urlBaseType);n=THREE.ImageUtils.loadTextureCube(n,k.mapping,a)}else{n=THREE.ImageUtils.loadTexture(d(k.url,D.urlBaseType),k.mapping,a);if(void 0!=THREE[k.minFilter])n.minFilter=THREE[k.minFilter];if(void 0!=THREE[k.magFilter])n.magFilter=THREE[k.magFilter];if(k.repeat){n.repeat.set(k.repeat[0],k.repeat[1]);if(1!=k.repeat[0])n.wrapS=THREE.RepeatWrapping;if(1!=k.repeat[1])n.wrapT=THREE.RepeatWrapping}k.offset&&n.offset.set(k.offset[0],k.offset[1]);
-if(k.wrap){I={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(void 0!==I[k.wrap[0]])n.wrapS=I[k.wrap[0]];if(void 0!==I[k.wrap[1]])n.wrapT=I[k.wrap[1]]}}F.textures[o]=n}for(p in D.materials){o=D.materials[p];for(C in o.parameters)if("envMap"==C||"map"==C||"lightMap"==C)o.parameters[C]=F.textures[o.parameters[C]];else if("shading"==C)o.parameters[C]="flat"==o.parameters[C]?THREE.FlatShading:THREE.SmoothShading;else if("blending"==C)o.parameters[C]=THREE[o.parameters[C]]?THREE[o.parameters[C]]:
-THREE.NormalBlending;else if("combine"==C)o.parameters[C]="MixOperation"==o.parameters[C]?THREE.MixOperation:THREE.MultiplyOperation;else if("vertexColors"==C)if("face"==o.parameters[C])o.parameters[C]=THREE.FaceColors;else if(o.parameters[C])o.parameters[C]=THREE.VertexColors;if(void 0!==o.parameters.opacity&&1>o.parameters.opacity)o.parameters.transparent=!0;if(o.parameters.normalMap){a=THREE.ShaderUtils.lib.normal;k=THREE.UniformsUtils.clone(a.uniforms);n=o.parameters.color;I=o.parameters.specular;
-c=o.parameters.ambient;y=o.parameters.shininess;k.tNormal.texture=F.textures[o.parameters.normalMap];if(o.parameters.normalMapFactor)k.uNormalScale.value=o.parameters.normalMapFactor;if(o.parameters.map)k.tDiffuse.texture=o.parameters.map,k.enableDiffuse.value=!0;if(o.parameters.lightMap)k.tAO.texture=o.parameters.lightMap,k.enableAO.value=!0;if(o.parameters.specularMap)k.tSpecular.texture=F.textures[o.parameters.specularMap],k.enableSpecular.value=!0;k.uDiffuseColor.value.setHex(n);k.uSpecularColor.value.setHex(I);
-k.uAmbientColor.value.setHex(c);k.uShininess.value=y;if(o.parameters.opacity)k.uOpacity.value=o.parameters.opacity;H=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:k,lights:!0,fog:!0})}else H=new THREE[o.type](o.parameters);F.materials[p]=H}f();i.callbackSync(F);h()};THREE.UTF8Loader=function(){};
-THREE.UTF8Loader.prototype.load=function(a,b,c){var d=new XMLHttpRequest,f=void 0!==c.scale?c.scale:1,e=void 0!==c.offsetX?c.offsetX:0,g=void 0!==c.offsetY?c.offsetY:0,h=void 0!==c.offsetZ?c.offsetZ:0;d.onreadystatechange=function(){4==d.readyState?200==d.status||0==d.status?THREE.UTF8Loader.prototype.createModel(d.responseText,b,f,e,g,h):console.error("THREE.UTF8Loader: Couldn't load ["+a+"] ["+d.status+"]"):3!=d.readyState&&2==d.readyState&&d.getResponseHeader("Content-Length")};d.open("GET",a,
-!0);d.send(null)};THREE.UTF8Loader.prototype.decompressMesh=function(a){var b=a.charCodeAt(0);57344<=b&&(b-=2048);b++;for(var c=new Float32Array(8*b),d=1,f=0;8>f;f++){for(var e=0,g=0;g<b;++g){var h=a.charCodeAt(g+d),e=e+(h>>1^-(h&1));c[8*g+f]=e}d+=b}b=a.length-d;e=new Uint16Array(b);for(f=g=0;f<b;f++)h=a.charCodeAt(f+d),e[f]=g-h,0==h&&g++;return[c,e]};
-THREE.UTF8Loader.prototype.createModel=function(a,b,c,d,f,e){var g=function(){var b=this;b.materials=[];THREE.Geometry.call(this);var g=THREE.UTF8Loader.prototype.decompressMesh(a),j=[],k=[];(function(a,g,i){for(var j,k,o,q=a.length;i<q;i+=g)j=a[i],k=a[i+1],o=a[i+2],j=j/16383*c,k=k/16383*c,o=o/16383*c,j+=d,k+=f,o+=e,b.vertices.push(new THREE.Vertex(new THREE.Vector3(j,k,o)))})(g[0],8,0);(function(a,b,c){for(var d,e,f=a.length;c<f;c+=b)d=a[c],e=a[c+1],d/=1023,e/=1023,k.push(d,1-e)})(g[0],8,3);(function(a,
-b,c){for(var d,e,f,g=a.length;c<g;c+=b)d=a[c],e=a[c+1],f=a[c+2],d=(d-512)/511,e=(e-512)/511,f=(f-512)/511,j.push(d,e,f)})(g[0],8,5);(function(a){var c,d,e,f,g,i,u,s,t,v=a.length;for(c=0;c<v;c+=3){d=a[c];e=a[c+1];f=a[c+2];g=b;s=d;t=e;i=f;var w=j[3*e],z=j[3*e+1],x=j[3*e+2],C=j[3*f],G=j[3*f+1],H=j[3*f+2];u=new THREE.Vector3(j[3*d],j[3*d+1],j[3*d+2]);w=new THREE.Vector3(w,z,x);C=new THREE.Vector3(C,G,H);g.faces.push(new THREE.Face3(s,t,i,[u,w,C],null,0));g=k[2*d];d=k[2*d+1];i=k[2*e];u=k[2*e+1];s=k[2*
-f];t=k[2*f+1];f=b.faceVertexUvs[0];e=i;i=u;u=[];u.push(new THREE.UV(g,d));u.push(new THREE.UV(e,i));u.push(new THREE.UV(s,t));f.push(u)}})(g[1]);this.computeCentroids();this.computeFaceNormals()};g.prototype=new THREE.Geometry;g.prototype.constructor=g;b(new g)};THREE.ImmediateRenderObject=function(){THREE.Object3D.call(this);this.render=function(){}};THREE.ImmediateRenderObject.prototype=new THREE.Object3D;THREE.ImmediateRenderObject.prototype.constructor=THREE.ImmediateRenderObject;
-THREE.LensFlare=function(a,b,c,d,f){THREE.Object3D.call(this);this.lensFlares=[];this.positionScreen=new THREE.Vector3;this.customUpdateCallback=void 0;void 0!==a&&this.add(a,b,c,d,f)};THREE.LensFlare.prototype=new THREE.Object3D;THREE.LensFlare.prototype.constructor=THREE.LensFlare;THREE.LensFlare.prototype.supr=THREE.Object3D.prototype;
-THREE.LensFlare.prototype.add=function(a,b,c,d,f,e){void 0===b&&(b=-1);void 0===c&&(c=0);void 0===e&&(e=1);void 0===f&&(f=new THREE.Color(16777215));if(void 0===d)d=THREE.NormalBlending;c=Math.min(c,Math.max(0,c));this.lensFlares.push({texture:a,size:b,distance:c,x:0,y:0,z:0,scale:1,rotation:1,opacity:e,color:f,blending:d})};
-THREE.LensFlare.prototype.updateLensFlares=function(){var a,b=this.lensFlares.length,c,d=2*-this.positionScreen.x,f=2*-this.positionScreen.y;for(a=0;a<b;a++)c=this.lensFlares[a],c.x=this.positionScreen.x+d*c.distance,c.y=this.positionScreen.y+f*c.distance,c.wantedRotation=0.25*c.x*Math.PI,c.rotation+=0.25*(c.wantedRotation-c.rotation)};
+THREE.SceneLoader.prototype.load=function(a,b){var c=this,d=new XMLHttpRequest;d.onreadystatechange=function(){if(4==d.readyState)if(200==d.status||0==d.status){var e=JSON.parse(d.responseText);c.createScene(e,b,a)}else console.error("THREE.SceneLoader: Couldn't load ["+a+"] ["+d.status+"]")};d.open("GET",a,!0);d.overrideMimeType&&d.overrideMimeType("text/plain; charset=x-user-defined");d.setRequestHeader("Content-Type","text/plain");d.send(null)};
+THREE.SceneLoader.prototype.createScene=function(a,b,c){function d(a,b){return"relativeToHTML"==b?a:j+"/"+a}function e(){var a;for(l in C.objects)if(!E.objects[l])if(r=C.objects[l],void 0!==r.geometry){if(G=E.geometries[r.geometry])a=!1,H=E.materials[r.materials[0]],(a=H instanceof THREE.ShaderMaterial)&&G.computeTangents(),u=r.position,v=r.rotation,x=r.quaternion,z=r.scale,x=0,0==r.materials.length&&(H=new THREE.MeshFaceMaterial),1<r.materials.length&&(H=new THREE.MeshFaceMaterial),a=new THREE.Mesh(G,
+H),a.name=l,a.position.set(u[0],u[1],u[2]),x?(a.quaternion.set(x[0],x[1],x[2],x[3]),a.useQuaternion=!0):a.rotation.set(v[0],v[1],v[2]),a.scale.set(z[0],z[1],z[2]),a.visible=r.visible,a.doubleSided=r.doubleSided,a.castShadow=r.castShadow,a.receiveShadow=r.receiveShadow,E.scene.add(a),E.objects[l]=a}else u=r.position,v=r.rotation,x=r.quaternion,z=r.scale,x=0,a=new THREE.Object3D,a.name=l,a.position.set(u[0],u[1],u[2]),x?(a.quaternion.set(x[0],x[1],x[2],x[3]),a.useQuaternion=!0):a.rotation.set(v[0],
+v[1],v[2]),a.scale.set(z[0],z[1],z[2]),a.visible=void 0!==r.visible?r.visible:!1,E.scene.add(a),E.objects[l]=a,E.empties[l]=a}function f(a){return function(b){E.geometries[a]=b;e();A-=1;i.onLoadComplete();h()}}function g(a){return function(b){E.geometries[a]=b}}function h(){i.callbackProgress({totalModels:L,totalTextures:I,loadedModels:L-A,loadedTextures:I-F},E);i.onLoadProgress();0==A&&0==F&&b(E)}var i=this,j=THREE.Loader.prototype.extractUrlBase(c),k,o,l,m,q,n,p,r,t,s,u,v,x,z,w,D,G,H,J,K,C,y,A,
+F,L,I,E;C=a;c=new THREE.BinaryLoader;y=new THREE.JSONLoader;F=A=0;E={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},empties:{}};if(C.transform&&(a=C.transform.position,t=C.transform.rotation,w=C.transform.scale,a&&E.scene.position.set(a[0],a[1],a[2]),t&&E.scene.rotation.set(t[0],t[1],t[2]),w&&E.scene.scale.set(w[0],w[1],w[2]),a||t||w))E.scene.updateMatrix(),E.scene.updateMatrixWorld();a=function(){F-=1;h();i.onLoadComplete()};for(q in C.cameras)w=
+C.cameras[q],"perspective"==w.type?J=new THREE.PerspectiveCamera(w.fov,w.aspect,w.near,w.far):"ortho"==w.type&&(J=new THREE.OrthographicCamera(w.left,w.right,w.top,w.bottom,w.near,w.far)),u=w.position,t=w.target,w=w.up,J.position.set(u[0],u[1],u[2]),J.target=new THREE.Vector3(t[0],t[1],t[2]),w&&J.up.set(w[0],w[1],w[2]),E.cameras[q]=J;for(m in C.lights)t=C.lights[m],q=void 0!==t.color?t.color:16777215,J=void 0!==t.intensity?t.intensity:1,"directional"==t.type?(u=t.direction,s=new THREE.DirectionalLight(q,
+J),s.position.set(u[0],u[1],u[2]),s.position.normalize()):"point"==t.type?(u=t.position,s=t.distance,s=new THREE.PointLight(q,J,s),s.position.set(u[0],u[1],u[2])):"ambient"==t.type&&(s=new THREE.AmbientLight(q)),E.scene.add(s),E.lights[m]=s;for(n in C.fogs)m=C.fogs[n],"linear"==m.type?K=new THREE.Fog(0,m.near,m.far):"exp2"==m.type&&(K=new THREE.FogExp2(0,m.density)),w=m.color,K.color.setRGB(w[0],w[1],w[2]),E.fogs[n]=K;if(E.cameras&&C.defaults.camera)E.currentCamera=E.cameras[C.defaults.camera];if(E.fogs&&
+C.defaults.fog)E.scene.fog=E.fogs[C.defaults.fog];w=C.defaults.bgcolor;E.bgColor=new THREE.Color;E.bgColor.setRGB(w[0],w[1],w[2]);E.bgColorAlpha=C.defaults.bgalpha;for(k in C.geometries)if(n=C.geometries[k],"bin_mesh"==n.type||"ascii_mesh"==n.type)A+=1,i.onLoadStart();L=A;for(k in C.geometries)if(n=C.geometries[k],"cube"==n.type)G=new THREE.CubeGeometry(n.width,n.height,n.depth,n.segmentsWidth,n.segmentsHeight,n.segmentsDepth,null,n.flipped,n.sides),E.geometries[k]=G;else if("plane"==n.type)G=new THREE.PlaneGeometry(n.width,
+n.height,n.segmentsWidth,n.segmentsHeight),E.geometries[k]=G;else if("sphere"==n.type)G=new THREE.SphereGeometry(n.radius,n.segmentsWidth,n.segmentsHeight),E.geometries[k]=G;else if("cylinder"==n.type)G=new THREE.CylinderGeometry(n.topRad,n.botRad,n.height,n.radSegs,n.heightSegs),E.geometries[k]=G;else if("torus"==n.type)G=new THREE.TorusGeometry(n.radius,n.tube,n.segmentsR,n.segmentsT),E.geometries[k]=G;else if("icosahedron"==n.type)G=new THREE.IcosahedronGeometry(n.radius,n.subdivisions),E.geometries[k]=
+G;else if("bin_mesh"==n.type)c.load(d(n.url,C.urlBaseType),f(k));else if("ascii_mesh"==n.type)y.load(d(n.url,C.urlBaseType),f(k));else if("embedded_mesh"==n.type)n=C.embeds[n.id],n.metadata=C.metadata,n&&y.createModel(n,g(k),"");for(p in C.textures)if(k=C.textures[p],k.url instanceof Array){F+=k.url.length;for(n=0;n<k.url.length;n++)i.onLoadStart()}else F+=1,i.onLoadStart();I=F;for(p in C.textures){k=C.textures[p];if(void 0!=k.mapping&&void 0!=THREE[k.mapping])k.mapping=new THREE[k.mapping];if(k.url instanceof
+Array){n=[];for(K=0;K<k.url.length;K++)n[K]=d(k.url[K],C.urlBaseType);n=THREE.ImageUtils.loadTextureCube(n,k.mapping,a)}else{n=THREE.ImageUtils.loadTexture(d(k.url,C.urlBaseType),k.mapping,a);if(void 0!=THREE[k.minFilter])n.minFilter=THREE[k.minFilter];if(void 0!=THREE[k.magFilter])n.magFilter=THREE[k.magFilter];if(k.repeat){n.repeat.set(k.repeat[0],k.repeat[1]);if(1!=k.repeat[0])n.wrapS=THREE.RepeatWrapping;if(1!=k.repeat[1])n.wrapT=THREE.RepeatWrapping}k.offset&&n.offset.set(k.offset[0],k.offset[1]);
+if(k.wrap){K={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(void 0!==K[k.wrap[0]])n.wrapS=K[k.wrap[0]];if(void 0!==K[k.wrap[1]])n.wrapT=K[k.wrap[1]]}}E.textures[p]=n}for(o in C.materials){p=C.materials[o];for(D in p.parameters)if("envMap"==D||"map"==D||"lightMap"==D)p.parameters[D]=E.textures[p.parameters[D]];else if("shading"==D)p.parameters[D]="flat"==p.parameters[D]?THREE.FlatShading:THREE.SmoothShading;else if("blending"==D)p.parameters[D]=THREE[p.parameters[D]]?THREE[p.parameters[D]]:
+THREE.NormalBlending;else if("combine"==D)p.parameters[D]="MixOperation"==p.parameters[D]?THREE.MixOperation:THREE.MultiplyOperation;else if("vertexColors"==D)if("face"==p.parameters[D])p.parameters[D]=THREE.FaceColors;else if(p.parameters[D])p.parameters[D]=THREE.VertexColors;if(void 0!==p.parameters.opacity&&1>p.parameters.opacity)p.parameters.transparent=!0;if(p.parameters.normalMap){a=THREE.ShaderUtils.lib.normal;k=THREE.UniformsUtils.clone(a.uniforms);n=p.parameters.color;K=p.parameters.specular;
+c=p.parameters.ambient;y=p.parameters.shininess;k.tNormal.texture=E.textures[p.parameters.normalMap];if(p.parameters.normalMapFactor)k.uNormalScale.value=p.parameters.normalMapFactor;if(p.parameters.map)k.tDiffuse.texture=p.parameters.map,k.enableDiffuse.value=!0;if(p.parameters.lightMap)k.tAO.texture=p.parameters.lightMap,k.enableAO.value=!0;if(p.parameters.specularMap)k.tSpecular.texture=E.textures[p.parameters.specularMap],k.enableSpecular.value=!0;k.uDiffuseColor.value.setHex(n);k.uSpecularColor.value.setHex(K);
+k.uAmbientColor.value.setHex(c);k.uShininess.value=y;if(p.parameters.opacity)k.uOpacity.value=p.parameters.opacity;H=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:k,lights:!0,fog:!0})}else H=new THREE[p.type](p.parameters);E.materials[o]=H}e();i.callbackSync(E);h()};THREE.UTF8Loader=function(){};
+THREE.UTF8Loader.prototype.load=function(a,b,c){var d=new XMLHttpRequest,e=void 0!==c.scale?c.scale:1,f=void 0!==c.offsetX?c.offsetX:0,g=void 0!==c.offsetY?c.offsetY:0,h=void 0!==c.offsetZ?c.offsetZ:0;d.onreadystatechange=function(){4==d.readyState?200==d.status||0==d.status?THREE.UTF8Loader.prototype.createModel(d.responseText,b,e,f,g,h):console.error("THREE.UTF8Loader: Couldn't load ["+a+"] ["+d.status+"]"):3!=d.readyState&&2==d.readyState&&d.getResponseHeader("Content-Length")};d.open("GET",a,
+!0);d.send(null)};THREE.UTF8Loader.prototype.decompressMesh=function(a){var b=a.charCodeAt(0);57344<=b&&(b-=2048);b++;for(var c=new Float32Array(8*b),d=1,e=0;8>e;e++){for(var f=0,g=0;g<b;++g){var h=a.charCodeAt(g+d),f=f+(h>>1^-(h&1));c[8*g+e]=f}d+=b}b=a.length-d;f=new Uint16Array(b);for(e=g=0;e<b;e++)h=a.charCodeAt(e+d),f[e]=g-h,0==h&&g++;return[c,f]};
+THREE.UTF8Loader.prototype.createModel=function(a,b,c,d,e,f){var g=function(){var b=this;b.materials=[];THREE.Geometry.call(this);var g=THREE.UTF8Loader.prototype.decompressMesh(a),j=[],k=[];(function(a,g,i){for(var j,k,p,r=a.length;i<r;i+=g)j=a[i],k=a[i+1],p=a[i+2],j=j/16383*c,k=k/16383*c,p=p/16383*c,j+=d,k+=e,p+=f,b.vertices.push(new THREE.Vertex(new THREE.Vector3(j,k,p)))})(g[0],8,0);(function(a,b,c){for(var d,e,f=a.length;c<f;c+=b)d=a[c],e=a[c+1],d/=1023,e/=1023,k.push(d,1-e)})(g[0],8,3);(function(a,
+b,c){for(var d,e,f,g=a.length;c<g;c+=b)d=a[c],e=a[c+1],f=a[c+2],d=(d-512)/511,e=(e-512)/511,f=(f-512)/511,j.push(d,e,f)})(g[0],8,5);(function(a){var c,d,e,f,g,i,t,s,u,v=a.length;for(c=0;c<v;c+=3){d=a[c];e=a[c+1];f=a[c+2];g=b;s=d;u=e;i=f;var x=j[3*e],z=j[3*e+1],w=j[3*e+2],D=j[3*f],G=j[3*f+1],H=j[3*f+2];t=new THREE.Vector3(j[3*d],j[3*d+1],j[3*d+2]);x=new THREE.Vector3(x,z,w);D=new THREE.Vector3(D,G,H);g.faces.push(new THREE.Face3(s,u,i,[t,x,D],null,0));g=k[2*d];d=k[2*d+1];i=k[2*e];t=k[2*e+1];s=k[2*
+f];u=k[2*f+1];f=b.faceVertexUvs[0];e=i;i=t;t=[];t.push(new THREE.UV(g,d));t.push(new THREE.UV(e,i));t.push(new THREE.UV(s,u));f.push(t)}})(g[1]);this.computeCentroids();this.computeFaceNormals()};g.prototype=new THREE.Geometry;g.prototype.constructor=g;b(new g)};THREE.ImmediateRenderObject=function(){THREE.Object3D.call(this);this.render=function(){}};THREE.ImmediateRenderObject.prototype=new THREE.Object3D;THREE.ImmediateRenderObject.prototype.constructor=THREE.ImmediateRenderObject;
+THREE.LensFlare=function(a,b,c,d,e){THREE.Object3D.call(this);this.lensFlares=[];this.positionScreen=new THREE.Vector3;this.customUpdateCallback=void 0;void 0!==a&&this.add(a,b,c,d,e)};THREE.LensFlare.prototype=new THREE.Object3D;THREE.LensFlare.prototype.constructor=THREE.LensFlare;THREE.LensFlare.prototype.supr=THREE.Object3D.prototype;
+THREE.LensFlare.prototype.add=function(a,b,c,d,e,f){void 0===b&&(b=-1);void 0===c&&(c=0);void 0===f&&(f=1);void 0===e&&(e=new THREE.Color(16777215));if(void 0===d)d=THREE.NormalBlending;c=Math.min(c,Math.max(0,c));this.lensFlares.push({texture:a,size:b,distance:c,x:0,y:0,z:0,scale:1,rotation:1,opacity:f,color:e,blending:d})};
+THREE.LensFlare.prototype.updateLensFlares=function(){var a,b=this.lensFlares.length,c,d=2*-this.positionScreen.x,e=2*-this.positionScreen.y;for(a=0;a<b;a++)c=this.lensFlares[a],c.x=this.positionScreen.x+d*c.distance,c.y=this.positionScreen.y+e*c.distance,c.wantedRotation=0.25*c.x*Math.PI,c.rotation+=0.25*(c.wantedRotation-c.rotation)};
 THREE.MorphBlendMesh=function(a,b){THREE.Mesh.call(this,a,b);this.animationsMap={};this.animationsList=[];var c=this.geometry.morphTargets.length;this.createAnimation("__default",0,c-1,c/1);this.setAnimationWeight("__default",1)};THREE.MorphBlendMesh.prototype=new THREE.Mesh;THREE.MorphBlendMesh.prototype.constructor=THREE.MorphBlendMesh;
 THREE.MorphBlendMesh.prototype.createAnimation=function(a,b,c,d){b={startFrame:b,endFrame:c,length:c-b+1,fps:d,duration:(c-b)/d,lastFrame:0,currentFrame:0,active:!1,time:0,direction:1,weight:1,directionBackwards:!1,mirroredLoop:!1};this.animationsMap[a]=b;this.animationsList.push(b)};
-THREE.MorphBlendMesh.prototype.autoCreateAnimations=function(a){for(var b=/([a-z]+)(\d+)/,c,d={},f=this.geometry,e=0,g=f.morphTargets.length;e<g;e++){var h=f.morphTargets[e].name.match(b);if(h&&1<h.length){var i=h[1];d[i]||(d[i]={start:Infinity,end:-Infinity});h=d[i];if(e<h.start)h.start=e;if(e>h.end)h.end=e;c||(c=i)}}for(i in d)h=d[i],this.createAnimation(i,h.start,h.end,a);this.firstAnimation=c};
+THREE.MorphBlendMesh.prototype.autoCreateAnimations=function(a){for(var b=/([a-z]+)(\d+)/,c,d={},e=this.geometry,f=0,g=e.morphTargets.length;f<g;f++){var h=e.morphTargets[f].name.match(b);if(h&&1<h.length){var i=h[1];d[i]||(d[i]={start:Infinity,end:-Infinity});h=d[i];if(f<h.start)h.start=f;if(f>h.end)h.end=f;c||(c=i)}}for(i in d)h=d[i],this.createAnimation(i,h.start,h.end,a);this.firstAnimation=c};
 THREE.MorphBlendMesh.prototype.setAnimationDirectionForward=function(a){if(a=this.animationsMap[a])a.direction=1,a.directionBackwards=!1};THREE.MorphBlendMesh.prototype.setAnimationDirectionBackward=function(a){if(a=this.animationsMap[a])a.direction=-1,a.directionBackwards=!0};THREE.MorphBlendMesh.prototype.setAnimationFPS=function(a,b){var c=this.animationsMap[a];if(c)c.fps=b,c.duration=(c.end-c.start)/c.fps};
 THREE.MorphBlendMesh.prototype.setAnimationDuration=function(a,b){var c=this.animationsMap[a];if(c)c.duration=b,c.fps=(c.end-c.start)/c.duration};THREE.MorphBlendMesh.prototype.setAnimationWeight=function(a,b){var c=this.animationsMap[a];if(c)c.weight=b};THREE.MorphBlendMesh.prototype.setAnimationTime=function(a,b){var c=this.animationsMap[a];if(c)c.time=b};THREE.MorphBlendMesh.prototype.getAnimationTime=function(a){var b=0;if(a=this.animationsMap[a])b=a.time;return b};
 THREE.MorphBlendMesh.prototype.getAnimationDuration=function(a){var b=-1;if(a=this.animationsMap[a])b=a.duration;return b};THREE.MorphBlendMesh.prototype.playAnimation=function(a){var b=this.animationsMap[a];b?(b.time=0,b.active=!0):console.warn("animation["+a+"] undefined")};THREE.MorphBlendMesh.prototype.stopAnimation=function(a){if(a=this.animationsMap[a])a.active=!1};
-THREE.MorphBlendMesh.prototype.update=function(a){for(var b=0,c=this.animationsList.length;b<c;b++){var d=this.animationsList[b];if(d.active){var f=d.duration/d.length;d.time+=d.direction*a;if(d.mirroredLoop){if(d.time>d.duration||0>d.time){d.direction*=-1;if(d.time>d.duration)d.time=d.duration,d.directionBackwards=!0;if(0>d.time)d.time=0,d.directionBackwards=!1}}else d.time%=d.duration,0>d.time&&(d.time+=d.duration);var e=d.startFrame+THREE.Math.clamp(Math.floor(d.time/f),0,d.length-1),g=d.weight;
-if(e!==d.currentFrame)this.morphTargetInfluences[d.lastFrame]=0,this.morphTargetInfluences[d.currentFrame]=1*g,this.morphTargetInfluences[e]=0,d.lastFrame=d.currentFrame,d.currentFrame=e;f=d.time%f/f;d.directionBackwards&&(f=1-f);this.morphTargetInfluences[d.currentFrame]=f*g;this.morphTargetInfluences[d.lastFrame]=(1-f)*g}}};
-THREE.LensFlarePlugin=function(){function a(a){var c=b.createProgram(),d=b.createShader(b.FRAGMENT_SHADER),e=b.createShader(b.VERTEX_SHADER);b.shaderSource(d,a.fragmentShader);b.shaderSource(e,a.vertexShader);b.compileShader(d);b.compileShader(e);b.attachShader(c,d);b.attachShader(c,e);b.linkProgram(c);return c}var b,c,d,f,e,g,h,i,j,k,p,l,m;this.init=function(r){b=r.context;c=r;d=new Float32Array(16);f=new Uint16Array(6);r=0;d[r++]=-1;d[r++]=-1;d[r++]=0;d[r++]=0;d[r++]=1;d[r++]=-1;d[r++]=1;d[r++]=
-0;d[r++]=1;d[r++]=1;d[r++]=1;d[r++]=1;d[r++]=-1;d[r++]=1;d[r++]=0;d[r++]=1;r=0;f[r++]=0;f[r++]=1;f[r++]=2;f[r++]=0;f[r++]=2;f[r++]=3;e=b.createBuffer();g=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,e);b.bufferData(b.ARRAY_BUFFER,d,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.bufferData(b.ELEMENT_ARRAY_BUFFER,f,b.STATIC_DRAW);h=b.createTexture();i=b.createTexture();b.bindTexture(b.TEXTURE_2D,h);b.texImage2D(b.TEXTURE_2D,0,b.RGB,16,16,0,b.RGB,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,
+THREE.MorphBlendMesh.prototype.update=function(a){for(var b=0,c=this.animationsList.length;b<c;b++){var d=this.animationsList[b];if(d.active){var e=d.duration/d.length;d.time+=d.direction*a;if(d.mirroredLoop){if(d.time>d.duration||0>d.time){d.direction*=-1;if(d.time>d.duration)d.time=d.duration,d.directionBackwards=!0;if(0>d.time)d.time=0,d.directionBackwards=!1}}else d.time%=d.duration,0>d.time&&(d.time+=d.duration);var f=d.startFrame+THREE.Math.clamp(Math.floor(d.time/e),0,d.length-1),g=d.weight;
+if(f!==d.currentFrame)this.morphTargetInfluences[d.lastFrame]=0,this.morphTargetInfluences[d.currentFrame]=1*g,this.morphTargetInfluences[f]=0,d.lastFrame=d.currentFrame,d.currentFrame=f;e=d.time%e/e;d.directionBackwards&&(e=1-e);this.morphTargetInfluences[d.currentFrame]=e*g;this.morphTargetInfluences[d.lastFrame]=(1-e)*g}}};
+THREE.LensFlarePlugin=function(){function a(a){var c=b.createProgram(),d=b.createShader(b.FRAGMENT_SHADER),e=b.createShader(b.VERTEX_SHADER);b.shaderSource(d,a.fragmentShader);b.shaderSource(e,a.vertexShader);b.compileShader(d);b.compileShader(e);b.attachShader(c,d);b.attachShader(c,e);b.linkProgram(c);return c}var b,c,d,e,f,g,h,i,j,k,o,l,m;this.init=function(q){b=q.context;c=q;d=new Float32Array(16);e=new Uint16Array(6);q=0;d[q++]=-1;d[q++]=-1;d[q++]=0;d[q++]=0;d[q++]=1;d[q++]=-1;d[q++]=1;d[q++]=
+0;d[q++]=1;d[q++]=1;d[q++]=1;d[q++]=1;d[q++]=-1;d[q++]=1;d[q++]=0;d[q++]=1;q=0;e[q++]=0;e[q++]=1;e[q++]=2;e[q++]=0;e[q++]=2;e[q++]=3;f=b.createBuffer();g=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,f);b.bufferData(b.ARRAY_BUFFER,d,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.bufferData(b.ELEMENT_ARRAY_BUFFER,e,b.STATIC_DRAW);h=b.createTexture();i=b.createTexture();b.bindTexture(b.TEXTURE_2D,h);b.texImage2D(b.TEXTURE_2D,0,b.RGB,16,16,0,b.RGB,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,
 b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);b.bindTexture(b.TEXTURE_2D,i);b.texImage2D(b.TEXTURE_2D,0,b.RGBA,16,16,0,b.RGBA,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);
-b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);0>=b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)?(j=!1,k=a(THREE.ShaderFlares.lensFlare)):(j=!0,k=a(THREE.ShaderFlares.lensFlareVertexTexture));p={};l={};p.vertex=b.getAttribLocation(k,"position");p.uv=b.getAttribLocation(k,"uv");l.renderType=b.getUniformLocation(k,"renderType");l.map=b.getUniformLocation(k,"map");l.occlusionMap=b.getUniformLocation(k,"occlusionMap");l.opacity=b.getUniformLocation(k,"opacity");l.color=b.getUniformLocation(k,
-"color");l.scale=b.getUniformLocation(k,"scale");l.rotation=b.getUniformLocation(k,"rotation");l.screenPosition=b.getUniformLocation(k,"screenPosition");m=!1};this.render=function(a,d,f,q){var a=a.__webglFlares,u=a.length;if(u){var s=new THREE.Vector3,t=q/f,v=0.5*f,w=0.5*q,z=16/q,x=new THREE.Vector2(z*t,z),C=new THREE.Vector3(1,1,0),G=new THREE.Vector2(1,1),H=l,z=p;b.useProgram(k);m||(b.enableVertexAttribArray(p.vertex),b.enableVertexAttribArray(p.uv),m=!0);b.uniform1i(H.occlusionMap,0);b.uniform1i(H.map,
-1);b.bindBuffer(b.ARRAY_BUFFER,e);b.vertexAttribPointer(z.vertex,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(z.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.disable(b.CULL_FACE);b.depthMask(!1);var J,I,D,y,B;for(J=0;J<u;J++)if(z=16/q,x.set(z*t,z),y=a[J],s.set(y.matrixWorld.n14,y.matrixWorld.n24,y.matrixWorld.n34),d.matrixWorldInverse.multiplyVector3(s),d.projectionMatrix.multiplyVector3(s),C.copy(s),G.x=C.x*v+v,G.y=C.y*w+w,j||0<G.x&&G.x<f&&0<G.y&&G.y<q){b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,
-h);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,G.x-8,G.y-8,16,16,0);b.uniform1i(H.renderType,0);b.uniform2f(H.scale,x.x,x.y);b.uniform3f(H.screenPosition,C.x,C.y,C.z);b.disable(b.BLEND);b.enable(b.DEPTH_TEST);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);b.activeTexture(b.TEXTURE0);b.bindTexture(b.TEXTURE_2D,i);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGBA,G.x-8,G.y-8,16,16,0);b.uniform1i(H.renderType,1);b.disable(b.DEPTH_TEST);b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,h);b.drawElements(b.TRIANGLES,
-6,b.UNSIGNED_SHORT,0);y.positionScreen.copy(C);y.customUpdateCallback?y.customUpdateCallback(y):y.updateLensFlares();b.uniform1i(H.renderType,2);b.enable(b.BLEND);for(I=0,D=y.lensFlares.length;I<D;I++)if(B=y.lensFlares[I],0.001<B.opacity&&0.001<B.scale)C.x=B.x,C.y=B.y,C.z=B.z,z=B.size*B.scale/q,x.x=z*t,x.y=z,b.uniform3f(H.screenPosition,C.x,C.y,C.z),b.uniform2f(H.scale,x.x,x.y),b.uniform1f(H.rotation,B.rotation),b.uniform1f(H.opacity,B.opacity),b.uniform3f(H.color,B.color.r,B.color.g,B.color.b),c.setBlending(B.blending),
-c.setTexture(B.texture,1),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0)}b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(!0)}}};
-THREE.ShadowMapPlugin=function(){var a,b,c,d,f=new THREE.Frustum,e=new THREE.Matrix4,g=new THREE.Vector3,h=new THREE.Vector3;this.init=function(e){a=e.context;b=e;var e=THREE.ShaderLib.depthRGBA,f=THREE.UniformsUtils.clone(e.uniforms);c=new THREE.ShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:f});d=new THREE.ShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:f,morphTargets:!0});c._shadowPass=!0;d._shadowPass=!0};this.render=function(a,
-c){b.shadowMapEnabled&&b.shadowMapAutoUpdate&&this.update(a,c)};this.update=function(i,j){var k,p,l,m,r,n,o,q,u,s=[];m=0;a.clearColor(1,1,1,1);a.disable(a.BLEND);b.shadowMapCullFrontFaces&&a.cullFace(a.FRONT);b.setDepthTest(!0);for(k=0,p=i.__lights.length;k<p;k++)if(l=i.__lights[k],l.castShadow)if(l instanceof THREE.DirectionalLight&&l.shadowCascade)for(r=0;r<l.shadowCascadeCount;r++){var t;if(l.shadowCascadeArray[r])t=l.shadowCascadeArray[r];else{u=l;o=r;t=new THREE.DirectionalLight;t.isVirtual=
-!0;t.onlyShadow=!0;t.castShadow=!0;t.shadowCameraNear=u.shadowCameraNear;t.shadowCameraFar=u.shadowCameraFar;t.shadowCameraLeft=u.shadowCameraLeft;t.shadowCameraRight=u.shadowCameraRight;t.shadowCameraBottom=u.shadowCameraBottom;t.shadowCameraTop=u.shadowCameraTop;t.shadowCameraVisible=u.shadowCameraVisible;t.shadowDarkness=u.shadowDarkness;t.shadowBias=u.shadowCascadeBias[o];t.shadowMapWidth=u.shadowCascadeWidth[o];t.shadowMapHeight=u.shadowCascadeHeight[o];t.pointsWorld=[];t.pointsFrustum=[];q=
-t.pointsWorld;n=t.pointsFrustum;for(var v=0;8>v;v++)q[v]=new THREE.Vector3,n[v]=new THREE.Vector3;q=u.shadowCascadeNearZ[o];u=u.shadowCascadeFarZ[o];n[0].set(-1,-1,q);n[1].set(1,-1,q);n[2].set(-1,1,q);n[3].set(1,1,q);n[4].set(-1,-1,u);n[5].set(1,-1,u);n[6].set(-1,1,u);n[7].set(1,1,u);t.originalCamera=j;n=new THREE.Gyroscope;n.position=l.shadowCascadeOffset;n.add(t);n.add(t.target);j.add(n);l.shadowCascadeArray[r]=t;console.log("Created virtualLight",t)}o=l;q=r;u=o.shadowCascadeArray[q];u.position.copy(o.position);
-u.target.position.copy(o.target.position);u.lookAt(u.target);u.shadowCameraVisible=o.shadowCameraVisible;u.shadowDarkness=o.shadowDarkness;u.shadowBias=o.shadowCascadeBias[q];n=o.shadowCascadeNearZ[q];o=o.shadowCascadeFarZ[q];u=u.pointsFrustum;u[0].z=n;u[1].z=n;u[2].z=n;u[3].z=n;u[4].z=o;u[5].z=o;u[6].z=o;u[7].z=o;s[m]=t;m++}else s[m]=l,m++;for(k=0,p=s.length;k<p;k++){l=s[k];if(!l.shadowMap)l.shadowMap=new THREE.WebGLRenderTarget(l.shadowMapWidth,l.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,
+b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);0>=b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)?(j=!1,k=a(THREE.ShaderFlares.lensFlare)):(j=!0,k=a(THREE.ShaderFlares.lensFlareVertexTexture));o={};l={};o.vertex=b.getAttribLocation(k,"position");o.uv=b.getAttribLocation(k,"uv");l.renderType=b.getUniformLocation(k,"renderType");l.map=b.getUniformLocation(k,"map");l.occlusionMap=b.getUniformLocation(k,"occlusionMap");l.opacity=b.getUniformLocation(k,"opacity");l.color=b.getUniformLocation(k,
+"color");l.scale=b.getUniformLocation(k,"scale");l.rotation=b.getUniformLocation(k,"rotation");l.screenPosition=b.getUniformLocation(k,"screenPosition");m=!1};this.render=function(a,d,e,r){var a=a.__webglFlares,t=a.length;if(t){var s=new THREE.Vector3,u=r/e,v=0.5*e,x=0.5*r,z=16/r,w=new THREE.Vector2(z*u,z),D=new THREE.Vector3(1,1,0),G=new THREE.Vector2(1,1),H=l,z=o;b.useProgram(k);m||(b.enableVertexAttribArray(o.vertex),b.enableVertexAttribArray(o.uv),m=!0);b.uniform1i(H.occlusionMap,0);b.uniform1i(H.map,
+1);b.bindBuffer(b.ARRAY_BUFFER,f);b.vertexAttribPointer(z.vertex,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(z.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.disable(b.CULL_FACE);b.depthMask(!1);var J,K,C,y,A;for(J=0;J<t;J++)if(z=16/r,w.set(z*u,z),y=a[J],s.set(y.matrixWorld.n14,y.matrixWorld.n24,y.matrixWorld.n34),d.matrixWorldInverse.multiplyVector3(s),d.projectionMatrix.multiplyVector3(s),D.copy(s),G.x=D.x*v+v,G.y=D.y*x+x,j||0<G.x&&G.x<e&&0<G.y&&G.y<r){b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,
+h);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,G.x-8,G.y-8,16,16,0);b.uniform1i(H.renderType,0);b.uniform2f(H.scale,w.x,w.y);b.uniform3f(H.screenPosition,D.x,D.y,D.z);b.disable(b.BLEND);b.enable(b.DEPTH_TEST);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);b.activeTexture(b.TEXTURE0);b.bindTexture(b.TEXTURE_2D,i);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGBA,G.x-8,G.y-8,16,16,0);b.uniform1i(H.renderType,1);b.disable(b.DEPTH_TEST);b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,h);b.drawElements(b.TRIANGLES,
+6,b.UNSIGNED_SHORT,0);y.positionScreen.copy(D);y.customUpdateCallback?y.customUpdateCallback(y):y.updateLensFlares();b.uniform1i(H.renderType,2);b.enable(b.BLEND);for(K=0,C=y.lensFlares.length;K<C;K++)if(A=y.lensFlares[K],0.001<A.opacity&&0.001<A.scale)D.x=A.x,D.y=A.y,D.z=A.z,z=A.size*A.scale/r,w.x=z*u,w.y=z,b.uniform3f(H.screenPosition,D.x,D.y,D.z),b.uniform2f(H.scale,w.x,w.y),b.uniform1f(H.rotation,A.rotation),b.uniform1f(H.opacity,A.opacity),b.uniform3f(H.color,A.color.r,A.color.g,A.color.b),c.setBlending(A.blending,
+A.blendEquation,A.blendSrc,A.blendDst),c.setTexture(A.texture,1),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0)}b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(!0)}}};
+THREE.ShadowMapPlugin=function(){var a,b,c,d,e=new THREE.Frustum,f=new THREE.Matrix4,g=new THREE.Vector3,h=new THREE.Vector3;this.init=function(e){a=e.context;b=e;var e=THREE.ShaderLib.depthRGBA,f=THREE.UniformsUtils.clone(e.uniforms);c=new THREE.ShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:f});d=new THREE.ShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:f,morphTargets:!0});c._shadowPass=!0;d._shadowPass=!0};this.render=function(a,
+c){b.shadowMapEnabled&&b.shadowMapAutoUpdate&&this.update(a,c)};this.update=function(i,j){var k,o,l,m,q,n,p,r,t,s=[];m=0;a.clearColor(1,1,1,1);a.disable(a.BLEND);b.shadowMapCullFrontFaces&&a.cullFace(a.FRONT);b.setDepthTest(!0);for(k=0,o=i.__lights.length;k<o;k++)if(l=i.__lights[k],l.castShadow)if(l instanceof THREE.DirectionalLight&&l.shadowCascade)for(q=0;q<l.shadowCascadeCount;q++){var u;if(l.shadowCascadeArray[q])u=l.shadowCascadeArray[q];else{t=l;p=q;u=new THREE.DirectionalLight;u.isVirtual=
+!0;u.onlyShadow=!0;u.castShadow=!0;u.shadowCameraNear=t.shadowCameraNear;u.shadowCameraFar=t.shadowCameraFar;u.shadowCameraLeft=t.shadowCameraLeft;u.shadowCameraRight=t.shadowCameraRight;u.shadowCameraBottom=t.shadowCameraBottom;u.shadowCameraTop=t.shadowCameraTop;u.shadowCameraVisible=t.shadowCameraVisible;u.shadowDarkness=t.shadowDarkness;u.shadowBias=t.shadowCascadeBias[p];u.shadowMapWidth=t.shadowCascadeWidth[p];u.shadowMapHeight=t.shadowCascadeHeight[p];u.pointsWorld=[];u.pointsFrustum=[];r=
+u.pointsWorld;n=u.pointsFrustum;for(var v=0;8>v;v++)r[v]=new THREE.Vector3,n[v]=new THREE.Vector3;r=t.shadowCascadeNearZ[p];t=t.shadowCascadeFarZ[p];n[0].set(-1,-1,r);n[1].set(1,-1,r);n[2].set(-1,1,r);n[3].set(1,1,r);n[4].set(-1,-1,t);n[5].set(1,-1,t);n[6].set(-1,1,t);n[7].set(1,1,t);u.originalCamera=j;n=new THREE.Gyroscope;n.position=l.shadowCascadeOffset;n.add(u);n.add(u.target);j.add(n);l.shadowCascadeArray[q]=u;console.log("Created virtualLight",u)}p=l;r=q;t=p.shadowCascadeArray[r];t.position.copy(p.position);
+t.target.position.copy(p.target.position);t.lookAt(t.target);t.shadowCameraVisible=p.shadowCameraVisible;t.shadowDarkness=p.shadowDarkness;t.shadowBias=p.shadowCascadeBias[r];n=p.shadowCascadeNearZ[r];p=p.shadowCascadeFarZ[r];t=t.pointsFrustum;t[0].z=n;t[1].z=n;t[2].z=n;t[3].z=n;t[4].z=p;t[5].z=p;t[6].z=p;t[7].z=p;s[m]=u;m++}else s[m]=l,m++;for(k=0,o=s.length;k<o;k++){l=s[k];if(!l.shadowMap)l.shadowMap=new THREE.WebGLRenderTarget(l.shadowMapWidth,l.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,
 format:THREE.RGBAFormat}),l.shadowMapSize=new THREE.Vector2(l.shadowMapWidth,l.shadowMapHeight),l.shadowMatrix=new THREE.Matrix4;if(!l.shadowCamera){if(l instanceof THREE.SpotLight)l.shadowCamera=new THREE.PerspectiveCamera(l.shadowCameraFov,l.shadowMapWidth/l.shadowMapHeight,l.shadowCameraNear,l.shadowCameraFar);else if(l instanceof THREE.DirectionalLight)l.shadowCamera=new THREE.OrthographicCamera(l.shadowCameraLeft,l.shadowCameraRight,l.shadowCameraTop,l.shadowCameraBottom,l.shadowCameraNear,l.shadowCameraFar);
-else{console.error("Unsupported light type for shadow");continue}i.add(l.shadowCamera);b.autoUpdateScene&&i.updateMatrixWorld()}if(l.shadowCameraVisible&&!l.cameraHelper)l.cameraHelper=new THREE.CameraHelper(l.shadowCamera),l.shadowCamera.add(l.cameraHelper);if(l.isVirtual&&t.originalCamera==j){r=j;m=l.shadowCamera;n=l.pointsFrustum;u=l.pointsWorld;g.set(Infinity,Infinity,Infinity);h.set(-Infinity,-Infinity,-Infinity);for(o=0;8>o;o++){q=u[o];q.copy(n[o]);THREE.ShadowMapPlugin.__projector.unprojectVector(q,
-r);m.matrixWorldInverse.multiplyVector3(q);if(q.x<g.x)g.x=q.x;if(q.x>h.x)h.x=q.x;if(q.y<g.y)g.y=q.y;if(q.y>h.y)h.y=q.y;if(q.z<g.z)g.z=q.z;if(q.z>h.z)h.z=q.z}m.left=g.x;m.right=h.x;m.top=h.y;m.bottom=g.y;m.updateProjectionMatrix()}m=l.shadowMap;n=l.shadowMatrix;r=l.shadowCamera;r.position.copy(l.matrixWorld.getPosition());r.lookAt(l.target.matrixWorld.getPosition());r.updateMatrixWorld();r.matrixWorldInverse.getInverse(r.matrixWorld);if(l.cameraHelper)l.cameraHelper.lines.visible=l.shadowCameraVisible;
-l.shadowCameraVisible&&l.cameraHelper.update();n.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);n.multiplySelf(r.projectionMatrix);n.multiplySelf(r.matrixWorldInverse);if(!r._viewMatrixArray)r._viewMatrixArray=new Float32Array(16);if(!r._projectionMatrixArray)r._projectionMatrixArray=new Float32Array(16);r.matrixWorldInverse.flattenToArray(r._viewMatrixArray);r.projectionMatrix.flattenToArray(r._projectionMatrixArray);e.multiply(r.projectionMatrix,r.matrixWorldInverse);f.setFromMatrix(e);b.setRenderTarget(m);
-b.clear();u=i.__webglObjects;for(l=0,m=u.length;l<m;l++)if(o=u[l],n=o.object,o.render=!1,n.visible&&n.castShadow&&(!(n instanceof THREE.Mesh)||!n.frustumCulled||f.contains(n)))n.matrixWorld.flattenToArray(n._objectMatrixArray),n._modelViewMatrix.multiplyToArray(r.matrixWorldInverse,n.matrixWorld,n._modelViewMatrixArray),o.render=!0;for(l=0,m=u.length;l<m;l++)if(o=u[l],o.render)n=o.object,o=o.buffer,b.setObjectFaces(n),q=n.customDepthMaterial?n.customDepthMaterial:n.geometry.morphTargets.length?d:
-c,o instanceof THREE.BufferGeometry?b.renderBufferDirect(r,i.__lights,null,q,o,n):b.renderBuffer(r,i.__lights,null,q,o,n);u=i.__webglObjectsImmediate;for(l=0,m=u.length;l<m;l++)o=u[l],n=o.object,n.visible&&n.castShadow&&(n.matrixAutoUpdate&&n.matrixWorld.flattenToArray(n._objectMatrixArray),n._modelViewMatrix.multiplyToArray(r.matrixWorldInverse,n.matrixWorld,n._modelViewMatrixArray),b.renderImmediateObject(r,i.__lights,null,c,n))}k=b.getClearColor();p=b.getClearAlpha();a.clearColor(k.r,k.g,k.b,p);
+else{console.error("Unsupported light type for shadow");continue}i.add(l.shadowCamera);b.autoUpdateScene&&i.updateMatrixWorld()}if(l.shadowCameraVisible&&!l.cameraHelper)l.cameraHelper=new THREE.CameraHelper(l.shadowCamera),l.shadowCamera.add(l.cameraHelper);if(l.isVirtual&&u.originalCamera==j){q=j;m=l.shadowCamera;n=l.pointsFrustum;t=l.pointsWorld;g.set(Infinity,Infinity,Infinity);h.set(-Infinity,-Infinity,-Infinity);for(p=0;8>p;p++){r=t[p];r.copy(n[p]);THREE.ShadowMapPlugin.__projector.unprojectVector(r,
+q);m.matrixWorldInverse.multiplyVector3(r);if(r.x<g.x)g.x=r.x;if(r.x>h.x)h.x=r.x;if(r.y<g.y)g.y=r.y;if(r.y>h.y)h.y=r.y;if(r.z<g.z)g.z=r.z;if(r.z>h.z)h.z=r.z}m.left=g.x;m.right=h.x;m.top=h.y;m.bottom=g.y;m.updateProjectionMatrix()}m=l.shadowMap;n=l.shadowMatrix;q=l.shadowCamera;q.position.copy(l.matrixWorld.getPosition());q.lookAt(l.target.matrixWorld.getPosition());q.updateMatrixWorld();q.matrixWorldInverse.getInverse(q.matrixWorld);if(l.cameraHelper)l.cameraHelper.lines.visible=l.shadowCameraVisible;
+l.shadowCameraVisible&&l.cameraHelper.update();n.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);n.multiplySelf(q.projectionMatrix);n.multiplySelf(q.matrixWorldInverse);if(!q._viewMatrixArray)q._viewMatrixArray=new Float32Array(16);if(!q._projectionMatrixArray)q._projectionMatrixArray=new Float32Array(16);q.matrixWorldInverse.flattenToArray(q._viewMatrixArray);q.projectionMatrix.flattenToArray(q._projectionMatrixArray);f.multiply(q.projectionMatrix,q.matrixWorldInverse);e.setFromMatrix(f);b.setRenderTarget(m);
+b.clear();t=i.__webglObjects;for(l=0,m=t.length;l<m;l++)if(p=t[l],n=p.object,p.render=!1,n.visible&&n.castShadow&&(!(n instanceof THREE.Mesh)||!n.frustumCulled||e.contains(n)))n.matrixWorld.flattenToArray(n._objectMatrixArray),n._modelViewMatrix.multiplyToArray(q.matrixWorldInverse,n.matrixWorld,n._modelViewMatrixArray),p.render=!0;for(l=0,m=t.length;l<m;l++)if(p=t[l],p.render)n=p.object,p=p.buffer,b.setObjectFaces(n),r=n.customDepthMaterial?n.customDepthMaterial:n.geometry.morphTargets.length?d:
+c,p instanceof THREE.BufferGeometry?b.renderBufferDirect(q,i.__lights,null,r,p,n):b.renderBuffer(q,i.__lights,null,r,p,n);t=i.__webglObjectsImmediate;for(l=0,m=t.length;l<m;l++)p=t[l],n=p.object,n.visible&&n.castShadow&&(n.matrixAutoUpdate&&n.matrixWorld.flattenToArray(n._objectMatrixArray),n._modelViewMatrix.multiplyToArray(q.matrixWorldInverse,n.matrixWorld,n._modelViewMatrixArray),b.renderImmediateObject(q,i.__lights,null,c,n))}k=b.getClearColor();o=b.getClearAlpha();a.clearColor(k.r,k.g,k.b,o);
 a.enable(a.BLEND);b.shadowMapCullFrontFaces&&a.cullFace(a.BACK)}};THREE.ShadowMapPlugin.__projector=new THREE.Projector;
-THREE.SpritePlugin=function(){function a(a,b){return b.z-a.z}var b,c,d,f,e,g,h,i,j,k;this.init=function(a){b=a.context;c=a;d=new Float32Array(16);f=new Uint16Array(6);a=0;d[a++]=-1;d[a++]=-1;d[a++]=0;d[a++]=1;d[a++]=1;d[a++]=-1;d[a++]=1;d[a++]=1;d[a++]=1;d[a++]=1;d[a++]=1;d[a++]=0;d[a++]=-1;d[a++]=1;d[a++]=0;a=d[a++]=0;f[a++]=0;f[a++]=1;f[a++]=2;f[a++]=0;f[a++]=2;f[a++]=3;e=b.createBuffer();g=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,e);b.bufferData(b.ARRAY_BUFFER,d,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,
-g);b.bufferData(b.ELEMENT_ARRAY_BUFFER,f,b.STATIC_DRAW);var a=THREE.ShaderSprite.sprite,l=b.createProgram(),m=b.createShader(b.FRAGMENT_SHADER),r=b.createShader(b.VERTEX_SHADER);b.shaderSource(m,a.fragmentShader);b.shaderSource(r,a.vertexShader);b.compileShader(m);b.compileShader(r);b.attachShader(l,m);b.attachShader(l,r);b.linkProgram(l);h=l;i={};j={};i.position=b.getAttribLocation(h,"position");i.uv=b.getAttribLocation(h,"uv");j.uvOffset=b.getUniformLocation(h,"uvOffset");j.uvScale=b.getUniformLocation(h,
+THREE.SpritePlugin=function(){function a(a,b){return b.z-a.z}var b,c,d,e,f,g,h,i,j,k;this.init=function(a){b=a.context;c=a;d=new Float32Array(16);e=new Uint16Array(6);a=0;d[a++]=-1;d[a++]=-1;d[a++]=0;d[a++]=1;d[a++]=1;d[a++]=-1;d[a++]=1;d[a++]=1;d[a++]=1;d[a++]=1;d[a++]=1;d[a++]=0;d[a++]=-1;d[a++]=1;d[a++]=0;a=d[a++]=0;e[a++]=0;e[a++]=1;e[a++]=2;e[a++]=0;e[a++]=2;e[a++]=3;f=b.createBuffer();g=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,f);b.bufferData(b.ARRAY_BUFFER,d,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,
+g);b.bufferData(b.ELEMENT_ARRAY_BUFFER,e,b.STATIC_DRAW);var a=THREE.ShaderSprite.sprite,l=b.createProgram(),m=b.createShader(b.FRAGMENT_SHADER),q=b.createShader(b.VERTEX_SHADER);b.shaderSource(m,a.fragmentShader);b.shaderSource(q,a.vertexShader);b.compileShader(m);b.compileShader(q);b.attachShader(l,m);b.attachShader(l,q);b.linkProgram(l);h=l;i={};j={};i.position=b.getAttribLocation(h,"position");i.uv=b.getAttribLocation(h,"uv");j.uvOffset=b.getUniformLocation(h,"uvOffset");j.uvScale=b.getUniformLocation(h,
 "uvScale");j.rotation=b.getUniformLocation(h,"rotation");j.scale=b.getUniformLocation(h,"scale");j.alignment=b.getUniformLocation(h,"alignment");j.color=b.getUniformLocation(h,"color");j.map=b.getUniformLocation(h,"map");j.opacity=b.getUniformLocation(h,"opacity");j.useScreenCoordinates=b.getUniformLocation(h,"useScreenCoordinates");j.affectedByDistance=b.getUniformLocation(h,"affectedByDistance");j.screenPosition=b.getUniformLocation(h,"screenPosition");j.modelViewMatrix=b.getUniformLocation(h,"modelViewMatrix");
-j.projectionMatrix=b.getUniformLocation(h,"projectionMatrix");k=!1};this.render=function(d,f,m,r){var d=d.__webglSprites,n=d.length;if(n){var o=i,q=j,u=r/m,m=0.5*m,s=0.5*r,t=!0;b.useProgram(h);k||(b.enableVertexAttribArray(o.position),b.enableVertexAttribArray(o.uv),k=!0);b.disable(b.CULL_FACE);b.enable(b.BLEND);b.depthMask(!0);b.bindBuffer(b.ARRAY_BUFFER,e);b.vertexAttribPointer(o.position,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(o.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.uniformMatrix4fv(q.projectionMatrix,
-!1,f._projectionMatrixArray);b.activeTexture(b.TEXTURE0);b.uniform1i(q.map,0);for(var v,w=[],o=0;o<n;o++)if(v=d[o],v.visible&&0!==v.opacity)v.useScreenCoordinates?v.z=-v.position.z:(v._modelViewMatrix.multiplyToArray(f.matrixWorldInverse,v.matrixWorld,v._modelViewMatrixArray),v.z=-v._modelViewMatrix.n34);d.sort(a);for(o=0;o<n;o++)v=d[o],v.visible&&0!==v.opacity&&v.map&&v.map.image&&v.map.image.width&&(v.useScreenCoordinates?(b.uniform1i(q.useScreenCoordinates,1),b.uniform3f(q.screenPosition,(v.position.x-
-m)/m,(s-v.position.y)/s,Math.max(0,Math.min(1,v.position.z)))):(b.uniform1i(q.useScreenCoordinates,0),b.uniform1i(q.affectedByDistance,v.affectedByDistance?1:0),b.uniformMatrix4fv(q.modelViewMatrix,!1,v._modelViewMatrixArray)),f=v.map.image.width/(v.scaleByViewport?r:1),w[0]=f*u*v.scale.x,w[1]=f*v.scale.y,b.uniform2f(q.uvScale,v.uvScale.x,v.uvScale.y),b.uniform2f(q.uvOffset,v.uvOffset.x,v.uvOffset.y),b.uniform2f(q.alignment,v.alignment.x,v.alignment.y),b.uniform1f(q.opacity,v.opacity),b.uniform3f(q.color,
-v.color.r,v.color.g,v.color.b),b.uniform1f(q.rotation,v.rotation),b.uniform2fv(q.scale,w),v.mergeWith3D&&!t?(b.enable(b.DEPTH_TEST),t=!0):!v.mergeWith3D&&t&&(b.disable(b.DEPTH_TEST),t=!1),c.setBlending(v.blending),c.setTexture(v.map,0),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0));b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(!0)}}};
-THREE.DepthPassPlugin=function(){this.enabled=!1;this.renderTarget=null;var a,b,c,d,f=new THREE.Frustum,e=new THREE.Matrix4;this.init=function(e){a=e.context;b=e;var e=THREE.ShaderLib.depthRGBA,f=THREE.UniformsUtils.clone(e.uniforms);c=new THREE.ShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:f});d=new THREE.ShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:f,morphTargets:!0});c._shadowPass=!0;d._shadowPass=!0};this.render=function(a,
-b){this.enabled&&this.update(a,b)};this.update=function(g,h){var i,j,k,p,l,m;a.clearColor(1,1,1,1);a.disable(a.BLEND);b.setDepthTest(!0);b.autoUpdateScene&&g.updateMatrixWorld();if(!h._viewMatrixArray)h._viewMatrixArray=new Float32Array(16);if(!h._projectionMatrixArray)h._projectionMatrixArray=new Float32Array(16);h.matrixWorldInverse.getInverse(h.matrixWorld);h.matrixWorldInverse.flattenToArray(h._viewMatrixArray);h.projectionMatrix.flattenToArray(h._projectionMatrixArray);e.multiply(h.projectionMatrix,
-h.matrixWorldInverse);f.setFromMatrix(e);b.setRenderTarget(this.renderTarget);b.clear();m=g.__webglObjects;for(i=0,j=m.length;i<j;i++)if(k=m[i],l=k.object,k.render=!1,l.visible&&(!(l instanceof THREE.Mesh)||!l.frustumCulled||f.contains(l)))l.matrixWorld.flattenToArray(l._objectMatrixArray),l._modelViewMatrix.multiplyToArray(h.matrixWorldInverse,l.matrixWorld,l._modelViewMatrixArray),k.render=!0;for(i=0,j=m.length;i<j;i++)if(k=m[i],k.render)l=k.object,k=k.buffer,b.setObjectFaces(l),p=l.customDepthMaterial?
-l.customDepthMaterial:l.geometry.morphTargets.length?d:c,k instanceof THREE.BufferGeometry?b.renderBufferDirect(h,g.__lights,null,p,k,l):b.renderBuffer(h,g.__lights,null,p,k,l);m=g.__webglObjectsImmediate;for(i=0,j=m.length;i<j;i++)k=m[i],l=k.object,l.visible&&l.castShadow&&(l.matrixAutoUpdate&&l.matrixWorld.flattenToArray(l._objectMatrixArray),l._modelViewMatrix.multiplyToArray(h.matrixWorldInverse,l.matrixWorld,l._modelViewMatrixArray),b.renderImmediateObject(h,g.__lights,null,c,l));i=b.getClearColor();
+j.projectionMatrix=b.getUniformLocation(h,"projectionMatrix");k=!1};this.render=function(d,e,m,q){var d=d.__webglSprites,n=d.length;if(n){var p=i,r=j,t=q/m,m=0.5*m,s=0.5*q,u=!0;b.useProgram(h);k||(b.enableVertexAttribArray(p.position),b.enableVertexAttribArray(p.uv),k=!0);b.disable(b.CULL_FACE);b.enable(b.BLEND);b.depthMask(!0);b.bindBuffer(b.ARRAY_BUFFER,f);b.vertexAttribPointer(p.position,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(p.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.uniformMatrix4fv(r.projectionMatrix,
+!1,e._projectionMatrixArray);b.activeTexture(b.TEXTURE0);b.uniform1i(r.map,0);for(var v,x=[],p=0;p<n;p++)if(v=d[p],v.visible&&0!==v.opacity)v.useScreenCoordinates?v.z=-v.position.z:(v._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,v.matrixWorld,v._modelViewMatrixArray),v.z=-v._modelViewMatrix.n34);d.sort(a);for(p=0;p<n;p++)v=d[p],v.visible&&0!==v.opacity&&v.map&&v.map.image&&v.map.image.width&&(v.useScreenCoordinates?(b.uniform1i(r.useScreenCoordinates,1),b.uniform3f(r.screenPosition,(v.position.x-
+m)/m,(s-v.position.y)/s,Math.max(0,Math.min(1,v.position.z)))):(b.uniform1i(r.useScreenCoordinates,0),b.uniform1i(r.affectedByDistance,v.affectedByDistance?1:0),b.uniformMatrix4fv(r.modelViewMatrix,!1,v._modelViewMatrixArray)),e=v.map.image.width/(v.scaleByViewport?q:1),x[0]=e*t*v.scale.x,x[1]=e*v.scale.y,b.uniform2f(r.uvScale,v.uvScale.x,v.uvScale.y),b.uniform2f(r.uvOffset,v.uvOffset.x,v.uvOffset.y),b.uniform2f(r.alignment,v.alignment.x,v.alignment.y),b.uniform1f(r.opacity,v.opacity),b.uniform3f(r.color,
+v.color.r,v.color.g,v.color.b),b.uniform1f(r.rotation,v.rotation),b.uniform2fv(r.scale,x),v.mergeWith3D&&!u?(b.enable(b.DEPTH_TEST),u=!0):!v.mergeWith3D&&u&&(b.disable(b.DEPTH_TEST),u=!1),c.setBlending(v.blending,v.blendEquation,v.blendSrc,v.blendDst),c.setTexture(v.map,0),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0));b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(!0)}}};
+THREE.DepthPassPlugin=function(){this.enabled=!1;this.renderTarget=null;var a,b,c,d,e=new THREE.Frustum,f=new THREE.Matrix4;this.init=function(e){a=e.context;b=e;var e=THREE.ShaderLib.depthRGBA,f=THREE.UniformsUtils.clone(e.uniforms);c=new THREE.ShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:f});d=new THREE.ShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:f,morphTargets:!0});c._shadowPass=!0;d._shadowPass=!0};this.render=function(a,
+b){this.enabled&&this.update(a,b)};this.update=function(g,h){var i,j,k,o,l,m;a.clearColor(1,1,1,1);a.disable(a.BLEND);b.setDepthTest(!0);b.autoUpdateScene&&g.updateMatrixWorld();if(!h._viewMatrixArray)h._viewMatrixArray=new Float32Array(16);if(!h._projectionMatrixArray)h._projectionMatrixArray=new Float32Array(16);h.matrixWorldInverse.getInverse(h.matrixWorld);h.matrixWorldInverse.flattenToArray(h._viewMatrixArray);h.projectionMatrix.flattenToArray(h._projectionMatrixArray);f.multiply(h.projectionMatrix,
+h.matrixWorldInverse);e.setFromMatrix(f);b.setRenderTarget(this.renderTarget);b.clear();m=g.__webglObjects;for(i=0,j=m.length;i<j;i++)if(k=m[i],l=k.object,k.render=!1,l.visible&&(!(l instanceof THREE.Mesh)||!l.frustumCulled||e.contains(l)))l.matrixWorld.flattenToArray(l._objectMatrixArray),l._modelViewMatrix.multiplyToArray(h.matrixWorldInverse,l.matrixWorld,l._modelViewMatrixArray),k.render=!0;for(i=0,j=m.length;i<j;i++)if(k=m[i],k.render)l=k.object,k=k.buffer,b.setObjectFaces(l),o=l.customDepthMaterial?
+l.customDepthMaterial:l.geometry.morphTargets.length?d:c,k instanceof THREE.BufferGeometry?b.renderBufferDirect(h,g.__lights,null,o,k,l):b.renderBuffer(h,g.__lights,null,o,k,l);m=g.__webglObjectsImmediate;for(i=0,j=m.length;i<j;i++)k=m[i],l=k.object,l.visible&&l.castShadow&&(l.matrixAutoUpdate&&l.matrixWorld.flattenToArray(l._objectMatrixArray),l._modelViewMatrix.multiplyToArray(h.matrixWorldInverse,l.matrixWorld,l._modelViewMatrixArray),b.renderImmediateObject(h,g.__lights,null,c,l));i=b.getClearColor();
 j=b.getClearAlpha();a.clearColor(i.r,i.g,i.b,j);a.enable(a.BLEND)}};
-if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoUpdateScene=!1;var b=this,c=this.setSize,d=this.render,f=new THREE.PerspectiveCamera,e=new THREE.PerspectiveCamera,g=new THREE.Matrix4,h=new THREE.Matrix4,i,j,k,p;f.matrixAutoUpdate=e.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},l=new THREE.WebGLRenderTarget(512,512,a),m=new THREE.WebGLRenderTarget(512,512,a),r=new THREE.PerspectiveCamera(53,
-1,1,1E4);r.position.z=2;var a=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:l},mapRight:{type:"t",value:1,texture:m}},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}"}),
-n=new THREE.Scene,a=new THREE.Mesh(new THREE.PlaneGeometry(2,2),a);a.rotation.x=Math.PI/2;n.add(a);n.add(r);this.setSize=function(a,d){c.call(b,a,d);l.width=a;l.height=d;m.width=a;m.height=d};this.render=function(a,c){a.updateMatrixWorld();if(i!==c.aspect||j!==c.near||k!==c.far||p!==c.fov){i=c.aspect;j=c.near;k=c.far;p=c.fov;var u=c.projectionMatrix.clone(),s=0.5*(125/30),t=s*j/125,v=j*Math.tan(p*Math.PI/360),w;g.n14=s;h.n14=-s;s=-v*i+t;w=v*i+t;u.n11=2*j/(w-s);u.n13=(w+s)/(w-s);f.projectionMatrix.copy(u);
-s=-v*i-t;w=v*i-t;u.n11=2*j/(w-s);u.n13=(w+s)/(w-s);e.projectionMatrix.copy(u)}f.matrixWorld.copy(c.matrixWorld).multiplySelf(h);f.position.copy(c.position);f.near=c.near;f.far=c.far;d.call(b,a,f,l,!0);e.matrixWorld.copy(c.matrixWorld).multiplySelf(g);e.position.copy(c.position);e.near=c.near;e.far=c.far;d.call(b,a,e,m,!0);n.updateMatrixWorld();d.call(b,n,r)}};
-if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoClear=!1;var b=this,c=this.setSize,d=this.render,f,e,g=new THREE.PerspectiveCamera;g.target=new THREE.Vector3(0,0,0);var h=new THREE.PerspectiveCamera;h.target=new THREE.Vector3(0,0,0);b.separation=10;if(a&&void 0!==a.separation)b.separation=a.separation;this.setSize=function(a,d){c.call(b,a,d);f=a/2;e=d};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);h.projectionMatrix=g.projectionMatrix;h.position.copy(c.position);h.target.copy(c.target);h.translateX(-b.separation);h.lookAt(h.target);this.setViewport(0,0,f,e);d.call(b,a,g);this.setViewport(f,0,f,e);d.call(b,a,h,!1)}};
+if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoUpdateScene=!1;var b=this,c=this.setSize,d=this.render,e=new THREE.PerspectiveCamera,f=new THREE.PerspectiveCamera,g=new THREE.Matrix4,h=new THREE.Matrix4,i,j,k,o;e.matrixAutoUpdate=f.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},l=new THREE.WebGLRenderTarget(512,512,a),m=new THREE.WebGLRenderTarget(512,512,a),q=new THREE.PerspectiveCamera(53,
+1,1,1E4);q.position.z=2;var a=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:l},mapRight:{type:"t",value:1,texture:m}},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}"}),
+n=new THREE.Scene,a=new THREE.Mesh(new THREE.PlaneGeometry(2,2),a);a.rotation.x=Math.PI/2;n.add(a);n.add(q);this.setSize=function(a,d){c.call(b,a,d);l.width=a;l.height=d;m.width=a;m.height=d};this.render=function(a,c){a.updateMatrixWorld();if(i!==c.aspect||j!==c.near||k!==c.far||o!==c.fov){i=c.aspect;j=c.near;k=c.far;o=c.fov;var t=c.projectionMatrix.clone(),s=0.5*(125/30),u=s*j/125,v=j*Math.tan(o*Math.PI/360),x;g.n14=s;h.n14=-s;s=-v*i+u;x=v*i+u;t.n11=2*j/(x-s);t.n13=(x+s)/(x-s);e.projectionMatrix.copy(t);
+s=-v*i-u;x=v*i-u;t.n11=2*j/(x-s);t.n13=(x+s)/(x-s);f.projectionMatrix.copy(t)}e.matrixWorld.copy(c.matrixWorld).multiplySelf(h);e.position.copy(c.position);e.near=c.near;e.far=c.far;d.call(b,a,e,l,!0);f.matrixWorld.copy(c.matrixWorld).multiplySelf(g);f.position.copy(c.position);f.near=c.near;f.far=c.far;d.call(b,a,f,m,!0);n.updateMatrixWorld();d.call(b,n,q)}};
+if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoClear=!1;var b=this,c=this.setSize,d=this.render,e,f,g=new THREE.PerspectiveCamera;g.target=new THREE.Vector3(0,0,0);var h=new THREE.PerspectiveCamera;h.target=new THREE.Vector3(0,0,0);b.separation=10;if(a&&void 0!==a.separation)b.separation=a.separation;this.setSize=function(a,d){c.call(b,a,d);e=a/2;f=d};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);h.projectionMatrix=g.projectionMatrix;h.position.copy(c.position);h.target.copy(c.target);h.translateX(-b.separation);h.lookAt(h.target);this.setViewport(0,0,e,f);d.call(b,a,g);this.setViewport(e,0,e,f);d.call(b,a,h,!1)}};
 THREE.ShaderFlares={lensFlareVertexTexture:{vertexShader:"uniform vec3 screenPosition;\nuniform vec2 scale;\nuniform float rotation;\nuniform int renderType;\nuniform sampler2D occlusionMap;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nvUV = uv;\nvec2 pos = position;\nif( renderType == 2 ) {\nvec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.5 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.1, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.1, 0.5 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.5 ) );\nvVisibility = (       visibility.r / 9.0 ) *\n( 1.0 - visibility.g / 9.0 ) *\n(       visibility.b / 9.0 ) *\n( 1.0 - visibility.a / 9.0 );\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",fragmentShader:"precision mediump float;\nuniform sampler2D map;\nuniform float opacity;\nuniform int renderType;\nuniform vec3 color;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nif( renderType == 0 ) {\ngl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );\n} else if( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nvec4 texture = texture2D( map, vUV );\ntexture.a *= opacity * vVisibility;\ngl_FragColor = texture;\ngl_FragColor.rgb *= color;\n}\n}"},
 lensFlare:{vertexShader:"uniform vec3 screenPosition;\nuniform vec2 scale;\nuniform float rotation;\nuniform int renderType;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvoid main() {\nvUV = uv;\nvec2 pos = position;\nif( renderType == 2 ) {\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",fragmentShader:"precision mediump float;\nuniform sampler2D map;\nuniform sampler2D occlusionMap;\nuniform float opacity;\nuniform int renderType;\nuniform vec3 color;\nvarying vec2 vUV;\nvoid main() {\nif( renderType == 0 ) {\ngl_FragColor = vec4( texture2D( map, vUV ).rgb, 0.0 );\n} else if( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nfloat visibility = texture2D( occlusionMap, vec2( 0.5, 0.1 ) ).a +\ntexture2D( occlusionMap, vec2( 0.9, 0.5 ) ).a +\ntexture2D( occlusionMap, vec2( 0.5, 0.9 ) ).a +\ntexture2D( occlusionMap, vec2( 0.1, 0.5 ) ).a;\nvisibility = ( 1.0 - visibility / 4.0 );\nvec4 texture = texture2D( map, vUV );\ntexture.a *= opacity * visibility;\ngl_FragColor = texture;\ngl_FragColor.rgb *= color;\n}\n}"}};
 THREE.ShaderSprite={sprite:{vertexShader:"uniform int useScreenCoordinates;\nuniform int affectedByDistance;\nuniform vec3 screenPosition;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform float rotation;\nuniform vec2 scale;\nuniform vec2 alignment;\nuniform vec2 uvOffset;\nuniform vec2 uvScale;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvoid main() {\nvUV = uvOffset + uv * uvScale;\nvec2 alignedPosition = position + alignment;\nvec2 rotatedPosition;\nrotatedPosition.x = ( cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y ) * scale.x;\nrotatedPosition.y = ( sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y ) * scale.y;\nvec4 finalPosition;\nif( useScreenCoordinates != 0 ) {\nfinalPosition = vec4( screenPosition.xy + rotatedPosition, screenPosition.z, 1.0 );\n} else {\nfinalPosition = projectionMatrix * modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\nfinalPosition.xy += rotatedPosition * ( affectedByDistance == 1 ? 1.0 : finalPosition.z );\n}\ngl_Position = finalPosition;\n}",

+ 72 - 70
build/custom/ThreeSVG.js

@@ -13,49 +13,49 @@ THREE.Vector3.prototype={constructor:THREE.Vector3,set:function(a,b,c){this.x=a;
 sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;return this},multiply:function(a,b){this.x=a.x*b.x;this.y=a.y*b.y;this.z=a.z*b.z;return this},multiplySelf:function(a){this.x*=a.x;this.y*=a.y;this.z*=a.z;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;return this},divideSelf:function(a){this.x/=a.x;this.y/=a.y;this.z/=a.z;return this},divideScalar:function(a){a?(this.x/=a,this.y/=a,this.z/=a):
 this.z=this.y=this.x=0;return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.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 Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},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;return this},cross:function(a,b){this.x=a.y*b.z-a.z*b.y;this.y=a.z*b.x-a.x*b.z;this.z=a.x*b.y-a.y*b.x;return this},crossSelf:function(a){var b=this.x,c=this.y,d=this.z;this.x=c*a.z-d*a.y;this.y=d*a.x-b*a.z;this.z=b*a.y-c*a.x;return this},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){return(new THREE.Vector3).sub(this,a).lengthSq()},getPositionFromMatrix:function(a){this.x=a.n14;this.y=
-a.n24;this.z=a.n34;return this},getRotationFromMatrix:function(a,b){var c=b?b.x:1,d=b?b.y:1,e=b?b.z:1,f=a.n11/c,g=a.n12/d,c=a.n21/c,d=a.n22/d,h=a.n23/e,j=a.n33/e;this.y=Math.asin(a.n13/e);e=Math.cos(this.y);1.0E-5<Math.abs(e)?(this.x=Math.atan2(-h/e,j/e),this.z=Math.atan2(-g/e,f/e)):(this.x=0,this.z=Math.atan2(c,d));return this},getScaleFromMatrix:function(a){var b=this.set(a.n11,a.n21,a.n31).length(),c=this.set(a.n12,a.n22,a.n32).length(),a=this.set(a.n13,a.n23,a.n33).length();this.x=b;this.y=c;
+a.n24;this.z=a.n34;return this},getRotationFromMatrix:function(a,b){var c=b?b.x:1,d=b?b.y:1,e=b?b.z:1,f=a.n11/c,g=a.n12/d,c=a.n21/c,d=a.n22/d,i=a.n23/e,j=a.n33/e;this.y=Math.asin(a.n13/e);e=Math.cos(this.y);1.0E-5<Math.abs(e)?(this.x=Math.atan2(-i/e,j/e),this.z=Math.atan2(-g/e,f/e)):(this.x=0,this.z=Math.atan2(c,d));return this},getScaleFromMatrix:function(a){var b=this.set(a.n11,a.n21,a.n31).length(),c=this.set(a.n12,a.n22,a.n32).length(),a=this.set(a.n13,a.n23,a.n33).length();this.x=b;this.y=c;
 this.z=a},equals:function(a){return a.x===this.x&&a.y===this.y&&a.z===this.z},isZero:function(){return 1.0E-4>this.lengthSq()},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};THREE.Vector4=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=void 0!==d?d:1};
 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=void 0!==a.w?a.w:1;return this},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},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Frustum=function(){this.planes=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4]};
 THREE.Frustum.prototype.setFromMatrix=function(a){var b,c=this.planes;c[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);c[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);c[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+a.n23,a.n44+a.n24);c[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);c[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);c[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+a.n33,a.n44+a.n34);for(a=0;6>a;a++)b=c[a],b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))};
 THREE.Frustum.prototype.contains=function(a){for(var b=this.planes,c=a.matrixWorld,d=THREE.Frustum.__v1.set(c.getColumnX().length(),c.getColumnY().length(),c.getColumnZ().length()),d=-a.geometry.boundingSphere.radius*Math.max(d.x,Math.max(d.y,d.z)),e=0;6>e;e++)if(a=b[e].x*c.n14+b[e].y*c.n24+b[e].z*c.n34+b[e].w,a<=d)return!1;return!0};THREE.Frustum.__v1=new THREE.Vector3;
-THREE.Ray=function(a,b){function c(a,b,c){o.sub(c,a);H=o.dot(b);w=p.add(a,u.copy(b).multiplyScalar(H));return C=c.distanceTo(w)}function d(a,b,c,d){o.sub(d,b);p.sub(c,b);u.sub(a,b);s=o.dot(o);t=o.dot(p);y=o.dot(u);x=p.dot(p);z=p.dot(u);D=1/(s*x-t*t);B=(x*y-t*z)*D;E=(s*z-t*y)*D;return 0<=B&&0<=E&&1>B+E}this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3;var e=1.0E-4;this.setPrecision=function(a){e=a};var f=new THREE.Vector3,g=new THREE.Vector3,h=new THREE.Vector3,j=new THREE.Vector3,
-i=new THREE.Vector3,k=new THREE.Vector3,l=new THREE.Vector3,n=new THREE.Vector3,m=new THREE.Vector3;this.intersectObject=function(a){var b,o=[];if(a instanceof THREE.Particle){var p=c(this.origin,this.direction,a.matrixWorld.getPosition());if(p>a.scale.x)return[];b={distance:p,point:a.position,face:null,object:a};o.push(b)}else if(a instanceof THREE.Mesh){var p=c(this.origin,this.direction,a.matrixWorld.getPosition()),N=THREE.Frustum.__v1.set(a.matrixWorld.getColumnX().length(),a.matrixWorld.getColumnY().length(),
-a.matrixWorld.getColumnZ().length());if(p>a.geometry.boundingSphere.radius*Math.max(N.x,Math.max(N.y,N.z)))return o;var s,t,u=a.geometry,r=u.vertices,q;a.matrixRotationWorld.extractRotation(a.matrixWorld);for(p=0,N=u.faces.length;p<N;p++)if(b=u.faces[p],i.copy(this.origin),k.copy(this.direction),q=a.matrixWorld,l=q.multiplyVector3(l.copy(b.centroid)).subSelf(i),n=a.matrixRotationWorld.multiplyVector3(n.copy(b.normal)),s=k.dot(n),!(Math.abs(s)<e)&&(t=n.dot(l)/s,!(0>t)&&(a.doubleSided||(a.flipSided?
-0<s:0>s))))if(m.add(i,k.multiplyScalar(t)),b instanceof THREE.Face3)f=q.multiplyVector3(f.copy(r[b.a].position)),g=q.multiplyVector3(g.copy(r[b.b].position)),h=q.multiplyVector3(h.copy(r[b.c].position)),d(m,f,g,h)&&(b={distance:i.distanceTo(m),point:m.clone(),face:b,object:a},o.push(b));else if(b instanceof THREE.Face4&&(f=q.multiplyVector3(f.copy(r[b.a].position)),g=q.multiplyVector3(g.copy(r[b.b].position)),h=q.multiplyVector3(h.copy(r[b.c].position)),j=q.multiplyVector3(j.copy(r[b.d].position)),
-d(m,f,g,j)||d(m,g,h,j)))b={distance:i.distanceTo(m),point:m.clone(),face:b,object:a},o.push(b)}return o};this.intersectObjects=function(a){for(var b=[],c=0,d=a.length;c<d;c++)Array.prototype.push.apply(b,this.intersectObject(a[c]));b.sort(function(a,b){return a.distance-b.distance});return b};var o=new THREE.Vector3,p=new THREE.Vector3,u=new THREE.Vector3,H,w,C,s,t,y,x,z,D,B,E};
-THREE.Rectangle=function(){function a(){f=d-b;g=e-c}var b,c,d,e,f,g,h=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return f};this.getHeight=function(){return g};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return e};this.set=function(f,g,k,l){h=!1;b=f;c=g;d=k;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,k,l,n,m){h?(h=!1,b=f<k?f<n?f:n:k<n?k:n,c=g<l?g<m?g:m:l<m?l:m,d=f>k?f>n?f:n:k>n?k:n,e=g>l?g>m?g:m:l>m?l:m):(b=f<k?f<n?f<b?f:b:n<b?n:b:k<n?k<b?k: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>k?f>n?f>d?f:d:n>d?n:d:k>n?k>d?k: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>
-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 d<a.getLeft()||b>a.getRight()||e<a.getTop()||c>a.getBottom()?!1:!0};this.empty=function(){h=!0;e=d=c=b=0;a()};this.isEmpty=function(){return h}};
+THREE.Ray=function(a,b){function c(a,b,c){o.sub(c,a);H=o.dot(b);w=p.add(a,u.copy(b).multiplyScalar(H));return C=c.distanceTo(w)}function d(a,b,c,d){o.sub(d,b);p.sub(c,b);u.sub(a,b);s=o.dot(o);t=o.dot(p);y=o.dot(u);x=p.dot(p);z=p.dot(u);D=1/(s*x-t*t);B=(x*y-t*z)*D;E=(s*z-t*y)*D;return 0<=B&&0<=E&&1>B+E}this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3;var e=1.0E-4;this.setPrecision=function(a){e=a};var f=new THREE.Vector3,g=new THREE.Vector3,i=new THREE.Vector3,j=new THREE.Vector3,
+h=new THREE.Vector3,k=new THREE.Vector3,m=new THREE.Vector3,n=new THREE.Vector3,l=new THREE.Vector3;this.intersectObject=function(a){var b,o=[];if(a instanceof THREE.Particle){var p=c(this.origin,this.direction,a.matrixWorld.getPosition());if(p>a.scale.x)return[];b={distance:p,point:a.position,face:null,object:a};o.push(b)}else if(a instanceof THREE.Mesh){var p=c(this.origin,this.direction,a.matrixWorld.getPosition()),N=THREE.Frustum.__v1.set(a.matrixWorld.getColumnX().length(),a.matrixWorld.getColumnY().length(),
+a.matrixWorld.getColumnZ().length());if(p>a.geometry.boundingSphere.radius*Math.max(N.x,Math.max(N.y,N.z)))return o;var s,t,u=a.geometry,r=u.vertices,q;a.matrixRotationWorld.extractRotation(a.matrixWorld);for(p=0,N=u.faces.length;p<N;p++)if(b=u.faces[p],h.copy(this.origin),k.copy(this.direction),q=a.matrixWorld,m=q.multiplyVector3(m.copy(b.centroid)).subSelf(h),n=a.matrixRotationWorld.multiplyVector3(n.copy(b.normal)),s=k.dot(n),!(Math.abs(s)<e)&&(t=n.dot(m)/s,!(0>t)&&(a.doubleSided||(a.flipSided?
+0<s:0>s))))if(l.add(h,k.multiplyScalar(t)),b instanceof THREE.Face3)f=q.multiplyVector3(f.copy(r[b.a].position)),g=q.multiplyVector3(g.copy(r[b.b].position)),i=q.multiplyVector3(i.copy(r[b.c].position)),d(l,f,g,i)&&(b={distance:h.distanceTo(l),point:l.clone(),face:b,object:a},o.push(b));else if(b instanceof THREE.Face4&&(f=q.multiplyVector3(f.copy(r[b.a].position)),g=q.multiplyVector3(g.copy(r[b.b].position)),i=q.multiplyVector3(i.copy(r[b.c].position)),j=q.multiplyVector3(j.copy(r[b.d].position)),
+d(l,f,g,j)||d(l,g,i,j)))b={distance:h.distanceTo(l),point:l.clone(),face:b,object:a},o.push(b)}return o};this.intersectObjects=function(a){for(var b=[],c=0,d=a.length;c<d;c++)Array.prototype.push.apply(b,this.intersectObject(a[c]));b.sort(function(a,b){return a.distance-b.distance});return b};var o=new THREE.Vector3,p=new THREE.Vector3,u=new THREE.Vector3,H,w,C,s,t,y,x,z,D,B,E};
+THREE.Rectangle=function(){function a(){f=d-b;g=e-c}var b,c,d,e,f,g,i=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return f};this.getHeight=function(){return g};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return e};this.set=function(f,h,g,m){i=!1;b=f;c=h;d=g;e=m;a()};this.addPoint=function(f,h){i?(i=!1,b=f,c=h,d=f,e=h):(b=b<f?b:f,c=c<h?c:h,d=d>f?d:f,e=e>h?e:h);a()};this.add3Points=
+function(f,h,g,m,n,l){i?(i=!1,b=f<g?f<n?f:n:g<n?g:n,c=h<m?h<l?h:l:m<l?m:l,d=f>g?f>n?f:n:g>n?g:n,e=h>m?h>l?h:l:m>l?m:l):(b=f<g?f<n?f<b?f:b:n<b?n:b:g<n?g<b?g:b:n<b?n:b,c=h<m?h<l?h<c?h:c:l<c?l:c:m<l?m<c?m:c:l<c?l:c,d=f>g?f>n?f>d?f:d:n>d?n:d:g>n?g>d?g:d:n>d?n:d,e=h>m?h>l?h>e?h:e:l>e?l:e:m>l?m>e?m:e:l>e?l:e);a()};this.addRectangle=function(f){i?(i=!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 d<a.getLeft()||b>a.getRight()||e<a.getTop()||c>a.getBottom()?!1:!0};this.empty=function(){i=!0;e=d=c=b=0;a()};this.isEmpty=function(){return i}};
 THREE.Math={clamp:function(a,b,c){return a<b?b:a>c?c:a},clampBottom:function(a,b){return a<b?b:a},mapLinear:function(a,b,c,d,e){return d+(a-b)*(e-d)/(c-b)},random16:function(){return(65280*Math.random()+255*Math.random())/65535},randInt:function(a,b){return a+Math.floor(Math.random()*(b-a+1))},randFloat:function(a,b){return a+Math.random()*(b-a)},randFloatSpread:function(a){return a*(0.5-Math.random())},sign:function(a){return 0>a?-1:0<a?1:0}};THREE.Matrix3=function(){this.m=[]};
-THREE.Matrix3.prototype={constructor:THREE.Matrix3,transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}};THREE.Matrix4=function(a,b,c,d,e,f,g,h,j,i,k,l,n,m,o,p){this.set(void 0!==a?a:1,b||0,c||0,d||0,e||0,void 0!==f?f:1,g||0,h||0,j||0,i||0,void 0!==k?k:1,l||0,n||0,m||0,o||0,void 0!==p?p:1);this.m33=new THREE.Matrix3};
-THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,e,f,g,h,j,i,k,l,n,m,o,p){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=e;this.n22=f;this.n23=g;this.n24=h;this.n31=j;this.n32=i;this.n33=k;this.n34=l;this.n41=n;this.n42=m;this.n43=o;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,e=THREE.Matrix4.__v2,f=THREE.Matrix4.__v3;f.sub(a,b).normalize();if(0===f.length())f.z=1;d.cross(c,f).normalize();0===d.length()&&(f.x+=1.0E-4,d.cross(c,f).normalize());e.cross(f,d);this.n11=d.x;this.n12=e.x;this.n13=f.x;this.n21=d.y;this.n22=e.y;this.n23=f.y;this.n31=d.z;this.n32=e.z;this.n33=f.z;return this},multiply:function(a,b){var c=a.n11,d=a.n12,e=a.n13,f=a.n14,g=a.n21,h=a.n22,j=a.n23,i=a.n24,k=a.n31,l=a.n32,n=a.n33,m=a.n34,o=a.n41,p=a.n42,u=a.n43,H=a.n44,w=b.n11,
-C=b.n12,s=b.n13,t=b.n14,y=b.n21,x=b.n22,z=b.n23,D=b.n24,B=b.n31,E=b.n32,A=b.n33,L=b.n34,P=b.n41,M=b.n42,N=b.n43,T=b.n44;this.n11=c*w+d*y+e*B+f*P;this.n12=c*C+d*x+e*E+f*M;this.n13=c*s+d*z+e*A+f*N;this.n14=c*t+d*D+e*L+f*T;this.n21=g*w+h*y+j*B+i*P;this.n22=g*C+h*x+j*E+i*M;this.n23=g*s+h*z+j*A+i*N;this.n24=g*t+h*D+j*L+i*T;this.n31=k*w+l*y+n*B+m*P;this.n32=k*C+l*x+n*E+m*M;this.n33=k*s+l*z+n*A+m*N;this.n34=k*t+l*D+n*L+m*T;this.n41=o*w+p*y+u*B+H*P;this.n42=o*C+p*x+u*E+H*M;this.n43=o*s+p*z+u*A+H*N;this.n44=
+THREE.Matrix3.prototype={constructor:THREE.Matrix3,getInverse:function(a){var b=a.n33*a.n22-a.n32*a.n23,c=-a.n33*a.n21+a.n31*a.n23,d=a.n32*a.n21-a.n31*a.n22,e=-a.n33*a.n12+a.n32*a.n13,f=a.n33*a.n11-a.n31*a.n13,g=-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,h=a.n22*a.n11-a.n21*a.n12,a=a.n11*b+a.n21*e+a.n31*i;0===a&&console.warn("Matrix3.getInverse(): determinant == 0");var a=1/a,k=this.m;k[0]=a*b;k[1]=a*c;k[2]=a*d;k[3]=a*e;k[4]=a*f;k[5]=a*g;k[6]=a*i;k[7]=a*j;k[8]=a*
+h;return this},transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}};THREE.Matrix4=function(a,b,c,d,e,f,g,i,j,h,k,m,n,l,o,p){this.set(void 0!==a?a:1,b||0,c||0,d||0,e||0,void 0!==f?f:1,g||0,i||0,j||0,h||0,void 0!==k?k:1,m||0,n||0,l||0,o||0,void 0!==p?p:1)};
+THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,e,f,g,i,j,h,k,m,n,l,o,p){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=e;this.n22=f;this.n23=g;this.n24=i;this.n31=j;this.n32=h;this.n33=k;this.n34=m;this.n41=n;this.n42=l;this.n43=o;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,e=THREE.Matrix4.__v2,f=THREE.Matrix4.__v3;f.sub(a,b).normalize();if(0===f.length())f.z=1;d.cross(c,f).normalize();0===d.length()&&(f.x+=1.0E-4,d.cross(c,f).normalize());e.cross(f,d);this.n11=d.x;this.n12=e.x;this.n13=f.x;this.n21=d.y;this.n22=e.y;this.n23=f.y;this.n31=d.z;this.n32=e.z;this.n33=f.z;return this},multiply:function(a,b){var c=a.n11,d=a.n12,e=a.n13,f=a.n14,g=a.n21,i=a.n22,j=a.n23,h=a.n24,k=a.n31,m=a.n32,n=a.n33,l=a.n34,o=a.n41,p=a.n42,u=a.n43,H=a.n44,w=b.n11,
+C=b.n12,s=b.n13,t=b.n14,y=b.n21,x=b.n22,z=b.n23,D=b.n24,B=b.n31,E=b.n32,A=b.n33,L=b.n34,P=b.n41,M=b.n42,N=b.n43,T=b.n44;this.n11=c*w+d*y+e*B+f*P;this.n12=c*C+d*x+e*E+f*M;this.n13=c*s+d*z+e*A+f*N;this.n14=c*t+d*D+e*L+f*T;this.n21=g*w+i*y+j*B+h*P;this.n22=g*C+i*x+j*E+h*M;this.n23=g*s+i*z+j*A+h*N;this.n24=g*t+i*D+j*L+h*T;this.n31=k*w+m*y+n*B+l*P;this.n32=k*C+m*x+n*E+l*M;this.n33=k*s+m*z+n*A+l*N;this.n34=k*t+m*D+n*L+l*T;this.n41=o*w+p*y+u*B+H*P;this.n42=o*C+p*x+u*E+H*M;this.n43=o*s+p*z+u*A+H*N;this.n44=
 o*t+p*D+u*L+H*T;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,f=this.n22,g=this.n23,h=this.n24,j=this.n31,i=this.n32,k=this.n33,l=this.n34,n=this.n41,m=this.n42,o=this.n43,p=this.n44;return d*g*i*n-c*h*i*n-d*f*k*n+b*h*k*n+c*f*l*n-b*g*l*n-d*g*j*m+c*h*j*m+d*e*k*m-a*h*k*m-c*e*l*m+a*g*l*m+d*f*j*o-b*h*j*o-d*e*i*o+a*h*i*o+b*e*l*o-a*f*l*o-c*f*j*p+b*g*j*p+c*e*i*p-a*g*i*p-b*e*k*p+a*f*k*p},transpose:function(){var a;
+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,f=this.n22,g=this.n23,i=this.n24,j=this.n31,h=this.n32,k=this.n33,m=this.n34,n=this.n41,l=this.n42,o=this.n43,p=this.n44;return d*g*h*n-c*i*h*n-d*f*k*n+b*i*k*n+c*f*m*n-b*g*m*n-d*g*j*l+c*i*j*l+d*e*k*l-a*i*k*l-c*e*m*l+a*g*m*l+d*f*j*o-b*i*j*o-d*e*h*o+a*i*h*o+b*e*m*o-a*f*m*o-c*f*j*p+b*g*j*p+c*e*h*p-a*g*h*p-b*e*k*p+a*f*k*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.n34=a;return this},flattenToArray:function(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=
-this.n44;return a},flattenToArrayOffset:function(a,b){a[b]=this.n11;a[b+1]=this.n21;a[b+2]=this.n31;a[b+3]=this.n41;a[b+4]=this.n12;a[b+5]=this.n22;a[b+6]=this.n32;a[b+7]=this.n42;a[b+8]=this.n13;a[b+9]=this.n23;a[b+10]=this.n33;a[b+11]=this.n43;a[b+12]=this.n14;a[b+13]=this.n24;a[b+14]=this.n34;a[b+15]=this.n44;return a},setTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},setScale:function(a,b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},setRotationX:function(a){var b=
-Math.cos(a),a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},setRotationY:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},setRotationZ:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),e=1-c,f=a.x,g=a.y,h=a.z,j=e*f,i=e*g;this.set(j*f+c,j*g-d*h,j*h+d*g,0,j*g+d*h,i*g+c,i*h-d*f,0,j*h-d*g,i*h+d*f,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,f=a.n21,g=a.n22,h=a.n23,j=a.n24,i=a.n31,k=
-a.n32,l=a.n33,n=a.n34,m=a.n41,o=a.n42,p=a.n43,u=a.n44;this.n11=h*n*o-j*l*o+j*k*p-g*n*p-h*k*u+g*l*u;this.n12=e*l*o-d*n*o-e*k*p+c*n*p+d*k*u-c*l*u;this.n13=d*j*o-e*h*o+e*g*p-c*j*p-d*g*u+c*h*u;this.n14=e*h*k-d*j*k-e*g*l+c*j*l+d*g*n-c*h*n;this.n21=j*l*m-h*n*m-j*i*p+f*n*p+h*i*u-f*l*u;this.n22=d*n*m-e*l*m+e*i*p-b*n*p-d*i*u+b*l*u;this.n23=e*h*m-d*j*m-e*f*p+b*j*p+d*f*u-b*h*u;this.n24=d*j*i-e*h*i+e*f*l-b*j*l-d*f*n+b*h*n;this.n31=g*n*m-j*k*m+j*i*o-f*n*o-g*i*u+f*k*u;this.n32=e*k*m-c*n*m-e*i*o+b*n*o+c*i*u-b*k*
-u;this.n33=c*j*m-e*g*m+e*f*o-b*j*o-c*f*u+b*g*u;this.n34=e*g*i-c*j*i-e*f*k+b*j*k+c*f*n-b*g*n;this.n41=h*k*m-g*l*m-h*i*o+f*l*o+g*i*p-f*k*p;this.n42=c*l*m-d*k*m+d*i*o-b*l*o-c*i*p+b*k*p;this.n43=d*g*m-c*h*m-d*f*o+b*h*o+c*f*p-b*g*p;this.n44=c*h*i-d*g*i+d*f*k-b*h*k-c*f*l+b*g*l;this.multiplyScalar(1/a.determinant());return this},setRotationFromEuler:function(a,b){var c=a.x,d=a.y,e=a.z,f=Math.cos(c),c=Math.sin(c),g=Math.cos(d),d=Math.sin(d),h=Math.cos(e),e=Math.sin(e);switch(b){case "YXZ":var j=g*h,i=g*e,
-k=d*h,l=d*e;this.n11=j+l*c;this.n12=k*c-i;this.n13=f*d;this.n21=f*e;this.n22=f*h;this.n23=-c;this.n31=i*c-k;this.n32=l+j*c;this.n33=f*g;break;case "ZXY":j=g*h;i=g*e;k=d*h;l=d*e;this.n11=j-l*c;this.n12=-f*e;this.n13=k+i*c;this.n21=i+k*c;this.n22=f*h;this.n23=l-j*c;this.n31=-f*d;this.n32=c;this.n33=f*g;break;case "ZYX":j=f*h;i=f*e;k=c*h;l=c*e;this.n11=g*h;this.n12=k*d-i;this.n13=j*d+l;this.n21=g*e;this.n22=l*d+j;this.n23=i*d-k;this.n31=-d;this.n32=c*g;this.n33=f*g;break;case "YZX":j=f*g;i=f*d;k=c*g;
-l=c*d;this.n11=g*h;this.n12=l-j*e;this.n13=k*e+i;this.n21=e;this.n22=f*h;this.n23=-c*h;this.n31=-d*h;this.n32=i*e+k;this.n33=j-l*e;break;case "XZY":j=f*g;i=f*d;k=c*g;l=c*d;this.n11=g*h;this.n12=-e;this.n13=d*h;this.n21=j*e+l;this.n22=f*h;this.n23=i*e-k;this.n31=k*e-i;this.n32=c*h;this.n33=l*e+j;break;default:j=f*h,i=f*e,k=c*h,l=c*e,this.n11=g*h,this.n12=-g*e,this.n13=d,this.n21=i+k*d,this.n22=j-l*d,this.n23=-c*g,this.n31=l-j*d,this.n32=k+i*d,this.n33=f*g}return this},setRotationFromQuaternion:function(a){var b=
-a.x,c=a.y,d=a.z,e=a.w,f=b+b,g=c+c,h=d+d,a=b*f,j=b*g,b=b*h,i=c*g,c=c*h,d=d*h,f=e*f,g=e*g,e=e*h;this.n11=1-(i+d);this.n12=j-e;this.n13=b+g;this.n21=j+e;this.n22=1-(a+d);this.n23=c-f;this.n31=b-g;this.n32=c+f;this.n33=1-(a+i);return this},scale:function(a){var b=a.x,c=a.y,a=a.z;this.n11*=b;this.n12*=c;this.n13*=a;this.n21*=b;this.n22*=c;this.n23*=a;this.n31*=b;this.n32*=c;this.n33*=a;this.n41*=b;this.n42*=c;this.n43*=a;return this},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,f=THREE.Matrix4.__v3;d.set(this.n11,this.n21,this.n31);e.set(this.n12,this.n22,this.n32);f.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=f.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},rotateByAxis:function(a,b){if(1===a.x&&0===a.y&&0===a.z)return this.rotateX(b);if(0===a.x&&1===a.y&&0===a.z)return this.rotateY(b);if(0===a.x&&0===a.y&&1===a.z)return this.rotateZ(b);var c=a.x,d=a.y,e=a.z,f=Math.sqrt(c*c+d*d+e*e),c=c/f,d=d/f,e=e/f,f=c*c,g=d*d,h=e*e,j=Math.cos(b),i=Math.sin(b),k=1-j,l=c*d*k,n=c*e*k,k=d*e*k,c=c*i,m=d*i,i=e*i,e=
-f+(1-f)*j,f=l+i,d=n-m,l=l-i,g=g+(1-g)*j,i=k+c,n=n+m,k=k-c,h=h+(1-h)*j,j=this.n11,c=this.n21,m=this.n31,o=this.n41,p=this.n12,u=this.n22,H=this.n32,w=this.n42,C=this.n13,s=this.n23,t=this.n33,y=this.n43;this.n11=e*j+f*p+d*C;this.n21=e*c+f*u+d*s;this.n31=e*m+f*H+d*t;this.n41=e*o+f*w+d*y;this.n12=l*j+g*p+i*C;this.n22=l*c+g*u+i*s;this.n32=l*m+g*H+i*t;this.n42=l*o+g*w+i*y;this.n13=n*j+k*p+h*C;this.n23=n*c+k*u+h*s;this.n33=n*m+k*H+h*t;this.n43=n*o+k*w+h*y;return this},rotateX:function(a){var b=this.n12,
-c=this.n22,d=this.n32,e=this.n42,f=this.n13,g=this.n23,h=this.n33,j=this.n43,i=Math.cos(a),a=Math.sin(a);this.n12=i*b+a*f;this.n22=i*c+a*g;this.n32=i*d+a*h;this.n42=i*e+a*j;this.n13=i*f-a*b;this.n23=i*g-a*c;this.n33=i*h-a*d;this.n43=i*j-a*e;return this},rotateY:function(a){var b=this.n11,c=this.n21,d=this.n31,e=this.n41,f=this.n13,g=this.n23,h=this.n33,j=this.n43,i=Math.cos(a),a=Math.sin(a);this.n11=i*b-a*f;this.n21=i*c-a*g;this.n31=i*d-a*h;this.n41=i*e-a*j;this.n13=i*f+a*b;this.n23=i*g+a*c;this.n33=
-i*h+a*d;this.n43=i*j+a*e;return this},rotateZ:function(a){var b=this.n11,c=this.n21,d=this.n31,e=this.n41,f=this.n12,g=this.n22,h=this.n32,j=this.n42,i=Math.cos(a),a=Math.sin(a);this.n11=i*b+a*f;this.n21=i*c+a*g;this.n31=i*d+a*h;this.n41=i*e+a*j;this.n12=i*f-a*b;this.n22=i*g-a*c;this.n32=i*h-a*d;this.n42=i*j-a*e;return this},translate:function(a){var b=a.x,c=a.y,a=a.z;this.n14=this.n11*b+this.n12*c+this.n13*a+this.n14;this.n24=this.n21*b+this.n22*c+this.n23*a+this.n24;this.n34=this.n31*b+this.n32*
-c+this.n33*a+this.n34;this.n44=this.n41*b+this.n42*c+this.n43*a+this.n44;return this},clone:function(){return new THREE.Matrix4(this.n11,this.n12,this.n13,this.n14,this.n21,this.n22,this.n23,this.n24,this.n31,this.n32,this.n33,this.n34,this.n41,this.n42,this.n43,this.n44)}};
-THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,d=a.n33*a.n22-a.n32*a.n23,e=-a.n33*a.n21+a.n31*a.n23,f=a.n32*a.n21-a.n31*a.n22,g=-a.n33*a.n12+a.n32*a.n13,h=a.n33*a.n11-a.n31*a.n13,j=-a.n32*a.n11+a.n31*a.n12,i=a.n23*a.n12-a.n22*a.n13,k=-a.n23*a.n11+a.n21*a.n13,l=a.n22*a.n11-a.n21*a.n12,a=a.n11*d+a.n21*g+a.n31*i;if(0===a)return null;a=1/a;c[0]=a*d;c[1]=a*e;c[2]=a*f;c[3]=a*g;c[4]=a*h;c[5]=a*j;c[6]=a*i;c[7]=a*k;c[8]=a*l;return b};
-THREE.Matrix4.makeFrustum=function(a,b,c,d,e,f){var g;g=new THREE.Matrix4;g.n11=2*e/(b-a);g.n12=0;g.n13=(b+a)/(b-a);g.n14=0;g.n21=0;g.n22=2*e/(d-c);g.n23=(d+c)/(d-c);g.n24=0;g.n31=0;g.n32=0;g.n33=-(f+e)/(f-e);g.n34=-2*f*e/(f-e);g.n41=0;g.n42=0;g.n43=-1;g.n44=0;return g};THREE.Matrix4.makePerspective=function(a,b,c,d){var e,a=c*Math.tan(a*Math.PI/360);e=-a;return THREE.Matrix4.makeFrustum(e*b,a*b,e,a,c,d)};
-THREE.Matrix4.makeOrtho=function(a,b,c,d,e,f){var g,h,j,i;g=new THREE.Matrix4;h=b-a;j=c-d;i=f-e;g.n11=2/h;g.n12=0;g.n13=0;g.n14=-((b+a)/h);g.n21=0;g.n22=2/j;g.n23=0;g.n24=-((c+d)/j);g.n31=0;g.n32=0;g.n33=-2/i;g.n34=-((f+e)/i);g.n41=0;g.n42=0;g.n43=0;g.n44=1;return g};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
+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},getPosition:function(){return THREE.Matrix4.__v1.set(this.n14,this.n24,this.n34)},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},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,f=a.n21,g=a.n22,i=a.n23,j=a.n24,h=a.n31,k=a.n32,m=a.n33,n=a.n34,l=a.n41,o=a.n42,p=a.n43,u=a.n44;this.n11=i*n*o-j*m*o+j*k*p-g*n*p-i*k*u+g*m*u;this.n12=e*m*o-d*n*o-e*k*p+c*n*p+d*k*u-c*m*u;this.n13=d*j*o-e*i*o+e*g*p-c*j*p-d*g*u+c*i*u;this.n14=e*i*k-d*j*k-e*g*m+c*
+j*m+d*g*n-c*i*n;this.n21=j*m*l-i*n*l-j*h*p+f*n*p+i*h*u-f*m*u;this.n22=d*n*l-e*m*l+e*h*p-b*n*p-d*h*u+b*m*u;this.n23=e*i*l-d*j*l-e*f*p+b*j*p+d*f*u-b*i*u;this.n24=d*j*h-e*i*h+e*f*m-b*j*m-d*f*n+b*i*n;this.n31=g*n*l-j*k*l+j*h*o-f*n*o-g*h*u+f*k*u;this.n32=e*k*l-c*n*l-e*h*o+b*n*o+c*h*u-b*k*u;this.n33=c*j*l-e*g*l+e*f*o-b*j*o-c*f*u+b*g*u;this.n34=e*g*h-c*j*h-e*f*k+b*j*k+c*f*n-b*g*n;this.n41=i*k*l-g*m*l-i*h*o+f*m*o+g*h*p-f*k*p;this.n42=c*m*l-d*k*l+d*h*o-b*m*o-c*h*p+b*k*p;this.n43=d*g*l-c*i*l-d*f*o+b*i*o+c*
+f*p-b*g*p;this.n44=c*i*h-d*g*h+d*f*k-b*i*k-c*f*m+b*g*m;this.multiplyScalar(1/a.determinant());return this},setRotationFromEuler:function(a,b){var c=a.x,d=a.y,e=a.z,f=Math.cos(c),c=Math.sin(c),g=Math.cos(d),d=Math.sin(d),i=Math.cos(e),e=Math.sin(e);switch(b){case "YXZ":var j=g*i,h=g*e,k=d*i,m=d*e;this.n11=j+m*c;this.n12=k*c-h;this.n13=f*d;this.n21=f*e;this.n22=f*i;this.n23=-c;this.n31=h*c-k;this.n32=m+j*c;this.n33=f*g;break;case "ZXY":j=g*i;h=g*e;k=d*i;m=d*e;this.n11=j-m*c;this.n12=-f*e;this.n13=k+
+h*c;this.n21=h+k*c;this.n22=f*i;this.n23=m-j*c;this.n31=-f*d;this.n32=c;this.n33=f*g;break;case "ZYX":j=f*i;h=f*e;k=c*i;m=c*e;this.n11=g*i;this.n12=k*d-h;this.n13=j*d+m;this.n21=g*e;this.n22=m*d+j;this.n23=h*d-k;this.n31=-d;this.n32=c*g;this.n33=f*g;break;case "YZX":j=f*g;h=f*d;k=c*g;m=c*d;this.n11=g*i;this.n12=m-j*e;this.n13=k*e+h;this.n21=e;this.n22=f*i;this.n23=-c*i;this.n31=-d*i;this.n32=h*e+k;this.n33=j-m*e;break;case "XZY":j=f*g;h=f*d;k=c*g;m=c*d;this.n11=g*i;this.n12=-e;this.n13=d*i;this.n21=
+j*e+m;this.n22=f*i;this.n23=h*e-k;this.n31=k*e-h;this.n32=c*i;this.n33=m*e+j;break;default:j=f*i,h=f*e,k=c*i,m=c*e,this.n11=g*i,this.n12=-g*e,this.n13=d,this.n21=h+k*d,this.n22=j-m*d,this.n23=-c*g,this.n31=m-j*d,this.n32=k+h*d,this.n33=f*g}return this},setRotationFromQuaternion:function(a){var b=a.x,c=a.y,d=a.z,e=a.w,f=b+b,g=c+c,i=d+d,a=b*f,j=b*g,b=b*i,h=c*g,c=c*i,d=d*i,f=e*f,g=e*g,e=e*i;this.n11=1-(h+d);this.n12=j-e;this.n13=b+g;this.n21=j+e;this.n22=1-(a+d);this.n23=c-f;this.n31=b-g;this.n32=c+
+f;this.n33=1-(a+h);return this},compose:function(a,b,c){var d=THREE.Matrix4.__m1,e=THREE.Matrix4.__m2;d.identity();d.setRotationFromQuaternion(b);e.makeScale(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,f=THREE.Matrix4.__v3;d.set(this.n11,this.n21,this.n31);e.set(this.n12,this.n22,this.n32);f.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=f.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},translate:function(a){var b=a.x,c=a.y,a=a.z;this.n14=this.n11*b+this.n12*c+this.n13*a+this.n14;this.n24=this.n21*b+this.n22*c+this.n23*a+this.n24;this.n34=this.n31*b+this.n32*c+this.n33*a+this.n34;this.n44=this.n41*b+this.n42*c+this.n43*a+this.n44;return this},
+rotateX:function(a){var b=this.n12,c=this.n22,d=this.n32,e=this.n42,f=this.n13,g=this.n23,i=this.n33,j=this.n43,h=Math.cos(a),a=Math.sin(a);this.n12=h*b+a*f;this.n22=h*c+a*g;this.n32=h*d+a*i;this.n42=h*e+a*j;this.n13=h*f-a*b;this.n23=h*g-a*c;this.n33=h*i-a*d;this.n43=h*j-a*e;return this},rotateY:function(a){var b=this.n11,c=this.n21,d=this.n31,e=this.n41,f=this.n13,g=this.n23,i=this.n33,j=this.n43,h=Math.cos(a),a=Math.sin(a);this.n11=h*b-a*f;this.n21=h*c-a*g;this.n31=h*d-a*i;this.n41=h*e-a*j;this.n13=
+h*f+a*b;this.n23=h*g+a*c;this.n33=h*i+a*d;this.n43=h*j+a*e;return this},rotateZ:function(a){var b=this.n11,c=this.n21,d=this.n31,e=this.n41,f=this.n12,g=this.n22,i=this.n32,j=this.n42,h=Math.cos(a),a=Math.sin(a);this.n11=h*b+a*f;this.n21=h*c+a*g;this.n31=h*d+a*i;this.n41=h*e+a*j;this.n12=h*f-a*b;this.n22=h*g-a*c;this.n32=h*i-a*d;this.n42=h*j-a*e;return this},rotateByAxis:function(a,b){if(1===a.x&&0===a.y&&0===a.z)return this.rotateX(b);if(0===a.x&&1===a.y&&0===a.z)return this.rotateY(b);if(0===a.x&&
+0===a.y&&1===a.z)return this.rotateZ(b);var c=a.x,d=a.y,e=a.z,f=Math.sqrt(c*c+d*d+e*e),c=c/f,d=d/f,e=e/f,f=c*c,g=d*d,i=e*e,j=Math.cos(b),h=Math.sin(b),k=1-j,m=c*d*k,n=c*e*k,k=d*e*k,c=c*h,l=d*h,h=e*h,e=f+(1-f)*j,f=m+h,d=n-l,m=m-h,g=g+(1-g)*j,h=k+c,n=n+l,k=k-c,i=i+(1-i)*j,j=this.n11,c=this.n21,l=this.n31,o=this.n41,p=this.n12,u=this.n22,H=this.n32,w=this.n42,C=this.n13,s=this.n23,t=this.n33,y=this.n43;this.n11=e*j+f*p+d*C;this.n21=e*c+f*u+d*s;this.n31=e*l+f*H+d*t;this.n41=e*o+f*w+d*y;this.n12=m*j+g*
+p+h*C;this.n22=m*c+g*u+h*s;this.n32=m*l+g*H+h*t;this.n42=m*o+g*w+h*y;this.n13=n*j+k*p+i*C;this.n23=n*c+k*u+i*s;this.n33=n*l+k*H+i*t;this.n43=n*o+k*w+i*y;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},makeTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},makeRotationX: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},makeRotationY: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},makeRotationZ: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},makeRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),e=1-c,f=a.x,g=a.y,i=a.z,j=e*f,h=e*g;this.set(j*f+c,j*g-d*i,j*i+d*g,0,j*g+d*i,h*g+c,h*i-d*f,0,j*i-d*g,h*i+d*f,e*i*i+c,0,0,0,0,1);return this},makeScale:function(a,
+b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},makeFrustum:function(a,b,c,d,e,f){this.n11=2*e/(b-a);this.n12=0;this.n13=(b+a)/(b-a);this.n21=this.n14=0;this.n22=2*e/(d-c);this.n23=(d+c)/(d-c);this.n32=this.n31=this.n24=0;this.n33=-(f+e)/(f-e);this.n34=-2*f*e/(f-e);this.n42=this.n41=0;this.n43=-1;this.n44=0;return this},makePerspective:function(a,b,c,d){var a=c*Math.tan(a*Math.PI/360),e=-a;return this.makeFrustum(e*b,a*b,e,a,c,d)},makeOrthographic:function(a,b,c,d,e,f){var g=b-a,i=c-d,
+j=f-e;this.n11=2/g;this.n13=this.n12=0;this.n14=-((b+a)/g);this.n21=0;this.n22=2/i;this.n23=0;this.n24=-((c+d)/i);this.n32=this.n31=0;this.n33=-2/j;this.n34=-((f+e)/j);this.n43=this.n42=this.n41=0;this.n44=1;return this},clone:function(){return new THREE.Matrix4(this.n11,this.n12,this.n13,this.n14,this.n21,this.n22,this.n23,this.n24,this.n31,this.n32,this.n33,this.n34,this.n41,this.n42,this.n43,this.n44)}};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.id=THREE.Object3DCount++;this.name="";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=!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,applyMatrix:function(a){this.matrix.multiply(a,this.matrix);this.scale.getScaleFromMatrix(this.matrix);this.rotation.getRotationFromMatrix(this.matrix,this.scale);this.position.getPositionFromMatrix(this.matrix)},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,
@@ -63,22 +63,22 @@ this._vector.set(0,0,1))},lookAt:function(a){this.matrix.lookAt(a,this.position,
 this.children.indexOf(a);if(-1!==b){a.parent=void 0;this.children.splice(b,1);for(b=this;void 0!==b.parent;)b=b.parent;void 0!==b&&b instanceof THREE.Scene&&b.__removeObject(a)}},getChildByName:function(a,b){var c,d,e;for(c=0,d=this.children.length;c<d;c++){e=this.children[c];if(e.name===a||b&&(e=e.getChildByName(a,b),void 0!==e))return e}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,
 this.eulerOrder);if(1!==this.scale.x||1!==this.scale.y||1!==this.scale.z)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[f]=g[f]||new THREE.RenderableObject;f++;return a}function b(){var a=i[j]=i[j]||new THREE.RenderableVertex;j++;return a}function c(a,b){return b.z-a.z}function d(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;if(0<=e&&0<=f&&0<=g&&0<=h)return!0;if(0>e&&0>f||0>g&&0>h)return!1;0>e?c=Math.max(c,e/(e-f)):0>f&&(d=Math.min(d,e/(e-f)));0>g?c=Math.max(c,g/(g-h)):0>h&&(d=Math.min(d,g/(g-h)));if(d<c)return!1;a.lerpSelf(b,c);b.lerpSelf(a,1-d);return!0}
-var e,f,g=[],h,j,i=[],k,l,n=[],m,o=[],p,u,H=[],w,C,s=[],t={objects:[],sprites:[],lights:[],elements:[]},y=new THREE.Vector3,x=new THREE.Vector4,z=new THREE.Matrix4,D=new THREE.Matrix4,B=new THREE.Frustum,E=new THREE.Vector4,A=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);z.multiply(b.projectionMatrix,b.matrixWorldInverse);z.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);z.multiply(b.matrixWorld,
+THREE.Projector=function(){function a(){var a=g[f]=g[f]||new THREE.RenderableObject;f++;return a}function b(){var a=h[j]=h[j]||new THREE.RenderableVertex;j++;return a}function c(a,b){return b.z-a.z}function d(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;if(0<=e&&0<=f&&0<=g&&0<=h)return!0;if(0>e&&0>f||0>g&&0>h)return!1;0>e?c=Math.max(c,e/(e-f)):0>f&&(d=Math.min(d,e/(e-f)));0>g?c=Math.max(c,g/(g-h)):0>h&&(d=Math.min(d,g/(g-h)));if(d<c)return!1;a.lerpSelf(b,c);b.lerpSelf(a,1-d);return!0}
+var e,f,g=[],i,j,h=[],k,m,n=[],l,o=[],p,u,H=[],w,C,s=[],t={objects:[],sprites:[],lights:[],elements:[]},y=new THREE.Vector3,x=new THREE.Vector4,z=new THREE.Matrix4,D=new THREE.Matrix4,B=new THREE.Frustum,E=new THREE.Vector4,A=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);z.multiply(b.projectionMatrix,b.matrixWorldInverse);z.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);z.multiply(b.matrixWorld,
 b.projectionMatrixInverse);z.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(b,d){f=0;t.objects.length=0;t.sprites.length=0;t.lights.length=0;var g=function(b){if(!1!==b.visible){(b instanceof THREE.Mesh||b instanceof THREE.Line)&&(!1===b.frustumCulled||B.contains(b))?(y.copy(b.matrixWorld.getPosition()),z.multiplyVector3(y),
-e=a(),e.object=b,e.z=y.z,t.objects.push(e)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(y.copy(b.matrixWorld.getPosition()),z.multiplyVector3(y),e=a(),e.object=b,e.z=y.z,t.sprites.push(e)):b instanceof THREE.Light&&t.lights.push(b);for(var c=0,d=b.children.length;c<d;c++)g(b.children[c])}};g(b);d&&t.objects.sort(c);return t};this.projectScene=function(a,e,f){var g=e.near,y=e.far,R=!1,U,r,q,J,v,G,I,K,F,O,Q,X,V,W,S;C=u=m=l=0;t.elements.length=0;void 0===e.parent&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),
-a.add(e));a.updateMatrixWorld();e.matrixWorldInverse.getInverse(e.matrixWorld);z.multiply(e.projectionMatrix,e.matrixWorldInverse);B.setFromMatrix(z);t=this.projectGraph(a,!1);for(a=0,U=t.objects.length;a<U;a++)if(F=t.objects[a].object,O=F.matrixWorld,j=0,F instanceof THREE.Mesh){Q=F.geometry;X=F.geometry.materials;J=Q.vertices;V=Q.faces;W=Q.faceVertexUvs;Q=F.matrixRotationWorld.extractRotation(O);for(r=0,q=J.length;r<q;r++)h=b(),h.positionWorld.copy(J[r].position),O.multiplyVector3(h.positionWorld),
-h.positionScreen.copy(h.positionWorld),z.multiplyVector4(h.positionScreen),h.positionScreen.x/=h.positionScreen.w,h.positionScreen.y/=h.positionScreen.w,h.visible=h.positionScreen.z>g&&h.positionScreen.z<y;for(J=0,r=V.length;J<r;J++){q=V[J];if(q instanceof THREE.Face3)if(v=i[q.a],G=i[q.b],I=i[q.c],v.visible&&G.visible&&I.visible)if(R=0>(I.positionScreen.x-v.positionScreen.x)*(G.positionScreen.y-v.positionScreen.y)-(I.positionScreen.y-v.positionScreen.y)*(G.positionScreen.x-v.positionScreen.x),F.doubleSided||
-R!=F.flipSided)K=n[l]=n[l]||new THREE.RenderableFace3,l++,k=K,k.v1.copy(v),k.v2.copy(G),k.v3.copy(I);else continue;else continue;else if(q instanceof THREE.Face4)if(v=i[q.a],G=i[q.b],I=i[q.c],K=i[q.d],v.visible&&G.visible&&I.visible&&K.visible)if(R=0>(K.positionScreen.x-v.positionScreen.x)*(G.positionScreen.y-v.positionScreen.y)-(K.positionScreen.y-v.positionScreen.y)*(G.positionScreen.x-v.positionScreen.x)||0>(G.positionScreen.x-I.positionScreen.x)*(K.positionScreen.y-I.positionScreen.y)-(G.positionScreen.y-
-I.positionScreen.y)*(K.positionScreen.x-I.positionScreen.x),F.doubleSided||R!=F.flipSided)S=o[m]=o[m]||new THREE.RenderableFace4,m++,k=S,k.v1.copy(v),k.v2.copy(G),k.v3.copy(I),k.v4.copy(K);else continue;else continue;k.normalWorld.copy(q.normal);!R&&(F.flipSided||F.doubleSided)&&k.normalWorld.negate();Q.multiplyVector3(k.normalWorld);k.centroidWorld.copy(q.centroid);O.multiplyVector3(k.centroidWorld);k.centroidScreen.copy(k.centroidWorld);z.multiplyVector3(k.centroidScreen);I=q.vertexNormals;for(v=
+e=a(),e.object=b,e.z=y.z,t.objects.push(e)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(y.copy(b.matrixWorld.getPosition()),z.multiplyVector3(y),e=a(),e.object=b,e.z=y.z,t.sprites.push(e)):b instanceof THREE.Light&&t.lights.push(b);for(var c=0,d=b.children.length;c<d;c++)g(b.children[c])}};g(b);d&&t.objects.sort(c);return t};this.projectScene=function(a,e,f){var g=e.near,y=e.far,R=!1,U,r,q,J,v,G,I,K,F,O,Q,X,V,W,S;C=u=l=m=0;t.elements.length=0;void 0===e.parent&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),
+a.add(e));a.updateMatrixWorld();e.matrixWorldInverse.getInverse(e.matrixWorld);z.multiply(e.projectionMatrix,e.matrixWorldInverse);B.setFromMatrix(z);t=this.projectGraph(a,!1);for(a=0,U=t.objects.length;a<U;a++)if(F=t.objects[a].object,O=F.matrixWorld,j=0,F instanceof THREE.Mesh){Q=F.geometry;X=F.geometry.materials;J=Q.vertices;V=Q.faces;W=Q.faceVertexUvs;Q=F.matrixRotationWorld.extractRotation(O);for(r=0,q=J.length;r<q;r++)i=b(),i.positionWorld.copy(J[r].position),O.multiplyVector3(i.positionWorld),
+i.positionScreen.copy(i.positionWorld),z.multiplyVector4(i.positionScreen),i.positionScreen.x/=i.positionScreen.w,i.positionScreen.y/=i.positionScreen.w,i.visible=i.positionScreen.z>g&&i.positionScreen.z<y;for(J=0,r=V.length;J<r;J++){q=V[J];if(q instanceof THREE.Face3)if(v=h[q.a],G=h[q.b],I=h[q.c],v.visible&&G.visible&&I.visible)if(R=0>(I.positionScreen.x-v.positionScreen.x)*(G.positionScreen.y-v.positionScreen.y)-(I.positionScreen.y-v.positionScreen.y)*(G.positionScreen.x-v.positionScreen.x),F.doubleSided||
+R!=F.flipSided)K=n[m]=n[m]||new THREE.RenderableFace3,m++,k=K,k.v1.copy(v),k.v2.copy(G),k.v3.copy(I);else continue;else continue;else if(q instanceof THREE.Face4)if(v=h[q.a],G=h[q.b],I=h[q.c],K=h[q.d],v.visible&&G.visible&&I.visible&&K.visible)if(R=0>(K.positionScreen.x-v.positionScreen.x)*(G.positionScreen.y-v.positionScreen.y)-(K.positionScreen.y-v.positionScreen.y)*(G.positionScreen.x-v.positionScreen.x)||0>(G.positionScreen.x-I.positionScreen.x)*(K.positionScreen.y-I.positionScreen.y)-(G.positionScreen.y-
+I.positionScreen.y)*(K.positionScreen.x-I.positionScreen.x),F.doubleSided||R!=F.flipSided)S=o[l]=o[l]||new THREE.RenderableFace4,l++,k=S,k.v1.copy(v),k.v2.copy(G),k.v3.copy(I),k.v4.copy(K);else continue;else continue;k.normalWorld.copy(q.normal);!R&&(F.flipSided||F.doubleSided)&&k.normalWorld.negate();Q.multiplyVector3(k.normalWorld);k.centroidWorld.copy(q.centroid);O.multiplyVector3(k.centroidWorld);k.centroidScreen.copy(k.centroidWorld);z.multiplyVector3(k.centroidScreen);I=q.vertexNormals;for(v=
 0,G=I.length;v<G;v++)K=k.vertexNormalsWorld[v],K.copy(I[v]),!R&&(F.flipSided||F.doubleSided)&&K.negate(),Q.multiplyVector3(K);for(v=0,G=W.length;v<G;v++)if(S=W[v][J])for(I=0,K=S.length;I<K;I++)k.uvs[v][I]=S[I];k.material=F.material;k.faceMaterial=null!==q.materialIndex?X[q.materialIndex]:null;k.z=k.centroidScreen.z;t.elements.push(k)}}else if(F instanceof THREE.Line){D.multiply(z,O);J=F.geometry.vertices;v=b();v.positionScreen.copy(J[0].position);D.multiplyVector4(v.positionScreen);for(r=1,q=J.length;r<
-q;r++)if(v=b(),v.positionScreen.copy(J[r].position),D.multiplyVector4(v.positionScreen),G=i[j-2],E.copy(v.positionScreen),A.copy(G.positionScreen),d(E,A))E.multiplyScalar(1/E.w),A.multiplyScalar(1/A.w),O=H[u]=H[u]||new THREE.RenderableLine,u++,p=O,p.v1.positionScreen.copy(E),p.v2.positionScreen.copy(A),p.z=Math.max(E.z,A.z),p.material=F.material,t.elements.push(p)}for(a=0,U=t.sprites.length;a<U;a++)if(F=t.sprites[a].object,O=F.matrixWorld,F instanceof THREE.Particle&&(x.set(O.n14,O.n24,O.n34,1),z.multiplyVector4(x),
+q;r++)if(v=b(),v.positionScreen.copy(J[r].position),D.multiplyVector4(v.positionScreen),G=h[j-2],E.copy(v.positionScreen),A.copy(G.positionScreen),d(E,A))E.multiplyScalar(1/E.w),A.multiplyScalar(1/A.w),O=H[u]=H[u]||new THREE.RenderableLine,u++,p=O,p.v1.positionScreen.copy(E),p.v2.positionScreen.copy(A),p.z=Math.max(E.z,A.z),p.material=F.material,t.elements.push(p)}for(a=0,U=t.sprites.length;a<U;a++)if(F=t.sprites[a].object,O=F.matrixWorld,F instanceof THREE.Particle&&(x.set(O.n14,O.n24,O.n34,1),z.multiplyVector4(x),
 x.z/=x.w,0<x.z&&1>x.z))g=s[C]=s[C]||new THREE.RenderableParticle,C++,w=g,w.x=x.x/x.w,w.y=x.y/x.w,w.z=x.z,w.rotation=F.rotation.z,w.scale.x=F.scale.x*Math.abs(w.x-(x.x+e.projectionMatrix.n11)/(x.w+e.projectionMatrix.n14)),w.scale.y=F.scale.y*Math.abs(w.y-(x.y+e.projectionMatrix.n22)/(x.w+e.projectionMatrix.n24)),w.material=F.material,t.elements.push(w);f&&t.elements.sort(c);return t}};THREE.Quaternion=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=void 0!==d?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),f=Math.cos(c),c=Math.sin(c),g=a*b,h=d*e;this.w=g*f-h*c;this.x=g*c+h*f;this.y=d*b*f+a*e*c;this.z=a*e*f-d*b*c;return this},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);
+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),f=Math.cos(c),c=Math.sin(c),g=a*b,i=d*e;this.w=g*f-i*c;this.x=g*c+i*f;this.y=d*b*f+a*e*c;this.z=a*e*f-d*b*c;return this},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=0>a.n32-a.n23?-Math.abs(this.x):Math.abs(this.x);this.y=0>a.n13-a.n31?-Math.abs(this.y):Math.abs(this.y);this.z=0>a.n21-a.n12?-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);0===a?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},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},multiplySelf:function(a){var b=this.x,c=this.y,d=this.z,e=this.w,f=a.x,g=a.y,h=a.z,a=a.w;this.x=b*a+e*f+c*h-d*g;this.y=c*a+e*g+d*f-b*h;this.z=d*a+e*h+b*g-c*f;this.w=e*a-b*f-c*g-d*h;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,f=this.x,g=this.y,h=this.z,j=this.w,i=j*c+g*e-h*d,k=j*d+h*c-f*e,l=j*e+f*
-d-g*c,c=-f*c-g*d-h*e;b.x=i*j+c*-f+k*-h-l*-g;b.y=k*j+c*-g+l*-f-i*-h;b.z=l*j+c*-h+i*-g-k*-f;return b},clone:function(){return new THREE.Quaternion(this.x,this.y,this.z,this.w)}};
+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},multiplySelf:function(a){var b=this.x,c=this.y,d=this.z,e=this.w,f=a.x,g=a.y,i=a.z,a=a.w;this.x=b*a+e*f+c*i-d*g;this.y=c*a+e*g+d*f-b*i;this.z=d*a+e*i+b*g-c*f;this.w=e*a-b*f-c*g-d*i;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,f=this.x,g=this.y,i=this.z,j=this.w,h=j*c+g*e-i*d,k=j*d+i*c-f*e,m=j*e+f*
+d-g*c,c=-f*c-g*d-i*e;b.x=h*j+c*-f+k*-i-m*-g;b.y=k*j+c*-g+m*-f-h*-i;b.z=m*j+c*-i+h*-g-k*-f;return b},clone:function(){return new THREE.Quaternion(this.x,this.y,this.z,this.w)}};
 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;0>e?(c.w=-b.w,c.x=-b.x,c.y=-b.y,c.z=-b.z,e=-e):c.copy(b);if(1<=Math.abs(e))return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var f=Math.acos(e),e=Math.sqrt(1-e*e);if(0.001>Math.abs(e))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)*f)/e;d=Math.sin(d*f)/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.Vertex.prototype={constructor:THREE.Vertex,clone:function(){return new THREE.Vertex(this.position.clone())}};THREE.Face3=function(a,b,c,d,e,f){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.materialIndex=f;this.centroid=new THREE.Vector3};
 THREE.Face3.prototype={constructor:THREE.Face3,clone:function(){var a=new THREE.Face3(this.a,this.b,this.c);a.normal.copy(this.normal);a.color.copy(this.color);a.centroid.copy(this.centroid);a.materialIndex=this.materialIndex;var b,c;for(b=0,c=this.vertexNormals.length;b<c;b++)a.vertexNormals[b]=this.vertexNormals[b].clone();for(b=0,c=this.vertexColors.length;b<c;b++)a.vertexColors[b]=this.vertexColors[b].clone();for(b=0,c=this.vertexTangents.length;b<c;b++)a.vertexTangents[b]=this.vertexTangents[b].clone();
@@ -88,28 +88,30 @@ return a}};THREE.UV=function(a,b){this.u=a||0;this.v=b||0};THREE.UV.prototype={c
 THREE.Geometry=function(){this.id=THREE.GeometryCount++;this.vertices=[];this.colors=[];this.materials=[];this.faces=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.morphNormals=[];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);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 e=this.faces[c];b.multiplyVector3(e.normal);for(var f=0,g=e.vertexNormals.length;f<g;f++)b.multiplyVector3(e.vertexNormals[f]);a.multiplyVector3(e.centroid)}},computeCentroids:function(){var a,b,c;for(a=0,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(){var a,b,c,d,e,f,g=new THREE.Vector3,
-h=new THREE.Vector3;for(a=0,b=this.faces.length;a<b;a++)c=this.faces[a],d=this.vertices[c.a],e=this.vertices[c.b],f=this.vertices[c.c],g.sub(f.position,e.position),h.sub(d.position,e.position),g.crossSelf(h),g.isZero()||g.normalize(),c.normal.copy(g)},computeVertexNormals:function(){var a,b,c,d;if(void 0===this.__tmpVertices){d=this.__tmpVertices=Array(this.vertices.length);for(a=0,b=this.vertices.length;a<b;a++)d[a]=new THREE.Vector3;for(a=0,b=this.faces.length;a<b;a++)if(c=this.faces[a],c instanceof
+i=new THREE.Vector3;for(a=0,b=this.faces.length;a<b;a++)c=this.faces[a],d=this.vertices[c.a],e=this.vertices[c.b],f=this.vertices[c.c],g.sub(f.position,e.position),i.sub(d.position,e.position),g.crossSelf(i),g.isZero()||g.normalize(),c.normal.copy(g)},computeVertexNormals:function(){var a,b,c,d;if(void 0===this.__tmpVertices){d=this.__tmpVertices=Array(this.vertices.length);for(a=0,b=this.vertices.length;a<b;a++)d[a]=new THREE.Vector3;for(a=0,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;for(a=0,b=this.vertices.length;a<b;a++)d[a].set(0,0,0)}for(a=0,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));for(a=0,b=this.vertices.length;a<b;a++)d[a].normalize();for(a=0,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]))},computeMorphNormals:function(){var a,b,c,d,e;for(c=0,d=this.faces.length;c<
 d;c++){e=this.faces[c];e.__originalFaceNormal?e.__originalFaceNormal.copy(e.normal):e.__originalFaceNormal=e.normal.clone();if(!e.__originalVertexNormals)e.__originalVertexNormals=[];for(a=0,b=e.vertexNormals.length;a<b;a++)e.__originalVertexNormals[a]?e.__originalVertexNormals[a].copy(e.vertexNormals[a]):e.__originalVertexNormals[a]=e.vertexNormals[a].clone()}var f=new THREE.Geometry;f.faces=this.faces;for(a=0,b=this.morphTargets.length;a<b;a++){if(!this.morphNormals[a]){this.morphNormals[a]={};
-this.morphNormals[a].faceNormals=[];this.morphNormals[a].vertexNormals=[];var g=this.morphNormals[a].faceNormals,h=this.morphNormals[a].vertexNormals,j,i;for(c=0,d=this.faces.length;c<d;c++)e=this.faces[c],j=new THREE.Vector3,i=e instanceof THREE.Face3?{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3}:{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3,d:new THREE.Vector3},g.push(j),h.push(i)}g=this.morphNormals[a];f.vertices=this.morphTargets[a].vertices;f.computeFaceNormals();
-f.computeVertexNormals();for(c=0,d=this.faces.length;c<d;c++)e=this.faces[c],j=g.faceNormals[c],i=g.vertexNormals[c],j.copy(e.normal),e instanceof THREE.Face3?(i.a.copy(e.vertexNormals[0]),i.b.copy(e.vertexNormals[1]),i.c.copy(e.vertexNormals[2])):(i.a.copy(e.vertexNormals[0]),i.b.copy(e.vertexNormals[1]),i.c.copy(e.vertexNormals[2]),i.d.copy(e.vertexNormals[3]))}for(c=0,d=this.faces.length;c<d;c++)e=this.faces[c],e.normal=e.__originalFaceNormal,e.vertexNormals=e.__originalVertexNormals},computeTangents:function(){function a(a,
-b,c,d,e,f,v){h=a.vertices[b].position;j=a.vertices[c].position;i=a.vertices[d].position;k=g[e];l=g[f];n=g[v];m=j.x-h.x;o=i.x-h.x;p=j.y-h.y;u=i.y-h.y;H=j.z-h.z;w=i.z-h.z;C=l.u-k.u;s=n.u-k.u;t=l.v-k.v;y=n.v-k.v;x=1/(C*y-s*t);E.set((y*m-t*o)*x,(y*p-t*u)*x,(y*H-t*w)*x);A.set((C*o-s*m)*x,(C*u-s*p)*x,(C*w-s*H)*x);D[b].addSelf(E);D[c].addSelf(E);D[d].addSelf(E);B[b].addSelf(A);B[c].addSelf(A);B[d].addSelf(A)}var b,c,d,e,f,g,h,j,i,k,l,n,m,o,p,u,H,w,C,s,t,y,x,z,D=[],B=[],E=new THREE.Vector3,A=new THREE.Vector3,
-L=new THREE.Vector3,P=new THREE.Vector3,M=new THREE.Vector3;for(b=0,c=this.vertices.length;b<c;b++)D[b]=new THREE.Vector3,B[b]=new THREE.Vector3;for(b=0,c=this.faces.length;b<c;b++)f=this.faces[b],g=this.faceVertexUvs[0][b],f instanceof THREE.Face3?a(this,f.a,f.b,f.c,0,1,2):f instanceof THREE.Face4&&(a(this,f.a,f.b,f.c,0,1,2),a(this,f.a,f.b,f.d,0,1,3));var N=["a","b","c","d"];for(b=0,c=this.faces.length;b<c;b++){f=this.faces[b];for(d=0;d<f.vertexNormals.length;d++)M.copy(f.vertexNormals[d]),e=f[N[d]],
+this.morphNormals[a].faceNormals=[];this.morphNormals[a].vertexNormals=[];var g=this.morphNormals[a].faceNormals,i=this.morphNormals[a].vertexNormals,j,h;for(c=0,d=this.faces.length;c<d;c++)e=this.faces[c],j=new THREE.Vector3,h=e instanceof THREE.Face3?{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3}:{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3,d:new THREE.Vector3},g.push(j),i.push(h)}g=this.morphNormals[a];f.vertices=this.morphTargets[a].vertices;f.computeFaceNormals();
+f.computeVertexNormals();for(c=0,d=this.faces.length;c<d;c++)e=this.faces[c],j=g.faceNormals[c],h=g.vertexNormals[c],j.copy(e.normal),e instanceof THREE.Face3?(h.a.copy(e.vertexNormals[0]),h.b.copy(e.vertexNormals[1]),h.c.copy(e.vertexNormals[2])):(h.a.copy(e.vertexNormals[0]),h.b.copy(e.vertexNormals[1]),h.c.copy(e.vertexNormals[2]),h.d.copy(e.vertexNormals[3]))}for(c=0,d=this.faces.length;c<d;c++)e=this.faces[c],e.normal=e.__originalFaceNormal,e.vertexNormals=e.__originalVertexNormals},computeTangents:function(){function a(a,
+b,c,d,e,f,v){i=a.vertices[b].position;j=a.vertices[c].position;h=a.vertices[d].position;k=g[e];m=g[f];n=g[v];l=j.x-i.x;o=h.x-i.x;p=j.y-i.y;u=h.y-i.y;H=j.z-i.z;w=h.z-i.z;C=m.u-k.u;s=n.u-k.u;t=m.v-k.v;y=n.v-k.v;x=1/(C*y-s*t);E.set((y*l-t*o)*x,(y*p-t*u)*x,(y*H-t*w)*x);A.set((C*o-s*l)*x,(C*u-s*p)*x,(C*w-s*H)*x);D[b].addSelf(E);D[c].addSelf(E);D[d].addSelf(E);B[b].addSelf(A);B[c].addSelf(A);B[d].addSelf(A)}var b,c,d,e,f,g,i,j,h,k,m,n,l,o,p,u,H,w,C,s,t,y,x,z,D=[],B=[],E=new THREE.Vector3,A=new THREE.Vector3,
+L=new THREE.Vector3,P=new THREE.Vector3,M=new THREE.Vector3;for(b=0,c=this.vertices.length;b<c;b++)D[b]=new THREE.Vector3,B[b]=new THREE.Vector3;for(b=0,c=this.faces.length;b<c;b++)f=this.faces[b],g=this.faceVertexUvs[0][b],f instanceof THREE.Face3?a(this,f.a,f.b,f.c,0,1,2):f instanceof THREE.Face4&&(a(this,f.a,f.b,f.d,0,1,3),a(this,f.b,f.c,f.d,1,2,3));var N=["a","b","c","d"];for(b=0,c=this.faces.length;b<c;b++){f=this.faces[b];for(d=0;d<f.vertexNormals.length;d++)M.copy(f.vertexNormals[d]),e=f[N[d]],
 z=D[e],L.copy(z),L.subSelf(M.multiplyScalar(M.dot(z))).normalize(),P.cross(f.vertexNormals[d],z),e=P.dot(B[e]),e=0>e?-1:1,f.vertexTangents[d]=new THREE.Vector4(L.x,L.y,L.z,e)}this.hasTangents=!0},computeBoundingBox:function(){if(!this.boundingBox)this.boundingBox={min:new THREE.Vector3,max:new THREE.Vector3};if(0<this.vertices.length){var a;a=this.vertices[0].position;this.boundingBox.min.copy(a);this.boundingBox.max.copy(a);for(var b=this.boundingBox.min,c=this.boundingBox.max,d=1,e=this.vertices.length;d<
 e;d++){a=this.vertices[d].position;if(a.x<b.x)b.x=a.x;else if(a.x>c.x)c.x=a.x;if(a.y<b.y)b.y=a.y;else if(a.y>c.y)c.y=a.y;if(a.z<b.z)b.z=a.z;else if(a.z>c.z)c.z=a.z}}else this.boundingBox.min.set(0,0,0),this.boundingBox.max.set(0,0,0)},computeBoundingSphere:function(){if(!this.boundingSphere)this.boundingSphere={radius:0};for(var a,b=0,c=0,d=this.vertices.length;c<d;c++)a=this.vertices[c].position.length(),a>b&&(b=a);this.boundingSphere.radius=b},mergeVertices:function(){var a={},b=[],c=[],d,e=Math.pow(10,
 4),f,g;for(f=0,g=this.vertices.length;f<g;f++)d=this.vertices[f].position,d=[Math.round(d.x*e),Math.round(d.y*e),Math.round(d.z*e)].join("_"),void 0===a[d]?(a[d]=f,b.push(this.vertices[f]),c[f]=b.length-1):c[f]=c[a[d]];for(f=0,g=this.faces.length;f<g;f++)if(a=this.faces[f],a instanceof THREE.Face3)a.a=c[a.a],a.b=c[a.b],a.c=c[a.c];else 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(){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.getRotationFromMatrix(this.matrix)};
-THREE.OrthographicCamera=function(a,b,c,d,e,f){THREE.Camera.call(this);this.left=a;this.right=b;this.top=c;this.bottom=d;this.near=void 0!==e?e:0.1;this.far=void 0!==f?f: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.OrthographicCamera=function(a,b,c,d,e,f){THREE.Camera.call(this);this.left=a;this.right=b;this.top=c;this.bottom=d;this.near=void 0!==e?e:0.1;this.far=void 0!==f?f:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=new THREE.Camera;THREE.OrthographicCamera.prototype.constructor=THREE.OrthographicCamera;THREE.OrthographicCamera.prototype.updateProjectionMatrix=function(){this.projectionMatrix.makeOrthographic(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=void 0!==a?a:50;this.aspect=void 0!==b?b:1;this.near=void 0!==c?c:0.1;this.far=void 0!==d?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((void 0!==b?b:24)/(2*a))*(180/Math.PI);this.updateProjectionMatrix()};
 THREE.PerspectiveCamera.prototype.setViewOffset=function(a,b,c,d,e,f){this.fullWidth=a;this.fullHeight=b;this.x=c;this.y=d;this.width=e;this.height=f;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.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.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.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.target=new THREE.Object3D;this.intensity=void 0!==b?b:1;this.distance=void 0!==c?c:0;this.onlyShadow=this.castShadow=!1;this.shadowCameraNear=50;this.shadowCameraFar=5E3;this.shadowCameraLeft=-500;this.shadowCameraTop=this.shadowCameraRight=500;this.shadowCameraBottom=-500;this.shadowCameraVisible=!1;this.shadowBias=0;this.shadowDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowCascade=
 !1;this.shadowCascadeOffset=new THREE.Vector3(0,0,-1E3);this.shadowCascadeCount=2;this.shadowCascadeBias=[0,0,0];this.shadowCascadeWidth=[512,512,512];this.shadowCascadeHeight=[512,512,512];this.shadowCascadeNearZ=[-1,0.99,0.998];this.shadowCascadeFarZ=[0.99,0.998,1];this.shadowCascadeArray=[];this.shadowMatrix=this.shadowCamera=this.shadowMapSize=this.shadowMap=null};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=void 0!==b?b:1;this.distance=void 0!==c?c:0};THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight;
-THREE.Material=function(a){a=a||{};this.id=THREE.MaterialCount++;this.name="";this.opacity=void 0!==a.opacity?a.opacity:1;this.transparent=void 0!==a.transparent?a.transparent:!1;this.blending=void 0!==a.blending?a.blending:THREE.NormalBlending;this.depthTest=void 0!==a.depthTest?a.depthTest:!0;this.depthWrite=void 0!==a.depthWrite?a.depthWrite:!0;this.polygonOffset=void 0!==a.polygonOffset?a.polygonOffset:!1;this.polygonOffsetFactor=void 0!==a.polygonOffsetFactor?a.polygonOffsetFactor:0;this.polygonOffsetUnits=
-void 0!==a.polygonOffsetUnits?a.polygonOffsetUnits:0;this.alphaTest=void 0!==a.alphaTest?a.alphaTest:0;this.overdraw=void 0!==a.overdraw?a.overdraw:!1;this.needsUpdate=!0};THREE.MaterialCount=0;THREE.NoShading=0;THREE.FlatShading=1;THREE.SmoothShading=2;THREE.NoColors=0;THREE.FaceColors=1;THREE.VertexColors=2;THREE.NoBlending=0;THREE.NormalBlending=1;THREE.AdditiveBlending=2;THREE.SubtractiveBlending=3;THREE.MultiplyBlending=4;THREE.AdditiveAlphaBlending=5;
+THREE.Material=function(a){a=a||{};this.id=THREE.MaterialCount++;this.name="";this.opacity=void 0!==a.opacity?a.opacity:1;this.transparent=void 0!==a.transparent?a.transparent:!1;this.blending=void 0!==a.blending?a.blending:THREE.NormalBlending;this.blendSrc=void 0!==a.blendSrc?a.blendSrc:THREE.SrcAlphaFactor;this.blendDst=void 0!==a.blendDst?a.blendDst:THREE.OneMinusSrcAlphaFactor;this.blendEquation=void 0!==a.blendEquation?a.blendEquation:THREE.AddEquation;this.depthTest=void 0!==a.depthTest?a.depthTest:
+!0;this.depthWrite=void 0!==a.depthWrite?a.depthWrite:!0;this.polygonOffset=void 0!==a.polygonOffset?a.polygonOffset:!1;this.polygonOffsetFactor=void 0!==a.polygonOffsetFactor?a.polygonOffsetFactor:0;this.polygonOffsetUnits=void 0!==a.polygonOffsetUnits?a.polygonOffsetUnits:0;this.alphaTest=void 0!==a.alphaTest?a.alphaTest:0;this.overdraw=void 0!==a.overdraw?a.overdraw:!1;this.needsUpdate=!0};THREE.MaterialCount=0;THREE.NoShading=0;THREE.FlatShading=1;THREE.SmoothShading=2;THREE.NoColors=0;
+THREE.FaceColors=1;THREE.VertexColors=2;THREE.NoBlending=0;THREE.NormalBlending=1;THREE.AdditiveBlending=2;THREE.SubtractiveBlending=3;THREE.MultiplyBlending=4;THREE.AdditiveAlphaBlending=5;THREE.CustomBlending=6;THREE.AddEquation=100;THREE.SubtractEquation=101;THREE.ReverseSubtractEquation=102;THREE.ZeroFactor=200;THREE.OneFactor=201;THREE.SrcColorFactor=202;THREE.OneMinusSrcColorFactor=203;THREE.SrcAlphaFactor=204;THREE.OneMinusSrcAlphaFactor=205;THREE.DstAlphaFactor=206;
+THREE.OneMinusDstAlphaFactor=207;THREE.DstColorFactor=208;THREE.OneMinusDstColorFactor=209;THREE.SrcAlphaSaturateFactor=210;
 THREE.LineBasicMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=void 0!==a.color?new THREE.Color(a.color):new THREE.Color(16777215);this.linewidth=void 0!==a.linewidth?a.linewidth:1;this.linecap=void 0!==a.linecap?a.linecap:"round";this.linejoin=void 0!==a.linejoin?a.linejoin:"round";this.vertexColors=a.vertexColors?a.vertexColors:!1;this.fog=void 0!==a.fog?a.fog:!0};THREE.LineBasicMaterial.prototype=new THREE.Material;THREE.LineBasicMaterial.prototype.constructor=THREE.LineBasicMaterial;
 THREE.MeshBasicMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=void 0!==a.color?new THREE.Color(a.color):new THREE.Color(16777215);this.map=void 0!==a.map?a.map:null;this.lightMap=void 0!==a.lightMap?a.lightMap:null;this.envMap=void 0!==a.envMap?a.envMap:null;this.combine=void 0!==a.combine?a.combine:THREE.MultiplyOperation;this.reflectivity=void 0!==a.reflectivity?a.reflectivity:1;this.refractionRatio=void 0!==a.refractionRatio?a.refractionRatio:0.98;this.fog=void 0!==a.fog?a.fog:
 !0;this.shading=void 0!==a.shading?a.shading:THREE.SmoothShading;this.wireframe=void 0!==a.wireframe?a.wireframe:!1;this.wireframeLinewidth=void 0!==a.wireframeLinewidth?a.wireframeLinewidth:1;this.wireframeLinecap=void 0!==a.wireframeLinecap?a.wireframeLinecap:"round";this.wireframeLinejoin=void 0!==a.wireframeLinejoin?a.wireframeLinejoin:"round";this.vertexColors=void 0!==a.vertexColors?a.vertexColors:THREE.NoColors;this.skinning=void 0!==a.skinning?a.skinning:!1;this.morphTargets=void 0!==a.morphTargets?
@@ -123,33 +125,33 @@ a.shading?a.shading:THREE.SmoothShading;this.wireframe=void 0!==a.wireframe?a.wi
 !1;this.morphNormals=void 0!==a.morphNormals?a.morphNormals:!1};THREE.MeshPhongMaterial.prototype=new THREE.Material;THREE.MeshPhongMaterial.prototype.constructor=THREE.MeshPhongMaterial;THREE.MeshDepthMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.shading=void 0!==a.shading?a.shading:THREE.SmoothShading;this.wireframe=void 0!==a.wireframe?a.wireframe:!1;this.wireframeLinewidth=void 0!==a.wireframeLinewidth?a.wireframeLinewidth:1};THREE.MeshDepthMaterial.prototype=new THREE.Material;
 THREE.MeshDepthMaterial.prototype.constructor=THREE.MeshDepthMaterial;THREE.MeshNormalMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.shading=a.shading?a.shading:THREE.FlatShading;this.wireframe=a.wireframe?a.wireframe:!1;this.wireframeLinewidth=a.wireframeLinewidth?a.wireframeLinewidth:1};THREE.MeshNormalMaterial.prototype=new THREE.Material;THREE.MeshNormalMaterial.prototype.constructor=THREE.MeshNormalMaterial;THREE.MeshFaceMaterial=function(){};
 THREE.ParticleBasicMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=void 0!==a.color?new THREE.Color(a.color):new THREE.Color(16777215);this.map=void 0!==a.map?a.map:null;this.size=void 0!==a.size?a.size:1;this.sizeAttenuation=void 0!==a.sizeAttenuation?a.sizeAttenuation:!0;this.vertexColors=void 0!==a.vertexColors?a.vertexColors:!1;this.fog=void 0!==a.fog?a.fog:!0};THREE.ParticleBasicMaterial.prototype=new THREE.Material;THREE.ParticleBasicMaterial.prototype.constructor=THREE.ParticleBasicMaterial;
-THREE.Texture=function(a,b,c,d,e,f,g,h){this.id=THREE.TextureCount++;this.image=a;this.mapping=void 0!==b?b:new THREE.UVMapping;this.wrapS=void 0!==c?c:THREE.ClampToEdgeWrapping;this.wrapT=void 0!==d?d:THREE.ClampToEdgeWrapping;this.magFilter=void 0!==e?e:THREE.LinearFilter;this.minFilter=void 0!==f?f:THREE.LinearMipMapLinearFilter;this.format=void 0!==g?g:THREE.RGBAFormat;this.type=void 0!==h?h:THREE.UnsignedByteType;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.generateMipmaps=
-!0;this.needsUpdate=!1;this.onUpdate=null};THREE.Texture.prototype={constructor:THREE.Texture,clone:function(){var a=new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter,this.format,this.type);a.offset.copy(this.offset);a.repeat.copy(this.repeat);return a}};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(a,b,c,d,e,f,g,h,j,i){THREE.Texture.call(this,null,f,g,h,j,i,d,e);this.image={data:a,width:b,height:c}};THREE.DataTexture.prototype=new THREE.Texture;THREE.DataTexture.prototype.constructor=THREE.DataTexture;
+THREE.Texture=function(a,b,c,d,e,f,g,i){this.id=THREE.TextureCount++;this.image=a;this.mapping=void 0!==b?b:new THREE.UVMapping;this.wrapS=void 0!==c?c:THREE.ClampToEdgeWrapping;this.wrapT=void 0!==d?d:THREE.ClampToEdgeWrapping;this.magFilter=void 0!==e?e:THREE.LinearFilter;this.minFilter=void 0!==f?f:THREE.LinearMipMapLinearFilter;this.format=void 0!==g?g:THREE.RGBAFormat;this.type=void 0!==i?i:THREE.UnsignedByteType;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.generateMipmaps=
+!0;this.needsUpdate=this.premultiplyAlpha=!1;this.onUpdate=null};THREE.Texture.prototype={constructor:THREE.Texture,clone:function(){var a=new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter,this.format,this.type);a.offset.copy(this.offset);a.repeat.copy(this.repeat);return a}};THREE.TextureCount=0;THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.UVMapping=function(){};THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};
+THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=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(a,b,c,d,e,f,g,i,j,h){THREE.Texture.call(this,null,f,g,i,j,h,d,e);this.image={data:a,width:b,height:c}};THREE.DataTexture.prototype=new THREE.Texture;THREE.DataTexture.prototype.constructor=THREE.DataTexture;
 THREE.DataTexture.prototype.clone=function(){var a=new THREE.DataTexture(this.image.data,this.image.width,this.image.height,this.format,this.type,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter);a.offset.copy(this.offset);a.repeat.copy(this.repeat);return a};THREE.Particle=function(a){THREE.Object3D.call(this);this.material=a};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;
 THREE.Line=function(a,b,c){THREE.Object3D.call(this);this.geometry=a;this.material=void 0!==b?b:new THREE.LineBasicMaterial({color:16777215*Math.random()});this.type=void 0!==c?c:THREE.LineStrip;this.geometry&&(this.geometry.boundingSphere||this.geometry.computeBoundingSphere())};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;
 THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material=void 0!==b?b:new THREE.MeshBasicMaterial({color:16777215*Math.random(),wireframe:!0});if(this.geometry&&(this.geometry.boundingSphere||this.geometry.computeBoundingSphere(),this.boundRadius=a.boundingSphere.radius,this.geometry.morphTargets.length)){this.morphTargetBase=-1;this.morphTargetForcedOrder=[];this.morphTargetInfluences=[];this.morphTargetDictionary={};for(var c=0;c<this.geometry.morphTargets.length;c++)this.morphTargetInfluences.push(0),
 this.morphTargetDictionary[this.geometry.morphTargets[c].name]=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(void 0!==this.morphTargetDictionary[a])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};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){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 c,d=this.children.length;for(c=0;c<d;c++)this.children[c].update(this.skinMatrix,b)};
-THREE.Sprite=function(a){THREE.Object3D.call(this);this.color=void 0!==a.color?new THREE.Color(a.color):new THREE.Color(16777215);this.map=void 0!==a.map?a.map:new THREE.Texture;this.blending=void 0!==a.blending?a.blending:THREE.NormalBlending;this.useScreenCoordinates=void 0!==a.useScreenCoordinates?a.useScreenCoordinates:!0;this.mergeWith3D=void 0!==a.mergeWith3D?a.mergeWith3D:!this.useScreenCoordinates;this.affectedByDistance=void 0!==a.affectedByDistance?a.affectedByDistance:!this.useScreenCoordinates;
-this.scaleByViewport=void 0!==a.scaleByViewport?a.scaleByViewport:!this.affectedByDistance;this.alignment=a.alignment instanceof THREE.Vector2?a.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.updateMatrix=function(){this.matrix.setPosition(this.position);this.rotation3d.set(0,0,this.rotation);this.matrix.setRotationFromEuler(this.rotation3d);if(1!==this.scale.x||1!==this.scale.y)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.overrideMaterial=this.fog=null;this.matrixAutoUpdate=!1;this.__objects=[];this.__lights=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;
+THREE.Sprite=function(a){THREE.Object3D.call(this);this.color=void 0!==a.color?new THREE.Color(a.color):new THREE.Color(16777215);this.map=void 0!==a.map?a.map:new THREE.Texture;this.blending=void 0!==a.blending?a.blending:THREE.NormalBlending;this.blendSrc=void 0!==a.blendSrc?a.blendSrc:THREE.SrcAlphaFactor;this.blendDst=void 0!==a.blendDst?a.blendDst:THREE.OneMinusSrcAlphaFactor;this.blendEquation=void 0!==a.blendEquation?a.blendEquation:THREE.AddEquation;this.useScreenCoordinates=void 0!==a.useScreenCoordinates?
+a.useScreenCoordinates:!0;this.mergeWith3D=void 0!==a.mergeWith3D?a.mergeWith3D:!this.useScreenCoordinates;this.affectedByDistance=void 0!==a.affectedByDistance?a.affectedByDistance:!this.useScreenCoordinates;this.scaleByViewport=void 0!==a.scaleByViewport?a.scaleByViewport:!this.affectedByDistance;this.alignment=a.alignment instanceof THREE.Vector2?a.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.updateMatrix=function(){this.matrix.setPosition(this.position);this.rotation3d.set(0,0,this.rotation);this.matrix.setRotationFromEuler(this.rotation3d);if(1!==this.scale.x||1!==this.scale.y)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.overrideMaterial=this.fog=null;this.matrixAutoUpdate=!1;this.__objects=[];this.__lights=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;
 THREE.Scene.prototype.__addObject=function(a){if(a instanceof THREE.Light)-1===this.__lights.indexOf(a)&&this.__lights.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&-1===this.__objects.indexOf(a)){this.__objects.push(a);this.__objectsAdded.push(a);var b=this.__objectsRemoved.indexOf(a);-1!==b&&this.__objectsRemoved.splice(b,1)}for(b=0;b<a.children.length;b++)this.__addObject(a.children[b])};
 THREE.Scene.prototype.__removeObject=function(a){if(a instanceof THREE.Light){var b=this.__lights.indexOf(a);-1!==b&&this.__lights.splice(b,1)}else a instanceof THREE.Camera||(b=this.__objects.indexOf(a),-1!==b&&(this.__objects.splice(b,1),this.__objectsRemoved.push(a),b=this.__objectsAdded.indexOf(a),-1!==b&&this.__objectsAdded.splice(b,1)));for(b=0;b<a.children.length;b++)this.__removeObject(a.children[b])};
 THREE.SVGRenderer=function(){function a(a,b,c,d){var e,f,g,h,i,j;for(e=0,f=a.length;e<f;e++)g=a[e],h=g.color,g instanceof THREE.DirectionalLight?(i=g.matrixWorld.getPosition(),j=c.dot(i),0>=j||(j*=g.intensity,d.r+=h.r*j,d.g+=h.g*j,d.b+=h.b*j)):g instanceof THREE.PointLight&&(i=g.matrixWorld.getPosition(),j=c.dot(D.sub(i,b).normalize()),0>=j||(j*=0==g.distance?1:1-Math.min(b.distanceTo(i)/g.distance,1),0!=j&&(j*=g.intensity,d.r+=h.r*j,d.g+=h.g*j,d.b+=h.b*j)))}function b(a){null==B[a]&&(B[a]=document.createElementNS("http://www.w3.org/2000/svg",
-"path"),0==M&&B[a].setAttribute("shape-rendering","crispEdges"));return B[a]}function c(a){a=0.5*(a+1);return 0>a?0:1<a?1:a}var d=this,e,f,g,h=new THREE.Projector,j=document.createElementNS("http://www.w3.org/2000/svg","svg"),i,k,l,n,m,o,p,u,H=new THREE.Rectangle,w=new THREE.Rectangle,C=!1,s=new THREE.Color,t=new THREE.Color,y=new THREE.Color,x=new THREE.Color,z,D=new THREE.Vector3,B=[],E=[],A,L,P,M=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":M=1;break;case "low":M=0}};this.setSize=function(a,b){i=a;k=b;l=i/2;n=k/2;j.setAttribute("viewBox",-l+" "+-n+" "+i+" "+k);j.setAttribute("width",i);j.setAttribute("height",k);H.set(-l,-n,l,n)};this.clear=function(){for(;0<j.childNodes.length;)j.removeChild(j.childNodes[0])};this.render=function(i,k){var B,D,r,q;this.autoClear&&this.clear();d.info.render.vertices=0;d.info.render.faces=0;e=h.projectScene(i,k,this.sortElements);f=e.elements;
-g=e.lights;P=L=0;if(C=0<g.length){t.setRGB(0,0,0);y.setRGB(0,0,0);x.setRGB(0,0,0);for(B=0,D=g.length;B<D;B++)q=g[B],r=q.color,q instanceof THREE.AmbientLight?(t.r+=r.r,t.g+=r.g,t.b+=r.b):q instanceof THREE.DirectionalLight?(y.r+=r.r,y.g+=r.g,y.b+=r.b):q instanceof THREE.PointLight&&(x.r+=r.r,x.g+=r.g,x.b+=r.b)}for(B=0,D=f.length;B<D;B++)if(r=f[B],q=r.material,q=q instanceof THREE.MeshFaceMaterial?r.faceMaterial:q,!(null==q||0==q.opacity))if(w.empty(),r instanceof THREE.RenderableParticle)m=r,m.x*=
-l,m.y*=-n;else if(r instanceof THREE.RenderableLine){if(m=r.v1,o=r.v2,m.positionScreen.x*=l,m.positionScreen.y*=-n,o.positionScreen.x*=l,o.positionScreen.y*=-n,w.addPoint(m.positionScreen.x,m.positionScreen.y),w.addPoint(o.positionScreen.x,o.positionScreen.y),H.intersects(w)){r=m;var J=o,v=P++;null==E[v]&&(E[v]=document.createElementNS("http://www.w3.org/2000/svg","line"),0==M&&E[v].setAttribute("shape-rendering","crispEdges"));A=E[v];A.setAttribute("x1",r.positionScreen.x);A.setAttribute("y1",r.positionScreen.y);
-A.setAttribute("x2",J.positionScreen.x);A.setAttribute("y2",J.positionScreen.y);q instanceof THREE.LineBasicMaterial&&(A.setAttribute("style","fill: none; stroke: "+q.color.getContextStyle()+"; stroke-width: "+q.linewidth+"; stroke-opacity: "+q.opacity+"; stroke-linecap: "+q.linecap+"; stroke-linejoin: "+q.linejoin),j.appendChild(A))}}else if(r instanceof THREE.RenderableFace3){if(m=r.v1,o=r.v2,p=r.v3,m.positionScreen.x*=l,m.positionScreen.y*=-n,o.positionScreen.x*=l,o.positionScreen.y*=-n,p.positionScreen.x*=
-l,p.positionScreen.y*=-n,w.addPoint(m.positionScreen.x,m.positionScreen.y),w.addPoint(o.positionScreen.x,o.positionScreen.y),w.addPoint(p.positionScreen.x,p.positionScreen.y),H.intersects(w)){var J=m,v=o,G=p;d.info.render.vertices+=3;d.info.render.faces++;A=b(L++);A.setAttribute("d","M "+J.positionScreen.x+" "+J.positionScreen.y+" L "+v.positionScreen.x+" "+v.positionScreen.y+" L "+G.positionScreen.x+","+G.positionScreen.y+"z");q instanceof THREE.MeshBasicMaterial?s.copy(q.color):q instanceof THREE.MeshLambertMaterial?
+"path"),0==M&&B[a].setAttribute("shape-rendering","crispEdges"));return B[a]}function c(a){a=0.5*(a+1);return 0>a?0:1<a?1:a}var d=this,e,f,g,i=new THREE.Projector,j=document.createElementNS("http://www.w3.org/2000/svg","svg"),h,k,m,n,l,o,p,u,H=new THREE.Rectangle,w=new THREE.Rectangle,C=!1,s=new THREE.Color,t=new THREE.Color,y=new THREE.Color,x=new THREE.Color,z,D=new THREE.Vector3,B=[],E=[],A,L,P,M=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":M=1;break;case "low":M=0}};this.setSize=function(a,b){h=a;k=b;m=h/2;n=k/2;j.setAttribute("viewBox",-m+" "+-n+" "+h+" "+k);j.setAttribute("width",h);j.setAttribute("height",k);H.set(-m,-n,m,n)};this.clear=function(){for(;0<j.childNodes.length;)j.removeChild(j.childNodes[0])};this.render=function(h,k){var B,D,r,q;this.autoClear&&this.clear();d.info.render.vertices=0;d.info.render.faces=0;e=i.projectScene(h,k,this.sortElements);f=e.elements;
+g=e.lights;P=L=0;if(C=0<g.length){t.setRGB(0,0,0);y.setRGB(0,0,0);x.setRGB(0,0,0);for(B=0,D=g.length;B<D;B++)q=g[B],r=q.color,q instanceof THREE.AmbientLight?(t.r+=r.r,t.g+=r.g,t.b+=r.b):q instanceof THREE.DirectionalLight?(y.r+=r.r,y.g+=r.g,y.b+=r.b):q instanceof THREE.PointLight&&(x.r+=r.r,x.g+=r.g,x.b+=r.b)}for(B=0,D=f.length;B<D;B++)if(r=f[B],q=r.material,q=q instanceof THREE.MeshFaceMaterial?r.faceMaterial:q,!(null==q||0==q.opacity))if(w.empty(),r instanceof THREE.RenderableParticle)l=r,l.x*=
+m,l.y*=-n;else if(r instanceof THREE.RenderableLine){if(l=r.v1,o=r.v2,l.positionScreen.x*=m,l.positionScreen.y*=-n,o.positionScreen.x*=m,o.positionScreen.y*=-n,w.addPoint(l.positionScreen.x,l.positionScreen.y),w.addPoint(o.positionScreen.x,o.positionScreen.y),H.intersects(w)){r=l;var J=o,v=P++;null==E[v]&&(E[v]=document.createElementNS("http://www.w3.org/2000/svg","line"),0==M&&E[v].setAttribute("shape-rendering","crispEdges"));A=E[v];A.setAttribute("x1",r.positionScreen.x);A.setAttribute("y1",r.positionScreen.y);
+A.setAttribute("x2",J.positionScreen.x);A.setAttribute("y2",J.positionScreen.y);q instanceof THREE.LineBasicMaterial&&(A.setAttribute("style","fill: none; stroke: "+q.color.getContextStyle()+"; stroke-width: "+q.linewidth+"; stroke-opacity: "+q.opacity+"; stroke-linecap: "+q.linecap+"; stroke-linejoin: "+q.linejoin),j.appendChild(A))}}else if(r instanceof THREE.RenderableFace3){if(l=r.v1,o=r.v2,p=r.v3,l.positionScreen.x*=m,l.positionScreen.y*=-n,o.positionScreen.x*=m,o.positionScreen.y*=-n,p.positionScreen.x*=
+m,p.positionScreen.y*=-n,w.addPoint(l.positionScreen.x,l.positionScreen.y),w.addPoint(o.positionScreen.x,o.positionScreen.y),w.addPoint(p.positionScreen.x,p.positionScreen.y),H.intersects(w)){var J=l,v=o,G=p;d.info.render.vertices+=3;d.info.render.faces++;A=b(L++);A.setAttribute("d","M "+J.positionScreen.x+" "+J.positionScreen.y+" L "+v.positionScreen.x+" "+v.positionScreen.y+" L "+G.positionScreen.x+","+G.positionScreen.y+"z");q instanceof THREE.MeshBasicMaterial?s.copy(q.color):q instanceof THREE.MeshLambertMaterial?
 C?(s.r=t.r,s.g=t.g,s.b=t.b,a(g,r.centroidWorld,r.normalWorld,s),s.r=Math.max(0,Math.min(q.color.r*s.r,1)),s.g=Math.max(0,Math.min(q.color.g*s.g,1)),s.b=Math.max(0,Math.min(q.color.b*s.b,1))):s.copy(q.color):q instanceof THREE.MeshDepthMaterial?(z=1-q.__2near/(q.__farPlusNear-r.z*q.__farMinusNear),s.setRGB(z,z,z)):q instanceof THREE.MeshNormalMaterial&&s.setRGB(c(r.normalWorld.x),c(r.normalWorld.y),c(r.normalWorld.z));q.wireframe?A.setAttribute("style","fill: none; stroke: "+s.getContextStyle()+"; stroke-width: "+
-q.wireframeLinewidth+"; stroke-opacity: "+q.opacity+"; stroke-linecap: "+q.wireframeLinecap+"; stroke-linejoin: "+q.wireframeLinejoin):A.setAttribute("style","fill: "+s.getContextStyle()+"; fill-opacity: "+q.opacity);j.appendChild(A)}}else if(r instanceof THREE.RenderableFace4&&(m=r.v1,o=r.v2,p=r.v3,u=r.v4,m.positionScreen.x*=l,m.positionScreen.y*=-n,o.positionScreen.x*=l,o.positionScreen.y*=-n,p.positionScreen.x*=l,p.positionScreen.y*=-n,u.positionScreen.x*=l,u.positionScreen.y*=-n,w.addPoint(m.positionScreen.x,
-m.positionScreen.y),w.addPoint(o.positionScreen.x,o.positionScreen.y),w.addPoint(p.positionScreen.x,p.positionScreen.y),w.addPoint(u.positionScreen.x,u.positionScreen.y),H.intersects(w))){var J=m,v=o,G=p,I=u;d.info.render.vertices+=4;d.info.render.faces++;A=b(L++);A.setAttribute("d","M "+J.positionScreen.x+" "+J.positionScreen.y+" L "+v.positionScreen.x+" "+v.positionScreen.y+" L "+G.positionScreen.x+","+G.positionScreen.y+" L "+I.positionScreen.x+","+I.positionScreen.y+"z");q instanceof THREE.MeshBasicMaterial?
+q.wireframeLinewidth+"; stroke-opacity: "+q.opacity+"; stroke-linecap: "+q.wireframeLinecap+"; stroke-linejoin: "+q.wireframeLinejoin):A.setAttribute("style","fill: "+s.getContextStyle()+"; fill-opacity: "+q.opacity);j.appendChild(A)}}else if(r instanceof THREE.RenderableFace4&&(l=r.v1,o=r.v2,p=r.v3,u=r.v4,l.positionScreen.x*=m,l.positionScreen.y*=-n,o.positionScreen.x*=m,o.positionScreen.y*=-n,p.positionScreen.x*=m,p.positionScreen.y*=-n,u.positionScreen.x*=m,u.positionScreen.y*=-n,w.addPoint(l.positionScreen.x,
+l.positionScreen.y),w.addPoint(o.positionScreen.x,o.positionScreen.y),w.addPoint(p.positionScreen.x,p.positionScreen.y),w.addPoint(u.positionScreen.x,u.positionScreen.y),H.intersects(w))){var J=l,v=o,G=p,I=u;d.info.render.vertices+=4;d.info.render.faces++;A=b(L++);A.setAttribute("d","M "+J.positionScreen.x+" "+J.positionScreen.y+" L "+v.positionScreen.x+" "+v.positionScreen.y+" L "+G.positionScreen.x+","+G.positionScreen.y+" L "+I.positionScreen.x+","+I.positionScreen.y+"z");q instanceof THREE.MeshBasicMaterial?
 s.copy(q.color):q instanceof THREE.MeshLambertMaterial?C?(s.r=t.r,s.g=t.g,s.b=t.b,a(g,r.centroidWorld,r.normalWorld,s),s.r=Math.max(0,Math.min(q.color.r*s.r,1)),s.g=Math.max(0,Math.min(q.color.g*s.g,1)),s.b=Math.max(0,Math.min(q.color.b*s.b,1))):s.copy(q.color):q instanceof THREE.MeshDepthMaterial?(z=1-q.__2near/(q.__farPlusNear-r.z*q.__farMinusNear),s.setRGB(z,z,z)):q instanceof THREE.MeshNormalMaterial&&s.setRGB(c(r.normalWorld.x),c(r.normalWorld.y),c(r.normalWorld.z));q.wireframe?A.setAttribute("style",
 "fill: none; stroke: "+s.getContextStyle()+"; stroke-width: "+q.wireframeLinewidth+"; stroke-opacity: "+q.opacity+"; stroke-linecap: "+q.wireframeLinecap+"; stroke-linejoin: "+q.wireframeLinejoin):A.setAttribute("style","fill: "+s.getContextStyle()+"; fill-opacity: "+q.opacity);j.appendChild(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)};

+ 223 - 219
build/custom/ThreeWebGL.js

@@ -1,6 +1,6 @@
 // ThreeWebGL.js - http://github.com/mrdoob/three.js
 'use strict';var THREE=THREE||{REVISION:"49dev"};if(!self.Int32Array)self.Int32Array=Array,self.Float32Array=Array;
-(function(){for(var a=0,b=["ms","moz","webkit","o"],c=0;c<b.length&&!window.requestAnimationFrame;++c)window.requestAnimationFrame=window[b[c]+"RequestAnimationFrame"],window.cancelAnimationFrame=window[b[c]+"CancelAnimationFrame"]||window[b[c]+"CancelRequestAnimationFrame"];if(!window.requestAnimationFrame)window.requestAnimationFrame=function(b){var c=(new Date).getTime(),g=Math.max(0,16-(c-a)),i=window.setTimeout(function(){b(c+g)},g);a=c+g;return i};if(!window.cancelAnimationFrame)window.cancelAnimationFrame=
+(function(){for(var a=0,b=["ms","moz","webkit","o"],c=0;c<b.length&&!window.requestAnimationFrame;++c)window.requestAnimationFrame=window[b[c]+"RequestAnimationFrame"],window.cancelAnimationFrame=window[b[c]+"CancelAnimationFrame"]||window[b[c]+"CancelRequestAnimationFrame"];if(!window.requestAnimationFrame)window.requestAnimationFrame=function(b){var c=(new Date).getTime(),g=Math.max(0,16-(c-a)),h=window.setTimeout(function(){b(c+g)},g);a=c+g;return h};if(!window.cancelAnimationFrame)window.cancelAnimationFrame=
 function(a){clearTimeout(a)}})();THREE.Color=function(a){void 0!==a&&this.setHex(a);return this};
 THREE.Color.prototype={constructor:THREE.Color,r:1,g:1,b:1,copy:function(a){this.r=a.r;this.g=a.g;this.b=a.b;return this},copyGammaToLinear:function(a){this.r=a.r*a.r;this.g=a.g*a.g;this.b=a.b*a.b;return this},copyLinearToGamma:function(a){this.r=Math.sqrt(a.r);this.g=Math.sqrt(a.g);this.b=Math.sqrt(a.b);return this},convertGammaToLinear:function(){var a=this.r,b=this.g,c=this.b;this.r=a*a;this.g=b*b;this.b=c*c;return this},convertLinearToGamma:function(){this.r=Math.sqrt(this.r);this.g=Math.sqrt(this.g);
 this.b=Math.sqrt(this.b);return this},setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;return this},setHSV:function(a,b,c){var d,f,g;if(0===c)this.r=this.g=this.b=0;else switch(d=Math.floor(6*a),f=6*a-d,a=c*(1-b),g=c*(1-b*f),b=c*(1-b*(1-f)),d){case 1:this.r=g;this.g=c;this.b=a;break;case 2:this.r=a;this.g=c;this.b=b;break;case 3:this.r=a;this.g=g;this.b=c;break;case 4:this.r=b;this.g=a;this.b=c;break;case 5:this.r=c;this.g=a;this.b=g;break;case 6:case 0:this.r=c,this.g=b,this.b=a}return this},setHex:function(a){a=
@@ -13,49 +13,49 @@ THREE.Vector3.prototype={constructor:THREE.Vector3,set:function(a,b,c){this.x=a;
 sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;return this},multiply:function(a,b){this.x=a.x*b.x;this.y=a.y*b.y;this.z=a.z*b.z;return this},multiplySelf:function(a){this.x*=a.x;this.y*=a.y;this.z*=a.z;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;return this},divideSelf:function(a){this.x/=a.x;this.y/=a.y;this.z/=a.z;return this},divideScalar:function(a){a?(this.x/=a,this.y/=a,this.z/=a):
 this.z=this.y=this.x=0;return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.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 Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},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;return this},cross:function(a,b){this.x=a.y*b.z-a.z*b.y;this.y=a.z*b.x-a.x*b.z;this.z=a.x*b.y-a.y*b.x;return this},crossSelf:function(a){var b=this.x,c=this.y,d=this.z;this.x=c*a.z-d*a.y;this.y=d*a.x-b*a.z;this.z=b*a.y-c*a.x;return this},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){return(new THREE.Vector3).sub(this,a).lengthSq()},getPositionFromMatrix:function(a){this.x=a.n14;this.y=
-a.n24;this.z=a.n34;return this},getRotationFromMatrix:function(a,b){var c=b?b.x:1,d=b?b.y:1,f=b?b.z:1,g=a.n11/c,i=a.n12/d,c=a.n21/c,d=a.n22/d,h=a.n23/f,k=a.n33/f;this.y=Math.asin(a.n13/f);f=Math.cos(this.y);1.0E-5<Math.abs(f)?(this.x=Math.atan2(-h/f,k/f),this.z=Math.atan2(-i/f,g/f)):(this.x=0,this.z=Math.atan2(c,d));return this},getScaleFromMatrix:function(a){var b=this.set(a.n11,a.n21,a.n31).length(),c=this.set(a.n12,a.n22,a.n32).length(),a=this.set(a.n13,a.n23,a.n33).length();this.x=b;this.y=c;
+a.n24;this.z=a.n34;return this},getRotationFromMatrix:function(a,b){var c=b?b.x:1,d=b?b.y:1,f=b?b.z:1,g=a.n11/c,h=a.n12/d,c=a.n21/c,d=a.n22/d,i=a.n23/f,k=a.n33/f;this.y=Math.asin(a.n13/f);f=Math.cos(this.y);1.0E-5<Math.abs(f)?(this.x=Math.atan2(-i/f,k/f),this.z=Math.atan2(-h/f,g/f)):(this.x=0,this.z=Math.atan2(c,d));return this},getScaleFromMatrix:function(a){var b=this.set(a.n11,a.n21,a.n31).length(),c=this.set(a.n12,a.n22,a.n32).length(),a=this.set(a.n13,a.n23,a.n33).length();this.x=b;this.y=c;
 this.z=a},equals:function(a){return a.x===this.x&&a.y===this.y&&a.z===this.z},isZero:function(){return 1.0E-4>this.lengthSq()},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};THREE.Vector4=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=void 0!==d?d:1};
 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=void 0!==a.w?a.w:1;return this},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},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Frustum=function(){this.planes=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4]};
 THREE.Frustum.prototype.setFromMatrix=function(a){var b,c=this.planes;c[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);c[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);c[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+a.n23,a.n44+a.n24);c[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);c[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);c[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+a.n33,a.n44+a.n34);for(a=0;6>a;a++)b=c[a],b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))};
 THREE.Frustum.prototype.contains=function(a){for(var b=this.planes,c=a.matrixWorld,d=THREE.Frustum.__v1.set(c.getColumnX().length(),c.getColumnY().length(),c.getColumnZ().length()),d=-a.geometry.boundingSphere.radius*Math.max(d.x,Math.max(d.y,d.z)),f=0;6>f;f++)if(a=b[f].x*c.n14+b[f].y*c.n24+b[f].z*c.n34+b[f].w,a<=d)return!1;return!0};THREE.Frustum.__v1=new THREE.Vector3;
-THREE.Ray=function(a,b){function c(a,b,c){r.sub(c,a);z=r.dot(b);w=o.add(a,q.copy(b).multiplyScalar(z));return P=c.distanceTo(w)}function d(a,b,c,d){r.sub(d,b);o.sub(c,b);q.sub(a,b);A=r.dot(r);t=r.dot(o);G=r.dot(q);H=o.dot(o);M=o.dot(q);I=1/(A*H-t*t);K=(H*G-t*M)*I;N=(A*M-t*G)*I;return 0<=K&&0<=N&&1>K+N}this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3;var f=1.0E-4;this.setPrecision=function(a){f=a};var g=new THREE.Vector3,i=new THREE.Vector3,h=new THREE.Vector3,k=new THREE.Vector3,
-j=new THREE.Vector3,m=new THREE.Vector3,n=new THREE.Vector3,l=new THREE.Vector3,u=new THREE.Vector3;this.intersectObject=function(a){var b,r=[];if(a instanceof THREE.Particle){var o=c(this.origin,this.direction,a.matrixWorld.getPosition());if(o>a.scale.x)return[];b={distance:o,point:a.position,face:null,object:a};r.push(b)}else if(a instanceof THREE.Mesh){var o=c(this.origin,this.direction,a.matrixWorld.getPosition()),q=THREE.Frustum.__v1.set(a.matrixWorld.getColumnX().length(),a.matrixWorld.getColumnY().length(),
-a.matrixWorld.getColumnZ().length());if(o>a.geometry.boundingSphere.radius*Math.max(q.x,Math.max(q.y,q.z)))return r;var t,e,w=a.geometry,z=w.vertices,A;a.matrixRotationWorld.extractRotation(a.matrixWorld);for(o=0,q=w.faces.length;o<q;o++)if(b=w.faces[o],j.copy(this.origin),m.copy(this.direction),A=a.matrixWorld,n=A.multiplyVector3(n.copy(b.centroid)).subSelf(j),l=a.matrixRotationWorld.multiplyVector3(l.copy(b.normal)),t=m.dot(l),!(Math.abs(t)<f)&&(e=l.dot(n)/t,!(0>e)&&(a.doubleSided||(a.flipSided?
-0<t:0>t))))if(u.add(j,m.multiplyScalar(e)),b instanceof THREE.Face3)g=A.multiplyVector3(g.copy(z[b.a].position)),i=A.multiplyVector3(i.copy(z[b.b].position)),h=A.multiplyVector3(h.copy(z[b.c].position)),d(u,g,i,h)&&(b={distance:j.distanceTo(u),point:u.clone(),face:b,object:a},r.push(b));else if(b instanceof THREE.Face4&&(g=A.multiplyVector3(g.copy(z[b.a].position)),i=A.multiplyVector3(i.copy(z[b.b].position)),h=A.multiplyVector3(h.copy(z[b.c].position)),k=A.multiplyVector3(k.copy(z[b.d].position)),
-d(u,g,i,k)||d(u,i,h,k)))b={distance:j.distanceTo(u),point:u.clone(),face:b,object:a},r.push(b)}return r};this.intersectObjects=function(a){for(var b=[],c=0,d=a.length;c<d;c++)Array.prototype.push.apply(b,this.intersectObject(a[c]));b.sort(function(a,b){return a.distance-b.distance});return b};var r=new THREE.Vector3,o=new THREE.Vector3,q=new THREE.Vector3,z,w,P,A,t,G,H,M,I,K,N};
-THREE.Rectangle=function(){function a(){g=d-b;i=f-c}var b,c,d,f,g,i,h=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return g};this.getHeight=function(){return i};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return f};this.set=function(g,i,m,n){h=!1;b=g;c=i;d=m;f=n;a()};this.addPoint=function(g,i){h?(h=!1,b=g,c=i,d=g,f=i):(b=b<g?b:g,c=c<i?c:i,d=d>g?d:g,f=f>i?f:i);a()};this.add3Points=
-function(g,i,m,n,l,u){h?(h=!1,b=g<m?g<l?g:l:m<l?m:l,c=i<n?i<u?i:u:n<u?n:u,d=g>m?g>l?g:l:m>l?m:l,f=i>n?i>u?i:u:n>u?n:u):(b=g<m?g<l?g<b?g:b:l<b?l:b:m<l?m<b?m:b:l<b?l:b,c=i<n?i<u?i<c?i:c:u<c?u:c:n<u?n<c?n:c:u<c?u:c,d=g>m?g>l?g>d?g:d:l>d?l:d:m>l?m>d?m:d:l>d?l:d,f=i>n?i>u?i>f?i:f:u>f?u:f:n>u?n>f?n:f:u>f?u:f);a()};this.addRectangle=function(g){h?(h=!1,b=g.getLeft(),c=g.getTop(),d=g.getRight(),f=g.getBottom()):(b=b<g.getLeft()?b:g.getLeft(),c=c<g.getTop()?c:g.getTop(),d=d>g.getRight()?d:g.getRight(),f=f>
-g.getBottom()?f:g.getBottom());a()};this.inflate=function(g){b-=g;c-=g;d+=g;f+=g;a()};this.minSelf=function(g){b=b>g.getLeft()?b:g.getLeft();c=c>g.getTop()?c:g.getTop();d=d<g.getRight()?d:g.getRight();f=f<g.getBottom()?f:g.getBottom();a()};this.intersects=function(a){return d<a.getLeft()||b>a.getRight()||f<a.getTop()||c>a.getBottom()?!1:!0};this.empty=function(){h=!0;f=d=c=b=0;a()};this.isEmpty=function(){return h}};
+THREE.Ray=function(a,b){function c(a,b,c){r.sub(c,a);z=r.dot(b);w=n.add(a,t.copy(b).multiplyScalar(z));return P=c.distanceTo(w)}function d(a,b,c,d){r.sub(d,b);n.sub(c,b);t.sub(a,b);A=r.dot(r);q=r.dot(n);G=r.dot(t);H=n.dot(n);M=n.dot(t);I=1/(A*H-q*q);K=(H*G-q*M)*I;N=(A*M-q*G)*I;return 0<=K&&0<=N&&1>K+N}this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3;var f=1.0E-4;this.setPrecision=function(a){f=a};var g=new THREE.Vector3,h=new THREE.Vector3,i=new THREE.Vector3,k=new THREE.Vector3,
+j=new THREE.Vector3,m=new THREE.Vector3,o=new THREE.Vector3,l=new THREE.Vector3,u=new THREE.Vector3;this.intersectObject=function(a){var b,r=[];if(a instanceof THREE.Particle){var n=c(this.origin,this.direction,a.matrixWorld.getPosition());if(n>a.scale.x)return[];b={distance:n,point:a.position,face:null,object:a};r.push(b)}else if(a instanceof THREE.Mesh){var n=c(this.origin,this.direction,a.matrixWorld.getPosition()),t=THREE.Frustum.__v1.set(a.matrixWorld.getColumnX().length(),a.matrixWorld.getColumnY().length(),
+a.matrixWorld.getColumnZ().length());if(n>a.geometry.boundingSphere.radius*Math.max(t.x,Math.max(t.y,t.z)))return r;var q,e,w=a.geometry,z=w.vertices,A;a.matrixRotationWorld.extractRotation(a.matrixWorld);for(n=0,t=w.faces.length;n<t;n++)if(b=w.faces[n],j.copy(this.origin),m.copy(this.direction),A=a.matrixWorld,o=A.multiplyVector3(o.copy(b.centroid)).subSelf(j),l=a.matrixRotationWorld.multiplyVector3(l.copy(b.normal)),q=m.dot(l),!(Math.abs(q)<f)&&(e=l.dot(o)/q,!(0>e)&&(a.doubleSided||(a.flipSided?
+0<q:0>q))))if(u.add(j,m.multiplyScalar(e)),b instanceof THREE.Face3)g=A.multiplyVector3(g.copy(z[b.a].position)),h=A.multiplyVector3(h.copy(z[b.b].position)),i=A.multiplyVector3(i.copy(z[b.c].position)),d(u,g,h,i)&&(b={distance:j.distanceTo(u),point:u.clone(),face:b,object:a},r.push(b));else if(b instanceof THREE.Face4&&(g=A.multiplyVector3(g.copy(z[b.a].position)),h=A.multiplyVector3(h.copy(z[b.b].position)),i=A.multiplyVector3(i.copy(z[b.c].position)),k=A.multiplyVector3(k.copy(z[b.d].position)),
+d(u,g,h,k)||d(u,h,i,k)))b={distance:j.distanceTo(u),point:u.clone(),face:b,object:a},r.push(b)}return r};this.intersectObjects=function(a){for(var b=[],c=0,d=a.length;c<d;c++)Array.prototype.push.apply(b,this.intersectObject(a[c]));b.sort(function(a,b){return a.distance-b.distance});return b};var r=new THREE.Vector3,n=new THREE.Vector3,t=new THREE.Vector3,z,w,P,A,q,G,H,M,I,K,N};
+THREE.Rectangle=function(){function a(){g=d-b;h=f-c}var b,c,d,f,g,h,i=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return g};this.getHeight=function(){return h};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return f};this.set=function(g,j,h,o){i=!1;b=g;c=j;d=h;f=o;a()};this.addPoint=function(g,j){i?(i=!1,b=g,c=j,d=g,f=j):(b=b<g?b:g,c=c<j?c:j,d=d>g?d:g,f=f>j?f:j);a()};this.add3Points=
+function(g,j,h,o,l,u){i?(i=!1,b=g<h?g<l?g:l:h<l?h:l,c=j<o?j<u?j:u:o<u?o:u,d=g>h?g>l?g:l:h>l?h:l,f=j>o?j>u?j:u:o>u?o:u):(b=g<h?g<l?g<b?g:b:l<b?l:b:h<l?h<b?h:b:l<b?l:b,c=j<o?j<u?j<c?j:c:u<c?u:c:o<u?o<c?o:c:u<c?u:c,d=g>h?g>l?g>d?g:d:l>d?l:d:h>l?h>d?h:d:l>d?l:d,f=j>o?j>u?j>f?j:f:u>f?u:f:o>u?o>f?o:f:u>f?u:f);a()};this.addRectangle=function(g){i?(i=!1,b=g.getLeft(),c=g.getTop(),d=g.getRight(),f=g.getBottom()):(b=b<g.getLeft()?b:g.getLeft(),c=c<g.getTop()?c:g.getTop(),d=d>g.getRight()?d:g.getRight(),f=f>
+g.getBottom()?f:g.getBottom());a()};this.inflate=function(g){b-=g;c-=g;d+=g;f+=g;a()};this.minSelf=function(g){b=b>g.getLeft()?b:g.getLeft();c=c>g.getTop()?c:g.getTop();d=d<g.getRight()?d:g.getRight();f=f<g.getBottom()?f:g.getBottom();a()};this.intersects=function(a){return d<a.getLeft()||b>a.getRight()||f<a.getTop()||c>a.getBottom()?!1:!0};this.empty=function(){i=!0;f=d=c=b=0;a()};this.isEmpty=function(){return i}};
 THREE.Math={clamp:function(a,b,c){return a<b?b:a>c?c:a},clampBottom:function(a,b){return a<b?b:a},mapLinear:function(a,b,c,d,f){return d+(a-b)*(f-d)/(c-b)},random16:function(){return(65280*Math.random()+255*Math.random())/65535},randInt:function(a,b){return a+Math.floor(Math.random()*(b-a+1))},randFloat:function(a,b){return a+Math.random()*(b-a)},randFloatSpread:function(a){return a*(0.5-Math.random())},sign:function(a){return 0>a?-1:0<a?1:0}};THREE.Matrix3=function(){this.m=[]};
-THREE.Matrix3.prototype={constructor:THREE.Matrix3,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,g,i,h,k,j,m,n,l,u,r,o){this.set(void 0!==a?a:1,b||0,c||0,d||0,f||0,void 0!==g?g:1,i||0,h||0,k||0,j||0,void 0!==m?m:1,n||0,l||0,u||0,r||0,void 0!==o?o:1);this.m33=new THREE.Matrix3};
-THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,f,g,i,h,k,j,m,n,l,u,r,o){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=f;this.n22=g;this.n23=i;this.n24=h;this.n31=k;this.n32=j;this.n33=m;this.n34=n;this.n41=l;this.n42=u;this.n43=r;this.n44=o;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(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,g=THREE.Matrix4.__v3;g.sub(a,b).normalize();if(0===g.length())g.z=1;d.cross(c,g).normalize();0===d.length()&&(g.x+=1.0E-4,d.cross(c,g).normalize());f.cross(g,d);this.n11=d.x;this.n12=f.x;this.n13=g.x;this.n21=d.y;this.n22=f.y;this.n23=g.y;this.n31=d.z;this.n32=f.z;this.n33=g.z;return this},multiply:function(a,b){var c=a.n11,d=a.n12,f=a.n13,g=a.n14,i=a.n21,h=a.n22,k=a.n23,j=a.n24,m=a.n31,n=a.n32,l=a.n33,u=a.n34,r=a.n41,o=a.n42,q=a.n43,z=a.n44,w=b.n11,
-P=b.n12,A=b.n13,t=b.n14,G=b.n21,H=b.n22,M=b.n23,I=b.n24,K=b.n31,N=b.n32,ja=b.n33,oa=b.n34,ka=b.n41,X=b.n42,$=b.n43,C=b.n44;this.n11=c*w+d*G+f*K+g*ka;this.n12=c*P+d*H+f*N+g*X;this.n13=c*A+d*M+f*ja+g*$;this.n14=c*t+d*I+f*oa+g*C;this.n21=i*w+h*G+k*K+j*ka;this.n22=i*P+h*H+k*N+j*X;this.n23=i*A+h*M+k*ja+j*$;this.n24=i*t+h*I+k*oa+j*C;this.n31=m*w+n*G+l*K+u*ka;this.n32=m*P+n*H+l*N+u*X;this.n33=m*A+n*M+l*ja+u*$;this.n34=m*t+n*I+l*oa+u*C;this.n41=r*w+o*G+q*K+z*ka;this.n42=r*P+o*H+q*N+z*X;this.n43=r*A+o*M+q*
-ja+z*$;this.n44=r*t+o*I+q*oa+z*C;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*=
+THREE.Matrix3.prototype={constructor:THREE.Matrix3,getInverse:function(a){var b=a.n33*a.n22-a.n32*a.n23,c=-a.n33*a.n21+a.n31*a.n23,d=a.n32*a.n21-a.n31*a.n22,f=-a.n33*a.n12+a.n32*a.n13,g=a.n33*a.n11-a.n31*a.n13,h=-a.n32*a.n11+a.n31*a.n12,i=a.n23*a.n12-a.n22*a.n13,k=-a.n23*a.n11+a.n21*a.n13,j=a.n22*a.n11-a.n21*a.n12,a=a.n11*b+a.n21*f+a.n31*i;0===a&&console.warn("Matrix3.getInverse(): determinant == 0");var a=1/a,m=this.m;m[0]=a*b;m[1]=a*c;m[2]=a*d;m[3]=a*f;m[4]=a*g;m[5]=a*h;m[6]=a*i;m[7]=a*k;m[8]=a*
+j;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,g,h,i,k,j,m,o,l,u,r,n){this.set(void 0!==a?a:1,b||0,c||0,d||0,f||0,void 0!==g?g:1,h||0,i||0,k||0,j||0,void 0!==m?m:1,o||0,l||0,u||0,r||0,void 0!==n?n:1)};
+THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,f,g,h,i,k,j,m,o,l,u,r,n){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=f;this.n22=g;this.n23=h;this.n24=i;this.n31=k;this.n32=j;this.n33=m;this.n34=o;this.n41=l;this.n42=u;this.n43=r;this.n44=n;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(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,g=THREE.Matrix4.__v3;g.sub(a,b).normalize();if(0===g.length())g.z=1;d.cross(c,g).normalize();0===d.length()&&(g.x+=1.0E-4,d.cross(c,g).normalize());f.cross(g,d);this.n11=d.x;this.n12=f.x;this.n13=g.x;this.n21=d.y;this.n22=f.y;this.n23=g.y;this.n31=d.z;this.n32=f.z;this.n33=g.z;return this},multiply:function(a,b){var c=a.n11,d=a.n12,f=a.n13,g=a.n14,h=a.n21,i=a.n22,k=a.n23,j=a.n24,m=a.n31,o=a.n32,l=a.n33,u=a.n34,r=a.n41,n=a.n42,t=a.n43,z=a.n44,w=b.n11,
+P=b.n12,A=b.n13,q=b.n14,G=b.n21,H=b.n22,M=b.n23,I=b.n24,K=b.n31,N=b.n32,ja=b.n33,oa=b.n34,ka=b.n41,Y=b.n42,S=b.n43,C=b.n44;this.n11=c*w+d*G+f*K+g*ka;this.n12=c*P+d*H+f*N+g*Y;this.n13=c*A+d*M+f*ja+g*S;this.n14=c*q+d*I+f*oa+g*C;this.n21=h*w+i*G+k*K+j*ka;this.n22=h*P+i*H+k*N+j*Y;this.n23=h*A+i*M+k*ja+j*S;this.n24=h*q+i*I+k*oa+j*C;this.n31=m*w+o*G+l*K+u*ka;this.n32=m*P+o*H+l*N+u*Y;this.n33=m*A+o*M+l*ja+u*S;this.n34=m*q+o*I+l*oa+u*C;this.n41=r*w+n*G+t*K+z*ka;this.n42=r*P+n*H+t*N+z*Y;this.n43=r*A+n*M+t*
+ja+z*S;this.n44=r*q+n*I+t*oa+z*C;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,g=this.n22,i=this.n23,h=this.n24,k=this.n31,j=this.n32,m=this.n33,n=this.n34,l=this.n41,u=this.n42,r=this.n43,o=this.n44;return d*i*j*l-c*h*j*l-d*g*m*l+b*h*m*l+c*g*n*l-b*i*n*l-d*i*k*u+c*h*k*u+d*f*m*u-a*h*m*u-c*f*n*u+a*i*n*u+d*g*k*r-b*h*k*r-d*f*j*r+a*h*j*r+b*f*n*r-a*g*n*r-c*g*k*o+b*i*k*o+c*f*j*o-a*i*j*o-b*f*m*o+a*g*m*o},transpose:function(){var a;
+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,g=this.n22,h=this.n23,i=this.n24,k=this.n31,j=this.n32,m=this.n33,o=this.n34,l=this.n41,u=this.n42,r=this.n43,n=this.n44;return d*h*j*l-c*i*j*l-d*g*m*l+b*i*m*l+c*g*o*l-b*h*o*l-d*h*k*u+c*i*k*u+d*f*m*u-a*i*m*u-c*f*o*u+a*h*o*u+d*g*k*r-b*i*k*r-d*f*j*r+a*i*j*r+b*f*o*r-a*g*o*r-c*g*k*n+b*h*k*n+c*f*j*n-a*h*j*n-b*f*m*n+a*g*m*n},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.n34=a;return this},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,g=a.x,i=a.y,h=a.z,k=f*g,j=f*i;this.set(k*g+c,k*i-d*h,k*h+d*i,0,k*i+d*h,j*i+c,j*h-d*g,0,k*h-d*i,j*h+d*g,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,g=a.n21,i=a.n22,h=a.n23,k=a.n24,j=a.n31,m=
-a.n32,n=a.n33,l=a.n34,u=a.n41,r=a.n42,o=a.n43,q=a.n44;this.n11=h*l*r-k*n*r+k*m*o-i*l*o-h*m*q+i*n*q;this.n12=f*n*r-d*l*r-f*m*o+c*l*o+d*m*q-c*n*q;this.n13=d*k*r-f*h*r+f*i*o-c*k*o-d*i*q+c*h*q;this.n14=f*h*m-d*k*m-f*i*n+c*k*n+d*i*l-c*h*l;this.n21=k*n*u-h*l*u-k*j*o+g*l*o+h*j*q-g*n*q;this.n22=d*l*u-f*n*u+f*j*o-b*l*o-d*j*q+b*n*q;this.n23=f*h*u-d*k*u-f*g*o+b*k*o+d*g*q-b*h*q;this.n24=d*k*j-f*h*j+f*g*n-b*k*n-d*g*l+b*h*l;this.n31=i*l*u-k*m*u+k*j*r-g*l*r-i*j*q+g*m*q;this.n32=f*m*u-c*l*u-f*j*r+b*l*r+c*j*q-b*m*
-q;this.n33=c*k*u-f*i*u+f*g*r-b*k*r-c*g*q+b*i*q;this.n34=f*i*j-c*k*j-f*g*m+b*k*m+c*g*l-b*i*l;this.n41=h*m*u-i*n*u-h*j*r+g*n*r+i*j*o-g*m*o;this.n42=c*n*u-d*m*u+d*j*r-b*n*r-c*j*o+b*m*o;this.n43=d*i*u-c*h*u-d*g*r+b*h*r+c*g*o-b*i*o;this.n44=c*h*j-d*i*j+d*g*m-b*h*m-c*g*n+b*i*n;this.multiplyScalar(1/a.determinant());return this},setRotationFromEuler:function(a,b){var c=a.x,d=a.y,f=a.z,g=Math.cos(c),c=Math.sin(c),i=Math.cos(d),d=Math.sin(d),h=Math.cos(f),f=Math.sin(f);switch(b){case "YXZ":var k=i*h,j=i*f,
-m=d*h,n=d*f;this.n11=k+n*c;this.n12=m*c-j;this.n13=g*d;this.n21=g*f;this.n22=g*h;this.n23=-c;this.n31=j*c-m;this.n32=n+k*c;this.n33=g*i;break;case "ZXY":k=i*h;j=i*f;m=d*h;n=d*f;this.n11=k-n*c;this.n12=-g*f;this.n13=m+j*c;this.n21=j+m*c;this.n22=g*h;this.n23=n-k*c;this.n31=-g*d;this.n32=c;this.n33=g*i;break;case "ZYX":k=g*h;j=g*f;m=c*h;n=c*f;this.n11=i*h;this.n12=m*d-j;this.n13=k*d+n;this.n21=i*f;this.n22=n*d+k;this.n23=j*d-m;this.n31=-d;this.n32=c*i;this.n33=g*i;break;case "YZX":k=g*i;j=g*d;m=c*i;
-n=c*d;this.n11=i*h;this.n12=n-k*f;this.n13=m*f+j;this.n21=f;this.n22=g*h;this.n23=-c*h;this.n31=-d*h;this.n32=j*f+m;this.n33=k-n*f;break;case "XZY":k=g*i;j=g*d;m=c*i;n=c*d;this.n11=i*h;this.n12=-f;this.n13=d*h;this.n21=k*f+n;this.n22=g*h;this.n23=j*f-m;this.n31=m*f-j;this.n32=c*h;this.n33=n*f+k;break;default:k=g*h,j=g*f,m=c*h,n=c*f,this.n11=i*h,this.n12=-i*f,this.n13=d,this.n21=j+m*d,this.n22=k-n*d,this.n23=-c*i,this.n31=n-k*d,this.n32=m+j*d,this.n33=g*i}return this},setRotationFromQuaternion:function(a){var b=
-a.x,c=a.y,d=a.z,f=a.w,g=b+b,i=c+c,h=d+d,a=b*g,k=b*i,b=b*h,j=c*i,c=c*h,d=d*h,g=f*g,i=f*i,f=f*h;this.n11=1-(j+d);this.n12=k-f;this.n13=b+i;this.n21=k+f;this.n22=1-(a+d);this.n23=c-g;this.n31=b-i;this.n32=c+g;this.n33=1-(a+j);return this},scale:function(a){var b=a.x,c=a.y,a=a.z;this.n11*=b;this.n12*=c;this.n13*=a;this.n21*=b;this.n22*=c;this.n23*=a;this.n31*=b;this.n32*=c;this.n33*=a;this.n41*=b;this.n42*=c;this.n43*=a;return this},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,g=THREE.Matrix4.__v3;d.set(this.n11,this.n21,this.n31);f.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=f.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},rotateByAxis:function(a,b){if(1===a.x&&0===a.y&&0===a.z)return this.rotateX(b);if(0===a.x&&1===a.y&&0===a.z)return this.rotateY(b);if(0===a.x&&0===a.y&&1===a.z)return this.rotateZ(b);var c=a.x,d=a.y,f=a.z,g=Math.sqrt(c*c+d*d+f*f),c=c/g,d=d/g,f=f/g,g=c*c,i=d*d,h=f*f,k=Math.cos(b),j=Math.sin(b),m=1-k,n=c*d*m,l=c*f*m,m=d*f*m,c=c*j,u=d*j,j=f*j,f=
-g+(1-g)*k,g=n+j,d=l-u,n=n-j,i=i+(1-i)*k,j=m+c,l=l+u,m=m-c,h=h+(1-h)*k,k=this.n11,c=this.n21,u=this.n31,r=this.n41,o=this.n12,q=this.n22,z=this.n32,w=this.n42,P=this.n13,A=this.n23,t=this.n33,G=this.n43;this.n11=f*k+g*o+d*P;this.n21=f*c+g*q+d*A;this.n31=f*u+g*z+d*t;this.n41=f*r+g*w+d*G;this.n12=n*k+i*o+j*P;this.n22=n*c+i*q+j*A;this.n32=n*u+i*z+j*t;this.n42=n*r+i*w+j*G;this.n13=l*k+m*o+h*P;this.n23=l*c+m*q+h*A;this.n33=l*u+m*z+h*t;this.n43=l*r+m*w+h*G;return this},rotateX:function(a){var b=this.n12,
-c=this.n22,d=this.n32,f=this.n42,g=this.n13,i=this.n23,h=this.n33,k=this.n43,j=Math.cos(a),a=Math.sin(a);this.n12=j*b+a*g;this.n22=j*c+a*i;this.n32=j*d+a*h;this.n42=j*f+a*k;this.n13=j*g-a*b;this.n23=j*i-a*c;this.n33=j*h-a*d;this.n43=j*k-a*f;return this},rotateY:function(a){var b=this.n11,c=this.n21,d=this.n31,f=this.n41,g=this.n13,i=this.n23,h=this.n33,k=this.n43,j=Math.cos(a),a=Math.sin(a);this.n11=j*b-a*g;this.n21=j*c-a*i;this.n31=j*d-a*h;this.n41=j*f-a*k;this.n13=j*g+a*b;this.n23=j*i+a*c;this.n33=
-j*h+a*d;this.n43=j*k+a*f;return this},rotateZ:function(a){var b=this.n11,c=this.n21,d=this.n31,f=this.n41,g=this.n12,i=this.n22,h=this.n32,k=this.n42,j=Math.cos(a),a=Math.sin(a);this.n11=j*b+a*g;this.n21=j*c+a*i;this.n31=j*d+a*h;this.n41=j*f+a*k;this.n12=j*g-a*b;this.n22=j*i-a*c;this.n32=j*h-a*d;this.n42=j*k-a*f;return this},translate:function(a){var b=a.x,c=a.y,a=a.z;this.n14=this.n11*b+this.n12*c+this.n13*a+this.n14;this.n24=this.n21*b+this.n22*c+this.n23*a+this.n24;this.n34=this.n31*b+this.n32*
-c+this.n33*a+this.n34;this.n44=this.n41*b+this.n42*c+this.n43*a+this.n44;return this},clone:function(){return new THREE.Matrix4(this.n11,this.n12,this.n13,this.n14,this.n21,this.n22,this.n23,this.n24,this.n31,this.n32,this.n33,this.n34,this.n41,this.n42,this.n43,this.n44)}};
-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,g=a.n32*a.n21-a.n31*a.n22,i=-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,j=a.n23*a.n12-a.n22*a.n13,m=-a.n23*a.n11+a.n21*a.n13,n=a.n22*a.n11-a.n21*a.n12,a=a.n11*d+a.n21*i+a.n31*j;if(0===a)return null;a=1/a;c[0]=a*d;c[1]=a*f;c[2]=a*g;c[3]=a*i;c[4]=a*h;c[5]=a*k;c[6]=a*j;c[7]=a*m;c[8]=a*n;return b};
-THREE.Matrix4.makeFrustum=function(a,b,c,d,f,g){var i;i=new THREE.Matrix4;i.n11=2*f/(b-a);i.n12=0;i.n13=(b+a)/(b-a);i.n14=0;i.n21=0;i.n22=2*f/(d-c);i.n23=(d+c)/(d-c);i.n24=0;i.n31=0;i.n32=0;i.n33=-(g+f)/(g-f);i.n34=-2*g*f/(g-f);i.n41=0;i.n42=0;i.n43=-1;i.n44=0;return i};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,g){var i,h,k,j;i=new THREE.Matrix4;h=b-a;k=c-d;j=g-f;i.n11=2/h;i.n12=0;i.n13=0;i.n14=-((b+a)/h);i.n21=0;i.n22=2/k;i.n23=0;i.n24=-((c+d)/k);i.n31=0;i.n32=0;i.n33=-2/j;i.n34=-((g+f)/j);i.n41=0;i.n42=0;i.n43=0;i.n44=1;return i};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
+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},getPosition:function(){return THREE.Matrix4.__v1.set(this.n14,this.n24,this.n34)},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},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,g=a.n21,h=a.n22,i=a.n23,k=a.n24,j=a.n31,m=a.n32,o=a.n33,l=a.n34,u=a.n41,r=a.n42,n=a.n43,t=a.n44;this.n11=i*l*r-k*o*r+k*m*n-h*l*n-i*m*t+h*o*t;this.n12=f*o*r-d*l*r-f*m*n+c*l*n+d*m*t-c*o*t;this.n13=d*k*r-f*i*r+f*h*n-c*k*n-d*h*t+c*i*t;this.n14=f*i*m-d*k*m-f*h*o+c*
+k*o+d*h*l-c*i*l;this.n21=k*o*u-i*l*u-k*j*n+g*l*n+i*j*t-g*o*t;this.n22=d*l*u-f*o*u+f*j*n-b*l*n-d*j*t+b*o*t;this.n23=f*i*u-d*k*u-f*g*n+b*k*n+d*g*t-b*i*t;this.n24=d*k*j-f*i*j+f*g*o-b*k*o-d*g*l+b*i*l;this.n31=h*l*u-k*m*u+k*j*r-g*l*r-h*j*t+g*m*t;this.n32=f*m*u-c*l*u-f*j*r+b*l*r+c*j*t-b*m*t;this.n33=c*k*u-f*h*u+f*g*r-b*k*r-c*g*t+b*h*t;this.n34=f*h*j-c*k*j-f*g*m+b*k*m+c*g*l-b*h*l;this.n41=i*m*u-h*o*u-i*j*r+g*o*r+h*j*n-g*m*n;this.n42=c*o*u-d*m*u+d*j*r-b*o*r-c*j*n+b*m*n;this.n43=d*h*u-c*i*u-d*g*r+b*i*r+c*
+g*n-b*h*n;this.n44=c*i*j-d*h*j+d*g*m-b*i*m-c*g*o+b*h*o;this.multiplyScalar(1/a.determinant());return this},setRotationFromEuler:function(a,b){var c=a.x,d=a.y,f=a.z,g=Math.cos(c),c=Math.sin(c),h=Math.cos(d),d=Math.sin(d),i=Math.cos(f),f=Math.sin(f);switch(b){case "YXZ":var k=h*i,j=h*f,m=d*i,o=d*f;this.n11=k+o*c;this.n12=m*c-j;this.n13=g*d;this.n21=g*f;this.n22=g*i;this.n23=-c;this.n31=j*c-m;this.n32=o+k*c;this.n33=g*h;break;case "ZXY":k=h*i;j=h*f;m=d*i;o=d*f;this.n11=k-o*c;this.n12=-g*f;this.n13=m+
+j*c;this.n21=j+m*c;this.n22=g*i;this.n23=o-k*c;this.n31=-g*d;this.n32=c;this.n33=g*h;break;case "ZYX":k=g*i;j=g*f;m=c*i;o=c*f;this.n11=h*i;this.n12=m*d-j;this.n13=k*d+o;this.n21=h*f;this.n22=o*d+k;this.n23=j*d-m;this.n31=-d;this.n32=c*h;this.n33=g*h;break;case "YZX":k=g*h;j=g*d;m=c*h;o=c*d;this.n11=h*i;this.n12=o-k*f;this.n13=m*f+j;this.n21=f;this.n22=g*i;this.n23=-c*i;this.n31=-d*i;this.n32=j*f+m;this.n33=k-o*f;break;case "XZY":k=g*h;j=g*d;m=c*h;o=c*d;this.n11=h*i;this.n12=-f;this.n13=d*i;this.n21=
+k*f+o;this.n22=g*i;this.n23=j*f-m;this.n31=m*f-j;this.n32=c*i;this.n33=o*f+k;break;default:k=g*i,j=g*f,m=c*i,o=c*f,this.n11=h*i,this.n12=-h*f,this.n13=d,this.n21=j+m*d,this.n22=k-o*d,this.n23=-c*h,this.n31=o-k*d,this.n32=m+j*d,this.n33=g*h}return this},setRotationFromQuaternion:function(a){var b=a.x,c=a.y,d=a.z,f=a.w,g=b+b,h=c+c,i=d+d,a=b*g,k=b*h,b=b*i,j=c*h,c=c*i,d=d*i,g=f*g,h=f*h,f=f*i;this.n11=1-(j+d);this.n12=k-f;this.n13=b+h;this.n21=k+f;this.n22=1-(a+d);this.n23=c-g;this.n31=b-h;this.n32=c+
+g;this.n33=1-(a+j);return this},compose:function(a,b,c){var d=THREE.Matrix4.__m1,f=THREE.Matrix4.__m2;d.identity();d.setRotationFromQuaternion(b);f.makeScale(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,g=THREE.Matrix4.__v3;d.set(this.n11,this.n21,this.n31);f.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=f.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},translate:function(a){var b=a.x,c=a.y,a=a.z;this.n14=this.n11*b+this.n12*c+this.n13*a+this.n14;this.n24=this.n21*b+this.n22*c+this.n23*a+this.n24;this.n34=this.n31*b+this.n32*c+this.n33*a+this.n34;this.n44=this.n41*b+this.n42*c+this.n43*a+this.n44;return this},
+rotateX:function(a){var b=this.n12,c=this.n22,d=this.n32,f=this.n42,g=this.n13,h=this.n23,i=this.n33,k=this.n43,j=Math.cos(a),a=Math.sin(a);this.n12=j*b+a*g;this.n22=j*c+a*h;this.n32=j*d+a*i;this.n42=j*f+a*k;this.n13=j*g-a*b;this.n23=j*h-a*c;this.n33=j*i-a*d;this.n43=j*k-a*f;return this},rotateY:function(a){var b=this.n11,c=this.n21,d=this.n31,f=this.n41,g=this.n13,h=this.n23,i=this.n33,k=this.n43,j=Math.cos(a),a=Math.sin(a);this.n11=j*b-a*g;this.n21=j*c-a*h;this.n31=j*d-a*i;this.n41=j*f-a*k;this.n13=
+j*g+a*b;this.n23=j*h+a*c;this.n33=j*i+a*d;this.n43=j*k+a*f;return this},rotateZ:function(a){var b=this.n11,c=this.n21,d=this.n31,f=this.n41,g=this.n12,h=this.n22,i=this.n32,k=this.n42,j=Math.cos(a),a=Math.sin(a);this.n11=j*b+a*g;this.n21=j*c+a*h;this.n31=j*d+a*i;this.n41=j*f+a*k;this.n12=j*g-a*b;this.n22=j*h-a*c;this.n32=j*i-a*d;this.n42=j*k-a*f;return this},rotateByAxis:function(a,b){if(1===a.x&&0===a.y&&0===a.z)return this.rotateX(b);if(0===a.x&&1===a.y&&0===a.z)return this.rotateY(b);if(0===a.x&&
+0===a.y&&1===a.z)return this.rotateZ(b);var c=a.x,d=a.y,f=a.z,g=Math.sqrt(c*c+d*d+f*f),c=c/g,d=d/g,f=f/g,g=c*c,h=d*d,i=f*f,k=Math.cos(b),j=Math.sin(b),m=1-k,o=c*d*m,l=c*f*m,m=d*f*m,c=c*j,u=d*j,j=f*j,f=g+(1-g)*k,g=o+j,d=l-u,o=o-j,h=h+(1-h)*k,j=m+c,l=l+u,m=m-c,i=i+(1-i)*k,k=this.n11,c=this.n21,u=this.n31,r=this.n41,n=this.n12,t=this.n22,z=this.n32,w=this.n42,P=this.n13,A=this.n23,q=this.n33,G=this.n43;this.n11=f*k+g*n+d*P;this.n21=f*c+g*t+d*A;this.n31=f*u+g*z+d*q;this.n41=f*r+g*w+d*G;this.n12=o*k+h*
+n+j*P;this.n22=o*c+h*t+j*A;this.n32=o*u+h*z+j*q;this.n42=o*r+h*w+j*G;this.n13=l*k+m*n+i*P;this.n23=l*c+m*t+i*A;this.n33=l*u+m*z+i*q;this.n43=l*r+m*w+i*G;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},makeTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},makeRotationX: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},makeRotationY: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},makeRotationZ: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},makeRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),f=1-c,g=a.x,h=a.y,i=a.z,k=f*g,j=f*h;this.set(k*g+c,k*h-d*i,k*i+d*h,0,k*h+d*i,j*h+c,j*i-d*g,0,k*i-d*h,j*i+d*g,f*i*i+c,0,0,0,0,1);return this},makeScale:function(a,
+b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},makeFrustum:function(a,b,c,d,f,g){this.n11=2*f/(b-a);this.n12=0;this.n13=(b+a)/(b-a);this.n21=this.n14=0;this.n22=2*f/(d-c);this.n23=(d+c)/(d-c);this.n32=this.n31=this.n24=0;this.n33=-(g+f)/(g-f);this.n34=-2*g*f/(g-f);this.n42=this.n41=0;this.n43=-1;this.n44=0;return this},makePerspective:function(a,b,c,d){var a=c*Math.tan(a*Math.PI/360),f=-a;return this.makeFrustum(f*b,a*b,f,a,c,d)},makeOrthographic:function(a,b,c,d,f,g){var h=b-a,i=c-d,
+k=g-f;this.n11=2/h;this.n13=this.n12=0;this.n14=-((b+a)/h);this.n21=0;this.n22=2/i;this.n23=0;this.n24=-((c+d)/i);this.n32=this.n31=0;this.n33=-2/k;this.n34=-((g+f)/k);this.n43=this.n42=this.n41=0;this.n44=1;return this},clone:function(){return new THREE.Matrix4(this.n11,this.n12,this.n13,this.n14,this.n21,this.n22,this.n23,this.n24,this.n31,this.n32,this.n33,this.n34,this.n41,this.n42,this.n43,this.n44)}};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.id=THREE.Object3DCount++;this.name="";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=!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,applyMatrix:function(a){this.matrix.multiply(a,this.matrix);this.scale.getScaleFromMatrix(this.matrix);this.rotation.getRotationFromMatrix(this.matrix,this.scale);this.position.getPositionFromMatrix(this.matrix)},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,
@@ -63,59 +63,61 @@ this._vector.set(0,0,1))},lookAt:function(a){this.matrix.lookAt(a,this.position,
 this.children.indexOf(a);if(-1!==b){a.parent=void 0;this.children.splice(b,1);for(b=this;void 0!==b.parent;)b=b.parent;void 0!==b&&b instanceof THREE.Scene&&b.__removeObject(a)}},getChildByName:function(a,b){var c,d,f;for(c=0,d=this.children.length;c<d;c++){f=this.children[c];if(f.name===a||b&&(f=f.getChildByName(a,b),void 0!==f))return f}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,
 this.eulerOrder);if(1!==this.scale.x||1!==this.scale.y||1!==this.scale.z)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=i[g]=i[g]||new THREE.RenderableObject;g++;return a}function b(){var a=j[k]=j[k]||new THREE.RenderableVertex;k++;return a}function c(a,b){return b.z-a.z}function d(a,b){var c=0,d=1,f=a.z+a.w,e=b.z+b.w,g=-a.z+a.w,i=-b.z+b.w;if(0<=f&&0<=e&&0<=g&&0<=i)return!0;if(0>f&&0>e||0>g&&0>i)return!1;0>f?c=Math.max(c,f/(f-e)):0>e&&(d=Math.min(d,f/(f-e)));0>g?c=Math.max(c,g/(g-i)):0>i&&(d=Math.min(d,g/(g-i)));if(d<c)return!1;a.lerpSelf(b,c);b.lerpSelf(a,1-d);return!0}
-var f,g,i=[],h,k,j=[],m,n,l=[],u,r=[],o,q,z=[],w,P,A=[],t={objects:[],sprites:[],lights:[],elements:[]},G=new THREE.Vector3,H=new THREE.Vector4,M=new THREE.Matrix4,I=new THREE.Matrix4,K=new THREE.Frustum,N=new THREE.Vector4,ja=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);M.multiply(b.projectionMatrix,b.matrixWorldInverse);M.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);M.multiply(b.matrixWorld,
-b.projectionMatrixInverse);M.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(b,d){g=0;t.objects.length=0;t.sprites.length=0;t.lights.length=0;var i=function(b){if(!1!==b.visible){(b instanceof THREE.Mesh||b instanceof THREE.Line)&&(!1===b.frustumCulled||K.contains(b))?(G.copy(b.matrixWorld.getPosition()),M.multiplyVector3(G),
-f=a(),f.object=b,f.z=G.z,t.objects.push(f)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(G.copy(b.matrixWorld.getPosition()),M.multiplyVector3(G),f=a(),f.object=b,f.z=G.z,t.sprites.push(f)):b instanceof THREE.Light&&t.lights.push(b);for(var c=0,e=b.children.length;c<e;c++)i(b.children[c])}};i(b);d&&t.objects.sort(c);return t};this.projectScene=function(a,f,g){var i=f.near,C=f.far,e=!1,G,Ba,S,sa,J,aa,ta,xa,T,Aa,Ga,Ha,Sa,Wa,Ma;P=q=u=n=0;t.elements.length=0;void 0===f.parent&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),
-a.add(f));a.updateMatrixWorld();f.matrixWorldInverse.getInverse(f.matrixWorld);M.multiply(f.projectionMatrix,f.matrixWorldInverse);K.setFromMatrix(M);t=this.projectGraph(a,!1);for(a=0,G=t.objects.length;a<G;a++)if(T=t.objects[a].object,Aa=T.matrixWorld,k=0,T instanceof THREE.Mesh){Ga=T.geometry;Ha=T.geometry.materials;sa=Ga.vertices;Sa=Ga.faces;Wa=Ga.faceVertexUvs;Ga=T.matrixRotationWorld.extractRotation(Aa);for(Ba=0,S=sa.length;Ba<S;Ba++)h=b(),h.positionWorld.copy(sa[Ba].position),Aa.multiplyVector3(h.positionWorld),
-h.positionScreen.copy(h.positionWorld),M.multiplyVector4(h.positionScreen),h.positionScreen.x/=h.positionScreen.w,h.positionScreen.y/=h.positionScreen.w,h.visible=h.positionScreen.z>i&&h.positionScreen.z<C;for(sa=0,Ba=Sa.length;sa<Ba;sa++){S=Sa[sa];if(S instanceof THREE.Face3)if(J=j[S.a],aa=j[S.b],ta=j[S.c],J.visible&&aa.visible&&ta.visible)if(e=0>(ta.positionScreen.x-J.positionScreen.x)*(aa.positionScreen.y-J.positionScreen.y)-(ta.positionScreen.y-J.positionScreen.y)*(aa.positionScreen.x-J.positionScreen.x),
-T.doubleSided||e!=T.flipSided)xa=l[n]=l[n]||new THREE.RenderableFace3,n++,m=xa,m.v1.copy(J),m.v2.copy(aa),m.v3.copy(ta);else continue;else continue;else if(S instanceof THREE.Face4)if(J=j[S.a],aa=j[S.b],ta=j[S.c],xa=j[S.d],J.visible&&aa.visible&&ta.visible&&xa.visible)if(e=0>(xa.positionScreen.x-J.positionScreen.x)*(aa.positionScreen.y-J.positionScreen.y)-(xa.positionScreen.y-J.positionScreen.y)*(aa.positionScreen.x-J.positionScreen.x)||0>(aa.positionScreen.x-ta.positionScreen.x)*(xa.positionScreen.y-
-ta.positionScreen.y)-(aa.positionScreen.y-ta.positionScreen.y)*(xa.positionScreen.x-ta.positionScreen.x),T.doubleSided||e!=T.flipSided)Ma=r[u]=r[u]||new THREE.RenderableFace4,u++,m=Ma,m.v1.copy(J),m.v2.copy(aa),m.v3.copy(ta),m.v4.copy(xa);else continue;else continue;m.normalWorld.copy(S.normal);!e&&(T.flipSided||T.doubleSided)&&m.normalWorld.negate();Ga.multiplyVector3(m.normalWorld);m.centroidWorld.copy(S.centroid);Aa.multiplyVector3(m.centroidWorld);m.centroidScreen.copy(m.centroidWorld);M.multiplyVector3(m.centroidScreen);
-ta=S.vertexNormals;for(J=0,aa=ta.length;J<aa;J++)xa=m.vertexNormalsWorld[J],xa.copy(ta[J]),!e&&(T.flipSided||T.doubleSided)&&xa.negate(),Ga.multiplyVector3(xa);for(J=0,aa=Wa.length;J<aa;J++)if(Ma=Wa[J][sa])for(ta=0,xa=Ma.length;ta<xa;ta++)m.uvs[J][ta]=Ma[ta];m.material=T.material;m.faceMaterial=null!==S.materialIndex?Ha[S.materialIndex]:null;m.z=m.centroidScreen.z;t.elements.push(m)}}else if(T instanceof THREE.Line){I.multiply(M,Aa);sa=T.geometry.vertices;J=b();J.positionScreen.copy(sa[0].position);
-I.multiplyVector4(J.positionScreen);for(Ba=1,S=sa.length;Ba<S;Ba++)if(J=b(),J.positionScreen.copy(sa[Ba].position),I.multiplyVector4(J.positionScreen),aa=j[k-2],N.copy(J.positionScreen),ja.copy(aa.positionScreen),d(N,ja))N.multiplyScalar(1/N.w),ja.multiplyScalar(1/ja.w),Aa=z[q]=z[q]||new THREE.RenderableLine,q++,o=Aa,o.v1.positionScreen.copy(N),o.v2.positionScreen.copy(ja),o.z=Math.max(N.z,ja.z),o.material=T.material,t.elements.push(o)}for(a=0,G=t.sprites.length;a<G;a++)if(T=t.sprites[a].object,Aa=
-T.matrixWorld,T instanceof THREE.Particle&&(H.set(Aa.n14,Aa.n24,Aa.n34,1),M.multiplyVector4(H),H.z/=H.w,0<H.z&&1>H.z))i=A[P]=A[P]||new THREE.RenderableParticle,P++,w=i,w.x=H.x/H.w,w.y=H.y/H.w,w.z=H.z,w.rotation=T.rotation.z,w.scale.x=T.scale.x*Math.abs(w.x-(H.x+f.projectionMatrix.n11)/(H.w+f.projectionMatrix.n14)),w.scale.y=T.scale.y*Math.abs(w.y-(H.y+f.projectionMatrix.n22)/(H.w+f.projectionMatrix.n24)),w.material=T.material,t.elements.push(w);g&&t.elements.sort(c);return t}};
+THREE.Projector=function(){function a(){var a=h[g]=h[g]||new THREE.RenderableObject;g++;return a}function b(){var a=j[k]=j[k]||new THREE.RenderableVertex;k++;return a}function c(a,b){return b.z-a.z}function d(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;if(0<=f&&0<=e&&0<=g&&0<=h)return!0;if(0>f&&0>e||0>g&&0>h)return!1;0>f?c=Math.max(c,f/(f-e)):0>e&&(d=Math.min(d,f/(f-e)));0>g?c=Math.max(c,g/(g-h)):0>h&&(d=Math.min(d,g/(g-h)));if(d<c)return!1;a.lerpSelf(b,c);b.lerpSelf(a,1-d);return!0}
+var f,g,h=[],i,k,j=[],m,o,l=[],u,r=[],n,t,z=[],w,P,A=[],q={objects:[],sprites:[],lights:[],elements:[]},G=new THREE.Vector3,H=new THREE.Vector4,M=new THREE.Matrix4,I=new THREE.Matrix4,K=new THREE.Frustum,N=new THREE.Vector4,ja=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);M.multiply(b.projectionMatrix,b.matrixWorldInverse);M.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);M.multiply(b.matrixWorld,
+b.projectionMatrixInverse);M.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(b,d){g=0;q.objects.length=0;q.sprites.length=0;q.lights.length=0;var h=function(b){if(!1!==b.visible){(b instanceof THREE.Mesh||b instanceof THREE.Line)&&(!1===b.frustumCulled||K.contains(b))?(G.copy(b.matrixWorld.getPosition()),M.multiplyVector3(G),
+f=a(),f.object=b,f.z=G.z,q.objects.push(f)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(G.copy(b.matrixWorld.getPosition()),M.multiplyVector3(G),f=a(),f.object=b,f.z=G.z,q.sprites.push(f)):b instanceof THREE.Light&&q.lights.push(b);for(var c=0,e=b.children.length;c<e;c++)h(b.children[c])}};h(b);d&&q.objects.sort(c);return q};this.projectScene=function(a,f,g){var h=f.near,C=f.far,e=!1,G,Ba,T,sa,J,aa,ta,xa,X,Aa,Ma,Wa,Ta,Ka,Ca;P=t=u=o=0;q.elements.length=0;void 0===f.parent&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),
+a.add(f));a.updateMatrixWorld();f.matrixWorldInverse.getInverse(f.matrixWorld);M.multiply(f.projectionMatrix,f.matrixWorldInverse);K.setFromMatrix(M);q=this.projectGraph(a,!1);for(a=0,G=q.objects.length;a<G;a++)if(X=q.objects[a].object,Aa=X.matrixWorld,k=0,X instanceof THREE.Mesh){Ma=X.geometry;Wa=X.geometry.materials;sa=Ma.vertices;Ta=Ma.faces;Ka=Ma.faceVertexUvs;Ma=X.matrixRotationWorld.extractRotation(Aa);for(Ba=0,T=sa.length;Ba<T;Ba++)i=b(),i.positionWorld.copy(sa[Ba].position),Aa.multiplyVector3(i.positionWorld),
+i.positionScreen.copy(i.positionWorld),M.multiplyVector4(i.positionScreen),i.positionScreen.x/=i.positionScreen.w,i.positionScreen.y/=i.positionScreen.w,i.visible=i.positionScreen.z>h&&i.positionScreen.z<C;for(sa=0,Ba=Ta.length;sa<Ba;sa++){T=Ta[sa];if(T instanceof THREE.Face3)if(J=j[T.a],aa=j[T.b],ta=j[T.c],J.visible&&aa.visible&&ta.visible)if(e=0>(ta.positionScreen.x-J.positionScreen.x)*(aa.positionScreen.y-J.positionScreen.y)-(ta.positionScreen.y-J.positionScreen.y)*(aa.positionScreen.x-J.positionScreen.x),
+X.doubleSided||e!=X.flipSided)xa=l[o]=l[o]||new THREE.RenderableFace3,o++,m=xa,m.v1.copy(J),m.v2.copy(aa),m.v3.copy(ta);else continue;else continue;else if(T instanceof THREE.Face4)if(J=j[T.a],aa=j[T.b],ta=j[T.c],xa=j[T.d],J.visible&&aa.visible&&ta.visible&&xa.visible)if(e=0>(xa.positionScreen.x-J.positionScreen.x)*(aa.positionScreen.y-J.positionScreen.y)-(xa.positionScreen.y-J.positionScreen.y)*(aa.positionScreen.x-J.positionScreen.x)||0>(aa.positionScreen.x-ta.positionScreen.x)*(xa.positionScreen.y-
+ta.positionScreen.y)-(aa.positionScreen.y-ta.positionScreen.y)*(xa.positionScreen.x-ta.positionScreen.x),X.doubleSided||e!=X.flipSided)Ca=r[u]=r[u]||new THREE.RenderableFace4,u++,m=Ca,m.v1.copy(J),m.v2.copy(aa),m.v3.copy(ta),m.v4.copy(xa);else continue;else continue;m.normalWorld.copy(T.normal);!e&&(X.flipSided||X.doubleSided)&&m.normalWorld.negate();Ma.multiplyVector3(m.normalWorld);m.centroidWorld.copy(T.centroid);Aa.multiplyVector3(m.centroidWorld);m.centroidScreen.copy(m.centroidWorld);M.multiplyVector3(m.centroidScreen);
+ta=T.vertexNormals;for(J=0,aa=ta.length;J<aa;J++)xa=m.vertexNormalsWorld[J],xa.copy(ta[J]),!e&&(X.flipSided||X.doubleSided)&&xa.negate(),Ma.multiplyVector3(xa);for(J=0,aa=Ka.length;J<aa;J++)if(Ca=Ka[J][sa])for(ta=0,xa=Ca.length;ta<xa;ta++)m.uvs[J][ta]=Ca[ta];m.material=X.material;m.faceMaterial=null!==T.materialIndex?Wa[T.materialIndex]:null;m.z=m.centroidScreen.z;q.elements.push(m)}}else if(X instanceof THREE.Line){I.multiply(M,Aa);sa=X.geometry.vertices;J=b();J.positionScreen.copy(sa[0].position);
+I.multiplyVector4(J.positionScreen);for(Ba=1,T=sa.length;Ba<T;Ba++)if(J=b(),J.positionScreen.copy(sa[Ba].position),I.multiplyVector4(J.positionScreen),aa=j[k-2],N.copy(J.positionScreen),ja.copy(aa.positionScreen),d(N,ja))N.multiplyScalar(1/N.w),ja.multiplyScalar(1/ja.w),Aa=z[t]=z[t]||new THREE.RenderableLine,t++,n=Aa,n.v1.positionScreen.copy(N),n.v2.positionScreen.copy(ja),n.z=Math.max(N.z,ja.z),n.material=X.material,q.elements.push(n)}for(a=0,G=q.sprites.length;a<G;a++)if(X=q.sprites[a].object,Aa=
+X.matrixWorld,X instanceof THREE.Particle&&(H.set(Aa.n14,Aa.n24,Aa.n34,1),M.multiplyVector4(H),H.z/=H.w,0<H.z&&1>H.z))h=A[P]=A[P]||new THREE.RenderableParticle,P++,w=h,w.x=H.x/H.w,w.y=H.y/H.w,w.z=H.z,w.rotation=X.rotation.z,w.scale.x=X.scale.x*Math.abs(w.x-(H.x+f.projectionMatrix.n11)/(H.w+f.projectionMatrix.n14)),w.scale.y=X.scale.y*Math.abs(w.y-(H.y+f.projectionMatrix.n22)/(H.w+f.projectionMatrix.n24)),w.material=X.material,q.elements.push(w);g&&q.elements.sort(c);return q}};
 THREE.Quaternion=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=void 0!==d?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),g=Math.cos(c),c=Math.sin(c),i=a*b,h=d*f;this.w=i*g-h*c;this.x=i*c+h*g;this.y=d*b*g+a*f*c;this.z=a*f*g-d*b*c;return this},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);
+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),g=Math.cos(c),c=Math.sin(c),h=a*b,i=d*f;this.w=h*g-i*c;this.x=h*c+i*g;this.y=d*b*g+a*f*c;this.z=a*f*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=0>a.n32-a.n23?-Math.abs(this.x):Math.abs(this.x);this.y=0>a.n13-a.n31?-Math.abs(this.y):Math.abs(this.y);this.z=0>a.n21-a.n12?-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);0===a?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},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},multiplySelf:function(a){var b=this.x,c=this.y,d=this.z,f=this.w,g=a.x,i=a.y,h=a.z,a=a.w;this.x=b*a+f*g+c*h-d*i;this.y=c*a+f*i+d*g-b*h;this.z=d*a+f*h+b*i-c*g;this.w=f*a-b*g-c*i-d*h;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,f=a.z,g=this.x,i=this.y,h=this.z,k=this.w,j=k*c+i*f-h*d,m=k*d+h*c-g*f,n=k*f+g*
-d-i*c,c=-g*c-i*d-h*f;b.x=j*k+c*-g+m*-h-n*-i;b.y=m*k+c*-i+n*-g-j*-h;b.z=n*k+c*-h+j*-i-m*-g;return b},clone:function(){return new THREE.Quaternion(this.x,this.y,this.z,this.w)}};
+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},multiplySelf:function(a){var b=this.x,c=this.y,d=this.z,f=this.w,g=a.x,h=a.y,i=a.z,a=a.w;this.x=b*a+f*g+c*i-d*h;this.y=c*a+f*h+d*g-b*i;this.z=d*a+f*i+b*h-c*g;this.w=f*a-b*g-c*h-d*i;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,f=a.z,g=this.x,h=this.y,i=this.z,k=this.w,j=k*c+h*f-i*d,m=k*d+i*c-g*f,o=k*f+g*
+d-h*c,c=-g*c-h*d-i*f;b.x=j*k+c*-g+m*-i-o*-h;b.y=m*k+c*-h+o*-g-j*-i;b.z=o*k+c*-i+j*-h-m*-g;return b},clone:function(){return new THREE.Quaternion(this.x,this.y,this.z,this.w)}};
 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;0>f?(c.w=-b.w,c.x=-b.x,c.y=-b.y,c.z=-b.z,f=-f):c.copy(b);if(1<=Math.abs(f))return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var g=Math.acos(f),f=Math.sqrt(1-f*f);if(0.001>Math.abs(f))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)/f;d=Math.sin(d*g)/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.Vertex.prototype={constructor:THREE.Vertex,clone:function(){return new THREE.Vertex(this.position.clone())}};THREE.Face3=function(a,b,c,d,f,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=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materialIndex=g;this.centroid=new THREE.Vector3};
 THREE.Face3.prototype={constructor:THREE.Face3,clone:function(){var a=new THREE.Face3(this.a,this.b,this.c);a.normal.copy(this.normal);a.color.copy(this.color);a.centroid.copy(this.centroid);a.materialIndex=this.materialIndex;var b,c;for(b=0,c=this.vertexNormals.length;b<c;b++)a.vertexNormals[b]=this.vertexNormals[b].clone();for(b=0,c=this.vertexColors.length;b<c;b++)a.vertexColors[b]=this.vertexColors[b].clone();for(b=0,c=this.vertexTangents.length;b<c;b++)a.vertexTangents[b]=this.vertexTangents[b].clone();
-return a}};THREE.Face4=function(a,b,c,d,f,g,i){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=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materialIndex=i;this.centroid=new THREE.Vector3};
+return a}};THREE.Face4=function(a,b,c,d,f,g,h){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=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materialIndex=h;this.centroid=new THREE.Vector3};
 THREE.Face4.prototype={constructor:THREE.Face4,clone:function(){var a=new THREE.Face4(this.a,this.b,this.c,this.d);a.normal.copy(this.normal);a.color.copy(this.color);a.centroid.copy(this.centroid);a.materialIndex=this.materialIndex;var b,c;for(b=0,c=this.vertexNormals.length;b<c;b++)a.vertexNormals[b]=this.vertexNormals[b].clone();for(b=0,c=this.vertexColors.length;b<c;b++)a.vertexColors[b]=this.vertexColors[b].clone();for(b=0,c=this.vertexTangents.length;b<c;b++)a.vertexTangents[b]=this.vertexTangents[b].clone();
 return a}};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},lerpSelf:function(a,b){this.u+=(a.u-this.u)*b;this.v+=(a.v-this.v)*b;return this},clone:function(){return new THREE.UV(this.u,this.v)}};
 THREE.Geometry=function(){this.id=THREE.GeometryCount++;this.vertices=[];this.colors=[];this.materials=[];this.faces=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.morphNormals=[];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);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 g=0,i=f.vertexNormals.length;g<i;g++)b.multiplyVector3(f.vertexNormals[g]);a.multiplyVector3(f.centroid)}},computeCentroids:function(){var a,b,c;for(a=0,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(){var a,b,c,d,f,g,i=new THREE.Vector3,
-h=new THREE.Vector3;for(a=0,b=this.faces.length;a<b;a++)c=this.faces[a],d=this.vertices[c.a],f=this.vertices[c.b],g=this.vertices[c.c],i.sub(g.position,f.position),h.sub(d.position,f.position),i.crossSelf(h),i.isZero()||i.normalize(),c.normal.copy(i)},computeVertexNormals:function(){var a,b,c,d;if(void 0===this.__tmpVertices){d=this.__tmpVertices=Array(this.vertices.length);for(a=0,b=this.vertices.length;a<b;a++)d[a]=new THREE.Vector3;for(a=0,b=this.faces.length;a<b;a++)if(c=this.faces[a],c instanceof
+THREE.Geometry.prototype={constructor:THREE.Geometry,applyMatrix:function(a){var b=new THREE.Matrix4;b.extractRotation(a);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 g=0,h=f.vertexNormals.length;g<h;g++)b.multiplyVector3(f.vertexNormals[g]);a.multiplyVector3(f.centroid)}},computeCentroids:function(){var a,b,c;for(a=0,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(){var a,b,c,d,f,g,h=new THREE.Vector3,
+i=new THREE.Vector3;for(a=0,b=this.faces.length;a<b;a++)c=this.faces[a],d=this.vertices[c.a],f=this.vertices[c.b],g=this.vertices[c.c],h.sub(g.position,f.position),i.sub(d.position,f.position),h.crossSelf(i),h.isZero()||h.normalize(),c.normal.copy(h)},computeVertexNormals:function(){var a,b,c,d;if(void 0===this.__tmpVertices){d=this.__tmpVertices=Array(this.vertices.length);for(a=0,b=this.vertices.length;a<b;a++)d[a]=new THREE.Vector3;for(a=0,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;for(a=0,b=this.vertices.length;a<b;a++)d[a].set(0,0,0)}for(a=0,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));for(a=0,b=this.vertices.length;a<b;a++)d[a].normalize();for(a=0,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]))},computeMorphNormals:function(){var a,b,c,d,f;for(c=0,d=this.faces.length;c<
 d;c++){f=this.faces[c];f.__originalFaceNormal?f.__originalFaceNormal.copy(f.normal):f.__originalFaceNormal=f.normal.clone();if(!f.__originalVertexNormals)f.__originalVertexNormals=[];for(a=0,b=f.vertexNormals.length;a<b;a++)f.__originalVertexNormals[a]?f.__originalVertexNormals[a].copy(f.vertexNormals[a]):f.__originalVertexNormals[a]=f.vertexNormals[a].clone()}var g=new THREE.Geometry;g.faces=this.faces;for(a=0,b=this.morphTargets.length;a<b;a++){if(!this.morphNormals[a]){this.morphNormals[a]={};
-this.morphNormals[a].faceNormals=[];this.morphNormals[a].vertexNormals=[];var i=this.morphNormals[a].faceNormals,h=this.morphNormals[a].vertexNormals,k,j;for(c=0,d=this.faces.length;c<d;c++)f=this.faces[c],k=new THREE.Vector3,j=f instanceof THREE.Face3?{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3}:{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3,d:new THREE.Vector3},i.push(k),h.push(j)}i=this.morphNormals[a];g.vertices=this.morphTargets[a].vertices;g.computeFaceNormals();
-g.computeVertexNormals();for(c=0,d=this.faces.length;c<d;c++)f=this.faces[c],k=i.faceNormals[c],j=i.vertexNormals[c],k.copy(f.normal),f instanceof THREE.Face3?(j.a.copy(f.vertexNormals[0]),j.b.copy(f.vertexNormals[1]),j.c.copy(f.vertexNormals[2])):(j.a.copy(f.vertexNormals[0]),j.b.copy(f.vertexNormals[1]),j.c.copy(f.vertexNormals[2]),j.d.copy(f.vertexNormals[3]))}for(c=0,d=this.faces.length;c<d;c++)f=this.faces[c],f.normal=f.__originalFaceNormal,f.vertexNormals=f.__originalVertexNormals},computeTangents:function(){function a(a,
-b,c,d,f,g,J){h=a.vertices[b].position;k=a.vertices[c].position;j=a.vertices[d].position;m=i[f];n=i[g];l=i[J];u=k.x-h.x;r=j.x-h.x;o=k.y-h.y;q=j.y-h.y;z=k.z-h.z;w=j.z-h.z;P=n.u-m.u;A=l.u-m.u;t=n.v-m.v;G=l.v-m.v;H=1/(P*G-A*t);N.set((G*u-t*r)*H,(G*o-t*q)*H,(G*z-t*w)*H);ja.set((P*r-A*u)*H,(P*q-A*o)*H,(P*w-A*z)*H);I[b].addSelf(N);I[c].addSelf(N);I[d].addSelf(N);K[b].addSelf(ja);K[c].addSelf(ja);K[d].addSelf(ja)}var b,c,d,f,g,i,h,k,j,m,n,l,u,r,o,q,z,w,P,A,t,G,H,M,I=[],K=[],N=new THREE.Vector3,ja=new THREE.Vector3,
-oa=new THREE.Vector3,ka=new THREE.Vector3,X=new THREE.Vector3;for(b=0,c=this.vertices.length;b<c;b++)I[b]=new THREE.Vector3,K[b]=new THREE.Vector3;for(b=0,c=this.faces.length;b<c;b++)g=this.faces[b],i=this.faceVertexUvs[0][b],g instanceof THREE.Face3?a(this,g.a,g.b,g.c,0,1,2):g instanceof THREE.Face4&&(a(this,g.a,g.b,g.c,0,1,2),a(this,g.a,g.b,g.d,0,1,3));var $=["a","b","c","d"];for(b=0,c=this.faces.length;b<c;b++){g=this.faces[b];for(d=0;d<g.vertexNormals.length;d++)X.copy(g.vertexNormals[d]),f=g[$[d]],
-M=I[f],oa.copy(M),oa.subSelf(X.multiplyScalar(X.dot(M))).normalize(),ka.cross(g.vertexNormals[d],M),f=ka.dot(K[f]),f=0>f?-1:1,g.vertexTangents[d]=new THREE.Vector4(oa.x,oa.y,oa.z,f)}this.hasTangents=!0},computeBoundingBox:function(){if(!this.boundingBox)this.boundingBox={min:new THREE.Vector3,max:new THREE.Vector3};if(0<this.vertices.length){var a;a=this.vertices[0].position;this.boundingBox.min.copy(a);this.boundingBox.max.copy(a);for(var b=this.boundingBox.min,c=this.boundingBox.max,d=1,f=this.vertices.length;d<
+this.morphNormals[a].faceNormals=[];this.morphNormals[a].vertexNormals=[];var h=this.morphNormals[a].faceNormals,i=this.morphNormals[a].vertexNormals,k,j;for(c=0,d=this.faces.length;c<d;c++)f=this.faces[c],k=new THREE.Vector3,j=f instanceof THREE.Face3?{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3}:{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3,d:new THREE.Vector3},h.push(k),i.push(j)}h=this.morphNormals[a];g.vertices=this.morphTargets[a].vertices;g.computeFaceNormals();
+g.computeVertexNormals();for(c=0,d=this.faces.length;c<d;c++)f=this.faces[c],k=h.faceNormals[c],j=h.vertexNormals[c],k.copy(f.normal),f instanceof THREE.Face3?(j.a.copy(f.vertexNormals[0]),j.b.copy(f.vertexNormals[1]),j.c.copy(f.vertexNormals[2])):(j.a.copy(f.vertexNormals[0]),j.b.copy(f.vertexNormals[1]),j.c.copy(f.vertexNormals[2]),j.d.copy(f.vertexNormals[3]))}for(c=0,d=this.faces.length;c<d;c++)f=this.faces[c],f.normal=f.__originalFaceNormal,f.vertexNormals=f.__originalVertexNormals},computeTangents:function(){function a(a,
+b,c,d,f,g,J){i=a.vertices[b].position;k=a.vertices[c].position;j=a.vertices[d].position;m=h[f];o=h[g];l=h[J];u=k.x-i.x;r=j.x-i.x;n=k.y-i.y;t=j.y-i.y;z=k.z-i.z;w=j.z-i.z;P=o.u-m.u;A=l.u-m.u;q=o.v-m.v;G=l.v-m.v;H=1/(P*G-A*q);N.set((G*u-q*r)*H,(G*n-q*t)*H,(G*z-q*w)*H);ja.set((P*r-A*u)*H,(P*t-A*n)*H,(P*w-A*z)*H);I[b].addSelf(N);I[c].addSelf(N);I[d].addSelf(N);K[b].addSelf(ja);K[c].addSelf(ja);K[d].addSelf(ja)}var b,c,d,f,g,h,i,k,j,m,o,l,u,r,n,t,z,w,P,A,q,G,H,M,I=[],K=[],N=new THREE.Vector3,ja=new THREE.Vector3,
+oa=new THREE.Vector3,ka=new THREE.Vector3,Y=new THREE.Vector3;for(b=0,c=this.vertices.length;b<c;b++)I[b]=new THREE.Vector3,K[b]=new THREE.Vector3;for(b=0,c=this.faces.length;b<c;b++)g=this.faces[b],h=this.faceVertexUvs[0][b],g instanceof THREE.Face3?a(this,g.a,g.b,g.c,0,1,2):g instanceof THREE.Face4&&(a(this,g.a,g.b,g.d,0,1,3),a(this,g.b,g.c,g.d,1,2,3));var S=["a","b","c","d"];for(b=0,c=this.faces.length;b<c;b++){g=this.faces[b];for(d=0;d<g.vertexNormals.length;d++)Y.copy(g.vertexNormals[d]),f=g[S[d]],
+M=I[f],oa.copy(M),oa.subSelf(Y.multiplyScalar(Y.dot(M))).normalize(),ka.cross(g.vertexNormals[d],M),f=ka.dot(K[f]),f=0>f?-1:1,g.vertexTangents[d]=new THREE.Vector4(oa.x,oa.y,oa.z,f)}this.hasTangents=!0},computeBoundingBox:function(){if(!this.boundingBox)this.boundingBox={min:new THREE.Vector3,max:new THREE.Vector3};if(0<this.vertices.length){var a;a=this.vertices[0].position;this.boundingBox.min.copy(a);this.boundingBox.max.copy(a);for(var b=this.boundingBox.min,c=this.boundingBox.max,d=1,f=this.vertices.length;d<
 f;d++){a=this.vertices[d].position;if(a.x<b.x)b.x=a.x;else if(a.x>c.x)c.x=a.x;if(a.y<b.y)b.y=a.y;else if(a.y>c.y)c.y=a.y;if(a.z<b.z)b.z=a.z;else if(a.z>c.z)c.z=a.z}}else this.boundingBox.min.set(0,0,0),this.boundingBox.max.set(0,0,0)},computeBoundingSphere:function(){if(!this.boundingSphere)this.boundingSphere={radius:0};for(var a,b=0,c=0,d=this.vertices.length;c<d;c++)a=this.vertices[c].position.length(),a>b&&(b=a);this.boundingSphere.radius=b},mergeVertices:function(){var a={},b=[],c=[],d,f=Math.pow(10,
-4),g,i;for(g=0,i=this.vertices.length;g<i;g++)d=this.vertices[g].position,d=[Math.round(d.x*f),Math.round(d.y*f),Math.round(d.z*f)].join("_"),void 0===a[d]?(a[d]=g,b.push(this.vertices[g]),c[g]=b.length-1):c[g]=c[a[d]];for(g=0,i=this.faces.length;g<i;g++)if(a=this.faces[g],a instanceof THREE.Face3)a.a=c[a.a],a.b=c[a.b],a.c=c[a.c];else 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.Spline=function(a){function b(a,b,c,d,f,g,i){a=0.5*(c-a);d=0.5*(d-b);return(2*(b-c)+a+d)*i+(-3*(b-c)-2*a-d)*g+a*f+b}this.points=a;var c=[],d={x:0,y:0,z:0},f,g,i,h,k,j,m,n,l;this.initFromArray=function(a){this.points=[];for(var b=0;b<a.length;b++)this.points[b]={x:a[b][0],y:a[b][1],z:a[b][2]}};this.getPoint=function(a){f=(this.points.length-1)*a;g=Math.floor(f);i=f-g;c[0]=0===g?g:g-1;c[1]=g;c[2]=g>this.points.length-2?this.points.length-1:g+1;c[3]=g>this.points.length-3?this.points.length-1:
-g+2;j=this.points[c[0]];m=this.points[c[1]];n=this.points[c[2]];l=this.points[c[3]];h=i*i;k=i*h;d.x=b(j.x,m.x,n.x,l.x,i,h,k);d.y=b(j.y,m.y,n.y,l.y,i,h,k);d.z=b(j.z,m.z,n.z,l.z,i,h,k);return d};this.getControlPointsArray=function(){var a,b,c=this.points.length,d=[];for(a=0;a<c;a++)b=this.points[a],d[a]=[b.x,b.y,b.z];return d};this.getLength=function(a){var b,c,d,f=b=b=0,g=new THREE.Vector3,i=new THREE.Vector3,h=[],j=0;h[0]=0;a||(a=100);c=this.points.length*a;g.copy(this.points[0]);for(a=1;a<c;a++)b=
-a/c,d=this.getPoint(b),i.copy(d),j+=i.distanceTo(g),g.copy(d),b*=this.points.length-1,b=Math.floor(b),b!=f&&(h[b]=j,f=b);h[h.length]=j;return{chunks:h,total:j}};this.reparametrizeByArcLength=function(a){var b,c,d,f,g,i,h=[],j=new THREE.Vector3,l=this.getLength();h.push(j.copy(this.points[0]).clone());for(b=1;b<this.points.length;b++){c=l.chunks[b]-l.chunks[b-1];i=Math.ceil(a*c/l.total);f=(b-1)/(this.points.length-1);g=b/(this.points.length-1);for(c=1;c<i-1;c++)d=f+c*(1/i)*(g-f),d=this.getPoint(d),
-h.push(j.copy(d).clone());h.push(j.copy(this.points[b]).clone())}this.points=h}};THREE.Camera=function(){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.getRotationFromMatrix(this.matrix)};
-THREE.OrthographicCamera=function(a,b,c,d,f,g){THREE.Camera.call(this);this.left=a;this.right=b;this.top=c;this.bottom=d;this.near=void 0!==f?f:0.1;this.far=void 0!==g?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)};
+4),g,h;for(g=0,h=this.vertices.length;g<h;g++)d=this.vertices[g].position,d=[Math.round(d.x*f),Math.round(d.y*f),Math.round(d.z*f)].join("_"),void 0===a[d]?(a[d]=g,b.push(this.vertices[g]),c[g]=b.length-1):c[g]=c[a[d]];for(g=0,h=this.faces.length;g<h;g++)if(a=this.faces[g],a instanceof THREE.Face3)a.a=c[a.a],a.b=c[a.b],a.c=c[a.c];else 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.Spline=function(a){function b(a,b,c,d,f,g,h){a=0.5*(c-a);d=0.5*(d-b);return(2*(b-c)+a+d)*h+(-3*(b-c)-2*a-d)*g+a*f+b}this.points=a;var c=[],d={x:0,y:0,z:0},f,g,h,i,k,j,m,o,l;this.initFromArray=function(a){this.points=[];for(var b=0;b<a.length;b++)this.points[b]={x:a[b][0],y:a[b][1],z:a[b][2]}};this.getPoint=function(a){f=(this.points.length-1)*a;g=Math.floor(f);h=f-g;c[0]=0===g?g:g-1;c[1]=g;c[2]=g>this.points.length-2?this.points.length-1:g+1;c[3]=g>this.points.length-3?this.points.length-1:
+g+2;j=this.points[c[0]];m=this.points[c[1]];o=this.points[c[2]];l=this.points[c[3]];i=h*h;k=h*i;d.x=b(j.x,m.x,o.x,l.x,h,i,k);d.y=b(j.y,m.y,o.y,l.y,h,i,k);d.z=b(j.z,m.z,o.z,l.z,h,i,k);return d};this.getControlPointsArray=function(){var a,b,c=this.points.length,d=[];for(a=0;a<c;a++)b=this.points[a],d[a]=[b.x,b.y,b.z];return d};this.getLength=function(a){var b,c,d,f=b=b=0,g=new THREE.Vector3,h=new THREE.Vector3,i=[],j=0;i[0]=0;a||(a=100);c=this.points.length*a;g.copy(this.points[0]);for(a=1;a<c;a++)b=
+a/c,d=this.getPoint(b),h.copy(d),j+=h.distanceTo(g),g.copy(d),b*=this.points.length-1,b=Math.floor(b),b!=f&&(i[b]=j,f=b);i[i.length]=j;return{chunks:i,total:j}};this.reparametrizeByArcLength=function(a){var b,c,d,f,g,h,i=[],j=new THREE.Vector3,l=this.getLength();i.push(j.copy(this.points[0]).clone());for(b=1;b<this.points.length;b++){c=l.chunks[b]-l.chunks[b-1];h=Math.ceil(a*c/l.total);f=(b-1)/(this.points.length-1);g=b/(this.points.length-1);for(c=1;c<h-1;c++)d=f+c*(1/h)*(g-f),d=this.getPoint(d),
+i.push(j.copy(d).clone());i.push(j.copy(this.points[b]).clone())}this.points=i}};THREE.Camera=function(){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.getRotationFromMatrix(this.matrix)};
+THREE.OrthographicCamera=function(a,b,c,d,f,g){THREE.Camera.call(this);this.left=a;this.right=b;this.top=c;this.bottom=d;this.near=void 0!==f?f:0.1;this.far=void 0!==g?g:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=new THREE.Camera;THREE.OrthographicCamera.prototype.constructor=THREE.OrthographicCamera;THREE.OrthographicCamera.prototype.updateProjectionMatrix=function(){this.projectionMatrix.makeOrthographic(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=void 0!==a?a:50;this.aspect=void 0!==b?b:1;this.near=void 0!==c?c:0.1;this.far=void 0!==d?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((void 0!==b?b:24)/(2*a))*(180/Math.PI);this.updateProjectionMatrix()};
 THREE.PerspectiveCamera.prototype.setViewOffset=function(a,b,c,d,f,g){this.fullWidth=a;this.fullHeight=b;this.x=c;this.y=d;this.width=f;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.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.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.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.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.target=new THREE.Object3D;this.intensity=void 0!==b?b:1;this.distance=void 0!==c?c:0;this.onlyShadow=this.castShadow=!1;this.shadowCameraNear=50;this.shadowCameraFar=5E3;this.shadowCameraLeft=-500;this.shadowCameraTop=this.shadowCameraRight=500;this.shadowCameraBottom=-500;this.shadowCameraVisible=!1;this.shadowBias=0;this.shadowDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowCascade=
 !1;this.shadowCascadeOffset=new THREE.Vector3(0,0,-1E3);this.shadowCascadeCount=2;this.shadowCascadeBias=[0,0,0];this.shadowCascadeWidth=[512,512,512];this.shadowCascadeHeight=[512,512,512];this.shadowCascadeNearZ=[-1,0.99,0.998];this.shadowCascadeFarZ=[0.99,0.998,1];this.shadowCascadeArray=[];this.shadowMatrix=this.shadowCamera=this.shadowMapSize=this.shadowMap=null};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=void 0!==b?b:1;this.distance=void 0!==c?c:0};THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight;
 THREE.SpotLight=function(a,b,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.target=new THREE.Object3D;this.intensity=void 0!==b?b:1;this.distance=void 0!==c?c:0;this.onlyShadow=this.castShadow=!1;this.shadowCameraNear=50;this.shadowCameraFar=5E3;this.shadowCameraFov=50;this.shadowCameraVisible=!1;this.shadowBias=0;this.shadowDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowMatrix=this.shadowCamera=this.shadowMapSize=this.shadowMap=null};
 THREE.SpotLight.prototype=new THREE.Light;THREE.SpotLight.prototype.constructor=THREE.SpotLight;
-THREE.Material=function(a){a=a||{};this.id=THREE.MaterialCount++;this.name="";this.opacity=void 0!==a.opacity?a.opacity:1;this.transparent=void 0!==a.transparent?a.transparent:!1;this.blending=void 0!==a.blending?a.blending:THREE.NormalBlending;this.depthTest=void 0!==a.depthTest?a.depthTest:!0;this.depthWrite=void 0!==a.depthWrite?a.depthWrite:!0;this.polygonOffset=void 0!==a.polygonOffset?a.polygonOffset:!1;this.polygonOffsetFactor=void 0!==a.polygonOffsetFactor?a.polygonOffsetFactor:0;this.polygonOffsetUnits=
-void 0!==a.polygonOffsetUnits?a.polygonOffsetUnits:0;this.alphaTest=void 0!==a.alphaTest?a.alphaTest:0;this.overdraw=void 0!==a.overdraw?a.overdraw:!1;this.needsUpdate=!0};THREE.MaterialCount=0;THREE.NoShading=0;THREE.FlatShading=1;THREE.SmoothShading=2;THREE.NoColors=0;THREE.FaceColors=1;THREE.VertexColors=2;THREE.NoBlending=0;THREE.NormalBlending=1;THREE.AdditiveBlending=2;THREE.SubtractiveBlending=3;THREE.MultiplyBlending=4;THREE.AdditiveAlphaBlending=5;
+THREE.Material=function(a){a=a||{};this.id=THREE.MaterialCount++;this.name="";this.opacity=void 0!==a.opacity?a.opacity:1;this.transparent=void 0!==a.transparent?a.transparent:!1;this.blending=void 0!==a.blending?a.blending:THREE.NormalBlending;this.blendSrc=void 0!==a.blendSrc?a.blendSrc:THREE.SrcAlphaFactor;this.blendDst=void 0!==a.blendDst?a.blendDst:THREE.OneMinusSrcAlphaFactor;this.blendEquation=void 0!==a.blendEquation?a.blendEquation:THREE.AddEquation;this.depthTest=void 0!==a.depthTest?a.depthTest:
+!0;this.depthWrite=void 0!==a.depthWrite?a.depthWrite:!0;this.polygonOffset=void 0!==a.polygonOffset?a.polygonOffset:!1;this.polygonOffsetFactor=void 0!==a.polygonOffsetFactor?a.polygonOffsetFactor:0;this.polygonOffsetUnits=void 0!==a.polygonOffsetUnits?a.polygonOffsetUnits:0;this.alphaTest=void 0!==a.alphaTest?a.alphaTest:0;this.overdraw=void 0!==a.overdraw?a.overdraw:!1;this.needsUpdate=!0};THREE.MaterialCount=0;THREE.NoShading=0;THREE.FlatShading=1;THREE.SmoothShading=2;THREE.NoColors=0;
+THREE.FaceColors=1;THREE.VertexColors=2;THREE.NoBlending=0;THREE.NormalBlending=1;THREE.AdditiveBlending=2;THREE.SubtractiveBlending=3;THREE.MultiplyBlending=4;THREE.AdditiveAlphaBlending=5;THREE.CustomBlending=6;THREE.AddEquation=100;THREE.SubtractEquation=101;THREE.ReverseSubtractEquation=102;THREE.ZeroFactor=200;THREE.OneFactor=201;THREE.SrcColorFactor=202;THREE.OneMinusSrcColorFactor=203;THREE.SrcAlphaFactor=204;THREE.OneMinusSrcAlphaFactor=205;THREE.DstAlphaFactor=206;
+THREE.OneMinusDstAlphaFactor=207;THREE.DstColorFactor=208;THREE.OneMinusDstColorFactor=209;THREE.SrcAlphaSaturateFactor=210;
 THREE.LineBasicMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=void 0!==a.color?new THREE.Color(a.color):new THREE.Color(16777215);this.linewidth=void 0!==a.linewidth?a.linewidth:1;this.linecap=void 0!==a.linecap?a.linecap:"round";this.linejoin=void 0!==a.linejoin?a.linejoin:"round";this.vertexColors=a.vertexColors?a.vertexColors:!1;this.fog=void 0!==a.fog?a.fog:!0};THREE.LineBasicMaterial.prototype=new THREE.Material;THREE.LineBasicMaterial.prototype.constructor=THREE.LineBasicMaterial;
 THREE.MeshBasicMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=void 0!==a.color?new THREE.Color(a.color):new THREE.Color(16777215);this.map=void 0!==a.map?a.map:null;this.lightMap=void 0!==a.lightMap?a.lightMap:null;this.envMap=void 0!==a.envMap?a.envMap:null;this.combine=void 0!==a.combine?a.combine:THREE.MultiplyOperation;this.reflectivity=void 0!==a.reflectivity?a.reflectivity:1;this.refractionRatio=void 0!==a.refractionRatio?a.refractionRatio:0.98;this.fog=void 0!==a.fog?a.fog:
 !0;this.shading=void 0!==a.shading?a.shading:THREE.SmoothShading;this.wireframe=void 0!==a.wireframe?a.wireframe:!1;this.wireframeLinewidth=void 0!==a.wireframeLinewidth?a.wireframeLinewidth:1;this.wireframeLinecap=void 0!==a.wireframeLinecap?a.wireframeLinecap:"round";this.wireframeLinejoin=void 0!==a.wireframeLinejoin?a.wireframeLinejoin:"round";this.vertexColors=void 0!==a.vertexColors?a.vertexColors:THREE.NoColors;this.skinning=void 0!==a.skinning?a.skinning:!1;this.morphTargets=void 0!==a.morphTargets?
@@ -131,10 +133,10 @@ THREE.MeshDepthMaterial.prototype.constructor=THREE.MeshDepthMaterial;THREE.Mesh
 THREE.ParticleBasicMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=void 0!==a.color?new THREE.Color(a.color):new THREE.Color(16777215);this.map=void 0!==a.map?a.map:null;this.size=void 0!==a.size?a.size:1;this.sizeAttenuation=void 0!==a.sizeAttenuation?a.sizeAttenuation:!0;this.vertexColors=void 0!==a.vertexColors?a.vertexColors:!1;this.fog=void 0!==a.fog?a.fog:!0};THREE.ParticleBasicMaterial.prototype=new THREE.Material;THREE.ParticleBasicMaterial.prototype.constructor=THREE.ParticleBasicMaterial;
 THREE.ShaderMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.fragmentShader=void 0!==a.fragmentShader?a.fragmentShader:"void main() {}";this.vertexShader=void 0!==a.vertexShader?a.vertexShader:"void main() {}";this.uniforms=void 0!==a.uniforms?a.uniforms:{};this.attributes=a.attributes;this.shading=void 0!==a.shading?a.shading:THREE.SmoothShading;this.wireframe=void 0!==a.wireframe?a.wireframe:!1;this.wireframeLinewidth=void 0!==a.wireframeLinewidth?a.wireframeLinewidth:1;this.fog=void 0!==
 a.fog?a.fog:!1;this.lights=void 0!==a.lights?a.lights:!1;this.vertexColors=void 0!==a.vertexColors?a.vertexColors:THREE.NoColors;this.skinning=void 0!==a.skinning?a.skinning:!1;this.morphTargets=void 0!==a.morphTargets?a.morphTargets:!1;this.morphNormals=void 0!==a.morphNormals?a.morphNormals:!1};THREE.ShaderMaterial.prototype=new THREE.Material;THREE.ShaderMaterial.prototype.constructor=THREE.ShaderMaterial;
-THREE.Texture=function(a,b,c,d,f,g,i,h){this.id=THREE.TextureCount++;this.image=a;this.mapping=void 0!==b?b:new THREE.UVMapping;this.wrapS=void 0!==c?c:THREE.ClampToEdgeWrapping;this.wrapT=void 0!==d?d:THREE.ClampToEdgeWrapping;this.magFilter=void 0!==f?f:THREE.LinearFilter;this.minFilter=void 0!==g?g:THREE.LinearMipMapLinearFilter;this.format=void 0!==i?i:THREE.RGBAFormat;this.type=void 0!==h?h:THREE.UnsignedByteType;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.generateMipmaps=
-!0;this.needsUpdate=!1;this.onUpdate=null};THREE.Texture.prototype={constructor:THREE.Texture,clone:function(){var a=new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter,this.format,this.type);a.offset.copy(this.offset);a.repeat.copy(this.repeat);return a}};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(a,b,c,d,f,g,i,h,k,j){THREE.Texture.call(this,null,g,i,h,k,j,d,f);this.image={data:a,width:b,height:c}};THREE.DataTexture.prototype=new THREE.Texture;THREE.DataTexture.prototype.constructor=THREE.DataTexture;
+THREE.Texture=function(a,b,c,d,f,g,h,i){this.id=THREE.TextureCount++;this.image=a;this.mapping=void 0!==b?b:new THREE.UVMapping;this.wrapS=void 0!==c?c:THREE.ClampToEdgeWrapping;this.wrapT=void 0!==d?d:THREE.ClampToEdgeWrapping;this.magFilter=void 0!==f?f:THREE.LinearFilter;this.minFilter=void 0!==g?g:THREE.LinearMipMapLinearFilter;this.format=void 0!==h?h:THREE.RGBAFormat;this.type=void 0!==i?i:THREE.UnsignedByteType;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.generateMipmaps=
+!0;this.needsUpdate=this.premultiplyAlpha=!1;this.onUpdate=null};THREE.Texture.prototype={constructor:THREE.Texture,clone:function(){var a=new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter,this.format,this.type);a.offset.copy(this.offset);a.repeat.copy(this.repeat);return a}};THREE.TextureCount=0;THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.UVMapping=function(){};THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};
+THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=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(a,b,c,d,f,g,h,i,k,j){THREE.Texture.call(this,null,g,h,i,k,j,d,f);this.image={data:a,width:b,height:c}};THREE.DataTexture.prototype=new THREE.Texture;THREE.DataTexture.prototype.constructor=THREE.DataTexture;
 THREE.DataTexture.prototype.clone=function(){var a=new THREE.DataTexture(this.image.data,this.image.width,this.image.height,this.format,this.type,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter);a.offset.copy(this.offset);a.repeat.copy(this.repeat);return a};THREE.Particle=function(a){THREE.Object3D.call(this);this.material=a};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;
 THREE.ParticleSystem=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material=void 0!==b?b:new THREE.ParticleBasicMaterial({color:16777215*Math.random()});this.sortParticles=!1;if(this.geometry)this.geometry.boundingSphere||this.geometry.computeBoundingSphere(),this.boundRadius=a.boundingSphere.radius;this.frustumCulled=!1};THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem;
 THREE.Line=function(a,b,c){THREE.Object3D.call(this);this.geometry=a;this.material=void 0!==b?b:new THREE.LineBasicMaterial({color:16777215*Math.random()});this.type=void 0!==c?c:THREE.LineStrip;this.geometry&&(this.geometry.boundingSphere||this.geometry.computeBoundingSphere())};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;
@@ -142,7 +144,7 @@ THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material
 this.morphTargetDictionary[this.geometry.morphTargets[c].name]=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(void 0!==this.morphTargetDictionary[a])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};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){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 c,d=this.children.length;for(c=0;c<d;c++)this.children[c].update(this.skinMatrix,b)};
-THREE.SkinnedMesh=function(a,b){THREE.Mesh.call(this,a,b);this.identityMatrix=new THREE.Matrix4;this.bones=[];this.boneMatrices=[];var c,d,f,g,i,h;if(void 0!==this.geometry.bones){for(c=0;c<this.geometry.bones.length;c++)f=this.geometry.bones[c],g=f.pos,i=f.rotq,h=f.scl,d=this.addBone(),d.name=f.name,d.position.set(g[0],g[1],g[2]),d.quaternion.set(i[0],i[1],i[2],i[3]),d.useQuaternion=!0,void 0!==h?d.scale.set(h[0],h[1],h[2]):d.scale.set(1,1,1);for(c=0;c<this.bones.length;c++)f=this.geometry.bones[c],
+THREE.SkinnedMesh=function(a,b){THREE.Mesh.call(this,a,b);this.identityMatrix=new THREE.Matrix4;this.bones=[];this.boneMatrices=[];var c,d,f,g,h,i;if(void 0!==this.geometry.bones){for(c=0;c<this.geometry.bones.length;c++)f=this.geometry.bones[c],g=f.pos,h=f.rotq,i=f.scl,d=this.addBone(),d.name=f.name,d.position.set(g[0],g[1],g[2]),d.quaternion.set(h[0],h[1],h[2],h[3]),d.useQuaternion=!0,void 0!==i?d.scale.set(i[0],i[1],i[2]):d.scale.set(1,1,1);for(c=0;c<this.bones.length;c++)f=this.geometry.bones[c],
 d=this.bones[c],-1===f.parent?this.add(d):this.bones[f.parent].add(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.addBone=function(a){void 0===a&&(a=new THREE.Bone(this));this.bones.push(a);return a};
 THREE.SkinnedMesh.prototype.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;for(var a=0,b=this.children.length;a<b;a++){var c=this.children[a];c instanceof THREE.Bone?c.update(this.identityMatrix,!1):c.updateMatrixWorld(!0)}for(var b=this.bones.length,c=this.bones,d=this.boneMatrices,a=0;a<b;a++)c[a].skinMatrix.flattenToArrayOffset(d,
 16*a)};
@@ -150,11 +152,11 @@ THREE.SkinnedMesh.prototype.pose=function(){this.updateMatrixWorld(!0);for(var a
 new THREE.Vector3(c.x,c.y,c.z);this.geometry.skinVerticesA.push(b[f].multiplyVector3(d));d=new THREE.Vector3(c.x,c.y,c.z);this.geometry.skinVerticesB.push(b[g].multiplyVector3(d));1!==this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y&&(c=0.5*(1-(this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y)),this.geometry.skinWeights[a].x+=c,this.geometry.skinWeights[a].y+=c)}}};THREE.Ribbon=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material=b};
 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(a,b){void 0===b&&(b=0);for(var b=Math.abs(b),c=0;c<this.LODs.length&&!(b<this.LODs[c].visibleAtDistance);c++);this.LODs.splice(c,0,{visibleAtDistance:b,object3D:a});this.add(a)};
 THREE.LOD.prototype.update=function(a){if(1<this.LODs.length){a.matrixWorldInverse.getInverse(a.matrixWorld);a=a.matrixWorldInverse;a=-(a.n31*this.matrixWorld.n14+a.n32*this.matrixWorld.n24+a.n33*this.matrixWorld.n34+a.n34);this.LODs[0].object3D.visible=!0;for(var b=1;b<this.LODs.length;b++)if(a>=this.LODs[b].visibleAtDistance)this.LODs[b-1].object3D.visible=!1,this.LODs[b].object3D.visible=!0;else break;for(;b<this.LODs.length;b++)this.LODs[b].object3D.visible=!1}};
-THREE.Sprite=function(a){THREE.Object3D.call(this);this.color=void 0!==a.color?new THREE.Color(a.color):new THREE.Color(16777215);this.map=void 0!==a.map?a.map:new THREE.Texture;this.blending=void 0!==a.blending?a.blending:THREE.NormalBlending;this.useScreenCoordinates=void 0!==a.useScreenCoordinates?a.useScreenCoordinates:!0;this.mergeWith3D=void 0!==a.mergeWith3D?a.mergeWith3D:!this.useScreenCoordinates;this.affectedByDistance=void 0!==a.affectedByDistance?a.affectedByDistance:!this.useScreenCoordinates;
-this.scaleByViewport=void 0!==a.scaleByViewport?a.scaleByViewport:!this.affectedByDistance;this.alignment=a.alignment instanceof THREE.Vector2?a.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.updateMatrix=function(){this.matrix.setPosition(this.position);this.rotation3d.set(0,0,this.rotation);this.matrix.setRotationFromEuler(this.rotation3d);if(1!==this.scale.x||1!==this.scale.y)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.overrideMaterial=this.fog=null;this.matrixAutoUpdate=!1;this.__objects=[];this.__lights=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;
+THREE.Sprite=function(a){THREE.Object3D.call(this);this.color=void 0!==a.color?new THREE.Color(a.color):new THREE.Color(16777215);this.map=void 0!==a.map?a.map:new THREE.Texture;this.blending=void 0!==a.blending?a.blending:THREE.NormalBlending;this.blendSrc=void 0!==a.blendSrc?a.blendSrc:THREE.SrcAlphaFactor;this.blendDst=void 0!==a.blendDst?a.blendDst:THREE.OneMinusSrcAlphaFactor;this.blendEquation=void 0!==a.blendEquation?a.blendEquation:THREE.AddEquation;this.useScreenCoordinates=void 0!==a.useScreenCoordinates?
+a.useScreenCoordinates:!0;this.mergeWith3D=void 0!==a.mergeWith3D?a.mergeWith3D:!this.useScreenCoordinates;this.affectedByDistance=void 0!==a.affectedByDistance?a.affectedByDistance:!this.useScreenCoordinates;this.scaleByViewport=void 0!==a.scaleByViewport?a.scaleByViewport:!this.affectedByDistance;this.alignment=a.alignment instanceof THREE.Vector2?a.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.updateMatrix=function(){this.matrix.setPosition(this.position);this.rotation3d.set(0,0,this.rotation);this.matrix.setRotationFromEuler(this.rotation3d);if(1!==this.scale.x||1!==this.scale.y)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.overrideMaterial=this.fog=null;this.matrixAutoUpdate=!1;this.__objects=[];this.__lights=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;
 THREE.Scene.prototype.__addObject=function(a){if(a instanceof THREE.Light)-1===this.__lights.indexOf(a)&&this.__lights.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&-1===this.__objects.indexOf(a)){this.__objects.push(a);this.__objectsAdded.push(a);var b=this.__objectsRemoved.indexOf(a);-1!==b&&this.__objectsRemoved.splice(b,1)}for(b=0;b<a.children.length;b++)this.__addObject(a.children[b])};
 THREE.Scene.prototype.__removeObject=function(a){if(a instanceof THREE.Light){var b=this.__lights.indexOf(a);-1!==b&&this.__lights.splice(b,1)}else a instanceof THREE.Camera||(b=this.__objects.indexOf(a),-1!==b&&(this.__objects.splice(b,1),this.__objectsRemoved.push(a),b=this.__objectsAdded.indexOf(a),-1!==b&&this.__objectsAdded.splice(b,1)));for(b=0;b<a.children.length;b++)this.__removeObject(a.children[b])};
 THREE.Fog=function(a,b,c){this.color=new THREE.Color(a);this.near=void 0!==b?b:1;this.far=void 0!==c?c:1E3};THREE.FogExp2=function(a,b){this.color=new THREE.Color(a);this.density=void 0!==b?b:2.5E-4};
@@ -192,129 +194,131 @@ THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_pars_fragment,THREE.
 THREE.ShaderChunk.envmap_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.linear_to_gamma_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(a){function b(a,b){var c=a.vertices.length,d=b.material;if(d.attributes){if(void 0===a.__webglCustomAttributesList)a.__webglCustomAttributesList=[];for(var f in d.attributes){var g=d.attributes[f];if(!g.__webglInitialized||g.createUniqueBuffers){g.__webglInitialized=!0;var i=1;"v2"===g.type?i=2:"v3"===g.type?i=3:"v4"===g.type?i=4:"c"===g.type&&(i=3);g.size=i;g.array=new Float32Array(c*i);g.buffer=e.createBuffer();g.buffer.belongsToAttribute=f;g.needsUpdate=!0}a.__webglCustomAttributesList.push(g)}}}
-function c(a,b){if(a.material&&!(a.material instanceof THREE.MeshFaceMaterial))return a.material;if(0<=b.materialIndex)return a.geometry.materials[b.materialIndex]}function d(a){return a instanceof THREE.MeshBasicMaterial&&!a.envMap||a instanceof THREE.MeshDepthMaterial?!1:a&&void 0!==a.shading&&a.shading===THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading}function f(a){return a.map||a.lightMap||a instanceof THREE.ShaderMaterial?!0:!1}function g(a,b,c){var d,f,g,i,h=a.vertices;i=h.length;
-var j=a.colors,l=j.length,m=a.__vertexArray,n=a.__colorArray,k=a.__sortArray,r=a.__dirtyVertices,o=a.__dirtyColors,u=a.__webglCustomAttributesList;if(c.sortParticles){Ob.copy(mb);Ob.multiplySelf(c.matrixWorld);for(d=0;d<i;d++)f=h[d].position,Na.copy(f),Ob.multiplyVector3(Na),k[d]=[Na.z,d];k.sort(function(a,b){return b[0]-a[0]});for(d=0;d<i;d++)f=h[k[d][1]].position,g=3*d,m[g]=f.x,m[g+1]=f.y,m[g+2]=f.z;for(d=0;d<l;d++)g=3*d,f=j[k[d][1]],n[g]=f.r,n[g+1]=f.g,n[g+2]=f.b;if(u)for(j=0,l=u.length;j<l;j++)if(h=
-u[j],void 0===h.boundTo||"vertices"===h.boundTo)if(g=0,f=h.value.length,1===h.size)for(d=0;d<f;d++)i=k[d][1],h.array[d]=h.value[i];else if(2===h.size)for(d=0;d<f;d++)i=k[d][1],i=h.value[i],h.array[g]=i.x,h.array[g+1]=i.y,g+=2;else if(3===h.size)if("c"===h.type)for(d=0;d<f;d++)i=k[d][1],i=h.value[i],h.array[g]=i.r,h.array[g+1]=i.g,h.array[g+2]=i.b,g+=3;else for(d=0;d<f;d++)i=k[d][1],i=h.value[i],h.array[g]=i.x,h.array[g+1]=i.y,h.array[g+2]=i.z,g+=3;else if(4===h.size)for(d=0;d<f;d++)i=k[d][1],i=h.value[i],
-h.array[g]=i.x,h.array[g+1]=i.y,h.array[g+2]=i.z,h.array[g+3]=i.w,g+=4}else{if(r)for(d=0;d<i;d++)f=h[d].position,g=3*d,m[g]=f.x,m[g+1]=f.y,m[g+2]=f.z;if(o)for(d=0;d<l;d++)f=j[d],g=3*d,n[g]=f.r,n[g+1]=f.g,n[g+2]=f.b;if(u)for(j=0,l=u.length;j<l;j++)if(h=u[j],h.needsUpdate&&(void 0===h.boundTo||"vertices"===h.boundTo))if(f=h.value.length,g=0,1===h.size)for(d=0;d<f;d++)h.array[d]=h.value[d];else if(2===h.size)for(d=0;d<f;d++)i=h.value[d],h.array[g]=i.x,h.array[g+1]=i.y,g+=2;else if(3===h.size)if("c"===
-h.type)for(d=0;d<f;d++)i=h.value[d],h.array[g]=i.r,h.array[g+1]=i.g,h.array[g+2]=i.b,g+=3;else for(d=0;d<f;d++)i=h.value[d],h.array[g]=i.x,h.array[g+1]=i.y,h.array[g+2]=i.z,g+=3;else if(4===h.size)for(d=0;d<f;d++)i=h.value[d],h.array[g]=i.x,h.array[g+1]=i.y,h.array[g+2]=i.z,h.array[g+3]=i.w,g+=4}if(r||c.sortParticles)e.bindBuffer(e.ARRAY_BUFFER,a.__webglVertexBuffer),e.bufferData(e.ARRAY_BUFFER,m,b);if(o||c.sortParticles)e.bindBuffer(e.ARRAY_BUFFER,a.__webglColorBuffer),e.bufferData(e.ARRAY_BUFFER,
-n,b);if(u)for(j=0,l=u.length;j<l;j++)if(h=u[j],h.needsUpdate||c.sortParticles)e.bindBuffer(e.ARRAY_BUFFER,h.buffer),e.bufferData(e.ARRAY_BUFFER,h.array,b)}function i(a,b){return b.z-a.z}function h(a,b,c){if(a.length)for(var e=0,d=a.length;e<d;e++)aa=Ba=null,sa=J=Ha=Ga=Aa=-1,a[e].render(b,c,mc,nc),aa=Ba=null,sa=J=Ha=Ga=Aa=-1}function k(a,b,c,e,d,f,g,i){var h,j,l,m;b?(j=a.length-1,m=b=-1):(j=0,b=a.length,m=1);for(var k=j;k!==b;k+=m)if(h=a[k],h.render){j=h.object;l=h.buffer;if(i)h=i;else{h=h[c];if(!h)continue;
-g&&C.setBlending(h.blending);C.setDepthTest(h.depthTest);C.setDepthWrite(h.depthWrite);z(h.polygonOffset,h.polygonOffsetFactor,h.polygonOffsetUnits)}C.setObjectFaces(j);l instanceof THREE.BufferGeometry?C.renderBufferDirect(e,d,f,h,l,j):C.renderBuffer(e,d,f,h,l,j)}}function j(a,b,c,e,d,f,g){for(var i,h,j=0,l=a.length;j<l;j++)if(i=a[j],h=i.object,h.visible){if(g)i=g;else{i=i[b];if(!i)continue;f&&C.setBlending(i.blending);C.setDepthTest(i.depthTest);C.setDepthWrite(i.depthWrite);z(i.polygonOffset,i.polygonOffsetFactor,
-i.polygonOffsetUnits)}C.renderImmediateObject(c,e,d,i,h)}}function m(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})}function n(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function l(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function u(a,b){for(var c=a.length-1;0<=c;c--)a[c].object===b&&a.splice(c,1)}function r(a,b){for(var c=a.length-1;0<=c;c--)a[c]===b&&a.splice(c,1)}function o(a,b,c,d,f){if(!d.program||d.needsUpdate)C.initMaterial(d,
-b,c,f),d.needsUpdate=!1;if(d.morphTargets&&!f.__webglMorphTargetInfluences){f.__webglMorphTargetInfluences=new Float32Array(C.maxMorphTargets);for(var g=0,i=C.maxMorphTargets;g<i;g++)f.__webglMorphTargetInfluences[g]=0}var h=!1,g=d.program,i=g.uniforms,j=d.uniforms;g!==Ba&&(e.useProgram(g),Ba=g,h=!0);if(d.id!==sa)sa=d.id,h=!0;if(h||a!==aa)e.uniformMatrix4fv(i.projectionMatrix,!1,a._projectionMatrixArray),a!==aa&&(aa=a);if(h){if(c&&d.fog)if(j.fogColor.value=c.color,c instanceof THREE.Fog)j.fogNear.value=
-c.near,j.fogFar.value=c.far;else if(c instanceof THREE.FogExp2)j.fogDensity.value=c.density;if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){var l,m=0,k=0,n=0,r,o,u,q=oc,t=q.directional.colors,z=q.directional.positions,w=q.point.colors,A=q.point.positions,J=q.point.distances,M=0,N=0,I=u=0;for(c=0,h=b.length;c<h;c++)if(l=b[c],!l.onlyShadow)if(r=l.color,o=l.intensity,u=l.distance,l instanceof THREE.AmbientLight)C.gammaInput?(m+=r.r*r.r,k+=r.g*r.g,n+=r.b*r.b):
-(m+=r.r,k+=r.g,n+=r.b);else if(l instanceof THREE.DirectionalLight)u=3*M,C.gammaInput?(t[u]=r.r*r.r*o*o,t[u+1]=r.g*r.g*o*o,t[u+2]=r.b*r.b*o*o):(t[u]=r.r*o,t[u+1]=r.g*o,t[u+2]=r.b*o),nb.copy(l.matrixWorld.getPosition()),nb.subSelf(l.target.matrixWorld.getPosition()),nb.normalize(),z[u]=nb.x,z[u+1]=nb.y,z[u+2]=nb.z,M+=1;else if(l instanceof THREE.PointLight||l instanceof THREE.SpotLight)I=3*N,C.gammaInput?(w[I]=r.r*r.r*o*o,w[I+1]=r.g*r.g*o*o,w[I+2]=r.b*r.b*o*o):(w[I]=r.r*o,w[I+1]=r.g*o,w[I+2]=r.b*o),
-l=l.matrixWorld.getPosition(),A[I]=l.x,A[I+1]=l.y,A[I+2]=l.z,J[N]=u,N+=1;for(c=3*M,h=t.length;c<h;c++)t[c]=0;for(c=3*N,h=w.length;c<h;c++)w[c]=0;q.point.length=N;q.directional.length=M;q.ambient[0]=m;q.ambient[1]=k;q.ambient[2]=n;c=oc;j.ambientLightColor.value=c.ambient;j.directionalLightColor.value=c.directional.colors;j.directionalLightDirection.value=c.directional.positions;j.pointLightColor.value=c.point.colors;j.pointLightPosition.value=c.point.positions;j.pointLightDistance.value=c.point.distances}if(d instanceof
-THREE.MeshBasicMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.MeshPhongMaterial)j.opacity.value=d.opacity,C.gammaInput?j.diffuse.value.copyGammaToLinear(d.color):j.diffuse.value=d.color,(j.map.texture=d.map)&&j.offsetRepeat.value.set(d.map.offset.x,d.map.offset.y,d.map.repeat.x,d.map.repeat.y),j.lightMap.texture=d.lightMap,j.envMap.texture=d.envMap,j.flipEnvMap.value=d.envMap instanceof THREE.WebGLRenderTargetCube?1:-1,j.reflectivity.value=d.reflectivity,j.refractionRatio.value=
-d.refractionRatio,j.combine.value=d.combine,j.useRefract.value=d.envMap&&d.envMap.mapping instanceof THREE.CubeRefractionMapping;if(d instanceof THREE.LineBasicMaterial)j.diffuse.value=d.color,j.opacity.value=d.opacity;else if(d instanceof THREE.ParticleBasicMaterial)j.psColor.value=d.color,j.opacity.value=d.opacity,j.size.value=d.size,j.scale.value=H.height/2,j.map.texture=d.map;else if(d instanceof THREE.MeshPhongMaterial)j.shininess.value=d.shininess,C.gammaInput?(j.ambient.value.copyGammaToLinear(d.ambient),
-j.emissive.value.copyGammaToLinear(d.emissive),j.specular.value.copyGammaToLinear(d.specular)):(j.ambient.value=d.ambient,j.emissive.value=d.emissive,j.specular.value=d.specular),d.wrapAround&&j.wrapRGB.value.copy(d.wrapRGB);else if(d instanceof THREE.MeshLambertMaterial)C.gammaInput?(j.ambient.value.copyGammaToLinear(d.ambient),j.emissive.value.copyGammaToLinear(d.emissive)):(j.ambient.value=d.ambient,j.emissive.value=d.emissive),d.wrapAround&&j.wrapRGB.value.copy(d.wrapRGB);else if(d instanceof
-THREE.MeshDepthMaterial)j.mNear.value=a.near,j.mFar.value=a.far,j.opacity.value=d.opacity;else if(d instanceof THREE.MeshNormalMaterial)j.opacity.value=d.opacity;if(f.receiveShadow&&!d._shadowPass&&j.shadowMatrix){h=c=0;for(m=b.length;h<m;h++)if(k=b[h],k.castShadow&&(k instanceof THREE.SpotLight||k instanceof THREE.DirectionalLight&&!k.shadowCascade))j.shadowMap.texture[c]=k.shadowMap,j.shadowMapSize.value[c]=k.shadowMapSize,j.shadowMatrix.value[c]=k.shadowMatrix,j.shadowDarkness.value[c]=k.shadowDarkness,
-j.shadowBias.value[c]=k.shadowBias,c++}b=d.uniformsList;for(j=0,c=b.length;j<c;j++)if(k=g.uniforms[b[j][1]])if(h=b[j][0],n=h.type,m=h.value,"i"===n)e.uniform1i(k,m);else if("f"===n)e.uniform1f(k,m);else if("v2"===n)e.uniform2f(k,m.x,m.y);else if("v3"===n)e.uniform3f(k,m.x,m.y,m.z);else if("v4"===n)e.uniform4f(k,m.x,m.y,m.z,m.w);else if("c"===n)e.uniform3f(k,m.r,m.g,m.b);else if("fv1"===n)e.uniform1fv(k,m);else if("fv"===n)e.uniform3fv(k,m);else if("v2v"===n){if(!h._array)h._array=new Float32Array(2*
-m.length);for(n=0,q=m.length;n<q;n++)t=2*n,h._array[t]=m[n].x,h._array[t+1]=m[n].y;e.uniform2fv(k,h._array)}else if("v3v"===n){if(!h._array)h._array=new Float32Array(3*m.length);for(n=0,q=m.length;n<q;n++)t=3*n,h._array[t]=m[n].x,h._array[t+1]=m[n].y,h._array[t+2]=m[n].z;e.uniform3fv(k,h._array)}else if("v4v"==n){if(!h._array)h._array=new Float32Array(4*m.length);for(n=0,q=m.length;n<q;n++)t=4*n,h._array[t]=m[n].x,h._array[t+1]=m[n].y,h._array[t+2]=m[n].z,h._array[t+3]=m[n].w;e.uniform4fv(k,h._array)}else if("m4"===
-n){if(!h._array)h._array=new Float32Array(16);m.flattenToArray(h._array);e.uniformMatrix4fv(k,!1,h._array)}else if("m4v"===n){if(!h._array)h._array=new Float32Array(16*m.length);for(n=0,q=m.length;n<q;n++)m[n].flattenToArrayOffset(h._array,16*n);e.uniformMatrix4fv(k,!1,h._array)}else if("t"===n){if(e.uniform1i(k,m),k=h.texture)if(k.image instanceof Array&&6===k.image.length){if(h=k,6===h.image.length)if(h.needsUpdate){if(!h.image.__webglTextureCube)h.image.__webglTextureCube=e.createTexture();e.activeTexture(e.TEXTURE0+
-m);e.bindTexture(e.TEXTURE_CUBE_MAP,h.image.__webglTextureCube);m=[];for(k=0;6>k;k++){n=m;q=k;if(C.autoScaleCubemaps){if(t=h.image[k],w=Fc,!(t.width<=w&&t.height<=w))A=Math.max(t.width,t.height),z=Math.floor(t.width*w/A),w=Math.floor(t.height*w/A),A=document.createElement("canvas"),A.width=z,A.height=w,A.getContext("2d").drawImage(t,0,0,t.width,t.height,0,0,z,w),t=A}else t=h.image[k];n[q]=t}k=m[0];n=0===(k.width&k.width-1)&&0===(k.height&k.height-1);q=G(h.format);t=G(h.type);P(e.TEXTURE_CUBE_MAP,
-h,n);for(k=0;6>k;k++)e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+k,0,q,q,t,m[k]);h.generateMipmaps&&n&&e.generateMipmap(e.TEXTURE_CUBE_MAP);h.needsUpdate=!1;if(h.onUpdate)h.onUpdate()}else e.activeTexture(e.TEXTURE0+m),e.bindTexture(e.TEXTURE_CUBE_MAP,h.image.__webglTextureCube)}else k instanceof THREE.WebGLRenderTargetCube?(h=k,e.activeTexture(e.TEXTURE0+m),e.bindTexture(e.TEXTURE_CUBE_MAP,h.__webglTexture)):C.setTexture(k,m)}else if("tv"===n){if(!h._array){h._array=[];for(n=0,q=h.texture.length;n<
-q;n++)h._array[n]=m+n}e.uniform1iv(k,h._array);for(n=0,q=h.texture.length;n<q;n++)(k=h.texture[n])&&C.setTexture(k,h._array[n])}if((d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&null!==i.cameraPosition)b=a.matrixWorld.getPosition(),e.uniform3f(i.cameraPosition,b.x,b.y,b.z);(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.ShaderMaterial||d.skinning)&&null!==i.viewMatrix&&e.uniformMatrix4fv(i.viewMatrix,!1,a._viewMatrixArray);
-d.skinning&&e.uniformMatrix4fv(i.boneGlobalMatrices,!1,f.boneMatrices)}e.uniformMatrix4fv(i.modelViewMatrix,!1,f._modelViewMatrixArray);i.normalMatrix&&e.uniformMatrix3fv(i.normalMatrix,!1,f._normalMatrixArray);(d instanceof THREE.ShaderMaterial||d.envMap||d.skinning||f.receiveShadow)&&null!==i.objectMatrix&&e.uniformMatrix4fv(i.objectMatrix,!1,f._objectMatrixArray);return g}function q(a,b){a._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,a.matrixWorld,a._modelViewMatrixArray);var c=THREE.Matrix4.makeInvert3x3(a._modelViewMatrix);
-c&&c.transposeIntoArray(a._normalMatrixArray)}function z(a,b,c){Sa!==a&&(a?e.enable(e.POLYGON_OFFSET_FILL):e.disable(e.POLYGON_OFFSET_FILL),Sa=a);if(a&&(Wa!==b||Ma!==c))e.polygonOffset(b,c),Wa=b,Ma=c}function w(a,b){var c;"fragment"===a?c=e.createShader(e.FRAGMENT_SHADER):"vertex"===a&&(c=e.createShader(e.VERTEX_SHADER));e.shaderSource(c,b);e.compileShader(c);return!e.getShaderParameter(c,e.COMPILE_STATUS)?(console.error(e.getShaderInfoLog(c)),console.error(b),null):c}function P(a,b,c){c?(e.texParameteri(a,
-e.TEXTURE_WRAP_S,G(b.wrapS)),e.texParameteri(a,e.TEXTURE_WRAP_T,G(b.wrapT)),e.texParameteri(a,e.TEXTURE_MAG_FILTER,G(b.magFilter)),e.texParameteri(a,e.TEXTURE_MIN_FILTER,G(b.minFilter))):(e.texParameteri(a,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(a,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameteri(a,e.TEXTURE_MAG_FILTER,t(b.magFilter)),e.texParameteri(a,e.TEXTURE_MIN_FILTER,t(b.minFilter)))}function A(a,b){e.bindRenderbuffer(e.RENDERBUFFER,a);b.depthBuffer&&!b.stencilBuffer?(e.renderbufferStorage(e.RENDERBUFFER,
-e.DEPTH_COMPONENT16,b.width,b.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_STENCIL,b.width,b.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,a)):e.renderbufferStorage(e.RENDERBUFFER,e.RGBA4,b.width,b.height)}function t(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return e.NEAREST;
+THREE.WebGLRenderer=function(a){function b(a,b){var c=a.vertices.length,d=b.material;if(d.attributes){if(void 0===a.__webglCustomAttributesList)a.__webglCustomAttributesList=[];for(var f in d.attributes){var g=d.attributes[f];if(!g.__webglInitialized||g.createUniqueBuffers){g.__webglInitialized=!0;var h=1;"v2"===g.type?h=2:"v3"===g.type?h=3:"v4"===g.type?h=4:"c"===g.type&&(h=3);g.size=h;g.array=new Float32Array(c*h);g.buffer=e.createBuffer();g.buffer.belongsToAttribute=f;g.needsUpdate=!0}a.__webglCustomAttributesList.push(g)}}}
+function c(a,b){if(a.material&&!(a.material instanceof THREE.MeshFaceMaterial))return a.material;if(0<=b.materialIndex)return a.geometry.materials[b.materialIndex]}function d(a){return a instanceof THREE.MeshBasicMaterial&&!a.envMap||a instanceof THREE.MeshDepthMaterial?!1:a&&void 0!==a.shading&&a.shading===THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading}function f(a){return a.map||a.lightMap||a instanceof THREE.ShaderMaterial?!0:!1}function g(a,b,c){var d,f,g,h,i=a.vertices;h=i.length;
+var j=a.colors,l=j.length,o=a.__vertexArray,k=a.__colorArray,m=a.__sortArray,r=a.__dirtyVertices,n=a.__dirtyColors,u=a.__webglCustomAttributesList;if(c.sortParticles){Ob.copy(mb);Ob.multiplySelf(c.matrixWorld);for(d=0;d<h;d++)f=i[d].position,Na.copy(f),Ob.multiplyVector3(Na),m[d]=[Na.z,d];m.sort(function(a,b){return b[0]-a[0]});for(d=0;d<h;d++)f=i[m[d][1]].position,g=3*d,o[g]=f.x,o[g+1]=f.y,o[g+2]=f.z;for(d=0;d<l;d++)g=3*d,f=j[m[d][1]],k[g]=f.r,k[g+1]=f.g,k[g+2]=f.b;if(u)for(j=0,l=u.length;j<l;j++)if(i=
+u[j],void 0===i.boundTo||"vertices"===i.boundTo)if(g=0,f=i.value.length,1===i.size)for(d=0;d<f;d++)h=m[d][1],i.array[d]=i.value[h];else if(2===i.size)for(d=0;d<f;d++)h=m[d][1],h=i.value[h],i.array[g]=h.x,i.array[g+1]=h.y,g+=2;else if(3===i.size)if("c"===i.type)for(d=0;d<f;d++)h=m[d][1],h=i.value[h],i.array[g]=h.r,i.array[g+1]=h.g,i.array[g+2]=h.b,g+=3;else for(d=0;d<f;d++)h=m[d][1],h=i.value[h],i.array[g]=h.x,i.array[g+1]=h.y,i.array[g+2]=h.z,g+=3;else if(4===i.size)for(d=0;d<f;d++)h=m[d][1],h=i.value[h],
+i.array[g]=h.x,i.array[g+1]=h.y,i.array[g+2]=h.z,i.array[g+3]=h.w,g+=4}else{if(r)for(d=0;d<h;d++)f=i[d].position,g=3*d,o[g]=f.x,o[g+1]=f.y,o[g+2]=f.z;if(n)for(d=0;d<l;d++)f=j[d],g=3*d,k[g]=f.r,k[g+1]=f.g,k[g+2]=f.b;if(u)for(j=0,l=u.length;j<l;j++)if(i=u[j],i.needsUpdate&&(void 0===i.boundTo||"vertices"===i.boundTo))if(f=i.value.length,g=0,1===i.size)for(d=0;d<f;d++)i.array[d]=i.value[d];else if(2===i.size)for(d=0;d<f;d++)h=i.value[d],i.array[g]=h.x,i.array[g+1]=h.y,g+=2;else if(3===i.size)if("c"===
+i.type)for(d=0;d<f;d++)h=i.value[d],i.array[g]=h.r,i.array[g+1]=h.g,i.array[g+2]=h.b,g+=3;else for(d=0;d<f;d++)h=i.value[d],i.array[g]=h.x,i.array[g+1]=h.y,i.array[g+2]=h.z,g+=3;else if(4===i.size)for(d=0;d<f;d++)h=i.value[d],i.array[g]=h.x,i.array[g+1]=h.y,i.array[g+2]=h.z,i.array[g+3]=h.w,g+=4}if(r||c.sortParticles)e.bindBuffer(e.ARRAY_BUFFER,a.__webglVertexBuffer),e.bufferData(e.ARRAY_BUFFER,o,b);if(n||c.sortParticles)e.bindBuffer(e.ARRAY_BUFFER,a.__webglColorBuffer),e.bufferData(e.ARRAY_BUFFER,
+k,b);if(u)for(j=0,l=u.length;j<l;j++)if(i=u[j],i.needsUpdate||c.sortParticles)e.bindBuffer(e.ARRAY_BUFFER,i.buffer),e.bufferData(e.ARRAY_BUFFER,i.array,b)}function h(a,b){return b.z-a.z}function i(a,b,c){if(a.length)for(var e=0,d=a.length;e<d;e++)aa=Ba=null,sa=J=Ca=Ka=Aa=-1,a[e].render(b,c,pc,qc),aa=Ba=null,sa=J=Ca=Ka=Aa=-1}function k(a,b,c,e,d,f,g,h){var i,j,l,m;b?(j=a.length-1,m=b=-1):(j=0,b=a.length,m=1);for(var o=j;o!==b;o+=m)if(i=a[o],i.render){j=i.object;l=i.buffer;if(h)i=h;else{i=i[c];if(!i)continue;
+g&&C.setBlending(i.blending,i.blendEquation,i.blendSrc,i.blendDst);C.setDepthTest(i.depthTest);C.setDepthWrite(i.depthWrite);z(i.polygonOffset,i.polygonOffsetFactor,i.polygonOffsetUnits)}C.setObjectFaces(j);l instanceof THREE.BufferGeometry?C.renderBufferDirect(e,d,f,i,l,j):C.renderBuffer(e,d,f,i,l,j)}}function j(a,b,c,e,d,f,g){for(var i,h,j=0,l=a.length;j<l;j++)if(i=a[j],h=i.object,h.visible){if(g)i=g;else{i=i[b];if(!i)continue;f&&C.setBlending(i.blending,i.blendEquation,i.blendSrc,i.blendDst);C.setDepthTest(i.depthTest);
+C.setDepthWrite(i.depthWrite);z(i.polygonOffset,i.polygonOffsetFactor,i.polygonOffsetUnits)}C.renderImmediateObject(c,e,d,i,h)}}function m(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})}function o(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function l(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function u(a,b){for(var c=a.length-1;0<=c;c--)a[c].object===b&&a.splice(c,1)}function r(a,b){for(var c=a.length-1;0<=c;c--)a[c]===b&&a.splice(c,
+1)}function n(a,b,c,d,f){if(!d.program||d.needsUpdate)C.initMaterial(d,b,c,f),d.needsUpdate=!1;if(d.morphTargets&&!f.__webglMorphTargetInfluences){f.__webglMorphTargetInfluences=new Float32Array(C.maxMorphTargets);for(var g=0,i=C.maxMorphTargets;g<i;g++)f.__webglMorphTargetInfluences[g]=0}var h=!1,g=d.program,i=g.uniforms,j=d.uniforms;g!==Ba&&(e.useProgram(g),Ba=g,h=!0);if(d.id!==sa)sa=d.id,h=!0;if(h||a!==aa)e.uniformMatrix4fv(i.projectionMatrix,!1,a._projectionMatrixArray),a!==aa&&(aa=a);if(h){if(c&&
+d.fog)if(j.fogColor.value=c.color,c instanceof THREE.Fog)j.fogNear.value=c.near,j.fogFar.value=c.far;else if(c instanceof THREE.FogExp2)j.fogDensity.value=c.density;if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){var l,o=0,m=0,k=0,r,n,u,t=rc,q=t.directional.colors,z=t.directional.positions,w=t.point.colors,A=t.point.positions,J=t.point.distances,M=0,N=0,I=u=0;for(c=0,h=b.length;c<h;c++)if(l=b[c],!l.onlyShadow)if(r=l.color,n=l.intensity,u=l.distance,l instanceof
+THREE.AmbientLight)C.gammaInput?(o+=r.r*r.r,m+=r.g*r.g,k+=r.b*r.b):(o+=r.r,m+=r.g,k+=r.b);else if(l instanceof THREE.DirectionalLight)u=3*M,C.gammaInput?(q[u]=r.r*r.r*n*n,q[u+1]=r.g*r.g*n*n,q[u+2]=r.b*r.b*n*n):(q[u]=r.r*n,q[u+1]=r.g*n,q[u+2]=r.b*n),nb.copy(l.matrixWorld.getPosition()),nb.subSelf(l.target.matrixWorld.getPosition()),nb.normalize(),z[u]=nb.x,z[u+1]=nb.y,z[u+2]=nb.z,M+=1;else if(l instanceof THREE.PointLight||l instanceof THREE.SpotLight)I=3*N,C.gammaInput?(w[I]=r.r*r.r*n*n,w[I+1]=r.g*
+r.g*n*n,w[I+2]=r.b*r.b*n*n):(w[I]=r.r*n,w[I+1]=r.g*n,w[I+2]=r.b*n),l=l.matrixWorld.getPosition(),A[I]=l.x,A[I+1]=l.y,A[I+2]=l.z,J[N]=u,N+=1;for(c=3*M,h=q.length;c<h;c++)q[c]=0;for(c=3*N,h=w.length;c<h;c++)w[c]=0;t.point.length=N;t.directional.length=M;t.ambient[0]=o;t.ambient[1]=m;t.ambient[2]=k;c=rc;j.ambientLightColor.value=c.ambient;j.directionalLightColor.value=c.directional.colors;j.directionalLightDirection.value=c.directional.positions;j.pointLightColor.value=c.point.colors;j.pointLightPosition.value=
+c.point.positions;j.pointLightDistance.value=c.point.distances}if(d instanceof THREE.MeshBasicMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.MeshPhongMaterial)j.opacity.value=d.opacity,C.gammaInput?j.diffuse.value.copyGammaToLinear(d.color):j.diffuse.value=d.color,(j.map.texture=d.map)&&j.offsetRepeat.value.set(d.map.offset.x,d.map.offset.y,d.map.repeat.x,d.map.repeat.y),j.lightMap.texture=d.lightMap,j.envMap.texture=d.envMap,j.flipEnvMap.value=d.envMap instanceof THREE.WebGLRenderTargetCube?
+1:-1,j.reflectivity.value=d.reflectivity,j.refractionRatio.value=d.refractionRatio,j.combine.value=d.combine,j.useRefract.value=d.envMap&&d.envMap.mapping instanceof THREE.CubeRefractionMapping;if(d instanceof THREE.LineBasicMaterial)j.diffuse.value=d.color,j.opacity.value=d.opacity;else if(d instanceof THREE.ParticleBasicMaterial)j.psColor.value=d.color,j.opacity.value=d.opacity,j.size.value=d.size,j.scale.value=H.height/2,j.map.texture=d.map;else if(d instanceof THREE.MeshPhongMaterial)j.shininess.value=
+d.shininess,C.gammaInput?(j.ambient.value.copyGammaToLinear(d.ambient),j.emissive.value.copyGammaToLinear(d.emissive),j.specular.value.copyGammaToLinear(d.specular)):(j.ambient.value=d.ambient,j.emissive.value=d.emissive,j.specular.value=d.specular),d.wrapAround&&j.wrapRGB.value.copy(d.wrapRGB);else if(d instanceof THREE.MeshLambertMaterial)C.gammaInput?(j.ambient.value.copyGammaToLinear(d.ambient),j.emissive.value.copyGammaToLinear(d.emissive)):(j.ambient.value=d.ambient,j.emissive.value=d.emissive),
+d.wrapAround&&j.wrapRGB.value.copy(d.wrapRGB);else if(d instanceof THREE.MeshDepthMaterial)j.mNear.value=a.near,j.mFar.value=a.far,j.opacity.value=d.opacity;else if(d instanceof THREE.MeshNormalMaterial)j.opacity.value=d.opacity;if(f.receiveShadow&&!d._shadowPass&&j.shadowMatrix){h=c=0;for(o=b.length;h<o;h++)if(m=b[h],m.castShadow&&(m instanceof THREE.SpotLight||m instanceof THREE.DirectionalLight&&!m.shadowCascade))j.shadowMap.texture[c]=m.shadowMap,j.shadowMapSize.value[c]=m.shadowMapSize,j.shadowMatrix.value[c]=
+m.shadowMatrix,j.shadowDarkness.value[c]=m.shadowDarkness,j.shadowBias.value[c]=m.shadowBias,c++}b=d.uniformsList;for(j=0,c=b.length;j<c;j++)if(m=g.uniforms[b[j][1]])if(h=b[j][0],k=h.type,o=h.value,"i"===k)e.uniform1i(m,o);else if("f"===k)e.uniform1f(m,o);else if("v2"===k)e.uniform2f(m,o.x,o.y);else if("v3"===k)e.uniform3f(m,o.x,o.y,o.z);else if("v4"===k)e.uniform4f(m,o.x,o.y,o.z,o.w);else if("c"===k)e.uniform3f(m,o.r,o.g,o.b);else if("fv1"===k)e.uniform1fv(m,o);else if("fv"===k)e.uniform3fv(m,o);
+else if("v2v"===k){if(!h._array)h._array=new Float32Array(2*o.length);for(k=0,t=o.length;k<t;k++)q=2*k,h._array[q]=o[k].x,h._array[q+1]=o[k].y;e.uniform2fv(m,h._array)}else if("v3v"===k){if(!h._array)h._array=new Float32Array(3*o.length);for(k=0,t=o.length;k<t;k++)q=3*k,h._array[q]=o[k].x,h._array[q+1]=o[k].y,h._array[q+2]=o[k].z;e.uniform3fv(m,h._array)}else if("v4v"==k){if(!h._array)h._array=new Float32Array(4*o.length);for(k=0,t=o.length;k<t;k++)q=4*k,h._array[q]=o[k].x,h._array[q+1]=o[k].y,h._array[q+
+2]=o[k].z,h._array[q+3]=o[k].w;e.uniform4fv(m,h._array)}else if("m4"===k){if(!h._array)h._array=new Float32Array(16);o.flattenToArray(h._array);e.uniformMatrix4fv(m,!1,h._array)}else if("m4v"===k){if(!h._array)h._array=new Float32Array(16*o.length);for(k=0,t=o.length;k<t;k++)o[k].flattenToArrayOffset(h._array,16*k);e.uniformMatrix4fv(m,!1,h._array)}else if("t"===k){if(e.uniform1i(m,o),m=h.texture)if(m.image instanceof Array&&6===m.image.length){if(h=m,6===h.image.length)if(h.needsUpdate){if(!h.image.__webglTextureCube)h.image.__webglTextureCube=
+e.createTexture();e.activeTexture(e.TEXTURE0+o);e.bindTexture(e.TEXTURE_CUBE_MAP,h.image.__webglTextureCube);o=[];for(m=0;6>m;m++){k=o;t=m;if(C.autoScaleCubemaps){if(q=h.image[m],w=Ic,!(q.width<=w&&q.height<=w))A=Math.max(q.width,q.height),z=Math.floor(q.width*w/A),w=Math.floor(q.height*w/A),A=document.createElement("canvas"),A.width=z,A.height=w,A.getContext("2d").drawImage(q,0,0,q.width,q.height,0,0,z,w),q=A}else q=h.image[m];k[t]=q}m=o[0];k=0===(m.width&m.width-1)&&0===(m.height&m.height-1);t=
+G(h.format);q=G(h.type);P(e.TEXTURE_CUBE_MAP,h,k);for(m=0;6>m;m++)e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+m,0,t,t,q,o[m]);h.generateMipmaps&&k&&e.generateMipmap(e.TEXTURE_CUBE_MAP);h.needsUpdate=!1;if(h.onUpdate)h.onUpdate()}else e.activeTexture(e.TEXTURE0+o),e.bindTexture(e.TEXTURE_CUBE_MAP,h.image.__webglTextureCube)}else m instanceof THREE.WebGLRenderTargetCube?(h=m,e.activeTexture(e.TEXTURE0+o),e.bindTexture(e.TEXTURE_CUBE_MAP,h.__webglTexture)):C.setTexture(m,o)}else if("tv"===k){if(!h._array){h._array=
+[];for(k=0,t=h.texture.length;k<t;k++)h._array[k]=o+k}e.uniform1iv(m,h._array);for(k=0,t=h.texture.length;k<t;k++)(m=h.texture[k])&&C.setTexture(m,h._array[k])}if((d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&null!==i.cameraPosition)b=a.matrixWorld.getPosition(),e.uniform3f(i.cameraPosition,b.x,b.y,b.z);(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.ShaderMaterial||d.skinning)&&null!==i.viewMatrix&&e.uniformMatrix4fv(i.viewMatrix,
+!1,a._viewMatrixArray);d.skinning&&e.uniformMatrix4fv(i.boneGlobalMatrices,!1,f.boneMatrices)}e.uniformMatrix4fv(i.modelViewMatrix,!1,f._modelViewMatrixArray);i.normalMatrix&&e.uniformMatrix3fv(i.normalMatrix,!1,f._normalMatrixArray);(d instanceof THREE.ShaderMaterial||d.envMap||d.skinning||f.receiveShadow)&&null!==i.objectMatrix&&e.uniformMatrix4fv(i.objectMatrix,!1,f._objectMatrixArray);return g}function t(a,b){a._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,a.matrixWorld,a._modelViewMatrixArray);
+a._normalMatrix.getInverse(a._modelViewMatrix);a._normalMatrix.transposeIntoArray(a._normalMatrixArray)}function z(a,b,c){sc!==a&&(a?e.enable(e.POLYGON_OFFSET_FILL):e.disable(e.POLYGON_OFFSET_FILL),sc=a);if(a&&(Yb!==b||Zb!==c))e.polygonOffset(b,c),Yb=b,Zb=c}function w(a,b){var c;"fragment"===a?c=e.createShader(e.FRAGMENT_SHADER):"vertex"===a&&(c=e.createShader(e.VERTEX_SHADER));e.shaderSource(c,b);e.compileShader(c);return!e.getShaderParameter(c,e.COMPILE_STATUS)?(console.error(e.getShaderInfoLog(c)),
+console.error(b),null):c}function P(a,b,c){c?(e.texParameteri(a,e.TEXTURE_WRAP_S,G(b.wrapS)),e.texParameteri(a,e.TEXTURE_WRAP_T,G(b.wrapT)),e.texParameteri(a,e.TEXTURE_MAG_FILTER,G(b.magFilter)),e.texParameteri(a,e.TEXTURE_MIN_FILTER,G(b.minFilter))):(e.texParameteri(a,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(a,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameteri(a,e.TEXTURE_MAG_FILTER,q(b.magFilter)),e.texParameteri(a,e.TEXTURE_MIN_FILTER,q(b.minFilter)))}function A(a,b){e.bindRenderbuffer(e.RENDERBUFFER,
+a);b.depthBuffer&&!b.stencilBuffer?(e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_COMPONENT16,b.width,b.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_STENCIL,b.width,b.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,a)):e.renderbufferStorage(e.RENDERBUFFER,e.RGBA4,b.width,b.height)}function q(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return e.NEAREST;
 default:return e.LINEAR}}function G(a){switch(a){case THREE.RepeatWrapping:return e.REPEAT;case THREE.ClampToEdgeWrapping:return e.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return e.MIRRORED_REPEAT;case THREE.NearestFilter:return e.NEAREST;case THREE.NearestMipMapNearestFilter:return e.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return e.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return e.LINEAR;case THREE.LinearMipMapNearestFilter:return e.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return e.LINEAR_MIPMAP_LINEAR;
-case THREE.ByteType:return e.BYTE;case THREE.UnsignedByteType:return e.UNSIGNED_BYTE;case THREE.ShortType:return e.SHORT;case THREE.UnsignedShortType:return e.UNSIGNED_SHORT;case THREE.IntType:return e.INT;case THREE.UnsignedIntType:return e.UNSIGNED_INT;case THREE.FloatType:return e.FLOAT;case THREE.AlphaFormat:return e.ALPHA;case THREE.RGBFormat:return e.RGB;case THREE.RGBAFormat:return e.RGBA;case THREE.LuminanceFormat:return e.LUMINANCE;case THREE.LuminanceAlphaFormat:return e.LUMINANCE_ALPHA}return 0}
-var a=a||{},H=void 0!==a.canvas?a.canvas:document.createElement("canvas"),M=void 0!==a.precision?a.precision:"highp",I=void 0!==a.alpha?a.alpha:!0,K=void 0!==a.premultipliedAlpha?a.premultipliedAlpha:!0,N=void 0!==a.antialias?a.antialias:!1,ja=void 0!==a.stencil?a.stencil:!0,oa=void 0!==a.preserveDrawingBuffer?a.preserveDrawingBuffer:!1,ka=void 0!==a.clearColor?new THREE.Color(a.clearColor):new THREE.Color(0),X=void 0!==a.clearAlpha?a.clearAlpha:0,$=void 0!==a.maxLights?a.maxLights:4;this.domElement=
-H;this.context=null;this.autoUpdateScene=this.autoUpdateObjects=this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.shadowMapEnabled=this.physicallyBasedShading=this.gammaOutput=this.gammaInput=!1;this.shadowMapCullFrontFaces=this.shadowMapSoft=this.shadowMapAutoUpdate=!0;this.shadowMapCascade=this.shadowMapDebug=!1;this.maxMorphTargets=8;this.maxMorphNormals=4;this.autoScaleCubemaps=!0;this.renderPluginsPre=[];this.renderPluginsPost=[];this.info=
-{memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0,points:0}};var C=this,e,Va=[],Ba=null,S=null,sa=-1,J=null,aa=null,ta=0,xa=null,T=null,Aa=null,Ga=null,Ha=null,Sa=null,Wa=null,Ma=null,tb=null,Yb=0,Hb=0,Pb=0,Zb=0,mc=0,nc=0,Ib=new THREE.Frustum,mb=new THREE.Matrix4,Ob=new THREE.Matrix4,Na=new THREE.Vector4,nb=new THREE.Vector3,oc={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}};e=function(){var a;try{if(!(a=
-H.getContext("experimental-webgl",{alpha:I,premultipliedAlpha:K,antialias:N,stencil:ja,preserveDrawingBuffer:oa})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+a.getParameter(a.VERSION)+" | "+a.getParameter(a.VENDOR)+" | "+a.getParameter(a.RENDERER)+" | "+a.getParameter(a.SHADING_LANGUAGE_VERSION))}catch(b){console.error(b)}return a}();e.clearColor(0,0,0,1);e.clearDepth(1);e.clearStencil(0);e.enable(e.DEPTH_TEST);e.depthFunc(e.LEQUAL);e.frontFace(e.CCW);e.cullFace(e.BACK);
-e.enable(e.CULL_FACE);e.enable(e.BLEND);e.blendEquation(e.FUNC_ADD);e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA);e.clearColor(ka.r,ka.g,ka.b,X);this.context=e;var pc=e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS);e.getParameter(e.MAX_TEXTURE_SIZE);var Fc=e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE);this.getContext=function(){return e};this.supportsVertexTextures=function(){return 0<pc};this.setSize=function(a,b){H.width=a;H.height=b;this.setViewport(0,0,H.width,H.height)};this.setViewport=function(a,
-b,c,d){Yb=a;Hb=b;Pb=c;Zb=d;e.viewport(Yb,Hb,Pb,Zb)};this.setScissor=function(a,b,c,d){e.scissor(a,b,c,d)};this.enableScissorTest=function(a){a?e.enable(e.SCISSOR_TEST):e.disable(e.SCISSOR_TEST)};this.setClearColorHex=function(a,b){ka.setHex(a);X=b;e.clearColor(ka.r,ka.g,ka.b,X)};this.setClearColor=function(a,b){ka.copy(a);X=b;e.clearColor(ka.r,ka.g,ka.b,X)};this.getClearColor=function(){return ka};this.getClearAlpha=function(){return X};this.clear=function(a,b,c){var d=0;if(void 0===a||a)d|=e.COLOR_BUFFER_BIT;
-if(void 0===b||b)d|=e.DEPTH_BUFFER_BIT;if(void 0===c||c)d|=e.STENCIL_BUFFER_BIT;e.clear(d)};this.clearTarget=function(a,b,c,d){this.setRenderTarget(a);this.clear(b,c,d)};this.addPostPlugin=function(a){a.init(this);this.renderPluginsPost.push(a)};this.addPrePlugin=function(a){a.init(this);this.renderPluginsPre.push(a)};this.deallocateObject=function(a){if(a.__webglInit)if(a.__webglInit=!1,delete a._modelViewMatrix,delete a._normalMatrixArray,delete a._modelViewMatrixArray,delete a._objectMatrixArray,
-a instanceof THREE.Mesh)for(var b in a.geometry.geometryGroups){var c=a.geometry.geometryGroups[b];e.deleteBuffer(c.__webglVertexBuffer);e.deleteBuffer(c.__webglNormalBuffer);e.deleteBuffer(c.__webglTangentBuffer);e.deleteBuffer(c.__webglColorBuffer);e.deleteBuffer(c.__webglUVBuffer);e.deleteBuffer(c.__webglUV2Buffer);e.deleteBuffer(c.__webglSkinVertexABuffer);e.deleteBuffer(c.__webglSkinVertexBBuffer);e.deleteBuffer(c.__webglSkinIndicesBuffer);e.deleteBuffer(c.__webglSkinWeightsBuffer);e.deleteBuffer(c.__webglFaceBuffer);
-e.deleteBuffer(c.__webglLineBuffer);var d=void 0,f=void 0;if(c.numMorphTargets)for(d=0,f=c.numMorphTargets;d<f;d++)e.deleteBuffer(c.__webglMorphTargetsBuffers[d]);if(c.numMorphNormals)for(d=0,f=c.numMorphNormals;d<f;d++)e.deleteBuffer(c.__webglMorphNormalsBuffers[d]);if(c.__webglCustomAttributesList)for(d in d=void 0,c.__webglCustomAttributesList)e.deleteBuffer(c.__webglCustomAttributesList[d].buffer);C.info.memory.geometries--}else if(a instanceof THREE.Ribbon)a=a.geometry,e.deleteBuffer(a.__webglVertexBuffer),
-e.deleteBuffer(a.__webglColorBuffer),C.info.memory.geometries--;else if(a instanceof THREE.Line)a=a.geometry,e.deleteBuffer(a.__webglVertexBuffer),e.deleteBuffer(a.__webglColorBuffer),C.info.memory.geometries--;else if(a instanceof THREE.ParticleSystem)a=a.geometry,e.deleteBuffer(a.__webglVertexBuffer),e.deleteBuffer(a.__webglColorBuffer),C.info.memory.geometries--};this.deallocateTexture=function(a){if(a.__webglInit)a.__webglInit=!1,e.deleteTexture(a.__webglTexture),C.info.memory.textures--};this.deallocateRenderTarget=
-function(a){if(a&&a.__webglTexture)if(e.deleteTexture(a.__webglTexture),a instanceof THREE.WebGLRenderTargetCube)for(var b=0;6>b;b++)e.deleteFramebuffer(a.__webglFramebuffer[b]),e.deleteRenderbuffer(a.__webglRenderbuffer[b]);else e.deleteFramebuffer(a.__webglFramebuffer),e.deleteRenderbuffer(a.__webglRenderbuffer)};this.updateShadowMap=function(a,b){Ba=null;sa=J=Ha=Ga=Aa=-1;this.shadowMapPlugin.update(a,b)};this.renderBufferImmediate=function(a,b,c){if(!a.__webglVertexBuffer)a.__webglVertexBuffer=
-e.createBuffer();if(!a.__webglNormalBuffer)a.__webglNormalBuffer=e.createBuffer();a.hasPos&&(e.bindBuffer(e.ARRAY_BUFFER,a.__webglVertexBuffer),e.bufferData(e.ARRAY_BUFFER,a.positionArray,e.DYNAMIC_DRAW),e.enableVertexAttribArray(b.attributes.position),e.vertexAttribPointer(b.attributes.position,3,e.FLOAT,!1,0,0));if(a.hasNormal){e.bindBuffer(e.ARRAY_BUFFER,a.__webglNormalBuffer);if(c===THREE.FlatShading){var d,f,g,h,i,j,m,n,k,l,r=3*a.count;for(l=0;l<r;l+=9)c=a.normalArray,d=c[l],f=c[l+1],g=c[l+2],
-h=c[l+3],j=c[l+4],n=c[l+5],i=c[l+6],m=c[l+7],k=c[l+8],d=(d+h+i)/3,f=(f+j+m)/3,g=(g+n+k)/3,c[l]=d,c[l+1]=f,c[l+2]=g,c[l+3]=d,c[l+4]=f,c[l+5]=g,c[l+6]=d,c[l+7]=f,c[l+8]=g}e.bufferData(e.ARRAY_BUFFER,a.normalArray,e.DYNAMIC_DRAW);e.enableVertexAttribArray(b.attributes.normal);e.vertexAttribPointer(b.attributes.normal,3,e.FLOAT,!1,0,0)}e.drawArrays(e.TRIANGLES,0,a.count);a.count=0};this.renderBufferDirect=function(a,b,c,d,f,g){if(0!==d.opacity&&(c=o(a,b,c,d,g),a=c.attributes,b=!1,d=16777215*f.id+2*c.id+
-(d.wireframe?1:0),d!==J&&(J=d,b=!0),g instanceof THREE.Mesh)){g=f.offsets;d=0;for(c=g.length;d<c;++d)b&&(e.bindBuffer(e.ARRAY_BUFFER,f.vertexPositionBuffer),e.vertexAttribPointer(a.position,f.vertexPositionBuffer.itemSize,e.FLOAT,!1,0,12*g[d].index),0<=a.normal&&f.vertexNormalBuffer&&(e.bindBuffer(e.ARRAY_BUFFER,f.vertexNormalBuffer),e.vertexAttribPointer(a.normal,f.vertexNormalBuffer.itemSize,e.FLOAT,!1,0,12*g[d].index)),0<=a.uv&&f.vertexUvBuffer&&(f.vertexUvBuffer?(e.bindBuffer(e.ARRAY_BUFFER,f.vertexUvBuffer),
-e.vertexAttribPointer(a.uv,f.vertexUvBuffer.itemSize,e.FLOAT,!1,0,8*g[d].index),e.enableVertexAttribArray(a.uv)):e.disableVertexAttribArray(a.uv)),0<=a.color&&f.vertexColorBuffer&&(e.bindBuffer(e.ARRAY_BUFFER,f.vertexColorBuffer),e.vertexAttribPointer(a.color,f.vertexColorBuffer.itemSize,e.FLOAT,!1,0,16*g[d].index)),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,f.vertexIndexBuffer)),e.drawElements(e.TRIANGLES,g[d].count,e.UNSIGNED_SHORT,2*g[d].start),C.info.render.calls++,C.info.render.vertices+=g[d].count,
-C.info.render.faces+=g[d].count/3}};this.renderBuffer=function(a,b,c,d,f,g){if(0!==d.opacity){var h,i,c=o(a,b,c,d,g),b=c.attributes,a=!1,c=16777215*f.id+2*c.id+(d.wireframe?1:0);c!==J&&(J=c,a=!0);if(!d.morphTargets&&0<=b.position)a&&(e.bindBuffer(e.ARRAY_BUFFER,f.__webglVertexBuffer),e.vertexAttribPointer(b.position,3,e.FLOAT,!1,0,0));else if(g.morphTargetBase){c=d.program.attributes;-1!==g.morphTargetBase?(e.bindBuffer(e.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[g.morphTargetBase]),e.vertexAttribPointer(c.position,
-3,e.FLOAT,!1,0,0)):0<=c.position&&(e.bindBuffer(e.ARRAY_BUFFER,f.__webglVertexBuffer),e.vertexAttribPointer(c.position,3,e.FLOAT,!1,0,0));if(g.morphTargetForcedOrder.length){h=0;var j=g.morphTargetForcedOrder;for(i=g.morphTargetInfluences;h<d.numSupportedMorphTargets&&h<j.length;)e.bindBuffer(e.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[j[h]]),e.vertexAttribPointer(c["morphTarget"+h],3,e.FLOAT,!1,0,0),d.morphNormals&&(e.bindBuffer(e.ARRAY_BUFFER,f.__webglMorphNormalsBuffers[j[h]]),e.vertexAttribPointer(c["morphNormal"+
-h],3,e.FLOAT,!1,0,0)),g.__webglMorphTargetInfluences[h]=i[j[h]],h++}else{var j=[],l=-1,m=0;i=g.morphTargetInfluences;var n,k=i.length;h=0;for(-1!==g.morphTargetBase&&(j[g.morphTargetBase]=!0);h<d.numSupportedMorphTargets;){for(n=0;n<k;n++)!j[n]&&i[n]>l&&(m=n,l=i[m]);e.bindBuffer(e.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[m]);e.vertexAttribPointer(c["morphTarget"+h],3,e.FLOAT,!1,0,0);d.morphNormals&&(e.bindBuffer(e.ARRAY_BUFFER,f.__webglMorphNormalsBuffers[m]),e.vertexAttribPointer(c["morphNormal"+
-h],3,e.FLOAT,!1,0,0));g.__webglMorphTargetInfluences[h]=l;j[m]=1;l=-1;h++}}null!==d.program.uniforms.morphTargetInfluences&&e.uniform1fv(d.program.uniforms.morphTargetInfluences,g.__webglMorphTargetInfluences)}if(a){if(f.__webglCustomAttributesList)for(h=0,i=f.__webglCustomAttributesList.length;h<i;h++)c=f.__webglCustomAttributesList[h],0<=b[c.buffer.belongsToAttribute]&&(e.bindBuffer(e.ARRAY_BUFFER,c.buffer),e.vertexAttribPointer(b[c.buffer.belongsToAttribute],c.size,e.FLOAT,!1,0,0));0<=b.color&&
-(e.bindBuffer(e.ARRAY_BUFFER,f.__webglColorBuffer),e.vertexAttribPointer(b.color,3,e.FLOAT,!1,0,0));0<=b.normal&&(e.bindBuffer(e.ARRAY_BUFFER,f.__webglNormalBuffer),e.vertexAttribPointer(b.normal,3,e.FLOAT,!1,0,0));0<=b.tangent&&(e.bindBuffer(e.ARRAY_BUFFER,f.__webglTangentBuffer),e.vertexAttribPointer(b.tangent,4,e.FLOAT,!1,0,0));0<=b.uv&&(f.__webglUVBuffer?(e.bindBuffer(e.ARRAY_BUFFER,f.__webglUVBuffer),e.vertexAttribPointer(b.uv,2,e.FLOAT,!1,0,0),e.enableVertexAttribArray(b.uv)):e.disableVertexAttribArray(b.uv));
-0<=b.uv2&&(f.__webglUV2Buffer?(e.bindBuffer(e.ARRAY_BUFFER,f.__webglUV2Buffer),e.vertexAttribPointer(b.uv2,2,e.FLOAT,!1,0,0),e.enableVertexAttribArray(b.uv2)):e.disableVertexAttribArray(b.uv2));d.skinning&&0<=b.skinVertexA&&0<=b.skinVertexB&&0<=b.skinIndex&&0<=b.skinWeight&&(e.bindBuffer(e.ARRAY_BUFFER,f.__webglSkinVertexABuffer),e.vertexAttribPointer(b.skinVertexA,4,e.FLOAT,!1,0,0),e.bindBuffer(e.ARRAY_BUFFER,f.__webglSkinVertexBBuffer),e.vertexAttribPointer(b.skinVertexB,4,e.FLOAT,!1,0,0),e.bindBuffer(e.ARRAY_BUFFER,
-f.__webglSkinIndicesBuffer),e.vertexAttribPointer(b.skinIndex,4,e.FLOAT,!1,0,0),e.bindBuffer(e.ARRAY_BUFFER,f.__webglSkinWeightsBuffer),e.vertexAttribPointer(b.skinWeight,4,e.FLOAT,!1,0,0))}g instanceof THREE.Mesh?(d.wireframe?(d=d.wireframeLinewidth,d!==tb&&(e.lineWidth(d),tb=d),a&&e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,f.__webglLineBuffer),e.drawElements(e.LINES,f.__webglLineCount,e.UNSIGNED_SHORT,0)):(a&&e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,f.__webglFaceBuffer),e.drawElements(e.TRIANGLES,f.__webglFaceCount,
-e.UNSIGNED_SHORT,0)),C.info.render.calls++,C.info.render.vertices+=f.__webglFaceCount,C.info.render.faces+=f.__webglFaceCount/3):g instanceof THREE.Line?(g=g.type===THREE.LineStrip?e.LINE_STRIP:e.LINES,d=d.linewidth,d!==tb&&(e.lineWidth(d),tb=d),e.drawArrays(g,0,f.__webglLineCount),C.info.render.calls++):g instanceof THREE.ParticleSystem?(e.drawArrays(e.POINTS,0,f.__webglParticleCount),C.info.render.calls++,C.info.render.points+=f.__webglParticleCount):g instanceof THREE.Ribbon&&(e.drawArrays(e.TRIANGLE_STRIP,
-0,f.__webglVertexCount),C.info.render.calls++)}};this.render=function(a,b,c,d){var f,g,l,n,m=a.__lights,r=a.fog;sa=-1;void 0===b.parent&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),a.add(b));this.autoUpdateScene&&a.updateMatrixWorld();if(!b._viewMatrixArray)b._viewMatrixArray=new Float32Array(16);if(!b._projectionMatrixArray)b._projectionMatrixArray=new Float32Array(16);b.matrixWorldInverse.getInverse(b.matrixWorld);b.matrixWorldInverse.flattenToArray(b._viewMatrixArray);
-b.projectionMatrix.flattenToArray(b._projectionMatrixArray);mb.multiply(b.projectionMatrix,b.matrixWorldInverse);Ib.setFromMatrix(mb);this.autoUpdateObjects&&this.initWebGLObjects(a);h(this.renderPluginsPre,a,b);C.info.render.calls=0;C.info.render.vertices=0;C.info.render.faces=0;C.info.render.points=0;this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);n=a.__webglObjects;for(d=0,f=n.length;d<f;d++)if(g=n[d],l=g.object,g.render=!1,
-l.visible&&(!(l instanceof THREE.Mesh||l instanceof THREE.ParticleSystem)||!l.frustumCulled||Ib.contains(l))){l.matrixWorld.flattenToArray(l._objectMatrixArray);q(l,b);var o=g,u=o.object,t=o.buffer,w=void 0,w=w=void 0,w=u.material;if(w instanceof THREE.MeshFaceMaterial){if(w=t.materialIndex,0<=w)w=u.geometry.materials[w],w.transparent?(o.transparent=w,o.opaque=null):(o.opaque=w,o.transparent=null)}else if(w)w.transparent?(o.transparent=w,o.opaque=null):(o.opaque=w,o.transparent=null);g.render=!0;
-if(this.sortObjects)l.renderDepth?g.z=l.renderDepth:(Na.copy(l.matrixWorld.getPosition()),mb.multiplyVector3(Na),g.z=Na.z)}this.sortObjects&&n.sort(i);n=a.__webglObjectsImmediate;for(d=0,f=n.length;d<f;d++)if(g=n[d],l=g.object,l.visible)l.matrixAutoUpdate&&l.matrixWorld.flattenToArray(l._objectMatrixArray),q(l,b),l=g.object.material,l.transparent?(g.transparent=l,g.opaque=null):(g.opaque=l,g.transparent=null);a.overrideMaterial?(this.setBlending(a.overrideMaterial.blending),this.setDepthTest(a.overrideMaterial.depthTest),
-this.setDepthWrite(a.overrideMaterial.depthWrite),z(a.overrideMaterial.polygonOffset,a.overrideMaterial.polygonOffsetFactor,a.overrideMaterial.polygonOffsetUnits),k(a.__webglObjects,!1,"",b,m,r,!0,a.overrideMaterial),j(a.__webglObjectsImmediate,"",b,m,r,!1,a.overrideMaterial)):(this.setBlending(THREE.NormalBlending),k(a.__webglObjects,!0,"opaque",b,m,r,!1),j(a.__webglObjectsImmediate,"opaque",b,m,r,!1),k(a.__webglObjects,!1,"transparent",b,m,r,!0),j(a.__webglObjectsImmediate,"transparent",b,m,r,!0));
-h(this.renderPluginsPost,a,b);c&&c.generateMipmaps&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&(c instanceof THREE.WebGLRenderTargetCube?(e.bindTexture(e.TEXTURE_CUBE_MAP,c.__webglTexture),e.generateMipmap(e.TEXTURE_CUBE_MAP),e.bindTexture(e.TEXTURE_CUBE_MAP,null)):(e.bindTexture(e.TEXTURE_2D,c.__webglTexture),e.generateMipmap(e.TEXTURE_2D),e.bindTexture(e.TEXTURE_2D,null)));this.setDepthTest(!0);this.setDepthWrite(!0)};this.renderImmediateObject=function(a,b,c,d,f){var g=
-o(a,b,c,d,f);J=-1;C.setObjectFaces(f);f.immediateRenderCallback?f.immediateRenderCallback(g,e,Ib):f.render(function(a){C.renderBufferImmediate(a,g,d.shading)})};this.initWebGLObjects=function(a){if(!a.__webglObjects)a.__webglObjects=[],a.__webglObjectsImmediate=[],a.__webglSprites=[],a.__webglFlares=[];for(;a.__objectsAdded.length;){var h=a.__objectsAdded[0],i=a,j=void 0,k=void 0,o=void 0;if(!h.__webglInit)if(h.__webglInit=!0,h._modelViewMatrix=new THREE.Matrix4,h._normalMatrixArray=new Float32Array(9),
-h._modelViewMatrixArray=new Float32Array(16),h._objectMatrixArray=new Float32Array(16),h.matrixWorld.flattenToArray(h._objectMatrixArray),h instanceof THREE.Mesh){if(k=h.geometry,k instanceof THREE.Geometry){if(void 0===k.geometryGroups){var q=k,t=void 0,w=void 0,z=void 0,A=void 0,H=void 0,G=void 0,I=void 0,J={},M=q.morphTargets.length,N=q.morphNormals.length;q.geometryGroups={};for(t=0,w=q.faces.length;t<w;t++)z=q.faces[t],A=z.materialIndex,G=void 0!==A?A:-1,void 0===J[G]&&(J[G]={hash:G,counter:0}),
-I=J[G].hash+"_"+J[G].counter,void 0===q.geometryGroups[I]&&(q.geometryGroups[I]={faces3:[],faces4:[],materialIndex:A,vertices:0,numMorphTargets:M,numMorphNormals:N}),H=z instanceof THREE.Face3?3:4,65535<q.geometryGroups[I].vertices+H&&(J[G].counter+=1,I=J[G].hash+"_"+J[G].counter,void 0===q.geometryGroups[I]&&(q.geometryGroups[I]={faces3:[],faces4:[],materialIndex:A,vertices:0,numMorphTargets:M,numMorphNormals:N})),z instanceof THREE.Face3?q.geometryGroups[I].faces3.push(t):q.geometryGroups[I].faces4.push(t),
-q.geometryGroups[I].vertices+=H;q.geometryGroupsList=[];var P=void 0;for(P in q.geometryGroups)q.geometryGroups[P].id=ta++,q.geometryGroupsList.push(q.geometryGroups[P])}for(j in k.geometryGroups)if(o=k.geometryGroups[j],!o.__webglVertexBuffer){var K=o;K.__webglVertexBuffer=e.createBuffer();K.__webglNormalBuffer=e.createBuffer();K.__webglTangentBuffer=e.createBuffer();K.__webglColorBuffer=e.createBuffer();K.__webglUVBuffer=e.createBuffer();K.__webglUV2Buffer=e.createBuffer();K.__webglSkinVertexABuffer=
-e.createBuffer();K.__webglSkinVertexBBuffer=e.createBuffer();K.__webglSkinIndicesBuffer=e.createBuffer();K.__webglSkinWeightsBuffer=e.createBuffer();K.__webglFaceBuffer=e.createBuffer();K.__webglLineBuffer=e.createBuffer();var T=void 0,X=void 0;if(K.numMorphTargets){K.__webglMorphTargetsBuffers=[];for(T=0,X=K.numMorphTargets;T<X;T++)K.__webglMorphTargetsBuffers.push(e.createBuffer())}if(K.numMorphNormals){K.__webglMorphNormalsBuffers=[];for(T=0,X=K.numMorphNormals;T<X;T++)K.__webglMorphNormalsBuffers.push(e.createBuffer())}C.info.memory.geometries++;
-var ca=o,$=h,aa=$.geometry,ja=ca.faces3,ka=ca.faces4,S=3*ja.length+4*ka.length,sa=1*ja.length+2*ka.length,xa=3*ja.length+4*ka.length,oa=c($,ca),Aa=f(oa),Ba=d(oa),Ga=oa.vertexColors?oa.vertexColors:!1;ca.__vertexArray=new Float32Array(3*S);if(Ba)ca.__normalArray=new Float32Array(3*S);if(aa.hasTangents)ca.__tangentArray=new Float32Array(4*S);if(Ga)ca.__colorArray=new Float32Array(3*S);if(Aa){if(0<aa.faceUvs.length||0<aa.faceVertexUvs.length)ca.__uvArray=new Float32Array(2*S);if(1<aa.faceUvs.length||
-1<aa.faceVertexUvs.length)ca.__uv2Array=new Float32Array(2*S)}if($.geometry.skinWeights.length&&$.geometry.skinIndices.length)ca.__skinVertexAArray=new Float32Array(4*S),ca.__skinVertexBArray=new Float32Array(4*S),ca.__skinIndexArray=new Float32Array(4*S),ca.__skinWeightArray=new Float32Array(4*S);ca.__faceArray=new Uint16Array(3*sa);ca.__lineArray=new Uint16Array(2*xa);var Ha=void 0,Ma=void 0;if(ca.numMorphTargets){ca.__morphTargetsArrays=[];for(Ha=0,Ma=ca.numMorphTargets;Ha<Ma;Ha++)ca.__morphTargetsArrays.push(new Float32Array(3*
-S))}if(ca.numMorphNormals){ca.__morphNormalsArrays=[];for(Ha=0,Ma=ca.numMorphNormals;Ha<Ma;Ha++)ca.__morphNormalsArrays.push(new Float32Array(3*S))}ca.__webglFaceCount=3*sa;ca.__webglLineCount=2*xa;if(oa.attributes){if(void 0===ca.__webglCustomAttributesList)ca.__webglCustomAttributesList=[];var Va=void 0;for(Va in oa.attributes){var Sa=oa.attributes[Va],La={},Wa;for(Wa in Sa)La[Wa]=Sa[Wa];if(!La.__webglInitialized||La.createUniqueBuffers){La.__webglInitialized=!0;var Na=1;"v2"===La.type?Na=2:"v3"===
-La.type?Na=3:"v4"===La.type?Na=4:"c"===La.type&&(Na=3);La.size=Na;La.array=new Float32Array(S*Na);La.buffer=e.createBuffer();La.buffer.belongsToAttribute=Va;Sa.needsUpdate=!0;La.__original=Sa}ca.__webglCustomAttributesList.push(La)}}ca.__inittedArrays=!0;k.__dirtyVertices=!0;k.__dirtyMorphTargets=!0;k.__dirtyElements=!0;k.__dirtyUvs=!0;k.__dirtyNormals=!0;k.__dirtyTangents=!0;k.__dirtyColors=!0}}}else if(h instanceof THREE.Ribbon){if(k=h.geometry,!k.__webglVertexBuffer){var nb=k;nb.__webglVertexBuffer=
-e.createBuffer();nb.__webglColorBuffer=e.createBuffer();C.info.memory.geometries++;var mb=k,tb=mb.vertices.length;mb.__vertexArray=new Float32Array(3*tb);mb.__colorArray=new Float32Array(3*tb);mb.__webglVertexCount=tb;k.__dirtyVertices=!0;k.__dirtyColors=!0}}else if(h instanceof THREE.Line){if(k=h.geometry,!k.__webglVertexBuffer){var Ob=k;Ob.__webglVertexBuffer=e.createBuffer();Ob.__webglColorBuffer=e.createBuffer();C.info.memory.geometries++;var $b=k,Yb=h,Hb=$b.vertices.length;$b.__vertexArray=new Float32Array(3*
-Hb);$b.__colorArray=new Float32Array(3*Hb);$b.__webglLineCount=Hb;b($b,Yb);k.__dirtyVertices=!0;k.__dirtyColors=!0}}else if(h instanceof THREE.ParticleSystem&&(k=h.geometry,!k.__webglVertexBuffer)){var Pb=k;Pb.__webglVertexBuffer=e.createBuffer();Pb.__webglColorBuffer=e.createBuffer();C.info.geometries++;var Qb=k,Zb=h,Ib=Qb.vertices.length;Qb.__vertexArray=new Float32Array(3*Ib);Qb.__colorArray=new Float32Array(3*Ib);Qb.__sortArray=[];Qb.__webglParticleCount=Ib;b(Qb,Zb);k.__dirtyVertices=!0;k.__dirtyColors=
-!0}if(!h.__webglActive){if(h instanceof THREE.Mesh)if(k=h.geometry,k instanceof THREE.BufferGeometry)m(i.__webglObjects,k,h);else for(j in k.geometryGroups)o=k.geometryGroups[j],m(i.__webglObjects,o,h);else h instanceof THREE.Ribbon||h instanceof THREE.Line||h instanceof THREE.ParticleSystem?(k=h.geometry,m(i.__webglObjects,k,h)):h instanceof THREE.ImmediateRenderObject||h.immediateRenderCallback?i.__webglObjectsImmediate.push({object:h,opaque:null,transparent:null}):h instanceof THREE.Sprite?i.__webglSprites.push(h):
-h instanceof THREE.LensFlare&&i.__webglFlares.push(h);h.__webglActive=!0}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;){var Oa=a.__objectsRemoved[0],qc=a;Oa instanceof THREE.Mesh||Oa instanceof THREE.ParticleSystem||Oa instanceof THREE.Ribbon||Oa instanceof THREE.Line?u(qc.__webglObjects,Oa):Oa instanceof THREE.Sprite?r(qc.__webglSprites,Oa):Oa instanceof THREE.LensFlare?r(qc.__webglFlares,Oa):(Oa instanceof THREE.ImmediateRenderObject||Oa.immediateRenderCallback)&&u(qc.__webglObjectsImmediate,
-Oa);Oa.__webglActive=!1;a.__objectsRemoved.splice(0,1)}for(var Gc=0,mc=a.__webglObjects.length;Gc<mc;Gc++){var Ta=a.__webglObjects[Gc].object,R=Ta.geometry,ac=void 0,Rb=void 0,Ea=void 0;if(Ta instanceof THREE.Mesh)if(R instanceof THREE.BufferGeometry)R.__dirtyVertices=!1,R.__dirtyElements=!1,R.__dirtyUvs=!1,R.__dirtyNormals=!1,R.__dirtyColors=!1;else{for(var Hc=0,nc=R.geometryGroupsList.length;Hc<nc;Hc++)if(ac=R.geometryGroupsList[Hc],Ea=c(Ta,ac),Rb=Ea.attributes&&n(Ea),R.__dirtyVertices||R.__dirtyMorphTargets||
-R.__dirtyElements||R.__dirtyUvs||R.__dirtyNormals||R.__dirtyColors||R.__dirtyTangents||Rb){var O=ac,oc=Ta,Ia=e.DYNAMIC_DRAW,pc=!R.dynamic,Jb=Ea;if(O.__inittedArrays){var Qc=d(Jb),Ic=Jb.vertexColors?Jb.vertexColors:!1,Rc=f(Jb),rc=Qc===THREE.SmoothShading,v=void 0,B=void 0,Ra=void 0,y=void 0,Sb=void 0,ub=void 0,Ua=void 0,sc=void 0,ob=void 0,Tb=void 0,Ub=void 0,D=void 0,E=void 0,F=void 0,Y=void 0,Xa=void 0,Ya=void 0,Za=void 0,bc=void 0,$a=void 0,ab=void 0,bb=void 0,cc=void 0,cb=void 0,db=void 0,eb=void 0,
-dc=void 0,fb=void 0,gb=void 0,hb=void 0,ec=void 0,ib=void 0,jb=void 0,kb=void 0,fc=void 0,vb=void 0,wb=void 0,xb=void 0,tc=void 0,yb=void 0,zb=void 0,Ab=void 0,uc=void 0,U=void 0,Sc=void 0,Bb=void 0,Vb=void 0,Wb=void 0,ua=void 0,Tc=void 0,qa=void 0,ra=void 0,Cb=void 0,pb=void 0,la=0,pa=0,qb=0,rb=0,Pa=0,za=0,Z=0,Ca=0,ma=0,x=0,L=0,s=0,Ja=void 0,va=O.__vertexArray,gc=O.__uvArray,hc=O.__uv2Array,Qa=O.__normalArray,da=O.__tangentArray,wa=O.__colorArray,ea=O.__skinVertexAArray,fa=O.__skinVertexBArray,ga=
-O.__skinIndexArray,ha=O.__skinWeightArray,Jc=O.__morphTargetsArrays,Kc=O.__morphNormalsArrays,Lc=O.__webglCustomAttributesList,p=void 0,lb=O.__faceArray,Ka=O.__lineArray,Da=oc.geometry,Fc=Da.__dirtyElements,Uc=Da.__dirtyUvs,ad=Da.__dirtyNormals,bd=Da.__dirtyTangents,cd=Da.__dirtyColors,dd=Da.__dirtyMorphTargets,Kb=Da.vertices,V=O.faces3,W=O.faces4,na=Da.faces,Mc=Da.faceVertexUvs[0],Nc=Da.faceVertexUvs[1],Lb=Da.skinVerticesA,Mb=Da.skinVerticesB,Nb=Da.skinIndices,Db=Da.skinWeights,Eb=Da.morphTargets,
-vc=Da.morphNormals;if(Da.__dirtyVertices){for(v=0,B=V.length;v<B;v++)y=na[V[v]],D=Kb[y.a].position,E=Kb[y.b].position,F=Kb[y.c].position,va[pa]=D.x,va[pa+1]=D.y,va[pa+2]=D.z,va[pa+3]=E.x,va[pa+4]=E.y,va[pa+5]=E.z,va[pa+6]=F.x,va[pa+7]=F.y,va[pa+8]=F.z,pa+=9;for(v=0,B=W.length;v<B;v++)y=na[W[v]],D=Kb[y.a].position,E=Kb[y.b].position,F=Kb[y.c].position,Y=Kb[y.d].position,va[pa]=D.x,va[pa+1]=D.y,va[pa+2]=D.z,va[pa+3]=E.x,va[pa+4]=E.y,va[pa+5]=E.z,va[pa+6]=F.x,va[pa+7]=F.y,va[pa+8]=F.z,va[pa+9]=Y.x,va[pa+
-10]=Y.y,va[pa+11]=Y.z,pa+=12;e.bindBuffer(e.ARRAY_BUFFER,O.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,va,Ia)}if(dd)for(ua=0,Tc=Eb.length;ua<Tc;ua++){L=0;for(v=0,B=V.length;v<B;v++){Cb=V[v];y=na[Cb];D=Eb[ua].vertices[y.a].position;E=Eb[ua].vertices[y.b].position;F=Eb[ua].vertices[y.c].position;qa=Jc[ua];qa[L]=D.x;qa[L+1]=D.y;qa[L+2]=D.z;qa[L+3]=E.x;qa[L+4]=E.y;qa[L+5]=E.z;qa[L+6]=F.x;qa[L+7]=F.y;qa[L+8]=F.z;if(Jb.morphNormals)rc?(pb=vc[ua].vertexNormals[Cb],$a=pb.a,ab=pb.b,bb=pb.c):bb=ab=$a=
-vc[ua].faceNormals[Cb],ra=Kc[ua],ra[L]=$a.x,ra[L+1]=$a.y,ra[L+2]=$a.z,ra[L+3]=ab.x,ra[L+4]=ab.y,ra[L+5]=ab.z,ra[L+6]=bb.x,ra[L+7]=bb.y,ra[L+8]=bb.z;L+=9}for(v=0,B=W.length;v<B;v++){Cb=W[v];y=na[Cb];D=Eb[ua].vertices[y.a].position;E=Eb[ua].vertices[y.b].position;F=Eb[ua].vertices[y.c].position;Y=Eb[ua].vertices[y.d].position;qa=Jc[ua];qa[L]=D.x;qa[L+1]=D.y;qa[L+2]=D.z;qa[L+3]=E.x;qa[L+4]=E.y;qa[L+5]=E.z;qa[L+6]=F.x;qa[L+7]=F.y;qa[L+8]=F.z;qa[L+9]=Y.x;qa[L+10]=Y.y;qa[L+11]=Y.z;if(Jb.morphNormals)rc?
-(pb=vc[ua].vertexNormals[Cb],$a=pb.a,ab=pb.b,bb=pb.c,cc=pb.d):cc=bb=ab=$a=vc[ua].faceNormals[Cb],ra=Kc[ua],ra[L]=$a.x,ra[L+1]=$a.y,ra[L+2]=$a.z,ra[L+3]=ab.x,ra[L+4]=ab.y,ra[L+5]=ab.z,ra[L+6]=bb.x,ra[L+7]=bb.y,ra[L+8]=bb.z,ra[L+9]=cc.x,ra[L+10]=cc.y,ra[L+11]=cc.z;L+=12}e.bindBuffer(e.ARRAY_BUFFER,O.__webglMorphTargetsBuffers[ua]);e.bufferData(e.ARRAY_BUFFER,Jc[ua],Ia);Jb.morphNormals&&(e.bindBuffer(e.ARRAY_BUFFER,O.__webglMorphNormalsBuffers[ua]),e.bufferData(e.ARRAY_BUFFER,Kc[ua],Ia))}if(Db.length){for(v=
+case THREE.ByteType:return e.BYTE;case THREE.UnsignedByteType:return e.UNSIGNED_BYTE;case THREE.ShortType:return e.SHORT;case THREE.UnsignedShortType:return e.UNSIGNED_SHORT;case THREE.IntType:return e.INT;case THREE.UnsignedIntType:return e.UNSIGNED_INT;case THREE.FloatType:return e.FLOAT;case THREE.AlphaFormat:return e.ALPHA;case THREE.RGBFormat:return e.RGB;case THREE.RGBAFormat:return e.RGBA;case THREE.LuminanceFormat:return e.LUMINANCE;case THREE.LuminanceAlphaFormat:return e.LUMINANCE_ALPHA;
+case THREE.AddEquation:return e.FUNC_ADD;case THREE.SubtractEquation:return e.FUNC_SUBTRACT;case THREE.ReverseSubtractEquation:return e.FUNC_REVERSE_SUBTRACT;case THREE.ZeroFactor:return e.ZERO;case THREE.OneFactor:return e.ONE;case THREE.SrcColorFactor:return e.SRC_COLOR;case THREE.OneMinusSrcColorFactor:return e.ONE_MINUS_SRC_COLOR;case THREE.SrcAlphaFactor:return e.SRC_ALPHA;case THREE.OneMinusSrcAlphaFactor:return e.ONE_MINUS_SRC_ALPHA;case THREE.DstAlphaFactor:return e.DST_ALPHA;case THREE.OneMinusDstAlphaFactor:return e.ONE_MINUS_DST_ALPHA;
+case THREE.DstColorFactor:return e.DST_COLOR;case THREE.OneMinusDstColorFactor:return e.ONE_MINUS_DST_COLOR;case THREE.SrcAlphaSaturateFactor:return e.SRC_ALPHA_SATURATE}return 0}var a=a||{},H=void 0!==a.canvas?a.canvas:document.createElement("canvas"),M=void 0!==a.precision?a.precision:"highp",I=void 0!==a.alpha?a.alpha:!0,K=void 0!==a.premultipliedAlpha?a.premultipliedAlpha:!0,N=void 0!==a.antialias?a.antialias:!1,ja=void 0!==a.stencil?a.stencil:!0,oa=void 0!==a.preserveDrawingBuffer?a.preserveDrawingBuffer:
+!1,ka=void 0!==a.clearColor?new THREE.Color(a.clearColor):new THREE.Color(0),Y=void 0!==a.clearAlpha?a.clearAlpha:0,S=void 0!==a.maxLights?a.maxLights:4;this.domElement=H;this.context=null;this.autoUpdateScene=this.autoUpdateObjects=this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.shadowMapEnabled=this.physicallyBasedShading=this.gammaOutput=this.gammaInput=!1;this.shadowMapCullFrontFaces=this.shadowMapSoft=this.shadowMapAutoUpdate=!0;this.shadowMapCascade=
+this.shadowMapDebug=!1;this.maxMorphTargets=8;this.maxMorphNormals=4;this.autoScaleCubemaps=!0;this.renderPluginsPre=[];this.renderPluginsPost=[];this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0,points:0}};var C=this,e,Sa=[],Ba=null,T=null,sa=-1,J=null,aa=null,ta=0,xa=null,X=null,Aa=null,Ma=null,Wa=null,Ta=null,Ka=null,Ca=null,sc=null,Yb=null,Zb=null,tb=null,$b=0,Hb=0,Pb=0,ac=0,pc=0,qc=0,Ib=new THREE.Frustum,mb=new THREE.Matrix4,Ob=new THREE.Matrix4,Na=new THREE.Vector4,
+nb=new THREE.Vector3,rc={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}};e=function(){var a;try{if(!(a=H.getContext("experimental-webgl",{alpha:I,premultipliedAlpha:K,antialias:N,stencil:ja,preserveDrawingBuffer:oa})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+a.getParameter(a.VERSION)+" | "+a.getParameter(a.VENDOR)+" | "+a.getParameter(a.RENDERER)+" | "+a.getParameter(a.SHADING_LANGUAGE_VERSION))}catch(b){console.error(b)}return a}();
+e.clearColor(0,0,0,1);e.clearDepth(1);e.clearStencil(0);e.enable(e.DEPTH_TEST);e.depthFunc(e.LEQUAL);e.frontFace(e.CCW);e.cullFace(e.BACK);e.enable(e.CULL_FACE);e.enable(e.BLEND);e.blendEquation(e.FUNC_ADD);e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA);e.clearColor(ka.r,ka.g,ka.b,Y);this.context=e;var bc=e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS);e.getParameter(e.MAX_TEXTURE_SIZE);var Ic=e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE);this.getContext=function(){return e};this.supportsVertexTextures=
+function(){return 0<bc};this.setSize=function(a,b){H.width=a;H.height=b;this.setViewport(0,0,H.width,H.height)};this.setViewport=function(a,b,c,d){$b=a;Hb=b;Pb=c;ac=d;e.viewport($b,Hb,Pb,ac)};this.setScissor=function(a,b,c,d){e.scissor(a,b,c,d)};this.enableScissorTest=function(a){a?e.enable(e.SCISSOR_TEST):e.disable(e.SCISSOR_TEST)};this.setClearColorHex=function(a,b){ka.setHex(a);Y=b;e.clearColor(ka.r,ka.g,ka.b,Y)};this.setClearColor=function(a,b){ka.copy(a);Y=b;e.clearColor(ka.r,ka.g,ka.b,Y)};this.getClearColor=
+function(){return ka};this.getClearAlpha=function(){return Y};this.clear=function(a,b,c){var d=0;if(void 0===a||a)d|=e.COLOR_BUFFER_BIT;if(void 0===b||b)d|=e.DEPTH_BUFFER_BIT;if(void 0===c||c)d|=e.STENCIL_BUFFER_BIT;e.clear(d)};this.clearTarget=function(a,b,c,d){this.setRenderTarget(a);this.clear(b,c,d)};this.addPostPlugin=function(a){a.init(this);this.renderPluginsPost.push(a)};this.addPrePlugin=function(a){a.init(this);this.renderPluginsPre.push(a)};this.deallocateObject=function(a){if(a.__webglInit)if(a.__webglInit=
+!1,delete a._modelViewMatrix,delete a._normalMatrix,delete a._normalMatrixArray,delete a._modelViewMatrixArray,delete a._objectMatrixArray,a instanceof THREE.Mesh)for(var b in a.geometry.geometryGroups){var c=a.geometry.geometryGroups[b];e.deleteBuffer(c.__webglVertexBuffer);e.deleteBuffer(c.__webglNormalBuffer);e.deleteBuffer(c.__webglTangentBuffer);e.deleteBuffer(c.__webglColorBuffer);e.deleteBuffer(c.__webglUVBuffer);e.deleteBuffer(c.__webglUV2Buffer);e.deleteBuffer(c.__webglSkinVertexABuffer);
+e.deleteBuffer(c.__webglSkinVertexBBuffer);e.deleteBuffer(c.__webglSkinIndicesBuffer);e.deleteBuffer(c.__webglSkinWeightsBuffer);e.deleteBuffer(c.__webglFaceBuffer);e.deleteBuffer(c.__webglLineBuffer);var d=void 0,f=void 0;if(c.numMorphTargets)for(d=0,f=c.numMorphTargets;d<f;d++)e.deleteBuffer(c.__webglMorphTargetsBuffers[d]);if(c.numMorphNormals)for(d=0,f=c.numMorphNormals;d<f;d++)e.deleteBuffer(c.__webglMorphNormalsBuffers[d]);if(c.__webglCustomAttributesList)for(d in d=void 0,c.__webglCustomAttributesList)e.deleteBuffer(c.__webglCustomAttributesList[d].buffer);
+C.info.memory.geometries--}else if(a instanceof THREE.Ribbon)a=a.geometry,e.deleteBuffer(a.__webglVertexBuffer),e.deleteBuffer(a.__webglColorBuffer),C.info.memory.geometries--;else if(a instanceof THREE.Line)a=a.geometry,e.deleteBuffer(a.__webglVertexBuffer),e.deleteBuffer(a.__webglColorBuffer),C.info.memory.geometries--;else if(a instanceof THREE.ParticleSystem)a=a.geometry,e.deleteBuffer(a.__webglVertexBuffer),e.deleteBuffer(a.__webglColorBuffer),C.info.memory.geometries--};this.deallocateTexture=
+function(a){if(a.__webglInit)a.__webglInit=!1,e.deleteTexture(a.__webglTexture),C.info.memory.textures--};this.deallocateRenderTarget=function(a){if(a&&a.__webglTexture)if(e.deleteTexture(a.__webglTexture),a instanceof THREE.WebGLRenderTargetCube)for(var b=0;6>b;b++)e.deleteFramebuffer(a.__webglFramebuffer[b]),e.deleteRenderbuffer(a.__webglRenderbuffer[b]);else e.deleteFramebuffer(a.__webglFramebuffer),e.deleteRenderbuffer(a.__webglRenderbuffer)};this.updateShadowMap=function(a,b){Ba=null;sa=J=Ca=
+Ka=Aa=-1;this.shadowMapPlugin.update(a,b)};this.renderBufferImmediate=function(a,b,c){if(!a.__webglVertexBuffer)a.__webglVertexBuffer=e.createBuffer();if(!a.__webglNormalBuffer)a.__webglNormalBuffer=e.createBuffer();a.hasPos&&(e.bindBuffer(e.ARRAY_BUFFER,a.__webglVertexBuffer),e.bufferData(e.ARRAY_BUFFER,a.positionArray,e.DYNAMIC_DRAW),e.enableVertexAttribArray(b.attributes.position),e.vertexAttribPointer(b.attributes.position,3,e.FLOAT,!1,0,0));if(a.hasNormal){e.bindBuffer(e.ARRAY_BUFFER,a.__webglNormalBuffer);
+if(c===THREE.FlatShading){var d,f,g,h,i,j,k,m,o,l,r=3*a.count;for(l=0;l<r;l+=9)c=a.normalArray,d=c[l],f=c[l+1],g=c[l+2],h=c[l+3],j=c[l+4],m=c[l+5],i=c[l+6],k=c[l+7],o=c[l+8],d=(d+h+i)/3,f=(f+j+k)/3,g=(g+m+o)/3,c[l]=d,c[l+1]=f,c[l+2]=g,c[l+3]=d,c[l+4]=f,c[l+5]=g,c[l+6]=d,c[l+7]=f,c[l+8]=g}e.bufferData(e.ARRAY_BUFFER,a.normalArray,e.DYNAMIC_DRAW);e.enableVertexAttribArray(b.attributes.normal);e.vertexAttribPointer(b.attributes.normal,3,e.FLOAT,!1,0,0)}e.drawArrays(e.TRIANGLES,0,a.count);a.count=0};
+this.renderBufferDirect=function(a,b,c,d,f,g){if(0!==d.opacity&&(c=n(a,b,c,d,g),a=c.attributes,b=!1,d=16777215*f.id+2*c.id+(d.wireframe?1:0),d!==J&&(J=d,b=!0),g instanceof THREE.Mesh)){g=f.offsets;d=0;for(c=g.length;d<c;++d)b&&(e.bindBuffer(e.ARRAY_BUFFER,f.vertexPositionBuffer),e.vertexAttribPointer(a.position,f.vertexPositionBuffer.itemSize,e.FLOAT,!1,0,12*g[d].index),0<=a.normal&&f.vertexNormalBuffer&&(e.bindBuffer(e.ARRAY_BUFFER,f.vertexNormalBuffer),e.vertexAttribPointer(a.normal,f.vertexNormalBuffer.itemSize,
+e.FLOAT,!1,0,12*g[d].index)),0<=a.uv&&f.vertexUvBuffer&&(f.vertexUvBuffer?(e.bindBuffer(e.ARRAY_BUFFER,f.vertexUvBuffer),e.vertexAttribPointer(a.uv,f.vertexUvBuffer.itemSize,e.FLOAT,!1,0,8*g[d].index),e.enableVertexAttribArray(a.uv)):e.disableVertexAttribArray(a.uv)),0<=a.color&&f.vertexColorBuffer&&(e.bindBuffer(e.ARRAY_BUFFER,f.vertexColorBuffer),e.vertexAttribPointer(a.color,f.vertexColorBuffer.itemSize,e.FLOAT,!1,0,16*g[d].index)),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,f.vertexIndexBuffer)),e.drawElements(e.TRIANGLES,
+g[d].count,e.UNSIGNED_SHORT,2*g[d].start),C.info.render.calls++,C.info.render.vertices+=g[d].count,C.info.render.faces+=g[d].count/3}};this.renderBuffer=function(a,b,c,d,f,g){if(0!==d.opacity){var h,i,c=n(a,b,c,d,g),b=c.attributes,a=!1,c=16777215*f.id+2*c.id+(d.wireframe?1:0);c!==J&&(J=c,a=!0);if(!d.morphTargets&&0<=b.position)a&&(e.bindBuffer(e.ARRAY_BUFFER,f.__webglVertexBuffer),e.vertexAttribPointer(b.position,3,e.FLOAT,!1,0,0));else if(g.morphTargetBase){c=d.program.attributes;-1!==g.morphTargetBase?
+(e.bindBuffer(e.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[g.morphTargetBase]),e.vertexAttribPointer(c.position,3,e.FLOAT,!1,0,0)):0<=c.position&&(e.bindBuffer(e.ARRAY_BUFFER,f.__webglVertexBuffer),e.vertexAttribPointer(c.position,3,e.FLOAT,!1,0,0));if(g.morphTargetForcedOrder.length){h=0;var j=g.morphTargetForcedOrder;for(i=g.morphTargetInfluences;h<d.numSupportedMorphTargets&&h<j.length;)e.bindBuffer(e.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[j[h]]),e.vertexAttribPointer(c["morphTarget"+h],3,e.FLOAT,
+!1,0,0),d.morphNormals&&(e.bindBuffer(e.ARRAY_BUFFER,f.__webglMorphNormalsBuffers[j[h]]),e.vertexAttribPointer(c["morphNormal"+h],3,e.FLOAT,!1,0,0)),g.__webglMorphTargetInfluences[h]=i[j[h]],h++}else{var j=[],l=-1,k=0;i=g.morphTargetInfluences;var m,o=i.length;h=0;for(-1!==g.morphTargetBase&&(j[g.morphTargetBase]=!0);h<d.numSupportedMorphTargets;){for(m=0;m<o;m++)!j[m]&&i[m]>l&&(k=m,l=i[k]);e.bindBuffer(e.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[k]);e.vertexAttribPointer(c["morphTarget"+h],3,e.FLOAT,
+!1,0,0);d.morphNormals&&(e.bindBuffer(e.ARRAY_BUFFER,f.__webglMorphNormalsBuffers[k]),e.vertexAttribPointer(c["morphNormal"+h],3,e.FLOAT,!1,0,0));g.__webglMorphTargetInfluences[h]=l;j[k]=1;l=-1;h++}}null!==d.program.uniforms.morphTargetInfluences&&e.uniform1fv(d.program.uniforms.morphTargetInfluences,g.__webglMorphTargetInfluences)}if(a){if(f.__webglCustomAttributesList)for(h=0,i=f.__webglCustomAttributesList.length;h<i;h++)c=f.__webglCustomAttributesList[h],0<=b[c.buffer.belongsToAttribute]&&(e.bindBuffer(e.ARRAY_BUFFER,
+c.buffer),e.vertexAttribPointer(b[c.buffer.belongsToAttribute],c.size,e.FLOAT,!1,0,0));0<=b.color&&(e.bindBuffer(e.ARRAY_BUFFER,f.__webglColorBuffer),e.vertexAttribPointer(b.color,3,e.FLOAT,!1,0,0));0<=b.normal&&(e.bindBuffer(e.ARRAY_BUFFER,f.__webglNormalBuffer),e.vertexAttribPointer(b.normal,3,e.FLOAT,!1,0,0));0<=b.tangent&&(e.bindBuffer(e.ARRAY_BUFFER,f.__webglTangentBuffer),e.vertexAttribPointer(b.tangent,4,e.FLOAT,!1,0,0));0<=b.uv&&(f.__webglUVBuffer?(e.bindBuffer(e.ARRAY_BUFFER,f.__webglUVBuffer),
+e.vertexAttribPointer(b.uv,2,e.FLOAT,!1,0,0),e.enableVertexAttribArray(b.uv)):e.disableVertexAttribArray(b.uv));0<=b.uv2&&(f.__webglUV2Buffer?(e.bindBuffer(e.ARRAY_BUFFER,f.__webglUV2Buffer),e.vertexAttribPointer(b.uv2,2,e.FLOAT,!1,0,0),e.enableVertexAttribArray(b.uv2)):e.disableVertexAttribArray(b.uv2));d.skinning&&0<=b.skinVertexA&&0<=b.skinVertexB&&0<=b.skinIndex&&0<=b.skinWeight&&(e.bindBuffer(e.ARRAY_BUFFER,f.__webglSkinVertexABuffer),e.vertexAttribPointer(b.skinVertexA,4,e.FLOAT,!1,0,0),e.bindBuffer(e.ARRAY_BUFFER,
+f.__webglSkinVertexBBuffer),e.vertexAttribPointer(b.skinVertexB,4,e.FLOAT,!1,0,0),e.bindBuffer(e.ARRAY_BUFFER,f.__webglSkinIndicesBuffer),e.vertexAttribPointer(b.skinIndex,4,e.FLOAT,!1,0,0),e.bindBuffer(e.ARRAY_BUFFER,f.__webglSkinWeightsBuffer),e.vertexAttribPointer(b.skinWeight,4,e.FLOAT,!1,0,0))}g instanceof THREE.Mesh?(d.wireframe?(d=d.wireframeLinewidth,d!==tb&&(e.lineWidth(d),tb=d),a&&e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,f.__webglLineBuffer),e.drawElements(e.LINES,f.__webglLineCount,e.UNSIGNED_SHORT,
+0)):(a&&e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,f.__webglFaceBuffer),e.drawElements(e.TRIANGLES,f.__webglFaceCount,e.UNSIGNED_SHORT,0)),C.info.render.calls++,C.info.render.vertices+=f.__webglFaceCount,C.info.render.faces+=f.__webglFaceCount/3):g instanceof THREE.Line?(g=g.type===THREE.LineStrip?e.LINE_STRIP:e.LINES,d=d.linewidth,d!==tb&&(e.lineWidth(d),tb=d),e.drawArrays(g,0,f.__webglLineCount),C.info.render.calls++):g instanceof THREE.ParticleSystem?(e.drawArrays(e.POINTS,0,f.__webglParticleCount),C.info.render.calls++,
+C.info.render.points+=f.__webglParticleCount):g instanceof THREE.Ribbon&&(e.drawArrays(e.TRIANGLE_STRIP,0,f.__webglVertexCount),C.info.render.calls++)}};this.render=function(a,b,c,d){var f,g,l,m,o=a.__lights,r=a.fog;sa=-1;void 0===b.parent&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),a.add(b));this.autoUpdateScene&&a.updateMatrixWorld();if(!b._viewMatrixArray)b._viewMatrixArray=new Float32Array(16);if(!b._projectionMatrixArray)b._projectionMatrixArray=new Float32Array(16);
+b.matrixWorldInverse.getInverse(b.matrixWorld);b.matrixWorldInverse.flattenToArray(b._viewMatrixArray);b.projectionMatrix.flattenToArray(b._projectionMatrixArray);mb.multiply(b.projectionMatrix,b.matrixWorldInverse);Ib.setFromMatrix(mb);this.autoUpdateObjects&&this.initWebGLObjects(a);i(this.renderPluginsPre,a,b);C.info.render.calls=0;C.info.render.vertices=0;C.info.render.faces=0;C.info.render.points=0;this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,
+this.autoClearStencil);m=a.__webglObjects;for(d=0,f=m.length;d<f;d++)if(g=m[d],l=g.object,g.render=!1,l.visible&&(!(l instanceof THREE.Mesh||l instanceof THREE.ParticleSystem)||!l.frustumCulled||Ib.contains(l))){l.matrixWorld.flattenToArray(l._objectMatrixArray);t(l,b);var n=g,u=n.object,q=n.buffer,w=void 0,w=w=void 0,w=u.material;if(w instanceof THREE.MeshFaceMaterial){if(w=q.materialIndex,0<=w)w=u.geometry.materials[w],w.transparent?(n.transparent=w,n.opaque=null):(n.opaque=w,n.transparent=null)}else if(w)w.transparent?
+(n.transparent=w,n.opaque=null):(n.opaque=w,n.transparent=null);g.render=!0;if(this.sortObjects)l.renderDepth?g.z=l.renderDepth:(Na.copy(l.matrixWorld.getPosition()),mb.multiplyVector3(Na),g.z=Na.z)}this.sortObjects&&m.sort(h);m=a.__webglObjectsImmediate;for(d=0,f=m.length;d<f;d++)if(g=m[d],l=g.object,l.visible)l.matrixAutoUpdate&&l.matrixWorld.flattenToArray(l._objectMatrixArray),t(l,b),l=g.object.material,l.transparent?(g.transparent=l,g.opaque=null):(g.opaque=l,g.transparent=null);a.overrideMaterial?
+(d=a.overrideMaterial,this.setBlending(d.blending,d.blendEquation,d.blendSrc,d.blendDst),this.setDepthTest(d.depthTest),this.setDepthWrite(d.depthWrite),z(d.polygonOffset,d.polygonOffsetFactor,d.polygonOffsetUnits),k(a.__webglObjects,!1,"",b,o,r,!0,d),j(a.__webglObjectsImmediate,"",b,o,r,!1,d)):(this.setBlending(THREE.NormalBlending),k(a.__webglObjects,!0,"opaque",b,o,r,!1),j(a.__webglObjectsImmediate,"opaque",b,o,r,!1),k(a.__webglObjects,!1,"transparent",b,o,r,!0),j(a.__webglObjectsImmediate,"transparent",
+b,o,r,!0));i(this.renderPluginsPost,a,b);c&&c.generateMipmaps&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&(c instanceof THREE.WebGLRenderTargetCube?(e.bindTexture(e.TEXTURE_CUBE_MAP,c.__webglTexture),e.generateMipmap(e.TEXTURE_CUBE_MAP),e.bindTexture(e.TEXTURE_CUBE_MAP,null)):(e.bindTexture(e.TEXTURE_2D,c.__webglTexture),e.generateMipmap(e.TEXTURE_2D),e.bindTexture(e.TEXTURE_2D,null)));this.setDepthTest(!0);this.setDepthWrite(!0)};this.renderImmediateObject=function(a,b,
+c,d,f){var g=n(a,b,c,d,f);J=-1;C.setObjectFaces(f);f.immediateRenderCallback?f.immediateRenderCallback(g,e,Ib):f.render(function(a){C.renderBufferImmediate(a,g,d.shading)})};this.initWebGLObjects=function(a){if(!a.__webglObjects)a.__webglObjects=[],a.__webglObjectsImmediate=[],a.__webglSprites=[],a.__webglFlares=[];for(;a.__objectsAdded.length;){var h=a.__objectsAdded[0],i=a,j=void 0,k=void 0,n=void 0;if(!h.__webglInit)if(h.__webglInit=!0,h._modelViewMatrix=new THREE.Matrix4,h._normalMatrix=new THREE.Matrix3,
+h._normalMatrixArray=new Float32Array(9),h._modelViewMatrixArray=new Float32Array(16),h._objectMatrixArray=new Float32Array(16),h.matrixWorld.flattenToArray(h._objectMatrixArray),h instanceof THREE.Mesh){if(k=h.geometry,k instanceof THREE.Geometry){if(void 0===k.geometryGroups){var q=k,t=void 0,w=void 0,z=void 0,A=void 0,H=void 0,G=void 0,I=void 0,J={},M=q.morphTargets.length,N=q.morphNormals.length;q.geometryGroups={};for(t=0,w=q.faces.length;t<w;t++)z=q.faces[t],A=z.materialIndex,G=void 0!==A?A:
+-1,void 0===J[G]&&(J[G]={hash:G,counter:0}),I=J[G].hash+"_"+J[G].counter,void 0===q.geometryGroups[I]&&(q.geometryGroups[I]={faces3:[],faces4:[],materialIndex:A,vertices:0,numMorphTargets:M,numMorphNormals:N}),H=z instanceof THREE.Face3?3:4,65535<q.geometryGroups[I].vertices+H&&(J[G].counter+=1,I=J[G].hash+"_"+J[G].counter,void 0===q.geometryGroups[I]&&(q.geometryGroups[I]={faces3:[],faces4:[],materialIndex:A,vertices:0,numMorphTargets:M,numMorphNormals:N})),z instanceof THREE.Face3?q.geometryGroups[I].faces3.push(t):
+q.geometryGroups[I].faces4.push(t),q.geometryGroups[I].vertices+=H;q.geometryGroupsList=[];var P=void 0;for(P in q.geometryGroups)q.geometryGroups[P].id=ta++,q.geometryGroupsList.push(q.geometryGroups[P])}for(j in k.geometryGroups)if(n=k.geometryGroups[j],!n.__webglVertexBuffer){var K=n;K.__webglVertexBuffer=e.createBuffer();K.__webglNormalBuffer=e.createBuffer();K.__webglTangentBuffer=e.createBuffer();K.__webglColorBuffer=e.createBuffer();K.__webglUVBuffer=e.createBuffer();K.__webglUV2Buffer=e.createBuffer();
+K.__webglSkinVertexABuffer=e.createBuffer();K.__webglSkinVertexBBuffer=e.createBuffer();K.__webglSkinIndicesBuffer=e.createBuffer();K.__webglSkinWeightsBuffer=e.createBuffer();K.__webglFaceBuffer=e.createBuffer();K.__webglLineBuffer=e.createBuffer();var S=void 0,X=void 0;if(K.numMorphTargets){K.__webglMorphTargetsBuffers=[];for(S=0,X=K.numMorphTargets;S<X;S++)K.__webglMorphTargetsBuffers.push(e.createBuffer())}if(K.numMorphNormals){K.__webglMorphNormalsBuffers=[];for(S=0,X=K.numMorphNormals;S<X;S++)K.__webglMorphNormalsBuffers.push(e.createBuffer())}C.info.memory.geometries++;
+var ca=n,Y=h,aa=Y.geometry,ja=ca.faces3,ka=ca.faces4,T=3*ja.length+4*ka.length,sa=1*ja.length+2*ka.length,xa=3*ja.length+4*ka.length,oa=c(Y,ca),Aa=f(oa),Ba=d(oa),Ma=oa.vertexColors?oa.vertexColors:!1;ca.__vertexArray=new Float32Array(3*T);if(Ba)ca.__normalArray=new Float32Array(3*T);if(aa.hasTangents)ca.__tangentArray=new Float32Array(4*T);if(Ma)ca.__colorArray=new Float32Array(3*T);if(Aa){if(0<aa.faceUvs.length||0<aa.faceVertexUvs.length)ca.__uvArray=new Float32Array(2*T);if(1<aa.faceUvs.length||
+1<aa.faceVertexUvs.length)ca.__uv2Array=new Float32Array(2*T)}if(Y.geometry.skinWeights.length&&Y.geometry.skinIndices.length)ca.__skinVertexAArray=new Float32Array(4*T),ca.__skinVertexBArray=new Float32Array(4*T),ca.__skinIndexArray=new Float32Array(4*T),ca.__skinWeightArray=new Float32Array(4*T);ca.__faceArray=new Uint16Array(3*sa);ca.__lineArray=new Uint16Array(2*xa);var Ca=void 0,Ka=void 0;if(ca.numMorphTargets){ca.__morphTargetsArrays=[];for(Ca=0,Ka=ca.numMorphTargets;Ca<Ka;Ca++)ca.__morphTargetsArrays.push(new Float32Array(3*
+T))}if(ca.numMorphNormals){ca.__morphNormalsArrays=[];for(Ca=0,Ka=ca.numMorphNormals;Ca<Ka;Ca++)ca.__morphNormalsArrays.push(new Float32Array(3*T))}ca.__webglFaceCount=3*sa;ca.__webglLineCount=2*xa;if(oa.attributes){if(void 0===ca.__webglCustomAttributesList)ca.__webglCustomAttributesList=[];var Ta=void 0;for(Ta in oa.attributes){var Sa=oa.attributes[Ta],La={},Wa;for(Wa in Sa)La[Wa]=Sa[Wa];if(!La.__webglInitialized||La.createUniqueBuffers){La.__webglInitialized=!0;var Na=1;"v2"===La.type?Na=2:"v3"===
+La.type?Na=3:"v4"===La.type?Na=4:"c"===La.type&&(Na=3);La.size=Na;La.array=new Float32Array(T*Na);La.buffer=e.createBuffer();La.buffer.belongsToAttribute=Ta;Sa.needsUpdate=!0;La.__original=Sa}ca.__webglCustomAttributesList.push(La)}}ca.__inittedArrays=!0;k.__dirtyVertices=!0;k.__dirtyMorphTargets=!0;k.__dirtyElements=!0;k.__dirtyUvs=!0;k.__dirtyNormals=!0;k.__dirtyTangents=!0;k.__dirtyColors=!0}}}else if(h instanceof THREE.Ribbon){if(k=h.geometry,!k.__webglVertexBuffer){var nb=k;nb.__webglVertexBuffer=
+e.createBuffer();nb.__webglColorBuffer=e.createBuffer();C.info.memory.geometries++;var mb=k,tb=mb.vertices.length;mb.__vertexArray=new Float32Array(3*tb);mb.__colorArray=new Float32Array(3*tb);mb.__webglVertexCount=tb;k.__dirtyVertices=!0;k.__dirtyColors=!0}}else if(h instanceof THREE.Line){if(k=h.geometry,!k.__webglVertexBuffer){var Ob=k;Ob.__webglVertexBuffer=e.createBuffer();Ob.__webglColorBuffer=e.createBuffer();C.info.memory.geometries++;var cc=k,$b=h,Hb=cc.vertices.length;cc.__vertexArray=new Float32Array(3*
+Hb);cc.__colorArray=new Float32Array(3*Hb);cc.__webglLineCount=Hb;b(cc,$b);k.__dirtyVertices=!0;k.__dirtyColors=!0}}else if(h instanceof THREE.ParticleSystem&&(k=h.geometry,!k.__webglVertexBuffer)){var Pb=k;Pb.__webglVertexBuffer=e.createBuffer();Pb.__webglColorBuffer=e.createBuffer();C.info.geometries++;var Qb=k,ac=h,Ib=Qb.vertices.length;Qb.__vertexArray=new Float32Array(3*Ib);Qb.__colorArray=new Float32Array(3*Ib);Qb.__sortArray=[];Qb.__webglParticleCount=Ib;b(Qb,ac);k.__dirtyVertices=!0;k.__dirtyColors=
+!0}if(!h.__webglActive){if(h instanceof THREE.Mesh)if(k=h.geometry,k instanceof THREE.BufferGeometry)m(i.__webglObjects,k,h);else for(j in k.geometryGroups)n=k.geometryGroups[j],m(i.__webglObjects,n,h);else h instanceof THREE.Ribbon||h instanceof THREE.Line||h instanceof THREE.ParticleSystem?(k=h.geometry,m(i.__webglObjects,k,h)):h instanceof THREE.ImmediateRenderObject||h.immediateRenderCallback?i.__webglObjectsImmediate.push({object:h,opaque:null,transparent:null}):h instanceof THREE.Sprite?i.__webglSprites.push(h):
+h instanceof THREE.LensFlare&&i.__webglFlares.push(h);h.__webglActive=!0}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;){var Oa=a.__objectsRemoved[0],tc=a;Oa instanceof THREE.Mesh||Oa instanceof THREE.ParticleSystem||Oa instanceof THREE.Ribbon||Oa instanceof THREE.Line?u(tc.__webglObjects,Oa):Oa instanceof THREE.Sprite?r(tc.__webglSprites,Oa):Oa instanceof THREE.LensFlare?r(tc.__webglFlares,Oa):(Oa instanceof THREE.ImmediateRenderObject||Oa.immediateRenderCallback)&&u(tc.__webglObjectsImmediate,
+Oa);Oa.__webglActive=!1;a.__objectsRemoved.splice(0,1)}for(var Jc=0,pc=a.__webglObjects.length;Jc<pc;Jc++){var Ua=a.__webglObjects[Jc].object,R=Ua.geometry,dc=void 0,Rb=void 0,Fa=void 0;if(Ua instanceof THREE.Mesh)if(R instanceof THREE.BufferGeometry)R.__dirtyVertices=!1,R.__dirtyElements=!1,R.__dirtyUvs=!1,R.__dirtyNormals=!1,R.__dirtyColors=!1;else{for(var Kc=0,qc=R.geometryGroupsList.length;Kc<qc;Kc++)if(dc=R.geometryGroupsList[Kc],Fa=c(Ua,dc),Rb=Fa.attributes&&o(Fa),R.__dirtyVertices||R.__dirtyMorphTargets||
+R.__dirtyElements||R.__dirtyUvs||R.__dirtyNormals||R.__dirtyColors||R.__dirtyTangents||Rb){var O=dc,rc=Ua,Ha=e.DYNAMIC_DRAW,sc=!R.dynamic,Jb=Fa;if(O.__inittedArrays){var Yb=d(Jb),Lc=Jb.vertexColors?Jb.vertexColors:!1,Zb=f(Jb),uc=Yb===THREE.SmoothShading,v=void 0,B=void 0,Ra=void 0,y=void 0,Sb=void 0,ub=void 0,Va=void 0,vc=void 0,ob=void 0,Tb=void 0,Ub=void 0,D=void 0,E=void 0,F=void 0,Z=void 0,Xa=void 0,Ya=void 0,Za=void 0,ec=void 0,$a=void 0,ab=void 0,bb=void 0,fc=void 0,cb=void 0,db=void 0,eb=void 0,
+gc=void 0,fb=void 0,gb=void 0,hb=void 0,hc=void 0,ib=void 0,jb=void 0,kb=void 0,ic=void 0,vb=void 0,wb=void 0,xb=void 0,wc=void 0,yb=void 0,zb=void 0,Ab=void 0,xc=void 0,U=void 0,bc=void 0,Bb=void 0,Vb=void 0,Wb=void 0,ua=void 0,Tc=void 0,qa=void 0,ra=void 0,Cb=void 0,pb=void 0,la=0,pa=0,qb=0,rb=0,Pa=0,za=0,$=0,Da=0,ma=0,x=0,L=0,s=0,Ia=void 0,va=O.__vertexArray,jc=O.__uvArray,kc=O.__uv2Array,Qa=O.__normalArray,da=O.__tangentArray,wa=O.__colorArray,ea=O.__skinVertexAArray,fa=O.__skinVertexBArray,ga=
+O.__skinIndexArray,ha=O.__skinWeightArray,Mc=O.__morphTargetsArrays,Nc=O.__morphNormalsArrays,Oc=O.__webglCustomAttributesList,p=void 0,lb=O.__faceArray,Ja=O.__lineArray,Ea=rc.geometry,Ic=Ea.__dirtyElements,Uc=Ea.__dirtyUvs,ad=Ea.__dirtyNormals,bd=Ea.__dirtyTangents,cd=Ea.__dirtyColors,dd=Ea.__dirtyMorphTargets,Kb=Ea.vertices,V=O.faces3,W=O.faces4,na=Ea.faces,Pc=Ea.faceVertexUvs[0],Qc=Ea.faceVertexUvs[1],Lb=Ea.skinVerticesA,Mb=Ea.skinVerticesB,Nb=Ea.skinIndices,Db=Ea.skinWeights,Eb=Ea.morphTargets,
+yc=Ea.morphNormals;if(Ea.__dirtyVertices){for(v=0,B=V.length;v<B;v++)y=na[V[v]],D=Kb[y.a].position,E=Kb[y.b].position,F=Kb[y.c].position,va[pa]=D.x,va[pa+1]=D.y,va[pa+2]=D.z,va[pa+3]=E.x,va[pa+4]=E.y,va[pa+5]=E.z,va[pa+6]=F.x,va[pa+7]=F.y,va[pa+8]=F.z,pa+=9;for(v=0,B=W.length;v<B;v++)y=na[W[v]],D=Kb[y.a].position,E=Kb[y.b].position,F=Kb[y.c].position,Z=Kb[y.d].position,va[pa]=D.x,va[pa+1]=D.y,va[pa+2]=D.z,va[pa+3]=E.x,va[pa+4]=E.y,va[pa+5]=E.z,va[pa+6]=F.x,va[pa+7]=F.y,va[pa+8]=F.z,va[pa+9]=Z.x,va[pa+
+10]=Z.y,va[pa+11]=Z.z,pa+=12;e.bindBuffer(e.ARRAY_BUFFER,O.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,va,Ha)}if(dd)for(ua=0,Tc=Eb.length;ua<Tc;ua++){L=0;for(v=0,B=V.length;v<B;v++){Cb=V[v];y=na[Cb];D=Eb[ua].vertices[y.a].position;E=Eb[ua].vertices[y.b].position;F=Eb[ua].vertices[y.c].position;qa=Mc[ua];qa[L]=D.x;qa[L+1]=D.y;qa[L+2]=D.z;qa[L+3]=E.x;qa[L+4]=E.y;qa[L+5]=E.z;qa[L+6]=F.x;qa[L+7]=F.y;qa[L+8]=F.z;if(Jb.morphNormals)uc?(pb=yc[ua].vertexNormals[Cb],$a=pb.a,ab=pb.b,bb=pb.c):bb=ab=$a=
+yc[ua].faceNormals[Cb],ra=Nc[ua],ra[L]=$a.x,ra[L+1]=$a.y,ra[L+2]=$a.z,ra[L+3]=ab.x,ra[L+4]=ab.y,ra[L+5]=ab.z,ra[L+6]=bb.x,ra[L+7]=bb.y,ra[L+8]=bb.z;L+=9}for(v=0,B=W.length;v<B;v++){Cb=W[v];y=na[Cb];D=Eb[ua].vertices[y.a].position;E=Eb[ua].vertices[y.b].position;F=Eb[ua].vertices[y.c].position;Z=Eb[ua].vertices[y.d].position;qa=Mc[ua];qa[L]=D.x;qa[L+1]=D.y;qa[L+2]=D.z;qa[L+3]=E.x;qa[L+4]=E.y;qa[L+5]=E.z;qa[L+6]=F.x;qa[L+7]=F.y;qa[L+8]=F.z;qa[L+9]=Z.x;qa[L+10]=Z.y;qa[L+11]=Z.z;if(Jb.morphNormals)uc?
+(pb=yc[ua].vertexNormals[Cb],$a=pb.a,ab=pb.b,bb=pb.c,fc=pb.d):fc=bb=ab=$a=yc[ua].faceNormals[Cb],ra=Nc[ua],ra[L]=$a.x,ra[L+1]=$a.y,ra[L+2]=$a.z,ra[L+3]=ab.x,ra[L+4]=ab.y,ra[L+5]=ab.z,ra[L+6]=bb.x,ra[L+7]=bb.y,ra[L+8]=bb.z,ra[L+9]=fc.x,ra[L+10]=fc.y,ra[L+11]=fc.z;L+=12}e.bindBuffer(e.ARRAY_BUFFER,O.__webglMorphTargetsBuffers[ua]);e.bufferData(e.ARRAY_BUFFER,Mc[ua],Ha);Jb.morphNormals&&(e.bindBuffer(e.ARRAY_BUFFER,O.__webglMorphNormalsBuffers[ua]),e.bufferData(e.ARRAY_BUFFER,Nc[ua],Ha))}if(Db.length){for(v=
 0,B=V.length;v<B;v++)y=na[V[v]],fb=Db[y.a],gb=Db[y.b],hb=Db[y.c],ha[x]=fb.x,ha[x+1]=fb.y,ha[x+2]=fb.z,ha[x+3]=fb.w,ha[x+4]=gb.x,ha[x+5]=gb.y,ha[x+6]=gb.z,ha[x+7]=gb.w,ha[x+8]=hb.x,ha[x+9]=hb.y,ha[x+10]=hb.z,ha[x+11]=hb.w,ib=Nb[y.a],jb=Nb[y.b],kb=Nb[y.c],ga[x]=ib.x,ga[x+1]=ib.y,ga[x+2]=ib.z,ga[x+3]=ib.w,ga[x+4]=jb.x,ga[x+5]=jb.y,ga[x+6]=jb.z,ga[x+7]=jb.w,ga[x+8]=kb.x,ga[x+9]=kb.y,ga[x+10]=kb.z,ga[x+11]=kb.w,vb=Lb[y.a],wb=Lb[y.b],xb=Lb[y.c],ea[x]=vb.x,ea[x+1]=vb.y,ea[x+2]=vb.z,ea[x+3]=1,ea[x+4]=wb.x,
-ea[x+5]=wb.y,ea[x+6]=wb.z,ea[x+7]=1,ea[x+8]=xb.x,ea[x+9]=xb.y,ea[x+10]=xb.z,ea[x+11]=1,yb=Mb[y.a],zb=Mb[y.b],Ab=Mb[y.c],fa[x]=yb.x,fa[x+1]=yb.y,fa[x+2]=yb.z,fa[x+3]=1,fa[x+4]=zb.x,fa[x+5]=zb.y,fa[x+6]=zb.z,fa[x+7]=1,fa[x+8]=Ab.x,fa[x+9]=Ab.y,fa[x+10]=Ab.z,fa[x+11]=1,x+=12;for(v=0,B=W.length;v<B;v++)y=na[W[v]],fb=Db[y.a],gb=Db[y.b],hb=Db[y.c],ec=Db[y.d],ha[x]=fb.x,ha[x+1]=fb.y,ha[x+2]=fb.z,ha[x+3]=fb.w,ha[x+4]=gb.x,ha[x+5]=gb.y,ha[x+6]=gb.z,ha[x+7]=gb.w,ha[x+8]=hb.x,ha[x+9]=hb.y,ha[x+10]=hb.z,ha[x+
-11]=hb.w,ha[x+12]=ec.x,ha[x+13]=ec.y,ha[x+14]=ec.z,ha[x+15]=ec.w,ib=Nb[y.a],jb=Nb[y.b],kb=Nb[y.c],fc=Nb[y.d],ga[x]=ib.x,ga[x+1]=ib.y,ga[x+2]=ib.z,ga[x+3]=ib.w,ga[x+4]=jb.x,ga[x+5]=jb.y,ga[x+6]=jb.z,ga[x+7]=jb.w,ga[x+8]=kb.x,ga[x+9]=kb.y,ga[x+10]=kb.z,ga[x+11]=kb.w,ga[x+12]=fc.x,ga[x+13]=fc.y,ga[x+14]=fc.z,ga[x+15]=fc.w,vb=Lb[y.a],wb=Lb[y.b],xb=Lb[y.c],tc=Lb[y.d],ea[x]=vb.x,ea[x+1]=vb.y,ea[x+2]=vb.z,ea[x+3]=1,ea[x+4]=wb.x,ea[x+5]=wb.y,ea[x+6]=wb.z,ea[x+7]=1,ea[x+8]=xb.x,ea[x+9]=xb.y,ea[x+10]=xb.z,
-ea[x+11]=1,ea[x+12]=tc.x,ea[x+13]=tc.y,ea[x+14]=tc.z,ea[x+15]=1,yb=Mb[y.a],zb=Mb[y.b],Ab=Mb[y.c],uc=Mb[y.d],fa[x]=yb.x,fa[x+1]=yb.y,fa[x+2]=yb.z,fa[x+3]=1,fa[x+4]=zb.x,fa[x+5]=zb.y,fa[x+6]=zb.z,fa[x+7]=1,fa[x+8]=Ab.x,fa[x+9]=Ab.y,fa[x+10]=Ab.z,fa[x+11]=1,fa[x+12]=uc.x,fa[x+13]=uc.y,fa[x+14]=uc.z,fa[x+15]=1,x+=16;0<x&&(e.bindBuffer(e.ARRAY_BUFFER,O.__webglSkinVertexABuffer),e.bufferData(e.ARRAY_BUFFER,ea,Ia),e.bindBuffer(e.ARRAY_BUFFER,O.__webglSkinVertexBBuffer),e.bufferData(e.ARRAY_BUFFER,fa,Ia),
-e.bindBuffer(e.ARRAY_BUFFER,O.__webglSkinIndicesBuffer),e.bufferData(e.ARRAY_BUFFER,ga,Ia),e.bindBuffer(e.ARRAY_BUFFER,O.__webglSkinWeightsBuffer),e.bufferData(e.ARRAY_BUFFER,ha,Ia))}if(cd&&Ic){for(v=0,B=V.length;v<B;v++)y=na[V[v]],Ua=y.vertexColors,sc=y.color,3===Ua.length&&Ic===THREE.VertexColors?(cb=Ua[0],db=Ua[1],eb=Ua[2]):eb=db=cb=sc,wa[ma]=cb.r,wa[ma+1]=cb.g,wa[ma+2]=cb.b,wa[ma+3]=db.r,wa[ma+4]=db.g,wa[ma+5]=db.b,wa[ma+6]=eb.r,wa[ma+7]=eb.g,wa[ma+8]=eb.b,ma+=9;for(v=0,B=W.length;v<B;v++)y=na[W[v]],
-Ua=y.vertexColors,sc=y.color,4===Ua.length&&Ic===THREE.VertexColors?(cb=Ua[0],db=Ua[1],eb=Ua[2],dc=Ua[3]):dc=eb=db=cb=sc,wa[ma]=cb.r,wa[ma+1]=cb.g,wa[ma+2]=cb.b,wa[ma+3]=db.r,wa[ma+4]=db.g,wa[ma+5]=db.b,wa[ma+6]=eb.r,wa[ma+7]=eb.g,wa[ma+8]=eb.b,wa[ma+9]=dc.r,wa[ma+10]=dc.g,wa[ma+11]=dc.b,ma+=12;0<ma&&(e.bindBuffer(e.ARRAY_BUFFER,O.__webglColorBuffer),e.bufferData(e.ARRAY_BUFFER,wa,Ia))}if(bd&&Da.hasTangents){for(v=0,B=V.length;v<B;v++)y=na[V[v]],ob=y.vertexTangents,Xa=ob[0],Ya=ob[1],Za=ob[2],da[Z]=
-Xa.x,da[Z+1]=Xa.y,da[Z+2]=Xa.z,da[Z+3]=Xa.w,da[Z+4]=Ya.x,da[Z+5]=Ya.y,da[Z+6]=Ya.z,da[Z+7]=Ya.w,da[Z+8]=Za.x,da[Z+9]=Za.y,da[Z+10]=Za.z,da[Z+11]=Za.w,Z+=12;for(v=0,B=W.length;v<B;v++)y=na[W[v]],ob=y.vertexTangents,Xa=ob[0],Ya=ob[1],Za=ob[2],bc=ob[3],da[Z]=Xa.x,da[Z+1]=Xa.y,da[Z+2]=Xa.z,da[Z+3]=Xa.w,da[Z+4]=Ya.x,da[Z+5]=Ya.y,da[Z+6]=Ya.z,da[Z+7]=Ya.w,da[Z+8]=Za.x,da[Z+9]=Za.y,da[Z+10]=Za.z,da[Z+11]=Za.w,da[Z+12]=bc.x,da[Z+13]=bc.y,da[Z+14]=bc.z,da[Z+15]=bc.w,Z+=16;e.bindBuffer(e.ARRAY_BUFFER,O.__webglTangentBuffer);
-e.bufferData(e.ARRAY_BUFFER,da,Ia)}if(ad&&Qc){for(v=0,B=V.length;v<B;v++)if(y=na[V[v]],Sb=y.vertexNormals,ub=y.normal,3===Sb.length&&rc)for(U=0;3>U;U++)Bb=Sb[U],Qa[za]=Bb.x,Qa[za+1]=Bb.y,Qa[za+2]=Bb.z,za+=3;else for(U=0;3>U;U++)Qa[za]=ub.x,Qa[za+1]=ub.y,Qa[za+2]=ub.z,za+=3;for(v=0,B=W.length;v<B;v++)if(y=na[W[v]],Sb=y.vertexNormals,ub=y.normal,4===Sb.length&&rc)for(U=0;4>U;U++)Bb=Sb[U],Qa[za]=Bb.x,Qa[za+1]=Bb.y,Qa[za+2]=Bb.z,za+=3;else for(U=0;4>U;U++)Qa[za]=ub.x,Qa[za+1]=ub.y,Qa[za+2]=ub.z,za+=3;
-e.bindBuffer(e.ARRAY_BUFFER,O.__webglNormalBuffer);e.bufferData(e.ARRAY_BUFFER,Qa,Ia)}if(Uc&&Mc&&Rc){for(v=0,B=V.length;v<B;v++)if(Ra=V[v],y=na[Ra],Tb=Mc[Ra],void 0!==Tb)for(U=0;3>U;U++)Vb=Tb[U],gc[qb]=Vb.u,gc[qb+1]=Vb.v,qb+=2;for(v=0,B=W.length;v<B;v++)if(Ra=W[v],y=na[Ra],Tb=Mc[Ra],void 0!==Tb)for(U=0;4>U;U++)Vb=Tb[U],gc[qb]=Vb.u,gc[qb+1]=Vb.v,qb+=2;0<qb&&(e.bindBuffer(e.ARRAY_BUFFER,O.__webglUVBuffer),e.bufferData(e.ARRAY_BUFFER,gc,Ia))}if(Uc&&Nc&&Rc){for(v=0,B=V.length;v<B;v++)if(Ra=V[v],y=na[Ra],
-Ub=Nc[Ra],void 0!==Ub)for(U=0;3>U;U++)Wb=Ub[U],hc[rb]=Wb.u,hc[rb+1]=Wb.v,rb+=2;for(v=0,B=W.length;v<B;v++)if(Ra=W[v],y=na[Ra],Ub=Nc[Ra],void 0!==Ub)for(U=0;4>U;U++)Wb=Ub[U],hc[rb]=Wb.u,hc[rb+1]=Wb.v,rb+=2;0<rb&&(e.bindBuffer(e.ARRAY_BUFFER,O.__webglUV2Buffer),e.bufferData(e.ARRAY_BUFFER,hc,Ia))}if(Fc){for(v=0,B=V.length;v<B;v++)y=na[V[v]],lb[Pa]=la,lb[Pa+1]=la+1,lb[Pa+2]=la+2,Pa+=3,Ka[Ca]=la,Ka[Ca+1]=la+1,Ka[Ca+2]=la,Ka[Ca+3]=la+2,Ka[Ca+4]=la+1,Ka[Ca+5]=la+2,Ca+=6,la+=3;for(v=0,B=W.length;v<B;v++)y=
-na[W[v]],lb[Pa]=la,lb[Pa+1]=la+1,lb[Pa+2]=la+3,lb[Pa+3]=la+1,lb[Pa+4]=la+2,lb[Pa+5]=la+3,Pa+=6,Ka[Ca]=la,Ka[Ca+1]=la+1,Ka[Ca+2]=la,Ka[Ca+3]=la+3,Ka[Ca+4]=la+1,Ka[Ca+5]=la+2,Ka[Ca+6]=la+2,Ka[Ca+7]=la+3,Ca+=8,la+=4;e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,O.__webglFaceBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,lb,Ia);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,O.__webglLineBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,Ka,Ia)}if(Lc)for(U=0,Sc=Lc.length;U<Sc;U++)if(p=Lc[U],p.__original.needsUpdate){s=0;if(1===p.size)if(void 0===
-p.boundTo||"vertices"===p.boundTo){for(v=0,B=V.length;v<B;v++)y=na[V[v]],p.array[s]=p.value[y.a],p.array[s+1]=p.value[y.b],p.array[s+2]=p.value[y.c],s+=3;for(v=0,B=W.length;v<B;v++)y=na[W[v]],p.array[s]=p.value[y.a],p.array[s+1]=p.value[y.b],p.array[s+2]=p.value[y.c],p.array[s+3]=p.value[y.d],s+=4}else{if("faces"===p.boundTo){for(v=0,B=V.length;v<B;v++)Ja=p.value[V[v]],p.array[s]=Ja,p.array[s+1]=Ja,p.array[s+2]=Ja,s+=3;for(v=0,B=W.length;v<B;v++)Ja=p.value[W[v]],p.array[s]=Ja,p.array[s+1]=Ja,p.array[s+
-2]=Ja,p.array[s+3]=Ja,s+=4}}else if(2===p.size)if(void 0===p.boundTo||"vertices"===p.boundTo){for(v=0,B=V.length;v<B;v++)y=na[V[v]],D=p.value[y.a],E=p.value[y.b],F=p.value[y.c],p.array[s]=D.x,p.array[s+1]=D.y,p.array[s+2]=E.x,p.array[s+3]=E.y,p.array[s+4]=F.x,p.array[s+5]=F.y,s+=6;for(v=0,B=W.length;v<B;v++)y=na[W[v]],D=p.value[y.a],E=p.value[y.b],F=p.value[y.c],Y=p.value[y.d],p.array[s]=D.x,p.array[s+1]=D.y,p.array[s+2]=E.x,p.array[s+3]=E.y,p.array[s+4]=F.x,p.array[s+5]=F.y,p.array[s+6]=Y.x,p.array[s+
-7]=Y.y,s+=8}else{if("faces"===p.boundTo){for(v=0,B=V.length;v<B;v++)F=E=D=Ja=p.value[V[v]],p.array[s]=D.x,p.array[s+1]=D.y,p.array[s+2]=E.x,p.array[s+3]=E.y,p.array[s+4]=F.x,p.array[s+5]=F.y,s+=6;for(v=0,B=W.length;v<B;v++)Y=F=E=D=Ja=p.value[W[v]],p.array[s]=D.x,p.array[s+1]=D.y,p.array[s+2]=E.x,p.array[s+3]=E.y,p.array[s+4]=F.x,p.array[s+5]=F.y,p.array[s+6]=Y.x,p.array[s+7]=Y.y,s+=8}}else if(3===p.size){var Q;Q="c"===p.type?["r","g","b"]:["x","y","z"];if(void 0===p.boundTo||"vertices"===p.boundTo){for(v=
-0,B=V.length;v<B;v++)y=na[V[v]],D=p.value[y.a],E=p.value[y.b],F=p.value[y.c],p.array[s]=D[Q[0]],p.array[s+1]=D[Q[1]],p.array[s+2]=D[Q[2]],p.array[s+3]=E[Q[0]],p.array[s+4]=E[Q[1]],p.array[s+5]=E[Q[2]],p.array[s+6]=F[Q[0]],p.array[s+7]=F[Q[1]],p.array[s+8]=F[Q[2]],s+=9;for(v=0,B=W.length;v<B;v++)y=na[W[v]],D=p.value[y.a],E=p.value[y.b],F=p.value[y.c],Y=p.value[y.d],p.array[s]=D[Q[0]],p.array[s+1]=D[Q[1]],p.array[s+2]=D[Q[2]],p.array[s+3]=E[Q[0]],p.array[s+4]=E[Q[1]],p.array[s+5]=E[Q[2]],p.array[s+
-6]=F[Q[0]],p.array[s+7]=F[Q[1]],p.array[s+8]=F[Q[2]],p.array[s+9]=Y[Q[0]],p.array[s+10]=Y[Q[1]],p.array[s+11]=Y[Q[2]],s+=12}else if("faces"===p.boundTo){for(v=0,B=V.length;v<B;v++)F=E=D=Ja=p.value[V[v]],p.array[s]=D[Q[0]],p.array[s+1]=D[Q[1]],p.array[s+2]=D[Q[2]],p.array[s+3]=E[Q[0]],p.array[s+4]=E[Q[1]],p.array[s+5]=E[Q[2]],p.array[s+6]=F[Q[0]],p.array[s+7]=F[Q[1]],p.array[s+8]=F[Q[2]],s+=9;for(v=0,B=W.length;v<B;v++)Y=F=E=D=Ja=p.value[W[v]],p.array[s]=D[Q[0]],p.array[s+1]=D[Q[1]],p.array[s+2]=D[Q[2]],
-p.array[s+3]=E[Q[0]],p.array[s+4]=E[Q[1]],p.array[s+5]=E[Q[2]],p.array[s+6]=F[Q[0]],p.array[s+7]=F[Q[1]],p.array[s+8]=F[Q[2]],p.array[s+9]=Y[Q[0]],p.array[s+10]=Y[Q[1]],p.array[s+11]=Y[Q[2]],s+=12}}else if(4===p.size)if(void 0===p.boundTo||"vertices"===p.boundTo){for(v=0,B=V.length;v<B;v++)y=na[V[v]],D=p.value[y.a],E=p.value[y.b],F=p.value[y.c],p.array[s]=D.x,p.array[s+1]=D.y,p.array[s+2]=D.z,p.array[s+3]=D.w,p.array[s+4]=E.x,p.array[s+5]=E.y,p.array[s+6]=E.z,p.array[s+7]=E.w,p.array[s+8]=F.x,p.array[s+
-9]=F.y,p.array[s+10]=F.z,p.array[s+11]=F.w,s+=12;for(v=0,B=W.length;v<B;v++)y=na[W[v]],D=p.value[y.a],E=p.value[y.b],F=p.value[y.c],Y=p.value[y.d],p.array[s]=D.x,p.array[s+1]=D.y,p.array[s+2]=D.z,p.array[s+3]=D.w,p.array[s+4]=E.x,p.array[s+5]=E.y,p.array[s+6]=E.z,p.array[s+7]=E.w,p.array[s+8]=F.x,p.array[s+9]=F.y,p.array[s+10]=F.z,p.array[s+11]=F.w,p.array[s+12]=Y.x,p.array[s+13]=Y.y,p.array[s+14]=Y.z,p.array[s+15]=Y.w,s+=16}else if("faces"===p.boundTo){for(v=0,B=V.length;v<B;v++)F=E=D=Ja=p.value[V[v]],
-p.array[s]=D.x,p.array[s+1]=D.y,p.array[s+2]=D.z,p.array[s+3]=D.w,p.array[s+4]=E.x,p.array[s+5]=E.y,p.array[s+6]=E.z,p.array[s+7]=E.w,p.array[s+8]=F.x,p.array[s+9]=F.y,p.array[s+10]=F.z,p.array[s+11]=F.w,s+=12;for(v=0,B=W.length;v<B;v++)Y=F=E=D=Ja=p.value[W[v]],p.array[s]=D.x,p.array[s+1]=D.y,p.array[s+2]=D.z,p.array[s+3]=D.w,p.array[s+4]=E.x,p.array[s+5]=E.y,p.array[s+6]=E.z,p.array[s+7]=E.w,p.array[s+8]=F.x,p.array[s+9]=F.y,p.array[s+10]=F.z,p.array[s+11]=F.w,p.array[s+12]=Y.x,p.array[s+13]=Y.y,
-p.array[s+14]=Y.z,p.array[s+15]=Y.w,s+=16}e.bindBuffer(e.ARRAY_BUFFER,p.buffer);e.bufferData(e.ARRAY_BUFFER,p.array,Ia)}pc&&(delete O.__inittedArrays,delete O.__colorArray,delete O.__normalArray,delete O.__tangentArray,delete O.__uvArray,delete O.__uv2Array,delete O.__faceArray,delete O.__vertexArray,delete O.__lineArray,delete O.__skinVertexAArray,delete O.__skinVertexBArray,delete O.__skinIndexArray,delete O.__skinWeightArray)}}R.__dirtyVertices=!1;R.__dirtyMorphTargets=!1;R.__dirtyElements=!1;
-R.__dirtyUvs=!1;R.__dirtyNormals=!1;R.__dirtyColors=!1;R.__dirtyTangents=!1;Ea.attributes&&l(Ea)}else if(Ta instanceof THREE.Ribbon){if(R.__dirtyVertices||R.__dirtyColors){var Fb=R,Vc=e.DYNAMIC_DRAW,ic=void 0,jc=void 0,wc=void 0,Gb=void 0,xc=void 0,Wc=Fb.vertices,Xc=Fb.colors,ed=Wc.length,fd=Xc.length,yc=Fb.__vertexArray,zc=Fb.__colorArray,gd=Fb.__dirtyColors;if(Fb.__dirtyVertices){for(ic=0;ic<ed;ic++)wc=Wc[ic].position,Gb=3*ic,yc[Gb]=wc.x,yc[Gb+1]=wc.y,yc[Gb+2]=wc.z;e.bindBuffer(e.ARRAY_BUFFER,Fb.__webglVertexBuffer);
-e.bufferData(e.ARRAY_BUFFER,yc,Vc)}if(gd){for(jc=0;jc<fd;jc++)xc=Xc[jc],Gb=3*jc,zc[Gb]=xc.r,zc[Gb+1]=xc.g,zc[Gb+2]=xc.b;e.bindBuffer(e.ARRAY_BUFFER,Fb.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,zc,Vc)}}R.__dirtyVertices=!1;R.__dirtyColors=!1}else if(Ta instanceof THREE.Line){Ea=c(Ta,ac);Rb=Ea.attributes&&n(Ea);if(R.__dirtyVertices||R.__dirtyColors||Rb){var sb=R,Oc=e.DYNAMIC_DRAW,kc=void 0,lc=void 0,Ac=void 0,ia=void 0,Bc=void 0,Yc=sb.vertices,Zc=sb.colors,hd=Yc.length,id=Zc.length,Cc=sb.__vertexArray,
-Dc=sb.__colorArray,jd=sb.__dirtyColors,Pc=sb.__webglCustomAttributesList,Ec=void 0,$c=void 0,ya=void 0,Xb=void 0,Fa=void 0,ba=void 0;if(sb.__dirtyVertices){for(kc=0;kc<hd;kc++)Ac=Yc[kc].position,ia=3*kc,Cc[ia]=Ac.x,Cc[ia+1]=Ac.y,Cc[ia+2]=Ac.z;e.bindBuffer(e.ARRAY_BUFFER,sb.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,Cc,Oc)}if(jd){for(lc=0;lc<id;lc++)Bc=Zc[lc],ia=3*lc,Dc[ia]=Bc.r,Dc[ia+1]=Bc.g,Dc[ia+2]=Bc.b;e.bindBuffer(e.ARRAY_BUFFER,sb.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,Dc,Oc)}if(Pc)for(Ec=
-0,$c=Pc.length;Ec<$c;Ec++)if(ba=Pc[Ec],ba.needsUpdate&&(void 0===ba.boundTo||"vertices"===ba.boundTo)){ia=0;Xb=ba.value.length;if(1===ba.size)for(ya=0;ya<Xb;ya++)ba.array[ya]=ba.value[ya];else if(2===ba.size)for(ya=0;ya<Xb;ya++)Fa=ba.value[ya],ba.array[ia]=Fa.x,ba.array[ia+1]=Fa.y,ia+=2;else if(3===ba.size)if("c"===ba.type)for(ya=0;ya<Xb;ya++)Fa=ba.value[ya],ba.array[ia]=Fa.r,ba.array[ia+1]=Fa.g,ba.array[ia+2]=Fa.b,ia+=3;else for(ya=0;ya<Xb;ya++)Fa=ba.value[ya],ba.array[ia]=Fa.x,ba.array[ia+1]=Fa.y,
-ba.array[ia+2]=Fa.z,ia+=3;else if(4===ba.size)for(ya=0;ya<Xb;ya++)Fa=ba.value[ya],ba.array[ia]=Fa.x,ba.array[ia+1]=Fa.y,ba.array[ia+2]=Fa.z,ba.array[ia+3]=Fa.w,ia+=4;e.bindBuffer(e.ARRAY_BUFFER,ba.buffer);e.bufferData(e.ARRAY_BUFFER,ba.array,Oc)}}R.__dirtyVertices=!1;R.__dirtyColors=!1;Ea.attributes&&l(Ea)}else if(Ta instanceof THREE.ParticleSystem)Ea=c(Ta,ac),Rb=Ea.attributes&&n(Ea),(R.__dirtyVertices||R.__dirtyColors||Ta.sortParticles||Rb)&&g(R,e.DYNAMIC_DRAW,Ta),R.__dirtyVertices=!1,R.__dirtyColors=
-!1,Ea.attributes&&l(Ea)}};this.initMaterial=function(a,b,c,d){var f,g,h,i,j;a instanceof THREE.MeshDepthMaterial?j="depth":a instanceof THREE.MeshNormalMaterial?j="normal":a instanceof THREE.MeshBasicMaterial?j="basic":a instanceof THREE.MeshLambertMaterial?j="lambert":a instanceof THREE.MeshPhongMaterial?j="phong":a instanceof THREE.LineBasicMaterial?j="basic":a instanceof THREE.ParticleBasicMaterial&&(j="particle_basic");if(j){var k=THREE.ShaderLib[j];a.uniforms=THREE.UniformsUtils.clone(k.uniforms);
-a.vertexShader=k.vertexShader;a.fragmentShader=k.fragmentShader}var l,n;g=k=0;for(l=0,n=b.length;l<n;l++)f=b[l],f.onlyShadow||(f instanceof THREE.DirectionalLight&&g++,f instanceof THREE.PointLight&&k++,f instanceof THREE.SpotLight&&k++);k+g<=$?l=g:(l=Math.ceil($*g/(k+g)),k=$-l);f=l;g=k;var m=0;for(k=0,l=b.length;k<l;k++)n=b[k],n.castShadow&&(n instanceof THREE.SpotLight&&m++,n instanceof THREE.DirectionalLight&&!n.shadowCascade&&m++);var r=50;if(void 0!==d&&d instanceof THREE.SkinnedMesh)r=d.bones.length;
-var o;a:{l=a.fragmentShader;n=a.vertexShader;var k=a.uniforms,b=a.attributes,c={map:!!a.map,envMap:!!a.envMap,lightMap:!!a.lightMap,vertexColors:a.vertexColors,fog:c,useFog:a.fog,sizeAttenuation:a.sizeAttenuation,skinning:a.skinning,morphTargets:a.morphTargets,morphNormals:a.morphNormals,maxMorphTargets:this.maxMorphTargets,maxMorphNormals:this.maxMorphNormals,maxDirLights:f,maxPointLights:g,maxBones:r,shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapDebug:this.shadowMapDebug,
-shadowMapCascade:this.shadowMapCascade,maxShadows:m,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel,wrapAround:a.wrapAround,doubleSided:d&&d.doubleSided},q,d=[];j?d.push(j):(d.push(l),d.push(n));for(q in c)d.push(q),d.push(c[q]);j=d.join();for(q=0,d=Va.length;q<d;q++)if(Va[q].code===j){o=Va[q].program;break a}q=e.createProgram();d=["precision "+M+" float;",0<pc?"#define VERTEX_TEXTURES":"",C.gammaInput?"#define GAMMA_INPUT":"",C.gammaOutput?"#define GAMMA_OUTPUT":"",C.physicallyBasedShading?
+ea[x+5]=wb.y,ea[x+6]=wb.z,ea[x+7]=1,ea[x+8]=xb.x,ea[x+9]=xb.y,ea[x+10]=xb.z,ea[x+11]=1,yb=Mb[y.a],zb=Mb[y.b],Ab=Mb[y.c],fa[x]=yb.x,fa[x+1]=yb.y,fa[x+2]=yb.z,fa[x+3]=1,fa[x+4]=zb.x,fa[x+5]=zb.y,fa[x+6]=zb.z,fa[x+7]=1,fa[x+8]=Ab.x,fa[x+9]=Ab.y,fa[x+10]=Ab.z,fa[x+11]=1,x+=12;for(v=0,B=W.length;v<B;v++)y=na[W[v]],fb=Db[y.a],gb=Db[y.b],hb=Db[y.c],hc=Db[y.d],ha[x]=fb.x,ha[x+1]=fb.y,ha[x+2]=fb.z,ha[x+3]=fb.w,ha[x+4]=gb.x,ha[x+5]=gb.y,ha[x+6]=gb.z,ha[x+7]=gb.w,ha[x+8]=hb.x,ha[x+9]=hb.y,ha[x+10]=hb.z,ha[x+
+11]=hb.w,ha[x+12]=hc.x,ha[x+13]=hc.y,ha[x+14]=hc.z,ha[x+15]=hc.w,ib=Nb[y.a],jb=Nb[y.b],kb=Nb[y.c],ic=Nb[y.d],ga[x]=ib.x,ga[x+1]=ib.y,ga[x+2]=ib.z,ga[x+3]=ib.w,ga[x+4]=jb.x,ga[x+5]=jb.y,ga[x+6]=jb.z,ga[x+7]=jb.w,ga[x+8]=kb.x,ga[x+9]=kb.y,ga[x+10]=kb.z,ga[x+11]=kb.w,ga[x+12]=ic.x,ga[x+13]=ic.y,ga[x+14]=ic.z,ga[x+15]=ic.w,vb=Lb[y.a],wb=Lb[y.b],xb=Lb[y.c],wc=Lb[y.d],ea[x]=vb.x,ea[x+1]=vb.y,ea[x+2]=vb.z,ea[x+3]=1,ea[x+4]=wb.x,ea[x+5]=wb.y,ea[x+6]=wb.z,ea[x+7]=1,ea[x+8]=xb.x,ea[x+9]=xb.y,ea[x+10]=xb.z,
+ea[x+11]=1,ea[x+12]=wc.x,ea[x+13]=wc.y,ea[x+14]=wc.z,ea[x+15]=1,yb=Mb[y.a],zb=Mb[y.b],Ab=Mb[y.c],xc=Mb[y.d],fa[x]=yb.x,fa[x+1]=yb.y,fa[x+2]=yb.z,fa[x+3]=1,fa[x+4]=zb.x,fa[x+5]=zb.y,fa[x+6]=zb.z,fa[x+7]=1,fa[x+8]=Ab.x,fa[x+9]=Ab.y,fa[x+10]=Ab.z,fa[x+11]=1,fa[x+12]=xc.x,fa[x+13]=xc.y,fa[x+14]=xc.z,fa[x+15]=1,x+=16;0<x&&(e.bindBuffer(e.ARRAY_BUFFER,O.__webglSkinVertexABuffer),e.bufferData(e.ARRAY_BUFFER,ea,Ha),e.bindBuffer(e.ARRAY_BUFFER,O.__webglSkinVertexBBuffer),e.bufferData(e.ARRAY_BUFFER,fa,Ha),
+e.bindBuffer(e.ARRAY_BUFFER,O.__webglSkinIndicesBuffer),e.bufferData(e.ARRAY_BUFFER,ga,Ha),e.bindBuffer(e.ARRAY_BUFFER,O.__webglSkinWeightsBuffer),e.bufferData(e.ARRAY_BUFFER,ha,Ha))}if(cd&&Lc){for(v=0,B=V.length;v<B;v++)y=na[V[v]],Va=y.vertexColors,vc=y.color,3===Va.length&&Lc===THREE.VertexColors?(cb=Va[0],db=Va[1],eb=Va[2]):eb=db=cb=vc,wa[ma]=cb.r,wa[ma+1]=cb.g,wa[ma+2]=cb.b,wa[ma+3]=db.r,wa[ma+4]=db.g,wa[ma+5]=db.b,wa[ma+6]=eb.r,wa[ma+7]=eb.g,wa[ma+8]=eb.b,ma+=9;for(v=0,B=W.length;v<B;v++)y=na[W[v]],
+Va=y.vertexColors,vc=y.color,4===Va.length&&Lc===THREE.VertexColors?(cb=Va[0],db=Va[1],eb=Va[2],gc=Va[3]):gc=eb=db=cb=vc,wa[ma]=cb.r,wa[ma+1]=cb.g,wa[ma+2]=cb.b,wa[ma+3]=db.r,wa[ma+4]=db.g,wa[ma+5]=db.b,wa[ma+6]=eb.r,wa[ma+7]=eb.g,wa[ma+8]=eb.b,wa[ma+9]=gc.r,wa[ma+10]=gc.g,wa[ma+11]=gc.b,ma+=12;0<ma&&(e.bindBuffer(e.ARRAY_BUFFER,O.__webglColorBuffer),e.bufferData(e.ARRAY_BUFFER,wa,Ha))}if(bd&&Ea.hasTangents){for(v=0,B=V.length;v<B;v++)y=na[V[v]],ob=y.vertexTangents,Xa=ob[0],Ya=ob[1],Za=ob[2],da[$]=
+Xa.x,da[$+1]=Xa.y,da[$+2]=Xa.z,da[$+3]=Xa.w,da[$+4]=Ya.x,da[$+5]=Ya.y,da[$+6]=Ya.z,da[$+7]=Ya.w,da[$+8]=Za.x,da[$+9]=Za.y,da[$+10]=Za.z,da[$+11]=Za.w,$+=12;for(v=0,B=W.length;v<B;v++)y=na[W[v]],ob=y.vertexTangents,Xa=ob[0],Ya=ob[1],Za=ob[2],ec=ob[3],da[$]=Xa.x,da[$+1]=Xa.y,da[$+2]=Xa.z,da[$+3]=Xa.w,da[$+4]=Ya.x,da[$+5]=Ya.y,da[$+6]=Ya.z,da[$+7]=Ya.w,da[$+8]=Za.x,da[$+9]=Za.y,da[$+10]=Za.z,da[$+11]=Za.w,da[$+12]=ec.x,da[$+13]=ec.y,da[$+14]=ec.z,da[$+15]=ec.w,$+=16;e.bindBuffer(e.ARRAY_BUFFER,O.__webglTangentBuffer);
+e.bufferData(e.ARRAY_BUFFER,da,Ha)}if(ad&&Yb){for(v=0,B=V.length;v<B;v++)if(y=na[V[v]],Sb=y.vertexNormals,ub=y.normal,3===Sb.length&&uc)for(U=0;3>U;U++)Bb=Sb[U],Qa[za]=Bb.x,Qa[za+1]=Bb.y,Qa[za+2]=Bb.z,za+=3;else for(U=0;3>U;U++)Qa[za]=ub.x,Qa[za+1]=ub.y,Qa[za+2]=ub.z,za+=3;for(v=0,B=W.length;v<B;v++)if(y=na[W[v]],Sb=y.vertexNormals,ub=y.normal,4===Sb.length&&uc)for(U=0;4>U;U++)Bb=Sb[U],Qa[za]=Bb.x,Qa[za+1]=Bb.y,Qa[za+2]=Bb.z,za+=3;else for(U=0;4>U;U++)Qa[za]=ub.x,Qa[za+1]=ub.y,Qa[za+2]=ub.z,za+=3;
+e.bindBuffer(e.ARRAY_BUFFER,O.__webglNormalBuffer);e.bufferData(e.ARRAY_BUFFER,Qa,Ha)}if(Uc&&Pc&&Zb){for(v=0,B=V.length;v<B;v++)if(Ra=V[v],y=na[Ra],Tb=Pc[Ra],void 0!==Tb)for(U=0;3>U;U++)Vb=Tb[U],jc[qb]=Vb.u,jc[qb+1]=Vb.v,qb+=2;for(v=0,B=W.length;v<B;v++)if(Ra=W[v],y=na[Ra],Tb=Pc[Ra],void 0!==Tb)for(U=0;4>U;U++)Vb=Tb[U],jc[qb]=Vb.u,jc[qb+1]=Vb.v,qb+=2;0<qb&&(e.bindBuffer(e.ARRAY_BUFFER,O.__webglUVBuffer),e.bufferData(e.ARRAY_BUFFER,jc,Ha))}if(Uc&&Qc&&Zb){for(v=0,B=V.length;v<B;v++)if(Ra=V[v],y=na[Ra],
+Ub=Qc[Ra],void 0!==Ub)for(U=0;3>U;U++)Wb=Ub[U],kc[rb]=Wb.u,kc[rb+1]=Wb.v,rb+=2;for(v=0,B=W.length;v<B;v++)if(Ra=W[v],y=na[Ra],Ub=Qc[Ra],void 0!==Ub)for(U=0;4>U;U++)Wb=Ub[U],kc[rb]=Wb.u,kc[rb+1]=Wb.v,rb+=2;0<rb&&(e.bindBuffer(e.ARRAY_BUFFER,O.__webglUV2Buffer),e.bufferData(e.ARRAY_BUFFER,kc,Ha))}if(Ic){for(v=0,B=V.length;v<B;v++)y=na[V[v]],lb[Pa]=la,lb[Pa+1]=la+1,lb[Pa+2]=la+2,Pa+=3,Ja[Da]=la,Ja[Da+1]=la+1,Ja[Da+2]=la,Ja[Da+3]=la+2,Ja[Da+4]=la+1,Ja[Da+5]=la+2,Da+=6,la+=3;for(v=0,B=W.length;v<B;v++)y=
+na[W[v]],lb[Pa]=la,lb[Pa+1]=la+1,lb[Pa+2]=la+3,lb[Pa+3]=la+1,lb[Pa+4]=la+2,lb[Pa+5]=la+3,Pa+=6,Ja[Da]=la,Ja[Da+1]=la+1,Ja[Da+2]=la,Ja[Da+3]=la+3,Ja[Da+4]=la+1,Ja[Da+5]=la+2,Ja[Da+6]=la+2,Ja[Da+7]=la+3,Da+=8,la+=4;e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,O.__webglFaceBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,lb,Ha);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,O.__webglLineBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,Ja,Ha)}if(Oc)for(U=0,bc=Oc.length;U<bc;U++)if(p=Oc[U],p.__original.needsUpdate){s=0;if(1===p.size)if(void 0===
+p.boundTo||"vertices"===p.boundTo){for(v=0,B=V.length;v<B;v++)y=na[V[v]],p.array[s]=p.value[y.a],p.array[s+1]=p.value[y.b],p.array[s+2]=p.value[y.c],s+=3;for(v=0,B=W.length;v<B;v++)y=na[W[v]],p.array[s]=p.value[y.a],p.array[s+1]=p.value[y.b],p.array[s+2]=p.value[y.c],p.array[s+3]=p.value[y.d],s+=4}else{if("faces"===p.boundTo){for(v=0,B=V.length;v<B;v++)Ia=p.value[V[v]],p.array[s]=Ia,p.array[s+1]=Ia,p.array[s+2]=Ia,s+=3;for(v=0,B=W.length;v<B;v++)Ia=p.value[W[v]],p.array[s]=Ia,p.array[s+1]=Ia,p.array[s+
+2]=Ia,p.array[s+3]=Ia,s+=4}}else if(2===p.size)if(void 0===p.boundTo||"vertices"===p.boundTo){for(v=0,B=V.length;v<B;v++)y=na[V[v]],D=p.value[y.a],E=p.value[y.b],F=p.value[y.c],p.array[s]=D.x,p.array[s+1]=D.y,p.array[s+2]=E.x,p.array[s+3]=E.y,p.array[s+4]=F.x,p.array[s+5]=F.y,s+=6;for(v=0,B=W.length;v<B;v++)y=na[W[v]],D=p.value[y.a],E=p.value[y.b],F=p.value[y.c],Z=p.value[y.d],p.array[s]=D.x,p.array[s+1]=D.y,p.array[s+2]=E.x,p.array[s+3]=E.y,p.array[s+4]=F.x,p.array[s+5]=F.y,p.array[s+6]=Z.x,p.array[s+
+7]=Z.y,s+=8}else{if("faces"===p.boundTo){for(v=0,B=V.length;v<B;v++)F=E=D=Ia=p.value[V[v]],p.array[s]=D.x,p.array[s+1]=D.y,p.array[s+2]=E.x,p.array[s+3]=E.y,p.array[s+4]=F.x,p.array[s+5]=F.y,s+=6;for(v=0,B=W.length;v<B;v++)Z=F=E=D=Ia=p.value[W[v]],p.array[s]=D.x,p.array[s+1]=D.y,p.array[s+2]=E.x,p.array[s+3]=E.y,p.array[s+4]=F.x,p.array[s+5]=F.y,p.array[s+6]=Z.x,p.array[s+7]=Z.y,s+=8}}else if(3===p.size){var Q;Q="c"===p.type?["r","g","b"]:["x","y","z"];if(void 0===p.boundTo||"vertices"===p.boundTo){for(v=
+0,B=V.length;v<B;v++)y=na[V[v]],D=p.value[y.a],E=p.value[y.b],F=p.value[y.c],p.array[s]=D[Q[0]],p.array[s+1]=D[Q[1]],p.array[s+2]=D[Q[2]],p.array[s+3]=E[Q[0]],p.array[s+4]=E[Q[1]],p.array[s+5]=E[Q[2]],p.array[s+6]=F[Q[0]],p.array[s+7]=F[Q[1]],p.array[s+8]=F[Q[2]],s+=9;for(v=0,B=W.length;v<B;v++)y=na[W[v]],D=p.value[y.a],E=p.value[y.b],F=p.value[y.c],Z=p.value[y.d],p.array[s]=D[Q[0]],p.array[s+1]=D[Q[1]],p.array[s+2]=D[Q[2]],p.array[s+3]=E[Q[0]],p.array[s+4]=E[Q[1]],p.array[s+5]=E[Q[2]],p.array[s+
+6]=F[Q[0]],p.array[s+7]=F[Q[1]],p.array[s+8]=F[Q[2]],p.array[s+9]=Z[Q[0]],p.array[s+10]=Z[Q[1]],p.array[s+11]=Z[Q[2]],s+=12}else if("faces"===p.boundTo){for(v=0,B=V.length;v<B;v++)F=E=D=Ia=p.value[V[v]],p.array[s]=D[Q[0]],p.array[s+1]=D[Q[1]],p.array[s+2]=D[Q[2]],p.array[s+3]=E[Q[0]],p.array[s+4]=E[Q[1]],p.array[s+5]=E[Q[2]],p.array[s+6]=F[Q[0]],p.array[s+7]=F[Q[1]],p.array[s+8]=F[Q[2]],s+=9;for(v=0,B=W.length;v<B;v++)Z=F=E=D=Ia=p.value[W[v]],p.array[s]=D[Q[0]],p.array[s+1]=D[Q[1]],p.array[s+2]=D[Q[2]],
+p.array[s+3]=E[Q[0]],p.array[s+4]=E[Q[1]],p.array[s+5]=E[Q[2]],p.array[s+6]=F[Q[0]],p.array[s+7]=F[Q[1]],p.array[s+8]=F[Q[2]],p.array[s+9]=Z[Q[0]],p.array[s+10]=Z[Q[1]],p.array[s+11]=Z[Q[2]],s+=12}}else if(4===p.size)if(void 0===p.boundTo||"vertices"===p.boundTo){for(v=0,B=V.length;v<B;v++)y=na[V[v]],D=p.value[y.a],E=p.value[y.b],F=p.value[y.c],p.array[s]=D.x,p.array[s+1]=D.y,p.array[s+2]=D.z,p.array[s+3]=D.w,p.array[s+4]=E.x,p.array[s+5]=E.y,p.array[s+6]=E.z,p.array[s+7]=E.w,p.array[s+8]=F.x,p.array[s+
+9]=F.y,p.array[s+10]=F.z,p.array[s+11]=F.w,s+=12;for(v=0,B=W.length;v<B;v++)y=na[W[v]],D=p.value[y.a],E=p.value[y.b],F=p.value[y.c],Z=p.value[y.d],p.array[s]=D.x,p.array[s+1]=D.y,p.array[s+2]=D.z,p.array[s+3]=D.w,p.array[s+4]=E.x,p.array[s+5]=E.y,p.array[s+6]=E.z,p.array[s+7]=E.w,p.array[s+8]=F.x,p.array[s+9]=F.y,p.array[s+10]=F.z,p.array[s+11]=F.w,p.array[s+12]=Z.x,p.array[s+13]=Z.y,p.array[s+14]=Z.z,p.array[s+15]=Z.w,s+=16}else if("faces"===p.boundTo){for(v=0,B=V.length;v<B;v++)F=E=D=Ia=p.value[V[v]],
+p.array[s]=D.x,p.array[s+1]=D.y,p.array[s+2]=D.z,p.array[s+3]=D.w,p.array[s+4]=E.x,p.array[s+5]=E.y,p.array[s+6]=E.z,p.array[s+7]=E.w,p.array[s+8]=F.x,p.array[s+9]=F.y,p.array[s+10]=F.z,p.array[s+11]=F.w,s+=12;for(v=0,B=W.length;v<B;v++)Z=F=E=D=Ia=p.value[W[v]],p.array[s]=D.x,p.array[s+1]=D.y,p.array[s+2]=D.z,p.array[s+3]=D.w,p.array[s+4]=E.x,p.array[s+5]=E.y,p.array[s+6]=E.z,p.array[s+7]=E.w,p.array[s+8]=F.x,p.array[s+9]=F.y,p.array[s+10]=F.z,p.array[s+11]=F.w,p.array[s+12]=Z.x,p.array[s+13]=Z.y,
+p.array[s+14]=Z.z,p.array[s+15]=Z.w,s+=16}e.bindBuffer(e.ARRAY_BUFFER,p.buffer);e.bufferData(e.ARRAY_BUFFER,p.array,Ha)}sc&&(delete O.__inittedArrays,delete O.__colorArray,delete O.__normalArray,delete O.__tangentArray,delete O.__uvArray,delete O.__uv2Array,delete O.__faceArray,delete O.__vertexArray,delete O.__lineArray,delete O.__skinVertexAArray,delete O.__skinVertexBArray,delete O.__skinIndexArray,delete O.__skinWeightArray)}}R.__dirtyVertices=!1;R.__dirtyMorphTargets=!1;R.__dirtyElements=!1;
+R.__dirtyUvs=!1;R.__dirtyNormals=!1;R.__dirtyColors=!1;R.__dirtyTangents=!1;Fa.attributes&&l(Fa)}else if(Ua instanceof THREE.Ribbon){if(R.__dirtyVertices||R.__dirtyColors){var Fb=R,Vc=e.DYNAMIC_DRAW,lc=void 0,mc=void 0,zc=void 0,Gb=void 0,Ac=void 0,Wc=Fb.vertices,Xc=Fb.colors,ed=Wc.length,fd=Xc.length,Bc=Fb.__vertexArray,Cc=Fb.__colorArray,gd=Fb.__dirtyColors;if(Fb.__dirtyVertices){for(lc=0;lc<ed;lc++)zc=Wc[lc].position,Gb=3*lc,Bc[Gb]=zc.x,Bc[Gb+1]=zc.y,Bc[Gb+2]=zc.z;e.bindBuffer(e.ARRAY_BUFFER,Fb.__webglVertexBuffer);
+e.bufferData(e.ARRAY_BUFFER,Bc,Vc)}if(gd){for(mc=0;mc<fd;mc++)Ac=Xc[mc],Gb=3*mc,Cc[Gb]=Ac.r,Cc[Gb+1]=Ac.g,Cc[Gb+2]=Ac.b;e.bindBuffer(e.ARRAY_BUFFER,Fb.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,Cc,Vc)}}R.__dirtyVertices=!1;R.__dirtyColors=!1}else if(Ua instanceof THREE.Line){Fa=c(Ua,dc);Rb=Fa.attributes&&o(Fa);if(R.__dirtyVertices||R.__dirtyColors||Rb){var sb=R,Rc=e.DYNAMIC_DRAW,nc=void 0,oc=void 0,Dc=void 0,ia=void 0,Ec=void 0,Yc=sb.vertices,Zc=sb.colors,hd=Yc.length,id=Zc.length,Fc=sb.__vertexArray,
+Gc=sb.__colorArray,jd=sb.__dirtyColors,Sc=sb.__webglCustomAttributesList,Hc=void 0,$c=void 0,ya=void 0,Xb=void 0,Ga=void 0,ba=void 0;if(sb.__dirtyVertices){for(nc=0;nc<hd;nc++)Dc=Yc[nc].position,ia=3*nc,Fc[ia]=Dc.x,Fc[ia+1]=Dc.y,Fc[ia+2]=Dc.z;e.bindBuffer(e.ARRAY_BUFFER,sb.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,Fc,Rc)}if(jd){for(oc=0;oc<id;oc++)Ec=Zc[oc],ia=3*oc,Gc[ia]=Ec.r,Gc[ia+1]=Ec.g,Gc[ia+2]=Ec.b;e.bindBuffer(e.ARRAY_BUFFER,sb.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,Gc,Rc)}if(Sc)for(Hc=
+0,$c=Sc.length;Hc<$c;Hc++)if(ba=Sc[Hc],ba.needsUpdate&&(void 0===ba.boundTo||"vertices"===ba.boundTo)){ia=0;Xb=ba.value.length;if(1===ba.size)for(ya=0;ya<Xb;ya++)ba.array[ya]=ba.value[ya];else if(2===ba.size)for(ya=0;ya<Xb;ya++)Ga=ba.value[ya],ba.array[ia]=Ga.x,ba.array[ia+1]=Ga.y,ia+=2;else if(3===ba.size)if("c"===ba.type)for(ya=0;ya<Xb;ya++)Ga=ba.value[ya],ba.array[ia]=Ga.r,ba.array[ia+1]=Ga.g,ba.array[ia+2]=Ga.b,ia+=3;else for(ya=0;ya<Xb;ya++)Ga=ba.value[ya],ba.array[ia]=Ga.x,ba.array[ia+1]=Ga.y,
+ba.array[ia+2]=Ga.z,ia+=3;else if(4===ba.size)for(ya=0;ya<Xb;ya++)Ga=ba.value[ya],ba.array[ia]=Ga.x,ba.array[ia+1]=Ga.y,ba.array[ia+2]=Ga.z,ba.array[ia+3]=Ga.w,ia+=4;e.bindBuffer(e.ARRAY_BUFFER,ba.buffer);e.bufferData(e.ARRAY_BUFFER,ba.array,Rc)}}R.__dirtyVertices=!1;R.__dirtyColors=!1;Fa.attributes&&l(Fa)}else if(Ua instanceof THREE.ParticleSystem)Fa=c(Ua,dc),Rb=Fa.attributes&&o(Fa),(R.__dirtyVertices||R.__dirtyColors||Ua.sortParticles||Rb)&&g(R,e.DYNAMIC_DRAW,Ua),R.__dirtyVertices=!1,R.__dirtyColors=
+!1,Fa.attributes&&l(Fa)}};this.initMaterial=function(a,b,c,d){var f,g,h,i,j;a instanceof THREE.MeshDepthMaterial?j="depth":a instanceof THREE.MeshNormalMaterial?j="normal":a instanceof THREE.MeshBasicMaterial?j="basic":a instanceof THREE.MeshLambertMaterial?j="lambert":a instanceof THREE.MeshPhongMaterial?j="phong":a instanceof THREE.LineBasicMaterial?j="basic":a instanceof THREE.ParticleBasicMaterial&&(j="particle_basic");if(j){var k=THREE.ShaderLib[j];a.uniforms=THREE.UniformsUtils.clone(k.uniforms);
+a.vertexShader=k.vertexShader;a.fragmentShader=k.fragmentShader}var l,m;g=k=0;for(l=0,m=b.length;l<m;l++)f=b[l],f.onlyShadow||(f instanceof THREE.DirectionalLight&&g++,f instanceof THREE.PointLight&&k++,f instanceof THREE.SpotLight&&k++);k+g<=S?l=g:(l=Math.ceil(S*g/(k+g)),k=S-l);f=l;g=k;var o=0;for(k=0,l=b.length;k<l;k++)m=b[k],m.castShadow&&(m instanceof THREE.SpotLight&&o++,m instanceof THREE.DirectionalLight&&!m.shadowCascade&&o++);var r=50;if(void 0!==d&&d instanceof THREE.SkinnedMesh)r=d.bones.length;
+var n;a:{l=a.fragmentShader;m=a.vertexShader;var k=a.uniforms,b=a.attributes,c={map:!!a.map,envMap:!!a.envMap,lightMap:!!a.lightMap,vertexColors:a.vertexColors,fog:c,useFog:a.fog,sizeAttenuation:a.sizeAttenuation,skinning:a.skinning,morphTargets:a.morphTargets,morphNormals:a.morphNormals,maxMorphTargets:this.maxMorphTargets,maxMorphNormals:this.maxMorphNormals,maxDirLights:f,maxPointLights:g,maxBones:r,shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapDebug:this.shadowMapDebug,
+shadowMapCascade:this.shadowMapCascade,maxShadows:o,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel,wrapAround:a.wrapAround,doubleSided:d&&d.doubleSided},q,d=[];j?d.push(j):(d.push(l),d.push(m));for(q in c)d.push(q),d.push(c[q]);j=d.join();for(q=0,d=Sa.length;q<d;q++)if(Sa[q].code===j){n=Sa[q].program;break a}q=e.createProgram();d=["precision "+M+" float;",0<bc?"#define VERTEX_TEXTURES":"",C.gammaInput?"#define GAMMA_INPUT":"",C.gammaOutput?"#define GAMMA_OUTPUT":"",C.physicallyBasedShading?
 "#define PHYSICALLY_BASED_SHADING":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,"#define MAX_BONES "+c.maxBones,c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.skinning?"#define USE_SKINNING":"",c.morphTargets?"#define USE_MORPHTARGETS":"",c.morphNormals?"#define USE_MORPHNORMALS":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.wrapAround?
 "#define WRAP_AROUND":"",c.doubleSided?"#define DOUBLE_SIDED":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"",c.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\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;\n#ifdef USE_MORPHNORMALS\nattribute vec3 morphNormal0;\nattribute vec3 morphNormal1;\nattribute vec3 morphNormal2;\nattribute vec3 morphNormal3;\n#else\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
 f=["precision "+M+" float;","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",C.gammaInput?"#define GAMMA_INPUT":"",C.gammaOutput?"#define GAMMA_OUTPUT":"",C.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"",c.useFog&&c.fog?"#define USE_FOG":"",c.useFog&&c.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?
 "#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.metal?"#define METAL":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.wrapAround?"#define WRAP_AROUND":"",c.doubleSided?"#define DOUBLE_SIDED":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");e.attachShader(q,w("fragment",f+l));
-e.attachShader(q,w("vertex",d+n));e.linkProgram(q);e.getProgramParameter(q,e.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+e.getProgramParameter(q,e.VALIDATE_STATUS)+", gl error ["+e.getError()+"]");q.uniforms={};q.attributes={};var t,d="viewMatrix,modelViewMatrix,projectionMatrix,normalMatrix,objectMatrix,cameraPosition,boneGlobalMatrices,morphTargetInfluences".split(",");for(t in k)d.push(t);t=d;for(d=0,k=t.length;d<k;d++)l=t[d],q.uniforms[l]=e.getUniformLocation(q,
-l);d="position,normal,uv,uv2,tangent,color,skinVertexA,skinVertexB,skinIndex,skinWeight".split(",");for(t=0;t<c.maxMorphTargets;t++)d.push("morphTarget"+t);for(t=0;t<c.maxMorphNormals;t++)d.push("morphNormal"+t);for(o in b)d.push(o);o=d;for(t=0,b=o.length;t<b;t++)c=o[t],q.attributes[c]=e.getAttribLocation(q,c);q.id=Va.length;Va.push({program:q,code:j});C.info.memory.programs=Va.length;o=q}a.program=o;o=a.program.attributes;0<=o.position&&e.enableVertexAttribArray(o.position);0<=o.color&&e.enableVertexAttribArray(o.color);
-0<=o.normal&&e.enableVertexAttribArray(o.normal);0<=o.tangent&&e.enableVertexAttribArray(o.tangent);a.skinning&&0<=o.skinVertexA&&0<=o.skinVertexB&&0<=o.skinIndex&&0<=o.skinWeight&&(e.enableVertexAttribArray(o.skinVertexA),e.enableVertexAttribArray(o.skinVertexB),e.enableVertexAttribArray(o.skinIndex),e.enableVertexAttribArray(o.skinWeight));if(a.attributes)for(i in a.attributes)void 0!==o[i]&&0<=o[i]&&e.enableVertexAttribArray(o[i]);if(a.morphTargets){a.numSupportedMorphTargets=0;q="morphTarget";
-for(i=0;i<this.maxMorphTargets;i++)t=q+i,0<=o[t]&&(e.enableVertexAttribArray(o[t]),a.numSupportedMorphTargets++)}if(a.morphNormals){a.numSupportedMorphNormals=0;q="morphNormal";for(i=0;i<this.maxMorphNormals;i++)t=q+i,0<=o[t]&&(e.enableVertexAttribArray(o[t]),a.numSupportedMorphNormals++)}a.uniformsList=[];for(h in a.uniforms)a.uniformsList.push([a.uniforms[h],h])};this.setFaceCulling=function(a,b){a?(!b||"ccw"===b?e.frontFace(e.CCW):e.frontFace(e.CW),"back"===a?e.cullFace(e.BACK):"front"===a?e.cullFace(e.FRONT):
-e.cullFace(e.FRONT_AND_BACK),e.enable(e.CULL_FACE)):e.disable(e.CULL_FACE)};this.setObjectFaces=function(a){if(xa!==a.doubleSided)a.doubleSided?e.disable(e.CULL_FACE):e.enable(e.CULL_FACE),xa=a.doubleSided;if(T!==a.flipSided)a.flipSided?e.frontFace(e.CW):e.frontFace(e.CCW),T=a.flipSided};this.setDepthTest=function(a){Ga!==a&&(a?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST),Ga=a)};this.setDepthWrite=function(a){Ha!==a&&(e.depthMask(a),Ha=a)};this.setBlending=function(a){if(a!==Aa){switch(a){case THREE.NoBlending:e.disable(e.BLEND);
-break;case THREE.AdditiveBlending:e.enable(e.BLEND);e.blendEquation(e.FUNC_ADD);e.blendFunc(e.SRC_ALPHA,e.ONE);break;case THREE.SubtractiveBlending:e.enable(e.BLEND);e.blendEquation(e.FUNC_ADD);e.blendFunc(e.ZERO,e.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:e.enable(e.BLEND);e.blendEquation(e.FUNC_ADD);e.blendFunc(e.ZERO,e.SRC_COLOR);break;default:e.enable(e.BLEND),e.blendEquationSeparate(e.FUNC_ADD,e.FUNC_ADD),e.blendFuncSeparate(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA)}Aa=
-a}};this.setTexture=function(a,b){if(a.needsUpdate){if(!a.__webglInit)a.__webglInit=!0,a.__webglTexture=e.createTexture(),C.info.memory.textures++;e.activeTexture(e.TEXTURE0+b);e.bindTexture(e.TEXTURE_2D,a.__webglTexture);var c=a.image,d=0===(c.width&c.width-1)&&0===(c.height&c.height-1),f=G(a.format),g=G(a.type);P(e.TEXTURE_2D,a,d);a instanceof THREE.DataTexture?e.texImage2D(e.TEXTURE_2D,0,f,c.width,c.height,0,f,g,c.data):e.texImage2D(e.TEXTURE_2D,0,f,f,g,a.image);a.generateMipmaps&&d&&e.generateMipmap(e.TEXTURE_2D);
-a.needsUpdate=!1;if(a.onUpdate)a.onUpdate()}else e.activeTexture(e.TEXTURE0+b),e.bindTexture(e.TEXTURE_2D,a.__webglTexture)};this.setRenderTarget=function(a){var b=a instanceof THREE.WebGLRenderTargetCube;if(a&&!a.__webglFramebuffer){if(void 0===a.depthBuffer)a.depthBuffer=!0;if(void 0===a.stencilBuffer)a.stencilBuffer=!0;a.__webglTexture=e.createTexture();var c=0===(a.width&a.width-1)&&0===(a.height&a.height-1),d=G(a.format),f=G(a.type);if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];e.bindTexture(e.TEXTURE_CUBE_MAP,
-a.__webglTexture);P(e.TEXTURE_CUBE_MAP,a,c);for(c=0;6>c;c++){a.__webglFramebuffer[c]=e.createFramebuffer();a.__webglRenderbuffer[c]=e.createRenderbuffer();e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+c,0,d,a.width,a.height,0,d,f,null);var g=a,h=e.TEXTURE_CUBE_MAP_POSITIVE_X+c;e.bindFramebuffer(e.FRAMEBUFFER,a.__webglFramebuffer[c]);e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,h,g.__webglTexture,0);A(a.__webglRenderbuffer[c],a)}}else a.__webglFramebuffer=e.createFramebuffer(),a.__webglRenderbuffer=
-e.createRenderbuffer(),e.bindTexture(e.TEXTURE_2D,a.__webglTexture),P(e.TEXTURE_2D,a,c),e.texImage2D(e.TEXTURE_2D,0,d,a.width,a.height,0,d,f,null),d=e.TEXTURE_2D,e.bindFramebuffer(e.FRAMEBUFFER,a.__webglFramebuffer),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,d,a.__webglTexture,0),A(a.__webglRenderbuffer,a);b?e.bindTexture(e.TEXTURE_CUBE_MAP,null):e.bindTexture(e.TEXTURE_2D,null);e.bindRenderbuffer(e.RENDERBUFFER,null);e.bindFramebuffer(e.FRAMEBUFFER,null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:
-a.__webglFramebuffer,d=a.width,a=a.height,c=f=0):(b=null,d=Pb,a=Zb,f=Yb,c=Hb);b!==S&&(e.bindFramebuffer(e.FRAMEBUFFER,b),e.viewport(f,c,d,a),S=b);mc=d;nc=a};this.shadowMapPlugin=new THREE.ShadowMapPlugin;this.addPrePlugin(this.shadowMapPlugin);this.addPostPlugin(new THREE.SpritePlugin);this.addPostPlugin(new THREE.LensFlarePlugin)};
+e.attachShader(q,w("vertex",d+m));e.linkProgram(q);e.getProgramParameter(q,e.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+e.getProgramParameter(q,e.VALIDATE_STATUS)+", gl error ["+e.getError()+"]");q.uniforms={};q.attributes={};var t,d="viewMatrix,modelViewMatrix,projectionMatrix,normalMatrix,objectMatrix,cameraPosition,boneGlobalMatrices,morphTargetInfluences".split(",");for(t in k)d.push(t);t=d;for(d=0,k=t.length;d<k;d++)l=t[d],q.uniforms[l]=e.getUniformLocation(q,
+l);d="position,normal,uv,uv2,tangent,color,skinVertexA,skinVertexB,skinIndex,skinWeight".split(",");for(t=0;t<c.maxMorphTargets;t++)d.push("morphTarget"+t);for(t=0;t<c.maxMorphNormals;t++)d.push("morphNormal"+t);for(n in b)d.push(n);n=d;for(t=0,b=n.length;t<b;t++)c=n[t],q.attributes[c]=e.getAttribLocation(q,c);q.id=Sa.length;Sa.push({program:q,code:j});C.info.memory.programs=Sa.length;n=q}a.program=n;n=a.program.attributes;0<=n.position&&e.enableVertexAttribArray(n.position);0<=n.color&&e.enableVertexAttribArray(n.color);
+0<=n.normal&&e.enableVertexAttribArray(n.normal);0<=n.tangent&&e.enableVertexAttribArray(n.tangent);a.skinning&&0<=n.skinVertexA&&0<=n.skinVertexB&&0<=n.skinIndex&&0<=n.skinWeight&&(e.enableVertexAttribArray(n.skinVertexA),e.enableVertexAttribArray(n.skinVertexB),e.enableVertexAttribArray(n.skinIndex),e.enableVertexAttribArray(n.skinWeight));if(a.attributes)for(i in a.attributes)void 0!==n[i]&&0<=n[i]&&e.enableVertexAttribArray(n[i]);if(a.morphTargets){a.numSupportedMorphTargets=0;q="morphTarget";
+for(i=0;i<this.maxMorphTargets;i++)t=q+i,0<=n[t]&&(e.enableVertexAttribArray(n[t]),a.numSupportedMorphTargets++)}if(a.morphNormals){a.numSupportedMorphNormals=0;q="morphNormal";for(i=0;i<this.maxMorphNormals;i++)t=q+i,0<=n[t]&&(e.enableVertexAttribArray(n[t]),a.numSupportedMorphNormals++)}a.uniformsList=[];for(h in a.uniforms)a.uniformsList.push([a.uniforms[h],h])};this.setFaceCulling=function(a,b){a?(!b||"ccw"===b?e.frontFace(e.CCW):e.frontFace(e.CW),"back"===a?e.cullFace(e.BACK):"front"===a?e.cullFace(e.FRONT):
+e.cullFace(e.FRONT_AND_BACK),e.enable(e.CULL_FACE)):e.disable(e.CULL_FACE)};this.setObjectFaces=function(a){if(xa!==a.doubleSided)a.doubleSided?e.disable(e.CULL_FACE):e.enable(e.CULL_FACE),xa=a.doubleSided;if(X!==a.flipSided)a.flipSided?e.frontFace(e.CW):e.frontFace(e.CCW),X=a.flipSided};this.setDepthTest=function(a){Ka!==a&&(a?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST),Ka=a)};this.setDepthWrite=function(a){Ca!==a&&(e.depthMask(a),Ca=a)};this.setBlending=function(a,b,c,d){if(a!==Aa){switch(a){case THREE.NoBlending:e.disable(e.BLEND);
+break;case THREE.AdditiveBlending:e.enable(e.BLEND);e.blendEquation(e.FUNC_ADD);e.blendFunc(e.SRC_ALPHA,e.ONE);break;case THREE.SubtractiveBlending:e.enable(e.BLEND);e.blendEquation(e.FUNC_ADD);e.blendFunc(e.ZERO,e.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:e.enable(e.BLEND);e.blendEquation(e.FUNC_ADD);e.blendFunc(e.ZERO,e.SRC_COLOR);break;case THREE.CustomBlending:e.enable(e.BLEND);break;default:e.enable(e.BLEND),e.blendEquationSeparate(e.FUNC_ADD,e.FUNC_ADD),e.blendFuncSeparate(e.SRC_ALPHA,
+e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA)}Aa=a}if(a===THREE.CustomBlending){if(b!==Ma&&(e.blendEquation(G(b)),Ma=b),c!==Wa||d!==Ta)e.blendFunc(G(c),G(d)),Wa=c,Ta=d}else Ta=Wa=Ma=null};this.setTexture=function(a,b){if(a.needsUpdate){if(!a.__webglInit)a.__webglInit=!0,a.__webglTexture=e.createTexture(),C.info.memory.textures++;e.activeTexture(e.TEXTURE0+b);e.bindTexture(e.TEXTURE_2D,a.__webglTexture);e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,a.premultiplyAlpha);var c=a.image,d=0===(c.width&
+c.width-1)&&0===(c.height&c.height-1),f=G(a.format),g=G(a.type);P(e.TEXTURE_2D,a,d);a instanceof THREE.DataTexture?e.texImage2D(e.TEXTURE_2D,0,f,c.width,c.height,0,f,g,c.data):e.texImage2D(e.TEXTURE_2D,0,f,f,g,a.image);a.generateMipmaps&&d&&e.generateMipmap(e.TEXTURE_2D);a.needsUpdate=!1;if(a.onUpdate)a.onUpdate()}else e.activeTexture(e.TEXTURE0+b),e.bindTexture(e.TEXTURE_2D,a.__webglTexture)};this.setRenderTarget=function(a){var b=a instanceof THREE.WebGLRenderTargetCube;if(a&&!a.__webglFramebuffer){if(void 0===
+a.depthBuffer)a.depthBuffer=!0;if(void 0===a.stencilBuffer)a.stencilBuffer=!0;a.__webglTexture=e.createTexture();var c=0===(a.width&a.width-1)&&0===(a.height&a.height-1),d=G(a.format),f=G(a.type);if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];e.bindTexture(e.TEXTURE_CUBE_MAP,a.__webglTexture);P(e.TEXTURE_CUBE_MAP,a,c);for(var g=0;6>g;g++){a.__webglFramebuffer[g]=e.createFramebuffer();a.__webglRenderbuffer[g]=e.createRenderbuffer();e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+g,0,d,a.width,a.height,
+0,d,f,null);var h=a,i=e.TEXTURE_CUBE_MAP_POSITIVE_X+g;e.bindFramebuffer(e.FRAMEBUFFER,a.__webglFramebuffer[g]);e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,i,h.__webglTexture,0);A(a.__webglRenderbuffer[g],a)}c&&e.generateMipmap(e.TEXTURE_CUBE_MAP)}else a.__webglFramebuffer=e.createFramebuffer(),a.__webglRenderbuffer=e.createRenderbuffer(),e.bindTexture(e.TEXTURE_2D,a.__webglTexture),P(e.TEXTURE_2D,a,c),e.texImage2D(e.TEXTURE_2D,0,d,a.width,a.height,0,d,f,null),d=e.TEXTURE_2D,e.bindFramebuffer(e.FRAMEBUFFER,
+a.__webglFramebuffer),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,d,a.__webglTexture,0),A(a.__webglRenderbuffer,a),c&&e.generateMipmap(e.TEXTURE_2D);b?e.bindTexture(e.TEXTURE_CUBE_MAP,null):e.bindTexture(e.TEXTURE_2D,null);e.bindRenderbuffer(e.RENDERBUFFER,null);e.bindFramebuffer(e.FRAMEBUFFER,null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,c=a.width,a=a.height,f=d=0):(b=null,c=Pb,a=ac,d=$b,f=Hb);b!==T&&(e.bindFramebuffer(e.FRAMEBUFFER,b),e.viewport(d,f,c,a),
+T=b);pc=c;qc=a};this.shadowMapPlugin=new THREE.ShadowMapPlugin;this.addPrePlugin(this.shadowMapPlugin);this.addPostPlugin(new THREE.SpritePlugin);this.addPostPlugin(new THREE.LensFlarePlugin)};
 THREE.WebGLRenderTarget=function(a,b,c){this.width=a;this.height=b;c=c||{};this.wrapS=void 0!==c.wrapS?c.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=void 0!==c.wrapT?c.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=void 0!==c.magFilter?c.magFilter:THREE.LinearFilter;this.minFilter=void 0!==c.minFilter?c.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=void 0!==c.format?c.format:THREE.RGBAFormat;this.type=void 0!==c.type?c.type:
 THREE.UnsignedByteType;this.depthBuffer=void 0!==c.depthBuffer?c.depthBuffer:!0;this.stencilBuffer=void 0!==c.stencilBuffer?c.stencilBuffer:!0;this.generateMipmaps=!0};
 THREE.WebGLRenderTarget.prototype.clone=function(){var a=new THREE.WebGLRenderTarget(this.width,this.height);a.wrapS=this.wrapS;a.wrapT=this.wrapT;a.magFilter=this.magFilter;a.minFilter=this.minFilter;a.offset.copy(this.offset);a.repeat.copy(this.repeat);a.format=this.format;a.type=this.type;a.depthBuffer=this.depthBuffer;a.stencilBuffer=this.stencilBuffer;return a};THREE.WebGLRenderTargetCube=function(a,b,c){THREE.WebGLRenderTarget.call(this,a,b,c);this.activeCubeFace=0};
@@ -335,34 +339,34 @@ THREE.LensFlare=function(a,b,c,d,f){THREE.Object3D.call(this);this.lensFlares=[]
 THREE.LensFlare.prototype.add=function(a,b,c,d,f,g){void 0===b&&(b=-1);void 0===c&&(c=0);void 0===g&&(g=1);void 0===f&&(f=new THREE.Color(16777215));if(void 0===d)d=THREE.NormalBlending;c=Math.min(c,Math.max(0,c));this.lensFlares.push({texture:a,size:b,distance:c,x:0,y:0,z:0,scale:1,rotation:1,opacity:g,color:f,blending:d})};
 THREE.LensFlare.prototype.updateLensFlares=function(){var a,b=this.lensFlares.length,c,d=2*-this.positionScreen.x,f=2*-this.positionScreen.y;for(a=0;a<b;a++)c=this.lensFlares[a],c.x=this.positionScreen.x+d*c.distance,c.y=this.positionScreen.y+f*c.distance,c.wantedRotation=0.25*c.x*Math.PI,c.rotation+=0.25*(c.wantedRotation-c.rotation)};THREE.ImmediateRenderObject=function(){THREE.Object3D.call(this);this.render=function(){}};THREE.ImmediateRenderObject.prototype=new THREE.Object3D;
 THREE.ImmediateRenderObject.prototype.constructor=THREE.ImmediateRenderObject;
-THREE.LensFlarePlugin=function(){function a(a){var c=b.createProgram(),d=b.createShader(b.FRAGMENT_SHADER),f=b.createShader(b.VERTEX_SHADER);b.shaderSource(d,a.fragmentShader);b.shaderSource(f,a.vertexShader);b.compileShader(d);b.compileShader(f);b.attachShader(c,d);b.attachShader(c,f);b.linkProgram(c);return c}var b,c,d,f,g,i,h,k,j,m,n,l,u;this.init=function(r){b=r.context;c=r;d=new Float32Array(16);f=new Uint16Array(6);r=0;d[r++]=-1;d[r++]=-1;d[r++]=0;d[r++]=0;d[r++]=1;d[r++]=-1;d[r++]=1;d[r++]=
-0;d[r++]=1;d[r++]=1;d[r++]=1;d[r++]=1;d[r++]=-1;d[r++]=1;d[r++]=0;d[r++]=1;r=0;f[r++]=0;f[r++]=1;f[r++]=2;f[r++]=0;f[r++]=2;f[r++]=3;g=b.createBuffer();i=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,g);b.bufferData(b.ARRAY_BUFFER,d,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,i);b.bufferData(b.ELEMENT_ARRAY_BUFFER,f,b.STATIC_DRAW);h=b.createTexture();k=b.createTexture();b.bindTexture(b.TEXTURE_2D,h);b.texImage2D(b.TEXTURE_2D,0,b.RGB,16,16,0,b.RGB,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,
+THREE.LensFlarePlugin=function(){function a(a){var c=b.createProgram(),d=b.createShader(b.FRAGMENT_SHADER),f=b.createShader(b.VERTEX_SHADER);b.shaderSource(d,a.fragmentShader);b.shaderSource(f,a.vertexShader);b.compileShader(d);b.compileShader(f);b.attachShader(c,d);b.attachShader(c,f);b.linkProgram(c);return c}var b,c,d,f,g,h,i,k,j,m,o,l,u;this.init=function(r){b=r.context;c=r;d=new Float32Array(16);f=new Uint16Array(6);r=0;d[r++]=-1;d[r++]=-1;d[r++]=0;d[r++]=0;d[r++]=1;d[r++]=-1;d[r++]=1;d[r++]=
+0;d[r++]=1;d[r++]=1;d[r++]=1;d[r++]=1;d[r++]=-1;d[r++]=1;d[r++]=0;d[r++]=1;r=0;f[r++]=0;f[r++]=1;f[r++]=2;f[r++]=0;f[r++]=2;f[r++]=3;g=b.createBuffer();h=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,g);b.bufferData(b.ARRAY_BUFFER,d,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,h);b.bufferData(b.ELEMENT_ARRAY_BUFFER,f,b.STATIC_DRAW);i=b.createTexture();k=b.createTexture();b.bindTexture(b.TEXTURE_2D,i);b.texImage2D(b.TEXTURE_2D,0,b.RGB,16,16,0,b.RGB,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,
 b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);b.bindTexture(b.TEXTURE_2D,k);b.texImage2D(b.TEXTURE_2D,0,b.RGBA,16,16,0,b.RGBA,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);
-b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);0>=b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)?(j=!1,m=a(THREE.ShaderFlares.lensFlare)):(j=!0,m=a(THREE.ShaderFlares.lensFlareVertexTexture));n={};l={};n.vertex=b.getAttribLocation(m,"position");n.uv=b.getAttribLocation(m,"uv");l.renderType=b.getUniformLocation(m,"renderType");l.map=b.getUniformLocation(m,"map");l.occlusionMap=b.getUniformLocation(m,"occlusionMap");l.opacity=b.getUniformLocation(m,"opacity");l.color=b.getUniformLocation(m,
-"color");l.scale=b.getUniformLocation(m,"scale");l.rotation=b.getUniformLocation(m,"rotation");l.screenPosition=b.getUniformLocation(m,"screenPosition");u=!1};this.render=function(a,d,f,z){var a=a.__webglFlares,w=a.length;if(w){var P=new THREE.Vector3,A=z/f,t=0.5*f,G=0.5*z,H=16/z,M=new THREE.Vector2(H*A,H),I=new THREE.Vector3(1,1,0),K=new THREE.Vector2(1,1),N=l,H=n;b.useProgram(m);u||(b.enableVertexAttribArray(n.vertex),b.enableVertexAttribArray(n.uv),u=!0);b.uniform1i(N.occlusionMap,0);b.uniform1i(N.map,
-1);b.bindBuffer(b.ARRAY_BUFFER,g);b.vertexAttribPointer(H.vertex,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(H.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,i);b.disable(b.CULL_FACE);b.depthMask(!1);var ja,oa,ka,X,$;for(ja=0;ja<w;ja++)if(H=16/z,M.set(H*A,H),X=a[ja],P.set(X.matrixWorld.n14,X.matrixWorld.n24,X.matrixWorld.n34),d.matrixWorldInverse.multiplyVector3(P),d.projectionMatrix.multiplyVector3(P),I.copy(P),K.x=I.x*t+t,K.y=I.y*G+G,j||0<K.x&&K.x<f&&0<K.y&&K.y<z){b.activeTexture(b.TEXTURE1);
-b.bindTexture(b.TEXTURE_2D,h);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,K.x-8,K.y-8,16,16,0);b.uniform1i(N.renderType,0);b.uniform2f(N.scale,M.x,M.y);b.uniform3f(N.screenPosition,I.x,I.y,I.z);b.disable(b.BLEND);b.enable(b.DEPTH_TEST);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);b.activeTexture(b.TEXTURE0);b.bindTexture(b.TEXTURE_2D,k);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGBA,K.x-8,K.y-8,16,16,0);b.uniform1i(N.renderType,1);b.disable(b.DEPTH_TEST);b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,
-h);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);X.positionScreen.copy(I);X.customUpdateCallback?X.customUpdateCallback(X):X.updateLensFlares();b.uniform1i(N.renderType,2);b.enable(b.BLEND);for(oa=0,ka=X.lensFlares.length;oa<ka;oa++)if($=X.lensFlares[oa],0.001<$.opacity&&0.001<$.scale)I.x=$.x,I.y=$.y,I.z=$.z,H=$.size*$.scale/z,M.x=H*A,M.y=H,b.uniform3f(N.screenPosition,I.x,I.y,I.z),b.uniform2f(N.scale,M.x,M.y),b.uniform1f(N.rotation,$.rotation),b.uniform1f(N.opacity,$.opacity),b.uniform3f(N.color,
-$.color.r,$.color.g,$.color.b),c.setBlending($.blending),c.setTexture($.texture,1),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0)}b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(!0)}}};
-THREE.ShadowMapPlugin=function(){var a,b,c,d,f=new THREE.Frustum,g=new THREE.Matrix4,i=new THREE.Vector3,h=new THREE.Vector3;this.init=function(f){a=f.context;b=f;var f=THREE.ShaderLib.depthRGBA,g=THREE.UniformsUtils.clone(f.uniforms);c=new THREE.ShaderMaterial({fragmentShader:f.fragmentShader,vertexShader:f.vertexShader,uniforms:g});d=new THREE.ShaderMaterial({fragmentShader:f.fragmentShader,vertexShader:f.vertexShader,uniforms:g,morphTargets:!0});c._shadowPass=!0;d._shadowPass=!0};this.render=function(a,
-c){b.shadowMapEnabled&&b.shadowMapAutoUpdate&&this.update(a,c)};this.update=function(k,j){var m,n,l,u,r,o,q,z,w,P=[];u=0;a.clearColor(1,1,1,1);a.disable(a.BLEND);b.shadowMapCullFrontFaces&&a.cullFace(a.FRONT);b.setDepthTest(!0);for(m=0,n=k.__lights.length;m<n;m++)if(l=k.__lights[m],l.castShadow)if(l instanceof THREE.DirectionalLight&&l.shadowCascade)for(r=0;r<l.shadowCascadeCount;r++){var A;if(l.shadowCascadeArray[r])A=l.shadowCascadeArray[r];else{w=l;q=r;A=new THREE.DirectionalLight;A.isVirtual=
-!0;A.onlyShadow=!0;A.castShadow=!0;A.shadowCameraNear=w.shadowCameraNear;A.shadowCameraFar=w.shadowCameraFar;A.shadowCameraLeft=w.shadowCameraLeft;A.shadowCameraRight=w.shadowCameraRight;A.shadowCameraBottom=w.shadowCameraBottom;A.shadowCameraTop=w.shadowCameraTop;A.shadowCameraVisible=w.shadowCameraVisible;A.shadowDarkness=w.shadowDarkness;A.shadowBias=w.shadowCascadeBias[q];A.shadowMapWidth=w.shadowCascadeWidth[q];A.shadowMapHeight=w.shadowCascadeHeight[q];A.pointsWorld=[];A.pointsFrustum=[];z=
-A.pointsWorld;o=A.pointsFrustum;for(var t=0;8>t;t++)z[t]=new THREE.Vector3,o[t]=new THREE.Vector3;z=w.shadowCascadeNearZ[q];w=w.shadowCascadeFarZ[q];o[0].set(-1,-1,z);o[1].set(1,-1,z);o[2].set(-1,1,z);o[3].set(1,1,z);o[4].set(-1,-1,w);o[5].set(1,-1,w);o[6].set(-1,1,w);o[7].set(1,1,w);A.originalCamera=j;o=new THREE.Gyroscope;o.position=l.shadowCascadeOffset;o.add(A);o.add(A.target);j.add(o);l.shadowCascadeArray[r]=A;console.log("Created virtualLight",A)}q=l;z=r;w=q.shadowCascadeArray[z];w.position.copy(q.position);
-w.target.position.copy(q.target.position);w.lookAt(w.target);w.shadowCameraVisible=q.shadowCameraVisible;w.shadowDarkness=q.shadowDarkness;w.shadowBias=q.shadowCascadeBias[z];o=q.shadowCascadeNearZ[z];q=q.shadowCascadeFarZ[z];w=w.pointsFrustum;w[0].z=o;w[1].z=o;w[2].z=o;w[3].z=o;w[4].z=q;w[5].z=q;w[6].z=q;w[7].z=q;P[u]=A;u++}else P[u]=l,u++;for(m=0,n=P.length;m<n;m++){l=P[m];if(!l.shadowMap)l.shadowMap=new THREE.WebGLRenderTarget(l.shadowMapWidth,l.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,
+b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);0>=b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)?(j=!1,m=a(THREE.ShaderFlares.lensFlare)):(j=!0,m=a(THREE.ShaderFlares.lensFlareVertexTexture));o={};l={};o.vertex=b.getAttribLocation(m,"position");o.uv=b.getAttribLocation(m,"uv");l.renderType=b.getUniformLocation(m,"renderType");l.map=b.getUniformLocation(m,"map");l.occlusionMap=b.getUniformLocation(m,"occlusionMap");l.opacity=b.getUniformLocation(m,"opacity");l.color=b.getUniformLocation(m,
+"color");l.scale=b.getUniformLocation(m,"scale");l.rotation=b.getUniformLocation(m,"rotation");l.screenPosition=b.getUniformLocation(m,"screenPosition");u=!1};this.render=function(a,d,f,z){var a=a.__webglFlares,w=a.length;if(w){var P=new THREE.Vector3,A=z/f,q=0.5*f,G=0.5*z,H=16/z,M=new THREE.Vector2(H*A,H),I=new THREE.Vector3(1,1,0),K=new THREE.Vector2(1,1),N=l,H=o;b.useProgram(m);u||(b.enableVertexAttribArray(o.vertex),b.enableVertexAttribArray(o.uv),u=!0);b.uniform1i(N.occlusionMap,0);b.uniform1i(N.map,
+1);b.bindBuffer(b.ARRAY_BUFFER,g);b.vertexAttribPointer(H.vertex,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(H.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,h);b.disable(b.CULL_FACE);b.depthMask(!1);var ja,oa,ka,Y,S;for(ja=0;ja<w;ja++)if(H=16/z,M.set(H*A,H),Y=a[ja],P.set(Y.matrixWorld.n14,Y.matrixWorld.n24,Y.matrixWorld.n34),d.matrixWorldInverse.multiplyVector3(P),d.projectionMatrix.multiplyVector3(P),I.copy(P),K.x=I.x*q+q,K.y=I.y*G+G,j||0<K.x&&K.x<f&&0<K.y&&K.y<z){b.activeTexture(b.TEXTURE1);
+b.bindTexture(b.TEXTURE_2D,i);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,K.x-8,K.y-8,16,16,0);b.uniform1i(N.renderType,0);b.uniform2f(N.scale,M.x,M.y);b.uniform3f(N.screenPosition,I.x,I.y,I.z);b.disable(b.BLEND);b.enable(b.DEPTH_TEST);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);b.activeTexture(b.TEXTURE0);b.bindTexture(b.TEXTURE_2D,k);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGBA,K.x-8,K.y-8,16,16,0);b.uniform1i(N.renderType,1);b.disable(b.DEPTH_TEST);b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,
+i);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);Y.positionScreen.copy(I);Y.customUpdateCallback?Y.customUpdateCallback(Y):Y.updateLensFlares();b.uniform1i(N.renderType,2);b.enable(b.BLEND);for(oa=0,ka=Y.lensFlares.length;oa<ka;oa++)if(S=Y.lensFlares[oa],0.001<S.opacity&&0.001<S.scale)I.x=S.x,I.y=S.y,I.z=S.z,H=S.size*S.scale/z,M.x=H*A,M.y=H,b.uniform3f(N.screenPosition,I.x,I.y,I.z),b.uniform2f(N.scale,M.x,M.y),b.uniform1f(N.rotation,S.rotation),b.uniform1f(N.opacity,S.opacity),b.uniform3f(N.color,
+S.color.r,S.color.g,S.color.b),c.setBlending(S.blending,S.blendEquation,S.blendSrc,S.blendDst),c.setTexture(S.texture,1),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0)}b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(!0)}}};
+THREE.ShadowMapPlugin=function(){var a,b,c,d,f=new THREE.Frustum,g=new THREE.Matrix4,h=new THREE.Vector3,i=new THREE.Vector3;this.init=function(f){a=f.context;b=f;var f=THREE.ShaderLib.depthRGBA,g=THREE.UniformsUtils.clone(f.uniforms);c=new THREE.ShaderMaterial({fragmentShader:f.fragmentShader,vertexShader:f.vertexShader,uniforms:g});d=new THREE.ShaderMaterial({fragmentShader:f.fragmentShader,vertexShader:f.vertexShader,uniforms:g,morphTargets:!0});c._shadowPass=!0;d._shadowPass=!0};this.render=function(a,
+c){b.shadowMapEnabled&&b.shadowMapAutoUpdate&&this.update(a,c)};this.update=function(k,j){var m,o,l,u,r,n,t,z,w,P=[];u=0;a.clearColor(1,1,1,1);a.disable(a.BLEND);b.shadowMapCullFrontFaces&&a.cullFace(a.FRONT);b.setDepthTest(!0);for(m=0,o=k.__lights.length;m<o;m++)if(l=k.__lights[m],l.castShadow)if(l instanceof THREE.DirectionalLight&&l.shadowCascade)for(r=0;r<l.shadowCascadeCount;r++){var A;if(l.shadowCascadeArray[r])A=l.shadowCascadeArray[r];else{w=l;t=r;A=new THREE.DirectionalLight;A.isVirtual=
+!0;A.onlyShadow=!0;A.castShadow=!0;A.shadowCameraNear=w.shadowCameraNear;A.shadowCameraFar=w.shadowCameraFar;A.shadowCameraLeft=w.shadowCameraLeft;A.shadowCameraRight=w.shadowCameraRight;A.shadowCameraBottom=w.shadowCameraBottom;A.shadowCameraTop=w.shadowCameraTop;A.shadowCameraVisible=w.shadowCameraVisible;A.shadowDarkness=w.shadowDarkness;A.shadowBias=w.shadowCascadeBias[t];A.shadowMapWidth=w.shadowCascadeWidth[t];A.shadowMapHeight=w.shadowCascadeHeight[t];A.pointsWorld=[];A.pointsFrustum=[];z=
+A.pointsWorld;n=A.pointsFrustum;for(var q=0;8>q;q++)z[q]=new THREE.Vector3,n[q]=new THREE.Vector3;z=w.shadowCascadeNearZ[t];w=w.shadowCascadeFarZ[t];n[0].set(-1,-1,z);n[1].set(1,-1,z);n[2].set(-1,1,z);n[3].set(1,1,z);n[4].set(-1,-1,w);n[5].set(1,-1,w);n[6].set(-1,1,w);n[7].set(1,1,w);A.originalCamera=j;n=new THREE.Gyroscope;n.position=l.shadowCascadeOffset;n.add(A);n.add(A.target);j.add(n);l.shadowCascadeArray[r]=A;console.log("Created virtualLight",A)}t=l;z=r;w=t.shadowCascadeArray[z];w.position.copy(t.position);
+w.target.position.copy(t.target.position);w.lookAt(w.target);w.shadowCameraVisible=t.shadowCameraVisible;w.shadowDarkness=t.shadowDarkness;w.shadowBias=t.shadowCascadeBias[z];n=t.shadowCascadeNearZ[z];t=t.shadowCascadeFarZ[z];w=w.pointsFrustum;w[0].z=n;w[1].z=n;w[2].z=n;w[3].z=n;w[4].z=t;w[5].z=t;w[6].z=t;w[7].z=t;P[u]=A;u++}else P[u]=l,u++;for(m=0,o=P.length;m<o;m++){l=P[m];if(!l.shadowMap)l.shadowMap=new THREE.WebGLRenderTarget(l.shadowMapWidth,l.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,
 format:THREE.RGBAFormat}),l.shadowMapSize=new THREE.Vector2(l.shadowMapWidth,l.shadowMapHeight),l.shadowMatrix=new THREE.Matrix4;if(!l.shadowCamera){if(l instanceof THREE.SpotLight)l.shadowCamera=new THREE.PerspectiveCamera(l.shadowCameraFov,l.shadowMapWidth/l.shadowMapHeight,l.shadowCameraNear,l.shadowCameraFar);else if(l instanceof THREE.DirectionalLight)l.shadowCamera=new THREE.OrthographicCamera(l.shadowCameraLeft,l.shadowCameraRight,l.shadowCameraTop,l.shadowCameraBottom,l.shadowCameraNear,l.shadowCameraFar);
-else{console.error("Unsupported light type for shadow");continue}k.add(l.shadowCamera);b.autoUpdateScene&&k.updateMatrixWorld()}if(l.shadowCameraVisible&&!l.cameraHelper)l.cameraHelper=new THREE.CameraHelper(l.shadowCamera),l.shadowCamera.add(l.cameraHelper);if(l.isVirtual&&A.originalCamera==j){r=j;u=l.shadowCamera;o=l.pointsFrustum;w=l.pointsWorld;i.set(Infinity,Infinity,Infinity);h.set(-Infinity,-Infinity,-Infinity);for(q=0;8>q;q++){z=w[q];z.copy(o[q]);THREE.ShadowMapPlugin.__projector.unprojectVector(z,
-r);u.matrixWorldInverse.multiplyVector3(z);if(z.x<i.x)i.x=z.x;if(z.x>h.x)h.x=z.x;if(z.y<i.y)i.y=z.y;if(z.y>h.y)h.y=z.y;if(z.z<i.z)i.z=z.z;if(z.z>h.z)h.z=z.z}u.left=i.x;u.right=h.x;u.top=h.y;u.bottom=i.y;u.updateProjectionMatrix()}u=l.shadowMap;o=l.shadowMatrix;r=l.shadowCamera;r.position.copy(l.matrixWorld.getPosition());r.lookAt(l.target.matrixWorld.getPosition());r.updateMatrixWorld();r.matrixWorldInverse.getInverse(r.matrixWorld);if(l.cameraHelper)l.cameraHelper.lines.visible=l.shadowCameraVisible;
-l.shadowCameraVisible&&l.cameraHelper.update();o.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);o.multiplySelf(r.projectionMatrix);o.multiplySelf(r.matrixWorldInverse);if(!r._viewMatrixArray)r._viewMatrixArray=new Float32Array(16);if(!r._projectionMatrixArray)r._projectionMatrixArray=new Float32Array(16);r.matrixWorldInverse.flattenToArray(r._viewMatrixArray);r.projectionMatrix.flattenToArray(r._projectionMatrixArray);g.multiply(r.projectionMatrix,r.matrixWorldInverse);f.setFromMatrix(g);b.setRenderTarget(u);
-b.clear();w=k.__webglObjects;for(l=0,u=w.length;l<u;l++)if(q=w[l],o=q.object,q.render=!1,o.visible&&o.castShadow&&(!(o instanceof THREE.Mesh)||!o.frustumCulled||f.contains(o)))o.matrixWorld.flattenToArray(o._objectMatrixArray),o._modelViewMatrix.multiplyToArray(r.matrixWorldInverse,o.matrixWorld,o._modelViewMatrixArray),q.render=!0;for(l=0,u=w.length;l<u;l++)if(q=w[l],q.render)o=q.object,q=q.buffer,b.setObjectFaces(o),z=o.customDepthMaterial?o.customDepthMaterial:o.geometry.morphTargets.length?d:
-c,q instanceof THREE.BufferGeometry?b.renderBufferDirect(r,k.__lights,null,z,q,o):b.renderBuffer(r,k.__lights,null,z,q,o);w=k.__webglObjectsImmediate;for(l=0,u=w.length;l<u;l++)q=w[l],o=q.object,o.visible&&o.castShadow&&(o.matrixAutoUpdate&&o.matrixWorld.flattenToArray(o._objectMatrixArray),o._modelViewMatrix.multiplyToArray(r.matrixWorldInverse,o.matrixWorld,o._modelViewMatrixArray),b.renderImmediateObject(r,k.__lights,null,c,o))}m=b.getClearColor();n=b.getClearAlpha();a.clearColor(m.r,m.g,m.b,n);
+else{console.error("Unsupported light type for shadow");continue}k.add(l.shadowCamera);b.autoUpdateScene&&k.updateMatrixWorld()}if(l.shadowCameraVisible&&!l.cameraHelper)l.cameraHelper=new THREE.CameraHelper(l.shadowCamera),l.shadowCamera.add(l.cameraHelper);if(l.isVirtual&&A.originalCamera==j){r=j;u=l.shadowCamera;n=l.pointsFrustum;w=l.pointsWorld;h.set(Infinity,Infinity,Infinity);i.set(-Infinity,-Infinity,-Infinity);for(t=0;8>t;t++){z=w[t];z.copy(n[t]);THREE.ShadowMapPlugin.__projector.unprojectVector(z,
+r);u.matrixWorldInverse.multiplyVector3(z);if(z.x<h.x)h.x=z.x;if(z.x>i.x)i.x=z.x;if(z.y<h.y)h.y=z.y;if(z.y>i.y)i.y=z.y;if(z.z<h.z)h.z=z.z;if(z.z>i.z)i.z=z.z}u.left=h.x;u.right=i.x;u.top=i.y;u.bottom=h.y;u.updateProjectionMatrix()}u=l.shadowMap;n=l.shadowMatrix;r=l.shadowCamera;r.position.copy(l.matrixWorld.getPosition());r.lookAt(l.target.matrixWorld.getPosition());r.updateMatrixWorld();r.matrixWorldInverse.getInverse(r.matrixWorld);if(l.cameraHelper)l.cameraHelper.lines.visible=l.shadowCameraVisible;
+l.shadowCameraVisible&&l.cameraHelper.update();n.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);n.multiplySelf(r.projectionMatrix);n.multiplySelf(r.matrixWorldInverse);if(!r._viewMatrixArray)r._viewMatrixArray=new Float32Array(16);if(!r._projectionMatrixArray)r._projectionMatrixArray=new Float32Array(16);r.matrixWorldInverse.flattenToArray(r._viewMatrixArray);r.projectionMatrix.flattenToArray(r._projectionMatrixArray);g.multiply(r.projectionMatrix,r.matrixWorldInverse);f.setFromMatrix(g);b.setRenderTarget(u);
+b.clear();w=k.__webglObjects;for(l=0,u=w.length;l<u;l++)if(t=w[l],n=t.object,t.render=!1,n.visible&&n.castShadow&&(!(n instanceof THREE.Mesh)||!n.frustumCulled||f.contains(n)))n.matrixWorld.flattenToArray(n._objectMatrixArray),n._modelViewMatrix.multiplyToArray(r.matrixWorldInverse,n.matrixWorld,n._modelViewMatrixArray),t.render=!0;for(l=0,u=w.length;l<u;l++)if(t=w[l],t.render)n=t.object,t=t.buffer,b.setObjectFaces(n),z=n.customDepthMaterial?n.customDepthMaterial:n.geometry.morphTargets.length?d:
+c,t instanceof THREE.BufferGeometry?b.renderBufferDirect(r,k.__lights,null,z,t,n):b.renderBuffer(r,k.__lights,null,z,t,n);w=k.__webglObjectsImmediate;for(l=0,u=w.length;l<u;l++)t=w[l],n=t.object,n.visible&&n.castShadow&&(n.matrixAutoUpdate&&n.matrixWorld.flattenToArray(n._objectMatrixArray),n._modelViewMatrix.multiplyToArray(r.matrixWorldInverse,n.matrixWorld,n._modelViewMatrixArray),b.renderImmediateObject(r,k.__lights,null,c,n))}m=b.getClearColor();o=b.getClearAlpha();a.clearColor(m.r,m.g,m.b,o);
 a.enable(a.BLEND);b.shadowMapCullFrontFaces&&a.cullFace(a.BACK)}};THREE.ShadowMapPlugin.__projector=new THREE.Projector;
-THREE.SpritePlugin=function(){function a(a,b){return b.z-a.z}var b,c,d,f,g,i,h,k,j,m;this.init=function(a){b=a.context;c=a;d=new Float32Array(16);f=new Uint16Array(6);a=0;d[a++]=-1;d[a++]=-1;d[a++]=0;d[a++]=1;d[a++]=1;d[a++]=-1;d[a++]=1;d[a++]=1;d[a++]=1;d[a++]=1;d[a++]=1;d[a++]=0;d[a++]=-1;d[a++]=1;d[a++]=0;a=d[a++]=0;f[a++]=0;f[a++]=1;f[a++]=2;f[a++]=0;f[a++]=2;f[a++]=3;g=b.createBuffer();i=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,g);b.bufferData(b.ARRAY_BUFFER,d,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,
-i);b.bufferData(b.ELEMENT_ARRAY_BUFFER,f,b.STATIC_DRAW);var a=THREE.ShaderSprite.sprite,l=b.createProgram(),u=b.createShader(b.FRAGMENT_SHADER),r=b.createShader(b.VERTEX_SHADER);b.shaderSource(u,a.fragmentShader);b.shaderSource(r,a.vertexShader);b.compileShader(u);b.compileShader(r);b.attachShader(l,u);b.attachShader(l,r);b.linkProgram(l);h=l;k={};j={};k.position=b.getAttribLocation(h,"position");k.uv=b.getAttribLocation(h,"uv");j.uvOffset=b.getUniformLocation(h,"uvOffset");j.uvScale=b.getUniformLocation(h,
-"uvScale");j.rotation=b.getUniformLocation(h,"rotation");j.scale=b.getUniformLocation(h,"scale");j.alignment=b.getUniformLocation(h,"alignment");j.color=b.getUniformLocation(h,"color");j.map=b.getUniformLocation(h,"map");j.opacity=b.getUniformLocation(h,"opacity");j.useScreenCoordinates=b.getUniformLocation(h,"useScreenCoordinates");j.affectedByDistance=b.getUniformLocation(h,"affectedByDistance");j.screenPosition=b.getUniformLocation(h,"screenPosition");j.modelViewMatrix=b.getUniformLocation(h,"modelViewMatrix");
-j.projectionMatrix=b.getUniformLocation(h,"projectionMatrix");m=!1};this.render=function(d,f,u,r){var d=d.__webglSprites,o=d.length;if(o){var q=k,z=j,w=r/u,u=0.5*u,P=0.5*r,A=!0;b.useProgram(h);m||(b.enableVertexAttribArray(q.position),b.enableVertexAttribArray(q.uv),m=!0);b.disable(b.CULL_FACE);b.enable(b.BLEND);b.depthMask(!0);b.bindBuffer(b.ARRAY_BUFFER,g);b.vertexAttribPointer(q.position,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(q.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,i);b.uniformMatrix4fv(z.projectionMatrix,
-!1,f._projectionMatrixArray);b.activeTexture(b.TEXTURE0);b.uniform1i(z.map,0);for(var t,G=[],q=0;q<o;q++)if(t=d[q],t.visible&&0!==t.opacity)t.useScreenCoordinates?t.z=-t.position.z:(t._modelViewMatrix.multiplyToArray(f.matrixWorldInverse,t.matrixWorld,t._modelViewMatrixArray),t.z=-t._modelViewMatrix.n34);d.sort(a);for(q=0;q<o;q++)t=d[q],t.visible&&0!==t.opacity&&t.map&&t.map.image&&t.map.image.width&&(t.useScreenCoordinates?(b.uniform1i(z.useScreenCoordinates,1),b.uniform3f(z.screenPosition,(t.position.x-
-u)/u,(P-t.position.y)/P,Math.max(0,Math.min(1,t.position.z)))):(b.uniform1i(z.useScreenCoordinates,0),b.uniform1i(z.affectedByDistance,t.affectedByDistance?1:0),b.uniformMatrix4fv(z.modelViewMatrix,!1,t._modelViewMatrixArray)),f=t.map.image.width/(t.scaleByViewport?r:1),G[0]=f*w*t.scale.x,G[1]=f*t.scale.y,b.uniform2f(z.uvScale,t.uvScale.x,t.uvScale.y),b.uniform2f(z.uvOffset,t.uvOffset.x,t.uvOffset.y),b.uniform2f(z.alignment,t.alignment.x,t.alignment.y),b.uniform1f(z.opacity,t.opacity),b.uniform3f(z.color,
-t.color.r,t.color.g,t.color.b),b.uniform1f(z.rotation,t.rotation),b.uniform2fv(z.scale,G),t.mergeWith3D&&!A?(b.enable(b.DEPTH_TEST),A=!0):!t.mergeWith3D&&A&&(b.disable(b.DEPTH_TEST),A=!1),c.setBlending(t.blending),c.setTexture(t.map,0),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0));b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(!0)}}};
+THREE.SpritePlugin=function(){function a(a,b){return b.z-a.z}var b,c,d,f,g,h,i,k,j,m;this.init=function(a){b=a.context;c=a;d=new Float32Array(16);f=new Uint16Array(6);a=0;d[a++]=-1;d[a++]=-1;d[a++]=0;d[a++]=1;d[a++]=1;d[a++]=-1;d[a++]=1;d[a++]=1;d[a++]=1;d[a++]=1;d[a++]=1;d[a++]=0;d[a++]=-1;d[a++]=1;d[a++]=0;a=d[a++]=0;f[a++]=0;f[a++]=1;f[a++]=2;f[a++]=0;f[a++]=2;f[a++]=3;g=b.createBuffer();h=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,g);b.bufferData(b.ARRAY_BUFFER,d,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,
+h);b.bufferData(b.ELEMENT_ARRAY_BUFFER,f,b.STATIC_DRAW);var a=THREE.ShaderSprite.sprite,l=b.createProgram(),u=b.createShader(b.FRAGMENT_SHADER),r=b.createShader(b.VERTEX_SHADER);b.shaderSource(u,a.fragmentShader);b.shaderSource(r,a.vertexShader);b.compileShader(u);b.compileShader(r);b.attachShader(l,u);b.attachShader(l,r);b.linkProgram(l);i=l;k={};j={};k.position=b.getAttribLocation(i,"position");k.uv=b.getAttribLocation(i,"uv");j.uvOffset=b.getUniformLocation(i,"uvOffset");j.uvScale=b.getUniformLocation(i,
+"uvScale");j.rotation=b.getUniformLocation(i,"rotation");j.scale=b.getUniformLocation(i,"scale");j.alignment=b.getUniformLocation(i,"alignment");j.color=b.getUniformLocation(i,"color");j.map=b.getUniformLocation(i,"map");j.opacity=b.getUniformLocation(i,"opacity");j.useScreenCoordinates=b.getUniformLocation(i,"useScreenCoordinates");j.affectedByDistance=b.getUniformLocation(i,"affectedByDistance");j.screenPosition=b.getUniformLocation(i,"screenPosition");j.modelViewMatrix=b.getUniformLocation(i,"modelViewMatrix");
+j.projectionMatrix=b.getUniformLocation(i,"projectionMatrix");m=!1};this.render=function(d,f,u,r){var d=d.__webglSprites,n=d.length;if(n){var t=k,z=j,w=r/u,u=0.5*u,P=0.5*r,A=!0;b.useProgram(i);m||(b.enableVertexAttribArray(t.position),b.enableVertexAttribArray(t.uv),m=!0);b.disable(b.CULL_FACE);b.enable(b.BLEND);b.depthMask(!0);b.bindBuffer(b.ARRAY_BUFFER,g);b.vertexAttribPointer(t.position,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(t.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,h);b.uniformMatrix4fv(z.projectionMatrix,
+!1,f._projectionMatrixArray);b.activeTexture(b.TEXTURE0);b.uniform1i(z.map,0);for(var q,G=[],t=0;t<n;t++)if(q=d[t],q.visible&&0!==q.opacity)q.useScreenCoordinates?q.z=-q.position.z:(q._modelViewMatrix.multiplyToArray(f.matrixWorldInverse,q.matrixWorld,q._modelViewMatrixArray),q.z=-q._modelViewMatrix.n34);d.sort(a);for(t=0;t<n;t++)q=d[t],q.visible&&0!==q.opacity&&q.map&&q.map.image&&q.map.image.width&&(q.useScreenCoordinates?(b.uniform1i(z.useScreenCoordinates,1),b.uniform3f(z.screenPosition,(q.position.x-
+u)/u,(P-q.position.y)/P,Math.max(0,Math.min(1,q.position.z)))):(b.uniform1i(z.useScreenCoordinates,0),b.uniform1i(z.affectedByDistance,q.affectedByDistance?1:0),b.uniformMatrix4fv(z.modelViewMatrix,!1,q._modelViewMatrixArray)),f=q.map.image.width/(q.scaleByViewport?r:1),G[0]=f*w*q.scale.x,G[1]=f*q.scale.y,b.uniform2f(z.uvScale,q.uvScale.x,q.uvScale.y),b.uniform2f(z.uvOffset,q.uvOffset.x,q.uvOffset.y),b.uniform2f(z.alignment,q.alignment.x,q.alignment.y),b.uniform1f(z.opacity,q.opacity),b.uniform3f(z.color,
+q.color.r,q.color.g,q.color.b),b.uniform1f(z.rotation,q.rotation),b.uniform2fv(z.scale,G),q.mergeWith3D&&!A?(b.enable(b.DEPTH_TEST),A=!0):!q.mergeWith3D&&A&&(b.disable(b.DEPTH_TEST),A=!1),c.setBlending(q.blending,q.blendEquation,q.blendSrc,q.blendDst),c.setTexture(q.map,0),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0));b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(!0)}}};
 THREE.ShaderFlares={lensFlareVertexTexture:{vertexShader:"uniform vec3 screenPosition;\nuniform vec2 scale;\nuniform float rotation;\nuniform int renderType;\nuniform sampler2D occlusionMap;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nvUV = uv;\nvec2 pos = position;\nif( renderType == 2 ) {\nvec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.5 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.1, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.1, 0.5 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.5 ) );\nvVisibility = (       visibility.r / 9.0 ) *\n( 1.0 - visibility.g / 9.0 ) *\n(       visibility.b / 9.0 ) *\n( 1.0 - visibility.a / 9.0 );\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",fragmentShader:"precision mediump float;\nuniform sampler2D map;\nuniform float opacity;\nuniform int renderType;\nuniform vec3 color;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nif( renderType == 0 ) {\ngl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );\n} else if( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nvec4 texture = texture2D( map, vUV );\ntexture.a *= opacity * vVisibility;\ngl_FragColor = texture;\ngl_FragColor.rgb *= color;\n}\n}"},
 lensFlare:{vertexShader:"uniform vec3 screenPosition;\nuniform vec2 scale;\nuniform float rotation;\nuniform int renderType;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvoid main() {\nvUV = uv;\nvec2 pos = position;\nif( renderType == 2 ) {\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",fragmentShader:"precision mediump float;\nuniform sampler2D map;\nuniform sampler2D occlusionMap;\nuniform float opacity;\nuniform int renderType;\nuniform vec3 color;\nvarying vec2 vUV;\nvoid main() {\nif( renderType == 0 ) {\ngl_FragColor = vec4( texture2D( map, vUV ).rgb, 0.0 );\n} else if( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nfloat visibility = texture2D( occlusionMap, vec2( 0.5, 0.1 ) ).a +\ntexture2D( occlusionMap, vec2( 0.9, 0.5 ) ).a +\ntexture2D( occlusionMap, vec2( 0.5, 0.9 ) ).a +\ntexture2D( occlusionMap, vec2( 0.1, 0.5 ) ).a;\nvisibility = ( 1.0 - visibility / 4.0 );\nvec4 texture = texture2D( map, vUV );\ntexture.a *= opacity * visibility;\ngl_FragColor = texture;\ngl_FragColor.rgb *= color;\n}\n}"}};
 THREE.ShaderSprite={sprite:{vertexShader:"uniform int useScreenCoordinates;\nuniform int affectedByDistance;\nuniform vec3 screenPosition;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform float rotation;\nuniform vec2 scale;\nuniform vec2 alignment;\nuniform vec2 uvOffset;\nuniform vec2 uvScale;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvoid main() {\nvUV = uvOffset + uv * uvScale;\nvec2 alignedPosition = position + alignment;\nvec2 rotatedPosition;\nrotatedPosition.x = ( cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y ) * scale.x;\nrotatedPosition.y = ( sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y ) * scale.y;\nvec4 finalPosition;\nif( useScreenCoordinates != 0 ) {\nfinalPosition = vec4( screenPosition.xy + rotatedPosition, screenPosition.z, 1.0 );\n} else {\nfinalPosition = projectionMatrix * modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\nfinalPosition.xy += rotatedPosition * ( affectedByDistance == 1 ? 1.0 : finalPosition.z );\n}\ngl_Position = finalPosition;\n}",

+ 29 - 9
docs/api/materials/LineBasicMaterial.html

@@ -2,27 +2,47 @@
 
 <h1>[name]</h1>
 
-<div class="desc">todo</div>
+<div class="desc">A material for drawing wireframe-style geometries.</div>
 
 
 <h2>Constructor</h2>
 
-<h3>[name]()</h3>
+<h3>[name]( [page:Object parameters] )</h3>
 
+<div>parameters is an object with one or more properties defining the material's appearance.</div>
+<div>
+color — An instance of [page:Color Color]. Default is white.<br />
+linewidth — Line thickness. Default is 1.<br />
+linecap — Define appearance of line ends. Default is 'round'.<br />
+linejoin — Define appearance of line joints. Default is 'round'.<br />
+vertexColors — Define whether the material uses vertex colors, or not. Default is false.<br />
+fog — Define whether the material color is affected by global fog settings. Default is false.
+</div>
 
 <h2>Properties</h2>
 
-<h3>.[page:Vector3 todo]</h3>
+<h3>.[page:Color color]</h3>
+<div>An instance of [page:Color THREE.Color]. Default is a white (0xffffff) instance.</div>
 
+<h3>.[page:Float linewidth]</h3>
+<div>Controls line thickness. Default is 1.</div>
 
-<h2>Methods</h2>
+<h3>.[page:String linecap]</h3>
+<div>Define appearance of line ends. Possible values are "butt", "round" and "square". Default is 'round'.</div>
+<div>This setting might not have any effect when used with certain renderers. For example, it is ignored with the [page:WebGLRenderer WebGL] renderer, but does work with the [page:CanvasRenderer Canvas] renderer.</div>
 
-<h3>.todo( [page:Vector3 todo] )</h3>
-<div>
-todo — todo<br />
-</div>
+<h3>.[page:String linejoin]</h3>
+<div>Define appearance of line joints. Possible values are "round", "bevel" and "miter". Default is 'round'.</div>
+<div>This setting might not have any effect when used with certain renderers. For example, it is ignored with the [page:WebGLRenderer WebGL] renderer, but does work with the [page:CanvasRenderer Canvas] renderer.</div>
+
+<h3>.[page:Boolean vertexColors]</h3>
+<div>Define whether the material uses vertex colors, or not. Default is false.</div>
+<div>This setting might not have any effect when used with certain renderers. For example, it is ignored with the [page:CanvasRenderer Canvas] renderer, but does work with the [page:WebGLRenderer WebGL] renderer.</div>
 
+<h3>.[page:Boolean fog]</h3>
+<div>Define whether the material color is affected by global fog settings.</div>
+<div>This setting might not have any effect when used with certain renderers. For example, it is ignored with the [page:CanvasRenderer Canvas] renderer, but does work with the [page:WebGLRenderer WebGL] renderer.</div>
 
 <h2>Source</h2>
 
-[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
+[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]

+ 25 - 7
docs/api/objects/Line.html

@@ -1,26 +1,44 @@
+[page:Object3D] &rarr;
 <h1>[name]</h1>
 
-<div class="desc">todo</div>
+<div class="desc">A line or a series of lines.</div>
 
 
 <h2>Constructor</h2>
 
-<h3>[name]()</h3>
+<h3>[name]( [page:Geometry geometry], [page:Material material], [page:Integer type] )</h3>
 
+<div>
+geometry — Vertices representing the line segment(s).<br />
+material — Material for the line. Default is [page:LineBasicMaterial LineBasicMaterial].<br />
+type — Connection type between vertices. Default is LineStrip.
+</div>
+
+<div>If no material is supplied, a randomized line material will be created and assigned to the object.</div>
+
+<div>Also, if no type is supplied, the default (LineStrip) will be used).</div>
 
 <h2>Properties</h2>
 
-<h3>.[page:Vector3 todo]</h3>
+<h3>.[page:Geometry geometry]</h3>
+<div>
+Vertices representing the line segment(s).
+</div>
 
+<h3>.[page:Material material]</h3>
+<div>
+Material for the line.
+</div>
 
-<h2>Methods</h2>
+<h3>.[page:Integer type]</h3>
+<div>
+Possible values: LineStrip or LinePieces. LineStrip will draw a series of segments connecting each point (first connected to the second, the second connected to the third, and so on and so forth); and LinePieces will draw a series of pairs of segments (first connected to the second, the third connected to the fourth, and so on and so forth).</div>
 
-<h3>.todo( [page:Vector3 todo] )</h3>
 <div>
-todo — todo<br />
+In OpenGL terms, LineStrip is the classic GL_LINE_STRIP and LinePieces is the equivalent to GL_LINES.
 </div>
 
 
 <h2>Source</h2>
 
-[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
+[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]

+ 18 - 6
docs/api/objects/Mesh.html

@@ -1,26 +1,38 @@
+[page:Object3D] &rarr;
 <h1>[name]</h1>
 
-<div class="desc">todo</div>
+<div class="desc">Base class for Mesh objects, such as [page:MorphAnimMesh] and [page:SkinnedMesh].</div>
 
 
 <h2>Constructor</h2>
 
-<h3>[name]()</h3>
+<h3>[name]( [page:Geometry geometry], [page:Material material] )</h3>
 
+<div>
+geometry — An instance of [page:Geometry].<br />
+material — An instance of [page:Material] (optional).
+</div>
 
 <h2>Properties</h2>
 
-<h3>.[page:Vector3 todo]</h3>
+<h3>.[page:Geometry geometry]</h3>
+
+<div>An instance of [page:Geometry], defining the object's structure.</div>
 
+<h3>.[page:Material material]</h3>
+
+<div>An instance of [page:Material], defining the object's appearance. Default is a [page:MeshBasicMaterial] with wireframe mode enabled and randomised colour.</div>
 
 <h2>Methods</h2>
 
-<h3>.todo( [page:Vector3 todo] )</h3>
+<h3>.getMorphTargetIndexByName( [page:String name] )</h3>
 <div>
-todo — todo<br />
+name — a morph target name<br />
 </div>
 
+Returns the index of a morph target defined by name.
+
 
 <h2>Source</h2>
 
-[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
+[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]

+ 299 - 6
docs/api/renderers/WebGLRenderer.html

@@ -1,26 +1,319 @@
 <h1>[name]</h1>
 
-<div class="desc">todo</div>
+<div class="desc">The WebGL renderer displays your beautifully crafted scenes using WebGL, if your device supports it.</div>
+<div class="desc">This renderer has way better performance than [page:CanvasRenderer].</div>
 
 
 <h2>Constructor</h2>
 
-<h3>[name]()</h3>
+<h3>[name]( [page:Object parameters] )</h3>
 
+<div>parameters is an optional object with properties defining the renderer's behaviour. The constructor also accepts no parameters at all. In all cases, it will assume sane defaults when parameters are missing.</div>
+
+<div>
+canvas — A [page:Canvas] where the renderer draws its output.<br />
+precision — shader precision. Can be 'highp' or ???<br />
+alpha — [page:Boolean], default is true.<br />
+premultipliedAlpha — [page:Boolean], default is true.<br />
+antialias — [page:Boolean], default is false.<br />
+stencil — [page:Boolean], default is true.<br />
+preserveDrawingBuffer — [page:Boolean], default is false.<br />
+clearColor — [page:Integer], default is black.<br />
+clearAlpha — [page:Float], default is 0.<br />
+maxLights — [page:Integer], default is 4.<br />
+</div>
 
 <h2>Properties</h2>
 
-<h3>.[page:Vector3 todo]</h3>
+<h3>.[page:DOMElement domElement]</h3>
+
+<div>A [page:Canvas] where the renderer draws its output.<br />
+This is automatically created by the renderer in the constructor (if not provided already); you just need to add it to your page.</div>
+
+<h3>.context</h3>
+
+<div>The HTML5 Canvas's 'webgl' context obtained from the canvas where the renderer will draw.</div>
+
+<h3>.[page:Boolean autoClear]</h3>
+
+<div>Defines whether the renderer should automatically clear its output before rendering.</div>
+
+
+<h3>.[page:Boolean autoClearColor]</h3>
+
+<div>If autoClear is true, defines whether the renderer should clear the color buffer. Default is true.</div>
+
+
+<h3>.[page:Boolean autoClearDepth]</h3>
+
+<div>If autoClear is true, defines whether the renderer should clear the depth buffer. Default is true.</div>
+
+
+<h3>.[page:Boolean autoClearStencil]</h3>
+
+<div>If autoClear is true, defines whether the renderer should clear the stencil buffer. Default is true.</div>
+
+
+<h3>.[page:Boolean sortObjects]</h3>
+
+<div>Defines whether the renderer should sort objects. Default is true.</div>
+
+<div>TODO</div>
+
+
+<h3>.[page:Boolean autoUpdateObjects]</h3>
+
+<div>Defines whether the renderer should auto update objects. Default is true.</div>
+
+<div>TODO</div>
+
+
+<h3>.[page:Boolean autoUpdateScene]</h3>
+
+<div>Defines whether the renderer should auto update the scene. Default is true.</div>
+
+<div>TODO</div>
+
+<!-- Physically based shading -->
+
+<h3>.[page:Boolean gammaInput]</h3>
+
+<div>Default is false. TODO</div>
+
+
+<h3>.[page:Boolean gammaOutput]</h3>
+
+<div>Default is false. TODO</div>
+
+
+<h3>.[page:Boolean physicallyBasedShading]</h3>
+
+<div>Default is false. TODO</div>
+
+
+<h3>.[page:Boolean shadowMapEnabled]</h3>
+
+<div>Default is false. TODO</div>
+
+
+<h3>.[page:Boolean shadowMapAutoUpdate]</h3>
+
+<div>Default is true. TODO</div>
+
+
+<h3>.[page:Boolean shadowMapSoft]</h3>
+
+<div>Default is true. TODO</div>
+
+
+<h3>.[page:Boolean shadowMapCullFrontFaces]</h3>
+
+<div>Default is true. TODO</div>
+
+
+<h3>.[page:Boolean shadowMapDebug]</h3>
+
+<div>Default is false. TODO</div>
+
+
+<h3>.[page:Boolean shadowMapCascade]</h3>
+
+<div>Default is false. TODO</div>
+
+
+<h3>.[page:Integer maxMorphTargets]</h3>
+
+<div>Default is 8. TODO</div>
+
+
+<h3>.[page:Integer maxMorphNormals]</h3>
+
+<div>Default is 4. TODO</div>
+
+
+<h3>.[page:Boolean autoScaleCubemaps]</h3>
+
+<div>Default is true. TODO</div>
+
 
+<h3>.[page:Boolean renderPluginsPre]</h3>
+
+<div>An array with render plugins to be applied before rendering.</div>
+<div>Default is an empty array, or [].</div>
+
+
+<h3>.[page:Boolean renderPluginsPost]</h3>
+
+<div>An array with render plugins to be applied after rendering.</div>
+<div>Default is an empty array, or [].</div>
+
+
+<h3>.[page:Object info]</h3>
+
+<div>An object with a series of statistical information about the graphics board memory and the rendering process. Useful for debugging or just for the sake of curiosity. The object contains the following fields:</div>
+<div>
+<ul>
+	<li>memory:
+		<ul>
+			<li>programs</li>
+			<li>geometries</li>
+			<li>textures</li>
+		</ul>
+	</li>
+	<li>render:
+		<ul>
+			<li>calls</li>
+			<li>vertices</li>
+			<li>faces</li>
+			<li>points</li>
+		</ul>
+	</li>
+</ul>
+</div>
 
 <h2>Methods</h2>
 
-<h3>.todo( [page:Vector3 todo] )</h3>
+<h3>.getContext()</h3>
 <div>
-todo — todo<br />
+Return the WebGL context.
 </div>
 
+<h3>.supportsVertexTextures()</h3>
+<div>
+Return a [page:Boolean] true if the context supports vertex textures.
+</div>
+
+
+<h3>.setSize( [page:Integer width], [page:Integer height] )</h3>
+<div>Resizes the output canvas to (width, height), and also sets the viewport to fit that size, starting in (0, 0).</div>
+
+<h3>.setViewport( [page:Integer x], [page:Integer y], [page:Integer width], [page:Integer height] )</h3>
+<div>Sets the viewport to render from (x, y) to (x + width, y + height).</div>
+
+
+<h3>.setScissor( [page:Integer x], [page:Integer y], [page:Integer width], [page:Integer height] )</h3>
+<div>Sets the scissor area from (x, y) to (x + width, y + height).</div>
+
+<h3>.enableScissorTest( [page:Boolean enable] )</h3>
+<div>Enable the scissor test. When this is enabled, only the pixels within the defined scissor area will be affected by further renderer actions.</div>
+
+
+<h3>.setClearColorHex( [page:Integer hex], [page:Float alpha] )</h3>
+<div>Sets the clear color, using hex for the color and alpha for the opacity.</div>
+
+<code>// Creates a renderer with black background
+var renderer = new THREE.WebGLRenderer();
+renderer.setSize(200, 100);
+renderer.setClearColorHex(0x000000, 1);
+</code>
+
+<h3>.setClearColor( [page:Color color], [page:Float alpha] )</h3>
+<div>Sets the clear color, using color for the color and alpha for the opacity.</div>
+
+<h3>.getClearColor() [page:Color]</h3>
+<div>Returns a [page:Color THREE.Color] instance with the current clear color.</div>
+
+
+<h3>.getClearAlpha() [page:Float]</h3>
+<div>Returns a [page:Float float] with the current clear alpha. Ranges from 0 to 1.</div>
+
+<h3>.clear( [page:Boolean color], [page:Boolean depth], [page:Boolean stencil] )</h3>
+<div>Tells the renderer to clear its color, depth or stencil drawing buffer(s).</div>
+<div>If no parameters are passed, no buffer will be cleared.</div>
+
+
+<h3>.addPostPlugin( plugin )</h3>
+<div>Initialises the postprocessing plugin, and adds it to the renderPluginsPost array.</div>
+
+<h3>.addPrePlugin( plugin )</h3>
+<div>Initialises the preprocessing plugin, and adds it to the renderPluginsPre array.</div>
+
+<h3>.deallocateObject( [page:Object3D object] )</h3>
+<div>object — an instance of [page:Object3D]</div>
+<div>Removes an object from the GL context and releases all the data (geometry, matrices...) that the GL context keeps about the object, but it doesn't release textures or affect any JavaScript data.</div>
+
+<h3>.deallocateTexture( [page:??? texture] )</h3>
+<div>texture — an instance of [page:???] TODO</div>
+<div>Releases a texture from the GL context.</div>
+
+<h3>.deallocateRenderTarget( [page:WebGLRenderTarget renderTarget] )</h3>
+<div>renderTarget — an instance of [page:WebGLRenderTarget]</div>
+<div>Releases a render target from the GL context.</div>
+
+<h3>.updateShadowMap( [page:Scene scene], [page:Camera camera] )</h3>
+<div>scene — an instance of [page:Scene]<br />
+camera — an instance of [page:Camera]</div>
+<div>Tells the shadow map plugin to update using the passed scene and camera parameters.</div>
+
+
+<h3>.renderBufferImmediate( [page:Object3D object], [page:??? program], [page:??? shading] )</h3>
+<div>object — an instance of [page:Object3D]]<br />
+program — an instance of ???<br />
+shading — an instance of ???<br />
+</div>
+<div>TODO.</div>
+
+
+<h3>.renderBufferDirect(  camera, lights, fog, material, geometryGroup, object )</h3>
+<div>TODO.</div>
+
+
+<h3>.renderBuffer( camera, lights, fog, material, geometryGroup, object )</h3>
+<div>TODO.</div>
+
+
+<h3>.render( [page:Scene scene], [page:Camera camera], [page:WebGLRenderTarget renderTarget], [page:Boolean forceClear] )</h3>
+<div>Render a scene using a camera.</div>
+<div>The render is done to the renderTarget (if specified) or to the canvas as usual.</div>
+<div>If forceClear is true, the canvas will be cleared before rendering, even if the renderer's autoClear property is false.</div>
+
+
+<h3>.renderImmediateObject( camera, lights, fog, material, object )</h3>
+<div>TODO.</div>
+
+
+<h3>.initWebGLObjects( [page:Scene scene] )</h3>
+<div>TODO.</div>
+
+
+<h3>.initMaterial( material, lights, fog, object )</h3>
+<div>TODO.</div>
+
+
+<h3>.setFaceCulling( cullFace, frontFace )</h3>
+<div>
+[page:String cullFace] — "back", "front", "front_and_back", or false.<br />
+[page:String frontFace] — "ccw" or "cw<br />
+</div>
+<div>Used for setting the gl frontFace, cullFace states in the GPU, thus enabling/disabling face culling when rendering.</div>
+<div>If cullFace is false, culling will be disabled.</div>
+
+
+<h3>.setObjectFaces( object )</h3>
+<div>TODO.</div>
+
+
+<h3>.setDepthTest( depthTest )</h3>
+<div>TODO.</div>
+
+
+<h3>.setDepthWrite( depthWrite )</h3>
+<div>TODO.</div>
+
+
+<h3>.setBlending( blending, blendEquation, blendSrc, blendDst )</h3>
+<div>TODO.</div>
+
+
+<h3>.setTexture( texture, slot )</h3>
+<div>TODO.</div>
+
+
+<h3>.setRenderTarget( renderTarget )</h3>
+<div>TODO.</div>
+
+
 
 <h2>Source</h2>
 
-[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
+[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]

+ 1 - 1
examples/canvas_camera_orthographic.html

@@ -132,7 +132,7 @@
 
 			function render() {
 
-				var timer = new Date().getTime() * 0.0001;
+				var timer = Date.now() * 0.0001;
 
 				camera.position.x = Math.cos( timer ) * 200;
 				camera.position.z = Math.sin( timer ) * 200;

+ 1 - 1
examples/canvas_camera_orthographic2.html

@@ -209,7 +209,7 @@
 
 			function render() {
 
-				var timer = new Date().getTime() * 0.0001;
+				var timer = Date.now() * 0.0001;
 
 				camera.position.x = Math.cos( timer ) * 200;
 				camera.position.z = Math.sin( timer ) * 200;

+ 3 - 3
examples/canvas_geometry_hierarchy.html

@@ -108,9 +108,9 @@
 				camera.position.y += ( - mouseY - camera.position.y ) * .05;
 				camera.lookAt( scene.position );
 
-				group.rotation.x = Math.sin( new Date().getTime() * 0.0007 ) * 0.5;
-				group.rotation.y = Math.sin( new Date().getTime() * 0.0003 ) * 0.5;
-				group.rotation.z = Math.sin( new Date().getTime() * 0.0002 ) * 0.5;
+				group.rotation.x = Math.sin( Date.now() * 0.0007 ) * 0.5;
+				group.rotation.y = Math.sin( Date.now() * 0.0003 ) * 0.5;
+				group.rotation.z = Math.sin( Date.now() * 0.0002 ) * 0.5;
 
 				renderer.render( scene, camera );
 

+ 1 - 1
examples/canvas_lights_pointlights.html

@@ -120,7 +120,7 @@
 
 			function render() {
 
-				var time = new Date().getTime() * 0.0005;
+				var time = Date.now() * 0.0005;
 
 				if ( mesh ) mesh.rotation.y -= 0.01;
 

+ 1 - 1
examples/canvas_lights_pointlights_smooth.html

@@ -123,7 +123,7 @@
 
 			function render() {
 
-				var time = new Date().getTime() * 0.0005;
+				var time = Date.now() * 0.0005;
 
 				if ( mesh ) mesh.rotation.y -= 0.01;
 

+ 1 - 1
examples/canvas_materials.html

@@ -190,7 +190,7 @@
 
 			function render() {
 
-				var timer = new Date().getTime() * 0.0001;
+				var timer = Date.now() * 0.0001;
 
 				camera.position.x = Math.cos( timer ) * 1000;
 				camera.position.z = Math.sin( timer ) * 1000;

+ 1 - 1
examples/canvas_materials_normal.html

@@ -85,7 +85,7 @@
 
 			function render() {
 
-				var time = new Date().getTime() * 0.0005;
+				var time = Date.now() * 0.0005;
 
 				if ( mesh ) {
 

+ 1 - 1
examples/canvas_materials_reflection.html

@@ -89,7 +89,7 @@
 
 			function render() {
 
-				var time = new Date().getTime() * 0.0005;
+				var time = Date.now() * 0.0005;
 
 				if ( mesh ) mesh.rotation.y -= 0.01;
 

+ 1 - 2
examples/canvas_particles_waves.html

@@ -60,8 +60,7 @@
 
 						context.beginPath();
 						context.arc( 0, 0, 1, 0, PI2, true );
-						context.closePath();
-						context.stroke();
+						context.fill();
 
 					}
 

+ 1 - 1
examples/js/postprocessing/EffectComposer.js

@@ -126,7 +126,7 @@ THREE.EffectComposer.camera = new THREE.OrthographicCamera( window.innerWidth /
 // shared fullscreen quad scene
 
 THREE.EffectComposer.geometry = new THREE.PlaneGeometry( 1, 1 );
-THREE.EffectComposer.geometry.applyMatrix( new THREE.Matrix4().setRotationX( Math.PI / 2 ) );
+THREE.EffectComposer.geometry.applyMatrix( new THREE.Matrix4().makeRotationX( Math.PI / 2 ) );
 
 THREE.EffectComposer.quad = new THREE.Mesh( THREE.EffectComposer.geometry, null );
 THREE.EffectComposer.quad.position.z = -100;

+ 2 - 2
examples/models/monster.dae

@@ -1380,10 +1380,10 @@
               </texture>
             </diffuse>
             <specular>
-              <color>0.9 0.9 0.9 1</color>
+              <color>0.1 0.1 0.1 1</color>
             </specular>
             <shininess>
-              <float>0.415939</float>
+              <float>20</float>
             </shininess>
             <reflective>
               <color>0 0 0 1</color>

+ 1 - 0
examples/models/readme.txt

@@ -0,0 +1 @@
+Monster model from http://www.3drt.com/downloads.htm

BIN
examples/textures/2294472375_24a3b8ef46_o.jpg


BIN
examples/textures/lensflare/lensflare0_alpha.png


BIN
examples/textures/sprites/snowflake7_alpha.png


+ 4 - 4
examples/webgl_geometry_subdivison.html

@@ -185,10 +185,10 @@
 
 				info.innerHTML = 'Drag to spin THREE.' + params.type +
 
-				 	'<br/><br/>Subdivisions: '  + subdivisions +
+				 	'<br><br>Subdivisions: '  + subdivisions +
 					' <a href="#" onclick="nextSubdivision(1); return false;">more</a>/<a href="#" onclick="nextSubdivision(-1); return false;">less</a>' +
 					'<br>Geometry: ' + dropdown + ' <a href="#" onclick="nextGeometry();return false;">next</a>' +
-					'<br/><br>Vertices count: before ' + geometry.vertices.length + ' after ' + smooth.vertices.length +
+					'<br><br>Vertices count: before ' + geometry.vertices.length + ' after ' + smooth.vertices.length +
 					'<br>Face count: before ' + geometry.faces.length + ' after ' + smooth.faces.length
 				; //+ params.args;
 			}
@@ -214,7 +214,7 @@
 
 				if ( params.scale ) {
 
-					geometry.applyMatrix( new THREE.Matrix4().setScale( params.scale, params.scale, params.scale ) );
+					geometry.applyMatrix( new THREE.Matrix4().makeScale( params.scale, params.scale, params.scale ) );
 
 				}
 
@@ -362,7 +362,7 @@
 
 				addStuff();
 
-				renderer = new THREE.WebGLRenderer( { antialias: true, clearColor: 0xf0f0f0 } ); // WebGLRenderer CanvasRenderer
+				renderer = new THREE.WebGLRenderer( { antialias: true } ); // WebGLRenderer CanvasRenderer
 				renderer.setSize( window.innerWidth, window.innerHeight );
 
 				container.appendChild( renderer.domElement );

+ 1 - 1
examples/webgl_interactive_draggablecubes.html

@@ -91,7 +91,7 @@
 				}
 
 				plane = new THREE.Mesh( new THREE.PlaneGeometry( 2000, 2000, 8, 8 ), new THREE.MeshBasicMaterial( { color: 0x000000, opacity: 0.25, transparent: true, wireframe: true } ) );
-				plane.geometry.applyMatrix( new THREE.Matrix4().setRotationX( Math.PI / 2 ) );
+				plane.geometry.applyMatrix( new THREE.Matrix4().makeRotationX( Math.PI / 2 ) );
 				plane.lookAt( camera.position );
 				plane.visible = false;
 				scene.add( plane );

+ 18 - 0
examples/webgl_loader_collada.html

@@ -11,9 +11,27 @@
 				margin: 0px;
 				overflow: hidden;
 			}
+
+			#info {
+				color: #fff;
+				position: absolute;
+				top: 10px;
+				width: 100%;
+				text-align: center;
+				z-index: 100;
+				display:block;
+
+			}
+
+			a { color: skyblue }
 		</style>
 	</head>
 	<body>
+		<div id="info">
+			<a href="http://github.com/mrdoob/three.js" target="_blank">three.js</a> -
+			monster by <a href="http://www.3drt.com/downloads.htm" target="_blank">3drt</a>
+		</div>
+
 		<script src="../build/Three.js"></script>
 
 		<script src="js/Detector.js"></script>

+ 18 - 0
examples/webgl_loader_json_blender.html

@@ -11,9 +11,27 @@
 				margin: 0px;
 				overflow: hidden;
 			}
+
+			#info {
+				color: #fff;
+				position: absolute;
+				top: 10px;
+				width: 100%;
+				text-align: center;
+				z-index: 100;
+				display:block;
+
+			}
+
+			a { color: red }
 		</style>
 	</head>
 	<body>
+		<div id="info">
+			<a href="http://github.com/mrdoob/three.js" target="_blank">three.js</a> -
+			monster by <a href="http://www.3drt.com/downloads.htm" target="_blank">3drt</a>
+		</div>
+
 		<script src="../build/Three.js"></script>
 
 		<script src="js/Detector.js"></script>

+ 181 - 0
examples/webgl_materials_blending.html

@@ -0,0 +1,181 @@
+<!doctype html>
+<html lang="en">
+	<head>
+		<title>three.js webgl - materials - blending</title>
+		<meta charset="utf-8">
+		<style>
+			body {
+				margin: 0px;
+				background-color: #000000;
+				overflow: hidden;
+			}
+		</style>
+	</head>
+	<body>
+
+		<script src="../build/Three.js"></script>
+		<script src="js/Detector.js"></script>
+
+		<script>
+
+			if ( ! Detector.webgl ) Detector.addGetWebGLMessage();
+
+			var camera, scene, renderer;
+			var mesh;
+
+			init();
+			animate();
+
+			function init() {
+
+				// SCENE
+
+				scene = new THREE.Scene();
+
+				// CAMERA
+
+				camera = new THREE.PerspectiveCamera( 70, window.innerWidth / window.innerHeight, 1, 1000 );
+				camera.position.z = 600;
+				scene.add( camera );
+
+				// BACKGROUND
+
+				var x = document.createElement( "canvas" );
+				var xc = x.getContext( "2d" );
+				x.width = x.height = 128;
+				xc.fillStyle = "#ddd";
+				xc.fillRect( 0, 0, 128, 128 );
+				xc.fillStyle = "#555";
+				xc.fillRect( 0, 0, 64, 64 );
+				xc.fillStyle = "#999";
+				xc.fillRect( 32, 32, 32, 32 );
+				xc.fillStyle = "#555";
+				xc.fillRect( 64, 64, 64, 64 );
+				xc.fillStyle = "#777";
+				xc.fillRect( 96, 96, 32, 32 );
+
+				var mapBg = new THREE.Texture( x );
+				mapBg.wrapS = mapBg.wrapT = THREE.RepeatWrapping;
+				mapBg.repeat.set( 128, 64 );
+				mapBg.needsUpdate = true;
+
+				/*
+				var mapBg = THREE.ImageUtils.loadTexture( "textures/disturb.jpg" );
+				mapBg.wrapS = mapBg.wrapT = THREE.RepeatWrapping;
+				mapBg.repeat.set( 8, 4 );
+				*/
+
+				var materialBg = new THREE.MeshBasicMaterial( { map: mapBg } );
+
+				var meshBg = new THREE.Mesh( new THREE.PlaneGeometry( 4000, 2000 ), materialBg );
+				meshBg.position.set( 0, 0, -1 );
+				meshBg.rotation.x = Math.PI / 2;
+				scene.add( meshBg );
+
+				// OBJECTS
+
+				var blendings = [ "NoBlending", "NormalBlending", "AdditiveBlending", "SubtractiveBlending", "MultiplyBlending", "AdditiveAlphaBlending" ];
+
+				var map0 = THREE.ImageUtils.loadTexture( 'textures/ash_uvgrid01.jpg' );
+				var map1 = THREE.ImageUtils.loadTexture( 'textures/sprite0.jpg' );
+				var map2 = THREE.ImageUtils.loadTexture( 'textures/sprite0.png' );
+				var map3 = THREE.ImageUtils.loadTexture( 'textures/lensflare/lensflare0.png' );
+				var map4 = THREE.ImageUtils.loadTexture( 'textures/lensflare/lensflare0_alpha.png' );
+
+				var geo1 = new THREE.PlaneGeometry( 100, 100 );
+				var geo2 = new THREE.PlaneGeometry( 100, 25 );
+
+				addImageRow( map0, 300 );
+				addImageRow( map1, 150 );
+				addImageRow( map2, 0 );
+				addImageRow( map3, -150 );
+				addImageRow( map4, -300 );
+
+				function addImageRow( map, y ) {
+
+					for ( var i = 0; i < blendings.length; i ++ ) {
+
+						var blending = blendings[ i ];
+
+						var material = new THREE.MeshBasicMaterial( { map: map } );
+						material.transparent = true;
+						material.blending = THREE[ blending ];
+
+						var x = ( i - blendings.length / 2 ) * 110;
+						var z = 0;
+
+						var mesh = new THREE.Mesh( geo1, material );
+						mesh.position.set( x, y, z );
+						mesh.rotation.x = Math.PI / 2;
+						scene.add( mesh );
+
+
+						var mesh = new THREE.Mesh( geo2, generateLabelMaterial( blending.replace( "Blending", "" ) ) );
+						mesh.position.set( x, y - 75, z );
+						mesh.rotation.x = Math.PI / 2;
+						scene.add( mesh );
+
+					}
+
+				}
+
+				// RENDERER
+
+				renderer = new THREE.WebGLRenderer( { clearColor: 0x000000, clearAlpha: 1 } );
+				renderer.setSize( window.innerWidth, window.innerHeight );
+				document.body.appendChild( renderer.domElement );
+
+				// EVENTS
+
+				window.addEventListener( 'resize', onWindowResize, false );
+
+			}
+
+			//
+
+			function onWindowResize( event ) {
+
+				var SCREEN_WIDTH = window.innerWidth;
+				var SCREEN_HEIGHT = window.innerHeight;
+
+				renderer.setSize( SCREEN_WIDTH, SCREEN_HEIGHT );
+
+				camera.aspect = SCREEN_WIDTH / SCREEN_HEIGHT;
+				camera.updateProjectionMatrix();
+
+			}
+
+
+			function generateLabelMaterial( text ) {
+
+				var x = document.createElement( "canvas" );
+				var xc = x.getContext( "2d" );
+				x.width = 128;
+				x.height = 32;
+
+				xc.fillStyle = "rgba( 0, 0, 0, 0.95 )";
+				xc.fillRect( 0, 0, 128, 32 );
+
+				xc.fillStyle = "white";
+				xc.font = "12pt arial bold";
+				xc.fillText( text, 10, 22 );
+
+				var map = new THREE.Texture( x );
+				map.needsUpdate = true;
+
+				var material = new THREE.MeshBasicMaterial( { map: map, transparent: true } );
+				return material;
+
+			}
+
+			function animate() {
+
+				requestAnimationFrame( animate );
+				renderer.render( scene, camera );
+
+			}
+
+		</script>
+
+	</body>
+</html>

+ 455 - 0
examples/webgl_materials_blending_custom.html

@@ -0,0 +1,455 @@
+<!doctype html>
+<html lang="en">
+	<head>
+		<title>three.js webgl - materials - custom blending</title>
+		<meta charset="utf-8">
+		<style>
+			body {
+				margin: 0px;
+				background-color: #111;
+				overflow: hidden;
+				font-family: arial;
+			}
+
+			.menu { color: #fff; font-weight: bold; font-size: 12px; z-index: 100; width: 75px; position: absolute; top: 0px; padding: 16px; }
+			.menu img, .menu canvas { width: 75px; margin: 10px 0 }
+
+			#images { background: rgba(0,0,0,0); left: 0px; }
+			#backgrounds { background: rgba(0,0,0,0.0); left: 107px; }
+			#labels { background: rgba(0,0,0,0.75); left: 214px; width: 100px }
+
+			.lbl { color: #fff; z-index: 150; float:left; padding: 0.25em; width: 75px; display: block  }
+			#lbl_dst { background:#800; }
+			#lbl_src { background:green; }
+
+			.btn { background: darkorange; width: 100px; cursor: pointer }
+
+			#btn_sub { background: transparent }
+			#btn_rsub { background: transparent }
+
+			#btn_pre { background: transparent }
+
+			#btn_rsub, #btn_nopre { margin-bottom: 2em }
+		</style>
+	</head>
+	<body>
+
+		<div id="images" class="menu">
+			Foreground
+			<a id="img_0" href="#"><img src="textures/disturb.jpg" /></a>
+			<a id="img_1" href="#"><img src="textures/sprite0.jpg" /></a>
+			<a id="img_2" href="#"><img src="textures/sprite0.png" /></a>
+			<a id="img_3" href="#"><img src="textures/lensflare/lensflare0.png" /></a>
+			<a id="img_4" href="#"><img src="textures/lensflare/lensflare0_alpha.png" /></a>
+			<a id="img_5" href="#"><img src="textures/sprites/ball.png" /></a>
+			<a id="img_6" href="#"><img src="textures/sprites/snowflake7_alpha.png" /></a>
+		</div>
+
+		<div id="backgrounds" class="menu">
+			Background
+			<a id="bg_0" href="#"><img src="textures/disturb.jpg" /></a>
+			<a id="bg_1" href="#"></a>
+			<a id="bg_2" href="#"></a>
+			<a id="bg_3" href="#"><img src="textures/crate.gif" /></a>
+			<a id="bg_4" href="#"><img src="textures/lava/lavatile.jpg" /></a>
+			<a id="bg_5" href="#"><img src="textures/water.jpg" /></a>
+			<a id="bg_6" href="#"><img src="textures/lava/cloud.png" /></a>
+		</div>
+
+		<div id="labels" class="menu">
+			Equation<br/><br/>
+			<div class="lbl btn" id="btn_add">Add</div>
+			<div class="lbl btn" id="btn_sub">Subtract</div>
+			<div class="lbl btn" id="btn_rsub">ReverseSubtract</div>
+
+			Premultiply alpha<br/><br/>
+			<div class="lbl btn" id="btn_pre">On</div>
+			<div class="lbl btn" id="btn_nopre">Off</div>
+
+			Labels<br/><br/>
+			<div class="lbl" id="lbl_src">Source</div>
+			<div class="lbl" id="lbl_dst">Destination</div>
+		</div>
+
+		<script src="../build/Three.js"></script>
+		<script src="js/Detector.js"></script>
+
+		<script>
+
+			if ( ! Detector.webgl ) Detector.addGetWebGLMessage();
+
+			var SCREEN_WIDTH = window.innerWidth - 215;
+			var SCREEN_HEIGHT = window.innerHeight;
+
+			var camera, scene, renderer;
+
+			var materialBg;
+			var materials = [];
+
+			var mapsPre = [];
+			var mapsNoPre = [];
+
+			var currentMaps = mapsNoPre;
+			var currentIndex = 4;
+
+			init();
+			animate();
+
+			function init() {
+
+				// SCENE
+
+				scene = new THREE.Scene();
+
+				// CAMERA
+
+				camera = new THREE.PerspectiveCamera( 70, SCREEN_WIDTH / SCREEN_HEIGHT, 1, 1000 );
+				camera.position.z = 700;
+				scene.add( camera );
+
+				// BACKGROUND IMAGES
+
+				var x = document.createElement( "canvas" );
+				var xc = x.getContext( "2d" );
+				x.width = x.height = 128;
+				xc.fillStyle = "#eee";
+				xc.fillRect( 0, 0, 128, 128 );
+				xc.fillStyle = "#999";
+				xc.fillRect( 0, 0, 64, 64 );
+				xc.fillStyle = "#aaa";
+				xc.fillRect( 32, 32, 32, 32 );
+				xc.fillStyle = "#999";
+				xc.fillRect( 64, 64, 64, 64 );
+				xc.fillStyle = "#bbb";
+				xc.fillRect( 96, 96, 32, 32 );
+
+				document.getElementById("bg_1").appendChild( x );
+
+				var x2 = document.createElement( "canvas" );
+				var xc2 = x2.getContext( "2d" );
+				x2.width = x2.height = 128;
+				xc2.fillStyle = "#444";
+				xc2.fillRect( 0, 0, 128, 128 );
+				xc2.fillStyle = "#000";
+				xc2.fillRect( 0, 0, 64, 64 );
+				xc2.fillStyle = "#111";
+				xc2.fillRect( 32, 32, 32, 32 );
+				xc2.fillStyle = "#000";
+				xc2.fillRect( 64, 64, 64, 64 );
+				xc2.fillStyle = "#222";
+				xc2.fillRect( 96, 96, 32, 32 );
+
+				document.getElementById("bg_1").appendChild( x );
+				document.getElementById("bg_2").appendChild( x2 );
+
+				var mapBg0 = new THREE.Texture( x );
+				mapBg0.wrapS = mapBg0.wrapT = THREE.RepeatWrapping;
+				mapBg0.repeat.set( 128, 64 );
+				mapBg0.needsUpdate = true;
+
+				var mapBg1 = new THREE.Texture( x2 );
+				mapBg1.wrapS = mapBg1.wrapT = THREE.RepeatWrapping;
+				mapBg1.repeat.set( 128, 64 );
+				mapBg1.needsUpdate = true;
+
+				var mapBg2 = THREE.ImageUtils.loadTexture( "textures/disturb.jpg" );
+				mapBg2.wrapS = mapBg2.wrapT = THREE.RepeatWrapping;
+				mapBg2.repeat.set( 8, 4 );
+
+				var mapBg3 = THREE.ImageUtils.loadTexture( "textures/crate.gif" );
+				mapBg3.wrapS = mapBg3.wrapT = THREE.RepeatWrapping;
+				mapBg3.repeat.set( 32, 16 );
+
+				var mapBg4 = THREE.ImageUtils.loadTexture( "textures/lava/lavatile.jpg" );
+				mapBg4.wrapS = mapBg4.wrapT = THREE.RepeatWrapping;
+				mapBg4.repeat.set( 8, 4 );
+
+				var mapBg5 = THREE.ImageUtils.loadTexture( "textures/water.jpg" );
+				mapBg5.wrapS = mapBg5.wrapT = THREE.RepeatWrapping;
+				mapBg5.repeat.set( 8, 4 );
+
+				var mapBg6 = THREE.ImageUtils.loadTexture( "textures/lava/cloud.png" );
+				mapBg6.wrapS = mapBg6.wrapT = THREE.RepeatWrapping;
+				mapBg6.repeat.set( 2, 1 );
+
+				// BACKGROUND
+
+				materialBg = new THREE.MeshBasicMaterial( { map: mapBg1 } );
+
+				var meshBg = new THREE.Mesh( new THREE.PlaneGeometry( 4000, 2000 ), materialBg );
+				meshBg.position.set( 0, 0, -1 );
+				meshBg.rotation.x = Math.PI / 2;
+				scene.add( meshBg );
+
+				// FOREGROUND IMAGES
+
+				var images = [ 'textures/disturb.jpg',
+							   'textures/sprite0.jpg',
+							   'textures/sprite0.png',
+							   'textures/lensflare/lensflare0.png',
+							   'textures/lensflare/lensflare0_alpha.png',
+							   'textures/sprites/ball.png',
+							   'textures/sprites/snowflake7_alpha.png' ];
+
+				for ( var i = 0; i < images.length; i ++ ) {
+
+					var map = THREE.ImageUtils.loadTexture( images[ i ] );
+
+					var mapPre = map.clone();
+
+					mapPre.premultiplyAlpha = true;
+					mapPre.needsUpdate = true;
+
+					mapsNoPre.push( map );
+					mapsPre.push( mapPre );
+
+				}
+
+				// FOREGROUND OBJECTS
+
+				var blendings = [ "NoBlending", "NormalBlending", "AdditiveBlending", "SubtractiveBlending", "MultiplyBlending", "AdditiveAlphaBlending" ];
+
+				var src = [ "ZeroFactor", "OneFactor", "SrcAlphaFactor", "OneMinusSrcAlphaFactor", "DstAlphaFactor", "OneMinusDstAlphaFactor", "DstColorFactor", "OneMinusDstColorFactor", "SrcAlphaSaturateFactor" ];
+				var dst = [ "ZeroFactor", "OneFactor", "SrcColorFactor", "OneMinusSrcColorFactor", "SrcAlphaFactor", "OneMinusSrcAlphaFactor", "DstAlphaFactor", "OneMinusDstAlphaFactor" ];
+
+				var geo1 = new THREE.PlaneGeometry( 100, 100 );
+				var geo2 = new THREE.PlaneGeometry( 100, 25 );
+
+				var blending = "CustomBlending";
+
+				for ( var i = 0; i < dst.length; i ++ ) {
+
+					var blendDst = dst[ i ];
+
+					for ( var j = 0; j < src.length; j ++ ) {
+
+						var blendSrc = src[ j ];
+
+						var material = new THREE.MeshBasicMaterial( { map: currentMaps[ currentIndex ] } );
+						material.transparent = true;
+
+						material.blending = THREE[ blending ];
+						material.blendSrc = THREE[ blendSrc ];
+						material.blendDst = THREE[ blendDst ];
+						material.blendEquation = THREE.AddEquation;
+
+						var x = ( j - src.length / 2 ) * 110;
+						var z = 0;
+						var y = ( i - dst.length / 2 ) * 110 + 50;
+
+						var mesh = new THREE.Mesh( geo1, material );
+						mesh.position.set( x, y, z );
+						mesh.rotation.x = Math.PI / 2;
+						mesh.matrixAutoUpdate = false;
+						mesh.updateMatrix();
+						scene.add( mesh );
+
+						materials.push( material );
+
+					}
+
+				}
+
+				for ( var j = 0; j < src.length; j ++ ) {
+
+					var blendSrc = src[ j ];
+
+					var x = ( j - src.length / 2 ) * 110;
+					var z = 0;
+					var y = ( 0 - dst.length / 2 ) * 110 + 50;
+
+					var mesh = new THREE.Mesh( geo2, generateLabelMaterial( blendSrc.replace( "Factor", "" ), "rgba( 0, 150, 0, 1 )" ) );
+					mesh.position.set( x, - (y - 70), z );
+					mesh.rotation.x = Math.PI / 2;
+					mesh.matrixAutoUpdate = false;
+					mesh.updateMatrix();
+					scene.add( mesh );
+
+				}
+
+				for ( var i = 0; i < dst.length; i ++ ) {
+
+					var blendDst = dst[ i ];
+
+					var x = ( 0 - src.length / 2 ) * 110 - 125;
+					var z = 0;
+					var y = ( i - dst.length / 2 ) * 110 + 165;
+
+					var mesh = new THREE.Mesh( geo2, generateLabelMaterial( blendDst.replace( "Factor", "" ), "rgba( 150, 0, 0, 1 )" ) );
+					mesh.position.set( x, - (y - 70), z );
+					mesh.rotation.x = Math.PI / 2;
+					mesh.matrixAutoUpdate = false;
+					mesh.updateMatrix();
+					scene.add( mesh );
+
+				}
+
+				// RENDERER
+
+				renderer = new THREE.WebGLRenderer( { clearColor: 0x000000, clearAlpha: 1 } );
+				renderer.setSize( SCREEN_WIDTH, SCREEN_HEIGHT );
+
+				renderer.domElement.style.position = "absolute";
+				renderer.domElement.style.left = "215px";
+
+				document.body.appendChild( renderer.domElement );
+
+				// EVENTS
+
+				window.addEventListener( 'resize', onWindowResize, false );
+
+				addImgHandler( "img_0", 0 );
+				addImgHandler( "img_1", 1 );
+				addImgHandler( "img_2", 2 );
+				addImgHandler( "img_3", 3 );
+				addImgHandler( "img_4", 4 );
+				addImgHandler( "img_5", 5 );
+				addImgHandler( "img_6", 6 );
+
+				addBgHandler( "bg_0", mapBg2 );
+				addBgHandler( "bg_1", mapBg0 );
+				addBgHandler( "bg_2", mapBg1 );
+				addBgHandler( "bg_3", mapBg3 );
+				addBgHandler( "bg_4", mapBg4 );
+				addBgHandler( "bg_5", mapBg5 );
+				addBgHandler( "bg_6", mapBg6 );
+
+				addEqHandler( "btn_add", THREE.AddEquation );
+				addEqHandler( "btn_sub", THREE.SubtractEquation );
+				addEqHandler( "btn_rsub", THREE.ReverseSubtractEquation );
+
+				addPreHandler( "btn_pre", mapsPre );
+				addPreHandler( "btn_nopre", mapsNoPre );
+
+			}
+
+			//
+
+			function addImgHandler( id, index ) {
+
+				var el = document.getElementById( id );
+
+				el.addEventListener( 'click', function () {
+
+					for ( var i = 0; i < materials.length; i ++ ) {
+
+						materials[ i ].map = currentMaps[ index ];
+
+					}
+
+					currentIndex = index;
+
+				} );
+
+			}
+
+			function addEqHandler( id, eq ) {
+
+				var el = document.getElementById( id );
+
+				el.addEventListener( 'click', function () {
+
+					for ( var i = 0; i < materials.length; i ++ ) {
+
+						materials[ i ].blendEquation = eq;
+
+					}
+
+					document.getElementById( "btn_add" ).style.backgroundColor = "transparent";
+					document.getElementById( "btn_sub" ).style.backgroundColor = "transparent";
+					document.getElementById( "btn_rsub" ).style.backgroundColor = "transparent";
+
+					el.style.backgroundColor = "darkorange";
+
+				});
+
+			}
+
+			function addBgHandler( id, map ) {
+
+				var el = document.getElementById( id );
+				el.addEventListener( 'click', function () { materialBg.map = map; }	);
+
+			}
+
+			function addPreHandler( id, marray ) {
+
+				var el = document.getElementById( id );
+				el.addEventListener( 'click', function () {
+
+					currentMaps = marray;
+
+					for ( var i = 0; i < materials.length; i ++ ) {
+
+						materials[ i ].map = currentMaps[ currentIndex ];
+
+					}
+
+					document.getElementById( "btn_pre" ).style.backgroundColor = "transparent";
+					document.getElementById( "btn_nopre" ).style.backgroundColor = "transparent";
+
+					el.style.backgroundColor = "darkorange";
+
+				} );
+
+			}
+
+			//
+
+			function onWindowResize( event ) {
+
+				SCREEN_WIDTH = window.innerWidth;
+				SCREEN_HEIGHT = window.innerHeight;
+
+				renderer.setSize( SCREEN_WIDTH, SCREEN_HEIGHT );
+
+				camera.aspect = SCREEN_WIDTH / SCREEN_HEIGHT;
+				camera.updateProjectionMatrix();
+
+			}
+
+			//
+
+			function generateLabelMaterial( text, bg ) {
+
+				var x = document.createElement( "canvas" );
+				var xc = x.getContext( "2d" );
+				x.width = 128;
+				x.height = 32;
+
+				xc.fillStyle = bg;
+				xc.fillRect( 0, 0, 128, 32 );
+
+				//xc.shadowColor = "#000";
+				//xc.shadowBlur = 3;
+				xc.fillStyle = "white";
+				xc.font = "10pt arial bold";
+				xc.fillText( text, 8, 22 );
+
+				var map = new THREE.Texture( x );
+				map.needsUpdate = true;
+
+				var material = new THREE.MeshBasicMaterial( { map: map, transparent: true } );
+				return material;
+
+			}
+
+			function animate() {
+
+				requestAnimationFrame( animate );
+
+				var time = Date.now() * 0.00025;
+				var ox = ( time * -0.01 * materialBg.map.repeat.x ) % 1;
+				var oy = ( time * -0.01 * materialBg.map.repeat.y ) % 1;
+				//var oy = Math.sin( 0.75 * time ) * 0.01 * materialBg.map.repeat.y;
+
+				materialBg.map.offset.set( ox, oy );
+
+				renderer.render( scene, camera );
+
+			}
+
+		</script>
+
+	</body>
+</html>

+ 2 - 4
examples/webgl_materials_cubemap_dynamic.html

@@ -81,8 +81,6 @@
 
 			var SHADOW_MAP_WIDTH = 1024, SHADOW_MAP_HEIGHT = 1024;
 
-			var CUBE_HEIGHT = 0;
-
 			var container, stats;
 
 			var camera, cameraTarget, scene, renderer;
@@ -217,7 +215,7 @@
 
 				// CUBE CAMERA
 
-				cubeCamera = new THREE.CubeCamera( 1, 100000, CUBE_HEIGHT, 128 );
+				cubeCamera = new THREE.CubeCamera( 1, 100000, 128 );
 
 				// MATERIALS
 
@@ -992,7 +990,7 @@
 					veyron.setVisible( false );
 					gallardo.setVisible( false );
 
-					cubeCamera.updatePosition( currentCar.root.position );
+					cubeCamera.position.copy( currentCar.root.position );
 
 					renderer.autoUpdateObjects = false;
 					renderer.initWebGLObjects( scene );

+ 217 - 0
examples/webgl_materials_cubemap_dynamic2.html

@@ -0,0 +1,217 @@
+<!doctype html>
+<html lang="en">
+	<head>
+		<title>three.js webgl - materials - dynamic cube reflection</title>
+		<meta charset="utf-8">
+		<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
+		<style>
+			body {
+				background-color: #000000;
+				margin: 0px;
+				overflow: hidden;
+			}
+			
+			#info {
+				position: absolute;
+				top: 0px; width: 100%;
+				color: #ffffff;
+				padding: 5px;
+				font-family:Monospace;
+				font-size:13px;
+				font-weight: bold;
+				text-align:center;
+			}
+
+			a {
+				color: #ffffff;
+			}
+		</style>
+	</head>
+	<body>
+
+		<div id="info"><a href="http://github.com/mrdoob/three.js" target="_blank">three.js webgl</a> - materials - dynamic cube reflection<br/>Photo by <a href="http://www.flickr.com/photos/jonragnarsson/2294472375/" target="_blank">J&oacute;n Ragnarsson</a>.</div>
+
+		<script src="../build/Three.js"></script>
+
+		<script>
+
+			var camera, cubeCamera, scene, renderer;
+			var cube, sphere, torus;
+			
+			var fov = 70,
+			isUserInteracting = false,
+			onMouseDownMouseX = 0, onMouseDownMouseY = 0,
+			lon = 0, onMouseDownLon = 0,
+			lat = 0, onMouseDownLat = 0,
+			phi = 0, theta = 0;
+
+			var texture = THREE.ImageUtils.loadTexture( 'textures/2294472375_24a3b8ef46_o.jpg', new THREE.UVMapping(), function () {
+
+				init();
+				animate();
+
+			} );
+
+			function init() {
+
+				scene = new THREE.Scene();
+
+				camera = new THREE.PerspectiveCamera( fov, window.innerWidth / window.innerHeight, 1, 1000 );
+				camera.target = new THREE.Vector3( 0, 0, 0 );
+				scene.add( camera );
+
+				var mesh = new THREE.Mesh( new THREE.SphereGeometry( 500, 60, 40 ), new THREE.MeshBasicMaterial( { map: texture } ) );
+				mesh.scale.x = -1;
+				scene.add( mesh );
+
+				renderer = new THREE.WebGLRenderer( { antialias: true } );
+				renderer.setSize( window.innerWidth, window.innerHeight );
+
+				cubeCamera = new THREE.CubeCamera( 1, 1000, 256 );
+				cubeCamera.renderTarget.minFilter = THREE.LinearMipMapLinearFilter;
+
+				document.body.appendChild( renderer.domElement );
+
+				//
+
+				var material = new THREE.MeshBasicMaterial( { envMap: cubeCamera.renderTarget } );
+				
+				sphere = new THREE.Mesh( new THREE.SphereGeometry( 20, 60, 40 ), material );
+				scene.add( sphere );
+
+				cube = new THREE.Mesh( new THREE.CubeGeometry( 20, 20, 20 ), material );
+				scene.add( cube );
+
+				torus = new THREE.Mesh( new THREE.TorusKnotGeometry( 20, 5, 100, 100 ), material );
+				scene.add( torus );
+
+				//
+
+				document.addEventListener( 'mousedown', onDocumentMouseDown, false );
+				document.addEventListener( 'mousewheel', onDocumentMouseWheel, false );
+				document.addEventListener( 'DOMMouseScroll', onDocumentMouseWheel, false);
+				window.addEventListener( 'resize', onWindowResized, false );
+			
+				onWindowResized( null );
+
+			}
+			
+			function onWindowResized( event ) {
+
+				renderer.setSize( window.innerWidth, window.innerHeight );
+				camera.projectionMatrix.makePerspective( fov, window.innerWidth / window.innerHeight, 1, 1100 );
+			}
+
+			function onDocumentMouseDown( event ) {
+
+				event.preventDefault();
+
+				onPointerDownPointerX = event.clientX;
+				onPointerDownPointerY = event.clientY;
+
+				onPointerDownLon = lon;
+				onPointerDownLat = lat;
+
+				document.addEventListener( 'mousemove', onDocumentMouseMove, false );
+				document.addEventListener( 'mouseup', onDocumentMouseUp, false );
+
+			}
+
+			function onDocumentMouseMove( event ) {
+
+				lon = ( event.clientX - onPointerDownPointerX ) * 0.1 + onPointerDownLon;
+				lat = ( event.clientY - onPointerDownPointerY ) * 0.1 + onPointerDownLat;
+
+			}
+
+			function onDocumentMouseUp( event ) {
+
+				document.removeEventListener( 'mousemove', onDocumentMouseMove, false );
+				document.removeEventListener( 'mouseup', onDocumentMouseUp, false );
+
+			}
+
+			function onDocumentMouseWheel( event ) {
+
+				// WebKit
+
+				if ( event.wheelDeltaY ) {
+
+					fov -= event.wheelDeltaY * 0.05;
+
+				// Opera / Explorer 9
+
+				} else if ( event.wheelDelta ) {
+
+					fov -= event.wheelDelta * 0.05;
+
+				// Firefox
+
+				} else if ( event.detail ) {
+
+					fov += event.detail * 1.0;
+
+				}
+
+				camera.projectionMatrix.makePerspective( fov, window.innerWidth / window.innerHeight, 1, 1100 );
+				
+			}
+
+			function animate() {
+
+				requestAnimationFrame( animate );
+				render();
+
+			}
+
+			function render() {
+				
+				var time = Date.now();
+
+				lon += .15;
+
+				lat = Math.max( - 85, Math.min( 85, lat ) );
+				phi = ( 90 - lat ) * Math.PI / 180;
+				theta = lon * Math.PI / 180;
+
+				sphere.position.x = Math.sin( time * 0.001 ) * 30;
+				sphere.position.y = Math.sin( time * 0.0011 ) * 30;
+				sphere.position.z = Math.sin( time * 0.0012 ) * 30;
+
+				sphere.rotation.x += 0.02;
+				sphere.rotation.y += 0.03;
+
+				cube.position.x = Math.sin( time * 0.001 + 2 ) * 30;
+				cube.position.y = Math.sin( time * 0.0011 + 2 ) * 30;
+				cube.position.z = Math.sin( time * 0.0012 + 2 ) * 30;
+
+				cube.rotation.x += 0.02;
+				cube.rotation.y += 0.03;
+
+				torus.position.x = Math.sin( time * 0.001 + 4 ) * 30;
+				torus.position.y = Math.sin( time * 0.0011 + 4 ) * 30;
+				torus.position.z = Math.sin( time * 0.0012 + 4 ) * 30;
+
+				torus.rotation.x += 0.02;
+				torus.rotation.y += 0.03;
+
+				camera.position.x = 100 * Math.sin( phi ) * Math.cos( theta );
+				camera.position.y = 100 * Math.cos( phi );
+				camera.position.z = 100 * Math.sin( phi ) * Math.sin( theta );
+
+				camera.lookAt( camera.target );
+
+				sphere.visible = false; // *cough*
+
+				cubeCamera.updateCubeMap( renderer, scene );
+
+				sphere.visible = true; // *cough*
+
+				renderer.render( scene, camera );
+
+			}
+
+		</script>
+	
+	</body>
+</html>

+ 2 - 2
examples/webgl_materials_normalmap2.html

@@ -102,8 +102,8 @@
 
 				// CAMERA
 
-				camera = new THREE.PerspectiveCamera( 45, window.innerWidth / window.innerHeight, 1, 10000 );
-				camera.position.z = 900;
+				camera = new THREE.PerspectiveCamera( 27, window.innerWidth / window.innerHeight, 1, 10000 );
+				camera.position.z = 1200;
 				scene.add( camera );
 
 				// LIGHTS

+ 1 - 1
examples/webgl_panorama_equirectangular.html

@@ -130,7 +130,7 @@
 
 				}
 
-				camera.projectionMatrix = THREE.Matrix4.makePerspective( fov, window.innerWidth / window.innerHeight, 1, 1100 );
+				camera.projectionMatrix.makePerspective( fov, window.innerWidth / window.innerHeight, 1, 1100 );
 				render();
 
 			}

+ 2 - 2
examples/webgl_postprocessing_dof.html

@@ -106,7 +106,7 @@
 
 				var geo = new THREE.SphereGeometry( 1, 20, 10 );
 
-				var start = new Date().getTime();
+				var start = Date.now();
 
 				renderer.initMaterial( cubeMaterial, scene.__lights, scene.fog );
 
@@ -154,7 +154,7 @@
 
 				}
 
-				//console.log("init time: ", new Date().getTime() - start );
+				//console.log("init time: ", Date.now() - start );
 
 				scene.matrixAutoUpdate = false;
 

+ 2 - 2
examples/webgl_shader.html

@@ -126,10 +126,10 @@
 					vertexShader: document.getElementById( 'vertexShader' ).textContent,
 					fragmentShader: document.getElementById( 'fragmentShader' ).textContent
 
-					} );
+				} );
 
 				mesh = new THREE.Mesh( new THREE.PlaneGeometry( 2, 2 ), material );
-				mesh.geometry.applyMatrix( new THREE.Matrix4().setRotationX( Math.PI / 2 ) );
+				mesh.geometry.applyMatrix( new THREE.Matrix4().makeRotationX( Math.PI / 2 ) );
 				scene.add( mesh );
 
 				renderer = new THREE.WebGLRenderer();

+ 2 - 2
examples/webgl_shading_physical.html

@@ -135,7 +135,7 @@
 
 				// CUBE CAMERA
 
-				cubeCamera = new THREE.CubeCamera( 1, FAR, 0, 128 );
+				cubeCamera = new THREE.CubeCamera( 1, FAR, 128 );
 				var cubeTarget = cubeCamera.renderTarget;
 
 				// TEXTURES
@@ -578,7 +578,7 @@
 				mesh.visible = false;
 
 				renderer.autoClear = true;
-				cubeCamera.updatePosition( mesh.position );
+				cubeCamera.position.copy( mesh.position );
 				cubeCamera.updateCubeMap( renderer, scene );
 				renderer.autoClear = false;
 

+ 1 - 1
examples/webgl_terrain_dynamic.html

@@ -425,7 +425,7 @@
 				// TERRAIN MESH
 
 				var geometryTerrain = new THREE.PlaneGeometry( 6000, 6000, 256, 256 );
-				geometryTerrain.applyMatrix( new THREE.Matrix4().setRotationX( Math.PI / 2 ) );
+				geometryTerrain.applyMatrix( new THREE.Matrix4().makeRotationX( Math.PI / 2 ) );
 
 				geometryTerrain.computeFaceNormals();
 				geometryTerrain.computeVertexNormals();

+ 1 - 1
src/cameras/OrthographicCamera.js

@@ -23,6 +23,6 @@ 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 );
+	this.projectionMatrix.makeOrthographic( this.left, this.right, this.top, this.bottom, this.near, this.far );
 
 };

+ 4 - 3
src/cameras/PerspectiveCamera.js

@@ -99,17 +99,18 @@ THREE.PerspectiveCamera.prototype.updateProjectionMatrix = function () {
 		var width = Math.abs( right - left );
 		var height = Math.abs( top - bottom );
 
-		this.projectionMatrix = THREE.Matrix4.makeFrustum(
+		this.projectionMatrix.makeFrustum(
 			left + this.x * width / this.fullWidth,
 			left + ( this.x + this.width ) * width / this.fullWidth,
 			top - ( this.y + this.height ) * height / this.fullHeight,
 			top - this.y * height / this.fullHeight,
 			this.near,
-			this.far );
+			this.far
+		);
 
 	} else {
 
-		this.projectionMatrix = THREE.Matrix4.makePerspective( this.fov, this.aspect, this.near, this.far );
+		this.projectionMatrix.makePerspective( this.fov, this.aspect, this.near, this.far );
 
 	}
 

+ 1 - 1
src/core/Geometry.js

@@ -437,8 +437,8 @@ THREE.Geometry.prototype = {
 
 			} else if ( face instanceof THREE.Face4 ) {
 
-				handleTriangle( this, face.a, face.b, face.c, 0, 1, 2 );
 				handleTriangle( this, face.a, face.b, face.d, 0, 1, 3 );
+				handleTriangle( this, face.b, face.c, face.d, 1, 2, 3 );
 
 			}
 

+ 37 - 0
src/core/Matrix3.js

@@ -12,6 +12,43 @@ THREE.Matrix3.prototype = {
 
 	constructor: THREE.Matrix3,
 
+	getInverse: function ( matrix ) {
+
+		// input: THREE.Matrix4
+		// ( based on http://code.google.com/p/webgl-mjs/ )
+
+		var a11 =   matrix.n33 * matrix.n22 - matrix.n32 * matrix.n23;
+		var a21 = - matrix.n33 * matrix.n21 + matrix.n31 * matrix.n23;
+		var a31 =   matrix.n32 * matrix.n21 - matrix.n31 * matrix.n22;
+		var a12 = - matrix.n33 * matrix.n12 + matrix.n32 * matrix.n13;
+		var a22 =   matrix.n33 * matrix.n11 - matrix.n31 * matrix.n13;
+		var a32 = - matrix.n32 * matrix.n11 + matrix.n31 * matrix.n12;
+		var a13 =   matrix.n23 * matrix.n12 - matrix.n22 * matrix.n13;
+		var a23 = - matrix.n23 * matrix.n11 + matrix.n21 * matrix.n13;
+		var a33 =   matrix.n22 * matrix.n11 - matrix.n21 * matrix.n12;
+
+		var det = matrix.n11 * a11 + matrix.n21 * a12 + matrix.n31 * a13;
+
+		// no inverse
+
+		if ( det === 0 ) {
+
+			console.warn( "Matrix3.getInverse(): determinant == 0" );
+
+		}
+
+		var idet = 1.0 / det;
+
+		var m = this.m;
+
+		m[ 0 ] = idet * a11; m[ 1 ] = idet * a21; m[ 2 ] = idet * a31;
+		m[ 3 ] = idet * a12; m[ 4 ] = idet * a22; m[ 5 ] = idet * a32;
+		m[ 6 ] = idet * a13; m[ 7 ] = idet * a23; m[ 8 ] = idet * a33;
+
+		return this;
+
+	},
+
 	/*
 	transpose: function () {
 

+ 272 - 328
src/core/Matrix4.js

@@ -20,8 +20,6 @@ THREE.Matrix4 = function ( n11, n12, n13, n14, n21, n22, n23, n24, n31, n32, n33
 
 	);
 
-	this.m33 = new THREE.Matrix3();
-
 };
 
 THREE.Matrix4.prototype = {
@@ -71,7 +69,9 @@ THREE.Matrix4.prototype = {
 
 	lookAt: function ( eye, target, up ) {
 
-		var x = THREE.Matrix4.__v1, y = THREE.Matrix4.__v2, z = THREE.Matrix4.__v3;
+		var x = THREE.Matrix4.__v1;
+		var y = THREE.Matrix4.__v2;
+		var z = THREE.Matrix4.__v3;
 
 		z.sub( eye, target ).normalize();
 
@@ -103,15 +103,15 @@ THREE.Matrix4.prototype = {
 
 	multiply: function ( a, b ) {
 
-		var a11 = a.n11, a12 = a.n12, a13 = a.n13, a14 = a.n14,
-		a21 = a.n21, a22 = a.n22, a23 = a.n23, a24 = a.n24,
-		a31 = a.n31, a32 = a.n32, a33 = a.n33, a34 = a.n34,
-		a41 = a.n41, a42 = a.n42, a43 = a.n43, a44 = a.n44,
+		var a11 = a.n11, a12 = a.n12, a13 = a.n13, a14 = a.n14;
+		var a21 = a.n21, a22 = a.n22, a23 = a.n23, a24 = a.n24;
+		var a31 = a.n31, a32 = a.n32, a33 = a.n33, a34 = a.n34;
+		var a41 = a.n41, a42 = a.n42, a43 = a.n43, a44 = a.n44;
 
-		b11 = b.n11, b12 = b.n12, b13 = b.n13, b14 = b.n14,
-		b21 = b.n21, b22 = b.n22, b23 = b.n23, b24 = b.n24,
-		b31 = b.n31, b32 = b.n32, b33 = b.n33, b34 = b.n34,
-		b41 = b.n41, b42 = b.n42, b43 = b.n43, b44 = b.n44;
+		var b11 = b.n11, b12 = b.n12, b13 = b.n13, b14 = b.n14;
+		var b21 = b.n21, b22 = b.n22, b23 = b.n23, b24 = b.n24;
+		var b31 = b.n31, b32 = b.n32, b33 = b.n33, b34 = b.n34;
+		var b41 = b.n41, b42 = b.n42, b43 = b.n43, b44 = b.n44;
 
 		this.n11 = a11 * b11 + a12 * b21 + a13 * b31 + a14 * b41;
 		this.n12 = a11 * b12 + a12 * b22 + a13 * b32 + a14 * b42;
@@ -169,8 +169,8 @@ 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 );
+		var vx = v.x, vy = v.y, vz = v.z;
+		var 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;
@@ -223,13 +223,14 @@ THREE.Matrix4.prototype = {
 
 	determinant: function () {
 
-		var n11 = this.n11, n12 = this.n12, n13 = this.n13, n14 = this.n14,
-		n21 = this.n21, n22 = this.n22, n23 = this.n23, n24 = this.n24,
-		n31 = this.n31, n32 = this.n32, n33 = this.n33, n34 = this.n34,
-		n41 = this.n41, n42 = this.n42, n43 = this.n43, n44 = this.n44;
+		var n11 = this.n11, n12 = this.n12, n13 = this.n13, n14 = this.n14;
+		var n21 = this.n21, n22 = this.n22, n23 = this.n23, n24 = this.n24;
+		var n31 = this.n31, n32 = this.n32, n33 = this.n33, n34 = this.n34;
+		var n41 = this.n41, n42 = this.n42, n43 = this.n43, n44 = this.n44;
 
 		//TODO: make this more efficient
 		//( based on http://www.euclideanspace.com/maths/algebra/matrix/functions/inverse/fourD/index.htm )
+
 		return (
 			n14 * n23 * n32 * n41-
 			n13 * n24 * n32 * n41-
@@ -317,107 +318,9 @@ THREE.Matrix4.prototype = {
 
 	},
 
-	setTranslation: function( x, y, z ) {
-
-		this.set(
-
-			1, 0, 0, x,
-			0, 1, 0, y,
-			0, 0, 1, z,
-			0, 0, 0, 1
-
-		);
-
-		return this;
-
-	},
-
-	setScale: function ( x, y, z ) {
-
-		this.set(
-
-			x, 0, 0, 0,
-			0, y, 0, 0,
-			0, 0, z, 0,
-			0, 0, 0, 1
-
-		);
-
-		return this;
-
-	},
-
-	setRotationX: function ( theta ) {
-
-		var c = Math.cos( theta ), s = Math.sin( theta );
-
-		this.set(
-
-			1, 0,  0, 0,
-			0, c, -s, 0,
-			0, s,  c, 0,
-			0, 0,  0, 1
-
-		);
-
-		return this;
-
-	},
-
-	setRotationY: function( theta ) {
-
-		var c = Math.cos( theta ), s = Math.sin( theta );
-
-		this.set(
-
-			 c, 0, s, 0,
-			 0, 1, 0, 0,
-			-s, 0, c, 0,
-			 0, 0, 0, 1
-
-		);
-
-		return this;
-
-	},
-
-	setRotationZ: function( theta ) {
-
-		var c = Math.cos( theta ), s = Math.sin( theta );
-
-		this.set(
-
-			c, -s, 0, 0,
-			s,  c, 0, 0,
-			0,  0, 1, 0,
-			0,  0, 0, 1
-
-		);
-
-		return this;
-
-	},
-
-	setRotationAxis: function( axis, angle ) {
-
-		// Based on http://www.gamedev.net/reference/articles/article1199.asp
-
-		var c = Math.cos( angle ),
-		s = Math.sin( angle ),
-		t = 1 - c,
-		x = axis.x, y = axis.y, z = axis.z,
-		tx = t * x, ty = t * y;
-
-		this.set(
-
-		 	tx * x + c, tx * y - s * z, tx * z + s * y, 0,
-			tx * y + s * z, ty * y + c, ty * z - s * x, 0,
-			tx * z - s * y, ty * z + s * x, t * z * z + c, 0,
-			0, 0, 0, 1
-
-		);
+	getPosition: function () {
 
-		 return this;
+		return THREE.Matrix4.__v1.set( this.n14, this.n24, this.n34 );
 
 	},
 
@@ -431,12 +334,6 @@ THREE.Matrix4.prototype = {
 
 	},
 
-	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 );
@@ -459,10 +356,10 @@ THREE.Matrix4.prototype = {
 
 		// based on http://www.euclideanspace.com/maths/algebra/matrix/functions/inverse/fourD/index.htm
 
-		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;
+		var n11 = m.n11, n12 = m.n12, n13 = m.n13, n14 = m.n14;
+		var n21 = m.n21, n22 = m.n22, n23 = m.n23, n24 = m.n24;
+		var n31 = m.n31, n32 = m.n32, n33 = m.n33, n34 = m.n34;
+		var 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;
@@ -488,10 +385,10 @@ THREE.Matrix4.prototype = {
 
 	setRotationFromEuler: function( v, order ) {
 
-		var x = v.x, y = v.y, z = v.z,
-		a = Math.cos( x ), b = Math.sin( x ),
-		c = Math.cos( y ), d = Math.sin( y ),
-		e = Math.cos( z ), f = Math.sin( z );
+		var x = v.x, y = v.y, z = v.z;
+		var a = Math.cos( x ), b = Math.sin( x );
+		var c = Math.cos( y ), d = Math.sin( y );
+		var e = Math.cos( z ), f = Math.sin( z );
 
 		switch ( order ) {
 
@@ -606,11 +503,11 @@ THREE.Matrix4.prototype = {
 
 	setRotationFromQuaternion: function( q ) {
 
-		var x = q.x, y = q.y, z = q.z, w = q.w,
-		x2 = x + x, y2 = y + y, z2 = z + z,
-		xx = x * x2, xy = x * y2, xz = x * z2,
-		yy = y * y2, yz = y * z2, zz = z * z2,
-		wx = w * x2, wy = w * y2, wz = w * z2;
+		var x = q.x, y = q.y, z = q.z, w = q.w;
+		var x2 = x + x, y2 = y + y, z2 = z + z;
+		var xx = x * x2, xy = x * y2, xz = x * z2;
+		var yy = y * y2, yz = y * z2, zz = z * z2;
+		var wx = w * x2, wy = w * y2, wz = w * z2;
 
 		this.n11 = 1 - ( yy + zz );
 		this.n12 = xy - wz;
@@ -628,19 +525,6 @@ THREE.Matrix4.prototype = {
 
 	},
 
-	scale: function ( v ) {
-
-		var x = v.x, y = v.y, z = v.z;
-
-		this.n11 *= x; this.n12 *= y; this.n13 *= z;
-		this.n21 *= x; this.n22 *= y; this.n23 *= z;
-		this.n31 *= x; this.n32 *= y; this.n33 *= z;
-		this.n41 *= x; this.n42 *= y; this.n43 *= z;
-
-		return this;
-
-	},
-
 	compose: function ( translation, rotation, scale ) {
 
 		var mRotation = THREE.Matrix4.__m1;
@@ -649,7 +533,7 @@ THREE.Matrix4.prototype = {
 		mRotation.identity();
 		mRotation.setRotationFromQuaternion( rotation );
 
-		mScale.setScale( scale.x, scale.y, scale.z );
+		mScale.makeScale( scale.x, scale.y, scale.z );
 
 		this.multiply( mRotation, mScale );
 
@@ -743,6 +627,102 @@ THREE.Matrix4.prototype = {
 
 	},
 
+	//
+
+	translate: function ( v ) {
+
+		var x = v.x, y = v.y, z = v.z;
+
+		this.n14 = this.n11 * x + this.n12 * y + this.n13 * z + this.n14;
+		this.n24 = this.n21 * x + this.n22 * y + this.n23 * z + this.n24;
+		this.n34 = this.n31 * x + this.n32 * y + this.n33 * z + this.n34;
+		this.n44 = this.n41 * x + this.n42 * y + this.n43 * z + this.n44;
+
+		return this;
+
+	},
+
+	rotateX: function ( angle ) {
+
+		var m12 = this.n12;
+		var m22 = this.n22;
+		var m32 = this.n32;
+		var m42 = this.n42;
+		var m13 = this.n13;
+		var m23 = this.n23;
+		var m33 = this.n33;
+		var m43 = this.n43;
+		var c = Math.cos( angle );
+		var s = Math.sin( angle );
+
+		this.n12 = c * m12 + s * m13;
+		this.n22 = c * m22 + s * m23;
+		this.n32 = c * m32 + s * m33;
+		this.n42 = c * m42 + s * m43;
+
+		this.n13 = c * m13 - s * m12;
+		this.n23 = c * m23 - s * m22;
+		this.n33 = c * m33 - s * m32;
+		this.n43 = c * m43 - s * m42;
+
+		return this;
+
+  	},
+
+	rotateY: function ( angle ) {
+
+		var m11 = this.n11;
+		var m21 = this.n21;
+		var m31 = this.n31;
+		var m41 = this.n41;
+		var m13 = this.n13;
+		var m23 = this.n23;
+		var m33 = this.n33;
+		var m43 = this.n43;
+		var c = Math.cos( angle );
+		var s = Math.sin( angle );
+
+		this.n11 = c * m11 - s * m13;
+		this.n21 = c * m21 - s * m23;
+		this.n31 = c * m31 - s * m33;
+		this.n41 = c * m41 - s * m43;
+
+		this.n13 = c * m13 + s * m11;
+		this.n23 = c * m23 + s * m21;
+		this.n33 = c * m33 + s * m31;
+		this.n43 = c * m43 + s * m41;
+
+		return this;
+
+	},
+
+	rotateZ: function ( angle ) {
+
+		var m11 = this.n11;
+		var m21 = this.n21;
+		var m31 = this.n31;
+		var m41 = this.n41;
+		var m12 = this.n12;
+		var m22 = this.n22;
+		var m32 = this.n32;
+		var m42 = this.n42;
+		var c = Math.cos( angle );
+		var s = Math.sin( angle );
+
+		this.n11 = c * m11 + s * m12;
+		this.n21 = c * m21 + s * m22;
+		this.n31 = c * m31 + s * m32;
+		this.n41 = c * m41 + s * m42;
+
+		this.n12 = c * m12 - s * m11;
+		this.n22 = c * m22 - s * m21;
+		this.n32 = c * m32 - s * m31;
+		this.n42 = c * m42 - s * m41;
+
+		return this;
+
+	},
+
 	rotateByAxis: function ( axis, angle ) {
 
 		// optimize by checking axis
@@ -761,54 +741,38 @@ THREE.Matrix4.prototype = {
 
 		}
 
-		var x = axis.x,
-			y = axis.y,
-			z = axis.z,
-			n = Math.sqrt(x * x + y * y + z * z);
+		var x = axis.x, y = axis.y, z = axis.z;
+		var n = Math.sqrt(x * x + y * y + z * z);
 
 		x /= n;
 		y /= n;
 		z /= n;
 
-		var xx = x * x,
-			yy = y * y,
-			zz = z * z,
-			c = Math.cos( angle ),
-			s = Math.sin( angle ),
-			oneMinusCosine = 1 - c,
-			xy = x * y * oneMinusCosine,
-			xz = x * z * oneMinusCosine,
-			yz = y * z * oneMinusCosine,
-			xs = x * s,
-			ys = y * s,
-			zs = z * s,
-
-			r11 = xx + (1 - xx) * c,
-			r21 = xy + zs,
-			r31 = xz - ys,
-			r12 = xy - zs,
-			r22 = yy + (1 - yy) * c,
-			r32 = yz + xs,
-			r13 = xz + ys,
-			r23 = yz - xs,
-			r33 = zz + (1 - zz) * c,
-
-			m11 = this.n11,
-			m21 = this.n21,
-			m31 = this.n31,
-			m41 = this.n41,
-			m12 = this.n12,
-			m22 = this.n22,
-			m32 = this.n32,
-			m42 = this.n42,
-			m13 = this.n13,
-			m23 = this.n23,
-			m33 = this.n33,
-			m43 = this.n43,
-			m14 = this.n14,
-			m24 = this.n24,
-			m34 = this.n34,
-			m44 = this.n44;
+		var xx = x * x, yy = y * y, zz = z * z;
+		var c = Math.cos( angle );
+		var s = Math.sin( angle );
+		var oneMinusCosine = 1 - c;
+		var xy = x * y * oneMinusCosine;
+		var xz = x * z * oneMinusCosine;
+		var yz = y * z * oneMinusCosine;
+		var xs = x * s;
+		var ys = y * s;
+		var zs = z * s;
+
+		var r11 = xx + (1 - xx) * c;
+		var r21 = xy + zs;
+		var r31 = xz - ys;
+		var r12 = xy - zs;
+		var r22 = yy + (1 - yy) * c;
+		var r32 = yz + xs;
+		var r13 = xz + ys;
+		var r23 = yz - xs;
+		var r33 = zz + (1 - zz) * c;
+
+		var m11 = this.n11, m21 = this.n21, m31 = this.n31, m41 = this.n41;
+		var m12 = this.n12, m22 = this.n22, m32 = this.n32, m42 = this.n42;
+		var m13 = this.n13, m23 = this.n23, m33 = this.n33, m43 = this.n43;
+		var m14 = this.n14, m24 = this.n24, m34 = this.n34, m44 = this.n44;
 
 		this.n11 = r11 * m11 + r21 * m12 + r31 * m13;
 		this.n21 = r11 * m21 + r21 * m22 + r31 * m23;
@@ -829,207 +793,187 @@ THREE.Matrix4.prototype = {
 
 	},
 
-	rotateX: function ( angle ) {
-
-		var m12 = this.n12,
-			m22 = this.n22,
-			m32 = this.n32,
-			m42 = this.n42,
-			m13 = this.n13,
-			m23 = this.n23,
-			m33 = this.n33,
-			m43 = this.n43,
-			c = Math.cos( angle ),
-			s = Math.sin( angle );
+	scale: function ( v ) {
 
-		this.n12 = c * m12 + s * m13;
-		this.n22 = c * m22 + s * m23;
-		this.n32 = c * m32 + s * m33;
-		this.n42 = c * m42 + s * m43;
+		var x = v.x, y = v.y, z = v.z;
 
-		this.n13 = c * m13 - s * m12;
-		this.n23 = c * m23 - s * m22;
-		this.n33 = c * m33 - s * m32;
-		this.n43 = c * m43 - s * m42;
+		this.n11 *= x; this.n12 *= y; this.n13 *= z;
+		this.n21 *= x; this.n22 *= y; this.n23 *= z;
+		this.n31 *= x; this.n32 *= y; this.n33 *= z;
+		this.n41 *= x; this.n42 *= y; this.n43 *= z;
 
 		return this;
 
-  	},
+	},
 
-	rotateY: function ( angle ) {
+	//
 
-		var m11 = this.n11,
-			m21 = this.n21,
-			m31 = this.n31,
-			m41 = this.n41,
-			m13 = this.n13,
-			m23 = this.n23,
-			m33 = this.n33,
-			m43 = this.n43,
-			c = Math.cos(angle),
-			s = Math.sin(angle);
+	makeTranslation: function ( x, y, z ) {
 
-		this.n11 = c * m11 - s * m13;
-		this.n21 = c * m21 - s * m23;
-		this.n31 = c * m31 - s * m33;
-		this.n41 = c * m41 - s * m43;
+		this.set(
 
-		this.n13 = c * m13 + s * m11;
-		this.n23 = c * m23 + s * m21;
-		this.n33 = c * m33 + s * m31;
-		this.n43 = c * m43 + s * m41;
+			1, 0, 0, x,
+			0, 1, 0, y,
+			0, 0, 1, z,
+			0, 0, 0, 1
+
+		);
 
 		return this;
 
 	},
 
-	rotateZ: function ( angle ) {
+	makeRotationX: function ( theta ) {
 
-		var m11 = this.n11,
-			m21 = this.n21,
-			m31 = this.n31,
-			m41 = this.n41,
-			m12 = this.n12,
-			m22 = this.n22,
-			m32 = this.n32,
-			m42 = this.n42,
-			c = Math.cos(angle),
-			s = Math.sin(angle);
+		var c = Math.cos( theta ), s = Math.sin( theta );
 
-		this.n11 = c * m11 + s * m12;
-		this.n21 = c * m21 + s * m22;
-		this.n31 = c * m31 + s * m32;
-		this.n41 = c * m41 + s * m42;
+		this.set(
 
-		this.n12 = c * m12 - s * m11;
-		this.n22 = c * m22 - s * m21;
-		this.n32 = c * m32 - s * m31;
-		this.n42 = c * m42 - s * m41;
+			1, 0,  0, 0,
+			0, c, -s, 0,
+			0, s,  c, 0,
+			0, 0,  0, 1
+
+		);
 
 		return this;
 
 	},
 
-	translate: function ( v ) {
+	makeRotationY: function ( theta ) {
 
-		var x = v.x, y = v.y, z = v.z;
+		var c = Math.cos( theta ), s = Math.sin( theta );
 
-		this.n14 = this.n11 * x + this.n12 * y + this.n13 * z + this.n14;
-		this.n24 = this.n21 * x + this.n22 * y + this.n23 * z + this.n24;
-		this.n34 = this.n31 * x + this.n32 * y + this.n33 * z + this.n34;
-		this.n44 = this.n41 * x + this.n42 * y + this.n43 * z + this.n44;
+		this.set(
+
+			 c, 0, s, 0,
+			 0, 1, 0, 0,
+			-s, 0, c, 0,
+			 0, 0, 0, 1
+
+		);
 
 		return this;
 
 	},
 
-	clone: function () {
+	makeRotationZ: function ( theta ) {
+
+		var c = Math.cos( theta ), s = Math.sin( theta );
+
+		this.set(
+
+			c, -s, 0, 0,
+			s,  c, 0, 0,
+			0,  0, 1, 0,
+			0,  0, 0, 1
 
-		return new THREE.Matrix4(
-			this.n11, this.n12, this.n13, this.n14,
-			this.n21, this.n22, this.n23, this.n24,
-			this.n31, this.n32, this.n33, this.n34,
-			this.n41, this.n42, this.n43, this.n44
 		);
 
-	}
+		return this;
 
-};
+	},
 
-THREE.Matrix4.makeInvert3x3 = function ( m1 ) {
+	makeRotationAxis: function ( axis, angle ) {
 
-	// input:  THREE.Matrix4, output: THREE.Matrix3
-	// ( based on http://code.google.com/p/webgl-mjs/ )
+		// Based on http://www.gamedev.net/reference/articles/article1199.asp
 
-	var m33 = m1.m33, m33m = m33.m,
-	a11 =   m1.n33 * m1.n22 - m1.n32 * m1.n23,
-	a21 = - m1.n33 * m1.n21 + m1.n31 * m1.n23,
-	a31 =   m1.n32 * m1.n21 - m1.n31 * m1.n22,
-	a12 = - m1.n33 * m1.n12 + m1.n32 * m1.n13,
-	a22 =   m1.n33 * m1.n11 - m1.n31 * m1.n13,
-	a32 = - m1.n32 * m1.n11 + m1.n31 * m1.n12,
-	a13 =   m1.n23 * m1.n12 - m1.n22 * m1.n13,
-	a23 = - m1.n23 * m1.n11 + m1.n21 * m1.n13,
-	a33 =   m1.n22 * m1.n11 - m1.n21 * m1.n12,
+		var c = Math.cos( angle );
+		var s = Math.sin( angle );
+		var t = 1 - c;
+		var x = axis.x, y = axis.y, z = axis.z;
+		var tx = t * x, ty = t * y;
 
-	det = m1.n11 * a11 + m1.n21 * a12 + m1.n31 * a13,
+		this.set(
 
-	idet;
+		 	tx * x + c, tx * y - s * z, tx * z + s * y, 0,
+			tx * y + s * z, ty * y + c, ty * z - s * x, 0,
+			tx * z - s * y, ty * z + s * x, t * z * z + c, 0,
+			0, 0, 0, 1
 
-	// no inverse
+		);
 
-	if ( det === 0 ) {
+		 return this;
 
-		return null;
+	},
 
-	}
+	makeScale: function ( x, y, z ) {
 
-	idet = 1.0 / det;
+		this.set(
 
-	m33m[ 0 ] = idet * a11; m33m[ 1 ] = idet * a21; m33m[ 2 ] = idet * a31;
-	m33m[ 3 ] = idet * a12; m33m[ 4 ] = idet * a22; m33m[ 5 ] = idet * a32;
-	m33m[ 6 ] = idet * a13; m33m[ 7 ] = idet * a23; m33m[ 8 ] = idet * a33;
+			x, 0, 0, 0,
+			0, y, 0, 0,
+			0, 0, z, 0,
+			0, 0, 0, 1
 
-	return m33;
+		);
 
-}
+		return this;
 
-THREE.Matrix4.makeFrustum = function ( left, right, bottom, top, near, far ) {
+	},
 
-	var m, x, y, a, b, c, d;
+	makeFrustum: function ( left, right, bottom, top, near, far ) {
 
-	m = new THREE.Matrix4();
+		var x = 2 * near / ( right - left );
+		var y = 2 * near / ( top - bottom );
 
-	x = 2 * near / ( right - left );
-	y = 2 * near / ( top - bottom );
+		var a = ( right + left ) / ( right - left );
+		var b = ( top + bottom ) / ( top - bottom );
+		var c = - ( far + near ) / ( far - near );
+		var d = - 2 * far * near / ( far - near );
 
-	a = ( right + left ) / ( right - left );
-	b = ( top + bottom ) / ( top - bottom );
-	c = - ( far + near ) / ( far - near );
-	d = - 2 * far * near / ( far - near );
+		this.n11 = x;  this.n12 = 0;  this.n13 = a;   this.n14 = 0;
+		this.n21 = 0;  this.n22 = y;  this.n23 = b;   this.n24 = 0;
+		this.n31 = 0;  this.n32 = 0;  this.n33 = c;   this.n34 = d;
+		this.n41 = 0;  this.n42 = 0;  this.n43 = - 1; this.n44 = 0;
 
-	m.n11 = x;  m.n12 = 0;  m.n13 = a;   m.n14 = 0;
-	m.n21 = 0;  m.n22 = y;  m.n23 = b;   m.n24 = 0;
-	m.n31 = 0;  m.n32 = 0;  m.n33 = c;   m.n34 = d;
-	m.n41 = 0;  m.n42 = 0;  m.n43 = - 1; m.n44 = 0;
+		return this;
 
-	return m;
+	},
 
-};
+	makePerspective: function ( fov, aspect, near, far ) {
 
-THREE.Matrix4.makePerspective = function ( fov, aspect, near, far ) {
+		var ymax = near * Math.tan( fov * Math.PI / 360 );
+		var ymin = - ymax;
+		var xmin = ymin * aspect;
+		var xmax = ymax * aspect;
 
-	var ymax, ymin, xmin, xmax;
+		return this.makeFrustum( xmin, xmax, ymin, ymax, near, far );
 
-	ymax = near * Math.tan( fov * Math.PI / 360 );
-	ymin = - ymax;
-	xmin = ymin * aspect;
-	xmax = ymax * aspect;
+	},
 
-	return THREE.Matrix4.makeFrustum( xmin, xmax, ymin, ymax, near, far );
+	makeOrthographic: function ( left, right, top, bottom, near, far ) {
 
-};
+		var w = right - left;
+		var h = top - bottom;
+		var p = far - near;
+
+		var x = ( right + left ) / w;
+		var y = ( top + bottom ) / h;
+		var z = ( far + near ) / p;
+
+		this.n11 = 2 / w; this.n12 = 0;     this.n13 = 0;      this.n14 = -x;
+		this.n21 = 0;     this.n22 = 2 / h; this.n23 = 0;      this.n24 = -y;
+		this.n31 = 0;     this.n32 = 0;     this.n33 = -2 / p; this.n34 = -z;
+		this.n41 = 0;     this.n42 = 0;     this.n43 = 0;      this.n44 = 1;
+
+		return this;
 
-THREE.Matrix4.makeOrtho = function ( left, right, top, bottom, near, far ) {
+	},
 
-	var m, x, y, z, w, h, p;
 
-	m = new THREE.Matrix4();
+	clone: function () {
 
-	w = right - left;
-	h = top - bottom;
-	p = far - near;
+		return new THREE.Matrix4(
 
-	x = ( right + left ) / w;
-	y = ( top + bottom ) / h;
-	z = ( far + near ) / p;
+			this.n11, this.n12, this.n13, this.n14,
+			this.n21, this.n22, this.n23, this.n24,
+			this.n31, this.n32, this.n33, this.n34,
+			this.n41, this.n42, this.n43, this.n44
 
-	m.n11 = 2 / w; m.n12 = 0;     m.n13 = 0;      m.n14 = -x;
-	m.n21 = 0;     m.n22 = 2 / h; m.n23 = 0;      m.n24 = -y;
-	m.n31 = 0;     m.n32 = 0;     m.n33 = -2 / p; m.n34 = -z;
-	m.n41 = 0;     m.n42 = 0;     m.n43 = 0;      m.n44 = 1;
+		);
 
-	return m;
+	}
 
 };
 

+ 1 - 1
src/extras/GeometryUtils.js

@@ -453,7 +453,7 @@ THREE.GeometryUtils = {
 		offset.add( bb.min, bb.max );
 		offset.multiplyScalar( -0.5 );
 
-		geometry.applyMatrix( new THREE.Matrix4().setTranslation( offset.x, offset.y, offset.z ) );
+		geometry.applyMatrix( new THREE.Matrix4().makeTranslation( offset.x, offset.y, offset.z ) );
 		geometry.computeBoundingBox();
 
 		return offset;

+ 39 - 76
src/extras/cameras/CubeCamera.js

@@ -5,114 +5,77 @@
  * @author alteredq / http://alteredqualia.com/
  */
 
-THREE.CubeCamera = function ( near, far, heightOffset, cubeResolution ) {
+THREE.CubeCamera = function ( near, far, cubeResolution ) {
 
-	this.heightOffset = heightOffset;
-	this.position = new THREE.Vector3( 0, heightOffset, 0 );
-
-	// cameras
+	this.position = new THREE.Vector3();
 
 	var fov = 90, aspect = 1;
 
-	this.cameraPX = new THREE.PerspectiveCamera( fov, aspect, near, far );
-	this.cameraNX = new THREE.PerspectiveCamera( fov, aspect, near, far );
-
-	this.cameraPY = new THREE.PerspectiveCamera( fov, aspect, near, far );
-	this.cameraNY = new THREE.PerspectiveCamera( fov, aspect, near, far );
-
-	this.cameraPZ = new THREE.PerspectiveCamera( fov, aspect, near, far );
-	this.cameraNZ = new THREE.PerspectiveCamera( fov, aspect, near, far );
+	var cameraPX = new THREE.PerspectiveCamera( fov, aspect, near, far );
+	var cameraNX = new THREE.PerspectiveCamera( fov, aspect, near, far );
 
-	this.cameraPX.position = this.position;
-	this.cameraNX.position = this.position;
+	var cameraPY = new THREE.PerspectiveCamera( fov, aspect, near, far );
+	var cameraNY = new THREE.PerspectiveCamera( fov, aspect, near, far );
 
-	this.cameraPY.position = this.position;
-	this.cameraNY.position = this.position;
+	var cameraPZ = new THREE.PerspectiveCamera( fov, aspect, near, far );
+	var cameraNZ = new THREE.PerspectiveCamera( fov, aspect, near, far );
 
-	this.cameraPZ.position = this.position;
-	this.cameraNZ.position = this.position;
+	cameraPX.position = this.position;
+	cameraPX.up.set( 0, -1, 0 );
+	cameraPX.lookAt( new THREE.Vector3( 1, 0, 0 ) );
 
-	this.cameraPX.up.set( 0, -1, 0 );
-	this.cameraNX.up.set( 0, -1, 0 );
+	cameraNX.position = this.position;
+	cameraNX.up.set( 0, -1, 0 );
+	cameraNX.lookAt( new THREE.Vector3( -1, 0, 0 ) );
 
-	this.cameraPY.up.set( 0, 0, 1 );
-	this.cameraNY.up.set( 0, 0, -1 );
+	cameraPY.position = this.position;
+	cameraPY.up.set( 0, 0, 1 );
+	cameraPY.lookAt( new THREE.Vector3( 0, 1, 0 ) );
 
-	this.cameraPZ.up.set( 0, -1, 0 );
-	this.cameraNZ.up.set( 0, -1, 0 );
+	cameraNY.position = this.position;
+	cameraNY.up.set( 0, 0, -1 );
+	cameraNY.lookAt( new THREE.Vector3( 0, -1, 0 ) );
 
-	// targets
+	cameraPZ.position = this.position;
+	cameraPZ.up.set( 0, -1, 0 );
+	cameraPZ.lookAt( new THREE.Vector3( 0, 0, 1 ) );
 
-	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 );
+	cameraNZ.position = this.position;
+	cameraNZ.up.set( 0, -1, 0 );
+	cameraNZ.lookAt( new THREE.Vector3( 0, 0, -1 ) );
 
 	// cube render target
 
 	this.renderTarget = new THREE.WebGLRenderTargetCube( cubeResolution, cubeResolution, { format: THREE.RGBFormat, magFilter: THREE.LinearFilter, minFilter: THREE.LinearFilter } );
 
-	this.updatePosition = function ( position ) {
-
-		this.position.copy( position );
-
-		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 ( renderer, scene ) {
 
 		var cubeTarget = this.renderTarget;
 
+		var oldGenerateMipmaps = cubeTarget.generateMipmaps;
+
+		cubeTarget.generateMipmaps = false;
+
 		cubeTarget.activeCubeFace = 0;
-		renderer.render( scene, this.cameraPX, cubeTarget );
+		renderer.render( scene, cameraPX, cubeTarget );
 
 		cubeTarget.activeCubeFace = 1;
-		renderer.render( scene, this.cameraNX, cubeTarget );
+		renderer.render( scene, cameraNX, cubeTarget );
 
 		cubeTarget.activeCubeFace = 2;
-		renderer.render( scene, this.cameraPY, cubeTarget );
+		renderer.render( scene, cameraPY, cubeTarget );
 
 		cubeTarget.activeCubeFace = 3;
-		renderer.render( scene, this.cameraNY, cubeTarget );
+		renderer.render( scene, cameraNY, cubeTarget );
 
 		cubeTarget.activeCubeFace = 4;
-		renderer.render( scene, this.cameraPZ, cubeTarget );
+		renderer.render( scene, cameraPZ, cubeTarget );
+
+		cubeTarget.generateMipmaps = oldGenerateMipmaps;
 
 		cubeTarget.activeCubeFace = 5;
-		renderer.render( scene, this.cameraNZ, cubeTarget );
+		renderer.render( scene, cameraNZ, cubeTarget );
 
 	};
 
-};
+};

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

@@ -11,7 +11,7 @@ THREE.LatheGeometry = function ( points, steps, angle ) {
 
 	var stepSize = this.angle / this.steps,
 	newV = [], oldInds = [], newInds = [], startInds = [],
-	matrix = new THREE.Matrix4().setRotationZ( stepSize );
+	matrix = new THREE.Matrix4().makeRotationZ( stepSize );
 
 	for ( var j = 0; j < points.length; j ++ ) {
 

+ 3 - 3
src/extras/geometries/TubeGeometry.js

@@ -250,7 +250,7 @@ THREE.TubeGeometry.FrenetFrames = function(path, segments, closed) {
 
 			theta = Math.acos( tangents[ i-1 ].dot( tangents[ i ] ) );
 
-			mat.setRotationAxis( vec, theta ).multiplyVector3( normals[ i ] );
+			mat.makeRotationAxis( vec, theta ).multiplyVector3( normals[ i ] );
 
 		}
 
@@ -275,10 +275,10 @@ THREE.TubeGeometry.FrenetFrames = function(path, segments, closed) {
 		for ( i = 1; i < numpoints; i++ ) {
 
 			// twist a little...
-			mat.setRotationAxis( tangents[ i ], theta * i ).multiplyVector3( normals[ i ] );
+			mat.makeRotationAxis( tangents[ i ], theta * i ).multiplyVector3( normals[ i ] );
 			binormals[ i ].cross( tangents[ i ], normals[ i ] );
 
 		}
 
 	}
-};
+};

+ 1 - 1
src/extras/helpers/ArrowHelper.js

@@ -51,7 +51,7 @@ THREE.ArrowHelper.prototype.setDirection = function( dir ) {
 
     var radians = Math.acos( new THREE.Vector3( 0, 1, 0 ).dot( dir.clone().normalize() ) );
 
-    this.matrix = new THREE.Matrix4().setRotationAxis( axis.normalize(), radians );
+    this.matrix = new THREE.Matrix4().makeRotationAxis( axis.normalize(), radians );
 
     this.rotation.getRotationFromMatrix( this.matrix, this.scale );
 

+ 185 - 125
src/extras/loaders/ColladaLoader.js

@@ -2195,7 +2195,8 @@ THREE.ColladaLoader = function () {
 
 				case 'polygons':
 
-					console.warn( 'polygon holes not yet supported!' );
+					this.primitives.push( ( new Polygons().parse( child ) ) );
+					break;
 
 				case 'polylist':
 
@@ -2246,7 +2247,7 @@ THREE.ColladaLoader = function () {
 
 	Mesh.prototype.handlePrimitive = function( primitive, geom ) {
 
-		var i = 0, j, k, p = primitive.p, inputs = primitive.inputs;
+		var j, k, pList = primitive.p, inputs = primitive.inputs;
 		var input, index, idx32;
 		var source, numParams;
 		var vcIndex = 0, vcount = 3, maxOffset = 0;
@@ -2268,177 +2269,176 @@ THREE.ColladaLoader = function () {
 
 		}
 
-		while ( i < p.length ) {
+		for ( var pCount = 0; pCount < pList.length; ++pCount ) {
 
-			var vs = [];
-			var ns = [];
-			var ts = {};
-			var cs = [];
+			var p = pList[pCount], i = 0;
 
-			if ( primitive.vcount ) {
+			while ( i < p.length ) {
 
-				vcount = primitive.vcount[ vcIndex ++ ];
+				var vs = [];
+				var ns = [];
+				var ts = {};
+				var cs = [];
 
-			}
+				if ( primitive.vcount ) {
 
-			for ( j = 0; j < vcount; j ++ ) {
+					vcount = primitive.vcount.length ? primitive.vcount[ vcIndex ++ ] : primitive.vcount;
 
-				for ( k = 0; k < inputs.length; k ++ ) {
+				} else {
 
-					input = inputs[ k ];
-					source = sources[ input.source ];
+					vcount = p.length / maxOffset;
 
-					index = p[ i + ( j * maxOffset ) + input.offset ];
-					numParams = source.accessor.params.length;
-					idx32 = index * numParams;
+				}
 
-					switch ( input.semantic ) {
 
-						case 'VERTEX':
+				for ( j = 0; j < vcount; j ++ ) {
 
-							vs.push( index );
+					for ( k = 0; k < inputs.length; k ++ ) {
 
-							break;
+						input = inputs[ k ];
+						source = sources[ input.source ];
 
-						case 'NORMAL':
+						index = p[ i + ( j * maxOffset ) + input.offset ];
+						numParams = source.accessor.params.length;
+						idx32 = index * numParams;
 
-							ns.push( getConvertedVec3( source.data, idx32 ) );
+						switch ( input.semantic ) {
 
-							break;
+							case 'VERTEX':
 
-						case 'TEXCOORD':
+								vs.push( index );
 
-							if ( ts[ input.set ] === undefined ) ts[ input.set ] = [];
-							// invert the V
-							ts[ input.set ].push( new THREE.UV( source.data[ idx32 ], 1.0 - source.data[ idx32 + 1 ] ) );
+								break;
 
-							break;
+							case 'NORMAL':
 
-						case 'COLOR':
+								ns.push( getConvertedVec3( source.data, idx32 ) );
 
-							cs.push( new THREE.Color().setRGB( source.data[ idx32 ], source.data[ idx32 + 1 ], source.data[ idx32 + 2 ] ) );
+								break;
 
-							break;
+							case 'TEXCOORD':
 
-						default:
-							break;
+								if ( ts[ input.set ] === undefined ) ts[ input.set ] = [];
+								// invert the V
+								ts[ input.set ].push( new THREE.UV( source.data[ idx32 ], 1.0 - source.data[ idx32 + 1 ] ) );
+
+								break;
+
+							case 'COLOR':
+
+								cs.push( new THREE.Color().setRGB( source.data[ idx32 ], source.data[ idx32 + 1 ], source.data[ idx32 + 2 ] ) );
+
+								break;
+
+							default:
+								break;
+
+						}
 
 					}
 
 				}
 
-			}
 
+				var face = null, faces = [], uv, uvArr;
 
-			var face = null, faces = [], uv, uvArr;
+				if ( ns.length == 0 ) {
+					// check the vertices source
+					input = this.vertices.input.NORMAL;
 
-			if ( ns.length == 0 ) {
-				
-				// check the vertices source
-				input = this.vertices.input.NORMAL;
+					if ( input ) {
 
-				if ( input ) {
+						source = sources[ input.source ];
+						numParams = source.accessor.params.length;
 
-					source = sources[ input.source ];
-					numParams = source.accessor.params.length;
+						for ( var ndx = 0, len = vs.length; ndx < len; ndx++ ) {
 
-					for ( var ndx = 0, len = vs.length; ndx < len; ndx++ ) {
+							ns.push( getConvertedVec3( source.data, vs[ ndx ] * numParams ) );
 
-						ns.push( getConvertedVec3( source.data, vs[ ndx ] * numParams ) );
+						}
 
 					}
+					else {
+						geom.calcNormals = true;
+					}
 
 				}
-				else {
-					
-					geom.calcNormals = true;
-					
-				}
 
-			}
+				if ( vcount === 3 ) {
 
-			if ( vcount === 3 ) {
+					faces.push( new THREE.Face3( vs[0], vs[1], vs[2], ns, cs.length ? cs : new THREE.Color() ) );
 
-				faces.push( new THREE.Face3( vs[0], vs[1], vs[2], ns, cs.length ? cs : new THREE.Color() ) );
+				} else if ( vcount === 4 ) {
+					faces.push( new THREE.Face4( vs[0], vs[1], vs[2], vs[3], ns, cs.length ? cs : new THREE.Color() ) );
 
-			} else if ( vcount === 4 ) {
-				
-				faces.push( new THREE.Face4( vs[0], vs[1], vs[2], vs[3], ns, cs.length ? cs : new THREE.Color() ) );
+				} else if ( vcount > 4 && options.subdivideFaces ) {
 
-			} else if ( vcount > 4 && options.subdivideFaces ) {
+					var clr = cs.length ? cs : new THREE.Color(),
+						vec1, vec2, vec3, v1, v2, norm;
 
-				var clr = cs.length ? cs : new THREE.Color(),
-					vec1, vec2, vec3, v1, v2, norm;
+					// subdivide into multiple Face3s
+					for ( k = 1; k < vcount-1; ) {
 
-				// subdivide into multiple Face3s
-				for ( k = 1; k < vcount-1; ) {
+						// FIXME: normals don't seem to be quite right
+						faces.push( new THREE.Face3( vs[0], vs[k], vs[k+1], [ ns[0], ns[k++], ns[k] ],  clr ) );
 
-					// FIXME: normals don't seem to be quite right
-					faces.push( new THREE.Face3( vs[0], vs[k], vs[k+1], [ ns[0], ns[k++], ns[k] ],  clr ) );
+					}
 
 				}
 
-			}
+				if ( faces.length ) {
 
-			if ( faces.length ) {
+					for (var ndx = 0, len = faces.length; ndx < len; ndx++) {
 
-				for (var ndx = 0, len = faces.length; ndx < len; ndx++) {
+						face = faces[ndx];
+						face.daeMaterial = primitive.material;
+						geom.faces.push( face );
 
-					face = faces[ndx];
-					face.daeMaterial = primitive.material;
-					geom.faces.push( face );
+						for ( k = 0; k < texture_sets.length; k++ ) {
 
-					for ( k = 0; k < texture_sets.length; k++ ) {
+							uv = ts[ texture_sets[k] ];
 
-						uv = ts[ texture_sets[k] ];
+							if ( vcount > 4 ) {
 
-						if ( vcount > 4 ) {
+								// Grab the right UVs for the vertices in this face
+								uvArr = [ uv[0], uv[ndx+1], uv[ndx+2] ];
 
-							// Grab the right UVs for the vertices in this face
-							uvArr = [ uv[0], uv[ndx+1], uv[ndx+2] ];
+							} else if ( vcount === 4 ) {
 
-						} else if ( vcount === 4 ) {
+								uvArr = [ uv[0], uv[1], uv[2], uv[3] ];
 
-							uvArr = [ uv[0], uv[1], uv[2], uv[3] ];
+							} else {
 
-						} else {
+								uvArr = [ uv[0], uv[1], uv[2] ];
 
-							uvArr = [ uv[0], uv[1], uv[2] ];
+							}
 
-						}
+							if ( !geom.faceVertexUvs[k] ) {
 
-						if ( !geom.faceVertexUvs[k] ) {
+								geom.faceVertexUvs[k] = [];
 
-							geom.faceVertexUvs[k] = [];
+							}
 
-						}
+							geom.faceVertexUvs[k].push( uvArr );
 
-						geom.faceVertexUvs[k].push( uvArr );
+						}
 
 					}
 
-				}
-
-			} else {
+				} else {
 
-				console.log( 'dropped face with vcount ' + vcount + ' for geometry with id: ' + geom.id );
+					console.log( 'dropped face with vcount ' + vcount + ' for geometry with id: ' + geom.id );
 
-			}
+				}
 
-			i += maxOffset * vcount;
+				i += maxOffset * vcount;
 
+			}
 		}
 
 	};
 
-
-	function Polylist () {
-	};
-
-	Polylist.prototype = new Triangles();
-	Polylist.prototype.constructor = Polylist;
-
-	function Triangles( flip_uv ) {
+	function Polygons () {
 
 		this.material = "";
 		this.count = 0;
@@ -2449,7 +2449,7 @@ THREE.ColladaLoader = function () {
 
 	};
 
-	Triangles.prototype.setVertices = function ( vertices ) {
+	Polygons.prototype.setVertices = function ( vertices ) {
 
 		for ( var i = 0; i < this.inputs.length; i ++ ) {
 
@@ -2463,9 +2463,8 @@ THREE.ColladaLoader = function () {
 
 	};
 
-	Triangles.prototype.parse = function ( element ) {
+	Polygons.prototype.parse = function ( element ) {
 
-		this.inputs = [];
 		this.material = element.getAttribute( 'material' );
 		this.count = _attr_as_int( element, 'count', 0 );
 
@@ -2487,7 +2486,12 @@ THREE.ColladaLoader = function () {
 
 				case 'p':
 
-					this.p = _ints( child.textContent );
+					this.p.push( _ints( child.textContent ) );
+					break;
+
+				case 'ph':
+
+					console.warn( 'polygon holes not yet supported!' );
 					break;
 
 				default:
@@ -2501,6 +2505,28 @@ THREE.ColladaLoader = function () {
 
 	};
 
+	function Polylist () {
+
+		Polygons.call( this );
+
+		this.vcount = [];
+
+	};
+
+	Polylist.prototype = new Polygons();
+	Polylist.prototype.constructor = Polylist;
+
+	function Triangles () {
+
+		Polygons.call( this );
+
+		this.vcount = 3;
+
+	};
+
+	Triangles.prototype = new Polygons();
+	Triangles.prototype.constructor = Triangles;
+
 	function Accessor() {
 
 		this.source = "";
@@ -2935,17 +2961,9 @@ THREE.ColladaLoader = function () {
 
 							}
 
-						} else {
+						} else if ( prop == 'diffuse' || !transparent ) {
 
-							if ( prop == 'diffuse' ) {
-
-								props[ 'color' ] = cot.color.getHex();
-
-							} else if ( !transparent ) {
-
-								props[ prop ] = cot.color.getHex();
-
-							}
+							props[ prop ] = cot.color.getHex();
 
 						}
 
@@ -2979,27 +2997,27 @@ THREE.ColladaLoader = function () {
 		}
 
 		props[ 'shading' ] = preferredShading;
-		this.material = new THREE.MeshLambertMaterial( props );
 
 		switch ( this.type ) {
 
 			case 'constant':
-			case 'lambert':
+
+				props.color = props.emission;
+				this.material = new THREE.MeshBasicMaterial( props );
 				break;
 
 			case 'phong':
 			case 'blinn':
 
-			default:
-
-				/*
-				if ( !transparent ) {
-
-				//	this.material = new THREE.MeshPhongMaterial(props);
+				props.color = props.diffuse;
+				this.material = new THREE.MeshPhongMaterial( props );
+				break;
 
-				}
-				*/
+			case 'lambert':
+			default:
 
+				props.color = props.diffuse;
+				this.material = new THREE.MeshLambertMaterial( props );
 				break;
 
 		}
@@ -3226,6 +3244,12 @@ THREE.ColladaLoader = function () {
 					this.parseNewparam( child );
 					break;
 
+				case 'image':
+
+					var _image = ( new _Image() ).parse( child );
+					images[ _image.id ] = _image;
+					break;
+
 				case 'extra':
 					break;
 
@@ -3665,6 +3689,7 @@ THREE.ColladaLoader = function () {
 
 		this.id = "";
 		this.name = "";
+		this.technique = "";
 
 	};
 
@@ -3706,7 +3731,9 @@ THREE.ColladaLoader = function () {
 
 				for ( var j = 0; j < technique.childNodes.length; j ++ ) {
 
-					if ( technique.childNodes[ j ].nodeName == 'perspective' ) {
+					this.technique = technique.childNodes[ j ].nodeName;
+
+					if ( this.technique == 'perspective' ) {
 
 						var perspective = technique.childNodes[ j ];
 
@@ -3716,14 +3743,47 @@ THREE.ColladaLoader = function () {
 
 							switch ( param.nodeName ) {
 
+								case 'yfov':
+									this.yfov = param.textContent;
+									break;
 								case 'xfov':
-									this.fov = param.textContent;
+									this.xfov = param.textContent;
+									break;
+								case 'znear':
+									this.znear = param.textContent;
+									break;
+								case 'zfar':
+									this.zfar = param.textContent;
+									break;
+								case 'aspect_ratio':
+									this.aspect_ratio = param.textContent;
+									break;
+
+							}
+
+						}
+
+					} else if ( this.technique == 'orthographic' ) {
+
+						var orthographic = technique.childNodes[ j ];
+
+						for ( var k = 0; k < orthographic.childNodes.length; k ++ ) {
+
+							var param = orthographic.childNodes[ k ];
+
+							switch ( param.nodeName ) {
+
+								case 'xmag':
+									this.xmag = param.textContent;
+									break;
+								case 'ymag':
+									this.ymag = param.textContent;
 									break;
 								case 'znear':
-									this.znear = .4;//param.textContent;
+									this.znear = param.textContent;
 									break;
 								case 'zfar':
-									this.zfar = 1e15;//param.textContent;
+									this.zfar = param.textContent;
 									break;
 								case 'aspect_ratio':
 									this.aspect_ratio = param.textContent;

+ 1 - 1
src/extras/renderers/plugins/LensFlarePlugin.js

@@ -261,7 +261,7 @@ THREE.LensFlarePlugin = function ( ) {
 						_gl.uniform1f( uniforms.opacity, sprite.opacity );
 						_gl.uniform3f( uniforms.color, sprite.color.r, sprite.color.g, sprite.color.b );
 
-						_renderer.setBlending( sprite.blending );
+						_renderer.setBlending( sprite.blending, sprite.blendEquation, sprite.blendSrc, sprite.blendDst );
 						_renderer.setTexture( sprite.texture, 1 );
 
 						_gl.drawElements( _gl.TRIANGLES, 6, _gl.UNSIGNED_SHORT, 0 );

+ 1 - 1
src/extras/renderers/plugins/SpritePlugin.js

@@ -194,7 +194,7 @@ THREE.SpritePlugin = function ( ) {
 
 				}
 
-				_renderer.setBlending( sprite.blending );
+				_renderer.setBlending( sprite.blending, sprite.blendEquation, sprite.blendSrc, sprite.blendDst );
 				_renderer.setTexture( sprite.map, 0 );
 
 				_gl.drawElements( _gl.TRIANGLES, 6, _gl.UNSIGNED_SHORT, 0 );

+ 44 - 0
src/materials/Material.js

@@ -1,5 +1,6 @@
 /**
  * @author mr.doob / http://mrdoob.com/
+ * @author alteredq / http://alteredqualia.com/
  */
 
 THREE.Material = function ( parameters ) {
@@ -15,6 +16,10 @@ THREE.Material = function ( parameters ) {
 
 	this.blending = parameters.blending !== undefined ? parameters.blending : THREE.NormalBlending;
 
+	this.blendSrc = parameters.blendSrc !== undefined ? parameters.blendSrc : THREE.SrcAlphaFactor;
+	this.blendDst = parameters.blendDst !== undefined ? parameters.blendDst : THREE.OneMinusSrcAlphaFactor;
+	this.blendEquation = parameters.blendEquation !== undefined ? parameters.blendEquation : THREE.AddEquation;
+
 	this.depthTest = parameters.depthTest !== undefined ? parameters.depthTest : true;
 	this.depthWrite = parameters.depthWrite !== undefined ? parameters.depthWrite : true;
 
@@ -32,17 +37,56 @@ THREE.Material = function ( parameters ) {
 
 THREE.MaterialCount = 0;
 
+// shading
+
 THREE.NoShading = 0;
 THREE.FlatShading = 1;
 THREE.SmoothShading = 2;
 
+// colors
+
 THREE.NoColors = 0;
 THREE.FaceColors = 1;
 THREE.VertexColors = 2;
 
+// blending modes
+
 THREE.NoBlending = 0;
 THREE.NormalBlending = 1;
 THREE.AdditiveBlending = 2;
 THREE.SubtractiveBlending = 3;
 THREE.MultiplyBlending = 4;
 THREE.AdditiveAlphaBlending = 5;
+THREE.CustomBlending = 6;
+
+// custom blending equations
+// (numbers start from 100 not to clash with other
+//  mappings to OpenGL constants defined in Texture.js)
+
+THREE.AddEquation = 100;
+THREE.SubtractEquation = 101;
+THREE.ReverseSubtractEquation = 102;
+
+// custom blending destination factors
+
+THREE.ZeroFactor = 200;
+THREE.OneFactor = 201;
+THREE.SrcColorFactor = 202;
+THREE.OneMinusSrcColorFactor = 203;
+THREE.SrcAlphaFactor = 204;
+THREE.OneMinusSrcAlphaFactor = 205;
+THREE.DstAlphaFactor = 206;
+THREE.OneMinusDstAlphaFactor = 207;
+
+// custom blending source factors
+
+//THREE.ZeroFactor = 200;
+//THREE.OneFactor = 201;
+//THREE.SrcAlphaFactor = 204;
+//THREE.OneMinusSrcAlphaFactor = 205;
+//THREE.DstAlphaFactor = 206;
+//THREE.OneMinusDstAlphaFactor = 207;
+THREE.DstColorFactor = 208;
+THREE.OneMinusDstColorFactor = 209;
+THREE.SrcAlphaSaturateFactor = 210;
+

+ 5 - 0
src/objects/Sprite.js

@@ -8,8 +8,13 @@ THREE.Sprite = function ( parameters ) {
 
 	this.color = ( parameters.color !== undefined ) ? new THREE.Color( parameters.color ) : new THREE.Color( 0xffffff );
 	this.map = ( parameters.map !== undefined ) ? parameters.map : new THREE.Texture();
+
 	this.blending = ( parameters.blending !== undefined ) ? parameters.blending : THREE.NormalBlending;
 
+	this.blendSrc = parameters.blendSrc !== undefined ? parameters.blendSrc : THREE.SrcAlphaFactor;
+	this.blendDst = parameters.blendDst !== undefined ? parameters.blendDst : THREE.OneMinusSrcAlphaFactor;
+	this.blendEquation = parameters.blendEquation !== undefined ? parameters.blendEquation : THREE.AddEquation;
+
 	this.useScreenCoordinates = ( parameters.useScreenCoordinates !== undefined ) ? parameters.useScreenCoordinates : true;
 	this.mergeWith3D = ( parameters.mergeWith3D !== undefined ) ? parameters.mergeWith3D : !this.useScreenCoordinates;
 	this.affectedByDistance = ( parameters.affectedByDistance !== undefined ) ? parameters.affectedByDistance : !this.useScreenCoordinates;

+ 4 - 4
src/renderers/CanvasRenderer.js

@@ -120,19 +120,19 @@ THREE.CanvasRenderer = function ( parameters ) {
 
 	};
 
-	this.setClearColor = function( color, opacity ) {
+	this.setClearColor = function ( color, opacity ) {
 
 		_clearColor.copy( color );
-		_clearOpacity = opacity;
+		_clearOpacity = opacity !== undefined ? opacity : 1;
 
 		_clearRect.set( - _canvasWidthHalf, - _canvasHeightHalf, _canvasWidthHalf, _canvasHeightHalf );
 
 	};
 
-	this.setClearColorHex = function( hex, opacity ) {
+	this.setClearColorHex = function ( hex, opacity ) {
 
 		_clearColor.setHex( hex );
-		_clearOpacity = opacity;
+		_clearOpacity = opacity !== undefined ? opacity : 1;
 
 		_clearRect.set( - _canvasWidthHalf, - _canvasHeightHalf, _canvasWidthHalf, _canvasHeightHalf );
 

+ 88 - 24
src/renderers/WebGLRenderer.js

@@ -118,12 +118,20 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 	_oldDoubleSided = null,
 	_oldFlipSided = null,
+
 	_oldBlending = null,
+
+	_oldBlendEquation = null,
+	_oldBlendSrc = null,
+	_oldBlendDst = null,
+
 	_oldDepthTest = null,
 	_oldDepthWrite = null,
+
 	_oldPolygonOffset = null,
 	_oldPolygonOffsetFactor = null,
 	_oldPolygonOffsetUnits = null,
+
 	_oldLineWidth = null,
 
 	_viewportX = 0,
@@ -293,6 +301,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 		object.__webglInit = false;
 
 		delete object._modelViewMatrix;
+		delete object._normalMatrix;
 
 		delete object._normalMatrixArray;
 		delete object._modelViewMatrixArray;
@@ -1049,7 +1058,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 					customAttribute = customAttributes[ i ];
 
 					if ( customAttribute.needsUpdate &&
-					     ( customAttribute.boundTo === undefined ||
+						 ( customAttribute.boundTo === undefined ||
 						   customAttribute.boundTo === "vertices") ) {
 
 						cal = customAttribute.value.length;
@@ -3291,7 +3300,6 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 		var i, il,
 
-		program, material,
 		webglObject, object,
 		renderList,
 
@@ -3426,13 +3434,15 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 		if ( scene.overrideMaterial ) {
 
-			this.setBlending( scene.overrideMaterial.blending );
-			this.setDepthTest( scene.overrideMaterial.depthTest );
-			this.setDepthWrite( scene.overrideMaterial.depthWrite );
-			setPolygonOffset( scene.overrideMaterial.polygonOffset, scene.overrideMaterial.polygonOffsetFactor, scene.overrideMaterial.polygonOffsetUnits );
+			var material = scene.overrideMaterial;
 
-			renderObjects( scene.__webglObjects, false, "", camera, lights, fog, true, scene.overrideMaterial );
-			renderObjectsImmediate( scene.__webglObjectsImmediate, "", camera, lights, fog, false, scene.overrideMaterial );
+			this.setBlending( material.blending, material.blendEquation, material.blendSrc, material.blendDst );
+			this.setDepthTest( material.depthTest );
+			this.setDepthWrite( material.depthWrite );
+			setPolygonOffset( material.polygonOffset, material.polygonOffsetFactor, material.polygonOffsetUnits );
+
+			renderObjects( scene.__webglObjects, false, "", camera, lights, fog, true, material );
+			renderObjectsImmediate( scene.__webglObjectsImmediate, "", camera, lights, fog, false, material );
 
 		} else {
 
@@ -3536,7 +3546,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 					if ( ! material ) continue;
 
-					if ( useBlending ) _this.setBlending( material.blending );
+					if ( useBlending ) _this.setBlending( material.blending, material.blendEquation, material.blendSrc, material.blendDst );
 
 					_this.setDepthTest( material.depthTest );
 					_this.setDepthWrite( material.depthWrite );
@@ -3583,7 +3593,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 					if ( ! material ) continue;
 
-					if ( useBlending ) _this.setBlending( material.blending );
+					if ( useBlending ) _this.setBlending( material.blending, material.blendEquation, material.blendSrc, material.blendDst );
 
 					_this.setDepthTest( material.depthTest );
 					_this.setDepthWrite( material.depthWrite );
@@ -3815,6 +3825,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 			object.__webglInit = true;
 
 			object._modelViewMatrix = new THREE.Matrix4();
+			object._normalMatrix = new THREE.Matrix3();
 
 			object._normalMatrixArray = new Float32Array( 9 );
 			object._modelViewMatrixArray = new Float32Array( 16 );
@@ -4928,13 +4939,8 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 		object._modelViewMatrix.multiplyToArray( camera.matrixWorldInverse, object.matrixWorld, object._modelViewMatrixArray );
 
-		var inverseMatrix = THREE.Matrix4.makeInvert3x3( object._modelViewMatrix );
-
-		if ( inverseMatrix ) {
-
-			inverseMatrix.transposeIntoArray( object._normalMatrixArray );
-
-		}
+		object._normalMatrix.getInverse( object._modelViewMatrix );
+		object._normalMatrix.transposeIntoArray( object._normalMatrixArray );
 
 	};
 
@@ -5208,19 +5214,21 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 	};
 
-	this.setBlending = function ( blending ) {
+	this.setBlending = function ( blending, blendEquation, blendSrc, blendDst ) {
 
 		if ( blending !== _oldBlending ) {
 
 			switch ( blending ) {
 
 				case THREE.NoBlending:
-                    _gl.disable( _gl.BLEND );
-                    break;
+
+					_gl.disable( _gl.BLEND );
+
+					break;
 
 				case THREE.AdditiveBlending:
 
-                    _gl.enable( _gl.BLEND );
+					_gl.enable( _gl.BLEND );
 					_gl.blendEquation( _gl.FUNC_ADD );
 					_gl.blendFunc( _gl.SRC_ALPHA, _gl.ONE );
 
@@ -5229,7 +5237,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 				case THREE.SubtractiveBlending:
 
 					// TODO: Find blendFuncSeparate() combination
-                    _gl.enable( _gl.BLEND );
+					_gl.enable( _gl.BLEND );
 					_gl.blendEquation( _gl.FUNC_ADD );
 					_gl.blendFunc( _gl.ZERO, _gl.ONE_MINUS_SRC_COLOR );
 
@@ -5238,15 +5246,21 @@ THREE.WebGLRenderer = function ( parameters ) {
 				case THREE.MultiplyBlending:
 
 					// TODO: Find blendFuncSeparate() combination
-                    _gl.enable( _gl.BLEND );
+					_gl.enable( _gl.BLEND );
 					_gl.blendEquation( _gl.FUNC_ADD );
 					_gl.blendFunc( _gl.ZERO, _gl.SRC_COLOR );
 
 					break;
 
+				case THREE.CustomBlending:
+
+					_gl.enable( _gl.BLEND );
+
+					break;
+
 				default:
 
-                    _gl.enable( _gl.BLEND );
+					_gl.enable( _gl.BLEND );
 					_gl.blendEquationSeparate( _gl.FUNC_ADD, _gl.FUNC_ADD );
 					_gl.blendFuncSeparate( _gl.SRC_ALPHA, _gl.ONE_MINUS_SRC_ALPHA, _gl.ONE, _gl.ONE_MINUS_SRC_ALPHA );
 
@@ -5258,6 +5272,33 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 		}
 
+		if ( blending === THREE.CustomBlending ) {
+
+			if ( blendEquation !== _oldBlendEquation ) {
+
+				_gl.blendEquation( paramThreeToGL( blendEquation ) );
+
+				_oldBlendEquation = blendEquation;
+
+			}
+
+			if ( blendSrc !== _oldBlendSrc || blendDst !== _oldBlendDst ) {
+
+				_gl.blendFunc( paramThreeToGL( blendSrc ), paramThreeToGL( blendDst ) );
+
+				_oldBlendSrc = blendSrc;
+				_oldBlendDst = blendDst;
+
+			}
+
+		} else {
+
+			_oldBlendEquation = null;
+			_oldBlendSrc = null;
+			_oldBlendDst = null;
+
+		}
+
 	};
 
 	// Shaders
@@ -5618,6 +5659,8 @@ THREE.WebGLRenderer = function ( parameters ) {
 			_gl.activeTexture( _gl.TEXTURE0 + slot );
 			_gl.bindTexture( _gl.TEXTURE_2D, texture.__webglTexture );
 
+			_gl.pixelStorei( _gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.premultiplyAlpha );
+
 			var image = texture.image,
 			isImagePowerOfTwo = isPowerOfTwo( image.width ) && isPowerOfTwo( image.height ),
 			glFormat = paramThreeToGL( texture.format ),
@@ -5818,6 +5861,8 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 				}
 
+				if ( isTargetPowerOfTwo ) _gl.generateMipmap( _gl.TEXTURE_CUBE_MAP );
+
 			} else {
 
 				renderTarget.__webglFramebuffer = _gl.createFramebuffer();
@@ -5831,6 +5876,8 @@ THREE.WebGLRenderer = function ( parameters ) {
 				setupFrameBuffer( renderTarget.__webglFramebuffer, renderTarget, _gl.TEXTURE_2D );
 				setupRenderBuffer( renderTarget.__webglRenderbuffer, renderTarget );
 
+				if ( isTargetPowerOfTwo ) _gl.generateMipmap( _gl.TEXTURE_2D );
+
 			}
 
 			// Release everything
@@ -5967,6 +6014,23 @@ THREE.WebGLRenderer = function ( parameters ) {
 			case THREE.LuminanceFormat: return _gl.LUMINANCE; break;
 			case THREE.LuminanceAlphaFormat: return _gl.LUMINANCE_ALPHA; break;
 
+			case THREE.AddEquation: return _gl.FUNC_ADD; break;
+			case THREE.SubtractEquation: return _gl.FUNC_SUBTRACT; break;
+			case THREE.ReverseSubtractEquation: return _gl.FUNC_REVERSE_SUBTRACT; break;
+
+			case THREE.ZeroFactor: return _gl.ZERO; break;
+			case THREE.OneFactor: return _gl.ONE; break;
+			case THREE.SrcColorFactor: return _gl.SRC_COLOR; break;
+			case THREE.OneMinusSrcColorFactor: return _gl.ONE_MINUS_SRC_COLOR; break;
+			case THREE.SrcAlphaFactor: return _gl.SRC_ALPHA; break;
+			case THREE.OneMinusSrcAlphaFactor: return _gl.ONE_MINUS_SRC_ALPHA; break;
+			case THREE.DstAlphaFactor: return _gl.DST_ALPHA; break;
+			case THREE.OneMinusDstAlphaFactor: return _gl.ONE_MINUS_DST_ALPHA; break;
+
+			case THREE.DstColorFactor: return _gl.DST_COLOR; break;
+			case THREE.OneMinusDstColorFactor: return _gl.ONE_MINUS_DST_COLOR; break;
+			case THREE.SrcAlphaSaturateFactor: return _gl.SRC_ALPHA_SATURATE; break;
+
 		}
 
 		return 0;

+ 3 - 5
src/textures/Texture.js

@@ -25,6 +25,7 @@ THREE.Texture = function ( image, mapping, wrapS, wrapT, magFilter, minFilter, f
 	this.repeat = new THREE.Vector2( 1, 1 );
 
 	this.generateMipmaps = true;
+	this.premultiplyAlpha = false;
 
 	this.needsUpdate = false;
 	this.onUpdate = null;
@@ -55,17 +56,14 @@ THREE.MixOperation = 1;
 
 // Mapping modes
 
+THREE.UVMapping = function () {};
+
 THREE.CubeReflectionMapping = function () {};
 THREE.CubeRefractionMapping = function () {};
 
-THREE.LatitudeReflectionMapping = function () {};
-THREE.LatitudeRefractionMapping = function () {};
-
 THREE.SphericalReflectionMapping = function () {};
 THREE.SphericalRefractionMapping = function () {};
 
-THREE.UVMapping = function () {};
-
 // Wrapping modes
 
 THREE.RepeatWrapping = 0;