Browse Source

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

alteredq 13 years ago
parent
commit
62123193b0
63 changed files with 833 additions and 800 deletions
  1. 444 443
      build/Three.js
  2. 1 1
      build/custom/ThreeCanvas.js
  3. 1 1
      build/custom/ThreeDOM.js
  4. 202 201
      build/custom/ThreeExtras.js
  5. 1 1
      build/custom/ThreeSVG.js
  6. 2 2
      build/custom/ThreeWebGL.js
  7. 2 2
      examples/canvas_camera_orthographic.html
  8. 2 2
      examples/canvas_camera_orthographic2.html
  9. 2 2
      examples/canvas_interactive_voxelpainter.html
  10. 1 1
      examples/canvas_lines.html
  11. 1 1
      examples/canvas_lines_sphere.html
  12. 2 2
      examples/canvas_materials.html
  13. 2 2
      examples/canvas_performance.html
  14. 2 2
      examples/canvas_sandbox.html
  15. 2 4
      examples/js/MarchingCubes.js
  16. 1 1
      examples/js/ctm/CTMLoader.js
  17. 8 2
      examples/misc_camera_fly.html
  18. 3 3
      examples/misc_ubiquity_test.html
  19. 1 1
      examples/obj/Bird.js
  20. 1 1
      examples/obj/Qrcode.js
  21. 7 6
      examples/webgl_camera.html
  22. 4 1
      examples/webgl_custom_attributes_particles.html
  23. 4 2
      examples/webgl_custom_attributes_particles3.html
  24. 1 1
      examples/webgl_kinect.html
  25. 1 1
      examples/webgl_lines_colors.html
  26. 1 1
      examples/webgl_lines_cubes.html
  27. 4 1
      examples/webgl_lines_sphere.html
  28. 1 1
      examples/webgl_lines_splines.html
  29. 4 4
      examples/webgl_loader_collada.html
  30. 4 4
      examples/webgl_loader_collada_keyframe.html
  31. 4 4
      examples/webgl_materials.html
  32. 1 1
      examples/webgl_morphtargets.html
  33. 1 1
      examples/webgl_particles_billboards.html
  34. 1 1
      examples/webgl_particles_billboards_colors.html
  35. 1 1
      examples/webgl_particles_dynamic.html
  36. 1 1
      examples/webgl_particles_random.html
  37. 1 1
      examples/webgl_particles_shapes.html
  38. 1 1
      examples/webgl_particles_sprites.html
  39. 2 2
      examples/webgl_ribbons.html
  40. 4 1
      examples/webgl_trackballcamera_earth.html
  41. 1 1
      examples/webgl_trails.html
  42. 5 1
      src/core/Vertex.js
  43. 1 1
      src/extras/controls/PathControls.js
  44. 6 6
      src/extras/core/CurvePath.js
  45. 1 1
      src/extras/geometries/CubeGeometry.js
  46. 7 6
      src/extras/geometries/CylinderGeometry.js
  47. 2 2
      src/extras/geometries/ExtrudeGeometry.js
  48. 3 4
      src/extras/geometries/LatheGeometry.js
  49. 1 1
      src/extras/geometries/PlaneGeometry.js
  50. 1 1
      src/extras/geometries/PolyhedronGeometry.js
  51. 5 4
      src/extras/geometries/SphereGeometry.js
  52. 1 1
      src/extras/geometries/TorusGeometry.js
  53. 1 1
      src/extras/geometries/TorusKnotGeometry.js
  54. 1 1
      src/extras/geometries/TubeGeometry.js
  55. 25 29
      src/extras/helpers/ArrowHelper.js
  56. 2 2
      src/extras/helpers/AxisHelper.js
  57. 1 1
      src/extras/helpers/CameraHelper.js
  58. 1 1
      src/extras/loaders/BinaryLoader.js
  59. 2 3
      src/extras/loaders/ColladaLoader.js
  60. 7 6
      src/extras/loaders/JSONLoader.js
  61. 26 12
      src/extras/loaders/SceneLoader.js
  62. 1 1
      src/extras/loaders/UTF8Loader.js
  63. 3 3
      src/extras/modifiers/SubdivisionModifier.js

+ 444 - 443
build/Three.js

@@ -14,47 +14,47 @@ THREE.Vector3.prototype={constructor:THREE.Vector3,set:function(a,b,c){this.x=a;
 a;this.z=this.z+a;return this},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=this.x-a.x;this.y=this.y-a.y;this.z=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=this.x*a.x;this.y=this.y*a.y;this.z=this.z*a.z;return this},multiplyScalar:function(a){this.x=this.x*a;this.y=this.y*a;this.z=this.z*a;return this},divideSelf:function(a){this.x=this.x/a.x;this.y=
 this.y/a.y;this.z=this.z/a.z;return this},divideScalar:function(a){if(a){this.x=this.x/a;this.y=this.y/a;this.z=this.z/a}else 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=this.x+(a.x-this.x)*b;this.y=this.y+(a.y-this.y)*b;this.z=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.elements[12];this.y=a.elements[13];this.z=a.elements[14];return this},getRotationFromMatrix:function(a,b){var c=b?b.x:1,d=b?b.y:1,e=b?b.z:1,f=a.elements[0]/c,g=a.elements[4]/d,c=a.elements[1]/c,d=a.elements[5]/d,h=a.elements[9]/e,l=a.elements[10]/e;this.y=Math.asin(a.elements[8]/e);e=Math.cos(this.y);if(Math.abs(e)>1.0E-5){this.x=Math.atan2(-h/e,l/e);this.z=Math.atan2(-g/e,f/e)}else{this.x=0;this.z=Math.atan2(c,d)}return this},getScaleFromMatrix:function(a){var b=
+a).lengthSq()},getPositionFromMatrix:function(a){this.x=a.elements[12];this.y=a.elements[13];this.z=a.elements[14];return this},getRotationFromMatrix:function(a,b){var c=b?b.x:1,d=b?b.y:1,e=b?b.z:1,f=a.elements[0]/c,g=a.elements[4]/d,c=a.elements[1]/c,d=a.elements[5]/d,h=a.elements[9]/e,k=a.elements[10]/e;this.y=Math.asin(a.elements[8]/e);e=Math.cos(this.y);if(Math.abs(e)>1.0E-5){this.x=Math.atan2(-h/e,k/e);this.z=Math.atan2(-g/e,f/e)}else{this.x=0;this.z=Math.atan2(c,d)}return this},getScaleFromMatrix:function(a){var b=
 this.set(a.elements[0],a.elements[1],a.elements[2]).length(),c=this.set(a.elements[4],a.elements[5],a.elements[6]).length(),a=this.set(a.elements[8],a.elements[9],a.elements[10]).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 this.lengthSq()<1.0E-4},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=d!==void 0?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=a.w!==void 0?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=this.x+a.x;this.y=this.y+a.y;this.z=this.z+a.z;this.w=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=
 this.x-a.x;this.y=this.y-a.y;this.z=this.z-a.z;this.w=this.w-a.w;return this},multiplyScalar:function(a){this.x=this.x*a;this.y=this.y*a;this.z=this.z*a;this.w=this.w*a;return this},divideScalar:function(a){if(a){this.x=this.x/a;this.y=this.y/a;this.z=this.z/a;this.w=this.w/a}else{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=this.x+(a.x-this.x)*b;this.y=this.y+(a.y-this.y)*b;this.z=this.z+(a.z-this.z)*b;this.w=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,d=a.elements,a=d[0];b=d[1];var e=d[2],f=d[3],g=d[4],h=d[5],l=d[6],k=d[7],j=d[8],o=d[9],m=d[10],p=d[11],r=d[12],n=d[13],q=d[14],d=d[15];c[0].set(f-a,k-g,p-j,d-r);c[1].set(f+a,k+g,p+j,d+r);c[2].set(f+b,k+h,p+o,d+n);c[3].set(f-b,k-h,p-o,d-n);c[4].set(f-e,k-l,p-m,d-q);c[5].set(f+e,k+l,p+m,d+q);for(a=0;a<6;a++){b=c[a];b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}};
+THREE.Frustum.prototype.setFromMatrix=function(a){var b,c=this.planes,d=a.elements,a=d[0];b=d[1];var e=d[2],f=d[3],g=d[4],h=d[5],k=d[6],j=d[7],l=d[8],o=d[9],n=d[10],p=d[11],r=d[12],m=d[13],q=d[14],d=d[15];c[0].set(f-a,j-g,p-l,d-r);c[1].set(f+a,j+g,p+l,d+r);c[2].set(f+b,j+h,p+o,d+m);c[3].set(f-b,j-h,p-o,d-m);c[4].set(f-e,j-k,p-n,d-q);c[5].set(f+e,j+k,p+n,d+q);for(a=0;a<6;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=c.elements,c=-a.geometry.boundingSphere.radius*c.getMaxScaleOnAxis(),e=0;e<6;e++){a=b[e].x*d[12]+b[e].y*d[13]+b[e].z*d[14]+b[e].w;if(a<=c)return false}return true};THREE.Frustum.__v1=new THREE.Vector3;
-THREE.Ray=function(a,b){function c(a,b,c){r.sub(c,a);u=r.dot(b);t=n.add(a,q.copy(b).multiplyScalar(u));return x=c.distanceTo(t)}function d(a,b,c,d){r.sub(d,b);n.sub(c,b);q.sub(a,b);s=r.dot(r);z=r.dot(n);D=r.dot(q);B=n.dot(n);v=n.dot(q);w=1/(s*B-z*z);H=(B*D-z*v)*w;I=(s*v-z*D)*w;return H>=0&&I>=0&&H+I<1}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,
-k=new THREE.Vector3,j=new THREE.Vector3,o=new THREE.Vector3,m=new THREE.Vector3,p=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,u=a.geometry,t=u.vertices,L;a.matrixRotationWorld.extractRotation(a.matrixWorld);r=0;for(q=u.faces.length;r<q;r++){b=u.faces[r];k.copy(this.origin);j.copy(this.direction);L=a.matrixWorld;o=L.multiplyVector3(o.copy(b.centroid)).subSelf(k);m=a.matrixRotationWorld.multiplyVector3(m.copy(b.normal));s=j.dot(m);if(!(Math.abs(s)<e)){i=m.dot(o)/s;if(!(i<0)&&(a.doubleSided||(a.flipSided?
-s>0:s<0))){p.add(k,j.multiplyScalar(i));if(b instanceof THREE.Face3){f=L.multiplyVector3(f.copy(t[b.a]));g=L.multiplyVector3(g.copy(t[b.b]));h=L.multiplyVector3(h.copy(t[b.c]));if(d(p,f,g,h)){b={distance:k.distanceTo(p),point:p.clone(),face:b,object:a};n.push(b)}}else if(b instanceof THREE.Face4){f=L.multiplyVector3(f.copy(t[b.a]));g=L.multiplyVector3(g.copy(t[b.b]));h=L.multiplyVector3(h.copy(t[b.c]));l=L.multiplyVector3(l.copy(t[b.d]));if(d(p,f,g,l)||d(p,g,h,l)){b={distance:k.distanceTo(p),point:p.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,u,t,x,s,z,D,B,v,w,H,I};
-THREE.Rectangle=function(){function a(){f=d-b;g=e-c}var b,c,d,e,f,g,h=true;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,o){h=false;b=f;c=g;d=j;e=o;a()};this.addPoint=function(f,g){if(h){h=false;b=f;c=g;d=f;e=g}else{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,o,m,p){if(h){h=false;b=f<j?f<m?f:m:j<m?j:m;c=g<o?g<p?g:p:o<p?o:p;d=f>j?f>m?f:m:j>m?j:m;e=g>o?g>p?g:p:o>p?o:p}else{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<o?g<p?g<c?g:c:p<c?p:c:o<p?o<c?o:c:p<c?p: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>o?g>p?g>e?g:e:p>e?p:e:o>p?o>e?o:e:p>e?p:e}a()};this.addRectangle=function(f){if(h){h=false;b=f.getLeft();c=f.getTop();d=f.getRight();e=f.getBottom()}else{b=b<f.getLeft()?b:f.getLeft();c=c<f.getTop()?c:f.getTop();
+THREE.Ray=function(a,b){function c(a,b,c){r.sub(c,a);u=r.dot(b);t=m.add(a,q.copy(b).multiplyScalar(u));return w=c.distanceTo(t)}function d(a,b,c,d){r.sub(d,b);m.sub(c,b);q.sub(a,b);s=r.dot(r);x=r.dot(m);F=r.dot(q);E=m.dot(m);B=m.dot(q);v=1/(s*E-x*x);z=(E*F-x*B)*v;J=(s*B-x*F)*v;return z>=0&&J>=0&&z+J<1}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,
+j=new THREE.Vector3,l=new THREE.Vector3,o=new THREE.Vector3,n=new THREE.Vector3,p=new THREE.Vector3;this.intersectObject=function(a){var b,m=[];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};m.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 m;var s,i,u=a.geometry,t=u.vertices,C;a.matrixRotationWorld.extractRotation(a.matrixWorld);r=0;for(q=u.faces.length;r<q;r++){b=u.faces[r];j.copy(this.origin);l.copy(this.direction);C=a.matrixWorld;o=C.multiplyVector3(o.copy(b.centroid)).subSelf(j);n=a.matrixRotationWorld.multiplyVector3(n.copy(b.normal));s=l.dot(n);if(!(Math.abs(s)<e)){i=n.dot(o)/s;if(!(i<0)&&(a.doubleSided||(a.flipSided?
+s>0:s<0))){p.add(j,l.multiplyScalar(i));if(b instanceof THREE.Face3){f=C.multiplyVector3(f.copy(t[b.a]));g=C.multiplyVector3(g.copy(t[b.b]));h=C.multiplyVector3(h.copy(t[b.c]));if(d(p,f,g,h)){b={distance:j.distanceTo(p),point:p.clone(),face:b,object:a};m.push(b)}}else if(b instanceof THREE.Face4){f=C.multiplyVector3(f.copy(t[b.a]));g=C.multiplyVector3(g.copy(t[b.b]));h=C.multiplyVector3(h.copy(t[b.c]));k=C.multiplyVector3(k.copy(t[b.d]));if(d(p,f,g,k)||d(p,g,h,k)){b={distance:j.distanceTo(p),point:p.clone(),
+face:b,object:a};m.push(b)}}}}}}return m};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,m=new THREE.Vector3,q=new THREE.Vector3,u,t,w,s,x,F,E,B,v,z,J};
+THREE.Rectangle=function(){function a(){f=d-b;g=e-c}var b,c,d,e,f,g,h=true;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,l,o){h=false;b=f;c=g;d=l;e=o;a()};this.addPoint=function(f,g){if(h){h=false;b=f;c=g;d=f;e=g}else{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,l,o,n,p){if(h){h=false;b=f<l?f<n?f:n:l<n?l:n;c=g<o?g<p?g:p:o<p?o:p;d=f>l?f>n?f:n:l>n?l:n;e=g>o?g>p?g:p:o>p?o:p}else{b=f<l?f<n?f<b?f:b:n<b?n:b:l<n?l<b?l:b:n<b?n:b;c=g<o?g<p?g<c?g:c:p<c?p:c:o<p?o<c?o:c:p<c?p:c;d=f>l?f>n?f>d?f:d:n>d?n:d:l>n?l>d?l:d:n>d?n:d;e=g>o?g>p?g>e?g:e:p>e?p:e:o>p?o>e?o:e:p>e?p:e}a()};this.addRectangle=function(f){if(h){h=false;b=f.getLeft();c=f.getTop();d=f.getRight();e=f.getBottom()}else{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=b-f;c=c-f;d=d+f;e=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()?false:true};this.empty=function(){h=true;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 a<0?-1:a>0?1:0}};THREE.Matrix3=function(){this.elements=new Float32Array(9)};
-THREE.Matrix3.prototype={constructor:THREE.Matrix3,getInverse:function(a){var b=a.elements,a=b[10]*b[5]-b[6]*b[9],c=-b[10]*b[1]+b[2]*b[9],d=b[6]*b[1]-b[2]*b[5],e=-b[10]*b[4]+b[6]*b[8],f=b[10]*b[0]-b[2]*b[8],g=-b[6]*b[0]+b[2]*b[4],h=b[9]*b[4]-b[5]*b[8],l=-b[9]*b[0]+b[1]*b[8],k=b[5]*b[0]-b[1]*b[4],b=b[0]*a+b[1]*e+b[2]*h;b===0&&console.warn("Matrix3.getInverse(): determinant == 0");var b=1/b,j=this.elements;j[0]=b*a;j[1]=b*c;j[2]=b*d;j[3]=b*e;j[4]=b*f;j[5]=b*g;j[6]=b*h;j[7]=b*l;j[8]=b*k;return this},
-transpose:function(){var a,b=this.elements;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}};THREE.Matrix4=function(a,b,c,d,e,f,g,h,l,k,j,o,m,p,r,n){this.elements=new Float32Array(16);this.set(a!==void 0?a:1,b||0,c||0,d||0,e||0,f!==void 0?f:1,g||0,h||0,l||0,k||0,j!==void 0?j:1,o||0,m||0,p||0,r||0,n!==void 0?n:1)};
-THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,e,f,g,h,l,k,j,o,m,p,r,n){var q=this.elements;q[0]=a;q[4]=b;q[8]=c;q[12]=d;q[1]=e;q[5]=f;q[9]=g;q[13]=h;q[2]=l;q[6]=k;q[10]=j;q[14]=o;q[3]=m;q[7]=p;q[11]=r;q[15]=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){a=a.elements;this.set(a[0],a[4],a[8],a[12],a[1],a[5],a[9],a[13],a[2],a[6],a[10],a[14],a[3],a[7],a[11],a[15]);return this},lookAt:function(a,b,c){var d=this.elements,
-e=THREE.Matrix4.__v1,f=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;g.sub(a,b).normalize();if(g.length()===0)g.z=1;e.cross(c,g).normalize();if(e.length()===0){g.x=g.x+1.0E-4;e.cross(c,g).normalize()}f.cross(g,e);d[0]=e.x;d[4]=f.x;d[8]=g.x;d[1]=e.y;d[5]=f.y;d[9]=g.y;d[2]=e.z;d[6]=f.z;d[10]=g.z;return this},multiply:function(a,b){var c=a.elements,d=b.elements,e=this.elements,f=c[0],g=c[4],h=c[8],l=c[12],k=c[1],j=c[5],o=c[9],m=c[13],p=c[2],r=c[6],n=c[10],q=c[14],u=c[3],t=c[7],x=c[11],c=c[15],s=d[0],z=d[4],
-D=d[8],B=d[12],v=d[1],w=d[5],H=d[9],I=d[13],M=d[2],T=d[6],C=d[10],K=d[14],O=d[3],E=d[7],i=d[11],d=d[15];e[0]=f*s+g*v+h*M+l*O;e[4]=f*z+g*w+h*T+l*E;e[8]=f*D+g*H+h*C+l*i;e[12]=f*B+g*I+h*K+l*d;e[1]=k*s+j*v+o*M+m*O;e[5]=k*z+j*w+o*T+m*E;e[9]=k*D+j*H+o*C+m*i;e[13]=k*B+j*I+o*K+m*d;e[2]=p*s+r*v+n*M+q*O;e[6]=p*z+r*w+n*T+q*E;e[10]=p*D+r*H+n*C+q*i;e[14]=p*B+r*I+n*K+q*d;e[3]=u*s+t*v+x*M+c*O;e[7]=u*z+t*w+x*T+c*E;e[11]=u*D+t*H+x*C+c*i;e[15]=u*B+t*I+x*K+c*d;return this},multiplySelf:function(a){return this.multiply(this,
+THREE.Matrix3.prototype={constructor:THREE.Matrix3,getInverse:function(a){var b=a.elements,a=b[10]*b[5]-b[6]*b[9],c=-b[10]*b[1]+b[2]*b[9],d=b[6]*b[1]-b[2]*b[5],e=-b[10]*b[4]+b[6]*b[8],f=b[10]*b[0]-b[2]*b[8],g=-b[6]*b[0]+b[2]*b[4],h=b[9]*b[4]-b[5]*b[8],k=-b[9]*b[0]+b[1]*b[8],j=b[5]*b[0]-b[1]*b[4],b=b[0]*a+b[1]*e+b[2]*h;b===0&&console.warn("Matrix3.getInverse(): determinant == 0");var b=1/b,l=this.elements;l[0]=b*a;l[1]=b*c;l[2]=b*d;l[3]=b*e;l[4]=b*f;l[5]=b*g;l[6]=b*h;l[7]=b*k;l[8]=b*j;return this},
+transpose:function(){var a,b=this.elements;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}};THREE.Matrix4=function(a,b,c,d,e,f,g,h,k,j,l,o,n,p,r,m){this.elements=new Float32Array(16);this.set(a!==void 0?a:1,b||0,c||0,d||0,e||0,f!==void 0?f:1,g||0,h||0,k||0,j||0,l!==void 0?l:1,o||0,n||0,p||0,r||0,m!==void 0?m:1)};
+THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,e,f,g,h,k,j,l,o,n,p,r,m){var q=this.elements;q[0]=a;q[4]=b;q[8]=c;q[12]=d;q[1]=e;q[5]=f;q[9]=g;q[13]=h;q[2]=k;q[6]=j;q[10]=l;q[14]=o;q[3]=n;q[7]=p;q[11]=r;q[15]=m;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){a=a.elements;this.set(a[0],a[4],a[8],a[12],a[1],a[5],a[9],a[13],a[2],a[6],a[10],a[14],a[3],a[7],a[11],a[15]);return this},lookAt:function(a,b,c){var d=this.elements,
+e=THREE.Matrix4.__v1,f=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;g.sub(a,b).normalize();if(g.length()===0)g.z=1;e.cross(c,g).normalize();if(e.length()===0){g.x=g.x+1.0E-4;e.cross(c,g).normalize()}f.cross(g,e);d[0]=e.x;d[4]=f.x;d[8]=g.x;d[1]=e.y;d[5]=f.y;d[9]=g.y;d[2]=e.z;d[6]=f.z;d[10]=g.z;return this},multiply:function(a,b){var c=a.elements,d=b.elements,e=this.elements,f=c[0],g=c[4],h=c[8],k=c[12],j=c[1],l=c[5],o=c[9],n=c[13],p=c[2],r=c[6],m=c[10],q=c[14],u=c[3],t=c[7],w=c[11],c=c[15],s=d[0],x=d[4],
+F=d[8],E=d[12],B=d[1],v=d[5],z=d[9],J=d[13],K=d[2],X=d[6],Q=d[10],A=d[14],M=d[3],G=d[7],i=d[11],d=d[15];e[0]=f*s+g*B+h*K+k*M;e[4]=f*x+g*v+h*X+k*G;e[8]=f*F+g*z+h*Q+k*i;e[12]=f*E+g*J+h*A+k*d;e[1]=j*s+l*B+o*K+n*M;e[5]=j*x+l*v+o*X+n*G;e[9]=j*F+l*z+o*Q+n*i;e[13]=j*E+l*J+o*A+n*d;e[2]=p*s+r*B+m*K+q*M;e[6]=p*x+r*v+m*X+q*G;e[10]=p*F+r*z+m*Q+q*i;e[14]=p*E+r*J+m*A+q*d;e[3]=u*s+t*B+w*K+c*M;e[7]=u*x+t*v+w*X+c*G;e[11]=u*F+t*z+w*Q+c*i;e[15]=u*E+t*J+w*A+c*d;return this},multiplySelf:function(a){return this.multiply(this,
 a)},multiplyToArray:function(a,b,c){var d=this.elements;this.multiply(a,b);c[0]=d[0];c[1]=d[1];c[2]=d[2];c[3]=d[3];c[4]=d[4];c[5]=d[5];c[6]=d[6];c[7]=d[7];c[8]=d[8];c[9]=d[9];c[10]=d[10];c[11]=d[11];c[12]=d[12];c[13]=d[13];c[14]=d[14];c[15]=d[15];return this},multiplyScalar:function(a){var b=this.elements;b[0]=b[0]*a;b[4]=b[4]*a;b[8]=b[8]*a;b[12]=b[12]*a;b[1]=b[1]*a;b[5]=b[5]*a;b[9]=b[9]*a;b[13]=b[13]*a;b[2]=b[2]*a;b[6]=b[6]*a;b[10]=b[10]*a;b[14]=b[14]*a;b[3]=b[3]*a;b[7]=b[7]*a;b[11]=b[11]*a;b[15]=
 b[15]*a;return this},multiplyVector3:function(a){var b=this.elements,c=a.x,d=a.y,e=a.z,f=1/(b[3]*c+b[7]*d+b[11]*e+b[15]);a.x=(b[0]*c+b[4]*d+b[8]*e+b[12])*f;a.y=(b[1]*c+b[5]*d+b[9]*e+b[13])*f;a.z=(b[2]*c+b[6]*d+b[10]*e+b[14])*f;return a},multiplyVector4:function(a){var b=this.elements,c=a.x,d=a.y,e=a.z,f=a.w;a.x=b[0]*c+b[4]*d+b[8]*e+b[12]*f;a.y=b[1]*c+b[5]*d+b[9]*e+b[13]*f;a.z=b[2]*c+b[6]*d+b[10]*e+b[14]*f;a.w=b[3]*c+b[7]*d+b[11]*e+b[15]*f;return a},rotateAxis:function(a){var b=this.elements,c=a.x,
-d=a.y,e=a.z;a.x=c*b[0]+d*b[4]+e*b[8];a.y=c*b[1]+d*b[5]+e*b[9];a.z=c*b[2]+d*b[6]+e*b[10];a.normalize();return a},crossVector:function(a){var b=this.elements,c=new THREE.Vector4;c.x=b[0]*a.x+b[4]*a.y+b[8]*a.z+b[12]*a.w;c.y=b[1]*a.x+b[5]*a.y+b[9]*a.z+b[13]*a.w;c.z=b[2]*a.x+b[6]*a.y+b[10]*a.z+b[14]*a.w;c.w=a.w?b[3]*a.x+b[7]*a.y+b[11]*a.z+b[15]*a.w:1;return c},determinant:function(){var a=this.elements,b=a[0],c=a[4],d=a[8],e=a[12],f=a[1],g=a[5],h=a[9],l=a[13],k=a[2],j=a[6],o=a[10],m=a[14],p=a[3],r=a[7],
-n=a[11],a=a[15];return e*h*j*p-d*l*j*p-e*g*o*p+c*l*o*p+d*g*m*p-c*h*m*p-e*h*k*r+d*l*k*r+e*f*o*r-b*l*o*r-d*f*m*r+b*h*m*r+e*g*k*n-c*l*k*n-e*f*j*n+b*l*j*n+c*f*m*n-b*g*m*n-d*g*k*a+c*h*k*a+d*f*j*a-b*h*j*a-c*f*o*a+b*g*o*a},transpose:function(){var a=this.elements,b;b=a[1];a[1]=a[4];a[4]=b;b=a[2];a[2]=a[8];a[8]=b;b=a[6];a[6]=a[9];a[9]=b;b=a[3];a[3]=a[12];a[12]=b;b=a[7];a[7]=a[13];a[13]=b;b=a[11];a[11]=a[14];a[14]=b;return this},flattenToArray:function(a){var b=this.elements;a[0]=b[0];a[1]=b[1];a[2]=b[2];
+d=a.y,e=a.z;a.x=c*b[0]+d*b[4]+e*b[8];a.y=c*b[1]+d*b[5]+e*b[9];a.z=c*b[2]+d*b[6]+e*b[10];a.normalize();return a},crossVector:function(a){var b=this.elements,c=new THREE.Vector4;c.x=b[0]*a.x+b[4]*a.y+b[8]*a.z+b[12]*a.w;c.y=b[1]*a.x+b[5]*a.y+b[9]*a.z+b[13]*a.w;c.z=b[2]*a.x+b[6]*a.y+b[10]*a.z+b[14]*a.w;c.w=a.w?b[3]*a.x+b[7]*a.y+b[11]*a.z+b[15]*a.w:1;return c},determinant:function(){var a=this.elements,b=a[0],c=a[4],d=a[8],e=a[12],f=a[1],g=a[5],h=a[9],k=a[13],j=a[2],l=a[6],o=a[10],n=a[14],p=a[3],r=a[7],
+m=a[11],a=a[15];return e*h*l*p-d*k*l*p-e*g*o*p+c*k*o*p+d*g*n*p-c*h*n*p-e*h*j*r+d*k*j*r+e*f*o*r-b*k*o*r-d*f*n*r+b*h*n*r+e*g*j*m-c*k*j*m-e*f*l*m+b*k*l*m+c*f*n*m-b*g*n*m-d*g*j*a+c*h*j*a+d*f*l*a-b*h*l*a-c*f*o*a+b*g*o*a},transpose:function(){var a=this.elements,b;b=a[1];a[1]=a[4];a[4]=b;b=a[2];a[2]=a[8];a[8]=b;b=a[6];a[6]=a[9];a[9]=b;b=a[3];a[3]=a[12];a[12]=b;b=a[7];a[7]=a[13];a[13]=b;b=a[11];a[11]=a[14];a[14]=b;return this},flattenToArray:function(a){var b=this.elements;a[0]=b[0];a[1]=b[1];a[2]=b[2];
 a[3]=b[3];a[4]=b[4];a[5]=b[5];a[6]=b[6];a[7]=b[7];a[8]=b[8];a[9]=b[9];a[10]=b[10];a[11]=b[11];a[12]=b[12];a[13]=b[13];a[14]=b[14];a[15]=b[15];return a},flattenToArrayOffset:function(a,b){var c=this.elements;a[b]=c[0];a[b+1]=c[1];a[b+2]=c[2];a[b+3]=c[3];a[b+4]=c[4];a[b+5]=c[5];a[b+6]=c[6];a[b+7]=c[7];a[b+8]=c[8];a[b+9]=c[9];a[b+10]=c[10];a[b+11]=c[11];a[b+12]=c[12];a[b+13]=c[13];a[b+14]=c[14];a[b+15]=c[15];return a},getPosition:function(){var a=this.elements;return THREE.Matrix4.__v1.set(a[12],a[13],
-a[14])},setPosition:function(a){var b=this.elements;b[12]=a.x;b[13]=a.y;b[14]=a.z;return this},getColumnX:function(){var a=this.elements;return THREE.Matrix4.__v1.set(a[0],a[1],a[2])},getColumnY:function(){var a=this.elements;return THREE.Matrix4.__v1.set(a[4],a[5],a[6])},getColumnZ:function(){var a=this.elements;return THREE.Matrix4.__v1.set(a[8],a[9],a[10])},getInverse:function(a){var b=this.elements,c=a.elements,d=c[0],e=c[4],f=c[8],g=c[12],h=c[1],l=c[5],k=c[9],j=c[13],o=c[2],m=c[6],p=c[10],r=
-c[14],n=c[3],q=c[7],u=c[11],c=c[15];b[0]=k*r*q-j*p*q+j*m*u-l*r*u-k*m*c+l*p*c;b[4]=g*p*q-f*r*q-g*m*u+e*r*u+f*m*c-e*p*c;b[8]=f*j*q-g*k*q+g*l*u-e*j*u-f*l*c+e*k*c;b[12]=g*k*m-f*j*m-g*l*p+e*j*p+f*l*r-e*k*r;b[1]=j*p*n-k*r*n-j*o*u+h*r*u+k*o*c-h*p*c;b[5]=f*r*n-g*p*n+g*o*u-d*r*u-f*o*c+d*p*c;b[9]=g*k*n-f*j*n-g*h*u+d*j*u+f*h*c-d*k*c;b[13]=f*j*o-g*k*o+g*h*p-d*j*p-f*h*r+d*k*r;b[2]=l*r*n-j*m*n+j*o*q-h*r*q-l*o*c+h*m*c;b[6]=g*m*n-e*r*n-g*o*q+d*r*q+e*o*c-d*m*c;b[10]=e*j*n-g*l*n+g*h*q-d*j*q-e*h*c+d*l*c;b[14]=g*l*o-
-e*j*o-g*h*m+d*j*m+e*h*r-d*l*r;b[3]=k*m*n-l*p*n-k*o*q+h*p*q+l*o*u-h*m*u;b[7]=e*p*n-f*m*n+f*o*q-d*p*q-e*o*u+d*m*u;b[11]=f*l*n-e*k*n-f*h*q+d*k*q+e*h*u-d*l*u;b[15]=e*k*o-f*l*o+f*h*m-d*k*m-e*h*p+d*l*p;this.multiplyScalar(1/a.determinant());return this},setRotationFromEuler:function(a,b){var c=this.elements,d=a.x,e=a.y,f=a.z,g=Math.cos(d),d=Math.sin(d),h=Math.cos(e),e=Math.sin(e),l=Math.cos(f),f=Math.sin(f);switch(b){case "YXZ":var k=h*l,j=h*f,o=e*l,m=e*f;c[0]=k+m*d;c[4]=o*d-j;c[8]=g*e;c[1]=g*f;c[5]=g*
-l;c[9]=-d;c[2]=j*d-o;c[6]=m+k*d;c[10]=g*h;break;case "ZXY":k=h*l;j=h*f;o=e*l;m=e*f;c[0]=k-m*d;c[4]=-g*f;c[8]=o+j*d;c[1]=j+o*d;c[5]=g*l;c[9]=m-k*d;c[2]=-g*e;c[6]=d;c[10]=g*h;break;case "ZYX":k=g*l;j=g*f;o=d*l;m=d*f;c[0]=h*l;c[4]=o*e-j;c[8]=k*e+m;c[1]=h*f;c[5]=m*e+k;c[9]=j*e-o;c[2]=-e;c[6]=d*h;c[10]=g*h;break;case "YZX":k=g*h;j=g*e;o=d*h;m=d*e;c[0]=h*l;c[4]=m-k*f;c[8]=o*f+j;c[1]=f;c[5]=g*l;c[9]=-d*l;c[2]=-e*l;c[6]=j*f+o;c[10]=k-m*f;break;case "XZY":k=g*h;j=g*e;o=d*h;m=d*e;c[0]=h*l;c[4]=-f;c[8]=e*l;
-c[1]=k*f+m;c[5]=g*l;c[9]=j*f-o;c[2]=o*f-j;c[6]=d*l;c[10]=m*f+k;break;default:k=g*l;j=g*f;o=d*l;m=d*f;c[0]=h*l;c[4]=-h*f;c[8]=e;c[1]=j+o*e;c[5]=k-m*e;c[9]=-d*h;c[2]=m-k*e;c[6]=o+j*e;c[10]=g*h}return this},setRotationFromQuaternion:function(a){var b=this.elements,c=a.x,d=a.y,e=a.z,f=a.w,g=c+c,h=d+d,l=e+e,a=c*g,k=c*h,c=c*l,j=d*h,d=d*l,e=e*l,g=f*g,h=f*h,f=f*l;b[0]=1-(j+e);b[4]=k-f;b[8]=c+h;b[1]=k+f;b[5]=1-(a+e);b[9]=d-g;b[2]=c-h;b[6]=d+g;b[10]=1-(a+j);return this},compose:function(a,b,c){var d=this.elements,
+a[14])},setPosition:function(a){var b=this.elements;b[12]=a.x;b[13]=a.y;b[14]=a.z;return this},getColumnX:function(){var a=this.elements;return THREE.Matrix4.__v1.set(a[0],a[1],a[2])},getColumnY:function(){var a=this.elements;return THREE.Matrix4.__v1.set(a[4],a[5],a[6])},getColumnZ:function(){var a=this.elements;return THREE.Matrix4.__v1.set(a[8],a[9],a[10])},getInverse:function(a){var b=this.elements,c=a.elements,d=c[0],e=c[4],f=c[8],g=c[12],h=c[1],k=c[5],j=c[9],l=c[13],o=c[2],n=c[6],p=c[10],r=
+c[14],m=c[3],q=c[7],u=c[11],c=c[15];b[0]=j*r*q-l*p*q+l*n*u-k*r*u-j*n*c+k*p*c;b[4]=g*p*q-f*r*q-g*n*u+e*r*u+f*n*c-e*p*c;b[8]=f*l*q-g*j*q+g*k*u-e*l*u-f*k*c+e*j*c;b[12]=g*j*n-f*l*n-g*k*p+e*l*p+f*k*r-e*j*r;b[1]=l*p*m-j*r*m-l*o*u+h*r*u+j*o*c-h*p*c;b[5]=f*r*m-g*p*m+g*o*u-d*r*u-f*o*c+d*p*c;b[9]=g*j*m-f*l*m-g*h*u+d*l*u+f*h*c-d*j*c;b[13]=f*l*o-g*j*o+g*h*p-d*l*p-f*h*r+d*j*r;b[2]=k*r*m-l*n*m+l*o*q-h*r*q-k*o*c+h*n*c;b[6]=g*n*m-e*r*m-g*o*q+d*r*q+e*o*c-d*n*c;b[10]=e*l*m-g*k*m+g*h*q-d*l*q-e*h*c+d*k*c;b[14]=g*k*o-
+e*l*o-g*h*n+d*l*n+e*h*r-d*k*r;b[3]=j*n*m-k*p*m-j*o*q+h*p*q+k*o*u-h*n*u;b[7]=e*p*m-f*n*m+f*o*q-d*p*q-e*o*u+d*n*u;b[11]=f*k*m-e*j*m-f*h*q+d*j*q+e*h*u-d*k*u;b[15]=e*j*o-f*k*o+f*h*n-d*j*n-e*h*p+d*k*p;this.multiplyScalar(1/a.determinant());return this},setRotationFromEuler:function(a,b){var c=this.elements,d=a.x,e=a.y,f=a.z,g=Math.cos(d),d=Math.sin(d),h=Math.cos(e),e=Math.sin(e),k=Math.cos(f),f=Math.sin(f);switch(b){case "YXZ":var j=h*k,l=h*f,o=e*k,n=e*f;c[0]=j+n*d;c[4]=o*d-l;c[8]=g*e;c[1]=g*f;c[5]=g*
+k;c[9]=-d;c[2]=l*d-o;c[6]=n+j*d;c[10]=g*h;break;case "ZXY":j=h*k;l=h*f;o=e*k;n=e*f;c[0]=j-n*d;c[4]=-g*f;c[8]=o+l*d;c[1]=l+o*d;c[5]=g*k;c[9]=n-j*d;c[2]=-g*e;c[6]=d;c[10]=g*h;break;case "ZYX":j=g*k;l=g*f;o=d*k;n=d*f;c[0]=h*k;c[4]=o*e-l;c[8]=j*e+n;c[1]=h*f;c[5]=n*e+j;c[9]=l*e-o;c[2]=-e;c[6]=d*h;c[10]=g*h;break;case "YZX":j=g*h;l=g*e;o=d*h;n=d*e;c[0]=h*k;c[4]=n-j*f;c[8]=o*f+l;c[1]=f;c[5]=g*k;c[9]=-d*k;c[2]=-e*k;c[6]=l*f+o;c[10]=j-n*f;break;case "XZY":j=g*h;l=g*e;o=d*h;n=d*e;c[0]=h*k;c[4]=-f;c[8]=e*k;
+c[1]=j*f+n;c[5]=g*k;c[9]=l*f-o;c[2]=o*f-l;c[6]=d*k;c[10]=n*f+j;break;default:j=g*k;l=g*f;o=d*k;n=d*f;c[0]=h*k;c[4]=-h*f;c[8]=e;c[1]=l+o*e;c[5]=j-n*e;c[9]=-d*h;c[2]=n-j*e;c[6]=o+l*e;c[10]=g*h}return this},setRotationFromQuaternion:function(a){var b=this.elements,c=a.x,d=a.y,e=a.z,f=a.w,g=c+c,h=d+d,k=e+e,a=c*g,j=c*h,c=c*k,l=d*h,d=d*k,e=e*k,g=f*g,h=f*h,f=f*k;b[0]=1-(l+e);b[4]=j-f;b[8]=c+h;b[1]=j+f;b[5]=1-(a+e);b[9]=d-g;b[2]=c-h;b[6]=d+g;b[10]=1-(a+l);return this},compose:function(a,b,c){var d=this.elements,
 e=THREE.Matrix4.__m1,f=THREE.Matrix4.__m2;e.identity();e.setRotationFromQuaternion(b);f.makeScale(c.x,c.y,c.z);this.multiply(e,f);d[12]=a.x;d[13]=a.y;d[14]=a.z;return this},decompose:function(a,b,c){var d=this.elements,e=THREE.Matrix4.__v1,f=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;e.set(d[0],d[1],d[2]);f.set(d[4],d[5],d[6]);g.set(d[8],d[9],d[10]);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=e.length();c.y=f.length();c.z=g.length();a.x=d[12];a.y=d[13];a.z=d[14];d=THREE.Matrix4.__m1;d.copy(this);d.elements[0]=d.elements[0]/c.x;d.elements[1]=d.elements[1]/c.x;d.elements[2]=d.elements[2]/c.x;d.elements[4]=d.elements[4]/c.y;d.elements[5]=d.elements[5]/c.y;d.elements[6]=d.elements[6]/c.y;d.elements[8]=d.elements[8]/c.z;d.elements[9]=d.elements[9]/c.z;d.elements[10]=d.elements[10]/c.z;b.setFromRotationMatrix(d);return[a,b,c]},extractPosition:function(a){var b=this.elements,a=a.elements;
 b[12]=a[12];b[13]=a[13];b[14]=a[14];return this},extractRotation:function(a){var b=this.elements,a=a.elements,c=THREE.Matrix4.__v1,d=1/c.set(a[0],a[1],a[2]).length(),e=1/c.set(a[4],a[5],a[6]).length(),c=1/c.set(a[8],a[9],a[10]).length();b[0]=a[0]*d;b[1]=a[1]*d;b[2]=a[2]*d;b[4]=a[4]*e;b[5]=a[5]*e;b[6]=a[6]*e;b[8]=a[8]*c;b[9]=a[9]*c;b[10]=a[10]*c;return this},translate:function(a){var b=this.elements,c=a.x,d=a.y,a=a.z;b[12]=b[0]*c+b[4]*d+b[8]*a+b[12];b[13]=b[1]*c+b[5]*d+b[9]*a+b[13];b[14]=b[2]*c+b[6]*
-d+b[10]*a+b[14];b[15]=b[3]*c+b[7]*d+b[11]*a+b[15];return this},rotateX:function(a){var b=this.elements,c=b[4],d=b[5],e=b[6],f=b[7],g=b[8],h=b[9],l=b[10],k=b[11],j=Math.cos(a),a=Math.sin(a);b[4]=j*c+a*g;b[5]=j*d+a*h;b[6]=j*e+a*l;b[7]=j*f+a*k;b[8]=j*g-a*c;b[9]=j*h-a*d;b[10]=j*l-a*e;b[11]=j*k-a*f;return this},rotateY:function(a){var b=this.elements,c=b[0],d=b[1],e=b[2],f=b[3],g=b[8],h=b[9],l=b[10],k=b[11],j=Math.cos(a),a=Math.sin(a);b[0]=j*c-a*g;b[1]=j*d-a*h;b[2]=j*e-a*l;b[3]=j*f-a*k;b[8]=j*g+a*c;b[9]=
-j*h+a*d;b[10]=j*l+a*e;b[11]=j*k+a*f;return this},rotateZ:function(a){var b=this.elements,c=b[0],d=b[1],e=b[2],f=b[3],g=b[4],h=b[5],l=b[6],k=b[7],j=Math.cos(a),a=Math.sin(a);b[0]=j*c+a*g;b[1]=j*d+a*h;b[2]=j*e+a*l;b[3]=j*f+a*k;b[4]=j*g-a*c;b[5]=j*h-a*d;b[6]=j*l-a*e;b[7]=j*k-a*f;return this},rotateByAxis:function(a,b){var c=this.elements;if(a.x===1&&a.y===0&&a.z===0)return this.rotateX(b);if(a.x===0&&a.y===1&&a.z===0)return this.rotateY(b);if(a.x===0&&a.y===0&&a.z===1)return this.rotateZ(b);var d=a.x,
-e=a.y,f=a.z,g=Math.sqrt(d*d+e*e+f*f),d=d/g,e=e/g,f=f/g,g=d*d,h=e*e,l=f*f,k=Math.cos(b),j=Math.sin(b),o=1-k,m=d*e*o,p=d*f*o,o=e*f*o,d=d*j,r=e*j,j=f*j,f=g+(1-g)*k,g=m+j,e=p-r,m=m-j,h=h+(1-h)*k,j=o+d,p=p+r,o=o-d,l=l+(1-l)*k,k=c[0],d=c[1],r=c[2],n=c[3],q=c[4],u=c[5],t=c[6],x=c[7],s=c[8],z=c[9],D=c[10],B=c[11];c[0]=f*k+g*q+e*s;c[1]=f*d+g*u+e*z;c[2]=f*r+g*t+e*D;c[3]=f*n+g*x+e*B;c[4]=m*k+h*q+j*s;c[5]=m*d+h*u+j*z;c[6]=m*r+h*t+j*D;c[7]=m*n+h*x+j*B;c[8]=p*k+o*q+l*s;c[9]=p*d+o*u+l*z;c[10]=p*r+o*t+l*D;c[11]=
-p*n+o*x+l*B;return this},scale:function(a){var b=this.elements,c=a.x,d=a.y,a=a.z;b[0]=b[0]*c;b[4]=b[4]*d;b[8]=b[8]*a;b[1]=b[1]*c;b[5]=b[5]*d;b[9]=b[9]*a;b[2]=b[2]*c;b[6]=b[6]*d;b[10]=b[10]*a;b[3]=b[3]*c;b[7]=b[7]*d;b[11]=b[11]*a;return this},getMaxScaleOnAxis:function(){var a=this.elements;return Math.sqrt(Math.max(a[0]*a[0]+a[1]*a[1]+a[2]*a[2],Math.max(a[4]*a[4]+a[5]*a[5]+a[6]*a[6],a[8]*a[8]+a[9]*a[9]+a[10]*a[10])))},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,k=e*g;this.set(l*f+c,l*g-d*h,l*h+d*g,0,l*g+d*h,k*g+c,k*h-d*f,0,l*h-
-d*g,k*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){var g=this.elements;g[0]=2*e/(b-a);g[4]=0;g[8]=(b+a)/(b-a);g[12]=0;g[1]=0;g[5]=2*e/(d-c);g[9]=(d+c)/(d-c);g[13]=0;g[2]=0;g[6]=0;g[10]=-(f+e)/(f-e);g[14]=-2*f*e/(f-e);g[3]=0;g[7]=0;g[11]=-1;g[15]=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=this.elements,h=b-a,l=c-d,k=f-e;g[0]=2/h;g[4]=0;g[8]=0;g[12]=-((b+a)/h);g[1]=0;g[5]=2/l;g[9]=0;g[13]=-((c+d)/l);g[2]=0;g[6]=0;g[10]=-2/k;g[14]=-((f+e)/k);g[3]=0;g[7]=0;g[11]=0;g[15]=1;return this},clone:function(){var a=this.elements;return new THREE.Matrix4(a[0],a[4],a[8],a[12],a[1],a[5],a[9],a[13],a[2],a[6],a[10],a[14],a[3],a[7],a[11],a[15])}};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;
+d+b[10]*a+b[14];b[15]=b[3]*c+b[7]*d+b[11]*a+b[15];return this},rotateX:function(a){var b=this.elements,c=b[4],d=b[5],e=b[6],f=b[7],g=b[8],h=b[9],k=b[10],j=b[11],l=Math.cos(a),a=Math.sin(a);b[4]=l*c+a*g;b[5]=l*d+a*h;b[6]=l*e+a*k;b[7]=l*f+a*j;b[8]=l*g-a*c;b[9]=l*h-a*d;b[10]=l*k-a*e;b[11]=l*j-a*f;return this},rotateY:function(a){var b=this.elements,c=b[0],d=b[1],e=b[2],f=b[3],g=b[8],h=b[9],k=b[10],j=b[11],l=Math.cos(a),a=Math.sin(a);b[0]=l*c-a*g;b[1]=l*d-a*h;b[2]=l*e-a*k;b[3]=l*f-a*j;b[8]=l*g+a*c;b[9]=
+l*h+a*d;b[10]=l*k+a*e;b[11]=l*j+a*f;return this},rotateZ:function(a){var b=this.elements,c=b[0],d=b[1],e=b[2],f=b[3],g=b[4],h=b[5],k=b[6],j=b[7],l=Math.cos(a),a=Math.sin(a);b[0]=l*c+a*g;b[1]=l*d+a*h;b[2]=l*e+a*k;b[3]=l*f+a*j;b[4]=l*g-a*c;b[5]=l*h-a*d;b[6]=l*k-a*e;b[7]=l*j-a*f;return this},rotateByAxis:function(a,b){var c=this.elements;if(a.x===1&&a.y===0&&a.z===0)return this.rotateX(b);if(a.x===0&&a.y===1&&a.z===0)return this.rotateY(b);if(a.x===0&&a.y===0&&a.z===1)return this.rotateZ(b);var d=a.x,
+e=a.y,f=a.z,g=Math.sqrt(d*d+e*e+f*f),d=d/g,e=e/g,f=f/g,g=d*d,h=e*e,k=f*f,j=Math.cos(b),l=Math.sin(b),o=1-j,n=d*e*o,p=d*f*o,o=e*f*o,d=d*l,r=e*l,l=f*l,f=g+(1-g)*j,g=n+l,e=p-r,n=n-l,h=h+(1-h)*j,l=o+d,p=p+r,o=o-d,k=k+(1-k)*j,j=c[0],d=c[1],r=c[2],m=c[3],q=c[4],u=c[5],t=c[6],w=c[7],s=c[8],x=c[9],F=c[10],E=c[11];c[0]=f*j+g*q+e*s;c[1]=f*d+g*u+e*x;c[2]=f*r+g*t+e*F;c[3]=f*m+g*w+e*E;c[4]=n*j+h*q+l*s;c[5]=n*d+h*u+l*x;c[6]=n*r+h*t+l*F;c[7]=n*m+h*w+l*E;c[8]=p*j+o*q+k*s;c[9]=p*d+o*u+k*x;c[10]=p*r+o*t+k*F;c[11]=
+p*m+o*w+k*E;return this},scale:function(a){var b=this.elements,c=a.x,d=a.y,a=a.z;b[0]=b[0]*c;b[4]=b[4]*d;b[8]=b[8]*a;b[1]=b[1]*c;b[5]=b[5]*d;b[9]=b[9]*a;b[2]=b[2]*c;b[6]=b[6]*d;b[10]=b[10]*a;b[3]=b[3]*c;b[7]=b[7]*d;b[11]=b[11]*a;return this},getMaxScaleOnAxis:function(){var a=this.elements;return Math.sqrt(Math.max(a[0]*a[0]+a[1]*a[1]+a[2]*a[2],Math.max(a[4]*a[4]+a[5]*a[5]+a[6]*a[6],a[8]*a[8]+a[9]*a[9]+a[10]*a[10])))},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,k=e*f,j=e*g;this.set(k*f+c,k*g-d*h,k*h+d*g,0,k*g+d*h,j*g+c,j*h-d*f,0,k*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){var g=this.elements;g[0]=2*e/(b-a);g[4]=0;g[8]=(b+a)/(b-a);g[12]=0;g[1]=0;g[5]=2*e/(d-c);g[9]=(d+c)/(d-c);g[13]=0;g[2]=0;g[6]=0;g[10]=-(f+e)/(f-e);g[14]=-2*f*e/(f-e);g[3]=0;g[7]=0;g[11]=-1;g[15]=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=this.elements,h=b-a,k=c-d,j=f-e;g[0]=2/h;g[4]=0;g[8]=0;g[12]=-((b+a)/h);g[1]=0;g[5]=2/k;g[9]=0;g[13]=-((c+d)/k);g[2]=0;g[6]=0;g[10]=-2/j;g[14]=-((f+e)/j);g[3]=0;g[7]=0;g[11]=0;g[15]=1;return this},clone:function(){var a=this.elements;return new THREE.Matrix4(a[0],a[4],a[8],a[12],a[1],a[5],a[9],a[13],a[2],a[6],a[10],a[14],a[3],a[7],a[11],a[15])}};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=false;this.renderDepth=null;this.rotationAutoUpdate=true;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=
 true;this.quaternion=new THREE.Quaternion;this.useQuaternion=false;this.boundRadius=0;this.boundRadiusScale=1;this.visible=true;this.receiveShadow=this.castShadow=false;this.frustumCulled=true;this._vector=new THREE.Vector3};
@@ -63,24 +63,24 @@ this._vector.set(0,0,1))},lookAt:function(a){this.matrix.lookAt(a,this.position,
 this.children.indexOf(a);if(b!==-1){a.parent=void 0;this.children.splice(b,1);for(b=this;b.parent!==void 0;)b=b.parent;b!==void 0&&b instanceof THREE.Scene&&b.__removeObject(a)}},getChildByName:function(a,b){var c,d,e;c=0;for(d=this.children.length;c<d;c++){e=this.children[c];if(e.name===a)return e;if(b){e=e.getChildByName(a,b);if(e!==void 0)return e}}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,
 this.eulerOrder);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1){this.matrix.scale(this.scale);this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z))}this.matrixWorldNeedsUpdate=true},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=false;a=true}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=k[l]=k[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(e>=0&&f>=0&&g>=0&&h>=0)return true;if(e<0&&f<0||g<0&&h<0)return false;e<0?c=Math.max(c,e/(e-f)):f<0&&(d=Math.min(d,e/(e-f)));g<0?c=Math.max(c,g/(g-h)):h<0&&(d=Math.min(d,g/(g-h)));if(d<c)return false;a.lerpSelf(b,c);b.lerpSelf(a,1-
-d);return true}var e,f,g=[],h,l,k=[],j,o,m=[],p,r=[],n,q,u=[],t,x,s=[],z={objects:[],sprites:[],lights:[],elements:[]},D=new THREE.Vector3,B=new THREE.Vector4,v=new THREE.Matrix4,w=new THREE.Matrix4,H=new THREE.Frustum,I=new THREE.Vector4,M=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);v.multiply(b.projectionMatrix,b.matrixWorldInverse);v.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);
-v.multiply(b.matrixWorld,b.projectionMatrixInverse);v.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;z.objects.length=0;z.sprites.length=0;z.lights.length=0;var g=function(b){if(b.visible!==false){if((b instanceof THREE.Mesh||b instanceof THREE.Line)&&(b.frustumCulled===false||H.contains(b))){D.copy(b.matrixWorld.getPosition());
-v.multiplyVector3(D);e=a();e.object=b;e.z=D.z;z.objects.push(e)}else if(b instanceof THREE.Sprite||b instanceof THREE.Particle){D.copy(b.matrixWorld.getPosition());v.multiplyVector3(D);e=a();e.object=b;e.z=D.z;z.sprites.push(e)}else b instanceof THREE.Light&&z.lights.push(b);for(var c=0,d=b.children.length;c<d;c++)g(b.children[c])}};g(b);d&&z.objects.sort(c);return z};this.projectScene=function(a,e,f){var g=e.near,E=e.far,i=false,D,F,L,W,G,ha,fa,la,R,$,ba,aa,ea,Ma,xa;x=q=p=o=0;z.elements.length=0;
-if(e.parent===void 0){console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it...");a.add(e)}a.updateMatrixWorld();e.matrixWorldInverse.getInverse(e.matrixWorld);v.multiply(e.projectionMatrix,e.matrixWorldInverse);H.setFromMatrix(v);z=this.projectGraph(a,false);a=0;for(D=z.objects.length;a<D;a++){R=z.objects[a].object;$=R.matrixWorld;l=0;if(R instanceof THREE.Mesh){ba=R.geometry;aa=R.geometry.materials;W=ba.vertices;ea=ba.faces;Ma=ba.faceVertexUvs;ba=R.matrixRotationWorld.extractRotation($);
-F=0;for(L=W.length;F<L;F++){h=b();h.positionWorld.copy(W[F]);$.multiplyVector3(h.positionWorld);h.positionScreen.copy(h.positionWorld);v.multiplyVector4(h.positionScreen);h.positionScreen.x=h.positionScreen.x/h.positionScreen.w;h.positionScreen.y=h.positionScreen.y/h.positionScreen.w;h.visible=h.positionScreen.z>g&&h.positionScreen.z<E}W=0;for(F=ea.length;W<F;W++){L=ea[W];if(L instanceof THREE.Face3){G=k[L.a];ha=k[L.b];fa=k[L.c];if(G.visible&&ha.visible&&fa.visible){i=(fa.positionScreen.x-G.positionScreen.x)*
-(ha.positionScreen.y-G.positionScreen.y)-(fa.positionScreen.y-G.positionScreen.y)*(ha.positionScreen.x-G.positionScreen.x)<0;if(R.doubleSided||i!=R.flipSided){la=m[o]=m[o]||new THREE.RenderableFace3;o++;j=la;j.v1.copy(G);j.v2.copy(ha);j.v3.copy(fa)}else continue}else continue}else if(L instanceof THREE.Face4){G=k[L.a];ha=k[L.b];fa=k[L.c];la=k[L.d];if(G.visible&&ha.visible&&fa.visible&&la.visible){i=(la.positionScreen.x-G.positionScreen.x)*(ha.positionScreen.y-G.positionScreen.y)-(la.positionScreen.y-
-G.positionScreen.y)*(ha.positionScreen.x-G.positionScreen.x)<0||(ha.positionScreen.x-fa.positionScreen.x)*(la.positionScreen.y-fa.positionScreen.y)-(ha.positionScreen.y-fa.positionScreen.y)*(la.positionScreen.x-fa.positionScreen.x)<0;if(R.doubleSided||i!=R.flipSided){xa=r[p]=r[p]||new THREE.RenderableFace4;p++;j=xa;j.v1.copy(G);j.v2.copy(ha);j.v3.copy(fa);j.v4.copy(la)}else continue}else continue}j.normalWorld.copy(L.normal);!i&&(R.flipSided||R.doubleSided)&&j.normalWorld.negate();ba.multiplyVector3(j.normalWorld);
-j.centroidWorld.copy(L.centroid);$.multiplyVector3(j.centroidWorld);j.centroidScreen.copy(j.centroidWorld);v.multiplyVector3(j.centroidScreen);fa=L.vertexNormals;G=0;for(ha=fa.length;G<ha;G++){la=j.vertexNormalsWorld[G];la.copy(fa[G]);!i&&(R.flipSided||R.doubleSided)&&la.negate();ba.multiplyVector3(la)}G=0;for(ha=Ma.length;G<ha;G++)if(xa=Ma[G][W]){fa=0;for(la=xa.length;fa<la;fa++)j.uvs[G][fa]=xa[fa]}j.material=R.material;j.faceMaterial=L.materialIndex!==null?aa[L.materialIndex]:null;j.z=j.centroidScreen.z;
-z.elements.push(j)}}else if(R instanceof THREE.Line){w.multiply(v,$);W=R.geometry.vertices;G=b();G.positionScreen.copy(W[0]);w.multiplyVector4(G.positionScreen);$=R.type===THREE.LinePieces?2:1;F=1;for(L=W.length;F<L;F++){G=b();G.positionScreen.copy(W[F]);w.multiplyVector4(G.positionScreen);if(!((F+1)%$>0)){ha=k[l-2];I.copy(G.positionScreen);M.copy(ha.positionScreen);if(d(I,M)){I.multiplyScalar(1/I.w);M.multiplyScalar(1/M.w);aa=u[q]=u[q]||new THREE.RenderableLine;q++;n=aa;n.v1.positionScreen.copy(I);
-n.v2.positionScreen.copy(M);n.z=Math.max(I.z,M.z);n.material=R.material;z.elements.push(n)}}}}}a=0;for(D=z.sprites.length;a<D;a++){R=z.sprites[a].object;$=R.matrixWorld;if(R instanceof THREE.Particle){B.set($.elements[12],$.elements[13],$.elements[14],1);v.multiplyVector4(B);B.z=B.z/B.w;if(B.z>0&&B.z<1){g=s[x]=s[x]||new THREE.RenderableParticle;x++;t=g;t.x=B.x/B.w;t.y=B.y/B.w;t.z=B.z;t.rotation=R.rotation.z;t.scale.x=R.scale.x*Math.abs(t.x-(B.x+e.projectionMatrix.elements[0])/(B.w+e.projectionMatrix.elements[12]));
-t.scale.y=R.scale.y*Math.abs(t.y-(B.y+e.projectionMatrix.elements[5])/(B.w+e.projectionMatrix.elements[13]));t.material=R.material;z.elements.push(t)}}}f&&z.elements.sort(c);return z}};THREE.Quaternion=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=d!==void 0?d:1};
+THREE.Projector=function(){function a(){var a=g[f]=g[f]||new THREE.RenderableObject;f++;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,e=a.z+a.w,f=b.z+b.w,g=-a.z+a.w,h=-b.z+b.w;if(e>=0&&f>=0&&g>=0&&h>=0)return true;if(e<0&&f<0||g<0&&h<0)return false;e<0?c=Math.max(c,e/(e-f)):f<0&&(d=Math.min(d,e/(e-f)));g<0?c=Math.max(c,g/(g-h)):h<0&&(d=Math.min(d,g/(g-h)));if(d<c)return false;a.lerpSelf(b,c);b.lerpSelf(a,1-
+d);return true}var e,f,g=[],h,k,j=[],l,o,n=[],p,r=[],m,q,u=[],t,w,s=[],x={objects:[],sprites:[],lights:[],elements:[]},F=new THREE.Vector3,E=new THREE.Vector4,B=new THREE.Matrix4,v=new THREE.Matrix4,z=new THREE.Frustum,J=new THREE.Vector4,K=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);B.multiply(b.projectionMatrix,b.matrixWorldInverse);B.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);
+B.multiply(b.matrixWorld,b.projectionMatrixInverse);B.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;x.objects.length=0;x.sprites.length=0;x.lights.length=0;var g=function(b){if(b.visible!==false){if((b instanceof THREE.Mesh||b instanceof THREE.Line)&&(b.frustumCulled===false||z.contains(b))){F.copy(b.matrixWorld.getPosition());
+B.multiplyVector3(F);e=a();e.object=b;e.z=F.z;x.objects.push(e)}else if(b instanceof THREE.Sprite||b instanceof THREE.Particle){F.copy(b.matrixWorld.getPosition());B.multiplyVector3(F);e=a();e.object=b;e.z=F.z;x.sprites.push(e)}else b instanceof THREE.Light&&x.lights.push(b);for(var c=0,d=b.children.length;c<d;c++)g(b.children[c])}};g(b);d&&x.objects.sort(c);return x};this.projectScene=function(a,e,f){var g=e.near,G=e.far,i=false,F,W,C,Y,H,ba,ga,la,P,S,ca,T,fa,Ma,xa;w=q=p=o=0;x.elements.length=0;
+if(e.parent===void 0){console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it...");a.add(e)}a.updateMatrixWorld();e.matrixWorldInverse.getInverse(e.matrixWorld);B.multiply(e.projectionMatrix,e.matrixWorldInverse);z.setFromMatrix(B);x=this.projectGraph(a,false);a=0;for(F=x.objects.length;a<F;a++){P=x.objects[a].object;S=P.matrixWorld;k=0;if(P instanceof THREE.Mesh){ca=P.geometry;T=P.geometry.materials;Y=ca.vertices;fa=ca.faces;Ma=ca.faceVertexUvs;ca=P.matrixRotationWorld.extractRotation(S);
+W=0;for(C=Y.length;W<C;W++){h=b();h.positionWorld.copy(Y[W]);S.multiplyVector3(h.positionWorld);h.positionScreen.copy(h.positionWorld);B.multiplyVector4(h.positionScreen);h.positionScreen.x=h.positionScreen.x/h.positionScreen.w;h.positionScreen.y=h.positionScreen.y/h.positionScreen.w;h.visible=h.positionScreen.z>g&&h.positionScreen.z<G}Y=0;for(W=fa.length;Y<W;Y++){C=fa[Y];if(C instanceof THREE.Face3){H=j[C.a];ba=j[C.b];ga=j[C.c];if(H.visible&&ba.visible&&ga.visible){i=(ga.positionScreen.x-H.positionScreen.x)*
+(ba.positionScreen.y-H.positionScreen.y)-(ga.positionScreen.y-H.positionScreen.y)*(ba.positionScreen.x-H.positionScreen.x)<0;if(P.doubleSided||i!=P.flipSided){la=n[o]=n[o]||new THREE.RenderableFace3;o++;l=la;l.v1.copy(H);l.v2.copy(ba);l.v3.copy(ga)}else continue}else continue}else if(C instanceof THREE.Face4){H=j[C.a];ba=j[C.b];ga=j[C.c];la=j[C.d];if(H.visible&&ba.visible&&ga.visible&&la.visible){i=(la.positionScreen.x-H.positionScreen.x)*(ba.positionScreen.y-H.positionScreen.y)-(la.positionScreen.y-
+H.positionScreen.y)*(ba.positionScreen.x-H.positionScreen.x)<0||(ba.positionScreen.x-ga.positionScreen.x)*(la.positionScreen.y-ga.positionScreen.y)-(ba.positionScreen.y-ga.positionScreen.y)*(la.positionScreen.x-ga.positionScreen.x)<0;if(P.doubleSided||i!=P.flipSided){xa=r[p]=r[p]||new THREE.RenderableFace4;p++;l=xa;l.v1.copy(H);l.v2.copy(ba);l.v3.copy(ga);l.v4.copy(la)}else continue}else continue}l.normalWorld.copy(C.normal);!i&&(P.flipSided||P.doubleSided)&&l.normalWorld.negate();ca.multiplyVector3(l.normalWorld);
+l.centroidWorld.copy(C.centroid);S.multiplyVector3(l.centroidWorld);l.centroidScreen.copy(l.centroidWorld);B.multiplyVector3(l.centroidScreen);ga=C.vertexNormals;H=0;for(ba=ga.length;H<ba;H++){la=l.vertexNormalsWorld[H];la.copy(ga[H]);!i&&(P.flipSided||P.doubleSided)&&la.negate();ca.multiplyVector3(la)}H=0;for(ba=Ma.length;H<ba;H++)if(xa=Ma[H][Y]){ga=0;for(la=xa.length;ga<la;ga++)l.uvs[H][ga]=xa[ga]}l.material=P.material;l.faceMaterial=C.materialIndex!==null?T[C.materialIndex]:null;l.z=l.centroidScreen.z;
+x.elements.push(l)}}else if(P instanceof THREE.Line){v.multiply(B,S);Y=P.geometry.vertices;H=b();H.positionScreen.copy(Y[0]);v.multiplyVector4(H.positionScreen);S=P.type===THREE.LinePieces?2:1;W=1;for(C=Y.length;W<C;W++){H=b();H.positionScreen.copy(Y[W]);v.multiplyVector4(H.positionScreen);if(!((W+1)%S>0)){ba=j[k-2];J.copy(H.positionScreen);K.copy(ba.positionScreen);if(d(J,K)){J.multiplyScalar(1/J.w);K.multiplyScalar(1/K.w);T=u[q]=u[q]||new THREE.RenderableLine;q++;m=T;m.v1.positionScreen.copy(J);
+m.v2.positionScreen.copy(K);m.z=Math.max(J.z,K.z);m.material=P.material;x.elements.push(m)}}}}}a=0;for(F=x.sprites.length;a<F;a++){P=x.sprites[a].object;S=P.matrixWorld;if(P instanceof THREE.Particle){E.set(S.elements[12],S.elements[13],S.elements[14],1);B.multiplyVector4(E);E.z=E.z/E.w;if(E.z>0&&E.z<1){g=s[w]=s[w]||new THREE.RenderableParticle;w++;t=g;t.x=E.x/E.w;t.y=E.y/E.w;t.z=E.z;t.rotation=P.rotation.z;t.scale.x=P.scale.x*Math.abs(t.x-(E.x+e.projectionMatrix.elements[0])/(E.w+e.projectionMatrix.elements[12]));
+t.scale.y=P.scale.y*Math.abs(t.y-(E.y+e.projectionMatrix.elements[5])/(E.w+e.projectionMatrix.elements[13]));t.material=P.material;x.elements.push(t)}}}f&&x.elements.sort(c);return x}};THREE.Quaternion=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=d!==void 0?d:1};
 THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this},setFromEuler:function(a){var b=Math.PI/360,c=a.x*b,d=a.y*b,e=a.z*b,a=Math.cos(d),d=Math.sin(d),b=Math.cos(-e),e=Math.sin(-e),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.elements[0]+a.elements[5]+a.elements[10]))/2;this.x=Math.sqrt(Math.max(0,b+a.elements[0]-a.elements[5]-a.elements[10]))/2;this.y=Math.sqrt(Math.max(0,b-a.elements[0]+a.elements[5]-a.elements[10]))/2;this.z=Math.sqrt(Math.max(0,b-a.elements[0]-a.elements[5]+a.elements[10]))/2;this.x=a.elements[6]-a.elements[9]<0?-Math.abs(this.x):
 Math.abs(this.x);this.y=a.elements[8]-a.elements[2]<0?-Math.abs(this.y):Math.abs(this.y);this.z=a.elements[1]-a.elements[4]<0?-Math.abs(this.z):Math.abs(this.z);this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x=this.x*-1;this.y=this.y*-1;this.z=this.z*-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=
 Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a===0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x=this.x*a;this.y=this.y*a;this.z=this.z*a;this.w=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,k=l*c+g*e-h*d,j=l*d+h*c-f*e,o=l*e+f*d-g*c,c=-f*c-g*d-h*e;b.x=k*l+c*-f+j*-h-o*-g;b.y=j*l+c*-g+o*-f-k*-h;b.z=o*l+c*-h+k*-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;if(e<0){c.w=-b.w;c.x=-b.x;c.y=-b.y;c.z=-b.z;e=-e}else c.copy(b);if(Math.abs(e)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var f=Math.acos(e),e=Math.sqrt(1-e*e);if(Math.abs(e)<0.0010){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}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=THREE.Vector3;
+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,j=k*c+g*e-h*d,l=k*d+h*c-f*e,o=k*e+f*d-g*c,c=-f*c-g*d-h*e;b.x=j*k+c*-f+l*-h-o*-g;b.y=l*k+c*-g+o*-f-j*-h;b.z=o*k+c*-h+j*-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;if(e<0){c.w=-b.w;c.x=-b.x;c.y=-b.y;c.z=-b.z;e=-e}else c.copy(b);if(Math.abs(e)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var f=Math.acos(e),e=Math.sqrt(1-e*e);if(Math.abs(e)<0.0010){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}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(){console.warn("THREE.Vertex has been DEPRECATED. Use THREE.Vector3 instead.")};
 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;b=0;for(c=this.vertexNormals.length;b<c;b++)a.vertexNormals[b]=this.vertexNormals[b].clone();b=0;for(c=this.vertexColors.length;b<c;b++)a.vertexColors[b]=this.vertexColors[b].clone();b=0;for(c=this.vertexTangents.length;b<c;b++)a.vertexTangents[b]=this.vertexTangents[b].clone();
 return a}};THREE.Face4=function(a,b,c,d,e,f,g){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materialIndex=g;this.centroid=new THREE.Vector3};
@@ -93,17 +93,17 @@ b;a++){c=this.faces[a];d=this.vertices[c.a];e=this.vertices[c.b];f=this.vertices
 else if(c instanceof THREE.Face4)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{d=this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)d[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3){d[c.a].addSelf(c.normal);d[c.b].addSelf(c.normal);d[c.c].addSelf(c.normal)}else if(c instanceof THREE.Face4){d[c.a].addSelf(c.normal);d[c.b].addSelf(c.normal);d[c.c].addSelf(c.normal);d[c.d].addSelf(c.normal)}}a=0;
 for(b=this.vertices.length;a<b;a++)d[a].normalize();a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3){c.vertexNormals[0].copy(d[c.a]);c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c])}else if(c instanceof THREE.Face4){c.vertexNormals[0].copy(d[c.a]);c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c]);c.vertexNormals[3].copy(d[c.d])}}},computeMorphNormals:function(){var a,b,c,d,e;c=0;for(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=[];a=0;for(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;a=0;for(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,k;c=0;for(d=this.faces.length;c<d;c++){e=this.faces[c];l=new THREE.Vector3;k=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(k)}}g=this.morphNormals[a];f.vertices=this.morphTargets[a].vertices;f.computeFaceNormals();f.computeVertexNormals();c=0;for(d=this.faces.length;c<d;c++){e=this.faces[c];
-l=g.faceNormals[c];k=g.vertexNormals[c];l.copy(e.normal);if(e instanceof THREE.Face3){k.a.copy(e.vertexNormals[0]);k.b.copy(e.vertexNormals[1]);k.c.copy(e.vertexNormals[2])}else{k.a.copy(e.vertexNormals[0]);k.b.copy(e.vertexNormals[1]);k.c.copy(e.vertexNormals[2]);k.d.copy(e.vertexNormals[3])}}}c=0;for(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,G){h=a.vertices[b];l=a.vertices[c];
-k=a.vertices[d];j=g[e];o=g[f];m=g[G];p=l.x-h.x;r=k.x-h.x;n=l.y-h.y;q=k.y-h.y;u=l.z-h.z;t=k.z-h.z;x=o.u-j.u;s=m.u-j.u;z=o.v-j.v;D=m.v-j.v;B=1/(x*D-s*z);I.set((D*p-z*r)*B,(D*n-z*q)*B,(D*u-z*t)*B);M.set((x*r-s*p)*B,(x*q-s*n)*B,(x*t-s*u)*B);w[b].addSelf(I);w[c].addSelf(I);w[d].addSelf(I);H[b].addSelf(M);H[c].addSelf(M);H[d].addSelf(M)}var b,c,d,e,f,g,h,l,k,j,o,m,p,r,n,q,u,t,x,s,z,D,B,v,w=[],H=[],I=new THREE.Vector3,M=new THREE.Vector3,T=new THREE.Vector3,C=new THREE.Vector3,K=new THREE.Vector3;b=0;for(c=
-this.vertices.length;b<c;b++){w[b]=new THREE.Vector3;H[b]=new THREE.Vector3}b=0;for(c=this.faces.length;b<c;b++){f=this.faces[b];g=this.faceVertexUvs[0][b];if(f instanceof THREE.Face3)a(this,f.a,f.b,f.c,0,1,2);else if(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 O=["a","b","c","d"];b=0;for(c=this.faces.length;b<c;b++){f=this.faces[b];for(d=0;d<f.vertexNormals.length;d++){K.copy(f.vertexNormals[d]);e=f[O[d]];v=w[e];T.copy(v);T.subSelf(K.multiplyScalar(K.dot(v))).normalize();
-C.cross(f.vertexNormals[d],v);e=C.dot(H[e]);e=e<0?-1:1;f.vertexTangents[d]=new THREE.Vector4(T.x,T.y,T.z,e)}}this.hasTangents=true},computeBoundingBox:function(){if(!this.boundingBox)this.boundingBox={min:new THREE.Vector3,max:new THREE.Vector3};if(this.vertices.length>0){var a;a=this.vertices[0];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];if(a.x<b.x)b.x=a.x;else if(a.x>c.x)c.x=
+[];var g=this.morphNormals[a].faceNormals,h=this.morphNormals[a].vertexNormals,k,j;c=0;for(d=this.faces.length;c<d;c++){e=this.faces[c];k=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(k);h.push(j)}}g=this.morphNormals[a];f.vertices=this.morphTargets[a].vertices;f.computeFaceNormals();f.computeVertexNormals();c=0;for(d=this.faces.length;c<d;c++){e=this.faces[c];
+k=g.faceNormals[c];j=g.vertexNormals[c];k.copy(e.normal);if(e instanceof THREE.Face3){j.a.copy(e.vertexNormals[0]);j.b.copy(e.vertexNormals[1]);j.c.copy(e.vertexNormals[2])}else{j.a.copy(e.vertexNormals[0]);j.b.copy(e.vertexNormals[1]);j.c.copy(e.vertexNormals[2]);j.d.copy(e.vertexNormals[3])}}}c=0;for(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,H){h=a.vertices[b];k=a.vertices[c];
+j=a.vertices[d];l=g[e];o=g[f];n=g[H];p=k.x-h.x;r=j.x-h.x;m=k.y-h.y;q=j.y-h.y;u=k.z-h.z;t=j.z-h.z;w=o.u-l.u;s=n.u-l.u;x=o.v-l.v;F=n.v-l.v;E=1/(w*F-s*x);J.set((F*p-x*r)*E,(F*m-x*q)*E,(F*u-x*t)*E);K.set((w*r-s*p)*E,(w*q-s*m)*E,(w*t-s*u)*E);v[b].addSelf(J);v[c].addSelf(J);v[d].addSelf(J);z[b].addSelf(K);z[c].addSelf(K);z[d].addSelf(K)}var b,c,d,e,f,g,h,k,j,l,o,n,p,r,m,q,u,t,w,s,x,F,E,B,v=[],z=[],J=new THREE.Vector3,K=new THREE.Vector3,X=new THREE.Vector3,Q=new THREE.Vector3,A=new THREE.Vector3;b=0;for(c=
+this.vertices.length;b<c;b++){v[b]=new THREE.Vector3;z[b]=new THREE.Vector3}b=0;for(c=this.faces.length;b<c;b++){f=this.faces[b];g=this.faceVertexUvs[0][b];if(f instanceof THREE.Face3)a(this,f.a,f.b,f.c,0,1,2);else if(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 M=["a","b","c","d"];b=0;for(c=this.faces.length;b<c;b++){f=this.faces[b];for(d=0;d<f.vertexNormals.length;d++){A.copy(f.vertexNormals[d]);e=f[M[d]];B=v[e];X.copy(B);X.subSelf(A.multiplyScalar(A.dot(B))).normalize();
+Q.cross(f.vertexNormals[d],B);e=Q.dot(z[e]);e=e<0?-1:1;f.vertexTangents[d]=new THREE.Vector4(X.x,X.y,X.z,e)}}this.hasTangents=true},computeBoundingBox:function(){if(!this.boundingBox)this.boundingBox={min:new THREE.Vector3,max:new THREE.Vector3};if(this.vertices.length>0){var a;a=this.vertices[0];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];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].length();a>b&&(b=a)}this.boundingSphere.radius=b},mergeVertices:function(){var a={},b=[],c=[],d,e=Math.pow(10,4),f,g;f=0;for(g=this.vertices.length;f<g;f++){d=this.vertices[f];d=[Math.round(d.x*
 e),Math.round(d.y*e),Math.round(d.z*e)].join("_");if(a[d]===void 0){a[d]=f;b.push(this.vertices[f]);c[f]=b.length-1}else c[f]=c[a[d]]}f=0;for(g=this.faces.length;f<g;f++){a=this.faces[f];if(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=(c-a)*0.5;d=(d-b)*0.5;return(2*(b-c)+a+d)*g+(-3*(b-c)-2*a-d)*f+a*e+b}this.points=a;var c=[],d={x:0,y:0,z:0},e,f,g,h,l,k,j,o,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]=f===0?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;k=this.points[c[0]];j=this.points[c[1]];o=this.points[c[2]];m=this.points[c[3]];h=g*g;l=g*h;d.x=b(k.x,j.x,o.x,m.x,g,h,l);d.y=b(k.y,j.y,o.y,m.y,g,h,l);d.z=b(k.z,j.z,o.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=l+g.distanceTo(f);f.copy(d);b=(this.points.length-1)*b;b=Math.floor(b);if(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,k=this.getLength();h.push(l.copy(this.points[0]).clone());for(b=1;b<this.points.length;b++){c=k.chunks[b]-k.chunks[b-1];g=Math.ceil(a*c/k.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.Spline=function(a){function b(a,b,c,d,e,f,g){a=(c-a)*0.5;d=(d-b)*0.5;return(2*(b-c)+a+d)*g+(-3*(b-c)-2*a-d)*f+a*e+b}this.points=a;var c=[],d={x:0,y:0,z:0},e,f,g,h,k,j,l,o,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]=f===0?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]];l=this.points[c[1]];o=this.points[c[2]];n=this.points[c[3]];h=g*g;k=g*h;d.x=b(j.x,l.x,o.x,n.x,g,h,k);d.y=b(j.y,l.y,o.y,n.y,g,h,k);d.z=b(j.z,l.z,o.z,n.z,g,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,e=b=b=0,f=new THREE.Vector3,g=new THREE.Vector3,h=[],k=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);k=k+g.distanceTo(f);f.copy(d);b=(this.points.length-1)*b;b=Math.floor(b);if(b!=e){h[b]=k;e=b}}h[h.length]=k;return{chunks:h,total:k}};this.reparametrizeByArcLength=function(a){var b,c,d,e,f,g,h=[],k=new THREE.Vector3,j=this.getLength();h.push(k.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(k.copy(d).clone())}h.push(k.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=e!==void 0?e:0.1;this.far=f!==void 0?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=a!==void 0?a:50;this.aspect=b!==void 0?b:1;this.near=c!==void 0?c:0.1;this.far=d!==void 0?d:2E3;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype=new THREE.Camera;THREE.PerspectiveCamera.prototype.constructor=THREE.PerspectiveCamera;THREE.PerspectiveCamera.prototype.setLens=function(a,b){this.fov=2*Math.atan((b!==void 0?b:24)/(a*2))*(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()};
@@ -138,7 +138,7 @@ a.fog!==void 0?a.fog:false;this.lights=a.lights!==void 0?a.lights:false;this.ver
 THREE.Texture=function(a,b,c,d,e,f,g,h){this.id=THREE.TextureCount++;this.image=a;this.mapping=b!==void 0?b:new THREE.UVMapping;this.wrapS=c!==void 0?c:THREE.ClampToEdgeWrapping;this.wrapT=d!==void 0?d:THREE.ClampToEdgeWrapping;this.magFilter=e!==void 0?e:THREE.LinearFilter;this.minFilter=f!==void 0?f:THREE.LinearMipMapLinearFilter;this.format=g!==void 0?g:THREE.RGBAFormat;this.type=h!==void 0?h:THREE.UnsignedByteType;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.generateMipmaps=
 true;this.needsUpdate=this.premultiplyAlpha=false;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,k){THREE.Texture.call(this,null,f,g,h,l,k,d,e);this.image={data:a,width:b,height:c}};THREE.DataTexture.prototype=new THREE.Texture;THREE.DataTexture.prototype.constructor=THREE.DataTexture;
+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,j){THREE.Texture.call(this,null,f,g,h,k,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=b!==void 0?b:new THREE.ParticleBasicMaterial({color:Math.random()*16777215});this.sortParticles=false;if(this.geometry){this.geometry.boundingSphere||this.geometry.computeBoundingSphere();this.boundRadius=a.boundingSphere.radius}this.frustumCulled=false};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=b!==void 0?b:new THREE.LineBasicMaterial({color:Math.random()*16777215});this.type=c!==void 0?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;
@@ -169,51 +169,51 @@ THREE.SpriteAlignment.bottomRight=new THREE.Vector2(-1,1);THREE.Scene=function()
 THREE.Scene.prototype.__addObject=function(a){if(a instanceof THREE.Light)this.__lights.indexOf(a)===-1&&this.__lights.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.__objects.indexOf(a)===-1){this.__objects.push(a);this.__objectsAdded.push(a);var b=this.__objectsRemoved.indexOf(a);b!==-1&&this.__objectsRemoved.splice(b,1)}for(b=0;b<a.children.length;b++)this.__addObject(a.children[b])};
 THREE.Scene.prototype.__removeObject=function(a){if(a instanceof THREE.Light){var b=this.__lights.indexOf(a);b!==-1&&this.__lights.splice(b,1)}else if(!(a instanceof THREE.Camera)){b=this.__objects.indexOf(a);if(b!==-1){this.__objects.splice(b,1);this.__objectsRemoved.push(a);b=this.__objectsAdded.indexOf(a);b!==-1&&this.__objectsAdded.splice(b,1)}}for(b=0;b<a.children.length;b++)this.__removeObject(a.children[b])};
 THREE.Fog=function(a,b,c){this.color=new THREE.Color(a);this.near=b!==void 0?b:1;this.far=c!==void 0?c:1E3};THREE.FogExp2=function(a,b){this.color=new THREE.Color(a);this.density=b!==void 0?b:2.5E-4};
-THREE.DOMRenderer=function(){console.log("THREE.DOMRenderer",THREE.REVISION);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(typeof b.style[a[c]]==="string")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,o,m,p,r,n;a=h.projectScene(c,d);b=a.elements;j=0;for(o=
-b.length;j<o;j++){m=b[j];if(m instanceof THREE.RenderableParticle&&m.material instanceof THREE.ParticleDOMMaterial){p=m.material.domElement;r=m.x*e+e-(p.offsetWidth>>1);n=m.y*f+f-(p.offsetHeight>>1);p.style.left=r+"px";p.style.top=n+"px";p.style.zIndex=Math.abs(Math.floor((1-m.z)*d.far/d.near));g&&(p.style[g]="scale("+m.scale.x*e+","+m.scale.y*f+")")}}}};
-THREE.CanvasRenderer=function(a){function b(a){if(t!=a)n.globalAlpha=t=a}function c(a){if(x!=a){switch(a){case THREE.NormalBlending:n.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:n.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:n.globalCompositeOperation="darker"}x=a}}function d(a){if(s!=a)n.strokeStyle=s=a}function e(a){if(z!=a)n.fillStyle=z=a}console.log("THREE.CanvasRenderer",THREE.REVISION);var a=a||{},f=this,g,h,l,k=new THREE.Projector,j=a.canvas!==
-void 0?a.canvas:document.createElement("canvas"),o,m,p,r,n=j.getContext("2d"),q=new THREE.Color(0),u=0,t=1,x=0,s=null,z=null,D=null,B=null,v=null,w,H,I,M,T=new THREE.RenderableVertex,C=new THREE.RenderableVertex,K,O,E,i,U,F,L,W,G,ha,fa,la,R=new THREE.Color,$=new THREE.Color,ba=new THREE.Color,aa=new THREE.Color,ea=new THREE.Color,Ma=[],xa=[],ta,Na,Sa,sa,Wa,Ya,Ja,db,hb,mb,Oa=new THREE.Rectangle,ua=new THREE.Rectangle,va=new THREE.Rectangle,ab=false,ja=new THREE.Color,Ha=new THREE.Color,Xa=new THREE.Color,
-ma=new THREE.Vector3,Fb,ca,S,Q,pc,Cc,a=16;Fb=document.createElement("canvas");Fb.width=Fb.height=2;ca=Fb.getContext("2d");ca.fillStyle="rgba(0,0,0,1)";ca.fillRect(0,0,2,2);S=ca.getImageData(0,0,2,2);Q=S.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=j;this.sortElements=this.sortObjects=this.autoClear=true;this.info={render:{vertices:0,faces:0}};this.setSize=function(a,b){o=a;m=b;p=Math.floor(o/2);r=Math.floor(m/
-2);j.width=o;j.height=m;Oa.set(-p,-r,p,r);ua.set(-p,-r,p,r);t=1;x=0;v=B=D=z=s=null};this.setClearColor=function(a,b){q.copy(a);u=b!==void 0?b:1;ua.set(-p,-r,p,r)};this.setClearColorHex=function(a,b){q.setHex(a);u=b!==void 0?b:1;ua.set(-p,-r,p,r)};this.clear=function(){n.setTransform(1,0,0,-1,p,r);if(!ua.isEmpty()){ua.minSelf(Oa);ua.inflate(2);u<1&&n.clearRect(Math.floor(ua.getX()),Math.floor(ua.getY()),Math.floor(ua.getWidth()),Math.floor(ua.getHeight()));if(u>0){c(THREE.NormalBlending);b(1);e("rgba("+
-Math.floor(q.r*255)+","+Math.floor(q.g*255)+","+Math.floor(q.b*255)+","+u+")");n.fillRect(Math.floor(ua.getX()),Math.floor(ua.getY()),Math.floor(ua.getWidth()),Math.floor(ua.getHeight()))}ua.empty()}};this.render=function(a,j){function m(a){var b,c,d,e;ja.setRGB(0,0,0);Ha.setRGB(0,0,0);Xa.setRGB(0,0,0);b=0;for(c=a.length;b<c;b++){d=a[b];e=d.color;if(d instanceof THREE.AmbientLight){ja.r=ja.r+e.r;ja.g=ja.g+e.g;ja.b=ja.b+e.b}else if(d instanceof THREE.DirectionalLight){Ha.r=Ha.r+e.r;Ha.g=Ha.g+e.g;Ha.b=
-Ha.b+e.b}else if(d instanceof THREE.PointLight){Xa.r=Xa.r+e.r;Xa.g=Xa.g+e.g;Xa.b=Xa.b+e.b}}}function o(a,b,c,d){var e,f,g,ca,h,i;e=0;for(f=a.length;e<f;e++){g=a[e];ca=g.color;if(g instanceof THREE.DirectionalLight){h=g.matrixWorld.getPosition();i=c.dot(h);if(!(i<=0)){i=i*g.intensity;d.r=d.r+ca.r*i;d.g=d.g+ca.g*i;d.b=d.b+ca.b*i}}else if(g instanceof THREE.PointLight){h=g.matrixWorld.getPosition();i=c.dot(ma.sub(h,b).normalize());if(!(i<=0)){i=i*(g.distance==0?1:1-Math.min(b.distanceTo(h)/g.distance,
-1));if(i!=0){i=i*g.intensity;d.r=d.r+ca.r*i;d.g=d.g+ca.g*i;d.b=d.b+ca.b*i}}}}}function q(a,f,g){b(g.opacity);c(g.blending);var ca,h,i,Q,S,l;if(g instanceof THREE.ParticleBasicMaterial){if(g.map){Q=g.map.image;S=Q.width>>1;l=Q.height>>1;g=f.scale.x*p;i=f.scale.y*r;ca=g*S;h=i*l;va.set(a.x-ca,a.y-h,a.x+ca,a.y+h);if(Oa.intersects(va)){n.save();n.translate(a.x,a.y);n.rotate(-f.rotation);n.scale(g,-i);n.translate(-S,-l);n.drawImage(Q,0,0);n.restore()}}}else if(g instanceof THREE.ParticleCanvasMaterial){ca=
-f.scale.x*p;h=f.scale.y*r;va.set(a.x-ca,a.y-h,a.x+ca,a.y+h);if(Oa.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(D!=a)n.lineWidth=D=a;a=g.linecap;if(B!=
-a)n.lineCap=B=a;a=g.linejoin;if(v!=a)n.lineJoin=v=a;d(g.color.getContextStyle());n.stroke();va.inflate(g.linewidth*2)}}function u(a,d,e,g,ca,h,Q,S){f.info.render.vertices=f.info.render.vertices+3;f.info.render.faces++;b(S.opacity);c(S.blending);K=a.positionScreen.x;O=a.positionScreen.y;E=d.positionScreen.x;i=d.positionScreen.y;U=e.positionScreen.x;F=e.positionScreen.y;x(K,O,E,i,U,F);if(S instanceof THREE.MeshBasicMaterial)if(S.map){if(S.map.mapping instanceof THREE.UVMapping){sa=Q.uvs[0];Tc(K,O,E,
-i,U,F,sa[g].u,sa[g].v,sa[ca].u,sa[ca].v,sa[h].u,sa[h].v,S.map)}}else if(S.envMap){if(S.envMap.mapping instanceof THREE.SphericalReflectionMapping){a=j.matrixWorldInverse;ma.copy(Q.vertexNormalsWorld[g]);Wa=(ma.x*a.elements[0]+ma.y*a.elements[4]+ma.z*a.elements[8])*0.5+0.5;Ya=-(ma.x*a.elements[1]+ma.y*a.elements[5]+ma.z*a.elements[9])*0.5+0.5;ma.copy(Q.vertexNormalsWorld[ca]);Ja=(ma.x*a.elements[0]+ma.y*a.elements[4]+ma.z*a.elements[8])*0.5+0.5;db=-(ma.x*a.elements[1]+ma.y*a.elements[5]+ma.z*a.elements[9])*
-0.5+0.5;ma.copy(Q.vertexNormalsWorld[h]);hb=(ma.x*a.elements[0]+ma.y*a.elements[4]+ma.z*a.elements[8])*0.5+0.5;mb=-(ma.x*a.elements[1]+ma.y*a.elements[5]+ma.z*a.elements[9])*0.5+0.5;Tc(K,O,E,i,U,F,Wa,Ya,Ja,db,hb,mb,S.envMap)}}else S.wireframe?Mb(S.color,S.wireframeLinewidth,S.wireframeLinecap,S.wireframeLinejoin):Gb(S.color);else if(S instanceof THREE.MeshLambertMaterial){if(S.map&&!S.wireframe){if(S.map.mapping instanceof THREE.UVMapping){sa=Q.uvs[0];Tc(K,O,E,i,U,F,sa[g].u,sa[g].v,sa[ca].u,sa[ca].v,
-sa[h].u,sa[h].v,S.map)}c(THREE.SubtractiveBlending)}if(ab)if(!S.wireframe&&S.shading==THREE.SmoothShading&&Q.vertexNormalsWorld.length==3){$.r=ba.r=aa.r=ja.r;$.g=ba.g=aa.g=ja.g;$.b=ba.b=aa.b=ja.b;o(l,Q.v1.positionWorld,Q.vertexNormalsWorld[0],$);o(l,Q.v2.positionWorld,Q.vertexNormalsWorld[1],ba);o(l,Q.v3.positionWorld,Q.vertexNormalsWorld[2],aa);$.r=Math.max(0,Math.min(S.color.r*$.r,1));$.g=Math.max(0,Math.min(S.color.g*$.g,1));$.b=Math.max(0,Math.min(S.color.b*$.b,1));ba.r=Math.max(0,Math.min(S.color.r*
-ba.r,1));ba.g=Math.max(0,Math.min(S.color.g*ba.g,1));ba.b=Math.max(0,Math.min(S.color.b*ba.b,1));aa.r=Math.max(0,Math.min(S.color.r*aa.r,1));aa.g=Math.max(0,Math.min(S.color.g*aa.g,1));aa.b=Math.max(0,Math.min(S.color.b*aa.b,1));ea.r=(ba.r+aa.r)*0.5;ea.g=(ba.g+aa.g)*0.5;ea.b=(ba.b+aa.b)*0.5;Sa=Dc($,ba,aa,ea);gc(K,O,E,i,U,F,0,0,1,0,0,1,Sa)}else{R.r=ja.r;R.g=ja.g;R.b=ja.b;o(l,Q.centroidWorld,Q.normalWorld,R);R.r=Math.max(0,Math.min(S.color.r*R.r,1));R.g=Math.max(0,Math.min(S.color.g*R.g,1));R.b=Math.max(0,
-Math.min(S.color.b*R.b,1));S.wireframe?Mb(R,S.wireframeLinewidth,S.wireframeLinecap,S.wireframeLinejoin):Gb(R)}else S.wireframe?Mb(S.color,S.wireframeLinewidth,S.wireframeLinecap,S.wireframeLinejoin):Gb(S.color)}else if(S instanceof THREE.MeshDepthMaterial){ta=j.near;Na=j.far;$.r=$.g=$.b=1-ac(a.positionScreen.z,ta,Na);ba.r=ba.g=ba.b=1-ac(d.positionScreen.z,ta,Na);aa.r=aa.g=aa.b=1-ac(e.positionScreen.z,ta,Na);ea.r=(ba.r+aa.r)*0.5;ea.g=(ba.g+aa.g)*0.5;ea.b=(ba.b+aa.b)*0.5;Sa=Dc($,ba,aa,ea);gc(K,O,E,
-i,U,F,0,0,1,0,0,1,Sa)}else if(S instanceof THREE.MeshNormalMaterial){R.r=hc(Q.normalWorld.x);R.g=hc(Q.normalWorld.y);R.b=hc(Q.normalWorld.z);S.wireframe?Mb(R,S.wireframeLinewidth,S.wireframeLinecap,S.wireframeLinejoin):Gb(R)}}function t(a,d,e,g,ca,h,S,Q,k){f.info.render.vertices=f.info.render.vertices+4;f.info.render.faces++;b(Q.opacity);c(Q.blending);if(Q.map||Q.envMap){u(a,d,g,0,1,3,S,Q,k);u(ca,e,h,1,2,3,S,Q,k)}else{K=a.positionScreen.x;O=a.positionScreen.y;E=d.positionScreen.x;i=d.positionScreen.y;
-U=e.positionScreen.x;F=e.positionScreen.y;L=g.positionScreen.x;W=g.positionScreen.y;G=ca.positionScreen.x;ha=ca.positionScreen.y;fa=h.positionScreen.x;la=h.positionScreen.y;if(Q instanceof THREE.MeshBasicMaterial){z(K,O,E,i,U,F,L,W);Q.wireframe?Mb(Q.color,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):Gb(Q.color)}else if(Q instanceof THREE.MeshLambertMaterial)if(ab)if(!Q.wireframe&&Q.shading==THREE.SmoothShading&&S.vertexNormalsWorld.length==4){$.r=ba.r=aa.r=ea.r=ja.r;$.g=ba.g=aa.g=
-ea.g=ja.g;$.b=ba.b=aa.b=ea.b=ja.b;o(l,S.v1.positionWorld,S.vertexNormalsWorld[0],$);o(l,S.v2.positionWorld,S.vertexNormalsWorld[1],ba);o(l,S.v4.positionWorld,S.vertexNormalsWorld[3],aa);o(l,S.v3.positionWorld,S.vertexNormalsWorld[2],ea);$.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));aa.r=Math.max(0,
-Math.min(Q.color.r*aa.r,1));aa.g=Math.max(0,Math.min(Q.color.g*aa.g,1));aa.b=Math.max(0,Math.min(Q.color.b*aa.b,1));ea.r=Math.max(0,Math.min(Q.color.r*ea.r,1));ea.g=Math.max(0,Math.min(Q.color.g*ea.g,1));ea.b=Math.max(0,Math.min(Q.color.b*ea.b,1));Sa=Dc($,ba,aa,ea);x(K,O,E,i,L,W);gc(K,O,E,i,L,W,0,0,1,0,0,1,Sa);x(G,ha,U,F,fa,la);gc(G,ha,U,F,fa,la,1,0,1,1,0,1,Sa)}else{R.r=ja.r;R.g=ja.g;R.b=ja.b;o(l,S.centroidWorld,S.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));z(K,O,E,i,U,F,L,W);Q.wireframe?Mb(R,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):Gb(R)}else{z(K,O,E,i,U,F,L,W);Q.wireframe?Mb(Q.color,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):Gb(Q.color)}else if(Q instanceof THREE.MeshNormalMaterial){R.r=hc(S.normalWorld.x);R.g=hc(S.normalWorld.y);R.b=hc(S.normalWorld.z);z(K,O,E,i,U,F,L,W);Q.wireframe?Mb(R,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):Gb(R)}else if(Q instanceof
-THREE.MeshDepthMaterial){ta=j.near;Na=j.far;$.r=$.g=$.b=1-ac(a.positionScreen.z,ta,Na);ba.r=ba.g=ba.b=1-ac(d.positionScreen.z,ta,Na);aa.r=aa.g=aa.b=1-ac(g.positionScreen.z,ta,Na);ea.r=ea.g=ea.b=1-ac(e.positionScreen.z,ta,Na);Sa=Dc($,ba,aa,ea);x(K,O,E,i,L,W);gc(K,O,E,i,L,W,0,0,1,0,0,1,Sa);x(G,ha,U,F,fa,la);gc(G,ha,U,F,fa,la,1,0,1,1,0,1,Sa)}}}function x(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 z(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(D!=b)n.lineWidth=D=b;if(B!=c)n.lineCap=B=c;if(v!=e)n.lineJoin=v=e;d(a.getContextStyle());n.stroke();va.inflate(b*2)}function Gb(a){e(a.getContextStyle());n.fill()}function Tc(a,b,c,d,f,g,ca,h,Q,i,S,l,j){if(j.image.width!=0){if(j.needsUpdate==true||Ma[j.id]==void 0){var k=j.wrapS==THREE.RepeatWrapping,m=j.wrapT==THREE.RepeatWrapping;Ma[j.id]=n.createPattern(j.image,k&&m?"repeat":k&&!m?"repeat-x":!k&&m?
-"repeat-y":"no-repeat");j.needsUpdate=false}e(Ma[j.id]);var k=j.offset.x/j.repeat.x,m=j.offset.y/j.repeat.y,o=j.image.width*j.repeat.x,p=j.image.height*j.repeat.y,ca=(ca+k)*o,h=(h+m)*p,c=c-a,d=d-b,f=f-a,g=g-b,Q=(Q+k)*o-ca,i=(i+m)*p-h,S=(S+k)*o-ca,l=(l+m)*p-h,k=Q*l-S*i;if(k==0){if(xa[j.id]===void 0){b=document.createElement("canvas");b.width=j.image.width;b.height=j.image.height;b=b.getContext("2d");b.drawImage(j.image,0,0);xa[j.id]=b.getImageData(0,0,j.image.width,j.image.height).data}b=xa[j.id];
-ca=(Math.floor(ca)+Math.floor(h)*j.image.width)*4;R.setRGB(b[ca]/255,b[ca+1]/255,b[ca+2]/255);Gb(R)}else{k=1/k;j=(l*c-i*f)*k;i=(l*d-i*g)*k;c=(Q*f-S*c)*k;d=(Q*g-S*d)*k;a=a-j*ca-c*h;ca=b-i*ca-d*h;n.save();n.transform(j,i,c,d,a,ca);n.fill();n.restore()}}}function gc(a,b,c,d,e,f,g,ca,h,Q,i,S,j){var l,k;l=j.width-1;k=j.height-1;g=g*l;ca=ca*k;c=c-a;d=d-b;e=e-a;f=f-b;h=h*l-g;Q=Q*k-ca;i=i*l-g;S=S*k-ca;k=1/(h*S-i*Q);l=(S*c-Q*e)*k;Q=(S*d-Q*f)*k;c=(h*e-i*c)*k;d=(h*f-i*d)*k;a=a-l*g-c*ca;b=b-Q*g-d*ca;n.save();
-n.transform(l,Q,c,d,a,b);n.clip();n.drawImage(j,0,0);n.restore()}function Dc(a,b,c,d){var e=~~(a.r*255),f=~~(a.g*255),a=~~(a.b*255),g=~~(b.r*255),h=~~(b.g*255),b=~~(b.b*255),i=~~(c.r*255),j=~~(c.g*255),c=~~(c.b*255),l=~~(d.r*255),k=~~(d.g*255),d=~~(d.b*255);Q[0]=e<0?0:e>255?255:e;Q[1]=f<0?0:f>255?255:f;Q[2]=a<0?0:a>255?255:a;Q[4]=g<0?0:g>255?255:g;Q[5]=h<0?0:h>255?255:h;Q[6]=b<0?0:b>255?255:b;Q[8]=i<0?0:i>255?255:i;Q[9]=j<0?0:j>255?255:j;Q[10]=c<0?0:c>255?255:c;Q[12]=l<0?0:l>255?255:l;Q[13]=k<0?0:
-k>255?255:k;Q[14]=d<0?0:d>255?255:d;ca.putImageData(S,0,0);Cc.drawImage(Fb,0,0);return pc}function ac(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function hc(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}function Nb(a,b){var c=b.x-a.x,d=b.y-a.y,e=c*c+d*d;if(e!=0){e=1/Math.sqrt(e);c=c*e;d=d*e;b.x=b.x+c;b.y=b.y+d;a.x=a.x-c;a.y=a.y-d}}var Ec,cd,Ta,kb;this.autoClear?this.clear():n.setTransform(1,0,0,-1,p,r);f.info.render.vertices=0;f.info.render.faces=0;g=k.projectScene(a,j,this.sortElements);h=g.elements;l=g.lights;
-(ab=l.length>0)&&m(l);Ec=0;for(cd=h.length;Ec<cd;Ec++){Ta=h[Ec];kb=Ta.material;kb=kb instanceof THREE.MeshFaceMaterial?Ta.faceMaterial:kb;if(!(kb==null||kb.opacity==0)){va.empty();if(Ta instanceof THREE.RenderableParticle){w=Ta;w.x=w.x*p;w.y=w.y*r;q(w,Ta,kb,a)}else if(Ta instanceof THREE.RenderableLine){w=Ta.v1;H=Ta.v2;w.positionScreen.x=w.positionScreen.x*p;w.positionScreen.y=w.positionScreen.y*r;H.positionScreen.x=H.positionScreen.x*p;H.positionScreen.y=H.positionScreen.y*r;va.addPoint(w.positionScreen.x,
-w.positionScreen.y);va.addPoint(H.positionScreen.x,H.positionScreen.y);Oa.intersects(va)&&s(w,H,Ta,kb,a)}else if(Ta instanceof THREE.RenderableFace3){w=Ta.v1;H=Ta.v2;I=Ta.v3;w.positionScreen.x=w.positionScreen.x*p;w.positionScreen.y=w.positionScreen.y*r;H.positionScreen.x=H.positionScreen.x*p;H.positionScreen.y=H.positionScreen.y*r;I.positionScreen.x=I.positionScreen.x*p;I.positionScreen.y=I.positionScreen.y*r;if(kb.overdraw){Nb(w.positionScreen,H.positionScreen);Nb(H.positionScreen,I.positionScreen);
-Nb(I.positionScreen,w.positionScreen)}va.add3Points(w.positionScreen.x,w.positionScreen.y,H.positionScreen.x,H.positionScreen.y,I.positionScreen.x,I.positionScreen.y);Oa.intersects(va)&&u(w,H,I,0,1,2,Ta,kb,a)}else if(Ta instanceof THREE.RenderableFace4){w=Ta.v1;H=Ta.v2;I=Ta.v3;M=Ta.v4;w.positionScreen.x=w.positionScreen.x*p;w.positionScreen.y=w.positionScreen.y*r;H.positionScreen.x=H.positionScreen.x*p;H.positionScreen.y=H.positionScreen.y*r;I.positionScreen.x=I.positionScreen.x*p;I.positionScreen.y=
-I.positionScreen.y*r;M.positionScreen.x=M.positionScreen.x*p;M.positionScreen.y=M.positionScreen.y*r;T.positionScreen.copy(H.positionScreen);C.positionScreen.copy(M.positionScreen);if(kb.overdraw){Nb(w.positionScreen,H.positionScreen);Nb(H.positionScreen,M.positionScreen);Nb(M.positionScreen,w.positionScreen);Nb(I.positionScreen,T.positionScreen);Nb(I.positionScreen,C.positionScreen)}va.addPoint(w.positionScreen.x,w.positionScreen.y);va.addPoint(H.positionScreen.x,H.positionScreen.y);va.addPoint(I.positionScreen.x,
-I.positionScreen.y);va.addPoint(M.positionScreen.x,M.positionScreen.y);Oa.intersects(va)&&t(w,H,I,M,T,C,Ta,kb,a)}ua.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;e=0;for(f=a.length;e<f;e++){g=a[e];h=g.color;if(g instanceof THREE.DirectionalLight){j=g.matrixWorld.getPosition();l=c.dot(j);if(!(l<=0)){l=l*g.intensity;d.r=d.r+h.r*l;d.g=d.g+h.g*l;d.b=d.b+h.b*l}}else if(g instanceof THREE.PointLight){j=g.matrixWorld.getPosition();l=c.dot(w.sub(j,b).normalize());if(!(l<=0)){l=l*(g.distance==0?1:1-Math.min(b.distanceTo(j)/g.distance,1));if(l!=0){l=l*g.intensity;d.r=d.r+h.r*l;d.g=d.g+h.g*l;d.b=d.b+h.b*
-l}}}}}function b(a){if(H[a]==null){H[a]=document.createElementNS("http://www.w3.org/2000/svg","path");K==0&&H[a].setAttribute("shape-rendering","crispEdges")}return H[a]}function c(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}console.log("THREE.SVGRenderer",THREE.REVISION);var d=this,e,f,g,h=new THREE.Projector,l=document.createElementNS("http://www.w3.org/2000/svg","svg"),k,j,o,m,p,r,n,q,u=new THREE.Rectangle,t=new THREE.Rectangle,x=false,s=new THREE.Color,z=new THREE.Color,D=new THREE.Color,B=new THREE.Color,
-v,w=new THREE.Vector3,H=[],I=[],M,T,C,K=1;this.domElement=l;this.sortElements=this.sortObjects=this.autoClear=true;this.info={render:{vertices:0,faces:0}};this.setQuality=function(a){switch(a){case "high":K=1;break;case "low":K=0}};this.setSize=function(a,b){k=a;j=b;o=k/2;m=j/2;l.setAttribute("viewBox",-o+" "+-m+" "+k+" "+j);l.setAttribute("width",k);l.setAttribute("height",j);u.set(-o,-m,o,m)};this.clear=function(){for(;l.childNodes.length>0;)l.removeChild(l.childNodes[0])};this.render=function(j,
-k){var i,w,F,L;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;C=T=0;if(x=g.length>0){z.setRGB(0,0,0);D.setRGB(0,0,0);B.setRGB(0,0,0);i=0;for(w=g.length;i<w;i++){L=g[i];F=L.color;if(L instanceof THREE.AmbientLight){z.r=z.r+F.r;z.g=z.g+F.g;z.b=z.b+F.b}else if(L instanceof THREE.DirectionalLight){D.r=D.r+F.r;D.g=D.g+F.g;D.b=D.b+F.b}else if(L instanceof THREE.PointLight){B.r=B.r+F.r;B.g=B.g+F.g;B.b=B.b+F.b}}}i=
-0;for(w=f.length;i<w;i++){F=f[i];L=F.material;L=L instanceof THREE.MeshFaceMaterial?F.faceMaterial:L;if(!(L==null||L.opacity==0)){t.empty();if(F instanceof THREE.RenderableParticle){p=F;p.x=p.x*o;p.y=p.y*-m}else if(F instanceof THREE.RenderableLine){p=F.v1;r=F.v2;p.positionScreen.x=p.positionScreen.x*o;p.positionScreen.y=p.positionScreen.y*-m;r.positionScreen.x=r.positionScreen.x*o;r.positionScreen.y=r.positionScreen.y*-m;t.addPoint(p.positionScreen.x,p.positionScreen.y);t.addPoint(r.positionScreen.x,
-r.positionScreen.y);if(u.intersects(t)){F=p;var W=r,G=C++;if(I[G]==null){I[G]=document.createElementNS("http://www.w3.org/2000/svg","line");K==0&&I[G].setAttribute("shape-rendering","crispEdges")}M=I[G];M.setAttribute("x1",F.positionScreen.x);M.setAttribute("y1",F.positionScreen.y);M.setAttribute("x2",W.positionScreen.x);M.setAttribute("y2",W.positionScreen.y);if(L instanceof THREE.LineBasicMaterial){M.setAttribute("style","fill: none; stroke: "+L.color.getContextStyle()+"; stroke-width: "+L.linewidth+
-"; stroke-opacity: "+L.opacity+"; stroke-linecap: "+L.linecap+"; stroke-linejoin: "+L.linejoin);l.appendChild(M)}}}else if(F instanceof THREE.RenderableFace3){p=F.v1;r=F.v2;n=F.v3;p.positionScreen.x=p.positionScreen.x*o;p.positionScreen.y=p.positionScreen.y*-m;r.positionScreen.x=r.positionScreen.x*o;r.positionScreen.y=r.positionScreen.y*-m;n.positionScreen.x=n.positionScreen.x*o;n.positionScreen.y=n.positionScreen.y*-m;t.addPoint(p.positionScreen.x,p.positionScreen.y);t.addPoint(r.positionScreen.x,
-r.positionScreen.y);t.addPoint(n.positionScreen.x,n.positionScreen.y);if(u.intersects(t)){var W=p,G=r,H=n;d.info.render.vertices=d.info.render.vertices+3;d.info.render.faces++;M=b(T++);M.setAttribute("d","M "+W.positionScreen.x+" "+W.positionScreen.y+" L "+G.positionScreen.x+" "+G.positionScreen.y+" L "+H.positionScreen.x+","+H.positionScreen.y+"z");if(L instanceof THREE.MeshBasicMaterial)s.copy(L.color);else if(L instanceof THREE.MeshLambertMaterial)if(x){s.r=z.r;s.g=z.g;s.b=z.b;a(g,F.centroidWorld,
-F.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))}else s.copy(L.color);else if(L instanceof THREE.MeshDepthMaterial){v=1-L.__2near/(L.__farPlusNear-F.z*L.__farMinusNear);s.setRGB(v,v,v)}else L instanceof THREE.MeshNormalMaterial&&s.setRGB(c(F.normalWorld.x),c(F.normalWorld.y),c(F.normalWorld.z));L.wireframe?M.setAttribute("style","fill: none; stroke: "+s.getContextStyle()+"; stroke-width: "+L.wireframeLinewidth+
-"; stroke-opacity: "+L.opacity+"; stroke-linecap: "+L.wireframeLinecap+"; stroke-linejoin: "+L.wireframeLinejoin):M.setAttribute("style","fill: "+s.getContextStyle()+"; fill-opacity: "+L.opacity);l.appendChild(M)}}else if(F instanceof THREE.RenderableFace4){p=F.v1;r=F.v2;n=F.v3;q=F.v4;p.positionScreen.x=p.positionScreen.x*o;p.positionScreen.y=p.positionScreen.y*-m;r.positionScreen.x=r.positionScreen.x*o;r.positionScreen.y=r.positionScreen.y*-m;n.positionScreen.x=n.positionScreen.x*o;n.positionScreen.y=
-n.positionScreen.y*-m;q.positionScreen.x=q.positionScreen.x*o;q.positionScreen.y=q.positionScreen.y*-m;t.addPoint(p.positionScreen.x,p.positionScreen.y);t.addPoint(r.positionScreen.x,r.positionScreen.y);t.addPoint(n.positionScreen.x,n.positionScreen.y);t.addPoint(q.positionScreen.x,q.positionScreen.y);if(u.intersects(t)){var W=p,G=r,H=n,fa=q;d.info.render.vertices=d.info.render.vertices+4;d.info.render.faces++;M=b(T++);M.setAttribute("d","M "+W.positionScreen.x+" "+W.positionScreen.y+" L "+G.positionScreen.x+
-" "+G.positionScreen.y+" L "+H.positionScreen.x+","+H.positionScreen.y+" L "+fa.positionScreen.x+","+fa.positionScreen.y+"z");if(L instanceof THREE.MeshBasicMaterial)s.copy(L.color);else if(L instanceof THREE.MeshLambertMaterial)if(x){s.r=z.r;s.g=z.g;s.b=z.b;a(g,F.centroidWorld,F.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))}else s.copy(L.color);else if(L instanceof THREE.MeshDepthMaterial){v=1-L.__2near/
-(L.__farPlusNear-F.z*L.__farMinusNear);s.setRGB(v,v,v)}else L instanceof THREE.MeshNormalMaterial&&s.setRGB(c(F.normalWorld.x),c(F.normalWorld.y),c(F.normalWorld.z));L.wireframe?M.setAttribute("style","fill: none; stroke: "+s.getContextStyle()+"; stroke-width: "+L.wireframeLinewidth+"; stroke-opacity: "+L.opacity+"; stroke-linecap: "+L.wireframeLinecap+"; stroke-linejoin: "+L.wireframeLinejoin):M.setAttribute("style","fill: "+s.getContextStyle()+"; fill-opacity: "+L.opacity);l.appendChild(M)}}}}}};
+THREE.DOMRenderer=function(){console.log("THREE.DOMRenderer",THREE.REVISION);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(typeof b.style[a[c]]==="string")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 l,o,n,p,r,m;a=h.projectScene(c,d);b=a.elements;l=0;for(o=
+b.length;l<o;l++){n=b[l];if(n instanceof THREE.RenderableParticle&&n.material instanceof THREE.ParticleDOMMaterial){p=n.material.domElement;r=n.x*e+e-(p.offsetWidth>>1);m=n.y*f+f-(p.offsetHeight>>1);p.style.left=r+"px";p.style.top=m+"px";p.style.zIndex=Math.abs(Math.floor((1-n.z)*d.far/d.near));g&&(p.style[g]="scale("+n.scale.x*e+","+n.scale.y*f+")")}}}};
+THREE.CanvasRenderer=function(a){function b(a){if(t!=a)m.globalAlpha=t=a}function c(a){if(w!=a){switch(a){case THREE.NormalBlending:m.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:m.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:m.globalCompositeOperation="darker"}w=a}}function d(a){if(s!=a)m.strokeStyle=s=a}function e(a){if(x!=a)m.fillStyle=x=a}console.log("THREE.CanvasRenderer",THREE.REVISION);var a=a||{},f=this,g,h,k,j=new THREE.Projector,l=a.canvas!==
+void 0?a.canvas:document.createElement("canvas"),o,n,p,r,m=l.getContext("2d"),q=new THREE.Color(0),u=0,t=1,w=0,s=null,x=null,F=null,E=null,B=null,v,z,J,K,X=new THREE.RenderableVertex,Q=new THREE.RenderableVertex,A,M,G,i,U,W,C,Y,H,ba,ga,la,P=new THREE.Color,S=new THREE.Color,ca=new THREE.Color,T=new THREE.Color,fa=new THREE.Color,Ma=[],xa=[],ta,Na,Sa,sa,Wa,Ya,Ja,db,hb,mb,Oa=new THREE.Rectangle,ua=new THREE.Rectangle,va=new THREE.Rectangle,ab=false,ja=new THREE.Color,Ha=new THREE.Color,Xa=new THREE.Color,
+ma=new THREE.Vector3,Fb,da,R,O,pc,Cc,a=16;Fb=document.createElement("canvas");Fb.width=Fb.height=2;da=Fb.getContext("2d");da.fillStyle="rgba(0,0,0,1)";da.fillRect(0,0,2,2);R=da.getImageData(0,0,2,2);O=R.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=l;this.sortElements=this.sortObjects=this.autoClear=true;this.info={render:{vertices:0,faces:0}};this.setSize=function(a,b){o=a;n=b;p=Math.floor(o/2);r=Math.floor(n/
+2);l.width=o;l.height=n;Oa.set(-p,-r,p,r);ua.set(-p,-r,p,r);t=1;w=0;B=E=F=x=s=null};this.setClearColor=function(a,b){q.copy(a);u=b!==void 0?b:1;ua.set(-p,-r,p,r)};this.setClearColorHex=function(a,b){q.setHex(a);u=b!==void 0?b:1;ua.set(-p,-r,p,r)};this.clear=function(){m.setTransform(1,0,0,-1,p,r);if(!ua.isEmpty()){ua.minSelf(Oa);ua.inflate(2);u<1&&m.clearRect(Math.floor(ua.getX()),Math.floor(ua.getY()),Math.floor(ua.getWidth()),Math.floor(ua.getHeight()));if(u>0){c(THREE.NormalBlending);b(1);e("rgba("+
+Math.floor(q.r*255)+","+Math.floor(q.g*255)+","+Math.floor(q.b*255)+","+u+")");m.fillRect(Math.floor(ua.getX()),Math.floor(ua.getY()),Math.floor(ua.getWidth()),Math.floor(ua.getHeight()))}ua.empty()}};this.render=function(a,l){function n(a){var b,c,d,e;ja.setRGB(0,0,0);Ha.setRGB(0,0,0);Xa.setRGB(0,0,0);b=0;for(c=a.length;b<c;b++){d=a[b];e=d.color;if(d instanceof THREE.AmbientLight){ja.r=ja.r+e.r;ja.g=ja.g+e.g;ja.b=ja.b+e.b}else if(d instanceof THREE.DirectionalLight){Ha.r=Ha.r+e.r;Ha.g=Ha.g+e.g;Ha.b=
+Ha.b+e.b}else if(d instanceof THREE.PointLight){Xa.r=Xa.r+e.r;Xa.g=Xa.g+e.g;Xa.b=Xa.b+e.b}}}function o(a,b,c,d){var e,f,g,da,h,i;e=0;for(f=a.length;e<f;e++){g=a[e];da=g.color;if(g instanceof THREE.DirectionalLight){h=g.matrixWorld.getPosition();i=c.dot(h);if(!(i<=0)){i=i*g.intensity;d.r=d.r+da.r*i;d.g=d.g+da.g*i;d.b=d.b+da.b*i}}else if(g instanceof THREE.PointLight){h=g.matrixWorld.getPosition();i=c.dot(ma.sub(h,b).normalize());if(!(i<=0)){i=i*(g.distance==0?1:1-Math.min(b.distanceTo(h)/g.distance,
+1));if(i!=0){i=i*g.intensity;d.r=d.r+da.r*i;d.g=d.g+da.g*i;d.b=d.b+da.b*i}}}}}function q(a,f,g){b(g.opacity);c(g.blending);var da,i,h,O,R,k;if(g instanceof THREE.ParticleBasicMaterial){if(g.map){O=g.map.image;R=O.width>>1;k=O.height>>1;g=f.scale.x*p;h=f.scale.y*r;da=g*R;i=h*k;va.set(a.x-da,a.y-i,a.x+da,a.y+i);if(Oa.intersects(va)){m.save();m.translate(a.x,a.y);m.rotate(-f.rotation);m.scale(g,-h);m.translate(-R,-k);m.drawImage(O,0,0);m.restore()}}}else if(g instanceof THREE.ParticleCanvasMaterial){da=
+f.scale.x*p;i=f.scale.y*r;va.set(a.x-da,a.y-i,a.x+da,a.y+i);if(Oa.intersects(va)){d(g.color.getContextStyle());e(g.color.getContextStyle());m.save();m.translate(a.x,a.y);m.rotate(-f.rotation);m.scale(da,i);g.program(m);m.restore()}}}function s(a,e,f,g){b(g.opacity);c(g.blending);m.beginPath();m.moveTo(a.positionScreen.x,a.positionScreen.y);m.lineTo(e.positionScreen.x,e.positionScreen.y);m.closePath();if(g instanceof THREE.LineBasicMaterial){a=g.linewidth;if(F!=a)m.lineWidth=F=a;a=g.linecap;if(E!=
+a)m.lineCap=E=a;a=g.linejoin;if(B!=a)m.lineJoin=B=a;d(g.color.getContextStyle());m.stroke();va.inflate(g.linewidth*2)}}function t(a,d,e,g,da,h,O,R){f.info.render.vertices=f.info.render.vertices+3;f.info.render.faces++;b(R.opacity);c(R.blending);A=a.positionScreen.x;M=a.positionScreen.y;G=d.positionScreen.x;i=d.positionScreen.y;U=e.positionScreen.x;W=e.positionScreen.y;w(A,M,G,i,U,W);if(R instanceof THREE.MeshBasicMaterial)if(R.map){if(R.map.mapping instanceof THREE.UVMapping){sa=O.uvs[0];Tc(A,M,G,
+i,U,W,sa[g].u,sa[g].v,sa[da].u,sa[da].v,sa[h].u,sa[h].v,R.map)}}else if(R.envMap){if(R.envMap.mapping instanceof THREE.SphericalReflectionMapping){a=l.matrixWorldInverse;ma.copy(O.vertexNormalsWorld[g]);Wa=(ma.x*a.elements[0]+ma.y*a.elements[4]+ma.z*a.elements[8])*0.5+0.5;Ya=-(ma.x*a.elements[1]+ma.y*a.elements[5]+ma.z*a.elements[9])*0.5+0.5;ma.copy(O.vertexNormalsWorld[da]);Ja=(ma.x*a.elements[0]+ma.y*a.elements[4]+ma.z*a.elements[8])*0.5+0.5;db=-(ma.x*a.elements[1]+ma.y*a.elements[5]+ma.z*a.elements[9])*
+0.5+0.5;ma.copy(O.vertexNormalsWorld[h]);hb=(ma.x*a.elements[0]+ma.y*a.elements[4]+ma.z*a.elements[8])*0.5+0.5;mb=-(ma.x*a.elements[1]+ma.y*a.elements[5]+ma.z*a.elements[9])*0.5+0.5;Tc(A,M,G,i,U,W,Wa,Ya,Ja,db,hb,mb,R.envMap)}}else R.wireframe?Mb(R.color,R.wireframeLinewidth,R.wireframeLinecap,R.wireframeLinejoin):Gb(R.color);else if(R instanceof THREE.MeshLambertMaterial){if(R.map&&!R.wireframe){if(R.map.mapping instanceof THREE.UVMapping){sa=O.uvs[0];Tc(A,M,G,i,U,W,sa[g].u,sa[g].v,sa[da].u,sa[da].v,
+sa[h].u,sa[h].v,R.map)}c(THREE.SubtractiveBlending)}if(ab)if(!R.wireframe&&R.shading==THREE.SmoothShading&&O.vertexNormalsWorld.length==3){S.r=ca.r=T.r=ja.r;S.g=ca.g=T.g=ja.g;S.b=ca.b=T.b=ja.b;o(k,O.v1.positionWorld,O.vertexNormalsWorld[0],S);o(k,O.v2.positionWorld,O.vertexNormalsWorld[1],ca);o(k,O.v3.positionWorld,O.vertexNormalsWorld[2],T);S.r=Math.max(0,Math.min(R.color.r*S.r,1));S.g=Math.max(0,Math.min(R.color.g*S.g,1));S.b=Math.max(0,Math.min(R.color.b*S.b,1));ca.r=Math.max(0,Math.min(R.color.r*
+ca.r,1));ca.g=Math.max(0,Math.min(R.color.g*ca.g,1));ca.b=Math.max(0,Math.min(R.color.b*ca.b,1));T.r=Math.max(0,Math.min(R.color.r*T.r,1));T.g=Math.max(0,Math.min(R.color.g*T.g,1));T.b=Math.max(0,Math.min(R.color.b*T.b,1));fa.r=(ca.r+T.r)*0.5;fa.g=(ca.g+T.g)*0.5;fa.b=(ca.b+T.b)*0.5;Sa=Dc(S,ca,T,fa);gc(A,M,G,i,U,W,0,0,1,0,0,1,Sa)}else{P.r=ja.r;P.g=ja.g;P.b=ja.b;o(k,O.centroidWorld,O.normalWorld,P);P.r=Math.max(0,Math.min(R.color.r*P.r,1));P.g=Math.max(0,Math.min(R.color.g*P.g,1));P.b=Math.max(0,Math.min(R.color.b*
+P.b,1));R.wireframe?Mb(P,R.wireframeLinewidth,R.wireframeLinecap,R.wireframeLinejoin):Gb(P)}else R.wireframe?Mb(R.color,R.wireframeLinewidth,R.wireframeLinecap,R.wireframeLinejoin):Gb(R.color)}else if(R instanceof THREE.MeshDepthMaterial){ta=l.near;Na=l.far;S.r=S.g=S.b=1-ac(a.positionScreen.z,ta,Na);ca.r=ca.g=ca.b=1-ac(d.positionScreen.z,ta,Na);T.r=T.g=T.b=1-ac(e.positionScreen.z,ta,Na);fa.r=(ca.r+T.r)*0.5;fa.g=(ca.g+T.g)*0.5;fa.b=(ca.b+T.b)*0.5;Sa=Dc(S,ca,T,fa);gc(A,M,G,i,U,W,0,0,1,0,0,1,Sa)}else if(R instanceof
+THREE.MeshNormalMaterial){P.r=hc(O.normalWorld.x);P.g=hc(O.normalWorld.y);P.b=hc(O.normalWorld.z);R.wireframe?Mb(P,R.wireframeLinewidth,R.wireframeLinecap,R.wireframeLinejoin):Gb(P)}}function u(a,d,e,g,da,h,R,O,j){f.info.render.vertices=f.info.render.vertices+4;f.info.render.faces++;b(O.opacity);c(O.blending);if(O.map||O.envMap){t(a,d,g,0,1,3,R,O,j);t(da,e,h,1,2,3,R,O,j)}else{A=a.positionScreen.x;M=a.positionScreen.y;G=d.positionScreen.x;i=d.positionScreen.y;U=e.positionScreen.x;W=e.positionScreen.y;
+C=g.positionScreen.x;Y=g.positionScreen.y;H=da.positionScreen.x;ba=da.positionScreen.y;ga=h.positionScreen.x;la=h.positionScreen.y;if(O instanceof THREE.MeshBasicMaterial){x(A,M,G,i,U,W,C,Y);O.wireframe?Mb(O.color,O.wireframeLinewidth,O.wireframeLinecap,O.wireframeLinejoin):Gb(O.color)}else if(O instanceof THREE.MeshLambertMaterial)if(ab)if(!O.wireframe&&O.shading==THREE.SmoothShading&&R.vertexNormalsWorld.length==4){S.r=ca.r=T.r=fa.r=ja.r;S.g=ca.g=T.g=fa.g=ja.g;S.b=ca.b=T.b=fa.b=ja.b;o(k,R.v1.positionWorld,
+R.vertexNormalsWorld[0],S);o(k,R.v2.positionWorld,R.vertexNormalsWorld[1],ca);o(k,R.v4.positionWorld,R.vertexNormalsWorld[3],T);o(k,R.v3.positionWorld,R.vertexNormalsWorld[2],fa);S.r=Math.max(0,Math.min(O.color.r*S.r,1));S.g=Math.max(0,Math.min(O.color.g*S.g,1));S.b=Math.max(0,Math.min(O.color.b*S.b,1));ca.r=Math.max(0,Math.min(O.color.r*ca.r,1));ca.g=Math.max(0,Math.min(O.color.g*ca.g,1));ca.b=Math.max(0,Math.min(O.color.b*ca.b,1));T.r=Math.max(0,Math.min(O.color.r*T.r,1));T.g=Math.max(0,Math.min(O.color.g*
+T.g,1));T.b=Math.max(0,Math.min(O.color.b*T.b,1));fa.r=Math.max(0,Math.min(O.color.r*fa.r,1));fa.g=Math.max(0,Math.min(O.color.g*fa.g,1));fa.b=Math.max(0,Math.min(O.color.b*fa.b,1));Sa=Dc(S,ca,T,fa);w(A,M,G,i,C,Y);gc(A,M,G,i,C,Y,0,0,1,0,0,1,Sa);w(H,ba,U,W,ga,la);gc(H,ba,U,W,ga,la,1,0,1,1,0,1,Sa)}else{P.r=ja.r;P.g=ja.g;P.b=ja.b;o(k,R.centroidWorld,R.normalWorld,P);P.r=Math.max(0,Math.min(O.color.r*P.r,1));P.g=Math.max(0,Math.min(O.color.g*P.g,1));P.b=Math.max(0,Math.min(O.color.b*P.b,1));x(A,M,G,i,
+U,W,C,Y);O.wireframe?Mb(P,O.wireframeLinewidth,O.wireframeLinecap,O.wireframeLinejoin):Gb(P)}else{x(A,M,G,i,U,W,C,Y);O.wireframe?Mb(O.color,O.wireframeLinewidth,O.wireframeLinecap,O.wireframeLinejoin):Gb(O.color)}else if(O instanceof THREE.MeshNormalMaterial){P.r=hc(R.normalWorld.x);P.g=hc(R.normalWorld.y);P.b=hc(R.normalWorld.z);x(A,M,G,i,U,W,C,Y);O.wireframe?Mb(P,O.wireframeLinewidth,O.wireframeLinecap,O.wireframeLinejoin):Gb(P)}else if(O instanceof THREE.MeshDepthMaterial){ta=l.near;Na=l.far;S.r=
+S.g=S.b=1-ac(a.positionScreen.z,ta,Na);ca.r=ca.g=ca.b=1-ac(d.positionScreen.z,ta,Na);T.r=T.g=T.b=1-ac(g.positionScreen.z,ta,Na);fa.r=fa.g=fa.b=1-ac(e.positionScreen.z,ta,Na);Sa=Dc(S,ca,T,fa);w(A,M,G,i,C,Y);gc(A,M,G,i,C,Y,0,0,1,0,0,1,Sa);w(H,ba,U,W,ga,la);gc(H,ba,U,W,ga,la,1,0,1,1,0,1,Sa)}}}function w(a,b,c,d,e,f){m.beginPath();m.moveTo(a,b);m.lineTo(c,d);m.lineTo(e,f);m.lineTo(a,b);m.closePath()}function x(a,b,c,d,e,f,g,da){m.beginPath();m.moveTo(a,b);m.lineTo(c,d);m.lineTo(e,f);m.lineTo(g,da);m.lineTo(a,
+b);m.closePath()}function Mb(a,b,c,e){if(F!=b)m.lineWidth=F=b;if(E!=c)m.lineCap=E=c;if(B!=e)m.lineJoin=B=e;d(a.getContextStyle());m.stroke();va.inflate(b*2)}function Gb(a){e(a.getContextStyle());m.fill()}function Tc(a,b,c,d,f,g,da,h,i,O,R,k,j){if(j.image.width!=0){if(j.needsUpdate==true||Ma[j.id]==void 0){var l=j.wrapS==THREE.RepeatWrapping,n=j.wrapT==THREE.RepeatWrapping;Ma[j.id]=m.createPattern(j.image,l&&n?"repeat":l&&!n?"repeat-x":!l&&n?"repeat-y":"no-repeat");j.needsUpdate=false}e(Ma[j.id]);
+var l=j.offset.x/j.repeat.x,n=j.offset.y/j.repeat.y,o=j.image.width*j.repeat.x,p=j.image.height*j.repeat.y,da=(da+l)*o,h=(h+n)*p,c=c-a,d=d-b,f=f-a,g=g-b,i=(i+l)*o-da,O=(O+n)*p-h,R=(R+l)*o-da,k=(k+n)*p-h,l=i*k-R*O;if(l==0){if(xa[j.id]===void 0){b=document.createElement("canvas");b.width=j.image.width;b.height=j.image.height;b=b.getContext("2d");b.drawImage(j.image,0,0);xa[j.id]=b.getImageData(0,0,j.image.width,j.image.height).data}b=xa[j.id];da=(Math.floor(da)+Math.floor(h)*j.image.width)*4;P.setRGB(b[da]/
+255,b[da+1]/255,b[da+2]/255);Gb(P)}else{l=1/l;j=(k*c-O*f)*l;O=(k*d-O*g)*l;c=(i*f-R*c)*l;d=(i*g-R*d)*l;a=a-j*da-c*h;da=b-O*da-d*h;m.save();m.transform(j,O,c,d,a,da);m.fill();m.restore()}}}function gc(a,b,c,d,e,f,g,da,h,O,i,R,j){var k,l;k=j.width-1;l=j.height-1;g=g*k;da=da*l;c=c-a;d=d-b;e=e-a;f=f-b;h=h*k-g;O=O*l-da;i=i*k-g;R=R*l-da;l=1/(h*R-i*O);k=(R*c-O*e)*l;O=(R*d-O*f)*l;c=(h*e-i*c)*l;d=(h*f-i*d)*l;a=a-k*g-c*da;b=b-O*g-d*da;m.save();m.transform(k,O,c,d,a,b);m.clip();m.drawImage(j,0,0);m.restore()}
+function Dc(a,b,c,d){var e=~~(a.r*255),f=~~(a.g*255),a=~~(a.b*255),g=~~(b.r*255),h=~~(b.g*255),b=~~(b.b*255),i=~~(c.r*255),j=~~(c.g*255),c=~~(c.b*255),k=~~(d.r*255),l=~~(d.g*255),d=~~(d.b*255);O[0]=e<0?0:e>255?255:e;O[1]=f<0?0:f>255?255:f;O[2]=a<0?0:a>255?255:a;O[4]=g<0?0:g>255?255:g;O[5]=h<0?0:h>255?255:h;O[6]=b<0?0:b>255?255:b;O[8]=i<0?0:i>255?255:i;O[9]=j<0?0:j>255?255:j;O[10]=c<0?0:c>255?255:c;O[12]=k<0?0:k>255?255:k;O[13]=l<0?0:l>255?255:l;O[14]=d<0?0:d>255?255:d;da.putImageData(R,0,0);Cc.drawImage(Fb,
+0,0);return pc}function ac(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function hc(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}function Nb(a,b){var c=b.x-a.x,d=b.y-a.y,e=c*c+d*d;if(e!=0){e=1/Math.sqrt(e);c=c*e;d=d*e;b.x=b.x+c;b.y=b.y+d;a.x=a.x-c;a.y=a.y-d}}var Ec,cd,Ta,kb;this.autoClear?this.clear():m.setTransform(1,0,0,-1,p,r);f.info.render.vertices=0;f.info.render.faces=0;g=j.projectScene(a,l,this.sortElements);h=g.elements;k=g.lights;(ab=k.length>0)&&n(k);Ec=0;for(cd=h.length;Ec<cd;Ec++){Ta=h[Ec];kb=Ta.material;
+kb=kb instanceof THREE.MeshFaceMaterial?Ta.faceMaterial:kb;if(!(kb==null||kb.opacity==0)){va.empty();if(Ta instanceof THREE.RenderableParticle){v=Ta;v.x=v.x*p;v.y=v.y*r;q(v,Ta,kb,a)}else if(Ta instanceof THREE.RenderableLine){v=Ta.v1;z=Ta.v2;v.positionScreen.x=v.positionScreen.x*p;v.positionScreen.y=v.positionScreen.y*r;z.positionScreen.x=z.positionScreen.x*p;z.positionScreen.y=z.positionScreen.y*r;va.addPoint(v.positionScreen.x,v.positionScreen.y);va.addPoint(z.positionScreen.x,z.positionScreen.y);
+Oa.intersects(va)&&s(v,z,Ta,kb,a)}else if(Ta instanceof THREE.RenderableFace3){v=Ta.v1;z=Ta.v2;J=Ta.v3;v.positionScreen.x=v.positionScreen.x*p;v.positionScreen.y=v.positionScreen.y*r;z.positionScreen.x=z.positionScreen.x*p;z.positionScreen.y=z.positionScreen.y*r;J.positionScreen.x=J.positionScreen.x*p;J.positionScreen.y=J.positionScreen.y*r;if(kb.overdraw){Nb(v.positionScreen,z.positionScreen);Nb(z.positionScreen,J.positionScreen);Nb(J.positionScreen,v.positionScreen)}va.add3Points(v.positionScreen.x,
+v.positionScreen.y,z.positionScreen.x,z.positionScreen.y,J.positionScreen.x,J.positionScreen.y);Oa.intersects(va)&&t(v,z,J,0,1,2,Ta,kb,a)}else if(Ta instanceof THREE.RenderableFace4){v=Ta.v1;z=Ta.v2;J=Ta.v3;K=Ta.v4;v.positionScreen.x=v.positionScreen.x*p;v.positionScreen.y=v.positionScreen.y*r;z.positionScreen.x=z.positionScreen.x*p;z.positionScreen.y=z.positionScreen.y*r;J.positionScreen.x=J.positionScreen.x*p;J.positionScreen.y=J.positionScreen.y*r;K.positionScreen.x=K.positionScreen.x*p;K.positionScreen.y=
+K.positionScreen.y*r;X.positionScreen.copy(z.positionScreen);Q.positionScreen.copy(K.positionScreen);if(kb.overdraw){Nb(v.positionScreen,z.positionScreen);Nb(z.positionScreen,K.positionScreen);Nb(K.positionScreen,v.positionScreen);Nb(J.positionScreen,X.positionScreen);Nb(J.positionScreen,Q.positionScreen)}va.addPoint(v.positionScreen.x,v.positionScreen.y);va.addPoint(z.positionScreen.x,z.positionScreen.y);va.addPoint(J.positionScreen.x,J.positionScreen.y);va.addPoint(K.positionScreen.x,K.positionScreen.y);
+Oa.intersects(va)&&u(v,z,J,K,X,Q,Ta,kb,a)}ua.addRectangle(va)}}m.setTransform(1,0,0,1,0,0)}};
+THREE.SVGRenderer=function(){function a(a,b,c,d){var e,f,g,h,j,k;e=0;for(f=a.length;e<f;e++){g=a[e];h=g.color;if(g instanceof THREE.DirectionalLight){j=g.matrixWorld.getPosition();k=c.dot(j);if(!(k<=0)){k=k*g.intensity;d.r=d.r+h.r*k;d.g=d.g+h.g*k;d.b=d.b+h.b*k}}else if(g instanceof THREE.PointLight){j=g.matrixWorld.getPosition();k=c.dot(v.sub(j,b).normalize());if(!(k<=0)){k=k*(g.distance==0?1:1-Math.min(b.distanceTo(j)/g.distance,1));if(k!=0){k=k*g.intensity;d.r=d.r+h.r*k;d.g=d.g+h.g*k;d.b=d.b+h.b*
+k}}}}}function b(a){if(z[a]==null){z[a]=document.createElementNS("http://www.w3.org/2000/svg","path");A==0&&z[a].setAttribute("shape-rendering","crispEdges")}return z[a]}function c(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}console.log("THREE.SVGRenderer",THREE.REVISION);var d=this,e,f,g,h=new THREE.Projector,k=document.createElementNS("http://www.w3.org/2000/svg","svg"),j,l,o,n,p,r,m,q,u=new THREE.Rectangle,t=new THREE.Rectangle,w=false,s=new THREE.Color,x=new THREE.Color,F=new THREE.Color,E=new THREE.Color,
+B,v=new THREE.Vector3,z=[],J=[],K,X,Q,A=1;this.domElement=k;this.sortElements=this.sortObjects=this.autoClear=true;this.info={render:{vertices:0,faces:0}};this.setQuality=function(a){switch(a){case "high":A=1;break;case "low":A=0}};this.setSize=function(a,b){j=a;l=b;o=j/2;n=l/2;k.setAttribute("viewBox",-o+" "+-n+" "+j+" "+l);k.setAttribute("width",j);k.setAttribute("height",l);u.set(-o,-n,o,n)};this.clear=function(){for(;k.childNodes.length>0;)k.removeChild(k.childNodes[0])};this.render=function(j,
+l){var i,v,z,C;this.autoClear&&this.clear();d.info.render.vertices=0;d.info.render.faces=0;e=h.projectScene(j,l,this.sortElements);f=e.elements;g=e.lights;Q=X=0;if(w=g.length>0){x.setRGB(0,0,0);F.setRGB(0,0,0);E.setRGB(0,0,0);i=0;for(v=g.length;i<v;i++){C=g[i];z=C.color;if(C instanceof THREE.AmbientLight){x.r=x.r+z.r;x.g=x.g+z.g;x.b=x.b+z.b}else if(C instanceof THREE.DirectionalLight){F.r=F.r+z.r;F.g=F.g+z.g;F.b=F.b+z.b}else if(C instanceof THREE.PointLight){E.r=E.r+z.r;E.g=E.g+z.g;E.b=E.b+z.b}}}i=
+0;for(v=f.length;i<v;i++){z=f[i];C=z.material;C=C instanceof THREE.MeshFaceMaterial?z.faceMaterial:C;if(!(C==null||C.opacity==0)){t.empty();if(z instanceof THREE.RenderableParticle){p=z;p.x=p.x*o;p.y=p.y*-n}else if(z instanceof THREE.RenderableLine){p=z.v1;r=z.v2;p.positionScreen.x=p.positionScreen.x*o;p.positionScreen.y=p.positionScreen.y*-n;r.positionScreen.x=r.positionScreen.x*o;r.positionScreen.y=r.positionScreen.y*-n;t.addPoint(p.positionScreen.x,p.positionScreen.y);t.addPoint(r.positionScreen.x,
+r.positionScreen.y);if(u.intersects(t)){z=p;var Y=r,H=Q++;if(J[H]==null){J[H]=document.createElementNS("http://www.w3.org/2000/svg","line");A==0&&J[H].setAttribute("shape-rendering","crispEdges")}K=J[H];K.setAttribute("x1",z.positionScreen.x);K.setAttribute("y1",z.positionScreen.y);K.setAttribute("x2",Y.positionScreen.x);K.setAttribute("y2",Y.positionScreen.y);if(C instanceof THREE.LineBasicMaterial){K.setAttribute("style","fill: none; stroke: "+C.color.getContextStyle()+"; stroke-width: "+C.linewidth+
+"; stroke-opacity: "+C.opacity+"; stroke-linecap: "+C.linecap+"; stroke-linejoin: "+C.linejoin);k.appendChild(K)}}}else if(z instanceof THREE.RenderableFace3){p=z.v1;r=z.v2;m=z.v3;p.positionScreen.x=p.positionScreen.x*o;p.positionScreen.y=p.positionScreen.y*-n;r.positionScreen.x=r.positionScreen.x*o;r.positionScreen.y=r.positionScreen.y*-n;m.positionScreen.x=m.positionScreen.x*o;m.positionScreen.y=m.positionScreen.y*-n;t.addPoint(p.positionScreen.x,p.positionScreen.y);t.addPoint(r.positionScreen.x,
+r.positionScreen.y);t.addPoint(m.positionScreen.x,m.positionScreen.y);if(u.intersects(t)){var Y=p,H=r,ba=m;d.info.render.vertices=d.info.render.vertices+3;d.info.render.faces++;K=b(X++);K.setAttribute("d","M "+Y.positionScreen.x+" "+Y.positionScreen.y+" L "+H.positionScreen.x+" "+H.positionScreen.y+" L "+ba.positionScreen.x+","+ba.positionScreen.y+"z");if(C instanceof THREE.MeshBasicMaterial)s.copy(C.color);else if(C instanceof THREE.MeshLambertMaterial)if(w){s.r=x.r;s.g=x.g;s.b=x.b;a(g,z.centroidWorld,
+z.normalWorld,s);s.r=Math.max(0,Math.min(C.color.r*s.r,1));s.g=Math.max(0,Math.min(C.color.g*s.g,1));s.b=Math.max(0,Math.min(C.color.b*s.b,1))}else s.copy(C.color);else if(C instanceof THREE.MeshDepthMaterial){B=1-C.__2near/(C.__farPlusNear-z.z*C.__farMinusNear);s.setRGB(B,B,B)}else C instanceof THREE.MeshNormalMaterial&&s.setRGB(c(z.normalWorld.x),c(z.normalWorld.y),c(z.normalWorld.z));C.wireframe?K.setAttribute("style","fill: none; stroke: "+s.getContextStyle()+"; stroke-width: "+C.wireframeLinewidth+
+"; stroke-opacity: "+C.opacity+"; stroke-linecap: "+C.wireframeLinecap+"; stroke-linejoin: "+C.wireframeLinejoin):K.setAttribute("style","fill: "+s.getContextStyle()+"; fill-opacity: "+C.opacity);k.appendChild(K)}}else if(z instanceof THREE.RenderableFace4){p=z.v1;r=z.v2;m=z.v3;q=z.v4;p.positionScreen.x=p.positionScreen.x*o;p.positionScreen.y=p.positionScreen.y*-n;r.positionScreen.x=r.positionScreen.x*o;r.positionScreen.y=r.positionScreen.y*-n;m.positionScreen.x=m.positionScreen.x*o;m.positionScreen.y=
+m.positionScreen.y*-n;q.positionScreen.x=q.positionScreen.x*o;q.positionScreen.y=q.positionScreen.y*-n;t.addPoint(p.positionScreen.x,p.positionScreen.y);t.addPoint(r.positionScreen.x,r.positionScreen.y);t.addPoint(m.positionScreen.x,m.positionScreen.y);t.addPoint(q.positionScreen.x,q.positionScreen.y);if(u.intersects(t)){var Y=p,H=r,ba=m,ga=q;d.info.render.vertices=d.info.render.vertices+4;d.info.render.faces++;K=b(X++);K.setAttribute("d","M "+Y.positionScreen.x+" "+Y.positionScreen.y+" L "+H.positionScreen.x+
+" "+H.positionScreen.y+" L "+ba.positionScreen.x+","+ba.positionScreen.y+" L "+ga.positionScreen.x+","+ga.positionScreen.y+"z");if(C instanceof THREE.MeshBasicMaterial)s.copy(C.color);else if(C instanceof THREE.MeshLambertMaterial)if(w){s.r=x.r;s.g=x.g;s.b=x.b;a(g,z.centroidWorld,z.normalWorld,s);s.r=Math.max(0,Math.min(C.color.r*s.r,1));s.g=Math.max(0,Math.min(C.color.g*s.g,1));s.b=Math.max(0,Math.min(C.color.b*s.b,1))}else s.copy(C.color);else if(C instanceof THREE.MeshDepthMaterial){B=1-C.__2near/
+(C.__farPlusNear-z.z*C.__farMinusNear);s.setRGB(B,B,B)}else C instanceof THREE.MeshNormalMaterial&&s.setRGB(c(z.normalWorld.x),c(z.normalWorld.y),c(z.normalWorld.z));C.wireframe?K.setAttribute("style","fill: none; stroke: "+s.getContextStyle()+"; stroke-width: "+C.wireframeLinewidth+"; stroke-opacity: "+C.opacity+"; stroke-linecap: "+C.wireframeLinecap+"; stroke-linejoin: "+C.wireframeLinejoin):K.setAttribute("style","fill: "+s.getContextStyle()+"; fill-opacity: "+C.opacity);k.appendChild(K)}}}}}};
 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",
@@ -252,132 +252,132 @@ THREE.ShaderChunk.map_particle_pars_fragment,THREE.ShaderChunk.fog_pars_fragment
 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(a.__webglCustomAttributesList===void 0)a.__webglCustomAttributesList=[];for(var e in d.attributes){var f=d.attributes[e];if(!f.__webglInitialized||f.createUniqueBuffers){f.__webglInitialized=true;var g=1;f.type==="v2"?g=2:f.type==="v3"?g=3:f.type==="v4"?g=4:f.type==="c"&&(g=3);f.size=g;f.array=new Float32Array(c*g);f.buffer=i.createBuffer();f.buffer.belongsToAttribute=e;f.needsUpdate=true}a.__webglCustomAttributesList.push(f)}}}
 function c(a,b){if(a.material&&!(a.material instanceof THREE.MeshFaceMaterial))return a.material;if(b.materialIndex>=0)return a.geometry.materials[b.materialIndex]}function d(a){return a instanceof THREE.MeshBasicMaterial&&!a.envMap||a instanceof THREE.MeshDepthMaterial?false:a&&a.shading!==void 0&&a.shading===THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading}function e(a){return a.map||a.lightMap||a instanceof THREE.ShaderMaterial?true:false}function f(a,b,c){var d,e,f,g,h=a.vertices;g=h.length;
-var l=a.colors,j=l.length,k=a.__vertexArray,m=a.__colorArray,n=a.__sortArray,o=a.__dirtyVertices,p=a.__dirtyColors,r=a.__webglCustomAttributesList;if(c.sortParticles){va.copy(ua);va.multiplySelf(c.matrixWorld);for(d=0;d<g;d++){e=h[d];ab.copy(e);va.multiplyVector3(ab);n[d]=[ab.z,d]}n.sort(function(a,b){return b[0]-a[0]});for(d=0;d<g;d++){e=h[n[d][1]];f=d*3;k[f]=e.x;k[f+1]=e.y;k[f+2]=e.z}for(d=0;d<j;d++){f=d*3;e=l[n[d][1]];m[f]=e.r;m[f+1]=e.g;m[f+2]=e.b}if(r){l=0;for(j=r.length;l<j;l++){h=r[l];if(h.boundTo===
-void 0||h.boundTo==="vertices"){f=0;e=h.value.length;if(h.size===1)for(d=0;d<e;d++){g=n[d][1];h.array[d]=h.value[g]}else if(h.size===2)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=f+2}else if(h.size===3)if(h.type==="c")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=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=f+3}else if(h.size===4)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=f+4}}}}}else{if(o)for(d=0;d<g;d++){e=h[d];f=d*3;k[f]=e.x;k[f+1]=e.y;k[f+2]=e.z}if(p)for(d=0;d<j;d++){e=l[d];f=d*3;m[f]=e.r;m[f+1]=e.g;m[f+2]=e.b}if(r){l=0;for(j=r.length;l<j;l++){h=r[l];if(h.needsUpdate&&(h.boundTo===void 0||h.boundTo==="vertices")){e=h.value.length;f=0;if(h.size===1)for(d=0;d<e;d++)h.array[d]=h.value[d];else if(h.size===2)for(d=0;d<e;d++){g=h.value[d];h.array[f]=g.x;h.array[f+1]=g.y;f=f+2}else if(h.size===3)if(h.type===
-"c")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=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=f+3}else if(h.size===4)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=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,
-m,b)}if(r){l=0;for(j=r.length;l<j;l++){h=r[l];if(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++){ha=F=null;W=G=xa=Ma=$=-1;a[d].render(b,c,hb,mb);ha=F=null;W=G=xa=Ma=$=-1}}function l(a,b,c,d,e,f,g,h){var i,l,j,k;if(b){l=a.length-1;k=b=-1}else{l=0;b=a.length;k=1}for(var m=l;m!==b;m=m+k){i=a[m];if(i.render){l=i.object;j=i.buffer;if(h)i=h;else{i=
-i[c];if(!i)continue;g&&E.setBlending(i.blending,i.blendEquation,i.blendSrc,i.blendDst);E.setDepthTest(i.depthTest);E.setDepthWrite(i.depthWrite);u(i.polygonOffset,i.polygonOffsetFactor,i.polygonOffsetUnits)}E.setObjectFaces(l);j instanceof THREE.BufferGeometry?E.renderBufferDirect(d,e,f,i,j,l):E.renderBuffer(d,e,f,i,j,l)}}}function k(a,b,c,d,e,f,g){for(var h,i,l=0,j=a.length;l<j;l++){h=a[l];i=h.object;if(i.visible){if(g)h=g;else{h=h[b];if(!h)continue;f&&E.setBlending(h.blending,h.blendEquation,h.blendSrc,
-h.blendDst);E.setDepthTest(h.depthTest);E.setDepthWrite(h.depthWrite);u(h.polygonOffset,h.polygonOffsetFactor,h.polygonOffsetUnits)}E.renderImmediateObject(c,d,e,h,i)}}}function j(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 true;return false}function m(a){for(var b in a.attributes)a.attributes[b].needsUpdate=false}function p(a,b){for(var c=a.length-1;c>=0;c--)a[c].object===b&&a.splice(c,1)}function r(a,
-b){for(var c=a.length-1;c>=0;c--)a[c]===b&&a.splice(c,1)}function n(a,b,c,d,e){if(!d.program||d.needsUpdate){E.initMaterial(d,b,c,e);d.needsUpdate=false}if(d.morphTargets&&!e.__webglMorphTargetInfluences){e.__webglMorphTargetInfluences=new Float32Array(E.maxMorphTargets);for(var f=0,g=E.maxMorphTargets;f<g;f++)e.__webglMorphTargetInfluences[f]=0}var h=false,f=d.program,g=f.uniforms,l=d.uniforms;if(f!==F){i.useProgram(f);F=f;h=true}if(d.id!==W){W=d.id;h=true}if(h||a!==ha){i.uniformMatrix4fv(g.projectionMatrix,
-false,a._projectionMatrixArray);a!==ha&&(ha=a)}if(h){if(c&&d.fog){l.fogColor.value=c.color;if(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){for(var j,k=0,m=0,n=0,o,p,r,q=Ha,s=q.directional.colors,u=q.directional.positions,t=q.point.colors,L=q.point.positions,G=q.point.distances,v=q.spot.colors,w=q.spot.positions,z=q.spot.distances,
-$=q.spot.directions,H=q.spot.angles,K=q.spot.exponents,R=0,M=0,I=0,C=r=0,c=C=0,h=b.length;c<h;c++){j=b[c];if(!j.onlyShadow){o=j.color;p=j.intensity;r=j.distance;if(j instanceof THREE.AmbientLight)if(E.gammaInput){k=k+o.r*o.r;m=m+o.g*o.g;n=n+o.b*o.b}else{k=k+o.r;m=m+o.g;n=n+o.b}else if(j instanceof THREE.DirectionalLight){r=R*3;if(E.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}else{s[r]=o.r*p;s[r+1]=o.g*p;s[r+2]=o.b*p}ja.copy(j.matrixWorld.getPosition());ja.subSelf(j.target.matrixWorld.getPosition());
-ja.normalize();u[r]=ja.x;u[r+1]=ja.y;u[r+2]=ja.z;R=R+1}else if(j instanceof THREE.PointLight){C=M*3;if(E.gammaInput){t[C]=o.r*o.r*p*p;t[C+1]=o.g*o.g*p*p;t[C+2]=o.b*o.b*p*p}else{t[C]=o.r*p;t[C+1]=o.g*p;t[C+2]=o.b*p}o=j.matrixWorld.getPosition();L[C]=o.x;L[C+1]=o.y;L[C+2]=o.z;G[M]=r;M=M+1}else if(j instanceof THREE.SpotLight){C=I*3;if(E.gammaInput){v[C]=o.r*o.r*p*p;v[C+1]=o.g*o.g*p*p;v[C+2]=o.b*o.b*p*p}else{v[C]=o.r*p;v[C+1]=o.g*p;v[C+2]=o.b*p}o=j.matrixWorld.getPosition();w[C]=o.x;w[C+1]=o.y;w[C+2]=
-o.z;z[I]=r;ja.copy(o);ja.subSelf(j.target.matrixWorld.getPosition());ja.normalize();$[C]=ja.x;$[C+1]=ja.y;$[C+2]=ja.z;H[I]=Math.cos(j.angle);K[I]=j.exponent;I=I+1}}}c=R*3;for(h=s.length;c<h;c++)s[c]=0;c=M*3;for(h=t.length;c<h;c++)t[c]=0;c=I*3;for(h=v.length;c<h;c++)v[c]=0;q.directional.length=R;q.point.length=M;q.spot.length=I;q.ambient[0]=k;q.ambient[1]=m;q.ambient[2]=n;c=Ha;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;l.spotLightColor.value=c.spot.colors;l.spotLightPosition.value=c.spot.positions;l.spotLightDistance.value=c.spot.distances;l.spotLightDirection.value=c.spot.directions;l.spotLightAngle.value=c.spot.angles;l.spotLightExponent.value=c.spot.exponents}if(d instanceof THREE.MeshBasicMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.MeshPhongMaterial){l.opacity.value=
-d.opacity;E.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=B.height/2;l.map.texture=d.map}else if(d instanceof THREE.MeshPhongMaterial){l.shininess.value=d.shininess;if(E.gammaInput){l.ambient.value.copyGammaToLinear(d.ambient);l.emissive.value.copyGammaToLinear(d.emissive);l.specular.value.copyGammaToLinear(d.specular)}else{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){if(E.gammaInput){l.ambient.value.copyGammaToLinear(d.ambient);l.emissive.value.copyGammaToLinear(d.emissive)}else{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(j=b.length;h<j;h++){k=b[h];if(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;l=0;for(c=b.length;l<c;l++)if(k=f.uniforms[b[l][1]]){h=b[l][0];m=h.type;j=h.value;
-if(m==="i")i.uniform1i(k,j);else if(m==="f")i.uniform1f(k,j);else if(m==="v2")i.uniform2f(k,j.x,j.y);else if(m==="v3")i.uniform3f(k,j.x,j.y,j.z);else if(m==="v4")i.uniform4f(k,j.x,j.y,j.z,j.w);else if(m==="c")i.uniform3f(k,j.r,j.g,j.b);else if(m==="fv1")i.uniform1fv(k,j);else if(m==="fv")i.uniform3fv(k,j);else if(m==="v2v"){if(!h._array)h._array=new Float32Array(2*j.length);m=0;for(n=j.length;m<n;m++){q=m*2;h._array[q]=j[m].x;h._array[q+1]=j[m].y}i.uniform2fv(k,h._array)}else if(m==="v3v"){if(!h._array)h._array=
-new Float32Array(3*j.length);m=0;for(n=j.length;m<n;m++){q=m*3;h._array[q]=j[m].x;h._array[q+1]=j[m].y;h._array[q+2]=j[m].z}i.uniform3fv(k,h._array)}else if(m=="v4v"){if(!h._array)h._array=new Float32Array(4*j.length);m=0;for(n=j.length;m<n;m++){q=m*4;h._array[q]=j[m].x;h._array[q+1]=j[m].y;h._array[q+2]=j[m].z;h._array[q+3]=j[m].w}i.uniform4fv(k,h._array)}else if(m==="m4"){if(!h._array)h._array=new Float32Array(16);j.flattenToArray(h._array);i.uniformMatrix4fv(k,false,h._array)}else if(m==="m4v"){if(!h._array)h._array=
-new Float32Array(16*j.length);m=0;for(n=j.length;m<n;m++)j[m].flattenToArrayOffset(h._array,m*16);i.uniformMatrix4fv(k,false,h._array)}else if(m==="t"){i.uniform1i(k,j);if(k=h.texture)if(k.image instanceof Array&&k.image.length===6){h=k;if(h.image.length===6)if(h.needsUpdate){if(!h.image.__webglTextureCube)h.image.__webglTextureCube=i.createTexture();i.activeTexture(i.TEXTURE0+j);i.bindTexture(i.TEXTURE_CUBE_MAP,h.image.__webglTextureCube);j=[];for(k=0;k<6;k++){m=j;n=k;if(E.autoScaleCubemaps){q=h.image[k];
-u=ma;if(!(q.width<=u&&q.height<=u)){t=Math.max(q.width,q.height);s=Math.floor(q.width*u/t);u=Math.floor(q.height*u/t);t=document.createElement("canvas");t.width=s;t.height=u;t.getContext("2d").drawImage(q,0,0,q.width,q.height,0,0,s,u);q=t}}else q=h.image[k];m[n]=q}k=j[0];m=(k.width&k.width-1)===0&&(k.height&k.height-1)===0;n=D(h.format);q=D(h.type);x(i.TEXTURE_CUBE_MAP,h,m);for(k=0;k<6;k++)i.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+k,0,n,n,q,j[k]);h.generateMipmaps&&m&&i.generateMipmap(i.TEXTURE_CUBE_MAP);
-h.needsUpdate=false;if(h.onUpdate)h.onUpdate()}else{i.activeTexture(i.TEXTURE0+j);i.bindTexture(i.TEXTURE_CUBE_MAP,h.image.__webglTextureCube)}}else if(k instanceof THREE.WebGLRenderTargetCube){h=k;i.activeTexture(i.TEXTURE0+j);i.bindTexture(i.TEXTURE_CUBE_MAP,h.__webglTexture)}else E.setTexture(k,j)}else if(m==="tv"){if(!h._array){h._array=[];m=0;for(n=h.texture.length;m<n;m++)h._array[m]=j+m}i.uniform1iv(k,h._array);m=0;for(n=h.texture.length;m<n;m++)(k=h.texture[m])&&E.setTexture(k,h._array[m])}}if((d instanceof
+var k=a.colors,j=k.length,l=a.__vertexArray,n=a.__colorArray,m=a.__sortArray,o=a.__dirtyVertices,p=a.__dirtyColors,r=a.__webglCustomAttributesList;if(c.sortParticles){va.copy(ua);va.multiplySelf(c.matrixWorld);for(d=0;d<g;d++){e=h[d];ab.copy(e);va.multiplyVector3(ab);m[d]=[ab.z,d]}m.sort(function(a,b){return b[0]-a[0]});for(d=0;d<g;d++){e=h[m[d][1]];f=d*3;l[f]=e.x;l[f+1]=e.y;l[f+2]=e.z}for(d=0;d<j;d++){f=d*3;e=k[m[d][1]];n[f]=e.r;n[f+1]=e.g;n[f+2]=e.b}if(r){k=0;for(j=r.length;k<j;k++){h=r[k];if(h.boundTo===
+void 0||h.boundTo==="vertices"){f=0;e=h.value.length;if(h.size===1)for(d=0;d<e;d++){g=m[d][1];h.array[d]=h.value[g]}else if(h.size===2)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=f+2}else if(h.size===3)if(h.type==="c")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=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=f+3}else if(h.size===4)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=f+4}}}}}else{if(o)for(d=0;d<g;d++){e=h[d];f=d*3;l[f]=e.x;l[f+1]=e.y;l[f+2]=e.z}if(p)for(d=0;d<j;d++){e=k[d];f=d*3;n[f]=e.r;n[f+1]=e.g;n[f+2]=e.b}if(r){k=0;for(j=r.length;k<j;k++){h=r[k];if(h.needsUpdate&&(h.boundTo===void 0||h.boundTo==="vertices")){e=h.value.length;f=0;if(h.size===1)for(d=0;d<e;d++)h.array[d]=h.value[d];else if(h.size===2)for(d=0;d<e;d++){g=h.value[d];h.array[f]=g.x;h.array[f+1]=g.y;f=f+2}else if(h.size===3)if(h.type===
+"c")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=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=f+3}else if(h.size===4)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=f+4}}}}}if(o||c.sortParticles){i.bindBuffer(i.ARRAY_BUFFER,a.__webglVertexBuffer);i.bufferData(i.ARRAY_BUFFER,l,b)}if(p||c.sortParticles){i.bindBuffer(i.ARRAY_BUFFER,a.__webglColorBuffer);i.bufferData(i.ARRAY_BUFFER,
+n,b)}if(r){k=0;for(j=r.length;k<j;k++){h=r[k];if(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++){ba=W=null;Y=H=xa=Ma=S=-1;a[d].render(b,c,hb,mb);ba=W=null;Y=H=xa=Ma=S=-1}}function k(a,b,c,d,e,f,g,h){var i,k,j,l;if(b){k=a.length-1;l=b=-1}else{k=0;b=a.length;l=1}for(var m=k;m!==b;m=m+l){i=a[m];if(i.render){k=i.object;j=i.buffer;if(h)i=h;else{i=
+i[c];if(!i)continue;g&&G.setBlending(i.blending,i.blendEquation,i.blendSrc,i.blendDst);G.setDepthTest(i.depthTest);G.setDepthWrite(i.depthWrite);u(i.polygonOffset,i.polygonOffsetFactor,i.polygonOffsetUnits)}G.setObjectFaces(k);j instanceof THREE.BufferGeometry?G.renderBufferDirect(d,e,f,i,j,k):G.renderBuffer(d,e,f,i,j,k)}}}function j(a,b,c,d,e,f,g){for(var h,i,k=0,j=a.length;k<j;k++){h=a[k];i=h.object;if(i.visible){if(g)h=g;else{h=h[b];if(!h)continue;f&&G.setBlending(h.blending,h.blendEquation,h.blendSrc,
+h.blendDst);G.setDepthTest(h.depthTest);G.setDepthWrite(h.depthWrite);u(h.polygonOffset,h.polygonOffsetFactor,h.polygonOffsetUnits)}G.renderImmediateObject(c,d,e,h,i)}}}function l(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 true;return false}function n(a){for(var b in a.attributes)a.attributes[b].needsUpdate=false}function p(a,b){for(var c=a.length-1;c>=0;c--)a[c].object===b&&a.splice(c,1)}function r(a,
+b){for(var c=a.length-1;c>=0;c--)a[c]===b&&a.splice(c,1)}function m(a,b,c,d,e){if(!d.program||d.needsUpdate){G.initMaterial(d,b,c,e);d.needsUpdate=false}if(d.morphTargets&&!e.__webglMorphTargetInfluences){e.__webglMorphTargetInfluences=new Float32Array(G.maxMorphTargets);for(var f=0,g=G.maxMorphTargets;f<g;f++)e.__webglMorphTargetInfluences[f]=0}var h=false,f=d.program,g=f.uniforms,k=d.uniforms;if(f!==W){i.useProgram(f);W=f;h=true}if(d.id!==Y){Y=d.id;h=true}if(h||a!==ba){i.uniformMatrix4fv(g.projectionMatrix,
+false,a._projectionMatrixArray);a!==ba&&(ba=a)}if(h){if(c&&d.fog){k.fogColor.value=c.color;if(c instanceof THREE.Fog){k.fogNear.value=c.near;k.fogFar.value=c.far}else if(c instanceof THREE.FogExp2)k.fogDensity.value=c.density}if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){for(var j,l=0,m=0,n=0,o,p,r,q=Ha,s=q.directional.colors,t=q.directional.positions,u=q.point.colors,C=q.point.positions,v=q.point.distances,H=q.spot.colors,x=q.spot.positions,B=q.spot.distances,
+z=q.spot.directions,A=q.spot.angles,S=q.spot.exponents,J=0,P=0,K=0,T=r=0,c=T=0,h=b.length;c<h;c++){j=b[c];if(!j.onlyShadow){o=j.color;p=j.intensity;r=j.distance;if(j instanceof THREE.AmbientLight)if(G.gammaInput){l=l+o.r*o.r;m=m+o.g*o.g;n=n+o.b*o.b}else{l=l+o.r;m=m+o.g;n=n+o.b}else if(j instanceof THREE.DirectionalLight){r=J*3;if(G.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}else{s[r]=o.r*p;s[r+1]=o.g*p;s[r+2]=o.b*p}ja.copy(j.matrixWorld.getPosition());ja.subSelf(j.target.matrixWorld.getPosition());
+ja.normalize();t[r]=ja.x;t[r+1]=ja.y;t[r+2]=ja.z;J=J+1}else if(j instanceof THREE.PointLight){T=P*3;if(G.gammaInput){u[T]=o.r*o.r*p*p;u[T+1]=o.g*o.g*p*p;u[T+2]=o.b*o.b*p*p}else{u[T]=o.r*p;u[T+1]=o.g*p;u[T+2]=o.b*p}o=j.matrixWorld.getPosition();C[T]=o.x;C[T+1]=o.y;C[T+2]=o.z;v[P]=r;P=P+1}else if(j instanceof THREE.SpotLight){T=K*3;if(G.gammaInput){H[T]=o.r*o.r*p*p;H[T+1]=o.g*o.g*p*p;H[T+2]=o.b*o.b*p*p}else{H[T]=o.r*p;H[T+1]=o.g*p;H[T+2]=o.b*p}o=j.matrixWorld.getPosition();x[T]=o.x;x[T+1]=o.y;x[T+2]=
+o.z;B[K]=r;ja.copy(o);ja.subSelf(j.target.matrixWorld.getPosition());ja.normalize();z[T]=ja.x;z[T+1]=ja.y;z[T+2]=ja.z;A[K]=Math.cos(j.angle);S[K]=j.exponent;K=K+1}}}c=J*3;for(h=s.length;c<h;c++)s[c]=0;c=P*3;for(h=u.length;c<h;c++)u[c]=0;c=K*3;for(h=H.length;c<h;c++)H[c]=0;q.directional.length=J;q.point.length=P;q.spot.length=K;q.ambient[0]=l;q.ambient[1]=m;q.ambient[2]=n;c=Ha;k.ambientLightColor.value=c.ambient;k.directionalLightColor.value=c.directional.colors;k.directionalLightDirection.value=c.directional.positions;
+k.pointLightColor.value=c.point.colors;k.pointLightPosition.value=c.point.positions;k.pointLightDistance.value=c.point.distances;k.spotLightColor.value=c.spot.colors;k.spotLightPosition.value=c.spot.positions;k.spotLightDistance.value=c.spot.distances;k.spotLightDirection.value=c.spot.directions;k.spotLightAngle.value=c.spot.angles;k.spotLightExponent.value=c.spot.exponents}if(d instanceof THREE.MeshBasicMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.MeshPhongMaterial){k.opacity.value=
+d.opacity;G.gammaInput?k.diffuse.value.copyGammaToLinear(d.color):k.diffuse.value=d.color;(k.map.texture=d.map)&&k.offsetRepeat.value.set(d.map.offset.x,d.map.offset.y,d.map.repeat.x,d.map.repeat.y);k.lightMap.texture=d.lightMap;k.envMap.texture=d.envMap;k.flipEnvMap.value=d.envMap instanceof THREE.WebGLRenderTargetCube?1:-1;k.reflectivity.value=d.reflectivity;k.refractionRatio.value=d.refractionRatio;k.combine.value=d.combine;k.useRefract.value=d.envMap&&d.envMap.mapping instanceof THREE.CubeRefractionMapping}if(d instanceof
+THREE.LineBasicMaterial){k.diffuse.value=d.color;k.opacity.value=d.opacity}else if(d instanceof THREE.ParticleBasicMaterial){k.psColor.value=d.color;k.opacity.value=d.opacity;k.size.value=d.size;k.scale.value=E.height/2;k.map.texture=d.map}else if(d instanceof THREE.MeshPhongMaterial){k.shininess.value=d.shininess;if(G.gammaInput){k.ambient.value.copyGammaToLinear(d.ambient);k.emissive.value.copyGammaToLinear(d.emissive);k.specular.value.copyGammaToLinear(d.specular)}else{k.ambient.value=d.ambient;
+k.emissive.value=d.emissive;k.specular.value=d.specular}d.wrapAround&&k.wrapRGB.value.copy(d.wrapRGB)}else if(d instanceof THREE.MeshLambertMaterial){if(G.gammaInput){k.ambient.value.copyGammaToLinear(d.ambient);k.emissive.value.copyGammaToLinear(d.emissive)}else{k.ambient.value=d.ambient;k.emissive.value=d.emissive}d.wrapAround&&k.wrapRGB.value.copy(d.wrapRGB)}else if(d instanceof THREE.MeshDepthMaterial){k.mNear.value=a.near;k.mFar.value=a.far;k.opacity.value=d.opacity}else if(d instanceof THREE.MeshNormalMaterial)k.opacity.value=
+d.opacity;if(e.receiveShadow&&!d._shadowPass&&k.shadowMatrix){h=c=0;for(j=b.length;h<j;h++){l=b[h];if(l.castShadow&&(l instanceof THREE.SpotLight||l instanceof THREE.DirectionalLight&&!l.shadowCascade)){k.shadowMap.texture[c]=l.shadowMap;k.shadowMapSize.value[c]=l.shadowMapSize;k.shadowMatrix.value[c]=l.shadowMatrix;k.shadowDarkness.value[c]=l.shadowDarkness;k.shadowBias.value[c]=l.shadowBias;c++}}}b=d.uniformsList;k=0;for(c=b.length;k<c;k++)if(l=f.uniforms[b[k][1]]){h=b[k][0];m=h.type;j=h.value;
+if(m==="i")i.uniform1i(l,j);else if(m==="f")i.uniform1f(l,j);else if(m==="v2")i.uniform2f(l,j.x,j.y);else if(m==="v3")i.uniform3f(l,j.x,j.y,j.z);else if(m==="v4")i.uniform4f(l,j.x,j.y,j.z,j.w);else if(m==="c")i.uniform3f(l,j.r,j.g,j.b);else if(m==="fv1")i.uniform1fv(l,j);else if(m==="fv")i.uniform3fv(l,j);else if(m==="v2v"){if(!h._array)h._array=new Float32Array(2*j.length);m=0;for(n=j.length;m<n;m++){q=m*2;h._array[q]=j[m].x;h._array[q+1]=j[m].y}i.uniform2fv(l,h._array)}else if(m==="v3v"){if(!h._array)h._array=
+new Float32Array(3*j.length);m=0;for(n=j.length;m<n;m++){q=m*3;h._array[q]=j[m].x;h._array[q+1]=j[m].y;h._array[q+2]=j[m].z}i.uniform3fv(l,h._array)}else if(m=="v4v"){if(!h._array)h._array=new Float32Array(4*j.length);m=0;for(n=j.length;m<n;m++){q=m*4;h._array[q]=j[m].x;h._array[q+1]=j[m].y;h._array[q+2]=j[m].z;h._array[q+3]=j[m].w}i.uniform4fv(l,h._array)}else if(m==="m4"){if(!h._array)h._array=new Float32Array(16);j.flattenToArray(h._array);i.uniformMatrix4fv(l,false,h._array)}else if(m==="m4v"){if(!h._array)h._array=
+new Float32Array(16*j.length);m=0;for(n=j.length;m<n;m++)j[m].flattenToArrayOffset(h._array,m*16);i.uniformMatrix4fv(l,false,h._array)}else if(m==="t"){i.uniform1i(l,j);if(l=h.texture)if(l.image instanceof Array&&l.image.length===6){h=l;if(h.image.length===6)if(h.needsUpdate){if(!h.image.__webglTextureCube)h.image.__webglTextureCube=i.createTexture();i.activeTexture(i.TEXTURE0+j);i.bindTexture(i.TEXTURE_CUBE_MAP,h.image.__webglTextureCube);j=[];for(l=0;l<6;l++){m=j;n=l;if(G.autoScaleCubemaps){q=h.image[l];
+t=ma;if(!(q.width<=t&&q.height<=t)){u=Math.max(q.width,q.height);s=Math.floor(q.width*t/u);t=Math.floor(q.height*t/u);u=document.createElement("canvas");u.width=s;u.height=t;u.getContext("2d").drawImage(q,0,0,q.width,q.height,0,0,s,t);q=u}}else q=h.image[l];m[n]=q}l=j[0];m=(l.width&l.width-1)===0&&(l.height&l.height-1)===0;n=F(h.format);q=F(h.type);w(i.TEXTURE_CUBE_MAP,h,m);for(l=0;l<6;l++)i.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+l,0,n,n,q,j[l]);h.generateMipmaps&&m&&i.generateMipmap(i.TEXTURE_CUBE_MAP);
+h.needsUpdate=false;if(h.onUpdate)h.onUpdate()}else{i.activeTexture(i.TEXTURE0+j);i.bindTexture(i.TEXTURE_CUBE_MAP,h.image.__webglTextureCube)}}else if(l instanceof THREE.WebGLRenderTargetCube){h=l;i.activeTexture(i.TEXTURE0+j);i.bindTexture(i.TEXTURE_CUBE_MAP,h.__webglTexture)}else G.setTexture(l,j)}else if(m==="tv"){if(!h._array){h._array=[];m=0;for(n=h.texture.length;m<n;m++)h._array[m]=j+m}i.uniform1iv(l,h._array);m=0;for(n=h.texture.length;m<n;m++)(l=h.texture[m])&&G.setTexture(l,h._array[m])}}if((d instanceof
 THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&g.cameraPosition!==null){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)&&g.viewMatrix!==null&&i.uniformMatrix4fv(g.viewMatrix,false,a._viewMatrixArray);d.skinning&&i.uniformMatrix4fv(g.boneGlobalMatrices,false,e.boneMatrices)}i.uniformMatrix4fv(g.modelViewMatrix,false,e._modelViewMatrix.elements);
 g.normalMatrix&&i.uniformMatrix3fv(g.normalMatrix,false,e._normalMatrix.elements);(d instanceof THREE.ShaderMaterial||d.envMap||d.skinning||e.receiveShadow)&&g.objectMatrix!==null&&i.uniformMatrix4fv(g.objectMatrix,false,e.matrixWorld.elements);return f}function q(a,b){a._modelViewMatrix.multiply(b.matrixWorldInverse,a.matrixWorld);a._normalMatrix.getInverse(a._modelViewMatrix);a._normalMatrix.transpose()}function u(a,b,c){if(ta!==a){a?i.enable(i.POLYGON_OFFSET_FILL):i.disable(i.POLYGON_OFFSET_FILL);
-ta=a}if(a&&(Na!==b||Sa!==c)){i.polygonOffset(b,c);Na=b;Sa=c}}function t(a,b){var c;a==="fragment"?c=i.createShader(i.FRAGMENT_SHADER):a==="vertex"&&(c=i.createShader(i.VERTEX_SHADER));i.shaderSource(c,b);i.compileShader(c);if(!i.getShaderParameter(c,i.COMPILE_STATUS)){console.error(i.getShaderInfoLog(c));console.error(b);return null}return c}function x(a,b,c){if(c){i.texParameteri(a,i.TEXTURE_WRAP_S,D(b.wrapS));i.texParameteri(a,i.TEXTURE_WRAP_T,D(b.wrapT));i.texParameteri(a,i.TEXTURE_MAG_FILTER,
-D(b.magFilter));i.texParameteri(a,i.TEXTURE_MIN_FILTER,D(b.minFilter))}else{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,z(b.magFilter));i.texParameteri(a,i.TEXTURE_MIN_FILTER,z(b.minFilter))}}function s(a,b){i.bindRenderbuffer(i.RENDERBUFFER,a);if(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)}else if(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)}else i.renderbufferStorage(i.RENDERBUFFER,i.RGBA4,b.width,b.height)}function z(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return i.NEAREST;default:return i.LINEAR}}function D(a){switch(a){case THREE.RepeatWrapping:return i.REPEAT;
+ta=a}if(a&&(Na!==b||Sa!==c)){i.polygonOffset(b,c);Na=b;Sa=c}}function t(a,b){var c;a==="fragment"?c=i.createShader(i.FRAGMENT_SHADER):a==="vertex"&&(c=i.createShader(i.VERTEX_SHADER));i.shaderSource(c,b);i.compileShader(c);if(!i.getShaderParameter(c,i.COMPILE_STATUS)){console.error(i.getShaderInfoLog(c));console.error(b);return null}return c}function w(a,b,c){if(c){i.texParameteri(a,i.TEXTURE_WRAP_S,F(b.wrapS));i.texParameteri(a,i.TEXTURE_WRAP_T,F(b.wrapT));i.texParameteri(a,i.TEXTURE_MAG_FILTER,
+F(b.magFilter));i.texParameteri(a,i.TEXTURE_MIN_FILTER,F(b.minFilter))}else{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,x(b.magFilter));i.texParameteri(a,i.TEXTURE_MIN_FILTER,x(b.minFilter))}}function s(a,b){i.bindRenderbuffer(i.RENDERBUFFER,a);if(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)}else if(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)}else i.renderbufferStorage(i.RENDERBUFFER,i.RGBA4,b.width,b.height)}function x(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return i.NEAREST;default:return i.LINEAR}}function F(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}console.log("THREE.WebGLRenderer",THREE.REVISION);var a=a||{},B=a.canvas!==void 0?a.canvas:document.createElement("canvas"),v=a.precision!==void 0?a.precision:"highp",w=a.alpha!==void 0?a.alpha:true,H=a.premultipliedAlpha!==void 0?a.premultipliedAlpha:true,I=a.antialias!==void 0?a.antialias:false,M=a.stencil!==void 0?a.stencil:
-true,T=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:false,C=a.clearColor!==void 0?new THREE.Color(a.clearColor):new THREE.Color(0),K=a.clearAlpha!==void 0?a.clearAlpha:0,O=a.maxLights!==void 0?a.maxLights:4;this.domElement=B;this.context=null;this.autoUpdateScene=this.autoUpdateObjects=this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=true;this.shadowMapEnabled=this.physicallyBasedShading=this.gammaOutput=this.gammaInput=false;this.shadowMapCullFrontFaces=
-this.shadowMapSoft=this.shadowMapAutoUpdate=true;this.shadowMapCascade=this.shadowMapDebug=false;this.maxMorphTargets=8;this.maxMorphNormals=4;this.autoScaleCubemaps=true;this.renderPluginsPre=[];this.renderPluginsPost=[];this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0,points:0}};var E=this,i,U=[],F=null,L=null,W=-1,G=null,ha=null,fa=0,la=null,R=null,$=null,ba=null,aa=null,ea=null,Ma=null,xa=null,ta=null,Na=null,Sa=null,sa=null,Wa=0,Ya=0,Ja=0,db=0,hb=0,mb=
-0,Oa=new THREE.Frustum,ua=new THREE.Matrix4,va=new THREE.Matrix4,ab=new THREE.Vector4,ja=new THREE.Vector3,Ha={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]},spot:{length:0,colors:[],positions:[],distances:[],directions:[],angles:[],exponents:[]}};i=function(){var a;try{if(!(a=B.getContext("experimental-webgl",{alpha:w,premultipliedAlpha:H,antialias:I,stencil:M,preserveDrawingBuffer:T})))throw"Error creating WebGL context.";}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(C.r,C.g,C.b,K);this.context=i;var Xa=i.getParameter(i.MAX_VERTEX_TEXTURE_IMAGE_UNITS);i.getParameter(i.MAX_TEXTURE_SIZE);var ma=i.getParameter(i.MAX_CUBE_MAP_TEXTURE_SIZE);this.getContext=function(){return i};this.supportsVertexTextures=
-function(){return Xa>0};this.setSize=function(a,b){B.width=a;B.height=b;this.setViewport(0,0,B.width,B.height)};this.setViewport=function(a,b,c,d){Wa=a;Ya=b;Ja=c;db=d;i.viewport(Wa,Ya,Ja,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){C.setHex(a);K=b;i.clearColor(C.r,C.g,C.b,K)};this.setClearColor=function(a,b){C.copy(a);K=b;i.clearColor(C.r,C.g,C.b,K)};this.getClearColor=
-function(){return C};this.getClearAlpha=function(){return K};this.clear=function(a,b,c){var d=0;if(a===void 0||a)d=d|i.COLOR_BUFFER_BIT;if(b===void 0||b)d=d|i.DEPTH_BUFFER_BIT;if(c===void 0||c)d=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){a.__webglInit=
+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}console.log("THREE.WebGLRenderer",THREE.REVISION);var a=a||{},E=a.canvas!==void 0?a.canvas:document.createElement("canvas"),B=a.precision!==void 0?a.precision:"highp",v=a.alpha!==void 0?a.alpha:true,z=a.premultipliedAlpha!==void 0?a.premultipliedAlpha:true,J=a.antialias!==void 0?a.antialias:false,K=a.stencil!==void 0?a.stencil:
+true,X=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:false,Q=a.clearColor!==void 0?new THREE.Color(a.clearColor):new THREE.Color(0),A=a.clearAlpha!==void 0?a.clearAlpha:0,M=a.maxLights!==void 0?a.maxLights:4;this.domElement=E;this.context=null;this.autoUpdateScene=this.autoUpdateObjects=this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=true;this.shadowMapEnabled=this.physicallyBasedShading=this.gammaOutput=this.gammaInput=false;this.shadowMapCullFrontFaces=
+this.shadowMapSoft=this.shadowMapAutoUpdate=true;this.shadowMapCascade=this.shadowMapDebug=false;this.maxMorphTargets=8;this.maxMorphNormals=4;this.autoScaleCubemaps=true;this.renderPluginsPre=[];this.renderPluginsPost=[];this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0,points:0}};var G=this,i,U=[],W=null,C=null,Y=-1,H=null,ba=null,ga=0,la=null,P=null,S=null,ca=null,T=null,fa=null,Ma=null,xa=null,ta=null,Na=null,Sa=null,sa=null,Wa=0,Ya=0,Ja=0,db=0,hb=0,mb=
+0,Oa=new THREE.Frustum,ua=new THREE.Matrix4,va=new THREE.Matrix4,ab=new THREE.Vector4,ja=new THREE.Vector3,Ha={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]},spot:{length:0,colors:[],positions:[],distances:[],directions:[],angles:[],exponents:[]}};i=function(){var a;try{if(!(a=E.getContext("experimental-webgl",{alpha:v,premultipliedAlpha:z,antialias:J,stencil:K,preserveDrawingBuffer:X})))throw"Error creating WebGL context.";}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(Q.r,Q.g,Q.b,A);this.context=i;var Xa=i.getParameter(i.MAX_VERTEX_TEXTURE_IMAGE_UNITS);i.getParameter(i.MAX_TEXTURE_SIZE);var ma=i.getParameter(i.MAX_CUBE_MAP_TEXTURE_SIZE);this.getContext=function(){return i};this.supportsVertexTextures=
+function(){return Xa>0};this.setSize=function(a,b){E.width=a;E.height=b;this.setViewport(0,0,E.width,E.height)};this.setViewport=function(a,b,c,d){Wa=a;Ya=b;Ja=c;db=d;i.viewport(Wa,Ya,Ja,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){Q.setHex(a);A=b;i.clearColor(Q.r,Q.g,Q.b,A)};this.setClearColor=function(a,b){Q.copy(a);A=b;i.clearColor(Q.r,Q.g,Q.b,A)};this.getClearColor=
+function(){return Q};this.getClearAlpha=function(){return A};this.clear=function(a,b,c){var d=0;if(a===void 0||a)d=d|i.COLOR_BUFFER_BIT;if(b===void 0||b)d=d|i.DEPTH_BUFFER_BIT;if(c===void 0||c)d=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){a.__webglInit=
 false;delete a._modelViewMatrix;delete a._normalMatrix;delete a._normalMatrixArray;delete a._modelViewMatrixArray;delete a._objectMatrixArray;if(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){d=0;for(e=c.numMorphTargets;d<e;d++)i.deleteBuffer(c.__webglMorphTargetsBuffers[d])}if(c.numMorphNormals){d=0;for(e=c.numMorphNormals;d<e;d++)i.deleteBuffer(c.__webglMorphNormalsBuffers[d])}if(c.__webglCustomAttributesList){d=void 0;for(d in c.__webglCustomAttributesList)i.deleteBuffer(c.__webglCustomAttributesList[d].buffer)}E.info.memory.geometries--}else if(a instanceof
-THREE.Ribbon){a=a.geometry;i.deleteBuffer(a.__webglVertexBuffer);i.deleteBuffer(a.__webglColorBuffer);E.info.memory.geometries--}else if(a instanceof THREE.Line){a=a.geometry;i.deleteBuffer(a.__webglVertexBuffer);i.deleteBuffer(a.__webglColorBuffer);E.info.memory.geometries--}else if(a instanceof THREE.ParticleSystem){a=a.geometry;i.deleteBuffer(a.__webglVertexBuffer);i.deleteBuffer(a.__webglColorBuffer);E.info.memory.geometries--}}};this.deallocateTexture=function(a){if(a.__webglInit){a.__webglInit=
-false;i.deleteTexture(a.__webglTexture);E.info.memory.textures--}};this.deallocateRenderTarget=function(a){if(a&&a.__webglTexture){i.deleteTexture(a.__webglTexture);if(a instanceof THREE.WebGLRenderTargetCube)for(var b=0;b<6;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){F=null;W=G=xa=Ma=$=-1;this.shadowMapPlugin.update(a,
+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){d=0;for(e=c.numMorphTargets;d<e;d++)i.deleteBuffer(c.__webglMorphTargetsBuffers[d])}if(c.numMorphNormals){d=0;for(e=c.numMorphNormals;d<e;d++)i.deleteBuffer(c.__webglMorphNormalsBuffers[d])}if(c.__webglCustomAttributesList){d=void 0;for(d in c.__webglCustomAttributesList)i.deleteBuffer(c.__webglCustomAttributesList[d].buffer)}G.info.memory.geometries--}else if(a instanceof
+THREE.Ribbon){a=a.geometry;i.deleteBuffer(a.__webglVertexBuffer);i.deleteBuffer(a.__webglColorBuffer);G.info.memory.geometries--}else if(a instanceof THREE.Line){a=a.geometry;i.deleteBuffer(a.__webglVertexBuffer);i.deleteBuffer(a.__webglColorBuffer);G.info.memory.geometries--}else if(a instanceof THREE.ParticleSystem){a=a.geometry;i.deleteBuffer(a.__webglVertexBuffer);i.deleteBuffer(a.__webglColorBuffer);G.info.memory.geometries--}}};this.deallocateTexture=function(a){if(a.__webglInit){a.__webglInit=
+false;i.deleteTexture(a.__webglTexture);G.info.memory.textures--}};this.deallocateRenderTarget=function(a){if(a&&a.__webglTexture){i.deleteTexture(a.__webglTexture);if(a instanceof THREE.WebGLRenderTargetCube)for(var b=0;b<6;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){W=null;Y=H=xa=Ma=S=-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();if(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,false,0,0)}if(a.hasNormal){i.bindBuffer(i.ARRAY_BUFFER,a.__webglNormalBuffer);if(c===THREE.FlatShading){var d,
-e,f,g,h,l,j,k,m,n,o=a.count*3;for(n=0;n<o;n=n+9){c=a.normalArray;d=c[n];e=c[n+1];f=c[n+2];g=c[n+3];l=c[n+4];k=c[n+5];h=c[n+6];j=c[n+7];m=c[n+8];d=(d+g+h)/3;e=(e+l+j)/3;f=(f+k+m)/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}}i.bufferData(i.ARRAY_BUFFER,a.normalArray,i.DYNAMIC_DRAW);i.enableVertexAttribArray(b.attributes.normal);i.vertexAttribPointer(b.attributes.normal,3,i.FLOAT,false,0,0)}i.drawArrays(i.TRIANGLES,0,a.count);a.count=0};this.renderBufferDirect=function(a,
-b,c,d,e,f){if(d.opacity!==0){c=n(a,b,c,d,f);a=c.attributes;b=false;d=e.id*16777215+c.id*2+(d.wireframe?1:0);if(d!==G){G=d;b=true}if(f instanceof THREE.Mesh){f=e.offsets;d=0;for(c=f.length;d<c;++d){if(b){i.bindBuffer(i.ARRAY_BUFFER,e.vertexPositionBuffer);i.vertexAttribPointer(a.position,e.vertexPositionBuffer.itemSize,i.FLOAT,false,0,f[d].index*12);if(a.normal>=0&&e.vertexNormalBuffer){i.bindBuffer(i.ARRAY_BUFFER,e.vertexNormalBuffer);i.vertexAttribPointer(a.normal,e.vertexNormalBuffer.itemSize,i.FLOAT,
+e,f,g,h,k,j,l,m,n,o=a.count*3;for(n=0;n<o;n=n+9){c=a.normalArray;d=c[n];e=c[n+1];f=c[n+2];g=c[n+3];k=c[n+4];l=c[n+5];h=c[n+6];j=c[n+7];m=c[n+8];d=(d+g+h)/3;e=(e+k+j)/3;f=(f+l+m)/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}}i.bufferData(i.ARRAY_BUFFER,a.normalArray,i.DYNAMIC_DRAW);i.enableVertexAttribArray(b.attributes.normal);i.vertexAttribPointer(b.attributes.normal,3,i.FLOAT,false,0,0)}i.drawArrays(i.TRIANGLES,0,a.count);a.count=0};this.renderBufferDirect=function(a,
+b,c,d,e,f){if(d.opacity!==0){c=m(a,b,c,d,f);a=c.attributes;b=false;d=e.id*16777215+c.id*2+(d.wireframe?1:0);if(d!==H){H=d;b=true}if(f instanceof THREE.Mesh){f=e.offsets;d=0;for(c=f.length;d<c;++d){if(b){i.bindBuffer(i.ARRAY_BUFFER,e.vertexPositionBuffer);i.vertexAttribPointer(a.position,e.vertexPositionBuffer.itemSize,i.FLOAT,false,0,f[d].index*12);if(a.normal>=0&&e.vertexNormalBuffer){i.bindBuffer(i.ARRAY_BUFFER,e.vertexNormalBuffer);i.vertexAttribPointer(a.normal,e.vertexNormalBuffer.itemSize,i.FLOAT,
 false,0,f[d].index*12)}if(a.uv>=0&&e.vertexUvBuffer)if(e.vertexUvBuffer){i.bindBuffer(i.ARRAY_BUFFER,e.vertexUvBuffer);i.vertexAttribPointer(a.uv,e.vertexUvBuffer.itemSize,i.FLOAT,false,0,f[d].index*8);i.enableVertexAttribArray(a.uv)}else i.disableVertexAttribArray(a.uv);if(a.color>=0&&e.vertexColorBuffer){i.bindBuffer(i.ARRAY_BUFFER,e.vertexColorBuffer);i.vertexAttribPointer(a.color,e.vertexColorBuffer.itemSize,i.FLOAT,false,0,f[d].index*16)}i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,e.vertexIndexBuffer)}i.drawElements(i.TRIANGLES,
-f[d].count,i.UNSIGNED_SHORT,f[d].start*2);E.info.render.calls++;E.info.render.vertices=E.info.render.vertices+f[d].count;E.info.render.faces=E.info.render.faces+f[d].count/3}}}};this.renderBuffer=function(a,b,c,d,e,f){if(d.opacity!==0){var g,h,c=n(a,b,c,d,f),b=c.attributes,a=false,c=e.id*16777215+c.id*2+(d.wireframe?1:0);if(c!==G){G=c;a=true}if(!d.morphTargets&&b.position>=0){if(a){i.bindBuffer(i.ARRAY_BUFFER,e.__webglVertexBuffer);i.vertexAttribPointer(b.position,3,i.FLOAT,false,0,0)}}else if(f.morphTargetBase){c=
-d.program.attributes;if(f.morphTargetBase!==-1){i.bindBuffer(i.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[f.morphTargetBase]);i.vertexAttribPointer(c.position,3,i.FLOAT,false,0,0)}else if(c.position>=0){i.bindBuffer(i.ARRAY_BUFFER,e.__webglVertexBuffer);i.vertexAttribPointer(c.position,3,i.FLOAT,false,0,0)}if(f.morphTargetForcedOrder.length){g=0;var l=f.morphTargetForcedOrder;for(h=f.morphTargetInfluences;g<d.numSupportedMorphTargets&&g<l.length;){i.bindBuffer(i.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[l[g]]);
-i.vertexAttribPointer(c["morphTarget"+g],3,i.FLOAT,false,0,0);if(d.morphNormals){i.bindBuffer(i.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[l[g]]);i.vertexAttribPointer(c["morphNormal"+g],3,i.FLOAT,false,0,0)}f.__webglMorphTargetInfluences[g]=h[l[g]];g++}}else{var l=[],j=-1,k=0;h=f.morphTargetInfluences;var m,o=h.length;g=0;for(f.morphTargetBase!==-1&&(l[f.morphTargetBase]=true);g<d.numSupportedMorphTargets;){for(m=0;m<o;m++)if(!l[m]&&h[m]>j){k=m;j=h[k]}i.bindBuffer(i.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[k]);
-i.vertexAttribPointer(c["morphTarget"+g],3,i.FLOAT,false,0,0);if(d.morphNormals){i.bindBuffer(i.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[k]);i.vertexAttribPointer(c["morphNormal"+g],3,i.FLOAT,false,0,0)}f.__webglMorphTargetInfluences[g]=j;l[k]=1;j=-1;g++}}d.program.uniforms.morphTargetInfluences!==null&&i.uniform1fv(d.program.uniforms.morphTargetInfluences,f.__webglMorphTargetInfluences)}if(a){if(e.__webglCustomAttributesList){g=0;for(h=e.__webglCustomAttributesList.length;g<h;g++){c=e.__webglCustomAttributesList[g];
+f[d].count,i.UNSIGNED_SHORT,f[d].start*2);G.info.render.calls++;G.info.render.vertices=G.info.render.vertices+f[d].count;G.info.render.faces=G.info.render.faces+f[d].count/3}}}};this.renderBuffer=function(a,b,c,d,e,f){if(d.opacity!==0){var g,h,c=m(a,b,c,d,f),b=c.attributes,a=false,c=e.id*16777215+c.id*2+(d.wireframe?1:0);if(c!==H){H=c;a=true}if(!d.morphTargets&&b.position>=0){if(a){i.bindBuffer(i.ARRAY_BUFFER,e.__webglVertexBuffer);i.vertexAttribPointer(b.position,3,i.FLOAT,false,0,0)}}else if(f.morphTargetBase){c=
+d.program.attributes;if(f.morphTargetBase!==-1){i.bindBuffer(i.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[f.morphTargetBase]);i.vertexAttribPointer(c.position,3,i.FLOAT,false,0,0)}else if(c.position>=0){i.bindBuffer(i.ARRAY_BUFFER,e.__webglVertexBuffer);i.vertexAttribPointer(c.position,3,i.FLOAT,false,0,0)}if(f.morphTargetForcedOrder.length){g=0;var k=f.morphTargetForcedOrder;for(h=f.morphTargetInfluences;g<d.numSupportedMorphTargets&&g<k.length;){i.bindBuffer(i.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[k[g]]);
+i.vertexAttribPointer(c["morphTarget"+g],3,i.FLOAT,false,0,0);if(d.morphNormals){i.bindBuffer(i.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[k[g]]);i.vertexAttribPointer(c["morphNormal"+g],3,i.FLOAT,false,0,0)}f.__webglMorphTargetInfluences[g]=h[k[g]];g++}}else{var k=[],j=-1,l=0;h=f.morphTargetInfluences;var n,o=h.length;g=0;for(f.morphTargetBase!==-1&&(k[f.morphTargetBase]=true);g<d.numSupportedMorphTargets;){for(n=0;n<o;n++)if(!k[n]&&h[n]>j){l=n;j=h[l]}i.bindBuffer(i.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[l]);
+i.vertexAttribPointer(c["morphTarget"+g],3,i.FLOAT,false,0,0);if(d.morphNormals){i.bindBuffer(i.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[l]);i.vertexAttribPointer(c["morphNormal"+g],3,i.FLOAT,false,0,0)}f.__webglMorphTargetInfluences[g]=j;k[l]=1;j=-1;g++}}d.program.uniforms.morphTargetInfluences!==null&&i.uniform1fv(d.program.uniforms.morphTargetInfluences,f.__webglMorphTargetInfluences)}if(a){if(e.__webglCustomAttributesList){g=0;for(h=e.__webglCustomAttributesList.length;g<h;g++){c=e.__webglCustomAttributesList[g];
 if(b[c.buffer.belongsToAttribute]>=0){i.bindBuffer(i.ARRAY_BUFFER,c.buffer);i.vertexAttribPointer(b[c.buffer.belongsToAttribute],c.size,i.FLOAT,false,0,0)}}}if(b.color>=0){i.bindBuffer(i.ARRAY_BUFFER,e.__webglColorBuffer);i.vertexAttribPointer(b.color,3,i.FLOAT,false,0,0)}if(b.normal>=0){i.bindBuffer(i.ARRAY_BUFFER,e.__webglNormalBuffer);i.vertexAttribPointer(b.normal,3,i.FLOAT,false,0,0)}if(b.tangent>=0){i.bindBuffer(i.ARRAY_BUFFER,e.__webglTangentBuffer);i.vertexAttribPointer(b.tangent,4,i.FLOAT,
 false,0,0)}if(b.uv>=0)if(e.__webglUVBuffer){i.bindBuffer(i.ARRAY_BUFFER,e.__webglUVBuffer);i.vertexAttribPointer(b.uv,2,i.FLOAT,false,0,0);i.enableVertexAttribArray(b.uv)}else i.disableVertexAttribArray(b.uv);if(b.uv2>=0)if(e.__webglUV2Buffer){i.bindBuffer(i.ARRAY_BUFFER,e.__webglUV2Buffer);i.vertexAttribPointer(b.uv2,2,i.FLOAT,false,0,0);i.enableVertexAttribArray(b.uv2)}else i.disableVertexAttribArray(b.uv2);if(d.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0){i.bindBuffer(i.ARRAY_BUFFER,
 e.__webglSkinVertexABuffer);i.vertexAttribPointer(b.skinVertexA,4,i.FLOAT,false,0,0);i.bindBuffer(i.ARRAY_BUFFER,e.__webglSkinVertexBBuffer);i.vertexAttribPointer(b.skinVertexB,4,i.FLOAT,false,0,0);i.bindBuffer(i.ARRAY_BUFFER,e.__webglSkinIndicesBuffer);i.vertexAttribPointer(b.skinIndex,4,i.FLOAT,false,0,0);i.bindBuffer(i.ARRAY_BUFFER,e.__webglSkinWeightsBuffer);i.vertexAttribPointer(b.skinWeight,4,i.FLOAT,false,0,0)}}if(f instanceof THREE.Mesh){if(d.wireframe){d=d.wireframeLinewidth;if(d!==sa){i.lineWidth(d);
-sa=d}a&&i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,e.__webglLineBuffer);i.drawElements(i.LINES,e.__webglLineCount,i.UNSIGNED_SHORT,0)}else{a&&i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,e.__webglFaceBuffer);i.drawElements(i.TRIANGLES,e.__webglFaceCount,i.UNSIGNED_SHORT,0)}E.info.render.calls++;E.info.render.vertices=E.info.render.vertices+e.__webglFaceCount;E.info.render.faces=E.info.render.faces+e.__webglFaceCount/3}else if(f instanceof THREE.Line){f=f.type===THREE.LineStrip?i.LINE_STRIP:i.LINES;d=d.linewidth;
-if(d!==sa){i.lineWidth(d);sa=d}i.drawArrays(f,0,e.__webglLineCount);E.info.render.calls++}else if(f instanceof THREE.ParticleSystem){i.drawArrays(i.POINTS,0,e.__webglParticleCount);E.info.render.calls++;E.info.render.points=E.info.render.points+e.__webglParticleCount}else if(f instanceof THREE.Ribbon){i.drawArrays(i.TRIANGLE_STRIP,0,e.__webglVertexCount);E.info.render.calls++}}};this.render=function(a,b,c,d){var e,f,j,m,n=a.__lights,o=a.fog;W=-1;if(b.parent===void 0){console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it...");
+sa=d}a&&i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,e.__webglLineBuffer);i.drawElements(i.LINES,e.__webglLineCount,i.UNSIGNED_SHORT,0)}else{a&&i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,e.__webglFaceBuffer);i.drawElements(i.TRIANGLES,e.__webglFaceCount,i.UNSIGNED_SHORT,0)}G.info.render.calls++;G.info.render.vertices=G.info.render.vertices+e.__webglFaceCount;G.info.render.faces=G.info.render.faces+e.__webglFaceCount/3}else if(f instanceof THREE.Line){f=f.type===THREE.LineStrip?i.LINE_STRIP:i.LINES;d=d.linewidth;
+if(d!==sa){i.lineWidth(d);sa=d}i.drawArrays(f,0,e.__webglLineCount);G.info.render.calls++}else if(f instanceof THREE.ParticleSystem){i.drawArrays(i.POINTS,0,e.__webglParticleCount);G.info.render.calls++;G.info.render.points=G.info.render.points+e.__webglParticleCount}else if(f instanceof THREE.Ribbon){i.drawArrays(i.TRIANGLE_STRIP,0,e.__webglVertexCount);G.info.render.calls++}}};this.render=function(a,b,c,d){var e,f,l,m,n=a.__lights,o=a.fog;Y=-1;if(b.parent===void 0){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);ua.multiply(b.projectionMatrix,b.matrixWorldInverse);Oa.setFromMatrix(ua);this.autoUpdateObjects&&this.initWebGLObjects(a);h(this.renderPluginsPre,
-a,b);E.info.render.calls=0;E.info.render.vertices=0;E.info.render.faces=0;E.info.render.points=0;this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);m=a.__webglObjects;d=0;for(e=m.length;d<e;d++){f=m[d];j=f.object;f.render=false;if(j.visible&&(!(j instanceof THREE.Mesh||j instanceof THREE.ParticleSystem)||!j.frustumCulled||Oa.contains(j))){q(j,b);var p=f,r=p.object,s=p.buffer,t=void 0,t=t=void 0,t=r.material;if(t instanceof THREE.MeshFaceMaterial){t=
-s.materialIndex;if(t>=0){t=r.geometry.materials[t];if(t.transparent){p.transparent=t;p.opaque=null}else{p.opaque=t;p.transparent=null}}}else if(t)if(t.transparent){p.transparent=t;p.opaque=null}else{p.opaque=t;p.transparent=null}f.render=true;if(this.sortObjects)if(j.renderDepth)f.z=j.renderDepth;else{ab.copy(j.matrixWorld.getPosition());ua.multiplyVector3(ab);f.z=ab.z}}}this.sortObjects&&m.sort(g);m=a.__webglObjectsImmediate;d=0;for(e=m.length;d<e;d++){f=m[d];j=f.object;if(j.visible){q(j,b);j=f.object.material;
-if(j.transparent){f.transparent=j;f.opaque=null}else{f.opaque=j;f.transparent=null}}}if(a.overrideMaterial){d=a.overrideMaterial;this.setBlending(d.blending,d.blendEquation,d.blendSrc,d.blendDst);this.setDepthTest(d.depthTest);this.setDepthWrite(d.depthWrite);u(d.polygonOffset,d.polygonOffsetFactor,d.polygonOffsetUnits);l(a.__webglObjects,false,"",b,n,o,true,d);k(a.__webglObjectsImmediate,"",b,n,o,false,d)}else{this.setBlending(THREE.NormalBlending);l(a.__webglObjects,true,"opaque",b,n,o,false);k(a.__webglObjectsImmediate,
-"opaque",b,n,o,false);l(a.__webglObjects,false,"transparent",b,n,o,true);k(a.__webglObjectsImmediate,"transparent",b,n,o,true)}h(this.renderPluginsPost,a,b);if(c&&c.generateMipmaps&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter)if(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)}else{i.bindTexture(i.TEXTURE_2D,c.__webglTexture);i.generateMipmap(i.TEXTURE_2D);
-i.bindTexture(i.TEXTURE_2D,null)}this.setDepthTest(true);this.setDepthWrite(true)};this.renderImmediateObject=function(a,b,c,d,e){var f=n(a,b,c,d,e);G=-1;E.setObjectFaces(e);e.immediateRenderCallback?e.immediateRenderCallback(f,i,Oa):e.render(function(a){E.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,k=void 0,n=void 0;if(!g.__webglInit){g.__webglInit=true;g._modelViewMatrix=new THREE.Matrix4;g._normalMatrix=new THREE.Matrix3;if(g instanceof THREE.Mesh){k=g.geometry;if(k instanceof THREE.Geometry){if(k.geometryGroups===void 0){var q=k,s=void 0,u=void 0,t=void 0,L=void 0,v=void 0,G=void 0,w=void 0,x={},z=q.morphTargets.length,W=q.morphNormals.length;q.geometryGroups={};s=0;for(u=q.faces.length;s<u;s++){t=q.faces[s];L=t.materialIndex;G=L!==void 0?L:-1;x[G]===void 0&&(x[G]={hash:G,counter:0});
-w=x[G].hash+"_"+x[G].counter;q.geometryGroups[w]===void 0&&(q.geometryGroups[w]={faces3:[],faces4:[],materialIndex:L,vertices:0,numMorphTargets:z,numMorphNormals:W});v=t instanceof THREE.Face3?3:4;if(q.geometryGroups[w].vertices+v>65535){x[G].counter=x[G].counter+1;w=x[G].hash+"_"+x[G].counter;q.geometryGroups[w]===void 0&&(q.geometryGroups[w]={faces3:[],faces4:[],materialIndex:L,vertices:0,numMorphTargets:z,numMorphNormals:W})}t instanceof THREE.Face3?q.geometryGroups[w].faces3.push(s):q.geometryGroups[w].faces4.push(s);
-q.geometryGroups[w].vertices=q.geometryGroups[w].vertices+v}q.geometryGroupsList=[];var D=void 0;for(D in q.geometryGroups){q.geometryGroups[D].id=fa++;q.geometryGroupsList.push(q.geometryGroups[D])}}for(l in k.geometryGroups){n=k.geometryGroups[l];if(!n.__webglVertexBuffer){var B=n;B.__webglVertexBuffer=i.createBuffer();B.__webglNormalBuffer=i.createBuffer();B.__webglTangentBuffer=i.createBuffer();B.__webglColorBuffer=i.createBuffer();B.__webglUVBuffer=i.createBuffer();B.__webglUV2Buffer=i.createBuffer();
-B.__webglSkinVertexABuffer=i.createBuffer();B.__webglSkinVertexBBuffer=i.createBuffer();B.__webglSkinIndicesBuffer=i.createBuffer();B.__webglSkinWeightsBuffer=i.createBuffer();B.__webglFaceBuffer=i.createBuffer();B.__webglLineBuffer=i.createBuffer();var F=void 0,$=void 0;if(B.numMorphTargets){B.__webglMorphTargetsBuffers=[];F=0;for($=B.numMorphTargets;F<$;F++)B.__webglMorphTargetsBuffers.push(i.createBuffer())}if(B.numMorphNormals){B.__webglMorphNormalsBuffers=[];F=0;for($=B.numMorphNormals;F<$;F++)B.__webglMorphNormalsBuffers.push(i.createBuffer())}E.info.memory.geometries++;
-var C=n,H=g,K=H.geometry,R=C.faces3,M=C.faces4,I=R.length*3+M.length*4,ha=R.length*1+M.length*2,O=R.length*3+M.length*4,aa=c(H,C),ba=e(aa),la=d(aa),ea=aa.vertexColors?aa.vertexColors:false;C.__vertexArray=new Float32Array(I*3);if(la)C.__normalArray=new Float32Array(I*3);if(K.hasTangents)C.__tangentArray=new Float32Array(I*4);if(ea)C.__colorArray=new Float32Array(I*3);if(ba){if(K.faceUvs.length>0||K.faceVertexUvs.length>0)C.__uvArray=new Float32Array(I*2);if(K.faceUvs.length>1||K.faceVertexUvs.length>
-1)C.__uv2Array=new Float32Array(I*2)}if(H.geometry.skinWeights.length&&H.geometry.skinIndices.length){C.__skinVertexAArray=new Float32Array(I*4);C.__skinVertexBArray=new Float32Array(I*4);C.__skinIndexArray=new Float32Array(I*4);C.__skinWeightArray=new Float32Array(I*4)}C.__faceArray=new Uint16Array(ha*3);C.__lineArray=new Uint16Array(O*2);var T=void 0,U=void 0;if(C.numMorphTargets){C.__morphTargetsArrays=[];T=0;for(U=C.numMorphTargets;T<U;T++)C.__morphTargetsArrays.push(new Float32Array(I*3))}if(C.numMorphNormals){C.__morphNormalsArrays=
-[];T=0;for(U=C.numMorphNormals;T<U;T++)C.__morphNormalsArrays.push(new Float32Array(I*3))}C.__webglFaceCount=ha*3;C.__webglLineCount=O*2;if(aa.attributes){if(C.__webglCustomAttributesList===void 0)C.__webglCustomAttributesList=[];var Ma=void 0;for(Ma in aa.attributes){var xa=aa.attributes[Ma],ta={},Na;for(Na in xa)ta[Na]=xa[Na];if(!ta.__webglInitialized||ta.createUniqueBuffers){ta.__webglInitialized=true;var ja=1;ta.type==="v2"?ja=2:ta.type==="v3"?ja=3:ta.type==="v4"?ja=4:ta.type==="c"&&(ja=3);ta.size=
-ja;ta.array=new Float32Array(I*ja);ta.buffer=i.createBuffer();ta.buffer.belongsToAttribute=Ma;xa.needsUpdate=true;ta.__original=xa}C.__webglCustomAttributesList.push(ta)}}C.__inittedArrays=true;k.__dirtyVertices=true;k.__dirtyMorphTargets=true;k.__dirtyElements=true;k.__dirtyUvs=true;k.__dirtyNormals=true;k.__dirtyTangents=true;k.__dirtyColors=true}}}}else if(g instanceof THREE.Ribbon){k=g.geometry;if(!k.__webglVertexBuffer){var Sa=k;Sa.__webglVertexBuffer=i.createBuffer();Sa.__webglColorBuffer=i.createBuffer();
-E.info.memory.geometries++;var sa=k,ma=sa.vertices.length;sa.__vertexArray=new Float32Array(ma*3);sa.__colorArray=new Float32Array(ma*3);sa.__webglVertexCount=ma;k.__dirtyVertices=true;k.__dirtyColors=true}}else if(g instanceof THREE.Line){k=g.geometry;if(!k.__webglVertexBuffer){var va=k;va.__webglVertexBuffer=i.createBuffer();va.__webglColorBuffer=i.createBuffer();E.info.memory.geometries++;var ua=k,Ha=g,Wa=ua.vertices.length;ua.__vertexArray=new Float32Array(Wa*3);ua.__colorArray=new Float32Array(Wa*
-3);ua.__webglLineCount=Wa;b(ua,Ha);k.__dirtyVertices=true;k.__dirtyColors=true}}else if(g instanceof THREE.ParticleSystem){k=g.geometry;if(!k.__webglVertexBuffer){var Ya=k;Ya.__webglVertexBuffer=i.createBuffer();Ya.__webglColorBuffer=i.createBuffer();E.info.geometries++;var Oa=k,ab=g,Xa=Oa.vertices.length;Oa.__vertexArray=new Float32Array(Xa*3);Oa.__colorArray=new Float32Array(Xa*3);Oa.__sortArray=[];Oa.__webglParticleCount=Xa;b(Oa,ab);k.__dirtyVertices=true;k.__dirtyColors=true}}}if(!g.__webglActive){if(g instanceof
-THREE.Mesh){k=g.geometry;if(k instanceof THREE.BufferGeometry)j(h.__webglObjects,k,g);else for(l in k.geometryGroups){n=k.geometryGroups[l];j(h.__webglObjects,n,g)}}else if(g instanceof THREE.Ribbon||g instanceof THREE.Line||g instanceof THREE.ParticleSystem){k=g.geometry;j(h.__webglObjects,k,g)}else 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=true}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;){var Ja=a.__objectsRemoved[0],db=a;Ja instanceof THREE.Mesh||Ja instanceof THREE.ParticleSystem||Ja instanceof THREE.Ribbon||Ja instanceof THREE.Line?p(db.__webglObjects,Ja):Ja instanceof THREE.Sprite?r(db.__webglSprites,Ja):Ja instanceof THREE.LensFlare?r(db.__webglFlares,Ja):(Ja instanceof THREE.ImmediateRenderObject||Ja.immediateRenderCallback)&&p(db.__webglObjectsImmediate,
-Ja);Ja.__webglActive=false;a.__objectsRemoved.splice(0,1)}for(var hb=0,mb=a.__webglObjects.length;hb<mb;hb++){var nb=a.__webglObjects[hb].object,ka=nb.geometry,qc=void 0,ic=void 0,bb=void 0;if(nb instanceof THREE.Mesh)if(ka instanceof THREE.BufferGeometry){ka.__dirtyVertices=false;ka.__dirtyElements=false;ka.__dirtyUvs=false;ka.__dirtyNormals=false;ka.__dirtyColors=false}else{for(var Uc=0,od=ka.geometryGroupsList.length;Uc<od;Uc++){qc=ka.geometryGroupsList[Uc];bb=c(nb,qc);ic=bb.attributes&&o(bb);
-if(ka.__dirtyVertices||ka.__dirtyMorphTargets||ka.__dirtyElements||ka.__dirtyUvs||ka.__dirtyNormals||ka.__dirtyColors||ka.__dirtyTangents||ic){var ga=qc,pd=nb,eb=i.DYNAMIC_DRAW,qd=!ka.dynamic,bc=bb;if(ga.__inittedArrays){var dd=d(bc),Vc=bc.vertexColors?bc.vertexColors:false,ed=e(bc),Fc=dd===THREE.SmoothShading,J=void 0,V=void 0,lb=void 0,P=void 0,jc=void 0,Ob=void 0,ob=void 0,Gc=void 0,Hb=void 0,kc=void 0,lc=void 0,X=void 0,Y=void 0,Z=void 0,qa=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,na=void 0,fd=void 0,Vb=void 0,mc=void 0,nc=void 0,Pa=void 0,gd=void 0,Ka=void 0,La=void 0,Wb=void 0,Ib=void 0,Ea=0,Ia=0,Jb=0,Kb=0,ib=0,Va=0,ra=0,Za=0,Fa=0,N=0,da=0,A=0,fb=void 0,Qa=ga.__vertexArray,wc=ga.__uvArray,xc=ga.__uv2Array,jb=ga.__normalArray,ya=ga.__tangentArray,
-Ra=ga.__colorArray,za=ga.__skinVertexAArray,Aa=ga.__skinVertexBArray,Ba=ga.__skinIndexArray,Ca=ga.__skinWeightArray,Wc=ga.__morphTargetsArrays,Xc=ga.__morphNormalsArrays,Yc=ga.__webglCustomAttributesList,y=void 0,Eb=ga.__faceArray,gb=ga.__lineArray,$a=pd.geometry,rd=$a.__dirtyElements,hd=$a.__dirtyUvs,sd=$a.__dirtyNormals,td=$a.__dirtyTangents,ud=$a.__dirtyColors,vd=$a.__dirtyMorphTargets,cc=$a.vertices,oa=ga.faces3,pa=ga.faces4,Ga=$a.faces,Zc=$a.faceVertexUvs[0],$c=$a.faceVertexUvs[1],dc=$a.skinVerticesA,
-ec=$a.skinVerticesB,fc=$a.skinIndices,Xb=$a.skinWeights,Yb=$a.morphTargets,Jc=$a.morphNormals;if($a.__dirtyVertices){J=0;for(V=oa.length;J<V;J++){P=Ga[oa[J]];X=cc[P.a];Y=cc[P.b];Z=cc[P.c];Qa[Ia]=X.x;Qa[Ia+1]=X.y;Qa[Ia+2]=X.z;Qa[Ia+3]=Y.x;Qa[Ia+4]=Y.y;Qa[Ia+5]=Y.z;Qa[Ia+6]=Z.x;Qa[Ia+7]=Z.y;Qa[Ia+8]=Z.z;Ia=Ia+9}J=0;for(V=pa.length;J<V;J++){P=Ga[pa[J]];X=cc[P.a];Y=cc[P.b];Z=cc[P.c];qa=cc[P.d];Qa[Ia]=X.x;Qa[Ia+1]=X.y;Qa[Ia+2]=X.z;Qa[Ia+3]=Y.x;Qa[Ia+4]=Y.y;Qa[Ia+5]=Y.z;Qa[Ia+6]=Z.x;Qa[Ia+7]=Z.y;Qa[Ia+
-8]=Z.z;Qa[Ia+9]=qa.x;Qa[Ia+10]=qa.y;Qa[Ia+11]=qa.z;Ia=Ia+12}i.bindBuffer(i.ARRAY_BUFFER,ga.__webglVertexBuffer);i.bufferData(i.ARRAY_BUFFER,Qa,eb)}if(vd){Pa=0;for(gd=Yb.length;Pa<gd;Pa++){J=da=0;for(V=oa.length;J<V;J++){Wb=oa[J];P=Ga[Wb];X=Yb[Pa].vertices[P.a];Y=Yb[Pa].vertices[P.b];Z=Yb[Pa].vertices[P.c];Ka=Wc[Pa];Ka[da]=X.x;Ka[da+1]=X.y;Ka[da+2]=X.z;Ka[da+3]=Y.x;Ka[da+4]=Y.y;Ka[da+5]=Y.z;Ka[da+6]=Z.x;Ka[da+7]=Z.y;Ka[da+8]=Z.z;if(bc.morphNormals){if(Fc){Ib=Jc[Pa].vertexNormals[Wb];sb=Ib.a;tb=Ib.b;
-ub=Ib.c}else ub=tb=sb=Jc[Pa].faceNormals[Wb];La=Xc[Pa];La[da]=sb.x;La[da+1]=sb.y;La[da+2]=sb.z;La[da+3]=tb.x;La[da+4]=tb.y;La[da+5]=tb.z;La[da+6]=ub.x;La[da+7]=ub.y;La[da+8]=ub.z}da=da+9}J=0;for(V=pa.length;J<V;J++){Wb=pa[J];P=Ga[Wb];X=Yb[Pa].vertices[P.a];Y=Yb[Pa].vertices[P.b];Z=Yb[Pa].vertices[P.c];qa=Yb[Pa].vertices[P.d];Ka=Wc[Pa];Ka[da]=X.x;Ka[da+1]=X.y;Ka[da+2]=X.z;Ka[da+3]=Y.x;Ka[da+4]=Y.y;Ka[da+5]=Y.z;Ka[da+6]=Z.x;Ka[da+7]=Z.y;Ka[da+8]=Z.z;Ka[da+9]=qa.x;Ka[da+10]=qa.y;Ka[da+11]=qa.z;if(bc.morphNormals){if(Fc){Ib=
-Jc[Pa].vertexNormals[Wb];sb=Ib.a;tb=Ib.b;ub=Ib.c;sc=Ib.d}else sc=ub=tb=sb=Jc[Pa].faceNormals[Wb];La=Xc[Pa];La[da]=sb.x;La[da+1]=sb.y;La[da+2]=sb.z;La[da+3]=tb.x;La[da+4]=tb.y;La[da+5]=tb.z;La[da+6]=ub.x;La[da+7]=ub.y;La[da+8]=ub.z;La[da+9]=sc.x;La[da+10]=sc.y;La[da+11]=sc.z}da=da+12}i.bindBuffer(i.ARRAY_BUFFER,ga.__webglMorphTargetsBuffers[Pa]);i.bufferData(i.ARRAY_BUFFER,Wc[Pa],eb);if(bc.morphNormals){i.bindBuffer(i.ARRAY_BUFFER,ga.__webglMorphNormalsBuffers[Pa]);i.bufferData(i.ARRAY_BUFFER,Xc[Pa],
-eb)}}}if(Xb.length){J=0;for(V=oa.length;J<V;J++){P=Ga[oa[J]];yb=Xb[P.a];zb=Xb[P.b];Ab=Xb[P.c];Ca[N]=yb.x;Ca[N+1]=yb.y;Ca[N+2]=yb.z;Ca[N+3]=yb.w;Ca[N+4]=zb.x;Ca[N+5]=zb.y;Ca[N+6]=zb.z;Ca[N+7]=zb.w;Ca[N+8]=Ab.x;Ca[N+9]=Ab.y;Ca[N+10]=Ab.z;Ca[N+11]=Ab.w;Bb=fc[P.a];Cb=fc[P.b];Db=fc[P.c];Ba[N]=Bb.x;Ba[N+1]=Bb.y;Ba[N+2]=Bb.z;Ba[N+3]=Bb.w;Ba[N+4]=Cb.x;Ba[N+5]=Cb.y;Ba[N+6]=Cb.z;Ba[N+7]=Cb.w;Ba[N+8]=Db.x;Ba[N+9]=Db.y;Ba[N+10]=Db.z;Ba[N+11]=Db.w;Pb=dc[P.a];Qb=dc[P.b];Rb=dc[P.c];za[N]=Pb.x;za[N+1]=Pb.y;za[N+
-2]=Pb.z;za[N+3]=1;za[N+4]=Qb.x;za[N+5]=Qb.y;za[N+6]=Qb.z;za[N+7]=1;za[N+8]=Rb.x;za[N+9]=Rb.y;za[N+10]=Rb.z;za[N+11]=1;Sb=ec[P.a];Tb=ec[P.b];Ub=ec[P.c];Aa[N]=Sb.x;Aa[N+1]=Sb.y;Aa[N+2]=Sb.z;Aa[N+3]=1;Aa[N+4]=Tb.x;Aa[N+5]=Tb.y;Aa[N+6]=Tb.z;Aa[N+7]=1;Aa[N+8]=Ub.x;Aa[N+9]=Ub.y;Aa[N+10]=Ub.z;Aa[N+11]=1;N=N+12}J=0;for(V=pa.length;J<V;J++){P=Ga[pa[J]];yb=Xb[P.a];zb=Xb[P.b];Ab=Xb[P.c];uc=Xb[P.d];Ca[N]=yb.x;Ca[N+1]=yb.y;Ca[N+2]=yb.z;Ca[N+3]=yb.w;Ca[N+4]=zb.x;Ca[N+5]=zb.y;Ca[N+6]=zb.z;Ca[N+7]=zb.w;Ca[N+8]=Ab.x;
-Ca[N+9]=Ab.y;Ca[N+10]=Ab.z;Ca[N+11]=Ab.w;Ca[N+12]=uc.x;Ca[N+13]=uc.y;Ca[N+14]=uc.z;Ca[N+15]=uc.w;Bb=fc[P.a];Cb=fc[P.b];Db=fc[P.c];vc=fc[P.d];Ba[N]=Bb.x;Ba[N+1]=Bb.y;Ba[N+2]=Bb.z;Ba[N+3]=Bb.w;Ba[N+4]=Cb.x;Ba[N+5]=Cb.y;Ba[N+6]=Cb.z;Ba[N+7]=Cb.w;Ba[N+8]=Db.x;Ba[N+9]=Db.y;Ba[N+10]=Db.z;Ba[N+11]=Db.w;Ba[N+12]=vc.x;Ba[N+13]=vc.y;Ba[N+14]=vc.z;Ba[N+15]=vc.w;Pb=dc[P.a];Qb=dc[P.b];Rb=dc[P.c];Hc=dc[P.d];za[N]=Pb.x;za[N+1]=Pb.y;za[N+2]=Pb.z;za[N+3]=1;za[N+4]=Qb.x;za[N+5]=Qb.y;za[N+6]=Qb.z;za[N+7]=1;za[N+8]=
-Rb.x;za[N+9]=Rb.y;za[N+10]=Rb.z;za[N+11]=1;za[N+12]=Hc.x;za[N+13]=Hc.y;za[N+14]=Hc.z;za[N+15]=1;Sb=ec[P.a];Tb=ec[P.b];Ub=ec[P.c];Ic=ec[P.d];Aa[N]=Sb.x;Aa[N+1]=Sb.y;Aa[N+2]=Sb.z;Aa[N+3]=1;Aa[N+4]=Tb.x;Aa[N+5]=Tb.y;Aa[N+6]=Tb.z;Aa[N+7]=1;Aa[N+8]=Ub.x;Aa[N+9]=Ub.y;Aa[N+10]=Ub.z;Aa[N+11]=1;Aa[N+12]=Ic.x;Aa[N+13]=Ic.y;Aa[N+14]=Ic.z;Aa[N+15]=1;N=N+16}if(N>0){i.bindBuffer(i.ARRAY_BUFFER,ga.__webglSkinVertexABuffer);i.bufferData(i.ARRAY_BUFFER,za,eb);i.bindBuffer(i.ARRAY_BUFFER,ga.__webglSkinVertexBBuffer);
-i.bufferData(i.ARRAY_BUFFER,Aa,eb);i.bindBuffer(i.ARRAY_BUFFER,ga.__webglSkinIndicesBuffer);i.bufferData(i.ARRAY_BUFFER,Ba,eb);i.bindBuffer(i.ARRAY_BUFFER,ga.__webglSkinWeightsBuffer);i.bufferData(i.ARRAY_BUFFER,Ca,eb)}}if(ud&&Vc){J=0;for(V=oa.length;J<V;J++){P=Ga[oa[J]];ob=P.vertexColors;Gc=P.color;if(ob.length===3&&Vc===THREE.VertexColors){vb=ob[0];wb=ob[1];xb=ob[2]}else xb=wb=vb=Gc;Ra[Fa]=vb.r;Ra[Fa+1]=vb.g;Ra[Fa+2]=vb.b;Ra[Fa+3]=wb.r;Ra[Fa+4]=wb.g;Ra[Fa+5]=wb.b;Ra[Fa+6]=xb.r;Ra[Fa+7]=xb.g;Ra[Fa+
-8]=xb.b;Fa=Fa+9}J=0;for(V=pa.length;J<V;J++){P=Ga[pa[J]];ob=P.vertexColors;Gc=P.color;if(ob.length===4&&Vc===THREE.VertexColors){vb=ob[0];wb=ob[1];xb=ob[2];tc=ob[3]}else tc=xb=wb=vb=Gc;Ra[Fa]=vb.r;Ra[Fa+1]=vb.g;Ra[Fa+2]=vb.b;Ra[Fa+3]=wb.r;Ra[Fa+4]=wb.g;Ra[Fa+5]=wb.b;Ra[Fa+6]=xb.r;Ra[Fa+7]=xb.g;Ra[Fa+8]=xb.b;Ra[Fa+9]=tc.r;Ra[Fa+10]=tc.g;Ra[Fa+11]=tc.b;Fa=Fa+12}if(Fa>0){i.bindBuffer(i.ARRAY_BUFFER,ga.__webglColorBuffer);i.bufferData(i.ARRAY_BUFFER,Ra,eb)}}if(td&&$a.hasTangents){J=0;for(V=oa.length;J<
-V;J++){P=Ga[oa[J]];Hb=P.vertexTangents;pb=Hb[0];qb=Hb[1];rb=Hb[2];ya[ra]=pb.x;ya[ra+1]=pb.y;ya[ra+2]=pb.z;ya[ra+3]=pb.w;ya[ra+4]=qb.x;ya[ra+5]=qb.y;ya[ra+6]=qb.z;ya[ra+7]=qb.w;ya[ra+8]=rb.x;ya[ra+9]=rb.y;ya[ra+10]=rb.z;ya[ra+11]=rb.w;ra=ra+12}J=0;for(V=pa.length;J<V;J++){P=Ga[pa[J]];Hb=P.vertexTangents;pb=Hb[0];qb=Hb[1];rb=Hb[2];rc=Hb[3];ya[ra]=pb.x;ya[ra+1]=pb.y;ya[ra+2]=pb.z;ya[ra+3]=pb.w;ya[ra+4]=qb.x;ya[ra+5]=qb.y;ya[ra+6]=qb.z;ya[ra+7]=qb.w;ya[ra+8]=rb.x;ya[ra+9]=rb.y;ya[ra+10]=rb.z;ya[ra+11]=
-rb.w;ya[ra+12]=rc.x;ya[ra+13]=rc.y;ya[ra+14]=rc.z;ya[ra+15]=rc.w;ra=ra+16}i.bindBuffer(i.ARRAY_BUFFER,ga.__webglTangentBuffer);i.bufferData(i.ARRAY_BUFFER,ya,eb)}if(sd&&dd){J=0;for(V=oa.length;J<V;J++){P=Ga[oa[J]];jc=P.vertexNormals;Ob=P.normal;if(jc.length===3&&Fc)for(na=0;na<3;na++){Vb=jc[na];jb[Va]=Vb.x;jb[Va+1]=Vb.y;jb[Va+2]=Vb.z;Va=Va+3}else for(na=0;na<3;na++){jb[Va]=Ob.x;jb[Va+1]=Ob.y;jb[Va+2]=Ob.z;Va=Va+3}}J=0;for(V=pa.length;J<V;J++){P=Ga[pa[J]];jc=P.vertexNormals;Ob=P.normal;if(jc.length===
-4&&Fc)for(na=0;na<4;na++){Vb=jc[na];jb[Va]=Vb.x;jb[Va+1]=Vb.y;jb[Va+2]=Vb.z;Va=Va+3}else for(na=0;na<4;na++){jb[Va]=Ob.x;jb[Va+1]=Ob.y;jb[Va+2]=Ob.z;Va=Va+3}}i.bindBuffer(i.ARRAY_BUFFER,ga.__webglNormalBuffer);i.bufferData(i.ARRAY_BUFFER,jb,eb)}if(hd&&Zc&&ed){J=0;for(V=oa.length;J<V;J++){lb=oa[J];P=Ga[lb];kc=Zc[lb];if(kc!==void 0)for(na=0;na<3;na++){mc=kc[na];wc[Jb]=mc.u;wc[Jb+1]=mc.v;Jb=Jb+2}}J=0;for(V=pa.length;J<V;J++){lb=pa[J];P=Ga[lb];kc=Zc[lb];if(kc!==void 0)for(na=0;na<4;na++){mc=kc[na];wc[Jb]=
-mc.u;wc[Jb+1]=mc.v;Jb=Jb+2}}if(Jb>0){i.bindBuffer(i.ARRAY_BUFFER,ga.__webglUVBuffer);i.bufferData(i.ARRAY_BUFFER,wc,eb)}}if(hd&&$c&&ed){J=0;for(V=oa.length;J<V;J++){lb=oa[J];P=Ga[lb];lc=$c[lb];if(lc!==void 0)for(na=0;na<3;na++){nc=lc[na];xc[Kb]=nc.u;xc[Kb+1]=nc.v;Kb=Kb+2}}J=0;for(V=pa.length;J<V;J++){lb=pa[J];P=Ga[lb];lc=$c[lb];if(lc!==void 0)for(na=0;na<4;na++){nc=lc[na];xc[Kb]=nc.u;xc[Kb+1]=nc.v;Kb=Kb+2}}if(Kb>0){i.bindBuffer(i.ARRAY_BUFFER,ga.__webglUV2Buffer);i.bufferData(i.ARRAY_BUFFER,xc,eb)}}if(rd){J=
-0;for(V=oa.length;J<V;J++){P=Ga[oa[J]];Eb[ib]=Ea;Eb[ib+1]=Ea+1;Eb[ib+2]=Ea+2;ib=ib+3;gb[Za]=Ea;gb[Za+1]=Ea+1;gb[Za+2]=Ea;gb[Za+3]=Ea+2;gb[Za+4]=Ea+1;gb[Za+5]=Ea+2;Za=Za+6;Ea=Ea+3}J=0;for(V=pa.length;J<V;J++){P=Ga[pa[J]];Eb[ib]=Ea;Eb[ib+1]=Ea+1;Eb[ib+2]=Ea+3;Eb[ib+3]=Ea+1;Eb[ib+4]=Ea+2;Eb[ib+5]=Ea+3;ib=ib+6;gb[Za]=Ea;gb[Za+1]=Ea+1;gb[Za+2]=Ea;gb[Za+3]=Ea+3;gb[Za+4]=Ea+1;gb[Za+5]=Ea+2;gb[Za+6]=Ea+2;gb[Za+7]=Ea+3;Za=Za+8;Ea=Ea+4}i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,ga.__webglFaceBuffer);i.bufferData(i.ELEMENT_ARRAY_BUFFER,
-Eb,eb);i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,ga.__webglLineBuffer);i.bufferData(i.ELEMENT_ARRAY_BUFFER,gb,eb)}if(Yc){na=0;for(fd=Yc.length;na<fd;na++){y=Yc[na];if(y.__original.needsUpdate){A=0;if(y.size===1)if(y.boundTo===void 0||y.boundTo==="vertices"){J=0;for(V=oa.length;J<V;J++){P=Ga[oa[J]];y.array[A]=y.value[P.a];y.array[A+1]=y.value[P.b];y.array[A+2]=y.value[P.c];A=A+3}J=0;for(V=pa.length;J<V;J++){P=Ga[pa[J]];y.array[A]=y.value[P.a];y.array[A+1]=y.value[P.b];y.array[A+2]=y.value[P.c];y.array[A+
-3]=y.value[P.d];A=A+4}}else{if(y.boundTo==="faces"){J=0;for(V=oa.length;J<V;J++){fb=y.value[oa[J]];y.array[A]=fb;y.array[A+1]=fb;y.array[A+2]=fb;A=A+3}J=0;for(V=pa.length;J<V;J++){fb=y.value[pa[J]];y.array[A]=fb;y.array[A+1]=fb;y.array[A+2]=fb;y.array[A+3]=fb;A=A+4}}}else if(y.size===2)if(y.boundTo===void 0||y.boundTo==="vertices"){J=0;for(V=oa.length;J<V;J++){P=Ga[oa[J]];X=y.value[P.a];Y=y.value[P.b];Z=y.value[P.c];y.array[A]=X.x;y.array[A+1]=X.y;y.array[A+2]=Y.x;y.array[A+3]=Y.y;y.array[A+4]=Z.x;
-y.array[A+5]=Z.y;A=A+6}J=0;for(V=pa.length;J<V;J++){P=Ga[pa[J]];X=y.value[P.a];Y=y.value[P.b];Z=y.value[P.c];qa=y.value[P.d];y.array[A]=X.x;y.array[A+1]=X.y;y.array[A+2]=Y.x;y.array[A+3]=Y.y;y.array[A+4]=Z.x;y.array[A+5]=Z.y;y.array[A+6]=qa.x;y.array[A+7]=qa.y;A=A+8}}else{if(y.boundTo==="faces"){J=0;for(V=oa.length;J<V;J++){Z=Y=X=fb=y.value[oa[J]];y.array[A]=X.x;y.array[A+1]=X.y;y.array[A+2]=Y.x;y.array[A+3]=Y.y;y.array[A+4]=Z.x;y.array[A+5]=Z.y;A=A+6}J=0;for(V=pa.length;J<V;J++){qa=Z=Y=X=fb=y.value[pa[J]];
-y.array[A]=X.x;y.array[A+1]=X.y;y.array[A+2]=Y.x;y.array[A+3]=Y.y;y.array[A+4]=Z.x;y.array[A+5]=Z.y;y.array[A+6]=qa.x;y.array[A+7]=qa.y;A=A+8}}}else if(y.size===3){var ia;ia=y.type==="c"?["r","g","b"]:["x","y","z"];if(y.boundTo===void 0||y.boundTo==="vertices"){J=0;for(V=oa.length;J<V;J++){P=Ga[oa[J]];X=y.value[P.a];Y=y.value[P.b];Z=y.value[P.c];y.array[A]=X[ia[0]];y.array[A+1]=X[ia[1]];y.array[A+2]=X[ia[2]];y.array[A+3]=Y[ia[0]];y.array[A+4]=Y[ia[1]];y.array[A+5]=Y[ia[2]];y.array[A+6]=Z[ia[0]];y.array[A+
-7]=Z[ia[1]];y.array[A+8]=Z[ia[2]];A=A+9}J=0;for(V=pa.length;J<V;J++){P=Ga[pa[J]];X=y.value[P.a];Y=y.value[P.b];Z=y.value[P.c];qa=y.value[P.d];y.array[A]=X[ia[0]];y.array[A+1]=X[ia[1]];y.array[A+2]=X[ia[2]];y.array[A+3]=Y[ia[0]];y.array[A+4]=Y[ia[1]];y.array[A+5]=Y[ia[2]];y.array[A+6]=Z[ia[0]];y.array[A+7]=Z[ia[1]];y.array[A+8]=Z[ia[2]];y.array[A+9]=qa[ia[0]];y.array[A+10]=qa[ia[1]];y.array[A+11]=qa[ia[2]];A=A+12}}else if(y.boundTo==="faces"){J=0;for(V=oa.length;J<V;J++){Z=Y=X=fb=y.value[oa[J]];y.array[A]=
-X[ia[0]];y.array[A+1]=X[ia[1]];y.array[A+2]=X[ia[2]];y.array[A+3]=Y[ia[0]];y.array[A+4]=Y[ia[1]];y.array[A+5]=Y[ia[2]];y.array[A+6]=Z[ia[0]];y.array[A+7]=Z[ia[1]];y.array[A+8]=Z[ia[2]];A=A+9}J=0;for(V=pa.length;J<V;J++){qa=Z=Y=X=fb=y.value[pa[J]];y.array[A]=X[ia[0]];y.array[A+1]=X[ia[1]];y.array[A+2]=X[ia[2]];y.array[A+3]=Y[ia[0]];y.array[A+4]=Y[ia[1]];y.array[A+5]=Y[ia[2]];y.array[A+6]=Z[ia[0]];y.array[A+7]=Z[ia[1]];y.array[A+8]=Z[ia[2]];y.array[A+9]=qa[ia[0]];y.array[A+10]=qa[ia[1]];y.array[A+11]=
-qa[ia[2]];A=A+12}}}else if(y.size===4)if(y.boundTo===void 0||y.boundTo==="vertices"){J=0;for(V=oa.length;J<V;J++){P=Ga[oa[J]];X=y.value[P.a];Y=y.value[P.b];Z=y.value[P.c];y.array[A]=X.x;y.array[A+1]=X.y;y.array[A+2]=X.z;y.array[A+3]=X.w;y.array[A+4]=Y.x;y.array[A+5]=Y.y;y.array[A+6]=Y.z;y.array[A+7]=Y.w;y.array[A+8]=Z.x;y.array[A+9]=Z.y;y.array[A+10]=Z.z;y.array[A+11]=Z.w;A=A+12}J=0;for(V=pa.length;J<V;J++){P=Ga[pa[J]];X=y.value[P.a];Y=y.value[P.b];Z=y.value[P.c];qa=y.value[P.d];y.array[A]=X.x;y.array[A+
-1]=X.y;y.array[A+2]=X.z;y.array[A+3]=X.w;y.array[A+4]=Y.x;y.array[A+5]=Y.y;y.array[A+6]=Y.z;y.array[A+7]=Y.w;y.array[A+8]=Z.x;y.array[A+9]=Z.y;y.array[A+10]=Z.z;y.array[A+11]=Z.w;y.array[A+12]=qa.x;y.array[A+13]=qa.y;y.array[A+14]=qa.z;y.array[A+15]=qa.w;A=A+16}}else if(y.boundTo==="faces"){J=0;for(V=oa.length;J<V;J++){Z=Y=X=fb=y.value[oa[J]];y.array[A]=X.x;y.array[A+1]=X.y;y.array[A+2]=X.z;y.array[A+3]=X.w;y.array[A+4]=Y.x;y.array[A+5]=Y.y;y.array[A+6]=Y.z;y.array[A+7]=Y.w;y.array[A+8]=Z.x;y.array[A+
-9]=Z.y;y.array[A+10]=Z.z;y.array[A+11]=Z.w;A=A+12}J=0;for(V=pa.length;J<V;J++){qa=Z=Y=X=fb=y.value[pa[J]];y.array[A]=X.x;y.array[A+1]=X.y;y.array[A+2]=X.z;y.array[A+3]=X.w;y.array[A+4]=Y.x;y.array[A+5]=Y.y;y.array[A+6]=Y.z;y.array[A+7]=Y.w;y.array[A+8]=Z.x;y.array[A+9]=Z.y;y.array[A+10]=Z.z;y.array[A+11]=Z.w;y.array[A+12]=qa.x;y.array[A+13]=qa.y;y.array[A+14]=qa.z;y.array[A+15]=qa.w;A=A+16}}i.bindBuffer(i.ARRAY_BUFFER,y.buffer);i.bufferData(i.ARRAY_BUFFER,y.array,eb)}}}if(qd){delete ga.__inittedArrays;
-delete ga.__colorArray;delete ga.__normalArray;delete ga.__tangentArray;delete ga.__uvArray;delete ga.__uv2Array;delete ga.__faceArray;delete ga.__vertexArray;delete ga.__lineArray;delete ga.__skinVertexAArray;delete ga.__skinVertexBArray;delete ga.__skinIndexArray;delete ga.__skinWeightArray}}}}ka.__dirtyVertices=false;ka.__dirtyMorphTargets=false;ka.__dirtyElements=false;ka.__dirtyUvs=false;ka.__dirtyNormals=false;ka.__dirtyColors=false;ka.__dirtyTangents=false;bb.attributes&&m(bb)}else if(nb 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];$b=yc*3;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=zc*3;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=false;ka.__dirtyColors=false}else if(nb instanceof THREE.Line){bb=c(nb,qc);ic=bb.attributes&&o(bb);if(ka.__dirtyVertices||ka.__dirtyColors||ic){var Lb=ka,ad=i.DYNAMIC_DRAW,Ac=void 0,Bc=void 0,Oc=void 0,Da=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,Ua=void 0,oc=void 0,cb=void 0,wa=void 0;if(Lb.__dirtyVertices){for(Ac=0;Ac<zd;Ac++){Oc=ld[Ac];Da=Ac*3;Qc[Da]=Oc.x;Qc[Da+1]=Oc.y;Qc[Da+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];Da=Bc*3;Rc[Da]=Pc.r;Rc[Da+1]=Pc.g;Rc[Da+2]=Pc.b}i.bindBuffer(i.ARRAY_BUFFER,Lb.__webglColorBuffer);i.bufferData(i.ARRAY_BUFFER,Rc,ad)}if(bd){Sc=0;for(nd=bd.length;Sc<nd;Sc++){wa=bd[Sc];if(wa.needsUpdate&&(wa.boundTo===void 0||
-wa.boundTo==="vertices")){Da=0;oc=wa.value.length;if(wa.size===1)for(Ua=0;Ua<oc;Ua++)wa.array[Ua]=wa.value[Ua];else if(wa.size===2)for(Ua=0;Ua<oc;Ua++){cb=wa.value[Ua];wa.array[Da]=cb.x;wa.array[Da+1]=cb.y;Da=Da+2}else if(wa.size===3)if(wa.type==="c")for(Ua=0;Ua<oc;Ua++){cb=wa.value[Ua];wa.array[Da]=cb.r;wa.array[Da+1]=cb.g;wa.array[Da+2]=cb.b;Da=Da+3}else for(Ua=0;Ua<oc;Ua++){cb=wa.value[Ua];wa.array[Da]=cb.x;wa.array[Da+1]=cb.y;wa.array[Da+2]=cb.z;Da=Da+3}else if(wa.size===4)for(Ua=0;Ua<oc;Ua++){cb=
-wa.value[Ua];wa.array[Da]=cb.x;wa.array[Da+1]=cb.y;wa.array[Da+2]=cb.z;wa.array[Da+3]=cb.w;Da=Da+4}i.bindBuffer(i.ARRAY_BUFFER,wa.buffer);i.bufferData(i.ARRAY_BUFFER,wa.array,ad)}}}}ka.__dirtyVertices=false;ka.__dirtyColors=false;bb.attributes&&m(bb)}else if(nb instanceof THREE.ParticleSystem){bb=c(nb,qc);ic=bb.attributes&&o(bb);(ka.__dirtyVertices||ka.__dirtyColors||nb.sortParticles||ic)&&f(ka,i.DYNAMIC_DRAW,nb);ka.__dirtyVertices=false;ka.__dirtyColors=false;bb.attributes&&m(bb)}}};this.initMaterial=
-function(a,b,c,d){var e,f,g;a instanceof THREE.MeshDepthMaterial?g="depth":a instanceof THREE.MeshNormalMaterial?g="normal":a instanceof THREE.MeshBasicMaterial?g="basic":a instanceof THREE.MeshLambertMaterial?g="lambert":a instanceof THREE.MeshPhongMaterial?g="phong":a instanceof THREE.LineBasicMaterial?g="basic":a instanceof THREE.ParticleBasicMaterial&&(g="particle_basic");if(g){var h=THREE.ShaderLib[g];a.uniforms=THREE.UniformsUtils.clone(h.uniforms);a.vertexShader=h.vertexShader;a.fragmentShader=
-h.fragmentShader}var l,j,k,m,n;l=m=n=h=0;for(j=b.length;l<j;l++){k=b[l];if(!k.onlyShadow){k instanceof THREE.DirectionalLight&&m++;k instanceof THREE.PointLight&&n++;k instanceof THREE.SpotLight&&h++}}if(n+h+m<=O){j=m;k=n;m=h}else{j=Math.ceil(O*m/(n+m));m=k=O-j}var o=0,h=0;for(n=b.length;h<n;h++){l=b[h];if(l.castShadow){l instanceof THREE.SpotLight&&o++;l instanceof THREE.DirectionalLight&&!l.shadowCascade&&o++}}var p=50;if(d!==void 0&&d instanceof THREE.SkinnedMesh)p=d.bones.length;var r;a:{n=a.fragmentShader;
-l=a.vertexShader;var h=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,maxBones:p,morphTargets:a.morphTargets,morphNormals:a.morphNormals,maxMorphTargets:this.maxMorphTargets,maxMorphNormals:this.maxMorphNormals,maxDirLights:j,maxPointLights:k,maxSpotLights:m,maxShadows:o,shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapDebug:this.shadowMapDebug,
-shadowMapCascade:this.shadowMapCascade,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel,wrapAround:a.wrapAround,doubleSided:d&&d.doubleSided},q,d=[];if(g)d.push(g);else{d.push(n);d.push(l)}for(q in c){d.push(q);d.push(c[q])}g=d.join();q=0;for(d=U.length;q<d;q++)if(U[q].code===g){r=U[q].program;break a}q=i.createProgram();d=["precision "+v+" float;",Xa>0?"#define VERTEX_TEXTURES":"",E.gammaInput?"#define GAMMA_INPUT":"",E.gammaOutput?"#define GAMMA_OUTPUT":"",E.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":
-"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SPOT_LIGHTS "+c.maxSpotLights,"#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");
-j=["precision "+v+" float;","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SPOT_LIGHTS "+c.maxSpotLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",E.gammaInput?"#define GAMMA_INPUT":"",E.gammaOutput?"#define GAMMA_OUTPUT":"",E.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":
+a,b);G.info.render.calls=0;G.info.render.vertices=0;G.info.render.faces=0;G.info.render.points=0;this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);m=a.__webglObjects;d=0;for(e=m.length;d<e;d++){f=m[d];l=f.object;f.render=false;if(l.visible&&(!(l instanceof THREE.Mesh||l instanceof THREE.ParticleSystem)||!l.frustumCulled||Oa.contains(l))){q(l,b);var p=f,r=p.object,s=p.buffer,t=void 0,t=t=void 0,t=r.material;if(t instanceof THREE.MeshFaceMaterial){t=
+s.materialIndex;if(t>=0){t=r.geometry.materials[t];if(t.transparent){p.transparent=t;p.opaque=null}else{p.opaque=t;p.transparent=null}}}else if(t)if(t.transparent){p.transparent=t;p.opaque=null}else{p.opaque=t;p.transparent=null}f.render=true;if(this.sortObjects)if(l.renderDepth)f.z=l.renderDepth;else{ab.copy(l.matrixWorld.getPosition());ua.multiplyVector3(ab);f.z=ab.z}}}this.sortObjects&&m.sort(g);m=a.__webglObjectsImmediate;d=0;for(e=m.length;d<e;d++){f=m[d];l=f.object;if(l.visible){q(l,b);l=f.object.material;
+if(l.transparent){f.transparent=l;f.opaque=null}else{f.opaque=l;f.transparent=null}}}if(a.overrideMaterial){d=a.overrideMaterial;this.setBlending(d.blending,d.blendEquation,d.blendSrc,d.blendDst);this.setDepthTest(d.depthTest);this.setDepthWrite(d.depthWrite);u(d.polygonOffset,d.polygonOffsetFactor,d.polygonOffsetUnits);k(a.__webglObjects,false,"",b,n,o,true,d);j(a.__webglObjectsImmediate,"",b,n,o,false,d)}else{this.setBlending(THREE.NormalBlending);k(a.__webglObjects,true,"opaque",b,n,o,false);j(a.__webglObjectsImmediate,
+"opaque",b,n,o,false);k(a.__webglObjects,false,"transparent",b,n,o,true);j(a.__webglObjectsImmediate,"transparent",b,n,o,true)}h(this.renderPluginsPost,a,b);if(c&&c.generateMipmaps&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter)if(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)}else{i.bindTexture(i.TEXTURE_2D,c.__webglTexture);i.generateMipmap(i.TEXTURE_2D);
+i.bindTexture(i.TEXTURE_2D,null)}this.setDepthTest(true);this.setDepthWrite(true)};this.renderImmediateObject=function(a,b,c,d,e){var f=m(a,b,c,d,e);H=-1;G.setObjectFaces(e);e.immediateRenderCallback?e.immediateRenderCallback(f,i,Oa):e.render(function(a){G.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,
+k=void 0,j=void 0,m=void 0;if(!g.__webglInit){g.__webglInit=true;g._modelViewMatrix=new THREE.Matrix4;g._normalMatrix=new THREE.Matrix3;if(g instanceof THREE.Mesh){j=g.geometry;if(j instanceof THREE.Geometry){if(j.geometryGroups===void 0){var q=j,s=void 0,t=void 0,u=void 0,C=void 0,H=void 0,v=void 0,w=void 0,x={},Y=q.morphTargets.length,B=q.morphNormals.length;q.geometryGroups={};s=0;for(t=q.faces.length;s<t;s++){u=q.faces[s];C=u.materialIndex;v=C!==void 0?C:-1;x[v]===void 0&&(x[v]={hash:v,counter:0});
+w=x[v].hash+"_"+x[v].counter;q.geometryGroups[w]===void 0&&(q.geometryGroups[w]={faces3:[],faces4:[],materialIndex:C,vertices:0,numMorphTargets:Y,numMorphNormals:B});H=u instanceof THREE.Face3?3:4;if(q.geometryGroups[w].vertices+H>65535){x[v].counter=x[v].counter+1;w=x[v].hash+"_"+x[v].counter;q.geometryGroups[w]===void 0&&(q.geometryGroups[w]={faces3:[],faces4:[],materialIndex:C,vertices:0,numMorphTargets:Y,numMorphNormals:B})}u instanceof THREE.Face3?q.geometryGroups[w].faces3.push(s):q.geometryGroups[w].faces4.push(s);
+q.geometryGroups[w].vertices=q.geometryGroups[w].vertices+H}q.geometryGroupsList=[];var z=void 0;for(z in q.geometryGroups){q.geometryGroups[z].id=ga++;q.geometryGroupsList.push(q.geometryGroups[z])}}for(k in j.geometryGroups){m=j.geometryGroups[k];if(!m.__webglVertexBuffer){var A=m;A.__webglVertexBuffer=i.createBuffer();A.__webglNormalBuffer=i.createBuffer();A.__webglTangentBuffer=i.createBuffer();A.__webglColorBuffer=i.createBuffer();A.__webglUVBuffer=i.createBuffer();A.__webglUV2Buffer=i.createBuffer();
+A.__webglSkinVertexABuffer=i.createBuffer();A.__webglSkinVertexBBuffer=i.createBuffer();A.__webglSkinIndicesBuffer=i.createBuffer();A.__webglSkinWeightsBuffer=i.createBuffer();A.__webglFaceBuffer=i.createBuffer();A.__webglLineBuffer=i.createBuffer();var E=void 0,F=void 0;if(A.numMorphTargets){A.__webglMorphTargetsBuffers=[];E=0;for(F=A.numMorphTargets;E<F;E++)A.__webglMorphTargetsBuffers.push(i.createBuffer())}if(A.numMorphNormals){A.__webglMorphNormalsBuffers=[];E=0;for(F=A.numMorphNormals;E<F;E++)A.__webglMorphNormalsBuffers.push(i.createBuffer())}G.info.memory.geometries++;
+var S=m,T=g,J=T.geometry,P=S.faces3,K=S.faces4,ba=P.length*3+K.length*4,M=P.length*1+K.length*2,ca=P.length*3+K.length*4,Q=c(T,S),la=e(Q),fa=d(Q),X=Q.vertexColors?Q.vertexColors:false;S.__vertexArray=new Float32Array(ba*3);if(fa)S.__normalArray=new Float32Array(ba*3);if(J.hasTangents)S.__tangentArray=new Float32Array(ba*4);if(X)S.__colorArray=new Float32Array(ba*3);if(la){if(J.faceUvs.length>0||J.faceVertexUvs.length>0)S.__uvArray=new Float32Array(ba*2);if(J.faceUvs.length>1||J.faceVertexUvs.length>
+1)S.__uv2Array=new Float32Array(ba*2)}if(T.geometry.skinWeights.length&&T.geometry.skinIndices.length){S.__skinVertexAArray=new Float32Array(ba*4);S.__skinVertexBArray=new Float32Array(ba*4);S.__skinIndexArray=new Float32Array(ba*4);S.__skinWeightArray=new Float32Array(ba*4)}S.__faceArray=new Uint16Array(M*3);S.__lineArray=new Uint16Array(ca*2);var U=void 0,W=void 0;if(S.numMorphTargets){S.__morphTargetsArrays=[];U=0;for(W=S.numMorphTargets;U<W;U++)S.__morphTargetsArrays.push(new Float32Array(ba*
+3))}if(S.numMorphNormals){S.__morphNormalsArrays=[];U=0;for(W=S.numMorphNormals;U<W;U++)S.__morphNormalsArrays.push(new Float32Array(ba*3))}S.__webglFaceCount=M*3;S.__webglLineCount=ca*2;if(Q.attributes){if(S.__webglCustomAttributesList===void 0)S.__webglCustomAttributesList=[];var Ma=void 0;for(Ma in Q.attributes){var xa=Q.attributes[Ma],ta={},Na;for(Na in xa)ta[Na]=xa[Na];if(!ta.__webglInitialized||ta.createUniqueBuffers){ta.__webglInitialized=true;var ja=1;ta.type==="v2"?ja=2:ta.type==="v3"?ja=
+3:ta.type==="v4"?ja=4:ta.type==="c"&&(ja=3);ta.size=ja;ta.array=new Float32Array(ba*ja);ta.buffer=i.createBuffer();ta.buffer.belongsToAttribute=Ma;xa.needsUpdate=true;ta.__original=xa}S.__webglCustomAttributesList.push(ta)}}S.__inittedArrays=true;j.__dirtyVertices=true;j.__dirtyMorphTargets=true;j.__dirtyElements=true;j.__dirtyUvs=true;j.__dirtyNormals=true;j.__dirtyTangents=true;j.__dirtyColors=true}}}}else if(g instanceof THREE.Ribbon){j=g.geometry;if(!j.__webglVertexBuffer){var Sa=j;Sa.__webglVertexBuffer=
+i.createBuffer();Sa.__webglColorBuffer=i.createBuffer();G.info.memory.geometries++;var sa=j,ma=sa.vertices.length;sa.__vertexArray=new Float32Array(ma*3);sa.__colorArray=new Float32Array(ma*3);sa.__webglVertexCount=ma;j.__dirtyVertices=true;j.__dirtyColors=true}}else if(g instanceof THREE.Line){j=g.geometry;if(!j.__webglVertexBuffer){var va=j;va.__webglVertexBuffer=i.createBuffer();va.__webglColorBuffer=i.createBuffer();G.info.memory.geometries++;var ua=j,Ha=g,Wa=ua.vertices.length;ua.__vertexArray=
+new Float32Array(Wa*3);ua.__colorArray=new Float32Array(Wa*3);ua.__webglLineCount=Wa;b(ua,Ha);j.__dirtyVertices=true;j.__dirtyColors=true}}else if(g instanceof THREE.ParticleSystem){j=g.geometry;if(!j.__webglVertexBuffer){var Ya=j;Ya.__webglVertexBuffer=i.createBuffer();Ya.__webglColorBuffer=i.createBuffer();G.info.geometries++;var Oa=j,ab=g,Xa=Oa.vertices.length;Oa.__vertexArray=new Float32Array(Xa*3);Oa.__colorArray=new Float32Array(Xa*3);Oa.__sortArray=[];Oa.__webglParticleCount=Xa;b(Oa,ab);j.__dirtyVertices=
+true;j.__dirtyColors=true}}}if(!g.__webglActive){if(g instanceof THREE.Mesh){j=g.geometry;if(j instanceof THREE.BufferGeometry)l(h.__webglObjects,j,g);else for(k in j.geometryGroups){m=j.geometryGroups[k];l(h.__webglObjects,m,g)}}else if(g instanceof THREE.Ribbon||g instanceof THREE.Line||g instanceof THREE.ParticleSystem){j=g.geometry;l(h.__webglObjects,j,g)}else 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=true}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;){var Ja=a.__objectsRemoved[0],db=a;Ja instanceof THREE.Mesh||Ja instanceof THREE.ParticleSystem||Ja instanceof THREE.Ribbon||Ja instanceof THREE.Line?p(db.__webglObjects,Ja):Ja instanceof THREE.Sprite?r(db.__webglSprites,Ja):Ja instanceof THREE.LensFlare?r(db.__webglFlares,Ja):(Ja instanceof THREE.ImmediateRenderObject||
+Ja.immediateRenderCallback)&&p(db.__webglObjectsImmediate,Ja);Ja.__webglActive=false;a.__objectsRemoved.splice(0,1)}for(var hb=0,mb=a.__webglObjects.length;hb<mb;hb++){var nb=a.__webglObjects[hb].object,ka=nb.geometry,qc=void 0,ic=void 0,bb=void 0;if(nb instanceof THREE.Mesh)if(ka instanceof THREE.BufferGeometry){ka.__dirtyVertices=false;ka.__dirtyElements=false;ka.__dirtyUvs=false;ka.__dirtyNormals=false;ka.__dirtyColors=false}else{for(var Uc=0,od=ka.geometryGroupsList.length;Uc<od;Uc++){qc=ka.geometryGroupsList[Uc];
+bb=c(nb,qc);ic=bb.attributes&&o(bb);if(ka.__dirtyVertices||ka.__dirtyMorphTargets||ka.__dirtyElements||ka.__dirtyUvs||ka.__dirtyNormals||ka.__dirtyColors||ka.__dirtyTangents||ic){var ha=qc,pd=nb,eb=i.DYNAMIC_DRAW,qd=!ka.dynamic,bc=bb;if(ha.__inittedArrays){var dd=d(bc),Vc=bc.vertexColors?bc.vertexColors:false,ed=e(bc),Fc=dd===THREE.SmoothShading,I=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,Z=void 0,$=void 0,aa=void 0,qa=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,na=void 0,fd=void 0,Vb=void 0,mc=void 0,nc=void 0,Pa=void 0,gd=void 0,Ka=void 0,La=void 0,Wb=void 0,Ib=void 0,Ea=0,Ia=0,Jb=0,Kb=0,ib=0,Va=0,ra=0,Za=0,Fa=0,L=0,ea=0,D=0,fb=void 0,Qa=ha.__vertexArray,wc=ha.__uvArray,xc=ha.__uv2Array,
+jb=ha.__normalArray,ya=ha.__tangentArray,Ra=ha.__colorArray,za=ha.__skinVertexAArray,Aa=ha.__skinVertexBArray,Ba=ha.__skinIndexArray,Ca=ha.__skinWeightArray,Wc=ha.__morphTargetsArrays,Xc=ha.__morphNormalsArrays,Yc=ha.__webglCustomAttributesList,y=void 0,Eb=ha.__faceArray,gb=ha.__lineArray,$a=pd.geometry,rd=$a.__dirtyElements,hd=$a.__dirtyUvs,sd=$a.__dirtyNormals,td=$a.__dirtyTangents,ud=$a.__dirtyColors,vd=$a.__dirtyMorphTargets,cc=$a.vertices,oa=ha.faces3,pa=ha.faces4,Ga=$a.faces,Zc=$a.faceVertexUvs[0],
+$c=$a.faceVertexUvs[1],dc=$a.skinVerticesA,ec=$a.skinVerticesB,fc=$a.skinIndices,Xb=$a.skinWeights,Yb=$a.morphTargets,Jc=$a.morphNormals;if($a.__dirtyVertices){I=0;for(V=oa.length;I<V;I++){N=Ga[oa[I]];Z=cc[N.a];$=cc[N.b];aa=cc[N.c];Qa[Ia]=Z.x;Qa[Ia+1]=Z.y;Qa[Ia+2]=Z.z;Qa[Ia+3]=$.x;Qa[Ia+4]=$.y;Qa[Ia+5]=$.z;Qa[Ia+6]=aa.x;Qa[Ia+7]=aa.y;Qa[Ia+8]=aa.z;Ia=Ia+9}I=0;for(V=pa.length;I<V;I++){N=Ga[pa[I]];Z=cc[N.a];$=cc[N.b];aa=cc[N.c];qa=cc[N.d];Qa[Ia]=Z.x;Qa[Ia+1]=Z.y;Qa[Ia+2]=Z.z;Qa[Ia+3]=$.x;Qa[Ia+4]=$.y;
+Qa[Ia+5]=$.z;Qa[Ia+6]=aa.x;Qa[Ia+7]=aa.y;Qa[Ia+8]=aa.z;Qa[Ia+9]=qa.x;Qa[Ia+10]=qa.y;Qa[Ia+11]=qa.z;Ia=Ia+12}i.bindBuffer(i.ARRAY_BUFFER,ha.__webglVertexBuffer);i.bufferData(i.ARRAY_BUFFER,Qa,eb)}if(vd){Pa=0;for(gd=Yb.length;Pa<gd;Pa++){I=ea=0;for(V=oa.length;I<V;I++){Wb=oa[I];N=Ga[Wb];Z=Yb[Pa].vertices[N.a];$=Yb[Pa].vertices[N.b];aa=Yb[Pa].vertices[N.c];Ka=Wc[Pa];Ka[ea]=Z.x;Ka[ea+1]=Z.y;Ka[ea+2]=Z.z;Ka[ea+3]=$.x;Ka[ea+4]=$.y;Ka[ea+5]=$.z;Ka[ea+6]=aa.x;Ka[ea+7]=aa.y;Ka[ea+8]=aa.z;if(bc.morphNormals){if(Fc){Ib=
+Jc[Pa].vertexNormals[Wb];sb=Ib.a;tb=Ib.b;ub=Ib.c}else ub=tb=sb=Jc[Pa].faceNormals[Wb];La=Xc[Pa];La[ea]=sb.x;La[ea+1]=sb.y;La[ea+2]=sb.z;La[ea+3]=tb.x;La[ea+4]=tb.y;La[ea+5]=tb.z;La[ea+6]=ub.x;La[ea+7]=ub.y;La[ea+8]=ub.z}ea=ea+9}I=0;for(V=pa.length;I<V;I++){Wb=pa[I];N=Ga[Wb];Z=Yb[Pa].vertices[N.a];$=Yb[Pa].vertices[N.b];aa=Yb[Pa].vertices[N.c];qa=Yb[Pa].vertices[N.d];Ka=Wc[Pa];Ka[ea]=Z.x;Ka[ea+1]=Z.y;Ka[ea+2]=Z.z;Ka[ea+3]=$.x;Ka[ea+4]=$.y;Ka[ea+5]=$.z;Ka[ea+6]=aa.x;Ka[ea+7]=aa.y;Ka[ea+8]=aa.z;Ka[ea+
+9]=qa.x;Ka[ea+10]=qa.y;Ka[ea+11]=qa.z;if(bc.morphNormals){if(Fc){Ib=Jc[Pa].vertexNormals[Wb];sb=Ib.a;tb=Ib.b;ub=Ib.c;sc=Ib.d}else sc=ub=tb=sb=Jc[Pa].faceNormals[Wb];La=Xc[Pa];La[ea]=sb.x;La[ea+1]=sb.y;La[ea+2]=sb.z;La[ea+3]=tb.x;La[ea+4]=tb.y;La[ea+5]=tb.z;La[ea+6]=ub.x;La[ea+7]=ub.y;La[ea+8]=ub.z;La[ea+9]=sc.x;La[ea+10]=sc.y;La[ea+11]=sc.z}ea=ea+12}i.bindBuffer(i.ARRAY_BUFFER,ha.__webglMorphTargetsBuffers[Pa]);i.bufferData(i.ARRAY_BUFFER,Wc[Pa],eb);if(bc.morphNormals){i.bindBuffer(i.ARRAY_BUFFER,
+ha.__webglMorphNormalsBuffers[Pa]);i.bufferData(i.ARRAY_BUFFER,Xc[Pa],eb)}}}if(Xb.length){I=0;for(V=oa.length;I<V;I++){N=Ga[oa[I]];yb=Xb[N.a];zb=Xb[N.b];Ab=Xb[N.c];Ca[L]=yb.x;Ca[L+1]=yb.y;Ca[L+2]=yb.z;Ca[L+3]=yb.w;Ca[L+4]=zb.x;Ca[L+5]=zb.y;Ca[L+6]=zb.z;Ca[L+7]=zb.w;Ca[L+8]=Ab.x;Ca[L+9]=Ab.y;Ca[L+10]=Ab.z;Ca[L+11]=Ab.w;Bb=fc[N.a];Cb=fc[N.b];Db=fc[N.c];Ba[L]=Bb.x;Ba[L+1]=Bb.y;Ba[L+2]=Bb.z;Ba[L+3]=Bb.w;Ba[L+4]=Cb.x;Ba[L+5]=Cb.y;Ba[L+6]=Cb.z;Ba[L+7]=Cb.w;Ba[L+8]=Db.x;Ba[L+9]=Db.y;Ba[L+10]=Db.z;Ba[L+11]=
+Db.w;Pb=dc[N.a];Qb=dc[N.b];Rb=dc[N.c];za[L]=Pb.x;za[L+1]=Pb.y;za[L+2]=Pb.z;za[L+3]=1;za[L+4]=Qb.x;za[L+5]=Qb.y;za[L+6]=Qb.z;za[L+7]=1;za[L+8]=Rb.x;za[L+9]=Rb.y;za[L+10]=Rb.z;za[L+11]=1;Sb=ec[N.a];Tb=ec[N.b];Ub=ec[N.c];Aa[L]=Sb.x;Aa[L+1]=Sb.y;Aa[L+2]=Sb.z;Aa[L+3]=1;Aa[L+4]=Tb.x;Aa[L+5]=Tb.y;Aa[L+6]=Tb.z;Aa[L+7]=1;Aa[L+8]=Ub.x;Aa[L+9]=Ub.y;Aa[L+10]=Ub.z;Aa[L+11]=1;L=L+12}I=0;for(V=pa.length;I<V;I++){N=Ga[pa[I]];yb=Xb[N.a];zb=Xb[N.b];Ab=Xb[N.c];uc=Xb[N.d];Ca[L]=yb.x;Ca[L+1]=yb.y;Ca[L+2]=yb.z;Ca[L+3]=
+yb.w;Ca[L+4]=zb.x;Ca[L+5]=zb.y;Ca[L+6]=zb.z;Ca[L+7]=zb.w;Ca[L+8]=Ab.x;Ca[L+9]=Ab.y;Ca[L+10]=Ab.z;Ca[L+11]=Ab.w;Ca[L+12]=uc.x;Ca[L+13]=uc.y;Ca[L+14]=uc.z;Ca[L+15]=uc.w;Bb=fc[N.a];Cb=fc[N.b];Db=fc[N.c];vc=fc[N.d];Ba[L]=Bb.x;Ba[L+1]=Bb.y;Ba[L+2]=Bb.z;Ba[L+3]=Bb.w;Ba[L+4]=Cb.x;Ba[L+5]=Cb.y;Ba[L+6]=Cb.z;Ba[L+7]=Cb.w;Ba[L+8]=Db.x;Ba[L+9]=Db.y;Ba[L+10]=Db.z;Ba[L+11]=Db.w;Ba[L+12]=vc.x;Ba[L+13]=vc.y;Ba[L+14]=vc.z;Ba[L+15]=vc.w;Pb=dc[N.a];Qb=dc[N.b];Rb=dc[N.c];Hc=dc[N.d];za[L]=Pb.x;za[L+1]=Pb.y;za[L+2]=Pb.z;
+za[L+3]=1;za[L+4]=Qb.x;za[L+5]=Qb.y;za[L+6]=Qb.z;za[L+7]=1;za[L+8]=Rb.x;za[L+9]=Rb.y;za[L+10]=Rb.z;za[L+11]=1;za[L+12]=Hc.x;za[L+13]=Hc.y;za[L+14]=Hc.z;za[L+15]=1;Sb=ec[N.a];Tb=ec[N.b];Ub=ec[N.c];Ic=ec[N.d];Aa[L]=Sb.x;Aa[L+1]=Sb.y;Aa[L+2]=Sb.z;Aa[L+3]=1;Aa[L+4]=Tb.x;Aa[L+5]=Tb.y;Aa[L+6]=Tb.z;Aa[L+7]=1;Aa[L+8]=Ub.x;Aa[L+9]=Ub.y;Aa[L+10]=Ub.z;Aa[L+11]=1;Aa[L+12]=Ic.x;Aa[L+13]=Ic.y;Aa[L+14]=Ic.z;Aa[L+15]=1;L=L+16}if(L>0){i.bindBuffer(i.ARRAY_BUFFER,ha.__webglSkinVertexABuffer);i.bufferData(i.ARRAY_BUFFER,
+za,eb);i.bindBuffer(i.ARRAY_BUFFER,ha.__webglSkinVertexBBuffer);i.bufferData(i.ARRAY_BUFFER,Aa,eb);i.bindBuffer(i.ARRAY_BUFFER,ha.__webglSkinIndicesBuffer);i.bufferData(i.ARRAY_BUFFER,Ba,eb);i.bindBuffer(i.ARRAY_BUFFER,ha.__webglSkinWeightsBuffer);i.bufferData(i.ARRAY_BUFFER,Ca,eb)}}if(ud&&Vc){I=0;for(V=oa.length;I<V;I++){N=Ga[oa[I]];ob=N.vertexColors;Gc=N.color;if(ob.length===3&&Vc===THREE.VertexColors){vb=ob[0];wb=ob[1];xb=ob[2]}else xb=wb=vb=Gc;Ra[Fa]=vb.r;Ra[Fa+1]=vb.g;Ra[Fa+2]=vb.b;Ra[Fa+3]=
+wb.r;Ra[Fa+4]=wb.g;Ra[Fa+5]=wb.b;Ra[Fa+6]=xb.r;Ra[Fa+7]=xb.g;Ra[Fa+8]=xb.b;Fa=Fa+9}I=0;for(V=pa.length;I<V;I++){N=Ga[pa[I]];ob=N.vertexColors;Gc=N.color;if(ob.length===4&&Vc===THREE.VertexColors){vb=ob[0];wb=ob[1];xb=ob[2];tc=ob[3]}else tc=xb=wb=vb=Gc;Ra[Fa]=vb.r;Ra[Fa+1]=vb.g;Ra[Fa+2]=vb.b;Ra[Fa+3]=wb.r;Ra[Fa+4]=wb.g;Ra[Fa+5]=wb.b;Ra[Fa+6]=xb.r;Ra[Fa+7]=xb.g;Ra[Fa+8]=xb.b;Ra[Fa+9]=tc.r;Ra[Fa+10]=tc.g;Ra[Fa+11]=tc.b;Fa=Fa+12}if(Fa>0){i.bindBuffer(i.ARRAY_BUFFER,ha.__webglColorBuffer);i.bufferData(i.ARRAY_BUFFER,
+Ra,eb)}}if(td&&$a.hasTangents){I=0;for(V=oa.length;I<V;I++){N=Ga[oa[I]];Hb=N.vertexTangents;pb=Hb[0];qb=Hb[1];rb=Hb[2];ya[ra]=pb.x;ya[ra+1]=pb.y;ya[ra+2]=pb.z;ya[ra+3]=pb.w;ya[ra+4]=qb.x;ya[ra+5]=qb.y;ya[ra+6]=qb.z;ya[ra+7]=qb.w;ya[ra+8]=rb.x;ya[ra+9]=rb.y;ya[ra+10]=rb.z;ya[ra+11]=rb.w;ra=ra+12}I=0;for(V=pa.length;I<V;I++){N=Ga[pa[I]];Hb=N.vertexTangents;pb=Hb[0];qb=Hb[1];rb=Hb[2];rc=Hb[3];ya[ra]=pb.x;ya[ra+1]=pb.y;ya[ra+2]=pb.z;ya[ra+3]=pb.w;ya[ra+4]=qb.x;ya[ra+5]=qb.y;ya[ra+6]=qb.z;ya[ra+7]=qb.w;
+ya[ra+8]=rb.x;ya[ra+9]=rb.y;ya[ra+10]=rb.z;ya[ra+11]=rb.w;ya[ra+12]=rc.x;ya[ra+13]=rc.y;ya[ra+14]=rc.z;ya[ra+15]=rc.w;ra=ra+16}i.bindBuffer(i.ARRAY_BUFFER,ha.__webglTangentBuffer);i.bufferData(i.ARRAY_BUFFER,ya,eb)}if(sd&&dd){I=0;for(V=oa.length;I<V;I++){N=Ga[oa[I]];jc=N.vertexNormals;Ob=N.normal;if(jc.length===3&&Fc)for(na=0;na<3;na++){Vb=jc[na];jb[Va]=Vb.x;jb[Va+1]=Vb.y;jb[Va+2]=Vb.z;Va=Va+3}else for(na=0;na<3;na++){jb[Va]=Ob.x;jb[Va+1]=Ob.y;jb[Va+2]=Ob.z;Va=Va+3}}I=0;for(V=pa.length;I<V;I++){N=
+Ga[pa[I]];jc=N.vertexNormals;Ob=N.normal;if(jc.length===4&&Fc)for(na=0;na<4;na++){Vb=jc[na];jb[Va]=Vb.x;jb[Va+1]=Vb.y;jb[Va+2]=Vb.z;Va=Va+3}else for(na=0;na<4;na++){jb[Va]=Ob.x;jb[Va+1]=Ob.y;jb[Va+2]=Ob.z;Va=Va+3}}i.bindBuffer(i.ARRAY_BUFFER,ha.__webglNormalBuffer);i.bufferData(i.ARRAY_BUFFER,jb,eb)}if(hd&&Zc&&ed){I=0;for(V=oa.length;I<V;I++){lb=oa[I];N=Ga[lb];kc=Zc[lb];if(kc!==void 0)for(na=0;na<3;na++){mc=kc[na];wc[Jb]=mc.u;wc[Jb+1]=mc.v;Jb=Jb+2}}I=0;for(V=pa.length;I<V;I++){lb=pa[I];N=Ga[lb];kc=
+Zc[lb];if(kc!==void 0)for(na=0;na<4;na++){mc=kc[na];wc[Jb]=mc.u;wc[Jb+1]=mc.v;Jb=Jb+2}}if(Jb>0){i.bindBuffer(i.ARRAY_BUFFER,ha.__webglUVBuffer);i.bufferData(i.ARRAY_BUFFER,wc,eb)}}if(hd&&$c&&ed){I=0;for(V=oa.length;I<V;I++){lb=oa[I];N=Ga[lb];lc=$c[lb];if(lc!==void 0)for(na=0;na<3;na++){nc=lc[na];xc[Kb]=nc.u;xc[Kb+1]=nc.v;Kb=Kb+2}}I=0;for(V=pa.length;I<V;I++){lb=pa[I];N=Ga[lb];lc=$c[lb];if(lc!==void 0)for(na=0;na<4;na++){nc=lc[na];xc[Kb]=nc.u;xc[Kb+1]=nc.v;Kb=Kb+2}}if(Kb>0){i.bindBuffer(i.ARRAY_BUFFER,
+ha.__webglUV2Buffer);i.bufferData(i.ARRAY_BUFFER,xc,eb)}}if(rd){I=0;for(V=oa.length;I<V;I++){N=Ga[oa[I]];Eb[ib]=Ea;Eb[ib+1]=Ea+1;Eb[ib+2]=Ea+2;ib=ib+3;gb[Za]=Ea;gb[Za+1]=Ea+1;gb[Za+2]=Ea;gb[Za+3]=Ea+2;gb[Za+4]=Ea+1;gb[Za+5]=Ea+2;Za=Za+6;Ea=Ea+3}I=0;for(V=pa.length;I<V;I++){N=Ga[pa[I]];Eb[ib]=Ea;Eb[ib+1]=Ea+1;Eb[ib+2]=Ea+3;Eb[ib+3]=Ea+1;Eb[ib+4]=Ea+2;Eb[ib+5]=Ea+3;ib=ib+6;gb[Za]=Ea;gb[Za+1]=Ea+1;gb[Za+2]=Ea;gb[Za+3]=Ea+3;gb[Za+4]=Ea+1;gb[Za+5]=Ea+2;gb[Za+6]=Ea+2;gb[Za+7]=Ea+3;Za=Za+8;Ea=Ea+4}i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,
+ha.__webglFaceBuffer);i.bufferData(i.ELEMENT_ARRAY_BUFFER,Eb,eb);i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,ha.__webglLineBuffer);i.bufferData(i.ELEMENT_ARRAY_BUFFER,gb,eb)}if(Yc){na=0;for(fd=Yc.length;na<fd;na++){y=Yc[na];if(y.__original.needsUpdate){D=0;if(y.size===1)if(y.boundTo===void 0||y.boundTo==="vertices"){I=0;for(V=oa.length;I<V;I++){N=Ga[oa[I]];y.array[D]=y.value[N.a];y.array[D+1]=y.value[N.b];y.array[D+2]=y.value[N.c];D=D+3}I=0;for(V=pa.length;I<V;I++){N=Ga[pa[I]];y.array[D]=y.value[N.a];y.array[D+
+1]=y.value[N.b];y.array[D+2]=y.value[N.c];y.array[D+3]=y.value[N.d];D=D+4}}else{if(y.boundTo==="faces"){I=0;for(V=oa.length;I<V;I++){fb=y.value[oa[I]];y.array[D]=fb;y.array[D+1]=fb;y.array[D+2]=fb;D=D+3}I=0;for(V=pa.length;I<V;I++){fb=y.value[pa[I]];y.array[D]=fb;y.array[D+1]=fb;y.array[D+2]=fb;y.array[D+3]=fb;D=D+4}}}else if(y.size===2)if(y.boundTo===void 0||y.boundTo==="vertices"){I=0;for(V=oa.length;I<V;I++){N=Ga[oa[I]];Z=y.value[N.a];$=y.value[N.b];aa=y.value[N.c];y.array[D]=Z.x;y.array[D+1]=
+Z.y;y.array[D+2]=$.x;y.array[D+3]=$.y;y.array[D+4]=aa.x;y.array[D+5]=aa.y;D=D+6}I=0;for(V=pa.length;I<V;I++){N=Ga[pa[I]];Z=y.value[N.a];$=y.value[N.b];aa=y.value[N.c];qa=y.value[N.d];y.array[D]=Z.x;y.array[D+1]=Z.y;y.array[D+2]=$.x;y.array[D+3]=$.y;y.array[D+4]=aa.x;y.array[D+5]=aa.y;y.array[D+6]=qa.x;y.array[D+7]=qa.y;D=D+8}}else{if(y.boundTo==="faces"){I=0;for(V=oa.length;I<V;I++){aa=$=Z=fb=y.value[oa[I]];y.array[D]=Z.x;y.array[D+1]=Z.y;y.array[D+2]=$.x;y.array[D+3]=$.y;y.array[D+4]=aa.x;y.array[D+
+5]=aa.y;D=D+6}I=0;for(V=pa.length;I<V;I++){qa=aa=$=Z=fb=y.value[pa[I]];y.array[D]=Z.x;y.array[D+1]=Z.y;y.array[D+2]=$.x;y.array[D+3]=$.y;y.array[D+4]=aa.x;y.array[D+5]=aa.y;y.array[D+6]=qa.x;y.array[D+7]=qa.y;D=D+8}}}else if(y.size===3){var ia;ia=y.type==="c"?["r","g","b"]:["x","y","z"];if(y.boundTo===void 0||y.boundTo==="vertices"){I=0;for(V=oa.length;I<V;I++){N=Ga[oa[I]];Z=y.value[N.a];$=y.value[N.b];aa=y.value[N.c];y.array[D]=Z[ia[0]];y.array[D+1]=Z[ia[1]];y.array[D+2]=Z[ia[2]];y.array[D+3]=$[ia[0]];
+y.array[D+4]=$[ia[1]];y.array[D+5]=$[ia[2]];y.array[D+6]=aa[ia[0]];y.array[D+7]=aa[ia[1]];y.array[D+8]=aa[ia[2]];D=D+9}I=0;for(V=pa.length;I<V;I++){N=Ga[pa[I]];Z=y.value[N.a];$=y.value[N.b];aa=y.value[N.c];qa=y.value[N.d];y.array[D]=Z[ia[0]];y.array[D+1]=Z[ia[1]];y.array[D+2]=Z[ia[2]];y.array[D+3]=$[ia[0]];y.array[D+4]=$[ia[1]];y.array[D+5]=$[ia[2]];y.array[D+6]=aa[ia[0]];y.array[D+7]=aa[ia[1]];y.array[D+8]=aa[ia[2]];y.array[D+9]=qa[ia[0]];y.array[D+10]=qa[ia[1]];y.array[D+11]=qa[ia[2]];D=D+12}}else if(y.boundTo===
+"faces"){I=0;for(V=oa.length;I<V;I++){aa=$=Z=fb=y.value[oa[I]];y.array[D]=Z[ia[0]];y.array[D+1]=Z[ia[1]];y.array[D+2]=Z[ia[2]];y.array[D+3]=$[ia[0]];y.array[D+4]=$[ia[1]];y.array[D+5]=$[ia[2]];y.array[D+6]=aa[ia[0]];y.array[D+7]=aa[ia[1]];y.array[D+8]=aa[ia[2]];D=D+9}I=0;for(V=pa.length;I<V;I++){qa=aa=$=Z=fb=y.value[pa[I]];y.array[D]=Z[ia[0]];y.array[D+1]=Z[ia[1]];y.array[D+2]=Z[ia[2]];y.array[D+3]=$[ia[0]];y.array[D+4]=$[ia[1]];y.array[D+5]=$[ia[2]];y.array[D+6]=aa[ia[0]];y.array[D+7]=aa[ia[1]];
+y.array[D+8]=aa[ia[2]];y.array[D+9]=qa[ia[0]];y.array[D+10]=qa[ia[1]];y.array[D+11]=qa[ia[2]];D=D+12}}}else if(y.size===4)if(y.boundTo===void 0||y.boundTo==="vertices"){I=0;for(V=oa.length;I<V;I++){N=Ga[oa[I]];Z=y.value[N.a];$=y.value[N.b];aa=y.value[N.c];y.array[D]=Z.x;y.array[D+1]=Z.y;y.array[D+2]=Z.z;y.array[D+3]=Z.w;y.array[D+4]=$.x;y.array[D+5]=$.y;y.array[D+6]=$.z;y.array[D+7]=$.w;y.array[D+8]=aa.x;y.array[D+9]=aa.y;y.array[D+10]=aa.z;y.array[D+11]=aa.w;D=D+12}I=0;for(V=pa.length;I<V;I++){N=
+Ga[pa[I]];Z=y.value[N.a];$=y.value[N.b];aa=y.value[N.c];qa=y.value[N.d];y.array[D]=Z.x;y.array[D+1]=Z.y;y.array[D+2]=Z.z;y.array[D+3]=Z.w;y.array[D+4]=$.x;y.array[D+5]=$.y;y.array[D+6]=$.z;y.array[D+7]=$.w;y.array[D+8]=aa.x;y.array[D+9]=aa.y;y.array[D+10]=aa.z;y.array[D+11]=aa.w;y.array[D+12]=qa.x;y.array[D+13]=qa.y;y.array[D+14]=qa.z;y.array[D+15]=qa.w;D=D+16}}else if(y.boundTo==="faces"){I=0;for(V=oa.length;I<V;I++){aa=$=Z=fb=y.value[oa[I]];y.array[D]=Z.x;y.array[D+1]=Z.y;y.array[D+2]=Z.z;y.array[D+
+3]=Z.w;y.array[D+4]=$.x;y.array[D+5]=$.y;y.array[D+6]=$.z;y.array[D+7]=$.w;y.array[D+8]=aa.x;y.array[D+9]=aa.y;y.array[D+10]=aa.z;y.array[D+11]=aa.w;D=D+12}I=0;for(V=pa.length;I<V;I++){qa=aa=$=Z=fb=y.value[pa[I]];y.array[D]=Z.x;y.array[D+1]=Z.y;y.array[D+2]=Z.z;y.array[D+3]=Z.w;y.array[D+4]=$.x;y.array[D+5]=$.y;y.array[D+6]=$.z;y.array[D+7]=$.w;y.array[D+8]=aa.x;y.array[D+9]=aa.y;y.array[D+10]=aa.z;y.array[D+11]=aa.w;y.array[D+12]=qa.x;y.array[D+13]=qa.y;y.array[D+14]=qa.z;y.array[D+15]=qa.w;D=D+
+16}}i.bindBuffer(i.ARRAY_BUFFER,y.buffer);i.bufferData(i.ARRAY_BUFFER,y.array,eb)}}}if(qd){delete ha.__inittedArrays;delete ha.__colorArray;delete ha.__normalArray;delete ha.__tangentArray;delete ha.__uvArray;delete ha.__uv2Array;delete ha.__faceArray;delete ha.__vertexArray;delete ha.__lineArray;delete ha.__skinVertexAArray;delete ha.__skinVertexBArray;delete ha.__skinIndexArray;delete ha.__skinWeightArray}}}}ka.__dirtyVertices=false;ka.__dirtyMorphTargets=false;ka.__dirtyElements=false;ka.__dirtyUvs=
+false;ka.__dirtyNormals=false;ka.__dirtyColors=false;ka.__dirtyTangents=false;bb.attributes&&n(bb)}else if(nb 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];$b=yc*3;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=zc*3;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=false;ka.__dirtyColors=false}else if(nb instanceof THREE.Line){bb=c(nb,qc);ic=bb.attributes&&o(bb);if(ka.__dirtyVertices||ka.__dirtyColors||ic){var Lb=ka,ad=i.DYNAMIC_DRAW,Ac=void 0,Bc=void 0,Oc=void 0,Da=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,Ua=void 0,oc=void 0,cb=void 0,wa=void 0;if(Lb.__dirtyVertices){for(Ac=0;Ac<zd;Ac++){Oc=ld[Ac];Da=Ac*3;Qc[Da]=Oc.x;Qc[Da+1]=Oc.y;Qc[Da+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];Da=Bc*3;Rc[Da]=Pc.r;Rc[Da+1]=Pc.g;Rc[Da+2]=Pc.b}i.bindBuffer(i.ARRAY_BUFFER,Lb.__webglColorBuffer);i.bufferData(i.ARRAY_BUFFER,
+Rc,ad)}if(bd){Sc=0;for(nd=bd.length;Sc<nd;Sc++){wa=bd[Sc];if(wa.needsUpdate&&(wa.boundTo===void 0||wa.boundTo==="vertices")){Da=0;oc=wa.value.length;if(wa.size===1)for(Ua=0;Ua<oc;Ua++)wa.array[Ua]=wa.value[Ua];else if(wa.size===2)for(Ua=0;Ua<oc;Ua++){cb=wa.value[Ua];wa.array[Da]=cb.x;wa.array[Da+1]=cb.y;Da=Da+2}else if(wa.size===3)if(wa.type==="c")for(Ua=0;Ua<oc;Ua++){cb=wa.value[Ua];wa.array[Da]=cb.r;wa.array[Da+1]=cb.g;wa.array[Da+2]=cb.b;Da=Da+3}else for(Ua=0;Ua<oc;Ua++){cb=wa.value[Ua];wa.array[Da]=
+cb.x;wa.array[Da+1]=cb.y;wa.array[Da+2]=cb.z;Da=Da+3}else if(wa.size===4)for(Ua=0;Ua<oc;Ua++){cb=wa.value[Ua];wa.array[Da]=cb.x;wa.array[Da+1]=cb.y;wa.array[Da+2]=cb.z;wa.array[Da+3]=cb.w;Da=Da+4}i.bindBuffer(i.ARRAY_BUFFER,wa.buffer);i.bufferData(i.ARRAY_BUFFER,wa.array,ad)}}}}ka.__dirtyVertices=false;ka.__dirtyColors=false;bb.attributes&&n(bb)}else if(nb instanceof THREE.ParticleSystem){bb=c(nb,qc);ic=bb.attributes&&o(bb);(ka.__dirtyVertices||ka.__dirtyColors||nb.sortParticles||ic)&&f(ka,i.DYNAMIC_DRAW,
+nb);ka.__dirtyVertices=false;ka.__dirtyColors=false;bb.attributes&&n(bb)}}};this.initMaterial=function(a,b,c,d){var e,f,g;a instanceof THREE.MeshDepthMaterial?g="depth":a instanceof THREE.MeshNormalMaterial?g="normal":a instanceof THREE.MeshBasicMaterial?g="basic":a instanceof THREE.MeshLambertMaterial?g="lambert":a instanceof THREE.MeshPhongMaterial?g="phong":a instanceof THREE.LineBasicMaterial?g="basic":a instanceof THREE.ParticleBasicMaterial&&(g="particle_basic");if(g){var h=THREE.ShaderLib[g];
+a.uniforms=THREE.UniformsUtils.clone(h.uniforms);a.vertexShader=h.vertexShader;a.fragmentShader=h.fragmentShader}var j,k,l,m,n;j=m=n=h=0;for(k=b.length;j<k;j++){l=b[j];if(!l.onlyShadow){l instanceof THREE.DirectionalLight&&m++;l instanceof THREE.PointLight&&n++;l instanceof THREE.SpotLight&&h++}}if(n+h+m<=M){k=m;l=n;m=h}else{k=Math.ceil(M*m/(n+m));m=l=M-k}var o=0,h=0;for(n=b.length;h<n;h++){j=b[h];if(j.castShadow){j instanceof THREE.SpotLight&&o++;j instanceof THREE.DirectionalLight&&!j.shadowCascade&&
+o++}}var p=50;if(d!==void 0&&d instanceof THREE.SkinnedMesh)p=d.bones.length;var r;a:{n=a.fragmentShader;j=a.vertexShader;var h=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,maxBones:p,morphTargets:a.morphTargets,morphNormals:a.morphNormals,maxMorphTargets:this.maxMorphTargets,maxMorphNormals:this.maxMorphNormals,maxDirLights:k,maxPointLights:l,maxSpotLights:m,maxShadows:o,
+shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapDebug:this.shadowMapDebug,shadowMapCascade:this.shadowMapCascade,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel,wrapAround:a.wrapAround,doubleSided:d&&d.doubleSided},q,d=[];if(g)d.push(g);else{d.push(n);d.push(j)}for(q in c){d.push(q);d.push(c[q])}g=d.join();q=0;for(d=U.length;q<d;q++)if(U[q].code===g){r=U[q].program;break a}q=i.createProgram();d=["precision "+B+" float;",Xa>0?"#define VERTEX_TEXTURES":
+"",G.gammaInput?"#define GAMMA_INPUT":"",G.gammaOutput?"#define GAMMA_OUTPUT":"",G.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SPOT_LIGHTS "+c.maxSpotLights,"#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");
+k=["precision "+B+" float;","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SPOT_LIGHTS "+c.maxSpotLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",G.gammaInput?"#define GAMMA_INPUT":"",G.gammaOutput?"#define GAMMA_OUTPUT":"",G.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(q,t("fragment",j+n));i.attachShader(q,t("vertex",d+l));i.linkProgram(q);i.getProgramParameter(q,i.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+i.getProgramParameter(q,i.VALIDATE_STATUS)+", gl error ["+i.getError()+"]");q.uniforms={};q.attributes={};var s,d=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","boneGlobalMatrices","morphTargetInfluences"];for(s in h)d.push(s);s=d;d=0;for(h=s.length;d<h;d++){n=
-s[d];q.uniforms[n]=i.getUniformLocation(q,n)}d=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(s=0;s<c.maxMorphTargets;s++)d.push("morphTarget"+s);for(s=0;s<c.maxMorphNormals;s++)d.push("morphNormal"+s);for(r in b)d.push(r);r=d;s=0;for(b=r.length;s<b;s++){c=r[s];q.attributes[c]=i.getAttribLocation(q,c)}q.id=U.length;U.push({program:q,code:g});E.info.memory.programs=U.length;r=q}a.program=r;r=a.program.attributes;r.position>=0&&i.enableVertexAttribArray(r.position);
+i.attachShader(q,t("fragment",k+n));i.attachShader(q,t("vertex",d+j));i.linkProgram(q);i.getProgramParameter(q,i.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+i.getProgramParameter(q,i.VALIDATE_STATUS)+", gl error ["+i.getError()+"]");q.uniforms={};q.attributes={};var s,d=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","boneGlobalMatrices","morphTargetInfluences"];for(s in h)d.push(s);s=d;d=0;for(h=s.length;d<h;d++){n=
+s[d];q.uniforms[n]=i.getUniformLocation(q,n)}d=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(s=0;s<c.maxMorphTargets;s++)d.push("morphTarget"+s);for(s=0;s<c.maxMorphNormals;s++)d.push("morphNormal"+s);for(r in b)d.push(r);r=d;s=0;for(b=r.length;s<b;s++){c=r[s];q.attributes[c]=i.getAttribLocation(q,c)}q.id=U.length;U.push({program:q,code:g});G.info.memory.programs=U.length;r=q}a.program=r;r=a.program.attributes;r.position>=0&&i.enableVertexAttribArray(r.position);
 r.color>=0&&i.enableVertexAttribArray(r.color);r.normal>=0&&i.enableVertexAttribArray(r.normal);r.tangent>=0&&i.enableVertexAttribArray(r.tangent);if(a.skinning&&r.skinVertexA>=0&&r.skinVertexB>=0&&r.skinIndex>=0&&r.skinWeight>=0){i.enableVertexAttribArray(r.skinVertexA);i.enableVertexAttribArray(r.skinVertexB);i.enableVertexAttribArray(r.skinIndex);i.enableVertexAttribArray(r.skinWeight)}if(a.attributes)for(f in a.attributes)r[f]!==void 0&&r[f]>=0&&i.enableVertexAttribArray(r[f]);if(a.morphTargets){a.numSupportedMorphTargets=
 0;q="morphTarget";for(f=0;f<this.maxMorphTargets;f++){s=q+f;if(r[s]>=0){i.enableVertexAttribArray(r[s]);a.numSupportedMorphTargets++}}}if(a.morphNormals){a.numSupportedMorphNormals=0;q="morphNormal";for(f=0;f<this.maxMorphNormals;f++){s=q+f;if(r[s]>=0){i.enableVertexAttribArray(r[s]);a.numSupportedMorphNormals++}}}a.uniformsList=[];for(e in a.uniforms)a.uniformsList.push([a.uniforms[e],e])};this.setFaceCulling=function(a,b){if(a){!b||b==="ccw"?i.frontFace(i.CCW):i.frontFace(i.CW);a==="back"?i.cullFace(i.BACK):
-a==="front"?i.cullFace(i.FRONT):i.cullFace(i.FRONT_AND_BACK);i.enable(i.CULL_FACE)}else i.disable(i.CULL_FACE)};this.setObjectFaces=function(a){if(la!==a.doubleSided){a.doubleSided?i.disable(i.CULL_FACE):i.enable(i.CULL_FACE);la=a.doubleSided}if(R!==a.flipSided){a.flipSided?i.frontFace(i.CW):i.frontFace(i.CCW);R=a.flipSided}};this.setDepthTest=function(a){if(Ma!==a){a?i.enable(i.DEPTH_TEST):i.disable(i.DEPTH_TEST);Ma=a}};this.setDepthWrite=function(a){if(xa!==a){i.depthMask(a);xa=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(D(b));ba=b}if(c!==aa||d!==ea){i.blendFunc(D(c),D(d));aa=c;ea=d}}else ea=aa=ba=null};this.setTexture=function(a,b){if(a.needsUpdate){if(!a.__webglInit){a.__webglInit=true;a.__webglTexture=i.createTexture();E.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=(c.width&c.width-1)===0&&(c.height&c.height-1)===0,e=D(a.format),f=D(a.type);x(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=false;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(a.depthBuffer===void 0)a.depthBuffer=true;if(a.stencilBuffer===void 0)a.stencilBuffer=true;a.__webglTexture=i.createTexture();var c=(a.width&a.width-1)===0&&(a.height&a.height-1)===0,d=D(a.format),e=D(a.type);if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];i.bindTexture(i.TEXTURE_CUBE_MAP,a.__webglTexture);x(i.TEXTURE_CUBE_MAP,a,c);for(var f=0;f<6;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);s(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);x(i.TEXTURE_2D,a,c);i.texImage2D(i.TEXTURE_2D,
+a==="front"?i.cullFace(i.FRONT):i.cullFace(i.FRONT_AND_BACK);i.enable(i.CULL_FACE)}else i.disable(i.CULL_FACE)};this.setObjectFaces=function(a){if(la!==a.doubleSided){a.doubleSided?i.disable(i.CULL_FACE):i.enable(i.CULL_FACE);la=a.doubleSided}if(P!==a.flipSided){a.flipSided?i.frontFace(i.CW):i.frontFace(i.CCW);P=a.flipSided}};this.setDepthTest=function(a){if(Ma!==a){a?i.enable(i.DEPTH_TEST):i.disable(i.DEPTH_TEST);Ma=a}};this.setDepthWrite=function(a){if(xa!==a){i.depthMask(a);xa=a}};this.setBlending=
+function(a,b,c,d){if(a!==S){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)}S=a}if(a===THREE.CustomBlending){if(b!==ca){i.blendEquation(F(b));ca=b}if(c!==T||d!==fa){i.blendFunc(F(c),F(d));T=c;fa=d}}else fa=T=ca=null};this.setTexture=function(a,b){if(a.needsUpdate){if(!a.__webglInit){a.__webglInit=true;a.__webglTexture=i.createTexture();G.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=(c.width&c.width-1)===0&&(c.height&c.height-1)===0,e=F(a.format),f=F(a.type);w(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=false;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(a.depthBuffer===void 0)a.depthBuffer=true;if(a.stencilBuffer===void 0)a.stencilBuffer=true;a.__webglTexture=i.createTexture();var c=(a.width&a.width-1)===0&&(a.height&a.height-1)===0,d=F(a.format),e=F(a.type);if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];i.bindTexture(i.TEXTURE_CUBE_MAP,a.__webglTexture);w(i.TEXTURE_CUBE_MAP,a,c);for(var f=0;f<6;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);s(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);w(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);s(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)}if(a){b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer;c=a.width;a=a.height;e=d=0}else{b=null;
-c=Ja;a=db;d=Wa;e=Ya}if(b!==L){i.bindFramebuffer(i.FRAMEBUFFER,b);i.viewport(d,e,c,a);L=b}hb=c;mb=a};this.shadowMapPlugin=new THREE.ShadowMapPlugin;this.addPrePlugin(this.shadowMapPlugin);this.addPostPlugin(new THREE.SpritePlugin);this.addPostPlugin(new THREE.LensFlarePlugin)};
+c=Ja;a=db;d=Wa;e=Ya}if(b!==C){i.bindFramebuffer(i.FRAMEBUFFER,b);i.viewport(d,e,c,a);C=b}hb=c;mb=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=c.wrapS!==void 0?c.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=c.wrapT!==void 0?c.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=c.magFilter!==void 0?c.magFilter:THREE.LinearFilter;this.minFilter=c.minFilter!==void 0?c.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=c.format!==void 0?c.format:THREE.RGBAFormat;this.type=c.type!==void 0?c.type:
 THREE.UnsignedByteType;this.depthBuffer=c.depthBuffer!==void 0?c.depthBuffer:true;this.stencilBuffer=c.stencilBuffer!==void 0?c.stencilBuffer:true;this.generateMipmaps=true};
 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};
@@ -387,31 +387,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;c<0&&(c=c+1);c>1&&(c=c-1)}b===void 0&&(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,l=a.faces,k=f.faces,j=a.faceVertexUvs[0],o=f.faceVertexUvs[0],m={},p=0;p<a.materials.length;p++)m[a.materials[p].id]=p;if(b instanceof THREE.Mesh){b.matrixAutoUpdate&&b.updateMatrix();c=b.matrix;d=new THREE.Matrix4;d.extractRotation(c,b.scale)}for(var p=0,r=h.length;p<r;p++){var n=h[p].clone();c&&c.multiplyVector3(n);g.push(n)}p=0;for(r=k.length;p<r;p++){var g=
-k[p],q,u,t=g.vertexNormals,x=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=t.length;h<n;h++){u=t[h].clone();d&&d.multiplyVector3(u);q.vertexNormals.push(u)}q.color.copy(g.color);h=0;for(n=x.length;h<n;h++){u=x[h];q.vertexColors.push(u.clone())}if(g.materialIndex!==void 0){h=f.materials[g.materialIndex];n=h.id;x=m[n];if(x===void 0){x=
-a.materials.length;m[n]=x;a.materials.push(h)}q.materialIndex=x}q.centroid.copy(g.centroid);c&&c.multiplyVector3(q.centroid);l.push(q)}p=0;for(r=o.length;p<r;p++){c=o[p];d=[];h=0;for(n=c.length;h<n;h++)d.push(new THREE.UV(c[h].u,c[h].v));j.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();a=0;for(c=d.length;a<c;a++)b.vertices.push(d[a].clone());a=0;for(c=e.length;a<c;a++)b.faces.push(e[a].clone());a=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,k=a.faces,j=f.faces,l=a.faceVertexUvs[0],o=f.faceVertexUvs[0],n={},p=0;p<a.materials.length;p++)n[a.materials[p].id]=p;if(b instanceof THREE.Mesh){b.matrixAutoUpdate&&b.updateMatrix();c=b.matrix;d=new THREE.Matrix4;d.extractRotation(c,b.scale)}for(var p=0,r=h.length;p<r;p++){var m=h[p].clone();c&&c.multiplyVector3(m);g.push(m)}p=0;for(r=j.length;p<r;p++){var g=
+j[p],q,u,t=g.vertexNormals,w=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(m=t.length;h<m;h++){u=t[h].clone();d&&d.multiplyVector3(u);q.vertexNormals.push(u)}q.color.copy(g.color);h=0;for(m=w.length;h<m;h++){u=w[h];q.vertexColors.push(u.clone())}if(g.materialIndex!==void 0){h=f.materials[g.materialIndex];m=h.id;w=n[m];if(w===void 0){w=
+a.materials.length;n[m]=w;a.materials.push(h)}q.materialIndex=w}q.centroid.copy(g.centroid);c&&c.multiplyVector3(q.centroid);k.push(q)}p=0;for(r=o.length;p<r;p++){c=o[p];d=[];h=0;for(m=c.length;h<m;h++)d.push(new THREE.UV(c[h].u,c[h].v));l.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();a=0;for(c=d.length;a<c;a++)b.vertices.push(d[a].clone());a=0;for(c=e.length;a<c;a++)b.faces.push(e[a].clone());a=0;
 for(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();if(d+e>1){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){d=b.vertices[a.a];e=b.vertices[a.b];f=b.vertices[a.c];return THREE.GeometryUtils.randomPointInTriangle(d,e,f)}if(a instanceof THREE.Face4){d=b.vertices[a.a];e=b.vertices[a.b];f=b.vertices[a.c];var b=b.vertices[a.d],g;if(c)if(a._area1&&a._area2){c=a._area1;g=a._area2}else{c=THREE.GeometryUtils.triangleArea(d,e,b);g=THREE.GeometryUtils.triangleArea(e,f,b);a._area1=c;a._area2=g}else{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 k[e]>a?b(c,e-1):k[e]<a?b(e+1,d):e}return b(0,k.length-1)}var d,e,f=a.faces,g=a.vertices,h=f.length,l=0,k=[],j,o,m,p;for(e=0;e<h;e++){d=f[e];if(d instanceof THREE.Face3){j=g[d.a];o=g[d.b];m=g[d.c];d._area=THREE.GeometryUtils.triangleArea(j,o,m)}else if(d instanceof THREE.Face4){j=
-g[d.a];o=g[d.b];m=g[d.c];p=g[d.d];d._area1=THREE.GeometryUtils.triangleArea(j,o,p);d._area2=THREE.GeometryUtils.triangleArea(o,m,p);d._area=d._area1+d._area2}l=l+d._area;k[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,true)}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();
+(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,k=0,j=[],l,o,n,p;for(e=0;e<h;e++){d=f[e];if(d instanceof THREE.Face3){l=g[d.a];o=g[d.b];n=g[d.c];d._area=THREE.GeometryUtils.triangleArea(l,o,n)}else if(d instanceof THREE.Face4){l=
+g[d.a];o=g[d.b];n=g[d.c];p=g[d.d];d._area1=THREE.GeometryUtils.triangleArea(l,o,p);d._area2=THREE.GeometryUtils.triangleArea(o,n,p);d._area=d._area1+d._area2}k=k+d._area;j[e]=k}d=[];for(e=0;e<b;e++){g=THREE.GeometryUtils.random()*k;g=c(g);d[e]=THREE.GeometryUtils.randomPointInFace(f[g],a,true)}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++){if(d[e].u!==1)d[e].u=d[e].u-Math.floor(d[e].u);if(d[e].v!==1)d[e].v=d[e].v-Math.floor(d[e].v)}},triangulateQuads:function(a){var b,c,d,e,f=[],g=[],h=[];b=0;for(c=a.faceUvs.length;b<c;b++)g[b]=[];b=0;for(c=a.faceVertexUvs.length;b<
-c;b++)h[b]=[];b=0;for(c=a.faces.length;b<c;b++){d=a.faces[b];if(d instanceof THREE.Face4){e=d.a;var l=d.b,k=d.c,j=d.d,o=new THREE.Face3,m=new THREE.Face3;o.color.copy(d.color);m.color.copy(d.color);o.materialIndex=d.materialIndex;m.materialIndex=d.materialIndex;o.a=e;o.b=l;o.c=j;m.a=l;m.b=k;m.c=j;if(d.vertexColors.length===4){o.vertexColors[0]=d.vertexColors[0].clone();o.vertexColors[1]=d.vertexColors[1].clone();o.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(o,m);d=0;for(e=a.faceVertexUvs.length;d<e;d++)if(a.faceVertexUvs[d].length){o=a.faceVertexUvs[d][b];l=o[1];k=o[2];j=o[3];o=[o[0].clone(),l.clone(),j.clone()];l=[l.clone(),k.clone(),j.clone()];h[d].push(o,l)}d=0;for(e=a.faceUvs.length;d<e;d++)if(a.faceUvs[d].length){l=a.faceUvs[d][b];g[d].push(l,l)}}else{f.push(d);d=0;for(e=a.faceUvs.length;d<e;d++)g[d].push(a.faceUvs[d]);d=0;for(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],k=a.vertices[f.d];b.push(g.clone());b.push(h.clone());b.push(l.clone());b.push(k.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,k,j,o,m,p,r,n,q,u,t,x,s,z=[],D=[];c=0;for(d=a.faceVertexUvs.length;c<d;c++)D[c]=[];c=0;for(d=a.faces.length;c<d;c++){e=a.faces[c];if(e instanceof THREE.Face3){f=e.a;g=e.b;h=e.c;k=a.vertices[f];j=a.vertices[g];o=a.vertices[h];p=k.distanceTo(j);r=j.distanceTo(o);m=k.distanceTo(o);if(p>
-b||r>b||m>b){l=a.vertices.length;x=e.clone();s=e.clone();if(p>=r&&p>=m){k=k.clone();k.lerpSelf(j,0.5);x.a=f;x.b=l;x.c=h;s.a=l;s.b=g;s.c=h;if(e.vertexNormals.length===3){f=e.vertexNormals[0].clone();f.lerpSelf(e.vertexNormals[1],0.5);x.vertexNormals[1].copy(f);s.vertexNormals[0].copy(f)}if(e.vertexColors.length===3){f=e.vertexColors[0].clone();f.lerpSelf(e.vertexColors[1],0.5);x.vertexColors[1].copy(f);s.vertexColors[0].copy(f)}e=0}else if(r>=p&&r>=m){k=j.clone();k.lerpSelf(o,0.5);x.a=f;x.b=g;x.c=
-l;s.a=l;s.b=h;s.c=f;if(e.vertexNormals.length===3){f=e.vertexNormals[1].clone();f.lerpSelf(e.vertexNormals[2],0.5);x.vertexNormals[2].copy(f);s.vertexNormals[0].copy(f);s.vertexNormals[1].copy(e.vertexNormals[2]);s.vertexNormals[2].copy(e.vertexNormals[0])}if(e.vertexColors.length===3){f=e.vertexColors[1].clone();f.lerpSelf(e.vertexColors[2],0.5);x.vertexColors[2].copy(f);s.vertexColors[0].copy(f);s.vertexColors[1].copy(e.vertexColors[2]);s.vertexColors[2].copy(e.vertexColors[0])}e=1}else{k=k.clone();
-k.lerpSelf(o,0.5);x.a=f;x.b=g;x.c=l;s.a=l;s.b=g;s.c=h;if(e.vertexNormals.length===3){f=e.vertexNormals[0].clone();f.lerpSelf(e.vertexNormals[2],0.5);x.vertexNormals[2].copy(f);s.vertexNormals[0].copy(f)}if(e.vertexColors.length===3){f=e.vertexColors[0].clone();f.lerpSelf(e.vertexColors[2],0.5);x.vertexColors[2].copy(f);s.vertexColors[0].copy(f)}e=2}z.push(x,s);a.vertices.push(k);f=0;for(g=a.faceVertexUvs.length;f<g;f++)if(a.faceVertexUvs[f].length){k=a.faceVertexUvs[f][c];s=k[0];h=k[1];x=k[2];if(e===
-0){j=s.clone();j.lerpSelf(h,0.5);k=[s.clone(),j.clone(),x.clone()];h=[j.clone(),h.clone(),x.clone()]}else if(e===1){j=h.clone();j.lerpSelf(x,0.5);k=[s.clone(),h.clone(),j.clone()];h=[j.clone(),x.clone(),s.clone()]}else{j=s.clone();j.lerpSelf(x,0.5);k=[s.clone(),h.clone(),j.clone()];h=[j.clone(),h.clone(),x.clone()]}D[f].push(k,h)}}else{z.push(e);f=0;for(g=a.faceVertexUvs.length;f<g;f++)D[f].push(a.faceVertexUvs[f][c])}}else{f=e.a;g=e.b;h=e.c;l=e.d;k=a.vertices[f];j=a.vertices[g];o=a.vertices[h];m=
-a.vertices[l];p=k.distanceTo(j);r=j.distanceTo(o);n=o.distanceTo(m);q=k.distanceTo(m);if(p>b||r>b||n>b||q>b){u=a.vertices.length;t=a.vertices.length+1;x=e.clone();s=e.clone();if(p>=r&&p>=n&&p>=q||n>=r&&n>=p&&n>=q){p=k.clone();p.lerpSelf(j,0.5);j=o.clone();j.lerpSelf(m,0.5);x.a=f;x.b=u;x.c=t;x.d=l;s.a=u;s.b=g;s.c=h;s.d=t;if(e.vertexNormals.length===4){f=e.vertexNormals[0].clone();f.lerpSelf(e.vertexNormals[1],0.5);g=e.vertexNormals[2].clone();g.lerpSelf(e.vertexNormals[3],0.5);x.vertexNormals[1].copy(f);
-x.vertexNormals[2].copy(g);s.vertexNormals[0].copy(f);s.vertexNormals[3].copy(g)}if(e.vertexColors.length===4){f=e.vertexColors[0].clone();f.lerpSelf(e.vertexColors[1],0.5);g=e.vertexColors[2].clone();g.lerpSelf(e.vertexColors[3],0.5);x.vertexColors[1].copy(f);x.vertexColors[2].copy(g);s.vertexColors[0].copy(f);s.vertexColors[3].copy(g)}e=0}else{p=j.clone();p.lerpSelf(o,0.5);j=m.clone();j.lerpSelf(k,0.5);x.a=f;x.b=g;x.c=u;x.d=t;s.a=t;s.b=u;s.c=h;s.d=l;if(e.vertexNormals.length===4){f=e.vertexNormals[1].clone();
-f.lerpSelf(e.vertexNormals[2],0.5);g=e.vertexNormals[3].clone();g.lerpSelf(e.vertexNormals[0],0.5);x.vertexNormals[2].copy(f);x.vertexNormals[3].copy(g);s.vertexNormals[0].copy(g);s.vertexNormals[1].copy(f)}if(e.vertexColors.length===4){f=e.vertexColors[1].clone();f.lerpSelf(e.vertexColors[2],0.5);g=e.vertexColors[3].clone();g.lerpSelf(e.vertexColors[0],0.5);x.vertexColors[2].copy(f);x.vertexColors[3].copy(g);s.vertexColors[0].copy(g);s.vertexColors[1].copy(f)}e=1}z.push(x,s);a.vertices.push(p,j);
-f=0;for(g=a.faceVertexUvs.length;f<g;f++)if(a.faceVertexUvs[f].length){k=a.faceVertexUvs[f][c];s=k[0];h=k[1];x=k[2];k=k[3];if(e===0){j=s.clone();j.lerpSelf(h,0.5);o=x.clone();o.lerpSelf(k,0.5);s=[s.clone(),j.clone(),o.clone(),k.clone()];h=[j.clone(),h.clone(),x.clone(),o.clone()]}else{j=h.clone();j.lerpSelf(x,0.5);o=k.clone();o.lerpSelf(s,0.5);s=[s.clone(),h.clone(),j.clone(),o.clone()];h=[o.clone(),j.clone(),x.clone(),k.clone()]}D[f].push(s,h)}}else{z.push(e);f=0;for(g=a.faceVertexUvs.length;f<g;f++)D[f].push(a.faceVertexUvs[f][c])}}}a.faces=
-z;a.faceVertexUvs=D}};THREE.GeometryUtils.random=THREE.Math.random16;THREE.GeometryUtils.__v1=new THREE.Vector3;
+c;b++)h[b]=[];b=0;for(c=a.faces.length;b<c;b++){d=a.faces[b];if(d instanceof THREE.Face4){e=d.a;var k=d.b,j=d.c,l=d.d,o=new THREE.Face3,n=new THREE.Face3;o.color.copy(d.color);n.color.copy(d.color);o.materialIndex=d.materialIndex;n.materialIndex=d.materialIndex;o.a=e;o.b=k;o.c=l;n.a=k;n.b=j;n.c=l;if(d.vertexColors.length===4){o.vertexColors[0]=d.vertexColors[0].clone();o.vertexColors[1]=d.vertexColors[1].clone();o.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(o,n);d=0;for(e=a.faceVertexUvs.length;d<e;d++)if(a.faceVertexUvs[d].length){o=a.faceVertexUvs[d][b];k=o[1];j=o[2];l=o[3];o=[o[0].clone(),k.clone(),l.clone()];k=[k.clone(),j.clone(),l.clone()];h[d].push(o,k)}d=0;for(e=a.faceUvs.length;d<e;d++)if(a.faceUvs[d].length){k=a.faceUvs[d][b];g[d].push(k,k)}}else{f.push(d);d=0;for(e=a.faceUvs.length;d<e;d++)g[d].push(a.faceUvs[d]);d=0;for(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,k=f.c,g=a.vertices[g],h=a.vertices[h],k=a.vertices[k],j=a.vertices[f.d];b.push(g.clone());b.push(h.clone());b.push(k.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;k=f.c;g=a.vertices[g];h=a.vertices[h];k=a.vertices[k];b.push(g.clone());b.push(h.clone());b.push(k.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,k,j,l,o,n,p,r,m,q,u,t,w,s,x=[],F=[];c=0;for(d=a.faceVertexUvs.length;c<d;c++)F[c]=[];c=0;for(d=a.faces.length;c<d;c++){e=a.faces[c];if(e instanceof THREE.Face3){f=e.a;g=e.b;h=e.c;j=a.vertices[f];l=a.vertices[g];o=a.vertices[h];p=j.distanceTo(l);r=l.distanceTo(o);n=j.distanceTo(o);if(p>
+b||r>b||n>b){k=a.vertices.length;w=e.clone();s=e.clone();if(p>=r&&p>=n){j=j.clone();j.lerpSelf(l,0.5);w.a=f;w.b=k;w.c=h;s.a=k;s.b=g;s.c=h;if(e.vertexNormals.length===3){f=e.vertexNormals[0].clone();f.lerpSelf(e.vertexNormals[1],0.5);w.vertexNormals[1].copy(f);s.vertexNormals[0].copy(f)}if(e.vertexColors.length===3){f=e.vertexColors[0].clone();f.lerpSelf(e.vertexColors[1],0.5);w.vertexColors[1].copy(f);s.vertexColors[0].copy(f)}e=0}else if(r>=p&&r>=n){j=l.clone();j.lerpSelf(o,0.5);w.a=f;w.b=g;w.c=
+k;s.a=k;s.b=h;s.c=f;if(e.vertexNormals.length===3){f=e.vertexNormals[1].clone();f.lerpSelf(e.vertexNormals[2],0.5);w.vertexNormals[2].copy(f);s.vertexNormals[0].copy(f);s.vertexNormals[1].copy(e.vertexNormals[2]);s.vertexNormals[2].copy(e.vertexNormals[0])}if(e.vertexColors.length===3){f=e.vertexColors[1].clone();f.lerpSelf(e.vertexColors[2],0.5);w.vertexColors[2].copy(f);s.vertexColors[0].copy(f);s.vertexColors[1].copy(e.vertexColors[2]);s.vertexColors[2].copy(e.vertexColors[0])}e=1}else{j=j.clone();
+j.lerpSelf(o,0.5);w.a=f;w.b=g;w.c=k;s.a=k;s.b=g;s.c=h;if(e.vertexNormals.length===3){f=e.vertexNormals[0].clone();f.lerpSelf(e.vertexNormals[2],0.5);w.vertexNormals[2].copy(f);s.vertexNormals[0].copy(f)}if(e.vertexColors.length===3){f=e.vertexColors[0].clone();f.lerpSelf(e.vertexColors[2],0.5);w.vertexColors[2].copy(f);s.vertexColors[0].copy(f)}e=2}x.push(w,s);a.vertices.push(j);f=0;for(g=a.faceVertexUvs.length;f<g;f++)if(a.faceVertexUvs[f].length){j=a.faceVertexUvs[f][c];s=j[0];h=j[1];w=j[2];if(e===
+0){l=s.clone();l.lerpSelf(h,0.5);j=[s.clone(),l.clone(),w.clone()];h=[l.clone(),h.clone(),w.clone()]}else if(e===1){l=h.clone();l.lerpSelf(w,0.5);j=[s.clone(),h.clone(),l.clone()];h=[l.clone(),w.clone(),s.clone()]}else{l=s.clone();l.lerpSelf(w,0.5);j=[s.clone(),h.clone(),l.clone()];h=[l.clone(),h.clone(),w.clone()]}F[f].push(j,h)}}else{x.push(e);f=0;for(g=a.faceVertexUvs.length;f<g;f++)F[f].push(a.faceVertexUvs[f][c])}}else{f=e.a;g=e.b;h=e.c;k=e.d;j=a.vertices[f];l=a.vertices[g];o=a.vertices[h];n=
+a.vertices[k];p=j.distanceTo(l);r=l.distanceTo(o);m=o.distanceTo(n);q=j.distanceTo(n);if(p>b||r>b||m>b||q>b){u=a.vertices.length;t=a.vertices.length+1;w=e.clone();s=e.clone();if(p>=r&&p>=m&&p>=q||m>=r&&m>=p&&m>=q){p=j.clone();p.lerpSelf(l,0.5);l=o.clone();l.lerpSelf(n,0.5);w.a=f;w.b=u;w.c=t;w.d=k;s.a=u;s.b=g;s.c=h;s.d=t;if(e.vertexNormals.length===4){f=e.vertexNormals[0].clone();f.lerpSelf(e.vertexNormals[1],0.5);g=e.vertexNormals[2].clone();g.lerpSelf(e.vertexNormals[3],0.5);w.vertexNormals[1].copy(f);
+w.vertexNormals[2].copy(g);s.vertexNormals[0].copy(f);s.vertexNormals[3].copy(g)}if(e.vertexColors.length===4){f=e.vertexColors[0].clone();f.lerpSelf(e.vertexColors[1],0.5);g=e.vertexColors[2].clone();g.lerpSelf(e.vertexColors[3],0.5);w.vertexColors[1].copy(f);w.vertexColors[2].copy(g);s.vertexColors[0].copy(f);s.vertexColors[3].copy(g)}e=0}else{p=l.clone();p.lerpSelf(o,0.5);l=n.clone();l.lerpSelf(j,0.5);w.a=f;w.b=g;w.c=u;w.d=t;s.a=t;s.b=u;s.c=h;s.d=k;if(e.vertexNormals.length===4){f=e.vertexNormals[1].clone();
+f.lerpSelf(e.vertexNormals[2],0.5);g=e.vertexNormals[3].clone();g.lerpSelf(e.vertexNormals[0],0.5);w.vertexNormals[2].copy(f);w.vertexNormals[3].copy(g);s.vertexNormals[0].copy(g);s.vertexNormals[1].copy(f)}if(e.vertexColors.length===4){f=e.vertexColors[1].clone();f.lerpSelf(e.vertexColors[2],0.5);g=e.vertexColors[3].clone();g.lerpSelf(e.vertexColors[0],0.5);w.vertexColors[2].copy(f);w.vertexColors[3].copy(g);s.vertexColors[0].copy(g);s.vertexColors[1].copy(f)}e=1}x.push(w,s);a.vertices.push(p,l);
+f=0;for(g=a.faceVertexUvs.length;f<g;f++)if(a.faceVertexUvs[f].length){j=a.faceVertexUvs[f][c];s=j[0];h=j[1];w=j[2];j=j[3];if(e===0){l=s.clone();l.lerpSelf(h,0.5);o=w.clone();o.lerpSelf(j,0.5);s=[s.clone(),l.clone(),o.clone(),j.clone()];h=[l.clone(),h.clone(),w.clone(),o.clone()]}else{l=h.clone();l.lerpSelf(w,0.5);o=j.clone();o.lerpSelf(s,0.5);s=[s.clone(),h.clone(),l.clone(),o.clone()];h=[o.clone(),l.clone(),w.clone(),j.clone()]}F[f].push(s,h)}}else{x.push(e);f=0;for(g=a.faceVertexUvs.length;f<g;f++)F[f].push(a.faceVertexUvs[f][c])}}}a.faces=
+x;a.faceVertexUvs=F}};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=true;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),b=e.loadCount=0;for(d=a.length;b<d;++b){e[b]=new Image;e[b].onload=function(){e.loadCount=e.loadCount+1;if(e.loadCount===6)f.needsUpdate=true;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,l=g.createImageData(d,e),k=l.data,j=0;j<d;j++)for(var o=1;o<e;o++){var m=o-1<0?e-1:o-1,p=(o+1)%e,r=j-1<0?d-1:j-1,n=(j+1)%d,q=[],u=[0,0,h[(o*d+j)*4]/255*b];q.push([-1,0,h[(o*d+r)*4]/255*b]);q.push([-1,-1,h[(m*d+r)*4]/255*b]);q.push([0,-1,
-h[(m*d+j)*4]/255*b]);q.push([1,-1,h[(m*d+n)*4]/255*b]);q.push([1,0,h[(o*d+n)*4]/255*b]);q.push([1,1,h[(p*d+n)*4]/255*b]);q.push([0,1,h[(p*d+j)*4]/255*b]);q.push([-1,1,h[(p*d+r)*4]/255*b]);m=[];r=q.length;for(p=0;p<r;p++){var n=q[p],t=q[(p+1)%r],n=[n[0]-u[0],n[1]-u[1],n[2]-u[2]],t=[t[0]-u[0],t[1]-u[1],t[2]-u[2]];m.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]]))}q=[0,0,0];for(p=0;p<m.length;p++){q[0]=q[0]+m[p][0];q[1]=q[1]+m[p][1];q[2]=q[2]+m[p][2]}q[0]=q[0]/m.length;q[1]=q[1]/
-m.length;q[2]=q[2]/m.length;u=(o*d+j)*4;k[u]=(q[0]+1)/2*255|0;k[u+1]=(q[1]+0.5)*255|0;k[u+2]=q[2]*255|0;k[u+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(c.r*255),g=Math.floor(c.g*255),c=Math.floor(c.b*255),h=0;h<d;h++){e[h*3]=f;e[h*3+1]=g;e[h*3+2]=c}a=new THREE.DataTexture(e,a,b,THREE.RGBFormat);a.needsUpdate=true;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,k=g.createImageData(d,e),j=k.data,l=0;l<d;l++)for(var o=1;o<e;o++){var n=o-1<0?e-1:o-1,p=(o+1)%e,r=l-1<0?d-1:l-1,m=(l+1)%d,q=[],u=[0,0,h[(o*d+l)*4]/255*b];q.push([-1,0,h[(o*d+r)*4]/255*b]);q.push([-1,-1,h[(n*d+r)*4]/255*b]);q.push([0,-1,
+h[(n*d+l)*4]/255*b]);q.push([1,-1,h[(n*d+m)*4]/255*b]);q.push([1,0,h[(o*d+m)*4]/255*b]);q.push([1,1,h[(p*d+m)*4]/255*b]);q.push([0,1,h[(p*d+l)*4]/255*b]);q.push([-1,1,h[(p*d+r)*4]/255*b]);n=[];r=q.length;for(p=0;p<r;p++){var m=q[p],t=q[(p+1)%r],m=[m[0]-u[0],m[1]-u[1],m[2]-u[2]],t=[t[0]-u[0],t[1]-u[1],t[2]-u[2]];n.push(c([m[1]*t[2]-m[2]*t[1],m[2]*t[0]-m[0]*t[2],m[0]*t[1]-m[1]*t[0]]))}q=[0,0,0];for(p=0;p<n.length;p++){q[0]=q[0]+n[p][0];q[1]=q[1]+n[p][1];q[2]=q[2]+n[p][2]}q[0]=q[0]/n.length;q[1]=q[1]/
+n.length;q[2]=q[2]/n.length;u=(o*d+l)*4;j[u]=(q[0]+1)/2*255|0;j[u+1]=(q[1]+0.5)*255|0;j[u+2]=q[2]*255|0;j[u+3]=255}g.putImageData(k,0,0);return f},generateDataTexture:function(a,b,c){for(var d=a*b,e=new Uint8Array(3*d),f=Math.floor(c.r*255),g=Math.floor(c.g*255),c=Math.floor(c.b*255),h=0;h<d;h++){e[h*3]=f;e[h*3+1]=g;e[h*3+2]=c}a=new THREE.DataTexture(e,a,b,THREE.RGBFormat);a.needsUpdate=true;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;if(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}else if(a instanceof THREE.SkinnedMesh)b=new THREE.SkinnedMesh(a.geometry,a.material);else if(a instanceof THREE.Mesh)b=new THREE.Mesh(a.geometry,a.material);else if(a instanceof THREE.Line)b=new THREE.Line(a.geometry,a.material,a.type);else if(a instanceof THREE.Ribbon)b=new THREE.Ribbon(a.geometry,a.material);
 else if(a instanceof THREE.ParticleSystem){b=new THREE.ParticleSystem(a.geometry,a.material);b.sortParticles=a.sortParticles}else if(a instanceof THREE.Particle)b=new THREE.Particle(a.material);else if(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);
@@ -430,7 +430,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=false;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=false;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=f+c.distanceTo(d);b.push(f);d=c}return this.cacheArcLengths=b};
-THREE.Curve.prototype.updateArcLengths=function(){this.needsUpdate=true;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;){d=Math.floor(g+(h-g)/2);l=c[d]-f;if(l<0)g=d+1;else if(l>0)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=true;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,k;g<=h;){d=Math.floor(g+(h-g)/2);k=c[d]-f;if(k<0)g=d+1;else if(k>0)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;b<0&&(b=0);a>1&&(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){this.v1=a;this.v2=b};THREE.LineCurve.prototype=new THREE.Curve;THREE.LineCurve.prototype.constructor=THREE.LineCurve;
 THREE.LineCurve.prototype.getPoint=function(a){var b=this.v2.clone().subSelf(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(){return this.v2.clone().subSelf(this.v1).normalize()};THREE.QuadraticBezierCurve=function(a,b,c){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};
@@ -447,10 +447,10 @@ THREE.ClosedSplineCurve3=THREE.Curve.create(function(a){this.points=a==void 0?[]
 d[c[1]].z,d[c[2]].z,d[c[3]].z,e);return b});THREE.CurvePath=function(){this.curves=[];this.bends=[];this.autoClose=false};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){b=c[a]-b;a=this.curves[a];b=1-b/a.getLength();return 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=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,l;l=new THREE.Vector2;g=0;for(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,true))};
-THREE.CurvePath.prototype.createSpacedPointsGeometry=function(a){return this.createGeometry(this.getSpacedPoints(a,true))};THREE.CurvePath.prototype.createGeometry=function(a){for(var b=new THREE.Geometry,c=0;c<a.length;c++)b.vertices.push(new THREE.Vertex(a[c].x,a[c].y,0));return b};THREE.CurvePath.prototype.addWrapPath=function(a){this.bends.push(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,k;k=new THREE.Vector2;g=0;for(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;k.addSelf(f.x,f.y)}return{minX:d,minY:e,maxX:b,maxY:c,centroid:k.divideScalar(h)}};THREE.CurvePath.prototype.createPointsGeometry=function(a){return this.createGeometry(this.getPoints(a,true))};
+THREE.CurvePath.prototype.createSpacedPointsGeometry=function(a){return this.createGeometry(this.getSpacedPoints(a,true))};THREE.CurvePath.prototype.createGeometry=function(a){for(var b=new THREE.Geometry,c=0;c<a.length;c++)b.vertices.push(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;d=0;for(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;d=0;for(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,l;d=0;for(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.CurvePath.prototype.getWrapPoints=function(a,b){var c=this.getBoundingBox(),d,e,f,g,h,k;d=0;for(e=a.length;d<e;d++){f=a[d];g=f.x;h=f.y;k=g/c.maxX;k=b.getUtoTmapping(k,g);g=b.getPoint(k);h=b.getNormalVector(k).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){a[b]==void 0&&(a[b]=[]);a[b].indexOf(c)===-1&&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);d!==-1&&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){if(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)}else this.matrixWorld.copy(this.matrix);
 this.matrixWorldNeedsUpdate=false;a=true}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;
@@ -461,37 +461,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){console.log("tata");return this.getSpacedPoints(a,b)}var a=a||12,c=[],d,e,f,g,h,l,k,j,o,m,p,r,n;d=0;for(e=this.actions.length;d<e;d++){f=this.actions[d];g=f.action;f=f.args;switch(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];o=f[0];m=f[1];if(c.length>0){g=c[c.length-1];
-p=g.x;r=g.y}else{g=this.actions[d-1].args;p=g[g.length-2];r=g[g.length-1]}for(f=1;f<=a;f++){n=f/a;g=THREE.Shape.Utils.b2(n,p,o,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];o=f[0];m=f[1];k=f[2];j=f[3];if(c.length>0){g=c[c.length-1];p=g.x;r=g.y}else{g=this.actions[d-1].args;p=g[g.length-2];r=g[g.length-1]}for(f=1;f<=a;f++){n=f/a;g=THREE.Shape.Utils.b3(n,p,o,k,h);n=THREE.Shape.Utils.b3(n,r,m,j,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];k=f[2];o=f[3];m=!!f[5];j=f[4]-o;p=a*2;for(f=1;f<=p;f++){n=f/p;m||(n=1-n);n=o+n*j;g=h+k*Math.cos(n);n=l+k*Math.sin(n);c.push(new THREE.Vector2(g,n))}}}d=c[c.length-1];Math.abs(d.x-c[0].x)<1.0E-10&&Math.abs(d.y-c[0].y)<1.0E-10&&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,k,j,o;h=0;for(l=g.length;h<l;h++){k=g[h];j=k.x;o=k.y;k.x=a*j+b*o+c;k.y=d*o+e*j+f}return g};
+THREE.Path.prototype.getPoints=function(a,b){if(this.useSpacedPoints){console.log("tata");return this.getSpacedPoints(a,b)}var a=a||12,c=[],d,e,f,g,h,k,j,l,o,n,p,r,m;d=0;for(e=this.actions.length;d<e;d++){f=this.actions[d];g=f.action;f=f.args;switch(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];k=f[3];o=f[0];n=f[1];if(c.length>0){g=c[c.length-1];
+p=g.x;r=g.y}else{g=this.actions[d-1].args;p=g[g.length-2];r=g[g.length-1]}for(f=1;f<=a;f++){m=f/a;g=THREE.Shape.Utils.b2(m,p,o,h);m=THREE.Shape.Utils.b2(m,r,n,k);c.push(new THREE.Vector2(g,m))}break;case THREE.PathActions.BEZIER_CURVE_TO:h=f[4];k=f[5];o=f[0];n=f[1];j=f[2];l=f[3];if(c.length>0){g=c[c.length-1];p=g.x;r=g.y}else{g=this.actions[d-1].args;p=g[g.length-2];r=g[g.length-1]}for(f=1;f<=a;f++){m=f/a;g=THREE.Shape.Utils.b3(m,p,o,j,h);m=THREE.Shape.Utils.b3(m,r,n,l,k);c.push(new THREE.Vector2(g,
+m))}break;case THREE.PathActions.CSPLINE_THRU:g=this.actions[d-1].args;m=[new THREE.Vector2(g[g.length-2],g[g.length-1])];g=a*f[0].length;m=m.concat(f[0]);m=new THREE.SplineCurve(m);for(f=1;f<=g;f++)c.push(m.getPointAt(f/g));break;case THREE.PathActions.ARC:h=f[0];k=f[1];j=f[2];o=f[3];n=!!f[5];l=f[4]-o;p=a*2;for(f=1;f<=p;f++){m=f/p;n||(m=1-m);m=o+m*l;g=h+j*Math.cos(m);m=k+j*Math.sin(m);c.push(new THREE.Vector2(g,m))}}}d=c[c.length-1];Math.abs(d.x-c[0].x)<1.0E-10&&Math.abs(d.y-c[0].y)<1.0E-10&&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,k,j,l,o;h=0;for(k=g.length;h<k;h++){j=g[h];l=j.x;o=j.y;j.x=a*l+b*o+c;j.y=d*o+e*l+f}return g};
 THREE.Path.prototype.debug=function(a){var b=this.getBoundingBox();if(!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,a=0;for(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();a=0;for(c=d.length;a<c;a++){e=d[a];b.beginPath();b.arc(e.x,e.y,1.5,0,Math.PI*2,false);b.stroke();b.closePath()}};
 THREE.Path.prototype.toShapes=function(){var a,b,c,d,e=[],f=new THREE.Path;a=0;for(b=this.actions.length;a<b;a++){c=this.actions[a];d=c.args;c=c.action;if(c==THREE.PathActions.MOVE_TO&&f.actions.length!=0){e.push(f);f=new THREE.Path}f[c].apply(f,d)}f.actions.length!=0&&e.push(f);if(e.length==0)return[];var g;d=[];a=!THREE.Shape.Utils.isClockWise(e[0].getPoints());if(e.length==1){f=e[0];g=new THREE.Shape;g.actions=f.actions;g.curves=f.curves;d.push(g);return d}if(a){g=new THREE.Shape;a=0;for(b=e.length;a<
 b;a++){f=e[a];if(THREE.Shape.Utils.isClockWise(f.getPoints())){g.actions=f.actions;g.curves=f.curves;d.push(g);g=new THREE.Shape}else g.holes.push(f)}}else{a=0;for(b=e.length;a<b;a++){f=e[a];if(THREE.Shape.Utils.isClockWise(f.getPoints())){g&&d.push(g);g=new THREE.Shape;g.actions=f.actions;g.curves=f.curves}else 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,l,k,j,o,m,p,r=[];for(l=0;l<b.length;l++){k=b[l];Array.prototype.push.apply(d,k);f=Number.POSITIVE_INFINITY;for(e=0;e<k.length;e++){m=k[e];p=[];for(o=0;o<c.length;o++){j=c[o];j=m.distanceToSquared(j);p.push(j);if(j<f){f=j;g=e;h=o}}}e=h-1>=0?h-1:c.length-1;f=g-1>=0?g-1:k.length-1;var n=[k[g],c[h],c[e]];o=THREE.FontUtils.Triangulate.area(n);var q=[k[g],k[f],c[h]];m=THREE.FontUtils.Triangulate.area(q);p=h;j=g;h=h+1;g=g+
--1;h<0&&(h=h+c.length);h=h%c.length;g<0&&(g=g+k.length);g=g%k.length;e=h-1>=0?h-1:c.length-1;f=g-1>=0?g-1:k.length-1;n=[k[g],c[h],c[e]];n=THREE.FontUtils.Triangulate.area(n);q=[k[g],k[f],c[h]];q=THREE.FontUtils.Triangulate.area(q);if(o+m>n+q){h=p;g=j;h<0&&(h=h+c.length);h=h%c.length;g<0&&(g=g+k.length);g=g%k.length;e=h-1>=0?h-1:c.length-1;f=g-1>=0?g-1:k.length-1}o=c.slice(0,h);m=c.slice(h);p=k.slice(g);j=k.slice(0,g);f=[k[g],k[f],c[h]];r.push([k[g],c[h],c[e]]);r.push(f);c=o.concat(p).concat(j).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,false),f,g,h,l,k={};f=0;for(g=d.length;f<g;f++){l=d[f].x+":"+d[f].y;k[l]!==void 0&&console.log("Duplicate point",l);k[l]=f}f=0;for(g=c.length;f<g;f++){h=c[f];for(d=0;d<3;d++){l=h[d].x+":"+h[d].y;l=k[l];l!==void 0&&(h[d]=l)}}f=0;for(g=e.length;f<g;f++){h=e[f];for(d=0;d<3;d++){l=h[d].x+":"+h[d].y;l=k[l];l!==void 0&&(h[d]=l)}}return c.concat(e)},
+THREE.Shape.Utils={removeHoles:function(a,b){var c=a.concat(),d=c.concat(),e,f,g,h,k,j,l,o,n,p,r=[];for(k=0;k<b.length;k++){j=b[k];Array.prototype.push.apply(d,j);f=Number.POSITIVE_INFINITY;for(e=0;e<j.length;e++){n=j[e];p=[];for(o=0;o<c.length;o++){l=c[o];l=n.distanceToSquared(l);p.push(l);if(l<f){f=l;g=e;h=o}}}e=h-1>=0?h-1:c.length-1;f=g-1>=0?g-1:j.length-1;var m=[j[g],c[h],c[e]];o=THREE.FontUtils.Triangulate.area(m);var q=[j[g],j[f],c[h]];n=THREE.FontUtils.Triangulate.area(q);p=h;l=g;h=h+1;g=g+
+-1;h<0&&(h=h+c.length);h=h%c.length;g<0&&(g=g+j.length);g=g%j.length;e=h-1>=0?h-1:c.length-1;f=g-1>=0?g-1:j.length-1;m=[j[g],c[h],c[e]];m=THREE.FontUtils.Triangulate.area(m);q=[j[g],j[f],c[h]];q=THREE.FontUtils.Triangulate.area(q);if(o+n>m+q){h=p;g=l;h<0&&(h=h+c.length);h=h%c.length;g<0&&(g=g+j.length);g=g%j.length;e=h-1>=0?h-1:c.length-1;f=g-1>=0?g-1:j.length-1}o=c.slice(0,h);n=c.slice(h);p=j.slice(g);l=j.slice(0,g);f=[j[g],j[f],c[h]];r.push([j[g],c[h],c[e]]);r.push(f);c=o.concat(p).concat(l).concat(n)}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,false),f,g,h,k,j={};f=0;for(g=d.length;f<g;f++){k=d[f].x+":"+d[f].y;j[k]!==void 0&&console.log("Duplicate point",k);j[k]=f}f=0;for(g=c.length;f<g;f++){h=c[f];for(d=0;d<3;d++){k=h[d].x+":"+h[d].y;k=j[k];k!==void 0&&(h[d]=k)}}f=0;for(g=e.length;f<g;f++){h=e[f];for(d=0;d<3;d++){k=h[d].x+":"+h[d].y;k=j[k];k!==void 0&&(h[d]=k)}}return c.concat(e)},
 isClockWise:function(a){return THREE.FontUtils.Triangulate.area(a)<0},b2p0:function(a,b){var c=1-a;return c*c*b},b2p1:function(a,b){return 2*(1-a)*a*b},b2p2:function(a,b){return a*a*b},b2:function(a,b,c,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=b.curveSegments!==void 0?b.curveSegments:4,d=b.font!==void 0?b.font:"helvetiker",e=b.weight!==void 0?b.weight:"normal",f=b.style!==void 0?b.style:"normal";THREE.FontUtils.size=b.size!==void 0?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){a.indexOf(b)===-1&&a.push(b)},removeFromUpdate:function(b){b=a.indexOf(b);b!==-1&&a.splice(b,1)},add:function(a){b[a.name]!==void 0&&console.log("THREE.AnimationHandler.add: Warning! "+a.name+" already exists in library. Overwriting.");b[a.name]=a;if(a.initialized!==true){for(var c=0;c<a.hierarchy.length;c++){for(var d=0;d<a.hierarchy[c].keys.length;d++){if(a.hierarchy[c].keys[d].time<
-0)a.hierarchy[c].keys[d].time=0;if(a.hierarchy[c].keys[d].rot!==void 0&&!(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&&a.hierarchy[c].keys[0].morphTargets!==void 0){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 k=a.hierarchy[c].keys[d].morphTargets[l];h[k]=-1}a.hierarchy[c].usedMorphTargets=
-h;for(d=0;d<a.hierarchy[c].keys.length;d++){var j={};for(k in h){for(l=0;l<a.hierarchy[c].keys[d].morphTargets.length;l++)if(a.hierarchy[c].keys[d].morphTargets[l]===k){j[k]=a.hierarchy[c].keys[d].morphTargetsInfluences[l];break}l===a.hierarchy[c].keys[d].morphTargets.length&&(j[k]=0)}a.hierarchy[c].keys[d].morphTargetsInfluences=j}}for(d=1;d<a.hierarchy[c].keys.length;d++)if(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=
+0)a.hierarchy[c].keys[d].time=0;if(a.hierarchy[c].keys[d].rot!==void 0&&!(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&&a.hierarchy[c].keys[0].morphTargets!==void 0){h={};for(d=0;d<a.hierarchy[c].keys.length;d++)for(var k=0;k<a.hierarchy[c].keys[d].morphTargets.length;k++){var j=a.hierarchy[c].keys[d].morphTargets[k];h[j]=-1}a.hierarchy[c].usedMorphTargets=
+h;for(d=0;d<a.hierarchy[c].keys.length;d++){var l={};for(j in h){for(k=0;k<a.hierarchy[c].keys[d].morphTargets.length;k++)if(a.hierarchy[c].keys[d].morphTargets[k]===j){l[j]=a.hierarchy[c].keys[d].morphTargetsInfluences[k];break}k===a.hierarchy[c].keys[d].morphTargets.length&&(l[j]=0)}a.hierarchy[c].keys[d].morphTargetsInfluences=l}}for(d=1;d<a.hierarchy[c].keys.length;d++)if(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=true}},get:function(a){if(typeof a==="string"){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=false;this.loop=this.isPaused=true;this.interpolationType=c!==void 0?c:THREE.AnimationHandler.LINEAR;this.JITCompile=d!==void 0?d:true;this.points=[];this.target=new THREE.Vector3};
 THREE.Animation.prototype.play=function(a,b){if(!this.isPlaying){this.isPlaying=true;this.loop=a!==void 0?a:true;this.currentTime=b!==void 0?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=true;e.matrixAutoUpdate=true;if(e.animationCache===void 0){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=false;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=false;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.hierarchy.length;a++)if(this.hierarchy[a].animationCache!==void 0){this.hierarchy[a]instanceof THREE.Bone?this.hierarchy[a].skinMatrix=this.hierarchy[a].animationCache.originalMatrix:this.hierarchy[a].matrix=this.hierarchy[a].animationCache.originalMatrix;delete this.hierarchy[a].animationCache}};
-THREE.Animation.prototype.update=function(a){if(this.isPlaying){var b=["pos","rot","scl"],c,d,e,f,g,h,l,k,j=this.data.JIT.hierarchy,o,m;m=this.currentTime=this.currentTime+a*this.timeScale;o=this.currentTime=this.currentTime%this.data.length;k=parseInt(Math.min(o*this.data.fps,this.data.length*this.data.fps),10);for(var p=0,r=this.hierarchy.length;p<r;p++){a=this.hierarchy[p];l=a.animationCache;if(this.JITCompile&&j[p][k]!==void 0)if(a instanceof THREE.Bone){a.skinMatrix=j[p][k];a.matrixAutoUpdate=
-false;a.matrixWorldNeedsUpdate=false}else{a.matrix=j[p][k];a.matrixAutoUpdate=false;a.matrixWorldNeedsUpdate=true}else{if(this.JITCompile)a instanceof THREE.Bone?a.skinMatrix=a.animationCache.originalMatrix:a.matrix=a.animationCache.originalMatrix;for(var n=0;n<3;n++){c=b[n];g=l.prevKey[c];h=l.nextKey[c];if(h.time<=m){if(o<m)if(this.loop){g=this.data.hierarchy[p].keys[0];for(h=this.getNextKeyWith(c,p,1);h.time<o;){g=h;h=this.getNextKeyWith(c,p,h.index+1)}}else{this.stop();return}else{do{g=h;h=this.getNextKeyWith(c,
-p,h.index+1)}while(h.time<o)}l.prevKey[c]=g;l.nextKey[c]=h}a.matrixAutoUpdate=true;a.matrixWorldNeedsUpdate=true;d=(o-g.time)/(h.time-g.time);e=g[c];f=h[c];if(d<0||d>1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+d+" on bone "+p);d=d<0?0:1}if(c==="pos"){c=a.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR){c.x=e[0]+(f[0]-e[0])*d;c.y=e[1]+(f[1]-e[1])*d;c.z=e[2]+(f[2]-e[2])*d}else if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===
+THREE.Animation.prototype.update=function(a){if(this.isPlaying){var b=["pos","rot","scl"],c,d,e,f,g,h,k,j,l=this.data.JIT.hierarchy,o,n;n=this.currentTime=this.currentTime+a*this.timeScale;o=this.currentTime=this.currentTime%this.data.length;j=parseInt(Math.min(o*this.data.fps,this.data.length*this.data.fps),10);for(var p=0,r=this.hierarchy.length;p<r;p++){a=this.hierarchy[p];k=a.animationCache;if(this.JITCompile&&l[p][j]!==void 0)if(a instanceof THREE.Bone){a.skinMatrix=l[p][j];a.matrixAutoUpdate=
+false;a.matrixWorldNeedsUpdate=false}else{a.matrix=l[p][j];a.matrixAutoUpdate=false;a.matrixWorldNeedsUpdate=true}else{if(this.JITCompile)a instanceof THREE.Bone?a.skinMatrix=a.animationCache.originalMatrix:a.matrix=a.animationCache.originalMatrix;for(var m=0;m<3;m++){c=b[m];g=k.prevKey[c];h=k.nextKey[c];if(h.time<=n){if(o<n)if(this.loop){g=this.data.hierarchy[p].keys[0];for(h=this.getNextKeyWith(c,p,1);h.time<o;){g=h;h=this.getNextKeyWith(c,p,h.index+1)}}else{this.stop();return}else{do{g=h;h=this.getNextKeyWith(c,
+p,h.index+1)}while(h.time<o)}k.prevKey[c]=g;k.nextKey[c]=h}a.matrixAutoUpdate=true;a.matrixWorldNeedsUpdate=true;d=(o-g.time)/(h.time-g.time);e=g[c];f=h[c];if(d<0||d>1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+d+" on bone "+p);d=d<0?0:1}if(c==="pos"){c=a.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR){c.x=e[0]+(f[0]-e[0])*d;c.y=e[1]+(f[1]-e[1])*d;c.z=e[2]+(f[2]-e[2])*d}else if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===
 THREE.AnimationHandler.CATMULLROM_FORWARD){this.points[0]=this.getPrevKeyWith("pos",p,g.index-1).pos;this.points[1]=e;this.points[2]=f;this.points[3]=this.getNextKeyWith("pos",p,h.index+1).pos;d=d*0.33+0.33;e=this.interpolateCatmullRom(this.points,d);c.x=e[0];c.y=e[1];c.z=e[2];if(this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){d=this.interpolateCatmullRom(this.points,d*1.01);this.target.set(d[0],d[1],d[2]);this.target.subSelf(c);this.target.y=0;this.target.normalize();d=Math.atan2(this.target.x,
-this.target.z);a.rotation.set(0,d,0)}}}else if(c==="rot")THREE.Quaternion.slerp(e,f,a.quaternion,d);else if(c==="scl"){c=a.scale;c.x=e[0]+(f[0]-e[0])*d;c.y=e[1]+(f[1]-e[1])*d;c.z=e[2]+(f[2]-e[2])*d}}}}if(this.JITCompile&&j[0][k]===void 0){this.hierarchy[0].updateMatrixWorld(true);for(p=0;p<this.hierarchy.length;p++)j[p][k]=this.hierarchy[p]instanceof THREE.Bone?this.hierarchy[p].skinMatrix.clone():this.hierarchy[p].matrix.clone()}}};
-THREE.Animation.prototype.interpolateCatmullRom=function(a,b){var c=[],d=[],e,f,g,h,l,k;e=(a.length-1)*b;f=Math.floor(e);e=e-f;c[0]=f===0?f:f-1;c[1]=f;c[2]=f>a.length-2?f:f+1;c[3]=f>a.length-3?f:f+2;f=a[c[0]];h=a[c[1]];l=a[c[2]];k=a[c[3]];c=e*e;g=e*c;d[0]=this.interpolate(f[0],h[0],l[0],k[0],e,c,g);d[1]=this.interpolate(f[1],h[1],l[1],k[1],e,c,g);d[2]=this.interpolate(f[2],h[2],l[2],k[2],e,c,g);return d};
+this.target.z);a.rotation.set(0,d,0)}}}else if(c==="rot")THREE.Quaternion.slerp(e,f,a.quaternion,d);else if(c==="scl"){c=a.scale;c.x=e[0]+(f[0]-e[0])*d;c.y=e[1]+(f[1]-e[1])*d;c.z=e[2]+(f[2]-e[2])*d}}}}if(this.JITCompile&&l[0][j]===void 0){this.hierarchy[0].updateMatrixWorld(true);for(p=0;p<this.hierarchy.length;p++)l[p][j]=this.hierarchy[p]instanceof THREE.Bone?this.hierarchy[p].skinMatrix.clone():this.hierarchy[p].matrix.clone()}}};
+THREE.Animation.prototype.interpolateCatmullRom=function(a,b){var c=[],d=[],e,f,g,h,k,j;e=(a.length-1)*b;f=Math.floor(e);e=e-f;c[0]=f===0?f:f-1;c[1]=f;c[2]=f>a.length-2?f:f+1;c[3]=f>a.length-3?f:f+2;f=a[c[0]];h=a[c[1]];k=a[c[2]];j=a[c[3]];c=e*e;g=e*c;d[0]=this.interpolate(f[0],h[0],k[0],j[0],e,c,g);d[1]=this.interpolate(f[1],h[1],k[1],j[1],e,c,g);d[2]=this.interpolate(f[2],h[2],k[2],j[2],e,c,g);return d};
 THREE.Animation.prototype.interpolate=function(a,b,c,d,e,f,g){a=(c-a)*0.5;d=(d-b)*0.5;return(2*(b-c)+a+d)*g+(-3*(b-c)-2*a-d)*f+a*e+b};THREE.Animation.prototype.getNextKeyWith=function(a,b,c){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(d[c][a]!==void 0)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?c>0?c:0:c>=0?c:c+d.length;c>=0;c--)if(d[c][a]!==void 0)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.0010;this.isPlaying=false;this.loop=this.isPaused=true;this.JITCompile=c!==void 0?c:true;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=
@@ -499,14 +499,14 @@ false;this.data.hierarchy[a].node.updateMatrix();d.matrixWorldNeedsUpdate=true}}
 THREE.KeyFrameAnimation.prototype.play=function(a,b){if(!this.isPlaying){this.isPlaying=true;this.loop=a!==void 0?a:true;this.currentTime=b!==void 0?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=true;if(f.animationCache===void 0){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=false;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=false;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(c.animationCache!==void 0){var d=c.animationCache.originalMatrix;if(b instanceof THREE.Bone){d.copy(b.skinMatrix);b.skinMatrix=d}else{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,l;h=this.currentTime=this.currentTime+a*this.timeScale;g=this.currentTime=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,k=this.hierarchy.length;a<k;a++){var j=this.data.hierarchy[a].keys,f=this.data.hierarchy[a].sids;d=j.length-1;e=
-this.hierarchy[a];if(j.length){for(j=0;j<f.length;j++){g=f[j];(h=this.getPrevKeyWith(g,a,d))&&h.apply(g)}this.data.hierarchy[a].node.updateMatrix();e.matrixWorldNeedsUpdate=true}}this.stop()}else if(!(g<this.startTime)){a=0;for(k=this.hierarchy.length;a<k;a++){d=this.hierarchy[a];b=this.data.hierarchy[a];var j=b.keys,o=b.animationCache;if(this.JITCompile&&f[a][e]!==void 0)if(d instanceof THREE.Bone){d.skinMatrix=f[a][e];d.matrixWorldNeedsUpdate=false}else{d.matrix=f[a][e];d.matrixWorldNeedsUpdate=
-true}else if(j.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(l&&this.loop){b=j[0];for(c=j[1];c.time<g;){b=c;c=j[b.index+1]}}else if(!l)for(var m=j.length-1;c.time<g&&c.index!==m;){b=c;c=j[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=true}}if(this.JITCompile&&f[0][e]===void 0){this.hierarchy[0].updateMatrixWorld(true);
+THREE.KeyFrameAnimation.prototype.update=function(a){if(this.isPlaying){var b,c,d,e,f=this.data.JIT.hierarchy,g,h,k;h=this.currentTime=this.currentTime+a*this.timeScale;g=this.currentTime=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((k=g<h)&&!this.loop){for(var a=0,j=this.hierarchy.length;a<j;a++){var l=this.data.hierarchy[a].keys,f=this.data.hierarchy[a].sids;d=l.length-1;e=
+this.hierarchy[a];if(l.length){for(l=0;l<f.length;l++){g=f[l];(h=this.getPrevKeyWith(g,a,d))&&h.apply(g)}this.data.hierarchy[a].node.updateMatrix();e.matrixWorldNeedsUpdate=true}}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 l=b.keys,o=b.animationCache;if(this.JITCompile&&f[a][e]!==void 0)if(d instanceof THREE.Bone){d.skinMatrix=f[a][e];d.matrixWorldNeedsUpdate=false}else{d.matrix=f[a][e];d.matrixWorldNeedsUpdate=
+true}else if(l.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(k&&this.loop){b=l[0];for(c=l[1];c.time<g;){b=c;c=l[b.index+1]}}else if(!k)for(var n=l.length-1;c.time<g&&c.index!==n;){b=c;c=l[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=true}}if(this.JITCompile&&f[0][e]===void 0){this.hierarchy[0].updateMatrixWorld(true);
 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=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=c>=0?c:c+b.length;c>=0;c--)if(b[c].hasTarget(a))return b[c];return b[b.length-1]};
 THREE.CubeCamera=function(a,b,c){THREE.Object3D.call(this);var d=new THREE.PerspectiveCamera(90,1,a,b);d.up.set(0,-1,0);d.lookAt(new THREE.Vector3(1,0,0));this.add(d);var e=new THREE.PerspectiveCamera(90,1,a,b);e.up.set(0,-1,0);e.lookAt(new THREE.Vector3(-1,0,0));this.add(e);var f=new THREE.PerspectiveCamera(90,1,a,b);f.up.set(0,0,1);f.lookAt(new THREE.Vector3(0,1,0));this.add(f);var g=new THREE.PerspectiveCamera(90,1,a,b);g.up.set(0,0,-1);g.lookAt(new THREE.Vector3(0,-1,0));this.add(g);var h=new THREE.PerspectiveCamera(90,
-1,a,b);h.up.set(0,-1,0);h.lookAt(new THREE.Vector3(0,0,1));this.add(h);var l=new THREE.PerspectiveCamera(90,1,a,b);l.up.set(0,-1,0);l.lookAt(new THREE.Vector3(0,0,-1));this.add(l);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=false;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.CubeCamera.prototype=new THREE.Object3D;THREE.CubeCamera.prototype.constructor=THREE.CubeCamera;
+1,a,b);h.up.set(0,-1,0);h.lookAt(new THREE.Vector3(0,0,1));this.add(h);var k=new THREE.PerspectiveCamera(90,1,a,b);k.up.set(0,-1,0);k.lookAt(new THREE.Vector3(0,0,-1));this.add(k);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,n=c.generateMipmaps;c.generateMipmaps=false;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=n;c.activeCubeFace=5;a.render(b,k,c)}};THREE.CubeCamera.prototype=new THREE.Object3D;THREE.CubeCamera.prototype.constructor=THREE.CubeCamera;
 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.CombinedCamera;
 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=true;this.inOrthographicMode=false};
 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=false;this.inOrthographicMode=true};
@@ -524,7 +524,7 @@ Math.sin(this.theta);b=1;this.constrainVertical&&(b=Math.PI/(this.verticalMax-th
 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()},false);this.domElement.addEventListener("mousemove",c(this,this.onMouseMove),false);this.domElement.addEventListener("mousedown",c(this,this.onMouseDown),false);this.domElement.addEventListener("mouseup",c(this,this.onMouseUp),false);this.domElement.addEventListener("keydown",c(this,this.onKeyDown),false);this.domElement.addEventListener("keyup",
 c(this,this.onKeyUp),false)};
 THREE.PathControls=function(a,b){function c(a){return(a=a*2)<1?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,u=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++){u=d*h.chunks[f]/h.total;b.keys[f]={time:u,pos:g[f]}}e.hierarchy[0]=b;THREE.AnimationHandler.add(e);
-return new THREE.Animation(a,c,THREE.AnimationHandler.CATMULLROM_FORWARD,false)}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(d.x,d.y,d.z)}return e}this.object=a;this.domElement=b!==void 0?b:document;this.id="PathControls"+THREE.PathControlsIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=true;this.resamplingCoef=50;this.debugPath=new THREE.Object3D;this.debugDummy=new THREE.Object3D;
+return new THREE.Animation(a,c,THREE.AnimationHandler.CATMULLROM_FORWARD,false)}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.Vector3(d.x,d.y,d.z)}return e}this.object=a;this.domElement=b!==void 0?b:document;this.id="PathControls"+THREE.PathControlsIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=true;this.resamplingCoef=50;this.debugPath=new THREE.Object3D;this.debugDummy=new THREE.Object3D;
 this.animationParent=new THREE.Object3D;this.lookSpeed=0.0050;this.lookHorizontal=this.lookVertical=true;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;if(this.domElement===document){this.viewHalfX=window.innerWidth/2;this.viewHalfY=window.innerHeight/2}else{this.viewHalfX=this.domElement.offsetWidth/2;this.viewHalfY=
 this.domElement.offsetHeight/2;this.domElement.setAttribute("tabindex",-1)}var g=Math.PI*2,h=Math.PI/180;this.update=function(a){var b;if(this.lookHorizontal)this.lon=this.lon+this.mouseX*this.lookSpeed*a;if(this.lookVertical)this.lat=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=a>=0?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){if(this.domElement===
@@ -541,264 +541,265 @@ false;break;case 2:this.moveBackward=false}this.updateRotationVector()};this.upd
 this.object.matrixWorldNeedsUpdate=true};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),false);this.domElement.addEventListener("mousedown",c(this,this.mousedown),false);this.domElement.addEventListener("mouseup",
 c(this,this.mouseup),false);this.domElement.addEventListener("keydown",c(this,this.keydown),false);this.domElement.addEventListener("keyup",c(this,this.keyup),false);this.updateMovementVector();this.updateRotationVector()};
-THREE.RollControls=function(a,b){this.object=a;this.domElement=b!==void 0?b:document;this.mouseLook=true;this.autoForward=false;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.object.matrixAutoUpdate=false;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=false,h=1,l=0,k=0,j=0,o=0,m=0,p=window.innerWidth/2,r=window.innerHeight/2;this.update=function(a){if(this.mouseLook){var b=
-a*this.lookSpeed;this.rotateHorizontally(b*o);this.rotateVertically(b*m)}b=a*this.movementSpeed;this.object.translateZ(-b*(l>0||this.autoForward&&!(l<0)?1:l));this.object.translateX(b*k);this.object.translateY(b*j);if(g)this.roll=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);
+THREE.RollControls=function(a,b){this.object=a;this.domElement=b!==void 0?b:document;this.mouseLook=true;this.autoForward=false;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.object.matrixAutoUpdate=false;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=false,h=1,k=0,j=0,l=0,o=0,n=0,p=window.innerWidth/2,r=window.innerHeight/2;this.update=function(a){if(this.mouseLook){var b=
+a*this.lookSpeed;this.rotateHorizontally(b*o);this.rotateVertically(b*n)}b=a*this.movementSpeed;this.object.translateZ(-b*(k>0||this.autoForward&&!(k<0)?1:k));this.object.translateX(b*j);this.object.translateY(b*l);if(g)this.roll=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.elements[0]=c.x;this.object.matrix.elements[4]=d.x;this.object.matrix.elements[8]=e.x;this.object.matrix.elements[1]=c.y;this.object.matrix.elements[5]=d.y;this.object.matrix.elements[9]=e.y;this.object.matrix.elements[2]=c.z;this.object.matrix.elements[6]=d.z;this.object.matrix.elements[10]=e.z;f.identity();f.elements[0]=Math.cos(this.roll);f.elements[4]=-Math.sin(this.roll);f.elements[1]=Math.sin(this.roll);f.elements[5]=
 Math.cos(this.roll);this.object.matrix.multiplySelf(f);this.object.matrixWorldNeedsUpdate=true;this.object.matrix.elements[12]=this.object.position.x;this.object.matrix.elements[13]=this.object.position.y;this.object.matrix.elements[14]=this.object.position.z};this.translateX=function(a){this.object.position.x=this.object.position.x+this.object.matrix.elements[0]*a;this.object.position.y=this.object.position.y+this.object.matrix.elements[1]*a;this.object.position.z=this.object.position.z+this.object.matrix.elements[2]*
 a};this.translateY=function(a){this.object.position.x=this.object.position.x+this.object.matrix.elements[4]*a;this.object.position.y=this.object.position.y+this.object.matrix.elements[5]*a;this.object.position.z=this.object.position.z+this.object.matrix.elements[6]*a};this.translateZ=function(a){this.object.position.x=this.object.position.x-this.object.matrix.elements[8]*a;this.object.position.y=this.object.position.y-this.object.matrix.elements[9]*a;this.object.position.z=this.object.position.z-
 this.object.matrix.elements[10]*a};this.rotateHorizontally=function(a){c.set(this.object.matrix.elements[0],this.object.matrix.elements[1],this.object.matrix.elements[2]);c.multiplyScalar(a);this.forward.subSelf(c);this.forward.normalize()};this.rotateVertically=function(a){d.set(this.object.matrix.elements[4],this.object.matrix.elements[5],this.object.matrix.elements[6]);d.multiplyScalar(a);this.forward.addSelf(d);this.forward.normalize()};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},
-false);this.domElement.addEventListener("mousemove",function(a){o=(a.clientX-p)/window.innerWidth;m=(a.clientY-r)/window.innerHeight},false);this.domElement.addEventListener("mousedown",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:l=1;break;case 2:l=-1}},false);this.domElement.addEventListener("mouseup",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:l=0;break;case 2:l=0}},false);this.domElement.addEventListener("keydown",function(a){switch(a.keyCode){case 38:case 87:l=
-1;break;case 37:case 65:k=-1;break;case 40:case 83:l=-1;break;case 39:case 68:k=1;break;case 81:g=true;h=1;break;case 69:g=true;h=-1;break;case 82:j=1;break;case 70:j=-1}},false);this.domElement.addEventListener("keyup",function(a){switch(a.keyCode){case 38:case 87:l=0;break;case 37:case 65:k=0;break;case 40:case 83:l=0;break;case 39:case 68:k=0;break;case 81:g=false;break;case 69:g=false;break;case 82:j=0;break;case 70:j=0}},false)};
+false);this.domElement.addEventListener("mousemove",function(a){o=(a.clientX-p)/window.innerWidth;n=(a.clientY-r)/window.innerHeight},false);this.domElement.addEventListener("mousedown",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:k=1;break;case 2:k=-1}},false);this.domElement.addEventListener("mouseup",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:k=0;break;case 2:k=0}},false);this.domElement.addEventListener("keydown",function(a){switch(a.keyCode){case 38:case 87:k=
+1;break;case 37:case 65:j=-1;break;case 40:case 83:k=-1;break;case 39:case 68:j=1;break;case 81:g=true;h=1;break;case 69:g=true;h=-1;break;case 82:l=1;break;case 70:l=-1}},false);this.domElement.addEventListener("keyup",function(a){switch(a.keyCode){case 38:case 87:k=0;break;case 37:case 65:j=0;break;case 40:case 83:k=0;break;case 39:case 68:j=0;break;case 81:g=false;break;case 69:g=false;break;case 82:l=0;break;case 70:l=0}},false)};
 THREE.TrackballControls=function(a,b){THREE.EventTarget.call(this);var c=this;this.object=a;this.domElement=b!==void 0?b:document;this.enabled=true;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=false;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=false,f=-1,g=new THREE.Vector3,h=new THREE.Vector3,l=new THREE.Vector3,k=new THREE.Vector2,j=new THREE.Vector2,o=new THREE.Vector2,m=new THREE.Vector2,p={type:"change"};this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.getMouseOnScreen=function(a,b){return new THREE.Vector2((a-c.screen.offsetLeft)/c.radius*0.5,(b-c.screen.offsetTop)/c.radius*0.5)};this.getMouseProjectionOnBall=function(a,b){var d=new THREE.Vector3((a-
-c.screen.width*0.5-c.screen.offsetLeft)/c.radius,(c.screen.height*0.5+c.screen.offsetTop-b)/c.radius,0),e=d.length();e>1?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);if(c.staticMoving)h=l;else{d.setFromAxisAngle(b,a*(c.dynamicDampingFactor-1));d.multiplyVector3(h)}}};this.zoomCamera=function(){var a=1+(j.y-k.y)*c.zoomSpeed;if(a!==1&&a>0){g.multiplyScalar(a);c.staticMoving?k=j:k.y=k.y+(j.y-k.y)*this.dynamicDampingFactor}};this.panCamera=function(){var a=m.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=m:o.addSelf(a.sub(m,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);if(d.distanceTo(c.object.position)>0){c.dispatchEvent(p);d.copy(c.object.position)}};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},false);this.domElement.addEventListener("mousemove",function(a){if(c.enabled){if(e){h=l=c.getMouseProjectionOnBall(a.clientX,a.clientY);k=j=c.getMouseOnScreen(a.clientX,a.clientY);o=
-m=c.getMouseOnScreen(a.clientX,a.clientY);e=false}f!==-1&&(f===0&&!c.noRotate?l=c.getMouseProjectionOnBall(a.clientX,a.clientY):f===1&&!c.noZoom?j=c.getMouseOnScreen(a.clientX,a.clientY):f===2&&!c.noPan&&(m=c.getMouseOnScreen(a.clientX,a.clientY)))}},false);this.domElement.addEventListener("mousedown",function(a){if(c.enabled){a.preventDefault();a.stopPropagation();if(f===-1){f=a.button;f===0&&!c.noRotate?h=l=c.getMouseProjectionOnBall(a.clientX,a.clientY):f===1&&!c.noZoom?k=j=c.getMouseOnScreen(a.clientX,
-a.clientY):this.noPan||(o=m=c.getMouseOnScreen(a.clientX,a.clientY))}}},false);this.domElement.addEventListener("mouseup",function(a){if(c.enabled){a.preventDefault();a.stopPropagation();f=-1}},false);window.addEventListener("keydown",function(a){if(c.enabled&&f===-1){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);f!==-1&&(e=true)}},false);window.addEventListener("keyup",function(){c.enabled&&f!==-1&&(f=-1)},false)};
-THREE.CubeGeometry=function(a,b,c,d,e,f,g,h){function l(a,b,c,g,h,j,l,m){var n,o=d||1,p=e||1,r=h/2,q=j/2,u=k.vertices.length;if(a==="x"&&b==="y"||a==="y"&&b==="x")n="z";else if(a==="x"&&b==="z"||a==="z"&&b==="x"){n="y";p=f||1}else if(a==="z"&&b==="y"||a==="y"&&b==="z"){n="x";o=f||1}var i=o+1,t=p+1,x=h/o,L=j/p,W=new THREE.Vector3;W[n]=l>0?1:-1;for(h=0;h<t;h++)for(j=0;j<i;j++){var G=new THREE.Vertex;G[a]=(j*x-r)*c;G[b]=(h*L-q)*g;G[n]=l;k.vertices.push(G)}for(h=0;h<p;h++)for(j=0;j<o;j++){a=new THREE.Face4(j+
-i*h+u,j+i*(h+1)+u,j+1+i*(h+1)+u,j+1+i*h+u);a.normal.copy(W);a.vertexNormals.push(W.clone(),W.clone(),W.clone(),W.clone());a.materialIndex=m;k.faces.push(a);k.faceVertexUvs[0].push([new THREE.UV(j/o,h/p),new THREE.UV(j/o,(h+1)/p),new THREE.UV((j+1)/o,(h+1)/p),new THREE.UV((j+1)/o,h/p)])}}THREE.Geometry.call(this);var k=this,j=a/2,o=b/2,m=c/2,p,r,n,q,u,t;if(g!==void 0){if(g instanceof Array)this.materials=g;else{this.materials=[];for(p=0;p<6;p++)this.materials.push(g)}p=0;q=1;r=2;u=3;n=4;t=5}else this.materials=
-[];this.sides={px:true,nx:true,py:true,ny:true,pz:true,nz:true};if(h!=void 0)for(var x in h)this.sides[x]!==void 0&&(this.sides[x]=h[x]);this.sides.px&&l("z","y",-1,-1,c,b,j,p);this.sides.nx&&l("z","y",1,-1,c,b,-j,q);this.sides.py&&l("x","z",1,1,a,c,o,r);this.sides.ny&&l("x","z",1,-1,a,c,-o,u);this.sides.pz&&l("x","y",1,-1,a,b,m,n);this.sides.nz&&l("x","y",-1,-1,a,b,-m,t);this.computeCentroids();this.mergeVertices()};THREE.CubeGeometry.prototype=new THREE.Geometry;
+this.target=new THREE.Vector3;var d=new THREE.Vector3,e=false,f=-1,g=new THREE.Vector3,h=new THREE.Vector3,k=new THREE.Vector3,j=new THREE.Vector2,l=new THREE.Vector2,o=new THREE.Vector2,n=new THREE.Vector2,p={type:"change"};this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.getMouseOnScreen=function(a,b){return new THREE.Vector2((a-c.screen.offsetLeft)/c.radius*0.5,(b-c.screen.offsetTop)/c.radius*0.5)};this.getMouseProjectionOnBall=function(a,b){var d=new THREE.Vector3((a-
+c.screen.width*0.5-c.screen.offsetLeft)/c.radius,(c.screen.height*0.5+c.screen.offsetTop-b)/c.radius,0),e=d.length();e>1?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(k)/h.length()/k.length());if(a){var b=(new THREE.Vector3).cross(h,k).normalize(),d=new THREE.Quaternion,a=a*c.rotateSpeed;
+d.setFromAxisAngle(b,-a);d.multiplyVector3(g);d.multiplyVector3(c.object.up);d.multiplyVector3(k);if(c.staticMoving)h=k;else{d.setFromAxisAngle(b,a*(c.dynamicDampingFactor-1));d.multiplyVector3(h)}}};this.zoomCamera=function(){var a=1+(l.y-j.y)*c.zoomSpeed;if(a!==1&&a>0){g.multiplyScalar(a);c.staticMoving?j=l:j.y=j.y+(l.y-j.y)*this.dynamicDampingFactor}};this.panCamera=function(){var a=n.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=n:o.addSelf(a.sub(n,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);if(d.distanceTo(c.object.position)>0){c.dispatchEvent(p);d.copy(c.object.position)}};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},false);this.domElement.addEventListener("mousemove",function(a){if(c.enabled){if(e){h=k=c.getMouseProjectionOnBall(a.clientX,a.clientY);j=l=c.getMouseOnScreen(a.clientX,a.clientY);o=
+n=c.getMouseOnScreen(a.clientX,a.clientY);e=false}f!==-1&&(f===0&&!c.noRotate?k=c.getMouseProjectionOnBall(a.clientX,a.clientY):f===1&&!c.noZoom?l=c.getMouseOnScreen(a.clientX,a.clientY):f===2&&!c.noPan&&(n=c.getMouseOnScreen(a.clientX,a.clientY)))}},false);this.domElement.addEventListener("mousedown",function(a){if(c.enabled){a.preventDefault();a.stopPropagation();if(f===-1){f=a.button;f===0&&!c.noRotate?h=k=c.getMouseProjectionOnBall(a.clientX,a.clientY):f===1&&!c.noZoom?j=l=c.getMouseOnScreen(a.clientX,
+a.clientY):this.noPan||(o=n=c.getMouseOnScreen(a.clientX,a.clientY))}}},false);this.domElement.addEventListener("mouseup",function(a){if(c.enabled){a.preventDefault();a.stopPropagation();f=-1}},false);window.addEventListener("keydown",function(a){if(c.enabled&&f===-1){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);f!==-1&&(e=true)}},false);window.addEventListener("keyup",function(){c.enabled&&f!==-1&&(f=-1)},false)};
+THREE.CubeGeometry=function(a,b,c,d,e,f,g,h){function k(a,b,c,g,h,k,l,n){var m,o=d||1,p=e||1,r=h/2,q=k/2,t=j.vertices.length;if(a==="x"&&b==="y"||a==="y"&&b==="x")m="z";else if(a==="x"&&b==="z"||a==="z"&&b==="x"){m="y";p=f||1}else if(a==="z"&&b==="y"||a==="y"&&b==="z"){m="x";o=f||1}var i=o+1,u=p+1,w=h/o,C=k/p,Y=new THREE.Vector3;Y[m]=l>0?1:-1;for(h=0;h<u;h++)for(k=0;k<i;k++){var H=new THREE.Vector3;H[a]=(k*w-r)*c;H[b]=(h*C-q)*g;H[m]=l;j.vertices.push(H)}for(h=0;h<p;h++)for(k=0;k<o;k++){a=new THREE.Face4(k+
+i*h+t,k+i*(h+1)+t,k+1+i*(h+1)+t,k+1+i*h+t);a.normal.copy(Y);a.vertexNormals.push(Y.clone(),Y.clone(),Y.clone(),Y.clone());a.materialIndex=n;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,l=a/2,o=b/2,n=c/2,p,r,m,q,u,t;if(g!==void 0){if(g instanceof Array)this.materials=g;else{this.materials=[];for(p=0;p<6;p++)this.materials.push(g)}p=0;q=1;r=2;u=3;m=4;t=5}else this.materials=
+[];this.sides={px:true,nx:true,py:true,ny:true,pz:true,nz:true};if(h!=void 0)for(var w in h)this.sides[w]!==void 0&&(this.sides[w]=h[w]);this.sides.px&&k("z","y",-1,-1,c,b,l,p);this.sides.nx&&k("z","y",1,-1,c,b,-l,q);this.sides.py&&k("x","z",1,1,a,c,o,r);this.sides.ny&&k("x","z",1,-1,a,c,-o,u);this.sides.pz&&k("x","y",1,-1,a,b,n,m);this.sides.nz&&k("x","y",-1,-1,a,b,-n,t);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=a!==void 0?a:20,b=b!==void 0?b:20,c=c!==void 0?c:100,g=c/2,d=d||8,e=e||1,h,l,k=[],j=[];for(l=0;l<=e;l++){var o=[],m=[],p=l/e,r=p*(b-a)+a;for(h=0;h<=d;h++){var n=h/d,q=r*Math.sin(n*Math.PI*2),u=-p*c+g,t=r*Math.cos(n*Math.PI*2);this.vertices.push(new THREE.Vertex(q,u,t));o.push(this.vertices.length-1);m.push(new THREE.UV(n,p))}k.push(o);j.push(m)}for(l=0;l<e;l++)for(h=0;h<d;h++){var c=k[l][h],o=k[l+1][h],m=k[l+1][h+1],p=k[l][h+
-1],r=this.vertices[c].clone().setY(0).normalize(),n=this.vertices[o].clone().setY(0).normalize(),q=this.vertices[m].clone().setY(0).normalize(),u=this.vertices[p].clone().setY(0).normalize(),t=j[l][h].clone(),x=j[l+1][h].clone(),s=j[l+1][h+1].clone(),z=j[l][h+1].clone();this.faces.push(new THREE.Face4(c,o,m,p,[r,n,q,u]));this.faceVertexUvs[0].push([t,x,s,z])}if(!f&&a>0){this.vertices.push(new THREE.Vertex(0,g,0));for(h=0;h<d;h++){c=k[0][h];o=k[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);t=j[0][h].clone();x=j[0][h+1].clone();s=new THREE.UV(x.u,0);this.faces.push(new THREE.Face3(c,o,m,[r,n,q]));this.faceVertexUvs[0].push([t,x,s])}}if(!f&&b>0){this.vertices.push(new THREE.Vertex(0,-g,0));for(h=0;h<d;h++){c=k[l][h+1];o=k[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);t=j[l][h+1].clone();x=j[l][h].clone();s=new THREE.UV(x.u,1);this.faces.push(new THREE.Face3(c,
-o,m,[r,n,q]));this.faceVertexUvs[0].push([t,x,s])}}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;THREE.ExtrudeGeometry=function(a,b){if(typeof a!=="undefined"){THREE.Geometry.call(this);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.CylinderGeometry=function(a,b,c,d,e,f){THREE.Geometry.call(this);var a=a!==void 0?a:20,b=b!==void 0?b:20,c=c!==void 0?c:100,g=c/2,d=d||8,e=e||1,h,k,j=[],l=[];for(k=0;k<=e;k++){var o=[],n=[],p=k/e,r=p*(b-a)+a;for(h=0;h<=d;h++){var m=h/d,q=new THREE.Vector3;q.x=r*Math.sin(m*Math.PI*2);q.y=-p*c+g;q.z=r*Math.cos(m*Math.PI*2);this.vertices.push(q);o.push(this.vertices.length-1);n.push(new THREE.UV(m,p))}j.push(o);l.push(n)}for(k=0;k<e;k++)for(h=0;h<d;h++){var c=j[k][h],o=j[k+1][h],n=j[k+1][h+1],
+p=j[k][h+1],r=this.vertices[c].clone().setY(0).normalize(),m=this.vertices[o].clone().setY(0).normalize(),q=this.vertices[n].clone().setY(0).normalize(),u=this.vertices[p].clone().setY(0).normalize(),t=l[k][h].clone(),w=l[k+1][h].clone(),s=l[k+1][h+1].clone(),x=l[k][h+1].clone();this.faces.push(new THREE.Face4(c,o,n,p,[r,m,q,u]));this.faceVertexUvs[0].push([t,w,s,x])}if(!f&&a>0){this.vertices.push(new THREE.Vector3(0,g,0));for(h=0;h<d;h++){c=j[0][h];o=j[0][h+1];n=this.vertices.length-1;r=new THREE.Vector3(0,
+1,0);m=new THREE.Vector3(0,1,0);q=new THREE.Vector3(0,1,0);t=l[0][h].clone();w=l[0][h+1].clone();s=new THREE.UV(w.u,0);this.faces.push(new THREE.Face3(c,o,n,[r,m,q]));this.faceVertexUvs[0].push([t,w,s])}}if(!f&&b>0){this.vertices.push(new THREE.Vector3(0,-g,0));for(h=0;h<d;h++){c=j[k][h+1];o=j[k][h];n=this.vertices.length-1;r=new THREE.Vector3(0,-1,0);m=new THREE.Vector3(0,-1,0);q=new THREE.Vector3(0,-1,0);t=l[k][h+1].clone();w=l[k][h].clone();s=new THREE.UV(w.u,1);this.faces.push(new THREE.Face3(c,
+o,n,[r,m,q]));this.faceVertexUvs[0].push([t,w,s])}}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;THREE.ExtrudeGeometry=function(a,b){if(typeof a!=="undefined"){THREE.Geometry.call(this);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,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);if(f===0){console.log("Either infinite or no solutions!");g===0?console.log("Its finite solutions."):console.log("Too bad, no solutions.")}g=g/f;if(g<0){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=a+Math.PI*2);c=(b+a)/2;a=-Math.cos(c);c=-Math.sin(c);return new THREE.Vector2(a,c)}return d.multiplyScalar(g).addSelf(h).subSelf(a).clone()}function e(c,d){var e,f;for(G=c.length;--G>=0;){e=G;f=G-1;f<0&&(f=
-c.length-1);for(var g=0,h=m+j*2,g=0;g<h;g++){var i=F*g,l=F*(g+1),k=d+e+i,i=d+f+i,n=d+f+l,l=d+e+l,o=c,p=g,r=h,k=k+I,i=i+I,n=n+I,l=l+I;H.faces.push(new THREE.Face4(k,i,n,l,null,null,t));k=R.generateSideWallUV(H,a,o,b,k,i,n,l,p,r);H.faceVertexUvs[0].push(k)}}}function f(a,b,c){H.vertices.push(new THREE.Vertex(a,b,c))}function g(c,d,e,f){c=c+I;d=d+I;e=e+I;H.faces.push(new THREE.Face3(c,d,e,null,null,u));c=f?R.generateBottomUV(H,a,b,c,d,e):R.generateTopUV(H,a,b,c,d,e);H.faceVertexUvs[0].push(c)}var h=
-b.amount!==void 0?b.amount:100,l=b.bevelThickness!==void 0?b.bevelThickness:6,k=b.bevelSize!==void 0?b.bevelSize:l-2,j=b.bevelSegments!==void 0?b.bevelSegments:3,o=b.bevelEnabled!==void 0?b.bevelEnabled:true,m=b.steps!==void 0?b.steps:1,p=b.bendPath,r=b.extrudePath,n,q=false,u=b.material,t=b.extrudeMaterial,x,s,z,D;if(r){n=r.getSpacedPoints(m);q=true;o=false;x=new THREE.TubeGeometry.FrenetFrames(r,m,false);s=new THREE.Vector3;z=new THREE.Vector3;D=new THREE.Vector3}if(!o)k=l=j=0;var B,v,w,H=this,
-I=this.vertices.length;p&&a.addWrapPath(p);var r=a.extractPoints(),p=r.shape,M=r.holes;if(r=!THREE.Shape.Utils.isClockWise(p)){p=p.reverse();v=0;for(w=M.length;v<w;v++){B=M[v];THREE.Shape.Utils.isClockWise(B)&&(M[v]=B.reverse())}r=false}var T=THREE.Shape.Utils.triangulateShape(p,M),C=p;v=0;for(w=M.length;v<w;v++){B=M[v];p=p.concat(B)}var K,O,E,i,U,F=p.length,L,W=T.length,r=[],G=0;E=C.length;K=E-1;for(O=G+1;G<E;G++,K++,O++){K===E&&(K=0);O===E&&(O=0);r[G]=d(C[G],C[K],C[O])}var ha=[],fa,la=r.concat();
-v=0;for(w=M.length;v<w;v++){B=M[v];fa=[];G=0;E=B.length;K=E-1;for(O=G+1;G<E;G++,K++,O++){K===E&&(K=0);O===E&&(O=0);fa[G]=d(B[G],B[K],B[O])}ha.push(fa);la=la.concat(fa)}for(K=0;K<j;K++){E=K/j;i=l*(1-E);O=k*Math.sin(E*Math.PI/2);G=0;for(E=C.length;G<E;G++){U=c(C[G],r[G],O);f(U.x,U.y,-i)}v=0;for(w=M.length;v<w;v++){B=M[v];fa=ha[v];G=0;for(E=B.length;G<E;G++){U=c(B[G],fa[G],O);f(U.x,U.y,-i)}}}O=k;for(G=0;G<F;G++){U=o?c(p[G],la[G],O):p[G];if(q){z.copy(x.normals[0]).multiplyScalar(U.x);s.copy(x.binormals[0]).multiplyScalar(U.y);
-D.copy(n[0]).addSelf(z).addSelf(s);f(D.x,D.y,D.z)}else f(U.x,U.y,0)}for(E=1;E<=m;E++)for(G=0;G<F;G++){U=o?c(p[G],la[G],O):p[G];if(q){z.copy(x.normals[E]).multiplyScalar(U.x);s.copy(x.binormals[E]).multiplyScalar(U.y);D.copy(n[E]).addSelf(z).addSelf(s);f(D.x,D.y,D.z)}else f(U.x,U.y,h/m*E)}for(K=j-1;K>=0;K--){E=K/j;i=l*(1-E);O=k*Math.sin(E*Math.PI/2);G=0;for(E=C.length;G<E;G++){U=c(C[G],r[G],O);f(U.x,U.y,h+i)}v=0;for(w=M.length;v<w;v++){B=M[v];fa=ha[v];G=0;for(E=B.length;G<E;G++){U=c(B[G],fa[G],O);
-q?f(U.x,U.y+n[m-1].y,n[m-1].x+i):f(U.x,U.y,h+i)}}}var R=THREE.ExtrudeGeometry.WorldUVGenerator;(function(){if(o){var a;a=F*0;for(G=0;G<W;G++){L=T[G];g(L[2]+a,L[1]+a,L[0]+a,true)}a=m+j*2;a=F*a;for(G=0;G<W;G++){L=T[G];g(L[0]+a,L[1]+a,L[2]+a,false)}}else{for(G=0;G<W;G++){L=T[G];g(L[2],L[1],L[0],true)}for(G=0;G<W;G++){L=T[G];g(L[0]+F*m,L[1]+F*m,L[2]+F*m,false)}}})();(function(){var a=0;e(C,a);a=a+C.length;v=0;for(w=M.length;v<w;v++){B=M[v];e(B,a);a=a+B.length}})()};
-THREE.ExtrudeGeometry.WorldUVGenerator={generateTopUV:function(a,b,c,d,e,f){b=a.vertices[e].x;e=a.vertices[e].y;c=a.vertices[f].x;f=a.vertices[f].y;return[new THREE.UV(a.vertices[d].x,1-a.vertices[d].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].x,c=a.vertices[e].y,e=a.vertices[e].z,d=a.vertices[f].x,l=a.vertices[f].y,f=a.vertices[f].z,k=a.vertices[g].x,j=
-a.vertices[g].y,g=a.vertices[g].z,o=a.vertices[h].x,m=a.vertices[h].y,a=a.vertices[h].z;return Math.abs(c-l)<0.01?[new THREE.UV(b,e),new THREE.UV(d,f),new THREE.UV(k,g),new THREE.UV(o,a)]:[new THREE.UV(c,e),new THREE.UV(l,f),new THREE.UV(j,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;
+h.copy(b).addSelf(f);i.copy(c).addSelf(g);f=d.dot(g);g=i.subSelf(h).dot(g);if(f===0){console.log("Either infinite or no solutions!");g===0?console.log("Its finite solutions."):console.log("Too bad, no solutions.")}g=g/f;if(g<0){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=a+Math.PI*2);c=(b+a)/2;a=-Math.cos(c);c=-Math.sin(c);return new THREE.Vector2(a,c)}return d.multiplyScalar(g).addSelf(h).subSelf(a).clone()}function e(c,d){var e,f;for(H=c.length;--H>=0;){e=H;f=H-1;f<0&&(f=
+c.length-1);for(var g=0,h=n+l*2,g=0;g<h;g++){var i=W*g,j=W*(g+1),k=d+e+i,i=d+f+i,m=d+f+j,j=d+e+j,o=c,p=g,r=h,k=k+J,i=i+J,m=m+J,j=j+J;z.faces.push(new THREE.Face4(k,i,m,j,null,null,t));k=P.generateSideWallUV(z,a,o,b,k,i,m,j,p,r);z.faceVertexUvs[0].push(k)}}}function f(a,b,c){z.vertices.push(new THREE.Vector3(a,b,c))}function g(c,d,e,f){c=c+J;d=d+J;e=e+J;z.faces.push(new THREE.Face3(c,d,e,null,null,u));c=f?P.generateBottomUV(z,a,b,c,d,e):P.generateTopUV(z,a,b,c,d,e);z.faceVertexUvs[0].push(c)}var h=
+b.amount!==void 0?b.amount:100,k=b.bevelThickness!==void 0?b.bevelThickness:6,j=b.bevelSize!==void 0?b.bevelSize:k-2,l=b.bevelSegments!==void 0?b.bevelSegments:3,o=b.bevelEnabled!==void 0?b.bevelEnabled:true,n=b.steps!==void 0?b.steps:1,p=b.bendPath,r=b.extrudePath,m,q=false,u=b.material,t=b.extrudeMaterial,w,s,x,F;if(r){m=r.getSpacedPoints(n);q=true;o=false;w=new THREE.TubeGeometry.FrenetFrames(r,n,false);s=new THREE.Vector3;x=new THREE.Vector3;F=new THREE.Vector3}if(!o)j=k=l=0;var E,B,v,z=this,
+J=this.vertices.length;p&&a.addWrapPath(p);var r=a.extractPoints(),p=r.shape,K=r.holes;if(r=!THREE.Shape.Utils.isClockWise(p)){p=p.reverse();B=0;for(v=K.length;B<v;B++){E=K[B];THREE.Shape.Utils.isClockWise(E)&&(K[B]=E.reverse())}r=false}var X=THREE.Shape.Utils.triangulateShape(p,K),Q=p;B=0;for(v=K.length;B<v;B++){E=K[B];p=p.concat(E)}var A,M,G,i,U,W=p.length,C,Y=X.length,r=[],H=0;G=Q.length;A=G-1;for(M=H+1;H<G;H++,A++,M++){A===G&&(A=0);M===G&&(M=0);r[H]=d(Q[H],Q[A],Q[M])}var ba=[],ga,la=r.concat();
+B=0;for(v=K.length;B<v;B++){E=K[B];ga=[];H=0;G=E.length;A=G-1;for(M=H+1;H<G;H++,A++,M++){A===G&&(A=0);M===G&&(M=0);ga[H]=d(E[H],E[A],E[M])}ba.push(ga);la=la.concat(ga)}for(A=0;A<l;A++){G=A/l;i=k*(1-G);M=j*Math.sin(G*Math.PI/2);H=0;for(G=Q.length;H<G;H++){U=c(Q[H],r[H],M);f(U.x,U.y,-i)}B=0;for(v=K.length;B<v;B++){E=K[B];ga=ba[B];H=0;for(G=E.length;H<G;H++){U=c(E[H],ga[H],M);f(U.x,U.y,-i)}}}M=j;for(H=0;H<W;H++){U=o?c(p[H],la[H],M):p[H];if(q){x.copy(w.normals[0]).multiplyScalar(U.x);s.copy(w.binormals[0]).multiplyScalar(U.y);
+F.copy(m[0]).addSelf(x).addSelf(s);f(F.x,F.y,F.z)}else f(U.x,U.y,0)}for(G=1;G<=n;G++)for(H=0;H<W;H++){U=o?c(p[H],la[H],M):p[H];if(q){x.copy(w.normals[G]).multiplyScalar(U.x);s.copy(w.binormals[G]).multiplyScalar(U.y);F.copy(m[G]).addSelf(x).addSelf(s);f(F.x,F.y,F.z)}else f(U.x,U.y,h/n*G)}for(A=l-1;A>=0;A--){G=A/l;i=k*(1-G);M=j*Math.sin(G*Math.PI/2);H=0;for(G=Q.length;H<G;H++){U=c(Q[H],r[H],M);f(U.x,U.y,h+i)}B=0;for(v=K.length;B<v;B++){E=K[B];ga=ba[B];H=0;for(G=E.length;H<G;H++){U=c(E[H],ga[H],M);
+q?f(U.x,U.y+m[n-1].y,m[n-1].x+i):f(U.x,U.y,h+i)}}}var P=THREE.ExtrudeGeometry.WorldUVGenerator;(function(){if(o){var a;a=W*0;for(H=0;H<Y;H++){C=X[H];g(C[2]+a,C[1]+a,C[0]+a,true)}a=n+l*2;a=W*a;for(H=0;H<Y;H++){C=X[H];g(C[0]+a,C[1]+a,C[2]+a,false)}}else{for(H=0;H<Y;H++){C=X[H];g(C[2],C[1],C[0],true)}for(H=0;H<Y;H++){C=X[H];g(C[0]+W*n,C[1]+W*n,C[2]+W*n,false)}}})();(function(){var a=0;e(Q,a);a=a+Q.length;B=0;for(v=K.length;B<v;B++){E=K[B];e(E,a);a=a+E.length}})()};
+THREE.ExtrudeGeometry.WorldUVGenerator={generateTopUV:function(a,b,c,d,e,f){b=a.vertices[e].x;e=a.vertices[e].y;c=a.vertices[f].x;f=a.vertices[f].y;return[new THREE.UV(a.vertices[d].x,1-a.vertices[d].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].x,c=a.vertices[e].y,e=a.vertices[e].z,d=a.vertices[f].x,k=a.vertices[f].y,f=a.vertices[f].z,j=a.vertices[g].x,l=
+a.vertices[g].y,g=a.vertices[g].z,o=a.vertices[h].x,n=a.vertices[h].y,a=a.vertices[h].z;return Math.abs(c-k)<0.01?[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(k,f),new THREE.UV(l,g),new THREE.UV(n,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);for(var b=b||12,c=c||2*Math.PI,d=[],e=(new THREE.Matrix4).makeRotationZ(c/b),f=0;f<a.length;f++){d[f]=a[f].clone();this.vertices.push((new THREE.Vertex).copy(d[f]))}for(var g=b+1,c=0;c<g;c++)for(f=0;f<d.length;f++){d[f]=e.multiplyVector3(d[f].clone());this.vertices.push((new THREE.Vertex).copy(d[f]))}for(c=0;c<b;c++){d=0;for(e=a.length;d<e-1;d++){this.faces.push(new THREE.Face4(c*e+d,(c+1)%g*e+d,(c+1)%g*e+(d+1)%e,c*e+(d+1)%e));this.faceVertexUvs[0].push([new THREE.UV(1-
-c/b,d/e),new THREE.UV(1-(c+1)/b,d/e),new THREE.UV(1-(c+1)/b,(d+1)/e),new THREE.UV(1-c/b,(d+1)/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,k=b/d,j=new THREE.Vector3(0,1,0),a=0;a<h;a++)for(b=0;b<g;b++)this.vertices.push(new THREE.Vertex(b*l-e,0,a*k-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(j);e.vertexNormals.push(j.clone(),j.clone(),j.clone(),j.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+
+THREE.LatheGeometry=function(a,b,c){THREE.Geometry.call(this);for(var b=b||12,c=c||2*Math.PI,d=[],e=(new THREE.Matrix4).makeRotationZ(c/b),f=0;f<a.length;f++){d[f]=a[f].clone();this.vertices.push(d[f])}for(var g=b+1,c=0;c<g;c++)for(f=0;f<d.length;f++){d[f]=e.multiplyVector3(d[f].clone());this.vertices.push(d[f])}for(c=0;c<b;c++){d=0;for(e=a.length;d<e-1;d++){this.faces.push(new THREE.Face4(c*e+d,(c+1)%g*e+d,(c+1)%g*e+(d+1)%e,c*e+(d+1)%e));this.faceVertexUvs[0].push([new THREE.UV(1-c/b,d/e),new THREE.UV(1-
+(c+1)/b,d/e),new THREE.UV(1-(c+1)/b,(d+1)/e),new THREE.UV(1-c/b,(d+1)/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,k=a/c,j=b/d,l=new THREE.Vector3(0,1,0),a=0;a<h;a++)for(b=0;b<g;b++)this.vertices.push(new THREE.Vector3(b*k-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(l);e.vertexNormals.push(l.clone(),l.clone(),l.clone(),l.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=d!==void 0?d:0,e=e!==void 0?e:Math.PI*2,f=f!==void 0?f:0,g=g!==void 0?g:Math.PI,b=Math.max(3,Math.floor(b)||8),c=Math.max(2,Math.floor(c)||6),h,l,k=[],j=[];for(l=0;l<=c;l++){var o=[],m=[];for(h=0;h<=b;h++){var p=h/b,r=l/c,n=-a*Math.cos(d+p*e)*Math.sin(f+r*g),q=a*Math.cos(f+r*g),u=a*Math.sin(d+p*e)*Math.sin(f+r*g);this.vertices.push(new THREE.Vertex(n,q,u));o.push(this.vertices.length-1);m.push(new THREE.UV(p,r))}k.push(o);
-j.push(m)}for(l=0;l<c;l++)for(h=0;h<b;h++){var d=k[l][h+1],e=k[l][h],f=k[l+1][h],g=k[l+1][h+1],o=this.vertices[d].clone().normalize(),m=this.vertices[e].clone().normalize(),p=this.vertices[f].clone().normalize(),r=this.vertices[g].clone().normalize(),n=j[l][h+1].clone(),q=j[l][h].clone(),u=j[l+1][h].clone(),t=j[l+1][h+1].clone();if(Math.abs(this.vertices[d].y)==a){this.faces.push(new THREE.Face3(d,f,g,[o,p,r]));this.faceVertexUvs[0].push([n,u,t])}else if(Math.abs(this.vertices[f].y)==a){this.faces.push(new THREE.Face3(d,
-e,f,[o,m,p]));this.faceVertexUvs[0].push([n,q,u])}else{this.faces.push(new THREE.Face4(d,e,f,g,[o,m,p,r]));this.faceVertexUvs[0].push([n,q,u,t])}}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=d!==void 0?d:0,e=e!==void 0?e:Math.PI*2,f=f!==void 0?f:0,g=g!==void 0?g:Math.PI,b=Math.max(3,Math.floor(b)||8),c=Math.max(2,Math.floor(c)||6),h,k,j=[],l=[];for(k=0;k<=c;k++){var o=[],n=[];for(h=0;h<=b;h++){var p=h/b,r=k/c,m=new THREE.Vector3;m.x=-a*Math.cos(d+p*e)*Math.sin(f+r*g);m.y=a*Math.cos(f+r*g);m.z=a*Math.sin(d+p*e)*Math.sin(f+r*g);this.vertices.push(m);o.push(this.vertices.length-1);n.push(new THREE.UV(p,
+r))}j.push(o);l.push(n)}for(k=0;k<c;k++)for(h=0;h<b;h++){var d=j[k][h+1],e=j[k][h],f=j[k+1][h],g=j[k+1][h+1],o=this.vertices[d].clone().normalize(),n=this.vertices[e].clone().normalize(),p=this.vertices[f].clone().normalize(),r=this.vertices[g].clone().normalize(),m=l[k][h+1].clone(),q=l[k][h].clone(),u=l[k+1][h].clone(),t=l[k+1][h+1].clone();if(Math.abs(this.vertices[d].y)==a){this.faces.push(new THREE.Face3(d,f,g,[o,p,r]));this.faceVertexUvs[0].push([m,u,t])}else if(Math.abs(this.vertices[f].y)==
+a){this.faces.push(new THREE.Face3(d,e,f,[o,n,p]));this.faceVertexUvs[0].push([m,q,u])}else{this.faces.push(new THREE.Face4(d,e,f,g,[o,n,p,r]));this.faceVertexUvs[0].push([m,q,u,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=b.height!==void 0?b.height:50;if(b.bevelThickness===void 0)b.bevelThickness=10;if(b.bevelSize===void 0)b.bevelSize=8;if(b.bevelEnabled===void 0)b.bevelEnabled=false;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,l,k,j,o,m,p,r,n,q,u=b.glyphs[a]||b.glyphs["?"];if(u){if(u.o){b=u._cachedOutline||(u._cachedOutline=u.o.split(" "));k=b.length;for(a=0;a<k;){l=b[a++];switch(l){case "m":l=b[a++]*c+d;j=b[a++]*c;f.push(new THREE.Vector2(l,j));e.moveTo(l,j);break;case "l":l=b[a++]*c+d;j=b[a++]*c;f.push(new THREE.Vector2(l,
-j));e.lineTo(l,j);break;case "q":l=b[a++]*c+d;j=b[a++]*c;p=b[a++]*c+d;r=b[a++]*c;e.quadraticCurveTo(p,r,l,j);if(g=f[f.length-1]){o=g.x;m=g.y;g=1;for(h=this.divisions;g<=h;g++){var t=g/h,x=THREE.Shape.Utils.b2(t,o,p,l),t=THREE.Shape.Utils.b2(t,m,r,j);f.push(new THREE.Vector2(x,t))}}break;case "b":l=b[a++]*c+d;j=b[a++]*c;p=b[a++]*c+d;r=b[a++]*-c;n=b[a++]*c+d;q=b[a++]*-c;e.bezierCurveTo(l,j,p,r,n,q);if(g=f[f.length-1]){o=g.x;m=g.y;g=1;for(h=this.divisions;g<=h;g++){t=g/h;x=THREE.Shape.Utils.b3(t,o,p,
-n,l);t=THREE.Shape.Utils.b3(t,m,r,q,j);f.push(new THREE.Vector2(x,t))}}}}}return{offset:u.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=e+(a[f].x*a[g].y-a[g].x*a[f].y);return e*0.5};a.Triangulate=function(a,d){var e=a.length;if(e<3)return null;var f=[],g=[],h=[],l,k,j;if(b(a)>0)for(k=0;k<e;k++)g[k]=k;else for(k=0;k<e;k++)g[k]=e-1-k;var o=2*e;for(k=e-1;e>2;){if(o--<=0){console.log("Warning, unable to triangulate polygon!");break}l=k;e<=l&&(l=0);k=l+1;e<=k&&(k=0);j=k+1;e<=j&&(j=0);var m;a:{m=a;var p=l,r=k,n=j,q=e,u=g,t=void 0,x=void 0,s=void 0,z=void 0,D=void 0,
-B=void 0,v=void 0,w=void 0,H=void 0,x=m[u[p]].x,s=m[u[p]].y,z=m[u[r]].x,D=m[u[r]].y,B=m[u[n]].x,v=m[u[n]].y;if(1.0E-10>(z-x)*(v-s)-(D-s)*(B-x))m=false;else{for(t=0;t<q;t++)if(!(t==p||t==r||t==n)){var w=m[u[t]].x,H=m[u[t]].y,I=void 0,M=void 0,T=void 0,C=void 0,K=void 0,O=void 0,E=void 0,i=void 0,U=void 0,F=void 0,L=void 0,W=void 0,I=T=K=void 0,I=B-z,M=v-D,T=x-B,C=s-v,K=z-x,O=D-s,E=w-x,i=H-s,U=w-z,F=H-D,L=w-B,W=H-v,I=I*F-M*U,K=K*i-O*E,T=T*W-C*L;if(I>=0&&T>=0&&K>=0){m=false;break a}}m=true}}if(m){f.push([a[g[l]],
-a[g[k]],a[g[j]]]);h.push([g[l],g[k],g[j]]);l=k;for(j=k+1;j<e;l++,j++)g[l]=g[j];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||Math.PI*2;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=c/this.segmentsR*Math.PI*2;e.x=this.radius*Math.cos(f);e.y=this.radius*Math.sin(f);var h=new THREE.Vertex;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(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);
+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,k,j,l,o,n,p,r,m,q,u=b.glyphs[a]||b.glyphs["?"];if(u){if(u.o){b=u._cachedOutline||(u._cachedOutline=u.o.split(" "));j=b.length;for(a=0;a<j;){k=b[a++];switch(k){case "m":k=b[a++]*c+d;l=b[a++]*c;f.push(new THREE.Vector2(k,l));e.moveTo(k,l);break;case "l":k=b[a++]*c+d;l=b[a++]*c;f.push(new THREE.Vector2(k,
+l));e.lineTo(k,l);break;case "q":k=b[a++]*c+d;l=b[a++]*c;p=b[a++]*c+d;r=b[a++]*c;e.quadraticCurveTo(p,r,k,l);if(g=f[f.length-1]){o=g.x;n=g.y;g=1;for(h=this.divisions;g<=h;g++){var t=g/h,w=THREE.Shape.Utils.b2(t,o,p,k),t=THREE.Shape.Utils.b2(t,n,r,l);f.push(new THREE.Vector2(w,t))}}break;case "b":k=b[a++]*c+d;l=b[a++]*c;p=b[a++]*c+d;r=b[a++]*-c;m=b[a++]*c+d;q=b[a++]*-c;e.bezierCurveTo(k,l,p,r,m,q);if(g=f[f.length-1]){o=g.x;n=g.y;g=1;for(h=this.divisions;g<=h;g++){t=g/h;w=THREE.Shape.Utils.b3(t,o,p,
+m,k);t=THREE.Shape.Utils.b3(t,n,r,q,l);f.push(new THREE.Vector2(w,t))}}}}}return{offset:u.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=e+(a[f].x*a[g].y-a[g].x*a[f].y);return e*0.5};a.Triangulate=function(a,d){var e=a.length;if(e<3)return null;var f=[],g=[],h=[],k,j,l;if(b(a)>0)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;e>2;){if(o--<=0){console.log("Warning, unable to triangulate polygon!");break}k=j;e<=k&&(k=0);j=k+1;e<=j&&(j=0);l=j+1;e<=l&&(l=0);var n;a:{n=a;var p=k,r=j,m=l,q=e,u=g,t=void 0,w=void 0,s=void 0,x=void 0,F=void 0,
+E=void 0,B=void 0,v=void 0,z=void 0,w=n[u[p]].x,s=n[u[p]].y,x=n[u[r]].x,F=n[u[r]].y,E=n[u[m]].x,B=n[u[m]].y;if(1.0E-10>(x-w)*(B-s)-(F-s)*(E-w))n=false;else{for(t=0;t<q;t++)if(!(t==p||t==r||t==m)){var v=n[u[t]].x,z=n[u[t]].y,J=void 0,K=void 0,X=void 0,Q=void 0,A=void 0,M=void 0,G=void 0,i=void 0,U=void 0,W=void 0,C=void 0,Y=void 0,J=X=A=void 0,J=E-x,K=B-F,X=w-E,Q=s-B,A=x-w,M=F-s,G=v-w,i=z-s,U=v-x,W=z-F,C=v-E,Y=z-B,J=J*W-K*U,A=A*i-M*G,X=X*Y-Q*C;if(J>=0&&X>=0&&A>=0){n=false;break a}}n=true}}if(n){f.push([a[g[k]],
+a[g[j]],a[g[l]]]);h.push([g[k],g[j],g[l]]);k=j;for(l=j+1;l<e;k++,l++)g[k]=g[l];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||Math.PI*2;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=c/this.segmentsR*Math.PI*2;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(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,k=new THREE.Face4(e,f,g,h,[b[e],b[f],b[g],b[h]]);k.normal.addSelf(b[e]);k.normal.addSelf(b[f]);k.normal.addSelf(b[g]);k.normal.addSelf(b[h]);k.normal.normalize();this.faces.push(k);
 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*a;c=Math.cos(a);g=e*(2+c)*0.5*g;b=e*(2+c)*b*0.5;e=f*e*Math.sin(a)*0.5;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 l=a/this.segmentsR*2*this.p*Math.PI,g=b/this.segmentsT*2*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=f.x+(l*d.x+g*e.x);f.y=f.y+(l*d.y+g*e.y);f.z=f.z+(l*d.z+g*e.z);this.grid[a][b]=this.vertices.push(new THREE.Vertex(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),k=new THREE.UV((a+1)/this.segmentsR,(b+1)/this.segmentsT),j=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,k,j])}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||false;if(f)this.debug=new THREE.Object3D;this.grid=[];var g,h,f=this.segments+1,l,k,j,o=new THREE.Vector3,m,p,r,b=new THREE.TubeGeometry.FrenetFrames(a,b,e);m=b.tangents;p=b.normals;r=b.binormals;this.tangents=m;this.normals=p;this.binormals=r;for(b=0;b<f;b++){this.grid[b]=[];d=b/(f-1);j=a.getPointAt(d);d=m[b];g=p[b];h=r[b];if(this.debug){this.debug.add(new THREE.ArrowHelper(d,
-j,c,255));this.debug.add(new THREE.ArrowHelper(g,j,c,16711680));this.debug.add(new THREE.ArrowHelper(h,j,c,65280))}for(d=0;d<this.segmentsRadius;d++){l=d/this.segmentsRadius*2*Math.PI;k=-this.radius*Math.cos(l);l=this.radius*Math.sin(l);o.copy(j);o.x=o.x+(k*g.x+l*h.x);o.y=o.y+(k*g.y+l*h.y);o.z=o.z+(k*g.z+l*h.z);this.grid[b][d]=this.vertices.push(new THREE.Vertex(o.x,o.y,o.z))-1}}for(b=0;b<this.segments;b++)for(d=0;d<this.segmentsRadius;d++){f=e?(b+1)%this.segments:b+1;o=(d+1)%this.segmentsRadius;
-a=this.grid[b][d];c=this.grid[f][d];f=this.grid[f][o];o=this.grid[b][o];m=new THREE.UV(b/this.segments,d/this.segmentsRadius);p=new THREE.UV((b+1)/this.segments,d/this.segmentsRadius);r=new THREE.UV((b+1)/this.segments,(d+1)/this.segmentsRadius);g=new THREE.UV(b/this.segments,(d+1)/this.segmentsRadius);this.faces.push(new THREE.Face4(a,c,f,o));this.faceVertexUvs[0].push([m,p,r,g])}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.TubeGeometry.prototype=new THREE.Geometry;
+Array(this.segmentsT);for(b=0;b<this.segmentsT;++b){var k=a/this.segmentsR*2*this.p*Math.PI,g=b/this.segmentsT*2*Math.PI,f=h(k,g,this.q,this.p,this.radius,this.heightScale),k=h(k+0.01,g,this.q,this.p,this.radius,this.heightScale);c.sub(k,f);d.add(k,f);e.cross(c,d);d.cross(e,c);e.normalize();d.normalize();k=-this.tube*Math.cos(g);g=this.tube*Math.sin(g);f.x=f.x+(k*d.x+g*e.x);f.y=f.y+(k*d.y+g*e.y);f.z=f.z+(k*d.z+g*e.z);this.grid[a][b]=this.vertices.push(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),k=new THREE.UV((a+1)/this.segmentsR,b/this.segmentsT),j=new THREE.UV((a+1)/this.segmentsR,(b+1)/this.segmentsT),l=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,k,j,l])}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||false;if(f)this.debug=new THREE.Object3D;this.grid=[];var g,h,f=this.segments+1,k,j,l,o=new THREE.Vector3,n,p,r,b=new THREE.TubeGeometry.FrenetFrames(a,b,e);n=b.tangents;p=b.normals;r=b.binormals;this.tangents=n;this.normals=p;this.binormals=r;for(b=0;b<f;b++){this.grid[b]=[];d=b/(f-1);l=a.getPointAt(d);d=n[b];g=p[b];h=r[b];if(this.debug){this.debug.add(new THREE.ArrowHelper(d,
+l,c,255));this.debug.add(new THREE.ArrowHelper(g,l,c,16711680));this.debug.add(new THREE.ArrowHelper(h,l,c,65280))}for(d=0;d<this.segmentsRadius;d++){k=d/this.segmentsRadius*2*Math.PI;j=-this.radius*Math.cos(k);k=this.radius*Math.sin(k);o.copy(l);o.x=o.x+(j*g.x+k*h.x);o.y=o.y+(j*g.y+k*h.y);o.z=o.z+(j*g.z+k*h.z);this.grid[b][d]=this.vertices.push(new THREE.Vector3(o.x,o.y,o.z))-1}}for(b=0;b<this.segments;b++)for(d=0;d<this.segmentsRadius;d++){f=e?(b+1)%this.segments:b+1;o=(d+1)%this.segmentsRadius;
+a=this.grid[b][d];c=this.grid[f][d];f=this.grid[f][o];o=this.grid[b][o];n=new THREE.UV(b/this.segments,d/this.segmentsRadius);p=new THREE.UV((b+1)/this.segments,d/this.segmentsRadius);r=new THREE.UV((b+1)/this.segments,(d+1)/this.segmentsRadius);g=new THREE.UV(b/this.segments,(d+1)/this.segmentsRadius);this.faces.push(new THREE.Face4(a,c,f,o));this.faceVertexUvs[0].push([n,p,r,g])}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.TubeGeometry.prototype=new THREE.Geometry;
 THREE.TubeGeometry.prototype.constructor=THREE.TubeGeometry;
-THREE.TubeGeometry.FrenetFrames=function(a,b,c){new THREE.Vector3;var d=new THREE.Vector3;new THREE.Vector3;var e=[],f=[],g=[],h=new THREE.Vector3,l=new THREE.Matrix4,b=b+1,k,j,o;this.tangents=e;this.normals=f;this.binormals=g;for(k=0;k<b;k++){j=k/(b-1);e[k]=a.getTangentAt(j);e[k].normalize()}f[0]=new THREE.Vector3;g[0]=new THREE.Vector3;a=Number.MAX_VALUE;k=Math.abs(e[0].x);j=Math.abs(e[0].y);o=Math.abs(e[0].z);if(k<=a){a=k;d.set(1,0,0)}if(j<=a){a=j;d.set(0,1,0)}o<=a&&d.set(0,0,1);h.cross(e[0],d).normalize();
-f[0].cross(e[0],h);g[0].cross(e[0],f[0]);for(k=1;k<b;k++){f[k]=f[k-1].clone();g[k]=g[k-1].clone();h.cross(e[k-1],e[k]);if(h.length()>1.0E-4){h.normalize();d=Math.acos(e[k-1].dot(e[k]));l.makeRotationAxis(h,d).multiplyVector3(f[k])}g[k].cross(e[k],f[k])}if(c){d=Math.acos(f[0].dot(f[b-1]));d=d/(b-1);e[0].dot(h.cross(f[0],f[b-1]))>0&&(d=-d);for(k=1;k<b;k++){l.makeRotationAxis(e[k],d*k).multiplyVector3(f[k]);g[k].cross(e[k],f[k])}}};
-THREE.PolyhedronGeometry=function(a,b,c,d){function e(a){var b=(new THREE.Vertex).copy(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){if(d<1){d=new THREE.Face3(a.index,b.index,c.index,[a.clone(),b.clone(),c.clone()]);d.centroid.addSelf(a).addSelf(b).addSelf(c).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,d),h(b.uv,b,d),h(c.uv,c,d)])}else{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];c===void 0&&(o[a.index][b.index]=o[b.index][a.index]=c=e((new THREE.Vector3).add(a,b).divideScalar(2)));return c}function h(a,b,c){c<0&&a.u===1&&(a=new THREE.UV(a.u-1,a.v));b.x===0&&b.z===0&&(a=new THREE.UV(c/2/Math.PI+0.5,a.v));
-return a}THREE.Geometry.call(this);for(var c=c||1,d=d||0,l=this,k=0,j=a.length;k<j;k++)e(new THREE.Vector3(a[k][0],a[k][1],a[k][2]));for(var o=[],a=this.vertices,k=0,j=b.length;k<j;k++)f(a[b[k][0]],a[b[k][1]],a[b[k][2]],d);this.mergeVertices();k=0;for(j=this.vertices.length;k<j;k++)this.vertices[k].multiplyScalar(c);this.computeCentroids();this.boundingSphere={radius:c}};THREE.PolyhedronGeometry.prototype=new THREE.Geometry;THREE.PolyhedronGeometry.prototype.constructor=THREE.PolyhedronGeometry;
+THREE.TubeGeometry.FrenetFrames=function(a,b,c){new THREE.Vector3;var d=new THREE.Vector3;new THREE.Vector3;var e=[],f=[],g=[],h=new THREE.Vector3,k=new THREE.Matrix4,b=b+1,j,l,o;this.tangents=e;this.normals=f;this.binormals=g;for(j=0;j<b;j++){l=j/(b-1);e[j]=a.getTangentAt(l);e[j].normalize()}f[0]=new THREE.Vector3;g[0]=new THREE.Vector3;a=Number.MAX_VALUE;j=Math.abs(e[0].x);l=Math.abs(e[0].y);o=Math.abs(e[0].z);if(j<=a){a=j;d.set(1,0,0)}if(l<=a){a=l;d.set(0,1,0)}o<=a&&d.set(0,0,1);h.cross(e[0],d).normalize();
+f[0].cross(e[0],h);g[0].cross(e[0],f[0]);for(j=1;j<b;j++){f[j]=f[j-1].clone();g[j]=g[j-1].clone();h.cross(e[j-1],e[j]);if(h.length()>1.0E-4){h.normalize();d=Math.acos(e[j-1].dot(e[j]));k.makeRotationAxis(h,d).multiplyVector3(f[j])}g[j].cross(e[j],f[j])}if(c){d=Math.acos(f[0].dot(f[b-1]));d=d/(b-1);e[0].dot(h.cross(f[0],f[b-1]))>0&&(d=-d);for(j=1;j<b;j++){k.makeRotationAxis(e[j],d*j).multiplyVector3(f[j]);g[j].cross(e[j],f[j])}}};
+THREE.PolyhedronGeometry=function(a,b,c,d){function e(a){var b=a.normalize().clone();b.index=k.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){if(d<1){d=new THREE.Face3(a.index,b.index,c.index,[a.clone(),b.clone(),c.clone()]);d.centroid.addSelf(a).addSelf(b).addSelf(c).divideScalar(3);d.normal=d.centroid.clone().normalize();k.faces.push(d);d=Math.atan2(d.centroid.z,-d.centroid.x);
+k.faceVertexUvs[0].push([h(a.uv,a,d),h(b.uv,b,d),h(c.uv,c,d)])}else{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];c===void 0&&(o[a.index][b.index]=o[b.index][a.index]=c=e((new THREE.Vector3).add(a,b).divideScalar(2)));return c}function h(a,b,c){c<0&&a.u===1&&(a=new THREE.UV(a.u-1,a.v));b.x===0&&b.z===0&&(a=new THREE.UV(c/2/Math.PI+0.5,a.v));return a}THREE.Geometry.call(this);
+for(var c=c||1,d=d||0,k=this,j=0,l=a.length;j<l;j++)e(new THREE.Vector3(a[j][0],a[j][1],a[j][2]));for(var o=[],a=this.vertices,j=0,l=b.length;j<l;j++)f(a[b[j][0]],a[b[j][1]],a[b[j][2]],d);this.mergeVertices();j=0;for(l=this.vertices.length;j<l;j++)this.vertices[j].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(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);d===void 0&&(d=16776960);c===void 0&&(c=20);var e=new THREE.Geometry;e.vertices.push(new THREE.Vertex(0,0,0));e.vertices.push(new THREE.Vertex(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=
+THREE.AxisHelper=function(){THREE.Object3D.call(this);var a=new THREE.Geometry;a.vertices.push(new THREE.Vector3);a.vertices.push(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);d===void 0&&(d=16776960);c===void 0&&(c=20);var e=new THREE.Geometry;e.vertices.push(new THREE.Vector3(0,0,0));e.vertices.push(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);d.lineGeometry.colors.push(new THREE.Color(b));d.pointMap[a]===void 0&&(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",
+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.Vector3);d.lineGeometry.colors.push(new THREE.Color(b));d.pointMap[a]===void 0&&(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,e,f){THREE.CameraHelper.__v.set(d,e,f);THREE.CameraHelper.__projector.unprojectVector(THREE.CameraHelper.__v,THREE.CameraHelper.__c);a=b.pointMap[a];if(a!==void 0){d=0;for(e=a.length;d<e;d++)b.lineGeometry.vertices[a[d]].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=true};THREE.CameraHelper.__projector=new THREE.Projector;THREE.CameraHelper.__v=new THREE.Vector3;THREE.CameraHelper.__c=new THREE.Camera;
 THREE.SubdivisionModifier=function(a){this.subdivisions=a===void 0?1:a;this.useOldVertexColors=false;this.supportUVs=true;this.debug=false};THREE.SubdivisionModifier.prototype.constructor=THREE.SubdivisionModifier;THREE.SubdivisionModifier.prototype.modify=function(a){for(var b=this.subdivisions;b-- >0;)this.smooth(a)};
-THREE.SubdivisionModifier.prototype.smooth=function(a){function b(){m.debug&&console.log.apply(console,arguments)}function c(){console&&console.log.apply(console,arguments)}function d(a,c,d,e,g,h,i){var l=new THREE.Face4(a,c,d,e,null,g.color,g.material);if(m.useOldVertexColors){l.vertexColors=[];for(var k,n,p,q=0;q<4;q++){p=h[q];k=new THREE.Color;k.setRGB(0,0,0);for(var r=0;r<p.length;r++){n=g.vertexColors[p[r]-1];k.r=k.r+n.r;k.g=k.g+n.g;k.b=k.b+n.b}k.r=k.r/p.length;k.g=k.g/p.length;k.b=k.b/p.length;
-l.vertexColors[q]=k}}j.push(l);if(m.supportUVs){g=[f(a,""),f(c,i),f(d,i),f(e,i)];g[0]?g[1]?g[2]?g[3]?o.push(g):b("d :( ",e+":"+i):b("c :( ",d+":"+i):b("b :( ",c+":"+i):b("a :( ",a+":"+i)}}function e(a,b){return Math.min(a,b)+"_"+Math.max(a,b)}function f(a,d){var e=a+":"+d,f=t[e];if(!f){a>=x&&a<x+r.length?b("face pt"):b("edge pt");c("warning, UV not found for",e);return null}return f}function g(a,b,d){var e=a+":"+b;e in t?c("dup vertexNo",a,"oldFaceNo",b,"value",d,"key",e,t[e]):t[e]=d}function h(a,
-b){T[a]===void 0&&(T[a]=[]);T[a].push(b)}function l(a,b,c){C[a]===void 0&&(C[a]={});C[a][b]=c}var k=[],j=[],o=[],m=this,p=a.vertices,r=a.faces,k=p.concat(),n=[],q={},u={},t={},x=p.length,s,z,D,B,v,w=a.faceVertexUvs[0],H;b("originalFaces, uvs, originalVerticesLength",r.length,w.length,x);if(m.supportUVs){s=0;for(z=w.length;s<z;s++){D=0;for(B=w[s].length;D<B;D++){H=r[s]["abcd".charAt(D)];g(H,s,w[s][D])}}}if(w.length==0)m.supportUVs=false;s=0;for(v in t)s++;if(!s){m.supportUVs=false;b("no uvs")}b("-- Original Faces + Vertices UVs completed",
-t,"vs",w.length);s=0;for(z=r.length;s<z;s++){v=r[s];n.push(v.centroid);k.push((new THREE.Vertex).copy(v.centroid));if(m.supportUVs){w=new THREE.UV;if(v instanceof THREE.Face3){w.u=f(v.a,s).u+f(v.b,s).u+f(v.c,s).u;w.v=f(v.a,s).v+f(v.b,s).v+f(v.c,s).v;w.u=w.u/3;w.v=w.v/3}else if(v instanceof THREE.Face4){w.u=f(v.a,s).u+f(v.b,s).u+f(v.c,s).u+f(v.d,s).u;w.v=f(v.a,s).v+f(v.b,s).v+f(v.c,s).v+f(v.d,s).v;w.u=w.u/4;w.v=w.v/4}g(x+s,"",w)}}b("-- added UVs for new Faces",t);z=function(a){function b(a,c){h[a]===
-void 0&&(h[a]=[]);h[a].push(c)}var c,d,f,g,h={};c=0;for(d=a.faces.length;c<d;c++){f=a.faces[c];if(f instanceof THREE.Face3){g=e(f.a,f.b);b(g,c);g=e(f.b,f.c);b(g,c);g=e(f.c,f.a);b(g,c)}else if(f instanceof THREE.Face4){g=e(f.a,f.b);b(g,c);g=e(f.b,f.c);b(g,c);g=e(f.c,f.d);b(g,c);g=e(f.d,f.a);b(g,c)}}return h}(a);H=0;var I,M,T={},C={};for(s in z){w=z[s];I=s.split("_");M=I[0];I=I[1];h(M,[M,I]);h(I,[M,I]);D=0;for(B=w.length;D<B;D++){v=w[D];l(M,v,s);l(I,v,s)}w.length<2&&(u[s]=true)}b("vertexEdgeMap",T,
-"vertexFaceMap",C);for(s in z){w=z[s];v=w[0];B=w[1];I=s.split("_");M=I[0];I=I[1];w=new THREE.Vector3;if(u[s]){w.addSelf(p[M]);w.addSelf(p[I]);w.multiplyScalar(0.5)}else{w.addSelf(n[v]);w.addSelf(n[B]);w.addSelf(p[M]);w.addSelf(p[I]);w.multiplyScalar(0.25)}q[s]=x+r.length+H;k.push((new THREE.Vertex).copy(w));H++;if(m.supportUVs){w=new THREE.UV;w.u=f(M,v).u+f(I,v).u;w.v=f(M,v).v+f(I,v).v;w.u=w.u/2;w.v=w.v/2;g(q[s],v,w);if(!u[s]){w=new THREE.UV;w.u=f(M,B).u+f(I,B).u;w.v=f(M,B).v+f(I,B).v;w.u=w.u/2;w.v=
-w.v/2;g(q[s],B,w)}}}b("-- Step 2 done");var K,O;B=["123","12","2","23"];I=["123","23","3","31"];var E=["123","31","1","12"],i=["1234","12","2","23"],U=["1234","23","3","34"],F=["1234","34","4","41"],L=["1234","41","1","12"];s=0;for(z=n.length;s<z;s++){v=r[s];w=x+s;if(v instanceof THREE.Face3){H=e(v.a,v.b);M=e(v.b,v.c);K=e(v.c,v.a);d(w,q[H],v.b,q[M],v,B,s);d(w,q[M],v.c,q[K],v,I,s);d(w,q[K],v.a,q[H],v,E,s)}else if(v instanceof THREE.Face4){H=e(v.a,v.b);M=e(v.b,v.c);K=e(v.c,v.d);O=e(v.d,v.a);d(w,q[H],
-v.b,q[M],v,i,s);d(w,q[M],v.c,q[K],v,U,s);d(w,q[K],v.d,q[O],v,F,s);d(w,q[O],v.a,q[H],v,L,s)}else b("face should be a face!",v)}q=new THREE.Vector3;v=new THREE.Vector3;s=0;for(z=p.length;s<z;s++)if(T[s]!==void 0){q.set(0,0,0);v.set(0,0,0);M=new THREE.Vector3(0,0,0);w=0;for(D in C[s]){q.addSelf(n[D]);w++}B=0;H=T[s].length;for(D=0;D<H;D++)u[e(T[s][D][0],T[s][D][1])]&&B++;if(B!=2){q.divideScalar(w);for(D=0;D<H;D++){w=T[s][D];w=p[w[0]].clone().addSelf(p[w[1]]).divideScalar(2);v.addSelf(w)}v.divideScalar(H);
-M.addSelf(p[s]);M.multiplyScalar(H-3);M.addSelf(q);M.addSelf(v.multiplyScalar(2));M.divideScalar(H);k[s]=M}}a.vertices=k;a.faces=j;a.faceVertexUvs[0]=o;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.SubdivisionModifier.prototype.smooth=function(a){function b(){n.debug&&console.log.apply(console,arguments)}function c(){console&&console.log.apply(console,arguments)}function d(a,c,d,e,g,h,i){var j=new THREE.Face4(a,c,d,e,null,g.color,g.material);if(n.useOldVertexColors){j.vertexColors=[];for(var k,m,p,r=0;r<4;r++){p=h[r];k=new THREE.Color;k.setRGB(0,0,0);for(var q=0;q<p.length;q++){m=g.vertexColors[p[q]-1];k.r=k.r+m.r;k.g=k.g+m.g;k.b=k.b+m.b}k.r=k.r/p.length;k.g=k.g/p.length;k.b=k.b/p.length;
+j.vertexColors[r]=k}}l.push(j);if(n.supportUVs){g=[f(a,""),f(c,i),f(d,i),f(e,i)];g[0]?g[1]?g[2]?g[3]?o.push(g):b("d :( ",e+":"+i):b("c :( ",d+":"+i):b("b :( ",c+":"+i):b("a :( ",a+":"+i)}}function e(a,b){return Math.min(a,b)+"_"+Math.max(a,b)}function f(a,d){var e=a+":"+d,f=t[e];if(!f){a>=w&&a<w+r.length?b("face pt"):b("edge pt");c("warning, UV not found for",e);return null}return f}function g(a,b,d){var e=a+":"+b;e in t?c("dup vertexNo",a,"oldFaceNo",b,"value",d,"key",e,t[e]):t[e]=d}function h(a,
+b){X[a]===void 0&&(X[a]=[]);X[a].push(b)}function k(a,b,c){Q[a]===void 0&&(Q[a]={});Q[a][b]=c}var j=[],l=[],o=[],n=this,p=a.vertices,r=a.faces,j=p.concat(),m=[],q={},u={},t={},w=p.length,s,x,F,E,B,v=a.faceVertexUvs[0],z;b("originalFaces, uvs, originalVerticesLength",r.length,v.length,w);if(n.supportUVs){s=0;for(x=v.length;s<x;s++){F=0;for(E=v[s].length;F<E;F++){z=r[s]["abcd".charAt(F)];g(z,s,v[s][F])}}}if(v.length==0)n.supportUVs=false;s=0;for(B in t)s++;if(!s){n.supportUVs=false;b("no uvs")}b("-- Original Faces + Vertices UVs completed",
+t,"vs",v.length);s=0;for(x=r.length;s<x;s++){B=r[s];m.push(B.centroid);j.push(B.centroid.clone());if(n.supportUVs){v=new THREE.UV;if(B instanceof THREE.Face3){v.u=f(B.a,s).u+f(B.b,s).u+f(B.c,s).u;v.v=f(B.a,s).v+f(B.b,s).v+f(B.c,s).v;v.u=v.u/3;v.v=v.v/3}else if(B instanceof THREE.Face4){v.u=f(B.a,s).u+f(B.b,s).u+f(B.c,s).u+f(B.d,s).u;v.v=f(B.a,s).v+f(B.b,s).v+f(B.c,s).v+f(B.d,s).v;v.u=v.u/4;v.v=v.v/4}g(w+s,"",v)}}b("-- added UVs for new Faces",t);x=function(a){function b(a,c){h[a]===void 0&&(h[a]=
+[]);h[a].push(c)}var c,d,f,g,h={};c=0;for(d=a.faces.length;c<d;c++){f=a.faces[c];if(f instanceof THREE.Face3){g=e(f.a,f.b);b(g,c);g=e(f.b,f.c);b(g,c);g=e(f.c,f.a);b(g,c)}else if(f instanceof THREE.Face4){g=e(f.a,f.b);b(g,c);g=e(f.b,f.c);b(g,c);g=e(f.c,f.d);b(g,c);g=e(f.d,f.a);b(g,c)}}return h}(a);z=0;var J,K,X={},Q={};for(s in x){v=x[s];J=s.split("_");K=J[0];J=J[1];h(K,[K,J]);h(J,[K,J]);F=0;for(E=v.length;F<E;F++){B=v[F];k(K,B,s);k(J,B,s)}v.length<2&&(u[s]=true)}b("vertexEdgeMap",X,"vertexFaceMap",
+Q);for(s in x){v=x[s];B=v[0];E=v[1];J=s.split("_");K=J[0];J=J[1];v=new THREE.Vector3;if(u[s]){v.addSelf(p[K]);v.addSelf(p[J]);v.multiplyScalar(0.5)}else{v.addSelf(m[B]);v.addSelf(m[E]);v.addSelf(p[K]);v.addSelf(p[J]);v.multiplyScalar(0.25)}q[s]=w+r.length+z;j.push(v);z++;if(n.supportUVs){v=new THREE.UV;v.u=f(K,B).u+f(J,B).u;v.v=f(K,B).v+f(J,B).v;v.u=v.u/2;v.v=v.v/2;g(q[s],B,v);if(!u[s]){v=new THREE.UV;v.u=f(K,E).u+f(J,E).u;v.v=f(K,E).v+f(J,E).v;v.u=v.u/2;v.v=v.v/2;g(q[s],E,v)}}}b("-- Step 2 done");
+var A,M;E=["123","12","2","23"];J=["123","23","3","31"];var G=["123","31","1","12"],i=["1234","12","2","23"],U=["1234","23","3","34"],W=["1234","34","4","41"],C=["1234","41","1","12"];s=0;for(x=m.length;s<x;s++){B=r[s];v=w+s;if(B instanceof THREE.Face3){z=e(B.a,B.b);K=e(B.b,B.c);A=e(B.c,B.a);d(v,q[z],B.b,q[K],B,E,s);d(v,q[K],B.c,q[A],B,J,s);d(v,q[A],B.a,q[z],B,G,s)}else if(B instanceof THREE.Face4){z=e(B.a,B.b);K=e(B.b,B.c);A=e(B.c,B.d);M=e(B.d,B.a);d(v,q[z],B.b,q[K],B,i,s);d(v,q[K],B.c,q[A],B,U,
+s);d(v,q[A],B.d,q[M],B,W,s);d(v,q[M],B.a,q[z],B,C,s)}else b("face should be a face!",B)}q=new THREE.Vector3;B=new THREE.Vector3;s=0;for(x=p.length;s<x;s++)if(X[s]!==void 0){q.set(0,0,0);B.set(0,0,0);K=new THREE.Vector3(0,0,0);v=0;for(F in Q[s]){q.addSelf(m[F]);v++}E=0;z=X[s].length;for(F=0;F<z;F++)u[e(X[s][F][0],X[s][F][1])]&&E++;if(E!=2){q.divideScalar(v);for(F=0;F<z;F++){v=X[s][F];v=p[v[0]].clone().addSelf(p[v[1]]).divideScalar(2);B.addSelf(v)}B.divideScalar(z);K.addSelf(p[s]);K.multiplyScalar(z-
+3);K.addSelf(q);K.addSelf(B.multiplyScalar(2));K.divideScalar(z);j[s]=K}}a.vertices=j;a.faces=l;a.faceVertexUvs[0]=o;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(a.length<1?".":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++){b=a.materials[c];if(b instanceof THREE.ShaderMaterial)return true}return false},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=true};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(f[0]!=1)a[c].wrapS=THREE.RepeatWrapping;if(f[1]!=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(f[h[0]]!==void 0)a[c].wrapS=f[h[0]];if(f[h[1]]!==void 0)a[c].wrapT=f[h[1]]}e(a[c],b+"/"+d)}function g(a){return(a[0]*255<<16)+(a[1]*255<<8)+a[2]*255}var h=this,l="MeshLambertMaterial",k={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:a.wireframe};
-if(a.shading){var j=a.shading.toLowerCase();j==="phong"?l="MeshPhongMaterial":j==="basic"&&(l="MeshBasicMaterial")}if(a.blending!==void 0&&THREE[a.blending]!==void 0)k.blending=THREE[a.blending];if(a.transparent!==void 0||a.opacity<1)k.transparent=a.transparent;if(a.depthTest!==void 0)k.depthTest=a.depthTest;if(a.depthWrite!==void 0)k.depthWrite=a.depthWrite;if(a.vertexColors!==void 0)if(a.vertexColors=="face")k.vertexColors=THREE.FaceColors;else if(a.vertexColors)k.vertexColors=THREE.VertexColors;
-if(a.colorDiffuse)k.color=g(a.colorDiffuse);else if(a.DbgColor)k.color=a.DbgColor;if(a.colorSpecular)k.specular=g(a.colorSpecular);if(a.colorAmbient)k.ambient=g(a.colorAmbient);if(a.transparency)k.opacity=a.transparency;if(a.specularCoef)k.shininess=a.specularCoef;a.mapDiffuse&&b&&f(k,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap);a.mapLight&&b&&f(k,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap);a.mapNormal&&b&&f(k,"normalMap",a.mapNormal,a.mapNormalRepeat,
-a.mapNormalOffset,a.mapNormalWrap);a.mapSpecular&&b&&f(k,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){l=THREE.ShaderUtils.lib.normal;j=THREE.UniformsUtils.clone(l.uniforms);j.tNormal.texture=k.normalMap;if(a.mapNormalFactor)j.uNormalScale.value=a.mapNormalFactor;if(k.map){j.tDiffuse.texture=k.map;j.enableDiffuse.value=true}if(k.specularMap){j.tSpecular.texture=k.specularMap;j.enableSpecular.value=true}if(k.lightMap){j.tAO.texture=k.lightMap;
-j.enableAO.value=true}j.uDiffuseColor.value.setHex(k.color);j.uSpecularColor.value.setHex(k.specular);j.uAmbientColor.value.setHex(k.ambient);j.uShininess.value=k.shininess;if(k.opacity!==void 0)j.uOpacity.value=k.opacity;k=new THREE.ShaderMaterial({fragmentShader:l.fragmentShader,vertexShader:l.vertexShader,uniforms:j,lights:true,fog:true})}else k=new THREE[l](k);if(a.DbgName!==void 0)k.name=a.DbgName;return k}};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};
+d;if(f){a[c].repeat.set(f[0],f[1]);if(f[0]!=1)a[c].wrapS=THREE.RepeatWrapping;if(f[1]!=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(f[h[0]]!==void 0)a[c].wrapS=f[h[0]];if(f[h[1]]!==void 0)a[c].wrapT=f[h[1]]}e(a[c],b+"/"+d)}function g(a){return(a[0]*255<<16)+(a[1]*255<<8)+a[2]*255}var h=this,k="MeshLambertMaterial",j={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:a.wireframe};
+if(a.shading){var l=a.shading.toLowerCase();l==="phong"?k="MeshPhongMaterial":l==="basic"&&(k="MeshBasicMaterial")}if(a.blending!==void 0&&THREE[a.blending]!==void 0)j.blending=THREE[a.blending];if(a.transparent!==void 0||a.opacity<1)j.transparent=a.transparent;if(a.depthTest!==void 0)j.depthTest=a.depthTest;if(a.depthWrite!==void 0)j.depthWrite=a.depthWrite;if(a.vertexColors!==void 0)if(a.vertexColors=="face")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){k=THREE.ShaderUtils.lib.normal;l=THREE.UniformsUtils.clone(k.uniforms);l.tNormal.texture=j.normalMap;if(a.mapNormalFactor)l.uNormalScale.value=a.mapNormalFactor;if(j.map){l.tDiffuse.texture=j.map;l.enableDiffuse.value=true}if(j.specularMap){l.tSpecular.texture=j.specularMap;l.enableSpecular.value=true}if(j.lightMap){l.tAO.texture=j.lightMap;
+l.enableAO.value=true}l.uDiffuseColor.value.setHex(j.color);l.uSpecularColor.value.setHex(j.specular);l.uAmbientColor.value.setHex(j.ambient);l.uShininess.value=j.shininess;if(j.opacity!==void 0)l.uOpacity.value=j.opacity;j=new THREE.ShaderMaterial({fragmentShader:k.fragmentShader,vertexShader:k.vertexShader,uniforms:l,lights:true,fog:true})}else j=new THREE[k](j);if(a.DbgName!==void 0)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(g.readyState==4)if(g.status==200||g.status==0){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,true);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(){if(f.readyState==4)f.status==200||f.status==0?THREE.BinaryLoader.prototype.createBinModel(f.response,b,d,a.materials):console.error("THREE.BinaryLoader: Couldn't load ["+g+"] ["+f.status+"]");else if(f.readyState==3){if(e){h==0&&(h=f.getResponseHeader("Content-Length"));e({total:h,loaded:f.responseText.length})}}else f.readyState==2&&(h=f.getResponseHeader("Content-Length"))};
 f.open("GET",g,true);f.responseType="arraybuffer";f.send(null)};
-THREE.BinaryLoader.prototype.createBinModel=function(a,b,c,d){var e=function(b){var c,e,l,k,j,o,m,p,r,n,q,u,t,x,s;function z(a){return a%4?4-a%4:0}function D(a,b){return(new Uint8Array(a,b,1))[0]}function B(a,b){return(new Uint32Array(a,b,1))[0]}function v(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[d*3];f=l[d*3+1];g=l[d*3+2];h=E[e*2];e=E[e*2+1];i=E[f*2];j=E[f*2+1];f=E[g*2];k=E[g*2+1];g=C.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 w(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[d*4];f=n[d*4+1];g=n[d*4+2];h=n[d*4+3];i=E[e*2];e=E[e*2+1];j=E[f*2];l=E[f*2+1];k=E[g*2];m=E[g*2+1];g=E[h*2];f=E[h*2+1];h=C.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 H(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[d*3];f=c[d*3+1];g=c[d*3+2];h=i[d];
-C.faces.push(new THREE.Face3(e,f,g,null,null,h))}}function I(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[d*4];f=c[d*4+1];g=c[d*4+2];h=c[d*4+3];i=j[d];C.faces.push(new THREE.Face4(e,f,g,h,null,null,i))}}function M(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[e*3];g=c[e*3+1];h=c[e*3+2];j=d[e*3];k=d[e*3+1];l=d[e*3+2];i=m[e];var n=O[k*3],o=O[k*3+1];k=O[k*3+2];var p=O[l*3],
-q=O[l*3+1];l=O[l*3+2];C.faces.push(new THREE.Face3(f,g,h,[new THREE.Vector3(O[j*3],O[j*3+1],O[j*3+2]),new THREE.Vector3(n,o,k),new THREE.Vector3(p,q,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[e*4];g=c[e*4+1];h=c[e*4+2];i=c[e*4+3];k=d[e*4];l=d[e*4+1];m=d[e*4+2];n=d[e*4+3];j=o[e];var p=O[l*3],q=O[l*3+1];l=O[l*3+2];var r=O[m*3],s=O[m*3+1];m=O[m*3+2];var u=O[n*3],t=O[n*3+1];n=O[n*3+2];C.faces.push(new THREE.Face4(f,
-g,h,i,[new THREE.Vector3(O[k*3],O[k*3+1],O[k*3+2]),new THREE.Vector3(p,q,l),new THREE.Vector3(r,s,m),new THREE.Vector3(u,t,n)],null,j))}}var C=this,K=0,O=[],E=[],i,U,F;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(C,d,b);(function(a,b,c){for(var a=new Uint8Array(a,b,c),d="",e=0;e<c;e++)d=d+String.fromCharCode(a[b+e]);return d})(a,K,12);c=D(a,K+12);D(a,K+13);D(a,K+14);D(a,K+15);e=D(a,K+16);l=D(a,K+17);k=D(a,K+18);j=D(a,K+19);o=B(a,K+20);m=B(a,K+20+4);p=B(a,K+20+8);b=B(a,K+20+12);r=
-B(a,K+20+16);n=B(a,K+20+20);q=B(a,K+20+24);u=B(a,K+20+28);t=B(a,K+20+32);x=B(a,K+20+36);s=B(a,K+20+40);K=K+c;c=e*3+j;F=e*4+j;i=b*c;U=r*(c+l*3);e=n*(c+k*3);j=q*(c+l*3+k*3);c=u*F;l=t*(F+l*4);k=x*(F+k*4);K=K+function(b){var b=new Float32Array(a,b,o*3),c,d,e,f;for(c=0;c<o;c++){d=b[c*3];e=b[c*3+1];f=b[c*3+2];C.vertices.push(new THREE.Vertex(d,e,f))}return o*3*Float32Array.BYTES_PER_ELEMENT}(K);K=K+function(b){if(m){var b=new Int8Array(a,b,m*3),c,d,e,f;for(c=0;c<m;c++){d=b[c*3];e=b[c*3+1];f=b[c*3+2];O.push(d/
-127,e/127,f/127)}}return m*3*Int8Array.BYTES_PER_ELEMENT}(K);K=K+z(m*3);K=K+function(b){if(p){var b=new Float32Array(a,b,p*2),c,d,e;for(c=0;c<p;c++){d=b[c*2];e=b[c*2+1];E.push(d,e)}}return p*2*Float32Array.BYTES_PER_ELEMENT}(K);i=K+i+z(b*2);U=i+U+z(r*2);e=U+e+z(n*2);j=e+j+z(q*2);c=j+c+z(u*2);l=c+l+z(t*2);k=l+k+z(x*2);(function(a){if(n){var b=a+n*Uint32Array.BYTES_PER_ELEMENT*3;H(n,a,b+n*Uint32Array.BYTES_PER_ELEMENT*3);v(n,b)}})(U);(function(a){if(q){var b=a+q*Uint32Array.BYTES_PER_ELEMENT*3,c=b+
-q*Uint32Array.BYTES_PER_ELEMENT*3;M(q,a,b,c+q*Uint32Array.BYTES_PER_ELEMENT*3);v(q,c)}})(e);(function(a){if(x){var b=a+x*Uint32Array.BYTES_PER_ELEMENT*4;I(x,a,b+x*Uint32Array.BYTES_PER_ELEMENT*4);w(x,b)}})(l);(function(a){if(s){var b=a+s*Uint32Array.BYTES_PER_ELEMENT*4,c=b+s*Uint32Array.BYTES_PER_ELEMENT*4;T(s,a,b,c+s*Uint32Array.BYTES_PER_ELEMENT*4);w(s,c)}})(k);b&&H(b,K,K+b*Uint32Array.BYTES_PER_ELEMENT*3);(function(a){if(r){var b=a+r*Uint32Array.BYTES_PER_ELEMENT*3;M(r,a,b,b+r*Uint32Array.BYTES_PER_ELEMENT*
-3)}})(i);u&&I(u,j,j+u*Uint32Array.BYTES_PER_ELEMENT*4);(function(a){if(t){var b=a+t*Uint32Array.BYTES_PER_ELEMENT*4;T(t,a,b,b+t*Uint32Array.BYTES_PER_ELEMENT*4)}})(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){ea=a;d=d||ta;if(e!==void 0){a=e.split("/");a.pop();ua=(a.length<1?".":a.join("/"))+"/"}if((a=ea.evaluate("//dae:asset",ea,W,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(!Ha.convertUpAxis||Xa===Ha.upAxis)ma=null;else switch(Xa){case "X":ma=Ha.upAxis===
-"Y"?"XtoY":"XtoZ";break;case "Y":ma=Ha.upAxis==="X"?"YtoX":"YtoZ";break;case "Z":ma=Ha.upAxis==="X"?"ZtoX":"ZtoY"}Sa=b("//dae:library_images/dae:image",g,"image");Ja=b("//dae:library_materials/dae:material",w,"material");db=b("//dae:library_effects/dae:effect",C,"effect");Ya=b("//dae:library_geometries/dae:geometry",q,"geometry");hb=b(".//dae:library_cameras/dae:camera",F,"camera");Wa=b("//dae:library_controllers/dae:controller",h,"controller");sa=b("//dae:library_animations/dae:animation",O,"animation");
-Oa=b(".//dae:library_visual_scenes/dae:visual_scene",j,"visual_scene");va=[];ab=[];if(a=ea.evaluate(".//dae:scene/dae:instance_visual_scene",ea,W,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext()){a=a.getAttribute("url").replace(/^#/,"");xa=Oa[a.length>0?a:"visual_scene0"]}else xa=null;Ma=new THREE.Object3D;for(a=0;a<xa.nodes.length;a++)Ma.add(f(xa.nodes[a]));mb=[];c(Ma);a={scene:Ma,morphs:va,skins:ab,animations:mb,dae:{images:Sa,materials:Ja,cameras:hb,effects:db,geometries:Ya,controllers:Wa,
-animations:sa,visualScenes:Oa,scene:xa}};d&&d(a);return a}function b(a,b,c){for(var a=ea.evaluate(a,ea,W,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null),d={},e=a.iterateNext(),f=0;e;){e=(new b).parse(e);if(!e.id||e.id.length==0)e.id=c+f++;d[e.id]=e;e=a.iterateNext()}return d}function c(a){var b=xa.getChildById(a.name,true),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};mb.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,k,j,l,o,n,p,r,m,q,u,t,w,s;function x(a){return a%4?4-a%4:0}function F(a,b){return(new Uint8Array(a,b,1))[0]}function E(a,b){return(new Uint32Array(a,b,1))[0]}function B(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[d*3];f=l[d*3+1];g=l[d*3+2];h=G[e*2];e=G[e*2+1];i=G[f*2];j=G[f*2+1];f=G[g*2];k=G[g*2+1];g=Q.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 v(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[d*4];f=n[d*4+1];g=n[d*4+2];h=n[d*4+3];i=G[e*2];e=G[e*2+1];j=G[f*2];l=G[f*2+1];k=G[g*2];m=G[g*2+1];g=G[h*2];f=G[h*2+1];h=Q.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 z(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[d*3];f=c[d*3+1];g=c[d*3+2];h=i[d];
+Q.faces.push(new THREE.Face3(e,f,g,null,null,h))}}function J(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[d*4];f=c[d*4+1];g=c[d*4+2];h=c[d*4+3];i=j[d];Q.faces.push(new THREE.Face4(e,f,g,h,null,null,i))}}function K(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[e*3];g=c[e*3+1];h=c[e*3+2];j=d[e*3];k=d[e*3+1];l=d[e*3+2];i=m[e];var n=M[k*3],o=M[k*3+1];k=M[k*3+2];var p=M[l*3],
+r=M[l*3+1];l=M[l*3+2];Q.faces.push(new THREE.Face3(f,g,h,[new THREE.Vector3(M[j*3],M[j*3+1],M[j*3+2]),new THREE.Vector3(n,o,k),new THREE.Vector3(p,r,l)],null,i))}}function X(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[e*4];g=c[e*4+1];h=c[e*4+2];i=c[e*4+3];k=d[e*4];l=d[e*4+1];m=d[e*4+2];n=d[e*4+3];j=o[e];var p=M[l*3],r=M[l*3+1];l=M[l*3+2];var q=M[m*3],s=M[m*3+1];m=M[m*3+2];var t=M[n*3],u=M[n*3+1];n=M[n*3+2];Q.faces.push(new THREE.Face4(f,
+g,h,i,[new THREE.Vector3(M[k*3],M[k*3+1],M[k*3+2]),new THREE.Vector3(p,r,l),new THREE.Vector3(q,s,m),new THREE.Vector3(t,u,n)],null,j))}}var Q=this,A=0,M=[],G=[],i,U,W;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(Q,d,b);(function(a,b,c){for(var a=new Uint8Array(a,b,c),d="",e=0;e<c;e++)d=d+String.fromCharCode(a[b+e]);return d})(a,A,12);c=F(a,A+12);F(a,A+13);F(a,A+14);F(a,A+15);e=F(a,A+16);k=F(a,A+17);j=F(a,A+18);l=F(a,A+19);o=E(a,A+20);n=E(a,A+20+4);p=E(a,A+20+8);b=E(a,A+20+12);r=
+E(a,A+20+16);m=E(a,A+20+20);q=E(a,A+20+24);u=E(a,A+20+28);t=E(a,A+20+32);w=E(a,A+20+36);s=E(a,A+20+40);A=A+c;c=e*3+l;W=e*4+l;i=b*c;U=r*(c+k*3);e=m*(c+j*3);l=q*(c+k*3+j*3);c=u*W;k=t*(W+k*4);j=w*(W+j*4);A=A+function(b){var b=new Float32Array(a,b,o*3),c,d,e,f;for(c=0;c<o;c++){d=b[c*3];e=b[c*3+1];f=b[c*3+2];Q.vertices.push(new THREE.Vector3(d,e,f))}return o*3*Float32Array.BYTES_PER_ELEMENT}(A);A=A+function(b){if(n){var b=new Int8Array(a,b,n*3),c,d,e,f;for(c=0;c<n;c++){d=b[c*3];e=b[c*3+1];f=b[c*3+2];M.push(d/
+127,e/127,f/127)}}return n*3*Int8Array.BYTES_PER_ELEMENT}(A);A=A+x(n*3);A=A+function(b){if(p){var b=new Float32Array(a,b,p*2),c,d,e;for(c=0;c<p;c++){d=b[c*2];e=b[c*2+1];G.push(d,e)}}return p*2*Float32Array.BYTES_PER_ELEMENT}(A);i=A+i+x(b*2);U=i+U+x(r*2);e=U+e+x(m*2);l=e+l+x(q*2);c=l+c+x(u*2);k=c+k+x(t*2);j=k+j+x(w*2);(function(a){if(m){var b=a+m*Uint32Array.BYTES_PER_ELEMENT*3;z(m,a,b+m*Uint32Array.BYTES_PER_ELEMENT*3);B(m,b)}})(U);(function(a){if(q){var b=a+q*Uint32Array.BYTES_PER_ELEMENT*3,c=b+
+q*Uint32Array.BYTES_PER_ELEMENT*3;K(q,a,b,c+q*Uint32Array.BYTES_PER_ELEMENT*3);B(q,c)}})(e);(function(a){if(w){var b=a+w*Uint32Array.BYTES_PER_ELEMENT*4;J(w,a,b+w*Uint32Array.BYTES_PER_ELEMENT*4);v(w,b)}})(k);(function(a){if(s){var b=a+s*Uint32Array.BYTES_PER_ELEMENT*4,c=b+s*Uint32Array.BYTES_PER_ELEMENT*4;X(s,a,b,c+s*Uint32Array.BYTES_PER_ELEMENT*4);v(s,c)}})(j);b&&z(b,A,A+b*Uint32Array.BYTES_PER_ELEMENT*3);(function(a){if(r){var b=a+r*Uint32Array.BYTES_PER_ELEMENT*3;K(r,a,b,b+r*Uint32Array.BYTES_PER_ELEMENT*
+3)}})(i);u&&J(u,l,l+u*Uint32Array.BYTES_PER_ELEMENT*4);(function(a){if(t){var b=a+t*Uint32Array.BYTES_PER_ELEMENT*4;X(t,a,b,b+t*Uint32Array.BYTES_PER_ELEMENT*4)}})(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){fa=a;d=d||ta;if(e!==void 0){a=e.split("/");a.pop();ua=(a.length<1?".":a.join("/"))+"/"}if((a=fa.evaluate("//dae:asset",fa,Y,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(!Ha.convertUpAxis||Xa===Ha.upAxis)ma=null;else switch(Xa){case "X":ma=Ha.upAxis===
+"Y"?"XtoY":"XtoZ";break;case "Y":ma=Ha.upAxis==="X"?"YtoX":"YtoZ";break;case "Z":ma=Ha.upAxis==="X"?"ZtoX":"ZtoY"}Sa=b("//dae:library_images/dae:image",g,"image");Ja=b("//dae:library_materials/dae:material",v,"material");db=b("//dae:library_effects/dae:effect",Q,"effect");Ya=b("//dae:library_geometries/dae:geometry",q,"geometry");hb=b(".//dae:library_cameras/dae:camera",W,"camera");Wa=b("//dae:library_controllers/dae:controller",h,"controller");sa=b("//dae:library_animations/dae:animation",M,"animation");
+Oa=b(".//dae:library_visual_scenes/dae:visual_scene",l,"visual_scene");va=[];ab=[];if(a=fa.evaluate(".//dae:scene/dae:instance_visual_scene",fa,Y,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext()){a=a.getAttribute("url").replace(/^#/,"");xa=Oa[a.length>0?a:"visual_scene0"]}else xa=null;Ma=new THREE.Object3D;for(a=0;a<xa.nodes.length;a++)Ma.add(f(xa.nodes[a]));mb=[];c(Ma);a={scene:Ma,morphs:va,skins:ab,animations:mb,dae:{images:Sa,materials:Ja,cameras:hb,effects:db,geometries:Ya,controllers:Wa,
+animations:sa,visualScenes:Oa,scene:xa}};d&&d(a);return a}function b(a,b,c){for(var a=fa.evaluate(a,fa,Y,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null),d={},e=a.iterateNext(),f=0;e;){e=(new b).parse(e);if(!e.id||e.id.length==0)e.id=c+f++;d[e.id]=e;e=a.iterateNext()}return d}function c(a){var b=xa.getChildById(a.name,true),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};mb.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=Wa[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 sa)for(var i=sa[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=xa.getChildById(b.skeleton[0],true)||xa.getChildBySid(b.skeleton[0],true),l,m,g=new THREE.Vector3,
-n,j=0;j<a.vertices.length;j++)f.skin.bindShapeMatrix.multiplyVector3(a.vertices[j]);for(c=0;c<e;c++){h=[];i=[];for(j=0;j<a.vertices.length;j++)i.push(new THREE.Vertex);d(b,h,c);j=h;k=f.skin;for(m=0;m<j.length;m++){l=j[m];n=-1;if(l.type=="JOINT"){for(var o=0;o<k.joints.length;o++)if(l.sid==k.joints[o]){n=o;break}if(n>=0){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 q=
-k.weights[o][p];q.joint==n&&l.weights.push(q)}}else throw"ColladaLoader: Could not find joint '"+l.sid+"'.";}}for(j=0;j<h.length;j++)if(h[j].type=="JOINT")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.x;g.y=n.y;g.z=n.z;h[j].skinningMatrix.multiplyVector3(g);m.x=m.x+g.x*l;m.y=m.y+g.y*l;m.z=m.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=Wa[a.controllers[g].url];
-switch(i.type){case "skin":if(Ya[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(Wa[i.skin.source]){d=i=Wa[i.skin.source];if(i.morph&&Ya[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(Ya[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=Ya[i.url],k={},l=[],m=0,o;if(i&&i.mesh&&i.mesh.primitives){if(b.name.length==0)b.name=i.id;if(j)for(h=0;h<j.length;h++){o=j[h];var q=Ja[o.target],r=db[q.instance_effect.url].shader;r.material.opacity=!r.material.opacity?1:r.material.opacity;k[o.symbol]=m;l.push(r.material);o=r.material;o.name=q.name==null||q.name===""?q.id:q.name;
-m++}j=o||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});i=i.mesh.geometry3js;if(m>1){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(c!==void 0){e(i,c);j.morphTargets=true;j=new THREE.SkinnedMesh(i,j);j.skeleton=c.skeleton;j.skinController=Wa[c.url];j.skinInstanceController=c;j.name="skin_"+ab.length;ab.push(j)}else if(d!==void 0){h=i;k=d instanceof p?Wa[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++){m=Ya[k.targets[l]];if(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})}j.morphTargets=true;j=new THREE.Mesh(i,j);j.name="morph_"+va.length;va.push(j)}else j=new THREE.Mesh(i,j);a.geometries.length>1?b.add(j):b=j}}for(g=0;g<a.cameras.length;g++){b=hb[a.cameras[g].url];
+n,j=0;j<a.vertices.length;j++)f.skin.bindShapeMatrix.multiplyVector3(a.vertices[j]);for(c=0;c<e;c++){h=[];i=[];for(j=0;j<a.vertices.length;j++)i.push(new THREE.Vector3);d(b,h,c);j=h;k=f.skin;for(m=0;m<j.length;m++){l=j[m];n=-1;if(l.type=="JOINT"){for(var o=0;o<k.joints.length;o++)if(l.sid==k.joints[o]){n=o;break}if(n>=0){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(h[j].type=="JOINT")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.x;g.y=n.y;g.z=n.z;h[j].skinningMatrix.multiplyVector3(g);m.x=m.x+g.x*l;m.y=m.y+g.y*l;m.z=m.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=Wa[a.controllers[g].url];
+switch(i.type){case "skin":if(Ya[i.skin.source]){var j=new m;j.url=i.skin.source;j.instance_material=a.controllers[g].instance_material;a.geometries.push(j);c=a.controllers[g]}else if(Wa[i.skin.source]){d=i=Wa[i.skin.source];if(i.morph&&Ya[i.morph.source]){j=new m;j.url=i.morph.source;j.instance_material=a.controllers[g].instance_material;a.geometries.push(j)}}break;case "morph":if(Ya[i.morph.source]){j=new m;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=Ya[i.url],k={},l=[],n=0,o;if(i&&i.mesh&&i.mesh.primitives){if(b.name.length==0)b.name=i.id;if(j)for(h=0;h<j.length;h++){o=j[h];var r=Ja[o.target],q=db[r.instance_effect.url].shader;q.material.opacity=!q.material.opacity?1:q.material.opacity;k[o.symbol]=n;l.push(q.material);o=q.material;o.name=r.name==null||r.name===""?r.id:r.name;
+n++}j=o||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});i=i.mesh.geometry3js;if(n>1){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(c!==void 0){e(i,c);j.morphTargets=true;j=new THREE.SkinnedMesh(i,j);j.skeleton=c.skeleton;j.skinController=Wa[c.url];j.skinInstanceController=c;j.name="skin_"+ab.length;ab.push(j)}else if(d!==void 0){h=i;k=d instanceof p?Wa[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++){n=Ya[k.targets[l]];if(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})}j.morphTargets=true;j=new THREE.Mesh(i,j);j.name="morph_"+va.length;va.push(j)}else j=new THREE.Mesh(i,j);a.geometries.length>1?b.add(j):b=j}}for(g=0;g<a.cameras.length;g++){b=hb[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=true;b.scale=g[2];if(Ha.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 k(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function j(){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 m(){this.type=this.sid="";this.data=[];this.obj=null}function p(){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 u(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 x(){t.call(this);this.vcount=[]}function s(){t.call(this);this.vcount=3}function z(){this.source="";this.stride=
-this.count=0;this.params=[]}function D(){this.input={}}function B(){this.semantic="";this.offset=0;this.source="";this.set=0}function v(a){this.id=a;this.type=null}function w(){this.name=this.id="";this.instance_effect=null}function H(){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 I(a,b){this.type=a;this.effect=b;this.material=null}function M(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 C(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function K(){this.url=""}function O(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function E(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 U(a){this.targets=[];this.time=a}function F(){this.technique=this.name=this.id=""}function L(){this.url=""}function W(a){return a=="dae"?"http://www.collada.org/2005/11/COLLADASchema":null}function G(a){for(var a=fa(a),b=[],c=0,d=a.length;c<d;c++)b.push(parseFloat(a[c]));return b}function ha(a){for(var a=fa(a),b=[],c=0,d=a.length;c<d;c++)b.push(parseInt(a[c],10));return b}function fa(a){return a.length>
-0?a.replace(/^\s+/,"").replace(/\s+$/,"").split(/\s+/):[]}function la(a,b,c){return a.hasAttribute(b)?parseInt(a.getAttribute(b),10):c}function R(a,b){if(Ha.convertUpAxis&&Xa!==Ha.upAxis)switch(ma){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(Ha.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])}function aa(a){if(Ha.convertUpAxis)switch(a){case "X":switch(ma){case "XtoY":case "XtoZ":case "YtoX":a="Y";break;case "ZtoX":a="Z"}break;case "Y":switch(ma){case "XtoY":case "YtoX":case "ZtoX":a="X";break;case "XtoZ":case "YtoZ":case "ZtoY":a="Z"}break;case "Z":switch(ma){case "XtoZ":a="X";break;case "YtoZ":case "ZtoX":case "ZtoY":a="Y"}}return a}var ea=null,Ma=null,xa,ta=null,Na={},
+null}function k(){this.weights=this.targets=this.source=this.method=null}function j(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function l(){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 n(){this.type=this.sid="";this.data=[];this.obj=null}function p(){this.url=
+"";this.skeleton=[];this.instance_material=[]}function r(){this.target=this.symbol=""}function m(){this.url="";this.instance_material=[]}function q(){this.id="";this.mesh=null}function u(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 w(){t.call(this);this.vcount=[]}function s(){t.call(this);this.vcount=3}function x(){this.source="";this.stride=
+this.count=0;this.params=[]}function F(){this.input={}}function E(){this.semantic="";this.offset=0;this.source="";this.set=0}function B(a){this.id=a;this.type=null}function v(){this.name=this.id="";this.instance_effect=null}function z(){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 K(a){this.effect=a;this.format=this.init_from=
+null}function X(a){this.effect=a;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=this.source=null}function Q(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function A(){this.url=""}function M(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function G(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 U(a){this.targets=[];this.time=a}function W(){this.technique=this.name=this.id=""}function C(){this.url=""}function Y(a){return a=="dae"?"http://www.collada.org/2005/11/COLLADASchema":null}function H(a){for(var a=ga(a),b=[],c=0,d=a.length;c<d;c++)b.push(parseFloat(a[c]));return b}function ba(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 a.length>
+0?a.replace(/^\s+/,"").replace(/\s+$/,"").split(/\s+/):[]}function la(a,b,c){return a.hasAttribute(b)?parseInt(a.getAttribute(b),10):c}function P(a,b){if(Ha.convertUpAxis&&Xa!==Ha.upAxis)switch(ma){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]];P(c,-1);return new THREE.Vector3(c[0],c[1],c[2])}function ca(a){if(Ha.convertUpAxis){var b=[a[0],a[4],a[8]];P(b,-1);a[0]=b[0];a[4]=b[1];a[8]=b[2];b=[a[1],a[5],a[9]];P(b,-1);a[1]=b[0];a[5]=b[1];a[9]=b[2];b=[a[2],a[6],a[10]];P(b,-1);a[2]=b[0];a[6]=b[1];a[10]=b[2];b=[a[0],a[1],a[2]];P(b,-1);a[0]=b[0];a[1]=b[1];a[2]=b[2];b=[a[4],a[5],a[6]];P(b,-1);a[4]=b[0];a[5]=b[1];a[6]=b[2];b=[a[8],a[9],a[10]];P(b,-1);a[8]=b[0];a[9]=b[1];a[10]=b[2];b=[a[3],a[7],a[11]];P(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])}function T(a){if(Ha.convertUpAxis)switch(a){case "X":switch(ma){case "XtoY":case "XtoZ":case "YtoX":a="Y";break;case "ZtoX":a="Z"}break;case "Y":switch(ma){case "XtoY":case "YtoX":case "ZtoX":a="X";break;case "XtoZ":case "YtoZ":case "ZtoY":a="Z"}break;case "Z":switch(ma){case "XtoZ":a="X";break;case "YtoZ":case "ZtoX":case "ZtoY":a="Y"}}return a}var fa=null,Ma=null,xa,ta=null,Na={},
 Sa={},sa={},Wa={},Ya={},Ja={},db={},hb={},mb,Oa,ua,va,ab,ja=THREE.SmoothShading,Ha={centerGeometry:false,convertUpAxis:false,subdivideFaces:true,upAxis:"Y"},Xa="Y",ma=null,Fb=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(c.nodeName=="init_from")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 k).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(e.nodeType==1)switch(e.nodeName){case "source":e=(new v).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++){a=c[d];e=b[a.source];switch(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(d.nodeType==1)switch(d.nodeName){case "input":b.push((new B).parse(d))}}return b};k.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(f.nodeType==1)switch(f.nodeName){case "bind_shape_matrix":f=G(f.textContent);this.bindShapeMatrix=ba(f);break;case "source":f=(new v).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};k.prototype.parseJoints=function(a,b){for(var c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "input":var d=
-(new B).parse(d),e=b[d.source];if(d.semantic=="JOINT")this.joints=e.read();else if(d.semantic=="INV_BIND_MATRIX")this.invBindMatrices=e.read()}}};k.prototype.parseWeights=function(a,b){for(var c,d,e=[],f=0;f<a.childNodes.length;f++){var g=a.childNodes[f];if(g.nodeType==1)switch(g.nodeName){case "input":e.push((new B).parse(g));break;case "v":c=ha(g.textContent);break;case "vcount":d=ha(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=g+e.length}for(j=0;j<i.length;j++)i[j].index=f;this.weights.push(i)}};j.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};j.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};j.prototype.parse=function(a){this.id=
+a.childNodes[b];switch(c.nodeName){case "skin":this.skin=(new j).parse(c);this.type=c.nodeName;break;case "morph":this.morph=(new k).parse(c);this.type=c.nodeName}}return this};k.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(e.nodeType==1)switch(e.nodeName){case "source":e=(new B).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++){a=c[d];e=b[a.source];switch(a.semantic){case "MORPH_TARGET":this.targets=e.read();break;case "MORPH_WEIGHT":this.weights=e.read()}}return this};k.prototype.parseInputs=function(a){for(var b=[],c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "input":b.push((new E).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(f.nodeType==1)switch(f.nodeName){case "bind_shape_matrix":f=H(f.textContent);this.bindShapeMatrix=ca(f);break;case "source":f=(new B).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(d.nodeType==1)switch(d.nodeName){case "input":var d=
+(new E).parse(d),e=b[d.source];if(d.semantic=="JOINT")this.joints=e.read();else if(d.semantic=="INV_BIND_MATRIX")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(g.nodeType==1)switch(g.nodeName){case "input":e.push((new E).parse(g));break;case "v":c=ba(g.textContent);break;case "vcount":d=ba(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=g+e.length}for(j=0;j<i.length;j++)i[j].index=f;this.weights.push(i)}};l.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};l.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};l.prototype.parse=function(a){this.id=
 a.getAttribute("id");this.name=a.getAttribute("name");this.nodes=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "node":this.nodes.push((new o).parse(c))}}return this};o.prototype.getChannelForTransform=function(a){for(var b=0;b<this.channels.length;b++){var c=this.channels[b],d=c.target.split("/");d.shift();var e=d.shift(),f=e.indexOf(".")>=0,g=e.indexOf("(")>=0,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){c.info={sid:e,dotSyntax:f,arrSyntax:g,arrIndices:h};return 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=this.type=="JOINT"?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++){b=a.childNodes[c];
-if(b.nodeType==1)switch(b.nodeName){case "node":this.nodes.push((new o).parse(b));break;case "instance_camera":this.cameras.push((new L).parse(b));break;case "instance_controller":this.controllers.push((new p).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=ea.evaluate(".//dae:library_nodes//dae:node[@id='"+b+"']",ea,W,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 m).parse(b));break;case "extra":break;default:console.log(b.nodeName)}}a=[];c=1E6;b=-1E6;for(var d in sa)for(var e=sa[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++){var i=this.channels[c],f=i.fullSid,g=i.sampler,h=g.input,j=this.getTransformBySid(i.sid),k;if(i.arrIndices){k=[];b=0;for(var l=i.arrIndices.length;b<l;b++){var q=k,r=b,s=i.arrIndices[b];if(s>-1&&s<3){s=aa(["X","Y","Z"][s]);s={X:0,Y:1,Z:2}[s]}q[r]=s}}else k=aa(i.member);if(j){a.indexOf(f)===-1&&a.push(f);b=0;for(l=h.length;b<l;b++){for(var q=h[b],i=g.getData(j.type,b),r=null,s=0,u=d.length;s<u&&r==null;s++){var t=d[s];if(t.time===
-q)r=t;else if(t.time>q)break}if(!r){r=new U(q);s=-1;u=0;for(t=d.length;u<t&&s==-1;u++)d[u].time>=q&&(s=u);q=s;d.splice(q==-1?d.length:q,0,r)}r.addTarget(f,j,k,i)}}else console.log('Could not find transform "'+i.sid+'" in node '+this.id)}for(c=0;c<a.length;c++){e=a[c];for(b=0;b<d.length;b++){r=d[b];if(!r.hasTarget(e)){h=d;f=r;k=b;g=e;j=void 0;a:{j=k?k-1:0;for(j=j>=0?j:j+h.length;j>=0;j--){l=h[j];if(l.hasTarget(g)){j=l;break a}}j=null}l=void 0;a:{for(k=k+1;k<h.length;k++){l=h[k];if(l.hasTarget(g))break a}l=
-null}if(j&&l){h=(f.time-j.time)/(l.time-j.time);j=j.getTarget(g);k=l.getTarget(g).data;l=j.data;i=void 0;if(j.type==="matrix")i=l;else if(l.length){i=[];for(q=0;q<l.length;++q)i[q]=l[q]+(k[q]-l[q])*h}else i=l+(k-l)*h;f.addTarget(g,j.transform,j.member,i)}}}}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)};m.prototype.parse=function(a){this.sid=a.getAttribute("sid");
-this.type=a.nodeName;this.data=G(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]*Fb;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){var c=["X","Y","Z","ANGLE"];switch(this.type){case "matrix":if(b)if(b.length===1)switch(b[0]){case 0:this.obj.n11=a[0];this.obj.n21=a[1];this.obj.n31=a[2];this.obj.n41=a[3];break;case 1:this.obj.n12=a[0];this.obj.n22=a[1];this.obj.n32=a[2];this.obj.n42=a[3];break;
+if(b.nodeType==1)switch(b.nodeName){case "node":this.nodes.push((new o).parse(b));break;case "instance_camera":this.cameras.push((new C).parse(b));break;case "instance_controller":this.controllers.push((new p).parse(b));break;case "instance_geometry":this.geometries.push((new m).parse(b));break;case "instance_light":break;case "instance_node":b=b.getAttribute("url").replace(/^#/,"");(b=fa.evaluate(".//dae:library_nodes//dae:node[@id='"+b+"']",fa,Y,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 n).parse(b));break;case "extra":break;default:console.log(b.nodeName)}}a=[];c=1E6;b=-1E6;for(var d in sa)for(var e=sa[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++){var i=this.channels[c],f=i.fullSid,g=i.sampler,h=g.input,j=this.getTransformBySid(i.sid),k;if(i.arrIndices){k=[];b=0;for(var l=i.arrIndices.length;b<l;b++){var r=k,q=b,s=i.arrIndices[b];if(s>-1&&s<3){s=T(["X","Y","Z"][s]);s={X:0,Y:1,Z:2}[s]}r[q]=s}}else k=T(i.member);if(j){a.indexOf(f)===-1&&a.push(f);b=0;for(l=h.length;b<l;b++){for(var r=h[b],i=g.getData(j.type,b),q=null,s=0,t=d.length;s<t&&q==null;s++){var u=d[s];if(u.time===
+r)q=u;else if(u.time>r)break}if(!q){q=new U(r);s=-1;t=0;for(u=d.length;t<u&&s==-1;t++)d[t].time>=r&&(s=t);r=s;d.splice(r==-1?d.length:r,0,q)}q.addTarget(f,j,k,i)}}else console.log('Could not find transform "'+i.sid+'" in node '+this.id)}for(c=0;c<a.length;c++){e=a[c];for(b=0;b<d.length;b++){q=d[b];if(!q.hasTarget(e)){h=d;f=q;k=b;g=e;j=void 0;a:{j=k?k-1:0;for(j=j>=0?j:j+h.length;j>=0;j--){l=h[j];if(l.hasTarget(g)){j=l;break a}}j=null}l=void 0;a:{for(k=k+1;k<h.length;k++){l=h[k];if(l.hasTarget(g))break a}l=
+null}if(j&&l){h=(f.time-j.time)/(l.time-j.time);j=j.getTarget(g);k=l.getTarget(g).data;l=j.data;i=void 0;if(j.type==="matrix")i=l;else if(l.length){i=[];for(r=0;r<l.length;++r)i[r]=l[r]+(k[r]-l[r])*h}else i=l+(k-l)*h;f.addTarget(g,j.transform,j.member,i)}}}}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)};n.prototype.parse=function(a){this.sid=a.getAttribute("sid");
+this.type=a.nodeName;this.data=H(a.textContent);this.convert();return this};n.prototype.convert=function(){switch(this.type){case "matrix":this.obj=ca(this.data);break;case "rotate":this.angle=this.data[3]*Fb;case "translate":P(this.data,-1);this.obj=new THREE.Vector3(this.data[0],this.data[1],this.data[2]);break;case "scale":P(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){var c=["X","Y","Z","ANGLE"];switch(this.type){case "matrix":if(b)if(b.length===1)switch(b[0]){case 0:this.obj.n11=a[0];this.obj.n21=a[1];this.obj.n31=a[2];this.obj.n41=a[3];break;case 1:this.obj.n12=a[0];this.obj.n22=a[1];this.obj.n32=a[2];this.obj.n42=a[3];break;
 case 2:this.obj.n13=a[0];this.obj.n23=a[1];this.obj.n33=a[2];this.obj.n43=a[3];break;case 3:this.obj.n14=a[0];this.obj.n24=a[1];this.obj.n34=a[2];this.obj.n44=a[3]}else b.length===2?this.obj["n"+(b[0]+1)+(b[1]+1)]=a:console.log("Incorrect addressing of matrix in transform.");else this.obj.copy(a);break;case "translate":case "scale":Object.prototype.toString.call(b)==="[object Array]"&&(b=c[b[0]]);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":Object.prototype.toString.call(b)==="[object Array]"&&(b=c[b[0]]);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*Fb;break;default:this.obj.x=a[0];this.obj.y=a[1];this.obj.z=a[2];this.angle=a[3]*Fb}}};p.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.skeleton=[];this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];
-if(c.nodeType==1)switch(c.nodeName){case "skeleton":this.skeleton.push(c.textContent.replace(/^#/,""));break;case "bind_material":if(c=ea.evaluate(".//dae:instance_material",c,W,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(c.nodeType==1&&c.nodeName=="bind_material"){if(a=ea.evaluate(".//dae:instance_material",c,W,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 u(this)).parse(c)}}return this};u.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");Na[d]==void 0&&(Na[d]=(new v(d)).parse(c));break;case "vertices":this.vertices=(new D).parse(c);break;case "triangles":this.primitives.push((new s).parse(c));break;case "polygons":this.primitives.push((new t).parse(c));break;case "polylist":this.primitives.push((new x).parse(c))}}this.geometry3js=
-new THREE.Geometry;a=Na[this.vertices.input.POSITION.source].data;for(b=0;b<a.length;b=b+3)this.geometry3js.vertices.push((new THREE.Vertex).copy($(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();if(this.geometry3js.calcNormals){this.geometry3js.computeVertexNormals();delete this.geometry3js.calcNormals}this.geometry3js.computeBoundingBox();
-return this};u.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++){g=f[c];k=g.offset+1;m=m<k?k:m;switch(g.semantic){case "TEXCOORD":n.push(g.set)}}for(var o=0;o<e.length;++o)for(var p=e[o],q=0;q<p.length;){var r=[],s=[],u={},t=[],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++){g=f[d];j=Na[g.source];h=p[q+c*m+g.offset];i=j.accessor.params.length;i=h*i;switch(g.semantic){case "VERTEX":r.push(h);
-break;case "NORMAL":s.push($(j.data,i));break;case "TEXCOORD":u[g.set]===void 0&&(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(s.length==0)if(g=this.vertices.input.NORMAL){j=Na[g.source];i=j.accessor.params.length;g=0;for(h=r.length;g<h;g++)s.push($(j.data,r[g]*i))}else b.calcNormals=true;if(k===3)c.push(new THREE.Face3(r[0],r[1],r[2],s,t.length?t:new THREE.Color));else if(k===
-4)c.push(new THREE.Face4(r[0],r[1],r[2],r[3],s,t.length?t:new THREE.Color));else if(k>4&&Ha.subdivideFaces){t=t.length?t:new THREE.Color;for(d=1;d<k-1;)c.push(new THREE.Face3(r[0],r[d],r[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++){r=u[n[d]];r=k>4?[r[0],r[g+1],r[g+2]]:k===4?[r[0],r[1],r[2],r[3]]:[r[0],r[1],r[2]];b.faceVertexUvs[d]||(b.faceVertexUvs[d]=[]);b.faceVertexUvs[d].push(r)}}}else console.log("dropped face with vcount "+
-k+" for geometry with id: "+b.id);q=q+m*k}};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=la(a,"count",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "input":this.inputs.push((new B).parse(a.childNodes[b]));break;case "vcount":this.vcount=ha(c.textContent);break;case "p":this.p.push(ha(c.textContent));
-break;case "ph":console.warn("polygon holes not yet supported!")}}return this};x.prototype=new t;x.prototype.constructor=x;s.prototype=new t;s.prototype.constructor=s;z.prototype.parse=function(a){this.params=[];this.source=a.getAttribute("source");this.count=la(a,"count",0);this.stride=la(a,"stride",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName=="param"){var d={};d.name=c.getAttribute("name");d.type=c.getAttribute("type");this.params.push(d)}}return this};D.prototype.parse=
-function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++)if(a.childNodes[b].nodeName=="input"){var c=(new B).parse(a.childNodes[b]);this.input[c.semantic]=c}return this};B.prototype.parse=function(a){this.semantic=a.getAttribute("semantic");this.source=a.getAttribute("source").replace(/^#/,"");this.set=la(a,"set",-1);this.offset=la(a,"offset",0);if(this.semantic=="TEXCOORD"&&this.set<0)this.set=0;return this};v.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=fa(c.textContent),e=[],f=0,g=d.length;f<g;f++)e.push(d[f]=="true"||d[f]=="1"?true:false);this.data=e;this.type=c.nodeName;break;case "float_array":this.data=G(c.textContent);this.type=c.nodeName;break;case "int_array":this.data=ha(c.textContent);this.type=c.nodeName;break;case "IDREF_array":case "Name_array":this.data=fa(c.textContent);this.type=c.nodeName;break;case "technique_common":for(d=0;d<c.childNodes.length;d++)if(c.childNodes[d].nodeName==
-"accessor"){this.accessor=(new z).parse(c.childNodes[d]);break}}}return this};v.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=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};w.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");
-for(var b=0;b<a.childNodes.length;b++)if(a.childNodes[b].nodeName=="instance_effect"){this.instance_effect=(new K).parse(a.childNodes[b]);break}return this};H.prototype.isColor=function(){return this.texture==null};H.prototype.isTexture=function(){return this.texture!=null};H.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "color":c=G(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};H.prototype.parseTexture=function(a){if(!a.childNodes)return this;if(a.childNodes[1]&&a.childNodes[1].nodeName==="extra"){a=a.childNodes[1];a.childNodes[1]&&a.childNodes[1].nodeName==="technique"&&(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};I.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[c.nodeName]=(new H).parse(c);break;case "shininess":case "reflectivity":case "transparency":var d;d=ea.evaluate(".//dae:float",
-c,W,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);for(var e=d.iterateNext(),f=[];e;){f.push(e);e=d.iterateNext()}d=f;d.length>0&&(this[c.nodeName]=parseFloat(d[0].textContent))}}this.create();return this};I.prototype.create=function(){var a={},b=this.transparency!==void 0&&this.transparency<1,c;for(c in this)switch(c){case "ambient":case "emission":case "diffuse":case "specular":var d=this[c];if(d instanceof H)if(d.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==
+if(c.nodeType==1)switch(c.nodeName){case "skeleton":this.skeleton.push(c.textContent.replace(/^#/,""));break;case "bind_material":if(c=fa.evaluate(".//dae:instance_material",c,Y,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};m.prototype.parse=function(a){this.url=
+a.getAttribute("url").replace(/^#/,"");this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1&&c.nodeName=="bind_material"){if(a=fa.evaluate(".//dae:instance_material",c,Y,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 u(this)).parse(c)}}return this};u.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");Na[d]==void 0&&(Na[d]=(new B(d)).parse(c));break;case "vertices":this.vertices=(new F).parse(c);break;case "triangles":this.primitives.push((new s).parse(c));break;case "polygons":this.primitives.push((new t).parse(c));break;case "polylist":this.primitives.push((new w).parse(c))}}this.geometry3js=
+new THREE.Geometry;a=Na[this.vertices.input.POSITION.source].data;for(b=0;b<a.length;b=b+3)this.geometry3js.vertices.push(S(a,b).clone());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();if(this.geometry3js.calcNormals){this.geometry3js.computeVertexNormals();delete this.geometry3js.calcNormals}this.geometry3js.computeBoundingBox();return this};
+u.prototype.handlePrimitive=function(a,b){var c,d,e=a.p,f=a.inputs,g,h,i,j,k=0,l=3,m=0,n=[];for(c=0;c<f.length;c++){g=f[c];l=g.offset+1;m=m<l?l:m;switch(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=[],l=a.vcount?a.vcount.length?a.vcount[k++]:a.vcount:p.length/m;for(c=0;c<l;c++)for(d=0;d<f.length;d++){g=f[d];j=Na[g.source];h=p[r+c*m+g.offset];i=j.accessor.params.length;i=h*i;switch(g.semantic){case "VERTEX":q.push(h);break;
+case "NORMAL":s.push(S(j.data,i));break;case "TEXCOORD":t[g.set]===void 0&&(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(s.length==0)if(g=this.vertices.input.NORMAL){j=Na[g.source];i=j.accessor.params.length;g=0;for(h=q.length;g<h;g++)s.push(S(j.data,q[g]*i))}else b.calcNormals=true;if(l===3)c.push(new THREE.Face3(q[0],q[1],q[2],s,u.length?u:new THREE.Color));else if(l===4)c.push(new THREE.Face4(q[0],
+q[1],q[2],q[3],s,u.length?u:new THREE.Color));else if(l>4&&Ha.subdivideFaces){u=u.length?u: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]],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=l>4?[q[0],q[g+1],q[g+2]]:l===4?[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=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=la(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 E).parse(a.childNodes[b]));break;case "vcount":this.vcount=ba(c.textContent);break;case "p":this.p.push(ba(c.textContent));
+break;case "ph":console.warn("polygon holes not yet supported!")}}return this};w.prototype=new t;w.prototype.constructor=w;s.prototype=new t;s.prototype.constructor=s;x.prototype.parse=function(a){this.params=[];this.source=a.getAttribute("source");this.count=la(a,"count",0);this.stride=la(a,"stride",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName=="param"){var d={};d.name=c.getAttribute("name");d.type=c.getAttribute("type");this.params.push(d)}}return this};F.prototype.parse=
+function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++)if(a.childNodes[b].nodeName=="input"){var c=(new E).parse(a.childNodes[b]);this.input[c.semantic]=c}return this};E.prototype.parse=function(a){this.semantic=a.getAttribute("semantic");this.source=a.getAttribute("source").replace(/^#/,"");this.set=la(a,"set",-1);this.offset=la(a,"offset",0);if(this.semantic=="TEXCOORD"&&this.set<0)this.set=0;return this};B.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(d[f]=="true"||d[f]=="1"?true:false);this.data=e;this.type=c.nodeName;break;case "float_array":this.data=H(c.textContent);this.type=c.nodeName;break;case "int_array":this.data=ba(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(c.childNodes[d].nodeName==
+"accessor"){this.accessor=(new x).parse(c.childNodes[d]);break}}}return this};B.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=b+16){var c=this.data.slice(b,b+16),c=ca(c);a.push(c)}break;default:console.log("ColladaLoader: Source: Read dont know how to read "+b.type+".")}return a};v.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");
+for(var b=0;b<a.childNodes.length;b++)if(a.childNodes[b].nodeName=="instance_effect"){this.instance_effect=(new A).parse(a.childNodes[b]);break}return this};z.prototype.isColor=function(){return this.texture==null};z.prototype.isTexture=function(){return this.texture!=null};z.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "color":c=H(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};z.prototype.parseTexture=function(a){if(!a.childNodes)return this;if(a.childNodes[1]&&a.childNodes[1].nodeName==="extra"){a=a.childNodes[1];a.childNodes[1]&&a.childNodes[1].nodeName==="technique"&&(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(c.nodeType==1)switch(c.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[c.nodeName]=(new z).parse(c);break;case "shininess":case "reflectivity":case "transparency":var d;d=fa.evaluate(".//dae:float",
+c,Y,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);for(var e=d.iterateNext(),f=[];e;){f.push(e);e=d.iterateNext()}d=f;d.length>0&&(this[c.nodeName]=parseFloat(d[0].textContent))}}this.create();return this};J.prototype.create=function(){var a={},b=this.transparency!==void 0&&this.transparency<1,c;for(c in this)switch(c){case "ambient":case "emission":case "diffuse":case "specular":var d=this[c];if(d instanceof z)if(d.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==
 this.effect.surface.sid){var e=Sa[this.effect.surface.init_from];if(e){e=THREE.ImageUtils.loadTexture(ua+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;c=="emission"&&(a.emissive=16777215)}}}else if(c=="diffuse"||!b)c=="emission"?a.emissive=d.color.getHex():a[c]=d.color.getHex();
-break;case "shininess":case "reflectivity":a[c]=this[c];break;case "transparency":if(b){a.transparent=true;a.opacity=this[c];b=true}}a.shading=ja;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};M.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=
-a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "init_from":this.init_from=c.textContent;break;case "format":this.format=c.textContent;break;default:console.log("unhandled Surface prop: "+c.nodeName)}}return this};T.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "source":this.source=c.textContent;break;case "minfilter":this.minfilter=c.textContent;break;case "magfilter":this.magfilter=c.textContent;break;case "mipfilter":this.mipfilter=
-c.textContent;break;case "wrap_s":this.wrap_s=c.textContent;break;case "wrap_t":this.wrap_t=c.textContent;break;default:console.log("unhandled Sampler2D prop: "+c.nodeName)}}return this};C.prototype.create=function(){if(this.shader==null)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(c.nodeType==1)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(d.nodeType==1)switch(d.nodeName){case "surface":this.surface=(new M(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)}}};C.prototype.parseProfileCOMMON=function(a){for(var b,c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)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);Sa[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(c.nodeType==1)switch(c.nodeName){case "constant":case "lambert":case "blinn":case "phong":this.shader=(new I(c.nodeName,this)).parse(c)}}};K.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,
-"");return this};O.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.source={};for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "animation":var c=(new O).parse(c),d;for(d in c.source)this.source[d]=c.source[d];for(var e=0;e<c.channel.length;e++){this.channel.push(c.channel[e]);this.sampler.push(c.sampler[e])}break;case "source":d=(new v).parse(c);this.source[d.id]=d;break;case "sampler":this.sampler.push((new i(this)).parse(c));
-break;case "channel":this.channel.push((new E(this)).parse(c))}}return this};E.prototype.parse=function(a){this.source=a.getAttribute("source").replace(/^#/,"");this.target=a.getAttribute("target");var b=this.target.split("/");b.shift();var a=b.shift(),c=a.indexOf(".")>=0,d=a.indexOf("(")>=0;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(c.nodeType==1)switch(c.nodeName){case "input":this.inputs.push((new B).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=
+break;case "shininess":case "reflectivity":a[c]=this[c];break;case "transparency":if(b){a.transparent=true;a.opacity=this[c];b=true}}a.shading=ja;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};K.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=
+a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "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};X.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "source":this.source=c.textContent;break;case "minfilter":this.minfilter=c.textContent;break;case "magfilter":this.magfilter=c.textContent;break;case "mipfilter":this.mipfilter=
+c.textContent;break;case "wrap_s":this.wrap_s=c.textContent;break;case "wrap_t":this.wrap_t=c.textContent;break;default:console.log("unhandled Sampler2D prop: "+c.nodeName)}}return this};Q.prototype.create=function(){if(this.shader==null)return null};Q.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.shader=null;for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "profile_COMMON":this.parseTechnique(this.parseProfileCOMMON(c))}}return this};
+Q.prototype.parseNewparam=function(a){for(var b=a.getAttribute("sid"),c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "surface":this.surface=(new K(this)).parse(d);this.surface.sid=b;break;case "sampler2D":this.sampler=(new X(this)).parse(d);this.sampler.sid=b;break;case "extra":break;default:console.log(d.nodeName)}}};Q.prototype.parseProfileCOMMON=function(a){for(var b,c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)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);Sa[d.id]=d;break;case "extra":break;default:console.log(d.nodeName)}}return b};Q.prototype.parseTechnique=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "constant":case "lambert":case "blinn":case "phong":this.shader=(new J(c.nodeName,this)).parse(c)}}};A.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,
+"");return this};M.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.source={};for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "animation":var c=(new M).parse(c),d;for(d in c.source)this.source[d]=c.source[d];for(var e=0;e<c.channel.length;e++){this.channel.push(c.channel[e]);this.sampler.push(c.sampler[e])}break;case "source":d=(new B).parse(c);this.source[d.id]=d;break;case "sampler":this.sampler.push((new i(this)).parse(c));
+break;case "channel":this.channel.push((new G(this)).parse(c))}}return this};G.prototype.parse=function(a){this.source=a.getAttribute("source").replace(/^#/,"");this.target=a.getAttribute("target");var b=this.target.split("/");b.shift();var a=b.shift(),c=a.indexOf(".")>=0,d=a.indexOf("(")>=0;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(c.nodeType==1)switch(c.nodeName){case "input":this.inputs.push((new E).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(a==="matrix"&&
-this.strideOut===16)c=this.output[b];else if(this.strideOut>1){c=[];for(var b=b*this.strideOut,d=0;d<this.strideOut;++d)c[d]=this.output[b+d];if(this.strideOut===3)switch(a){case "rotate":case "translate":R(c,-1);break;case "scale":R(c,1)}else this.strideOut===4&&a==="matrix"&&R(c,-1)}else c=this.output[b];return c};U.prototype.addTarget=function(a,b,c,d){this.targets.push({sid:a,member:c,transform:b,data:d})};U.prototype.apply=function(a){for(var b=0;b<this.targets.length;++b){var c=this.targets[b];
+this.strideOut===16)c=this.output[b];else if(this.strideOut>1){c=[];for(var b=b*this.strideOut,d=0;d<this.strideOut;++d)c[d]=this.output[b+d];if(this.strideOut===3)switch(a){case "rotate":case "translate":P(c,-1);break;case "scale":P(c,1)}else this.strideOut===4&&a==="matrix"&&P(c,-1)}else c=this.output[b];return c};U.prototype.addTarget=function(a,b,c,d){this.targets.push({sid:a,member:c,transform:b,data:d})};U.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)}};U.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};U.prototype.hasTarget=function(a){for(var b=0;b<this.targets.length;++b)if(this.targets[b].sid===a)return true;return false};U.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(d.transform.type!=="matrix"&&e){var f=(b-this.time)/(a.time-this.time),
-g=e.data,h=d.data;if(f<0||f>1){console.log("Key.interpolate: Warning! Scale out of bounds:"+f);f=f<0?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)}};F.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(c.nodeType==1)switch(c.nodeName){case "optics":this.parseOptics(c)}}return this};F.prototype.parseOptics=function(a){for(var b=
+g=e.data,h=d.data;if(f<0||f>1){console.log("Key.interpolate: Warning! Scale out of bounds:"+f);f=f<0?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)}};W.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(c.nodeType==1)switch(c.nodeName){case "optics":this.parseOptics(c)}}return this};W.prototype.parseOptics=function(a){for(var b=
 0;b<a.childNodes.length;b++)if(a.childNodes[b].nodeName=="technique_common")for(var c=a.childNodes[b],d=0;d<c.childNodes.length;d++){this.technique=c.childNodes[d].nodeName;if(this.technique=="perspective")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(this.technique=="orthographic"){e=c.childNodes[d];for(f=0;f<e.childNodes.length;f++){g=e.childNodes[f];switch(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};L.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");return this};return{load:function(b,c,d){var e=
+g.textContent}}else if(this.technique=="orthographic"){e=c.childNodes[d];for(f=0;f<e.childNodes.length;f++){g=e.childNodes[f];switch(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};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(f.readyState==4){if(f.status==0||f.status==200)if(f.responseXML){ta=c;a(f.responseXML,void 0,b)}else console.error("ColladaLoader: Empty or non-existing file ("+b+")")}else if(f.readyState==3&&d){e==0&&(e=f.getResponseHeader("Content-Length"));d({total:e,loaded:f.responseText.length})}};f.open("GET",b,true);f.send(null)}else alert("Don't know how to parse XML!")},
 parse:a,setPreferredShading:function(a){ja=a},applySkin:e,geometries:Ya,options:Ha}};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(f.status===200||f.status===0){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 if(f.readyState===f.LOADING){if(e){g===0&&(g=f.getResponseHeader("Content-Length"));
 e({total:g,loaded:f.responseText.length})}}else f.readyState===f.HEADERS_RECEIVED&&(g=f.getResponseHeader("Content-Length"))};f.open("GET",b,true);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=a.scale!==void 0?1/a.scale:1;this.initMaterials(d,a.materials,c);(function(b){var c,e,l,k,j,o,m,p,r,n,q,u,t,x,s=a.faces;o=a.vertices;var z=a.normals,D=a.colors,B=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&B++;for(c=0;c<B;c++){d.faceUvs[c]=[];d.faceVertexUvs[c]=[]}k=0;for(j=o.length;k<j;){m=new THREE.Vertex;m.x=o[k++]*b;m.y=o[k++]*b;m.z=o[k++]*b;d.vertices.push(m)}k=0;for(j=s.length;k<j;){b=s[k++];o=b&1;l=b&2;c=b&
-4;e=b&8;p=b&16;m=b&32;n=b&64;b=b&128;if(o){q=new THREE.Face4;q.a=s[k++];q.b=s[k++];q.c=s[k++];q.d=s[k++];o=4}else{q=new THREE.Face3;q.a=s[k++];q.b=s[k++];q.c=s[k++];o=3}if(l){l=s[k++];q.materialIndex=l}l=d.faces.length;if(c)for(c=0;c<B;c++){u=a.uvs[c];r=s[k++];x=u[r*2];r=u[r*2+1];d.faceUvs[c][l]=new THREE.UV(x,r)}if(e)for(c=0;c<B;c++){u=a.uvs[c];t=[];for(e=0;e<o;e++){r=s[k++];x=u[r*2];r=u[r*2+1];t[e]=new THREE.UV(x,r)}d.faceVertexUvs[c][l]=t}if(p){p=s[k++]*3;e=new THREE.Vector3;e.x=z[p++];e.y=z[p++];
-e.z=z[p];q.normal=e}if(m)for(c=0;c<o;c++){p=s[k++]*3;e=new THREE.Vector3;e.x=z[p++];e.y=z[p++];e.z=z[p];q.vertexNormals.push(e)}if(n){m=s[k++];m=new THREE.Color(D[m]);q.color=m}if(b)for(c=0;c<o;c++){m=s[k++];m=new THREE.Color(D[m]);q.vertexColors.push(m)}d.faces.push(q)}})(e);(function(){var b,c,e,l;if(a.skinWeights){b=0;for(c=a.skinWeights.length;b<c;b=b+2){e=a.skinWeights[b];l=a.skinWeights[b+1];d.skinWeights.push(new THREE.Vector4(e,l,0,0))}}if(a.skinIndices){b=0;for(c=a.skinIndices.length;b<c;b=
-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(a.morphTargets!==void 0){var c,e,l,k,j,o,m,p,r;c=0;for(e=a.morphTargets.length;c<e;c++){d.morphTargets[c]={};d.morphTargets[c].name=a.morphTargets[c].name;d.morphTargets[c].vertices=[];p=d.morphTargets[c].vertices;r=a.morphTargets[c].vertices;l=0;for(k=r.length;l<k;l=l+3){j=r[l]*b;o=r[l+1]*b;m=r[l+2]*b;p.push(new THREE.Vertex(j,o,m))}}}if(a.morphColors!==
-void 0){c=0;for(e=a.morphColors.length;c<e;c++){d.morphColors[c]={};d.morphColors[c].name=a.morphColors[c].name;d.morphColors[c].colors=[];k=d.morphColors[c].colors;j=a.morphColors[c].colors;b=0;for(l=j.length;b<l;b=b+3){o=new THREE.Color(16755200);o.setRGB(j[b],j[b+1],j[b+2]);k.push(o)}}}})(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=a.scale!==void 0?1/a.scale:1;this.initMaterials(d,a.materials,c);(function(b){var c,e,k,j,l,o,n,p,r,m,q,u,t,w,s=a.faces;o=a.vertices;var x=a.normals,F=a.colors,E=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&E++;for(c=0;c<E;c++){d.faceUvs[c]=[];d.faceVertexUvs[c]=[]}j=0;for(l=o.length;j<l;){n=new THREE.Vector3;n.x=o[j++]*b;n.y=o[j++]*b;n.z=o[j++]*b;d.vertices.push(n)}j=0;for(l=s.length;j<l;){b=s[j++];o=b&1;k=b&2;c=b&
+4;e=b&8;p=b&16;n=b&32;m=b&64;b=b&128;if(o){q=new THREE.Face4;q.a=s[j++];q.b=s[j++];q.c=s[j++];q.d=s[j++];o=4}else{q=new THREE.Face3;q.a=s[j++];q.b=s[j++];q.c=s[j++];o=3}if(k){k=s[j++];q.materialIndex=k}k=d.faces.length;if(c)for(c=0;c<E;c++){u=a.uvs[c];r=s[j++];w=u[r*2];r=u[r*2+1];d.faceUvs[c][k]=new THREE.UV(w,r)}if(e)for(c=0;c<E;c++){u=a.uvs[c];t=[];for(e=0;e<o;e++){r=s[j++];w=u[r*2];r=u[r*2+1];t[e]=new THREE.UV(w,r)}d.faceVertexUvs[c][k]=t}if(p){p=s[j++]*3;e=new THREE.Vector3;e.x=x[p++];e.y=x[p++];
+e.z=x[p];q.normal=e}if(n)for(c=0;c<o;c++){p=s[j++]*3;e=new THREE.Vector3;e.x=x[p++];e.y=x[p++];e.z=x[p];q.vertexNormals.push(e)}if(m){n=s[j++];n=new THREE.Color(F[n]);q.color=n}if(b)for(c=0;c<o;c++){n=s[j++];n=new THREE.Color(F[n]);q.vertexColors.push(n)}d.faces.push(q)}})(e);(function(){var b,c,e,k;if(a.skinWeights){b=0;for(c=a.skinWeights.length;b<c;b=b+2){e=a.skinWeights[b];k=a.skinWeights[b+1];d.skinWeights.push(new THREE.Vector4(e,k,0,0))}}if(a.skinIndices){b=0;for(c=a.skinIndices.length;b<c;b=
+b+2){e=a.skinIndices[b];k=a.skinIndices[b+1];d.skinIndices.push(new THREE.Vector4(e,k,0,0))}}d.bones=a.bones;d.animation=a.animation})();(function(b){if(a.morphTargets!==void 0){var c,e,k,j,l,o;c=0;for(e=a.morphTargets.length;c<e;c++){d.morphTargets[c]={};d.morphTargets[c].name=a.morphTargets[c].name;d.morphTargets[c].vertices=[];l=d.morphTargets[c].vertices;o=a.morphTargets[c].vertices;k=0;for(j=o.length;k<j;k=k+3){var n=new THREE.Vector3;n.x=o[k]*b;n.y=o[k+1]*b;n.z=o[k+2]*b;l.push(n)}}}if(a.morphColors!==
+void 0){c=0;for(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;l=a.morphColors[c].colors;b=0;for(k=l.length;b<k;b=b+3){o=new THREE.Color(16755200);o.setRGB(l[b],l[b+1],l[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(d.readyState==4)if(d.status==200||d.status==0){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,true);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 b=="relativeToHTML"?a:k+"/"+a}function e(){var a;for(m in C.objects)if(!F.objects[m]){u=C.objects[m];if(u.geometry!==void 0){if(H=F.geometries[u.geometry]){a=false;I=F.materials[u.materials[0]];(a=I instanceof THREE.ShaderMaterial)&&H.computeTangents();s=u.position;z=u.rotation;D=u.quaternion;B=u.scale;D=0;u.materials.length==0&&(I=new THREE.MeshFaceMaterial);u.materials.length>1&&(I=new THREE.MeshFaceMaterial);a=new THREE.Mesh(H,
-I);a.name=m;a.position.set(s[0],s[1],s[2]);if(D){a.quaternion.set(D[0],D[1],D[2],D[3]);a.useQuaternion=true}else a.rotation.set(z[0],z[1],z[2]);a.scale.set(B[0],B[1],B[2]);a.visible=u.visible;a.doubleSided=u.doubleSided;a.castShadow=u.castShadow;a.receiveShadow=u.receiveShadow;F.scene.add(a);F.objects[m]=a}}else{s=u.position;z=u.rotation;D=u.quaternion;B=u.scale;D=0;a=new THREE.Object3D;a.name=m;a.position.set(s[0],s[1],s[2]);if(D){a.quaternion.set(D[0],D[1],D[2],D[3]);a.useQuaternion=true}else a.rotation.set(z[0],
-z[1],z[2]);a.scale.set(B[0],B[1],B[2]);a.visible=u.visible!==void 0?u.visible:false;F.scene.add(a);F.objects[m]=a;F.empties[m]=a}}}function f(a){return function(b){F.geometries[a]=b;e();O=O-1;l.onLoadComplete();h()}}function g(a){return function(b){F.geometries[a]=b}}function h(){l.callbackProgress({totalModels:i,totalTextures:U,loadedModels:i-O,loadedTextures:U-E},F);l.onLoadProgress();O==0&&E==0&&b(F)}var l=this,k=THREE.Loader.prototype.extractUrlBase(c),j,o,m,p,r,n,q,u,t,x,s,z,D,B,v,w,H,I,M,T,
-C,K,O,E,i,U,F;C=a;c=new THREE.BinaryLoader;K=new THREE.JSONLoader;E=O=0;F={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},empties:{}};if(C.transform){a=C.transform.position;t=C.transform.rotation;v=C.transform.scale;a&&F.scene.position.set(a[0],a[1],a[2]);t&&F.scene.rotation.set(t[0],t[1],t[2]);v&&F.scene.scale.set(v[0],v[1],v[2]);if(a||t||v){F.scene.updateMatrix();F.scene.updateMatrixWorld()}}a=function(){E=E-1;h();l.onLoadComplete()};for(r in C.cameras){v=
-C.cameras[r];v.type=="perspective"?M=new THREE.PerspectiveCamera(v.fov,v.aspect,v.near,v.far):v.type=="ortho"&&(M=new THREE.OrthographicCamera(v.left,v.right,v.top,v.bottom,v.near,v.far));s=v.position;t=v.target;v=v.up;M.position.set(s[0],s[1],s[2]);M.target=new THREE.Vector3(t[0],t[1],t[2]);v&&M.up.set(v[0],v[1],v[2]);F.cameras[r]=M}for(p in C.lights){t=C.lights[p];r=t.color!==void 0?t.color:16777215;M=t.intensity!==void 0?t.intensity:1;if(t.type=="directional"){s=t.direction;x=new THREE.DirectionalLight(r,
-M);x.position.set(s[0],s[1],s[2]);x.position.normalize()}else if(t.type=="point"){s=t.position;x=t.distance;x=new THREE.PointLight(r,M,x);x.position.set(s[0],s[1],s[2])}else t.type=="ambient"&&(x=new THREE.AmbientLight(r));F.scene.add(x);F.lights[p]=x}for(n in C.fogs){p=C.fogs[n];p.type=="linear"?T=new THREE.Fog(0,p.near,p.far):p.type=="exp2"&&(T=new THREE.FogExp2(0,p.density));v=p.color;T.color.setRGB(v[0],v[1],v[2]);F.fogs[n]=T}if(F.cameras&&C.defaults.camera)F.currentCamera=F.cameras[C.defaults.camera];
-if(F.fogs&&C.defaults.fog)F.scene.fog=F.fogs[C.defaults.fog];v=C.defaults.bgcolor;F.bgColor=new THREE.Color;F.bgColor.setRGB(v[0],v[1],v[2]);F.bgColorAlpha=C.defaults.bgalpha;for(j in C.geometries){n=C.geometries[j];if(n.type=="bin_mesh"||n.type=="ascii_mesh"){O=O+1;l.onLoadStart()}}i=O;for(j in C.geometries){n=C.geometries[j];if(n.type=="cube"){H=new THREE.CubeGeometry(n.width,n.height,n.depth,n.segmentsWidth,n.segmentsHeight,n.segmentsDepth,null,n.flipped,n.sides);F.geometries[j]=H}else if(n.type==
-"plane"){H=new THREE.PlaneGeometry(n.width,n.height,n.segmentsWidth,n.segmentsHeight);F.geometries[j]=H}else if(n.type=="sphere"){H=new THREE.SphereGeometry(n.radius,n.segmentsWidth,n.segmentsHeight);F.geometries[j]=H}else if(n.type=="cylinder"){H=new THREE.CylinderGeometry(n.topRad,n.botRad,n.height,n.radSegs,n.heightSegs);F.geometries[j]=H}else if(n.type=="torus"){H=new THREE.TorusGeometry(n.radius,n.tube,n.segmentsR,n.segmentsT);F.geometries[j]=H}else if(n.type=="icosahedron"){H=new THREE.IcosahedronGeometry(n.radius,
-n.subdivisions);F.geometries[j]=H}else if(n.type=="bin_mesh")c.load(d(n.url,C.urlBaseType),f(j));else if(n.type=="ascii_mesh")K.load(d(n.url,C.urlBaseType),f(j));else if(n.type=="embedded_mesh"){n=C.embeds[n.id];n.metadata=C.metadata;n&&K.createModel(n,g(j),"")}}for(q in C.textures){j=C.textures[q];if(j.url instanceof Array){E=E+j.url.length;for(n=0;n<j.url.length;n++)l.onLoadStart()}else{E=E+1;l.onLoadStart()}}U=E;for(q in C.textures){j=C.textures[q];if(j.mapping!=void 0&&THREE[j.mapping]!=void 0)j.mapping=
-new THREE[j.mapping];if(j.url instanceof Array){n=[];for(T=0;T<j.url.length;T++)n[T]=d(j.url[T],C.urlBaseType);n=THREE.ImageUtils.loadTextureCube(n,j.mapping,a)}else{n=THREE.ImageUtils.loadTexture(d(j.url,C.urlBaseType),j.mapping,a);if(THREE[j.minFilter]!=void 0)n.minFilter=THREE[j.minFilter];if(THREE[j.magFilter]!=void 0)n.magFilter=THREE[j.magFilter];if(j.repeat){n.repeat.set(j.repeat[0],j.repeat[1]);if(j.repeat[0]!=1)n.wrapS=THREE.RepeatWrapping;if(j.repeat[1]!=1)n.wrapT=THREE.RepeatWrapping}j.offset&&
-n.offset.set(j.offset[0],j.offset[1]);if(j.wrap){T={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(T[j.wrap[0]]!==void 0)n.wrapS=T[j.wrap[0]];if(T[j.wrap[1]]!==void 0)n.wrapT=T[j.wrap[1]]}}F.textures[q]=n}for(o in C.materials){q=C.materials[o];for(w in q.parameters)if(w=="envMap"||w=="map"||w=="lightMap")q.parameters[w]=F.textures[q.parameters[w]];else if(w=="shading")q.parameters[w]=q.parameters[w]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(w=="blending")q.parameters[w]=
-THREE[q.parameters[w]]?THREE[q.parameters[w]]:THREE.NormalBlending;else if(w=="combine")q.parameters[w]=q.parameters[w]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(w=="vertexColors")if(q.parameters[w]=="face")q.parameters[w]=THREE.FaceColors;else if(q.parameters[w])q.parameters[w]=THREE.VertexColors;if(q.parameters.opacity!==void 0&&q.parameters.opacity<1)q.parameters.transparent=true;if(q.parameters.normalMap){a=THREE.ShaderUtils.lib.normal;j=THREE.UniformsUtils.clone(a.uniforms);
-n=q.parameters.color;T=q.parameters.specular;c=q.parameters.ambient;K=q.parameters.shininess;j.tNormal.texture=F.textures[q.parameters.normalMap];if(q.parameters.normalMapFactor)j.uNormalScale.value=q.parameters.normalMapFactor;if(q.parameters.map){j.tDiffuse.texture=q.parameters.map;j.enableDiffuse.value=true}if(q.parameters.lightMap){j.tAO.texture=q.parameters.lightMap;j.enableAO.value=true}if(q.parameters.specularMap){j.tSpecular.texture=F.textures[q.parameters.specularMap];j.enableSpecular.value=
-true}j.uDiffuseColor.value.setHex(n);j.uSpecularColor.value.setHex(T);j.uAmbientColor.value.setHex(c);j.uShininess.value=K;if(q.parameters.opacity)j.uOpacity.value=q.parameters.opacity;I=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:j,lights:true,fog:true})}else I=new THREE[q.type](q.parameters);F.materials[o]=I}e();l.callbackSync(F);h()};THREE.UTF8Loader=function(){};
+THREE.SceneLoader.prototype.createScene=function(a,b,c){function d(a,b){return b=="relativeToHTML"?a:j+"/"+a}function e(){var a;for(n in A.objects)if(!C.objects[n]){u=A.objects[n];if(u.geometry!==void 0){if(J=C.geometries[u.geometry]){a=false;K=C.materials[u.materials[0]];(a=K instanceof THREE.ShaderMaterial)&&J.computeTangents();x=u.position;F=u.rotation;E=u.quaternion;B=u.scale;t=u.matrix;E=0;u.materials.length==0&&(K=new THREE.MeshFaceMaterial);u.materials.length>1&&(K=new THREE.MeshFaceMaterial);
+a=new THREE.Mesh(J,K);a.name=n;if(t){a.matrixAutoUpdate=false;a.matrix.set(t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8],t[9],t[10],t[11],t[12],t[13],t[14],t[15])}else{a.position.set(x[0],x[1],x[2]);if(E){a.quaternion.set(E[0],E[1],E[2],E[3]);a.useQuaternion=true}else a.rotation.set(F[0],F[1],F[2]);a.scale.set(B[0],B[1],B[2])}a.visible=u.visible;a.doubleSided=u.doubleSided;a.castShadow=u.castShadow;a.receiveShadow=u.receiveShadow;C.scene.add(a);C.objects[n]=a}}else{x=u.position;F=u.rotation;E=u.quaternion;
+B=u.scale;E=0;a=new THREE.Object3D;a.name=n;a.position.set(x[0],x[1],x[2]);if(E){a.quaternion.set(E[0],E[1],E[2],E[3]);a.useQuaternion=true}else a.rotation.set(F[0],F[1],F[2]);a.scale.set(B[0],B[1],B[2]);a.visible=u.visible!==void 0?u.visible:false;C.scene.add(a);C.objects[n]=a;C.empties[n]=a}}}function f(a){return function(b){C.geometries[a]=b;e();G=G-1;k.onLoadComplete();h()}}function g(a){return function(b){C.geometries[a]=b}}function h(){k.callbackProgress({totalModels:U,totalTextures:W,loadedModels:U-
+G,loadedTextures:W-i},C);k.onLoadProgress();G==0&&i==0&&b(C)}var k=this,j=THREE.Loader.prototype.extractUrlBase(c),l,o,n,p,r,m,q,u,t,w,s,x,F,E,B,v,z,J,K,X,Q,A,M,G,i,U,W,C;A=a;c=new THREE.BinaryLoader;M=new THREE.JSONLoader;i=G=0;C={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},empties:{}};if(A.transform){a=A.transform.position;w=A.transform.rotation;v=A.transform.scale;a&&C.scene.position.set(a[0],a[1],a[2]);w&&C.scene.rotation.set(w[0],w[1],
+w[2]);v&&C.scene.scale.set(v[0],v[1],v[2]);if(a||w||v){C.scene.updateMatrix();C.scene.updateMatrixWorld()}}a=function(){i=i-1;h();k.onLoadComplete()};for(r in A.cameras){v=A.cameras[r];v.type=="perspective"?X=new THREE.PerspectiveCamera(v.fov,v.aspect,v.near,v.far):v.type=="ortho"&&(X=new THREE.OrthographicCamera(v.left,v.right,v.top,v.bottom,v.near,v.far));x=v.position;w=v.target;v=v.up;X.position.set(x[0],x[1],x[2]);X.target=new THREE.Vector3(w[0],w[1],w[2]);v&&X.up.set(v[0],v[1],v[2]);C.cameras[r]=
+X}for(p in A.lights){w=A.lights[p];r=w.color!==void 0?w.color:16777215;X=w.intensity!==void 0?w.intensity:1;if(w.type=="directional"){x=w.direction;s=new THREE.DirectionalLight(r,X);s.position.set(x[0],x[1],x[2]);s.position.normalize()}else if(w.type=="point"){x=w.position;s=w.distance;s=new THREE.PointLight(r,X,s);s.position.set(x[0],x[1],x[2])}else w.type=="ambient"&&(s=new THREE.AmbientLight(r));C.scene.add(s);C.lights[p]=s}for(m in A.fogs){p=A.fogs[m];p.type=="linear"?Q=new THREE.Fog(0,p.near,
+p.far):p.type=="exp2"&&(Q=new THREE.FogExp2(0,p.density));v=p.color;Q.color.setRGB(v[0],v[1],v[2]);C.fogs[m]=Q}if(C.cameras&&A.defaults.camera)C.currentCamera=C.cameras[A.defaults.camera];if(C.fogs&&A.defaults.fog)C.scene.fog=C.fogs[A.defaults.fog];v=A.defaults.bgcolor;C.bgColor=new THREE.Color;C.bgColor.setRGB(v[0],v[1],v[2]);C.bgColorAlpha=A.defaults.bgalpha;for(l in A.geometries){m=A.geometries[l];if(m.type=="bin_mesh"||m.type=="ascii_mesh"){G=G+1;k.onLoadStart()}}U=G;for(l in A.geometries){m=
+A.geometries[l];if(m.type=="cube"){J=new THREE.CubeGeometry(m.width,m.height,m.depth,m.segmentsWidth,m.segmentsHeight,m.segmentsDepth,null,m.flipped,m.sides);C.geometries[l]=J}else if(m.type=="plane"){J=new THREE.PlaneGeometry(m.width,m.height,m.segmentsWidth,m.segmentsHeight);C.geometries[l]=J}else if(m.type=="sphere"){J=new THREE.SphereGeometry(m.radius,m.segmentsWidth,m.segmentsHeight);C.geometries[l]=J}else if(m.type=="cylinder"){J=new THREE.CylinderGeometry(m.topRad,m.botRad,m.height,m.radSegs,
+m.heightSegs);C.geometries[l]=J}else if(m.type=="torus"){J=new THREE.TorusGeometry(m.radius,m.tube,m.segmentsR,m.segmentsT);C.geometries[l]=J}else if(m.type=="icosahedron"){J=new THREE.IcosahedronGeometry(m.radius,m.subdivisions);C.geometries[l]=J}else if(m.type=="bin_mesh")c.load(d(m.url,A.urlBaseType),f(l));else if(m.type=="ascii_mesh")M.load(d(m.url,A.urlBaseType),f(l));else if(m.type=="embedded_mesh"){m=A.embeds[m.id];m.metadata=A.metadata;m&&M.createModel(m,g(l),"")}}for(q in A.textures){l=A.textures[q];
+if(l.url instanceof Array){i=i+l.url.length;for(m=0;m<l.url.length;m++)k.onLoadStart()}else{i=i+1;k.onLoadStart()}}W=i;for(q in A.textures){l=A.textures[q];if(l.mapping!=void 0&&THREE[l.mapping]!=void 0)l.mapping=new THREE[l.mapping];if(l.url instanceof Array){m=[];for(Q=0;Q<l.url.length;Q++)m[Q]=d(l.url[Q],A.urlBaseType);m=THREE.ImageUtils.loadTextureCube(m,l.mapping,a)}else{m=THREE.ImageUtils.loadTexture(d(l.url,A.urlBaseType),l.mapping,a);if(THREE[l.minFilter]!=void 0)m.minFilter=THREE[l.minFilter];
+if(THREE[l.magFilter]!=void 0)m.magFilter=THREE[l.magFilter];if(l.repeat){m.repeat.set(l.repeat[0],l.repeat[1]);if(l.repeat[0]!=1)m.wrapS=THREE.RepeatWrapping;if(l.repeat[1]!=1)m.wrapT=THREE.RepeatWrapping}l.offset&&m.offset.set(l.offset[0],l.offset[1]);if(l.wrap){Q={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(Q[l.wrap[0]]!==void 0)m.wrapS=Q[l.wrap[0]];if(Q[l.wrap[1]]!==void 0)m.wrapT=Q[l.wrap[1]]}}C.textures[q]=m}for(o in A.materials){t=A.materials[o];for(z in t.parameters)if(z==
+"envMap"||z=="map"||z=="lightMap")t.parameters[z]=C.textures[t.parameters[z]];else if(z=="shading")t.parameters[z]=t.parameters[z]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(z=="blending")t.parameters[z]=THREE[t.parameters[z]]?THREE[t.parameters[z]]:THREE.NormalBlending;else if(z=="combine")t.parameters[z]=t.parameters[z]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(z=="vertexColors")if(t.parameters[z]=="face")t.parameters[z]=THREE.FaceColors;else if(t.parameters[z])t.parameters[z]=
+THREE.VertexColors;if(t.parameters.opacity!==void 0&&t.parameters.opacity<1)t.parameters.transparent=true;if(t.parameters.normalMap){q=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(q.uniforms);l=t.parameters.color;m=t.parameters.specular;Q=t.parameters.ambient;c=t.parameters.shininess;a.tNormal.texture=C.textures[t.parameters.normalMap];if(t.parameters.normalMapFactor)a.uNormalScale.value=t.parameters.normalMapFactor;if(t.parameters.map){a.tDiffuse.texture=t.parameters.map;a.enableDiffuse.value=
+true}if(t.parameters.lightMap){a.tAO.texture=t.parameters.lightMap;a.enableAO.value=true}if(t.parameters.specularMap){a.tSpecular.texture=C.textures[t.parameters.specularMap];a.enableSpecular.value=true}a.uDiffuseColor.value.setHex(l);a.uSpecularColor.value.setHex(m);a.uAmbientColor.value.setHex(Q);a.uShininess.value=c;if(t.parameters.opacity)a.uOpacity.value=t.parameters.opacity;K=new THREE.ShaderMaterial({fragmentShader:q.fragmentShader,vertexShader:q.vertexShader,uniforms:a,lights:true,fog:true})}else K=
+new THREE[t.type](t.parameters);C.materials[o]=K}e();k.callbackSync(C);h()};THREE.UTF8Loader=function(){};
 THREE.UTF8Loader.prototype.load=function(a,b,c){var d=new XMLHttpRequest,e=c.scale!==void 0?c.scale:1,f=c.offsetX!==void 0?c.offsetX:0,g=c.offsetY!==void 0?c.offsetY:0,h=c.offsetZ!==void 0?c.offsetZ:0;d.onreadystatechange=function(){d.readyState==4?d.status==200||d.status==0?THREE.UTF8Loader.prototype.createModel(d.responseText,b,e,f,g,h):console.error("THREE.UTF8Loader: Couldn't load ["+a+"] ["+d.status+"]"):d.readyState!=3&&d.readyState==2&&d.getResponseHeader("Content-Length")};d.open("GET",a,
 true);d.send(null)};THREE.UTF8Loader.prototype.decompressMesh=function(a){var b=a.charCodeAt(0);b>=57344&&(b=b-2048);b++;for(var c=new Float32Array(8*b),d=1,e=0;e<8;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=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;h==0&&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),k=[],j=[];(function(a,g,j){for(var k,l,q,u=a.length;j<u;j=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=k+d;l=l+e;q=q+f;b.vertices.push(new THREE.Vertex(k,l,q))}})(g[0],8,0);(function(a,b,c){for(var d,e,f=a.length;c<f;c=c+b){d=a[c];e=a[c+1];d=d/1023;e=e/1023;j.push(d,1-e)}})(g[0],8,3);(function(a,
-b,c){for(var d,e,f,g=a.length;c<g;c=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;k.push(d,e,f)}})(g[0],8,5);(function(a){var c,d,e,f,g,l,t,x,s,z=a.length;for(c=0;c<z;c=c+3){d=a[c];e=a[c+1];f=a[c+2];g=b;x=d;s=e;l=f;var D=k[e*3],B=k[e*3+1],v=k[e*3+2],w=k[f*3],H=k[f*3+1],I=k[f*3+2];t=new THREE.Vector3(k[d*3],k[d*3+1],k[d*3+2]);D=new THREE.Vector3(D,B,v);w=new THREE.Vector3(w,H,I);g.faces.push(new THREE.Face3(x,s,l,[t,D,w],null,0));g=j[d*2];d=j[d*2+1];l=j[e*2];t=j[e*2+1];x=
-j[f*2];s=j[f*2+1];f=b.faceVertexUvs[0];e=l;l=t;t=[];t.push(new THREE.UV(g,d));t.push(new THREE.UV(e,l));t.push(new THREE.UV(x,s));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.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=[],l=[];(function(a,g,j){for(var k,l,q,u=a.length;j<u;j=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=k+d;l=l+e;q=q+f;b.vertices.push(new THREE.Vector3(k,l,q))}})(g[0],8,0);(function(a,b,c){for(var d,e,f=a.length;c<f;c=c+b){d=a[c];e=a[c+1];d=d/1023;e=e/1023;l.push(d,1-e)}})(g[0],8,3);(function(a,
+b,c){for(var d,e,f,g=a.length;c<g;c=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,k,t,w,s,x=a.length;for(c=0;c<x;c=c+3){d=a[c];e=a[c+1];f=a[c+2];g=b;w=d;s=e;k=f;var F=j[e*3],E=j[e*3+1],B=j[e*3+2],v=j[f*3],z=j[f*3+1],J=j[f*3+2];t=new THREE.Vector3(j[d*3],j[d*3+1],j[d*3+2]);F=new THREE.Vector3(F,E,B);v=new THREE.Vector3(v,z,J);g.faces.push(new THREE.Face3(w,s,k,[t,F,v],null,0));g=l[d*2];d=l[d*2+1];k=l[e*2];t=l[e*2+1];w=
+l[f*2];s=l[f*2+1];f=b.faceVertexUvs[0];e=k;k=t;t=[];t.push(new THREE.UV(g,d));t.push(new THREE.UV(e,k));t.push(new THREE.UV(w,s));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;a!==void 0&&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){b===void 0&&(b=-1);c===void 0&&(c=0);f===void 0&&(f=1);e===void 0&&(e=new THREE.Color(16777215));if(d===void 0)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=-this.positionScreen.x*2,e=-this.positionScreen.y*2;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=c.x*Math.PI*0.25;c.rotation=c.rotation+(c.wantedRotation-c.rotation)*0.25}};
 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:false,time:0,direction:1,weight:1,directionBackwards:false,mirroredLoop:false};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&&h.length>1){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.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&&h.length>1){var k=h[1];d[k]||(d[k]={start:Infinity,end:-Infinity});h=d[k];if(f<h.start)h.start=f;if(f>h.end)h.end=f;c||(c=k)}}for(k in d){h=d[k];this.createAnimation(k,h.start,h.end,a)}this.firstAnimation=c};
 THREE.MorphBlendMesh.prototype.setAnimationDirectionForward=function(a){if(a=this.animationsMap[a]){a.direction=1;a.directionBackwards=false}};THREE.MorphBlendMesh.prototype.setAnimationDirectionBackward=function(a){if(a=this.animationsMap[a]){a.direction=-1;a.directionBackwards=true}};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];if(b){b.time=0;b.active=true}else console.warn("animation["+a+"] undefined")};THREE.MorphBlendMesh.prototype.stopAnimation=function(a){if(a=this.animationsMap[a])a.active=false};
 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.time+d.direction*a;if(d.mirroredLoop){if(d.time>d.duration||d.time<0){d.direction=d.direction*-1;if(d.time>d.duration){d.time=d.duration;d.directionBackwards=true}if(d.time<0){d.time=0;d.directionBackwards=false}}}else{d.time=d.time%d.duration;if(d.time<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,l,k,j,o,m,p;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);if(b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)<=0){k=false;j=a(THREE.ShaderFlares.lensFlare)}else{k=true;j=a(THREE.ShaderFlares.lensFlareVertexTexture)}o={};m={};o.vertex=b.getAttribLocation(j,"position");o.uv=b.getAttribLocation(j,"uv");m.renderType=b.getUniformLocation(j,"renderType");m.map=b.getUniformLocation(j,"map");m.occlusionMap=b.getUniformLocation(j,"occlusionMap");m.opacity=b.getUniformLocation(j,"opacity");m.color=b.getUniformLocation(j,
-"color");m.scale=b.getUniformLocation(j,"scale");m.rotation=b.getUniformLocation(j,"rotation");m.screenPosition=b.getUniformLocation(j,"screenPosition");p=false};this.render=function(a,d,e,u){var a=a.__webglFlares,t=a.length;if(t){var x=new THREE.Vector3,s=u/e,z=e*0.5,D=u*0.5,B=16/u,v=new THREE.Vector2(B*s,B),w=new THREE.Vector3(1,1,0),H=new THREE.Vector2(1,1),I=m,B=o;b.useProgram(j);if(!p){b.enableVertexAttribArray(o.vertex);b.enableVertexAttribArray(o.uv);p=true}b.uniform1i(I.occlusionMap,0);b.uniform1i(I.map,
-1);b.bindBuffer(b.ARRAY_BUFFER,f);b.vertexAttribPointer(B.vertex,2,b.FLOAT,false,16,0);b.vertexAttribPointer(B.uv,2,b.FLOAT,false,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.disable(b.CULL_FACE);b.depthMask(false);var M,T,C,K,O;for(M=0;M<t;M++){B=16/u;v.set(B*s,B);K=a[M];x.set(K.matrixWorld.elements[12],K.matrixWorld.elements[13],K.matrixWorld.elements[14]);d.matrixWorldInverse.multiplyVector3(x);d.projectionMatrix.multiplyVector3(x);w.copy(x);H.x=w.x*z+z;H.y=w.y*D+D;if(k||H.x>0&&H.x<e&&H.y>0&&
-H.y<u){b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,h);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,H.x-8,H.y-8,16,16,0);b.uniform1i(I.renderType,0);b.uniform2f(I.scale,v.x,v.y);b.uniform3f(I.screenPosition,w.x,w.y,w.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,H.x-8,H.y-8,16,16,0);b.uniform1i(I.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);K.positionScreen.copy(w);K.customUpdateCallback?K.customUpdateCallback(K):K.updateLensFlares();b.uniform1i(I.renderType,2);b.enable(b.BLEND);T=0;for(C=K.lensFlares.length;T<C;T++){O=K.lensFlares[T];if(O.opacity>0.0010&&O.scale>0.0010){w.x=O.x;w.y=O.y;w.z=O.z;B=O.size*O.scale/u;v.x=B*s;v.y=B;b.uniform3f(I.screenPosition,w.x,w.y,w.z);b.uniform2f(I.scale,v.x,v.y);b.uniform1f(I.rotation,O.rotation);b.uniform1f(I.opacity,O.opacity);
-b.uniform3f(I.color,O.color.r,O.color.g,O.color.b);c.setBlending(O.blending,O.blendEquation,O.blendSrc,O.blendDst);c.setTexture(O.texture,1);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0)}}}}b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(true)}}};
+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,k,j,l,o,n,p;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();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,
+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);if(b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)<=0){j=false;l=a(THREE.ShaderFlares.lensFlare)}else{j=true;l=a(THREE.ShaderFlares.lensFlareVertexTexture)}o={};n={};o.vertex=b.getAttribLocation(l,"position");o.uv=b.getAttribLocation(l,"uv");n.renderType=b.getUniformLocation(l,"renderType");n.map=b.getUniformLocation(l,"map");n.occlusionMap=b.getUniformLocation(l,"occlusionMap");n.opacity=b.getUniformLocation(l,"opacity");n.color=b.getUniformLocation(l,
+"color");n.scale=b.getUniformLocation(l,"scale");n.rotation=b.getUniformLocation(l,"rotation");n.screenPosition=b.getUniformLocation(l,"screenPosition");p=false};this.render=function(a,d,e,u){var a=a.__webglFlares,t=a.length;if(t){var w=new THREE.Vector3,s=u/e,x=e*0.5,F=u*0.5,E=16/u,B=new THREE.Vector2(E*s,E),v=new THREE.Vector3(1,1,0),z=new THREE.Vector2(1,1),J=n,E=o;b.useProgram(l);if(!p){b.enableVertexAttribArray(o.vertex);b.enableVertexAttribArray(o.uv);p=true}b.uniform1i(J.occlusionMap,0);b.uniform1i(J.map,
+1);b.bindBuffer(b.ARRAY_BUFFER,f);b.vertexAttribPointer(E.vertex,2,b.FLOAT,false,16,0);b.vertexAttribPointer(E.uv,2,b.FLOAT,false,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.disable(b.CULL_FACE);b.depthMask(false);var K,X,Q,A,M;for(K=0;K<t;K++){E=16/u;B.set(E*s,E);A=a[K];w.set(A.matrixWorld.elements[12],A.matrixWorld.elements[13],A.matrixWorld.elements[14]);d.matrixWorldInverse.multiplyVector3(w);d.projectionMatrix.multiplyVector3(w);v.copy(w);z.x=v.x*x+x;z.y=v.y*F+F;if(j||z.x>0&&z.x<e&&z.y>0&&
+z.y<u){b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,h);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,z.x-8,z.y-8,16,16,0);b.uniform1i(J.renderType,0);b.uniform2f(J.scale,B.x,B.y);b.uniform3f(J.screenPosition,v.x,v.y,v.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,z.x-8,z.y-8,16,16,0);b.uniform1i(J.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);A.positionScreen.copy(v);A.customUpdateCallback?A.customUpdateCallback(A):A.updateLensFlares();b.uniform1i(J.renderType,2);b.enable(b.BLEND);X=0;for(Q=A.lensFlares.length;X<Q;X++){M=A.lensFlares[X];if(M.opacity>0.0010&&M.scale>0.0010){v.x=M.x;v.y=M.y;v.z=M.z;E=M.size*M.scale/u;B.x=E*s;B.y=E;b.uniform3f(J.screenPosition,v.x,v.y,v.z);b.uniform2f(J.scale,B.x,B.y);b.uniform1f(J.rotation,M.rotation);b.uniform1f(J.opacity,M.opacity);
+b.uniform3f(J.color,M.color.r,M.color.g,M.color.b);c.setBlending(M.blending,M.blendEquation,M.blendSrc,M.blendDst);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(true)}}};
 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:true});c._shadowPass=true;d._shadowPass=true};this.render=
-function(a,c){b.shadowMapEnabled&&b.shadowMapAutoUpdate&&this.update(a,c)};this.update=function(l,k){var j,o,m,p,r,n,q,u,t,x=[];p=0;a.clearColor(1,1,1,1);a.disable(a.BLEND);b.shadowMapCullFrontFaces&&a.cullFace(a.FRONT);b.setDepthTest(true);j=0;for(o=l.__lights.length;j<o;j++){m=l.__lights[j];if(m.castShadow)if(m instanceof THREE.DirectionalLight&&m.shadowCascade)for(r=0;r<m.shadowCascadeCount;r++){var s;if(m.shadowCascadeArray[r])s=m.shadowCascadeArray[r];else{t=m;q=r;s=new THREE.DirectionalLight;
+function(a,c){b.shadowMapEnabled&&b.shadowMapAutoUpdate&&this.update(a,c)};this.update=function(k,j){var l,o,n,p,r,m,q,u,t,w=[];p=0;a.clearColor(1,1,1,1);a.disable(a.BLEND);b.shadowMapCullFrontFaces&&a.cullFace(a.FRONT);b.setDepthTest(true);l=0;for(o=k.__lights.length;l<o;l++){n=k.__lights[l];if(n.castShadow)if(n instanceof THREE.DirectionalLight&&n.shadowCascade)for(r=0;r<n.shadowCascadeCount;r++){var s;if(n.shadowCascadeArray[r])s=n.shadowCascadeArray[r];else{t=n;q=r;s=new THREE.DirectionalLight;
 s.isVirtual=true;s.onlyShadow=true;s.castShadow=true;s.shadowCameraNear=t.shadowCameraNear;s.shadowCameraFar=t.shadowCameraFar;s.shadowCameraLeft=t.shadowCameraLeft;s.shadowCameraRight=t.shadowCameraRight;s.shadowCameraBottom=t.shadowCameraBottom;s.shadowCameraTop=t.shadowCameraTop;s.shadowCameraVisible=t.shadowCameraVisible;s.shadowDarkness=t.shadowDarkness;s.shadowBias=t.shadowCascadeBias[q];s.shadowMapWidth=t.shadowCascadeWidth[q];s.shadowMapHeight=t.shadowCascadeHeight[q];s.pointsWorld=[];s.pointsFrustum=
-[];u=s.pointsWorld;n=s.pointsFrustum;for(var z=0;z<8;z++){u[z]=new THREE.Vector3;n[z]=new THREE.Vector3}u=t.shadowCascadeNearZ[q];t=t.shadowCascadeFarZ[q];n[0].set(-1,-1,u);n[1].set(1,-1,u);n[2].set(-1,1,u);n[3].set(1,1,u);n[4].set(-1,-1,t);n[5].set(1,-1,t);n[6].set(-1,1,t);n[7].set(1,1,t);s.originalCamera=k;n=new THREE.Gyroscope;n.position=m.shadowCascadeOffset;n.add(s);n.add(s.target);k.add(n);m.shadowCascadeArray[r]=s;console.log("Created virtualLight",s)}q=m;u=r;t=q.shadowCascadeArray[u];t.position.copy(q.position);
-t.target.position.copy(q.target.position);t.lookAt(t.target);t.shadowCameraVisible=q.shadowCameraVisible;t.shadowDarkness=q.shadowDarkness;t.shadowBias=q.shadowCascadeBias[u];n=q.shadowCascadeNearZ[u];q=q.shadowCascadeFarZ[u];t=t.pointsFrustum;t[0].z=n;t[1].z=n;t[2].z=n;t[3].z=n;t[4].z=q;t[5].z=q;t[6].z=q;t[7].z=q;x[p]=s;p++}else{x[p]=m;p++}}j=0;for(o=x.length;j<o;j++){m=x[j];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&&s.originalCamera==k){r=k;p=m.shadowCamera;n=m.pointsFrustum;t=m.pointsWorld;g.set(Infinity,Infinity,Infinity);h.set(-Infinity,-Infinity,-Infinity);for(q=0;q<8;q++){u=t[q];u.copy(n[q]);THREE.ShadowMapPlugin.__projector.unprojectVector(u,
-r);p.matrixWorldInverse.multiplyVector3(u);if(u.x<g.x)g.x=u.x;if(u.x>h.x)h.x=u.x;if(u.y<g.y)g.y=u.y;if(u.y>h.y)h.y=u.y;if(u.z<g.z)g.z=u.z;if(u.z>h.z)h.z=u.z}p.left=g.x;p.right=h.x;p.top=h.y;p.bottom=g.y;p.updateProjectionMatrix()}p=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(p);
-b.clear();t=l.__webglObjects;m=0;for(p=t.length;m<p;m++){q=t[m];n=q.object;q.render=false;if(n.visible&&n.castShadow&&(!(n instanceof THREE.Mesh)||!n.frustumCulled||e.contains(n))){n._modelViewMatrix.multiply(r.matrixWorldInverse,n.matrixWorld);q.render=true}}m=0;for(p=t.length;m<p;m++){q=t[m];if(q.render){n=q.object;q=q.buffer;b.setObjectFaces(n);u=n.customDepthMaterial?n.customDepthMaterial:n.geometry.morphTargets.length?d:c;q instanceof THREE.BufferGeometry?b.renderBufferDirect(r,l.__lights,null,
-u,q,n):b.renderBuffer(r,l.__lights,null,u,q,n)}}t=l.__webglObjectsImmediate;m=0;for(p=t.length;m<p;m++){q=t[m];n=q.object;if(n.visible&&n.castShadow){n._modelViewMatrix.multiply(r.matrixWorldInverse,n.matrixWorld);b.renderImmediateObject(r,l.__lights,null,c,n)}}}j=b.getClearColor();o=b.getClearAlpha();a.clearColor(j.r,j.g,j.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,e,f,g,h,l,k,j;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(),p=b.createShader(b.FRAGMENT_SHADER),r=b.createShader(b.VERTEX_SHADER);b.shaderSource(p,a.fragmentShader);b.shaderSource(r,a.vertexShader);b.compileShader(p);b.compileShader(r);b.attachShader(m,p);b.attachShader(m,r);b.linkProgram(m);h=m;l={};k={};l.position=b.getAttribLocation(h,"position");l.uv=b.getAttribLocation(h,"uv");k.uvOffset=b.getUniformLocation(h,"uvOffset");k.uvScale=b.getUniformLocation(h,
-"uvScale");k.rotation=b.getUniformLocation(h,"rotation");k.scale=b.getUniformLocation(h,"scale");k.alignment=b.getUniformLocation(h,"alignment");k.color=b.getUniformLocation(h,"color");k.map=b.getUniformLocation(h,"map");k.opacity=b.getUniformLocation(h,"opacity");k.useScreenCoordinates=b.getUniformLocation(h,"useScreenCoordinates");k.affectedByDistance=b.getUniformLocation(h,"affectedByDistance");k.screenPosition=b.getUniformLocation(h,"screenPosition");k.modelViewMatrix=b.getUniformLocation(h,"modelViewMatrix");
-k.projectionMatrix=b.getUniformLocation(h,"projectionMatrix");j=false};this.render=function(d,e,p,r){var d=d.__webglSprites,n=d.length;if(n){var q=l,u=k,t=r/p,p=p*0.5,x=r*0.5,s=true;b.useProgram(h);if(!j){b.enableVertexAttribArray(q.position);b.enableVertexAttribArray(q.uv);j=true}b.disable(b.CULL_FACE);b.enable(b.BLEND);b.depthMask(true);b.bindBuffer(b.ARRAY_BUFFER,f);b.vertexAttribPointer(q.position,2,b.FLOAT,false,16,0);b.vertexAttribPointer(q.uv,2,b.FLOAT,false,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,
-g);b.uniformMatrix4fv(u.projectionMatrix,false,e._projectionMatrixArray);b.activeTexture(b.TEXTURE0);b.uniform1i(u.map,0);for(var z,D=[],q=0;q<n;q++){z=d[q];if(z.visible&&z.opacity!==0)if(z.useScreenCoordinates)z.z=-z.position.z;else{z._modelViewMatrix.multiply(e.matrixWorldInverse,z.matrixWorld);z.z=-z._modelViewMatrix.elements[14]}}d.sort(a);for(q=0;q<n;q++){z=d[q];if(z.visible&&z.opacity!==0&&z.map&&z.map.image&&z.map.image.width){if(z.useScreenCoordinates){b.uniform1i(u.useScreenCoordinates,1);
-b.uniform3f(u.screenPosition,(z.position.x-p)/p,(x-z.position.y)/x,Math.max(0,Math.min(1,z.position.z)))}else{b.uniform1i(u.useScreenCoordinates,0);b.uniform1i(u.affectedByDistance,z.affectedByDistance?1:0);b.uniformMatrix4fv(u.modelViewMatrix,false,z._modelViewMatrix.elements)}e=z.map.image.width/(z.scaleByViewport?r:1);D[0]=e*t*z.scale.x;D[1]=e*z.scale.y;b.uniform2f(u.uvScale,z.uvScale.x,z.uvScale.y);b.uniform2f(u.uvOffset,z.uvOffset.x,z.uvOffset.y);b.uniform2f(u.alignment,z.alignment.x,z.alignment.y);
-b.uniform1f(u.opacity,z.opacity);b.uniform3f(u.color,z.color.r,z.color.g,z.color.b);b.uniform1f(u.rotation,z.rotation);b.uniform2fv(u.scale,D);if(z.mergeWith3D&&!s){b.enable(b.DEPTH_TEST);s=true}else if(!z.mergeWith3D&&s){b.disable(b.DEPTH_TEST);s=false}c.setBlending(z.blending,z.blendEquation,z.blendSrc,z.blendDst);c.setTexture(z.map,0);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0)}}b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(true)}}};
+[];u=s.pointsWorld;m=s.pointsFrustum;for(var x=0;x<8;x++){u[x]=new THREE.Vector3;m[x]=new THREE.Vector3}u=t.shadowCascadeNearZ[q];t=t.shadowCascadeFarZ[q];m[0].set(-1,-1,u);m[1].set(1,-1,u);m[2].set(-1,1,u);m[3].set(1,1,u);m[4].set(-1,-1,t);m[5].set(1,-1,t);m[6].set(-1,1,t);m[7].set(1,1,t);s.originalCamera=j;m=new THREE.Gyroscope;m.position=n.shadowCascadeOffset;m.add(s);m.add(s.target);j.add(m);n.shadowCascadeArray[r]=s;console.log("Created virtualLight",s)}q=n;u=r;t=q.shadowCascadeArray[u];t.position.copy(q.position);
+t.target.position.copy(q.target.position);t.lookAt(t.target);t.shadowCameraVisible=q.shadowCameraVisible;t.shadowDarkness=q.shadowDarkness;t.shadowBias=q.shadowCascadeBias[u];m=q.shadowCascadeNearZ[u];q=q.shadowCascadeFarZ[u];t=t.pointsFrustum;t[0].z=m;t[1].z=m;t[2].z=m;t[3].z=m;t[4].z=q;t[5].z=q;t[6].z=q;t[7].z=q;w[p]=s;p++}else{w[p]=n;p++}}l=0;for(o=w.length;l<o;l++){n=w[l];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}k.add(n.shadowCamera);b.autoUpdateScene&&k.updateMatrixWorld()}if(n.shadowCameraVisible&&!n.cameraHelper){n.cameraHelper=new THREE.CameraHelper(n.shadowCamera);n.shadowCamera.add(n.cameraHelper)}if(n.isVirtual&&s.originalCamera==j){r=j;p=n.shadowCamera;m=n.pointsFrustum;t=n.pointsWorld;g.set(Infinity,Infinity,Infinity);h.set(-Infinity,-Infinity,-Infinity);for(q=0;q<8;q++){u=t[q];u.copy(m[q]);THREE.ShadowMapPlugin.__projector.unprojectVector(u,
+r);p.matrixWorldInverse.multiplyVector3(u);if(u.x<g.x)g.x=u.x;if(u.x>h.x)h.x=u.x;if(u.y<g.y)g.y=u.y;if(u.y>h.y)h.y=u.y;if(u.z<g.z)g.z=u.z;if(u.z>h.z)h.z=u.z}p.left=g.x;p.right=h.x;p.top=h.y;p.bottom=g.y;p.updateProjectionMatrix()}p=n.shadowMap;m=n.shadowMatrix;r=n.shadowCamera;r.position.copy(n.matrixWorld.getPosition());r.lookAt(n.target.matrixWorld.getPosition());r.updateMatrixWorld();r.matrixWorldInverse.getInverse(r.matrixWorld);if(n.cameraHelper)n.cameraHelper.lines.visible=n.shadowCameraVisible;
+n.shadowCameraVisible&&n.cameraHelper.update();m.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);m.multiplySelf(r.projectionMatrix);m.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(p);
+b.clear();t=k.__webglObjects;n=0;for(p=t.length;n<p;n++){q=t[n];m=q.object;q.render=false;if(m.visible&&m.castShadow&&(!(m instanceof THREE.Mesh)||!m.frustumCulled||e.contains(m))){m._modelViewMatrix.multiply(r.matrixWorldInverse,m.matrixWorld);q.render=true}}n=0;for(p=t.length;n<p;n++){q=t[n];if(q.render){m=q.object;q=q.buffer;b.setObjectFaces(m);u=m.customDepthMaterial?m.customDepthMaterial:m.geometry.morphTargets.length?d:c;q instanceof THREE.BufferGeometry?b.renderBufferDirect(r,k.__lights,null,
+u,q,m):b.renderBuffer(r,k.__lights,null,u,q,m)}}t=k.__webglObjectsImmediate;n=0;for(p=t.length;n<p;n++){q=t[n];m=q.object;if(m.visible&&m.castShadow){m._modelViewMatrix.multiply(r.matrixWorldInverse,m.matrixWorld);b.renderImmediateObject(r,k.__lights,null,c,m)}}}l=b.getClearColor();o=b.getClearAlpha();a.clearColor(l.r,l.g,l.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,e,f,g,h,k,j,l;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(),p=b.createShader(b.FRAGMENT_SHADER),r=b.createShader(b.VERTEX_SHADER);b.shaderSource(p,a.fragmentShader);b.shaderSource(r,a.vertexShader);b.compileShader(p);b.compileShader(r);b.attachShader(n,p);b.attachShader(n,r);b.linkProgram(n);h=n;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");l=false};this.render=function(d,e,p,r){var d=d.__webglSprites,m=d.length;if(m){var q=k,u=j,t=r/p,p=p*0.5,w=r*0.5,s=true;b.useProgram(h);if(!l){b.enableVertexAttribArray(q.position);b.enableVertexAttribArray(q.uv);l=true}b.disable(b.CULL_FACE);b.enable(b.BLEND);b.depthMask(true);b.bindBuffer(b.ARRAY_BUFFER,f);b.vertexAttribPointer(q.position,2,b.FLOAT,false,16,0);b.vertexAttribPointer(q.uv,2,b.FLOAT,false,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,
+g);b.uniformMatrix4fv(u.projectionMatrix,false,e._projectionMatrixArray);b.activeTexture(b.TEXTURE0);b.uniform1i(u.map,0);for(var x,F=[],q=0;q<m;q++){x=d[q];if(x.visible&&x.opacity!==0)if(x.useScreenCoordinates)x.z=-x.position.z;else{x._modelViewMatrix.multiply(e.matrixWorldInverse,x.matrixWorld);x.z=-x._modelViewMatrix.elements[14]}}d.sort(a);for(q=0;q<m;q++){x=d[q];if(x.visible&&x.opacity!==0&&x.map&&x.map.image&&x.map.image.width){if(x.useScreenCoordinates){b.uniform1i(u.useScreenCoordinates,1);
+b.uniform3f(u.screenPosition,(x.position.x-p)/p,(w-x.position.y)/w,Math.max(0,Math.min(1,x.position.z)))}else{b.uniform1i(u.useScreenCoordinates,0);b.uniform1i(u.affectedByDistance,x.affectedByDistance?1:0);b.uniformMatrix4fv(u.modelViewMatrix,false,x._modelViewMatrix.elements)}e=x.map.image.width/(x.scaleByViewport?r:1);F[0]=e*t*x.scale.x;F[1]=e*x.scale.y;b.uniform2f(u.uvScale,x.uvScale.x,x.uvScale.y);b.uniform2f(u.uvOffset,x.uvOffset.x,x.uvOffset.y);b.uniform2f(u.alignment,x.alignment.x,x.alignment.y);
+b.uniform1f(u.opacity,x.opacity);b.uniform3f(u.color,x.color.r,x.color.g,x.color.b);b.uniform1f(u.rotation,x.rotation);b.uniform2fv(u.scale,F);if(x.mergeWith3D&&!s){b.enable(b.DEPTH_TEST);s=true}else if(!x.mergeWith3D&&s){b.disable(b.DEPTH_TEST);s=false}c.setBlending(x.blending,x.blendEquation,x.blendSrc,x.blendDst);c.setTexture(x.map,0);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0)}}b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(true)}}};
 THREE.DepthPassPlugin=function(){this.enabled=false;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:true});c._shadowPass=true;d._shadowPass=true};this.render=
-function(a,b){this.enabled&&this.update(a,b)};this.update=function(g,h){var l,k,j,o,m,p;a.clearColor(1,1,1,1);a.disable(a.BLEND);b.setDepthTest(true);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();p=g.__webglObjects;l=0;for(k=p.length;l<k;l++){j=p[l];m=j.object;j.render=false;if(m.visible&&(!(m instanceof THREE.Mesh)||!m.frustumCulled||e.contains(m))){m._modelViewMatrix.multiply(h.matrixWorldInverse,m.matrixWorld);j.render=true}}l=0;for(k=p.length;l<k;l++){j=p[l];if(j.render){m=j.object;j=j.buffer;b.setObjectFaces(m);o=m.customDepthMaterial?m.customDepthMaterial:m.geometry.morphTargets.length?d:c;j instanceof
-THREE.BufferGeometry?b.renderBufferDirect(h,g.__lights,null,o,j,m):b.renderBuffer(h,g.__lights,null,o,j,m)}}p=g.__webglObjectsImmediate;l=0;for(k=p.length;l<k;l++){j=p[l];m=j.object;if(m.visible&&m.castShadow){m._modelViewMatrix.multiply(h.matrixWorldInverse,m.matrixWorld);b.renderImmediateObject(h,g.__lights,null,c,m)}}l=b.getClearColor();k=b.getClearAlpha();a.clearColor(l.r,l.g,l.b,k);a.enable(a.BLEND)}};
-THREE.WebGLRenderer&&(THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoUpdateScene=false;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,k,j,o;e.matrixAutoUpdate=f.matrixAutoUpdate=false;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},m=new THREE.WebGLRenderTarget(512,512,a),p=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:p}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D mapLeft;\nuniform sampler2D mapRight;\nvarying vec2 vUv;\nvoid main() {\nvec4 colorL, colorR;\nvec2 uv = vUv;\ncolorL = texture2D( mapLeft, uv );\ncolorR = texture2D( mapRight, uv );\ngl_FragColor = vec4( colorL.g * 0.7 + colorL.b * 0.3, colorR.g, colorR.b, colorL.a + colorR.a ) * 1.1;\n}"}),
-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;p.width=a;p.height=d};this.render=function(a,c){a.updateMatrixWorld();if(l!==c.aspect||k!==c.near||j!==c.far||o!==c.fov){l=c.aspect;k=c.near;j=c.far;o=c.fov;var t=c.projectionMatrix.clone(),x=125/30*0.5,s=x*k/125,z=k*Math.tan(o*Math.PI/360),D;g.elements[12]=x;h.elements[12]=-x;x=-z*l+s;D=z*l+s;t.elements[0]=2*k/(D-x);t.elements[8]=
-(D+x)/(D-x);e.projectionMatrix.copy(t);x=-z*l-s;D=z*l-s;t.elements[0]=2*k/(D-x);t.elements[8]=(D+x)/(D-x);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,m,true);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,p,true);n.updateMatrixWorld();d.call(b,n,r)}});
+function(a,b){this.enabled&&this.update(a,b)};this.update=function(g,h){var k,j,l,o,n,p;a.clearColor(1,1,1,1);a.disable(a.BLEND);b.setDepthTest(true);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();p=g.__webglObjects;k=0;for(j=p.length;k<j;k++){l=p[k];n=l.object;l.render=false;if(n.visible&&(!(n instanceof THREE.Mesh)||!n.frustumCulled||e.contains(n))){n._modelViewMatrix.multiply(h.matrixWorldInverse,n.matrixWorld);l.render=true}}k=0;for(j=p.length;k<j;k++){l=p[k];if(l.render){n=l.object;l=l.buffer;b.setObjectFaces(n);o=n.customDepthMaterial?n.customDepthMaterial:n.geometry.morphTargets.length?d:c;l instanceof
+THREE.BufferGeometry?b.renderBufferDirect(h,g.__lights,null,o,l,n):b.renderBuffer(h,g.__lights,null,o,l,n)}}p=g.__webglObjectsImmediate;k=0;for(j=p.length;k<j;k++){l=p[k];n=l.object;if(n.visible&&n.castShadow){n._modelViewMatrix.multiply(h.matrixWorldInverse,n.matrixWorld);b.renderImmediateObject(h,g.__lights,null,c,n)}}k=b.getClearColor();j=b.getClearAlpha();a.clearColor(k.r,k.g,k.b,j);a.enable(a.BLEND)}};
+THREE.WebGLRenderer&&(THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoUpdateScene=false;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,k,j,l,o;e.matrixAutoUpdate=f.matrixAutoUpdate=false;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},n=new THREE.WebGLRenderTarget(512,512,a),p=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:n},mapRight:{type:"t",value:1,texture:p}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D mapLeft;\nuniform sampler2D mapRight;\nvarying vec2 vUv;\nvoid main() {\nvec4 colorL, colorR;\nvec2 uv = vUv;\ncolorL = texture2D( mapLeft, uv );\ncolorR = texture2D( mapRight, uv );\ngl_FragColor = vec4( colorL.g * 0.7 + colorL.b * 0.3, colorR.g, colorR.b, colorL.a + colorR.a ) * 1.1;\n}"}),
+m=new THREE.Scene,a=new THREE.Mesh(new THREE.PlaneGeometry(2,2),a);a.rotation.x=Math.PI/2;m.add(a);m.add(r);this.setSize=function(a,d){c.call(b,a,d);n.width=a;n.height=d;p.width=a;p.height=d};this.render=function(a,c){a.updateMatrixWorld();if(k!==c.aspect||j!==c.near||l!==c.far||o!==c.fov){k=c.aspect;j=c.near;l=c.far;o=c.fov;var t=c.projectionMatrix.clone(),w=125/30*0.5,s=w*j/125,x=j*Math.tan(o*Math.PI/360),F;g.elements[12]=w;h.elements[12]=-w;w=-x*k+s;F=x*k+s;t.elements[0]=2*j/(F-w);t.elements[8]=
+(F+w)/(F-w);e.projectionMatrix.copy(t);w=-x*k-s;F=x*k-s;t.elements[0]=2*j/(F-w);t.elements[8]=(F+w)/(F-w);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,n,true);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,p,true);m.updateMatrixWorld();d.call(b,m,r)}});
 THREE.WebGLRenderer&&(THREE.CrosseyedWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoClear=false;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&&a.separation!==void 0)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,false)}});
 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}"},

+ 1 - 1
build/custom/ThreeCanvas.js

@@ -79,7 +79,7 @@ this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRo
 Math.abs(this.x);this.y=a.elements[8]-a.elements[2]<0?-Math.abs(this.y):Math.abs(this.y);this.z=a.elements[1]-a.elements[4]<0?-Math.abs(this.z):Math.abs(this.z);this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x=this.x*-1;this.y=this.y*-1;this.z=this.z*-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=
 Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a===0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x=this.x*a;this.y=this.y*a;this.z=this.z*a;this.w=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,j=k*c+g*e-h*d,i=k*d+h*c-f*e,m=k*e+f*d-g*c,c=-f*c-g*d-h*e;b.x=j*k+c*-f+i*-h-m*-g;b.y=i*k+c*-g+m*-f-j*-h;b.z=m*k+c*-h+j*-g-i*-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;if(e<0){c.w=-b.w;c.x=-b.x;c.y=-b.y;c.z=-b.z;e=-e}else c.copy(b);if(Math.abs(e)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var f=Math.acos(e),e=Math.sqrt(1-e*e);if(Math.abs(e)<0.0010){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}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=THREE.Vector3;
+THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(e<0){c.w=-b.w;c.x=-b.x;c.y=-b.y;c.z=-b.z;e=-e}else c.copy(b);if(Math.abs(e)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var f=Math.acos(e),e=Math.sqrt(1-e*e);if(Math.abs(e)<0.0010){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}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(){console.warn("THREE.Vertex has been DEPRECATED. Use THREE.Vector3 instead.")};
 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;b=0;for(c=this.vertexNormals.length;b<c;b++)a.vertexNormals[b]=this.vertexNormals[b].clone();b=0;for(c=this.vertexColors.length;b<c;b++)a.vertexColors[b]=this.vertexColors[b].clone();b=0;for(c=this.vertexTangents.length;b<c;b++)a.vertexTangents[b]=this.vertexTangents[b].clone();
 return a}};THREE.Face4=function(a,b,c,d,e,f,g){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materialIndex=g;this.centroid=new THREE.Vector3};

+ 1 - 1
build/custom/ThreeDOM.js

@@ -79,7 +79,7 @@ this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRo
 Math.abs(this.x);this.y=a.elements[8]-a.elements[2]<0?-Math.abs(this.y):Math.abs(this.y);this.z=a.elements[1]-a.elements[4]<0?-Math.abs(this.z):Math.abs(this.z);this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x=this.x*-1;this.y=this.y*-1;this.z=this.z*-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=
 Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a===0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x=this.x*a;this.y=this.y*a;this.z=this.z*a;this.w=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,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,k=j*c+g*e-i*d,h=j*d+i*c-f*e,m=j*e+f*d-g*c,c=-f*c-g*d-i*e;b.x=k*j+c*-f+h*-i-m*-g;b.y=h*j+c*-g+m*-f-k*-i;b.z=m*j+c*-i+k*-g-h*-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;if(e<0){c.w=-b.w;c.x=-b.x;c.y=-b.y;c.z=-b.z;e=-e}else c.copy(b);if(Math.abs(e)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var f=Math.acos(e),e=Math.sqrt(1-e*e);if(Math.abs(e)<0.0010){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}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=THREE.Vector3;
+THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(e<0){c.w=-b.w;c.x=-b.x;c.y=-b.y;c.z=-b.z;e=-e}else c.copy(b);if(Math.abs(e)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var f=Math.acos(e),e=Math.sqrt(1-e*e);if(Math.abs(e)<0.0010){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}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(){console.warn("THREE.Vertex has been DEPRECATED. Use THREE.Vector3 instead.")};
 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;b=0;for(c=this.vertexNormals.length;b<c;b++)a.vertexNormals[b]=this.vertexNormals[b].clone();b=0;for(c=this.vertexColors.length;b<c;b++)a.vertexColors[b]=this.vertexColors[b].clone();b=0;for(c=this.vertexTangents.length;b<c;b++)a.vertexTangents[b]=this.vertexTangents[b].clone();
 return a}};THREE.Face4=function(a,b,c,d,e,f,g){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materialIndex=g;this.centroid=new THREE.Vector3};

+ 202 - 201
build/custom/ThreeExtras.js

@@ -1,30 +1,30 @@
 // 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}};
 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,j=a.faces,i=e.faces,k=a.faceVertexUvs[0],q=e.faceVertexUvs[0],l={},n=0;n<a.materials.length;n++)l[a.materials[n].id]=n;b instanceof THREE.Mesh&&(b.matrixAutoUpdate&&b.updateMatrix(),c=b.matrix,d=new THREE.Matrix4,d.extractRotation(c,b.scale));for(var n=0,r=h.length;n<r;n++){var m=h[n].clone();c&&c.multiplyVector3(m);g.push(m)}n=0;for(r=i.length;n<r;n++){var g=i[n],
-p,t,s=g.vertexNormals,v=g.vertexColors;g instanceof THREE.Face3?p=new THREE.Face3(g.a+f,g.b+f,g.c+f):g instanceof THREE.Face4&&(p=new THREE.Face4(g.a+f,g.b+f,g.c+f,g.d+f));p.normal.copy(g.normal);d&&d.multiplyVector3(p.normal);h=0;for(m=s.length;h<m;h++)t=s[h].clone(),d&&d.multiplyVector3(t),p.vertexNormals.push(t);p.color.copy(g.color);h=0;for(m=v.length;h<m;h++)t=v[h],p.vertexColors.push(t.clone());void 0!==g.materialIndex&&(h=e.materials[g.materialIndex],m=h.id,v=l[m],void 0===v&&(v=a.materials.length,
-l[m]=v,a.materials.push(h)),p.materialIndex=v);p.centroid.copy(g.centroid);c&&c.multiplyVector3(p.centroid);j.push(p)}n=0;for(r=q.length;n<r;n++){c=q[n];d=[];h=0;for(m=c.length;h<m;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];a.materials&&(b.materials=a.materials.slice());a=0;for(c=d.length;a<c;a++)b.vertices.push(d[a].clone());a=0;for(c=f.length;a<c;a++)b.faces.push(f[a].clone());a=0;for(c=e.length;a<
+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,j=a.faces,i=e.faces,k=a.faceVertexUvs[0],o=e.faceVertexUvs[0],l={},n=0;n<a.materials.length;n++)l[a.materials[n].id]=n;b instanceof THREE.Mesh&&(b.matrixAutoUpdate&&b.updateMatrix(),c=b.matrix,d=new THREE.Matrix4,d.extractRotation(c,b.scale));for(var n=0,q=h.length;n<q;n++){var m=h[n].clone();c&&c.multiplyVector3(m);g.push(m)}n=0;for(q=i.length;n<q;n++){var g=i[n],
+r,u,s=g.vertexNormals,t=g.vertexColors;g instanceof THREE.Face3?r=new THREE.Face3(g.a+f,g.b+f,g.c+f):g instanceof THREE.Face4&&(r=new THREE.Face4(g.a+f,g.b+f,g.c+f,g.d+f));r.normal.copy(g.normal);d&&d.multiplyVector3(r.normal);h=0;for(m=s.length;h<m;h++)u=s[h].clone(),d&&d.multiplyVector3(u),r.vertexNormals.push(u);r.color.copy(g.color);h=0;for(m=t.length;h<m;h++)u=t[h],r.vertexColors.push(u.clone());void 0!==g.materialIndex&&(h=e.materials[g.materialIndex],m=h.id,t=l[m],void 0===t&&(t=a.materials.length,
+l[m]=t,a.materials.push(h)),r.materialIndex=t);r.centroid.copy(g.centroid);c&&c.multiplyVector3(r.centroid);j.push(r)}n=0;for(q=o.length;n<q;n++){c=o[n];d=[];h=0;for(m=c.length;h<m;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];a.materials&&(b.materials=a.materials.slice());a=0;for(c=d.length;a<c;a++)b.vertices.push(d[a].clone());a=0;for(c=f.length;a<c;a++)b.faces.push(f[a].clone());a=0;for(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],f=b.vertices[a.b],e=b.vertices[a.c],THREE.GeometryUtils.randomPointInTriangle(d,f,e);if(a instanceof THREE.Face4){d=b.vertices[a.a];f=b.vertices[a.b];e=b.vertices[a.c];var b=b.vertices[a.d],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 i[f]>a?b(c,f-1):i[f]<a?b(f+1,d):f}return b(0,i.length-1)}var d,f,e=a.faces,g=a.vertices,h=e.length,j=0,i=[],k,q,l,n;for(f=0;f<h;f++)d=e[f],d instanceof THREE.Face3?(k=g[d.a],q=g[d.b],l=g[d.c],d._area=THREE.GeometryUtils.triangleArea(k,q,l)):d instanceof THREE.Face4&&(k=g[d.a],q=g[d.b],l=g[d.c],n=g[d.d],d._area1=THREE.GeometryUtils.triangleArea(k,
-q,n),d._area2=THREE.GeometryUtils.triangleArea(q,l,n),d._area=d._area1+d._area2),j+=d._area,i[f]=j;d=[];for(f=0;f<b;f++)g=THREE.GeometryUtils.random()*j,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,
+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 i[f]>a?b(c,f-1):i[f]<a?b(f+1,d):f}return b(0,i.length-1)}var d,f,e=a.faces,g=a.vertices,h=e.length,j=0,i=[],k,o,l,n;for(f=0;f<h;f++)d=e[f],d instanceof THREE.Face3?(k=g[d.a],o=g[d.b],l=g[d.c],d._area=THREE.GeometryUtils.triangleArea(k,o,l)):d instanceof THREE.Face4&&(k=g[d.a],o=g[d.b],l=g[d.c],n=g[d.d],d._area1=THREE.GeometryUtils.triangleArea(k,
+o,n),d._area2=THREE.GeometryUtils.triangleArea(o,l,n),d._area=d._area1+d._area2),j+=d._area,i[f]=j;d=[];for(f=0;f<b;f++)g=THREE.GeometryUtils.random()*j,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).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],f=0,e=d.length;f<e;f++)if(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=[];b=0;for(c=a.faceUvs.length;b<c;b++)g[b]=[];b=0;for(c=a.faceVertexUvs.length;b<c;b++)h[b]=[];b=0;for(c=a.faces.length;b<c;b++)if(d=
-a.faces[b],d instanceof THREE.Face4){f=d.a;var j=d.b,i=d.c,k=d.d,q=new THREE.Face3,l=new THREE.Face3;q.color.copy(d.color);l.color.copy(d.color);q.materialIndex=d.materialIndex;l.materialIndex=d.materialIndex;q.a=f;q.b=j;q.c=k;l.a=j;l.b=i;l.c=k;4===d.vertexColors.length&&(q.vertexColors[0]=d.vertexColors[0].clone(),q.vertexColors[1]=d.vertexColors[1].clone(),q.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(q,l);d=0;for(f=a.faceVertexUvs.length;d<f;d++)a.faceVertexUvs[d].length&&(q=a.faceVertexUvs[d][b],j=q[1],i=q[2],k=q[3],q=[q[0].clone(),j.clone(),k.clone()],j=[j.clone(),i.clone(),k.clone()],h[d].push(q,j));d=0;for(f=a.faceUvs.length;d<f;d++)a.faceUvs[d].length&&(j=a.faceUvs[d][b],g[d].push(j,j))}else{e.push(d);d=0;for(f=a.faceUvs.length;d<f;d++)g[d].push(a.faceUvs[d]);d=0;for(f=a.faceVertexUvs.length;d<f;d++)h[d].push(a.faceVertexUvs[d])}a.faces=e;a.faceUvs=g;a.faceVertexUvs=
+a.faces[b],d instanceof THREE.Face4){f=d.a;var j=d.b,i=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=f;o.b=j;o.c=k;l.a=j;l.b=i;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());e.push(o,l);d=0;for(f=a.faceVertexUvs.length;d<f;d++)a.faceVertexUvs[d].length&&(o=a.faceVertexUvs[d][b],j=o[1],i=o[2],k=o[3],o=[o[0].clone(),j.clone(),k.clone()],j=[j.clone(),i.clone(),k.clone()],h[d].push(o,j));d=0;for(f=a.faceUvs.length;d<f;d++)a.faceUvs[d].length&&(j=a.faceUvs[d][b],g[d].push(j,j))}else{e.push(d);d=0;for(f=a.faceUvs.length;d<f;d++)g[d].push(a.faceUvs[d]);d=0;for(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,j=e.c,g=a.vertices[g],h=a.vertices[h],j=a.vertices[j],i=a.vertices[e.d];b.push(g.clone());b.push(h.clone());b.push(j.clone());b.push(i.clone());e.a=f;e.b=f+1;e.c=f+2;e.d=f+3}else g=e.a,h=e.b,j=e.c,g=a.vertices[g],h=a.vertices[h],j=a.vertices[j],b.push(g.clone()),
-b.push(h.clone()),b.push(j.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,j,i,k,q,l,n,r,m,p,t,s,v,o,x=[],y=[];c=0;for(d=a.faceVertexUvs.length;c<d;c++)y[c]=[];c=0;for(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,i=a.vertices[e],k=a.vertices[g],q=a.vertices[h],n=i.distanceTo(k),r=k.distanceTo(q),l=i.distanceTo(q),n>b||r>b||l>b){j=a.vertices.length;v=f.clone();o=f.clone();n>=r&&n>=l?(i=i.clone(),
-i.lerpSelf(k,0.5),v.a=e,v.b=j,v.c=h,o.a=j,o.b=g,o.c=h,3===f.vertexNormals.length&&(e=f.vertexNormals[0].clone(),e.lerpSelf(f.vertexNormals[1],0.5),v.vertexNormals[1].copy(e),o.vertexNormals[0].copy(e)),3===f.vertexColors.length&&(e=f.vertexColors[0].clone(),e.lerpSelf(f.vertexColors[1],0.5),v.vertexColors[1].copy(e),o.vertexColors[0].copy(e)),f=0):r>=n&&r>=l?(i=k.clone(),i.lerpSelf(q,0.5),v.a=e,v.b=g,v.c=j,o.a=j,o.b=h,o.c=e,3===f.vertexNormals.length&&(e=f.vertexNormals[1].clone(),e.lerpSelf(f.vertexNormals[2],
-0.5),v.vertexNormals[2].copy(e),o.vertexNormals[0].copy(e),o.vertexNormals[1].copy(f.vertexNormals[2]),o.vertexNormals[2].copy(f.vertexNormals[0])),3===f.vertexColors.length&&(e=f.vertexColors[1].clone(),e.lerpSelf(f.vertexColors[2],0.5),v.vertexColors[2].copy(e),o.vertexColors[0].copy(e),o.vertexColors[1].copy(f.vertexColors[2]),o.vertexColors[2].copy(f.vertexColors[0])),f=1):(i=i.clone(),i.lerpSelf(q,0.5),v.a=e,v.b=g,v.c=j,o.a=j,o.b=g,o.c=h,3===f.vertexNormals.length&&(e=f.vertexNormals[0].clone(),
-e.lerpSelf(f.vertexNormals[2],0.5),v.vertexNormals[2].copy(e),o.vertexNormals[0].copy(e)),3===f.vertexColors.length&&(e=f.vertexColors[0].clone(),e.lerpSelf(f.vertexColors[2],0.5),v.vertexColors[2].copy(e),o.vertexColors[0].copy(e)),f=2);x.push(v,o);a.vertices.push(i);e=0;for(g=a.faceVertexUvs.length;e<g;e++)a.faceVertexUvs[e].length&&(i=a.faceVertexUvs[e][c],o=i[0],h=i[1],v=i[2],0===f?(k=o.clone(),k.lerpSelf(h,0.5),i=[o.clone(),k.clone(),v.clone()],h=[k.clone(),h.clone(),v.clone()]):1===f?(k=h.clone(),
-k.lerpSelf(v,0.5),i=[o.clone(),h.clone(),k.clone()],h=[k.clone(),v.clone(),o.clone()]):(k=o.clone(),k.lerpSelf(v,0.5),i=[o.clone(),h.clone(),k.clone()],h=[k.clone(),h.clone(),v.clone()]),y[e].push(i,h))}else{x.push(f);e=0;for(g=a.faceVertexUvs.length;e<g;e++)y[e].push(a.faceVertexUvs[e][c])}else if(e=f.a,g=f.b,h=f.c,j=f.d,i=a.vertices[e],k=a.vertices[g],q=a.vertices[h],l=a.vertices[j],n=i.distanceTo(k),r=k.distanceTo(q),m=q.distanceTo(l),p=i.distanceTo(l),n>b||r>b||m>b||p>b){t=a.vertices.length;s=
-a.vertices.length+1;v=f.clone();o=f.clone();n>=r&&n>=m&&n>=p||m>=r&&m>=n&&m>=p?(n=i.clone(),n.lerpSelf(k,0.5),k=q.clone(),k.lerpSelf(l,0.5),v.a=e,v.b=t,v.c=s,v.d=j,o.a=t,o.b=g,o.c=h,o.d=s,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),v.vertexNormals[1].copy(e),v.vertexNormals[2].copy(g),o.vertexNormals[0].copy(e),o.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),v.vertexColors[1].copy(e),v.vertexColors[2].copy(g),o.vertexColors[0].copy(e),o.vertexColors[3].copy(g)),f=0):(n=k.clone(),n.lerpSelf(q,0.5),k=l.clone(),k.lerpSelf(i,0.5),v.a=e,v.b=g,v.c=t,v.d=s,o.a=s,o.b=t,o.c=h,o.d=j,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),v.vertexNormals[2].copy(e),v.vertexNormals[3].copy(g),
-o.vertexNormals[0].copy(g),o.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),v.vertexColors[2].copy(e),v.vertexColors[3].copy(g),o.vertexColors[0].copy(g),o.vertexColors[1].copy(e)),f=1);x.push(v,o);a.vertices.push(n,k);e=0;for(g=a.faceVertexUvs.length;e<g;e++)a.faceVertexUvs[e].length&&(i=a.faceVertexUvs[e][c],o=i[0],h=i[1],v=i[2],i=i[3],0===f?(k=o.clone(),k.lerpSelf(h,
-0.5),q=v.clone(),q.lerpSelf(i,0.5),o=[o.clone(),k.clone(),q.clone(),i.clone()],h=[k.clone(),h.clone(),v.clone(),q.clone()]):(k=h.clone(),k.lerpSelf(v,0.5),q=i.clone(),q.lerpSelf(o,0.5),o=[o.clone(),h.clone(),k.clone(),q.clone()],h=[q.clone(),k.clone(),v.clone(),i.clone()]),y[e].push(o,h))}else{x.push(f);e=0;for(g=a.faceVertexUvs.length;e<g;e++)y[e].push(a.faceVertexUvs[e][c])}a.faces=x;a.faceVertexUvs=y}};THREE.GeometryUtils.random=THREE.Math.random16;THREE.GeometryUtils.__v1=new THREE.Vector3;
+b.push(h.clone()),b.push(j.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,j,i,k,o,l,n,q,m,r,u,s,t,p,w=[],A=[];c=0;for(d=a.faceVertexUvs.length;c<d;c++)A[c]=[];c=0;for(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,i=a.vertices[e],k=a.vertices[g],o=a.vertices[h],n=i.distanceTo(k),q=k.distanceTo(o),l=i.distanceTo(o),n>b||q>b||l>b){j=a.vertices.length;t=f.clone();p=f.clone();n>=q&&n>=l?(i=i.clone(),
+i.lerpSelf(k,0.5),t.a=e,t.b=j,t.c=h,p.a=j,p.b=g,p.c=h,3===f.vertexNormals.length&&(e=f.vertexNormals[0].clone(),e.lerpSelf(f.vertexNormals[1],0.5),t.vertexNormals[1].copy(e),p.vertexNormals[0].copy(e)),3===f.vertexColors.length&&(e=f.vertexColors[0].clone(),e.lerpSelf(f.vertexColors[1],0.5),t.vertexColors[1].copy(e),p.vertexColors[0].copy(e)),f=0):q>=n&&q>=l?(i=k.clone(),i.lerpSelf(o,0.5),t.a=e,t.b=g,t.c=j,p.a=j,p.b=h,p.c=e,3===f.vertexNormals.length&&(e=f.vertexNormals[1].clone(),e.lerpSelf(f.vertexNormals[2],
+0.5),t.vertexNormals[2].copy(e),p.vertexNormals[0].copy(e),p.vertexNormals[1].copy(f.vertexNormals[2]),p.vertexNormals[2].copy(f.vertexNormals[0])),3===f.vertexColors.length&&(e=f.vertexColors[1].clone(),e.lerpSelf(f.vertexColors[2],0.5),t.vertexColors[2].copy(e),p.vertexColors[0].copy(e),p.vertexColors[1].copy(f.vertexColors[2]),p.vertexColors[2].copy(f.vertexColors[0])),f=1):(i=i.clone(),i.lerpSelf(o,0.5),t.a=e,t.b=g,t.c=j,p.a=j,p.b=g,p.c=h,3===f.vertexNormals.length&&(e=f.vertexNormals[0].clone(),
+e.lerpSelf(f.vertexNormals[2],0.5),t.vertexNormals[2].copy(e),p.vertexNormals[0].copy(e)),3===f.vertexColors.length&&(e=f.vertexColors[0].clone(),e.lerpSelf(f.vertexColors[2],0.5),t.vertexColors[2].copy(e),p.vertexColors[0].copy(e)),f=2);w.push(t,p);a.vertices.push(i);e=0;for(g=a.faceVertexUvs.length;e<g;e++)a.faceVertexUvs[e].length&&(i=a.faceVertexUvs[e][c],p=i[0],h=i[1],t=i[2],0===f?(k=p.clone(),k.lerpSelf(h,0.5),i=[p.clone(),k.clone(),t.clone()],h=[k.clone(),h.clone(),t.clone()]):1===f?(k=h.clone(),
+k.lerpSelf(t,0.5),i=[p.clone(),h.clone(),k.clone()],h=[k.clone(),t.clone(),p.clone()]):(k=p.clone(),k.lerpSelf(t,0.5),i=[p.clone(),h.clone(),k.clone()],h=[k.clone(),h.clone(),t.clone()]),A[e].push(i,h))}else{w.push(f);e=0;for(g=a.faceVertexUvs.length;e<g;e++)A[e].push(a.faceVertexUvs[e][c])}else if(e=f.a,g=f.b,h=f.c,j=f.d,i=a.vertices[e],k=a.vertices[g],o=a.vertices[h],l=a.vertices[j],n=i.distanceTo(k),q=k.distanceTo(o),m=o.distanceTo(l),r=i.distanceTo(l),n>b||q>b||m>b||r>b){u=a.vertices.length;s=
+a.vertices.length+1;t=f.clone();p=f.clone();n>=q&&n>=m&&n>=r||m>=q&&m>=n&&m>=r?(n=i.clone(),n.lerpSelf(k,0.5),k=o.clone(),k.lerpSelf(l,0.5),t.a=e,t.b=u,t.c=s,t.d=j,p.a=u,p.b=g,p.c=h,p.d=s,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),t.vertexNormals[1].copy(e),t.vertexNormals[2].copy(g),p.vertexNormals[0].copy(e),p.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),t.vertexColors[1].copy(e),t.vertexColors[2].copy(g),p.vertexColors[0].copy(e),p.vertexColors[3].copy(g)),f=0):(n=k.clone(),n.lerpSelf(o,0.5),k=l.clone(),k.lerpSelf(i,0.5),t.a=e,t.b=g,t.c=u,t.d=s,p.a=s,p.b=u,p.c=h,p.d=j,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),t.vertexNormals[2].copy(e),t.vertexNormals[3].copy(g),
+p.vertexNormals[0].copy(g),p.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),t.vertexColors[2].copy(e),t.vertexColors[3].copy(g),p.vertexColors[0].copy(g),p.vertexColors[1].copy(e)),f=1);w.push(t,p);a.vertices.push(n,k);e=0;for(g=a.faceVertexUvs.length;e<g;e++)a.faceVertexUvs[e].length&&(i=a.faceVertexUvs[e][c],p=i[0],h=i[1],t=i[2],i=i[3],0===f?(k=p.clone(),k.lerpSelf(h,
+0.5),o=t.clone(),o.lerpSelf(i,0.5),p=[p.clone(),k.clone(),o.clone(),i.clone()],h=[k.clone(),h.clone(),t.clone(),o.clone()]):(k=h.clone(),k.lerpSelf(t,0.5),o=i.clone(),o.lerpSelf(p,0.5),p=[p.clone(),h.clone(),k.clone(),o.clone()],h=[o.clone(),k.clone(),t.clone(),i.clone()]),A[e].push(p,h))}else{w.push(f);e=0;for(g=a.faceVertexUvs.length;e<g;e++)A[e].push(a.faceVertexUvs[e][c])}a.faces=w;a.faceVertexUvs=A}};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),b=f.loadCount=0;for(d=a.length;b<d;++b)f[b]=new Image,f[b].onload=function(){f.loadCount+=1;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,j=g.createImageData(d,f),i=j.data,k=0;k<d;k++)for(var q=1;q<f;q++){var l=0>q-1?f-1:q-1,n=(q+1)%f,r=0>k-1?d-1:k-1,m=(k+1)%d,p=[],t=[0,0,h[4*(q*d+k)]/255*b];p.push([-1,0,h[4*(q*d+r)]/255*b]);p.push([-1,-1,h[4*(l*d+r)]/255*b]);p.push([0,-1,h[4*(l*d+
-k)]/255*b]);p.push([1,-1,h[4*(l*d+m)]/255*b]);p.push([1,0,h[4*(q*d+m)]/255*b]);p.push([1,1,h[4*(n*d+m)]/255*b]);p.push([0,1,h[4*(n*d+k)]/255*b]);p.push([-1,1,h[4*(n*d+r)]/255*b]);l=[];r=p.length;for(n=0;n<r;n++){var m=p[n],s=p[(n+1)%r],m=[m[0]-t[0],m[1]-t[1],m[2]-t[2]],s=[s[0]-t[0],s[1]-t[1],s[2]-t[2]];l.push(c([m[1]*s[2]-m[2]*s[1],m[2]*s[0]-m[0]*s[2],m[0]*s[1]-m[1]*s[0]]))}p=[0,0,0];for(n=0;n<l.length;n++)p[0]+=l[n][0],p[1]+=l[n][1],p[2]+=l[n][2];p[0]/=l.length;p[1]/=l.length;p[2]/=l.length;t=4*
-(q*d+k);i[t]=255*((p[0]+1)/2)|0;i[t+1]=255*(p[1]+0.5)|0;i[t+2]=255*p[2]|0;i[t+3]=255}g.putImageData(j,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}};
+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,j=g.createImageData(d,f),i=j.data,k=0;k<d;k++)for(var o=1;o<f;o++){var l=0>o-1?f-1:o-1,n=(o+1)%f,q=0>k-1?d-1:k-1,m=(k+1)%d,r=[],u=[0,0,h[4*(o*d+k)]/255*b];r.push([-1,0,h[4*(o*d+q)]/255*b]);r.push([-1,-1,h[4*(l*d+q)]/255*b]);r.push([0,-1,h[4*(l*d+
+k)]/255*b]);r.push([1,-1,h[4*(l*d+m)]/255*b]);r.push([1,0,h[4*(o*d+m)]/255*b]);r.push([1,1,h[4*(n*d+m)]/255*b]);r.push([0,1,h[4*(n*d+k)]/255*b]);r.push([-1,1,h[4*(n*d+q)]/255*b]);l=[];q=r.length;for(n=0;n<q;n++){var m=r[n],s=r[(n+1)%q],m=[m[0]-u[0],m[1]-u[1],m[2]-u[2]],s=[s[0]-u[0],s[1]-u[1],s[2]-u[2]];l.push(c([m[1]*s[2]-m[2]*s[1],m[2]*s[0]-m[0]*s[2],m[0]*s[1]-m[1]*s[0]]))}r=[0,0,0];for(n=0;n<l.length;n++)r[0]+=l[n][0],r[1]+=l[n][1],r[2]+=l[n][2];r[0]/=l.length;r[1]/=l.length;r[2]/=l.length;u=4*
+(o*d+k);i[u]=255*((r[0]+1)/2)|0;i[u+1]=255*(r[1]+0.5)|0;i[u+2]=255*r[2]|0;i[u+3]=255}g.putImageData(j,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),
 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,
@@ -61,7 +61,7 @@ d[c[1]].z,d[c[2]].z,d[c[3]].z,f);return b});THREE.CurvePath=function(){this.curv
 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){b=c[a]-b;a=this.curves[a];b=1-b/a.getLength();return 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=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,j;j=new THREE.Vector2;g=0;for(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;j.addSelf(e.x,e.y)}return{minX:d,minY:f,maxX:b,maxY:c,centroid:j.divideScalar(h)}};THREE.CurvePath.prototype.createPointsGeometry=function(a){return this.createGeometry(this.getPoints(a,true))};
-THREE.CurvePath.prototype.createSpacedPointsGeometry=function(a){return this.createGeometry(this.getSpacedPoints(a,true))};THREE.CurvePath.prototype.createGeometry=function(a){for(var b=new THREE.Geometry,c=0;c<a.length;c++)b.vertices.push(new THREE.Vertex(a[c].x,a[c].y,0));return b};THREE.CurvePath.prototype.addWrapPath=function(a){this.bends.push(a)};
+THREE.CurvePath.prototype.createSpacedPointsGeometry=function(a){return this.createGeometry(this.getSpacedPoints(a,true))};THREE.CurvePath.prototype.createGeometry=function(a){for(var b=new THREE.Geometry,c=0;c<a.length;c++)b.vertices.push(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;d=0;for(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;d=0;for(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,j;d=0;for(f=a.length;d<f;d++){e=a[d];g=e.x;h=e.y;j=g/c.maxX;j=b.getUtoTmapping(j,g);g=b.getPoint(j);h=b.getNormalVector(j).multiplyScalar(h);e.x=g.x+h.x;e.y=g.y+h.y}return a};
 THREE.EventTarget=function(){var a={};this.addEventListener=function(b,c){a[b]==void 0&&(a[b]=[]);a[b].indexOf(c)===-1&&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);d!==-1&&a[b].splice(d,1)}};THREE.Gyroscope=function(){THREE.Object3D.call(this)};THREE.Gyroscope.prototype=new THREE.Object3D;THREE.Gyroscope.prototype.constructor=THREE.Gyroscope;
@@ -74,19 +74,19 @@ THREE.Path.prototype.bezierCurveTo=function(a,b,c,d,f,e){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,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){console.log("tata");return this.getSpacedPoints(a,b)}var a=a||12,c=[],d,f,e,g,h,j,i,k,q,l,n,r,m;d=0;for(f=this.actions.length;d<f;d++){e=this.actions[d];g=e.action;e=e.args;switch(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];j=e[3];q=e[0];l=e[1];if(c.length>0){g=c[c.length-1];
-n=g.x;r=g.y}else{g=this.actions[d-1].args;n=g[g.length-2];r=g[g.length-1]}for(e=1;e<=a;e++){m=e/a;g=THREE.Shape.Utils.b2(m,n,q,h);m=THREE.Shape.Utils.b2(m,r,l,j);c.push(new THREE.Vector2(g,m))}break;case THREE.PathActions.BEZIER_CURVE_TO:h=e[4];j=e[5];q=e[0];l=e[1];i=e[2];k=e[3];if(c.length>0){g=c[c.length-1];n=g.x;r=g.y}else{g=this.actions[d-1].args;n=g[g.length-2];r=g[g.length-1]}for(e=1;e<=a;e++){m=e/a;g=THREE.Shape.Utils.b3(m,n,q,i,h);m=THREE.Shape.Utils.b3(m,r,l,k,j);c.push(new THREE.Vector2(g,
-m))}break;case THREE.PathActions.CSPLINE_THRU:g=this.actions[d-1].args;m=[new THREE.Vector2(g[g.length-2],g[g.length-1])];g=a*e[0].length;m=m.concat(e[0]);m=new THREE.SplineCurve(m);for(e=1;e<=g;e++)c.push(m.getPointAt(e/g));break;case THREE.PathActions.ARC:h=e[0];j=e[1];i=e[2];q=e[3];l=!!e[5];k=e[4]-q;n=a*2;for(e=1;e<=n;e++){m=e/n;l||(m=1-m);m=q+m*k;g=h+i*Math.cos(m);m=j+i*Math.sin(m);c.push(new THREE.Vector2(g,m))}}}d=c[c.length-1];Math.abs(d.x-c[0].x)<1.0E-10&&Math.abs(d.y-c[0].y)<1.0E-10&&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,j,i,k,q;h=0;for(j=g.length;h<j;h++){i=g[h];k=i.x;q=i.y;i.x=a*k+b*q+c;i.y=d*q+f*k+e}return g};
+THREE.Path.prototype.getPoints=function(a,b){if(this.useSpacedPoints){console.log("tata");return this.getSpacedPoints(a,b)}var a=a||12,c=[],d,f,e,g,h,j,i,k,o,l,n,q,m;d=0;for(f=this.actions.length;d<f;d++){e=this.actions[d];g=e.action;e=e.args;switch(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];j=e[3];o=e[0];l=e[1];if(c.length>0){g=c[c.length-1];
+n=g.x;q=g.y}else{g=this.actions[d-1].args;n=g[g.length-2];q=g[g.length-1]}for(e=1;e<=a;e++){m=e/a;g=THREE.Shape.Utils.b2(m,n,o,h);m=THREE.Shape.Utils.b2(m,q,l,j);c.push(new THREE.Vector2(g,m))}break;case THREE.PathActions.BEZIER_CURVE_TO:h=e[4];j=e[5];o=e[0];l=e[1];i=e[2];k=e[3];if(c.length>0){g=c[c.length-1];n=g.x;q=g.y}else{g=this.actions[d-1].args;n=g[g.length-2];q=g[g.length-1]}for(e=1;e<=a;e++){m=e/a;g=THREE.Shape.Utils.b3(m,n,o,i,h);m=THREE.Shape.Utils.b3(m,q,l,k,j);c.push(new THREE.Vector2(g,
+m))}break;case THREE.PathActions.CSPLINE_THRU:g=this.actions[d-1].args;m=[new THREE.Vector2(g[g.length-2],g[g.length-1])];g=a*e[0].length;m=m.concat(e[0]);m=new THREE.SplineCurve(m);for(e=1;e<=g;e++)c.push(m.getPointAt(e/g));break;case THREE.PathActions.ARC:h=e[0];j=e[1];i=e[2];o=e[3];l=!!e[5];k=e[4]-o;n=a*2;for(e=1;e<=n;e++){m=e/n;l||(m=1-m);m=o+m*k;g=h+i*Math.cos(m);m=j+i*Math.sin(m);c.push(new THREE.Vector2(g,m))}}}d=c[c.length-1];Math.abs(d.x-c[0].x)<1.0E-10&&Math.abs(d.y-c[0].y)<1.0E-10&&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,j,i,k,o;h=0;for(j=g.length;h<j;h++){i=g[h];k=i.x;o=i.y;i.x=a*k+b*o+c;i.y=d*o+f*k+e}return g};
 THREE.Path.prototype.debug=function(a){var b=this.getBoundingBox();if(!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,a=0;for(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();a=0;for(c=d.length;a<c;a++){f=d[a];b.beginPath();b.arc(f.x,f.y,1.5,0,Math.PI*2,false);b.stroke();b.closePath()}};
 THREE.Path.prototype.toShapes=function(){var a,b,c,d,f=[],e=new THREE.Path;a=0;for(b=this.actions.length;a<b;a++){c=this.actions[a];d=c.args;c=c.action;if(c==THREE.PathActions.MOVE_TO&&e.actions.length!=0){f.push(e);e=new THREE.Path}e[c].apply(e,d)}e.actions.length!=0&&f.push(e);if(f.length==0)return[];var g;d=[];a=!THREE.Shape.Utils.isClockWise(f[0].getPoints());if(f.length==1){e=f[0];g=new THREE.Shape;g.actions=e.actions;g.curves=e.curves;d.push(g);return d}if(a){g=new THREE.Shape;a=0;for(b=f.length;a<
 b;a++){e=f[a];if(THREE.Shape.Utils.isClockWise(e.getPoints())){g.actions=e.actions;g.curves=e.curves;d.push(g);g=new THREE.Shape}else g.holes.push(e)}}else{a=0;for(b=f.length;a<b;a++){e=f[a];if(THREE.Shape.Utils.isClockWise(e.getPoints())){g&&d.push(g);g=new THREE.Shape;g.actions=e.actions;g.curves=e.curves}else 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.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,j,i,k,q,l,n,r=[];for(j=0;j<b.length;j++){i=b[j];Array.prototype.push.apply(d,i);e=Number.POSITIVE_INFINITY;for(f=0;f<i.length;f++){l=i[f];n=[];for(q=0;q<c.length;q++){k=c[q];k=l.distanceToSquared(k);n.push(k);if(k<e){e=k;g=f;h=q}}}f=h-1>=0?h-1:c.length-1;e=g-1>=0?g-1:i.length-1;var m=[i[g],c[h],c[f]];q=THREE.FontUtils.Triangulate.area(m);var p=[i[g],i[e],c[h]];l=THREE.FontUtils.Triangulate.area(p);n=h;k=g;h=h+1;g=g+
--1;h<0&&(h=h+c.length);h=h%c.length;g<0&&(g=g+i.length);g=g%i.length;f=h-1>=0?h-1:c.length-1;e=g-1>=0?g-1:i.length-1;m=[i[g],c[h],c[f]];m=THREE.FontUtils.Triangulate.area(m);p=[i[g],i[e],c[h]];p=THREE.FontUtils.Triangulate.area(p);if(q+l>m+p){h=n;g=k;h<0&&(h=h+c.length);h=h%c.length;g<0&&(g=g+i.length);g=g%i.length;f=h-1>=0?h-1:c.length-1;e=g-1>=0?g-1:i.length-1}q=c.slice(0,h);l=c.slice(h);n=i.slice(g);k=i.slice(0,g);e=[i[g],i[e],c[h]];r.push([i[g],c[h],c[f]]);r.push(e);c=q.concat(n).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,false),e,g,h,j,i={};e=0;for(g=d.length;e<g;e++){j=d[e].x+":"+d[e].y;i[j]!==void 0&&console.log("Duplicate point",j);i[j]=e}e=0;for(g=c.length;e<g;e++){h=c[e];for(d=0;d<3;d++){j=h[d].x+":"+h[d].y;j=i[j];j!==void 0&&(h[d]=j)}}e=0;for(g=f.length;e<g;e++){h=f[e];for(d=0;d<3;d++){j=h[d].x+":"+h[d].y;j=i[j];j!==void 0&&(h[d]=j)}}return c.concat(f)},
+THREE.Shape.Utils={removeHoles:function(a,b){var c=a.concat(),d=c.concat(),f,e,g,h,j,i,k,o,l,n,q=[];for(j=0;j<b.length;j++){i=b[j];Array.prototype.push.apply(d,i);e=Number.POSITIVE_INFINITY;for(f=0;f<i.length;f++){l=i[f];n=[];for(o=0;o<c.length;o++){k=c[o];k=l.distanceToSquared(k);n.push(k);if(k<e){e=k;g=f;h=o}}}f=h-1>=0?h-1:c.length-1;e=g-1>=0?g-1:i.length-1;var m=[i[g],c[h],c[f]];o=THREE.FontUtils.Triangulate.area(m);var r=[i[g],i[e],c[h]];l=THREE.FontUtils.Triangulate.area(r);n=h;k=g;h=h+1;g=g+
+-1;h<0&&(h=h+c.length);h=h%c.length;g<0&&(g=g+i.length);g=g%i.length;f=h-1>=0?h-1:c.length-1;e=g-1>=0?g-1:i.length-1;m=[i[g],c[h],c[f]];m=THREE.FontUtils.Triangulate.area(m);r=[i[g],i[e],c[h]];r=THREE.FontUtils.Triangulate.area(r);if(o+l>m+r){h=n;g=k;h<0&&(h=h+c.length);h=h%c.length;g<0&&(g=g+i.length);g=g%i.length;f=h-1>=0?h-1:c.length-1;e=g-1>=0?g-1:i.length-1}o=c.slice(0,h);l=c.slice(h);n=i.slice(g);k=i.slice(0,g);e=[i[g],i[e],c[h]];q.push([i[g],c[h],c[f]]);q.push(e);c=o.concat(n).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,f=c.isolatedPts,c=THREE.FontUtils.Triangulate(c.shape,false),e,g,h,j,i={};e=0;for(g=d.length;e<g;e++){j=d[e].x+":"+d[e].y;i[j]!==void 0&&console.log("Duplicate point",j);i[j]=e}e=0;for(g=c.length;e<g;e++){h=c[e];for(d=0;d<3;d++){j=h[d].x+":"+h[d].y;j=i[j];j!==void 0&&(h[d]=j)}}e=0;for(g=f.length;e<g;e++){h=f[e];for(d=0;d<3;d++){j=h[d].x+":"+h[d].y;j=i[j];j!==void 0&&(h[d]=j)}}return c.concat(f)},
 isClockWise:function(a){return THREE.FontUtils.Triangulate.area(a)<0},b2p0:function(a,b){var c=1-a;return c*c*b},b2p1:function(a,b){return 2*(1-a)*a*b},b2p2:function(a,b){return a*a*b},b2:function(a,b,c,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=b.curveSegments!==void 0?b.curveSegments:4,d=b.font!==void 0?b.font:"helvetiker",f=b.weight!==void 0?b.weight:"normal",e=b.style!==void 0?b.style:"normal";THREE.FontUtils.size=b.size!==void 0?b.size:100;THREE.FontUtils.divisions=c;THREE.FontUtils.face=d;THREE.FontUtils.weight=f;THREE.FontUtils.style=e};
 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};
@@ -99,9 +99,9 @@ THREE.Animation.prototype.play=function(a,b){if(!this.isPlaying){this.isPlaying=
 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=false;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=false;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.hierarchy.length;a++)if(this.hierarchy[a].animationCache!==void 0){this.hierarchy[a]instanceof THREE.Bone?this.hierarchy[a].skinMatrix=this.hierarchy[a].animationCache.originalMatrix:this.hierarchy[a].matrix=this.hierarchy[a].animationCache.originalMatrix;delete this.hierarchy[a].animationCache}};
-THREE.Animation.prototype.update=function(a){if(this.isPlaying){var b=["pos","rot","scl"],c,d,f,e,g,h,j,i,k=this.data.JIT.hierarchy,q,l;l=this.currentTime=this.currentTime+a*this.timeScale;q=this.currentTime=this.currentTime%this.data.length;i=parseInt(Math.min(q*this.data.fps,this.data.length*this.data.fps),10);for(var n=0,r=this.hierarchy.length;n<r;n++){a=this.hierarchy[n];j=a.animationCache;if(this.JITCompile&&k[n][i]!==void 0)if(a instanceof THREE.Bone){a.skinMatrix=k[n][i];a.matrixAutoUpdate=
-false;a.matrixWorldNeedsUpdate=false}else{a.matrix=k[n][i];a.matrixAutoUpdate=false;a.matrixWorldNeedsUpdate=true}else{if(this.JITCompile)a instanceof THREE.Bone?a.skinMatrix=a.animationCache.originalMatrix:a.matrix=a.animationCache.originalMatrix;for(var m=0;m<3;m++){c=b[m];g=j.prevKey[c];h=j.nextKey[c];if(h.time<=l){if(q<l)if(this.loop){g=this.data.hierarchy[n].keys[0];for(h=this.getNextKeyWith(c,n,1);h.time<q;){g=h;h=this.getNextKeyWith(c,n,h.index+1)}}else{this.stop();return}else{do{g=h;h=this.getNextKeyWith(c,
-n,h.index+1)}while(h.time<q)}j.prevKey[c]=g;j.nextKey[c]=h}a.matrixAutoUpdate=true;a.matrixWorldNeedsUpdate=true;d=(q-g.time)/(h.time-g.time);f=g[c];e=h[c];if(d<0||d>1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+d+" on bone "+n);d=d<0?0:1}if(c==="pos"){c=a.position;if(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.Animation.prototype.update=function(a){if(this.isPlaying){var b=["pos","rot","scl"],c,d,f,e,g,h,j,i,k=this.data.JIT.hierarchy,o,l;l=this.currentTime=this.currentTime+a*this.timeScale;o=this.currentTime=this.currentTime%this.data.length;i=parseInt(Math.min(o*this.data.fps,this.data.length*this.data.fps),10);for(var n=0,q=this.hierarchy.length;n<q;n++){a=this.hierarchy[n];j=a.animationCache;if(this.JITCompile&&k[n][i]!==void 0)if(a instanceof THREE.Bone){a.skinMatrix=k[n][i];a.matrixAutoUpdate=
+false;a.matrixWorldNeedsUpdate=false}else{a.matrix=k[n][i];a.matrixAutoUpdate=false;a.matrixWorldNeedsUpdate=true}else{if(this.JITCompile)a instanceof THREE.Bone?a.skinMatrix=a.animationCache.originalMatrix:a.matrix=a.animationCache.originalMatrix;for(var m=0;m<3;m++){c=b[m];g=j.prevKey[c];h=j.nextKey[c];if(h.time<=l){if(o<l)if(this.loop){g=this.data.hierarchy[n].keys[0];for(h=this.getNextKeyWith(c,n,1);h.time<o;){g=h;h=this.getNextKeyWith(c,n,h.index+1)}}else{this.stop();return}else{do{g=h;h=this.getNextKeyWith(c,
+n,h.index+1)}while(h.time<o)}j.prevKey[c]=g;j.nextKey[c]=h}a.matrixAutoUpdate=true;a.matrixWorldNeedsUpdate=true;d=(o-g.time)/(h.time-g.time);f=g[c];e=h[c];if(d<0||d>1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+d+" on bone "+n);d=d<0?0:1}if(c==="pos"){c=a.position;if(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){this.points[0]=this.getPrevKeyWith("pos",n,g.index-1).pos;this.points[1]=f;this.points[2]=e;this.points[3]=this.getNextKeyWith("pos",n,h.index+1).pos;d=d*0.33+0.33;f=this.interpolateCatmullRom(this.points,d);c.x=f[0];c.y=f[1];c.z=f[2];if(this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){d=this.interpolateCatmullRom(this.points,d*1.01);this.target.set(d[0],d[1],d[2]);this.target.subSelf(c);this.target.y=0;this.target.normalize();d=Math.atan2(this.target.x,
 this.target.z);a.rotation.set(0,d,0)}}}else if(c==="rot")THREE.Quaternion.slerp(f,e,a.quaternion,d);else if(c==="scl"){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&&k[0][i]===void 0){this.hierarchy[0].updateMatrixWorld(true);for(n=0;n<this.hierarchy.length;n++)k[n][i]=this.hierarchy[n]instanceof THREE.Bone?this.hierarchy[n].skinMatrix.clone():this.hierarchy[n].matrix.clone()}}};
 THREE.Animation.prototype.interpolateCatmullRom=function(a,b){var c=[],d=[],f,e,g,h,j,i;f=(a.length-1)*b;e=Math.floor(f);f=f-e;c[0]=e===0?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]];j=a[c[2]];i=a[c[3]];c=f*f;g=f*c;d[0]=this.interpolate(e[0],h[0],j[0],i[0],f,c,g);d[1]=this.interpolate(e[1],h[1],j[1],i[1],f,c,g);d[2]=this.interpolate(e[2],h[2],j[2],i[2],f,c,g);return d};
@@ -113,8 +113,8 @@ THREE.KeyFrameAnimation.prototype.play=function(a,b){if(!this.isPlaying){this.is
 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=false;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=false;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(c.animationCache!==void 0){var d=c.animationCache.originalMatrix;if(b instanceof THREE.Bone){d.copy(b.skinMatrix);b.skinMatrix=d}else{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,j;h=this.currentTime=this.currentTime+a*this.timeScale;g=this.currentTime=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((j=g<h)&&!this.loop){for(var a=0,i=this.hierarchy.length;a<i;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=true}}this.stop()}else if(!(g<this.startTime)){a=0;for(i=this.hierarchy.length;a<i;a++){d=this.hierarchy[a];b=this.data.hierarchy[a];var k=b.keys,q=b.animationCache;if(this.JITCompile&&e[a][f]!==void 0)if(d instanceof THREE.Bone){d.skinMatrix=e[a][f];d.matrixWorldNeedsUpdate=false}else{d.matrix=e[a][f];d.matrixWorldNeedsUpdate=
-true}else if(k.length){if(this.JITCompile&&q)d instanceof THREE.Bone?d.skinMatrix=q.originalMatrix:d.matrix=q.originalMatrix;b=q.prevKey;c=q.nextKey;if(b&&c){if(c.time<=h){if(j&&this.loop){b=k[0];for(c=k[1];c.time<g;){b=c;c=k[b.index+1]}}else if(!j)for(var l=k.length-1;c.time<g&&c.index!==l;){b=c;c=k[b.index+1]}q.prevKey=b;q.nextKey=c}c.time>=g?b.interpolate(c,g):b.interpolate(c,c.time)}this.data.hierarchy[a].node.updateMatrix();d.matrixWorldNeedsUpdate=true}}if(this.JITCompile&&e[0][f]===void 0){this.hierarchy[0].updateMatrixWorld(true);
+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=true}}this.stop()}else if(!(g<this.startTime)){a=0;for(i=this.hierarchy.length;a<i;a++){d=this.hierarchy[a];b=this.data.hierarchy[a];var k=b.keys,o=b.animationCache;if(this.JITCompile&&e[a][f]!==void 0)if(d instanceof THREE.Bone){d.skinMatrix=e[a][f];d.matrixWorldNeedsUpdate=false}else{d.matrix=e[a][f];d.matrixWorldNeedsUpdate=
+true}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(j&&this.loop){b=k[0];for(c=k[1];c.time<g;){b=c;c=k[b.index+1]}}else if(!j)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=true}}if(this.JITCompile&&e[0][f]===void 0){this.hierarchy[0].updateMatrixWorld(true);
 for(a=0;a<this.hierarchy.length;a++)e[a][f]=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=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=c>=0?c:c+b.length;c>=0;c--)if(b[c].hasTarget(a))return b[c];return b[b.length-1]};
 THREE.CubeCamera=function(a,b,c){THREE.Object3D.call(this);var d=new THREE.PerspectiveCamera(90,1,a,b);d.up.set(0,-1,0);d.lookAt(new THREE.Vector3(1,0,0));this.add(d);var f=new THREE.PerspectiveCamera(90,1,a,b);f.up.set(0,-1,0);f.lookAt(new THREE.Vector3(-1,0,0));this.add(f);var e=new THREE.PerspectiveCamera(90,1,a,b);e.up.set(0,0,1);e.lookAt(new THREE.Vector3(0,1,0));this.add(e);var g=new THREE.PerspectiveCamera(90,1,a,b);g.up.set(0,0,-1);g.lookAt(new THREE.Vector3(0,-1,0));this.add(g);var h=new THREE.PerspectiveCamera(90,
@@ -136,8 +136,8 @@ this.moveRight&&this.object.translateX(b);this.moveUp&&this.object.translateY(b)
 Math.sin(this.theta);b=1;this.constrainVertical&&(b=Math.PI/(this.verticalMax-this.verticalMin));this.lon=this.lon+this.mouseX*a;if(this.lookVertical)this.lat=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()},false);this.domElement.addEventListener("mousemove",c(this,this.onMouseMove),false);this.domElement.addEventListener("mousedown",c(this,this.onMouseDown),false);this.domElement.addEventListener("mouseup",c(this,this.onMouseUp),false);this.domElement.addEventListener("keydown",c(this,this.onKeyDown),false);this.domElement.addEventListener("keyup",
 c(this,this.onKeyUp),false)};
-THREE.PathControls=function(a,b){function c(a){return(a=a*2)<1?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(),p=g.length,t=0;f=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[f]={time:d,pos:g[f],rot:[0,0,0,1],scl:[1,1,1]};for(f=1;f<p-1;f++){t=d*h.chunks[f]/h.total;b.keys[f]={time:t,pos:g[f]}}e.hierarchy[0]=b;THREE.AnimationHandler.add(e);
-return new THREE.Animation(a,c,THREE.AnimationHandler.CATMULLROM_FORWARD,false)}function e(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(d.x,d.y,d.z)}return e}this.object=a;this.domElement=b!==void 0?b:document;this.id="PathControls"+THREE.PathControlsIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=true;this.resamplingCoef=50;this.debugPath=new THREE.Object3D;this.debugDummy=new THREE.Object3D;
+THREE.PathControls=function(a,b){function c(a){return(a=a*2)<1?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(),r=g.length,u=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++){u=d*h.chunks[f]/h.total;b.keys[f]={time:u,pos:g[f]}}e.hierarchy[0]=b;THREE.AnimationHandler.add(e);
+return new THREE.Animation(a,c,THREE.AnimationHandler.CATMULLROM_FORWARD,false)}function e(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.Vector3(d.x,d.y,d.z)}return e}this.object=a;this.domElement=b!==void 0?b:document;this.id="PathControls"+THREE.PathControlsIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=true;this.resamplingCoef=50;this.debugPath=new THREE.Object3D;this.debugDummy=new THREE.Object3D;
 this.animationParent=new THREE.Object3D;this.lookSpeed=0.0050;this.lookHorizontal=this.lookVertical=true;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;if(this.domElement===document){this.viewHalfX=window.innerWidth/2;this.viewHalfY=window.innerHeight/2}else{this.viewHalfX=this.domElement.offsetWidth/2;this.viewHalfY=
 this.domElement.offsetHeight/2;this.domElement.setAttribute("tabindex",-1)}var g=Math.PI*2,h=Math.PI/180;this.update=function(a){var b;if(this.lookHorizontal)this.lon=this.lon+this.mouseX*this.lookSpeed*a;if(this.lookVertical)this.lat=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=a>=0?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){if(this.domElement===
@@ -154,97 +154,97 @@ false;break;case 2:this.moveBackward=false}this.updateRotationVector()};this.upd
 this.object.matrixWorldNeedsUpdate=true};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),false);this.domElement.addEventListener("mousedown",c(this,this.mousedown),false);this.domElement.addEventListener("mouseup",
 c(this,this.mouseup),false);this.domElement.addEventListener("keydown",c(this,this.keydown),false);this.domElement.addEventListener("keyup",c(this,this.keyup),false);this.updateMovementVector();this.updateRotationVector()};
-THREE.RollControls=function(a,b){this.object=a;this.domElement=b!==void 0?b:document;this.mouseLook=true;this.autoForward=false;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.object.matrixAutoUpdate=false;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=false,h=1,j=0,i=0,k=0,q=0,l=0,n=window.innerWidth/2,r=window.innerHeight/2;this.update=function(a){if(this.mouseLook){var b=
-a*this.lookSpeed;this.rotateHorizontally(b*q);this.rotateVertically(b*l)}b=a*this.movementSpeed;this.object.translateZ(-b*(j>0||this.autoForward&&!(j<0)?1:j));this.object.translateX(b*i);this.object.translateY(b*k);if(g)this.roll=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);
+THREE.RollControls=function(a,b){this.object=a;this.domElement=b!==void 0?b:document;this.mouseLook=true;this.autoForward=false;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.object.matrixAutoUpdate=false;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=false,h=1,j=0,i=0,k=0,o=0,l=0,n=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*(j>0||this.autoForward&&!(j<0)?1:j));this.object.translateX(b*i);this.object.translateY(b*k);if(g)this.roll=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.elements[0]=c.x;this.object.matrix.elements[4]=d.x;this.object.matrix.elements[8]=f.x;this.object.matrix.elements[1]=c.y;this.object.matrix.elements[5]=d.y;this.object.matrix.elements[9]=f.y;this.object.matrix.elements[2]=c.z;this.object.matrix.elements[6]=d.z;this.object.matrix.elements[10]=f.z;e.identity();e.elements[0]=Math.cos(this.roll);e.elements[4]=-Math.sin(this.roll);e.elements[1]=Math.sin(this.roll);e.elements[5]=
 Math.cos(this.roll);this.object.matrix.multiplySelf(e);this.object.matrixWorldNeedsUpdate=true;this.object.matrix.elements[12]=this.object.position.x;this.object.matrix.elements[13]=this.object.position.y;this.object.matrix.elements[14]=this.object.position.z};this.translateX=function(a){this.object.position.x=this.object.position.x+this.object.matrix.elements[0]*a;this.object.position.y=this.object.position.y+this.object.matrix.elements[1]*a;this.object.position.z=this.object.position.z+this.object.matrix.elements[2]*
 a};this.translateY=function(a){this.object.position.x=this.object.position.x+this.object.matrix.elements[4]*a;this.object.position.y=this.object.position.y+this.object.matrix.elements[5]*a;this.object.position.z=this.object.position.z+this.object.matrix.elements[6]*a};this.translateZ=function(a){this.object.position.x=this.object.position.x-this.object.matrix.elements[8]*a;this.object.position.y=this.object.position.y-this.object.matrix.elements[9]*a;this.object.position.z=this.object.position.z-
 this.object.matrix.elements[10]*a};this.rotateHorizontally=function(a){c.set(this.object.matrix.elements[0],this.object.matrix.elements[1],this.object.matrix.elements[2]);c.multiplyScalar(a);this.forward.subSelf(c);this.forward.normalize()};this.rotateVertically=function(a){d.set(this.object.matrix.elements[4],this.object.matrix.elements[5],this.object.matrix.elements[6]);d.multiplyScalar(a);this.forward.addSelf(d);this.forward.normalize()};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},
-false);this.domElement.addEventListener("mousemove",function(a){q=(a.clientX-n)/window.innerWidth;l=(a.clientY-r)/window.innerHeight},false);this.domElement.addEventListener("mousedown",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:j=1;break;case 2:j=-1}},false);this.domElement.addEventListener("mouseup",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:j=0;break;case 2:j=0}},false);this.domElement.addEventListener("keydown",function(a){switch(a.keyCode){case 38:case 87:j=
+false);this.domElement.addEventListener("mousemove",function(a){o=(a.clientX-n)/window.innerWidth;l=(a.clientY-q)/window.innerHeight},false);this.domElement.addEventListener("mousedown",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:j=1;break;case 2:j=-1}},false);this.domElement.addEventListener("mouseup",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:j=0;break;case 2:j=0}},false);this.domElement.addEventListener("keydown",function(a){switch(a.keyCode){case 38:case 87:j=
 1;break;case 37:case 65:i=-1;break;case 40:case 83:j=-1;break;case 39:case 68:i=1;break;case 81:g=true;h=1;break;case 69:g=true;h=-1;break;case 82:k=1;break;case 70:k=-1}},false);this.domElement.addEventListener("keyup",function(a){switch(a.keyCode){case 38:case 87:j=0;break;case 37:case 65:i=0;break;case 40:case 83:j=0;break;case 39:case 68:i=0;break;case 81:g=false;break;case 69:g=false;break;case 82:k=0;break;case 70:k=0}},false)};
 THREE.TrackballControls=function(a,b){THREE.EventTarget.call(this);var c=this;this.object=a;this.domElement=b!==void 0?b:document;this.enabled=true;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=false;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=false,e=-1,g=new THREE.Vector3,h=new THREE.Vector3,j=new THREE.Vector3,i=new THREE.Vector2,k=new THREE.Vector2,q=new THREE.Vector2,l=new THREE.Vector2,n={type:"change"};this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.getMouseOnScreen=function(a,b){return new THREE.Vector2((a-c.screen.offsetLeft)/c.radius*0.5,(b-c.screen.offsetTop)/c.radius*0.5)};this.getMouseProjectionOnBall=function(a,b){var d=new THREE.Vector3((a-
+this.target=new THREE.Vector3;var d=new THREE.Vector3,f=false,e=-1,g=new THREE.Vector3,h=new THREE.Vector3,j=new THREE.Vector3,i=new THREE.Vector2,k=new THREE.Vector2,o=new THREE.Vector2,l=new THREE.Vector2,n={type:"change"};this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.getMouseOnScreen=function(a,b){return new THREE.Vector2((a-c.screen.offsetLeft)/c.radius*0.5,(b-c.screen.offsetTop)/c.radius*0.5)};this.getMouseProjectionOnBall=function(a,b){var d=new THREE.Vector3((a-
 c.screen.width*0.5-c.screen.offsetLeft)/c.radius,(c.screen.height*0.5+c.screen.offsetTop-b)/c.radius,0),e=d.length();e>1?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(j)/h.length()/j.length());if(a){var b=(new THREE.Vector3).cross(h,j).normalize(),d=new THREE.Quaternion,a=a*c.rotateSpeed;
-d.setFromAxisAngle(b,-a);d.multiplyVector3(g);d.multiplyVector3(c.object.up);d.multiplyVector3(j);if(c.staticMoving)h=j;else{d.setFromAxisAngle(b,a*(c.dynamicDampingFactor-1));d.multiplyVector3(h)}}};this.zoomCamera=function(){var a=1+(k.y-i.y)*c.zoomSpeed;if(a!==1&&a>0){g.multiplyScalar(a);c.staticMoving?i=k:i.y=i.y+(k.y-i.y)*this.dynamicDampingFactor}};this.panCamera=function(){var a=l.clone().subSelf(q);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?q=l:q.addSelf(a.sub(l,q).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);if(d.distanceTo(c.object.position)>0){c.dispatchEvent(n);d.copy(c.object.position)}};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},false);this.domElement.addEventListener("mousemove",function(a){if(c.enabled){if(f){h=j=c.getMouseProjectionOnBall(a.clientX,a.clientY);i=k=c.getMouseOnScreen(a.clientX,a.clientY);q=
+d.setFromAxisAngle(b,-a);d.multiplyVector3(g);d.multiplyVector3(c.object.up);d.multiplyVector3(j);if(c.staticMoving)h=j;else{d.setFromAxisAngle(b,a*(c.dynamicDampingFactor-1));d.multiplyVector3(h)}}};this.zoomCamera=function(){var a=1+(k.y-i.y)*c.zoomSpeed;if(a!==1&&a>0){g.multiplyScalar(a);c.staticMoving?i=k:i.y=i.y+(k.y-i.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);if(d.distanceTo(c.object.position)>0){c.dispatchEvent(n);d.copy(c.object.position)}};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},false);this.domElement.addEventListener("mousemove",function(a){if(c.enabled){if(f){h=j=c.getMouseProjectionOnBall(a.clientX,a.clientY);i=k=c.getMouseOnScreen(a.clientX,a.clientY);o=
 l=c.getMouseOnScreen(a.clientX,a.clientY);f=false}e!==-1&&(e===0&&!c.noRotate?j=c.getMouseProjectionOnBall(a.clientX,a.clientY):e===1&&!c.noZoom?k=c.getMouseOnScreen(a.clientX,a.clientY):e===2&&!c.noPan&&(l=c.getMouseOnScreen(a.clientX,a.clientY)))}},false);this.domElement.addEventListener("mousedown",function(a){if(c.enabled){a.preventDefault();a.stopPropagation();if(e===-1){e=a.button;e===0&&!c.noRotate?h=j=c.getMouseProjectionOnBall(a.clientX,a.clientY):e===1&&!c.noZoom?i=k=c.getMouseOnScreen(a.clientX,
-a.clientY):this.noPan||(q=l=c.getMouseOnScreen(a.clientX,a.clientY))}}},false);this.domElement.addEventListener("mouseup",function(a){if(c.enabled){a.preventDefault();a.stopPropagation();e=-1}},false);window.addEventListener("keydown",function(a){if(c.enabled&&e===-1){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);e!==-1&&(f=true)}},false);window.addEventListener("keyup",function(){c.enabled&&e!==-1&&(e=-1)},false)};
-THREE.CubeGeometry=function(a,b,c,d,f,e,g,h){function j(a,b,c,g,h,j,l,k){var q,m=d||1,n=f||1,r=h/2,p=j/2,t=i.vertices.length;if(a==="x"&&b==="y"||a==="y"&&b==="x")q="z";else if(a==="x"&&b==="z"||a==="z"&&b==="x"){q="y";n=e||1}else if(a==="z"&&b==="y"||a==="y"&&b==="z"){q="x";m=e||1}var s=m+1,v=n+1,F=h/m,M=j/n,N=new THREE.Vector3;N[q]=l>0?1:-1;for(h=0;h<v;h++)for(j=0;j<s;j++){var D=new THREE.Vertex;D[a]=(j*F-r)*c;D[b]=(h*M-p)*g;D[q]=l;i.vertices.push(D)}for(h=0;h<n;h++)for(j=0;j<m;j++){a=new THREE.Face4(j+
-s*h+t,j+s*(h+1)+t,j+1+s*(h+1)+t,j+1+s*h+t);a.normal.copy(N);a.vertexNormals.push(N.clone(),N.clone(),N.clone(),N.clone());a.materialIndex=k;i.faces.push(a);i.faceVertexUvs[0].push([new THREE.UV(j/m,h/n),new THREE.UV(j/m,(h+1)/n),new THREE.UV((j+1)/m,(h+1)/n),new THREE.UV((j+1)/m,h/n)])}}THREE.Geometry.call(this);var i=this,k=a/2,q=b/2,l=c/2,n,r,m,p,t,s;if(g!==void 0){if(g instanceof Array)this.materials=g;else{this.materials=[];for(n=0;n<6;n++)this.materials.push(g)}n=0;p=1;r=2;t=3;m=4;s=5}else this.materials=
-[];this.sides={px:true,nx:true,py:true,ny:true,pz:true,nz:true};if(h!=void 0)for(var v in h)this.sides[v]!==void 0&&(this.sides[v]=h[v]);this.sides.px&&j("z","y",-1,-1,c,b,k,n);this.sides.nx&&j("z","y",1,-1,c,b,-k,p);this.sides.py&&j("x","z",1,1,a,c,q,r);this.sides.ny&&j("x","z",1,-1,a,c,-q,t);this.sides.pz&&j("x","y",1,-1,a,b,l,m);this.sides.nz&&j("x","y",-1,-1,a,b,-l,s);this.computeCentroids();this.mergeVertices()};THREE.CubeGeometry.prototype=new THREE.Geometry;
+a.clientY):this.noPan||(o=l=c.getMouseOnScreen(a.clientX,a.clientY))}}},false);this.domElement.addEventListener("mouseup",function(a){if(c.enabled){a.preventDefault();a.stopPropagation();e=-1}},false);window.addEventListener("keydown",function(a){if(c.enabled&&e===-1){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);e!==-1&&(f=true)}},false);window.addEventListener("keyup",function(){c.enabled&&e!==-1&&(e=-1)},false)};
+THREE.CubeGeometry=function(a,b,c,d,f,e,g,h){function j(a,b,c,g,h,j,l,k){var o,m=d||1,n=f||1,q=h/2,r=j/2,s=i.vertices.length;if(a==="x"&&b==="y"||a==="y"&&b==="x")o="z";else if(a==="x"&&b==="z"||a==="z"&&b==="x"){o="y";n=e||1}else if(a==="z"&&b==="y"||a==="y"&&b==="z"){o="x";m=e||1}var u=m+1,t=n+1,M=h/m,F=j/n,N=new THREE.Vector3;N[o]=l>0?1:-1;for(h=0;h<t;h++)for(j=0;j<u;j++){var D=new THREE.Vector3;D[a]=(j*M-q)*c;D[b]=(h*F-r)*g;D[o]=l;i.vertices.push(D)}for(h=0;h<n;h++)for(j=0;j<m;j++){a=new THREE.Face4(j+
+u*h+s,j+u*(h+1)+s,j+1+u*(h+1)+s,j+1+u*h+s);a.normal.copy(N);a.vertexNormals.push(N.clone(),N.clone(),N.clone(),N.clone());a.materialIndex=k;i.faces.push(a);i.faceVertexUvs[0].push([new THREE.UV(j/m,h/n),new THREE.UV(j/m,(h+1)/n),new THREE.UV((j+1)/m,(h+1)/n),new THREE.UV((j+1)/m,h/n)])}}THREE.Geometry.call(this);var i=this,k=a/2,o=b/2,l=c/2,n,q,m,r,u,s;if(g!==void 0){if(g instanceof Array)this.materials=g;else{this.materials=[];for(n=0;n<6;n++)this.materials.push(g)}n=0;r=1;q=2;u=3;m=4;s=5}else this.materials=
+[];this.sides={px:true,nx:true,py:true,ny:true,pz:true,nz:true};if(h!=void 0)for(var t in h)this.sides[t]!==void 0&&(this.sides[t]=h[t]);this.sides.px&&j("z","y",-1,-1,c,b,k,n);this.sides.nx&&j("z","y",1,-1,c,b,-k,r);this.sides.py&&j("x","z",1,1,a,c,o,q);this.sides.ny&&j("x","z",1,-1,a,c,-o,u);this.sides.pz&&j("x","y",1,-1,a,b,l,m);this.sides.nz&&j("x","y",-1,-1,a,b,-l,s);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=a!==void 0?a:20,b=b!==void 0?b:20,c=c!==void 0?c:100,g=c/2,d=d||8,f=f||1,h,j,i=[],k=[];for(j=0;j<=f;j++){var q=[],l=[],n=j/f,r=n*(b-a)+a;for(h=0;h<=d;h++){var m=h/d,p=r*Math.sin(m*Math.PI*2),t=-n*c+g,s=r*Math.cos(m*Math.PI*2);this.vertices.push(new THREE.Vertex(p,t,s));q.push(this.vertices.length-1);l.push(new THREE.UV(m,n))}i.push(q);k.push(l)}for(j=0;j<f;j++)for(h=0;h<d;h++){var c=i[j][h],q=i[j+1][h],l=i[j+1][h+1],n=i[j][h+
-1],r=this.vertices[c].clone().setY(0).normalize(),m=this.vertices[q].clone().setY(0).normalize(),p=this.vertices[l].clone().setY(0).normalize(),t=this.vertices[n].clone().setY(0).normalize(),s=k[j][h].clone(),v=k[j+1][h].clone(),o=k[j+1][h+1].clone(),x=k[j][h+1].clone();this.faces.push(new THREE.Face4(c,q,l,n,[r,m,p,t]));this.faceVertexUvs[0].push([s,v,o,x])}if(!e&&a>0){this.vertices.push(new THREE.Vertex(0,g,0));for(h=0;h<d;h++){c=i[0][h];q=i[0][h+1];l=this.vertices.length-1;r=new THREE.Vector3(0,
-1,0);m=new THREE.Vector3(0,1,0);p=new THREE.Vector3(0,1,0);s=k[0][h].clone();v=k[0][h+1].clone();o=new THREE.UV(v.u,0);this.faces.push(new THREE.Face3(c,q,l,[r,m,p]));this.faceVertexUvs[0].push([s,v,o])}}if(!e&&b>0){this.vertices.push(new THREE.Vertex(0,-g,0));for(h=0;h<d;h++){c=i[j][h+1];q=i[j][h];l=this.vertices.length-1;r=new THREE.Vector3(0,-1,0);m=new THREE.Vector3(0,-1,0);p=new THREE.Vector3(0,-1,0);s=k[j][h+1].clone();v=k[j][h].clone();o=new THREE.UV(v.u,1);this.faces.push(new THREE.Face3(c,
-q,l,[r,m,p]));this.faceVertexUvs[0].push([s,v,o])}}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;THREE.ExtrudeGeometry=function(a,b){if(typeof a!=="undefined"){THREE.Geometry.call(this);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.CylinderGeometry=function(a,b,c,d,f,e){THREE.Geometry.call(this);var a=a!==void 0?a:20,b=b!==void 0?b:20,c=c!==void 0?c:100,g=c/2,d=d||8,f=f||1,h,j,i=[],k=[];for(j=0;j<=f;j++){var o=[],l=[],n=j/f,q=n*(b-a)+a;for(h=0;h<=d;h++){var m=h/d,r=new THREE.Vector3;r.x=q*Math.sin(m*Math.PI*2);r.y=-n*c+g;r.z=q*Math.cos(m*Math.PI*2);this.vertices.push(r);o.push(this.vertices.length-1);l.push(new THREE.UV(m,n))}i.push(o);k.push(l)}for(j=0;j<f;j++)for(h=0;h<d;h++){var c=i[j][h],o=i[j+1][h],l=i[j+1][h+1],
+n=i[j][h+1],q=this.vertices[c].clone().setY(0).normalize(),m=this.vertices[o].clone().setY(0).normalize(),r=this.vertices[l].clone().setY(0).normalize(),u=this.vertices[n].clone().setY(0).normalize(),s=k[j][h].clone(),t=k[j+1][h].clone(),p=k[j+1][h+1].clone(),w=k[j][h+1].clone();this.faces.push(new THREE.Face4(c,o,l,n,[q,m,r,u]));this.faceVertexUvs[0].push([s,t,p,w])}if(!e&&a>0){this.vertices.push(new THREE.Vector3(0,g,0));for(h=0;h<d;h++){c=i[0][h];o=i[0][h+1];l=this.vertices.length-1;q=new THREE.Vector3(0,
+1,0);m=new THREE.Vector3(0,1,0);r=new THREE.Vector3(0,1,0);s=k[0][h].clone();t=k[0][h+1].clone();p=new THREE.UV(t.u,0);this.faces.push(new THREE.Face3(c,o,l,[q,m,r]));this.faceVertexUvs[0].push([s,t,p])}}if(!e&&b>0){this.vertices.push(new THREE.Vector3(0,-g,0));for(h=0;h<d;h++){c=i[j][h+1];o=i[j][h];l=this.vertices.length-1;q=new THREE.Vector3(0,-1,0);m=new THREE.Vector3(0,-1,0);r=new THREE.Vector3(0,-1,0);s=k[j][h+1].clone();t=k[j][h].clone();p=new THREE.UV(t.u,1);this.faces.push(new THREE.Face3(c,
+o,l,[q,m,r]));this.faceVertexUvs[0].push([s,t,p])}}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;THREE.ExtrudeGeometry=function(a,b){if(typeof a!=="undefined"){THREE.Geometry.call(this);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,j=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);j.copy(a).addSelf(g);if(h.equals(j))return g.clone();
 h.copy(b).addSelf(f);j.copy(c).addSelf(g);f=d.dot(g);g=j.subSelf(h).dot(g);if(f===0){console.log("Either infinite or no solutions!");g===0?console.log("Its finite solutions."):console.log("Too bad, no solutions.")}g=g/f;if(g<0){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=a+Math.PI*2);c=(b+a)/2;a=-Math.cos(c);c=-Math.sin(c);return new THREE.Vector2(a,c)}return d.multiplyScalar(g).addSelf(h).subSelf(a).clone()}function f(c,d){var e,f;for(D=c.length;--D>=0;){e=D;f=D-1;f<0&&(f=
-c.length-1);for(var g=0,h=l+k*2,g=0;g<h;g++){var j=F*g,i=F*(g+1),m=d+e+j,j=d+f+j,q=d+f+i,i=d+e+i,n=c,r=g,p=h,m=m+H,j=j+H,q=q+H,i=i+H;E.faces.push(new THREE.Face4(m,j,q,i,null,null,s));m=O.generateSideWallUV(E,a,n,b,m,j,q,i,r,p);E.faceVertexUvs[0].push(m)}}}function e(a,b,c){E.vertices.push(new THREE.Vertex(a,b,c))}function g(c,d,e,f){c=c+H;d=d+H;e=e+H;E.faces.push(new THREE.Face3(c,d,e,null,null,t));c=f?O.generateBottomUV(E,a,b,c,d,e):O.generateTopUV(E,a,b,c,d,e);E.faceVertexUvs[0].push(c)}var h=
-b.amount!==void 0?b.amount:100,j=b.bevelThickness!==void 0?b.bevelThickness:6,i=b.bevelSize!==void 0?b.bevelSize:j-2,k=b.bevelSegments!==void 0?b.bevelSegments:3,q=b.bevelEnabled!==void 0?b.bevelEnabled:true,l=b.steps!==void 0?b.steps:1,n=b.bendPath,r=b.extrudePath,m,p=false,t=b.material,s=b.extrudeMaterial,v,o,x,y;if(r){m=r.getSpacedPoints(l);p=true;q=false;v=new THREE.TubeGeometry.FrenetFrames(r,l,false);o=new THREE.Vector3;x=new THREE.Vector3;y=new THREE.Vector3}if(!q)i=j=k=0;var z,u,w,E=this,
-H=this.vertices.length;n&&a.addWrapPath(n);var r=a.extractPoints(),n=r.shape,I=r.holes;if(r=!THREE.Shape.Utils.isClockWise(n)){n=n.reverse();u=0;for(w=I.length;u<w;u++){z=I[u];THREE.Shape.Utils.isClockWise(z)&&(I[u]=z.reverse())}r=false}var J=THREE.Shape.Utils.triangulateShape(n,I),C=n;u=0;for(w=I.length;u<w;u++){z=I[u];n=n.concat(z)}var A,B,G,L,K,F=n.length,M,N=J.length,r=[],D=0;G=C.length;A=G-1;for(B=D+1;D<G;D++,A++,B++){A===G&&(A=0);B===G&&(B=0);r[D]=d(C[D],C[A],C[B])}var T=[],P,S=r.concat();u=
-0;for(w=I.length;u<w;u++){z=I[u];P=[];D=0;G=z.length;A=G-1;for(B=D+1;D<G;D++,A++,B++){A===G&&(A=0);B===G&&(B=0);P[D]=d(z[D],z[A],z[B])}T.push(P);S=S.concat(P)}for(A=0;A<k;A++){G=A/k;L=j*(1-G);B=i*Math.sin(G*Math.PI/2);D=0;for(G=C.length;D<G;D++){K=c(C[D],r[D],B);e(K.x,K.y,-L)}u=0;for(w=I.length;u<w;u++){z=I[u];P=T[u];D=0;for(G=z.length;D<G;D++){K=c(z[D],P[D],B);e(K.x,K.y,-L)}}}B=i;for(D=0;D<F;D++){K=q?c(n[D],S[D],B):n[D];if(p){x.copy(v.normals[0]).multiplyScalar(K.x);o.copy(v.binormals[0]).multiplyScalar(K.y);
-y.copy(m[0]).addSelf(x).addSelf(o);e(y.x,y.y,y.z)}else e(K.x,K.y,0)}for(G=1;G<=l;G++)for(D=0;D<F;D++){K=q?c(n[D],S[D],B):n[D];if(p){x.copy(v.normals[G]).multiplyScalar(K.x);o.copy(v.binormals[G]).multiplyScalar(K.y);y.copy(m[G]).addSelf(x).addSelf(o);e(y.x,y.y,y.z)}else e(K.x,K.y,h/l*G)}for(A=k-1;A>=0;A--){G=A/k;L=j*(1-G);B=i*Math.sin(G*Math.PI/2);D=0;for(G=C.length;D<G;D++){K=c(C[D],r[D],B);e(K.x,K.y,h+L)}u=0;for(w=I.length;u<w;u++){z=I[u];P=T[u];D=0;for(G=z.length;D<G;D++){K=c(z[D],P[D],B);p?e(K.x,
-K.y+m[l-1].y,m[l-1].x+L):e(K.x,K.y,h+L)}}}var O=THREE.ExtrudeGeometry.WorldUVGenerator;(function(){if(q){var a;a=F*0;for(D=0;D<N;D++){M=J[D];g(M[2]+a,M[1]+a,M[0]+a,true)}a=l+k*2;a=F*a;for(D=0;D<N;D++){M=J[D];g(M[0]+a,M[1]+a,M[2]+a,false)}}else{for(D=0;D<N;D++){M=J[D];g(M[2],M[1],M[0],true)}for(D=0;D<N;D++){M=J[D];g(M[0]+F*l,M[1]+F*l,M[2]+F*l,false)}}})();(function(){var a=0;f(C,a);a=a+C.length;u=0;for(w=I.length;u<w;u++){z=I[u];f(z,a);a=a+z.length}})()};
+c.length-1);for(var g=0,h=l+k*2,g=0;g<h;g++){var j=M*g,i=M*(g+1),m=d+e+j,j=d+f+j,o=d+f+i,i=d+e+i,n=c,q=g,r=h,m=m+E,j=j+E,o=o+E,i=i+E;B.faces.push(new THREE.Face4(m,j,o,i,null,null,s));m=O.generateSideWallUV(B,a,n,b,m,j,o,i,q,r);B.faceVertexUvs[0].push(m)}}}function e(a,b,c){B.vertices.push(new THREE.Vector3(a,b,c))}function g(c,d,e,f){c=c+E;d=d+E;e=e+E;B.faces.push(new THREE.Face3(c,d,e,null,null,u));c=f?O.generateBottomUV(B,a,b,c,d,e):O.generateTopUV(B,a,b,c,d,e);B.faceVertexUvs[0].push(c)}var h=
+b.amount!==void 0?b.amount:100,j=b.bevelThickness!==void 0?b.bevelThickness:6,i=b.bevelSize!==void 0?b.bevelSize:j-2,k=b.bevelSegments!==void 0?b.bevelSegments:3,o=b.bevelEnabled!==void 0?b.bevelEnabled:true,l=b.steps!==void 0?b.steps:1,n=b.bendPath,q=b.extrudePath,m,r=false,u=b.material,s=b.extrudeMaterial,t,p,w,A;if(q){m=q.getSpacedPoints(l);r=true;o=false;t=new THREE.TubeGeometry.FrenetFrames(q,l,false);p=new THREE.Vector3;w=new THREE.Vector3;A=new THREE.Vector3}if(!o)i=j=k=0;var z,x,v,B=this,
+E=this.vertices.length;n&&a.addWrapPath(n);var q=a.extractPoints(),n=q.shape,H=q.holes;if(q=!THREE.Shape.Utils.isClockWise(n)){n=n.reverse();x=0;for(v=H.length;x<v;x++){z=H[x];THREE.Shape.Utils.isClockWise(z)&&(H[x]=z.reverse())}q=false}var K=THREE.Shape.Utils.triangulateShape(n,H),I=n;x=0;for(v=H.length;x<v;x++){z=H[x];n=n.concat(z)}var y,C,G,L,J,M=n.length,F,N=K.length,q=[],D=0;G=I.length;y=G-1;for(C=D+1;D<G;D++,y++,C++){y===G&&(y=0);C===G&&(C=0);q[D]=d(I[D],I[y],I[C])}var T=[],P,S=q.concat();x=
+0;for(v=H.length;x<v;x++){z=H[x];P=[];D=0;G=z.length;y=G-1;for(C=D+1;D<G;D++,y++,C++){y===G&&(y=0);C===G&&(C=0);P[D]=d(z[D],z[y],z[C])}T.push(P);S=S.concat(P)}for(y=0;y<k;y++){G=y/k;L=j*(1-G);C=i*Math.sin(G*Math.PI/2);D=0;for(G=I.length;D<G;D++){J=c(I[D],q[D],C);e(J.x,J.y,-L)}x=0;for(v=H.length;x<v;x++){z=H[x];P=T[x];D=0;for(G=z.length;D<G;D++){J=c(z[D],P[D],C);e(J.x,J.y,-L)}}}C=i;for(D=0;D<M;D++){J=o?c(n[D],S[D],C):n[D];if(r){w.copy(t.normals[0]).multiplyScalar(J.x);p.copy(t.binormals[0]).multiplyScalar(J.y);
+A.copy(m[0]).addSelf(w).addSelf(p);e(A.x,A.y,A.z)}else e(J.x,J.y,0)}for(G=1;G<=l;G++)for(D=0;D<M;D++){J=o?c(n[D],S[D],C):n[D];if(r){w.copy(t.normals[G]).multiplyScalar(J.x);p.copy(t.binormals[G]).multiplyScalar(J.y);A.copy(m[G]).addSelf(w).addSelf(p);e(A.x,A.y,A.z)}else e(J.x,J.y,h/l*G)}for(y=k-1;y>=0;y--){G=y/k;L=j*(1-G);C=i*Math.sin(G*Math.PI/2);D=0;for(G=I.length;D<G;D++){J=c(I[D],q[D],C);e(J.x,J.y,h+L)}x=0;for(v=H.length;x<v;x++){z=H[x];P=T[x];D=0;for(G=z.length;D<G;D++){J=c(z[D],P[D],C);r?e(J.x,
+J.y+m[l-1].y,m[l-1].x+L):e(J.x,J.y,h+L)}}}var O=THREE.ExtrudeGeometry.WorldUVGenerator;(function(){if(o){var a;a=M*0;for(D=0;D<N;D++){F=K[D];g(F[2]+a,F[1]+a,F[0]+a,true)}a=l+k*2;a=M*a;for(D=0;D<N;D++){F=K[D];g(F[0]+a,F[1]+a,F[2]+a,false)}}else{for(D=0;D<N;D++){F=K[D];g(F[2],F[1],F[0],true)}for(D=0;D<N;D++){F=K[D];g(F[0]+M*l,F[1]+M*l,F[2]+M*l,false)}}})();(function(){var a=0;f(I,a);a=a+I.length;x=0;for(v=H.length;x<v;x++){z=H[x];f(z,a);a=a+z.length}})()};
 THREE.ExtrudeGeometry.WorldUVGenerator={generateTopUV:function(a,b,c,d,f,e){b=a.vertices[f].x;f=a.vertices[f].y;c=a.vertices[e].x;e=a.vertices[e].y;return[new THREE.UV(a.vertices[d].x,1-a.vertices[d].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].x,c=a.vertices[f].y,f=a.vertices[f].z,d=a.vertices[e].x,j=a.vertices[e].y,e=a.vertices[e].z,i=a.vertices[g].x,k=
-a.vertices[g].y,g=a.vertices[g].z,q=a.vertices[h].x,l=a.vertices[h].y,a=a.vertices[h].z;return Math.abs(c-j)<0.01?[new THREE.UV(b,f),new THREE.UV(d,e),new THREE.UV(i,g),new THREE.UV(q,a)]:[new THREE.UV(c,f),new THREE.UV(j,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.__v3=new THREE.Vector2;THREE.ExtrudeGeometry.__v4=new THREE.Vector2;THREE.ExtrudeGeometry.__v5=new THREE.Vector2;
+a.vertices[g].y,g=a.vertices[g].z,o=a.vertices[h].x,l=a.vertices[h].y,a=a.vertices[h].z;return Math.abs(c-j)<0.01?[new THREE.UV(b,f),new THREE.UV(d,e),new THREE.UV(i,g),new THREE.UV(o,a)]:[new THREE.UV(c,f),new THREE.UV(j,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.__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);for(var b=b||12,c=c||2*Math.PI,d=[],f=(new THREE.Matrix4).makeRotationZ(c/b),e=0;e<a.length;e++){d[e]=a[e].clone();this.vertices.push((new THREE.Vertex).copy(d[e]))}for(var g=b+1,c=0;c<g;c++)for(e=0;e<d.length;e++){d[e]=f.multiplyVector3(d[e].clone());this.vertices.push((new THREE.Vertex).copy(d[e]))}for(c=0;c<b;c++){d=0;for(f=a.length;d<f-1;d++){this.faces.push(new THREE.Face4(c*f+d,(c+1)%g*f+d,(c+1)%g*f+(d+1)%f,c*f+(d+1)%f));this.faceVertexUvs[0].push([new THREE.UV(1-
-c/b,d/f),new THREE.UV(1-(c+1)/b,d/f),new THREE.UV(1-(c+1)/b,(d+1)/f),new THREE.UV(1-c/b,(d+1)/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,j=a/c,i=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(b*j-f,0,a*i-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+1)/d),new THREE.UV((b+
+THREE.LatheGeometry=function(a,b,c){THREE.Geometry.call(this);for(var b=b||12,c=c||2*Math.PI,d=[],f=(new THREE.Matrix4).makeRotationZ(c/b),e=0;e<a.length;e++){d[e]=a[e].clone();this.vertices.push(d[e])}for(var g=b+1,c=0;c<g;c++)for(e=0;e<d.length;e++){d[e]=f.multiplyVector3(d[e].clone());this.vertices.push(d[e])}for(c=0;c<b;c++){d=0;for(f=a.length;d<f-1;d++){this.faces.push(new THREE.Face4(c*f+d,(c+1)%g*f+d,(c+1)%g*f+(d+1)%f,c*f+(d+1)%f));this.faceVertexUvs[0].push([new THREE.UV(1-c/b,d/f),new THREE.UV(1-
+(c+1)/b,d/f),new THREE.UV(1-(c+1)/b,(d+1)/f),new THREE.UV(1-c/b,(d+1)/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,j=a/c,i=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.Vector3(b*j-f,0,a*i-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+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=d!==void 0?d:0,f=f!==void 0?f:Math.PI*2,e=e!==void 0?e:0,g=g!==void 0?g:Math.PI,b=Math.max(3,Math.floor(b)||8),c=Math.max(2,Math.floor(c)||6),h,j,i=[],k=[];for(j=0;j<=c;j++){var q=[],l=[];for(h=0;h<=b;h++){var n=h/b,r=j/c,m=-a*Math.cos(d+n*f)*Math.sin(e+r*g),p=a*Math.cos(e+r*g),t=a*Math.sin(d+n*f)*Math.sin(e+r*g);this.vertices.push(new THREE.Vertex(m,p,t));q.push(this.vertices.length-1);l.push(new THREE.UV(n,r))}i.push(q);
-k.push(l)}for(j=0;j<c;j++)for(h=0;h<b;h++){var d=i[j][h+1],f=i[j][h],e=i[j+1][h],g=i[j+1][h+1],q=this.vertices[d].clone().normalize(),l=this.vertices[f].clone().normalize(),n=this.vertices[e].clone().normalize(),r=this.vertices[g].clone().normalize(),m=k[j][h+1].clone(),p=k[j][h].clone(),t=k[j+1][h].clone(),s=k[j+1][h+1].clone();if(Math.abs(this.vertices[d].y)==a){this.faces.push(new THREE.Face3(d,e,g,[q,n,r]));this.faceVertexUvs[0].push([m,t,s])}else if(Math.abs(this.vertices[e].y)==a){this.faces.push(new THREE.Face3(d,
-f,e,[q,l,n]));this.faceVertexUvs[0].push([m,p,t])}else{this.faces.push(new THREE.Face4(d,f,e,g,[q,l,n,r]));this.faceVertexUvs[0].push([m,p,t,s])}}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,f,e,g){THREE.Geometry.call(this);var a=a||50,d=d!==void 0?d:0,f=f!==void 0?f:Math.PI*2,e=e!==void 0?e:0,g=g!==void 0?g:Math.PI,b=Math.max(3,Math.floor(b)||8),c=Math.max(2,Math.floor(c)||6),h,j,i=[],k=[];for(j=0;j<=c;j++){var o=[],l=[];for(h=0;h<=b;h++){var n=h/b,q=j/c,m=new THREE.Vector3;m.x=-a*Math.cos(d+n*f)*Math.sin(e+q*g);m.y=a*Math.cos(e+q*g);m.z=a*Math.sin(d+n*f)*Math.sin(e+q*g);this.vertices.push(m);o.push(this.vertices.length-1);l.push(new THREE.UV(n,
+q))}i.push(o);k.push(l)}for(j=0;j<c;j++)for(h=0;h<b;h++){var d=i[j][h+1],f=i[j][h],e=i[j+1][h],g=i[j+1][h+1],o=this.vertices[d].clone().normalize(),l=this.vertices[f].clone().normalize(),n=this.vertices[e].clone().normalize(),q=this.vertices[g].clone().normalize(),m=k[j][h+1].clone(),r=k[j][h].clone(),u=k[j+1][h].clone(),s=k[j+1][h+1].clone();if(Math.abs(this.vertices[d].y)==a){this.faces.push(new THREE.Face3(d,e,g,[o,n,q]));this.faceVertexUvs[0].push([m,u,s])}else if(Math.abs(this.vertices[e].y)==
+a){this.faces.push(new THREE.Face3(d,f,e,[o,l,n]));this.faceVertexUvs[0].push([m,r,u])}else{this.faces.push(new THREE.Face4(d,f,e,g,[o,l,n,q]));this.faceVertexUvs[0].push([m,r,u,s])}}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=b.height!==void 0?b.height:50;if(b.bevelThickness===void 0)b.bevelThickness=10;if(b.bevelSize===void 0)b.bevelSize=8;if(b.bevelEnabled===void 0)b.bevelEnabled=false;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,j,i,k,q,l,n,r,m,p,t=b.glyphs[a]||b.glyphs["?"];if(t){if(t.o){b=t._cachedOutline||(t._cachedOutline=t.o.split(" "));i=b.length;for(a=0;a<i;){j=b[a++];switch(j){case "m":j=b[a++]*c+d;k=b[a++]*c;e.push(new THREE.Vector2(j,k));f.moveTo(j,k);break;case "l":j=b[a++]*c+d;k=b[a++]*c;e.push(new THREE.Vector2(j,
-k));f.lineTo(j,k);break;case "q":j=b[a++]*c+d;k=b[a++]*c;n=b[a++]*c+d;r=b[a++]*c;f.quadraticCurveTo(n,r,j,k);if(g=e[e.length-1]){q=g.x;l=g.y;g=1;for(h=this.divisions;g<=h;g++){var s=g/h,v=THREE.Shape.Utils.b2(s,q,n,j),s=THREE.Shape.Utils.b2(s,l,r,k);e.push(new THREE.Vector2(v,s))}}break;case "b":j=b[a++]*c+d;k=b[a++]*c;n=b[a++]*c+d;r=b[a++]*-c;m=b[a++]*c+d;p=b[a++]*-c;f.bezierCurveTo(j,k,n,r,m,p);if(g=e[e.length-1]){q=g.x;l=g.y;g=1;for(h=this.divisions;g<=h;g++){s=g/h;v=THREE.Shape.Utils.b3(s,q,n,
-m,j);s=THREE.Shape.Utils.b3(s,l,r,p,k);e.push(new THREE.Vector2(v,s))}}}}}return{offset:t.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=f+(a[e].x*a[g].y-a[g].x*a[e].y);return f*0.5};a.Triangulate=function(a,d){var f=a.length;if(f<3)return null;var e=[],g=[],h=[],j,i,k;if(b(a)>0)for(i=0;i<f;i++)g[i]=i;else for(i=0;i<f;i++)g[i]=f-1-i;var q=2*f;for(i=f-1;f>2;){if(q--<=0){console.log("Warning, unable to triangulate polygon!");break}j=i;f<=j&&(j=0);i=j+1;f<=i&&(i=0);k=i+1;f<=k&&(k=0);var l;a:{l=a;var n=j,r=i,m=k,p=f,t=g,s=void 0,v=void 0,o=void 0,x=void 0,y=void 0,
-z=void 0,u=void 0,w=void 0,E=void 0,v=l[t[n]].x,o=l[t[n]].y,x=l[t[r]].x,y=l[t[r]].y,z=l[t[m]].x,u=l[t[m]].y;if(1.0E-10>(x-v)*(u-o)-(y-o)*(z-v))l=false;else{for(s=0;s<p;s++)if(!(s==n||s==r||s==m)){var w=l[t[s]].x,E=l[t[s]].y,H=void 0,I=void 0,J=void 0,C=void 0,A=void 0,B=void 0,G=void 0,L=void 0,K=void 0,F=void 0,M=void 0,N=void 0,H=J=A=void 0,H=z-x,I=u-y,J=v-z,C=o-u,A=x-v,B=y-o,G=w-v,L=E-o,K=w-x,F=E-y,M=w-z,N=E-u,H=H*F-I*K,A=A*L-B*G,J=J*N-C*M;if(H>=0&&J>=0&&A>=0){l=false;break a}}l=true}}if(l){e.push([a[g[j]],
-a[g[i]],a[g[k]]]);h.push([g[j],g[i],g[k]]);j=i;for(k=i+1;k<f;j++,k++)g[j]=g[k];f--;q=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||Math.PI*2;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=c/this.segmentsR*Math.PI*2;f.x=this.radius*Math.cos(e);f.y=this.radius*Math.sin(e);var h=new THREE.Vertex;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=
+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,j,i,k,o,l,n,q,m,r,u=b.glyphs[a]||b.glyphs["?"];if(u){if(u.o){b=u._cachedOutline||(u._cachedOutline=u.o.split(" "));i=b.length;for(a=0;a<i;){j=b[a++];switch(j){case "m":j=b[a++]*c+d;k=b[a++]*c;e.push(new THREE.Vector2(j,k));f.moveTo(j,k);break;case "l":j=b[a++]*c+d;k=b[a++]*c;e.push(new THREE.Vector2(j,
+k));f.lineTo(j,k);break;case "q":j=b[a++]*c+d;k=b[a++]*c;n=b[a++]*c+d;q=b[a++]*c;f.quadraticCurveTo(n,q,j,k);if(g=e[e.length-1]){o=g.x;l=g.y;g=1;for(h=this.divisions;g<=h;g++){var s=g/h,t=THREE.Shape.Utils.b2(s,o,n,j),s=THREE.Shape.Utils.b2(s,l,q,k);e.push(new THREE.Vector2(t,s))}}break;case "b":j=b[a++]*c+d;k=b[a++]*c;n=b[a++]*c+d;q=b[a++]*-c;m=b[a++]*c+d;r=b[a++]*-c;f.bezierCurveTo(j,k,n,q,m,r);if(g=e[e.length-1]){o=g.x;l=g.y;g=1;for(h=this.divisions;g<=h;g++){s=g/h;t=THREE.Shape.Utils.b3(s,o,n,
+m,j);s=THREE.Shape.Utils.b3(s,l,q,r,k);e.push(new THREE.Vector2(t,s))}}}}}return{offset:u.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=f+(a[e].x*a[g].y-a[g].x*a[e].y);return f*0.5};a.Triangulate=function(a,d){var f=a.length;if(f<3)return null;var e=[],g=[],h=[],j,i,k;if(b(a)>0)for(i=0;i<f;i++)g[i]=i;else for(i=0;i<f;i++)g[i]=f-1-i;var o=2*f;for(i=f-1;f>2;){if(o--<=0){console.log("Warning, unable to triangulate polygon!");break}j=i;f<=j&&(j=0);i=j+1;f<=i&&(i=0);k=i+1;f<=k&&(k=0);var l;a:{l=a;var n=j,q=i,m=k,r=f,u=g,s=void 0,t=void 0,p=void 0,w=void 0,A=void 0,
+z=void 0,x=void 0,v=void 0,B=void 0,t=l[u[n]].x,p=l[u[n]].y,w=l[u[q]].x,A=l[u[q]].y,z=l[u[m]].x,x=l[u[m]].y;if(1.0E-10>(w-t)*(x-p)-(A-p)*(z-t))l=false;else{for(s=0;s<r;s++)if(!(s==n||s==q||s==m)){var v=l[u[s]].x,B=l[u[s]].y,E=void 0,H=void 0,K=void 0,I=void 0,y=void 0,C=void 0,G=void 0,L=void 0,J=void 0,M=void 0,F=void 0,N=void 0,E=K=y=void 0,E=z-w,H=x-A,K=t-z,I=p-x,y=w-t,C=A-p,G=v-t,L=B-p,J=v-w,M=B-A,F=v-z,N=B-x,E=E*M-H*J,y=y*L-C*G,K=K*N-I*F;if(E>=0&&K>=0&&y>=0){l=false;break a}}l=true}}if(l){e.push([a[g[j]],
+a[g[i]],a[g[k]]]);h.push([g[j],g[i],g[k]]);j=i;for(k=i+1;k<f;j++,k++)g[j]=g[k];f--;o=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||Math.PI*2;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=c/this.segmentsR*Math.PI*2;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(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,j=new THREE.Face4(f,e,g,h,[b[f],b[e],b[g],b[h]]);j.normal.addSelf(b[f]);j.normal.addSelf(b[e]);j.normal.addSelf(b[g]);j.normal.addSelf(b[h]);j.normal.normalize();this.faces.push(j);
 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*a;c=Math.cos(a);g=e*(2+c)*0.5*g;b=e*(2+c)*b*0.5;e=f*e*Math.sin(a)*0.5;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 j=a/this.segmentsR*2*this.p*Math.PI,g=b/this.segmentsT*2*Math.PI,e=h(j,g,this.q,this.p,this.radius,this.heightScale),j=h(j+0.01,g,this.q,this.p,this.radius,this.heightScale);c.sub(j,e);d.add(j,e);f.cross(c,d);d.cross(f,c);f.normalize();d.normalize();j=-this.tube*Math.cos(g);g=this.tube*Math.sin(g);e.x=e.x+(j*d.x+g*f.x);e.y=e.y+(j*d.y+g*f.y);e.z=e.z+(j*d.z+g*f.z);this.grid[a][b]=this.vertices.push(new THREE.Vertex(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),j=new THREE.UV((a+1)/this.segmentsR,b/this.segmentsT),i=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,j,i,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||false;if(e)this.debug=new THREE.Object3D;this.grid=[];var g,h,e=this.segments+1,j,i,k,q=new THREE.Vector3,l,n,r,b=new THREE.TubeGeometry.FrenetFrames(a,b,f);l=b.tangents;n=b.normals;r=b.binormals;this.tangents=l;this.normals=n;this.binormals=r;for(b=0;b<e;b++){this.grid[b]=[];d=b/(e-1);k=a.getPointAt(d);d=l[b];g=n[b];h=r[b];if(this.debug){this.debug.add(new THREE.ArrowHelper(d,
-k,c,255));this.debug.add(new THREE.ArrowHelper(g,k,c,16711680));this.debug.add(new THREE.ArrowHelper(h,k,c,65280))}for(d=0;d<this.segmentsRadius;d++){j=d/this.segmentsRadius*2*Math.PI;i=-this.radius*Math.cos(j);j=this.radius*Math.sin(j);q.copy(k);q.x=q.x+(i*g.x+j*h.x);q.y=q.y+(i*g.y+j*h.y);q.z=q.z+(i*g.z+j*h.z);this.grid[b][d]=this.vertices.push(new THREE.Vertex(q.x,q.y,q.z))-1}}for(b=0;b<this.segments;b++)for(d=0;d<this.segmentsRadius;d++){e=f?(b+1)%this.segments:b+1;q=(d+1)%this.segmentsRadius;
-a=this.grid[b][d];c=this.grid[e][d];e=this.grid[e][q];q=this.grid[b][q];l=new THREE.UV(b/this.segments,d/this.segmentsRadius);n=new THREE.UV((b+1)/this.segments,d/this.segmentsRadius);r=new THREE.UV((b+1)/this.segments,(d+1)/this.segmentsRadius);g=new THREE.UV(b/this.segments,(d+1)/this.segmentsRadius);this.faces.push(new THREE.Face4(a,c,e,q));this.faceVertexUvs[0].push([l,n,r,g])}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.TubeGeometry.prototype=new THREE.Geometry;
+Array(this.segmentsT);for(b=0;b<this.segmentsT;++b){var j=a/this.segmentsR*2*this.p*Math.PI,g=b/this.segmentsT*2*Math.PI,e=h(j,g,this.q,this.p,this.radius,this.heightScale),j=h(j+0.01,g,this.q,this.p,this.radius,this.heightScale);c.sub(j,e);d.add(j,e);f.cross(c,d);d.cross(f,c);f.normalize();d.normalize();j=-this.tube*Math.cos(g);g=this.tube*Math.sin(g);e.x=e.x+(j*d.x+g*f.x);e.y=e.y+(j*d.y+g*f.y);e.z=e.z+(j*d.z+g*f.z);this.grid[a][b]=this.vertices.push(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),j=new THREE.UV((a+1)/this.segmentsR,b/this.segmentsT),i=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,j,i,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||false;if(e)this.debug=new THREE.Object3D;this.grid=[];var g,h,e=this.segments+1,j,i,k,o=new THREE.Vector3,l,n,q,b=new THREE.TubeGeometry.FrenetFrames(a,b,f);l=b.tangents;n=b.normals;q=b.binormals;this.tangents=l;this.normals=n;this.binormals=q;for(b=0;b<e;b++){this.grid[b]=[];d=b/(e-1);k=a.getPointAt(d);d=l[b];g=n[b];h=q[b];if(this.debug){this.debug.add(new THREE.ArrowHelper(d,
+k,c,255));this.debug.add(new THREE.ArrowHelper(g,k,c,16711680));this.debug.add(new THREE.ArrowHelper(h,k,c,65280))}for(d=0;d<this.segmentsRadius;d++){j=d/this.segmentsRadius*2*Math.PI;i=-this.radius*Math.cos(j);j=this.radius*Math.sin(j);o.copy(k);o.x=o.x+(i*g.x+j*h.x);o.y=o.y+(i*g.y+j*h.y);o.z=o.z+(i*g.z+j*h.z);this.grid[b][d]=this.vertices.push(new THREE.Vector3(o.x,o.y,o.z))-1}}for(b=0;b<this.segments;b++)for(d=0;d<this.segmentsRadius;d++){e=f?(b+1)%this.segments:b+1;o=(d+1)%this.segmentsRadius;
+a=this.grid[b][d];c=this.grid[e][d];e=this.grid[e][o];o=this.grid[b][o];l=new THREE.UV(b/this.segments,d/this.segmentsRadius);n=new THREE.UV((b+1)/this.segments,d/this.segmentsRadius);q=new THREE.UV((b+1)/this.segments,(d+1)/this.segmentsRadius);g=new THREE.UV(b/this.segments,(d+1)/this.segmentsRadius);this.faces.push(new THREE.Face4(a,c,e,o));this.faceVertexUvs[0].push([l,n,q,g])}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.TubeGeometry.prototype=new THREE.Geometry;
 THREE.TubeGeometry.prototype.constructor=THREE.TubeGeometry;
-THREE.TubeGeometry.FrenetFrames=function(a,b,c){new THREE.Vector3;var d=new THREE.Vector3;new THREE.Vector3;var f=[],e=[],g=[],h=new THREE.Vector3,j=new THREE.Matrix4,b=b+1,i,k,q;this.tangents=f;this.normals=e;this.binormals=g;for(i=0;i<b;i++){k=i/(b-1);f[i]=a.getTangentAt(k);f[i].normalize()}e[0]=new THREE.Vector3;g[0]=new THREE.Vector3;a=Number.MAX_VALUE;i=Math.abs(f[0].x);k=Math.abs(f[0].y);q=Math.abs(f[0].z);if(i<=a){a=i;d.set(1,0,0)}if(k<=a){a=k;d.set(0,1,0)}q<=a&&d.set(0,0,1);h.cross(f[0],d).normalize();
+THREE.TubeGeometry.FrenetFrames=function(a,b,c){new THREE.Vector3;var d=new THREE.Vector3;new THREE.Vector3;var f=[],e=[],g=[],h=new THREE.Vector3,j=new THREE.Matrix4,b=b+1,i,k,o;this.tangents=f;this.normals=e;this.binormals=g;for(i=0;i<b;i++){k=i/(b-1);f[i]=a.getTangentAt(k);f[i].normalize()}e[0]=new THREE.Vector3;g[0]=new THREE.Vector3;a=Number.MAX_VALUE;i=Math.abs(f[0].x);k=Math.abs(f[0].y);o=Math.abs(f[0].z);if(i<=a){a=i;d.set(1,0,0)}if(k<=a){a=k;d.set(0,1,0)}o<=a&&d.set(0,0,1);h.cross(f[0],d).normalize();
 e[0].cross(f[0],h);g[0].cross(f[0],e[0]);for(i=1;i<b;i++){e[i]=e[i-1].clone();g[i]=g[i-1].clone();h.cross(f[i-1],f[i]);if(h.length()>1.0E-4){h.normalize();d=Math.acos(f[i-1].dot(f[i]));j.makeRotationAxis(h,d).multiplyVector3(e[i])}g[i].cross(f[i],e[i])}if(c){d=Math.acos(e[0].dot(e[b-1]));d=d/(b-1);f[0].dot(h.cross(e[0],e[b-1]))>0&&(d=-d);for(i=1;i<b;i++){j.makeRotationAxis(f[i],d*i).multiplyVector3(e[i]);g[i].cross(f[i],e[i])}}};
-THREE.PolyhedronGeometry=function(a,b,c,d){function f(a){var b=(new THREE.Vertex).copy(a.normalize());b.index=j.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){if(d<1){d=new THREE.Face3(a.index,b.index,c.index,[a.clone(),b.clone(),c.clone()]);d.centroid.addSelf(a).addSelf(b).addSelf(c).divideScalar(3);d.normal=d.centroid.clone().normalize();j.faces.push(d);d=Math.atan2(d.centroid.z,
--d.centroid.x);j.faceVertexUvs[0].push([h(a.uv,a,d),h(b.uv,b,d),h(c.uv,c,d)])}else{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){q[a.index]||(q[a.index]=[]);q[b.index]||(q[b.index]=[]);var c=q[a.index][b.index];c===void 0&&(q[a.index][b.index]=q[b.index][a.index]=c=f((new THREE.Vector3).add(a,b).divideScalar(2)));return c}function h(a,b,c){c<0&&a.u===1&&(a=new THREE.UV(a.u-1,a.v));b.x===0&&b.z===0&&(a=new THREE.UV(c/2/Math.PI+0.5,a.v));
-return a}THREE.Geometry.call(this);for(var c=c||1,d=d||0,j=this,i=0,k=a.length;i<k;i++)f(new THREE.Vector3(a[i][0],a[i][1],a[i][2]));for(var q=[],a=this.vertices,i=0,k=b.length;i<k;i++)e(a[b[i][0]],a[b[i][1]],a[b[i][2]],d);this.mergeVertices();i=0;for(k=this.vertices.length;i<k;i++)this.vertices[i].multiplyScalar(c);this.computeCentroids();this.boundingSphere={radius:c}};THREE.PolyhedronGeometry.prototype=new THREE.Geometry;THREE.PolyhedronGeometry.prototype.constructor=THREE.PolyhedronGeometry;
+THREE.PolyhedronGeometry=function(a,b,c,d){function f(a){var b=a.normalize().clone();b.index=j.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){if(d<1){d=new THREE.Face3(a.index,b.index,c.index,[a.clone(),b.clone(),c.clone()]);d.centroid.addSelf(a).addSelf(b).addSelf(c).divideScalar(3);d.normal=d.centroid.clone().normalize();j.faces.push(d);d=Math.atan2(d.centroid.z,-d.centroid.x);
+j.faceVertexUvs[0].push([h(a.uv,a,d),h(b.uv,b,d),h(c.uv,c,d)])}else{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){o[a.index]||(o[a.index]=[]);o[b.index]||(o[b.index]=[]);var c=o[a.index][b.index];c===void 0&&(o[a.index][b.index]=o[b.index][a.index]=c=f((new THREE.Vector3).add(a,b).divideScalar(2)));return c}function h(a,b,c){c<0&&a.u===1&&(a=new THREE.UV(a.u-1,a.v));b.x===0&&b.z===0&&(a=new THREE.UV(c/2/Math.PI+0.5,a.v));return a}THREE.Geometry.call(this);
+for(var c=c||1,d=d||0,j=this,i=0,k=a.length;i<k;i++)f(new THREE.Vector3(a[i][0],a[i][1],a[i][2]));for(var o=[],a=this.vertices,i=0,k=b.length;i<k;i++)e(a[b[i][0]],a[b[i][1]],a[b[i][2]],d);this.mergeVertices();i=0;for(k=this.vertices.length;i<k;i++)this.vertices[i].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(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);d===void 0&&(d=16776960);c===void 0&&(c=20);var f=new THREE.Geometry;f.vertices.push(new THREE.Vertex(0,0,0));f.vertices.push(new THREE.Vertex(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=
+THREE.AxisHelper=function(){THREE.Object3D.call(this);var a=new THREE.Geometry;a.vertices.push(new THREE.Vector3);a.vertices.push(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);d===void 0&&(d=16776960);c===void 0&&(c=20);var f=new THREE.Geometry;f.vertices.push(new THREE.Vector3(0,0,0));f.vertices.push(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).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);d.lineGeometry.colors.push(new THREE.Color(b));d.pointMap[a]===void 0&&(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",
+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.Vector3);d.lineGeometry.colors.push(new THREE.Color(b));d.pointMap[a]===void 0&&(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(a!==void 0){d=0;for(f=a.length;d<f;d++)b.lineGeometry.vertices[a[d]].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=true};THREE.CameraHelper.__projector=new THREE.Projector;THREE.CameraHelper.__v=new THREE.Vector3;THREE.CameraHelper.__c=new THREE.Camera;
 THREE.SubdivisionModifier=function(a){this.subdivisions=a===void 0?1:a;this.useOldVertexColors=false;this.supportUVs=true;this.debug=false};THREE.SubdivisionModifier.prototype.constructor=THREE.SubdivisionModifier;THREE.SubdivisionModifier.prototype.modify=function(a){for(var b=this.subdivisions;b-- >0;)this.smooth(a)};
-THREE.SubdivisionModifier.prototype.smooth=function(a){function b(){l.debug&&console.log.apply(console,arguments)}function c(){console&&console.log.apply(console,arguments)}function d(a,c,d,f,g,h,j){var i=new THREE.Face4(a,c,d,f,null,g.color,g.material);if(l.useOldVertexColors){i.vertexColors=[];for(var m,n,p,r=0;r<4;r++){p=h[r];m=new THREE.Color;m.setRGB(0,0,0);for(var o=0;o<p.length;o++){n=g.vertexColors[p[o]-1];m.r=m.r+n.r;m.g=m.g+n.g;m.b=m.b+n.b}m.r=m.r/p.length;m.g=m.g/p.length;m.b=m.b/p.length;
-i.vertexColors[r]=m}}k.push(i);if(l.supportUVs){g=[e(a,""),e(c,j),e(d,j),e(f,j)];g[0]?g[1]?g[2]?g[3]?q.push(g):b("d :( ",f+":"+j):b("c :( ",d+":"+j):b("b :( ",c+":"+j):b("a :( ",a+":"+j)}}function f(a,b){return Math.min(a,b)+"_"+Math.max(a,b)}function e(a,d){var e=a+":"+d,f=s[e];if(!f){a>=v&&a<v+r.length?b("face pt"):b("edge pt");c("warning, UV not found for",e);return null}return f}function g(a,b,d){var e=a+":"+b;e in s?c("dup vertexNo",a,"oldFaceNo",b,"value",d,"key",e,s[e]):s[e]=d}function h(a,
-b){J[a]===void 0&&(J[a]=[]);J[a].push(b)}function j(a,b,c){C[a]===void 0&&(C[a]={});C[a][b]=c}var i=[],k=[],q=[],l=this,n=a.vertices,r=a.faces,i=n.concat(),m=[],p={},t={},s={},v=n.length,o,x,y,z,u,w=a.faceVertexUvs[0],E;b("originalFaces, uvs, originalVerticesLength",r.length,w.length,v);if(l.supportUVs){o=0;for(x=w.length;o<x;o++){y=0;for(z=w[o].length;y<z;y++){E=r[o]["abcd".charAt(y)];g(E,o,w[o][y])}}}if(w.length==0)l.supportUVs=false;o=0;for(u in s)o++;if(!o){l.supportUVs=false;b("no uvs")}b("-- Original Faces + Vertices UVs completed",
-s,"vs",w.length);o=0;for(x=r.length;o<x;o++){u=r[o];m.push(u.centroid);i.push((new THREE.Vertex).copy(u.centroid));if(l.supportUVs){w=new THREE.UV;if(u instanceof THREE.Face3){w.u=e(u.a,o).u+e(u.b,o).u+e(u.c,o).u;w.v=e(u.a,o).v+e(u.b,o).v+e(u.c,o).v;w.u=w.u/3;w.v=w.v/3}else if(u instanceof THREE.Face4){w.u=e(u.a,o).u+e(u.b,o).u+e(u.c,o).u+e(u.d,o).u;w.v=e(u.a,o).v+e(u.b,o).v+e(u.c,o).v+e(u.d,o).v;w.u=w.u/4;w.v=w.v/4}g(v+o,"",w)}}b("-- added UVs for new Faces",s);x=function(a){function b(a,c){h[a]===
-void 0&&(h[a]=[]);h[a].push(c)}var c,d,e,g,h={};c=0;for(d=a.faces.length;c<d;c++){e=a.faces[c];if(e instanceof THREE.Face3){g=f(e.a,e.b);b(g,c);g=f(e.b,e.c);b(g,c);g=f(e.c,e.a);b(g,c)}else if(e instanceof THREE.Face4){g=f(e.a,e.b);b(g,c);g=f(e.b,e.c);b(g,c);g=f(e.c,e.d);b(g,c);g=f(e.d,e.a);b(g,c)}}return h}(a);E=0;var H,I,J={},C={};for(o in x){w=x[o];H=o.split("_");I=H[0];H=H[1];h(I,[I,H]);h(H,[I,H]);y=0;for(z=w.length;y<z;y++){u=w[y];j(I,u,o);j(H,u,o)}w.length<2&&(t[o]=true)}b("vertexEdgeMap",J,
-"vertexFaceMap",C);for(o in x){w=x[o];u=w[0];z=w[1];H=o.split("_");I=H[0];H=H[1];w=new THREE.Vector3;if(t[o]){w.addSelf(n[I]);w.addSelf(n[H]);w.multiplyScalar(0.5)}else{w.addSelf(m[u]);w.addSelf(m[z]);w.addSelf(n[I]);w.addSelf(n[H]);w.multiplyScalar(0.25)}p[o]=v+r.length+E;i.push((new THREE.Vertex).copy(w));E++;if(l.supportUVs){w=new THREE.UV;w.u=e(I,u).u+e(H,u).u;w.v=e(I,u).v+e(H,u).v;w.u=w.u/2;w.v=w.v/2;g(p[o],u,w);if(!t[o]){w=new THREE.UV;w.u=e(I,z).u+e(H,z).u;w.v=e(I,z).v+e(H,z).v;w.u=w.u/2;w.v=
-w.v/2;g(p[o],z,w)}}}b("-- Step 2 done");var A,B;z=["123","12","2","23"];H=["123","23","3","31"];var G=["123","31","1","12"],L=["1234","12","2","23"],K=["1234","23","3","34"],F=["1234","34","4","41"],M=["1234","41","1","12"];o=0;for(x=m.length;o<x;o++){u=r[o];w=v+o;if(u instanceof THREE.Face3){E=f(u.a,u.b);I=f(u.b,u.c);A=f(u.c,u.a);d(w,p[E],u.b,p[I],u,z,o);d(w,p[I],u.c,p[A],u,H,o);d(w,p[A],u.a,p[E],u,G,o)}else if(u instanceof THREE.Face4){E=f(u.a,u.b);I=f(u.b,u.c);A=f(u.c,u.d);B=f(u.d,u.a);d(w,p[E],
-u.b,p[I],u,L,o);d(w,p[I],u.c,p[A],u,K,o);d(w,p[A],u.d,p[B],u,F,o);d(w,p[B],u.a,p[E],u,M,o)}else b("face should be a face!",u)}p=new THREE.Vector3;u=new THREE.Vector3;o=0;for(x=n.length;o<x;o++)if(J[o]!==void 0){p.set(0,0,0);u.set(0,0,0);I=new THREE.Vector3(0,0,0);w=0;for(y in C[o]){p.addSelf(m[y]);w++}z=0;E=J[o].length;for(y=0;y<E;y++)t[f(J[o][y][0],J[o][y][1])]&&z++;if(z!=2){p.divideScalar(w);for(y=0;y<E;y++){w=J[o][y];w=n[w[0]].clone().addSelf(n[w[1]]).divideScalar(2);u.addSelf(w)}u.divideScalar(E);
-I.addSelf(n[o]);I.multiplyScalar(E-3);I.addSelf(p);I.addSelf(u.multiplyScalar(2));I.divideScalar(E);i[o]=I}}a.vertices=i;a.faces=k;a.faceVertexUvs[0]=q;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.SubdivisionModifier.prototype.smooth=function(a){function b(){l.debug&&console.log.apply(console,arguments)}function c(){console&&console.log.apply(console,arguments)}function d(a,c,d,f,g,h,j){var i=new THREE.Face4(a,c,d,f,null,g.color,g.material);if(l.useOldVertexColors){i.vertexColors=[];for(var m,n,q,r=0;r<4;r++){q=h[r];m=new THREE.Color;m.setRGB(0,0,0);for(var p=0;p<q.length;p++){n=g.vertexColors[q[p]-1];m.r=m.r+n.r;m.g=m.g+n.g;m.b=m.b+n.b}m.r=m.r/q.length;m.g=m.g/q.length;m.b=m.b/q.length;
+i.vertexColors[r]=m}}k.push(i);if(l.supportUVs){g=[e(a,""),e(c,j),e(d,j),e(f,j)];g[0]?g[1]?g[2]?g[3]?o.push(g):b("d :( ",f+":"+j):b("c :( ",d+":"+j):b("b :( ",c+":"+j):b("a :( ",a+":"+j)}}function f(a,b){return Math.min(a,b)+"_"+Math.max(a,b)}function e(a,d){var e=a+":"+d,f=s[e];if(!f){a>=t&&a<t+q.length?b("face pt"):b("edge pt");c("warning, UV not found for",e);return null}return f}function g(a,b,d){var e=a+":"+b;e in s?c("dup vertexNo",a,"oldFaceNo",b,"value",d,"key",e,s[e]):s[e]=d}function h(a,
+b){K[a]===void 0&&(K[a]=[]);K[a].push(b)}function j(a,b,c){I[a]===void 0&&(I[a]={});I[a][b]=c}var i=[],k=[],o=[],l=this,n=a.vertices,q=a.faces,i=n.concat(),m=[],r={},u={},s={},t=n.length,p,w,A,z,x,v=a.faceVertexUvs[0],B;b("originalFaces, uvs, originalVerticesLength",q.length,v.length,t);if(l.supportUVs){p=0;for(w=v.length;p<w;p++){A=0;for(z=v[p].length;A<z;A++){B=q[p]["abcd".charAt(A)];g(B,p,v[p][A])}}}if(v.length==0)l.supportUVs=false;p=0;for(x in s)p++;if(!p){l.supportUVs=false;b("no uvs")}b("-- Original Faces + Vertices UVs completed",
+s,"vs",v.length);p=0;for(w=q.length;p<w;p++){x=q[p];m.push(x.centroid);i.push(x.centroid.clone());if(l.supportUVs){v=new THREE.UV;if(x instanceof THREE.Face3){v.u=e(x.a,p).u+e(x.b,p).u+e(x.c,p).u;v.v=e(x.a,p).v+e(x.b,p).v+e(x.c,p).v;v.u=v.u/3;v.v=v.v/3}else if(x instanceof THREE.Face4){v.u=e(x.a,p).u+e(x.b,p).u+e(x.c,p).u+e(x.d,p).u;v.v=e(x.a,p).v+e(x.b,p).v+e(x.c,p).v+e(x.d,p).v;v.u=v.u/4;v.v=v.v/4}g(t+p,"",v)}}b("-- added UVs for new Faces",s);w=function(a){function b(a,c){h[a]===void 0&&(h[a]=
+[]);h[a].push(c)}var c,d,e,g,h={};c=0;for(d=a.faces.length;c<d;c++){e=a.faces[c];if(e instanceof THREE.Face3){g=f(e.a,e.b);b(g,c);g=f(e.b,e.c);b(g,c);g=f(e.c,e.a);b(g,c)}else if(e instanceof THREE.Face4){g=f(e.a,e.b);b(g,c);g=f(e.b,e.c);b(g,c);g=f(e.c,e.d);b(g,c);g=f(e.d,e.a);b(g,c)}}return h}(a);B=0;var E,H,K={},I={};for(p in w){v=w[p];E=p.split("_");H=E[0];E=E[1];h(H,[H,E]);h(E,[H,E]);A=0;for(z=v.length;A<z;A++){x=v[A];j(H,x,p);j(E,x,p)}v.length<2&&(u[p]=true)}b("vertexEdgeMap",K,"vertexFaceMap",
+I);for(p in w){v=w[p];x=v[0];z=v[1];E=p.split("_");H=E[0];E=E[1];v=new THREE.Vector3;if(u[p]){v.addSelf(n[H]);v.addSelf(n[E]);v.multiplyScalar(0.5)}else{v.addSelf(m[x]);v.addSelf(m[z]);v.addSelf(n[H]);v.addSelf(n[E]);v.multiplyScalar(0.25)}r[p]=t+q.length+B;i.push(v);B++;if(l.supportUVs){v=new THREE.UV;v.u=e(H,x).u+e(E,x).u;v.v=e(H,x).v+e(E,x).v;v.u=v.u/2;v.v=v.v/2;g(r[p],x,v);if(!u[p]){v=new THREE.UV;v.u=e(H,z).u+e(E,z).u;v.v=e(H,z).v+e(E,z).v;v.u=v.u/2;v.v=v.v/2;g(r[p],z,v)}}}b("-- Step 2 done");
+var y,C;z=["123","12","2","23"];E=["123","23","3","31"];var G=["123","31","1","12"],L=["1234","12","2","23"],J=["1234","23","3","34"],M=["1234","34","4","41"],F=["1234","41","1","12"];p=0;for(w=m.length;p<w;p++){x=q[p];v=t+p;if(x instanceof THREE.Face3){B=f(x.a,x.b);H=f(x.b,x.c);y=f(x.c,x.a);d(v,r[B],x.b,r[H],x,z,p);d(v,r[H],x.c,r[y],x,E,p);d(v,r[y],x.a,r[B],x,G,p)}else if(x instanceof THREE.Face4){B=f(x.a,x.b);H=f(x.b,x.c);y=f(x.c,x.d);C=f(x.d,x.a);d(v,r[B],x.b,r[H],x,L,p);d(v,r[H],x.c,r[y],x,J,
+p);d(v,r[y],x.d,r[C],x,M,p);d(v,r[C],x.a,r[B],x,F,p)}else b("face should be a face!",x)}r=new THREE.Vector3;x=new THREE.Vector3;p=0;for(w=n.length;p<w;p++)if(K[p]!==void 0){r.set(0,0,0);x.set(0,0,0);H=new THREE.Vector3(0,0,0);v=0;for(A in I[p]){r.addSelf(m[A]);v++}z=0;B=K[p].length;for(A=0;A<B;A++)u[f(K[p][A][0],K[p][A][1])]&&z++;if(z!=2){r.divideScalar(v);for(A=0;A<B;A++){v=K[p][A];v=n[v[0]].clone().addSelf(n[v[1]]).divideScalar(2);x.addSelf(v)}x.divideScalar(B);H.addSelf(n[p]);H.multiplyScalar(B-
+3);H.addSelf(r);H.addSelf(x.multiplyScalar(2));H.divideScalar(B);i[p]=H}}a.vertices=i;a.faces=k;a.faceVertexUvs[0]=o;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(a.length<1?".":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++){b=a.materials[c];if(b instanceof THREE.ShaderMaterial)return true}return false},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=true};e.crossOrigin=h.crossOrigin;e.src=b}function e(a,c,d,e,g,h){var j=document.createElement("canvas");a[c]=new THREE.Texture(j);a[c].sourceFile=
@@ -257,115 +257,116 @@ THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.const
 THREE.BinaryLoader.prototype.loadAjaxJSON=function(a,b,c,d,f,e){var g=new XMLHttpRequest;g.onreadystatechange=function(){if(g.readyState==4)if(g.status==200||g.status==0){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,true);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(){if(e.readyState==4)e.status==200||e.status==0?THREE.BinaryLoader.prototype.createBinModel(e.response,b,d,a.materials):console.error("THREE.BinaryLoader: Couldn't load ["+g+"] ["+e.status+"]");else if(e.readyState==3){if(f){h==0&&(h=e.getResponseHeader("Content-Length"));f({total:h,loaded:e.responseText.length})}}else e.readyState==2&&(h=e.getResponseHeader("Content-Length"))};
 e.open("GET",g,true);e.responseType="arraybuffer";e.send(null)};
-THREE.BinaryLoader.prototype.createBinModel=function(a,b,c,d){var f=function(b){var c,f,j,i,k,q,l,n,r,m,p,t,s,v,o;function x(a){return a%4?4-a%4:0}function y(a,b){return(new Uint8Array(a,b,1))[0]}function z(a,b){return(new Uint32Array(a,b,1))[0]}function u(b,c){var d,e,f,g,h,j,i,k,l=new Uint32Array(a,c,3*b);for(d=0;d<b;d++){e=l[d*3];f=l[d*3+1];g=l[d*3+2];h=G[e*2];e=G[e*2+1];j=G[f*2];i=G[f*2+1];f=G[g*2];k=G[g*2+1];g=C.faceVertexUvs[0];var m=[];m.push(new THREE.UV(h,e));m.push(new THREE.UV(j,i));m.push(new THREE.UV(f,
-k));g.push(m)}}function w(b,c){var d,e,f,g,h,j,i,k,m,l,q=new Uint32Array(a,c,4*b);for(d=0;d<b;d++){e=q[d*4];f=q[d*4+1];g=q[d*4+2];h=q[d*4+3];j=G[e*2];e=G[e*2+1];i=G[f*2];m=G[f*2+1];k=G[g*2];l=G[g*2+1];g=G[h*2];f=G[h*2+1];h=C.faceVertexUvs[0];var n=[];n.push(new THREE.UV(j,e));n.push(new THREE.UV(i,m));n.push(new THREE.UV(k,l));n.push(new THREE.UV(g,f));h.push(n)}}function E(b,c,d){for(var e,f,g,h,c=new Uint32Array(a,c,3*b),j=new Uint16Array(a,d,b),d=0;d<b;d++){e=c[d*3];f=c[d*3+1];g=c[d*3+2];h=j[d];
-C.faces.push(new THREE.Face3(e,f,g,null,null,h))}}function H(b,c,d){for(var e,f,g,h,j,c=new Uint32Array(a,c,4*b),i=new Uint16Array(a,d,b),d=0;d<b;d++){e=c[d*4];f=c[d*4+1];g=c[d*4+2];h=c[d*4+3];j=i[d];C.faces.push(new THREE.Face4(e,f,g,h,null,null,j))}}function I(b,c,d,e){for(var f,g,h,j,i,k,m,c=new Uint32Array(a,c,3*b),d=new Uint32Array(a,d,3*b),l=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[e*3];g=c[e*3+1];h=c[e*3+2];i=d[e*3];k=d[e*3+1];m=d[e*3+2];j=l[e];var q=B[k*3],n=B[k*3+1];k=B[k*3+2];var p=B[m*3],
-r=B[m*3+1];m=B[m*3+2];C.faces.push(new THREE.Face3(f,g,h,[new THREE.Vector3(B[i*3],B[i*3+1],B[i*3+2]),new THREE.Vector3(q,n,k),new THREE.Vector3(p,r,m)],null,j))}}function J(b,c,d,e){for(var f,g,h,j,i,k,m,l,q,c=new Uint32Array(a,c,4*b),d=new Uint32Array(a,d,4*b),n=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[e*4];g=c[e*4+1];h=c[e*4+2];j=c[e*4+3];k=d[e*4];m=d[e*4+1];l=d[e*4+2];q=d[e*4+3];i=n[e];var p=B[m*3],r=B[m*3+1];m=B[m*3+2];var o=B[l*3],t=B[l*3+1];l=B[l*3+2];var s=B[q*3],u=B[q*3+1];q=B[q*3+2];C.faces.push(new THREE.Face4(f,
-g,h,j,[new THREE.Vector3(B[k*3],B[k*3+1],B[k*3+2]),new THREE.Vector3(p,r,m),new THREE.Vector3(o,t,l),new THREE.Vector3(s,u,q)],null,i))}}var C=this,A=0,B=[],G=[],L,K,F;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(C,d,b);(function(a,b,c){for(var a=new Uint8Array(a,b,c),d="",e=0;e<c;e++)d=d+String.fromCharCode(a[b+e]);return d})(a,A,12);c=y(a,A+12);y(a,A+13);y(a,A+14);y(a,A+15);f=y(a,A+16);j=y(a,A+17);i=y(a,A+18);k=y(a,A+19);q=z(a,A+20);l=z(a,A+20+4);n=z(a,A+20+8);b=z(a,A+20+12);r=
-z(a,A+20+16);m=z(a,A+20+20);p=z(a,A+20+24);t=z(a,A+20+28);s=z(a,A+20+32);v=z(a,A+20+36);o=z(a,A+20+40);A=A+c;c=f*3+k;F=f*4+k;L=b*c;K=r*(c+j*3);f=m*(c+i*3);k=p*(c+j*3+i*3);c=t*F;j=s*(F+j*4);i=v*(F+i*4);A=A+function(b){var b=new Float32Array(a,b,q*3),c,d,e,f;for(c=0;c<q;c++){d=b[c*3];e=b[c*3+1];f=b[c*3+2];C.vertices.push(new THREE.Vertex(d,e,f))}return q*3*Float32Array.BYTES_PER_ELEMENT}(A);A=A+function(b){if(l){var b=new Int8Array(a,b,l*3),c,d,e,f;for(c=0;c<l;c++){d=b[c*3];e=b[c*3+1];f=b[c*3+2];B.push(d/
-127,e/127,f/127)}}return l*3*Int8Array.BYTES_PER_ELEMENT}(A);A=A+x(l*3);A=A+function(b){if(n){var b=new Float32Array(a,b,n*2),c,d,e;for(c=0;c<n;c++){d=b[c*2];e=b[c*2+1];G.push(d,e)}}return n*2*Float32Array.BYTES_PER_ELEMENT}(A);L=A+L+x(b*2);K=L+K+x(r*2);f=K+f+x(m*2);k=f+k+x(p*2);c=k+c+x(t*2);j=c+j+x(s*2);i=j+i+x(v*2);(function(a){if(m){var b=a+m*Uint32Array.BYTES_PER_ELEMENT*3;E(m,a,b+m*Uint32Array.BYTES_PER_ELEMENT*3);u(m,b)}})(K);(function(a){if(p){var b=a+p*Uint32Array.BYTES_PER_ELEMENT*3,c=b+
-p*Uint32Array.BYTES_PER_ELEMENT*3;I(p,a,b,c+p*Uint32Array.BYTES_PER_ELEMENT*3);u(p,c)}})(f);(function(a){if(v){var b=a+v*Uint32Array.BYTES_PER_ELEMENT*4;H(v,a,b+v*Uint32Array.BYTES_PER_ELEMENT*4);w(v,b)}})(j);(function(a){if(o){var b=a+o*Uint32Array.BYTES_PER_ELEMENT*4,c=b+o*Uint32Array.BYTES_PER_ELEMENT*4;J(o,a,b,c+o*Uint32Array.BYTES_PER_ELEMENT*4);w(o,c)}})(i);b&&E(b,A,A+b*Uint32Array.BYTES_PER_ELEMENT*3);(function(a){if(r){var b=a+r*Uint32Array.BYTES_PER_ELEMENT*3;I(r,a,b,b+r*Uint32Array.BYTES_PER_ELEMENT*
-3)}})(L);t&&H(t,k,k+t*Uint32Array.BYTES_PER_ELEMENT*4);(function(a){if(s){var b=a+s*Uint32Array.BYTES_PER_ELEMENT*4;J(s,a,b,b+s*Uint32Array.BYTES_PER_ELEMENT*4)}})(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.BinaryLoader.prototype.createBinModel=function(a,b,c,d){var f=function(b){var c,f,j,i,k,o,l,n,q,m,r,u,s,t,p;function w(a){return a%4?4-a%4:0}function A(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,j,i,k,m=new Uint32Array(a,c,3*b);for(d=0;d<b;d++){e=m[d*3];f=m[d*3+1];g=m[d*3+2];h=G[e*2];e=G[e*2+1];j=G[f*2];i=G[f*2+1];f=G[g*2];k=G[g*2+1];g=I.faceVertexUvs[0];var l=[];l.push(new THREE.UV(h,e));l.push(new THREE.UV(j,i));l.push(new THREE.UV(f,
+k));g.push(l)}}function v(b,c){var d,e,f,g,h,j,i,k,l,m,o=new Uint32Array(a,c,4*b);for(d=0;d<b;d++){e=o[d*4];f=o[d*4+1];g=o[d*4+2];h=o[d*4+3];j=G[e*2];e=G[e*2+1];i=G[f*2];l=G[f*2+1];k=G[g*2];m=G[g*2+1];g=G[h*2];f=G[h*2+1];h=I.faceVertexUvs[0];var n=[];n.push(new THREE.UV(j,e));n.push(new THREE.UV(i,l));n.push(new THREE.UV(k,m));n.push(new THREE.UV(g,f));h.push(n)}}function B(b,c,d){for(var e,f,g,h,c=new Uint32Array(a,c,3*b),j=new Uint16Array(a,d,b),d=0;d<b;d++){e=c[d*3];f=c[d*3+1];g=c[d*3+2];h=j[d];
+I.faces.push(new THREE.Face3(e,f,g,null,null,h))}}function E(b,c,d){for(var e,f,g,h,j,c=new Uint32Array(a,c,4*b),i=new Uint16Array(a,d,b),d=0;d<b;d++){e=c[d*4];f=c[d*4+1];g=c[d*4+2];h=c[d*4+3];j=i[d];I.faces.push(new THREE.Face4(e,f,g,h,null,null,j))}}function H(b,c,d,e){for(var f,g,h,j,i,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[e*3];g=c[e*3+1];h=c[e*3+2];i=d[e*3];k=d[e*3+1];l=d[e*3+2];j=m[e];var o=C[k*3],n=C[k*3+1];k=C[k*3+2];var q=C[l*3],
+r=C[l*3+1];l=C[l*3+2];I.faces.push(new THREE.Face3(f,g,h,[new THREE.Vector3(C[i*3],C[i*3+1],C[i*3+2]),new THREE.Vector3(o,n,k),new THREE.Vector3(q,r,l)],null,j))}}function K(b,c,d,e){for(var f,g,h,j,i,k,l,m,o,c=new Uint32Array(a,c,4*b),d=new Uint32Array(a,d,4*b),n=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[e*4];g=c[e*4+1];h=c[e*4+2];j=c[e*4+3];k=d[e*4];l=d[e*4+1];m=d[e*4+2];o=d[e*4+3];i=n[e];var q=C[l*3],r=C[l*3+1];l=C[l*3+2];var p=C[m*3],s=C[m*3+1];m=C[m*3+2];var u=C[o*3],t=C[o*3+1];o=C[o*3+2];I.faces.push(new THREE.Face4(f,
+g,h,j,[new THREE.Vector3(C[k*3],C[k*3+1],C[k*3+2]),new THREE.Vector3(q,r,l),new THREE.Vector3(p,s,m),new THREE.Vector3(u,t,o)],null,i))}}var I=this,y=0,C=[],G=[],L,J,M;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(I,d,b);(function(a,b,c){for(var a=new Uint8Array(a,b,c),d="",e=0;e<c;e++)d=d+String.fromCharCode(a[b+e]);return d})(a,y,12);c=A(a,y+12);A(a,y+13);A(a,y+14);A(a,y+15);f=A(a,y+16);j=A(a,y+17);i=A(a,y+18);k=A(a,y+19);o=z(a,y+20);l=z(a,y+20+4);n=z(a,y+20+8);b=z(a,y+20+12);q=
+z(a,y+20+16);m=z(a,y+20+20);r=z(a,y+20+24);u=z(a,y+20+28);s=z(a,y+20+32);t=z(a,y+20+36);p=z(a,y+20+40);y=y+c;c=f*3+k;M=f*4+k;L=b*c;J=q*(c+j*3);f=m*(c+i*3);k=r*(c+j*3+i*3);c=u*M;j=s*(M+j*4);i=t*(M+i*4);y=y+function(b){var b=new Float32Array(a,b,o*3),c,d,e,f;for(c=0;c<o;c++){d=b[c*3];e=b[c*3+1];f=b[c*3+2];I.vertices.push(new THREE.Vector3(d,e,f))}return o*3*Float32Array.BYTES_PER_ELEMENT}(y);y=y+function(b){if(l){var b=new Int8Array(a,b,l*3),c,d,e,f;for(c=0;c<l;c++){d=b[c*3];e=b[c*3+1];f=b[c*3+2];C.push(d/
+127,e/127,f/127)}}return l*3*Int8Array.BYTES_PER_ELEMENT}(y);y=y+w(l*3);y=y+function(b){if(n){var b=new Float32Array(a,b,n*2),c,d,e;for(c=0;c<n;c++){d=b[c*2];e=b[c*2+1];G.push(d,e)}}return n*2*Float32Array.BYTES_PER_ELEMENT}(y);L=y+L+w(b*2);J=L+J+w(q*2);f=J+f+w(m*2);k=f+k+w(r*2);c=k+c+w(u*2);j=c+j+w(s*2);i=j+i+w(t*2);(function(a){if(m){var b=a+m*Uint32Array.BYTES_PER_ELEMENT*3;B(m,a,b+m*Uint32Array.BYTES_PER_ELEMENT*3);x(m,b)}})(J);(function(a){if(r){var b=a+r*Uint32Array.BYTES_PER_ELEMENT*3,c=b+
+r*Uint32Array.BYTES_PER_ELEMENT*3;H(r,a,b,c+r*Uint32Array.BYTES_PER_ELEMENT*3);x(r,c)}})(f);(function(a){if(t){var b=a+t*Uint32Array.BYTES_PER_ELEMENT*4;E(t,a,b+t*Uint32Array.BYTES_PER_ELEMENT*4);v(t,b)}})(j);(function(a){if(p){var b=a+p*Uint32Array.BYTES_PER_ELEMENT*4,c=b+p*Uint32Array.BYTES_PER_ELEMENT*4;K(p,a,b,c+p*Uint32Array.BYTES_PER_ELEMENT*4);v(p,c)}})(i);b&&B(b,y,y+b*Uint32Array.BYTES_PER_ELEMENT*3);(function(a){if(q){var b=a+q*Uint32Array.BYTES_PER_ELEMENT*3;H(q,a,b,b+q*Uint32Array.BYTES_PER_ELEMENT*
+3)}})(L);u&&E(u,k,k+u*Uint32Array.BYTES_PER_ELEMENT*4);(function(a){if(s){var b=a+s*Uint32Array.BYTES_PER_ELEMENT*4;K(s,a,b,b+s*Uint32Array.BYTES_PER_ELEMENT*4)}})(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||na;if(f!==void 0){a=f.split("/");a.pop();oa=(a.length<1?".":a.join("/"))+"/"}if((a=Q.evaluate("//dae:asset",Q,N,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&a.childNodes)for(f=0;f<a.childNodes.length;f++){var j=a.childNodes[f];switch(j.nodeName){case "unit":(j=j.getAttribute("meter"))&&parseFloat(j);break;case "up_axis":ba=j.textContent.charAt(0)}}if(!R.convertUpAxis||ba===R.upAxis)X=null;else switch(ba){case "X":X=R.upAxis===
-"Y"?"XtoY":"XtoZ";break;case "Y":X=R.upAxis==="X"?"YtoX":"YtoZ";break;case "Z":X=R.upAxis==="X"?"ZtoX":"ZtoY"}aa=b("//dae:library_images/dae:image",g,"image");ga=b("//dae:library_materials/dae:material",w,"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",F,"camera");V=b("//dae:library_controllers/dae:controller",h,"controller");Y=b("//dae:library_animations/dae:animation",B,"animation");
+"Y"?"XtoY":"XtoZ";break;case "Y":X=R.upAxis==="X"?"YtoX":"YtoZ";break;case "Z":X=R.upAxis==="X"?"ZtoX":"ZtoY"}aa=b("//dae:library_images/dae:image",g,"image");ga=b("//dae:library_materials/dae:material",v,"material");ha=b("//dae:library_effects/dae:effect",I,"effect");W=b("//dae:library_geometries/dae:geometry",r,"geometry");ia=b(".//dae:library_cameras/dae:camera",M,"camera");V=b("//dae:library_controllers/dae:controller",h,"controller");Y=b("//dae:library_animations/dae:animation",C,"animation");
 ja=b(".//dae:library_visual_scenes/dae:visual_scene",k,"visual_scene");ca=[];da=[];if(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[a.length>0?a:"visual_scene0"]}else U=null;$=new THREE.Object3D;for(a=0;a<U.nodes.length;a++)$.add(e(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={},e=a.iterateNext(),f=0;e;){e=(new b).parse(e);if(!e.id||e.id.length==0)e.id=c+f++;d[e.id]=e;e=a.iterateNext()}return d}function c(a){var b=U.getChildById(a.name,true),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 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=V[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 j=Y[e],i=0;i<j.sampler.length;i++){var k=j.sampler[i];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=U.getChildById(b.skeleton[0],true)||U.getChildBySid(b.skeleton[0],true),m,l,g=new THREE.Vector3,q,i=0;i<a.vertices.length;i++)f.skin.bindShapeMatrix.multiplyVector3(a.vertices[i]);
-for(c=0;c<e;c++){h=[];j=[];for(i=0;i<a.vertices.length;i++)j.push(new THREE.Vertex);d(b,h,c);i=h;k=f.skin;for(l=0;l<i.length;l++){m=i[l];q=-1;if(m.type=="JOINT"){for(var n=0;n<k.joints.length;n++)if(m.sid==k.joints[n]){q=n;break}if(q>=0){n=k.invBindMatrices[q];m.invBindMatrix=n;m.skinningMatrix=new THREE.Matrix4;m.skinningMatrix.multiply(m.world,n);m.weights=[];for(n=0;n<k.weights.length;n++)for(var p=0;p<k.weights[n].length;p++){var r=k.weights[n][p];r.joint==q&&m.weights.push(r)}}else throw"ColladaLoader: Could not find joint '"+
-m.sid+"'.";}}for(i=0;i<h.length;i++)if(h[i].type=="JOINT")for(k=0;k<h[i].weights.length;k++){m=h[i].weights[k];l=m.index;m=m.weight;q=a.vertices[l];l=j[l];g.x=q.x;g.y=q.y;g.z=q.z;h[i].skinningMatrix.multiplyVector3(g);l.x=l.x+g.x*m;l.y=l.y+g.y*m;l.z=l.z+g.z*m}a.morphTargets.push({name:"target_"+c,vertices:j})}}}function e(a){var b=new THREE.Object3D,c,d,g,h;for(g=0;g<a.controllers.length;g++){var j=V[a.controllers[g].url];switch(j.type){case "skin":if(W[j.skin.source]){var i=new m;i.url=j.skin.source;
+!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 j=Y[e],i=0;i<j.sampler.length;i++){var k=j.sampler[i];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=U.getChildById(b.skeleton[0],true)||U.getChildBySid(b.skeleton[0],true),l,m,g=new THREE.Vector3,o,i=0;i<a.vertices.length;i++)f.skin.bindShapeMatrix.multiplyVector3(a.vertices[i]);
+for(c=0;c<e;c++){h=[];j=[];for(i=0;i<a.vertices.length;i++)j.push(new THREE.Vector3);d(b,h,c);i=h;k=f.skin;for(m=0;m<i.length;m++){l=i[m];o=-1;if(l.type=="JOINT"){for(var n=0;n<k.joints.length;n++)if(l.sid==k.joints[n]){o=n;break}if(o>=0){n=k.invBindMatrices[o];l.invBindMatrix=n;l.skinningMatrix=new THREE.Matrix4;l.skinningMatrix.multiply(l.world,n);l.weights=[];for(n=0;n<k.weights.length;n++)for(var q=0;q<k.weights[n].length;q++){var r=k.weights[n][q];r.joint==o&&l.weights.push(r)}}else throw"ColladaLoader: Could not find joint '"+
+l.sid+"'.";}}for(i=0;i<h.length;i++)if(h[i].type=="JOINT")for(k=0;k<h[i].weights.length;k++){l=h[i].weights[k];m=l.index;l=l.weight;o=a.vertices[m];m=j[m];g.x=o.x;g.y=o.y;g.z=o.z;h[i].skinningMatrix.multiplyVector3(g);m.x=m.x+g.x*l;m.y=m.y+g.y*l;m.z=m.z+g.z*l}a.morphTargets.push({name:"target_"+c,vertices:j})}}}function e(a){var b=new THREE.Object3D,c,d,g,h;for(g=0;g<a.controllers.length;g++){var j=V[a.controllers[g].url];switch(j.type){case "skin":if(W[j.skin.source]){var i=new m;i.url=j.skin.source;
 i.instance_material=a.controllers[g].instance_material;a.geometries.push(i);c=a.controllers[g]}else if(V[j.skin.source]){d=j=V[j.skin.source];if(j.morph&&W[j.morph.source]){i=new m;i.url=j.morph.source;i.instance_material=a.controllers[g].instance_material;a.geometries.push(i)}}break;case "morph":if(W[j.morph.source]){i=new m;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=W[j.url],k={},l=[],q=0,p;if(j&&j.mesh&&j.mesh.primitives){if(b.name.length==0)b.name=j.id;if(i)for(h=0;h<i.length;h++){p=i[h];var r=ga[p.target],o=ha[r.instance_effect.url].shader;o.material.opacity=!o.material.opacity?1:o.material.opacity;k[p.symbol]=q;l.push(o.material);p=o.material;p.name=r.name==null||r.name===""?r.id:r.name;q++}i=p||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});j=j.mesh.geometry3js;
-if(q>1){i=new THREE.MeshFaceMaterial;j.materials=l;for(h=0;h<j.faces.length;h++){l=j.faces[h];l.materialIndex=k[l.daeMaterial]}}if(c!==void 0){f(j,c);i.morphTargets=true;i=new THREE.SkinnedMesh(j,i);i.skeleton=c.skeleton;i.skinController=V[c.url];i.skinInstanceController=c;i.name="skin_"+da.length;da.push(i)}else if(d!==void 0){h=j;k=d instanceof n?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++){q=W[k.targets[l]];if(q.mesh&&
-q.mesh.primitives&&q.mesh.primitives.length){q=q.mesh.primitives[0].geometry;q.vertices.length===h.vertices.length&&h.morphTargets.push({name:"target_1",vertices:q.vertices})}}h.morphTargets.push({name:"target_Z",vertices:h.vertices})}i.morphTargets=true;i=new THREE.Mesh(j,i);i.name="morph_"+ca.length;ca.push(i)}else i=new THREE.Mesh(j,i);a.geometries.length>1?b.add(i):b=i}}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=
+0;g<a.geometries.length;g++){var j=a.geometries[g],i=j.instance_material,j=W[j.url],k={},l=[],o=0,q;if(j&&j.mesh&&j.mesh.primitives){if(b.name.length==0)b.name=j.id;if(i)for(h=0;h<i.length;h++){q=i[h];var r=ga[q.target],p=ha[r.instance_effect.url].shader;p.material.opacity=!p.material.opacity?1:p.material.opacity;k[q.symbol]=o;l.push(p.material);q=p.material;q.name=r.name==null||r.name===""?r.id:r.name;o++}i=q||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});j=j.mesh.geometry3js;
+if(o>1){i=new THREE.MeshFaceMaterial;j.materials=l;for(h=0;h<j.faces.length;h++){l=j.faces[h];l.materialIndex=k[l.daeMaterial]}}if(c!==void 0){f(j,c);i.morphTargets=true;i=new THREE.SkinnedMesh(j,i);i.skeleton=c.skeleton;i.skinController=V[c.url];i.skinInstanceController=c;i.name="skin_"+da.length;da.push(i)}else if(d!==void 0){h=j;k=d instanceof n?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++){o=W[k.targets[l]];if(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})}i.morphTargets=true;i=new THREE.Mesh(j,i);i.name="morph_"+ca.length;ca.push(i)}else i=new THREE.Mesh(j,i);a.geometries.length>1?b.add(i):b=i}}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=true;b.scale=g[2];if(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 j(){this.weights=this.targets=this.source=this.method=
-null}function i(){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 q(){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 n(){this.url="";this.skeleton=[];this.instance_material=[]}function r(){this.target=
-this.symbol=""}function m(){this.url="";this.instance_material=[]}function p(){this.id="";this.mesh=null}function t(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function s(){this.material="";this.count=0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function v(){s.call(this);this.vcount=[]}function o(){s.call(this);this.vcount=3}function x(){this.source="";this.stride=this.count=0;this.params=[]}function y(){this.input={}}function z(){this.semantic=
-"";this.offset=0;this.source="";this.set=0}function u(a){this.id=a;this.type=null}function w(){this.name=this.id="";this.instance_effect=null}function E(){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 I(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 C(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function A(){this.url=""}function B(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function G(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 K(a){this.targets=[];this.time=a}function F(){this.technique=this.name=this.id=""}function M(){this.url=""}function N(a){return a=="dae"?"http://www.collada.org/2005/11/COLLADASchema":null}function D(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 a.length>0?a.replace(/^\s+/,"").replace(/\s+$/,"").split(/\s+/):[]}function S(a,b,c){return a.hasAttribute(b)?
+null}function i(){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 n(){this.url="";this.skeleton=[];this.instance_material=[]}function q(){this.target=
+this.symbol=""}function m(){this.url="";this.instance_material=[]}function r(){this.id="";this.mesh=null}function u(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function s(){this.material="";this.count=0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function t(){s.call(this);this.vcount=[]}function p(){s.call(this);this.vcount=3}function w(){this.source="";this.stride=this.count=0;this.params=[]}function A(){this.input={}}function z(){this.semantic=
+"";this.offset=0;this.source="";this.set=0}function x(a){this.id=a;this.type=null}function v(){this.name=this.id="";this.instance_effect=null}function B(){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 E(a,b){this.type=a;this.effect=b;this.material=null}function H(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 I(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function y(){this.url=""}function C(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function G(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 J(a){this.targets=[];this.time=a}function M(){this.technique=this.name=this.id=""}function F(){this.url=""}function N(a){return a=="dae"?"http://www.collada.org/2005/11/COLLADASchema":null}function D(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 a.length>0?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])}function ma(a){if(R.convertUpAxis)switch(a){case "X":switch(X){case "XtoY":case "XtoZ":case "YtoX":a="Y";break;case "ZtoX":a="Z"}break;case "Y":switch(X){case "XtoY":case "YtoX":case "ZtoX":a="X";break;case "XtoZ":case "YtoZ":case "ZtoY":a="Z"}break;case "Z":switch(X){case "XtoZ":a="X";break;case "YtoZ":case "ZtoX":case "ZtoY":a="Y"}}return a}var Q=null,$=null,U,na=null,Z={},aa={},Y={},V={},W={},ga={},ha={},ia={},ka,ja,oa,ca,da,pa=THREE.SmoothShading,R={centerGeometry:false,convertUpAxis:false,
 subdivideFaces:true,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(c.nodeName=="init_from")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 i).parse(c);this.type=c.nodeName;break;
-case "morph":this.morph=(new j).parse(c);this.type=c.nodeName}}return this};j.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(e.nodeType==1)switch(e.nodeName){case "source":e=(new u).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++){a=c[d];e=b[a.source];switch(a.semantic){case "MORPH_TARGET":this.targets=
+case "morph":this.morph=(new j).parse(c);this.type=c.nodeName}}return this};j.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(e.nodeType==1)switch(e.nodeName){case "source":e=(new x).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++){a=c[d];e=b[a.source];switch(a.semantic){case "MORPH_TARGET":this.targets=
 e.read();break;case "MORPH_WEIGHT":this.weights=e.read()}}return this};j.prototype.parseInputs=function(a){for(var b=[],c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "input":b.push((new z).parse(d))}}return b};i.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(f.nodeType==1)switch(f.nodeName){case "bind_shape_matrix":f=
-D(f.textContent);this.bindShapeMatrix=fa(f);break;case "source":f=(new u).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};i.prototype.parseJoints=function(a,b){for(var c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "input":var d=(new z).parse(d),e=b[d.source];if(d.semantic=="JOINT")this.joints=e.read();else if(d.semantic=="INV_BIND_MATRIX")this.invBindMatrices=
-e.read()}}};i.prototype.parseWeights=function(a,b){for(var c,d,e=[],f=0;f<a.childNodes.length;f++){var g=a.childNodes[f];if(g.nodeType==1)switch(g.nodeName){case "input":e.push((new z).parse(g));break;case "v":c=T(g.textContent);break;case "vcount":d=T(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],q=c[g+m.offset];switch(m.semantic){case "JOINT":k.joint=q;break;case "WEIGHT":k.weight=b[m.source].data[q]}}i.push(k);g=g+e.length}for(j=
+D(f.textContent);this.bindShapeMatrix=fa(f);break;case "source":f=(new x).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};i.prototype.parseJoints=function(a,b){for(var c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "input":var d=(new z).parse(d),e=b[d.source];if(d.semantic=="JOINT")this.joints=e.read();else if(d.semantic=="INV_BIND_MATRIX")this.invBindMatrices=
+e.read()}}};i.prototype.parseWeights=function(a,b){for(var c,d,e=[],f=0;f<a.childNodes.length;f++){var g=a.childNodes[f];if(g.nodeType==1)switch(g.nodeName){case "input":e.push((new z).parse(g));break;case "v":c=T(g.textContent);break;case "vcount":d=T(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],o=c[g+m.offset];switch(m.semantic){case "JOINT":k.joint=o;break;case "WEIGHT":k.weight=b[m.source].data[o]}}i.push(k);g=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(c.nodeType==1)switch(c.nodeName){case "node":this.nodes.push((new q).parse(c))}}return this};q.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=e.indexOf(".")>=0,g=e.indexOf("(")>=0,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){c.info={sid:e,dotSyntax:f,arrSyntax:g,arrIndices:h};return c}}return null};
-q.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};q.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};q.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};q.prototype.parse=
-function(a){var b;this.id=a.getAttribute("id");this.sid=a.getAttribute("sid");this.name=a.getAttribute("name");this.type=a.getAttribute("type");this.type=this.type=="JOINT"?this.type:"NODE";this.nodes=[];this.transforms=[];this.geometries=[];this.cameras=[];this.controllers=[];this.matrix=new THREE.Matrix4;for(var c=0;c<a.childNodes.length;c++){b=a.childNodes[c];if(b.nodeType==1)switch(b.nodeName){case "node":this.nodes.push((new q).parse(b));break;case "instance_camera":this.cameras.push((new M).parse(b));
-break;case "instance_controller":this.controllers.push((new n).parse(b));break;case "instance_geometry":this.geometries.push((new m).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 q).parse(b));break;case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new l).parse(b));
+if(c.nodeType==1)switch(c.nodeName){case "node":this.nodes.push((new o).parse(c))}}return this};o.prototype.getChannelForTransform=function(a){for(var b=0;b<this.channels.length;b++){var c=this.channels[b],d=c.target.split("/");d.shift();var e=d.shift(),f=e.indexOf(".")>=0,g=e.indexOf("(")>=0,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){c.info={sid:e,dotSyntax:f,arrSyntax:g,arrIndices:h};return 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=this.type=="JOINT"?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++){b=a.childNodes[c];if(b.nodeType==1)switch(b.nodeName){case "node":this.nodes.push((new o).parse(b));break;case "instance_camera":this.cameras.push((new F).parse(b));
+break;case "instance_controller":this.controllers.push((new n).parse(b));break;case "instance_geometry":this.geometries.push((new m).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 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++){var j=this.channels[c],f=j.fullSid,g=j.sampler,h=g.input,i=this.getTransformBySid(j.sid),
-k;if(j.arrIndices){k=[];b=0;for(var p=j.arrIndices.length;b<p;b++){var r=k,o=b,t=j.arrIndices[b];if(t>-1&&t<3){t=ma(["X","Y","Z"][t]);t={X:0,Y:1,Z:2}[t]}r[o]=t}}else k=ma(j.member);if(i){a.indexOf(f)===-1&&a.push(f);b=0;for(p=h.length;b<p;b++){for(var r=h[b],j=g.getData(i.type,b),o=null,t=0,s=d.length;t<s&&o==null;t++){var u=d[t];if(u.time===r)o=u;else if(u.time>r)break}if(!o){o=new K(r);t=-1;s=0;for(u=d.length;s<u&&t==-1;s++)d[s].time>=r&&(t=s);r=t;d.splice(r==-1?d.length:r,0,o)}o.addTarget(f,i,
-k,j)}}else console.log('Could not find transform "'+j.sid+'" in node '+this.id)}for(c=0;c<a.length;c++){e=a[c];for(b=0;b<d.length;b++){o=d[b];if(!o.hasTarget(e)){h=d;f=o;k=b;g=e;i=void 0;a:{i=k?k-1:0;for(i=i>=0?i:i+h.length;i>=0;i--){p=h[i];if(p.hasTarget(g)){i=p;break a}}i=null}p=void 0;a:{for(k=k+1;k<h.length;k++){p=h[k];if(p.hasTarget(g))break a}p=null}if(i&&p){h=(f.time-i.time)/(p.time-i.time);i=i.getTarget(g);k=p.getTarget(g).data;p=i.data;j=void 0;if(i.type==="matrix")j=p;else if(p.length){j=
-[];for(r=0;r<p.length;++r)j[r]=p[r]+(k[r]-p[r])*h}else j=p+(k-p)*h;f.addTarget(g,i.transform,i.member,j)}}}}this.keys=d;this.sids=a}this.updateMatrix();return this};q.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=D(a.textContent);this.convert();return this};l.prototype.convert=function(){switch(this.type){case "matrix":this.obj=
+k;if(j.arrIndices){k=[];b=0;for(var q=j.arrIndices.length;b<q;b++){var r=k,p=b,s=j.arrIndices[b];if(s>-1&&s<3){s=ma(["X","Y","Z"][s]);s={X:0,Y:1,Z:2}[s]}r[p]=s}}else k=ma(j.member);if(i){a.indexOf(f)===-1&&a.push(f);b=0;for(q=h.length;b<q;b++){for(var r=h[b],j=g.getData(i.type,b),p=null,s=0,u=d.length;s<u&&p==null;s++){var t=d[s];if(t.time===r)p=t;else if(t.time>r)break}if(!p){p=new J(r);s=-1;u=0;for(t=d.length;u<t&&s==-1;u++)d[u].time>=r&&(s=u);r=s;d.splice(r==-1?d.length:r,0,p)}p.addTarget(f,i,
+k,j)}}else console.log('Could not find transform "'+j.sid+'" in node '+this.id)}for(c=0;c<a.length;c++){e=a[c];for(b=0;b<d.length;b++){p=d[b];if(!p.hasTarget(e)){h=d;f=p;k=b;g=e;i=void 0;a:{i=k?k-1:0;for(i=i>=0?i:i+h.length;i>=0;i--){q=h[i];if(q.hasTarget(g)){i=q;break a}}i=null}q=void 0;a:{for(k=k+1;k<h.length;k++){q=h[k];if(q.hasTarget(g))break a}q=null}if(i&&q){h=(f.time-i.time)/(q.time-i.time);i=i.getTarget(g);k=q.getTarget(g).data;q=i.data;j=void 0;if(i.type==="matrix")j=q;else if(q.length){j=
+[];for(r=0;r<q.length;++r)j[r]=q[r]+(k[r]-q[r])*h}else j=q+(k-q)*h;f.addTarget(g,i.transform,i.member,j)}}}}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=D(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){var c=["X","Y","Z","ANGLE"];switch(this.type){case "matrix":if(b)if(b.length===1)switch(b[0]){case 0:this.obj.n11=a[0];this.obj.n21=a[1];this.obj.n31=a[2];this.obj.n41=a[3];break;case 1:this.obj.n12=a[0];this.obj.n22=a[1];this.obj.n32=a[2];this.obj.n42=a[3];break;case 2:this.obj.n13=a[0];this.obj.n23=a[1];this.obj.n33=a[2];this.obj.n43=a[3];break;case 3:this.obj.n14=a[0];this.obj.n24=a[1];this.obj.n34=a[2];this.obj.n44=
 a[3]}else b.length===2?this.obj["n"+(b[0]+1)+(b[1]+1)]=a:console.log("Incorrect addressing of matrix in transform.");else this.obj.copy(a);break;case "translate":case "scale":Object.prototype.toString.call(b)==="[object Array]"&&(b=c[b[0]]);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":Object.prototype.toString.call(b)==="[object Array]"&&(b=c[b[0]]);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}}};n.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.skeleton=[];this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "skeleton":this.skeleton.push(c.textContent.replace(/^#/,""));break;case "bind_material":if(c=Q.evaluate(".//dae:instance_material",
-c,N,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};m.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1&&c.nodeName=="bind_material"){if(a=
-Q.evaluate(".//dae:instance_material",c,N,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};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 t(this)).parse(c)}}return this};t.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");Z[d]==void 0&&(Z[d]=(new u(d)).parse(c));break;case "vertices":this.vertices=(new y).parse(c);break;case "triangles":this.primitives.push((new o).parse(c));break;case "polygons":this.primitives.push((new s).parse(c));break;case "polylist":this.primitives.push((new v).parse(c))}}this.geometry3js=new THREE.Geometry;a=Z[this.vertices.input.POSITION.source].data;for(b=0;b<a.length;b=b+3)this.geometry3js.vertices.push((new THREE.Vertex).copy(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();if(this.geometry3js.calcNormals){this.geometry3js.computeVertexNormals();delete this.geometry3js.calcNormals}this.geometry3js.computeBoundingBox();return this};t.prototype.handlePrimitive=function(a,b){var c,d,e=a.p,f=a.inputs,g,h,i,j,k=0,l=3,m=0,q=[];for(c=0;c<f.length;c++){g=f[c];l=g.offset+
-1;m=m<l?l:m;switch(g.semantic){case "TEXCOORD":q.push(g.set)}}for(var n=0;n<e.length;++n)for(var p=e[n],r=0;r<p.length;){var o=[],t=[],s={},u=[],l=a.vcount?a.vcount.length?a.vcount[k++]:a.vcount:p.length/m;for(c=0;c<l;c++)for(d=0;d<f.length;d++){g=f[d];j=Z[g.source];h=p[r+c*m+g.offset];i=j.accessor.params.length;i=h*i;switch(g.semantic){case "VERTEX":o.push(h);break;case "NORMAL":t.push(ea(j.data,i));break;case "TEXCOORD":s[g.set]===void 0&&(s[g.set]=[]);s[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(t.length==0)if(g=this.vertices.input.NORMAL){j=Z[g.source];i=j.accessor.params.length;g=0;for(h=o.length;g<h;g++)t.push(ea(j.data,o[g]*i))}else b.calcNormals=true;if(l===3)c.push(new THREE.Face3(o[0],o[1],o[2],t,u.length?u:new THREE.Color));else if(l===4)c.push(new THREE.Face4(o[0],o[1],o[2],o[3],t,u.length?u:new THREE.Color));else if(l>4&&R.subdivideFaces){u=u.length?u:new THREE.Color;for(d=
-1;d<l-1;)c.push(new THREE.Face3(o[0],o[d],o[d+1],[t[0],t[d++],t[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<q.length;d++){o=s[q[d]];o=l>4?[o[0],o[g+1],o[g+2]]:l===4?[o[0],o[1],o[2],o[3]]:[o[0],o[1],o[2]];b.faceVertexUvs[d]||(b.faceVertexUvs[d]=[]);b.faceVertexUvs[d].push(o)}}}else console.log("dropped face with vcount "+l+" for geometry with id: "+b.id);r=r+m*l}};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.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};v.prototype=new s;v.prototype.constructor=
-v;o.prototype=new s;o.prototype.constructor=o;x.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(c.nodeName=="param"){var d={};d.name=c.getAttribute("name");d.type=c.getAttribute("type");this.params.push(d)}}return this};y.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++)if(a.childNodes[b].nodeName=="input"){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(this.semantic=="TEXCOORD"&&this.set<0)this.set=0;return this};u.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),e=[],f=
-0,g=d.length;f<g;f++)e.push(d[f]=="true"||d[f]=="1"?true:false);this.data=e;this.type=c.nodeName;break;case "float_array":this.data=D(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(c.childNodes[d].nodeName=="accessor"){this.accessor=(new x).parse(c.childNodes[d]);break}}}return this};
-u.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=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};w.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");for(var b=0;b<a.childNodes.length;b++)if(a.childNodes[b].nodeName==
-"instance_effect"){this.instance_effect=(new A).parse(a.childNodes[b]);break}return this};E.prototype.isColor=function(){return this.texture==null};E.prototype.isTexture=function(){return this.texture!=null};E.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "color":c=D(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};E.prototype.parseTexture=function(a){if(!a.childNodes)return this;if(a.childNodes[1]&&a.childNodes[1].nodeName==="extra"){a=a.childNodes[1];a.childNodes[1]&&a.childNodes[1].nodeName==="technique"&&(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(c.nodeType==1)switch(c.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[c.nodeName]=(new E).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 e=d.iterateNext(),f=[];e;){f.push(e);e=d.iterateNext()}d=f;d.length>0&&(this[c.nodeName]=parseFloat(d[0].textContent))}}this.create();return this};H.prototype.create=function(){var a={},b=this.transparency!==void 0&&this.transparency<1,c;for(c in this)switch(c){case "ambient":case "emission":case "diffuse":case "specular":var d=this[c];if(d instanceof E)if(d.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==
-this.effect.surface.sid){var e=aa[this.effect.surface.init_from];if(e){e=THREE.ImageUtils.loadTexture(oa+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;c=="emission"&&(a.emissive=16777215)}}}else if(c=="diffuse"||!b)c=="emission"?a.emissive=d.color.getHex():a[c]=d.color.getHex();
-break;case "shininess":case "reflectivity":a[c]=this[c];break;case "transparency":if(b){a.transparent=true;a.opacity=this[c];b=true}}a.shading=pa;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};I.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=
-a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "init_from":this.init_from=c.textContent;break;case "format":this.format=c.textContent;break;default:console.log("unhandled Surface prop: "+c.nodeName)}}return this};J.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "source":this.source=c.textContent;break;case "minfilter":this.minfilter=c.textContent;break;case "magfilter":this.magfilter=c.textContent;break;case "mipfilter":this.mipfilter=
-c.textContent;break;case "wrap_s":this.wrap_s=c.textContent;break;case "wrap_t":this.wrap_t=c.textContent;break;default:console.log("unhandled Sampler2D prop: "+c.nodeName)}}return this};C.prototype.create=function(){if(this.shader==null)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(c.nodeType==1)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(d.nodeType==1)switch(d.nodeName){case "surface":this.surface=(new I(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)}}};C.prototype.parseProfileCOMMON=function(a){for(var b,c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)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(c.nodeType==1)switch(c.nodeName){case "constant":case "lambert":case "blinn":case "phong":this.shader=(new H(c.nodeName,this)).parse(c)}}};A.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,
-"");return this};B.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.source={};for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "animation":var c=(new B).parse(c),d;for(d in c.source)this.source[d]=c.source[d];for(var e=0;e<c.channel.length;e++){this.channel.push(c.channel[e]);this.sampler.push(c.sampler[e])}break;case "source":d=(new u).parse(c);this.source[d.id]=d;break;case "sampler":this.sampler.push((new L(this)).parse(c));
+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};m.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1&&c.nodeName=="bind_material"){if(a=
+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};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 u(this)).parse(c)}}return this};u.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");Z[d]==void 0&&(Z[d]=(new x(d)).parse(c));break;case "vertices":this.vertices=(new A).parse(c);break;case "triangles":this.primitives.push((new p).parse(c));break;case "polygons":this.primitives.push((new s).parse(c));break;case "polylist":this.primitives.push((new t).parse(c))}}this.geometry3js=new THREE.Geometry;a=Z[this.vertices.input.POSITION.source].data;for(b=0;b<a.length;b=b+3)this.geometry3js.vertices.push(ea(a,b).clone());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();if(this.geometry3js.calcNormals){this.geometry3js.computeVertexNormals();delete this.geometry3js.calcNormals}this.geometry3js.computeBoundingBox();return this};u.prototype.handlePrimitive=function(a,b){var c,d,e=a.p,f=a.inputs,g,h,i,j,k=0,l=3,m=0,o=[];for(c=0;c<f.length;c++){g=f[c];l=g.offset+1;m=m<l?l:m;switch(g.semantic){case "TEXCOORD":o.push(g.set)}}for(var n=
+0;n<e.length;++n)for(var q=e[n],r=0;r<q.length;){var p=[],s=[],u={},t=[],l=a.vcount?a.vcount.length?a.vcount[k++]:a.vcount:q.length/m;for(c=0;c<l;c++)for(d=0;d<f.length;d++){g=f[d];j=Z[g.source];h=q[r+c*m+g.offset];i=j.accessor.params.length;i=h*i;switch(g.semantic){case "VERTEX":p.push(h);break;case "NORMAL":s.push(ea(j.data,i));break;case "TEXCOORD":u[g.set]===void 0&&(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(s.length==0)if(g=this.vertices.input.NORMAL){j=Z[g.source];i=j.accessor.params.length;g=0;for(h=p.length;g<h;g++)s.push(ea(j.data,p[g]*i))}else b.calcNormals=true;if(l===3)c.push(new THREE.Face3(p[0],p[1],p[2],s,t.length?t:new THREE.Color));else if(l===4)c.push(new THREE.Face4(p[0],p[1],p[2],p[3],s,t.length?t:new THREE.Color));else if(l>4&&R.subdivideFaces){t=t.length?t:new THREE.Color;for(d=1;d<l-1;)c.push(new THREE.Face3(p[0],p[d],p[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<o.length;d++){p=u[o[d]];p=l>4?[p[0],p[g+1],p[g+2]]:l===4?[p[0],p[1],p[2],p[3]]:[p[0],p[1],p[2]];b.faceVertexUvs[d]||(b.faceVertexUvs[d]=[]);b.faceVertexUvs[d].push(p)}}}else console.log("dropped face with vcount "+l+" for geometry with id: "+b.id);r=r+m*l}};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.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};t.prototype=new s;t.prototype.constructor=t;p.prototype=new s;p.prototype.constructor=p;w.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(c.nodeName=="param"){var d={};d.name=c.getAttribute("name");d.type=c.getAttribute("type");this.params.push(d)}}return this};A.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++)if(a.childNodes[b].nodeName=="input"){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(this.semantic=="TEXCOORD"&&this.set<0)this.set=0;return this};x.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),e=[],f=0,g=d.length;f<g;f++)e.push(d[f]=="true"||d[f]=="1"?true:
+false);this.data=e;this.type=c.nodeName;break;case "float_array":this.data=D(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(c.childNodes[d].nodeName=="accessor"){this.accessor=(new w).parse(c.childNodes[d]);break}}}return this};x.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=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};v.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");for(var b=0;b<a.childNodes.length;b++)if(a.childNodes[b].nodeName=="instance_effect"){this.instance_effect=(new y).parse(a.childNodes[b]);
+break}return this};B.prototype.isColor=function(){return this.texture==null};B.prototype.isTexture=function(){return this.texture!=null};B.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "color":c=D(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};B.prototype.parseTexture=function(a){if(!a.childNodes)return this;if(a.childNodes[1]&&a.childNodes[1].nodeName==="extra"){a=a.childNodes[1];a.childNodes[1]&&a.childNodes[1].nodeName==="technique"&&(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};E.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[c.nodeName]=(new B).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 e=d.iterateNext(),
+f=[];e;){f.push(e);e=d.iterateNext()}d=f;d.length>0&&(this[c.nodeName]=parseFloat(d[0].textContent))}}this.create();return this};E.prototype.create=function(){var a={},b=this.transparency!==void 0&&this.transparency<1,c;for(c in this)switch(c){case "ambient":case "emission":case "diffuse":case "specular":var d=this[c];if(d instanceof B)if(d.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid){var e=aa[this.effect.surface.init_from];if(e){e=
+THREE.ImageUtils.loadTexture(oa+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;c=="emission"&&(a.emissive=16777215)}}}else if(c=="diffuse"||!b)c=="emission"?a.emissive=d.color.getHex():a[c]=d.color.getHex();break;case "shininess":case "reflectivity":a[c]=this[c];break;
+case "transparency":if(b){a.transparent=true;a.opacity=this[c];b=true}}a.shading=pa;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};H.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "init_from":this.init_from=
+c.textContent;break;case "format":this.format=c.textContent;break;default:console.log("unhandled Surface prop: "+c.nodeName)}}return this};K.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "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(this.shader==null)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(c.nodeType==1)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(d.nodeType==1)switch(d.nodeName){case "surface":this.surface=(new H(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)}}};I.prototype.parseProfileCOMMON=function(a){for(var b,c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)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};I.prototype.parseTechnique=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "constant":case "lambert":case "blinn":case "phong":this.shader=(new E(c.nodeName,this)).parse(c)}}};y.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,
+"");return this};C.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.source={};for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "animation":var c=(new C).parse(c),d;for(d in c.source)this.source[d]=c.source[d];for(var e=0;e<c.channel.length;e++){this.channel.push(c.channel[e]);this.sampler.push(c.sampler[e])}break;case "source":d=(new x).parse(c);this.source[d.id]=d;break;case "sampler":this.sampler.push((new L(this)).parse(c));
 break;case "channel":this.channel.push((new G(this)).parse(c))}}return this};G.prototype.parse=function(a){this.source=a.getAttribute("source").replace(/^#/,"");this.target=a.getAttribute("target");var b=this.target.split("/");b.shift();var a=b.shift(),c=a.indexOf(".")>=0,d=a.indexOf("(")>=0;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};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(c.nodeType==1)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(a==="matrix"&&
-this.strideOut===16)c=this.output[b];else if(this.strideOut>1){c=[];for(var b=b*this.strideOut,d=0;d<this.strideOut;++d)c[d]=this.output[b+d];if(this.strideOut===3)switch(a){case "rotate":case "translate":O(c,-1);break;case "scale":O(c,1)}else this.strideOut===4&&a==="matrix"&&O(c,-1)}else c=this.output[b];return c};K.prototype.addTarget=function(a,b,c,d){this.targets.push({sid:a,member:c,transform:b,data:d})};K.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)}};K.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};K.prototype.hasTarget=function(a){for(var b=0;b<this.targets.length;++b)if(this.targets[b].sid===a)return true;return false};K.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(d.transform.type!=="matrix"&&e){var f=(b-this.time)/(a.time-this.time),
-g=e.data,h=d.data;if(f<0||f>1){console.log("Key.interpolate: Warning! Scale out of bounds:"+f);f=f<0?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)}};F.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(c.nodeType==1)switch(c.nodeName){case "optics":this.parseOptics(c)}}return this};F.prototype.parseOptics=function(a){for(var b=
+this.strideOut===16)c=this.output[b];else if(this.strideOut>1){c=[];for(var b=b*this.strideOut,d=0;d<this.strideOut;++d)c[d]=this.output[b+d];if(this.strideOut===3)switch(a){case "rotate":case "translate":O(c,-1);break;case "scale":O(c,1)}else this.strideOut===4&&a==="matrix"&&O(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 true;return false};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(d.transform.type!=="matrix"&&e){var f=(b-this.time)/(a.time-this.time),
+g=e.data,h=d.data;if(f<0||f>1){console.log("Key.interpolate: Warning! Scale out of bounds:"+f);f=f<0?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)}};M.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(c.nodeType==1)switch(c.nodeName){case "optics":this.parseOptics(c)}}return this};M.prototype.parseOptics=function(a){for(var b=
 0;b<a.childNodes.length;b++)if(a.childNodes[b].nodeName=="technique_common")for(var c=a.childNodes[b],d=0;d<c.childNodes.length;d++){this.technique=c.childNodes[d].nodeName;if(this.technique=="perspective")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(this.technique=="orthographic"){e=c.childNodes[d];for(f=0;f<e.childNodes.length;f++){g=e.childNodes[f];switch(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 e=
+g.textContent}}else if(this.technique=="orthographic"){e=c.childNodes[d];for(f=0;f<e.childNodes.length;f++){g=e.childNodes[f];switch(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};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(f.readyState==4){if(f.status==0||f.status==200)if(f.responseXML){na=c;a(f.responseXML,void 0,b)}else console.error("ColladaLoader: Empty or non-existing file ("+b+")")}else if(f.readyState==3&&d){e==0&&(e=f.getResponseHeader("Content-Length"));d({total:e,loaded:f.responseText.length})}};f.open("GET",b,true);f.send(null)}else alert("Don't know how to parse XML!")},
 parse:a,setPreferredShading:function(a){pa=a},applySkin:f,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(e.status===200||e.status===0){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 if(e.readyState===e.LOADING){if(f){g===0&&(g=e.getResponseHeader("Content-Length"));
 f({total:g,loaded:e.responseText.length})}}else e.readyState===e.HEADERS_RECEIVED&&(g=e.getResponseHeader("Content-Length"))};e.open("GET",b,true);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=a.scale!==void 0?1/a.scale:1;this.initMaterials(d,a.materials,c);(function(b){var c,f,j,i,k,q,l,n,r,m,p,t,s,v,o=a.faces;q=a.vertices;var x=a.normals,y=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]=[]}i=0;for(k=q.length;i<k;){l=new THREE.Vertex;l.x=q[i++]*b;l.y=q[i++]*b;l.z=q[i++]*b;d.vertices.push(l)}i=0;for(k=o.length;i<k;){b=o[i++];q=b&1;j=b&2;c=b&
-4;f=b&8;n=b&16;l=b&32;m=b&64;b=b&128;if(q){p=new THREE.Face4;p.a=o[i++];p.b=o[i++];p.c=o[i++];p.d=o[i++];q=4}else{p=new THREE.Face3;p.a=o[i++];p.b=o[i++];p.c=o[i++];q=3}if(j){j=o[i++];p.materialIndex=j}j=d.faces.length;if(c)for(c=0;c<z;c++){t=a.uvs[c];r=o[i++];v=t[r*2];r=t[r*2+1];d.faceUvs[c][j]=new THREE.UV(v,r)}if(f)for(c=0;c<z;c++){t=a.uvs[c];s=[];for(f=0;f<q;f++){r=o[i++];v=t[r*2];r=t[r*2+1];s[f]=new THREE.UV(v,r)}d.faceVertexUvs[c][j]=s}if(n){n=o[i++]*3;f=new THREE.Vector3;f.x=x[n++];f.y=x[n++];
-f.z=x[n];p.normal=f}if(l)for(c=0;c<q;c++){n=o[i++]*3;f=new THREE.Vector3;f.x=x[n++];f.y=x[n++];f.z=x[n];p.vertexNormals.push(f)}if(m){l=o[i++];l=new THREE.Color(y[l]);p.color=l}if(b)for(c=0;c<q;c++){l=o[i++];l=new THREE.Color(y[l]);p.vertexColors.push(l)}d.faces.push(p)}})(f);(function(){var b,c,f,j;if(a.skinWeights){b=0;for(c=a.skinWeights.length;b<c;b=b+2){f=a.skinWeights[b];j=a.skinWeights[b+1];d.skinWeights.push(new THREE.Vector4(f,j,0,0))}}if(a.skinIndices){b=0;for(c=a.skinIndices.length;b<c;b=
-b+2){f=a.skinIndices[b];j=a.skinIndices[b+1];d.skinIndices.push(new THREE.Vector4(f,j,0,0))}}d.bones=a.bones;d.animation=a.animation})();(function(b){if(a.morphTargets!==void 0){var c,f,j,i,k,q,l,n,r;c=0;for(f=a.morphTargets.length;c<f;c++){d.morphTargets[c]={};d.morphTargets[c].name=a.morphTargets[c].name;d.morphTargets[c].vertices=[];n=d.morphTargets[c].vertices;r=a.morphTargets[c].vertices;j=0;for(i=r.length;j<i;j=j+3){k=r[j]*b;q=r[j+1]*b;l=r[j+2]*b;n.push(new THREE.Vertex(k,q,l))}}}if(a.morphColors!==
-void 0){c=0;for(f=a.morphColors.length;c<f;c++){d.morphColors[c]={};d.morphColors[c].name=a.morphColors[c].name;d.morphColors[c].colors=[];i=d.morphColors[c].colors;k=a.morphColors[c].colors;b=0;for(j=k.length;b<j;b=b+3){q=new THREE.Color(16755200);q.setRGB(k[b],k[b+1],k[b+2]);i.push(q)}}}})(f);d.computeCentroids();d.computeFaceNormals();this.hasNormals(d)&&d.computeTangents();b(d)};
+THREE.JSONLoader.prototype.createModel=function(a,b,c){var d=new THREE.Geometry,f=a.scale!==void 0?1/a.scale:1;this.initMaterials(d,a.materials,c);(function(b){var c,f,j,i,k,o,l,n,q,m,r,u,s,t,p=a.faces;o=a.vertices;var w=a.normals,A=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]=[]}i=0;for(k=o.length;i<k;){l=new THREE.Vector3;l.x=o[i++]*b;l.y=o[i++]*b;l.z=o[i++]*b;d.vertices.push(l)}i=0;for(k=p.length;i<k;){b=p[i++];o=b&1;j=b&2;c=b&
+4;f=b&8;n=b&16;l=b&32;m=b&64;b=b&128;if(o){r=new THREE.Face4;r.a=p[i++];r.b=p[i++];r.c=p[i++];r.d=p[i++];o=4}else{r=new THREE.Face3;r.a=p[i++];r.b=p[i++];r.c=p[i++];o=3}if(j){j=p[i++];r.materialIndex=j}j=d.faces.length;if(c)for(c=0;c<z;c++){u=a.uvs[c];q=p[i++];t=u[q*2];q=u[q*2+1];d.faceUvs[c][j]=new THREE.UV(t,q)}if(f)for(c=0;c<z;c++){u=a.uvs[c];s=[];for(f=0;f<o;f++){q=p[i++];t=u[q*2];q=u[q*2+1];s[f]=new THREE.UV(t,q)}d.faceVertexUvs[c][j]=s}if(n){n=p[i++]*3;f=new THREE.Vector3;f.x=w[n++];f.y=w[n++];
+f.z=w[n];r.normal=f}if(l)for(c=0;c<o;c++){n=p[i++]*3;f=new THREE.Vector3;f.x=w[n++];f.y=w[n++];f.z=w[n];r.vertexNormals.push(f)}if(m){l=p[i++];l=new THREE.Color(A[l]);r.color=l}if(b)for(c=0;c<o;c++){l=p[i++];l=new THREE.Color(A[l]);r.vertexColors.push(l)}d.faces.push(r)}})(f);(function(){var b,c,f,j;if(a.skinWeights){b=0;for(c=a.skinWeights.length;b<c;b=b+2){f=a.skinWeights[b];j=a.skinWeights[b+1];d.skinWeights.push(new THREE.Vector4(f,j,0,0))}}if(a.skinIndices){b=0;for(c=a.skinIndices.length;b<c;b=
+b+2){f=a.skinIndices[b];j=a.skinIndices[b+1];d.skinIndices.push(new THREE.Vector4(f,j,0,0))}}d.bones=a.bones;d.animation=a.animation})();(function(b){if(a.morphTargets!==void 0){var c,f,j,i,k,o;c=0;for(f=a.morphTargets.length;c<f;c++){d.morphTargets[c]={};d.morphTargets[c].name=a.morphTargets[c].name;d.morphTargets[c].vertices=[];k=d.morphTargets[c].vertices;o=a.morphTargets[c].vertices;j=0;for(i=o.length;j<i;j=j+3){var l=new THREE.Vector3;l.x=o[j]*b;l.y=o[j+1]*b;l.z=o[j+2]*b;k.push(l)}}}if(a.morphColors!==
+void 0){c=0;for(f=a.morphColors.length;c<f;c++){d.morphColors[c]={};d.morphColors[c].name=a.morphColors[c].name;d.morphColors[c].colors=[];i=d.morphColors[c].colors;k=a.morphColors[c].colors;b=0;for(j=k.length;b<j;b=b+3){o=new THREE.Color(16755200);o.setRGB(k[b],k[b+1],k[b+2]);i.push(o)}}}})(f);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(d.readyState==4)if(d.status==200||d.status==0){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,true);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 b=="relativeToHTML"?a:i+"/"+a}function f(){var a;for(l in C.objects)if(!F.objects[l]){t=C.objects[l];if(t.geometry!==void 0){if(E=F.geometries[t.geometry]){a=false;H=F.materials[t.materials[0]];(a=H instanceof THREE.ShaderMaterial)&&E.computeTangents();o=t.position;x=t.rotation;y=t.quaternion;z=t.scale;y=0;t.materials.length==0&&(H=new THREE.MeshFaceMaterial);t.materials.length>1&&(H=new THREE.MeshFaceMaterial);a=new THREE.Mesh(E,
-H);a.name=l;a.position.set(o[0],o[1],o[2]);if(y){a.quaternion.set(y[0],y[1],y[2],y[3]);a.useQuaternion=true}else a.rotation.set(x[0],x[1],x[2]);a.scale.set(z[0],z[1],z[2]);a.visible=t.visible;a.doubleSided=t.doubleSided;a.castShadow=t.castShadow;a.receiveShadow=t.receiveShadow;F.scene.add(a);F.objects[l]=a}}else{o=t.position;x=t.rotation;y=t.quaternion;z=t.scale;y=0;a=new THREE.Object3D;a.name=l;a.position.set(o[0],o[1],o[2]);if(y){a.quaternion.set(y[0],y[1],y[2],y[3]);a.useQuaternion=true}else a.rotation.set(x[0],
-x[1],x[2]);a.scale.set(z[0],z[1],z[2]);a.visible=t.visible!==void 0?t.visible:false;F.scene.add(a);F.objects[l]=a;F.empties[l]=a}}}function e(a){return function(b){F.geometries[a]=b;f();B=B-1;j.onLoadComplete();h()}}function g(a){return function(b){F.geometries[a]=b}}function h(){j.callbackProgress({totalModels:L,totalTextures:K,loadedModels:L-B,loadedTextures:K-G},F);j.onLoadProgress();B==0&&G==0&&b(F)}var j=this,i=THREE.Loader.prototype.extractUrlBase(c),k,q,l,n,r,m,p,t,s,v,o,x,y,z,u,w,E,H,I,J,
-C,A,B,G,L,K,F;C=a;c=new THREE.BinaryLoader;A=new THREE.JSONLoader;G=B=0;F={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},empties:{}};if(C.transform){a=C.transform.position;s=C.transform.rotation;u=C.transform.scale;a&&F.scene.position.set(a[0],a[1],a[2]);s&&F.scene.rotation.set(s[0],s[1],s[2]);u&&F.scene.scale.set(u[0],u[1],u[2]);if(a||s||u){F.scene.updateMatrix();F.scene.updateMatrixWorld()}}a=function(){G=G-1;h();j.onLoadComplete()};for(r in C.cameras){u=
-C.cameras[r];u.type=="perspective"?I=new THREE.PerspectiveCamera(u.fov,u.aspect,u.near,u.far):u.type=="ortho"&&(I=new THREE.OrthographicCamera(u.left,u.right,u.top,u.bottom,u.near,u.far));o=u.position;s=u.target;u=u.up;I.position.set(o[0],o[1],o[2]);I.target=new THREE.Vector3(s[0],s[1],s[2]);u&&I.up.set(u[0],u[1],u[2]);F.cameras[r]=I}for(n in C.lights){s=C.lights[n];r=s.color!==void 0?s.color:16777215;I=s.intensity!==void 0?s.intensity:1;if(s.type=="directional"){o=s.direction;v=new THREE.DirectionalLight(r,
-I);v.position.set(o[0],o[1],o[2]);v.position.normalize()}else if(s.type=="point"){o=s.position;v=s.distance;v=new THREE.PointLight(r,I,v);v.position.set(o[0],o[1],o[2])}else s.type=="ambient"&&(v=new THREE.AmbientLight(r));F.scene.add(v);F.lights[n]=v}for(m in C.fogs){n=C.fogs[m];n.type=="linear"?J=new THREE.Fog(0,n.near,n.far):n.type=="exp2"&&(J=new THREE.FogExp2(0,n.density));u=n.color;J.color.setRGB(u[0],u[1],u[2]);F.fogs[m]=J}if(F.cameras&&C.defaults.camera)F.currentCamera=F.cameras[C.defaults.camera];
-if(F.fogs&&C.defaults.fog)F.scene.fog=F.fogs[C.defaults.fog];u=C.defaults.bgcolor;F.bgColor=new THREE.Color;F.bgColor.setRGB(u[0],u[1],u[2]);F.bgColorAlpha=C.defaults.bgalpha;for(k in C.geometries){m=C.geometries[k];if(m.type=="bin_mesh"||m.type=="ascii_mesh"){B=B+1;j.onLoadStart()}}L=B;for(k in C.geometries){m=C.geometries[k];if(m.type=="cube"){E=new THREE.CubeGeometry(m.width,m.height,m.depth,m.segmentsWidth,m.segmentsHeight,m.segmentsDepth,null,m.flipped,m.sides);F.geometries[k]=E}else if(m.type==
-"plane"){E=new THREE.PlaneGeometry(m.width,m.height,m.segmentsWidth,m.segmentsHeight);F.geometries[k]=E}else if(m.type=="sphere"){E=new THREE.SphereGeometry(m.radius,m.segmentsWidth,m.segmentsHeight);F.geometries[k]=E}else if(m.type=="cylinder"){E=new THREE.CylinderGeometry(m.topRad,m.botRad,m.height,m.radSegs,m.heightSegs);F.geometries[k]=E}else if(m.type=="torus"){E=new THREE.TorusGeometry(m.radius,m.tube,m.segmentsR,m.segmentsT);F.geometries[k]=E}else if(m.type=="icosahedron"){E=new THREE.IcosahedronGeometry(m.radius,
-m.subdivisions);F.geometries[k]=E}else if(m.type=="bin_mesh")c.load(d(m.url,C.urlBaseType),e(k));else if(m.type=="ascii_mesh")A.load(d(m.url,C.urlBaseType),e(k));else if(m.type=="embedded_mesh"){m=C.embeds[m.id];m.metadata=C.metadata;m&&A.createModel(m,g(k),"")}}for(p in C.textures){k=C.textures[p];if(k.url instanceof Array){G=G+k.url.length;for(m=0;m<k.url.length;m++)j.onLoadStart()}else{G=G+1;j.onLoadStart()}}K=G;for(p in C.textures){k=C.textures[p];if(k.mapping!=void 0&&THREE[k.mapping]!=void 0)k.mapping=
-new THREE[k.mapping];if(k.url instanceof Array){m=[];for(J=0;J<k.url.length;J++)m[J]=d(k.url[J],C.urlBaseType);m=THREE.ImageUtils.loadTextureCube(m,k.mapping,a)}else{m=THREE.ImageUtils.loadTexture(d(k.url,C.urlBaseType),k.mapping,a);if(THREE[k.minFilter]!=void 0)m.minFilter=THREE[k.minFilter];if(THREE[k.magFilter]!=void 0)m.magFilter=THREE[k.magFilter];if(k.repeat){m.repeat.set(k.repeat[0],k.repeat[1]);if(k.repeat[0]!=1)m.wrapS=THREE.RepeatWrapping;if(k.repeat[1]!=1)m.wrapT=THREE.RepeatWrapping}k.offset&&
-m.offset.set(k.offset[0],k.offset[1]);if(k.wrap){J={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(J[k.wrap[0]]!==void 0)m.wrapS=J[k.wrap[0]];if(J[k.wrap[1]]!==void 0)m.wrapT=J[k.wrap[1]]}}F.textures[p]=m}for(q in C.materials){p=C.materials[q];for(w in p.parameters)if(w=="envMap"||w=="map"||w=="lightMap")p.parameters[w]=F.textures[p.parameters[w]];else if(w=="shading")p.parameters[w]=p.parameters[w]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(w=="blending")p.parameters[w]=
-THREE[p.parameters[w]]?THREE[p.parameters[w]]:THREE.NormalBlending;else if(w=="combine")p.parameters[w]=p.parameters[w]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(w=="vertexColors")if(p.parameters[w]=="face")p.parameters[w]=THREE.FaceColors;else if(p.parameters[w])p.parameters[w]=THREE.VertexColors;if(p.parameters.opacity!==void 0&&p.parameters.opacity<1)p.parameters.transparent=true;if(p.parameters.normalMap){a=THREE.ShaderUtils.lib.normal;k=THREE.UniformsUtils.clone(a.uniforms);
-m=p.parameters.color;J=p.parameters.specular;c=p.parameters.ambient;A=p.parameters.shininess;k.tNormal.texture=F.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=true}if(p.parameters.lightMap){k.tAO.texture=p.parameters.lightMap;k.enableAO.value=true}if(p.parameters.specularMap){k.tSpecular.texture=F.textures[p.parameters.specularMap];k.enableSpecular.value=
-true}k.uDiffuseColor.value.setHex(m);k.uSpecularColor.value.setHex(J);k.uAmbientColor.value.setHex(c);k.uShininess.value=A;if(p.parameters.opacity)k.uOpacity.value=p.parameters.opacity;H=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:k,lights:true,fog:true})}else H=new THREE[p.type](p.parameters);F.materials[q]=H}f();j.callbackSync(F);h()};THREE.UTF8Loader=function(){};
+THREE.SceneLoader.prototype.createScene=function(a,b,c){function d(a,b){return b=="relativeToHTML"?a:i+"/"+a}function f(){var a;for(l in y.objects)if(!F.objects[l]){u=y.objects[l];if(u.geometry!==void 0){if(E=F.geometries[u.geometry]){a=false;H=F.materials[u.materials[0]];(a=H instanceof THREE.ShaderMaterial)&&E.computeTangents();w=u.position;A=u.rotation;z=u.quaternion;x=u.scale;s=u.matrix;z=0;u.materials.length==0&&(H=new THREE.MeshFaceMaterial);u.materials.length>1&&(H=new THREE.MeshFaceMaterial);
+a=new THREE.Mesh(E,H);a.name=l;if(s){a.matrixAutoUpdate=false;a.matrix.set(s[0],s[1],s[2],s[3],s[4],s[5],s[6],s[7],s[8],s[9],s[10],s[11],s[12],s[13],s[14],s[15])}else{a.position.set(w[0],w[1],w[2]);if(z){a.quaternion.set(z[0],z[1],z[2],z[3]);a.useQuaternion=true}else a.rotation.set(A[0],A[1],A[2]);a.scale.set(x[0],x[1],x[2])}a.visible=u.visible;a.doubleSided=u.doubleSided;a.castShadow=u.castShadow;a.receiveShadow=u.receiveShadow;F.scene.add(a);F.objects[l]=a}}else{w=u.position;A=u.rotation;z=u.quaternion;
+x=u.scale;z=0;a=new THREE.Object3D;a.name=l;a.position.set(w[0],w[1],w[2]);if(z){a.quaternion.set(z[0],z[1],z[2],z[3]);a.useQuaternion=true}else a.rotation.set(A[0],A[1],A[2]);a.scale.set(x[0],x[1],x[2]);a.visible=u.visible!==void 0?u.visible:false;F.scene.add(a);F.objects[l]=a;F.empties[l]=a}}}function e(a){return function(b){F.geometries[a]=b;f();G=G-1;j.onLoadComplete();h()}}function g(a){return function(b){F.geometries[a]=b}}function h(){j.callbackProgress({totalModels:J,totalTextures:M,loadedModels:J-
+G,loadedTextures:M-L},F);j.onLoadProgress();G==0&&L==0&&b(F)}var j=this,i=THREE.Loader.prototype.extractUrlBase(c),k,o,l,n,q,m,r,u,s,t,p,w,A,z,x,v,B,E,H,K,I,y,C,G,L,J,M,F;y=a;c=new THREE.BinaryLoader;C=new THREE.JSONLoader;L=G=0;F={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},empties:{}};if(y.transform){a=y.transform.position;t=y.transform.rotation;v=y.transform.scale;a&&F.scene.position.set(a[0],a[1],a[2]);t&&F.scene.rotation.set(t[0],t[1],
+t[2]);v&&F.scene.scale.set(v[0],v[1],v[2]);if(a||t||v){F.scene.updateMatrix();F.scene.updateMatrixWorld()}}a=function(){L=L-1;h();j.onLoadComplete()};for(q in y.cameras){v=y.cameras[q];v.type=="perspective"?K=new THREE.PerspectiveCamera(v.fov,v.aspect,v.near,v.far):v.type=="ortho"&&(K=new THREE.OrthographicCamera(v.left,v.right,v.top,v.bottom,v.near,v.far));w=v.position;t=v.target;v=v.up;K.position.set(w[0],w[1],w[2]);K.target=new THREE.Vector3(t[0],t[1],t[2]);v&&K.up.set(v[0],v[1],v[2]);F.cameras[q]=
+K}for(n in y.lights){t=y.lights[n];q=t.color!==void 0?t.color:16777215;K=t.intensity!==void 0?t.intensity:1;if(t.type=="directional"){w=t.direction;p=new THREE.DirectionalLight(q,K);p.position.set(w[0],w[1],w[2]);p.position.normalize()}else if(t.type=="point"){w=t.position;p=t.distance;p=new THREE.PointLight(q,K,p);p.position.set(w[0],w[1],w[2])}else t.type=="ambient"&&(p=new THREE.AmbientLight(q));F.scene.add(p);F.lights[n]=p}for(m in y.fogs){n=y.fogs[m];n.type=="linear"?I=new THREE.Fog(0,n.near,
+n.far):n.type=="exp2"&&(I=new THREE.FogExp2(0,n.density));v=n.color;I.color.setRGB(v[0],v[1],v[2]);F.fogs[m]=I}if(F.cameras&&y.defaults.camera)F.currentCamera=F.cameras[y.defaults.camera];if(F.fogs&&y.defaults.fog)F.scene.fog=F.fogs[y.defaults.fog];v=y.defaults.bgcolor;F.bgColor=new THREE.Color;F.bgColor.setRGB(v[0],v[1],v[2]);F.bgColorAlpha=y.defaults.bgalpha;for(k in y.geometries){m=y.geometries[k];if(m.type=="bin_mesh"||m.type=="ascii_mesh"){G=G+1;j.onLoadStart()}}J=G;for(k in y.geometries){m=
+y.geometries[k];if(m.type=="cube"){E=new THREE.CubeGeometry(m.width,m.height,m.depth,m.segmentsWidth,m.segmentsHeight,m.segmentsDepth,null,m.flipped,m.sides);F.geometries[k]=E}else if(m.type=="plane"){E=new THREE.PlaneGeometry(m.width,m.height,m.segmentsWidth,m.segmentsHeight);F.geometries[k]=E}else if(m.type=="sphere"){E=new THREE.SphereGeometry(m.radius,m.segmentsWidth,m.segmentsHeight);F.geometries[k]=E}else if(m.type=="cylinder"){E=new THREE.CylinderGeometry(m.topRad,m.botRad,m.height,m.radSegs,
+m.heightSegs);F.geometries[k]=E}else if(m.type=="torus"){E=new THREE.TorusGeometry(m.radius,m.tube,m.segmentsR,m.segmentsT);F.geometries[k]=E}else if(m.type=="icosahedron"){E=new THREE.IcosahedronGeometry(m.radius,m.subdivisions);F.geometries[k]=E}else if(m.type=="bin_mesh")c.load(d(m.url,y.urlBaseType),e(k));else if(m.type=="ascii_mesh")C.load(d(m.url,y.urlBaseType),e(k));else if(m.type=="embedded_mesh"){m=y.embeds[m.id];m.metadata=y.metadata;m&&C.createModel(m,g(k),"")}}for(r in y.textures){k=y.textures[r];
+if(k.url instanceof Array){L=L+k.url.length;for(m=0;m<k.url.length;m++)j.onLoadStart()}else{L=L+1;j.onLoadStart()}}M=L;for(r in y.textures){k=y.textures[r];if(k.mapping!=void 0&&THREE[k.mapping]!=void 0)k.mapping=new THREE[k.mapping];if(k.url instanceof Array){m=[];for(I=0;I<k.url.length;I++)m[I]=d(k.url[I],y.urlBaseType);m=THREE.ImageUtils.loadTextureCube(m,k.mapping,a)}else{m=THREE.ImageUtils.loadTexture(d(k.url,y.urlBaseType),k.mapping,a);if(THREE[k.minFilter]!=void 0)m.minFilter=THREE[k.minFilter];
+if(THREE[k.magFilter]!=void 0)m.magFilter=THREE[k.magFilter];if(k.repeat){m.repeat.set(k.repeat[0],k.repeat[1]);if(k.repeat[0]!=1)m.wrapS=THREE.RepeatWrapping;if(k.repeat[1]!=1)m.wrapT=THREE.RepeatWrapping}k.offset&&m.offset.set(k.offset[0],k.offset[1]);if(k.wrap){I={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(I[k.wrap[0]]!==void 0)m.wrapS=I[k.wrap[0]];if(I[k.wrap[1]]!==void 0)m.wrapT=I[k.wrap[1]]}}F.textures[r]=m}for(o in y.materials){s=y.materials[o];for(B in s.parameters)if(B==
+"envMap"||B=="map"||B=="lightMap")s.parameters[B]=F.textures[s.parameters[B]];else if(B=="shading")s.parameters[B]=s.parameters[B]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(B=="blending")s.parameters[B]=THREE[s.parameters[B]]?THREE[s.parameters[B]]:THREE.NormalBlending;else if(B=="combine")s.parameters[B]=s.parameters[B]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(B=="vertexColors")if(s.parameters[B]=="face")s.parameters[B]=THREE.FaceColors;else if(s.parameters[B])s.parameters[B]=
+THREE.VertexColors;if(s.parameters.opacity!==void 0&&s.parameters.opacity<1)s.parameters.transparent=true;if(s.parameters.normalMap){r=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(r.uniforms);k=s.parameters.color;m=s.parameters.specular;I=s.parameters.ambient;c=s.parameters.shininess;a.tNormal.texture=F.textures[s.parameters.normalMap];if(s.parameters.normalMapFactor)a.uNormalScale.value=s.parameters.normalMapFactor;if(s.parameters.map){a.tDiffuse.texture=s.parameters.map;a.enableDiffuse.value=
+true}if(s.parameters.lightMap){a.tAO.texture=s.parameters.lightMap;a.enableAO.value=true}if(s.parameters.specularMap){a.tSpecular.texture=F.textures[s.parameters.specularMap];a.enableSpecular.value=true}a.uDiffuseColor.value.setHex(k);a.uSpecularColor.value.setHex(m);a.uAmbientColor.value.setHex(I);a.uShininess.value=c;if(s.parameters.opacity)a.uOpacity.value=s.parameters.opacity;H=new THREE.ShaderMaterial({fragmentShader:r.fragmentShader,vertexShader:r.vertexShader,uniforms:a,lights:true,fog:true})}else H=
+new THREE[s.type](s.parameters);F.materials[o]=H}f();j.callbackSync(F);h()};THREE.UTF8Loader=function(){};
 THREE.UTF8Loader.prototype.load=function(a,b,c){var d=new XMLHttpRequest,f=c.scale!==void 0?c.scale:1,e=c.offsetX!==void 0?c.offsetX:0,g=c.offsetY!==void 0?c.offsetY:0,h=c.offsetZ!==void 0?c.offsetZ:0;d.onreadystatechange=function(){d.readyState==4?d.status==200||d.status==0?THREE.UTF8Loader.prototype.createModel(d.responseText,b,f,e,g,h):console.error("THREE.UTF8Loader: Couldn't load ["+a+"] ["+d.status+"]"):d.readyState!=3&&d.readyState==2&&d.getResponseHeader("Content-Length")};d.open("GET",a,
 true);d.send(null)};THREE.UTF8Loader.prototype.decompressMesh=function(a){var b=a.charCodeAt(0);b>=57344&&(b=b-2048);b++;for(var c=new Float32Array(8*b),d=1,f=0;f<8;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=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;h==0&&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),i=[],k=[];(function(a,g,i){for(var j,k,p,t=a.length;i<t;i=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=j+d;k=k+f;p=p+e;b.vertices.push(new THREE.Vertex(j,k,p))}})(g[0],8,0);(function(a,b,c){for(var d,e,f=a.length;c<f;c=c+b){d=a[c];e=a[c+1];d=d/1023;e=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=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;i.push(d,e,f)}})(g[0],8,5);(function(a){var c,d,e,f,g,j,s,v,o,x=a.length;for(c=0;c<x;c=c+3){d=a[c];e=a[c+1];f=a[c+2];g=b;v=d;o=e;j=f;var y=i[e*3],z=i[e*3+1],u=i[e*3+2],w=i[f*3],E=i[f*3+1],H=i[f*3+2];s=new THREE.Vector3(i[d*3],i[d*3+1],i[d*3+2]);y=new THREE.Vector3(y,z,u);w=new THREE.Vector3(w,E,H);g.faces.push(new THREE.Face3(v,o,j,[s,y,w],null,0));g=k[d*2];d=k[d*2+1];j=k[e*2];s=k[e*2+1];v=
-k[f*2];o=k[f*2+1];f=b.faceVertexUvs[0];e=j;j=s;s=[];s.push(new THREE.UV(g,d));s.push(new THREE.UV(e,j));s.push(new THREE.UV(v,o));f.push(s)}})(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,f,e){var g=function(){var b=this;b.materials=[];THREE.Geometry.call(this);var g=THREE.UTF8Loader.prototype.decompressMesh(a),i=[],k=[];(function(a,g,i){for(var j,k,r,u=a.length;i<u;i=i+g){j=a[i];k=a[i+1];r=a[i+2];j=j/16383*c;k=k/16383*c;r=r/16383*c;j=j+d;k=k+f;r=r+e;b.vertices.push(new THREE.Vector3(j,k,r))}})(g[0],8,0);(function(a,b,c){for(var d,e,f=a.length;c<f;c=c+b){d=a[c];e=a[c+1];d=d/1023;e=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=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;i.push(d,e,f)}})(g[0],8,5);(function(a){var c,d,e,f,g,j,s,t,p,w=a.length;for(c=0;c<w;c=c+3){d=a[c];e=a[c+1];f=a[c+2];g=b;t=d;p=e;j=f;var A=i[e*3],z=i[e*3+1],x=i[e*3+2],v=i[f*3],B=i[f*3+1],E=i[f*3+2];s=new THREE.Vector3(i[d*3],i[d*3+1],i[d*3+2]);A=new THREE.Vector3(A,z,x);v=new THREE.Vector3(v,B,E);g.faces.push(new THREE.Face3(t,p,j,[s,A,v],null,0));g=k[d*2];d=k[d*2+1];j=k[e*2];s=k[e*2+1];t=
+k[f*2];p=k[f*2+1];f=b.faceVertexUvs[0];e=j;j=s;s=[];s.push(new THREE.UV(g,d));s.push(new THREE.UV(e,j));s.push(new THREE.UV(t,p));f.push(s)}})(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;a!==void 0&&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){b===void 0&&(b=-1);c===void 0&&(c=0);e===void 0&&(e=1);f===void 0&&(f=new THREE.Color(16777215));if(d===void 0)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=-this.positionScreen.x*2,f=-this.positionScreen.y*2;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=c.x*Math.PI*0.25;c.rotation=c.rotation+(c.wantedRotation-c.rotation)*0.25}};
@@ -377,41 +378,41 @@ THREE.MorphBlendMesh.prototype.setAnimationDuration=function(a,b){var c=this.ani
 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];if(b){b.time=0;b.active=true}else console.warn("animation["+a+"] undefined")};THREE.MorphBlendMesh.prototype.stopAnimation=function(a){if(a=this.animationsMap[a])a.active=false};
 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.time+d.direction*a;if(d.mirroredLoop){if(d.time>d.duration||d.time<0){d.direction=d.direction*-1;if(d.time>d.duration){d.time=d.duration;d.directionBackwards=true}if(d.time<0){d.time=0;d.directionBackwards=false}}}else{d.time=d.time%d.duration;if(d.time<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,j,i,k,q,l,n;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();j=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),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,j,i,k,o,l,n;this.init=function(q){b=q.context;c=q;d=new Float32Array(16);f=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;f[q++]=0;f[q++]=1;f[q++]=2;f[q++]=0;f[q++]=2;f[q++]=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();j=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,j);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);if(b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)<=0){i=false;k=a(THREE.ShaderFlares.lensFlare)}else{i=true;k=a(THREE.ShaderFlares.lensFlareVertexTexture)}q={};l={};q.vertex=b.getAttribLocation(k,"position");q.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");n=false};this.render=function(a,d,f,t){var a=a.__webglFlares,s=a.length;if(s){var v=new THREE.Vector3,o=t/f,x=f*0.5,y=t*0.5,z=16/t,u=new THREE.Vector2(z*o,z),w=new THREE.Vector3(1,1,0),E=new THREE.Vector2(1,1),H=l,z=q;b.useProgram(k);if(!n){b.enableVertexAttribArray(q.vertex);b.enableVertexAttribArray(q.uv);n=true}b.uniform1i(H.occlusionMap,0);b.uniform1i(H.map,
-1);b.bindBuffer(b.ARRAY_BUFFER,e);b.vertexAttribPointer(z.vertex,2,b.FLOAT,false,16,0);b.vertexAttribPointer(z.uv,2,b.FLOAT,false,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.disable(b.CULL_FACE);b.depthMask(false);var I,J,C,A,B;for(I=0;I<s;I++){z=16/t;u.set(z*o,z);A=a[I];v.set(A.matrixWorld.elements[12],A.matrixWorld.elements[13],A.matrixWorld.elements[14]);d.matrixWorldInverse.multiplyVector3(v);d.projectionMatrix.multiplyVector3(v);w.copy(v);E.x=w.x*x+x;E.y=w.y*y+y;if(i||E.x>0&&E.x<f&&E.y>0&&
-E.y<t){b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,h);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,E.x-8,E.y-8,16,16,0);b.uniform1i(H.renderType,0);b.uniform2f(H.scale,u.x,u.y);b.uniform3f(H.screenPosition,w.x,w.y,w.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,j);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGBA,E.x-8,E.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);A.positionScreen.copy(w);A.customUpdateCallback?A.customUpdateCallback(A):A.updateLensFlares();b.uniform1i(H.renderType,2);b.enable(b.BLEND);J=0;for(C=A.lensFlares.length;J<C;J++){B=A.lensFlares[J];if(B.opacity>0.0010&&B.scale>0.0010){w.x=B.x;w.y=B.y;w.z=B.z;z=B.size*B.scale/t;u.x=z*o;u.y=z;b.uniform3f(H.screenPosition,w.x,w.y,w.z);b.uniform2f(H.scale,u.x,u.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,B.blendEquation,B.blendSrc,B.blendDst);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(true)}}};
+b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);if(b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)<=0){i=false;k=a(THREE.ShaderFlares.lensFlare)}else{i=true;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");n=false};this.render=function(a,d,f,u){var a=a.__webglFlares,s=a.length;if(s){var t=new THREE.Vector3,p=u/f,w=f*0.5,A=u*0.5,z=16/u,x=new THREE.Vector2(z*p,z),v=new THREE.Vector3(1,1,0),B=new THREE.Vector2(1,1),E=l,z=o;b.useProgram(k);if(!n){b.enableVertexAttribArray(o.vertex);b.enableVertexAttribArray(o.uv);n=true}b.uniform1i(E.occlusionMap,0);b.uniform1i(E.map,
+1);b.bindBuffer(b.ARRAY_BUFFER,e);b.vertexAttribPointer(z.vertex,2,b.FLOAT,false,16,0);b.vertexAttribPointer(z.uv,2,b.FLOAT,false,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.disable(b.CULL_FACE);b.depthMask(false);var H,K,I,y,C;for(H=0;H<s;H++){z=16/u;x.set(z*p,z);y=a[H];t.set(y.matrixWorld.elements[12],y.matrixWorld.elements[13],y.matrixWorld.elements[14]);d.matrixWorldInverse.multiplyVector3(t);d.projectionMatrix.multiplyVector3(t);v.copy(t);B.x=v.x*w+w;B.y=v.y*A+A;if(i||B.x>0&&B.x<f&&B.y>0&&
+B.y<u){b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,h);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,B.x-8,B.y-8,16,16,0);b.uniform1i(E.renderType,0);b.uniform2f(E.scale,x.x,x.y);b.uniform3f(E.screenPosition,v.x,v.y,v.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,j);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGBA,B.x-8,B.y-8,16,16,0);b.uniform1i(E.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(v);y.customUpdateCallback?y.customUpdateCallback(y):y.updateLensFlares();b.uniform1i(E.renderType,2);b.enable(b.BLEND);K=0;for(I=y.lensFlares.length;K<I;K++){C=y.lensFlares[K];if(C.opacity>0.0010&&C.scale>0.0010){v.x=C.x;v.y=C.y;v.z=C.z;z=C.size*C.scale/u;x.x=z*p;x.y=z;b.uniform3f(E.screenPosition,v.x,v.y,v.z);b.uniform2f(E.scale,x.x,x.y);b.uniform1f(E.rotation,C.rotation);b.uniform1f(E.opacity,C.opacity);
+b.uniform3f(E.color,C.color.r,C.color.g,C.color.b);c.setBlending(C.blending,C.blendEquation,C.blendSrc,C.blendDst);c.setTexture(C.texture,1);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0)}}}}b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(true)}}};
 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:true});c._shadowPass=true;d._shadowPass=true};this.render=
-function(a,c){b.shadowMapEnabled&&b.shadowMapAutoUpdate&&this.update(a,c)};this.update=function(j,i){var k,q,l,n,r,m,p,t,s,v=[];n=0;a.clearColor(1,1,1,1);a.disable(a.BLEND);b.shadowMapCullFrontFaces&&a.cullFace(a.FRONT);b.setDepthTest(true);k=0;for(q=j.__lights.length;k<q;k++){l=j.__lights[k];if(l.castShadow)if(l instanceof THREE.DirectionalLight&&l.shadowCascade)for(r=0;r<l.shadowCascadeCount;r++){var o;if(l.shadowCascadeArray[r])o=l.shadowCascadeArray[r];else{s=l;p=r;o=new THREE.DirectionalLight;
-o.isVirtual=true;o.onlyShadow=true;o.castShadow=true;o.shadowCameraNear=s.shadowCameraNear;o.shadowCameraFar=s.shadowCameraFar;o.shadowCameraLeft=s.shadowCameraLeft;o.shadowCameraRight=s.shadowCameraRight;o.shadowCameraBottom=s.shadowCameraBottom;o.shadowCameraTop=s.shadowCameraTop;o.shadowCameraVisible=s.shadowCameraVisible;o.shadowDarkness=s.shadowDarkness;o.shadowBias=s.shadowCascadeBias[p];o.shadowMapWidth=s.shadowCascadeWidth[p];o.shadowMapHeight=s.shadowCascadeHeight[p];o.pointsWorld=[];o.pointsFrustum=
-[];t=o.pointsWorld;m=o.pointsFrustum;for(var x=0;x<8;x++){t[x]=new THREE.Vector3;m[x]=new THREE.Vector3}t=s.shadowCascadeNearZ[p];s=s.shadowCascadeFarZ[p];m[0].set(-1,-1,t);m[1].set(1,-1,t);m[2].set(-1,1,t);m[3].set(1,1,t);m[4].set(-1,-1,s);m[5].set(1,-1,s);m[6].set(-1,1,s);m[7].set(1,1,s);o.originalCamera=i;m=new THREE.Gyroscope;m.position=l.shadowCascadeOffset;m.add(o);m.add(o.target);i.add(m);l.shadowCascadeArray[r]=o;console.log("Created virtualLight",o)}p=l;t=r;s=p.shadowCascadeArray[t];s.position.copy(p.position);
-s.target.position.copy(p.target.position);s.lookAt(s.target);s.shadowCameraVisible=p.shadowCameraVisible;s.shadowDarkness=p.shadowDarkness;s.shadowBias=p.shadowCascadeBias[t];m=p.shadowCascadeNearZ[t];p=p.shadowCascadeFarZ[t];s=s.pointsFrustum;s[0].z=m;s[1].z=m;s[2].z=m;s[3].z=m;s[4].z=p;s[5].z=p;s[6].z=p;s[7].z=p;v[n]=o;n++}else{v[n]=l;n++}}k=0;for(q=v.length;k<q;k++){l=v[k];if(!l.shadowMap){l.shadowMap=new THREE.WebGLRenderTarget(l.shadowMapWidth,l.shadowMapHeight,{minFilter:THREE.LinearFilter,
+function(a,c){b.shadowMapEnabled&&b.shadowMapAutoUpdate&&this.update(a,c)};this.update=function(j,i){var k,o,l,n,q,m,r,u,s,t=[];n=0;a.clearColor(1,1,1,1);a.disable(a.BLEND);b.shadowMapCullFrontFaces&&a.cullFace(a.FRONT);b.setDepthTest(true);k=0;for(o=j.__lights.length;k<o;k++){l=j.__lights[k];if(l.castShadow)if(l instanceof THREE.DirectionalLight&&l.shadowCascade)for(q=0;q<l.shadowCascadeCount;q++){var p;if(l.shadowCascadeArray[q])p=l.shadowCascadeArray[q];else{s=l;r=q;p=new THREE.DirectionalLight;
+p.isVirtual=true;p.onlyShadow=true;p.castShadow=true;p.shadowCameraNear=s.shadowCameraNear;p.shadowCameraFar=s.shadowCameraFar;p.shadowCameraLeft=s.shadowCameraLeft;p.shadowCameraRight=s.shadowCameraRight;p.shadowCameraBottom=s.shadowCameraBottom;p.shadowCameraTop=s.shadowCameraTop;p.shadowCameraVisible=s.shadowCameraVisible;p.shadowDarkness=s.shadowDarkness;p.shadowBias=s.shadowCascadeBias[r];p.shadowMapWidth=s.shadowCascadeWidth[r];p.shadowMapHeight=s.shadowCascadeHeight[r];p.pointsWorld=[];p.pointsFrustum=
+[];u=p.pointsWorld;m=p.pointsFrustum;for(var w=0;w<8;w++){u[w]=new THREE.Vector3;m[w]=new THREE.Vector3}u=s.shadowCascadeNearZ[r];s=s.shadowCascadeFarZ[r];m[0].set(-1,-1,u);m[1].set(1,-1,u);m[2].set(-1,1,u);m[3].set(1,1,u);m[4].set(-1,-1,s);m[5].set(1,-1,s);m[6].set(-1,1,s);m[7].set(1,1,s);p.originalCamera=i;m=new THREE.Gyroscope;m.position=l.shadowCascadeOffset;m.add(p);m.add(p.target);i.add(m);l.shadowCascadeArray[q]=p;console.log("Created virtualLight",p)}r=l;u=q;s=r.shadowCascadeArray[u];s.position.copy(r.position);
+s.target.position.copy(r.target.position);s.lookAt(s.target);s.shadowCameraVisible=r.shadowCameraVisible;s.shadowDarkness=r.shadowDarkness;s.shadowBias=r.shadowCascadeBias[u];m=r.shadowCascadeNearZ[u];r=r.shadowCascadeFarZ[u];s=s.pointsFrustum;s[0].z=m;s[1].z=m;s[2].z=m;s[3].z=m;s[4].z=r;s[5].z=r;s[6].z=r;s[7].z=r;t[n]=p;n++}else{t[n]=l;n++}}k=0;for(o=t.length;k<o;k++){l=t[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}j.add(l.shadowCamera);b.autoUpdateScene&&j.updateMatrixWorld()}if(l.shadowCameraVisible&&!l.cameraHelper){l.cameraHelper=new THREE.CameraHelper(l.shadowCamera);l.shadowCamera.add(l.cameraHelper)}if(l.isVirtual&&o.originalCamera==i){r=i;n=l.shadowCamera;m=l.pointsFrustum;s=l.pointsWorld;g.set(Infinity,Infinity,Infinity);h.set(-Infinity,-Infinity,-Infinity);for(p=0;p<8;p++){t=s[p];t.copy(m[p]);THREE.ShadowMapPlugin.__projector.unprojectVector(t,
-r);n.matrixWorldInverse.multiplyVector3(t);if(t.x<g.x)g.x=t.x;if(t.x>h.x)h.x=t.x;if(t.y<g.y)g.y=t.y;if(t.y>h.y)h.y=t.y;if(t.z<g.z)g.z=t.z;if(t.z>h.z)h.z=t.z}n.left=g.x;n.right=h.x;n.top=h.y;n.bottom=g.y;n.updateProjectionMatrix()}n=l.shadowMap;m=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();m.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);m.multiplySelf(r.projectionMatrix);m.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(n);
-b.clear();s=j.__webglObjects;l=0;for(n=s.length;l<n;l++){p=s[l];m=p.object;p.render=false;if(m.visible&&m.castShadow&&(!(m instanceof THREE.Mesh)||!m.frustumCulled||f.contains(m))){m._modelViewMatrix.multiply(r.matrixWorldInverse,m.matrixWorld);p.render=true}}l=0;for(n=s.length;l<n;l++){p=s[l];if(p.render){m=p.object;p=p.buffer;b.setObjectFaces(m);t=m.customDepthMaterial?m.customDepthMaterial:m.geometry.morphTargets.length?d:c;p instanceof THREE.BufferGeometry?b.renderBufferDirect(r,j.__lights,null,
-t,p,m):b.renderBuffer(r,j.__lights,null,t,p,m)}}s=j.__webglObjectsImmediate;l=0;for(n=s.length;l<n;l++){p=s[l];m=p.object;if(m.visible&&m.castShadow){m._modelViewMatrix.multiply(r.matrixWorldInverse,m.matrixWorld);b.renderImmediateObject(r,j.__lights,null,c,m)}}}k=b.getClearColor();q=b.getClearAlpha();a.clearColor(k.r,k.g,k.b,q);a.enable(a.BLEND);b.shadowMapCullFrontFaces&&a.cullFace(a.BACK)}};THREE.ShadowMapPlugin.__projector=new THREE.Projector;
+l.shadowCameraNear,l.shadowCameraFar);else{console.error("Unsupported light type for shadow");continue}j.add(l.shadowCamera);b.autoUpdateScene&&j.updateMatrixWorld()}if(l.shadowCameraVisible&&!l.cameraHelper){l.cameraHelper=new THREE.CameraHelper(l.shadowCamera);l.shadowCamera.add(l.cameraHelper)}if(l.isVirtual&&p.originalCamera==i){q=i;n=l.shadowCamera;m=l.pointsFrustum;s=l.pointsWorld;g.set(Infinity,Infinity,Infinity);h.set(-Infinity,-Infinity,-Infinity);for(r=0;r<8;r++){u=s[r];u.copy(m[r]);THREE.ShadowMapPlugin.__projector.unprojectVector(u,
+q);n.matrixWorldInverse.multiplyVector3(u);if(u.x<g.x)g.x=u.x;if(u.x>h.x)h.x=u.x;if(u.y<g.y)g.y=u.y;if(u.y>h.y)h.y=u.y;if(u.z<g.z)g.z=u.z;if(u.z>h.z)h.z=u.z}n.left=g.x;n.right=h.x;n.top=h.y;n.bottom=g.y;n.updateProjectionMatrix()}n=l.shadowMap;m=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();m.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);m.multiplySelf(q.projectionMatrix);m.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);e.multiply(q.projectionMatrix,q.matrixWorldInverse);f.setFromMatrix(e);b.setRenderTarget(n);
+b.clear();s=j.__webglObjects;l=0;for(n=s.length;l<n;l++){r=s[l];m=r.object;r.render=false;if(m.visible&&m.castShadow&&(!(m instanceof THREE.Mesh)||!m.frustumCulled||f.contains(m))){m._modelViewMatrix.multiply(q.matrixWorldInverse,m.matrixWorld);r.render=true}}l=0;for(n=s.length;l<n;l++){r=s[l];if(r.render){m=r.object;r=r.buffer;b.setObjectFaces(m);u=m.customDepthMaterial?m.customDepthMaterial:m.geometry.morphTargets.length?d:c;r instanceof THREE.BufferGeometry?b.renderBufferDirect(q,j.__lights,null,
+u,r,m):b.renderBuffer(q,j.__lights,null,u,r,m)}}s=j.__webglObjectsImmediate;l=0;for(n=s.length;l<n;l++){r=s[l];m=r.object;if(m.visible&&m.castShadow){m._modelViewMatrix.multiply(q.matrixWorldInverse,m.matrixWorld);b.renderImmediateObject(q,j.__lights,null,c,m)}}}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,j,i,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(),n=b.createShader(b.FRAGMENT_SHADER),r=b.createShader(b.VERTEX_SHADER);b.shaderSource(n,a.fragmentShader);b.shaderSource(r,a.vertexShader);b.compileShader(n);b.compileShader(r);b.attachShader(l,n);b.attachShader(l,r);b.linkProgram(l);h=l;j={};i={};j.position=b.getAttribLocation(h,"position");j.uv=b.getAttribLocation(h,"uv");i.uvOffset=b.getUniformLocation(h,"uvOffset");i.uvScale=b.getUniformLocation(h,
+g);b.bufferData(b.ELEMENT_ARRAY_BUFFER,f,b.STATIC_DRAW);var a=THREE.ShaderSprite.sprite,l=b.createProgram(),n=b.createShader(b.FRAGMENT_SHADER),q=b.createShader(b.VERTEX_SHADER);b.shaderSource(n,a.fragmentShader);b.shaderSource(q,a.vertexShader);b.compileShader(n);b.compileShader(q);b.attachShader(l,n);b.attachShader(l,q);b.linkProgram(l);h=l;j={};i={};j.position=b.getAttribLocation(h,"position");j.uv=b.getAttribLocation(h,"uv");i.uvOffset=b.getUniformLocation(h,"uvOffset");i.uvScale=b.getUniformLocation(h,
 "uvScale");i.rotation=b.getUniformLocation(h,"rotation");i.scale=b.getUniformLocation(h,"scale");i.alignment=b.getUniformLocation(h,"alignment");i.color=b.getUniformLocation(h,"color");i.map=b.getUniformLocation(h,"map");i.opacity=b.getUniformLocation(h,"opacity");i.useScreenCoordinates=b.getUniformLocation(h,"useScreenCoordinates");i.affectedByDistance=b.getUniformLocation(h,"affectedByDistance");i.screenPosition=b.getUniformLocation(h,"screenPosition");i.modelViewMatrix=b.getUniformLocation(h,"modelViewMatrix");
-i.projectionMatrix=b.getUniformLocation(h,"projectionMatrix");k=false};this.render=function(d,f,n,r){var d=d.__webglSprites,m=d.length;if(m){var p=j,t=i,s=r/n,n=n*0.5,v=r*0.5,o=true;b.useProgram(h);if(!k){b.enableVertexAttribArray(p.position);b.enableVertexAttribArray(p.uv);k=true}b.disable(b.CULL_FACE);b.enable(b.BLEND);b.depthMask(true);b.bindBuffer(b.ARRAY_BUFFER,e);b.vertexAttribPointer(p.position,2,b.FLOAT,false,16,0);b.vertexAttribPointer(p.uv,2,b.FLOAT,false,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,
-g);b.uniformMatrix4fv(t.projectionMatrix,false,f._projectionMatrixArray);b.activeTexture(b.TEXTURE0);b.uniform1i(t.map,0);for(var x,y=[],p=0;p<m;p++){x=d[p];if(x.visible&&x.opacity!==0)if(x.useScreenCoordinates)x.z=-x.position.z;else{x._modelViewMatrix.multiply(f.matrixWorldInverse,x.matrixWorld);x.z=-x._modelViewMatrix.elements[14]}}d.sort(a);for(p=0;p<m;p++){x=d[p];if(x.visible&&x.opacity!==0&&x.map&&x.map.image&&x.map.image.width){if(x.useScreenCoordinates){b.uniform1i(t.useScreenCoordinates,1);
-b.uniform3f(t.screenPosition,(x.position.x-n)/n,(v-x.position.y)/v,Math.max(0,Math.min(1,x.position.z)))}else{b.uniform1i(t.useScreenCoordinates,0);b.uniform1i(t.affectedByDistance,x.affectedByDistance?1:0);b.uniformMatrix4fv(t.modelViewMatrix,false,x._modelViewMatrix.elements)}f=x.map.image.width/(x.scaleByViewport?r:1);y[0]=f*s*x.scale.x;y[1]=f*x.scale.y;b.uniform2f(t.uvScale,x.uvScale.x,x.uvScale.y);b.uniform2f(t.uvOffset,x.uvOffset.x,x.uvOffset.y);b.uniform2f(t.alignment,x.alignment.x,x.alignment.y);
-b.uniform1f(t.opacity,x.opacity);b.uniform3f(t.color,x.color.r,x.color.g,x.color.b);b.uniform1f(t.rotation,x.rotation);b.uniform2fv(t.scale,y);if(x.mergeWith3D&&!o){b.enable(b.DEPTH_TEST);o=true}else if(!x.mergeWith3D&&o){b.disable(b.DEPTH_TEST);o=false}c.setBlending(x.blending,x.blendEquation,x.blendSrc,x.blendDst);c.setTexture(x.map,0);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0)}}b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(true)}}};
+i.projectionMatrix=b.getUniformLocation(h,"projectionMatrix");k=false};this.render=function(d,f,n,q){var d=d.__webglSprites,m=d.length;if(m){var r=j,u=i,s=q/n,n=n*0.5,t=q*0.5,p=true;b.useProgram(h);if(!k){b.enableVertexAttribArray(r.position);b.enableVertexAttribArray(r.uv);k=true}b.disable(b.CULL_FACE);b.enable(b.BLEND);b.depthMask(true);b.bindBuffer(b.ARRAY_BUFFER,e);b.vertexAttribPointer(r.position,2,b.FLOAT,false,16,0);b.vertexAttribPointer(r.uv,2,b.FLOAT,false,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,
+g);b.uniformMatrix4fv(u.projectionMatrix,false,f._projectionMatrixArray);b.activeTexture(b.TEXTURE0);b.uniform1i(u.map,0);for(var w,A=[],r=0;r<m;r++){w=d[r];if(w.visible&&w.opacity!==0)if(w.useScreenCoordinates)w.z=-w.position.z;else{w._modelViewMatrix.multiply(f.matrixWorldInverse,w.matrixWorld);w.z=-w._modelViewMatrix.elements[14]}}d.sort(a);for(r=0;r<m;r++){w=d[r];if(w.visible&&w.opacity!==0&&w.map&&w.map.image&&w.map.image.width){if(w.useScreenCoordinates){b.uniform1i(u.useScreenCoordinates,1);
+b.uniform3f(u.screenPosition,(w.position.x-n)/n,(t-w.position.y)/t,Math.max(0,Math.min(1,w.position.z)))}else{b.uniform1i(u.useScreenCoordinates,0);b.uniform1i(u.affectedByDistance,w.affectedByDistance?1:0);b.uniformMatrix4fv(u.modelViewMatrix,false,w._modelViewMatrix.elements)}f=w.map.image.width/(w.scaleByViewport?q:1);A[0]=f*s*w.scale.x;A[1]=f*w.scale.y;b.uniform2f(u.uvScale,w.uvScale.x,w.uvScale.y);b.uniform2f(u.uvOffset,w.uvOffset.x,w.uvOffset.y);b.uniform2f(u.alignment,w.alignment.x,w.alignment.y);
+b.uniform1f(u.opacity,w.opacity);b.uniform3f(u.color,w.color.r,w.color.g,w.color.b);b.uniform1f(u.rotation,w.rotation);b.uniform2fv(u.scale,A);if(w.mergeWith3D&&!p){b.enable(b.DEPTH_TEST);p=true}else if(!w.mergeWith3D&&p){b.disable(b.DEPTH_TEST);p=false}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(true)}}};
 THREE.DepthPassPlugin=function(){this.enabled=false;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:true});c._shadowPass=true;d._shadowPass=true};this.render=
-function(a,b){this.enabled&&this.update(a,b)};this.update=function(g,h){var j,i,k,q,l,n;a.clearColor(1,1,1,1);a.disable(a.BLEND);b.setDepthTest(true);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();n=g.__webglObjects;j=0;for(i=n.length;j<i;j++){k=n[j];l=k.object;k.render=false;if(l.visible&&(!(l instanceof THREE.Mesh)||!l.frustumCulled||f.contains(l))){l._modelViewMatrix.multiply(h.matrixWorldInverse,l.matrixWorld);k.render=true}}j=0;for(i=n.length;j<i;j++){k=n[j];if(k.render){l=k.object;k=k.buffer;b.setObjectFaces(l);q=l.customDepthMaterial?l.customDepthMaterial:l.geometry.morphTargets.length?d:c;k instanceof
-THREE.BufferGeometry?b.renderBufferDirect(h,g.__lights,null,q,k,l):b.renderBuffer(h,g.__lights,null,q,k,l)}}n=g.__webglObjectsImmediate;j=0;for(i=n.length;j<i;j++){k=n[j];l=k.object;if(l.visible&&l.castShadow){l._modelViewMatrix.multiply(h.matrixWorldInverse,l.matrixWorld);b.renderImmediateObject(h,g.__lights,null,c,l)}}j=b.getClearColor();i=b.getClearAlpha();a.clearColor(j.r,j.g,j.b,i);a.enable(a.BLEND)}};
-THREE.WebGLRenderer&&(THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoUpdateScene=false;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,j,i,k,q;f.matrixAutoUpdate=e.matrixAutoUpdate=false;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},l=new THREE.WebGLRenderTarget(512,512,a),n=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:n}},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}"}),
-m=new THREE.Scene,a=new THREE.Mesh(new THREE.PlaneGeometry(2,2),a);a.rotation.x=Math.PI/2;m.add(a);m.add(r);this.setSize=function(a,d){c.call(b,a,d);l.width=a;l.height=d;n.width=a;n.height=d};this.render=function(a,c){a.updateMatrixWorld();if(j!==c.aspect||i!==c.near||k!==c.far||q!==c.fov){j=c.aspect;i=c.near;k=c.far;q=c.fov;var s=c.projectionMatrix.clone(),v=125/30*0.5,o=v*i/125,x=i*Math.tan(q*Math.PI/360),y;g.elements[12]=v;h.elements[12]=-v;v=-x*j+o;y=x*j+o;s.elements[0]=2*i/(y-v);s.elements[8]=
-(y+v)/(y-v);f.projectionMatrix.copy(s);v=-x*j-o;y=x*j-o;s.elements[0]=2*i/(y-v);s.elements[8]=(y+v)/(y-v);e.projectionMatrix.copy(s)}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,true);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,n,true);m.updateMatrixWorld();d.call(b,m,r)}});
+function(a,b){this.enabled&&this.update(a,b)};this.update=function(g,h){var j,i,k,o,l,n;a.clearColor(1,1,1,1);a.disable(a.BLEND);b.setDepthTest(true);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();n=g.__webglObjects;j=0;for(i=n.length;j<i;j++){k=n[j];l=k.object;k.render=false;if(l.visible&&(!(l instanceof THREE.Mesh)||!l.frustumCulled||f.contains(l))){l._modelViewMatrix.multiply(h.matrixWorldInverse,l.matrixWorld);k.render=true}}j=0;for(i=n.length;j<i;j++){k=n[j];if(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)}}n=g.__webglObjectsImmediate;j=0;for(i=n.length;j<i;j++){k=n[j];l=k.object;if(l.visible&&l.castShadow){l._modelViewMatrix.multiply(h.matrixWorldInverse,l.matrixWorld);b.renderImmediateObject(h,g.__lights,null,c,l)}}j=b.getClearColor();i=b.getClearAlpha();a.clearColor(j.r,j.g,j.b,i);a.enable(a.BLEND)}};
+THREE.WebGLRenderer&&(THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoUpdateScene=false;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,j,i,k,o;f.matrixAutoUpdate=e.matrixAutoUpdate=false;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},l=new THREE.WebGLRenderTarget(512,512,a),n=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:n}},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}"}),
+m=new THREE.Scene,a=new THREE.Mesh(new THREE.PlaneGeometry(2,2),a);a.rotation.x=Math.PI/2;m.add(a);m.add(q);this.setSize=function(a,d){c.call(b,a,d);l.width=a;l.height=d;n.width=a;n.height=d};this.render=function(a,c){a.updateMatrixWorld();if(j!==c.aspect||i!==c.near||k!==c.far||o!==c.fov){j=c.aspect;i=c.near;k=c.far;o=c.fov;var s=c.projectionMatrix.clone(),t=125/30*0.5,p=t*i/125,w=i*Math.tan(o*Math.PI/360),A;g.elements[12]=t;h.elements[12]=-t;t=-w*j+p;A=w*j+p;s.elements[0]=2*i/(A-t);s.elements[8]=
+(A+t)/(A-t);f.projectionMatrix.copy(s);t=-w*j-p;A=w*j-p;s.elements[0]=2*i/(A-t);s.elements[8]=(A+t)/(A-t);e.projectionMatrix.copy(s)}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,true);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,n,true);m.updateMatrixWorld();d.call(b,m,q)}});
 THREE.WebGLRenderer&&(THREE.CrosseyedWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoClear=false;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&&a.separation!==void 0)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,false)}});
 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}"},

+ 1 - 1
build/custom/ThreeSVG.js

@@ -79,7 +79,7 @@ this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRo
 Math.abs(this.x);this.y=a.elements[8]-a.elements[2]<0?-Math.abs(this.y):Math.abs(this.y);this.z=a.elements[1]-a.elements[4]<0?-Math.abs(this.z):Math.abs(this.z);this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x=this.x*-1;this.y=this.y*-1;this.z=this.z*-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=
 Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a===0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x=this.x*a;this.y=this.y*a;this.z=this.z*a;this.w=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,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,k=j*c+g*e-i*d,h=j*d+i*c-f*e,m=j*e+f*d-g*c,c=-f*c-g*d-i*e;b.x=k*j+c*-f+h*-i-m*-g;b.y=h*j+c*-g+m*-f-k*-i;b.z=m*j+c*-i+k*-g-h*-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;if(e<0){c.w=-b.w;c.x=-b.x;c.y=-b.y;c.z=-b.z;e=-e}else c.copy(b);if(Math.abs(e)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var f=Math.acos(e),e=Math.sqrt(1-e*e);if(Math.abs(e)<0.0010){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}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=THREE.Vector3;
+THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(e<0){c.w=-b.w;c.x=-b.x;c.y=-b.y;c.z=-b.z;e=-e}else c.copy(b);if(Math.abs(e)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var f=Math.acos(e),e=Math.sqrt(1-e*e);if(Math.abs(e)<0.0010){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}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(){console.warn("THREE.Vertex has been DEPRECATED. Use THREE.Vector3 instead.")};
 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;b=0;for(c=this.vertexNormals.length;b<c;b++)a.vertexNormals[b]=this.vertexNormals[b].clone();b=0;for(c=this.vertexColors.length;b<c;b++)a.vertexColors[b]=this.vertexColors[b].clone();b=0;for(c=this.vertexTangents.length;b<c;b++)a.vertexTangents[b]=this.vertexTangents[b].clone();
 return a}};THREE.Face4=function(a,b,c,d,e,f,g){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materialIndex=g;this.centroid=new THREE.Vector3};

+ 2 - 2
build/custom/ThreeWebGL.js

@@ -79,7 +79,7 @@ this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRo
 Math.abs(this.x);this.y=a.elements[8]-a.elements[2]<0?-Math.abs(this.y):Math.abs(this.y);this.z=a.elements[1]-a.elements[4]<0?-Math.abs(this.z):Math.abs(this.z);this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x=this.x*-1;this.y=this.y*-1;this.z=this.z*-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=
 Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a===0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x=this.x*a;this.y=this.y*a;this.z=this.z*a;this.w=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,m=this.w,l=m*c+i*f-h*d,j=m*d+h*c-g*f,t=m*f+g*d-i*c,c=-g*c-i*d-h*f;b.x=l*m+c*-g+j*-h-t*-i;b.y=j*m+c*-i+t*-g-l*-h;b.z=t*m+c*-h+l*-i-j*-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;if(f<0){c.w=-b.w;c.x=-b.x;c.y=-b.y;c.z=-b.z;f=-f}else c.copy(b);if(Math.abs(f)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var g=Math.acos(f),f=Math.sqrt(1-f*f);if(Math.abs(f)<0.0010){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}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=THREE.Vector3;
+THREE.Quaternion.slerp=function(a,b,c,d){var f=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(f<0){c.w=-b.w;c.x=-b.x;c.y=-b.y;c.z=-b.z;f=-f}else c.copy(b);if(Math.abs(f)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var g=Math.acos(f),f=Math.sqrt(1-f*f);if(Math.abs(f)<0.0010){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}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(){console.warn("THREE.Vertex has been DEPRECATED. Use THREE.Vector3 instead.")};
 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;b=0;for(c=this.vertexNormals.length;b<c;b++)a.vertexNormals[b]=this.vertexNormals[b].clone();b=0;for(c=this.vertexColors.length;b<c;b++)a.vertexColors[b]=this.vertexColors[b].clone();b=0;for(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};
@@ -337,7 +337,7 @@ THREE.BufferGeometry=function(){this.id=THREE.GeometryCount++;this.vertexColorAr
 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){if(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)}else this.matrixWorld.copy(this.matrix);
 this.matrixWorldNeedsUpdate=false;a=true}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.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);d.lineGeometry.colors.push(new THREE.Color(b));d.pointMap[a]===void 0&&(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",
+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.Vector3);d.lineGeometry.colors.push(new THREE.Color(b));d.pointMap[a]===void 0&&(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,g){THREE.CameraHelper.__v.set(d,f,g);THREE.CameraHelper.__projector.unprojectVector(THREE.CameraHelper.__v,THREE.CameraHelper.__c);a=b.pointMap[a];if(a!==void 0){d=0;for(f=a.length;d<f;d++)b.lineGeometry.vertices[a[d]].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,

+ 2 - 2
examples/canvas_camera_orthographic.html

@@ -53,8 +53,8 @@
 				// Grid
 
 				var geometry = new THREE.Geometry();
-				geometry.vertices.push( new THREE.Vertex( - 500, 0, 0 ) );
-				geometry.vertices.push( new THREE.Vertex( 500, 0, 0 ) );
+				geometry.vertices.push( new THREE.Vector3( - 500, 0, 0 ) );
+				geometry.vertices.push( new THREE.Vector3( 500, 0, 0 ) );
 
 				for ( var i = 0; i <= 20; i ++ ) {
 

+ 2 - 2
examples/canvas_camera_orthographic2.html

@@ -119,8 +119,8 @@
 				// Grid
 
 				var geometry = new THREE.Geometry();
-				geometry.vertices.push( new THREE.Vertex( - 500, 0, 0 ) );
-				geometry.vertices.push( new THREE.Vertex( 500, 0, 0 ) );
+				geometry.vertices.push( new THREE.Vector3( - 500, 0, 0 ) );
+				geometry.vertices.push( new THREE.Vector3( 500, 0, 0 ) );
 
 				for ( var i = 0; i <= 20; i ++ ) {
 

+ 2 - 2
examples/canvas_interactive_voxelpainter.html

@@ -55,8 +55,8 @@
 				// Grid
 
 				var geometry = new THREE.Geometry();
-				geometry.vertices.push( new THREE.Vertex( - 500, 0, 0 ) );
-				geometry.vertices.push( new THREE.Vertex( 500, 0, 0 ) );
+				geometry.vertices.push( new THREE.Vector3( - 500, 0, 0 ) );
+				geometry.vertices.push( new THREE.Vector3( 500, 0, 0 ) );
 
 				var material = new THREE.LineBasicMaterial( { color: 0x000000, opacity: 0.2 } );
 

+ 1 - 1
examples/canvas_lines.html

@@ -85,7 +85,7 @@
 					particle.scale.x = particle.scale.y = 5;
 					scene.add( particle );
 
-					geometry.vertices.push( new THREE.Vertex().copy( particle.position ) );
+					geometry.vertices.push( particle.position );
 
 				}
 

+ 1 - 1
examples/canvas_lines_sphere.html

@@ -93,7 +93,7 @@
 
 					var geometry = new THREE.Geometry();
 
-					var vertex = new THREE.Vertex( Math.random() * 2 - 1, Math.random() * 2 - 1, Math.random() * 2 - 1 );
+					var vertex = new THREE.Vector3( Math.random() * 2 - 1, Math.random() * 2 - 1, Math.random() * 2 - 1 );
 					vertex.normalize();
 					vertex.multiplyScalar( 450 );
 

+ 2 - 2
examples/canvas_materials.html

@@ -44,8 +44,8 @@
 				// Grid
 
 				var geometry = new THREE.Geometry();
-				geometry.vertices.push( new THREE.Vertex( - 500, 0, 0 ) );
-				geometry.vertices.push( new THREE.Vertex( 500, 0, 0 ) );
+				geometry.vertices.push( new THREE.Vector3( - 500, 0, 0 ) );
+				geometry.vertices.push( new THREE.Vector3( 500, 0, 0 ) );
 
 				var material = new THREE.LineBasicMaterial( { color: 0xffffff, opacity: 0.2 } );
 

+ 2 - 2
examples/canvas_performance.html

@@ -54,8 +54,8 @@
 				// Grid
 
 				var geometry = new THREE.Geometry();
-				geometry.vertices.push( new THREE.Vertex( - 500, 0, 0 ) );
-				geometry.vertices.push( new THREE.Vertex( 500, 0, 0 ) );
+				geometry.vertices.push( new THREE.Vector3( - 500, 0, 0 ) );
+				geometry.vertices.push( new THREE.Vector3( 500, 0, 0 ) );
 
 				var material = new THREE.LineBasicMaterial( { color: 0x000000, opacity: 0.5 } );
 

+ 2 - 2
examples/canvas_sandbox.html

@@ -69,8 +69,8 @@
 				// Grid
 
 				var geometry = new THREE.Geometry();
-				geometry.vertices.push( new THREE.Vertex( - 500, 0, 0 ) );
-				geometry.vertices.push( new THREE.Vertex( 500, 0, 0 ) );
+				geometry.vertices.push( new THREE.Vector3( - 500, 0, 0 ) );
+				geometry.vertices.push( new THREE.Vector3( 500, 0, 0 ) );
 
 				var material = new THREE.LineBasicMaterial( { color: 0x000000, opacity: 0.5 } );
 

+ 2 - 4
examples/js/MarchingCubes.js

@@ -602,7 +602,7 @@ THREE.MarchingCubes = function ( resolution, material ) {
 
 		var geo_callback = function( object ) {
 
-			var i, x, y, z, vertex, position, normal,
+			var i, x, y, z, vertex, normal,
 				face, a, b, c, na, nb, nc, nfaces;
 
 
@@ -615,7 +615,7 @@ THREE.MarchingCubes = function ( resolution, material ) {
 				x = object.positionArray[ a ];
 				y = object.positionArray[ b ];
 				z = object.positionArray[ c ];
-				position = new THREE.Vector3( x, y, z );
+				vertex = new THREE.Vector3( x, y, z );
 
 				x = object.normalArray[ a ];
 				y = object.normalArray[ b ];
@@ -623,8 +623,6 @@ THREE.MarchingCubes = function ( resolution, material ) {
 				normal = new THREE.Vector3( x, y, z );
 				normal.normalize();
 
-				vertex = new THREE.Vertex( position );
-
 				geo.vertices.push( vertex );
 				normals.push( normal );
 

+ 1 - 1
examples/js/ctm/CTMLoader.js

@@ -763,7 +763,7 @@ THREE.CTMLoader.prototype.createModelClassic = function ( file, callback ) {
 
 	function vertex ( scope, x, y, z ) {
 
-		scope.vertices.push( new THREE.Vertex( x, y, z ) );
+		scope.vertices.push( new THREE.Vector3( x, y, z ) );
 
 	};
 

+ 8 - 2
examples/misc_camera_fly.html

@@ -181,7 +181,10 @@
 
 				for ( i = 0; i < 250; i ++ ) {
 
-					var vertex = new THREE.Vertex( Math.random() * 2 - 1, Math.random() * 2 - 1, Math.random() * 2 - 1 );
+					var vertex = new THREE.Vector3();
+					vertex.x = Math.random() * 2 - 1;
+					vertex.y = Math.random() * 2 - 1;
+					vertex.z = Math.random() * 2 - 1;
 					vertex.multiplyScalar( r );
 
 					starsGeometry[ 0 ].vertices.push( vertex );
@@ -190,7 +193,10 @@
 
 				for ( i = 0; i < 1500; i ++ ) {
 
-					var vertex = new THREE.Vertex( Math.random() * 2 - 1, Math.random() * 2 - 1, Math.random() * 2 - 1 );
+					var vertex = new THREE.Vector3();
+					vertex.x = Math.random() * 2 - 1;
+					vertex.y = Math.random() * 2 - 1;
+					vertex.z = Math.random() * 2 - 1;
 					vertex.multiplyScalar( r );
 
 					starsGeometry[ 1 ].vertices.push( vertex );

+ 3 - 3
examples/misc_ubiquity_test.html

@@ -103,9 +103,9 @@
 
 					var v = new THREE.Vector3( Math.random() * 1000 - 500, Math.random() * 1000 - 500, Math.random() * 1000 - 500 );
 
-					var v0 = new THREE.Vertex( Math.random() * 100 - 50, Math.random() * 100 - 50, Math.random() * 100 - 50 );
-					var v1 = new THREE.Vertex( Math.random() * 100 - 50, Math.random() * 100 - 50, Math.random() * 100 - 50 );
-					var v2 = new THREE.Vertex( Math.random() * 100 - 50, Math.random() * 100 - 50, Math.random() * 100 - 50 );
+					var v0 = new THREE.Vector3( Math.random() * 100 - 50, Math.random() * 100 - 50, Math.random() * 100 - 50 );
+					var v1 = new THREE.Vector3( Math.random() * 100 - 50, Math.random() * 100 - 50, Math.random() * 100 - 50 );
+					var v2 = new THREE.Vector3( Math.random() * 100 - 50, Math.random() * 100 - 50, Math.random() * 100 - 50 );
 
 					v0.addSelf( v );
 					v1.addSelf( v );

+ 1 - 1
examples/obj/Bird.js

@@ -25,7 +25,7 @@ var Bird = function () {
 
 	function v( x, y, z ) {
 
-		scope.vertices.push( new THREE.Vertex( x, y, z ) );
+		scope.vertices.push( new THREE.Vector3( x, y, z ) );
 
 	}
 

+ 1 - 1
examples/obj/Qrcode.js

@@ -1443,7 +1443,7 @@ var Qrcode = function () {
 
 	function v( x, y, z ) {
 
-		scope.vertices.push( new THREE.Vertex( x, y, z ) );
+		scope.vertices.push( new THREE.Vector3( x, y, z ) );
 
 	}
 

+ 7 - 6
examples/webgl_camera.html

@@ -115,19 +115,20 @@
 
 				//
 
-				var x, y, z, geo = new THREE.Geometry();
+				var geometry = new THREE.Geometry();
 
 				for ( var i = 0; i < 10000; i ++ ) {
 
-					x = THREE.Math.randFloatSpread( 2000 );
-					y = THREE.Math.randFloatSpread( 2000 );
-					z = THREE.Math.randFloatSpread( 2000 );
+					var vertex = new THREE.Vector3();
+					vertex.x = THREE.Math.randFloatSpread( 2000 );
+					vertex.y = THREE.Math.randFloatSpread( 2000 );
+					vertex.z = THREE.Math.randFloatSpread( 2000 );
 
-					geo.vertices.push( new THREE.Vertex( x, y, z ) );
+					geometry.vertices.push( vertex );
 
 				}
 
-				var particles = new THREE.ParticleSystem( geo, new THREE.ParticleBasicMaterial( { color: 0x888888 } ) );
+				var particles = new THREE.ParticleSystem( geometry, new THREE.ParticleBasicMaterial( { color: 0x888888 } ) );
 				scene.add( particles );
 
 				//

+ 4 - 1
examples/webgl_custom_attributes_particles.html

@@ -138,7 +138,10 @@
 
 			for ( var i = 0; i < 100000; i++ ) {
 
-				var vertex = new THREE.Vertex( Math.random() * 2 - 1, Math.random() * 2 - 1, Math.random() * 2 - 1 );
+				var vertex = new THREE.Vector3();
+				vertex.x = Math.random() * 2 - 1;
+				vertex.y = Math.random() * 2 - 1;
+				vertex.z = Math.random() * 2 - 1;
 				vertex.multiplyScalar( radius );
 
 				geometry.vertices.push( vertex );

+ 4 - 2
examples/webgl_custom_attributes_particles3.html

@@ -140,8 +140,10 @@
 
 			for ( var i = 0; i < 100000; i ++ ) {
 
-				var vertex = new THREE.Vertex( Math.random() * 2 - 1, Math.random() * 2 - 1, Math.random() * 2 - 1 );
-
+				var vertex = new THREE.Vector3();
+				vertex.x = Math.random() * 2 - 1;
+				vertex.y = Math.random() * 2 - 1;
+				vertex.z = Math.random() * 2 - 1;
 				vertex.multiplyScalar( radius );
 
 				if ( ( vertex.x > inner || vertex.x < -inner ) ||

+ 1 - 1
examples/webgl_kinect.html

@@ -155,7 +155,7 @@
 
 					for ( var i = 0, l = width * height; i < l; i ++ ) {
  
-						var vertex = new THREE.Vertex();
+						var vertex = new THREE.Vector3();
 						vertex.x = ( i % width );
 						vertex.y = Math.floor( i / width );
 

+ 1 - 1
examples/webgl_lines_colors.html

@@ -98,7 +98,7 @@
 
 				for ( i = 0; i < points.length; i ++ ) {
 
-					geometry.vertices.push( new THREE.Vertex().copy( points[ i ] ) );
+					geometry.vertices.push( points[ i ] );
 
 					colors[ i ] = new THREE.Color( 0xffffff );
 					colors[ i ].setHSV( 0.6, ( 200 + points[ i ].x ) / 400, 1.0 );

+ 1 - 1
examples/webgl_lines_cubes.html

@@ -85,7 +85,7 @@
 
 				for ( i = 0; i < points.length; i ++ ) {
 
-					geometry.vertices.push( new THREE.Vertex().copy( points[i] ) );
+					geometry.vertices.push( points[i] );
 
 				}
 

+ 4 - 1
examples/webgl_lines_sphere.html

@@ -89,7 +89,10 @@
 
 				for ( i = 0; i < 1500; i ++ ) {
 
-					var vertex1 = new THREE.Vertex( Math.random() * 2 - 1, Math.random() * 2 - 1, Math.random() * 2 - 1 );
+					var vertex1 = new THREE.Vector3();
+					vertex1.x = Math.random() * 2 - 1;
+					vertex1.y = Math.random() * 2 - 1;
+					vertex1.z = Math.random() * 2 - 1;
 					vertex1.normalize();
 					vertex1.multiplyScalar( r );
 

+ 1 - 1
examples/webgl_lines_splines.html

@@ -98,7 +98,7 @@
 					index = i / ( points.length * n_sub );
 					position = spline.getPoint( index );
 
-					geometry.vertices[ i ] = new THREE.Vertex( position.x, position.y, position.z );
+					geometry.vertices[ i ] = new THREE.Vector3( position.x, position.y, position.z );
 
 					colors[ i ] = new THREE.Color( 0xffffff );
 					colors[ i ].setHSV( 0.6, ( 200 + position.x ) / 400, 1.0 );

+ 4 - 4
examples/webgl_loader_collada.html

@@ -81,11 +81,11 @@
 
 				for ( var i = 0; i <= size / step * 2; i ++ ) {
 
-					geometry.vertices.push( new THREE.Vertex( - size, floor, i * step - size ) );
-					geometry.vertices.push( new THREE.Vertex(   size, floor, i * step - size ) );
+					geometry.vertices.push( new THREE.Vector3( - size, floor, i * step - size ) );
+					geometry.vertices.push( new THREE.Vector3(   size, floor, i * step - size ) );
 
-					geometry.vertices.push( new THREE.Vertex( i * step - size, floor, -size ) );
-					geometry.vertices.push( new THREE.Vertex( i * step - size, floor,  size ) );
+					geometry.vertices.push( new THREE.Vector3( i * step - size, floor, -size ) );
+					geometry.vertices.push( new THREE.Vector3( i * step - size, floor,  size ) );
 
 				}
 

+ 4 - 4
examples/webgl_loader_collada_keyframe.html

@@ -109,10 +109,10 @@
 
 				for ( var i = 0; i <= size / step * 2; i ++ ) {
 
-					geometry.vertices.push( new THREE.Vertex( - size, floor, i * step - size ) );
-					geometry.vertices.push( new THREE.Vertex(   size, floor, i * step - size ) );
-					geometry.vertices.push( new THREE.Vertex( i * step - size, floor, -size ) );
-					geometry.vertices.push( new THREE.Vertex( i * step - size, floor,  size ) );
+					geometry.vertices.push( new THREE.Vector3( - size, floor, i * step - size ) );
+					geometry.vertices.push( new THREE.Vector3(   size, floor, i * step - size ) );
+					geometry.vertices.push( new THREE.Vector3( i * step - size, floor, -size ) );
+					geometry.vertices.push( new THREE.Vector3( i * step - size, floor,  size ) );
 
 				}
 

+ 4 - 4
examples/webgl_materials.html

@@ -54,11 +54,11 @@
 
 				for ( var i = 0; i <= 40; i ++ ) {
 
-					geometry.vertices.push( new THREE.Vertex( - 500, floor, i * step - 500 ) );
-					geometry.vertices.push( new THREE.Vertex(   500, floor, i * step - 500 ) );
+					geometry.vertices.push( new THREE.Vector3( - 500, floor, i * step - 500 ) );
+					geometry.vertices.push( new THREE.Vector3(   500, floor, i * step - 500 ) );
 
-					geometry.vertices.push( new THREE.Vertex( i * step - 500, floor, -500 ) );
-					geometry.vertices.push( new THREE.Vertex( i * step - 500, floor,  500 ) );
+					geometry.vertices.push( new THREE.Vector3( i * step - 500, floor, -500 ) );
+					geometry.vertices.push( new THREE.Vector3( i * step - 500, floor,  500 ) );
 
 				}
 

+ 1 - 1
examples/webgl_morphtargets.html

@@ -119,7 +119,7 @@
 
 					for ( var v = 0; v < geometry.vertices.length; v ++ ) {
 
-						vertices.push( new THREE.Vertex().copy( geometry.vertices[ v ] ) );
+						vertices.push( geometry.vertices[ v ].clone() );
 
 						if ( v === i ) {
 

+ 1 - 1
examples/webgl_particles_billboards.html

@@ -73,7 +73,7 @@
 
 				for ( i = 0; i < 10000; i ++ ) {
 
-					var vertex = new THREE.Vertex();
+					var vertex = new THREE.Vector3();
 					vertex.x = 2000 * Math.random() - 1000;
 					vertex.y = 2000 * Math.random() - 1000;
 					vertex.z = 2000 * Math.random() - 1000;

+ 1 - 1
examples/webgl_particles_billboards_colors.html

@@ -73,7 +73,7 @@
 
 				for ( i = 0; i < 5000; i ++ ) {
 
-					var vertex = new THREE.Vertex();
+					var vertex = new THREE.Vector3();
 					vertex.x = 2000 * Math.random() - 1000;
 					vertex.y = 2000 * Math.random() - 1000;
 					vertex.z = 2000 * Math.random() - 1000;

+ 1 - 1
examples/webgl_particles_dynamic.html

@@ -214,7 +214,7 @@
 
 					p = vertices[ i ];
 
-					geometry.vertices[ i ] = new THREE.Vertex().copy( p );
+					geometry.vertices[ i ] = p.clone();
 					vertices_tmp[ i ] = [ p.x, p.y, p.z, 0, 0 ];
 
 				}

+ 1 - 1
examples/webgl_particles_random.html

@@ -71,7 +71,7 @@
 
 				for ( i = 0; i < 20000; i ++ ) {
 
-					var vertex = new THREE.Vertex();
+					var vertex = new THREE.Vector3();
 					vertex.x = Math.random() * 2000 - 1000;
 					vertex.y = Math.random() * 2000 - 1000;
 					vertex.z = Math.random() * 2000 - 1000;

+ 1 - 1
examples/webgl_particles_shapes.html

@@ -201,7 +201,7 @@
 
 				function newpos( x, y, z ) {
 
-					return new THREE.Vertex( x, y, z );
+					return new THREE.Vector3( x, y, z );
 
 				}
 

+ 1 - 1
examples/webgl_particles_sprites.html

@@ -78,7 +78,7 @@
 
 				for ( i = 0; i < 10000; i ++ ) {
 
-					var vertex = new THREE.Vertex();
+					var vertex = new THREE.Vector3();
 					vertex.x = Math.random() * 2000 - 1000;
 					vertex.y = Math.random() * 2000 - 1000;
 					vertex.z = Math.random() * 2000 - 1000;

+ 2 - 2
examples/webgl_ribbons.html

@@ -101,8 +101,8 @@
 
 					}
 
-					geometry.vertices.push( new THREE.Vertex( x, y, z ) );
-					geometry2.vertices.push( new THREE.Vertex( x, y, z ) );
+					geometry.vertices.push( new THREE.Vector3( x, y, z ) );
+					geometry2.vertices.push( new THREE.Vector3( x, y, z ) );
 
 					h = i2 % 2 ? 1 : 0.15;
 					if( i2 % 4 <= 2 ) h -= 0.15;

+ 4 - 1
examples/webgl_trackballcamera_earth.html

@@ -198,7 +198,10 @@
 
 				for ( var i = 0; i < 1500; i ++ ) {
 
-					var vertex = new THREE.Vertex( Math.random() * 2 - 1, Math.random() * 2 - 1, Math.random() * 2 - 1 );
+					var vertex = new THREE.Vector3();
+					vertex.x = Math.random() * 2 - 1;
+					vertex.y = Math.random() * 2 - 1;
+					vertex.z = Math.random() * 2 - 1;
 					vertex.multiplyScalar( radius );
 
 					starsGeometry.vertices.push( vertex );

+ 1 - 1
examples/webgl_trails.html

@@ -55,7 +55,7 @@
 
 				for ( var i = 0; i < 2000; i ++ ) {
 
-					var vertex = new THREE.Vertex();
+					var vertex = new THREE.Vector3();
 					vertex.x = Math.random() * 4000 - 2000;
 					vertex.y = Math.random() * 4000 - 2000;
 					vertex.z = Math.random() * 4000 - 2000;

+ 5 - 1
src/core/Vertex.js

@@ -2,4 +2,8 @@
  * @author mr.doob / http://mrdoob.com/
  */
 
-THREE.Vertex = THREE.Vector3;
+THREE.Vertex = function () {
+
+	console.warn( 'THREE.Vertex has been DEPRECATED. Use THREE.Vector3 instead.')
+
+};

+ 1 - 1
src/extras/controls/PathControls.js

@@ -221,7 +221,7 @@ THREE.PathControls = function ( object, domElement ) {
 			index = i / ( spline.points.length * n_sub );
 			position = spline.getPoint( index );
 
-			geometry.vertices[ i ] = new THREE.Vertex( position.x, position.y, position.z );
+			geometry.vertices[ i ] = new THREE.Vector3( position.x, position.y, position.z );
 
 		}
 

+ 6 - 6
src/extras/core/CurvePath.js

@@ -185,7 +185,7 @@ THREE.CurvePath.prototype.getBoundingBox = function () {
 
 THREE.CurvePath.prototype.createPointsGeometry = function( divisions ) {
 
-    var pts = this.getPoints( divisions, true );
+	var pts = this.getPoints( divisions, true );
 	return this.createGeometry( pts );
 
 };
@@ -194,7 +194,7 @@ THREE.CurvePath.prototype.createPointsGeometry = function( divisions ) {
 
 THREE.CurvePath.prototype.createSpacedPointsGeometry = function( divisions ) {
 
-    var pts = this.getSpacedPoints( divisions, true );
+	var pts = this.getSpacedPoints( divisions, true );
 	return this.createGeometry( pts );
 
 };
@@ -203,13 +203,13 @@ THREE.CurvePath.prototype.createGeometry = function( points ) {
 
 	var geometry = new THREE.Geometry();
 
-    for( var i = 0; i < points.length; i ++ ) {
+	for ( var i = 0; i < points.length; i ++ ) {
 
-        geometry.vertices.push( new THREE.Vertex( points[ i ].x, points[ i ].y, 0 ) );
+		geometry.vertices.push( new THREE.Vector3( points[ i ].x, points[ i ].y, 0 ) );
 
-    }
+	}
 
-    return geometry;
+	return geometry;
 
 };
 

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

@@ -100,7 +100,7 @@ THREE.CubeGeometry = function ( width, height, depth, segmentsWidth, segmentsHei
 
 			for ( ix = 0; ix < gridX1; ix ++ ) {
 
-				var vector = new THREE.Vertex();
+				var vector = new THREE.Vector3();
 				vector[ u ] = ( ix * segment_width - width_half ) * udir;
 				vector[ v ] = ( iy * segment_height - height_half ) * vdir;
 				vector[ w ] = depth;

+ 7 - 6
src/extras/geometries/CylinderGeometry.js

@@ -28,11 +28,12 @@ THREE.CylinderGeometry = function ( radiusTop, radiusBottom, height, segmentsRad
 
 			var u = x / segmentsX;
 
-			var xpos = radius * Math.sin( u * Math.PI * 2 );
-			var ypos = - v * height + heightHalf;
-			var zpos = radius * Math.cos( u * Math.PI * 2 );
+			var vertex = new THREE.Vector3();
+			vertex.x = radius * Math.sin( u * Math.PI * 2 );
+			vertex.y = - v * height + heightHalf;
+			vertex.z = radius * Math.cos( u * Math.PI * 2 );
 
-			this.vertices.push( new THREE.Vertex( xpos, ypos, zpos ) );
+			this.vertices.push( vertex );
 
 			verticesRow.push( this.vertices.length - 1 );
 			uvsRow.push( new THREE.UV( u, v ) );
@@ -76,7 +77,7 @@ THREE.CylinderGeometry = function ( radiusTop, radiusBottom, height, segmentsRad
 
 	if ( !openEnded && radiusTop > 0 ) {
 
-		this.vertices.push( new THREE.Vertex( 0, heightHalf, 0 ) );
+		this.vertices.push( new THREE.Vector3( 0, heightHalf, 0 ) );
 
 		for ( x = 0; x < segmentsX; x ++ ) {
 
@@ -103,7 +104,7 @@ THREE.CylinderGeometry = function ( radiusTop, radiusBottom, height, segmentsRad
 
 	if ( !openEnded && radiusBottom > 0 ) {
 
-		this.vertices.push( new THREE.Vertex( 0, - heightHalf, 0 ) );
+		this.vertices.push( new THREE.Vector3( 0, - heightHalf, 0 ) );
 
 		for ( x = 0; x < segmentsX; x ++ ) {
 

+ 2 - 2
src/extras/geometries/ExtrudeGeometry.js

@@ -625,7 +625,7 @@ THREE.ExtrudeGeometry.prototype.addShape = function( shape, options ) {
 
 
 	function v( x, y, z ) {
-		scope.vertices.push( new THREE.Vertex( x, y, z ) );
+		scope.vertices.push( new THREE.Vector3( x, y, z ) );
 	}
 
 	function f3( a, b, c, isBottom ) {
@@ -633,7 +633,7 @@ THREE.ExtrudeGeometry.prototype.addShape = function( shape, options ) {
 		b += shapesOffset;
 		c += shapesOffset;
 
-												   // normal, color, material
+		// normal, color, material
 		scope.faces.push( new THREE.Face3( a, b, c, null, null, material ) );
 
 		var uvs = isBottom ? uvgen.generateBottomUV( scope, shape, options, a, b, c)

+ 3 - 4
src/extras/geometries/LatheGeometry.js

@@ -16,19 +16,18 @@ THREE.LatheGeometry = function ( points, steps, angle ) {
 	for ( var j = 0; j < points.length; j ++ ) {
 
 		_newV[ j ] = points[ j ].clone();
-		this.vertices.push( new THREE.Vertex().copy( _newV[ j ] ) );
+		this.vertices.push( _newV[ j ] );
 
 	}
 
-	var i;
-	var il = _steps + 1;
+	var i, il = _steps + 1;
 
 	for ( i = 0; i < il; i ++ ) {
 
 		for ( var j = 0; j < _newV.length; j ++ ) {
 
 			_newV[ j ] = _matrix.multiplyVector3( _newV[ j ].clone() );
-			this.vertices.push( new THREE.Vertex().copy( _newV[ j ] ) );
+			this.vertices.push( _newV[ j ] );
 
 		}
 

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

@@ -25,7 +25,7 @@ THREE.PlaneGeometry = function ( width, depth, segmentsWidth, segmentsDepth ) {
 			var x = ix * segment_width - width_half;
 			var z = iz * segment_depth - depth_half;
 
-			this.vertices.push( new THREE.Vertex( x, 0, z ) );
+			this.vertices.push( new THREE.Vector3( x, 0, z ) );
 
 		}
 

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

@@ -41,7 +41,7 @@ THREE.PolyhedronGeometry = function ( vertices, faces, radius, detail ) {
 	 */
 	function prepare( vector ) {
 
-		var vertex = new THREE.Vertex().copy( vector.normalize() );
+		var vertex = vector.normalize().clone();
 		vertex.index = that.vertices.push( vertex ) - 1;
 
 		// Texture coords are equivalent to map coords, calculate angle and convert to fraction of a circle.

+ 5 - 4
src/extras/geometries/SphereGeometry.js

@@ -29,11 +29,12 @@ THREE.SphereGeometry = function ( radius, segmentsWidth, segmentsHeight, phiStar
 			var u = x / segmentsX;
 			var v = y / segmentsY;
 
-			var xpos = - radius * Math.cos( phiStart + u * phiLength ) * Math.sin( thetaStart + v * thetaLength );
-			var ypos = radius * Math.cos( thetaStart + v * thetaLength );
-			var zpos = radius * Math.sin( phiStart + u * phiLength ) * Math.sin( thetaStart + v * thetaLength );
+			var vertex = new THREE.Vector3();
+			vertex.x = - radius * Math.cos( phiStart + u * phiLength ) * Math.sin( thetaStart + v * thetaLength );
+			vertex.y = radius * Math.cos( thetaStart + v * thetaLength );
+			vertex.z = radius * Math.sin( phiStart + u * phiLength ) * Math.sin( thetaStart + v * thetaLength );
 
-			this.vertices.push( new THREE.Vertex( xpos, ypos, zpos ) );
+			this.vertices.push( vertex );
 
 			verticesRow.push( this.vertices.length - 1 );
 			uvsRow.push( new THREE.UV( u, v ) );

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

@@ -28,7 +28,7 @@ THREE.TorusGeometry = function ( radius, tube, segmentsR, segmentsT, arc ) {
 			center.x = this.radius * Math.cos( u );
 			center.y = this.radius * Math.sin( u );
 
-			var vertex = new THREE.Vertex();
+			var vertex = new THREE.Vector3();
 			vertex.x = ( this.radius + this.tube * Math.cos( v ) ) * Math.cos( u );
 			vertex.y = ( this.radius + this.tube * Math.cos( v ) ) * Math.sin( u );
 			vertex.z = this.tube * Math.sin( v );

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

@@ -84,7 +84,7 @@ THREE.TorusKnotGeometry = function ( radius, tube, segmentsR, segmentsT, p, q, h
 
 	function vert( x, y, z ) {
 
-		return scope.vertices.push( new THREE.Vertex( x, y, z ) ) - 1;
+		return scope.vertices.push( new THREE.Vector3( x, y, z ) ) - 1;
 
 	}
 

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

@@ -56,7 +56,7 @@ THREE.TubeGeometry = function( path, segments, radius, segmentsRadius, closed, d
 	
 	function vert( x, y, z ) {
 
-		return scope.vertices.push( new THREE.Vertex( x, y, z ) ) - 1;
+		return scope.vertices.push( new THREE.Vector3( x, y, z ) ) - 1;
 
 	}
 

+ 25 - 29
src/extras/helpers/ArrowHelper.js

@@ -13,59 +13,55 @@
 
 THREE.ArrowHelper = function ( dir, origin, length, hex ) {
 
-    THREE.Object3D.call( this );
+	THREE.Object3D.call( this );
 
-    if ( hex === undefined ) hex = 0xffff00;
-    if ( length === undefined ) length = 20;
+	if ( hex === undefined ) hex = 0xffff00;
+	if ( length === undefined ) length = 20;
 
-    var lineGeometry = new THREE.Geometry();
-    lineGeometry.vertices.push( new THREE.Vertex( 0, 0, 0 ) );
-    lineGeometry.vertices.push( new THREE.Vertex( 0, 1, 0 ) );
+	var lineGeometry = new THREE.Geometry();
+	lineGeometry.vertices.push( new THREE.Vector3( 0, 0, 0 ) );
+	lineGeometry.vertices.push( new THREE.Vector3( 0, 1, 0 ) );
 
-    this.line = new THREE.Line( lineGeometry, new THREE.LineBasicMaterial( { color : hex } ) );
-    this.add( this.line );
+	this.line = new THREE.Line( lineGeometry, new THREE.LineBasicMaterial( { color: hex } ) );
+	this.add( this.line );
 
-    var coneGeometry = new THREE.CylinderGeometry( 0, 0.05, 0.25, 5, 1 );
+	var coneGeometry = new THREE.CylinderGeometry( 0, 0.05, 0.25, 5, 1 );
 
-    this.cone = new THREE.Mesh( coneGeometry, new THREE.MeshBasicMaterial( { color : hex } ) );
-    this.cone.position.set( 0, 1, 0 );
-    this.add( this.cone );
+	this.cone = new THREE.Mesh( coneGeometry, new THREE.MeshBasicMaterial( { color: hex } ) );
+	this.cone.position.set( 0, 1, 0 );
+	this.add( this.cone );
 
-    if ( origin instanceof THREE.Vector3 ) {
+	if ( origin instanceof THREE.Vector3 ) this.position = origin;
 
-        this.position = origin;
-
-    }
-
-    this.setDirection( dir );
-    this.setLength( length );
+	this.setDirection( dir );
+	this.setLength( length );
 
 };
 
 THREE.ArrowHelper.prototype = new THREE.Object3D();
 THREE.ArrowHelper.prototype.constructor = THREE.ArrowHelper;
 
-THREE.ArrowHelper.prototype.setDirection = function( dir ) {
+THREE.ArrowHelper.prototype.setDirection = function ( dir ) {
 
-    var axis = new THREE.Vector3( 0, 1, 0 ).crossSelf( dir );
+	var axis = new THREE.Vector3( 0, 1, 0 ).crossSelf( dir );
 
-    var radians = Math.acos( new THREE.Vector3( 0, 1, 0 ).dot( dir.clone().normalize() ) );
+	var radians = Math.acos( new THREE.Vector3( 0, 1, 0 ).dot( dir.clone().normalize() ) );
 
-    this.matrix = new THREE.Matrix4().makeRotationAxis( axis.normalize(), radians );
+	this.matrix = new THREE.Matrix4().makeRotationAxis( axis.normalize(), radians );
 
-    this.rotation.getRotationFromMatrix( this.matrix, this.scale );
+	this.rotation.getRotationFromMatrix( this.matrix, this.scale );
 
 };
 
-THREE.ArrowHelper.prototype.setLength = function( length ) {
+THREE.ArrowHelper.prototype.setLength = function ( length ) {
 
-    this.scale.set( length, length, length );
+	this.scale.set( length, length, length );
 
 };
 
-THREE.ArrowHelper.prototype.setColor = function( hex ) {
+THREE.ArrowHelper.prototype.setColor = function ( hex ) {
 
-    this.line.material.color.setHex( hex );
-    this.cone.material.color.setHex( hex );
+	this.line.material.color.setHex( hex );
+	this.cone.material.color.setHex( hex );
 
 };

+ 2 - 2
src/extras/helpers/AxisHelper.js

@@ -8,8 +8,8 @@ THREE.AxisHelper = function () {
 	THREE.Object3D.call( this );
 
 	var lineGeometry = new THREE.Geometry();
-	lineGeometry.vertices.push( new THREE.Vertex() );
-	lineGeometry.vertices.push( new THREE.Vertex( 0, 100, 0 ) );
+	lineGeometry.vertices.push( new THREE.Vector3() );
+	lineGeometry.vertices.push( new THREE.Vector3( 0, 100, 0 ) );
 
 	var coneGeometry = new THREE.CylinderGeometry( 0, 5, 25, 5, 1 );
 

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

@@ -84,7 +84,7 @@ THREE.CameraHelper = function ( camera ) {
 
 	function addPoint( id, hex ) {
 
-		_this.lineGeometry.vertices.push( new THREE.Vertex() );
+		_this.lineGeometry.vertices.push( new THREE.Vector3() );
 		_this.lineGeometry.colors.push( new THREE.Color( hex ) );
 
 		if ( _this.pointMap[ id ] === undefined ) _this.pointMap[ id ] = [];

+ 1 - 1
src/extras/loaders/BinaryLoader.js

@@ -673,7 +673,7 @@ THREE.BinaryLoader.prototype.createBinModel = function ( data, callback, texture
 
 	function vertex ( scope, x, y, z ) {
 
-		scope.vertices.push( new THREE.Vertex( x, y, z ) );
+		scope.vertices.push( new THREE.Vector3( x, y, z ) );
 
 	};
 

+ 2 - 3
src/extras/loaders/ColladaLoader.js

@@ -583,7 +583,7 @@ THREE.ColladaLoader = function () {
 
 			for ( i = 0; i < geometry.vertices.length; i++ ) {
 
-				skinned.push( new THREE.Vertex() );
+				skinned.push( new THREE.Vector3() );
 
 			}
 
@@ -2306,8 +2306,7 @@ THREE.ColladaLoader = function () {
 
 		for ( i = 0; i < vertexData.length; i += 3 ) {
 
-			var v = new THREE.Vertex().copy( getConvertedVec3( vertexData, i ) );
-			this.geometry3js.vertices.push( v );
+			this.geometry3js.vertices.push( getConvertedVec3( vertexData, i ).clone() );
 
 		}
 

+ 7 - 6
src/extras/loaders/JSONLoader.js

@@ -159,7 +159,7 @@ THREE.JSONLoader.prototype.createModel = function ( json, callback, texturePath
 
 		while ( offset < zLength ) {
 
-			vertex = new THREE.Vertex();
+			vertex = new THREE.Vector3();
 
 			vertex.x = vertices[ offset ++ ] * scale;
 			vertex.y = vertices[ offset ++ ] * scale;
@@ -369,7 +369,7 @@ THREE.JSONLoader.prototype.createModel = function ( json, callback, texturePath
 
 		if ( json.morphTargets !== undefined ) {
 
-			var i, l, v, vl, x, y, z, dstVertices, srcVertices;
+			var i, l, v, vl, dstVertices, srcVertices;
 
 			for ( i = 0, l = json.morphTargets.length; i < l; i ++ ) {
 
@@ -382,11 +382,12 @@ THREE.JSONLoader.prototype.createModel = function ( json, callback, texturePath
 
 				for( v = 0, vl = srcVertices.length; v < vl; v += 3 ) {
 
-					x = srcVertices[ v ] * scale;
-					y = srcVertices[ v + 1 ] * scale;
-					z = srcVertices[ v + 2 ] * scale;
+					var vertex = new THREE.Vector3();
+					vertex.x = srcVertices[ v ] * scale;
+					vertex.y = srcVertices[ v + 1 ] * scale;
+					vertex.z = srcVertices[ v + 2 ] * scale;
 
-					dstVertices.push( new THREE.Vertex( x, y, z ) );
+					dstVertices.push( vertex );
 
 				}
 

+ 26 - 12
src/extras/loaders/SceneLoader.js

@@ -159,6 +159,7 @@ THREE.SceneLoader.prototype.createScene = function ( json, callbackFinished, url
 						r = o.rotation;
 						q = o.quaternion;
 						s = o.scale;
+						m = o.matrix;
 
 						// turn off quaternions, for the moment
 
@@ -181,21 +182,34 @@ THREE.SceneLoader.prototype.createScene = function ( json, callbackFinished, url
 
 						object = new THREE.Mesh( geometry, material );
 						object.name = dd;
-						object.position.set( p[0], p[1], p[2] );
-
-						if ( q ) {
-
-							object.quaternion.set( q[0], q[1], q[2], q[3] );
-							object.useQuaternion = true;
-
+						
+						if ( m ) {
+							
+							object.matrixAutoUpdate = false;
+							object.matrix.set( m[0], m[1], m[2], m[3],
+											   m[4], m[5], m[6], m[7],
+											   m[8], m[9], m[10], m[11],
+											   m[12], m[13], m[14], m[15]);
+							
 						} else {
-
-							object.rotation.set( r[0], r[1], r[2] );
-
+							
+							object.position.set( p[0], p[1], p[2] );
+	
+							if ( q ) {
+	
+								object.quaternion.set( q[0], q[1], q[2], q[3] );
+								object.useQuaternion = true;
+	
+							} else {
+	
+								object.rotation.set( r[0], r[1], r[2] );
+	
+							}
+	
+							object.scale.set( s[0], s[1], s[2] );
+							
 						}
 
-						object.scale.set( s[0], s[1], s[2] );
-
 						object.visible = o.visible;
 						object.doubleSided = o.doubleSided;
 						object.castShadow = o.castShadow;

+ 1 - 1
src/extras/loaders/UTF8Loader.js

@@ -283,7 +283,7 @@ THREE.UTF8Loader.prototype.createModel = function ( data, callback, scale, offse
 
 	function vertex ( scope, x, y, z ) {
 
-		scope.vertices.push( new THREE.Vertex( x, y, z ) );
+		scope.vertices.push( new THREE.Vector3( x, y, z ) );
 
 	};
 

+ 3 - 3
src/extras/modifiers/SubdivisionModifier.js

@@ -57,7 +57,7 @@ THREE.SubdivisionModifier.prototype.smooth = function ( oldGeometry ) {
 	var newVertices = [], newFaces = [], newUVs = [];
 	
 	function v( x, y, z ) {
-		newVertices.push( new THREE.Vertex( x, y, z ) );
+		newVertices.push( new THREE.Vector3( x, y, z ) );
 	}
 	
 	var scope = this;
@@ -294,7 +294,7 @@ THREE.SubdivisionModifier.prototype.smooth = function ( oldGeometry ) {
 	for (i=0, il = originalFaces.length; i<il ;i++) {
 		face = originalFaces[ i ];
 		facePoints.push( face.centroid );
-		newPoints.push( new THREE.Vertex().copy( face.centroid ) );
+		newPoints.push( face.centroid.clone() );
 		
 		
 		if (!scope.supportUVs) continue;
@@ -430,7 +430,7 @@ THREE.SubdivisionModifier.prototype.smooth = function ( oldGeometry ) {
 		
 		edgePoints[i] = originalVerticesLength + originalFaces.length + edgeCount;
 		
-		newPoints.push( new THREE.Vertex().copy( avg ) );
+		newPoints.push( avg );
 	
 		edgeCount ++;