소스 검색

Changed Vertex so it's just a Vector3 and updated all the examples. Fixes #1703.
(Phewww!) I'm sure there are still things I missed...

Mr.doob 13 년 전
부모
커밋
ded6c16ad3
83개의 변경된 파일815개의 추가작업 그리고 833개의 파일을 삭제
  1. 220 223
      build/Three.js
  2. 26 26
      build/custom/ThreeCanvas.js
  3. 7 7
      build/custom/ThreeDOM.js
  4. 126 128
      build/custom/ThreeExtras.js
  5. 21 21
      build/custom/ThreeSVG.js
  6. 77 78
      build/custom/ThreeWebGL.js
  7. 2 2
      examples/canvas_camera_orthographic.html
  8. 5 5
      examples/canvas_camera_orthographic2.html
  9. 2 2
      examples/canvas_geometry_birds.html
  10. 2 2
      examples/canvas_geometry_panorama_fisheye.html
  11. 1 1
      examples/canvas_geometry_terrain.html
  12. 5 5
      examples/canvas_interactive_voxelpainter.html
  13. 1 1
      examples/canvas_lines.html
  14. 7 7
      examples/canvas_lines_sphere.html
  15. 2 2
      examples/canvas_materials.html
  16. 2 2
      examples/canvas_performance.html
  17. 2 2
      examples/canvas_sandbox.html
  18. 1 1
      examples/js/ctm/CTMLoader.js
  19. 6 6
      examples/misc_camera_fly.html
  20. 6 6
      examples/misc_ubiquity_test.html
  21. 1 1
      examples/obj/Bird.js
  22. 1 1
      examples/obj/Qrcode.js
  23. 1 2
      examples/webgl_camera.html
  24. 4 4
      examples/webgl_custom_attributes_particles.html
  25. 2 2
      examples/webgl_custom_attributes_particles2.html
  26. 6 6
      examples/webgl_custom_attributes_particles3.html
  27. 1 1
      examples/webgl_geometry_colors.html
  28. 2 2
      examples/webgl_geometry_dynamic.html
  29. 3 3
      examples/webgl_geometry_subdivison.html
  30. 1 1
      examples/webgl_geometry_terrain.html
  31. 1 1
      examples/webgl_geometry_terrain_fog.html
  32. 3 3
      examples/webgl_geometry_text.html
  33. 4 4
      examples/webgl_kinect.html
  34. 1 1
      examples/webgl_lines_colors.html
  35. 1 1
      examples/webgl_lines_cubes.html
  36. 8 8
      examples/webgl_lines_sphere.html
  37. 1 1
      examples/webgl_lines_splines.html
  38. 4 4
      examples/webgl_loader_collada.html
  39. 4 4
      examples/webgl_loader_collada_keyframe.html
  40. 1 1
      examples/webgl_loader_json_blender.html
  41. 4 4
      examples/webgl_materials.html
  42. 4 4
      examples/webgl_morphtargets.html
  43. 1 1
      examples/webgl_multiple_canvases_circle.html
  44. 1 1
      examples/webgl_multiple_canvases_complex.html
  45. 1 1
      examples/webgl_multiple_canvases_grid.html
  46. 1 1
      examples/webgl_multiple_views.html
  47. 6 6
      examples/webgl_particles_billboards.html
  48. 7 7
      examples/webgl_particles_billboards_colors.html
  49. 3 3
      examples/webgl_particles_dynamic.html
  50. 7 3
      examples/webgl_particles_random.html
  51. 15 15
      examples/webgl_particles_shapes.html
  52. 6 2
      examples/webgl_particles_sprites.html
  53. 5 8
      examples/webgl_ribbons.html
  54. 5 7
      examples/webgl_trackballcamera_earth.html
  55. 3 3
      examples/webgl_trails.html
  56. 17 17
      src/core/Geometry.js
  57. 3 3
      src/core/Projector.js
  58. 8 8
      src/core/Ray.js
  59. 2 0
      src/core/Vector3.js
  60. 1 17
      src/core/Vertex.js
  61. 29 29
      src/extras/GeometryUtils.js
  62. 1 1
      src/extras/controls/PathControls.js
  63. 1 1
      src/extras/core/CurvePath.js
  64. 2 2
      src/extras/geometries/CubeGeometry.js
  65. 7 7
      src/extras/geometries/CylinderGeometry.js
  66. 19 19
      src/extras/geometries/ExtrudeGeometry.js
  67. 2 2
      src/extras/geometries/LatheGeometry.js
  68. 1 1
      src/extras/geometries/PlaneGeometry.js
  69. 8 8
      src/extras/geometries/PolyhedronGeometry.js
  70. 7 7
      src/extras/geometries/SphereGeometry.js
  71. 6 6
      src/extras/geometries/TorusGeometry.js
  72. 1 1
      src/extras/geometries/TorusKnotGeometry.js
  73. 1 1
      src/extras/geometries/TubeGeometry.js
  74. 2 2
      src/extras/helpers/ArrowHelper.js
  75. 1 1
      src/extras/helpers/AxisHelper.js
  76. 2 2
      src/extras/helpers/CameraHelper.js
  77. 1 1
      src/extras/loaders/BinaryLoader.js
  78. 10 10
      src/extras/loaders/ColladaLoader.js
  79. 4 4
      src/extras/loaders/JSONLoader.js
  80. 1 1
      src/extras/loaders/UTF8Loader.js
  81. 18 18
      src/extras/modifiers/SubdivisionModifier.js
  82. 1 1
      src/objects/SkinnedMesh.js
  83. 19 19
      src/renderers/WebGLRenderer.js

+ 220 - 223
build/Three.js

@@ -9,7 +9,7 @@ Math.floor(a);this.r=(a>>16&255)/255;this.g=(a>>8&255)/255;this.b=(a&255)/255;re
 THREE.Vector2=function(a,b){this.x=a||0;this.y=b||0};
 THREE.Vector2.prototype={constructor:THREE.Vector2,set:function(a,b){this.x=a;this.y=b;return this},copy:function(a){this.x=a.x;this.y=a.y;return this},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;return this},addSelf:function(a){this.x=this.x+a.x;this.y=this.y+a.y;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;return this},subSelf:function(a){this.x=this.x-a.x;this.y=this.y-a.y;return this},multiplyScalar:function(a){this.x=this.x*a;this.y=this.y*a;return this},divideScalar:function(a){if(a){this.x=
 this.x/a;this.y=this.y/a}else this.set(0,0);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.lengthSq())},normalize:function(){return this.divideScalar(this.length())},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var b=this.x-a.x,a=this.y-a.y;return b*b+a*a},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;return this},equals:function(a){return a.x===this.x&&a.y===this.y},isZero:function(){return this.lengthSq()<1.0E-4},clone:function(){return new THREE.Vector2(this.x,this.y)}};THREE.Vector3=function(a,b,c){this.x=a||0;this.y=b||0;this.z=c||0};
+lerpSelf:function(a,b){this.x=this.x+(a.x-this.x)*b;this.y=this.y+(a.y-this.y)*b;return this},equals:function(a){return a.x===this.x&&a.y===this.y},isZero:function(){return this.lengthSq()<1.0E-4},clone:function(){return new THREE.Vector2(this.x,this.y)}};THREE.Vector3=function(a,b,c){a instanceof THREE.Vector3&&console.warn("OPS!");this.x=a||0;this.y=b||0;this.z=c||0};
 THREE.Vector3.prototype={constructor:THREE.Vector3,set:function(a,b,c){this.x=a;this.y=b;this.z=c;return this},setX:function(a){this.x=a;return this},setY:function(a){this.y=a;return this},setZ:function(a){this.z=a;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;return this},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;return this},addSelf:function(a){this.x=this.x+a.x;this.y=this.y+a.y;this.z=this.z+a.z;return this},addScalar:function(a){this.x=this.x+a;this.y=this.y+
 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())},
@@ -24,8 +24,8 @@ THREE.Frustum.prototype.contains=function(a){for(var b=this.planes,c=a.matrixWor
 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 y=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);x=r.dot(n);D=r.dot(q);B=n.dot(n);w=n.dot(q);v=1/(s*B-x*x);C=(B*D-x*w)*v;K=(s*w-x*D)*v;return C>=0&&K>=0&&C+K<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,j=new THREE.Vector3,
 k=new THREE.Vector3,l=new THREE.Vector3,p=new THREE.Vector3,m=new THREE.Vector3,o=new THREE.Vector3;this.intersectObject=function(a){var b,n=[];if(a instanceof THREE.Particle){var r=c(this.origin,this.direction,a.matrixWorld.getPosition());if(r>a.scale.x)return[];b={distance:r,point:a.position,face:null,object:a};n.push(b)}else if(a instanceof THREE.Mesh){var r=c(this.origin,this.direction,a.matrixWorld.getPosition()),q=THREE.Frustum.__v1.set(a.matrixWorld.getColumnX().length(),a.matrixWorld.getColumnY().length(),
 a.matrixWorld.getColumnZ().length());if(r>a.geometry.boundingSphere.radius*Math.max(q.x,Math.max(q.y,q.z)))return n;var s,i,u=a.geometry,t=u.vertices,H;a.matrixRotationWorld.extractRotation(a.matrixWorld);r=0;for(q=u.faces.length;r<q;r++){b=u.faces[r];k.copy(this.origin);l.copy(this.direction);H=a.matrixWorld;p=H.multiplyVector3(p.copy(b.centroid)).subSelf(k);m=a.matrixRotationWorld.multiplyVector3(m.copy(b.normal));s=l.dot(m);if(!(Math.abs(s)<e)){i=m.dot(p)/s;if(!(i<0)&&(a.doubleSided||(a.flipSided?
-s>0:s<0))){o.add(k,l.multiplyScalar(i));if(b instanceof THREE.Face3){f=H.multiplyVector3(f.copy(t[b.a].position));g=H.multiplyVector3(g.copy(t[b.b].position));h=H.multiplyVector3(h.copy(t[b.c].position));if(d(o,f,g,h)){b={distance:k.distanceTo(o),point:o.clone(),face:b,object:a};n.push(b)}}else if(b instanceof THREE.Face4){f=H.multiplyVector3(f.copy(t[b.a].position));g=H.multiplyVector3(g.copy(t[b.b].position));h=H.multiplyVector3(h.copy(t[b.c].position));j=H.multiplyVector3(j.copy(t[b.d].position));
-if(d(o,f,g,j)||d(o,g,h,j)){b={distance:k.distanceTo(o),point:o.clone(),face:b,object:a};n.push(b)}}}}}}return n};this.intersectObjects=function(a){for(var b=[],c=0,d=a.length;c<d;c++)Array.prototype.push.apply(b,this.intersectObject(a[c]));b.sort(function(a,b){return a.distance-b.distance});return b};var r=new THREE.Vector3,n=new THREE.Vector3,q=new THREE.Vector3,u,t,y,s,x,D,B,w,v,C,K};
+s>0:s<0))){o.add(k,l.multiplyScalar(i));if(b instanceof THREE.Face3){f=H.multiplyVector3(f.copy(t[b.a]));g=H.multiplyVector3(g.copy(t[b.b]));h=H.multiplyVector3(h.copy(t[b.c]));if(d(o,f,g,h)){b={distance:k.distanceTo(o),point:o.clone(),face:b,object:a};n.push(b)}}else if(b instanceof THREE.Face4){f=H.multiplyVector3(f.copy(t[b.a]));g=H.multiplyVector3(g.copy(t[b.b]));h=H.multiplyVector3(h.copy(t[b.c]));j=H.multiplyVector3(j.copy(t[b.d]));if(d(o,f,g,j)||d(o,g,h,j)){b={distance:k.distanceTo(o),point:o.clone(),
+face:b,object:a};n.push(b)}}}}}}return n};this.intersectObjects=function(a){for(var b=[],c=0,d=a.length;c<d;c++)Array.prototype.push.apply(b,this.intersectObject(a[c]));b.sort(function(a,b){return a.distance-b.distance});return b};var r=new THREE.Vector3,n=new THREE.Vector3,q=new THREE.Vector3,u,t,y,s,x,D,B,w,v,C,K};
 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,p){h=false;b=f;c=g;d=l;e=p;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,p,m,o){if(h){h=false;b=f<l?f<m?f:m:l<m?l:m;c=g<p?g<o?g:o:p<o?p:o;d=f>l?f>m?f:m:l>m?l:m;e=g>p?g>o?g:o:p>o?p:o}else{b=f<l?f<m?f<b?f:b:m<b?m:b:l<m?l<b?l:b:m<b?m:b;c=g<p?g<o?g<c?g:c:o<c?o:c:p<o?p<c?p:c:o<c?o:c;d=f>l?f>m?f>d?f:d:m>d?m:d:l>m?l>d?l:d:m>d?m:d;e=g>p?g>o?g>e?g:e:o>e?o:e:p>o?p>e?p:e:o>e?o:e}a()};this.addRectangle=function(f){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}};
@@ -69,39 +69,38 @@ d);return true}var e,f,g=[],h,j,k=[],l,p,m=[],o,r=[],n,q,u=[],t,y,s=[],x={object
 w.multiply(b.matrixWorld,b.projectionMatrixInverse);w.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||C.contains(b))){D.copy(b.matrixWorld.getPosition());
 w.multiplyVector3(D);e=a();e.object=b;e.z=D.z;x.objects.push(e)}else if(b instanceof THREE.Sprite||b instanceof THREE.Particle){D.copy(b.matrixWorld.getPosition());w.multiplyVector3(D);e=a();e.object=b;e.z=D.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,F=e.far,i=false,D,E,H,W,G,ha,fa,la,R,$,ba,aa,ea,Na,wa;y=q=o=p=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);w.multiply(e.projectionMatrix,e.matrixWorldInverse);C.setFromMatrix(w);x=this.projectGraph(a,false);a=0;for(D=x.objects.length;a<D;a++){R=x.objects[a].object;$=R.matrixWorld;j=0;if(R instanceof THREE.Mesh){ba=R.geometry;aa=R.geometry.materials;W=ba.vertices;ea=ba.faces;Na=ba.faceVertexUvs;ba=R.matrixRotationWorld.extractRotation($);
-E=0;for(H=W.length;E<H;E++){h=b();h.positionWorld.copy(W[E].position);$.multiplyVector3(h.positionWorld);h.positionScreen.copy(h.positionWorld);w.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<F}W=0;for(E=ea.length;W<E;W++){H=ea[W];if(H instanceof THREE.Face3){G=k[H.a];ha=k[H.b];fa=k[H.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[p]=m[p]||new THREE.RenderableFace3;p++;l=la;l.v1.copy(G);l.v2.copy(ha);l.v3.copy(fa)}else continue}else continue}else if(H instanceof THREE.Face4){G=k[H.a];ha=k[H.b];fa=k[H.c];la=k[H.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){wa=r[o]=r[o]||new THREE.RenderableFace4;o++;l=wa;l.v1.copy(G);l.v2.copy(ha);l.v3.copy(fa);l.v4.copy(la)}else continue}else continue}l.normalWorld.copy(H.normal);!i&&(R.flipSided||R.doubleSided)&&l.normalWorld.negate();
-ba.multiplyVector3(l.normalWorld);l.centroidWorld.copy(H.centroid);$.multiplyVector3(l.centroidWorld);l.centroidScreen.copy(l.centroidWorld);w.multiplyVector3(l.centroidScreen);fa=H.vertexNormals;G=0;for(ha=fa.length;G<ha;G++){la=l.vertexNormalsWorld[G];la.copy(fa[G]);!i&&(R.flipSided||R.doubleSided)&&la.negate();ba.multiplyVector3(la)}G=0;for(ha=Na.length;G<ha;G++)if(wa=Na[G][W]){fa=0;for(la=wa.length;fa<la;fa++)l.uvs[G][fa]=wa[fa]}l.material=R.material;l.faceMaterial=H.materialIndex!==null?aa[H.materialIndex]:
-null;l.z=l.centroidScreen.z;x.elements.push(l)}}else if(R instanceof THREE.Line){v.multiply(w,$);W=R.geometry.vertices;G=b();G.positionScreen.copy(W[0].position);v.multiplyVector4(G.positionScreen);$=R.type===THREE.LinePieces?2:1;E=1;for(H=W.length;E<H;E++){G=b();G.positionScreen.copy(W[E].position);v.multiplyVector4(G.positionScreen);if(!((E+1)%$>0)){ha=k[j-2];K.copy(G.positionScreen);L.copy(ha.positionScreen);if(d(K,L)){K.multiplyScalar(1/K.w);L.multiplyScalar(1/L.w);aa=u[q]=u[q]||new THREE.RenderableLine;
-q++;n=aa;n.v1.positionScreen.copy(K);n.v2.positionScreen.copy(L);n.z=Math.max(K.z,L.z);n.material=R.material;x.elements.push(n)}}}}}a=0;for(D=x.sprites.length;a<D;a++){R=x.sprites[a].object;$=R.matrixWorld;if(R instanceof THREE.Particle){B.set($.n14,$.n24,$.n34,1);w.multiplyVector4(B);B.z=B.z/B.w;if(B.z>0&&B.z<1){g=s[y]=s[y]||new THREE.RenderableParticle;y++;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.n11)/(B.w+e.projectionMatrix.n14));
-t.scale.y=R.scale.y*Math.abs(t.y-(B.y+e.projectionMatrix.n22)/(B.w+e.projectionMatrix.n24));t.material=R.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};
+E=0;for(H=W.length;E<H;E++){h=b();h.positionWorld.copy(W[E]);$.multiplyVector3(h.positionWorld);h.positionScreen.copy(h.positionWorld);w.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<F}W=0;for(E=ea.length;W<E;W++){H=ea[W];if(H instanceof THREE.Face3){G=k[H.a];ha=k[H.b];fa=k[H.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[p]=m[p]||new THREE.RenderableFace3;p++;l=la;l.v1.copy(G);l.v2.copy(ha);l.v3.copy(fa)}else continue}else continue}else if(H instanceof THREE.Face4){G=k[H.a];ha=k[H.b];fa=k[H.c];la=k[H.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){wa=r[o]=r[o]||new THREE.RenderableFace4;o++;l=wa;l.v1.copy(G);l.v2.copy(ha);l.v3.copy(fa);l.v4.copy(la)}else continue}else continue}l.normalWorld.copy(H.normal);!i&&(R.flipSided||R.doubleSided)&&l.normalWorld.negate();ba.multiplyVector3(l.normalWorld);
+l.centroidWorld.copy(H.centroid);$.multiplyVector3(l.centroidWorld);l.centroidScreen.copy(l.centroidWorld);w.multiplyVector3(l.centroidScreen);fa=H.vertexNormals;G=0;for(ha=fa.length;G<ha;G++){la=l.vertexNormalsWorld[G];la.copy(fa[G]);!i&&(R.flipSided||R.doubleSided)&&la.negate();ba.multiplyVector3(la)}G=0;for(ha=Na.length;G<ha;G++)if(wa=Na[G][W]){fa=0;for(la=wa.length;fa<la;fa++)l.uvs[G][fa]=wa[fa]}l.material=R.material;l.faceMaterial=H.materialIndex!==null?aa[H.materialIndex]:null;l.z=l.centroidScreen.z;
+x.elements.push(l)}}else if(R instanceof THREE.Line){v.multiply(w,$);W=R.geometry.vertices;G=b();G.positionScreen.copy(W[0]);v.multiplyVector4(G.positionScreen);$=R.type===THREE.LinePieces?2:1;E=1;for(H=W.length;E<H;E++){G=b();G.positionScreen.copy(W[E]);v.multiplyVector4(G.positionScreen);if(!((E+1)%$>0)){ha=k[j-2];K.copy(G.positionScreen);L.copy(ha.positionScreen);if(d(K,L)){K.multiplyScalar(1/K.w);L.multiplyScalar(1/L.w);aa=u[q]=u[q]||new THREE.RenderableLine;q++;n=aa;n.v1.positionScreen.copy(K);
+n.v2.positionScreen.copy(L);n.z=Math.max(K.z,L.z);n.material=R.material;x.elements.push(n)}}}}}a=0;for(D=x.sprites.length;a<D;a++){R=x.sprites[a].object;$=R.matrixWorld;if(R instanceof THREE.Particle){B.set($.n14,$.n24,$.n34,1);w.multiplyVector4(B);B.z=B.z/B.w;if(B.z>0&&B.z<1){g=s[y]=s[y]||new THREE.RenderableParticle;y++;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.n11)/(B.w+e.projectionMatrix.n14));t.scale.y=R.scale.y*Math.abs(t.y-
+(B.y+e.projectionMatrix.n22)/(B.w+e.projectionMatrix.n24));t.material=R.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.n11+a.n22+a.n33))/2;this.x=Math.sqrt(Math.max(0,b+a.n11-a.n22-a.n33))/2;this.y=Math.sqrt(Math.max(0,b-a.n11+a.n22-a.n33))/2;this.z=Math.sqrt(Math.max(0,b-a.n11-a.n22+a.n33))/2;this.x=a.n32-a.n23<0?-Math.abs(this.x):Math.abs(this.x);this.y=a.n13-a.n31<0?-Math.abs(this.y):Math.abs(this.y);this.z=a.n21-a.n12<0?-Math.abs(this.z):Math.abs(this.z);
 this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x=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,
 j=this.w,k=j*c+g*e-h*d,l=j*d+h*c-f*e,p=j*e+f*d-g*c,c=-f*c-g*d-h*e;b.x=k*j+c*-f+l*-h-p*-g;b.y=l*j+c*-g+p*-f-k*-h;b.z=p*j+c*-h+k*-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.001){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}b=Math.sin((1-d)*f)/e;d=Math.sin(d*f)/e;c.w=a.w*b+c.w*d;c.x=a.x*b+c.x*d;c.y=a.y*b+c.y*d;c.z=a.z*b+c.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
-THREE.Vertex.prototype={constructor:THREE.Vertex,clone:function(){return new THREE.Vertex(this.position.clone())}};THREE.Face3=function(a,b,c,d,e,f){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materialIndex=f;this.centroid=new THREE.Vector3};
+THREE.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.001){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}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.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};
 THREE.Face4.prototype={constructor:THREE.Face4,clone:function(){var a=new THREE.Face4(this.a,this.b,this.c,this.d);a.normal.copy(this.normal);a.color.copy(this.color);a.centroid.copy(this.centroid);a.materialIndex=this.materialIndex;var b,c;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.UV=function(a,b){this.u=a||0;this.v=b||0};THREE.UV.prototype={constructor:THREE.UV,set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.u=a.u;this.v=a.v;return this},lerpSelf:function(a,b){this.u=this.u+(a.u-this.u)*b;this.v=this.v+(a.v-this.v)*b;return this},clone:function(){return new THREE.UV(this.u,this.v)}};
 THREE.Geometry=function(){this.id=THREE.GeometryCount++;this.vertices=[];this.colors=[];this.materials=[];this.faces=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.morphNormals=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.dynamic=this.hasTangents=false};
-THREE.Geometry.prototype={constructor:THREE.Geometry,applyMatrix:function(a){var b=new THREE.Matrix4;b.extractRotation(a);for(var c=0,d=this.vertices.length;c<d;c++)a.multiplyVector3(this.vertices[c].position);c=0;for(d=this.faces.length;c<d;c++){var e=this.faces[c];b.multiplyVector3(e.normal);for(var f=0,g=e.vertexNormals.length;f<g;f++)b.multiplyVector3(e.vertexNormals[f]);a.multiplyVector3(e.centroid)}},computeCentroids:function(){var a,b,c;a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];
-c.centroid.set(0,0,0);if(c instanceof THREE.Face3){c.centroid.addSelf(this.vertices[c.a].position);c.centroid.addSelf(this.vertices[c.b].position);c.centroid.addSelf(this.vertices[c.c].position);c.centroid.divideScalar(3)}else if(c instanceof THREE.Face4){c.centroid.addSelf(this.vertices[c.a].position);c.centroid.addSelf(this.vertices[c.b].position);c.centroid.addSelf(this.vertices[c.c].position);c.centroid.addSelf(this.vertices[c.d].position);c.centroid.divideScalar(4)}}},computeFaceNormals:function(){var a,
-b,c,d,e,f,g=new THREE.Vector3,h=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];d=this.vertices[c.a];e=this.vertices[c.b];f=this.vertices[c.c];g.sub(f.position,e.position);h.sub(d.position,e.position);g.crossSelf(h);g.isZero()||g.normalize();c.normal.copy(g)}},computeVertexNormals:function(){var a,b,c,d;if(this.__tmpVertices===void 0){d=this.__tmpVertices=Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)d[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<
-b;a++){c=this.faces[a];if(c instanceof THREE.Face3)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(c instanceof THREE.Face4)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{d=this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)d[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3){d[c.a].addSelf(c.normal);d[c.b].addSelf(c.normal);d[c.c].addSelf(c.normal)}else if(c instanceof
-THREE.Face4){d[c.a].addSelf(c.normal);d[c.b].addSelf(c.normal);d[c.c].addSelf(c.normal);d[c.d].addSelf(c.normal)}}a=0;for(b=this.vertices.length;a<b;a++)d[a].normalize();a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3){c.vertexNormals[0].copy(d[c.a]);c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c])}else if(c instanceof THREE.Face4){c.vertexNormals[0].copy(d[c.a]);c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c]);c.vertexNormals[3].copy(d[c.d])}}},
-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,j,k;c=0;for(d=this.faces.length;c<d;c++){e=this.faces[c];j=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(j);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];j=g.faceNormals[c];k=g.vertexNormals[c];j.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].position;j=a.vertices[c].position;k=a.vertices[d].position;l=g[e];p=g[f];m=g[G];o=j.x-h.x;r=k.x-h.x;n=j.y-h.y;q=k.y-h.y;u=j.z-h.z;t=k.z-h.z;y=p.u-l.u;s=m.u-l.u;x=p.v-l.v;D=m.v-l.v;B=1/(y*D-s*x);K.set((D*o-x*r)*B,(D*n-x*q)*B,(D*u-x*t)*B);L.set((y*r-s*o)*B,(y*q-s*n)*B,(y*t-s*u)*B);v[b].addSelf(K);v[c].addSelf(K);v[d].addSelf(K);C[b].addSelf(L);C[c].addSelf(L);C[d].addSelf(L)}var b,c,d,e,
-f,g,h,j,k,l,p,m,o,r,n,q,u,t,y,s,x,D,B,w,v=[],C=[],K=new THREE.Vector3,L=new THREE.Vector3,T=new THREE.Vector3,P=new THREE.Vector3,J=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++){v[b]=new THREE.Vector3;C[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 N=["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++){J.copy(f.vertexNormals[d]);e=f[N[d]];w=v[e];T.copy(w);T.subSelf(J.multiplyScalar(J.dot(w))).normalize();P.cross(f.vertexNormals[d],w);e=P.dot(C[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].position;this.boundingBox.min.copy(a);
-this.boundingBox.max.copy(a);for(var b=this.boundingBox.min,c=this.boundingBox.max,d=1,e=this.vertices.length;d<e;d++){a=this.vertices[d].position;if(a.x<b.x)b.x=a.x;else if(a.x>c.x)c.x=a.x;if(a.y<b.y)b.y=a.y;else if(a.y>c.y)c.y=a.y;if(a.z<b.z)b.z=a.z;else if(a.z>c.z)c.z=a.z}}else{this.boundingBox.min.set(0,0,0);this.boundingBox.max.set(0,0,0)}},computeBoundingSphere:function(){if(!this.boundingSphere)this.boundingSphere={radius:0};for(var a,b=0,c=0,d=this.vertices.length;c<d;c++){a=this.vertices[c].position.length();
-a>b&&(b=a)}this.boundingSphere.radius=b},mergeVertices:function(){var a={},b=[],c=[],d,e=Math.pow(10,4),f,g;f=0;for(g=this.vertices.length;f<g;f++){d=this.vertices[f].position;d=[Math.round(d.x*e),Math.round(d.y*e),Math.round(d.z*e)].join("_");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.Geometry.prototype={constructor:THREE.Geometry,applyMatrix:function(a){var b=new THREE.Matrix4;b.extractRotation(a);for(var c=0,d=this.vertices.length;c<d;c++)a.multiplyVector3(this.vertices[c]);c=0;for(d=this.faces.length;c<d;c++){var e=this.faces[c];b.multiplyVector3(e.normal);for(var f=0,g=e.vertexNormals.length;f<g;f++)b.multiplyVector3(e.vertexNormals[f]);a.multiplyVector3(e.centroid)}},computeCentroids:function(){var a,b,c;a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];c.centroid.set(0,
+0,0);if(c instanceof THREE.Face3){c.centroid.addSelf(this.vertices[c.a]);c.centroid.addSelf(this.vertices[c.b]);c.centroid.addSelf(this.vertices[c.c]);c.centroid.divideScalar(3)}else if(c instanceof THREE.Face4){c.centroid.addSelf(this.vertices[c.a]);c.centroid.addSelf(this.vertices[c.b]);c.centroid.addSelf(this.vertices[c.c]);c.centroid.addSelf(this.vertices[c.d]);c.centroid.divideScalar(4)}}},computeFaceNormals:function(){var a,b,c,d,e,f,g=new THREE.Vector3,h=new THREE.Vector3;a=0;for(b=this.faces.length;a<
+b;a++){c=this.faces[a];d=this.vertices[c.a];e=this.vertices[c.b];f=this.vertices[c.c];g.sub(f,e);h.sub(d,e);g.crossSelf(h);g.isZero()||g.normalize();c.normal.copy(g)}},computeVertexNormals:function(){var a,b,c,d;if(this.__tmpVertices===void 0){d=this.__tmpVertices=Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)d[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];
+else if(c instanceof THREE.Face4)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{d=this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)d[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3){d[c.a].addSelf(c.normal);d[c.b].addSelf(c.normal);d[c.c].addSelf(c.normal)}else if(c instanceof THREE.Face4){d[c.a].addSelf(c.normal);d[c.b].addSelf(c.normal);d[c.c].addSelf(c.normal);d[c.d].addSelf(c.normal)}}a=0;
+for(b=this.vertices.length;a<b;a++)d[a].normalize();a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3){c.vertexNormals[0].copy(d[c.a]);c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c])}else if(c instanceof THREE.Face4){c.vertexNormals[0].copy(d[c.a]);c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c]);c.vertexNormals[3].copy(d[c.d])}}},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,j,k;c=0;for(d=this.faces.length;c<d;c++){e=this.faces[c];j=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(j);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];
+j=g.faceNormals[c];k=g.vertexNormals[c];j.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];j=a.vertices[c];
+k=a.vertices[d];l=g[e];p=g[f];m=g[G];o=j.x-h.x;r=k.x-h.x;n=j.y-h.y;q=k.y-h.y;u=j.z-h.z;t=k.z-h.z;y=p.u-l.u;s=m.u-l.u;x=p.v-l.v;D=m.v-l.v;B=1/(y*D-s*x);K.set((D*o-x*r)*B,(D*n-x*q)*B,(D*u-x*t)*B);L.set((y*r-s*o)*B,(y*q-s*n)*B,(y*t-s*u)*B);v[b].addSelf(K);v[c].addSelf(K);v[d].addSelf(K);C[b].addSelf(L);C[c].addSelf(L);C[d].addSelf(L)}var b,c,d,e,f,g,h,j,k,l,p,m,o,r,n,q,u,t,y,s,x,D,B,w,v=[],C=[],K=new THREE.Vector3,L=new THREE.Vector3,T=new THREE.Vector3,P=new THREE.Vector3,J=new THREE.Vector3;b=0;for(c=
+this.vertices.length;b<c;b++){v[b]=new THREE.Vector3;C[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 N=["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++){J.copy(f.vertexNormals[d]);e=f[N[d]];w=v[e];T.copy(w);T.subSelf(J.multiplyScalar(J.dot(w))).normalize();
+P.cross(f.vertexNormals[d],w);e=P.dot(C[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=
+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,j,k,l,p,m;this.initFromArray=function(a){this.points=[];for(var b=0;b<a.length;b++)this.points[b]={x:a[b][0],y:a[b][1],z:a[b][2]}};this.getPoint=function(a){e=(this.points.length-1)*a;f=Math.floor(e);g=e-f;c[0]=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]];l=this.points[c[1]];p=this.points[c[2]];m=this.points[c[3]];h=g*g;j=g*h;d.x=b(k.x,l.x,p.x,m.x,g,h,j);d.y=b(k.y,l.y,p.y,m.y,g,h,j);d.z=b(k.z,l.z,p.z,m.z,g,h,j);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);
@@ -152,7 +151,7 @@ THREE.SkinnedMesh=function(a,b){THREE.Mesh.call(this,a,b);this.identityMatrix=ne
 d=this.bones[c];e.parent===-1?this.add(d):this.bones[e.parent].add(d)}this.boneMatrices=new Float32Array(16*this.bones.length);this.pose()}};THREE.SkinnedMesh.prototype=new THREE.Mesh;THREE.SkinnedMesh.prototype.constructor=THREE.SkinnedMesh;THREE.SkinnedMesh.prototype.addBone=function(a){a===void 0&&(a=new THREE.Bone(this));this.bones.push(a);return a};
 THREE.SkinnedMesh.prototype.updateMatrixWorld=function(a){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||a){this.parent?this.matrixWorld.multiply(this.parent.matrixWorld,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=false}for(var a=0,b=this.children.length;a<b;a++){var c=this.children[a];c instanceof THREE.Bone?c.update(this.identityMatrix,false):c.updateMatrixWorld(true)}for(var b=this.bones.length,c=this.bones,d=this.boneMatrices,a=0;a<b;a++)c[a].skinMatrix.flattenToArrayOffset(d,
 a*16)};
-THREE.SkinnedMesh.prototype.pose=function(){this.updateMatrixWorld(true);for(var a,b=[],c=0;c<this.bones.length;c++){a=this.bones[c];var d=new THREE.Matrix4;d.getInverse(a.skinMatrix);b.push(d);a.skinMatrix.flattenToArrayOffset(this.boneMatrices,c*16)}if(this.geometry.skinVerticesA===void 0){this.geometry.skinVerticesA=[];this.geometry.skinVerticesB=[];for(a=0;a<this.geometry.skinIndices.length;a++){var c=this.geometry.vertices[a].position,e=this.geometry.skinIndices[a].x,f=this.geometry.skinIndices[a].y,d=
+THREE.SkinnedMesh.prototype.pose=function(){this.updateMatrixWorld(true);for(var a,b=[],c=0;c<this.bones.length;c++){a=this.bones[c];var d=new THREE.Matrix4;d.getInverse(a.skinMatrix);b.push(d);a.skinMatrix.flattenToArrayOffset(this.boneMatrices,c*16)}if(this.geometry.skinVerticesA===void 0){this.geometry.skinVerticesA=[];this.geometry.skinVerticesB=[];for(a=0;a<this.geometry.skinIndices.length;a++){var c=this.geometry.vertices[a],e=this.geometry.skinIndices[a].x,f=this.geometry.skinIndices[a].y,d=
 new THREE.Vector3(c.x,c.y,c.z);this.geometry.skinVerticesA.push(b[e].multiplyVector3(d));d=new THREE.Vector3(c.x,c.y,c.z);this.geometry.skinVerticesB.push(b[f].multiplyVector3(d));if(this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y!==1){c=(1-(this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y))*0.5;this.geometry.skinWeights[a].x=this.geometry.skinWeights[a].x+c;this.geometry.skinWeights[a].y=this.geometry.skinWeights[a].y+c}}}};
 THREE.MorphAnimMesh=function(a,b){THREE.Mesh.call(this,a,b);this.duration=1E3;this.mirroredLoop=false;this.currentKeyframe=this.lastKeyframe=this.time=0;this.direction=1;this.directionBackwards=false;this.setFrameRange(0,this.geometry.morphTargets.length-1)};THREE.MorphAnimMesh.prototype=new THREE.Mesh;THREE.MorphAnimMesh.prototype.constructor=THREE.MorphAnimMesh;
 THREE.MorphAnimMesh.prototype.setFrameRange=function(a,b){this.startKeyframe=a;this.endKeyframe=b;this.length=this.endKeyframe-this.startKeyframe+1};THREE.MorphAnimMesh.prototype.setDirectionForward=function(){this.direction=1;this.directionBackwards=false};THREE.MorphAnimMesh.prototype.setDirectionBackward=function(){this.direction=-1;this.directionBackwards=true};
@@ -250,20 +249,20 @@ THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform vec3
 "}"].join("\n")},depthRGBA:{uniforms:{},vertexShader:[THREE.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n"),fragmentShader:"vec4 pack_depth( const in float depth ) {\nconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\nconst vec4 bit_mask  = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\nvec4 res = fract( depth * bit_shift );\nres -= res.xxyz * bit_mask;\nreturn res;\n}\nvoid main() {\ngl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );\n}"}};
 THREE.WebGLRenderer=function(a){function b(a,b){var c=a.vertices.length,d=b.material;if(d.attributes){if(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 j=a.colors,k=j.length,l=a.__vertexArray,n=a.__colorArray,m=a.__sortArray,p=a.__dirtyVertices,o=a.__dirtyColors,r=a.__webglCustomAttributesList;if(c.sortParticles){ua.copy(ta);ua.multiplySelf(c.matrixWorld);for(d=0;d<g;d++){e=h[d].position;ab.copy(e);ua.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]].position;f=d*3;l[f]=e.x;l[f+1]=e.y;l[f+2]=e.z}for(d=0;d<k;d++){f=d*3;e=j[m[d][1]];n[f]=e.r;n[f+1]=e.g;n[f+2]=e.b}if(r){j=0;for(k=r.length;j<
-k;j++){h=r[j];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(p)for(d=0;d<g;d++){e=h[d].position;f=d*3;l[f]=e.x;l[f+1]=e.y;l[f+2]=e.z}if(o)for(d=0;d<k;d++){e=j[d];f=d*3;n[f]=e.r;n[f+1]=e.g;n[f+2]=e.b}if(r){j=0;for(k=r.length;j<k;j++){h=r[j];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(p||c.sortParticles){i.bindBuffer(i.ARRAY_BUFFER,a.__webglVertexBuffer);i.bufferData(i.ARRAY_BUFFER,l,b)}if(o||c.sortParticles){i.bindBuffer(i.ARRAY_BUFFER,
-a.__webglColorBuffer);i.bufferData(i.ARRAY_BUFFER,n,b)}if(r){j=0;for(k=r.length;j<k;j++){h=r[j];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=E=null;W=G=wa=Na=$=-1;a[d].render(b,c,hb,mb);ha=E=null;W=G=wa=Na=$=-1}}function j(a,b,c,d,e,f,g,h){var i,j,k,l;if(b){j=a.length-1;l=b=-1}else{j=0;b=a.length;l=1}for(var n=j;n!==b;n=n+l){i=a[n];if(i.render){j=
-i.object;k=i.buffer;if(h)i=h;else{i=i[c];if(!i)continue;g&&F.setBlending(i.blending,i.blendEquation,i.blendSrc,i.blendDst);F.setDepthTest(i.depthTest);F.setDepthWrite(i.depthWrite);u(i.polygonOffset,i.polygonOffsetFactor,i.polygonOffsetUnits)}F.setObjectFaces(j);k instanceof THREE.BufferGeometry?F.renderBufferDirect(d,e,f,i,k,j):F.renderBuffer(d,e,f,i,k,j)}}}function k(a,b,c,d,e,f,g){for(var h,i,j=0,k=a.length;j<k;j++){h=a[j];i=h.object;if(i.visible){if(g)h=g;else{h=h[b];if(!h)continue;f&&F.setBlending(h.blending,
-h.blendEquation,h.blendSrc,h.blendDst);F.setDepthTest(h.depthTest);F.setDepthWrite(h.depthWrite);u(h.polygonOffset,h.polygonOffsetFactor,h.polygonOffsetUnits)}F.renderImmediateObject(c,d,e,h,i)}}}function l(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})}function p(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return true;return false}function m(a){for(var b in a.attributes)a.attributes[b].needsUpdate=false}function o(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){F.initMaterial(d,b,c,e);d.needsUpdate=false}if(d.morphTargets&&!e.__webglMorphTargetInfluences){e.__webglMorphTargetInfluences=new Float32Array(F.maxMorphTargets);for(var f=0,g=F.maxMorphTargets;f<g;f++)e.__webglMorphTargetInfluences[f]=0}var h=false,f=d.program,g=f.uniforms,j=d.uniforms;if(f!==E){i.useProgram(f);E=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){j.fogColor.value=c.color;if(c instanceof THREE.Fog){j.fogNear.value=c.near;j.fogFar.value=c.far}else if(c instanceof THREE.FogExp2)j.fogDensity.value=c.density}if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){for(var k,l=0,n=0,m=0,p,o,r,q=Ia,s=q.directional.colors,u=q.directional.positions,t=q.point.colors,H=q.point.positions,G=q.point.distances,w=0,
-v=0,x=r=0,c=0,h=b.length;c<h;c++){k=b[c];if(!k.onlyShadow){p=k.color;o=k.intensity;r=k.distance;if(k instanceof THREE.AmbientLight)if(F.gammaInput){l=l+p.r*p.r;n=n+p.g*p.g;m=m+p.b*p.b}else{l=l+p.r;n=n+p.g;m=m+p.b}else if(k instanceof THREE.DirectionalLight){r=w*3;if(F.gammaInput){s[r]=p.r*p.r*o*o;s[r+1]=p.g*p.g*o*o;s[r+2]=p.b*p.b*o*o}else{s[r]=p.r*o;s[r+1]=p.g*o;s[r+2]=p.b*o}pa.copy(k.matrixWorld.getPosition());pa.subSelf(k.target.matrixWorld.getPosition());pa.normalize();u[r]=pa.x;u[r+1]=pa.y;u[r+
-2]=pa.z;w=w+1}else if(k instanceof THREE.PointLight||k instanceof THREE.SpotLight){x=v*3;if(F.gammaInput){t[x]=p.r*p.r*o*o;t[x+1]=p.g*p.g*o*o;t[x+2]=p.b*p.b*o*o}else{t[x]=p.r*o;t[x+1]=p.g*o;t[x+2]=p.b*o}k=k.matrixWorld.getPosition();H[x]=k.x;H[x+1]=k.y;H[x+2]=k.z;G[v]=r;v=v+1}}}c=w*3;for(h=s.length;c<h;c++)s[c]=0;c=v*3;for(h=t.length;c<h;c++)t[c]=0;q.point.length=v;q.directional.length=w;q.ambient[0]=l;q.ambient[1]=n;q.ambient[2]=m;c=Ia;j.ambientLightColor.value=c.ambient;j.directionalLightColor.value=
-c.directional.colors;j.directionalLightDirection.value=c.directional.positions;j.pointLightColor.value=c.point.colors;j.pointLightPosition.value=c.point.positions;j.pointLightDistance.value=c.point.distances}if(d instanceof THREE.MeshBasicMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.MeshPhongMaterial){j.opacity.value=d.opacity;F.gammaInput?j.diffuse.value.copyGammaToLinear(d.color):j.diffuse.value=d.color;(j.map.texture=d.map)&&j.offsetRepeat.value.set(d.map.offset.x,d.map.offset.y,
-d.map.repeat.x,d.map.repeat.y);j.lightMap.texture=d.lightMap;j.envMap.texture=d.envMap;j.flipEnvMap.value=d.envMap instanceof THREE.WebGLRenderTargetCube?1:-1;j.reflectivity.value=d.reflectivity;j.refractionRatio.value=d.refractionRatio;j.combine.value=d.combine;j.useRefract.value=d.envMap&&d.envMap.mapping instanceof THREE.CubeRefractionMapping}if(d instanceof THREE.LineBasicMaterial){j.diffuse.value=d.color;j.opacity.value=d.opacity}else if(d instanceof THREE.ParticleBasicMaterial){j.psColor.value=
-d.color;j.opacity.value=d.opacity;j.size.value=d.size;j.scale.value=B.height/2;j.map.texture=d.map}else if(d instanceof THREE.MeshPhongMaterial){j.shininess.value=d.shininess;if(F.gammaInput){j.ambient.value.copyGammaToLinear(d.ambient);j.emissive.value.copyGammaToLinear(d.emissive);j.specular.value.copyGammaToLinear(d.specular)}else{j.ambient.value=d.ambient;j.emissive.value=d.emissive;j.specular.value=d.specular}d.wrapAround&&j.wrapRGB.value.copy(d.wrapRGB)}else if(d instanceof THREE.MeshLambertMaterial){if(F.gammaInput){j.ambient.value.copyGammaToLinear(d.ambient);
+var j=a.colors,k=j.length,l=a.__vertexArray,n=a.__colorArray,m=a.__sortArray,p=a.__dirtyVertices,o=a.__dirtyColors,r=a.__webglCustomAttributesList;if(c.sortParticles){ua.copy(ta);ua.multiplySelf(c.matrixWorld);for(d=0;d<g;d++){e=h[d];ab.copy(e);ua.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<k;d++){f=d*3;e=j[m[d][1]];n[f]=e.r;n[f+1]=e.g;n[f+2]=e.b}if(r){j=0;for(k=r.length;j<k;j++){h=r[j];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(p)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(o)for(d=0;d<k;d++){e=j[d];f=d*3;n[f]=e.r;n[f+1]=e.g;n[f+2]=e.b}if(r){j=0;for(k=r.length;j<k;j++){h=r[j];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(p||c.sortParticles){i.bindBuffer(i.ARRAY_BUFFER,a.__webglVertexBuffer);i.bufferData(i.ARRAY_BUFFER,l,b)}if(o||c.sortParticles){i.bindBuffer(i.ARRAY_BUFFER,a.__webglColorBuffer);i.bufferData(i.ARRAY_BUFFER,
+n,b)}if(r){j=0;for(k=r.length;j<k;j++){h=r[j];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=E=null;W=G=wa=Na=$=-1;a[d].render(b,c,hb,mb);ha=E=null;W=G=wa=Na=$=-1}}function j(a,b,c,d,e,f,g,h){var i,j,k,l;if(b){j=a.length-1;l=b=-1}else{j=0;b=a.length;l=1}for(var n=j;n!==b;n=n+l){i=a[n];if(i.render){j=i.object;k=i.buffer;if(h)i=h;else{i=
+i[c];if(!i)continue;g&&F.setBlending(i.blending,i.blendEquation,i.blendSrc,i.blendDst);F.setDepthTest(i.depthTest);F.setDepthWrite(i.depthWrite);u(i.polygonOffset,i.polygonOffsetFactor,i.polygonOffsetUnits)}F.setObjectFaces(j);k instanceof THREE.BufferGeometry?F.renderBufferDirect(d,e,f,i,k,j):F.renderBuffer(d,e,f,i,k,j)}}}function k(a,b,c,d,e,f,g){for(var h,i,j=0,k=a.length;j<k;j++){h=a[j];i=h.object;if(i.visible){if(g)h=g;else{h=h[b];if(!h)continue;f&&F.setBlending(h.blending,h.blendEquation,h.blendSrc,
+h.blendDst);F.setDepthTest(h.depthTest);F.setDepthWrite(h.depthWrite);u(h.polygonOffset,h.polygonOffsetFactor,h.polygonOffsetUnits)}F.renderImmediateObject(c,d,e,h,i)}}}function l(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})}function p(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return true;return false}function m(a){for(var b in a.attributes)a.attributes[b].needsUpdate=false}function o(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){F.initMaterial(d,b,c,e);d.needsUpdate=false}if(d.morphTargets&&!e.__webglMorphTargetInfluences){e.__webglMorphTargetInfluences=new Float32Array(F.maxMorphTargets);for(var f=0,g=F.maxMorphTargets;f<g;f++)e.__webglMorphTargetInfluences[f]=0}var h=false,f=d.program,g=f.uniforms,j=d.uniforms;if(f!==E){i.useProgram(f);E=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){j.fogColor.value=c.color;if(c instanceof THREE.Fog){j.fogNear.value=c.near;j.fogFar.value=c.far}else if(c instanceof THREE.FogExp2)j.fogDensity.value=c.density}if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){for(var k,l=0,n=0,m=0,p,o,r,q=Ia,s=q.directional.colors,u=q.directional.positions,t=q.point.colors,H=q.point.positions,G=q.point.distances,w=0,v=0,x=r=0,c=0,h=b.length;c<h;c++){k=b[c];
+if(!k.onlyShadow){p=k.color;o=k.intensity;r=k.distance;if(k instanceof THREE.AmbientLight)if(F.gammaInput){l=l+p.r*p.r;n=n+p.g*p.g;m=m+p.b*p.b}else{l=l+p.r;n=n+p.g;m=m+p.b}else if(k instanceof THREE.DirectionalLight){r=w*3;if(F.gammaInput){s[r]=p.r*p.r*o*o;s[r+1]=p.g*p.g*o*o;s[r+2]=p.b*p.b*o*o}else{s[r]=p.r*o;s[r+1]=p.g*o;s[r+2]=p.b*o}pa.copy(k.matrixWorld.getPosition());pa.subSelf(k.target.matrixWorld.getPosition());pa.normalize();u[r]=pa.x;u[r+1]=pa.y;u[r+2]=pa.z;w=w+1}else if(k instanceof THREE.PointLight||
+k instanceof THREE.SpotLight){x=v*3;if(F.gammaInput){t[x]=p.r*p.r*o*o;t[x+1]=p.g*p.g*o*o;t[x+2]=p.b*p.b*o*o}else{t[x]=p.r*o;t[x+1]=p.g*o;t[x+2]=p.b*o}k=k.matrixWorld.getPosition();H[x]=k.x;H[x+1]=k.y;H[x+2]=k.z;G[v]=r;v=v+1}}}c=w*3;for(h=s.length;c<h;c++)s[c]=0;c=v*3;for(h=t.length;c<h;c++)t[c]=0;q.point.length=v;q.directional.length=w;q.ambient[0]=l;q.ambient[1]=n;q.ambient[2]=m;c=Ia;j.ambientLightColor.value=c.ambient;j.directionalLightColor.value=c.directional.colors;j.directionalLightDirection.value=
+c.directional.positions;j.pointLightColor.value=c.point.colors;j.pointLightPosition.value=c.point.positions;j.pointLightDistance.value=c.point.distances}if(d instanceof THREE.MeshBasicMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.MeshPhongMaterial){j.opacity.value=d.opacity;F.gammaInput?j.diffuse.value.copyGammaToLinear(d.color):j.diffuse.value=d.color;(j.map.texture=d.map)&&j.offsetRepeat.value.set(d.map.offset.x,d.map.offset.y,d.map.repeat.x,d.map.repeat.y);j.lightMap.texture=
+d.lightMap;j.envMap.texture=d.envMap;j.flipEnvMap.value=d.envMap instanceof THREE.WebGLRenderTargetCube?1:-1;j.reflectivity.value=d.reflectivity;j.refractionRatio.value=d.refractionRatio;j.combine.value=d.combine;j.useRefract.value=d.envMap&&d.envMap.mapping instanceof THREE.CubeRefractionMapping}if(d instanceof THREE.LineBasicMaterial){j.diffuse.value=d.color;j.opacity.value=d.opacity}else if(d instanceof THREE.ParticleBasicMaterial){j.psColor.value=d.color;j.opacity.value=d.opacity;j.size.value=
+d.size;j.scale.value=B.height/2;j.map.texture=d.map}else if(d instanceof THREE.MeshPhongMaterial){j.shininess.value=d.shininess;if(F.gammaInput){j.ambient.value.copyGammaToLinear(d.ambient);j.emissive.value.copyGammaToLinear(d.emissive);j.specular.value.copyGammaToLinear(d.specular)}else{j.ambient.value=d.ambient;j.emissive.value=d.emissive;j.specular.value=d.specular}d.wrapAround&&j.wrapRGB.value.copy(d.wrapRGB)}else if(d instanceof THREE.MeshLambertMaterial){if(F.gammaInput){j.ambient.value.copyGammaToLinear(d.ambient);
 j.emissive.value.copyGammaToLinear(d.emissive)}else{j.ambient.value=d.ambient;j.emissive.value=d.emissive}d.wrapAround&&j.wrapRGB.value.copy(d.wrapRGB)}else if(d instanceof THREE.MeshDepthMaterial){j.mNear.value=a.near;j.mFar.value=a.far;j.opacity.value=d.opacity}else if(d instanceof THREE.MeshNormalMaterial)j.opacity.value=d.opacity;if(e.receiveShadow&&!d._shadowPass&&j.shadowMatrix){h=c=0;for(l=b.length;h<l;h++){n=b[h];if(n.castShadow&&(n instanceof THREE.SpotLight||n instanceof THREE.DirectionalLight&&
 !n.shadowCascade)){j.shadowMap.texture[c]=n.shadowMap;j.shadowMapSize.value[c]=n.shadowMapSize;j.shadowMatrix.value[c]=n.shadowMatrix;j.shadowDarkness.value[c]=n.shadowDarkness;j.shadowBias.value[c]=n.shadowBias;c++}}}b=d.uniformsList;j=0;for(c=b.length;j<c;j++)if(n=f.uniforms[b[j][1]]){h=b[j][0];m=h.type;l=h.value;if(m==="i")i.uniform1i(n,l);else if(m==="f")i.uniform1f(n,l);else if(m==="v2")i.uniform2f(n,l.x,l.y);else if(m==="v3")i.uniform3f(n,l.x,l.y,l.z);else if(m==="v4")i.uniform4f(n,l.x,l.y,
 l.z,l.w);else if(m==="c")i.uniform3f(n,l.r,l.g,l.b);else if(m==="fv1")i.uniform1fv(n,l);else if(m==="fv")i.uniform3fv(n,l);else if(m==="v2v"){if(!h._array)h._array=new Float32Array(2*l.length);m=0;for(q=l.length;m<q;m++){s=m*2;h._array[s]=l[m].x;h._array[s+1]=l[m].y}i.uniform2fv(n,h._array)}else if(m==="v3v"){if(!h._array)h._array=new Float32Array(3*l.length);m=0;for(q=l.length;m<q;m++){s=m*3;h._array[s]=l[m].x;h._array[s+1]=l[m].y;h._array[s+2]=l[m].z}i.uniform3fv(n,h._array)}else if(m=="v4v"){if(!h._array)h._array=
@@ -325,43 +324,43 @@ Ka instanceof THREE.ParticleSystem||Ka instanceof THREE.Ribbon||Ka instanceof TH
 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&&p(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,I=void 0,V=void 0,lb=void 0,O=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,ma=void 0,fd=void 0,Vb=void 0,mc=void 0,nc=void 0,Qa=void 0,gd=void 0,La=void 0,Ma=void 0,Wb=void 0,Ib=void 0,Ea=0,Ja=0,Jb=0,Kb=0,ib=0,Va=0,ra=0,Za=0,Fa=0,M=0,da=0,A=0,fb=void 0,Ra=ga.__vertexArray,wc=ga.__uvArray,xc=ga.__uv2Array,jb=ga.__normalArray,ya=ga.__tangentArray,Sa=ga.__colorArray,za=ga.__skinVertexAArray,Aa=ga.__skinVertexBArray,Ba=ga.__skinIndexArray,Ca=ga.__skinWeightArray,Wc=ga.__morphTargetsArrays,Xc=ga.__morphNormalsArrays,Yc=ga.__webglCustomAttributesList,
-z=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,na=ga.faces3,oa=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){I=0;for(V=na.length;I<V;I++){O=Ga[na[I]];X=cc[O.a].position;Y=cc[O.b].position;
-Z=cc[O.c].position;Ra[Ja]=X.x;Ra[Ja+1]=X.y;Ra[Ja+2]=X.z;Ra[Ja+3]=Y.x;Ra[Ja+4]=Y.y;Ra[Ja+5]=Y.z;Ra[Ja+6]=Z.x;Ra[Ja+7]=Z.y;Ra[Ja+8]=Z.z;Ja=Ja+9}I=0;for(V=oa.length;I<V;I++){O=Ga[oa[I]];X=cc[O.a].position;Y=cc[O.b].position;Z=cc[O.c].position;qa=cc[O.d].position;Ra[Ja]=X.x;Ra[Ja+1]=X.y;Ra[Ja+2]=X.z;Ra[Ja+3]=Y.x;Ra[Ja+4]=Y.y;Ra[Ja+5]=Y.z;Ra[Ja+6]=Z.x;Ra[Ja+7]=Z.y;Ra[Ja+8]=Z.z;Ra[Ja+9]=qa.x;Ra[Ja+10]=qa.y;Ra[Ja+11]=qa.z;Ja=Ja+12}i.bindBuffer(i.ARRAY_BUFFER,ga.__webglVertexBuffer);i.bufferData(i.ARRAY_BUFFER,
-Ra,eb)}if(vd){Qa=0;for(gd=Yb.length;Qa<gd;Qa++){I=da=0;for(V=na.length;I<V;I++){Wb=na[I];O=Ga[Wb];X=Yb[Qa].vertices[O.a].position;Y=Yb[Qa].vertices[O.b].position;Z=Yb[Qa].vertices[O.c].position;La=Wc[Qa];La[da]=X.x;La[da+1]=X.y;La[da+2]=X.z;La[da+3]=Y.x;La[da+4]=Y.y;La[da+5]=Y.z;La[da+6]=Z.x;La[da+7]=Z.y;La[da+8]=Z.z;if(bc.morphNormals){if(Fc){Ib=Jc[Qa].vertexNormals[Wb];sb=Ib.a;tb=Ib.b;ub=Ib.c}else ub=tb=sb=Jc[Qa].faceNormals[Wb];Ma=Xc[Qa];Ma[da]=sb.x;Ma[da+1]=sb.y;Ma[da+2]=sb.z;Ma[da+3]=tb.x;Ma[da+
-4]=tb.y;Ma[da+5]=tb.z;Ma[da+6]=ub.x;Ma[da+7]=ub.y;Ma[da+8]=ub.z}da=da+9}I=0;for(V=oa.length;I<V;I++){Wb=oa[I];O=Ga[Wb];X=Yb[Qa].vertices[O.a].position;Y=Yb[Qa].vertices[O.b].position;Z=Yb[Qa].vertices[O.c].position;qa=Yb[Qa].vertices[O.d].position;La=Wc[Qa];La[da]=X.x;La[da+1]=X.y;La[da+2]=X.z;La[da+3]=Y.x;La[da+4]=Y.y;La[da+5]=Y.z;La[da+6]=Z.x;La[da+7]=Z.y;La[da+8]=Z.z;La[da+9]=qa.x;La[da+10]=qa.y;La[da+11]=qa.z;if(bc.morphNormals){if(Fc){Ib=Jc[Qa].vertexNormals[Wb];sb=Ib.a;tb=Ib.b;ub=Ib.c;sc=Ib.d}else sc=
-ub=tb=sb=Jc[Qa].faceNormals[Wb];Ma=Xc[Qa];Ma[da]=sb.x;Ma[da+1]=sb.y;Ma[da+2]=sb.z;Ma[da+3]=tb.x;Ma[da+4]=tb.y;Ma[da+5]=tb.z;Ma[da+6]=ub.x;Ma[da+7]=ub.y;Ma[da+8]=ub.z;Ma[da+9]=sc.x;Ma[da+10]=sc.y;Ma[da+11]=sc.z}da=da+12}i.bindBuffer(i.ARRAY_BUFFER,ga.__webglMorphTargetsBuffers[Qa]);i.bufferData(i.ARRAY_BUFFER,Wc[Qa],eb);if(bc.morphNormals){i.bindBuffer(i.ARRAY_BUFFER,ga.__webglMorphNormalsBuffers[Qa]);i.bufferData(i.ARRAY_BUFFER,Xc[Qa],eb)}}}if(Xb.length){I=0;for(V=na.length;I<V;I++){O=Ga[na[I]];yb=
-Xb[O.a];zb=Xb[O.b];Ab=Xb[O.c];Ca[M]=yb.x;Ca[M+1]=yb.y;Ca[M+2]=yb.z;Ca[M+3]=yb.w;Ca[M+4]=zb.x;Ca[M+5]=zb.y;Ca[M+6]=zb.z;Ca[M+7]=zb.w;Ca[M+8]=Ab.x;Ca[M+9]=Ab.y;Ca[M+10]=Ab.z;Ca[M+11]=Ab.w;Bb=fc[O.a];Cb=fc[O.b];Db=fc[O.c];Ba[M]=Bb.x;Ba[M+1]=Bb.y;Ba[M+2]=Bb.z;Ba[M+3]=Bb.w;Ba[M+4]=Cb.x;Ba[M+5]=Cb.y;Ba[M+6]=Cb.z;Ba[M+7]=Cb.w;Ba[M+8]=Db.x;Ba[M+9]=Db.y;Ba[M+10]=Db.z;Ba[M+11]=Db.w;Pb=dc[O.a];Qb=dc[O.b];Rb=dc[O.c];za[M]=Pb.x;za[M+1]=Pb.y;za[M+2]=Pb.z;za[M+3]=1;za[M+4]=Qb.x;za[M+5]=Qb.y;za[M+6]=Qb.z;za[M+7]=
-1;za[M+8]=Rb.x;za[M+9]=Rb.y;za[M+10]=Rb.z;za[M+11]=1;Sb=ec[O.a];Tb=ec[O.b];Ub=ec[O.c];Aa[M]=Sb.x;Aa[M+1]=Sb.y;Aa[M+2]=Sb.z;Aa[M+3]=1;Aa[M+4]=Tb.x;Aa[M+5]=Tb.y;Aa[M+6]=Tb.z;Aa[M+7]=1;Aa[M+8]=Ub.x;Aa[M+9]=Ub.y;Aa[M+10]=Ub.z;Aa[M+11]=1;M=M+12}I=0;for(V=oa.length;I<V;I++){O=Ga[oa[I]];yb=Xb[O.a];zb=Xb[O.b];Ab=Xb[O.c];uc=Xb[O.d];Ca[M]=yb.x;Ca[M+1]=yb.y;Ca[M+2]=yb.z;Ca[M+3]=yb.w;Ca[M+4]=zb.x;Ca[M+5]=zb.y;Ca[M+6]=zb.z;Ca[M+7]=zb.w;Ca[M+8]=Ab.x;Ca[M+9]=Ab.y;Ca[M+10]=Ab.z;Ca[M+11]=Ab.w;Ca[M+12]=uc.x;Ca[M+13]=
-uc.y;Ca[M+14]=uc.z;Ca[M+15]=uc.w;Bb=fc[O.a];Cb=fc[O.b];Db=fc[O.c];vc=fc[O.d];Ba[M]=Bb.x;Ba[M+1]=Bb.y;Ba[M+2]=Bb.z;Ba[M+3]=Bb.w;Ba[M+4]=Cb.x;Ba[M+5]=Cb.y;Ba[M+6]=Cb.z;Ba[M+7]=Cb.w;Ba[M+8]=Db.x;Ba[M+9]=Db.y;Ba[M+10]=Db.z;Ba[M+11]=Db.w;Ba[M+12]=vc.x;Ba[M+13]=vc.y;Ba[M+14]=vc.z;Ba[M+15]=vc.w;Pb=dc[O.a];Qb=dc[O.b];Rb=dc[O.c];Hc=dc[O.d];za[M]=Pb.x;za[M+1]=Pb.y;za[M+2]=Pb.z;za[M+3]=1;za[M+4]=Qb.x;za[M+5]=Qb.y;za[M+6]=Qb.z;za[M+7]=1;za[M+8]=Rb.x;za[M+9]=Rb.y;za[M+10]=Rb.z;za[M+11]=1;za[M+12]=Hc.x;za[M+13]=
-Hc.y;za[M+14]=Hc.z;za[M+15]=1;Sb=ec[O.a];Tb=ec[O.b];Ub=ec[O.c];Ic=ec[O.d];Aa[M]=Sb.x;Aa[M+1]=Sb.y;Aa[M+2]=Sb.z;Aa[M+3]=1;Aa[M+4]=Tb.x;Aa[M+5]=Tb.y;Aa[M+6]=Tb.z;Aa[M+7]=1;Aa[M+8]=Ub.x;Aa[M+9]=Ub.y;Aa[M+10]=Ub.z;Aa[M+11]=1;Aa[M+12]=Ic.x;Aa[M+13]=Ic.y;Aa[M+14]=Ic.z;Aa[M+15]=1;M=M+16}if(M>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){I=0;for(V=na.length;I<V;I++){O=Ga[na[I]];ob=O.vertexColors;Gc=O.color;if(ob.length===3&&Vc===THREE.VertexColors){vb=ob[0];wb=ob[1];xb=ob[2]}else xb=wb=vb=Gc;Sa[Fa]=vb.r;Sa[Fa+1]=vb.g;Sa[Fa+2]=vb.b;Sa[Fa+3]=wb.r;Sa[Fa+4]=wb.g;Sa[Fa+5]=wb.b;Sa[Fa+6]=xb.r;Sa[Fa+7]=xb.g;Sa[Fa+8]=xb.b;Fa=Fa+9}I=0;for(V=oa.length;I<V;I++){O=Ga[oa[I]];ob=
-O.vertexColors;Gc=O.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;Sa[Fa]=vb.r;Sa[Fa+1]=vb.g;Sa[Fa+2]=vb.b;Sa[Fa+3]=wb.r;Sa[Fa+4]=wb.g;Sa[Fa+5]=wb.b;Sa[Fa+6]=xb.r;Sa[Fa+7]=xb.g;Sa[Fa+8]=xb.b;Sa[Fa+9]=tc.r;Sa[Fa+10]=tc.g;Sa[Fa+11]=tc.b;Fa=Fa+12}if(Fa>0){i.bindBuffer(i.ARRAY_BUFFER,ga.__webglColorBuffer);i.bufferData(i.ARRAY_BUFFER,Sa,eb)}}if(td&&$a.hasTangents){I=0;for(V=na.length;I<V;I++){O=Ga[na[I]];Hb=O.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=oa.length;I<V;I++){O=Ga[oa[I]];Hb=O.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){I=0;for(V=na.length;I<V;I++){O=Ga[na[I]];jc=O.vertexNormals;Ob=O.normal;if(jc.length===3&&Fc)for(ma=0;ma<3;ma++){Vb=jc[ma];jb[Va]=Vb.x;jb[Va+1]=Vb.y;jb[Va+2]=Vb.z;Va=Va+3}else for(ma=0;ma<3;ma++){jb[Va]=Ob.x;jb[Va+1]=Ob.y;jb[Va+2]=Ob.z;Va=Va+3}}I=0;for(V=oa.length;I<V;I++){O=Ga[oa[I]];jc=O.vertexNormals;Ob=O.normal;if(jc.length===4&&Fc)for(ma=0;ma<4;ma++){Vb=jc[ma];jb[Va]=Vb.x;jb[Va+1]=
-Vb.y;jb[Va+2]=Vb.z;Va=Va+3}else for(ma=0;ma<4;ma++){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){I=0;for(V=na.length;I<V;I++){lb=na[I];O=Ga[lb];kc=Zc[lb];if(kc!==void 0)for(ma=0;ma<3;ma++){mc=kc[ma];wc[Jb]=mc.u;wc[Jb+1]=mc.v;Jb=Jb+2}}I=0;for(V=oa.length;I<V;I++){lb=oa[I];O=Ga[lb];kc=Zc[lb];if(kc!==void 0)for(ma=0;ma<4;ma++){mc=kc[ma];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){I=0;for(V=na.length;I<V;I++){lb=na[I];O=Ga[lb];lc=$c[lb];if(lc!==void 0)for(ma=0;ma<3;ma++){nc=lc[ma];xc[Kb]=nc.u;xc[Kb+1]=nc.v;Kb=Kb+2}}I=0;for(V=oa.length;I<V;I++){lb=oa[I];O=Ga[lb];lc=$c[lb];if(lc!==void 0)for(ma=0;ma<4;ma++){nc=lc[ma];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){I=0;for(V=na.length;I<V;I++){O=Ga[na[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=oa.length;I<V;I++){O=Ga[oa[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,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){ma=0;for(fd=Yc.length;ma<fd;ma++){z=Yc[ma];if(z.__original.needsUpdate){A=0;if(z.size===1)if(z.boundTo===void 0||z.boundTo==="vertices"){I=0;for(V=na.length;I<V;I++){O=Ga[na[I]];z.array[A]=z.value[O.a];z.array[A+1]=z.value[O.b];z.array[A+2]=z.value[O.c];A=A+3}I=0;for(V=oa.length;I<V;I++){O=Ga[oa[I]];z.array[A]=z.value[O.a];z.array[A+1]=z.value[O.b];z.array[A+2]=z.value[O.c];z.array[A+3]=z.value[O.d];A=A+4}}else{if(z.boundTo===
-"faces"){I=0;for(V=na.length;I<V;I++){fb=z.value[na[I]];z.array[A]=fb;z.array[A+1]=fb;z.array[A+2]=fb;A=A+3}I=0;for(V=oa.length;I<V;I++){fb=z.value[oa[I]];z.array[A]=fb;z.array[A+1]=fb;z.array[A+2]=fb;z.array[A+3]=fb;A=A+4}}}else if(z.size===2)if(z.boundTo===void 0||z.boundTo==="vertices"){I=0;for(V=na.length;I<V;I++){O=Ga[na[I]];X=z.value[O.a];Y=z.value[O.b];Z=z.value[O.c];z.array[A]=X.x;z.array[A+1]=X.y;z.array[A+2]=Y.x;z.array[A+3]=Y.y;z.array[A+4]=Z.x;z.array[A+5]=Z.y;A=A+6}I=0;for(V=oa.length;I<
-V;I++){O=Ga[oa[I]];X=z.value[O.a];Y=z.value[O.b];Z=z.value[O.c];qa=z.value[O.d];z.array[A]=X.x;z.array[A+1]=X.y;z.array[A+2]=Y.x;z.array[A+3]=Y.y;z.array[A+4]=Z.x;z.array[A+5]=Z.y;z.array[A+6]=qa.x;z.array[A+7]=qa.y;A=A+8}}else{if(z.boundTo==="faces"){I=0;for(V=na.length;I<V;I++){Z=Y=X=fb=z.value[na[I]];z.array[A]=X.x;z.array[A+1]=X.y;z.array[A+2]=Y.x;z.array[A+3]=Y.y;z.array[A+4]=Z.x;z.array[A+5]=Z.y;A=A+6}I=0;for(V=oa.length;I<V;I++){qa=Z=Y=X=fb=z.value[oa[I]];z.array[A]=X.x;z.array[A+1]=X.y;z.array[A+
-2]=Y.x;z.array[A+3]=Y.y;z.array[A+4]=Z.x;z.array[A+5]=Z.y;z.array[A+6]=qa.x;z.array[A+7]=qa.y;A=A+8}}}else if(z.size===3){var ia;ia=z.type==="c"?["r","g","b"]:["x","y","z"];if(z.boundTo===void 0||z.boundTo==="vertices"){I=0;for(V=na.length;I<V;I++){O=Ga[na[I]];X=z.value[O.a];Y=z.value[O.b];Z=z.value[O.c];z.array[A]=X[ia[0]];z.array[A+1]=X[ia[1]];z.array[A+2]=X[ia[2]];z.array[A+3]=Y[ia[0]];z.array[A+4]=Y[ia[1]];z.array[A+5]=Y[ia[2]];z.array[A+6]=Z[ia[0]];z.array[A+7]=Z[ia[1]];z.array[A+8]=Z[ia[2]];
-A=A+9}I=0;for(V=oa.length;I<V;I++){O=Ga[oa[I]];X=z.value[O.a];Y=z.value[O.b];Z=z.value[O.c];qa=z.value[O.d];z.array[A]=X[ia[0]];z.array[A+1]=X[ia[1]];z.array[A+2]=X[ia[2]];z.array[A+3]=Y[ia[0]];z.array[A+4]=Y[ia[1]];z.array[A+5]=Y[ia[2]];z.array[A+6]=Z[ia[0]];z.array[A+7]=Z[ia[1]];z.array[A+8]=Z[ia[2]];z.array[A+9]=qa[ia[0]];z.array[A+10]=qa[ia[1]];z.array[A+11]=qa[ia[2]];A=A+12}}else if(z.boundTo==="faces"){I=0;for(V=na.length;I<V;I++){Z=Y=X=fb=z.value[na[I]];z.array[A]=X[ia[0]];z.array[A+1]=X[ia[1]];
-z.array[A+2]=X[ia[2]];z.array[A+3]=Y[ia[0]];z.array[A+4]=Y[ia[1]];z.array[A+5]=Y[ia[2]];z.array[A+6]=Z[ia[0]];z.array[A+7]=Z[ia[1]];z.array[A+8]=Z[ia[2]];A=A+9}I=0;for(V=oa.length;I<V;I++){qa=Z=Y=X=fb=z.value[oa[I]];z.array[A]=X[ia[0]];z.array[A+1]=X[ia[1]];z.array[A+2]=X[ia[2]];z.array[A+3]=Y[ia[0]];z.array[A+4]=Y[ia[1]];z.array[A+5]=Y[ia[2]];z.array[A+6]=Z[ia[0]];z.array[A+7]=Z[ia[1]];z.array[A+8]=Z[ia[2]];z.array[A+9]=qa[ia[0]];z.array[A+10]=qa[ia[1]];z.array[A+11]=qa[ia[2]];A=A+12}}}else if(z.size===
-4)if(z.boundTo===void 0||z.boundTo==="vertices"){I=0;for(V=na.length;I<V;I++){O=Ga[na[I]];X=z.value[O.a];Y=z.value[O.b];Z=z.value[O.c];z.array[A]=X.x;z.array[A+1]=X.y;z.array[A+2]=X.z;z.array[A+3]=X.w;z.array[A+4]=Y.x;z.array[A+5]=Y.y;z.array[A+6]=Y.z;z.array[A+7]=Y.w;z.array[A+8]=Z.x;z.array[A+9]=Z.y;z.array[A+10]=Z.z;z.array[A+11]=Z.w;A=A+12}I=0;for(V=oa.length;I<V;I++){O=Ga[oa[I]];X=z.value[O.a];Y=z.value[O.b];Z=z.value[O.c];qa=z.value[O.d];z.array[A]=X.x;z.array[A+1]=X.y;z.array[A+2]=X.z;z.array[A+
-3]=X.w;z.array[A+4]=Y.x;z.array[A+5]=Y.y;z.array[A+6]=Y.z;z.array[A+7]=Y.w;z.array[A+8]=Z.x;z.array[A+9]=Z.y;z.array[A+10]=Z.z;z.array[A+11]=Z.w;z.array[A+12]=qa.x;z.array[A+13]=qa.y;z.array[A+14]=qa.z;z.array[A+15]=qa.w;A=A+16}}else if(z.boundTo==="faces"){I=0;for(V=na.length;I<V;I++){Z=Y=X=fb=z.value[na[I]];z.array[A]=X.x;z.array[A+1]=X.y;z.array[A+2]=X.z;z.array[A+3]=X.w;z.array[A+4]=Y.x;z.array[A+5]=Y.y;z.array[A+6]=Y.z;z.array[A+7]=Y.w;z.array[A+8]=Z.x;z.array[A+9]=Z.y;z.array[A+10]=Z.z;z.array[A+
-11]=Z.w;A=A+12}I=0;for(V=oa.length;I<V;I++){qa=Z=Y=X=fb=z.value[oa[I]];z.array[A]=X.x;z.array[A+1]=X.y;z.array[A+2]=X.z;z.array[A+3]=X.w;z.array[A+4]=Y.x;z.array[A+5]=Y.y;z.array[A+6]=Y.z;z.array[A+7]=Y.w;z.array[A+8]=Z.x;z.array[A+9]=Z.y;z.array[A+10]=Z.z;z.array[A+11]=Z.w;z.array[A+12]=qa.x;z.array[A+13]=qa.y;z.array[A+14]=qa.z;z.array[A+15]=qa.w;A=A+16}}i.bindBuffer(i.ARRAY_BUFFER,z.buffer);i.bufferData(i.ARRAY_BUFFER,z.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].position;$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&&p(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,va=void 0;
-if(Lb.__dirtyVertices){for(Ac=0;Ac<zd;Ac++){Oc=ld[Ac].position;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++){va=bd[Sc];if(va.needsUpdate&&(va.boundTo===void 0||va.boundTo==="vertices")){Da=0;oc=va.value.length;
-if(va.size===1)for(Ua=0;Ua<oc;Ua++)va.array[Ua]=va.value[Ua];else if(va.size===2)for(Ua=0;Ua<oc;Ua++){cb=va.value[Ua];va.array[Da]=cb.x;va.array[Da+1]=cb.y;Da=Da+2}else if(va.size===3)if(va.type==="c")for(Ua=0;Ua<oc;Ua++){cb=va.value[Ua];va.array[Da]=cb.r;va.array[Da+1]=cb.g;va.array[Da+2]=cb.b;Da=Da+3}else for(Ua=0;Ua<oc;Ua++){cb=va.value[Ua];va.array[Da]=cb.x;va.array[Da+1]=cb.y;va.array[Da+2]=cb.z;Da=Da+3}else if(va.size===4)for(Ua=0;Ua<oc;Ua++){cb=va.value[Ua];va.array[Da]=cb.x;va.array[Da+1]=
-cb.y;va.array[Da+2]=cb.z;va.array[Da+3]=cb.w;Da=Da+4}i.bindBuffer(i.ARRAY_BUFFER,va.buffer);i.bufferData(i.ARRAY_BUFFER,va.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&&p(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 j,k,l,m;j=m=h=0;
-for(k=b.length;j<k;j++){l=b[j];if(!l.onlyShadow){l instanceof THREE.DirectionalLight&&m++;l instanceof THREE.PointLight&&h++;l instanceof THREE.SpotLight&&h++}}if(h+m<=N){l=m;m=h}else{l=Math.ceil(N*m/(h+m));m=N-l}var n=0,h=0;for(j=b.length;h<j;h++){k=b[h];if(k.castShadow){k instanceof THREE.SpotLight&&n++;k instanceof THREE.DirectionalLight&&!k.shadowCascade&&n++}}var p=50;if(d!==void 0&&d instanceof THREE.SkinnedMesh)p=d.bones.length;var o;a:{j=a.fragmentShader;k=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,morphTargets:a.morphTargets,morphNormals:a.morphNormals,maxMorphTargets:this.maxMorphTargets,maxMorphNormals:this.maxMorphNormals,maxDirLights:l,maxPointLights:m,maxBones:p,shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapDebug:this.shadowMapDebug,shadowMapCascade:this.shadowMapCascade,
-maxShadows:n,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel,wrapAround:a.wrapAround,doubleSided:d&&d.doubleSided},r,d=[];if(g)d.push(g);else{d.push(j);d.push(k)}for(r in c){d.push(r);d.push(c[r])}g=d.join();r=0;for(d=U.length;r<d;r++)if(U[r].code===g){o=U[r].program;break a}r=i.createProgram();d=["precision "+w+" float;",Xa>0?"#define VERTEX_TEXTURES":"",F.gammaInput?"#define GAMMA_INPUT":"",F.gammaOutput?"#define GAMMA_OUTPUT":"",F.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":
-"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,"#define MAX_BONES "+c.maxBones,c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.skinning?"#define USE_SKINNING":"",c.morphTargets?"#define USE_MORPHTARGETS":"",c.morphNormals?"#define USE_MORPHNORMALS":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.wrapAround?"#define WRAP_AROUND":"",c.doubleSided?
-"#define DOUBLE_SIDED":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"",c.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\n#ifdef USE_MORPHNORMALS\nattribute vec3 morphNormal0;\nattribute vec3 morphNormal1;\nattribute vec3 morphNormal2;\nattribute vec3 morphNormal3;\n#else\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
+z=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,na=ga.faces3,oa=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){I=0;for(V=na.length;I<V;I++){O=Ga[na[I]];X=cc[O.a];Y=cc[O.b];Z=cc[O.c];Ra[Ja]=
+X.x;Ra[Ja+1]=X.y;Ra[Ja+2]=X.z;Ra[Ja+3]=Y.x;Ra[Ja+4]=Y.y;Ra[Ja+5]=Y.z;Ra[Ja+6]=Z.x;Ra[Ja+7]=Z.y;Ra[Ja+8]=Z.z;Ja=Ja+9}I=0;for(V=oa.length;I<V;I++){O=Ga[oa[I]];X=cc[O.a];Y=cc[O.b];Z=cc[O.c];qa=cc[O.d];Ra[Ja]=X.x;Ra[Ja+1]=X.y;Ra[Ja+2]=X.z;Ra[Ja+3]=Y.x;Ra[Ja+4]=Y.y;Ra[Ja+5]=Y.z;Ra[Ja+6]=Z.x;Ra[Ja+7]=Z.y;Ra[Ja+8]=Z.z;Ra[Ja+9]=qa.x;Ra[Ja+10]=qa.y;Ra[Ja+11]=qa.z;Ja=Ja+12}i.bindBuffer(i.ARRAY_BUFFER,ga.__webglVertexBuffer);i.bufferData(i.ARRAY_BUFFER,Ra,eb)}if(vd){Qa=0;for(gd=Yb.length;Qa<gd;Qa++){I=da=0;
+for(V=na.length;I<V;I++){Wb=na[I];O=Ga[Wb];X=Yb[Qa].vertices[O.a];Y=Yb[Qa].vertices[O.b];Z=Yb[Qa].vertices[O.c];La=Wc[Qa];La[da]=X.x;La[da+1]=X.y;La[da+2]=X.z;La[da+3]=Y.x;La[da+4]=Y.y;La[da+5]=Y.z;La[da+6]=Z.x;La[da+7]=Z.y;La[da+8]=Z.z;if(bc.morphNormals){if(Fc){Ib=Jc[Qa].vertexNormals[Wb];sb=Ib.a;tb=Ib.b;ub=Ib.c}else ub=tb=sb=Jc[Qa].faceNormals[Wb];Ma=Xc[Qa];Ma[da]=sb.x;Ma[da+1]=sb.y;Ma[da+2]=sb.z;Ma[da+3]=tb.x;Ma[da+4]=tb.y;Ma[da+5]=tb.z;Ma[da+6]=ub.x;Ma[da+7]=ub.y;Ma[da+8]=ub.z}da=da+9}I=0;for(V=
+oa.length;I<V;I++){Wb=oa[I];O=Ga[Wb];X=Yb[Qa].vertices[O.a];Y=Yb[Qa].vertices[O.b];Z=Yb[Qa].vertices[O.c];qa=Yb[Qa].vertices[O.d];La=Wc[Qa];La[da]=X.x;La[da+1]=X.y;La[da+2]=X.z;La[da+3]=Y.x;La[da+4]=Y.y;La[da+5]=Y.z;La[da+6]=Z.x;La[da+7]=Z.y;La[da+8]=Z.z;La[da+9]=qa.x;La[da+10]=qa.y;La[da+11]=qa.z;if(bc.morphNormals){if(Fc){Ib=Jc[Qa].vertexNormals[Wb];sb=Ib.a;tb=Ib.b;ub=Ib.c;sc=Ib.d}else sc=ub=tb=sb=Jc[Qa].faceNormals[Wb];Ma=Xc[Qa];Ma[da]=sb.x;Ma[da+1]=sb.y;Ma[da+2]=sb.z;Ma[da+3]=tb.x;Ma[da+4]=tb.y;
+Ma[da+5]=tb.z;Ma[da+6]=ub.x;Ma[da+7]=ub.y;Ma[da+8]=ub.z;Ma[da+9]=sc.x;Ma[da+10]=sc.y;Ma[da+11]=sc.z}da=da+12}i.bindBuffer(i.ARRAY_BUFFER,ga.__webglMorphTargetsBuffers[Qa]);i.bufferData(i.ARRAY_BUFFER,Wc[Qa],eb);if(bc.morphNormals){i.bindBuffer(i.ARRAY_BUFFER,ga.__webglMorphNormalsBuffers[Qa]);i.bufferData(i.ARRAY_BUFFER,Xc[Qa],eb)}}}if(Xb.length){I=0;for(V=na.length;I<V;I++){O=Ga[na[I]];yb=Xb[O.a];zb=Xb[O.b];Ab=Xb[O.c];Ca[M]=yb.x;Ca[M+1]=yb.y;Ca[M+2]=yb.z;Ca[M+3]=yb.w;Ca[M+4]=zb.x;Ca[M+5]=zb.y;Ca[M+
+6]=zb.z;Ca[M+7]=zb.w;Ca[M+8]=Ab.x;Ca[M+9]=Ab.y;Ca[M+10]=Ab.z;Ca[M+11]=Ab.w;Bb=fc[O.a];Cb=fc[O.b];Db=fc[O.c];Ba[M]=Bb.x;Ba[M+1]=Bb.y;Ba[M+2]=Bb.z;Ba[M+3]=Bb.w;Ba[M+4]=Cb.x;Ba[M+5]=Cb.y;Ba[M+6]=Cb.z;Ba[M+7]=Cb.w;Ba[M+8]=Db.x;Ba[M+9]=Db.y;Ba[M+10]=Db.z;Ba[M+11]=Db.w;Pb=dc[O.a];Qb=dc[O.b];Rb=dc[O.c];za[M]=Pb.x;za[M+1]=Pb.y;za[M+2]=Pb.z;za[M+3]=1;za[M+4]=Qb.x;za[M+5]=Qb.y;za[M+6]=Qb.z;za[M+7]=1;za[M+8]=Rb.x;za[M+9]=Rb.y;za[M+10]=Rb.z;za[M+11]=1;Sb=ec[O.a];Tb=ec[O.b];Ub=ec[O.c];Aa[M]=Sb.x;Aa[M+1]=Sb.y;
+Aa[M+2]=Sb.z;Aa[M+3]=1;Aa[M+4]=Tb.x;Aa[M+5]=Tb.y;Aa[M+6]=Tb.z;Aa[M+7]=1;Aa[M+8]=Ub.x;Aa[M+9]=Ub.y;Aa[M+10]=Ub.z;Aa[M+11]=1;M=M+12}I=0;for(V=oa.length;I<V;I++){O=Ga[oa[I]];yb=Xb[O.a];zb=Xb[O.b];Ab=Xb[O.c];uc=Xb[O.d];Ca[M]=yb.x;Ca[M+1]=yb.y;Ca[M+2]=yb.z;Ca[M+3]=yb.w;Ca[M+4]=zb.x;Ca[M+5]=zb.y;Ca[M+6]=zb.z;Ca[M+7]=zb.w;Ca[M+8]=Ab.x;Ca[M+9]=Ab.y;Ca[M+10]=Ab.z;Ca[M+11]=Ab.w;Ca[M+12]=uc.x;Ca[M+13]=uc.y;Ca[M+14]=uc.z;Ca[M+15]=uc.w;Bb=fc[O.a];Cb=fc[O.b];Db=fc[O.c];vc=fc[O.d];Ba[M]=Bb.x;Ba[M+1]=Bb.y;Ba[M+2]=
+Bb.z;Ba[M+3]=Bb.w;Ba[M+4]=Cb.x;Ba[M+5]=Cb.y;Ba[M+6]=Cb.z;Ba[M+7]=Cb.w;Ba[M+8]=Db.x;Ba[M+9]=Db.y;Ba[M+10]=Db.z;Ba[M+11]=Db.w;Ba[M+12]=vc.x;Ba[M+13]=vc.y;Ba[M+14]=vc.z;Ba[M+15]=vc.w;Pb=dc[O.a];Qb=dc[O.b];Rb=dc[O.c];Hc=dc[O.d];za[M]=Pb.x;za[M+1]=Pb.y;za[M+2]=Pb.z;za[M+3]=1;za[M+4]=Qb.x;za[M+5]=Qb.y;za[M+6]=Qb.z;za[M+7]=1;za[M+8]=Rb.x;za[M+9]=Rb.y;za[M+10]=Rb.z;za[M+11]=1;za[M+12]=Hc.x;za[M+13]=Hc.y;za[M+14]=Hc.z;za[M+15]=1;Sb=ec[O.a];Tb=ec[O.b];Ub=ec[O.c];Ic=ec[O.d];Aa[M]=Sb.x;Aa[M+1]=Sb.y;Aa[M+2]=Sb.z;
+Aa[M+3]=1;Aa[M+4]=Tb.x;Aa[M+5]=Tb.y;Aa[M+6]=Tb.z;Aa[M+7]=1;Aa[M+8]=Ub.x;Aa[M+9]=Ub.y;Aa[M+10]=Ub.z;Aa[M+11]=1;Aa[M+12]=Ic.x;Aa[M+13]=Ic.y;Aa[M+14]=Ic.z;Aa[M+15]=1;M=M+16}if(M>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){I=0;for(V=na.length;I<V;I++){O=Ga[na[I]];ob=O.vertexColors;Gc=O.color;if(ob.length===3&&Vc===THREE.VertexColors){vb=ob[0];wb=ob[1];xb=ob[2]}else xb=wb=vb=Gc;Sa[Fa]=vb.r;Sa[Fa+1]=vb.g;Sa[Fa+2]=vb.b;Sa[Fa+3]=wb.r;Sa[Fa+4]=wb.g;Sa[Fa+5]=wb.b;Sa[Fa+6]=xb.r;Sa[Fa+7]=xb.g;Sa[Fa+8]=xb.b;Fa=Fa+9}I=0;for(V=oa.length;I<V;I++){O=Ga[oa[I]];ob=O.vertexColors;Gc=O.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;Sa[Fa]=vb.r;Sa[Fa+1]=vb.g;Sa[Fa+2]=vb.b;Sa[Fa+3]=wb.r;Sa[Fa+4]=wb.g;Sa[Fa+5]=wb.b;Sa[Fa+6]=xb.r;Sa[Fa+7]=xb.g;Sa[Fa+8]=xb.b;Sa[Fa+9]=tc.r;Sa[Fa+10]=tc.g;Sa[Fa+11]=tc.b;Fa=Fa+12}if(Fa>0){i.bindBuffer(i.ARRAY_BUFFER,ga.__webglColorBuffer);i.bufferData(i.ARRAY_BUFFER,Sa,eb)}}if(td&&$a.hasTangents){I=0;for(V=na.length;I<V;I++){O=Ga[na[I]];Hb=O.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=oa.length;I<V;I++){O=Ga[oa[I]];Hb=O.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){I=0;for(V=
+na.length;I<V;I++){O=Ga[na[I]];jc=O.vertexNormals;Ob=O.normal;if(jc.length===3&&Fc)for(ma=0;ma<3;ma++){Vb=jc[ma];jb[Va]=Vb.x;jb[Va+1]=Vb.y;jb[Va+2]=Vb.z;Va=Va+3}else for(ma=0;ma<3;ma++){jb[Va]=Ob.x;jb[Va+1]=Ob.y;jb[Va+2]=Ob.z;Va=Va+3}}I=0;for(V=oa.length;I<V;I++){O=Ga[oa[I]];jc=O.vertexNormals;Ob=O.normal;if(jc.length===4&&Fc)for(ma=0;ma<4;ma++){Vb=jc[ma];jb[Va]=Vb.x;jb[Va+1]=Vb.y;jb[Va+2]=Vb.z;Va=Va+3}else for(ma=0;ma<4;ma++){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){I=0;for(V=na.length;I<V;I++){lb=na[I];O=Ga[lb];kc=Zc[lb];if(kc!==void 0)for(ma=0;ma<3;ma++){mc=kc[ma];wc[Jb]=mc.u;wc[Jb+1]=mc.v;Jb=Jb+2}}I=0;for(V=oa.length;I<V;I++){lb=oa[I];O=Ga[lb];kc=Zc[lb];if(kc!==void 0)for(ma=0;ma<4;ma++){mc=kc[ma];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){I=0;for(V=na.length;I<V;I++){lb=na[I];O=Ga[lb];
+lc=$c[lb];if(lc!==void 0)for(ma=0;ma<3;ma++){nc=lc[ma];xc[Kb]=nc.u;xc[Kb+1]=nc.v;Kb=Kb+2}}I=0;for(V=oa.length;I<V;I++){lb=oa[I];O=Ga[lb];lc=$c[lb];if(lc!==void 0)for(ma=0;ma<4;ma++){nc=lc[ma];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){I=0;for(V=na.length;I<V;I++){O=Ga[na[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=oa.length;I<V;I++){O=Ga[oa[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,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){ma=0;for(fd=Yc.length;ma<fd;ma++){z=
+Yc[ma];if(z.__original.needsUpdate){A=0;if(z.size===1)if(z.boundTo===void 0||z.boundTo==="vertices"){I=0;for(V=na.length;I<V;I++){O=Ga[na[I]];z.array[A]=z.value[O.a];z.array[A+1]=z.value[O.b];z.array[A+2]=z.value[O.c];A=A+3}I=0;for(V=oa.length;I<V;I++){O=Ga[oa[I]];z.array[A]=z.value[O.a];z.array[A+1]=z.value[O.b];z.array[A+2]=z.value[O.c];z.array[A+3]=z.value[O.d];A=A+4}}else{if(z.boundTo==="faces"){I=0;for(V=na.length;I<V;I++){fb=z.value[na[I]];z.array[A]=fb;z.array[A+1]=fb;z.array[A+2]=fb;A=A+3}I=
+0;for(V=oa.length;I<V;I++){fb=z.value[oa[I]];z.array[A]=fb;z.array[A+1]=fb;z.array[A+2]=fb;z.array[A+3]=fb;A=A+4}}}else if(z.size===2)if(z.boundTo===void 0||z.boundTo==="vertices"){I=0;for(V=na.length;I<V;I++){O=Ga[na[I]];X=z.value[O.a];Y=z.value[O.b];Z=z.value[O.c];z.array[A]=X.x;z.array[A+1]=X.y;z.array[A+2]=Y.x;z.array[A+3]=Y.y;z.array[A+4]=Z.x;z.array[A+5]=Z.y;A=A+6}I=0;for(V=oa.length;I<V;I++){O=Ga[oa[I]];X=z.value[O.a];Y=z.value[O.b];Z=z.value[O.c];qa=z.value[O.d];z.array[A]=X.x;z.array[A+1]=
+X.y;z.array[A+2]=Y.x;z.array[A+3]=Y.y;z.array[A+4]=Z.x;z.array[A+5]=Z.y;z.array[A+6]=qa.x;z.array[A+7]=qa.y;A=A+8}}else{if(z.boundTo==="faces"){I=0;for(V=na.length;I<V;I++){Z=Y=X=fb=z.value[na[I]];z.array[A]=X.x;z.array[A+1]=X.y;z.array[A+2]=Y.x;z.array[A+3]=Y.y;z.array[A+4]=Z.x;z.array[A+5]=Z.y;A=A+6}I=0;for(V=oa.length;I<V;I++){qa=Z=Y=X=fb=z.value[oa[I]];z.array[A]=X.x;z.array[A+1]=X.y;z.array[A+2]=Y.x;z.array[A+3]=Y.y;z.array[A+4]=Z.x;z.array[A+5]=Z.y;z.array[A+6]=qa.x;z.array[A+7]=qa.y;A=A+8}}}else if(z.size===
+3){var ia;ia=z.type==="c"?["r","g","b"]:["x","y","z"];if(z.boundTo===void 0||z.boundTo==="vertices"){I=0;for(V=na.length;I<V;I++){O=Ga[na[I]];X=z.value[O.a];Y=z.value[O.b];Z=z.value[O.c];z.array[A]=X[ia[0]];z.array[A+1]=X[ia[1]];z.array[A+2]=X[ia[2]];z.array[A+3]=Y[ia[0]];z.array[A+4]=Y[ia[1]];z.array[A+5]=Y[ia[2]];z.array[A+6]=Z[ia[0]];z.array[A+7]=Z[ia[1]];z.array[A+8]=Z[ia[2]];A=A+9}I=0;for(V=oa.length;I<V;I++){O=Ga[oa[I]];X=z.value[O.a];Y=z.value[O.b];Z=z.value[O.c];qa=z.value[O.d];z.array[A]=
+X[ia[0]];z.array[A+1]=X[ia[1]];z.array[A+2]=X[ia[2]];z.array[A+3]=Y[ia[0]];z.array[A+4]=Y[ia[1]];z.array[A+5]=Y[ia[2]];z.array[A+6]=Z[ia[0]];z.array[A+7]=Z[ia[1]];z.array[A+8]=Z[ia[2]];z.array[A+9]=qa[ia[0]];z.array[A+10]=qa[ia[1]];z.array[A+11]=qa[ia[2]];A=A+12}}else if(z.boundTo==="faces"){I=0;for(V=na.length;I<V;I++){Z=Y=X=fb=z.value[na[I]];z.array[A]=X[ia[0]];z.array[A+1]=X[ia[1]];z.array[A+2]=X[ia[2]];z.array[A+3]=Y[ia[0]];z.array[A+4]=Y[ia[1]];z.array[A+5]=Y[ia[2]];z.array[A+6]=Z[ia[0]];z.array[A+
+7]=Z[ia[1]];z.array[A+8]=Z[ia[2]];A=A+9}I=0;for(V=oa.length;I<V;I++){qa=Z=Y=X=fb=z.value[oa[I]];z.array[A]=X[ia[0]];z.array[A+1]=X[ia[1]];z.array[A+2]=X[ia[2]];z.array[A+3]=Y[ia[0]];z.array[A+4]=Y[ia[1]];z.array[A+5]=Y[ia[2]];z.array[A+6]=Z[ia[0]];z.array[A+7]=Z[ia[1]];z.array[A+8]=Z[ia[2]];z.array[A+9]=qa[ia[0]];z.array[A+10]=qa[ia[1]];z.array[A+11]=qa[ia[2]];A=A+12}}}else if(z.size===4)if(z.boundTo===void 0||z.boundTo==="vertices"){I=0;for(V=na.length;I<V;I++){O=Ga[na[I]];X=z.value[O.a];Y=z.value[O.b];
+Z=z.value[O.c];z.array[A]=X.x;z.array[A+1]=X.y;z.array[A+2]=X.z;z.array[A+3]=X.w;z.array[A+4]=Y.x;z.array[A+5]=Y.y;z.array[A+6]=Y.z;z.array[A+7]=Y.w;z.array[A+8]=Z.x;z.array[A+9]=Z.y;z.array[A+10]=Z.z;z.array[A+11]=Z.w;A=A+12}I=0;for(V=oa.length;I<V;I++){O=Ga[oa[I]];X=z.value[O.a];Y=z.value[O.b];Z=z.value[O.c];qa=z.value[O.d];z.array[A]=X.x;z.array[A+1]=X.y;z.array[A+2]=X.z;z.array[A+3]=X.w;z.array[A+4]=Y.x;z.array[A+5]=Y.y;z.array[A+6]=Y.z;z.array[A+7]=Y.w;z.array[A+8]=Z.x;z.array[A+9]=Z.y;z.array[A+
+10]=Z.z;z.array[A+11]=Z.w;z.array[A+12]=qa.x;z.array[A+13]=qa.y;z.array[A+14]=qa.z;z.array[A+15]=qa.w;A=A+16}}else if(z.boundTo==="faces"){I=0;for(V=na.length;I<V;I++){Z=Y=X=fb=z.value[na[I]];z.array[A]=X.x;z.array[A+1]=X.y;z.array[A+2]=X.z;z.array[A+3]=X.w;z.array[A+4]=Y.x;z.array[A+5]=Y.y;z.array[A+6]=Y.z;z.array[A+7]=Y.w;z.array[A+8]=Z.x;z.array[A+9]=Z.y;z.array[A+10]=Z.z;z.array[A+11]=Z.w;A=A+12}I=0;for(V=oa.length;I<V;I++){qa=Z=Y=X=fb=z.value[oa[I]];z.array[A]=X.x;z.array[A+1]=X.y;z.array[A+
+2]=X.z;z.array[A+3]=X.w;z.array[A+4]=Y.x;z.array[A+5]=Y.y;z.array[A+6]=Y.z;z.array[A+7]=Y.w;z.array[A+8]=Z.x;z.array[A+9]=Z.y;z.array[A+10]=Z.z;z.array[A+11]=Z.w;z.array[A+12]=qa.x;z.array[A+13]=qa.y;z.array[A+14]=qa.z;z.array[A+15]=qa.w;A=A+16}}i.bindBuffer(i.ARRAY_BUFFER,z.buffer);i.bufferData(i.ARRAY_BUFFER,z.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&&p(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,va=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++){va=bd[Sc];if(va.needsUpdate&&(va.boundTo===void 0||va.boundTo==="vertices")){Da=0;oc=va.value.length;if(va.size===1)for(Ua=0;Ua<oc;Ua++)va.array[Ua]=va.value[Ua];else if(va.size===2)for(Ua=0;Ua<oc;Ua++){cb=va.value[Ua];va.array[Da]=
+cb.x;va.array[Da+1]=cb.y;Da=Da+2}else if(va.size===3)if(va.type==="c")for(Ua=0;Ua<oc;Ua++){cb=va.value[Ua];va.array[Da]=cb.r;va.array[Da+1]=cb.g;va.array[Da+2]=cb.b;Da=Da+3}else for(Ua=0;Ua<oc;Ua++){cb=va.value[Ua];va.array[Da]=cb.x;va.array[Da+1]=cb.y;va.array[Da+2]=cb.z;Da=Da+3}else if(va.size===4)for(Ua=0;Ua<oc;Ua++){cb=va.value[Ua];va.array[Da]=cb.x;va.array[Da+1]=cb.y;va.array[Da+2]=cb.z;va.array[Da+3]=cb.w;Da=Da+4}i.bindBuffer(i.ARRAY_BUFFER,va.buffer);i.bufferData(i.ARRAY_BUFFER,va.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&&p(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 j,k,l,m;j=m=h=0;for(k=b.length;j<k;j++){l=b[j];if(!l.onlyShadow){l instanceof THREE.DirectionalLight&&m++;l instanceof THREE.PointLight&&h++;l instanceof THREE.SpotLight&&h++}}if(h+m<=
+N){l=m;m=h}else{l=Math.ceil(N*m/(h+m));m=N-l}var n=0,h=0;for(j=b.length;h<j;h++){k=b[h];if(k.castShadow){k instanceof THREE.SpotLight&&n++;k instanceof THREE.DirectionalLight&&!k.shadowCascade&&n++}}var p=50;if(d!==void 0&&d instanceof THREE.SkinnedMesh)p=d.bones.length;var o;a:{j=a.fragmentShader;k=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,
+morphTargets:a.morphTargets,morphNormals:a.morphNormals,maxMorphTargets:this.maxMorphTargets,maxMorphNormals:this.maxMorphNormals,maxDirLights:l,maxPointLights:m,maxBones:p,shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapDebug:this.shadowMapDebug,shadowMapCascade:this.shadowMapCascade,maxShadows:n,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel,wrapAround:a.wrapAround,doubleSided:d&&d.doubleSided},r,d=[];if(g)d.push(g);else{d.push(j);d.push(k)}for(r in c){d.push(r);
+d.push(c[r])}g=d.join();r=0;for(d=U.length;r<d;r++)if(U[r].code===g){o=U[r].program;break a}r=i.createProgram();d=["precision "+w+" float;",Xa>0?"#define VERTEX_TEXTURES":"",F.gammaInput?"#define GAMMA_INPUT":"",F.gammaOutput?"#define GAMMA_OUTPUT":"",F.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,"#define MAX_BONES "+c.maxBones,c.map?"#define USE_MAP":"",c.envMap?
+"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.skinning?"#define USE_SKINNING":"",c.morphTargets?"#define USE_MORPHTARGETS":"",c.morphNormals?"#define USE_MORPHNORMALS":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.wrapAround?"#define WRAP_AROUND":"",c.doubleSided?"#define DOUBLE_SIDED":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":
+"",c.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\n#ifdef USE_MORPHNORMALS\nattribute vec3 morphNormal0;\nattribute vec3 morphNormal1;\nattribute vec3 morphNormal2;\nattribute vec3 morphNormal3;\n#else\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
 l=["precision "+w+" float;","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",F.gammaInput?"#define GAMMA_INPUT":"",F.gammaOutput?"#define GAMMA_OUTPUT":"",F.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"",c.useFog&&c.fog?"#define USE_FOG":"",c.useFog&&c.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?
 "#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.metal?"#define METAL":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.wrapAround?"#define WRAP_AROUND":"",c.doubleSided?"#define DOUBLE_SIDED":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");i.attachShader(r,t("fragment",l+j));
 i.attachShader(r,t("vertex",d+k));i.linkProgram(r);i.getProgramParameter(r,i.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+i.getProgramParameter(r,i.VALIDATE_STATUS)+", gl error ["+i.getError()+"]");r.uniforms={};r.attributes={};var q,d=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","boneGlobalMatrices","morphTargetInfluences"];for(q in h)d.push(q);q=d;d=0;for(h=q.length;d<h;d++){j=q[d];r.uniforms[j]=i.getUniformLocation(r,
@@ -385,27 +384,27 @@ 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,j=a.faces,k=f.faces,l=a.faceVertexUvs[0],p=f.faceVertexUvs[0],m={},o=0;o<a.materials.length;o++)m[a.materials[o].id]=o;if(b instanceof THREE.Mesh){b.matrixAutoUpdate&&b.updateMatrix();c=b.matrix;d=new THREE.Matrix4;d.extractRotation(c,b.scale)}for(var o=0,r=h.length;o<r;o++){var n=h[o].clone();c&&c.multiplyVector3(n.position);g.push(n)}o=0;for(r=k.length;o<r;o++){var g=
+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,j=a.faces,k=f.faces,l=a.faceVertexUvs[0],p=f.faceVertexUvs[0],m={},o=0;o<a.materials.length;o++)m[a.materials[o].id]=o;if(b instanceof THREE.Mesh){b.matrixAutoUpdate&&b.updateMatrix();c=b.matrix;d=new THREE.Matrix4;d.extractRotation(c,b.scale)}for(var o=0,r=h.length;o<r;o++){var n=h[o].clone();c&&c.multiplyVector3(n);g.push(n)}o=0;for(r=k.length;o<r;o++){var g=
 k[o],q,u,t=g.vertexNormals,y=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=y.length;h<n;h++){u=y[h];q.vertexColors.push(u.clone())}if(g.materialIndex!==void 0){h=f.materials[g.materialIndex];n=h.id;y=m[n];if(y===void 0){y=
 a.materials.length;m[n]=y;a.materials.push(h)}q.materialIndex=y}q.centroid.copy(g.centroid);c&&c.multiplyVector3(q.centroid);j.push(q)}o=0;for(r=p.length;o<r;o++){c=p[o];d=[];h=0;for(n=c.length;h<n;h++)d.push(new THREE.UV(c[h].u,c[h].v));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].position;e=b.vertices[a.b].position;f=b.vertices[a.c].position;return THREE.GeometryUtils.randomPointInTriangle(d,e,f)}if(a instanceof THREE.Face4){d=b.vertices[a.a].position;e=b.vertices[a.b].position;f=b.vertices[a.c].position;var b=b.vertices[a.d].position,g;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,j=0,k=[],l,p,m,o;for(e=0;e<h;e++){d=f[e];if(d instanceof THREE.Face3){l=g[d.a].position;p=g[d.b].position;
-m=g[d.c].position;d._area=THREE.GeometryUtils.triangleArea(l,p,m)}else if(d instanceof THREE.Face4){l=g[d.a].position;p=g[d.b].position;m=g[d.c].position;o=g[d.d].position;d._area1=THREE.GeometryUtils.triangleArea(l,p,o);d._area2=THREE.GeometryUtils.triangleArea(p,m,o);d._area=d._area1+d._area2}j=j+d._area;k[e]=j}d=[];for(e=0;e<b;e++){g=THREE.GeometryUtils.random()*j;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 j=d.b,k=d.c,l=d.d,p=new THREE.Face3,m=new THREE.Face3;p.color.copy(d.color);m.color.copy(d.color);p.materialIndex=d.materialIndex;m.materialIndex=d.materialIndex;p.a=e;p.b=j;p.c=l;m.a=j;m.b=k;m.c=l;if(d.vertexColors.length===
-4){p.vertexColors[0]=d.vertexColors[0].clone();p.vertexColors[1]=d.vertexColors[1].clone();p.vertexColors[2]=d.vertexColors[3].clone();m.vertexColors[0]=d.vertexColors[1].clone();m.vertexColors[1]=d.vertexColors[2].clone();m.vertexColors[2]=d.vertexColors[3].clone()}f.push(p,m);d=0;for(e=a.faceVertexUvs.length;d<e;d++)if(a.faceVertexUvs[d].length){p=a.faceVertexUvs[d][b];j=p[1];k=p[2];l=p[3];p=[p[0].clone(),j.clone(),l.clone()];j=[j.clone(),k.clone(),l.clone()];h[d].push(p,j)}d=0;for(e=a.faceUvs.length;d<
-e;d++)if(a.faceUvs[d].length){j=a.faceUvs[d][b];g[d].push(j,j)}}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,j=f.c,g=a.vertices[g],
-h=a.vertices[h],j=a.vertices[j],k=a.vertices[f.d];b.push(g.clone());b.push(h.clone());b.push(j.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;j=f.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());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,j,k,l,p,m,o,r,n,q,u,t,y,s,x=[],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];l=a.vertices[g];p=a.vertices[h];o=k.position.distanceTo(l.position);r=l.position.distanceTo(p.position);m=k.position.distanceTo(p.position);if(o>b||r>b||m>b){j=a.vertices.length;y=e.clone();s=e.clone();if(o>=r&&o>=m){k=k.clone();k.position.lerpSelf(l.position,0.5);y.a=f;y.b=j;y.c=h;s.a=j;s.b=g;s.c=h;if(e.vertexNormals.length===3){f=e.vertexNormals[0].clone();f.lerpSelf(e.vertexNormals[1],0.5);y.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);y.vertexColors[1].copy(f);s.vertexColors[0].copy(f)}e=0}else if(r>=o&&r>=m){k=l.clone();k.position.lerpSelf(p.position,0.5);y.a=f;y.b=g;y.c=j;s.a=j;s.b=h;s.c=f;if(e.vertexNormals.length===3){f=e.vertexNormals[1].clone();f.lerpSelf(e.vertexNormals[2],0.5);y.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);y.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.position.lerpSelf(p.position,0.5);y.a=f;y.b=g;y.c=j;s.a=j;s.b=g;s.c=h;if(e.vertexNormals.length===3){f=e.vertexNormals[0].clone();f.lerpSelf(e.vertexNormals[2],0.5);y.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);
-y.vertexColors[2].copy(f);s.vertexColors[0].copy(f)}e=2}x.push(y,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];y=k[2];if(e===0){l=s.clone();l.lerpSelf(h,0.5);k=[s.clone(),l.clone(),y.clone()];h=[l.clone(),h.clone(),y.clone()]}else if(e===1){l=h.clone();l.lerpSelf(y,0.5);k=[s.clone(),h.clone(),l.clone()];h=[l.clone(),y.clone(),s.clone()]}else{l=s.clone();l.lerpSelf(y,0.5);k=[s.clone(),h.clone(),l.clone()];h=[l.clone(),
-h.clone(),y.clone()]}D[f].push(k,h)}}else{x.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;j=e.d;k=a.vertices[f];l=a.vertices[g];p=a.vertices[h];m=a.vertices[j];o=k.position.distanceTo(l.position);r=l.position.distanceTo(p.position);n=p.position.distanceTo(m.position);q=k.position.distanceTo(m.position);if(o>b||r>b||n>b||q>b){u=a.vertices.length;t=a.vertices.length+1;y=e.clone();s=e.clone();if(o>=r&&o>=n&&o>=q||n>=r&&n>=o&&n>=q){o=k.clone();
-o.position.lerpSelf(l.position,0.5);l=p.clone();l.position.lerpSelf(m.position,0.5);y.a=f;y.b=u;y.c=t;y.d=j;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);y.vertexNormals[1].copy(f);y.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);y.vertexColors[1].copy(f);y.vertexColors[2].copy(g);s.vertexColors[0].copy(f);s.vertexColors[3].copy(g)}e=0}else{o=l.clone();o.position.lerpSelf(p.position,0.5);l=m.clone();l.position.lerpSelf(k.position,0.5);y.a=f;y.b=g;y.c=u;y.d=t;s.a=t;s.b=u;s.c=h;s.d=j;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);y.vertexNormals[2].copy(f);y.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);y.vertexColors[2].copy(f);y.vertexColors[3].copy(g);s.vertexColors[0].copy(g);s.vertexColors[1].copy(f)}e=1}x.push(y,s);a.vertices.push(o,l);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];y=k[2];k=k[3];if(e===0){l=s.clone();l.lerpSelf(h,
-0.5);p=y.clone();p.lerpSelf(k,0.5);s=[s.clone(),l.clone(),p.clone(),k.clone()];h=[l.clone(),h.clone(),y.clone(),p.clone()]}else{l=h.clone();l.lerpSelf(y,0.5);p=k.clone();p.lerpSelf(s,0.5);s=[s.clone(),h.clone(),l.clone(),p.clone()];h=[p.clone(),l.clone(),y.clone(),k.clone()]}D[f].push(s,h)}}else{x.push(e);f=0;for(g=a.faceVertexUvs.length;f<g;f++)D[f].push(a.faceVertexUvs[f][c])}}}a.faces=x;a.faceVertexUvs=D}};THREE.GeometryUtils.random=THREE.Math.random16;THREE.GeometryUtils.__v1=new THREE.Vector3;
+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,j=0,k=[],l,p,m,o;for(e=0;e<h;e++){d=f[e];if(d instanceof THREE.Face3){l=g[d.a];p=g[d.b];m=g[d.c];d._area=THREE.GeometryUtils.triangleArea(l,p,m)}else if(d instanceof THREE.Face4){l=
+g[d.a];p=g[d.b];m=g[d.c];o=g[d.d];d._area1=THREE.GeometryUtils.triangleArea(l,p,o);d._area2=THREE.GeometryUtils.triangleArea(p,m,o);d._area=d._area1+d._area2}j=j+d._area;k[e]=j}d=[];for(e=0;e<b;e++){g=THREE.GeometryUtils.random()*j;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 j=d.b,k=d.c,l=d.d,p=new THREE.Face3,m=new THREE.Face3;p.color.copy(d.color);m.color.copy(d.color);p.materialIndex=d.materialIndex;m.materialIndex=d.materialIndex;p.a=e;p.b=j;p.c=l;m.a=j;m.b=k;m.c=l;if(d.vertexColors.length===4){p.vertexColors[0]=d.vertexColors[0].clone();p.vertexColors[1]=d.vertexColors[1].clone();p.vertexColors[2]=d.vertexColors[3].clone();m.vertexColors[0]=d.vertexColors[1].clone();
+m.vertexColors[1]=d.vertexColors[2].clone();m.vertexColors[2]=d.vertexColors[3].clone()}f.push(p,m);d=0;for(e=a.faceVertexUvs.length;d<e;d++)if(a.faceVertexUvs[d].length){p=a.faceVertexUvs[d][b];j=p[1];k=p[2];l=p[3];p=[p[0].clone(),j.clone(),l.clone()];j=[j.clone(),k.clone(),l.clone()];h[d].push(p,j)}d=0;for(e=a.faceUvs.length;d<e;d++)if(a.faceUvs[d].length){j=a.faceUvs[d][b];g[d].push(j,j)}}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,j=f.c,g=a.vertices[g],h=a.vertices[h],j=a.vertices[j],k=a.vertices[f.d];b.push(g.clone());b.push(h.clone());b.push(j.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;j=f.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());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,j,k,l,p,m,o,r,n,q,u,t,y,s,x=[],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];l=a.vertices[g];p=a.vertices[h];o=k.distanceTo(l);r=l.distanceTo(p);m=k.distanceTo(p);if(o>
+b||r>b||m>b){j=a.vertices.length;y=e.clone();s=e.clone();if(o>=r&&o>=m){k=k.clone();k.lerpSelf(l,0.5);y.a=f;y.b=j;y.c=h;s.a=j;s.b=g;s.c=h;if(e.vertexNormals.length===3){f=e.vertexNormals[0].clone();f.lerpSelf(e.vertexNormals[1],0.5);y.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);y.vertexColors[1].copy(f);s.vertexColors[0].copy(f)}e=0}else if(r>=o&&r>=m){k=l.clone();k.lerpSelf(p,0.5);y.a=f;y.b=g;y.c=
+j;s.a=j;s.b=h;s.c=f;if(e.vertexNormals.length===3){f=e.vertexNormals[1].clone();f.lerpSelf(e.vertexNormals[2],0.5);y.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);y.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(p,0.5);y.a=f;y.b=g;y.c=j;s.a=j;s.b=g;s.c=h;if(e.vertexNormals.length===3){f=e.vertexNormals[0].clone();f.lerpSelf(e.vertexNormals[2],0.5);y.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);y.vertexColors[2].copy(f);s.vertexColors[0].copy(f)}e=2}x.push(y,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];y=k[2];if(e===
+0){l=s.clone();l.lerpSelf(h,0.5);k=[s.clone(),l.clone(),y.clone()];h=[l.clone(),h.clone(),y.clone()]}else if(e===1){l=h.clone();l.lerpSelf(y,0.5);k=[s.clone(),h.clone(),l.clone()];h=[l.clone(),y.clone(),s.clone()]}else{l=s.clone();l.lerpSelf(y,0.5);k=[s.clone(),h.clone(),l.clone()];h=[l.clone(),h.clone(),y.clone()]}D[f].push(k,h)}}else{x.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;j=e.d;k=a.vertices[f];l=a.vertices[g];p=a.vertices[h];m=
+a.vertices[j];o=k.distanceTo(l);r=l.distanceTo(p);n=p.distanceTo(m);q=k.distanceTo(m);if(o>b||r>b||n>b||q>b){u=a.vertices.length;t=a.vertices.length+1;y=e.clone();s=e.clone();if(o>=r&&o>=n&&o>=q||n>=r&&n>=o&&n>=q){o=k.clone();o.lerpSelf(l,0.5);l=p.clone();l.lerpSelf(m,0.5);y.a=f;y.b=u;y.c=t;y.d=j;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);y.vertexNormals[1].copy(f);
+y.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);y.vertexColors[1].copy(f);y.vertexColors[2].copy(g);s.vertexColors[0].copy(f);s.vertexColors[3].copy(g)}e=0}else{o=l.clone();o.lerpSelf(p,0.5);l=m.clone();l.lerpSelf(k,0.5);y.a=f;y.b=g;y.c=u;y.d=t;s.a=t;s.b=u;s.c=h;s.d=j;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);y.vertexNormals[2].copy(f);y.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);y.vertexColors[2].copy(f);y.vertexColors[3].copy(g);s.vertexColors[0].copy(g);s.vertexColors[1].copy(f)}e=1}x.push(y,s);a.vertices.push(o,l);
+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];y=k[2];k=k[3];if(e===0){l=s.clone();l.lerpSelf(h,0.5);p=y.clone();p.lerpSelf(k,0.5);s=[s.clone(),l.clone(),p.clone(),k.clone()];h=[l.clone(),h.clone(),y.clone(),p.clone()]}else{l=h.clone();l.lerpSelf(y,0.5);p=k.clone();p.lerpSelf(s,0.5);s=[s.clone(),h.clone(),l.clone(),p.clone()];h=[p.clone(),l.clone(),y.clone(),k.clone()]}D[f].push(s,h)}}else{x.push(e);f=0;for(g=a.faceVertexUvs.length;f<g;f++)D[f].push(a.faceVertexUvs[f][c])}}}a.faces=
+x;a.faceVertexUvs=D}};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,j=g.createImageData(d,e),k=j.data,l=0;l<d;l++)for(var p=1;p<e;p++){var m=p-1<0?e-1:p-1,o=(p+1)%e,r=l-1<0?d-1:l-1,n=(l+1)%d,q=[],u=[0,0,h[(p*d+l)*4]/255*b];q.push([-1,0,h[(p*d+r)*4]/255*b]);q.push([-1,-1,h[(m*d+r)*4]/255*b]);q.push([0,-1,
 h[(m*d+l)*4]/255*b]);q.push([1,-1,h[(m*d+n)*4]/255*b]);q.push([1,0,h[(p*d+n)*4]/255*b]);q.push([1,1,h[(o*d+n)*4]/255*b]);q.push([0,1,h[(o*d+l)*4]/255*b]);q.push([-1,1,h[(o*d+r)*4]/255*b]);m=[];r=q.length;for(o=0;o<r;o++){var n=q[o],t=q[(o+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(o=0;o<m.length;o++){q[0]=q[0]+m[o][0];q[1]=q[1]+m[o][1];q[2]=q[2]+m[o][2]}q[0]=q[0]/m.length;q[1]=q[1]/
@@ -446,7 +445,7 @@ d[c[1]].z,d[c[2]].z,d[c[3]].z,e);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,e;b=c=Number.NEGATIVE_INFINITY;d=e=Number.POSITIVE_INFINITY;var f,g,h,j;j=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;j.addSelf(f.x,f.y)}return{minX:d,minY:e,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(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.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.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,j;d=0;for(e=a.length;d<e;d++){f=a[d];g=f.x;h=f.y;j=g/c.maxX;j=b.getUtoTmapping(j,g);g=b.getPoint(j);h=b.getNormalVector(j).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;
@@ -522,9 +521,9 @@ 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(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.005;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;
+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;
+this.animationParent=new THREE.Object3D;this.lookSpeed=0.005;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===
 document){this.mouseX=a.pageX-this.viewHalfX;this.mouseY=a.pageY-this.viewHalfY}else{this.mouseX=a.pageX-this.domElement.offsetLeft-this.viewHalfX;this.mouseY=a.pageY-this.domElement.offsetTop-this.viewHalfY}};this.init=function(){this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){var a=new THREE.MeshLambertMaterial({color:30719}),b=new THREE.MeshLambertMaterial({color:65280}),
 c=new THREE.CubeGeometry(10,10,20),g=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(c,a);a=new THREE.Mesh(g,b);a.position.set(0,10,0);this.animation=e(this.animationParent,this.spline,this.id,this.duration);this.animationParent.add(this.object);this.animationParent.add(this.target);this.animationParent.add(a)}else{this.animation=e(this.animationParent,this.spline,this.id,this.duration);this.animationParent.add(this.target);this.animationParent.add(this.object)}if(this.createDebugPath){var a=
@@ -555,33 +554,33 @@ b.addSelf(c.object.up.clone().setLength(a.y));c.object.position.addSelf(b);c.tar
 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(o);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=j=c.getMouseProjectionOnBall(a.clientX,a.clientY);k=l=c.getMouseOnScreen(a.clientX,a.clientY);p=
 m=c.getMouseOnScreen(a.clientX,a.clientY);e=false}f!==-1&&(f===0&&!c.noRotate?j=c.getMouseProjectionOnBall(a.clientX,a.clientY):f===1&&!c.noZoom?l=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=j=c.getMouseProjectionOnBall(a.clientX,a.clientY):f===1&&!c.noZoom?k=l=c.getMouseOnScreen(a.clientX,
 a.clientY):this.noPan||(p=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 j(a,b,c,g,h,j,l,m){var n,o=d||1,p=e||1,r=h/2,q=j/2,t=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,u=p+1,y=h/o,H=j/p,W=new THREE.Vector3;W[n]=l>0?1:-1;for(h=0;h<u;h++)for(j=0;j<i;j++){var G=new THREE.Vector3;G[a]=(j*y-r)*c;G[b]=(h*H-q)*g;G[n]=l;k.vertices.push(new THREE.Vertex(G))}for(h=0;h<p;h++)for(j=0;j<
-o;j++){a=new THREE.Face4(j+i*h+t,j+i*(h+1)+t,j+1+i*(h+1)+t,j+1+i*h+t);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,l=a/2,p=b/2,m=c/2,o,r,n,q,u,t;if(g!==void 0){if(g instanceof Array)this.materials=g;else{this.materials=[];for(o=0;o<6;o++)this.materials.push(g)}o=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 y in h)this.sides[y]!==void 0&&(this.sides[y]=h[y]);this.sides.px&&j("z","y",-1,-1,c,b,l,o);this.sides.nx&&j("z","y",1,-1,c,b,-l,q);this.sides.py&&j("x","z",1,1,a,c,p,r);this.sides.ny&&j("x","z",1,-1,a,c,-p,u);this.sides.pz&&j("x","y",1,-1,a,b,m,n);this.sides.nz&&j("x","y",-1,-1,a,b,-m,t);this.computeCentroids();this.mergeVertices()};THREE.CubeGeometry.prototype=new THREE.Geometry;
+THREE.CubeGeometry=function(a,b,c,d,e,f,g,h){function j(a,b,c,g,h,j,l,m){var n,o=d||1,p=e||1,r=h/2,q=j/2,t=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,u=p+1,y=h/o,H=j/p,W=new THREE.Vector3;W[n]=l>0?1:-1;for(h=0;h<u;h++)for(j=0;j<i;j++){var G=new THREE.Vertex;G[a]=(j*y-r)*c;G[b]=(h*H-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+t,j+i*(h+1)+t,j+1+i*(h+1)+t,j+1+i*h+t);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,l=a/2,p=b/2,m=c/2,o,r,n,q,u,t;if(g!==void 0){if(g instanceof Array)this.materials=g;else{this.materials=[];for(o=0;o<6;o++)this.materials.push(g)}o=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 y in h)this.sides[y]!==void 0&&(this.sides[y]=h[y]);this.sides.px&&j("z","y",-1,-1,c,b,l,o);this.sides.nx&&j("z","y",1,-1,c,b,-l,q);this.sides.py&&j("x","z",1,1,a,c,p,r);this.sides.ny&&j("x","z",1,-1,a,c,-p,u);this.sides.pz&&j("x","y",1,-1,a,b,m,n);this.sides.nz&&j("x","y",-1,-1,a,b,-m,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,j,k=[],l=[];for(j=0;j<=e;j++){var p=[],m=[],o=j/e,r=o*(b-a)+a;for(h=0;h<=d;h++){var n=h/d,q=r*Math.sin(n*Math.PI*2),u=-o*c+g,t=r*Math.cos(n*Math.PI*2);this.vertices.push(new THREE.Vertex(new THREE.Vector3(q,u,t)));p.push(this.vertices.length-1);m.push(new THREE.UV(n,o))}k.push(p);l.push(m)}for(j=0;j<e;j++)for(h=0;h<d;h++){var c=k[j][h],p=k[j+1][h],
-m=k[j+1][h+1],o=k[j][h+1],r=this.vertices[c].position.clone().setY(0).normalize(),n=this.vertices[p].position.clone().setY(0).normalize(),q=this.vertices[m].position.clone().setY(0).normalize(),u=this.vertices[o].position.clone().setY(0).normalize(),t=l[j][h].clone(),y=l[j+1][h].clone(),s=l[j+1][h+1].clone(),x=l[j][h+1].clone();this.faces.push(new THREE.Face4(c,p,m,o,[r,n,q,u]));this.faceVertexUvs[0].push([t,y,s,x])}if(!f&&a>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,g,0)));for(h=
-0;h<d;h++){c=k[0][h];p=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=l[0][h].clone();y=l[0][h+1].clone();s=new THREE.UV(y.u,0);this.faces.push(new THREE.Face3(c,p,m,[r,n,q]));this.faceVertexUvs[0].push([t,y,s])}}if(!f&&b>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-g,0)));for(h=0;h<d;h++){c=k[j][h+1];p=k[j][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=l[j][h+1].clone();y=l[j][h].clone();s=new THREE.UV(y.u,1);this.faces.push(new THREE.Face3(c,p,m,[r,n,q]));this.faceVertexUvs[0].push([t,y,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.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,j,k=[],l=[];for(j=0;j<=e;j++){var p=[],m=[],o=j/e,r=o*(b-a)+a;for(h=0;h<=d;h++){var n=h/d,q=r*Math.sin(n*Math.PI*2),u=-o*c+g,t=r*Math.cos(n*Math.PI*2);this.vertices.push(new THREE.Vertex(q,u,t));p.push(this.vertices.length-1);m.push(new THREE.UV(n,o))}k.push(p);l.push(m)}for(j=0;j<e;j++)for(h=0;h<d;h++){var c=k[j][h],p=k[j+1][h],m=k[j+1][h+1],o=k[j][h+
+1],r=this.vertices[c].clone().setY(0).normalize(),n=this.vertices[p].clone().setY(0).normalize(),q=this.vertices[m].clone().setY(0).normalize(),u=this.vertices[o].clone().setY(0).normalize(),t=l[j][h].clone(),y=l[j+1][h].clone(),s=l[j+1][h+1].clone(),x=l[j][h+1].clone();this.faces.push(new THREE.Face4(c,p,m,o,[r,n,q,u]));this.faceVertexUvs[0].push([t,y,s,x])}if(!f&&a>0){this.vertices.push(new THREE.Vertex(0,g,0));for(h=0;h<d;h++){c=k[0][h];p=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=l[0][h].clone();y=l[0][h+1].clone();s=new THREE.UV(y.u,0);this.faces.push(new THREE.Face3(c,p,m,[r,n,q]));this.faceVertexUvs[0].push([t,y,s])}}if(!f&&b>0){this.vertices.push(new THREE.Vertex(0,-g,0));for(h=0;h<d;h++){c=k[j][h+1];p=k[j][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=l[j][h+1].clone();y=l[j][h].clone();s=new THREE.UV(y.u,1);this.faces.push(new THREE.Face3(c,
+p,m,[r,n,q]));this.faceVertexUvs[0].push([t,y,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+l*2,g=0;g<h;g++){var i=E*g,j=E*(g+1),k=d+e+i,i=d+f+i,n=d+f+j,j=d+e+j,o=c,p=g,r=h,k=k+K,i=i+K,n=n+K,j=j+K;C.faces.push(new THREE.Face4(k,i,n,j,null,null,t));k=R.generateSideWallUV(C,a,o,b,k,i,n,j,p,r);C.faceVertexUvs[0].push(k)}}}function f(a,b,c){C.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function g(c,d,e,f){c=c+K;d=d+K;e=e+K;C.faces.push(new THREE.Face3(c,d,e,null,null,u));c=f?R.generateBottomUV(C,a,b,c,d,e):R.generateTopUV(C,a,b,c,d,e);C.faceVertexUvs[0].push(c)}
-var h=b.amount!==void 0?b.amount:100,j=b.bevelThickness!==void 0?b.bevelThickness:6,k=b.bevelSize!==void 0?b.bevelSize:j-2,l=b.bevelSegments!==void 0?b.bevelSegments:3,p=b.bevelEnabled!==void 0?b.bevelEnabled:true,m=b.steps!==void 0?b.steps:1,o=b.bendPath,r=b.extrudePath,n,q=false,u=b.material,t=b.extrudeMaterial,y,s,x,D;if(r){n=r.getSpacedPoints(m);q=true;p=false;y=new THREE.TubeGeometry.FrenetFrames(r,m,false);s=new THREE.Vector3;x=new THREE.Vector3;D=new THREE.Vector3}if(!p)k=j=l=0;var B,w,v,C=
-this,K=this.vertices.length;o&&a.addWrapPath(o);var r=a.extractPoints(),o=r.shape,L=r.holes;if(r=!THREE.Shape.Utils.isClockWise(o)){o=o.reverse();w=0;for(v=L.length;w<v;w++){B=L[w];THREE.Shape.Utils.isClockWise(B)&&(L[w]=B.reverse())}r=false}var T=THREE.Shape.Utils.triangulateShape(o,L),P=o;w=0;for(v=L.length;w<v;w++){B=L[w];o=o.concat(B)}var J,N,F,i,U,E=o.length,H,W=T.length,r=[],G=0;F=P.length;J=F-1;for(N=G+1;G<F;G++,J++,N++){J===F&&(J=0);N===F&&(N=0);r[G]=d(P[G],P[J],P[N])}var ha=[],fa,la=r.concat();
+c.length-1);for(var g=0,h=m+l*2,g=0;g<h;g++){var i=E*g,j=E*(g+1),k=d+e+i,i=d+f+i,n=d+f+j,j=d+e+j,o=c,p=g,r=h,k=k+K,i=i+K,n=n+K,j=j+K;C.faces.push(new THREE.Face4(k,i,n,j,null,null,t));k=R.generateSideWallUV(C,a,o,b,k,i,n,j,p,r);C.faceVertexUvs[0].push(k)}}}function f(a,b,c){C.vertices.push(new THREE.Vertex(a,b,c))}function g(c,d,e,f){c=c+K;d=d+K;e=e+K;C.faces.push(new THREE.Face3(c,d,e,null,null,u));c=f?R.generateBottomUV(C,a,b,c,d,e):R.generateTopUV(C,a,b,c,d,e);C.faceVertexUvs[0].push(c)}var h=
+b.amount!==void 0?b.amount:100,j=b.bevelThickness!==void 0?b.bevelThickness:6,k=b.bevelSize!==void 0?b.bevelSize:j-2,l=b.bevelSegments!==void 0?b.bevelSegments:3,p=b.bevelEnabled!==void 0?b.bevelEnabled:true,m=b.steps!==void 0?b.steps:1,o=b.bendPath,r=b.extrudePath,n,q=false,u=b.material,t=b.extrudeMaterial,y,s,x,D;if(r){n=r.getSpacedPoints(m);q=true;p=false;y=new THREE.TubeGeometry.FrenetFrames(r,m,false);s=new THREE.Vector3;x=new THREE.Vector3;D=new THREE.Vector3}if(!p)k=j=l=0;var B,w,v,C=this,
+K=this.vertices.length;o&&a.addWrapPath(o);var r=a.extractPoints(),o=r.shape,L=r.holes;if(r=!THREE.Shape.Utils.isClockWise(o)){o=o.reverse();w=0;for(v=L.length;w<v;w++){B=L[w];THREE.Shape.Utils.isClockWise(B)&&(L[w]=B.reverse())}r=false}var T=THREE.Shape.Utils.triangulateShape(o,L),P=o;w=0;for(v=L.length;w<v;w++){B=L[w];o=o.concat(B)}var J,N,F,i,U,E=o.length,H,W=T.length,r=[],G=0;F=P.length;J=F-1;for(N=G+1;G<F;G++,J++,N++){J===F&&(J=0);N===F&&(N=0);r[G]=d(P[G],P[J],P[N])}var ha=[],fa,la=r.concat();
 w=0;for(v=L.length;w<v;w++){B=L[w];fa=[];G=0;F=B.length;J=F-1;for(N=G+1;G<F;G++,J++,N++){J===F&&(J=0);N===F&&(N=0);fa[G]=d(B[G],B[J],B[N])}ha.push(fa);la=la.concat(fa)}for(J=0;J<l;J++){F=J/l;i=j*(1-F);N=k*Math.sin(F*Math.PI/2);G=0;for(F=P.length;G<F;G++){U=c(P[G],r[G],N);f(U.x,U.y,-i)}w=0;for(v=L.length;w<v;w++){B=L[w];fa=ha[w];G=0;for(F=B.length;G<F;G++){U=c(B[G],fa[G],N);f(U.x,U.y,-i)}}}N=k;for(G=0;G<E;G++){U=p?c(o[G],la[G],N):o[G];if(q){x.copy(y.normals[0]).multiplyScalar(U.x);s.copy(y.binormals[0]).multiplyScalar(U.y);
 D.copy(n[0]).addSelf(x).addSelf(s);f(D.x,D.y,D.z)}else f(U.x,U.y,0)}for(F=1;F<=m;F++)for(G=0;G<E;G++){U=p?c(o[G],la[G],N):o[G];if(q){x.copy(y.normals[F]).multiplyScalar(U.x);s.copy(y.binormals[F]).multiplyScalar(U.y);D.copy(n[F]).addSelf(x).addSelf(s);f(D.x,D.y,D.z)}else f(U.x,U.y,h/m*F)}for(J=l-1;J>=0;J--){F=J/l;i=j*(1-F);N=k*Math.sin(F*Math.PI/2);G=0;for(F=P.length;G<F;G++){U=c(P[G],r[G],N);f(U.x,U.y,h+i)}w=0;for(v=L.length;w<v;w++){B=L[w];fa=ha[w];G=0;for(F=B.length;G<F;G++){U=c(B[G],fa[G],N);
 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(p){var a;a=E*0;for(G=0;G<W;G++){H=T[G];g(H[2]+a,H[1]+a,H[0]+a,true)}a=m+l*2;a=E*a;for(G=0;G<W;G++){H=T[G];g(H[0]+a,H[1]+a,H[2]+a,false)}}else{for(G=0;G<W;G++){H=T[G];g(H[2],H[1],H[0],true)}for(G=0;G<W;G++){H=T[G];g(H[0]+E*m,H[1]+E*m,H[2]+E*m,false)}}})();(function(){var a=0;e(P,a);a=a+P.length;w=0;for(v=L.length;w<v;w++){B=L[w];e(B,a);a=a+B.length}})()};
-THREE.ExtrudeGeometry.WorldUVGenerator={generateTopUV:function(a,b,c,d,e,f){b=a.vertices[e].position.x;e=a.vertices[e].position.y;c=a.vertices[f].position.x;f=a.vertices[f].position.y;return[new THREE.UV(a.vertices[d].position.x,1-a.vertices[d].position.y),new THREE.UV(b,1-e),new THREE.UV(c,1-f)]},generateBottomUV:function(a,b,c,d,e,f){return this.generateTopUV(a,b,c,d,e,f)},generateSideWallUV:function(a,b,c,d,e,f,g,h){var b=a.vertices[e].position.x,c=a.vertices[e].position.y,e=a.vertices[e].position.z,
-d=a.vertices[f].position.x,j=a.vertices[f].position.y,f=a.vertices[f].position.z,k=a.vertices[g].position.x,l=a.vertices[g].position.y,g=a.vertices[g].position.z,p=a.vertices[h].position.x,m=a.vertices[h].position.y,a=a.vertices[h].position.z;return Math.abs(c-j)<0.01?[new THREE.UV(b,e),new THREE.UV(d,f),new THREE.UV(k,g),new THREE.UV(p,a)]:[new THREE.UV(c,e),new THREE.UV(j,f),new THREE.UV(l,g),new THREE.UV(m,a)]}};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;THREE.ExtrudeGeometry.__v2=new THREE.Vector2;
-THREE.ExtrudeGeometry.__v3=new THREE.Vector2;THREE.ExtrudeGeometry.__v4=new THREE.Vector2;THREE.ExtrudeGeometry.__v5=new THREE.Vector2;THREE.ExtrudeGeometry.__v6=new THREE.Vector2;
-THREE.LatheGeometry=function(a,b,c){THREE.Geometry.call(this);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(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(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-
+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,j=a.vertices[f].y,f=a.vertices[f].z,k=a.vertices[g].x,l=
+a.vertices[g].y,g=a.vertices[g].z,p=a.vertices[h].x,m=a.vertices[h].y,a=a.vertices[h].z;return Math.abs(c-j)<0.01?[new THREE.UV(b,e),new THREE.UV(d,f),new THREE.UV(k,g),new THREE.UV(p,a)]:[new THREE.UV(c,e),new THREE.UV(j,f),new THREE.UV(l,g),new THREE.UV(m,a)]}};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;THREE.ExtrudeGeometry.__v2=new THREE.Vector2;THREE.ExtrudeGeometry.__v3=new THREE.Vector2;THREE.ExtrudeGeometry.__v4=new THREE.Vector2;THREE.ExtrudeGeometry.__v5=new THREE.Vector2;
+THREE.ExtrudeGeometry.__v6=new THREE.Vector2;
+THREE.LatheGeometry=function(a,b,c){THREE.Geometry.call(this);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,j=a/c,k=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.Vertex(new THREE.Vector3(b*j-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(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,j,k=[],l=[];for(j=0;j<=c;j++){var p=[],m=[];for(h=0;h<=b;h++){var o=h/b,r=j/c,n=-a*Math.cos(d+o*e)*Math.sin(f+r*g),q=a*Math.cos(f+r*g),u=a*Math.sin(d+o*e)*Math.sin(f+r*g);this.vertices.push(new THREE.Vertex(new THREE.Vector3(n,q,u)));p.push(this.vertices.length-1);m.push(new THREE.UV(o,
-r))}k.push(p);l.push(m)}for(j=0;j<c;j++)for(h=0;h<b;h++){var d=k[j][h+1],e=k[j][h],f=k[j+1][h],g=k[j+1][h+1],p=this.vertices[d].position.clone().normalize(),m=this.vertices[e].position.clone().normalize(),o=this.vertices[f].position.clone().normalize(),r=this.vertices[g].position.clone().normalize(),n=l[j][h+1].clone(),q=l[j][h].clone(),u=l[j+1][h].clone(),t=l[j+1][h+1].clone();if(Math.abs(this.vertices[d].position.y)==a){this.faces.push(new THREE.Face3(d,f,g,[p,o,r]));this.faceVertexUvs[0].push([n,
-u,t])}else if(Math.abs(this.vertices[f].position.y)==a){this.faces.push(new THREE.Face3(d,e,f,[p,m,o]));this.faceVertexUvs[0].push([n,q,u])}else{this.faces.push(new THREE.Face4(d,e,f,g,[p,m,o,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.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,j=a/c,k=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.Vertex(b*j-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(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,j,k=[],l=[];for(j=0;j<=c;j++){var p=[],m=[];for(h=0;h<=b;h++){var o=h/b,r=j/c,n=-a*Math.cos(d+o*e)*Math.sin(f+r*g),q=a*Math.cos(f+r*g),u=a*Math.sin(d+o*e)*Math.sin(f+r*g);this.vertices.push(new THREE.Vertex(n,q,u));p.push(this.vertices.length-1);m.push(new THREE.UV(o,r))}k.push(p);
+l.push(m)}for(j=0;j<c;j++)for(h=0;h<b;h++){var d=k[j][h+1],e=k[j][h],f=k[j+1][h],g=k[j+1][h+1],p=this.vertices[d].clone().normalize(),m=this.vertices[e].clone().normalize(),o=this.vertices[f].clone().normalize(),r=this.vertices[g].clone().normalize(),n=l[j][h+1].clone(),q=l[j][h].clone(),u=l[j+1][h].clone(),t=l[j+1][h+1].clone();if(Math.abs(this.vertices[d].y)==a){this.faces.push(new THREE.Face3(d,f,g,[p,o,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,[p,m,o]));this.faceVertexUvs[0].push([n,q,u])}else{this.faces.push(new THREE.Face4(d,e,f,g,[p,m,o,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.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=
@@ -591,46 +590,45 @@ n,j);t=THREE.Shape.Utils.b3(t,m,r,q,l);f.push(new THREE.Vector2(y,t))}}}}}return
 (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=[],j,k,l;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 p=2*e;for(k=e-1;e>2;){if(p--<=0){console.log("Warning, unable to triangulate polygon!");break}j=k;e<=j&&(j=0);k=j+1;e<=k&&(k=0);l=k+1;e<=l&&(l=0);var m;a:{m=a;var o=j,r=k,n=l,q=e,u=g,t=void 0,y=void 0,s=void 0,x=void 0,D=void 0,
 B=void 0,w=void 0,v=void 0,C=void 0,y=m[u[o]].x,s=m[u[o]].y,x=m[u[r]].x,D=m[u[r]].y,B=m[u[n]].x,w=m[u[n]].y;if(1.0E-10>(x-y)*(w-s)-(D-s)*(B-y))m=false;else{for(t=0;t<q;t++)if(!(t==o||t==r||t==n)){var v=m[u[t]].x,C=m[u[t]].y,K=void 0,L=void 0,T=void 0,P=void 0,J=void 0,N=void 0,F=void 0,i=void 0,U=void 0,E=void 0,H=void 0,W=void 0,K=T=J=void 0,K=B-x,L=w-D,T=y-B,P=s-w,J=x-y,N=D-s,F=v-y,i=C-s,U=v-x,E=C-D,H=v-B,W=C-w,K=K*E-L*U,J=J*i-N*F,T=T*W-P*H;if(K>=0&&T>=0&&J>=0){m=false;break a}}m=true}}if(m){f.push([a[g[j]],
 a[g[k]],a[g[l]]]);h.push([g[j],g[k],g[l]]);j=k;for(l=k+1;l<e;j++,l++)g[j]=g[l];e--;p=2*e}}return d?h:f};a.Triangulate.area=b;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
-THREE.TorusGeometry=function(a,b,c,d,e){THREE.Geometry.call(this);this.radius=a||100;this.tube=b||40;this.segmentsR=c||8;this.segmentsT=d||6;this.arc=e||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(new THREE.Vertex(h));a.push(new THREE.UV(d/this.segmentsT,1-c/this.segmentsR));b.push(h.clone().subSelf(e).normalize())}for(c=1;c<=this.segmentsR;c++)for(d=1;d<=this.segmentsT;d++){var e=(this.segmentsT+1)*c+d-1,f=(this.segmentsT+1)*(c-1)+d-1,g=(this.segmentsT+1)*(c-1)+d,h=(this.segmentsT+1)*c+d,j=new THREE.Face4(e,f,g,h,[b[e],b[f],b[g],b[h]]);j.normal.addSelf(b[e]);j.normal.addSelf(b[f]);j.normal.addSelf(b[g]);j.normal.addSelf(b[h]);j.normal.normalize();this.faces.push(j);
+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,j=new THREE.Face4(e,f,g,h,[b[e],b[f],b[g],b[h]]);j.normal.addSelf(b[e]);j.normal.addSelf(b[f]);j.normal.addSelf(b[g]);j.normal.addSelf(b[h]);j.normal.normalize();this.faces.push(j);
 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 j=a/this.segmentsR*2*this.p*Math.PI,g=b/this.segmentsT*2*Math.PI,f=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,f);d.add(j,f);e.cross(c,d);d.cross(e,c);e.normalize();d.normalize();j=-this.tube*Math.cos(g);g=this.tube*Math.sin(g);f.x=f.x+(j*d.x+g*e.x);f.y=f.y+(j*d.y+g*e.y);f.z=f.z+(j*d.z+g*e.z);this.grid[a][b]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(f.x,f.y,f.z)))-
-1}}for(a=0;a<this.segmentsR;++a)for(b=0;b<this.segmentsT;++b){var e=(a+1)%this.segmentsR,f=(b+1)%this.segmentsT,c=this.grid[a][b],d=this.grid[e][b],e=this.grid[e][f],f=this.grid[a][f],g=new THREE.UV(a/this.segmentsR,b/this.segmentsT),j=new THREE.UV((a+1)/this.segmentsR,b/this.segmentsT),k=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,j,k,l])}this.computeCentroids();
-this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusKnotGeometry.prototype=new THREE.Geometry;THREE.TorusKnotGeometry.prototype.constructor=THREE.TorusKnotGeometry;
+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,f=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,f);d.add(j,f);e.cross(c,d);d.cross(e,c);e.normalize();d.normalize();j=-this.tube*Math.cos(g);g=this.tube*Math.sin(g);f.x=f.x+(j*d.x+g*e.x);f.y=f.y+(j*d.y+g*e.y);f.z=f.z+(j*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),j=new THREE.UV((a+1)/this.segmentsR,b/this.segmentsT),k=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,j,k,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,j,k,l,p=new THREE.Vector3,m,o,r,b=new THREE.TubeGeometry.FrenetFrames(a,b,e);m=b.tangents;o=b.normals;r=b.binormals;this.tangents=m;this.normals=o;this.binormals=r;for(b=0;b<f;b++){this.grid[b]=[];d=b/(f-1);l=a.getPointAt(d);d=m[b];g=o[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++){j=d/this.segmentsRadius*2*Math.PI;k=-this.radius*Math.cos(j);j=this.radius*Math.sin(j);p.copy(l);p.x=p.x+(k*g.x+j*h.x);p.y=p.y+(k*g.y+j*h.y);p.z=p.z+(k*g.z+j*h.z);this.grid[b][d]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(p.x,p.y,p.z)))-1}}for(b=0;b<this.segments;b++)for(d=0;d<this.segmentsRadius;d++){f=e?(b+1)%this.segments:b+1;p=(d+1)%this.segmentsRadius;
+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++){j=d/this.segmentsRadius*2*Math.PI;k=-this.radius*Math.cos(j);j=this.radius*Math.sin(j);p.copy(l);p.x=p.x+(k*g.x+j*h.x);p.y=p.y+(k*g.y+j*h.y);p.z=p.z+(k*g.z+j*h.z);this.grid[b][d]=this.vertices.push(new THREE.Vertex(p.x,p.y,p.z))-1}}for(b=0;b<this.segments;b++)for(d=0;d<this.segmentsRadius;d++){f=e?(b+1)%this.segments:b+1;p=(d+1)%this.segmentsRadius;
 a=this.grid[b][d];c=this.grid[f][d];f=this.grid[f][p];p=this.grid[b][p];m=new THREE.UV(b/this.segments,d/this.segmentsRadius);o=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,p));this.faceVertexUvs[0].push([m,o,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,j=new THREE.Matrix4,b=b+1,k,l,p;this.tangents=e;this.normals=f;this.binormals=g;for(k=0;k<b;k++){l=k/(b-1);e[k]=a.getTangentAt(l);e[k].normalize()}f[0]=new THREE.Vector3;g[0]=new THREE.Vector3;a=Number.MAX_VALUE;k=Math.abs(e[0].x);l=Math.abs(e[0].y);p=Math.abs(e[0].z);if(k<=a){a=k;d.set(1,0,0)}if(l<=a){a=l;d.set(0,1,0)}p<=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]));j.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++){j.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(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 f(a,b,c,d){if(d<1){d=new THREE.Face3(a.index,b.index,c.index,[a.position.clone(),b.position.clone(),c.position.clone()]);d.centroid.addSelf(a.position).addSelf(b.position).addSelf(c.position).divideScalar(3);d.normal=d.centroid.clone().normalize();
-j.faces.push(d);d=Math.atan2(d.centroid.z,-d.centroid.x);j.faceVertexUvs[0].push([h(a.uv,a.position,d),h(b.uv,b.position,d),h(c.uv,c.position,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){p[a.index]||(p[a.index]=[]);p[b.index]||(p[b.index]=[]);var c=p[a.index][b.index];c===void 0&&(p[a.index][b.index]=p[b.index][a.index]=c=e((new THREE.Vector3).add(a.position,b.position).divideScalar(2)));return c}function h(a,b,c){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,k=0,l=a.length;k<l;k++)e(new THREE.Vector3(a[k][0],a[k][1],a[k][2]));for(var p=[],a=this.vertices,k=0,l=b.length;k<l;k++)f(a[b[k][0]],a[b[k][1]],a[b[k][2]],d);this.mergeVertices();k=0;for(l=this.vertices.length;k<l;k++)this.vertices[k].position.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 e(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 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();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;f(a,g(a,b),g(a,c),d);f(g(a,b),b,g(b,c),d);f(g(a,c),g(b,c),c,d);f(g(a,b),g(b,c),g(a,c),d)}}function g(a,b){p[a.index]||(p[a.index]=[]);p[b.index]||(p[b.index]=[]);var c=p[a.index][b.index];c===void 0&&(p[a.index][b.index]=p[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,j=this,k=0,l=a.length;k<l;k++)e(new THREE.Vector3(a[k][0],a[k][1],a[k][2]));for(var p=[],a=this.vertices,k=0,l=b.length;k<l;k++)f(a[b[k][0]],a[b[k][1]],a[b[k][2]],d);this.mergeVertices();k=0;for(l=this.vertices.length;k<l;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.IcosahedronGeometry=function(a,b){var c=(1+Math.sqrt(5))/2;THREE.PolyhedronGeometry.call(this,[[-1,c,0],[1,c,0],[-1,-c,0],[1,-c,0],[0,-1,c],[0,1,c],[0,-1,-c],[0,1,-c],[c,0,-1],[c,0,1],[-c,0,-1],[-c,0,1]],[[0,11,5],[0,5,1],[0,1,7],[0,7,10],[0,10,11],[1,5,9],[5,11,4],[11,10,2],[10,7,6],[7,1,8],[3,9,4],[3,4,2],[3,2,6],[3,6,8],[3,8,9],[4,9,5],[2,4,11],[6,2,10],[8,6,7],[9,8,1]],a,b)};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;
 THREE.OctahedronGeometry=function(a,b){THREE.PolyhedronGeometry.call(this,[[1,0,0],[-1,0,0],[0,1,0],[0,-1,0],[0,0,1],[0,0,-1]],[[0,2,4],[0,4,3],[0,3,5],[0,5,2],[1,2,5],[1,5,3],[1,3,4],[1,4,2]],a,b)};THREE.OctahedronGeometry.prototype=new THREE.Geometry;THREE.OctahedronGeometry.prototype.constructor=THREE.OctahedronGeometry;THREE.TetrahedronGeometry=function(a,b){THREE.PolyhedronGeometry.call(this,[[1,1,1],[-1,-1,1],[-1,1,-1],[1,-1,-1]],[[2,1,0],[0,3,2],[1,3,0],[2,3,1]],a,b)};
 THREE.TetrahedronGeometry.prototype=new THREE.Geometry;THREE.TetrahedronGeometry.prototype.constructor=THREE.TetrahedronGeometry;
-THREE.AxisHelper=function(){THREE.Object3D.call(this);var a=new THREE.Geometry;a.vertices.push(new THREE.Vertex);a.vertices.push(new THREE.Vertex(new THREE.Vector3(0,100,0)));var b=new THREE.CylinderGeometry(0,5,25,5,1),c;c=new THREE.Line(a,new THREE.LineBasicMaterial({color:16711680}));c.rotation.z=-Math.PI/2;this.add(c);c=new THREE.Mesh(b,new THREE.MeshBasicMaterial({color:16711680}));c.position.x=100;c.rotation.z=-Math.PI/2;this.add(c);c=new THREE.Line(a,new THREE.LineBasicMaterial({color:65280}));
-this.add(c);c=new THREE.Mesh(b,new THREE.MeshBasicMaterial({color:65280}));c.position.y=100;this.add(c);c=new THREE.Line(a,new THREE.LineBasicMaterial({color:255}));c.rotation.x=Math.PI/2;this.add(c);c=new THREE.Mesh(b,new THREE.MeshBasicMaterial({color:255}));c.position.z=100;c.rotation.x=Math.PI/2;this.add(c)};THREE.AxisHelper.prototype=new THREE.Object3D;THREE.AxisHelper.prototype.constructor=THREE.AxisHelper;
-THREE.ArrowHelper=function(a,b,c,d){THREE.Object3D.call(this);d===void 0&&(d=16776960);c===void 0&&(c=20);var e=new THREE.Geometry;e.vertices.push(new THREE.Vertex(new THREE.Vector3(0,0,0)));e.vertices.push(new THREE.Vertex(new THREE.Vector3(0,1,0)));this.line=new THREE.Line(e,new THREE.LineBasicMaterial({color:d}));this.add(this.line);e=new THREE.CylinderGeometry(0,0.05,0.25,5,1);this.cone=new THREE.Mesh(e,new THREE.MeshBasicMaterial({color:d}));this.cone.position.set(0,1,0);this.add(this.cone);
-if(b instanceof THREE.Vector3)this.position=b;this.setDirection(a);this.setLength(c)};THREE.ArrowHelper.prototype=new THREE.Object3D;THREE.ArrowHelper.prototype.constructor=THREE.ArrowHelper;THREE.ArrowHelper.prototype.setDirection=function(a){var b=(new THREE.Vector3(0,1,0)).crossSelf(a),a=Math.acos((new THREE.Vector3(0,1,0)).dot(a.clone().normalize()));this.matrix=(new THREE.Matrix4).makeRotationAxis(b.normalize(),a);this.rotation.getRotationFromMatrix(this.matrix,this.scale)};
+THREE.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=
+b;this.setDirection(a);this.setLength(c)};THREE.ArrowHelper.prototype=new THREE.Object3D;THREE.ArrowHelper.prototype.constructor=THREE.ArrowHelper;THREE.ArrowHelper.prototype.setDirection=function(a){var b=(new THREE.Vector3(0,1,0)).crossSelf(a),a=Math.acos((new THREE.Vector3(0,1,0)).dot(a.clone().normalize()));this.matrix=(new THREE.Matrix4).makeRotationAxis(b.normalize(),a);this.rotation.getRotationFromMatrix(this.matrix,this.scale)};
 THREE.ArrowHelper.prototype.setLength=function(a){this.scale.set(a,a,a)};THREE.ArrowHelper.prototype.setColor=function(a){this.line.material.color.setHex(a);this.cone.material.color.setHex(a)};
-THREE.CameraHelper=function(a){function b(a,b,d){c(a,d);c(b,d)}function c(a,b){d.lineGeometry.vertices.push(new THREE.Vertex(new THREE.Vector3));d.lineGeometry.colors.push(new THREE.Color(b));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]].position.copy(THREE.CameraHelper.__v)}}var b=this;THREE.CameraHelper.__c.projectionMatrix.copy(this.camera.projectionMatrix);a("c",0,0,-1);a("t",0,0,1);a("n1",-1,-1,-1);a("n2",1,-1,-1);a("n3",-1,1,-1);a("n4",1,1,-1);a("f1",
--1,-1,1);a("f2",1,-1,1);a("f3",-1,1,1);a("f4",1,1,1);a("u1",0.7,1.1,-1);a("u2",-0.7,1.1,-1);a("u3",0,2,-1);a("cf1",-1,0,1);a("cf2",1,0,1);a("cf3",0,-1,1);a("cf4",0,1,1);a("cn1",-1,0,-1);a("cn2",1,0,-1);a("cn3",0,-1,-1);a("cn4",0,1,-1);this.lineGeometry.__dirtyVertices=true};THREE.CameraHelper.__projector=new THREE.Projector;THREE.CameraHelper.__v=new THREE.Vector3;THREE.CameraHelper.__c=new THREE.Camera;
+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",
+"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 j=new THREE.Face4(a,c,d,e,null,g.color,g.material);if(m.useOldVertexColors){j.vertexColors=[];for(var k,n,o,r=0;r<4;r++){o=h[r];k=new THREE.Color;k.setRGB(0,0,0);for(var q=0;q<o.length;q++){n=g.vertexColors[o[q]-1];k.r=k.r+n.r;k.g=k.g+n.g;k.b=k.b+n.b}k.r=k.r/o.length;k.g=k.g/o.length;k.b=k.b/o.length;
 j.vertexColors[r]=k}}l.push(j);if(m.supportUVs){g=[f(a,""),f(c,i),f(d,i),f(e,i)];g[0]?g[1]?g[2]?g[3]?p.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>=y&&a<y+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 j(a,b,c){P[a]===void 0&&(P[a]={});P[a][b]=c}var k=[],l=[],p=[],m=this,o=a.vertices,r=a.faces,k=o.concat(),n=[],q={},u={},t={},y=o.length,s,x,D,B,w,v=a.faceVertexUvs[0],C;b("originalFaces, uvs, originalVerticesLength",r.length,v.length,y);if(m.supportUVs){s=0;for(x=v.length;s<x;s++){D=0;for(B=v[s].length;D<B;D++){C=r[s]["abcd".charAt(D)];g(C,s,v[s][D])}}}if(v.length==0)m.supportUVs=false;s=0;for(w in t)s++;if(!s){m.supportUVs=false;b("no uvs")}b("-- Original Faces + Vertices UVs completed",
-t,"vs",v.length);s=0;for(x=r.length;s<x;s++){w=r[s];n.push(w.centroid);k.push(new THREE.Vertex(w.centroid));if(m.supportUVs){v=new THREE.UV;if(w instanceof THREE.Face3){v.u=f(w.a,s).u+f(w.b,s).u+f(w.c,s).u;v.v=f(w.a,s).v+f(w.b,s).v+f(w.c,s).v;v.u=v.u/3;v.v=v.v/3}else if(w instanceof THREE.Face4){v.u=f(w.a,s).u+f(w.b,s).u+f(w.c,s).u+f(w.d,s).u;v.v=f(w.a,s).v+f(w.b,s).v+f(w.c,s).v+f(w.d,s).v;v.u=v.u/4;v.v=v.v/4}g(y+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);C=0;var K,L,T={},P={};for(s in x){v=x[s];K=s.split("_");L=K[0];K=K[1];h(L,[L,K]);h(K,[L,K]);D=0;for(B=v.length;D<B;D++){w=v[D];j(L,w,s);j(K,w,s)}v.length<2&&(u[s]=true)}b("vertexEdgeMap",T,"vertexFaceMap",
-P);for(s in x){v=x[s];w=v[0];B=v[1];K=s.split("_");L=K[0];K=K[1];v=new THREE.Vector3;if(u[s]){v.addSelf(o[L].position);v.addSelf(o[K].position);v.multiplyScalar(0.5)}else{v.addSelf(n[w]);v.addSelf(n[B]);v.addSelf(o[L].position);v.addSelf(o[K].position);v.multiplyScalar(0.25)}q[s]=y+r.length+C;k.push(new THREE.Vertex(v));C++;if(m.supportUVs){v=new THREE.UV;v.u=f(L,w).u+f(K,w).u;v.v=f(L,w).v+f(K,w).v;v.u=v.u/2;v.v=v.v/2;g(q[s],w,v);if(!u[s]){v=new THREE.UV;v.u=f(L,B).u+f(K,B).u;v.v=f(L,B).v+f(K,B).v;
-v.u=v.u/2;v.v=v.v/2;g(q[s],B,v)}}}b("-- Step 2 done");var J,N;B=["123","12","2","23"];K=["123","23","3","31"];var F=["123","31","1","12"],i=["1234","12","2","23"],U=["1234","23","3","34"],E=["1234","34","4","41"],H=["1234","41","1","12"];s=0;for(x=n.length;s<x;s++){w=r[s];v=y+s;if(w instanceof THREE.Face3){C=e(w.a,w.b);L=e(w.b,w.c);J=e(w.c,w.a);d(v,q[C],w.b,q[L],w,B,s);d(v,q[L],w.c,q[J],w,K,s);d(v,q[J],w.a,q[C],w,F,s)}else if(w instanceof THREE.Face4){C=e(w.a,w.b);L=e(w.b,w.c);J=e(w.c,w.d);N=e(w.d,
-w.a);d(v,q[C],w.b,q[L],w,i,s);d(v,q[L],w.c,q[J],w,U,s);d(v,q[J],w.d,q[N],w,E,s);d(v,q[N],w.a,q[C],w,H,s)}else b("face should be a face!",w)}q=new THREE.Vector3;w=new THREE.Vector3;s=0;for(x=o.length;s<x;s++)if(T[s]!==void 0){q.set(0,0,0);w.set(0,0,0);L=new THREE.Vector3(0,0,0);v=0;for(D in P[s]){q.addSelf(n[D]);v++}B=0;C=T[s].length;for(D=0;D<C;D++)u[e(T[s][D][0],T[s][D][1])]&&B++;if(B!=2){q.divideScalar(v);for(D=0;D<C;D++){v=T[s][D];v=o[v[0]].position.clone().addSelf(o[v[1]].position).divideScalar(2);
-w.addSelf(v)}w.divideScalar(C);L.addSelf(o[s].position);L.multiplyScalar(C-3);L.addSelf(q);L.addSelf(w.multiplyScalar(2));L.divideScalar(C);k[s].position=L}}a.vertices=k;a.faces=l;a.faceVertexUvs[0]=p;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(){}};
+t,"vs",v.length);s=0;for(x=r.length;s<x;s++){w=r[s];n.push(w.centroid);k.push((new THREE.Vertex).copy(w.centroid));if(m.supportUVs){v=new THREE.UV;if(w instanceof THREE.Face3){v.u=f(w.a,s).u+f(w.b,s).u+f(w.c,s).u;v.v=f(w.a,s).v+f(w.b,s).v+f(w.c,s).v;v.u=v.u/3;v.v=v.v/3}else if(w instanceof THREE.Face4){v.u=f(w.a,s).u+f(w.b,s).u+f(w.c,s).u+f(w.d,s).u;v.v=f(w.a,s).v+f(w.b,s).v+f(w.c,s).v+f(w.d,s).v;v.u=v.u/4;v.v=v.v/4}g(y+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);C=0;var K,L,T={},P={};for(s in x){v=x[s];K=s.split("_");L=K[0];K=K[1];h(L,[L,K]);h(K,[L,K]);D=0;for(B=v.length;D<B;D++){w=v[D];j(L,w,s);j(K,w,s)}v.length<2&&(u[s]=true)}b("vertexEdgeMap",T,
+"vertexFaceMap",P);for(s in x){v=x[s];w=v[0];B=v[1];K=s.split("_");L=K[0];K=K[1];v=new THREE.Vector3;if(u[s]){v.addSelf(o[L]);v.addSelf(o[K]);v.multiplyScalar(0.5)}else{v.addSelf(n[w]);v.addSelf(n[B]);v.addSelf(o[L]);v.addSelf(o[K]);v.multiplyScalar(0.25)}q[s]=y+r.length+C;k.push((new THREE.Vertex).copy(v));C++;if(m.supportUVs){v=new THREE.UV;v.u=f(L,w).u+f(K,w).u;v.v=f(L,w).v+f(K,w).v;v.u=v.u/2;v.v=v.v/2;g(q[s],w,v);if(!u[s]){v=new THREE.UV;v.u=f(L,B).u+f(K,B).u;v.v=f(L,B).v+f(K,B).v;v.u=v.u/2;v.v=
+v.v/2;g(q[s],B,v)}}}b("-- Step 2 done");var J,N;B=["123","12","2","23"];K=["123","23","3","31"];var F=["123","31","1","12"],i=["1234","12","2","23"],U=["1234","23","3","34"],E=["1234","34","4","41"],H=["1234","41","1","12"];s=0;for(x=n.length;s<x;s++){w=r[s];v=y+s;if(w instanceof THREE.Face3){C=e(w.a,w.b);L=e(w.b,w.c);J=e(w.c,w.a);d(v,q[C],w.b,q[L],w,B,s);d(v,q[L],w.c,q[J],w,K,s);d(v,q[J],w.a,q[C],w,F,s)}else if(w instanceof THREE.Face4){C=e(w.a,w.b);L=e(w.b,w.c);J=e(w.c,w.d);N=e(w.d,w.a);d(v,q[C],
+w.b,q[L],w,i,s);d(v,q[L],w.c,q[J],w,U,s);d(v,q[J],w.d,q[N],w,E,s);d(v,q[N],w.a,q[C],w,H,s)}else b("face should be a face!",w)}q=new THREE.Vector3;w=new THREE.Vector3;s=0;for(x=o.length;s<x;s++)if(T[s]!==void 0){q.set(0,0,0);w.set(0,0,0);L=new THREE.Vector3(0,0,0);v=0;for(D in P[s]){q.addSelf(n[D]);v++}B=0;C=T[s].length;for(D=0;D<C;D++)u[e(T[s][D][0],T[s][D][1])]&&B++;if(B!=2){q.divideScalar(v);for(D=0;D<C;D++){v=T[s][D];v=o[v[0]].clone().addSelf(o[v[1]]).divideScalar(2);w.addSelf(v)}w.divideScalar(C);
+L.addSelf(o[s]);L.multiplyScalar(C-3);L.addSelf(q);L.addSelf(w.multiplyScalar(2));L.divideScalar(C);k[s]=L}}a.vertices=k;a.faces=l;a.faceVertexUvs[0]=p;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=
@@ -648,9 +646,9 @@ 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
 P.faces.push(new THREE.Face3(e,f,g,null,null,h))}}function K(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];P.faces.push(new THREE.Face4(e,f,g,h,null,null,i))}}function L(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=N[k*3],o=N[k*3+1];k=N[k*3+2];var p=N[l*3],
 r=N[l*3+1];l=N[l*3+2];P.faces.push(new THREE.Face3(f,g,h,[new THREE.Vector3(N[j*3],N[j*3+1],N[j*3+2]),new THREE.Vector3(n,o,k),new THREE.Vector3(p,r,l)],null,i))}}function T(b,c,d,e){for(var f,g,h,i,j,k,l,m,n,c=new Uint32Array(a,c,4*b),d=new Uint32Array(a,d,4*b),o=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[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=N[l*3],r=N[l*3+1];l=N[l*3+2];var q=N[m*3],s=N[m*3+1];m=N[m*3+2];var t=N[n*3],u=N[n*3+1];n=N[n*3+2];P.faces.push(new THREE.Face4(f,
 g,h,i,[new THREE.Vector3(N[k*3],N[k*3+1],N[k*3+2]),new THREE.Vector3(p,r,l),new THREE.Vector3(q,s,m),new THREE.Vector3(t,u,n)],null,j))}}var P=this,J=0,N=[],F=[],i,U,E;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(P,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,J,12);c=D(a,J+12);D(a,J+13);D(a,J+14);D(a,J+15);e=D(a,J+16);j=D(a,J+17);k=D(a,J+18);l=D(a,J+19);p=B(a,J+20);m=B(a,J+20+4);o=B(a,J+20+8);b=B(a,J+20+12);r=
-B(a,J+20+16);n=B(a,J+20+20);q=B(a,J+20+24);u=B(a,J+20+28);t=B(a,J+20+32);y=B(a,J+20+36);s=B(a,J+20+40);J=J+c;c=e*3+l;E=e*4+l;i=b*c;U=r*(c+j*3);e=n*(c+k*3);l=q*(c+j*3+k*3);c=u*E;j=t*(E+j*4);k=y*(E+k*4);J=J+function(b){var b=new Float32Array(a,b,p*3),c,d,e,f;for(c=0;c<p;c++){d=b[c*3];e=b[c*3+1];f=b[c*3+2];P.vertices.push(new THREE.Vertex(new THREE.Vector3(d,e,f)))}return p*3*Float32Array.BYTES_PER_ELEMENT}(J);J=J+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];N.push(d/127,e/127,f/127)}}return m*3*Int8Array.BYTES_PER_ELEMENT}(J);J=J+x(m*3);J=J+function(b){if(o){var b=new Float32Array(a,b,o*2),c,d,e;for(c=0;c<o;c++){d=b[c*2];e=b[c*2+1];F.push(d,e)}}return o*2*Float32Array.BYTES_PER_ELEMENT}(J);i=J+i+x(b*2);U=i+U+x(r*2);e=U+e+x(n*2);l=e+l+x(q*2);c=l+c+x(u*2);j=c+j+x(t*2);k=j+k+x(y*2);(function(a){if(n){var b=a+n*Uint32Array.BYTES_PER_ELEMENT*3;C(n,a,b+n*Uint32Array.BYTES_PER_ELEMENT*3);w(n,b)}})(U);(function(a){if(q){var b=a+q*Uint32Array.BYTES_PER_ELEMENT*
-3,c=b+q*Uint32Array.BYTES_PER_ELEMENT*3;L(q,a,b,c+q*Uint32Array.BYTES_PER_ELEMENT*3);w(q,c)}})(e);(function(a){if(y){var b=a+y*Uint32Array.BYTES_PER_ELEMENT*4;K(y,a,b+y*Uint32Array.BYTES_PER_ELEMENT*4);v(y,b)}})(j);(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);v(s,c)}})(k);b&&C(b,J,J+b*Uint32Array.BYTES_PER_ELEMENT*3);(function(a){if(r){var b=a+r*Uint32Array.BYTES_PER_ELEMENT*3;L(r,a,b,b+r*Uint32Array.BYTES_PER_ELEMENT*
+B(a,J+20+16);n=B(a,J+20+20);q=B(a,J+20+24);u=B(a,J+20+28);t=B(a,J+20+32);y=B(a,J+20+36);s=B(a,J+20+40);J=J+c;c=e*3+l;E=e*4+l;i=b*c;U=r*(c+j*3);e=n*(c+k*3);l=q*(c+j*3+k*3);c=u*E;j=t*(E+j*4);k=y*(E+k*4);J=J+function(b){var b=new Float32Array(a,b,p*3),c,d,e,f;for(c=0;c<p;c++){d=b[c*3];e=b[c*3+1];f=b[c*3+2];P.vertices.push(new THREE.Vertex(d,e,f))}return p*3*Float32Array.BYTES_PER_ELEMENT}(J);J=J+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];N.push(d/
+127,e/127,f/127)}}return m*3*Int8Array.BYTES_PER_ELEMENT}(J);J=J+x(m*3);J=J+function(b){if(o){var b=new Float32Array(a,b,o*2),c,d,e;for(c=0;c<o;c++){d=b[c*2];e=b[c*2+1];F.push(d,e)}}return o*2*Float32Array.BYTES_PER_ELEMENT}(J);i=J+i+x(b*2);U=i+U+x(r*2);e=U+e+x(n*2);l=e+l+x(q*2);c=l+c+x(u*2);j=c+j+x(t*2);k=j+k+x(y*2);(function(a){if(n){var b=a+n*Uint32Array.BYTES_PER_ELEMENT*3;C(n,a,b+n*Uint32Array.BYTES_PER_ELEMENT*3);w(n,b)}})(U);(function(a){if(q){var b=a+q*Uint32Array.BYTES_PER_ELEMENT*3,c=b+
+q*Uint32Array.BYTES_PER_ELEMENT*3;L(q,a,b,c+q*Uint32Array.BYTES_PER_ELEMENT*3);w(q,c)}})(e);(function(a){if(y){var b=a+y*Uint32Array.BYTES_PER_ELEMENT*4;K(y,a,b+y*Uint32Array.BYTES_PER_ELEMENT*4);v(y,b)}})(j);(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);v(s,c)}})(k);b&&C(b,J,J+b*Uint32Array.BYTES_PER_ELEMENT*3);(function(a){if(r){var b=a+r*Uint32Array.BYTES_PER_ELEMENT*3;L(r,a,b,b+r*Uint32Array.BYTES_PER_ELEMENT*
 3)}})(i);u&&K(u,l,l+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||sa;if(e!==void 0){a=e.split("/");a.pop();ta=(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(!Ia.convertUpAxis||Xa===Ia.upAxis)ja=null;else switch(Xa){case "X":ja=Ia.upAxis===
 "Y"?"XtoY":"XtoZ";break;case "Y":ja=Ia.upAxis==="X"?"YtoX":"YtoZ";break;case "Z":ja=Ia.upAxis==="X"?"ZtoX":"ZtoY"}Ha=b("//dae:library_images/dae:image",g,"image");Ka=b("//dae:library_materials/dae:material",v,"material");db=b("//dae:library_effects/dae:effect",P,"effect");Ya=b("//dae:library_geometries/dae:geometry",q,"geometry");hb=b(".//dae:library_cameras/dae:camera",E,"camera");Wa=b("//dae:library_controllers/dae:controller",h,"controller");xa=b("//dae:library_animations/dae:animation",N,"animation");
@@ -658,80 +656,79 @@ Pa=b(".//dae:library_visual_scenes/dae:visual_scene",l,"visual_scene");ua=[];ab=
 animations:xa,visualScenes:Pa,scene:wa}};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=wa.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 xa)for(var i=xa[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=wa.getChildById(b.skeleton[0],true)||wa.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].position);for(c=0;c<e;c++){h=[];i=[];for(j=0;j<a.vertices.length;j++)i.push(new THREE.Vertex(new THREE.Vector3));d(b,h,c);j=h;k=f.skin;for(m=0;m<j.length;m++){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.position.x;g.y=n.position.y;g.z=n.position.z;h[j].skinningMatrix.multiplyVector3(g);m.position.x=m.position.x+g.x*l;m.position.y=m.position.y+g.y*l;m.position.z=m.position.z+g.z*l}a.morphTargets.push({name:"target_"+
-c,vertices:i})}}}function f(a){var b=new THREE.Object3D,c,d,g,h;for(g=0;g<a.controllers.length;g++){var i=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,p;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++){p=j[h];var r=Ka[p.target],q=db[r.instance_effect.url].shader;q.material.opacity=!q.material.opacity?1:q.material.opacity;
-k[p.symbol]=m;l.push(q.material);p=q.material;p.name=r.name==null||r.name===""?r.id:r.name;m++}j=p||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 o?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_"+ua.length;ua.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(Ia.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 j(){this.weights=this.targets=this.source=this.method=null}function k(){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 p(){this.sid=this.name=this.id="";this.nodes=[];this.controllers=[];this.transforms=[];this.geometries=[];this.channels=
-[];this.matrix=new THREE.Matrix4}function m(){this.type=this.sid="";this.data=[];this.obj=null}function o(){this.url="";this.skeleton=[];this.instance_material=[]}function r(){this.target=this.symbol=""}function n(){this.url="";this.instance_material=[]}function q(){this.id="";this.mesh=null}function 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 y(){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 D(){this.input={}}function B(){this.semantic="";this.offset=0;this.source="";this.set=0}function w(a){this.id=a;this.type=null}function v(){this.name=this.id="";this.instance_effect=null}function C(){this.color=new THREE.Color(0);this.color.setRGB(Math.random(),Math.random(),Math.random());this.color.a=1;this.texOpts=this.texcoord=this.texture=null}function K(a,b){this.type=
-a;this.effect=b;this.material=null}function L(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 P(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function J(){this.url=""}function N(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function F(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=this.dotSyntax=
-this.sid=this.fullSid=null}function 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 E(){this.technique=this.name=this.id=""}function H(){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(Ia.convertUpAxis&&Xa!==Ia.upAxis)switch(ja){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(Ia.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(Ia.convertUpAxis)switch(a){case "X":switch(ja){case "XtoY":case "XtoZ":case "YtoX":a="Y";break;case "ZtoX":a="Z"}break;case "Y":switch(ja){case "XtoY":case "YtoX":case "ZtoX":a="X";break;case "XtoZ":case "YtoZ":case "ZtoY":a="Z"}break;case "Z":switch(ja){case "XtoZ":a=
-"X";break;case "YtoZ":case "ZtoX":case "ZtoY":a="Y"}}return a}var ea=null,Na=null,wa,sa=null,Oa={},Ha={},xa={},Wa={},Ya={},Ka={},db={},hb={},mb,Pa,ta,ua,ab,pa=THREE.SmoothShading,Ia={centerGeometry:false,convertUpAxis:false,subdivideFaces:true,upAxis:"Y"},Xa="Y",ja=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 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 w).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 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 w).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)}};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 p).parse(c))}}return this};p.prototype.getChannelForTransform=function(a){for(var b=0;b<this.channels.length;b++){var c=this.channels[b],
-d=c.target.split("/");d.shift();var e=d.shift(),f=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};p.prototype.getChildById=function(a,b){if(this.id==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildById(a,b);if(d)return d}return null};p.prototype.getChildBySid=
-function(a,b){if(this.sid==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildBySid(a,b);if(d)return d}return null};p.prototype.getTransformBySid=function(a){for(var b=0;b<this.transforms.length;b++)if(this.transforms[b].sid==a)return this.transforms[b];return null};p.prototype.parse=function(a){var b;this.id=a.getAttribute("id");this.sid=a.getAttribute("sid");this.name=a.getAttribute("name");this.type=a.getAttribute("type");this.type=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 p).parse(b));break;case "instance_camera":this.cameras.push((new H).parse(b));break;case "instance_controller":this.controllers.push((new o).parse(b));break;case "instance_geometry":this.geometries.push((new n).parse(b));break;case "instance_light":break;
-case "instance_node":b=b.getAttribute("url").replace(/^#/,"");(b=ea.evaluate(".//dae:library_nodes//dae:node[@id='"+b+"']",ea,W,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new p).parse(b));break;case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new m).parse(b));break;case "extra":break;default:console.log(b.nodeName)}}a=[];c=1E6;b=-1E6;for(var d in xa)for(var e=xa[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=aa(["X","Y","Z"][s]);
-s={X:0,Y:1,Z:2}[s]}r[q]=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 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};p.prototype.updateMatrix=function(){this.matrix.identity();for(var a=0;a<this.transforms.length;a++)this.transforms[a].apply(this.matrix)};m.prototype.parse=function(a){this.sid=a.getAttribute("sid");this.type=a.nodeName;this.data=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;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}}};o.prototype.parse=function(a){this.url=
-a.getAttribute("url").replace(/^#/,"");this.skeleton=[];this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(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");Oa[d]==void 0&&(Oa[d]=(new w(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 y).parse(c))}}this.geometry3js=new THREE.Geometry;a=Oa[this.vertices.input.POSITION.source].data;for(b=0;b<a.length;b=b+3)this.geometry3js.vertices.push(new THREE.Vertex($(a,b)));for(b=0;b<this.primitives.length;b++){a=this.primitives[b];a.setVertices(this.vertices);this.handlePrimitive(a,this.geometry3js)}this.geometry3js.computeCentroids();this.geometry3js.computeFaceNormals();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=Oa[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($(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=Oa[g.source];i=j.accessor.params.length;g=0;for(h=q.length;g<h;g++)s.push($(j.data,q[g]*i))}else b.calcNormals=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&&Ia.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 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};y.prototype=new t;y.prototype.constructor=y;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};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};w.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "bool_array":for(var d=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 x).parse(c.childNodes[d]);break}}}return this};w.prototype.read=function(){var a=[],b=this.accessor.params[0];switch(b.type){case "IDREF":case "Name":case "name":case "float":return this.data;case "float4x4":for(b=0;b<this.data.length;b=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};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 J).parse(a.childNodes[b]);break}return this};C.prototype.isColor=function(){return this.texture==null};C.prototype.isTexture=function(){return this.texture!=null};C.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "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};C.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};K.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[c.nodeName]=
-(new C).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};K.prototype.create=function(){var a={},b=this.transparency!==void 0&&this.transparency<1,c;for(c in this)switch(c){case "ambient":case "emission":case "diffuse":case "specular":var d=
-this[c];if(d instanceof C)if(d.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid){var e=Ha[this.effect.surface.init_from];if(e){e=THREE.ImageUtils.loadTexture(ta+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};L.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};P.prototype.create=function(){if(this.shader==null)return null};P.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};P.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 L(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)}}};P.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);Ha[d.id]=d;break;case "extra":break;default:console.log(d.nodeName)}}return b};P.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 K(c.nodeName,this)).parse(c)}}};J.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");return this};N.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.source={};for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "animation":var c=(new N).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 w).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 F(this)).parse(c))}}return this};F.prototype.parse=function(a){this.source=a.getAttribute("source").replace(/^#/,"");this.target=a.getAttribute("target");var b=this.target.split("/");b.shift();var a=b.shift(),c=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=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];(!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)}};E.prototype.parse=function(a){this.id=a.getAttribute("id");
-this.name=a.getAttribute("name");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "optics":this.parseOptics(c)}}return this};E.prototype.parseOptics=function(a){for(var b=0;b<a.childNodes.length;b++)if(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};H.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){sa=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:e,geometries:Ya,options:Ia}};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)};
+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 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 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,p;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++){p=j[h];var r=Ka[p.target],q=db[r.instance_effect.url].shader;q.material.opacity=!q.material.opacity?1:q.material.opacity;k[p.symbol]=m;l.push(q.material);p=q.material;p.name=r.name==null||r.name===""?r.id:r.name;
+m++}j=p||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 o?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_"+ua.length;ua.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(Ia.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 j(){this.weights=this.targets=this.source=this.method=null}function k(){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 p(){this.sid=this.name=this.id="";this.nodes=[];this.controllers=[];this.transforms=[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function m(){this.type=this.sid="";this.data=[];this.obj=null}function o(){this.url=
+"";this.skeleton=[];this.instance_material=[]}function r(){this.target=this.symbol=""}function n(){this.url="";this.instance_material=[]}function q(){this.id="";this.mesh=null}function 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 y(){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 D(){this.input={}}function B(){this.semantic="";this.offset=0;this.source="";this.set=0}function w(a){this.id=a;this.type=null}function v(){this.name=this.id="";this.instance_effect=null}function C(){this.color=new THREE.Color(0);this.color.setRGB(Math.random(),Math.random(),Math.random());this.color.a=1;this.texOpts=this.texcoord=this.texture=null}function K(a,b){this.type=a;this.effect=b;this.material=null}function L(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 P(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function J(){this.url=""}function N(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function F(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=this.dotSyntax=this.sid=this.fullSid=null}function 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 E(){this.technique=this.name=this.id=""}function H(){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(Ia.convertUpAxis&&Xa!==Ia.upAxis)switch(ja){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(Ia.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(Ia.convertUpAxis)switch(a){case "X":switch(ja){case "XtoY":case "XtoZ":case "YtoX":a="Y";break;case "ZtoX":a="Z"}break;case "Y":switch(ja){case "XtoY":case "YtoX":case "ZtoX":a="X";break;case "XtoZ":case "YtoZ":case "ZtoY":a="Z"}break;case "Z":switch(ja){case "XtoZ":a="X";break;case "YtoZ":case "ZtoX":case "ZtoY":a="Y"}}return a}var ea=null,Na=null,wa,sa=null,Oa={},
+Ha={},xa={},Wa={},Ya={},Ka={},db={},hb={},mb,Pa,ta,ua,ab,pa=THREE.SmoothShading,Ia={centerGeometry:false,convertUpAxis:false,subdivideFaces:true,upAxis:"Y"},Xa="Y",ja=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 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 w).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 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 w).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)}};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 p).parse(c))}}return this};p.prototype.getChannelForTransform=function(a){for(var b=0;b<this.channels.length;b++){var c=this.channels[b],d=c.target.split("/");d.shift();var e=d.shift(),f=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};p.prototype.getChildById=function(a,b){if(this.id==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildById(a,b);if(d)return d}return null};p.prototype.getChildBySid=function(a,b){if(this.sid==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildBySid(a,b);if(d)return d}return null};p.prototype.getTransformBySid=
+function(a){for(var b=0;b<this.transforms.length;b++)if(this.transforms[b].sid==a)return this.transforms[b];return null};p.prototype.parse=function(a){var b;this.id=a.getAttribute("id");this.sid=a.getAttribute("sid");this.name=a.getAttribute("name");this.type=a.getAttribute("type");this.type=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 p).parse(b));break;case "instance_camera":this.cameras.push((new H).parse(b));break;case "instance_controller":this.controllers.push((new o).parse(b));break;case "instance_geometry":this.geometries.push((new n).parse(b));break;case "instance_light":break;case "instance_node":b=b.getAttribute("url").replace(/^#/,"");(b=ea.evaluate(".//dae:library_nodes//dae:node[@id='"+b+"']",ea,W,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&
+this.nodes.push((new p).parse(b));break;case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new m).parse(b));break;case "extra":break;default:console.log(b.nodeName)}}a=[];c=1E6;b=-1E6;for(var d in xa)for(var e=xa[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=aa(["X","Y","Z"][s]);s={X:0,Y:1,Z:2}[s]}r[q]=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 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};p.prototype.updateMatrix=function(){this.matrix.identity();for(var a=0;a<this.transforms.length;a++)this.transforms[a].apply(this.matrix)};m.prototype.parse=function(a){this.sid=a.getAttribute("sid");
+this.type=a.nodeName;this.data=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;
+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}}};o.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.skeleton=[];this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];
+if(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");Oa[d]==void 0&&(Oa[d]=(new w(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 y).parse(c))}}this.geometry3js=
+new THREE.Geometry;a=Oa[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,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=Oa[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($(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=Oa[g.source];i=j.accessor.params.length;g=0;for(h=q.length;g<h;g++)s.push($(j.data,q[g]*i))}else b.calcNormals=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&&Ia.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 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};y.prototype=new t;y.prototype.constructor=y;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};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};w.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=
+0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "bool_array":for(var d=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 x).parse(c.childNodes[d]);break}}}return this};w.prototype.read=function(){var a=[],b=this.accessor.params[0];switch(b.type){case "IDREF":case "Name":case "name":case "float":return this.data;case "float4x4":for(b=0;b<this.data.length;b=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};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 J).parse(a.childNodes[b]);break}return this};C.prototype.isColor=function(){return this.texture==null};C.prototype.isTexture=function(){return this.texture!=null};C.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "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};C.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};K.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[c.nodeName]=(new C).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};K.prototype.create=function(){var a={},b=this.transparency!==void 0&&this.transparency<1,c;for(c in this)switch(c){case "ambient":case "emission":case "diffuse":case "specular":var d=this[c];if(d instanceof C)if(d.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==
+this.effect.surface.sid){var e=Ha[this.effect.surface.init_from];if(e){e=THREE.ImageUtils.loadTexture(ta+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};L.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};P.prototype.create=function(){if(this.shader==null)return null};P.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};
+P.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 L(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)}}};P.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);Ha[d.id]=d;break;case "extra":break;default:console.log(d.nodeName)}}return b};P.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 K(c.nodeName,this)).parse(c)}}};J.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,
+"");return this};N.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.source={};for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "animation":var c=(new N).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 w).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 F(this)).parse(c))}}return this};F.prototype.parse=function(a){this.source=a.getAttribute("source").replace(/^#/,"");this.target=a.getAttribute("target");var b=this.target.split("/");b.shift();var a=b.shift(),c=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=
+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];
+(!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)}};E.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "optics":this.parseOptics(c)}}return this};E.prototype.parseOptics=function(a){for(var b=
+0;b<a.childNodes.length;b++)if(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};H.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){sa=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:e,geometries:Ya,options:Ia}};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,j,k,l,p,m,o,r,n,q,u,t,y,s=a.faces;p=a.vertices;var x=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(l=p.length;k<l;){m=new THREE.Vertex;m.position.x=p[k++]*b;m.position.y=p[k++]*b;m.position.z=p[k++]*b;d.vertices.push(m)}k=0;for(l=s.length;k<l;){b=
-s[k++];p=b&1;j=b&2;c=b&4;e=b&8;o=b&16;m=b&32;n=b&64;b=b&128;if(p){q=new THREE.Face4;q.a=s[k++];q.b=s[k++];q.c=s[k++];q.d=s[k++];p=4}else{q=new THREE.Face3;q.a=s[k++];q.b=s[k++];q.c=s[k++];p=3}if(j){j=s[k++];q.materialIndex=j}j=d.faces.length;if(c)for(c=0;c<B;c++){u=a.uvs[c];r=s[k++];y=u[r*2];r=u[r*2+1];d.faceUvs[c][j]=new THREE.UV(y,r)}if(e)for(c=0;c<B;c++){u=a.uvs[c];t=[];for(e=0;e<p;e++){r=s[k++];y=u[r*2];r=u[r*2+1];t[e]=new THREE.UV(y,r)}d.faceVertexUvs[c][j]=t}if(o){o=s[k++]*3;e=new THREE.Vector3;
-e.x=x[o++];e.y=x[o++];e.z=x[o];q.normal=e}if(m)for(c=0;c<p;c++){o=s[k++]*3;e=new THREE.Vector3;e.x=x[o++];e.y=x[o++];e.z=x[o];q.vertexNormals.push(e)}if(n){m=s[k++];m=new THREE.Color(D[m]);q.color=m}if(b)for(c=0;c<p;c++){m=s[k++];m=new THREE.Color(D[m]);q.vertexColors.push(m)}d.faces.push(q)}})(e);(function(){var b,c,e,j;if(a.skinWeights){b=0;for(c=a.skinWeights.length;b<c;b=b+2){e=a.skinWeights[b];j=a.skinWeights[b+1];d.skinWeights.push(new THREE.Vector4(e,j,0,0))}}if(a.skinIndices){b=0;for(c=a.skinIndices.length;b<
-c;b=b+2){e=a.skinIndices[b];j=a.skinIndices[b+1];d.skinIndices.push(new THREE.Vector4(e,j,0,0))}}d.bones=a.bones;d.animation=a.animation})();(function(b){if(a.morphTargets!==void 0){var c,e,j,k,l,p,m,o,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=[];o=d.morphTargets[c].vertices;r=a.morphTargets[c].vertices;j=0;for(k=r.length;j<k;j=j+3){l=r[j]*b;p=r[j+1]*b;m=r[j+2]*b;o.push(new THREE.Vertex(new THREE.Vector3(l,
-p,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;l=a.morphColors[c].colors;b=0;for(j=l.length;b<j;b=b+3){p=new THREE.Color(16755200);p.setRGB(l[b],l[b+1],l[b+2]);k.push(p)}}}})(e);d.computeCentroids();d.computeFaceNormals();this.hasNormals(d)&&d.computeTangents();b(d)};
+THREE.JSONLoader.prototype.createModel=function(a,b,c){var d=new THREE.Geometry,e=a.scale!==void 0?1/a.scale:1;this.initMaterials(d,a.materials,c);(function(b){var c,e,j,k,l,p,m,o,r,n,q,u,t,y,s=a.faces;p=a.vertices;var x=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(l=p.length;k<l;){m=new THREE.Vertex;m.x=p[k++]*b;m.y=p[k++]*b;m.z=p[k++]*b;d.vertices.push(m)}k=0;for(l=s.length;k<l;){b=s[k++];p=b&1;j=b&2;c=b&
+4;e=b&8;o=b&16;m=b&32;n=b&64;b=b&128;if(p){q=new THREE.Face4;q.a=s[k++];q.b=s[k++];q.c=s[k++];q.d=s[k++];p=4}else{q=new THREE.Face3;q.a=s[k++];q.b=s[k++];q.c=s[k++];p=3}if(j){j=s[k++];q.materialIndex=j}j=d.faces.length;if(c)for(c=0;c<B;c++){u=a.uvs[c];r=s[k++];y=u[r*2];r=u[r*2+1];d.faceUvs[c][j]=new THREE.UV(y,r)}if(e)for(c=0;c<B;c++){u=a.uvs[c];t=[];for(e=0;e<p;e++){r=s[k++];y=u[r*2];r=u[r*2+1];t[e]=new THREE.UV(y,r)}d.faceVertexUvs[c][j]=t}if(o){o=s[k++]*3;e=new THREE.Vector3;e.x=x[o++];e.y=x[o++];
+e.z=x[o];q.normal=e}if(m)for(c=0;c<p;c++){o=s[k++]*3;e=new THREE.Vector3;e.x=x[o++];e.y=x[o++];e.z=x[o];q.vertexNormals.push(e)}if(n){m=s[k++];m=new THREE.Color(D[m]);q.color=m}if(b)for(c=0;c<p;c++){m=s[k++];m=new THREE.Color(D[m]);q.vertexColors.push(m)}d.faces.push(q)}})(e);(function(){var b,c,e,j;if(a.skinWeights){b=0;for(c=a.skinWeights.length;b<c;b=b+2){e=a.skinWeights[b];j=a.skinWeights[b+1];d.skinWeights.push(new THREE.Vector4(e,j,0,0))}}if(a.skinIndices){b=0;for(c=a.skinIndices.length;b<c;b=
+b+2){e=a.skinIndices[b];j=a.skinIndices[b+1];d.skinIndices.push(new THREE.Vector4(e,j,0,0))}}d.bones=a.bones;d.animation=a.animation})();(function(b){if(a.morphTargets!==void 0){var c,e,j,k,l,p,m,o,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=[];o=d.morphTargets[c].vertices;r=a.morphTargets[c].vertices;j=0;for(k=r.length;j<k;j=j+3){l=r[j]*b;p=r[j+1]*b;m=r[j+2]*b;o.push(new THREE.Vertex(l,p,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;l=a.morphColors[c].colors;b=0;for(j=l.length;b<j;b=b+3){p=new THREE.Color(16755200);p.setRGB(l[b],l[b+1],l[b+2]);k.push(p)}}}})(e);d.computeCentroids();d.computeFaceNormals();this.hasNormals(d)&&d.computeTangents();b(d)};
 THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};THREE.SceneLoader.prototype.constructor=THREE.SceneLoader;
 THREE.SceneLoader.prototype.load=function(a,b){var c=this,d=new XMLHttpRequest;d.onreadystatechange=function(){if(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 P.objects)if(!E.objects[m]){u=P.objects[m];if(u.geometry!==void 0){if(C=E.geometries[u.geometry]){a=false;K=E.materials[u.materials[0]];(a=K instanceof THREE.ShaderMaterial)&&C.computeTangents();s=u.position;x=u.rotation;D=u.quaternion;B=u.scale;D=0;u.materials.length==0&&(K=new THREE.MeshFaceMaterial);u.materials.length>1&&(K=new THREE.MeshFaceMaterial);a=new THREE.Mesh(C,
@@ -750,9 +747,9 @@ n=q.parameters.color;T=q.parameters.specular;c=q.parameters.ambient;J=q.paramete
 true}l.uDiffuseColor.value.setHex(n);l.uSpecularColor.value.setHex(T);l.uAmbientColor.value.setHex(c);l.uShininess.value=J;if(q.parameters.opacity)l.uOpacity.value=q.parameters.opacity;K=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:l,lights:true,fog:true})}else K=new THREE[q.type](q.parameters);E.materials[p]=K}e();j.callbackSync(E);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=[],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.Vertex(new THREE.Vector3(k,l,q)))}})(g[0],8,0);(function(a,b,c){for(var d,e,f=a.length;c<f;c=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;k.push(d,e,f)}})(g[0],8,5);(function(a){var c,d,e,f,g,j,t,y,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;y=d;s=e;j=f;var D=k[e*3],B=k[e*3+1],w=k[e*3+2],v=k[f*3],C=k[f*3+1],K=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,w);v=new THREE.Vector3(v,C,K);g.faces.push(new THREE.Face3(y,s,j,[t,D,v],null,0));g=l[d*2];d=l[d*2+1];j=l[e*
-2];t=l[e*2+1];y=l[f*2];s=l[f*2+1];f=b.faceVertexUvs[0];e=j;j=t;t=[];t.push(new THREE.UV(g,d));t.push(new THREE.UV(e,j));t.push(new THREE.UV(y,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),k=[],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.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;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;k.push(d,e,f)}})(g[0],8,5);(function(a){var c,d,e,f,g,j,t,y,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;y=d;s=e;j=f;var D=k[e*3],B=k[e*3+1],w=k[e*3+2],v=k[f*3],C=k[f*3+1],K=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,w);v=new THREE.Vector3(v,C,K);g.faces.push(new THREE.Face3(y,s,j,[t,D,v],null,0));g=l[d*2];d=l[d*2+1];j=l[e*2];t=l[e*2+1];y=
+l[f*2];s=l[f*2+1];f=b.faceVertexUvs[0];e=j;j=t;t=[];t.push(new THREE.UV(g,d));t.push(new THREE.UV(e,j));t.push(new THREE.UV(y,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}};

+ 26 - 26
build/custom/ThreeCanvas.js

@@ -8,7 +8,7 @@ Math.floor(a);this.r=(a>>16&255)/255;this.g=(a>>8&255)/255;this.b=(a&255)/255;re
 THREE.Vector2=function(a,b){this.x=a||0;this.y=b||0};
 THREE.Vector2.prototype={constructor:THREE.Vector2,set:function(a,b){this.x=a;this.y=b;return this},copy:function(a){this.x=a.x;this.y=a.y;return this},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;return this},addSelf:function(a){this.x=this.x+a.x;this.y=this.y+a.y;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;return this},subSelf:function(a){this.x=this.x-a.x;this.y=this.y-a.y;return this},multiplyScalar:function(a){this.x=this.x*a;this.y=this.y*a;return this},divideScalar:function(a){if(a){this.x=
 this.x/a;this.y=this.y/a}else this.set(0,0);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.lengthSq())},normalize:function(){return this.divideScalar(this.length())},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var b=this.x-a.x,a=this.y-a.y;return b*b+a*a},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;return this},equals:function(a){return a.x===this.x&&a.y===this.y},isZero:function(){return this.lengthSq()<1.0E-4},clone:function(){return new THREE.Vector2(this.x,this.y)}};THREE.Vector3=function(a,b,c){this.x=a||0;this.y=b||0;this.z=c||0};
+lerpSelf:function(a,b){this.x=this.x+(a.x-this.x)*b;this.y=this.y+(a.y-this.y)*b;return this},equals:function(a){return a.x===this.x&&a.y===this.y},isZero:function(){return this.lengthSq()<1.0E-4},clone:function(){return new THREE.Vector2(this.x,this.y)}};THREE.Vector3=function(a,b,c){a instanceof THREE.Vector3&&console.warn("OPS!");this.x=a||0;this.y=b||0;this.z=c||0};
 THREE.Vector3.prototype={constructor:THREE.Vector3,set:function(a,b,c){this.x=a;this.y=b;this.z=c;return this},setX:function(a){this.x=a;return this},setY:function(a){this.y=a;return this},setZ:function(a){this.z=a;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;return this},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;return this},addSelf:function(a){this.x=this.x+a.x;this.y=this.y+a.y;this.z=this.z+a.z;return this},addScalar:function(a){this.x=this.x+a;this.y=this.y+
 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())},
@@ -23,8 +23,8 @@ THREE.Frustum.prototype.contains=function(a){for(var b=this.planes,c=a.matrixWor
 THREE.Ray=function(a,b){function c(a,b,c){p.sub(c,a);H=p.dot(b);D=k.add(a,u.copy(b).multiplyScalar(H));return L=c.distanceTo(D)}function d(a,b,c,d){p.sub(d,b);k.sub(c,b);u.sub(a,b);G=p.dot(p);t=p.dot(k);E=p.dot(u);A=k.dot(k);F=k.dot(u);r=1/(G*A-t*t);v=(A*E-t*F)*r;y=(G*F-t*E)*r;return v>=0&&y>=0&&v+y<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,i=new THREE.Vector3,j=new THREE.Vector3,
 h=new THREE.Vector3,l=new THREE.Vector3,o=new THREE.Vector3,m=new THREE.Vector3,n=new THREE.Vector3;this.intersectObject=function(a){var b,k=[];if(a instanceof THREE.Particle){var p=c(this.origin,this.direction,a.matrixWorld.getPosition());if(p>a.scale.x)return[];b={distance:p,point:a.position,face:null,object:a};k.push(b)}else if(a instanceof THREE.Mesh){var p=c(this.origin,this.direction,a.matrixWorld.getPosition()),I=THREE.Frustum.__v1.set(a.matrixWorld.getColumnX().length(),a.matrixWorld.getColumnY().length(),
 a.matrixWorld.getColumnZ().length());if(p>a.geometry.boundingSphere.radius*Math.max(I.x,Math.max(I.y,I.z)))return k;var r,u,v=a.geometry,C=v.vertices,t;a.matrixRotationWorld.extractRotation(a.matrixWorld);p=0;for(I=v.faces.length;p<I;p++){b=v.faces[p];h.copy(this.origin);l.copy(this.direction);t=a.matrixWorld;o=t.multiplyVector3(o.copy(b.centroid)).subSelf(h);m=a.matrixRotationWorld.multiplyVector3(m.copy(b.normal));r=l.dot(m);if(!(Math.abs(r)<e)){u=m.dot(o)/r;if(!(u<0)&&(a.doubleSided||(a.flipSided?
-r>0:r<0))){n.add(h,l.multiplyScalar(u));if(b instanceof THREE.Face3){f=t.multiplyVector3(f.copy(C[b.a].position));g=t.multiplyVector3(g.copy(C[b.b].position));i=t.multiplyVector3(i.copy(C[b.c].position));if(d(n,f,g,i)){b={distance:h.distanceTo(n),point:n.clone(),face:b,object:a};k.push(b)}}else if(b instanceof THREE.Face4){f=t.multiplyVector3(f.copy(C[b.a].position));g=t.multiplyVector3(g.copy(C[b.b].position));i=t.multiplyVector3(i.copy(C[b.c].position));j=t.multiplyVector3(j.copy(C[b.d].position));
-if(d(n,f,g,j)||d(n,g,i,j)){b={distance:h.distanceTo(n),point:n.clone(),face:b,object:a};k.push(b)}}}}}}return k};this.intersectObjects=function(a){for(var b=[],c=0,d=a.length;c<d;c++)Array.prototype.push.apply(b,this.intersectObject(a[c]));b.sort(function(a,b){return a.distance-b.distance});return b};var p=new THREE.Vector3,k=new THREE.Vector3,u=new THREE.Vector3,H,D,L,G,t,E,A,F,r,v,y};
+r>0:r<0))){n.add(h,l.multiplyScalar(u));if(b instanceof THREE.Face3){f=t.multiplyVector3(f.copy(C[b.a]));g=t.multiplyVector3(g.copy(C[b.b]));i=t.multiplyVector3(i.copy(C[b.c]));if(d(n,f,g,i)){b={distance:h.distanceTo(n),point:n.clone(),face:b,object:a};k.push(b)}}else if(b instanceof THREE.Face4){f=t.multiplyVector3(f.copy(C[b.a]));g=t.multiplyVector3(g.copy(C[b.b]));i=t.multiplyVector3(i.copy(C[b.c]));j=t.multiplyVector3(j.copy(C[b.d]));if(d(n,f,g,j)||d(n,g,i,j)){b={distance:h.distanceTo(n),point:n.clone(),
+face:b,object:a};k.push(b)}}}}}}return k};this.intersectObjects=function(a){for(var b=[],c=0,d=a.length;c<d;c++)Array.prototype.push.apply(b,this.intersectObject(a[c]));b.sort(function(a,b){return a.distance-b.distance});return b};var p=new THREE.Vector3,k=new THREE.Vector3,u=new THREE.Vector3,H,D,L,G,t,E,A,F,r,v,y};
 THREE.Rectangle=function(){function a(){f=d-b;g=e-c}var b,c,d,e,f,g,i=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,h,g,o){i=false;b=f;c=h;d=g;e=o;a()};this.addPoint=function(f,h){if(i){i=false;b=f;c=h;d=f;e=h}else{b=b<f?b:f;c=c<h?c:h;d=d>f?d:f;e=e>h?
 e:h}a()};this.add3Points=function(f,h,g,o,m,n){if(i){i=false;b=f<g?f<m?f:m:g<m?g:m;c=h<o?h<n?h:n:o<n?o:n;d=f>g?f>m?f:m:g>m?g:m;e=h>o?h>n?h:n:o>n?o:n}else{b=f<g?f<m?f<b?f:b:m<b?m:b:g<m?g<b?g:b:m<b?m:b;c=h<o?h<n?h<c?h:c:n<c?n:c:o<n?o<c?o:c:n<c?n:c;d=f>g?f>m?f>d?f:d:m>d?m:d:g>m?g>d?g:d:m>d?m:d;e=h>o?h>n?h>e?h:e:n>e?n:e:o>n?o>e?o:e:n>e?n:e}a()};this.addRectangle=function(f){if(i){i=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(){i=true;e=d=c=b=0;a()};this.isEmpty=function(){return i}};
@@ -68,39 +68,39 @@ d);return true}var e,f,g=[],i,j,h=[],l,o,m=[],n,p=[],k,u,H=[],D,L,G=[],t={object
 F.multiply(b.matrixWorld,b.projectionMatrixInverse);F.multiplyVector3(a);return a};this.pickingRay=function(a,b){var c;a.z=-1;c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.subSelf(a).normalize();return new THREE.Ray(a,c)};this.projectGraph=function(b,d){f=0;t.objects.length=0;t.sprites.length=0;t.lights.length=0;var g=function(b){if(b.visible!==false){if((b instanceof THREE.Mesh||b instanceof THREE.Line)&&(b.frustumCulled===false||v.contains(b))){E.copy(b.matrixWorld.getPosition());
 F.multiplyVector3(E);e=a();e.object=b;e.z=E.z;t.objects.push(e)}else if(b instanceof THREE.Sprite||b instanceof THREE.Particle){E.copy(b.matrixWorld.getPosition());F.multiplyVector3(E);e=a();e.object=b;e.z=E.z;t.sprites.push(e)}else b instanceof THREE.Light&&t.lights.push(b);for(var c=0,d=b.children.length;c<d;c++)g(b.children[c])}};g(b);d&&t.objects.sort(c);return t};this.projectScene=function(a,e,f){var g=e.near,E=e.far,Q=false,U,C,J,R,B,P,N,V,s,x,w,z,M,la,fa;L=u=n=o=0;t.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);F.multiply(e.projectionMatrix,e.matrixWorldInverse);v.setFromMatrix(F);t=this.projectGraph(a,false);a=0;for(U=t.objects.length;a<U;a++){s=t.objects[a].object;x=s.matrixWorld;j=0;if(s instanceof THREE.Mesh){w=s.geometry;z=s.geometry.materials;R=w.vertices;M=w.faces;la=w.faceVertexUvs;w=s.matrixRotationWorld.extractRotation(x);C=0;for(J=
-R.length;C<J;C++){i=b();i.positionWorld.copy(R[C].position);x.multiplyVector3(i.positionWorld);i.positionScreen.copy(i.positionWorld);F.multiplyVector4(i.positionScreen);i.positionScreen.x=i.positionScreen.x/i.positionScreen.w;i.positionScreen.y=i.positionScreen.y/i.positionScreen.w;i.visible=i.positionScreen.z>g&&i.positionScreen.z<E}R=0;for(C=M.length;R<C;R++){J=M[R];if(J instanceof THREE.Face3){B=h[J.a];P=h[J.b];N=h[J.c];if(B.visible&&P.visible&&N.visible){Q=(N.positionScreen.x-B.positionScreen.x)*
-(P.positionScreen.y-B.positionScreen.y)-(N.positionScreen.y-B.positionScreen.y)*(P.positionScreen.x-B.positionScreen.x)<0;if(s.doubleSided||Q!=s.flipSided){V=m[o]=m[o]||new THREE.RenderableFace3;o++;l=V;l.v1.copy(B);l.v2.copy(P);l.v3.copy(N)}else continue}else continue}else if(J instanceof THREE.Face4){B=h[J.a];P=h[J.b];N=h[J.c];V=h[J.d];if(B.visible&&P.visible&&N.visible&&V.visible){Q=(V.positionScreen.x-B.positionScreen.x)*(P.positionScreen.y-B.positionScreen.y)-(V.positionScreen.y-B.positionScreen.y)*
-(P.positionScreen.x-B.positionScreen.x)<0||(P.positionScreen.x-N.positionScreen.x)*(V.positionScreen.y-N.positionScreen.y)-(P.positionScreen.y-N.positionScreen.y)*(V.positionScreen.x-N.positionScreen.x)<0;if(s.doubleSided||Q!=s.flipSided){fa=p[n]=p[n]||new THREE.RenderableFace4;n++;l=fa;l.v1.copy(B);l.v2.copy(P);l.v3.copy(N);l.v4.copy(V)}else continue}else continue}l.normalWorld.copy(J.normal);!Q&&(s.flipSided||s.doubleSided)&&l.normalWorld.negate();w.multiplyVector3(l.normalWorld);l.centroidWorld.copy(J.centroid);
-x.multiplyVector3(l.centroidWorld);l.centroidScreen.copy(l.centroidWorld);F.multiplyVector3(l.centroidScreen);N=J.vertexNormals;B=0;for(P=N.length;B<P;B++){V=l.vertexNormalsWorld[B];V.copy(N[B]);!Q&&(s.flipSided||s.doubleSided)&&V.negate();w.multiplyVector3(V)}B=0;for(P=la.length;B<P;B++)if(fa=la[B][R]){N=0;for(V=fa.length;N<V;N++)l.uvs[B][N]=fa[N]}l.material=s.material;l.faceMaterial=J.materialIndex!==null?z[J.materialIndex]:null;l.z=l.centroidScreen.z;t.elements.push(l)}}else if(s instanceof THREE.Line){r.multiply(F,
-x);R=s.geometry.vertices;B=b();B.positionScreen.copy(R[0].position);r.multiplyVector4(B.positionScreen);x=s.type===THREE.LinePieces?2:1;C=1;for(J=R.length;C<J;C++){B=b();B.positionScreen.copy(R[C].position);r.multiplyVector4(B.positionScreen);if(!((C+1)%x>0)){P=h[j-2];y.copy(B.positionScreen);K.copy(P.positionScreen);if(d(y,K)){y.multiplyScalar(1/y.w);K.multiplyScalar(1/K.w);z=H[u]=H[u]||new THREE.RenderableLine;u++;k=z;k.v1.positionScreen.copy(y);k.v2.positionScreen.copy(K);k.z=Math.max(y.z,K.z);
-k.material=s.material;t.elements.push(k)}}}}}a=0;for(U=t.sprites.length;a<U;a++){s=t.sprites[a].object;x=s.matrixWorld;if(s instanceof THREE.Particle){A.set(x.n14,x.n24,x.n34,1);F.multiplyVector4(A);A.z=A.z/A.w;if(A.z>0&&A.z<1){g=G[L]=G[L]||new THREE.RenderableParticle;L++;D=g;D.x=A.x/A.w;D.y=A.y/A.w;D.z=A.z;D.rotation=s.rotation.z;D.scale.x=s.scale.x*Math.abs(D.x-(A.x+e.projectionMatrix.n11)/(A.w+e.projectionMatrix.n14));D.scale.y=s.scale.y*Math.abs(D.y-(A.y+e.projectionMatrix.n22)/(A.w+e.projectionMatrix.n24));
-D.material=s.material;t.elements.push(D)}}}f&&t.elements.sort(c);return t}};THREE.Quaternion=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=d!==void 0?d:1};
+R.length;C<J;C++){i=b();i.positionWorld.copy(R[C]);x.multiplyVector3(i.positionWorld);i.positionScreen.copy(i.positionWorld);F.multiplyVector4(i.positionScreen);i.positionScreen.x=i.positionScreen.x/i.positionScreen.w;i.positionScreen.y=i.positionScreen.y/i.positionScreen.w;i.visible=i.positionScreen.z>g&&i.positionScreen.z<E}R=0;for(C=M.length;R<C;R++){J=M[R];if(J instanceof THREE.Face3){B=h[J.a];P=h[J.b];N=h[J.c];if(B.visible&&P.visible&&N.visible){Q=(N.positionScreen.x-B.positionScreen.x)*(P.positionScreen.y-
+B.positionScreen.y)-(N.positionScreen.y-B.positionScreen.y)*(P.positionScreen.x-B.positionScreen.x)<0;if(s.doubleSided||Q!=s.flipSided){V=m[o]=m[o]||new THREE.RenderableFace3;o++;l=V;l.v1.copy(B);l.v2.copy(P);l.v3.copy(N)}else continue}else continue}else if(J instanceof THREE.Face4){B=h[J.a];P=h[J.b];N=h[J.c];V=h[J.d];if(B.visible&&P.visible&&N.visible&&V.visible){Q=(V.positionScreen.x-B.positionScreen.x)*(P.positionScreen.y-B.positionScreen.y)-(V.positionScreen.y-B.positionScreen.y)*(P.positionScreen.x-
+B.positionScreen.x)<0||(P.positionScreen.x-N.positionScreen.x)*(V.positionScreen.y-N.positionScreen.y)-(P.positionScreen.y-N.positionScreen.y)*(V.positionScreen.x-N.positionScreen.x)<0;if(s.doubleSided||Q!=s.flipSided){fa=p[n]=p[n]||new THREE.RenderableFace4;n++;l=fa;l.v1.copy(B);l.v2.copy(P);l.v3.copy(N);l.v4.copy(V)}else continue}else continue}l.normalWorld.copy(J.normal);!Q&&(s.flipSided||s.doubleSided)&&l.normalWorld.negate();w.multiplyVector3(l.normalWorld);l.centroidWorld.copy(J.centroid);x.multiplyVector3(l.centroidWorld);
+l.centroidScreen.copy(l.centroidWorld);F.multiplyVector3(l.centroidScreen);N=J.vertexNormals;B=0;for(P=N.length;B<P;B++){V=l.vertexNormalsWorld[B];V.copy(N[B]);!Q&&(s.flipSided||s.doubleSided)&&V.negate();w.multiplyVector3(V)}B=0;for(P=la.length;B<P;B++)if(fa=la[B][R]){N=0;for(V=fa.length;N<V;N++)l.uvs[B][N]=fa[N]}l.material=s.material;l.faceMaterial=J.materialIndex!==null?z[J.materialIndex]:null;l.z=l.centroidScreen.z;t.elements.push(l)}}else if(s instanceof THREE.Line){r.multiply(F,x);R=s.geometry.vertices;
+B=b();B.positionScreen.copy(R[0]);r.multiplyVector4(B.positionScreen);x=s.type===THREE.LinePieces?2:1;C=1;for(J=R.length;C<J;C++){B=b();B.positionScreen.copy(R[C]);r.multiplyVector4(B.positionScreen);if(!((C+1)%x>0)){P=h[j-2];y.copy(B.positionScreen);K.copy(P.positionScreen);if(d(y,K)){y.multiplyScalar(1/y.w);K.multiplyScalar(1/K.w);z=H[u]=H[u]||new THREE.RenderableLine;u++;k=z;k.v1.positionScreen.copy(y);k.v2.positionScreen.copy(K);k.z=Math.max(y.z,K.z);k.material=s.material;t.elements.push(k)}}}}}a=
+0;for(U=t.sprites.length;a<U;a++){s=t.sprites[a].object;x=s.matrixWorld;if(s instanceof THREE.Particle){A.set(x.n14,x.n24,x.n34,1);F.multiplyVector4(A);A.z=A.z/A.w;if(A.z>0&&A.z<1){g=G[L]=G[L]||new THREE.RenderableParticle;L++;D=g;D.x=A.x/A.w;D.y=A.y/A.w;D.z=A.z;D.rotation=s.rotation.z;D.scale.x=s.scale.x*Math.abs(D.x-(A.x+e.projectionMatrix.n11)/(A.w+e.projectionMatrix.n14));D.scale.y=s.scale.y*Math.abs(D.y-(A.y+e.projectionMatrix.n22)/(A.w+e.projectionMatrix.n24));D.material=s.material;t.elements.push(D)}}}f&&
+t.elements.sort(c);return t}};THREE.Quaternion=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=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,i=d*e;this.w=g*f-i*c;this.x=g*c+i*f;this.y=d*b*f+a*e*c;this.z=a*e*f-d*b*c;return this},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);
 this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRotationMatrix:function(a){var b=Math.pow(a.determinant(),1/3);this.w=Math.sqrt(Math.max(0,b+a.n11+a.n22+a.n33))/2;this.x=Math.sqrt(Math.max(0,b+a.n11-a.n22-a.n33))/2;this.y=Math.sqrt(Math.max(0,b-a.n11+a.n22-a.n33))/2;this.z=Math.sqrt(Math.max(0,b-a.n11-a.n22+a.n33))/2;this.x=a.n32-a.n23<0?-Math.abs(this.x):Math.abs(this.x);this.y=a.n13-a.n31<0?-Math.abs(this.y):Math.abs(this.y);this.z=a.n21-a.n12<0?-Math.abs(this.z):Math.abs(this.z);
 this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x=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,h=j*c+g*e-i*d,l=j*d+i*c-f*e,o=j*e+f*d-g*c,c=-f*c-g*d-i*e;b.x=h*j+c*-f+l*-i-o*-g;b.y=l*j+c*-g+o*-f-h*-i;b.z=o*j+c*-i+h*-g-l*-f;return b},clone:function(){return new THREE.Quaternion(this.x,this.y,this.z,this.w)}};
-THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;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.001){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}b=Math.sin((1-d)*f)/e;d=Math.sin(d*f)/e;c.w=a.w*b+c.w*d;c.x=a.x*b+c.x*d;c.y=a.y*b+c.y*d;c.z=a.z*b+c.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
-THREE.Vertex.prototype={constructor:THREE.Vertex,clone:function(){return new THREE.Vertex(this.position.clone())}};THREE.Face3=function(a,b,c,d,e,f){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materialIndex=f;this.centroid=new THREE.Vector3};
+THREE.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.001){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}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.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};
 THREE.Face4.prototype={constructor:THREE.Face4,clone:function(){var a=new THREE.Face4(this.a,this.b,this.c,this.d);a.normal.copy(this.normal);a.color.copy(this.color);a.centroid.copy(this.centroid);a.materialIndex=this.materialIndex;var b,c;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.UV=function(a,b){this.u=a||0;this.v=b||0};THREE.UV.prototype={constructor:THREE.UV,set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.u=a.u;this.v=a.v;return this},lerpSelf:function(a,b){this.u=this.u+(a.u-this.u)*b;this.v=this.v+(a.v-this.v)*b;return this},clone:function(){return new THREE.UV(this.u,this.v)}};
 THREE.Geometry=function(){this.id=THREE.GeometryCount++;this.vertices=[];this.colors=[];this.materials=[];this.faces=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.morphNormals=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.dynamic=this.hasTangents=false};
-THREE.Geometry.prototype={constructor:THREE.Geometry,applyMatrix:function(a){var b=new THREE.Matrix4;b.extractRotation(a);for(var c=0,d=this.vertices.length;c<d;c++)a.multiplyVector3(this.vertices[c].position);c=0;for(d=this.faces.length;c<d;c++){var e=this.faces[c];b.multiplyVector3(e.normal);for(var f=0,g=e.vertexNormals.length;f<g;f++)b.multiplyVector3(e.vertexNormals[f]);a.multiplyVector3(e.centroid)}},computeCentroids:function(){var a,b,c;a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];
-c.centroid.set(0,0,0);if(c instanceof THREE.Face3){c.centroid.addSelf(this.vertices[c.a].position);c.centroid.addSelf(this.vertices[c.b].position);c.centroid.addSelf(this.vertices[c.c].position);c.centroid.divideScalar(3)}else if(c instanceof THREE.Face4){c.centroid.addSelf(this.vertices[c.a].position);c.centroid.addSelf(this.vertices[c.b].position);c.centroid.addSelf(this.vertices[c.c].position);c.centroid.addSelf(this.vertices[c.d].position);c.centroid.divideScalar(4)}}},computeFaceNormals:function(){var a,
-b,c,d,e,f,g=new THREE.Vector3,i=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];d=this.vertices[c.a];e=this.vertices[c.b];f=this.vertices[c.c];g.sub(f.position,e.position);i.sub(d.position,e.position);g.crossSelf(i);g.isZero()||g.normalize();c.normal.copy(g)}},computeVertexNormals:function(){var a,b,c,d;if(this.__tmpVertices===void 0){d=this.__tmpVertices=Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)d[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<
-b;a++){c=this.faces[a];if(c instanceof THREE.Face3)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(c instanceof THREE.Face4)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{d=this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)d[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3){d[c.a].addSelf(c.normal);d[c.b].addSelf(c.normal);d[c.c].addSelf(c.normal)}else if(c instanceof
-THREE.Face4){d[c.a].addSelf(c.normal);d[c.b].addSelf(c.normal);d[c.c].addSelf(c.normal);d[c.d].addSelf(c.normal)}}a=0;for(b=this.vertices.length;a<b;a++)d[a].normalize();a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3){c.vertexNormals[0].copy(d[c.a]);c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c])}else if(c instanceof THREE.Face4){c.vertexNormals[0].copy(d[c.a]);c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c]);c.vertexNormals[3].copy(d[c.d])}}},
-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,i=this.morphNormals[a].vertexNormals,j,h;c=0;for(d=this.faces.length;c<d;c++){e=this.faces[c];j=new THREE.Vector3;h=e instanceof THREE.Face3?{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3}:{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3,d:new THREE.Vector3};g.push(j);i.push(h)}}g=this.morphNormals[a];f.vertices=
-this.morphTargets[a].vertices;f.computeFaceNormals();f.computeVertexNormals();c=0;for(d=this.faces.length;c<d;c++){e=this.faces[c];j=g.faceNormals[c];h=g.vertexNormals[c];j.copy(e.normal);if(e instanceof THREE.Face3){h.a.copy(e.vertexNormals[0]);h.b.copy(e.vertexNormals[1]);h.c.copy(e.vertexNormals[2])}else{h.a.copy(e.vertexNormals[0]);h.b.copy(e.vertexNormals[1]);h.c.copy(e.vertexNormals[2]);h.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,B){i=a.vertices[b].position;j=a.vertices[c].position;h=a.vertices[d].position;l=g[e];o=g[f];m=g[B];n=j.x-i.x;p=h.x-i.x;k=j.y-i.y;u=h.y-i.y;H=j.z-i.z;D=h.z-i.z;L=o.u-l.u;G=m.u-l.u;t=o.v-l.v;E=m.v-l.v;A=1/(L*E-G*t);y.set((E*n-t*p)*A,(E*k-t*u)*A,(E*H-t*D)*A);K.set((L*p-G*n)*A,(L*u-G*k)*A,(L*D-G*H)*A);r[b].addSelf(y);r[c].addSelf(y);r[d].addSelf(y);v[b].addSelf(K);v[c].addSelf(K);v[d].addSelf(K)}var b,c,d,e,
-f,g,i,j,h,l,o,m,n,p,k,u,H,D,L,G,t,E,A,F,r=[],v=[],y=new THREE.Vector3,K=new THREE.Vector3,$=new THREE.Vector3,da=new THREE.Vector3,O=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++){r[b]=new THREE.Vector3;v[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 I=["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++){O.copy(f.vertexNormals[d]);e=f[I[d]];F=r[e];$.copy(F);$.subSelf(O.multiplyScalar(O.dot(F))).normalize();da.cross(f.vertexNormals[d],F);e=da.dot(v[e]);e=e<0?-1:1;f.vertexTangents[d]=new THREE.Vector4($.x,$.y,$.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].position;this.boundingBox.min.copy(a);
-this.boundingBox.max.copy(a);for(var b=this.boundingBox.min,c=this.boundingBox.max,d=1,e=this.vertices.length;d<e;d++){a=this.vertices[d].position;if(a.x<b.x)b.x=a.x;else if(a.x>c.x)c.x=a.x;if(a.y<b.y)b.y=a.y;else if(a.y>c.y)c.y=a.y;if(a.z<b.z)b.z=a.z;else if(a.z>c.z)c.z=a.z}}else{this.boundingBox.min.set(0,0,0);this.boundingBox.max.set(0,0,0)}},computeBoundingSphere:function(){if(!this.boundingSphere)this.boundingSphere={radius:0};for(var a,b=0,c=0,d=this.vertices.length;c<d;c++){a=this.vertices[c].position.length();
-a>b&&(b=a)}this.boundingSphere.radius=b},mergeVertices:function(){var a={},b=[],c=[],d,e=Math.pow(10,4),f,g;f=0;for(g=this.vertices.length;f<g;f++){d=this.vertices[f].position;d=[Math.round(d.x*e),Math.round(d.y*e),Math.round(d.z*e)].join("_");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.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.Geometry.prototype={constructor:THREE.Geometry,applyMatrix:function(a){var b=new THREE.Matrix4;b.extractRotation(a);for(var c=0,d=this.vertices.length;c<d;c++)a.multiplyVector3(this.vertices[c]);c=0;for(d=this.faces.length;c<d;c++){var e=this.faces[c];b.multiplyVector3(e.normal);for(var f=0,g=e.vertexNormals.length;f<g;f++)b.multiplyVector3(e.vertexNormals[f]);a.multiplyVector3(e.centroid)}},computeCentroids:function(){var a,b,c;a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];c.centroid.set(0,
+0,0);if(c instanceof THREE.Face3){c.centroid.addSelf(this.vertices[c.a]);c.centroid.addSelf(this.vertices[c.b]);c.centroid.addSelf(this.vertices[c.c]);c.centroid.divideScalar(3)}else if(c instanceof THREE.Face4){c.centroid.addSelf(this.vertices[c.a]);c.centroid.addSelf(this.vertices[c.b]);c.centroid.addSelf(this.vertices[c.c]);c.centroid.addSelf(this.vertices[c.d]);c.centroid.divideScalar(4)}}},computeFaceNormals:function(){var a,b,c,d,e,f,g=new THREE.Vector3,i=new THREE.Vector3;a=0;for(b=this.faces.length;a<
+b;a++){c=this.faces[a];d=this.vertices[c.a];e=this.vertices[c.b];f=this.vertices[c.c];g.sub(f,e);i.sub(d,e);g.crossSelf(i);g.isZero()||g.normalize();c.normal.copy(g)}},computeVertexNormals:function(){var a,b,c,d;if(this.__tmpVertices===void 0){d=this.__tmpVertices=Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)d[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];
+else if(c instanceof THREE.Face4)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{d=this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)d[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3){d[c.a].addSelf(c.normal);d[c.b].addSelf(c.normal);d[c.c].addSelf(c.normal)}else if(c instanceof THREE.Face4){d[c.a].addSelf(c.normal);d[c.b].addSelf(c.normal);d[c.c].addSelf(c.normal);d[c.d].addSelf(c.normal)}}a=0;
+for(b=this.vertices.length;a<b;a++)d[a].normalize();a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3){c.vertexNormals[0].copy(d[c.a]);c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c])}else if(c instanceof THREE.Face4){c.vertexNormals[0].copy(d[c.a]);c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c]);c.vertexNormals[3].copy(d[c.d])}}},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,i=this.morphNormals[a].vertexNormals,j,h;c=0;for(d=this.faces.length;c<d;c++){e=this.faces[c];j=new THREE.Vector3;h=e instanceof THREE.Face3?{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3}:{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3,d:new THREE.Vector3};g.push(j);i.push(h)}}g=this.morphNormals[a];f.vertices=this.morphTargets[a].vertices;f.computeFaceNormals();f.computeVertexNormals();c=0;for(d=this.faces.length;c<d;c++){e=this.faces[c];
+j=g.faceNormals[c];h=g.vertexNormals[c];j.copy(e.normal);if(e instanceof THREE.Face3){h.a.copy(e.vertexNormals[0]);h.b.copy(e.vertexNormals[1]);h.c.copy(e.vertexNormals[2])}else{h.a.copy(e.vertexNormals[0]);h.b.copy(e.vertexNormals[1]);h.c.copy(e.vertexNormals[2]);h.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,B){i=a.vertices[b];j=a.vertices[c];
+h=a.vertices[d];l=g[e];o=g[f];m=g[B];n=j.x-i.x;p=h.x-i.x;k=j.y-i.y;u=h.y-i.y;H=j.z-i.z;D=h.z-i.z;L=o.u-l.u;G=m.u-l.u;t=o.v-l.v;E=m.v-l.v;A=1/(L*E-G*t);y.set((E*n-t*p)*A,(E*k-t*u)*A,(E*H-t*D)*A);K.set((L*p-G*n)*A,(L*u-G*k)*A,(L*D-G*H)*A);r[b].addSelf(y);r[c].addSelf(y);r[d].addSelf(y);v[b].addSelf(K);v[c].addSelf(K);v[d].addSelf(K)}var b,c,d,e,f,g,i,j,h,l,o,m,n,p,k,u,H,D,L,G,t,E,A,F,r=[],v=[],y=new THREE.Vector3,K=new THREE.Vector3,$=new THREE.Vector3,da=new THREE.Vector3,O=new THREE.Vector3;b=0;for(c=
+this.vertices.length;b<c;b++){r[b]=new THREE.Vector3;v[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 I=["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++){O.copy(f.vertexNormals[d]);e=f[I[d]];F=r[e];$.copy(F);$.subSelf(O.multiplyScalar(O.dot(F))).normalize();
+da.cross(f.vertexNormals[d],F);e=da.dot(v[e]);e=e<0?-1:1;f.vertexTangents[d]=new THREE.Vector4($.x,$.y,$.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.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()};

+ 7 - 7
build/custom/ThreeDOM.js

@@ -8,7 +8,7 @@ Math.floor(a);this.r=(a>>16&255)/255;this.g=(a>>8&255)/255;this.b=(a&255)/255;re
 THREE.Vector2=function(a,b){this.x=a||0;this.y=b||0};
 THREE.Vector2.prototype={constructor:THREE.Vector2,set:function(a,b){this.x=a;this.y=b;return this},copy:function(a){this.x=a.x;this.y=a.y;return this},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;return this},addSelf:function(a){this.x=this.x+a.x;this.y=this.y+a.y;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;return this},subSelf:function(a){this.x=this.x-a.x;this.y=this.y-a.y;return this},multiplyScalar:function(a){this.x=this.x*a;this.y=this.y*a;return this},divideScalar:function(a){if(a){this.x=
 this.x/a;this.y=this.y/a}else this.set(0,0);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.lengthSq())},normalize:function(){return this.divideScalar(this.length())},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var b=this.x-a.x,a=this.y-a.y;return b*b+a*a},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;return this},equals:function(a){return a.x===this.x&&a.y===this.y},isZero:function(){return this.lengthSq()<1.0E-4},clone:function(){return new THREE.Vector2(this.x,this.y)}};THREE.Vector3=function(a,b,c){this.x=a||0;this.y=b||0;this.z=c||0};
+lerpSelf:function(a,b){this.x=this.x+(a.x-this.x)*b;this.y=this.y+(a.y-this.y)*b;return this},equals:function(a){return a.x===this.x&&a.y===this.y},isZero:function(){return this.lengthSq()<1.0E-4},clone:function(){return new THREE.Vector2(this.x,this.y)}};THREE.Vector3=function(a,b,c){a instanceof THREE.Vector3&&console.warn("OPS!");this.x=a||0;this.y=b||0;this.z=c||0};
 THREE.Vector3.prototype={constructor:THREE.Vector3,set:function(a,b,c){this.x=a;this.y=b;this.z=c;return this},setX:function(a){this.x=a;return this},setY:function(a){this.y=a;return this},setZ:function(a){this.z=a;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;return this},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;return this},addSelf:function(a){this.x=this.x+a.x;this.y=this.y+a.y;this.z=this.z+a.z;return this},addScalar:function(a){this.x=this.x+a;this.y=this.y+
 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())},
@@ -23,8 +23,8 @@ THREE.Frustum.prototype.contains=function(a){for(var b=this.planes,c=a.matrixWor
 THREE.Ray=function(a,b){function c(a,b,c){p.sub(c,a);G=p.dot(b);w=o.add(a,q.copy(b).multiplyScalar(G));return C=c.distanceTo(w)}function d(a,b,c,d){p.sub(d,b);o.sub(c,b);q.sub(a,b);D=p.dot(p);r=p.dot(o);x=p.dot(q);t=o.dot(o);y=o.dot(q);H=1/(D*t-r*r);K=(t*x-r*y)*H;E=(D*y-r*x)*H;return K>=0&&E>=0&&K+E<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,i=new THREE.Vector3,k=new THREE.Vector3,
 h=new THREE.Vector3,j=new THREE.Vector3,l=new THREE.Vector3,n=new THREE.Vector3,m=new THREE.Vector3;this.intersectObject=function(a){var b,o=[];if(a instanceof THREE.Particle){var p=c(this.origin,this.direction,a.matrixWorld.getPosition());if(p>a.scale.x)return[];b={distance:p,point:a.position,face:null,object:a};o.push(b)}else if(a instanceof THREE.Mesh){var p=c(this.origin,this.direction,a.matrixWorld.getPosition()),M=THREE.Frustum.__v1.set(a.matrixWorld.getColumnX().length(),a.matrixWorld.getColumnY().length(),
 a.matrixWorld.getColumnZ().length());if(p>a.geometry.boundingSphere.radius*Math.max(M.x,Math.max(M.y,M.z)))return o;var q,r,t=a.geometry,A=t.vertices,u;a.matrixRotationWorld.extractRotation(a.matrixWorld);p=0;for(M=t.faces.length;p<M;p++){b=t.faces[p];h.copy(this.origin);j.copy(this.direction);u=a.matrixWorld;l=u.multiplyVector3(l.copy(b.centroid)).subSelf(h);n=a.matrixRotationWorld.multiplyVector3(n.copy(b.normal));q=j.dot(n);if(!(Math.abs(q)<e)){r=n.dot(l)/q;if(!(r<0)&&(a.doubleSided||(a.flipSided?
-q>0:q<0))){m.add(h,j.multiplyScalar(r));if(b instanceof THREE.Face3){f=u.multiplyVector3(f.copy(A[b.a].position));g=u.multiplyVector3(g.copy(A[b.b].position));i=u.multiplyVector3(i.copy(A[b.c].position));if(d(m,f,g,i)){b={distance:h.distanceTo(m),point:m.clone(),face:b,object:a};o.push(b)}}else if(b instanceof THREE.Face4){f=u.multiplyVector3(f.copy(A[b.a].position));g=u.multiplyVector3(g.copy(A[b.b].position));i=u.multiplyVector3(i.copy(A[b.c].position));k=u.multiplyVector3(k.copy(A[b.d].position));
-if(d(m,f,g,k)||d(m,g,i,k)){b={distance:h.distanceTo(m),point:m.clone(),face:b,object:a};o.push(b)}}}}}}return o};this.intersectObjects=function(a){for(var b=[],c=0,d=a.length;c<d;c++)Array.prototype.push.apply(b,this.intersectObject(a[c]));b.sort(function(a,b){return a.distance-b.distance});return b};var p=new THREE.Vector3,o=new THREE.Vector3,q=new THREE.Vector3,G,w,C,D,r,x,t,y,H,K,E};
+q>0:q<0))){m.add(h,j.multiplyScalar(r));if(b instanceof THREE.Face3){f=u.multiplyVector3(f.copy(A[b.a]));g=u.multiplyVector3(g.copy(A[b.b]));i=u.multiplyVector3(i.copy(A[b.c]));if(d(m,f,g,i)){b={distance:h.distanceTo(m),point:m.clone(),face:b,object:a};o.push(b)}}else if(b instanceof THREE.Face4){f=u.multiplyVector3(f.copy(A[b.a]));g=u.multiplyVector3(g.copy(A[b.b]));i=u.multiplyVector3(i.copy(A[b.c]));k=u.multiplyVector3(k.copy(A[b.d]));if(d(m,f,g,k)||d(m,g,i,k)){b={distance:h.distanceTo(m),point:m.clone(),
+face:b,object:a};o.push(b)}}}}}}return o};this.intersectObjects=function(a){for(var b=[],c=0,d=a.length;c<d;c++)Array.prototype.push.apply(b,this.intersectObject(a[c]));b.sort(function(a,b){return a.distance-b.distance});return b};var p=new THREE.Vector3,o=new THREE.Vector3,q=new THREE.Vector3,G,w,C,D,r,x,t,y,H,K,E};
 THREE.Rectangle=function(){function a(){f=d-b;g=e-c}var b,c,d,e,f,g,i=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,h,g,l){i=false;b=f;c=h;d=g;e=l;a()};this.addPoint=function(f,h){if(i){i=false;b=f;c=h;d=f;e=h}else{b=b<f?b:f;c=c<h?c:h;d=d>f?d:f;e=e>h?
 e:h}a()};this.add3Points=function(f,h,g,l,n,m){if(i){i=false;b=f<g?f<n?f:n:g<n?g:n;c=h<l?h<m?h:m:l<m?l:m;d=f>g?f>n?f:n:g>n?g:n;e=h>l?h>m?h:m:l>m?l:m}else{b=f<g?f<n?f<b?f:b:n<b?n:b:g<n?g<b?g:b:n<b?n:b;c=h<l?h<m?h<c?h:c:m<c?m:c:l<m?l<c?l:c:m<c?m:c;d=f>g?f>n?f>d?f:d:n>d?n:d:g>n?g>d?g:d:n>d?n:d;e=h>l?h>m?h>e?h:e:m>e?m:e:l>m?l>e?l:e:m>e?m:e}a()};this.addRectangle=function(f){if(i){i=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(){i=true;e=d=c=b=0;a()};this.isEmpty=function(){return i}};
@@ -68,11 +68,11 @@ d);return true}var e,f,g=[],i,k,h=[],j,l,n=[],m,p=[],o,q,G=[],w,C,D=[],r={object
 y.multiply(b.matrixWorld,b.projectionMatrixInverse);y.multiplyVector3(a);return a};this.pickingRay=function(a,b){var c;a.z=-1;c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.subSelf(a).normalize();return new THREE.Ray(a,c)};this.projectGraph=function(b,d){f=0;r.objects.length=0;r.sprites.length=0;r.lights.length=0;var h=function(b){if(b.visible!==false){if((b instanceof THREE.Mesh||b instanceof THREE.Line)&&(b.frustumCulled===false||K.contains(b))){x.copy(b.matrixWorld.getPosition());
 y.multiplyVector3(x);e=a();e.object=b;e.z=x.z;r.objects.push(e)}else if(b instanceof THREE.Sprite||b instanceof THREE.Particle){x.copy(b.matrixWorld.getPosition());y.multiplyVector3(x);e=a();e.object=b;e.z=x.z;r.sprites.push(e)}else b instanceof THREE.Light&&r.lights.push(b);for(var c=0,d=b.children.length;c<d;c++)h(b.children[c])}};h(b);d&&r.objects.sort(c);return r};this.projectScene=function(a,e,f){var g=e.near,x=e.far,O=false,U,A,u,I,s,B,z,F,v,L,N,V,W,X,P;C=q=m=l=0;r.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);y.multiply(e.projectionMatrix,e.matrixWorldInverse);K.setFromMatrix(y);r=this.projectGraph(a,false);a=0;for(U=r.objects.length;a<U;a++){v=r.objects[a].object;L=v.matrixWorld;k=0;if(v instanceof THREE.Mesh){N=v.geometry;V=v.geometry.materials;I=N.vertices;W=N.faces;X=N.faceVertexUvs;N=v.matrixRotationWorld.extractRotation(L);A=0;for(u=I.length;A<
-u;A++){i=b();i.positionWorld.copy(I[A].position);L.multiplyVector3(i.positionWorld);i.positionScreen.copy(i.positionWorld);y.multiplyVector4(i.positionScreen);i.positionScreen.x=i.positionScreen.x/i.positionScreen.w;i.positionScreen.y=i.positionScreen.y/i.positionScreen.w;i.visible=i.positionScreen.z>g&&i.positionScreen.z<x}I=0;for(A=W.length;I<A;I++){u=W[I];if(u instanceof THREE.Face3){s=h[u.a];B=h[u.b];z=h[u.c];if(s.visible&&B.visible&&z.visible){O=(z.positionScreen.x-s.positionScreen.x)*(B.positionScreen.y-
+u;A++){i=b();i.positionWorld.copy(I[A]);L.multiplyVector3(i.positionWorld);i.positionScreen.copy(i.positionWorld);y.multiplyVector4(i.positionScreen);i.positionScreen.x=i.positionScreen.x/i.positionScreen.w;i.positionScreen.y=i.positionScreen.y/i.positionScreen.w;i.visible=i.positionScreen.z>g&&i.positionScreen.z<x}I=0;for(A=W.length;I<A;I++){u=W[I];if(u instanceof THREE.Face3){s=h[u.a];B=h[u.b];z=h[u.c];if(s.visible&&B.visible&&z.visible){O=(z.positionScreen.x-s.positionScreen.x)*(B.positionScreen.y-
 s.positionScreen.y)-(z.positionScreen.y-s.positionScreen.y)*(B.positionScreen.x-s.positionScreen.x)<0;if(v.doubleSided||O!=v.flipSided){F=n[l]=n[l]||new THREE.RenderableFace3;l++;j=F;j.v1.copy(s);j.v2.copy(B);j.v3.copy(z)}else continue}else continue}else if(u instanceof THREE.Face4){s=h[u.a];B=h[u.b];z=h[u.c];F=h[u.d];if(s.visible&&B.visible&&z.visible&&F.visible){O=(F.positionScreen.x-s.positionScreen.x)*(B.positionScreen.y-s.positionScreen.y)-(F.positionScreen.y-s.positionScreen.y)*(B.positionScreen.x-
 s.positionScreen.x)<0||(B.positionScreen.x-z.positionScreen.x)*(F.positionScreen.y-z.positionScreen.y)-(B.positionScreen.y-z.positionScreen.y)*(F.positionScreen.x-z.positionScreen.x)<0;if(v.doubleSided||O!=v.flipSided){P=p[m]=p[m]||new THREE.RenderableFace4;m++;j=P;j.v1.copy(s);j.v2.copy(B);j.v3.copy(z);j.v4.copy(F)}else continue}else continue}j.normalWorld.copy(u.normal);!O&&(v.flipSided||v.doubleSided)&&j.normalWorld.negate();N.multiplyVector3(j.normalWorld);j.centroidWorld.copy(u.centroid);L.multiplyVector3(j.centroidWorld);
 j.centroidScreen.copy(j.centroidWorld);y.multiplyVector3(j.centroidScreen);z=u.vertexNormals;s=0;for(B=z.length;s<B;s++){F=j.vertexNormalsWorld[s];F.copy(z[s]);!O&&(v.flipSided||v.doubleSided)&&F.negate();N.multiplyVector3(F)}s=0;for(B=X.length;s<B;s++)if(P=X[s][I]){z=0;for(F=P.length;z<F;z++)j.uvs[s][z]=P[z]}j.material=v.material;j.faceMaterial=u.materialIndex!==null?V[u.materialIndex]:null;j.z=j.centroidScreen.z;r.elements.push(j)}}else if(v instanceof THREE.Line){H.multiply(y,L);I=v.geometry.vertices;
-s=b();s.positionScreen.copy(I[0].position);H.multiplyVector4(s.positionScreen);L=v.type===THREE.LinePieces?2:1;A=1;for(u=I.length;A<u;A++){s=b();s.positionScreen.copy(I[A].position);H.multiplyVector4(s.positionScreen);if(!((A+1)%L>0)){B=h[k-2];E.copy(s.positionScreen);J.copy(B.positionScreen);if(d(E,J)){E.multiplyScalar(1/E.w);J.multiplyScalar(1/J.w);V=G[q]=G[q]||new THREE.RenderableLine;q++;o=V;o.v1.positionScreen.copy(E);o.v2.positionScreen.copy(J);o.z=Math.max(E.z,J.z);o.material=v.material;r.elements.push(o)}}}}}a=
+s=b();s.positionScreen.copy(I[0]);H.multiplyVector4(s.positionScreen);L=v.type===THREE.LinePieces?2:1;A=1;for(u=I.length;A<u;A++){s=b();s.positionScreen.copy(I[A]);H.multiplyVector4(s.positionScreen);if(!((A+1)%L>0)){B=h[k-2];E.copy(s.positionScreen);J.copy(B.positionScreen);if(d(E,J)){E.multiplyScalar(1/E.w);J.multiplyScalar(1/J.w);V=G[q]=G[q]||new THREE.RenderableLine;q++;o=V;o.v1.positionScreen.copy(E);o.v2.positionScreen.copy(J);o.z=Math.max(E.z,J.z);o.material=v.material;r.elements.push(o)}}}}}a=
 0;for(U=r.sprites.length;a<U;a++){v=r.sprites[a].object;L=v.matrixWorld;if(v instanceof THREE.Particle){t.set(L.n14,L.n24,L.n34,1);y.multiplyVector4(t);t.z=t.z/t.w;if(t.z>0&&t.z<1){g=D[C]=D[C]||new THREE.RenderableParticle;C++;w=g;w.x=t.x/t.w;w.y=t.y/t.w;w.z=t.z;w.rotation=v.rotation.z;w.scale.x=v.scale.x*Math.abs(w.x-(t.x+e.projectionMatrix.n11)/(t.w+e.projectionMatrix.n14));w.scale.y=v.scale.y*Math.abs(w.y-(t.y+e.projectionMatrix.n22)/(t.w+e.projectionMatrix.n24));w.material=v.material;r.elements.push(w)}}}f&&
 r.elements.sort(c);return r}};THREE.Quaternion=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=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,i=d*e;this.w=g*f-i*c;this.x=g*c+i*f;this.y=d*b*f+a*e*c;this.z=a*e*f-d*b*c;return this},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);
@@ -80,8 +80,8 @@ this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRo
 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,
 k=this.w,h=k*c+g*e-i*d,j=k*d+i*c-f*e,l=k*e+f*d-g*c,c=-f*c-g*d-i*e;b.x=h*k+c*-f+j*-i-l*-g;b.y=j*k+c*-g+l*-f-h*-i;b.z=l*k+c*-i+h*-g-j*-f;return b},clone:function(){return new THREE.Quaternion(this.x,this.y,this.z,this.w)}};
-THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;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.001){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}b=Math.sin((1-d)*f)/e;d=Math.sin(d*f)/e;c.w=a.w*b+c.w*d;c.x=a.x*b+c.x*d;c.y=a.y*b+c.y*d;c.z=a.z*b+c.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
-THREE.Vertex.prototype={constructor:THREE.Vertex,clone:function(){return new THREE.Vertex(this.position.clone())}};THREE.Face3=function(a,b,c,d,e,f){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materialIndex=f;this.centroid=new THREE.Vector3};
+THREE.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.001){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}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.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};
 THREE.Face4.prototype={constructor:THREE.Face4,clone:function(){var a=new THREE.Face4(this.a,this.b,this.c,this.d);a.normal.copy(this.normal);a.color.copy(this.color);a.centroid.copy(this.centroid);a.materialIndex=this.materialIndex;var b,c;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();

+ 126 - 128
build/custom/ThreeExtras.js

@@ -1,27 +1,26 @@
 // 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,i=a.faces,j=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.position);g.push(m)}n=0;for(r=j.length;n<r;n++){var g=
-j[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,
+THREE.GeometryUtils={merge:function(a,b){for(var c,d,f=a.vertices.length,e=b instanceof THREE.Mesh?b.geometry:b,g=a.vertices,h=e.vertices,i=a.faces,j=e.faces,k=a.faceVertexUvs[0],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=j.length;n<r;n++){var g=j[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);i.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<
 c;a++){for(var d=e[a],f=[],g=0,h=d.length;g<h;g++)f.push(new THREE.UV(d[g].u,d[g].v));b.faceVertexUvs[0].push(f)}return b},randomPointInTriangle:function(a,b,c){var d,f,e,g=new THREE.Vector3,h=THREE.GeometryUtils.__v1;d=THREE.GeometryUtils.random();f=THREE.GeometryUtils.random();1<d+f&&(d=1-d,f=1-f);e=1-d-f;g.copy(a);g.multiplyScalar(d);h.copy(b);h.multiplyScalar(f);g.addSelf(h);h.copy(c);h.multiplyScalar(e);g.addSelf(h);return g},randomPointInFace:function(a,b,c){var d,f,e;if(a instanceof THREE.Face3)return d=
-b.vertices[a.a].position,f=b.vertices[a.b].position,e=b.vertices[a.c].position,THREE.GeometryUtils.randomPointInTriangle(d,f,e);if(a instanceof THREE.Face4){d=b.vertices[a.a].position;f=b.vertices[a.b].position;e=b.vertices[a.c].position;var b=b.vertices[a.d].position,g;c?a._area1&&a._area2?(c=a._area1,g=a._area2):(c=THREE.GeometryUtils.triangleArea(d,f,b),g=THREE.GeometryUtils.triangleArea(f,e,b),a._area1=c,a._area2=g):(c=THREE.GeometryUtils.triangleArea(d,f,b),g=THREE.GeometryUtils.triangleArea(f,
-e,b));return THREE.GeometryUtils.random()*(c+g)<c?THREE.GeometryUtils.randomPointInTriangle(d,f,b):THREE.GeometryUtils.randomPointInTriangle(f,e,b)}},randomPointsInGeometry:function(a,b){function c(a){function b(c,d){if(d<c)return c;var f=c+Math.floor((d-c)/2);return j[f]>a?b(c,f-1):j[f]<a?b(f+1,d):f}return b(0,j.length-1)}var d,f,e=a.faces,g=a.vertices,h=e.length,i=0,j=[],k,q,l,n;for(f=0;f<h;f++)d=e[f],d instanceof THREE.Face3?(k=g[d.a].position,q=g[d.b].position,l=g[d.c].position,d._area=THREE.GeometryUtils.triangleArea(k,
-q,l)):d instanceof THREE.Face4&&(k=g[d.a].position,q=g[d.b].position,l=g[d.c].position,n=g[d.d].position,d._area1=THREE.GeometryUtils.triangleArea(k,q,n),d._area2=THREE.GeometryUtils.triangleArea(q,l,n),d._area=d._area1+d._area2),i+=d._area,j[f]=i;d=[];for(f=0;f<b;f++)g=THREE.GeometryUtils.random()*i,g=c(g),d[f]=THREE.GeometryUtils.randomPointInFace(e[g],a,!0);return d},triangleArea:function(a,b,c){var d,f=THREE.GeometryUtils.__v1;f.sub(a,b);d=f.length();f.sub(a,c);a=f.length();f.sub(b,c);c=f.length();
-b=0.5*(d+a+c);return Math.sqrt(b*(b-d)*(b-a)*(b-c))},center:function(a){a.computeBoundingBox();var b=a.boundingBox,c=new THREE.Vector3;c.add(b.min,b.max);c.multiplyScalar(-0.5);a.applyMatrix((new THREE.Matrix4).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 i=d.b,j=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=i;q.c=k;l.a=i;l.b=j;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],i=q[1],j=q[2],k=q[3],q=[q[0].clone(),i.clone(),k.clone()],i=[i.clone(),j.clone(),k.clone()],h[d].push(q,i));d=0;for(f=a.faceUvs.length;d<f;d++)a.faceUvs[d].length&&(i=a.faceUvs[d][b],g[d].push(i,i))}else{e.push(d);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,i=e.c,g=a.vertices[g],h=a.vertices[h],i=a.vertices[i],j=a.vertices[e.d];b.push(g.clone());b.push(h.clone());
-b.push(i.clone());b.push(j.clone());e.a=f;e.b=f+1;e.c=f+2;e.d=f+3}else g=e.a,h=e.b,i=e.c,g=a.vertices[g],h=a.vertices[h],i=a.vertices[i],b.push(g.clone()),b.push(h.clone()),b.push(i.clone()),e.a=f,e.b=f+1,e.c=f+2}a.vertices=b;delete a.__tmpVertices},tessellate:function(a,b){var c,d,f,e,g,h,i,j,k,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,j=a.vertices[e],k=a.vertices[g],
-q=a.vertices[h],n=j.position.distanceTo(k.position),r=k.position.distanceTo(q.position),l=j.position.distanceTo(q.position),n>b||r>b||l>b){i=a.vertices.length;v=f.clone();o=f.clone();n>=r&&n>=l?(j=j.clone(),j.position.lerpSelf(k.position,0.5),v.a=e,v.b=i,v.c=h,o.a=i,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?(j=k.clone(),j.position.lerpSelf(q.position,0.5),v.a=e,v.b=g,v.c=i,o.a=i,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):(j=j.clone(),j.position.lerpSelf(q.position,0.5),v.a=e,v.b=g,v.c=i,o.a=i,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(j);e=0;for(g=a.faceVertexUvs.length;e<g;e++)a.faceVertexUvs[e].length&&(j=a.faceVertexUvs[e][c],o=j[0],h=j[1],v=j[2],0===f?(k=o.clone(),k.lerpSelf(h,0.5),j=[o.clone(),k.clone(),v.clone()],h=[k.clone(),h.clone(),v.clone()]):1===f?(k=h.clone(),k.lerpSelf(v,0.5),j=[o.clone(),h.clone(),k.clone()],h=[k.clone(),v.clone(),o.clone()]):(k=o.clone(),k.lerpSelf(v,0.5),j=[o.clone(),h.clone(),k.clone()],h=[k.clone(),h.clone(),v.clone()]),y[e].push(j,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,i=f.d,j=a.vertices[e],k=a.vertices[g],q=a.vertices[h],l=a.vertices[i],n=j.position.distanceTo(k.position),r=k.position.distanceTo(q.position),m=q.position.distanceTo(l.position),p=j.position.distanceTo(l.position),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=j.clone(),n.position.lerpSelf(k.position,0.5),k=q.clone(),k.position.lerpSelf(l.position,0.5),v.a=
-e,v.b=t,v.c=s,v.d=i,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.position.lerpSelf(q.position,0.5),k=l.clone(),k.position.lerpSelf(j.position,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=i,4===f.vertexNormals.length&&(e=f.vertexNormals[1].clone(),e.lerpSelf(f.vertexNormals[2],0.5),g=f.vertexNormals[3].clone(),g.lerpSelf(f.vertexNormals[0],0.5),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&&(j=a.faceVertexUvs[e][c],o=j[0],h=j[1],v=j[2],j=j[3],0===f?(k=o.clone(),k.lerpSelf(h,0.5),q=v.clone(),q.lerpSelf(j,0.5),o=[o.clone(),k.clone(),q.clone(),j.clone()],h=[k.clone(),h.clone(),v.clone(),
-q.clone()]):(k=h.clone(),k.lerpSelf(v,0.5),q=j.clone(),q.lerpSelf(o,0.5),o=[o.clone(),h.clone(),k.clone(),q.clone()],h=[q.clone(),k.clone(),v.clone(),j.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.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 j[f]>a?b(c,f-1):j[f]<a?b(f+1,d):f}return b(0,j.length-1)}var d,f,e=a.faces,g=a.vertices,h=e.length,i=0,j=[],k,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),i+=d._area,j[f]=i;d=[];for(f=0;f<b;f++)g=THREE.GeometryUtils.random()*i,g=c(g),d[f]=THREE.GeometryUtils.randomPointInFace(e[g],a,!0);return d},triangleArea:function(a,b,c){var d,f=THREE.GeometryUtils.__v1;f.sub(a,b);d=f.length();f.sub(a,c);a=f.length();f.sub(b,c);c=f.length();b=0.5*(d+a+c);return Math.sqrt(b*(b-d)*(b-a)*(b-c))},center:function(a){a.computeBoundingBox();var b=a.boundingBox,c=new THREE.Vector3;c.add(b.min,
+b.max);c.multiplyScalar(-0.5);a.applyMatrix((new THREE.Matrix4).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 i=d.b,j=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=i;q.c=k;l.a=i;l.b=j;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],i=q[1],j=q[2],k=q[3],q=[q[0].clone(),i.clone(),k.clone()],i=[i.clone(),j.clone(),k.clone()],h[d].push(q,i));d=0;for(f=a.faceUvs.length;d<f;d++)a.faceUvs[d].length&&(i=a.faceUvs[d][b],g[d].push(i,i))}else{e.push(d);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,i=e.c,g=a.vertices[g],h=a.vertices[h],i=a.vertices[i],j=a.vertices[e.d];b.push(g.clone());b.push(h.clone());b.push(i.clone());b.push(j.clone());e.a=f;e.b=f+1;e.c=f+2;e.d=f+3}else g=e.a,h=e.b,i=e.c,g=a.vertices[g],h=a.vertices[h],i=a.vertices[i],b.push(g.clone()),
+b.push(h.clone()),b.push(i.clone()),e.a=f,e.b=f+1,e.c=f+2}a.vertices=b;delete a.__tmpVertices},tessellate:function(a,b){var c,d,f,e,g,h,i,j,k,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,j=a.vertices[e],k=a.vertices[g],q=a.vertices[h],n=j.distanceTo(k),r=k.distanceTo(q),l=j.distanceTo(q),n>b||r>b||l>b){i=a.vertices.length;v=f.clone();o=f.clone();n>=r&&n>=l?(j=j.clone(),
+j.lerpSelf(k,0.5),v.a=e,v.b=i,v.c=h,o.a=i,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?(j=k.clone(),j.lerpSelf(q,0.5),v.a=e,v.b=g,v.c=i,o.a=i,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):(j=j.clone(),j.lerpSelf(q,0.5),v.a=e,v.b=g,v.c=i,o.a=i,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(j);e=0;for(g=a.faceVertexUvs.length;e<g;e++)a.faceVertexUvs[e].length&&(j=a.faceVertexUvs[e][c],o=j[0],h=j[1],v=j[2],0===f?(k=o.clone(),k.lerpSelf(h,0.5),j=[o.clone(),k.clone(),v.clone()],h=[k.clone(),h.clone(),v.clone()]):1===f?(k=h.clone(),
+k.lerpSelf(v,0.5),j=[o.clone(),h.clone(),k.clone()],h=[k.clone(),v.clone(),o.clone()]):(k=o.clone(),k.lerpSelf(v,0.5),j=[o.clone(),h.clone(),k.clone()],h=[k.clone(),h.clone(),v.clone()]),y[e].push(j,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,i=f.d,j=a.vertices[e],k=a.vertices[g],q=a.vertices[h],l=a.vertices[i],n=j.distanceTo(k),r=k.distanceTo(q),m=q.distanceTo(l),p=j.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=j.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=i,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(j,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=i,4===f.vertexNormals.length&&(e=f.vertexNormals[1].clone(),e.lerpSelf(f.vertexNormals[2],0.5),g=f.vertexNormals[3].clone(),g.lerpSelf(f.vertexNormals[0],0.5),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&&(j=a.faceVertexUvs[e][c],o=j[0],h=j[1],v=j[2],j=j[3],0===f?(k=o.clone(),k.lerpSelf(h,
+0.5),q=v.clone(),q.lerpSelf(j,0.5),o=[o.clone(),k.clone(),q.clone(),j.clone()],h=[k.clone(),h.clone(),v.clone(),q.clone()]):(k=h.clone(),k.lerpSelf(v,0.5),q=j.clone(),q.lerpSelf(o,0.5),o=[o.clone(),h.clone(),k.clone(),q.clone()],h=[q.clone(),k.clone(),v.clone(),j.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;
 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,i=g.createImageData(d,f),j=i.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*
@@ -62,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,i;i=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;i.addSelf(e.x,e.y)}return{minX:d,minY:f,maxX:b,maxY:c,centroid:i.divideScalar(h)}};THREE.CurvePath.prototype.createPointsGeometry=function(a){return this.createGeometry(this.getPoints(a,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(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.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.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,i;d=0;for(f=a.length;d<f;d++){e=a[d];g=e.x;h=e.y;i=g/c.maxX;i=b.getUtoTmapping(i,g);g=b.getPoint(i);h=b.getNormalVector(i).multiplyScalar(h);e.x=g.x+h.x;e.y=g.y+h.y}return a};
 THREE.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;
@@ -138,9 +137,9 @@ 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 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(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.005;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;
+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;
+this.animationParent=new THREE.Object3D;this.lookSpeed=0.005;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===
 document){this.mouseX=a.pageX-this.viewHalfX;this.mouseY=a.pageY-this.viewHalfY}else{this.mouseX=a.pageX-this.domElement.offsetLeft-this.viewHalfX;this.mouseY=a.pageY-this.domElement.offsetTop-this.viewHalfY}};this.init=function(){this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){var a=new THREE.MeshLambertMaterial({color:30719}),b=new THREE.MeshLambertMaterial({color:65280}),
 c=new THREE.CubeGeometry(10,10,20),g=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(c,a);a=new THREE.Mesh(g,b);a.position.set(0,10,0);this.animation=f(this.animationParent,this.spline,this.id,this.duration);this.animationParent.add(this.object);this.animationParent.add(this.target);this.animationParent.add(a)}else{this.animation=f(this.animationParent,this.spline,this.id,this.duration);this.animationParent.add(this.target);this.animationParent.add(this.object)}if(this.createDebugPath){var a=
@@ -171,33 +170,33 @@ b.addSelf(c.object.up.clone().setLength(a.y));c.object.position.addSelf(b);c.tar
 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=i=c.getMouseProjectionOnBall(a.clientX,a.clientY);j=k=c.getMouseOnScreen(a.clientX,a.clientY);q=
 l=c.getMouseOnScreen(a.clientX,a.clientY);f=false}e!==-1&&(e===0&&!c.noRotate?i=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=i=c.getMouseProjectionOnBall(a.clientX,a.clientY):e===1&&!c.noZoom?j=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 i(a,b,c,g,h,l,i,k){var m,q=d||1,n=f||1,r=h/2,p=l/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";n=e||1}else if(a==="z"&&b==="y"||a==="y"&&b==="z"){m="x";q=e||1}var s=q+1,v=n+1,F=h/q,M=l/n,N=new THREE.Vector3;N[m]=i>0?1:-1;for(h=0;h<v;h++)for(l=0;l<s;l++){var D=new THREE.Vector3;D[a]=(l*F-r)*c;D[b]=(h*M-p)*g;D[m]=i;j.vertices.push(new THREE.Vertex(D))}for(h=0;h<n;h++)for(l=0;l<
-q;l++){a=new THREE.Face4(l+s*h+t,l+s*(h+1)+t,l+1+s*(h+1)+t,l+1+s*h+t);a.normal.copy(N);a.vertexNormals.push(N.clone(),N.clone(),N.clone(),N.clone());a.materialIndex=k;j.faces.push(a);j.faceVertexUvs[0].push([new THREE.UV(l/q,h/n),new THREE.UV(l/q,(h+1)/n),new THREE.UV((l+1)/q,(h+1)/n),new THREE.UV((l+1)/q,h/n)])}}THREE.Geometry.call(this);var j=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&&i("z","y",-1,-1,c,b,k,n);this.sides.nx&&i("z","y",1,-1,c,b,-k,p);this.sides.py&&i("x","z",1,1,a,c,q,r);this.sides.ny&&i("x","z",1,-1,a,c,-q,t);this.sides.pz&&i("x","y",1,-1,a,b,l,m);this.sides.nz&&i("x","y",-1,-1,a,b,-l,s);this.computeCentroids();this.mergeVertices()};THREE.CubeGeometry.prototype=new THREE.Geometry;
+THREE.CubeGeometry=function(a,b,c,d,f,e,g,h){function i(a,b,c,g,h,l,i,k){var m,q=d||1,n=f||1,r=h/2,p=l/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";n=e||1}else if(a==="z"&&b==="y"||a==="y"&&b==="z"){m="x";q=e||1}var s=q+1,v=n+1,F=h/q,M=l/n,N=new THREE.Vector3;N[m]=i>0?1:-1;for(h=0;h<v;h++)for(l=0;l<s;l++){var D=new THREE.Vertex;D[a]=(l*F-r)*c;D[b]=(h*M-p)*g;D[m]=i;j.vertices.push(D)}for(h=0;h<n;h++)for(l=0;l<q;l++){a=new THREE.Face4(l+
+s*h+t,l+s*(h+1)+t,l+1+s*(h+1)+t,l+1+s*h+t);a.normal.copy(N);a.vertexNormals.push(N.clone(),N.clone(),N.clone(),N.clone());a.materialIndex=k;j.faces.push(a);j.faceVertexUvs[0].push([new THREE.UV(l/q,h/n),new THREE.UV(l/q,(h+1)/n),new THREE.UV((l+1)/q,(h+1)/n),new THREE.UV((l+1)/q,h/n)])}}THREE.Geometry.call(this);var j=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&&i("z","y",-1,-1,c,b,k,n);this.sides.nx&&i("z","y",1,-1,c,b,-k,p);this.sides.py&&i("x","z",1,1,a,c,q,r);this.sides.ny&&i("x","z",1,-1,a,c,-q,t);this.sides.pz&&i("x","y",1,-1,a,b,l,m);this.sides.nz&&i("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,i,j=[],k=[];for(i=0;i<=f;i++){var q=[],l=[],n=i/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(new THREE.Vector3(p,t,s)));q.push(this.vertices.length-1);l.push(new THREE.UV(m,n))}j.push(q);k.push(l)}for(i=0;i<f;i++)for(h=0;h<d;h++){var c=j[i][h],q=j[i+1][h],
-l=j[i+1][h+1],n=j[i][h+1],r=this.vertices[c].position.clone().setY(0).normalize(),m=this.vertices[q].position.clone().setY(0).normalize(),p=this.vertices[l].position.clone().setY(0).normalize(),t=this.vertices[n].position.clone().setY(0).normalize(),s=k[i][h].clone(),v=k[i+1][h].clone(),o=k[i+1][h+1].clone(),x=k[i][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(new THREE.Vector3(0,g,0)));for(h=
-0;h<d;h++){c=j[0][h];q=j[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(new THREE.Vector3(0,-g,0)));for(h=0;h<d;h++){c=j[i][h+1];q=j[i][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[i][h+1].clone();v=k[i][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.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.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,i,j=[],k=[];for(i=0;i<=f;i++){var q=[],l=[],n=i/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))}j.push(q);k.push(l)}for(i=0;i<f;i++)for(h=0;h<d;h++){var c=j[i][h],q=j[i+1][h],l=j[i+1][h+1],n=j[i][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[i][h].clone(),v=k[i+1][h].clone(),o=k[i+1][h+1].clone(),x=k[i][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=j[0][h];q=j[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=j[i][h+1];q=j[i][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[i][h+1].clone();v=k[i][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.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;THREE.ExtrudeGeometry.prototype.addShapeList=function(a,b){for(var c=a.length,d=0;d<c;d++)this.addShape(a[d],b)};
 THREE.ExtrudeGeometry.prototype.addShape=function(a,b){function c(a,b,c){b||console.log("die");return b.clone().multiplyScalar(c).addSelf(a)}function d(a,b,c){var d=THREE.ExtrudeGeometry.__v1,e=THREE.ExtrudeGeometry.__v2,f=THREE.ExtrudeGeometry.__v3,g=THREE.ExtrudeGeometry.__v4,h=THREE.ExtrudeGeometry.__v5,l=THREE.ExtrudeGeometry.__v6;d.set(a.x-b.x,a.y-b.y);e.set(a.x-c.x,a.y-c.y);d=d.normalize();e=e.normalize();f.set(-d.y,d.x);g.set(e.y,-e.x);h.copy(a).addSelf(f);l.copy(a).addSelf(g);if(h.equals(l))return g.clone();
 h.copy(b).addSelf(f);l.copy(c).addSelf(g);f=d.dot(g);g=l.subSelf(h).dot(g);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(new THREE.Vector3(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,i=b.bevelThickness!==void 0?b.bevelThickness:6,j=b.bevelSize!==void 0?b.bevelSize:i-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)j=i=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=i*(1-G);B=j*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=j;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);
+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,i=b.bevelThickness!==void 0?b.bevelThickness:6,j=b.bevelSize!==void 0?b.bevelSize:i-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)j=i=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=i*(1-G);B=j*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=j;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=i*(1-G);B=j*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}})()};
-THREE.ExtrudeGeometry.WorldUVGenerator={generateTopUV:function(a,b,c,d,f,e){b=a.vertices[f].position.x;f=a.vertices[f].position.y;c=a.vertices[e].position.x;e=a.vertices[e].position.y;return[new THREE.UV(a.vertices[d].position.x,1-a.vertices[d].position.y),new THREE.UV(b,1-f),new THREE.UV(c,1-e)]},generateBottomUV:function(a,b,c,d,f,e){return this.generateTopUV(a,b,c,d,f,e)},generateSideWallUV:function(a,b,c,d,f,e,g,h){var b=a.vertices[f].position.x,c=a.vertices[f].position.y,f=a.vertices[f].position.z,
-d=a.vertices[e].position.x,i=a.vertices[e].position.y,e=a.vertices[e].position.z,j=a.vertices[g].position.x,k=a.vertices[g].position.y,g=a.vertices[g].position.z,q=a.vertices[h].position.x,l=a.vertices[h].position.y,a=a.vertices[h].position.z;return Math.abs(c-i)<0.01?[new THREE.UV(b,f),new THREE.UV(d,e),new THREE.UV(j,g),new THREE.UV(q,a)]:[new THREE.UV(c,f),new THREE.UV(i,e),new THREE.UV(k,g),new THREE.UV(l,a)]}};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;THREE.ExtrudeGeometry.__v2=new THREE.Vector2;
-THREE.ExtrudeGeometry.__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(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(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-
+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,i=a.vertices[e].y,e=a.vertices[e].z,j=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-i)<0.01?[new THREE.UV(b,f),new THREE.UV(d,e),new THREE.UV(j,g),new THREE.UV(q,a)]:[new THREE.UV(c,f),new THREE.UV(i,e),new THREE.UV(k,g),new THREE.UV(l,a)]}};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;THREE.ExtrudeGeometry.__v2=new THREE.Vector2;THREE.ExtrudeGeometry.__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,i=a/c,j=b/d,k=new THREE.Vector3(0,1,0),a=0;a<h;a++)for(b=0;b<g;b++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(b*i-f,0,a*j-e)));for(a=0;a<d;a++)for(b=0;b<c;b++){f=new THREE.Face4(b+g*a,b+g*(a+1),b+1+g*(a+1),b+1+g*a);f.normal.copy(k);f.vertexNormals.push(k.clone(),k.clone(),k.clone(),k.clone());this.faces.push(f);this.faceVertexUvs[0].push([new THREE.UV(b/c,a/d),new THREE.UV(b/c,
-(a+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,i,j=[],k=[];for(i=0;i<=c;i++){var q=[],l=[];for(h=0;h<=b;h++){var n=h/b,r=i/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(new THREE.Vector3(m,p,t)));q.push(this.vertices.length-1);l.push(new THREE.UV(n,
-r))}j.push(q);k.push(l)}for(i=0;i<c;i++)for(h=0;h<b;h++){var d=j[i][h+1],f=j[i][h],e=j[i+1][h],g=j[i+1][h+1],q=this.vertices[d].position.clone().normalize(),l=this.vertices[f].position.clone().normalize(),n=this.vertices[e].position.clone().normalize(),r=this.vertices[g].position.clone().normalize(),m=k[i][h+1].clone(),p=k[i][h].clone(),t=k[i+1][h].clone(),s=k[i+1][h+1].clone();if(Math.abs(this.vertices[d].position.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].position.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.PlaneGeometry=function(a,b,c,d){THREE.Geometry.call(this);for(var f=a/2,e=b/2,c=c||1,d=d||1,g=c+1,h=d+1,i=a/c,j=b/d,k=new THREE.Vector3(0,1,0),a=0;a<h;a++)for(b=0;b<g;b++)this.vertices.push(new THREE.Vertex(b*i-f,0,a*j-e));for(a=0;a<d;a++)for(b=0;b<c;b++){f=new THREE.Face4(b+g*a,b+g*(a+1),b+1+g*(a+1),b+1+g*a);f.normal.copy(k);f.vertexNormals.push(k.clone(),k.clone(),k.clone(),k.clone());this.faces.push(f);this.faceVertexUvs[0].push([new THREE.UV(b/c,a/d),new THREE.UV(b/c,(a+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,i,j=[],k=[];for(i=0;i<=c;i++){var q=[],l=[];for(h=0;h<=b;h++){var n=h/b,r=i/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))}j.push(q);
+k.push(l)}for(i=0;i<c;i++)for(h=0;h<b;h++){var d=j[i][h+1],f=j[i][h],e=j[i+1][h],g=j[i+1][h+1],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[i][h+1].clone(),p=k[i][h].clone(),t=k[i+1][h].clone(),s=k[i+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.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=
@@ -207,46 +206,45 @@ m,i);s=THREE.Shape.Utils.b3(s,l,r,p,k);e.push(new THREE.Vector2(v,s))}}}}}return
 (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=[],i,j,k;if(b(a)>0)for(j=0;j<f;j++)g[j]=j;else for(j=0;j<f;j++)g[j]=f-1-j;var q=2*f;for(j=f-1;f>2;){if(q--<=0){console.log("Warning, unable to triangulate polygon!");break}i=j;f<=i&&(i=0);j=i+1;f<=j&&(j=0);k=j+1;f<=k&&(k=0);var l;a:{l=a;var n=i,r=j,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[i]],
 a[g[j]],a[g[k]]]);h.push([g[i],g[j],g[k]]);i=j;for(k=j+1;k<f;i++,k++)g[i]=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.Vector3;h.x=(this.radius+this.tube*Math.cos(g))*Math.cos(e);h.y=(this.radius+this.tube*Math.cos(g))*Math.sin(e);h.z=
-this.tube*Math.sin(g);this.vertices.push(new THREE.Vertex(h));a.push(new THREE.UV(d/this.segmentsT,1-c/this.segmentsR));b.push(h.clone().subSelf(f).normalize())}for(c=1;c<=this.segmentsR;c++)for(d=1;d<=this.segmentsT;d++){var f=(this.segmentsT+1)*c+d-1,e=(this.segmentsT+1)*(c-1)+d-1,g=(this.segmentsT+1)*(c-1)+d,h=(this.segmentsT+1)*c+d,i=new THREE.Face4(f,e,g,h,[b[f],b[e],b[g],b[h]]);i.normal.addSelf(b[f]);i.normal.addSelf(b[e]);i.normal.addSelf(b[g]);i.normal.addSelf(b[h]);i.normal.normalize();this.faces.push(i);
+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=
+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,i=new THREE.Face4(f,e,g,h,[b[f],b[e],b[g],b[h]]);i.normal.addSelf(b[f]);i.normal.addSelf(b[e]);i.normal.addSelf(b[g]);i.normal.addSelf(b[h]);i.normal.normalize();this.faces.push(i);
 this.faceVertexUvs[0].push([a[f].clone(),a[e].clone(),a[g].clone(),a[h].clone()])}this.computeCentroids()};THREE.TorusGeometry.prototype=new THREE.Geometry;THREE.TorusGeometry.prototype.constructor=THREE.TorusGeometry;
 THREE.TorusKnotGeometry=function(a,b,c,d,f,e,g){function h(a,b,c,d,e,f){var g=Math.cos(a);Math.cos(b);b=Math.sin(a);a=c/d*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 i=a/this.segmentsR*2*this.p*Math.PI,g=b/this.segmentsT*2*Math.PI,e=h(i,g,this.q,this.p,this.radius,this.heightScale),i=h(i+0.01,g,this.q,this.p,this.radius,this.heightScale);c.sub(i,e);d.add(i,e);f.cross(c,d);d.cross(f,c);f.normalize();d.normalize();i=-this.tube*Math.cos(g);g=this.tube*Math.sin(g);e.x=e.x+(i*d.x+g*f.x);e.y=e.y+(i*d.y+g*f.y);e.z=e.z+(i*d.z+g*f.z);this.grid[a][b]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(e.x,e.y,e.z)))-
-1}}for(a=0;a<this.segmentsR;++a)for(b=0;b<this.segmentsT;++b){var f=(a+1)%this.segmentsR,e=(b+1)%this.segmentsT,c=this.grid[a][b],d=this.grid[f][b],f=this.grid[f][e],e=this.grid[a][e],g=new THREE.UV(a/this.segmentsR,b/this.segmentsT),i=new THREE.UV((a+1)/this.segmentsR,b/this.segmentsT),j=new THREE.UV((a+1)/this.segmentsR,(b+1)/this.segmentsT),k=new THREE.UV(a/this.segmentsR,(b+1)/this.segmentsT);this.faces.push(new THREE.Face4(c,d,f,e));this.faceVertexUvs[0].push([g,i,j,k])}this.computeCentroids();
-this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusKnotGeometry.prototype=new THREE.Geometry;THREE.TorusKnotGeometry.prototype.constructor=THREE.TorusKnotGeometry;
+Array(this.segmentsT);for(b=0;b<this.segmentsT;++b){var i=a/this.segmentsR*2*this.p*Math.PI,g=b/this.segmentsT*2*Math.PI,e=h(i,g,this.q,this.p,this.radius,this.heightScale),i=h(i+0.01,g,this.q,this.p,this.radius,this.heightScale);c.sub(i,e);d.add(i,e);f.cross(c,d);d.cross(f,c);f.normalize();d.normalize();i=-this.tube*Math.cos(g);g=this.tube*Math.sin(g);e.x=e.x+(i*d.x+g*f.x);e.y=e.y+(i*d.y+g*f.y);e.z=e.z+(i*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),i=new THREE.UV((a+1)/this.segmentsR,b/this.segmentsT),j=new THREE.UV((a+1)/this.segmentsR,(b+1)/this.segmentsT),k=new THREE.UV(a/this.segmentsR,(b+1)/this.segmentsT);this.faces.push(new THREE.Face4(c,d,f,e));this.faceVertexUvs[0].push([g,i,j,k])}this.computeCentroids();this.computeFaceNormals();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,i,j,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++){i=d/this.segmentsRadius*2*Math.PI;j=-this.radius*Math.cos(i);i=this.radius*Math.sin(i);q.copy(k);q.x=q.x+(j*g.x+i*h.x);q.y=q.y+(j*g.y+i*h.y);q.z=q.z+(j*g.z+i*h.z);this.grid[b][d]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(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;
+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++){i=d/this.segmentsRadius*2*Math.PI;j=-this.radius*Math.cos(i);i=this.radius*Math.sin(i);q.copy(k);q.x=q.x+(j*g.x+i*h.x);q.y=q.y+(j*g.y+i*h.y);q.z=q.z+(j*g.z+i*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;
 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,i=new THREE.Matrix4,b=b+1,j,k,q;this.tangents=f;this.normals=e;this.binormals=g;for(j=0;j<b;j++){k=j/(b-1);f[j]=a.getTangentAt(k);f[j].normalize()}e[0]=new THREE.Vector3;g[0]=new THREE.Vector3;a=Number.MAX_VALUE;j=Math.abs(f[0].x);k=Math.abs(f[0].y);q=Math.abs(f[0].z);if(j<=a){a=j;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();
 e[0].cross(f[0],h);g[0].cross(f[0],e[0]);for(j=1;j<b;j++){e[j]=e[j-1].clone();g[j]=g[j-1].clone();h.cross(f[j-1],f[j]);if(h.length()>1.0E-4){h.normalize();d=Math.acos(f[j-1].dot(f[j]));i.makeRotationAxis(h,d).multiplyVector3(e[j])}g[j].cross(f[j],e[j])}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(j=1;j<b;j++){i.makeRotationAxis(f[j],d*j).multiplyVector3(e[j]);g[j].cross(f[j],e[j])}}};
-THREE.PolyhedronGeometry=function(a,b,c,d){function f(a){var b=new THREE.Vertex(a.normalize());b.index=i.vertices.push(b)-1;var c=Math.atan2(a.z,-a.x)/2/Math.PI+0.5,a=Math.atan2(-a.y,Math.sqrt(a.x*a.x+a.z*a.z))/Math.PI+0.5;b.uv=new THREE.UV(c,a);return b}function e(a,b,c,d){if(d<1){d=new THREE.Face3(a.index,b.index,c.index,[a.position.clone(),b.position.clone(),c.position.clone()]);d.centroid.addSelf(a.position).addSelf(b.position).addSelf(c.position).divideScalar(3);d.normal=d.centroid.clone().normalize();
-i.faces.push(d);d=Math.atan2(d.centroid.z,-d.centroid.x);i.faceVertexUvs[0].push([h(a.uv,a.position,d),h(b.uv,b.position,d),h(c.uv,c.position,d)])}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.position,b.position).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,i=this,j=0,k=a.length;j<k;j++)f(new THREE.Vector3(a[j][0],a[j][1],a[j][2]));for(var q=[],a=this.vertices,j=0,k=b.length;j<k;j++)e(a[b[j][0]],a[b[j][1]],a[b[j][2]],d);this.mergeVertices();j=0;for(k=this.vertices.length;j<k;j++)this.vertices[j].position.multiplyScalar(c);this.computeCentroids();this.boundingSphere={radius:c}};
-THREE.PolyhedronGeometry.prototype=new THREE.Geometry;THREE.PolyhedronGeometry.prototype.constructor=THREE.PolyhedronGeometry;
+THREE.PolyhedronGeometry=function(a,b,c,d){function f(a){var b=(new THREE.Vertex).copy(a.normalize());b.index=i.vertices.push(b)-1;var c=Math.atan2(a.z,-a.x)/2/Math.PI+0.5,a=Math.atan2(-a.y,Math.sqrt(a.x*a.x+a.z*a.z))/Math.PI+0.5;b.uv=new THREE.UV(c,a);return b}function e(a,b,c,d){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();i.faces.push(d);d=Math.atan2(d.centroid.z,
+-d.centroid.x);i.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,i=this,j=0,k=a.length;j<k;j++)f(new THREE.Vector3(a[j][0],a[j][1],a[j][2]));for(var q=[],a=this.vertices,j=0,k=b.length;j<k;j++)e(a[b[j][0]],a[b[j][1]],a[b[j][2]],d);this.mergeVertices();j=0;for(k=this.vertices.length;j<k;j++)this.vertices[j].multiplyScalar(c);this.computeCentroids();this.boundingSphere={radius:c}};THREE.PolyhedronGeometry.prototype=new THREE.Geometry;THREE.PolyhedronGeometry.prototype.constructor=THREE.PolyhedronGeometry;
 THREE.IcosahedronGeometry=function(a,b){var c=(1+Math.sqrt(5))/2;THREE.PolyhedronGeometry.call(this,[[-1,c,0],[1,c,0],[-1,-c,0],[1,-c,0],[0,-1,c],[0,1,c],[0,-1,-c],[0,1,-c],[c,0,-1],[c,0,1],[-c,0,-1],[-c,0,1]],[[0,11,5],[0,5,1],[0,1,7],[0,7,10],[0,10,11],[1,5,9],[5,11,4],[11,10,2],[10,7,6],[7,1,8],[3,9,4],[3,4,2],[3,2,6],[3,6,8],[3,8,9],[4,9,5],[2,4,11],[6,2,10],[8,6,7],[9,8,1]],a,b)};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;
 THREE.OctahedronGeometry=function(a,b){THREE.PolyhedronGeometry.call(this,[[1,0,0],[-1,0,0],[0,1,0],[0,-1,0],[0,0,1],[0,0,-1]],[[0,2,4],[0,4,3],[0,3,5],[0,5,2],[1,2,5],[1,5,3],[1,3,4],[1,4,2]],a,b)};THREE.OctahedronGeometry.prototype=new THREE.Geometry;THREE.OctahedronGeometry.prototype.constructor=THREE.OctahedronGeometry;THREE.TetrahedronGeometry=function(a,b){THREE.PolyhedronGeometry.call(this,[[1,1,1],[-1,-1,1],[-1,1,-1],[1,-1,-1]],[[2,1,0],[0,3,2],[1,3,0],[2,3,1]],a,b)};
 THREE.TetrahedronGeometry.prototype=new THREE.Geometry;THREE.TetrahedronGeometry.prototype.constructor=THREE.TetrahedronGeometry;
-THREE.AxisHelper=function(){THREE.Object3D.call(this);var a=new THREE.Geometry;a.vertices.push(new THREE.Vertex);a.vertices.push(new THREE.Vertex(new THREE.Vector3(0,100,0)));var b=new THREE.CylinderGeometry(0,5,25,5,1),c;c=new THREE.Line(a,new THREE.LineBasicMaterial({color:16711680}));c.rotation.z=-Math.PI/2;this.add(c);c=new THREE.Mesh(b,new THREE.MeshBasicMaterial({color:16711680}));c.position.x=100;c.rotation.z=-Math.PI/2;this.add(c);c=new THREE.Line(a,new THREE.LineBasicMaterial({color:65280}));
-this.add(c);c=new THREE.Mesh(b,new THREE.MeshBasicMaterial({color:65280}));c.position.y=100;this.add(c);c=new THREE.Line(a,new THREE.LineBasicMaterial({color:255}));c.rotation.x=Math.PI/2;this.add(c);c=new THREE.Mesh(b,new THREE.MeshBasicMaterial({color:255}));c.position.z=100;c.rotation.x=Math.PI/2;this.add(c)};THREE.AxisHelper.prototype=new THREE.Object3D;THREE.AxisHelper.prototype.constructor=THREE.AxisHelper;
-THREE.ArrowHelper=function(a,b,c,d){THREE.Object3D.call(this);d===void 0&&(d=16776960);c===void 0&&(c=20);var f=new THREE.Geometry;f.vertices.push(new THREE.Vertex(new THREE.Vector3(0,0,0)));f.vertices.push(new THREE.Vertex(new THREE.Vector3(0,1,0)));this.line=new THREE.Line(f,new THREE.LineBasicMaterial({color:d}));this.add(this.line);f=new THREE.CylinderGeometry(0,0.05,0.25,5,1);this.cone=new THREE.Mesh(f,new THREE.MeshBasicMaterial({color:d}));this.cone.position.set(0,1,0);this.add(this.cone);
-if(b instanceof THREE.Vector3)this.position=b;this.setDirection(a);this.setLength(c)};THREE.ArrowHelper.prototype=new THREE.Object3D;THREE.ArrowHelper.prototype.constructor=THREE.ArrowHelper;THREE.ArrowHelper.prototype.setDirection=function(a){var b=(new THREE.Vector3(0,1,0)).crossSelf(a),a=Math.acos((new THREE.Vector3(0,1,0)).dot(a.clone().normalize()));this.matrix=(new THREE.Matrix4).makeRotationAxis(b.normalize(),a);this.rotation.getRotationFromMatrix(this.matrix,this.scale)};
+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=
+b;this.setDirection(a);this.setLength(c)};THREE.ArrowHelper.prototype=new THREE.Object3D;THREE.ArrowHelper.prototype.constructor=THREE.ArrowHelper;THREE.ArrowHelper.prototype.setDirection=function(a){var b=(new THREE.Vector3(0,1,0)).crossSelf(a),a=Math.acos((new THREE.Vector3(0,1,0)).dot(a.clone().normalize()));this.matrix=(new THREE.Matrix4).makeRotationAxis(b.normalize(),a);this.rotation.getRotationFromMatrix(this.matrix,this.scale)};
 THREE.ArrowHelper.prototype.setLength=function(a){this.scale.set(a,a,a)};THREE.ArrowHelper.prototype.setColor=function(a){this.line.material.color.setHex(a);this.cone.material.color.setHex(a)};
-THREE.CameraHelper=function(a){function b(a,b,d){c(a,d);c(b,d)}function c(a,b){d.lineGeometry.vertices.push(new THREE.Vertex(new THREE.Vector3));d.lineGeometry.colors.push(new THREE.Color(b));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]].position.copy(THREE.CameraHelper.__v)}}var b=this;THREE.CameraHelper.__c.projectionMatrix.copy(this.camera.projectionMatrix);a("c",0,0,-1);a("t",0,0,1);a("n1",-1,-1,-1);a("n2",1,-1,-1);a("n3",-1,1,-1);a("n4",1,1,-1);a("f1",
--1,-1,1);a("f2",1,-1,1);a("f3",-1,1,1);a("f4",1,1,1);a("u1",0.7,1.1,-1);a("u2",-0.7,1.1,-1);a("u3",0,2,-1);a("cf1",-1,0,1);a("cf2",1,0,1);a("cf3",0,-1,1);a("cf4",0,1,1);a("cn1",-1,0,-1);a("cn2",1,0,-1);a("cn3",0,-1,-1);a("cn4",0,1,-1);this.lineGeometry.__dirtyVertices=true};THREE.CameraHelper.__projector=new THREE.Projector;THREE.CameraHelper.__v=new THREE.Vector3;THREE.CameraHelper.__c=new THREE.Camera;
+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",
+"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 i(a,b,c){C[a]===void 0&&(C[a]={});C[a][b]=c}var j=[],k=[],q=[],l=this,n=a.vertices,r=a.faces,j=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);j.push(new THREE.Vertex(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];i(I,u,o);i(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].position);w.addSelf(n[H].position);w.multiplyScalar(0.5)}else{w.addSelf(m[u]);w.addSelf(m[z]);w.addSelf(n[I].position);w.addSelf(n[H].position);w.multiplyScalar(0.25)}p[o]=v+r.length+E;j.push(new THREE.Vertex(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]].position.clone().addSelf(n[w[1]].position).divideScalar(2);
-u.addSelf(w)}u.divideScalar(E);I.addSelf(n[o].position);I.multiplyScalar(E-3);I.addSelf(p);I.addSelf(u.multiplyScalar(2));I.divideScalar(E);j[o].position=I}}a.vertices=j;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(){}};
+s,"vs",w.length);o=0;for(x=r.length;o<x;o++){u=r[o];m.push(u.centroid);j.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];i(I,u,o);i(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;j.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);j[o]=I}}a.vertices=j;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.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=
@@ -264,63 +262,63 @@ k));g.push(m)}}function w(b,c){var d,e,f,g,h,j,i,k,l,m,q=new Uint32Array(a,c,4*b
 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,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 q=B[k*3],n=B[k*3+1];k=B[k*3+2];var p=B[l*3],
 r=B[l*3+1];l=B[l*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,l)],null,j))}}function J(b,c,d,e){for(var f,g,h,j,i,k,l,m,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];l=d[e*4+1];m=d[e*4+2];q=d[e*4+3];i=n[e];var p=B[l*3],r=B[l*3+1];l=B[l*3+2];var o=B[m*3],t=B[m*3+1];m=B[m*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,l),new THREE.Vector3(o,t,m),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);i=y(a,A+17);j=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+i*3);f=m*(c+j*3);k=p*(c+i*3+j*3);c=t*F;i=s*(F+i*4);j=v*(F+j*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(new THREE.Vector3(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);i=c+i+x(s*2);j=i+j+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)}})(i);(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)}})(j);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*
+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+i*3);f=m*(c+j*3);k=p*(c+i*3+j*3);c=t*F;i=s*(F+i*4);j=v*(F+j*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);i=c+i+x(s*2);j=i+j+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)}})(i);(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)}})(j);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.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");
 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),l,m,g=new THREE.Vector3,q,i=0;i<a.vertices.length;i++)f.skin.bindShapeMatrix.multiplyVector3(a.vertices[i].position);
-for(c=0;c<e;c++){h=[];j=[];for(i=0;i<a.vertices.length;i++)j.push(new THREE.Vertex(new THREE.Vector3));d(b,h,c);i=h;k=f.skin;for(m=0;m<i.length;m++){l=i[m];q=-1;if(l.type=="JOINT"){for(var n=0;n<k.joints.length;n++)if(l.sid==k.joints[n]){q=n;break}if(q>=0){n=k.invBindMatrices[q];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 p=0;p<k.weights[n].length;p++){var r=k.weights[n][p];r.joint==q&&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;q=a.vertices[m];m=j[m];g.x=q.position.x;g.y=q.position.y;g.z=q.position.z;h[i].skinningMatrix.multiplyVector3(g);m.position.x=m.position.x+g.x*l;m.position.y=m.position.y+g.y*l;m.position.z=m.position.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=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 i(){this.weights=this.targets=this.source=this.method=null}function j(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function k(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function 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)?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 j).parse(c);this.type=c.nodeName;break;case "morph":this.morph=(new i).parse(c);this.type=c.nodeName}}return this};i.prototype.parse=function(a){var b={},c=[],d;this.method=a.getAttribute("method");this.source=a.getAttribute("source").replace(/^#/,"");for(d=0;d<a.childNodes.length;d++){var e=a.childNodes[d];if(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=e.read();break;case "MORPH_WEIGHT":this.weights=e.read()}}return this};i.prototype.parseInputs=function(a){for(var b=[],c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "input":b.push((new z).parse(d))}}return b};j.prototype.parse=function(a){var b={},c,d;this.source=a.getAttribute("source").replace(/^#/,"");this.invBindMatrices=[];this.joints=[];this.weights=[];
-for(var 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};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 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()}}};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 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],j=[],i=0;i<h;i++){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]}}j.push(k);g=g+e.length}for(i=0;i<j.length;i++)j[i].index=f;this.weights.push(j)}};k.prototype.getChildById=function(a,b){for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildById(a,b);if(d)return d}return null};k.prototype.getChildBySid=function(a,b){for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildBySid(a,b);if(d)return d}return null};k.prototype.parse=function(a){this.id=
-a.getAttribute("id");this.name=a.getAttribute("name");this.nodes=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(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));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=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(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]=
+!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,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(m=0;m<i.length;m++){l=i[m];q=-1;if(l.type=="JOINT"){for(var n=0;n<k.joints.length;n++)if(l.sid==k.joints[n]){q=n;break}if(q>=0){n=k.invBindMatrices[q];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 p=0;p<k.weights[n].length;p++){var r=k.weights[n][p];r.joint==q&&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;q=a.vertices[m];m=j[m];g.x=q.x;g.y=q.y;g.z=q.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=
+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 i(){this.weights=this.targets=this.source=this.method=
+null}function j(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function k(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function 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)?
+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 j).parse(c);this.type=c.nodeName;break;
+case "morph":this.morph=(new i).parse(c);this.type=c.nodeName}}return this};i.prototype.parse=function(a){var b={},c=[],d;this.method=a.getAttribute("method");this.source=a.getAttribute("source").replace(/^#/,"");for(d=0;d<a.childNodes.length;d++){var e=a.childNodes[d];if(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=
+e.read();break;case "MORPH_WEIGHT":this.weights=e.read()}}return this};i.prototype.parseInputs=function(a){for(var b=[],c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "input":b.push((new z).parse(d))}}return b};j.prototype.parse=function(a){var b={},c,d;this.source=a.getAttribute("source").replace(/^#/,"");this.invBindMatrices=[];this.joints=[];this.weights=[];for(var 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};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 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()}}};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 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],j=[],i=0;i<h;i++){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]}}j.push(k);g=g+e.length}for(i=
+0;i<j.length;i++)j[i].index=f;this.weights.push(j)}};k.prototype.getChildById=function(a,b){for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildById(a,b);if(d)return d}return null};k.prototype.getChildBySid=function(a,b){for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildBySid(a,b);if(d)return d}return null};k.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.nodes=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];
+if(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));
+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=
+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();
@@ -342,11 +340,11 @@ g.textContent}}else if(this.technique=="orthographic"){e=c.childNodes[d];for(f=0
 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,i,j,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]=[]}j=0;for(k=q.length;j<k;){l=new THREE.Vertex;l.position.x=q[j++]*b;l.position.y=q[j++]*b;l.position.z=q[j++]*b;d.vertices.push(l)}j=0;for(k=o.length;j<k;){b=
-o[j++];q=b&1;i=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[j++];p.b=o[j++];p.c=o[j++];p.d=o[j++];q=4}else{p=new THREE.Face3;p.a=o[j++];p.b=o[j++];p.c=o[j++];q=3}if(i){i=o[j++];p.materialIndex=i}i=d.faces.length;if(c)for(c=0;c<z;c++){t=a.uvs[c];r=o[j++];v=t[r*2];r=t[r*2+1];d.faceUvs[c][i]=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[j++];v=t[r*2];r=t[r*2+1];s[f]=new THREE.UV(v,r)}d.faceVertexUvs[c][i]=s}if(n){n=o[j++]*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[j++]*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[j++];l=new THREE.Color(y[l]);p.color=l}if(b)for(c=0;c<q;c++){l=o[j++];l=new THREE.Color(y[l]);p.vertexColors.push(l)}d.faces.push(p)}})(f);(function(){var b,c,f,i;if(a.skinWeights){b=0;for(c=a.skinWeights.length;b<c;b=b+2){f=a.skinWeights[b];i=a.skinWeights[b+1];d.skinWeights.push(new THREE.Vector4(f,i,0,0))}}if(a.skinIndices){b=0;for(c=a.skinIndices.length;b<
-c;b=b+2){f=a.skinIndices[b];i=a.skinIndices[b+1];d.skinIndices.push(new THREE.Vector4(f,i,0,0))}}d.bones=a.bones;d.animation=a.animation})();(function(b){if(a.morphTargets!==void 0){var c,f,i,j,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;i=0;for(j=r.length;i<j;i=i+3){k=r[i]*b;q=r[i+1]*b;l=r[i+2]*b;n.push(new THREE.Vertex(new THREE.Vector3(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=[];j=d.morphColors[c].colors;k=a.morphColors[c].colors;b=0;for(i=k.length;b<i;b=b+3){q=new THREE.Color(16755200);q.setRGB(k[b],k[b+1],k[b+2]);j.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,i,j,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]=[]}j=0;for(k=q.length;j<k;){l=new THREE.Vertex;l.x=q[j++]*b;l.y=q[j++]*b;l.z=q[j++]*b;d.vertices.push(l)}j=0;for(k=o.length;j<k;){b=o[j++];q=b&1;i=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[j++];p.b=o[j++];p.c=o[j++];p.d=o[j++];q=4}else{p=new THREE.Face3;p.a=o[j++];p.b=o[j++];p.c=o[j++];q=3}if(i){i=o[j++];p.materialIndex=i}i=d.faces.length;if(c)for(c=0;c<z;c++){t=a.uvs[c];r=o[j++];v=t[r*2];r=t[r*2+1];d.faceUvs[c][i]=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[j++];v=t[r*2];r=t[r*2+1];s[f]=new THREE.UV(v,r)}d.faceVertexUvs[c][i]=s}if(n){n=o[j++]*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[j++]*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[j++];l=new THREE.Color(y[l]);p.color=l}if(b)for(c=0;c<q;c++){l=o[j++];l=new THREE.Color(y[l]);p.vertexColors.push(l)}d.faces.push(p)}})(f);(function(){var b,c,f,i;if(a.skinWeights){b=0;for(c=a.skinWeights.length;b<c;b=b+2){f=a.skinWeights[b];i=a.skinWeights[b+1];d.skinWeights.push(new THREE.Vector4(f,i,0,0))}}if(a.skinIndices){b=0;for(c=a.skinIndices.length;b<c;b=
+b+2){f=a.skinIndices[b];i=a.skinIndices[b+1];d.skinIndices.push(new THREE.Vector4(f,i,0,0))}}d.bones=a.bones;d.animation=a.animation})();(function(b){if(a.morphTargets!==void 0){var c,f,i,j,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;i=0;for(j=r.length;i<j;i=i+3){k=r[i]*b;q=r[i+1]*b;l=r[i+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=[];j=d.morphColors[c].colors;k=a.morphColors[c].colors;b=0;for(i=k.length;b<i;b=b+3){q=new THREE.Color(16755200);q.setRGB(k[b],k[b+1],k[b+2]);j.push(q)}}}})(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:j+"/"+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,
@@ -365,9 +363,9 @@ m=p.parameters.color;J=p.parameters.specular;c=p.parameters.ambient;A=p.paramete
 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();i.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),j=[],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(new THREE.Vector3(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;j.push(d,e,f)}})(g[0],8,5);(function(a){var c,d,e,f,g,i,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;i=f;var y=j[e*3],z=j[e*3+1],u=j[e*3+2],w=j[f*3],E=j[f*3+1],H=j[f*3+2];s=new THREE.Vector3(j[d*3],j[d*3+1],j[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,i,[s,y,w],null,0));g=k[d*2];d=k[d*2+1];i=k[e*
-2];s=k[e*2+1];v=k[f*2];o=k[f*2+1];f=b.faceVertexUvs[0];e=i;i=s;s=[];s.push(new THREE.UV(g,d));s.push(new THREE.UV(e,i));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),j=[],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;j.push(d,e,f)}})(g[0],8,5);(function(a){var c,d,e,f,g,i,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;i=f;var y=j[e*3],z=j[e*3+1],u=j[e*3+2],w=j[f*3],E=j[f*3+1],H=j[f*3+2];s=new THREE.Vector3(j[d*3],j[d*3+1],j[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,i,[s,y,w],null,0));g=k[d*2];d=k[d*2+1];i=k[e*2];s=k[e*2+1];v=
+k[f*2];o=k[f*2+1];f=b.faceVertexUvs[0];e=i;i=s;s=[];s.push(new THREE.UV(g,d));s.push(new THREE.UV(e,i));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.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}};

+ 21 - 21
build/custom/ThreeSVG.js

@@ -8,7 +8,7 @@ Math.floor(a);this.r=(a>>16&255)/255;this.g=(a>>8&255)/255;this.b=(a&255)/255;re
 THREE.Vector2=function(a,b){this.x=a||0;this.y=b||0};
 THREE.Vector2.prototype={constructor:THREE.Vector2,set:function(a,b){this.x=a;this.y=b;return this},copy:function(a){this.x=a.x;this.y=a.y;return this},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;return this},addSelf:function(a){this.x=this.x+a.x;this.y=this.y+a.y;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;return this},subSelf:function(a){this.x=this.x-a.x;this.y=this.y-a.y;return this},multiplyScalar:function(a){this.x=this.x*a;this.y=this.y*a;return this},divideScalar:function(a){if(a){this.x=
 this.x/a;this.y=this.y/a}else this.set(0,0);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.lengthSq())},normalize:function(){return this.divideScalar(this.length())},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var b=this.x-a.x,a=this.y-a.y;return b*b+a*a},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;return this},equals:function(a){return a.x===this.x&&a.y===this.y},isZero:function(){return this.lengthSq()<1.0E-4},clone:function(){return new THREE.Vector2(this.x,this.y)}};THREE.Vector3=function(a,b,c){this.x=a||0;this.y=b||0;this.z=c||0};
+lerpSelf:function(a,b){this.x=this.x+(a.x-this.x)*b;this.y=this.y+(a.y-this.y)*b;return this},equals:function(a){return a.x===this.x&&a.y===this.y},isZero:function(){return this.lengthSq()<1.0E-4},clone:function(){return new THREE.Vector2(this.x,this.y)}};THREE.Vector3=function(a,b,c){a instanceof THREE.Vector3&&console.warn("OPS!");this.x=a||0;this.y=b||0;this.z=c||0};
 THREE.Vector3.prototype={constructor:THREE.Vector3,set:function(a,b,c){this.x=a;this.y=b;this.z=c;return this},setX:function(a){this.x=a;return this},setY:function(a){this.y=a;return this},setZ:function(a){this.z=a;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;return this},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;return this},addSelf:function(a){this.x=this.x+a.x;this.y=this.y+a.y;this.z=this.z+a.z;return this},addScalar:function(a){this.x=this.x+a;this.y=this.y+
 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())},
@@ -23,8 +23,8 @@ THREE.Frustum.prototype.contains=function(a){for(var b=this.planes,c=a.matrixWor
 THREE.Ray=function(a,b){function c(a,b,c){o.sub(c,a);H=o.dot(b);w=p.add(a,u.copy(b).multiplyScalar(H));return D=c.distanceTo(w)}function d(a,b,c,d){o.sub(d,b);p.sub(c,b);u.sub(a,b);s=o.dot(o);t=o.dot(p);y=o.dot(u);x=p.dot(p);z=p.dot(u);E=1/(s*x-t*t);B=(x*y-t*z)*E;F=(s*z-t*y)*E;return B>=0&&F>=0&&B+F<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,i=new THREE.Vector3,j=new THREE.Vector3,
 h=new THREE.Vector3,k=new THREE.Vector3,m=new THREE.Vector3,n=new THREE.Vector3,l=new THREE.Vector3;this.intersectObject=function(a){var b,o=[];if(a instanceof THREE.Particle){var p=c(this.origin,this.direction,a.matrixWorld.getPosition());if(p>a.scale.x)return[];b={distance:p,point:a.position,face:null,object:a};o.push(b)}else if(a instanceof THREE.Mesh){var p=c(this.origin,this.direction,a.matrixWorld.getPosition()),N=THREE.Frustum.__v1.set(a.matrixWorld.getColumnX().length(),a.matrixWorld.getColumnY().length(),
 a.matrixWorld.getColumnZ().length());if(p>a.geometry.boundingSphere.radius*Math.max(N.x,Math.max(N.y,N.z)))return o;var s,t,u=a.geometry,r=u.vertices,q;a.matrixRotationWorld.extractRotation(a.matrixWorld);p=0;for(N=u.faces.length;p<N;p++){b=u.faces[p];h.copy(this.origin);k.copy(this.direction);q=a.matrixWorld;m=q.multiplyVector3(m.copy(b.centroid)).subSelf(h);n=a.matrixRotationWorld.multiplyVector3(n.copy(b.normal));s=k.dot(n);if(!(Math.abs(s)<e)){t=n.dot(m)/s;if(!(t<0)&&(a.doubleSided||(a.flipSided?
-s>0:s<0))){l.add(h,k.multiplyScalar(t));if(b instanceof THREE.Face3){f=q.multiplyVector3(f.copy(r[b.a].position));g=q.multiplyVector3(g.copy(r[b.b].position));i=q.multiplyVector3(i.copy(r[b.c].position));if(d(l,f,g,i)){b={distance:h.distanceTo(l),point:l.clone(),face:b,object:a};o.push(b)}}else if(b instanceof THREE.Face4){f=q.multiplyVector3(f.copy(r[b.a].position));g=q.multiplyVector3(g.copy(r[b.b].position));i=q.multiplyVector3(i.copy(r[b.c].position));j=q.multiplyVector3(j.copy(r[b.d].position));
-if(d(l,f,g,j)||d(l,g,i,j)){b={distance:h.distanceTo(l),point:l.clone(),face:b,object:a};o.push(b)}}}}}}return o};this.intersectObjects=function(a){for(var b=[],c=0,d=a.length;c<d;c++)Array.prototype.push.apply(b,this.intersectObject(a[c]));b.sort(function(a,b){return a.distance-b.distance});return b};var o=new THREE.Vector3,p=new THREE.Vector3,u=new THREE.Vector3,H,w,D,s,t,y,x,z,E,B,F};
+s>0:s<0))){l.add(h,k.multiplyScalar(t));if(b instanceof THREE.Face3){f=q.multiplyVector3(f.copy(r[b.a]));g=q.multiplyVector3(g.copy(r[b.b]));i=q.multiplyVector3(i.copy(r[b.c]));if(d(l,f,g,i)){b={distance:h.distanceTo(l),point:l.clone(),face:b,object:a};o.push(b)}}else if(b instanceof THREE.Face4){f=q.multiplyVector3(f.copy(r[b.a]));g=q.multiplyVector3(g.copy(r[b.b]));i=q.multiplyVector3(i.copy(r[b.c]));j=q.multiplyVector3(j.copy(r[b.d]));if(d(l,f,g,j)||d(l,g,i,j)){b={distance:h.distanceTo(l),point:l.clone(),
+face:b,object:a};o.push(b)}}}}}}return o};this.intersectObjects=function(a){for(var b=[],c=0,d=a.length;c<d;c++)Array.prototype.push.apply(b,this.intersectObject(a[c]));b.sort(function(a,b){return a.distance-b.distance});return b};var o=new THREE.Vector3,p=new THREE.Vector3,u=new THREE.Vector3,H,w,D,s,t,y,x,z,E,B,F};
 THREE.Rectangle=function(){function a(){f=d-b;g=e-c}var b,c,d,e,f,g,i=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,h,g,m){i=false;b=f;c=h;d=g;e=m;a()};this.addPoint=function(f,h){if(i){i=false;b=f;c=h;d=f;e=h}else{b=b<f?b:f;c=c<h?c:h;d=d>f?d:f;e=e>h?
 e:h}a()};this.add3Points=function(f,h,g,m,n,l){if(i){i=false;b=f<g?f<n?f:n:g<n?g:n;c=h<m?h<l?h:l:m<l?m:l;d=f>g?f>n?f:n:g>n?g:n;e=h>m?h>l?h:l:m>l?m:l}else{b=f<g?f<n?f<b?f:b:n<b?n:b:g<n?g<b?g:b:n<b?n:b;c=h<m?h<l?h<c?h:c:l<c?l:c:m<l?m<c?m:c:l<c?l:c;d=f>g?f>n?f>d?f:d:n>d?n:d:g>n?g>d?g:d:n>d?n:d;e=h>m?h>l?h>e?h:e:l>e?l:e:m>l?m>e?m:e:l>e?l:e}a()};this.addRectangle=function(f){if(i){i=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(){i=true;e=d=c=b=0;a()};this.isEmpty=function(){return i}};
@@ -68,11 +68,11 @@ d);return true}var e,f,g=[],i,j,h=[],k,m,n=[],l,o=[],p,u,H=[],w,D,s=[],t={object
 z.multiply(b.matrixWorld,b.projectionMatrixInverse);z.multiplyVector3(a);return a};this.pickingRay=function(a,b){var c;a.z=-1;c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.subSelf(a).normalize();return new THREE.Ray(a,c)};this.projectGraph=function(b,d){f=0;t.objects.length=0;t.sprites.length=0;t.lights.length=0;var g=function(b){if(b.visible!==false){if((b instanceof THREE.Mesh||b instanceof THREE.Line)&&(b.frustumCulled===false||B.contains(b))){y.copy(b.matrixWorld.getPosition());
 z.multiplyVector3(y);e=a();e.object=b;e.z=y.z;t.objects.push(e)}else if(b instanceof THREE.Sprite||b instanceof THREE.Particle){y.copy(b.matrixWorld.getPosition());z.multiplyVector3(y);e=a();e.object=b;e.z=y.z;t.sprites.push(e)}else b instanceof THREE.Light&&t.lights.push(b);for(var c=0,d=b.children.length;c<d;c++)g(b.children[c])}};g(b);d&&t.objects.sort(c);return t};this.projectScene=function(a,e,f){var g=e.near,y=e.far,R=false,U,r,q,J,v,G,I,K,C,O,Q,V,W,X,S;D=u=l=m=0;t.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);z.multiply(e.projectionMatrix,e.matrixWorldInverse);B.setFromMatrix(z);t=this.projectGraph(a,false);a=0;for(U=t.objects.length;a<U;a++){C=t.objects[a].object;O=C.matrixWorld;j=0;if(C instanceof THREE.Mesh){Q=C.geometry;V=C.geometry.materials;J=Q.vertices;W=Q.faces;X=Q.faceVertexUvs;Q=C.matrixRotationWorld.extractRotation(O);r=0;for(q=J.length;r<
-q;r++){i=b();i.positionWorld.copy(J[r].position);O.multiplyVector3(i.positionWorld);i.positionScreen.copy(i.positionWorld);z.multiplyVector4(i.positionScreen);i.positionScreen.x=i.positionScreen.x/i.positionScreen.w;i.positionScreen.y=i.positionScreen.y/i.positionScreen.w;i.visible=i.positionScreen.z>g&&i.positionScreen.z<y}J=0;for(r=W.length;J<r;J++){q=W[J];if(q instanceof THREE.Face3){v=h[q.a];G=h[q.b];I=h[q.c];if(v.visible&&G.visible&&I.visible){R=(I.positionScreen.x-v.positionScreen.x)*(G.positionScreen.y-
+q;r++){i=b();i.positionWorld.copy(J[r]);O.multiplyVector3(i.positionWorld);i.positionScreen.copy(i.positionWorld);z.multiplyVector4(i.positionScreen);i.positionScreen.x=i.positionScreen.x/i.positionScreen.w;i.positionScreen.y=i.positionScreen.y/i.positionScreen.w;i.visible=i.positionScreen.z>g&&i.positionScreen.z<y}J=0;for(r=W.length;J<r;J++){q=W[J];if(q instanceof THREE.Face3){v=h[q.a];G=h[q.b];I=h[q.c];if(v.visible&&G.visible&&I.visible){R=(I.positionScreen.x-v.positionScreen.x)*(G.positionScreen.y-
 v.positionScreen.y)-(I.positionScreen.y-v.positionScreen.y)*(G.positionScreen.x-v.positionScreen.x)<0;if(C.doubleSided||R!=C.flipSided){K=n[m]=n[m]||new THREE.RenderableFace3;m++;k=K;k.v1.copy(v);k.v2.copy(G);k.v3.copy(I)}else continue}else continue}else if(q instanceof THREE.Face4){v=h[q.a];G=h[q.b];I=h[q.c];K=h[q.d];if(v.visible&&G.visible&&I.visible&&K.visible){R=(K.positionScreen.x-v.positionScreen.x)*(G.positionScreen.y-v.positionScreen.y)-(K.positionScreen.y-v.positionScreen.y)*(G.positionScreen.x-
 v.positionScreen.x)<0||(G.positionScreen.x-I.positionScreen.x)*(K.positionScreen.y-I.positionScreen.y)-(G.positionScreen.y-I.positionScreen.y)*(K.positionScreen.x-I.positionScreen.x)<0;if(C.doubleSided||R!=C.flipSided){S=o[l]=o[l]||new THREE.RenderableFace4;l++;k=S;k.v1.copy(v);k.v2.copy(G);k.v3.copy(I);k.v4.copy(K)}else continue}else continue}k.normalWorld.copy(q.normal);!R&&(C.flipSided||C.doubleSided)&&k.normalWorld.negate();Q.multiplyVector3(k.normalWorld);k.centroidWorld.copy(q.centroid);O.multiplyVector3(k.centroidWorld);
 k.centroidScreen.copy(k.centroidWorld);z.multiplyVector3(k.centroidScreen);I=q.vertexNormals;v=0;for(G=I.length;v<G;v++){K=k.vertexNormalsWorld[v];K.copy(I[v]);!R&&(C.flipSided||C.doubleSided)&&K.negate();Q.multiplyVector3(K)}v=0;for(G=X.length;v<G;v++)if(S=X[v][J]){I=0;for(K=S.length;I<K;I++)k.uvs[v][I]=S[I]}k.material=C.material;k.faceMaterial=q.materialIndex!==null?V[q.materialIndex]:null;k.z=k.centroidScreen.z;t.elements.push(k)}}else if(C instanceof THREE.Line){E.multiply(z,O);J=C.geometry.vertices;
-v=b();v.positionScreen.copy(J[0].position);E.multiplyVector4(v.positionScreen);O=C.type===THREE.LinePieces?2:1;r=1;for(q=J.length;r<q;r++){v=b();v.positionScreen.copy(J[r].position);E.multiplyVector4(v.positionScreen);if(!((r+1)%O>0)){G=h[j-2];F.copy(v.positionScreen);A.copy(G.positionScreen);if(d(F,A)){F.multiplyScalar(1/F.w);A.multiplyScalar(1/A.w);V=H[u]=H[u]||new THREE.RenderableLine;u++;p=V;p.v1.positionScreen.copy(F);p.v2.positionScreen.copy(A);p.z=Math.max(F.z,A.z);p.material=C.material;t.elements.push(p)}}}}}a=
+v=b();v.positionScreen.copy(J[0]);E.multiplyVector4(v.positionScreen);O=C.type===THREE.LinePieces?2:1;r=1;for(q=J.length;r<q;r++){v=b();v.positionScreen.copy(J[r]);E.multiplyVector4(v.positionScreen);if(!((r+1)%O>0)){G=h[j-2];F.copy(v.positionScreen);A.copy(G.positionScreen);if(d(F,A)){F.multiplyScalar(1/F.w);A.multiplyScalar(1/A.w);V=H[u]=H[u]||new THREE.RenderableLine;u++;p=V;p.v1.positionScreen.copy(F);p.v2.positionScreen.copy(A);p.z=Math.max(F.z,A.z);p.material=C.material;t.elements.push(p)}}}}}a=
 0;for(U=t.sprites.length;a<U;a++){C=t.sprites[a].object;O=C.matrixWorld;if(C instanceof THREE.Particle){x.set(O.n14,O.n24,O.n34,1);z.multiplyVector4(x);x.z=x.z/x.w;if(x.z>0&&x.z<1){g=s[D]=s[D]||new THREE.RenderableParticle;D++;w=g;w.x=x.x/x.w;w.y=x.y/x.w;w.z=x.z;w.rotation=C.rotation.z;w.scale.x=C.scale.x*Math.abs(w.x-(x.x+e.projectionMatrix.n11)/(x.w+e.projectionMatrix.n14));w.scale.y=C.scale.y*Math.abs(w.y-(x.y+e.projectionMatrix.n22)/(x.w+e.projectionMatrix.n24));w.material=C.material;t.elements.push(w)}}}f&&
 t.elements.sort(c);return t}};THREE.Quaternion=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=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,i=d*e;this.w=g*f-i*c;this.x=g*c+i*f;this.y=d*b*f+a*e*c;this.z=a*e*f-d*b*c;return this},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);
@@ -80,27 +80,27 @@ this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRo
 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,h=j*c+g*e-i*d,k=j*d+i*c-f*e,m=j*e+f*d-g*c,c=-f*c-g*d-i*e;b.x=h*j+c*-f+k*-i-m*-g;b.y=k*j+c*-g+m*-f-h*-i;b.z=m*j+c*-i+h*-g-k*-f;return b},clone:function(){return new THREE.Quaternion(this.x,this.y,this.z,this.w)}};
-THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;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.001){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}b=Math.sin((1-d)*f)/e;d=Math.sin(d*f)/e;c.w=a.w*b+c.w*d;c.x=a.x*b+c.x*d;c.y=a.y*b+c.y*d;c.z=a.z*b+c.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
-THREE.Vertex.prototype={constructor:THREE.Vertex,clone:function(){return new THREE.Vertex(this.position.clone())}};THREE.Face3=function(a,b,c,d,e,f){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materialIndex=f;this.centroid=new THREE.Vector3};
+THREE.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.001){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}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.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};
 THREE.Face4.prototype={constructor:THREE.Face4,clone:function(){var a=new THREE.Face4(this.a,this.b,this.c,this.d);a.normal.copy(this.normal);a.color.copy(this.color);a.centroid.copy(this.centroid);a.materialIndex=this.materialIndex;var b,c;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.UV=function(a,b){this.u=a||0;this.v=b||0};THREE.UV.prototype={constructor:THREE.UV,set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.u=a.u;this.v=a.v;return this},lerpSelf:function(a,b){this.u=this.u+(a.u-this.u)*b;this.v=this.v+(a.v-this.v)*b;return this},clone:function(){return new THREE.UV(this.u,this.v)}};
 THREE.Geometry=function(){this.id=THREE.GeometryCount++;this.vertices=[];this.colors=[];this.materials=[];this.faces=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.morphNormals=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.dynamic=this.hasTangents=false};
-THREE.Geometry.prototype={constructor:THREE.Geometry,applyMatrix:function(a){var b=new THREE.Matrix4;b.extractRotation(a);for(var c=0,d=this.vertices.length;c<d;c++)a.multiplyVector3(this.vertices[c].position);c=0;for(d=this.faces.length;c<d;c++){var e=this.faces[c];b.multiplyVector3(e.normal);for(var f=0,g=e.vertexNormals.length;f<g;f++)b.multiplyVector3(e.vertexNormals[f]);a.multiplyVector3(e.centroid)}},computeCentroids:function(){var a,b,c;a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];
-c.centroid.set(0,0,0);if(c instanceof THREE.Face3){c.centroid.addSelf(this.vertices[c.a].position);c.centroid.addSelf(this.vertices[c.b].position);c.centroid.addSelf(this.vertices[c.c].position);c.centroid.divideScalar(3)}else if(c instanceof THREE.Face4){c.centroid.addSelf(this.vertices[c.a].position);c.centroid.addSelf(this.vertices[c.b].position);c.centroid.addSelf(this.vertices[c.c].position);c.centroid.addSelf(this.vertices[c.d].position);c.centroid.divideScalar(4)}}},computeFaceNormals:function(){var a,
-b,c,d,e,f,g=new THREE.Vector3,i=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];d=this.vertices[c.a];e=this.vertices[c.b];f=this.vertices[c.c];g.sub(f.position,e.position);i.sub(d.position,e.position);g.crossSelf(i);g.isZero()||g.normalize();c.normal.copy(g)}},computeVertexNormals:function(){var a,b,c,d;if(this.__tmpVertices===void 0){d=this.__tmpVertices=Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)d[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<
-b;a++){c=this.faces[a];if(c instanceof THREE.Face3)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(c instanceof THREE.Face4)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{d=this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)d[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3){d[c.a].addSelf(c.normal);d[c.b].addSelf(c.normal);d[c.c].addSelf(c.normal)}else if(c instanceof
-THREE.Face4){d[c.a].addSelf(c.normal);d[c.b].addSelf(c.normal);d[c.c].addSelf(c.normal);d[c.d].addSelf(c.normal)}}a=0;for(b=this.vertices.length;a<b;a++)d[a].normalize();a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3){c.vertexNormals[0].copy(d[c.a]);c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c])}else if(c instanceof THREE.Face4){c.vertexNormals[0].copy(d[c.a]);c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c]);c.vertexNormals[3].copy(d[c.d])}}},
-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,i=this.morphNormals[a].vertexNormals,j,h;c=0;for(d=this.faces.length;c<d;c++){e=this.faces[c];j=new THREE.Vector3;h=e instanceof THREE.Face3?{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3}:{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3,d:new THREE.Vector3};g.push(j);i.push(h)}}g=this.morphNormals[a];f.vertices=
-this.morphTargets[a].vertices;f.computeFaceNormals();f.computeVertexNormals();c=0;for(d=this.faces.length;c<d;c++){e=this.faces[c];j=g.faceNormals[c];h=g.vertexNormals[c];j.copy(e.normal);if(e instanceof THREE.Face3){h.a.copy(e.vertexNormals[0]);h.b.copy(e.vertexNormals[1]);h.c.copy(e.vertexNormals[2])}else{h.a.copy(e.vertexNormals[0]);h.b.copy(e.vertexNormals[1]);h.c.copy(e.vertexNormals[2]);h.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,v){i=a.vertices[b].position;j=a.vertices[c].position;h=a.vertices[d].position;k=g[e];m=g[f];n=g[v];l=j.x-i.x;o=h.x-i.x;p=j.y-i.y;u=h.y-i.y;H=j.z-i.z;w=h.z-i.z;D=m.u-k.u;s=n.u-k.u;t=m.v-k.v;y=n.v-k.v;x=1/(D*y-s*t);F.set((y*l-t*o)*x,(y*p-t*u)*x,(y*H-t*w)*x);A.set((D*o-s*l)*x,(D*u-s*p)*x,(D*w-s*H)*x);E[b].addSelf(F);E[c].addSelf(F);E[d].addSelf(F);B[b].addSelf(A);B[c].addSelf(A);B[d].addSelf(A)}var b,c,d,e,
-f,g,i,j,h,k,m,n,l,o,p,u,H,w,D,s,t,y,x,z,E=[],B=[],F=new THREE.Vector3,A=new THREE.Vector3,L=new THREE.Vector3,P=new THREE.Vector3,M=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++){E[b]=new THREE.Vector3;B[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 N=["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++){M.copy(f.vertexNormals[d]);e=f[N[d]];z=E[e];L.copy(z);L.subSelf(M.multiplyScalar(M.dot(z))).normalize();P.cross(f.vertexNormals[d],z);e=P.dot(B[e]);e=e<0?-1:1;f.vertexTangents[d]=new THREE.Vector4(L.x,L.y,L.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].position;this.boundingBox.min.copy(a);
-this.boundingBox.max.copy(a);for(var b=this.boundingBox.min,c=this.boundingBox.max,d=1,e=this.vertices.length;d<e;d++){a=this.vertices[d].position;if(a.x<b.x)b.x=a.x;else if(a.x>c.x)c.x=a.x;if(a.y<b.y)b.y=a.y;else if(a.y>c.y)c.y=a.y;if(a.z<b.z)b.z=a.z;else if(a.z>c.z)c.z=a.z}}else{this.boundingBox.min.set(0,0,0);this.boundingBox.max.set(0,0,0)}},computeBoundingSphere:function(){if(!this.boundingSphere)this.boundingSphere={radius:0};for(var a,b=0,c=0,d=this.vertices.length;c<d;c++){a=this.vertices[c].position.length();
-a>b&&(b=a)}this.boundingSphere.radius=b},mergeVertices:function(){var a={},b=[],c=[],d,e=Math.pow(10,4),f,g;f=0;for(g=this.vertices.length;f<g;f++){d=this.vertices[f].position;d=[Math.round(d.x*e),Math.round(d.y*e),Math.round(d.z*e)].join("_");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.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.Geometry.prototype={constructor:THREE.Geometry,applyMatrix:function(a){var b=new THREE.Matrix4;b.extractRotation(a);for(var c=0,d=this.vertices.length;c<d;c++)a.multiplyVector3(this.vertices[c]);c=0;for(d=this.faces.length;c<d;c++){var e=this.faces[c];b.multiplyVector3(e.normal);for(var f=0,g=e.vertexNormals.length;f<g;f++)b.multiplyVector3(e.vertexNormals[f]);a.multiplyVector3(e.centroid)}},computeCentroids:function(){var a,b,c;a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];c.centroid.set(0,
+0,0);if(c instanceof THREE.Face3){c.centroid.addSelf(this.vertices[c.a]);c.centroid.addSelf(this.vertices[c.b]);c.centroid.addSelf(this.vertices[c.c]);c.centroid.divideScalar(3)}else if(c instanceof THREE.Face4){c.centroid.addSelf(this.vertices[c.a]);c.centroid.addSelf(this.vertices[c.b]);c.centroid.addSelf(this.vertices[c.c]);c.centroid.addSelf(this.vertices[c.d]);c.centroid.divideScalar(4)}}},computeFaceNormals:function(){var a,b,c,d,e,f,g=new THREE.Vector3,i=new THREE.Vector3;a=0;for(b=this.faces.length;a<
+b;a++){c=this.faces[a];d=this.vertices[c.a];e=this.vertices[c.b];f=this.vertices[c.c];g.sub(f,e);i.sub(d,e);g.crossSelf(i);g.isZero()||g.normalize();c.normal.copy(g)}},computeVertexNormals:function(){var a,b,c,d;if(this.__tmpVertices===void 0){d=this.__tmpVertices=Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)d[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];
+else if(c instanceof THREE.Face4)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{d=this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)d[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3){d[c.a].addSelf(c.normal);d[c.b].addSelf(c.normal);d[c.c].addSelf(c.normal)}else if(c instanceof THREE.Face4){d[c.a].addSelf(c.normal);d[c.b].addSelf(c.normal);d[c.c].addSelf(c.normal);d[c.d].addSelf(c.normal)}}a=0;
+for(b=this.vertices.length;a<b;a++)d[a].normalize();a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3){c.vertexNormals[0].copy(d[c.a]);c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c])}else if(c instanceof THREE.Face4){c.vertexNormals[0].copy(d[c.a]);c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c]);c.vertexNormals[3].copy(d[c.d])}}},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,i=this.morphNormals[a].vertexNormals,j,h;c=0;for(d=this.faces.length;c<d;c++){e=this.faces[c];j=new THREE.Vector3;h=e instanceof THREE.Face3?{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3}:{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3,d:new THREE.Vector3};g.push(j);i.push(h)}}g=this.morphNormals[a];f.vertices=this.morphTargets[a].vertices;f.computeFaceNormals();f.computeVertexNormals();c=0;for(d=this.faces.length;c<d;c++){e=this.faces[c];
+j=g.faceNormals[c];h=g.vertexNormals[c];j.copy(e.normal);if(e instanceof THREE.Face3){h.a.copy(e.vertexNormals[0]);h.b.copy(e.vertexNormals[1]);h.c.copy(e.vertexNormals[2])}else{h.a.copy(e.vertexNormals[0]);h.b.copy(e.vertexNormals[1]);h.c.copy(e.vertexNormals[2]);h.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,v){i=a.vertices[b];j=a.vertices[c];
+h=a.vertices[d];k=g[e];m=g[f];n=g[v];l=j.x-i.x;o=h.x-i.x;p=j.y-i.y;u=h.y-i.y;H=j.z-i.z;w=h.z-i.z;D=m.u-k.u;s=n.u-k.u;t=m.v-k.v;y=n.v-k.v;x=1/(D*y-s*t);F.set((y*l-t*o)*x,(y*p-t*u)*x,(y*H-t*w)*x);A.set((D*o-s*l)*x,(D*u-s*p)*x,(D*w-s*H)*x);E[b].addSelf(F);E[c].addSelf(F);E[d].addSelf(F);B[b].addSelf(A);B[c].addSelf(A);B[d].addSelf(A)}var b,c,d,e,f,g,i,j,h,k,m,n,l,o,p,u,H,w,D,s,t,y,x,z,E=[],B=[],F=new THREE.Vector3,A=new THREE.Vector3,L=new THREE.Vector3,P=new THREE.Vector3,M=new THREE.Vector3;b=0;for(c=
+this.vertices.length;b<c;b++){E[b]=new THREE.Vector3;B[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 N=["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++){M.copy(f.vertexNormals[d]);e=f[N[d]];z=E[e];L.copy(z);L.subSelf(M.multiplyScalar(M.dot(z))).normalize();
+P.cross(f.vertexNormals[d],z);e=P.dot(B[e]);e=e<0?-1:1;f.vertexTangents[d]=new THREE.Vector4(L.x,L.y,L.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.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()};

+ 77 - 78
build/custom/ThreeWebGL.js

@@ -8,7 +8,7 @@ Math.floor(a);this.r=(a>>16&255)/255;this.g=(a>>8&255)/255;this.b=(a&255)/255;re
 THREE.Vector2=function(a,b){this.x=a||0;this.y=b||0};
 THREE.Vector2.prototype={constructor:THREE.Vector2,set:function(a,b){this.x=a;this.y=b;return this},copy:function(a){this.x=a.x;this.y=a.y;return this},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;return this},addSelf:function(a){this.x=this.x+a.x;this.y=this.y+a.y;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;return this},subSelf:function(a){this.x=this.x-a.x;this.y=this.y-a.y;return this},multiplyScalar:function(a){this.x=this.x*a;this.y=this.y*a;return this},divideScalar:function(a){if(a){this.x=
 this.x/a;this.y=this.y/a}else this.set(0,0);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.lengthSq())},normalize:function(){return this.divideScalar(this.length())},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var b=this.x-a.x,a=this.y-a.y;return b*b+a*a},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;return this},equals:function(a){return a.x===this.x&&a.y===this.y},isZero:function(){return this.lengthSq()<1.0E-4},clone:function(){return new THREE.Vector2(this.x,this.y)}};THREE.Vector3=function(a,b,c){this.x=a||0;this.y=b||0;this.z=c||0};
+lerpSelf:function(a,b){this.x=this.x+(a.x-this.x)*b;this.y=this.y+(a.y-this.y)*b;return this},equals:function(a){return a.x===this.x&&a.y===this.y},isZero:function(){return this.lengthSq()<1.0E-4},clone:function(){return new THREE.Vector2(this.x,this.y)}};THREE.Vector3=function(a,b,c){a instanceof THREE.Vector3&&console.warn("OPS!");this.x=a||0;this.y=b||0;this.z=c||0};
 THREE.Vector3.prototype={constructor:THREE.Vector3,set:function(a,b,c){this.x=a;this.y=b;this.z=c;return this},setX:function(a){this.x=a;return this},setY:function(a){this.y=a;return this},setZ:function(a){this.z=a;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;return this},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;return this},addSelf:function(a){this.x=this.x+a.x;this.y=this.y+a.y;this.z=this.z+a.z;return this},addScalar:function(a){this.x=this.x+a;this.y=this.y+
 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())},
@@ -23,8 +23,8 @@ THREE.Frustum.prototype.contains=function(a){for(var b=this.planes,c=a.matrixWor
 THREE.Ray=function(a,b){function c(a,b,c){r.sub(c,a);z=r.dot(b);w=n.add(a,t.copy(b).multiplyScalar(z));return P=c.distanceTo(w)}function d(a,b,c,d){r.sub(d,b);n.sub(c,b);t.sub(a,b);A=r.dot(r);q=r.dot(n);G=r.dot(t);H=n.dot(n);M=n.dot(t);I=1/(A*H-q*q);K=(H*G-q*M)*I;N=(A*M-q*G)*I;return K>=0&&N>=0&&K+N<1}this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3;var f=1.0E-4;this.setPrecision=function(a){f=a};var g=new THREE.Vector3,h=new THREE.Vector3,i=new THREE.Vector3,k=new THREE.Vector3,
 j=new THREE.Vector3,m=new THREE.Vector3,o=new THREE.Vector3,l=new THREE.Vector3,u=new THREE.Vector3;this.intersectObject=function(a){var b,r=[];if(a instanceof THREE.Particle){var n=c(this.origin,this.direction,a.matrixWorld.getPosition());if(n>a.scale.x)return[];b={distance:n,point:a.position,face:null,object:a};r.push(b)}else if(a instanceof THREE.Mesh){var n=c(this.origin,this.direction,a.matrixWorld.getPosition()),t=THREE.Frustum.__v1.set(a.matrixWorld.getColumnX().length(),a.matrixWorld.getColumnY().length(),
 a.matrixWorld.getColumnZ().length());if(n>a.geometry.boundingSphere.radius*Math.max(t.x,Math.max(t.y,t.z)))return r;var q,e,w=a.geometry,z=w.vertices,A;a.matrixRotationWorld.extractRotation(a.matrixWorld);n=0;for(t=w.faces.length;n<t;n++){b=w.faces[n];j.copy(this.origin);m.copy(this.direction);A=a.matrixWorld;o=A.multiplyVector3(o.copy(b.centroid)).subSelf(j);l=a.matrixRotationWorld.multiplyVector3(l.copy(b.normal));q=m.dot(l);if(!(Math.abs(q)<f)){e=l.dot(o)/q;if(!(e<0)&&(a.doubleSided||(a.flipSided?
-q>0:q<0))){u.add(j,m.multiplyScalar(e));if(b instanceof THREE.Face3){g=A.multiplyVector3(g.copy(z[b.a].position));h=A.multiplyVector3(h.copy(z[b.b].position));i=A.multiplyVector3(i.copy(z[b.c].position));if(d(u,g,h,i)){b={distance:j.distanceTo(u),point:u.clone(),face:b,object:a};r.push(b)}}else if(b instanceof THREE.Face4){g=A.multiplyVector3(g.copy(z[b.a].position));h=A.multiplyVector3(h.copy(z[b.b].position));i=A.multiplyVector3(i.copy(z[b.c].position));k=A.multiplyVector3(k.copy(z[b.d].position));
-if(d(u,g,h,k)||d(u,h,i,k)){b={distance:j.distanceTo(u),point:u.clone(),face:b,object:a};r.push(b)}}}}}}return r};this.intersectObjects=function(a){for(var b=[],c=0,d=a.length;c<d;c++)Array.prototype.push.apply(b,this.intersectObject(a[c]));b.sort(function(a,b){return a.distance-b.distance});return b};var r=new THREE.Vector3,n=new THREE.Vector3,t=new THREE.Vector3,z,w,P,A,q,G,H,M,I,K,N};
+q>0:q<0))){u.add(j,m.multiplyScalar(e));if(b instanceof THREE.Face3){g=A.multiplyVector3(g.copy(z[b.a]));h=A.multiplyVector3(h.copy(z[b.b]));i=A.multiplyVector3(i.copy(z[b.c]));if(d(u,g,h,i)){b={distance:j.distanceTo(u),point:u.clone(),face:b,object:a};r.push(b)}}else if(b instanceof THREE.Face4){g=A.multiplyVector3(g.copy(z[b.a]));h=A.multiplyVector3(h.copy(z[b.b]));i=A.multiplyVector3(i.copy(z[b.c]));k=A.multiplyVector3(k.copy(z[b.d]));if(d(u,g,h,k)||d(u,h,i,k)){b={distance:j.distanceTo(u),point:u.clone(),
+face:b,object:a};r.push(b)}}}}}}return r};this.intersectObjects=function(a){for(var b=[],c=0,d=a.length;c<d;c++)Array.prototype.push.apply(b,this.intersectObject(a[c]));b.sort(function(a,b){return a.distance-b.distance});return b};var r=new THREE.Vector3,n=new THREE.Vector3,t=new THREE.Vector3,z,w,P,A,q,G,H,M,I,K,N};
 THREE.Rectangle=function(){function a(){g=d-b;h=f-c}var b,c,d,f,g,h,i=true;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return g};this.getHeight=function(){return h};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return f};this.set=function(g,j,h,o){i=false;b=g;c=j;d=h;f=o;a()};this.addPoint=function(g,j){if(i){i=false;b=g;c=j;d=g;f=j}else{b=b<g?b:g;c=c<j?c:j;d=d>g?d:g;f=f>j?
 f:j}a()};this.add3Points=function(g,j,h,o,l,u){if(i){i=false;b=g<h?g<l?g:l:h<l?h:l;c=j<o?j<u?j:u:o<u?o:u;d=g>h?g>l?g:l:h>l?h:l;f=j>o?j>u?j:u:o>u?o:u}else{b=g<h?g<l?g<b?g:b:l<b?l:b:h<l?h<b?h:b:l<b?l:b;c=j<o?j<u?j<c?j:c:u<c?u:c:o<u?o<c?o:c:u<c?u:c;d=g>h?g>l?g>d?g:d:l>d?l:d:h>l?h>d?h:d:l>d?l:d;f=j>o?j>u?j>f?j:f:u>f?u:f:o>u?o>f?o:f:u>f?u:f}a()};this.addRectangle=function(g){if(i){i=false;b=g.getLeft();c=g.getTop();d=g.getRight();f=g.getBottom()}else{b=b<g.getLeft()?b:g.getLeft();c=c<g.getTop()?c:g.getTop();
 d=d>g.getRight()?d:g.getRight();f=f>g.getBottom()?f:g.getBottom()}a()};this.inflate=function(g){b=b-g;c=c-g;d=d+g;f=f+g;a()};this.minSelf=function(g){b=b>g.getLeft()?b:g.getLeft();c=c>g.getTop()?c:g.getTop();d=d<g.getRight()?d:g.getRight();f=f<g.getBottom()?f:g.getBottom();a()};this.intersects=function(a){return d<a.getLeft()||b>a.getRight()||f<a.getTop()||c>a.getBottom()?false:true};this.empty=function(){i=true;f=d=c=b=0;a()};this.isEmpty=function(){return i}};
@@ -68,39 +68,38 @@ d);return true}var f,g,h=[],i,k,j=[],m,o,l=[],u,r=[],n,t,z=[],w,P,A=[],q={object
 M.multiply(b.matrixWorld,b.projectionMatrixInverse);M.multiplyVector3(a);return a};this.pickingRay=function(a,b){var c;a.z=-1;c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.subSelf(a).normalize();return new THREE.Ray(a,c)};this.projectGraph=function(b,d){g=0;q.objects.length=0;q.sprites.length=0;q.lights.length=0;var h=function(b){if(b.visible!==false){if((b instanceof THREE.Mesh||b instanceof THREE.Line)&&(b.frustumCulled===false||K.contains(b))){G.copy(b.matrixWorld.getPosition());
 M.multiplyVector3(G);f=a();f.object=b;f.z=G.z;q.objects.push(f)}else if(b instanceof THREE.Sprite||b instanceof THREE.Particle){G.copy(b.matrixWorld.getPosition());M.multiplyVector3(G);f=a();f.object=b;f.z=G.z;q.sprites.push(f)}else b instanceof THREE.Light&&q.lights.push(b);for(var c=0,e=b.children.length;c<e;c++)h(b.children[c])}};h(b);d&&q.objects.sort(c);return q};this.projectScene=function(a,f,g){var h=f.near,C=f.far,e=false,G,Aa,T,sa,J,aa,ta,xa,U,Ba,Ma,Ra,Sa,Ka,Ca;P=t=u=o=0;q.elements.length=
 0;if(f.parent===void 0){console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it...");a.add(f)}a.updateMatrixWorld();f.matrixWorldInverse.getInverse(f.matrixWorld);M.multiply(f.projectionMatrix,f.matrixWorldInverse);K.setFromMatrix(M);q=this.projectGraph(a,false);a=0;for(G=q.objects.length;a<G;a++){U=q.objects[a].object;Ba=U.matrixWorld;k=0;if(U instanceof THREE.Mesh){Ma=U.geometry;Ra=U.geometry.materials;sa=Ma.vertices;Sa=Ma.faces;Ka=Ma.faceVertexUvs;Ma=U.matrixRotationWorld.extractRotation(Ba);
-Aa=0;for(T=sa.length;Aa<T;Aa++){i=b();i.positionWorld.copy(sa[Aa].position);Ba.multiplyVector3(i.positionWorld);i.positionScreen.copy(i.positionWorld);M.multiplyVector4(i.positionScreen);i.positionScreen.x=i.positionScreen.x/i.positionScreen.w;i.positionScreen.y=i.positionScreen.y/i.positionScreen.w;i.visible=i.positionScreen.z>h&&i.positionScreen.z<C}sa=0;for(Aa=Sa.length;sa<Aa;sa++){T=Sa[sa];if(T instanceof THREE.Face3){J=j[T.a];aa=j[T.b];ta=j[T.c];if(J.visible&&aa.visible&&ta.visible){e=(ta.positionScreen.x-
+Aa=0;for(T=sa.length;Aa<T;Aa++){i=b();i.positionWorld.copy(sa[Aa]);Ba.multiplyVector3(i.positionWorld);i.positionScreen.copy(i.positionWorld);M.multiplyVector4(i.positionScreen);i.positionScreen.x=i.positionScreen.x/i.positionScreen.w;i.positionScreen.y=i.positionScreen.y/i.positionScreen.w;i.visible=i.positionScreen.z>h&&i.positionScreen.z<C}sa=0;for(Aa=Sa.length;sa<Aa;sa++){T=Sa[sa];if(T instanceof THREE.Face3){J=j[T.a];aa=j[T.b];ta=j[T.c];if(J.visible&&aa.visible&&ta.visible){e=(ta.positionScreen.x-
 J.positionScreen.x)*(aa.positionScreen.y-J.positionScreen.y)-(ta.positionScreen.y-J.positionScreen.y)*(aa.positionScreen.x-J.positionScreen.x)<0;if(U.doubleSided||e!=U.flipSided){xa=l[o]=l[o]||new THREE.RenderableFace3;o++;m=xa;m.v1.copy(J);m.v2.copy(aa);m.v3.copy(ta)}else continue}else continue}else if(T instanceof THREE.Face4){J=j[T.a];aa=j[T.b];ta=j[T.c];xa=j[T.d];if(J.visible&&aa.visible&&ta.visible&&xa.visible){e=(xa.positionScreen.x-J.positionScreen.x)*(aa.positionScreen.y-J.positionScreen.y)-
 (xa.positionScreen.y-J.positionScreen.y)*(aa.positionScreen.x-J.positionScreen.x)<0||(aa.positionScreen.x-ta.positionScreen.x)*(xa.positionScreen.y-ta.positionScreen.y)-(aa.positionScreen.y-ta.positionScreen.y)*(xa.positionScreen.x-ta.positionScreen.x)<0;if(U.doubleSided||e!=U.flipSided){Ca=r[u]=r[u]||new THREE.RenderableFace4;u++;m=Ca;m.v1.copy(J);m.v2.copy(aa);m.v3.copy(ta);m.v4.copy(xa)}else continue}else continue}m.normalWorld.copy(T.normal);!e&&(U.flipSided||U.doubleSided)&&m.normalWorld.negate();
 Ma.multiplyVector3(m.normalWorld);m.centroidWorld.copy(T.centroid);Ba.multiplyVector3(m.centroidWorld);m.centroidScreen.copy(m.centroidWorld);M.multiplyVector3(m.centroidScreen);ta=T.vertexNormals;J=0;for(aa=ta.length;J<aa;J++){xa=m.vertexNormalsWorld[J];xa.copy(ta[J]);!e&&(U.flipSided||U.doubleSided)&&xa.negate();Ma.multiplyVector3(xa)}J=0;for(aa=Ka.length;J<aa;J++)if(Ca=Ka[J][sa]){ta=0;for(xa=Ca.length;ta<xa;ta++)m.uvs[J][ta]=Ca[ta]}m.material=U.material;m.faceMaterial=T.materialIndex!==null?Ra[T.materialIndex]:
-null;m.z=m.centroidScreen.z;q.elements.push(m)}}else if(U instanceof THREE.Line){I.multiply(M,Ba);sa=U.geometry.vertices;J=b();J.positionScreen.copy(sa[0].position);I.multiplyVector4(J.positionScreen);Ba=U.type===THREE.LinePieces?2:1;Aa=1;for(T=sa.length;Aa<T;Aa++){J=b();J.positionScreen.copy(sa[Aa].position);I.multiplyVector4(J.positionScreen);if(!((Aa+1)%Ba>0)){aa=j[k-2];N.copy(J.positionScreen);ja.copy(aa.positionScreen);if(d(N,ja)){N.multiplyScalar(1/N.w);ja.multiplyScalar(1/ja.w);Ra=z[t]=z[t]||
-new THREE.RenderableLine;t++;n=Ra;n.v1.positionScreen.copy(N);n.v2.positionScreen.copy(ja);n.z=Math.max(N.z,ja.z);n.material=U.material;q.elements.push(n)}}}}}a=0;for(G=q.sprites.length;a<G;a++){U=q.sprites[a].object;Ba=U.matrixWorld;if(U instanceof THREE.Particle){H.set(Ba.n14,Ba.n24,Ba.n34,1);M.multiplyVector4(H);H.z=H.z/H.w;if(H.z>0&&H.z<1){h=A[P]=A[P]||new THREE.RenderableParticle;P++;w=h;w.x=H.x/H.w;w.y=H.y/H.w;w.z=H.z;w.rotation=U.rotation.z;w.scale.x=U.scale.x*Math.abs(w.x-(H.x+f.projectionMatrix.n11)/
-(H.w+f.projectionMatrix.n14));w.scale.y=U.scale.y*Math.abs(w.y-(H.y+f.projectionMatrix.n22)/(H.w+f.projectionMatrix.n24));w.material=U.material;q.elements.push(w)}}}g&&q.elements.sort(c);return q}};THREE.Quaternion=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=d!==void 0?d:1};
+null;m.z=m.centroidScreen.z;q.elements.push(m)}}else if(U instanceof THREE.Line){I.multiply(M,Ba);sa=U.geometry.vertices;J=b();J.positionScreen.copy(sa[0]);I.multiplyVector4(J.positionScreen);Ba=U.type===THREE.LinePieces?2:1;Aa=1;for(T=sa.length;Aa<T;Aa++){J=b();J.positionScreen.copy(sa[Aa]);I.multiplyVector4(J.positionScreen);if(!((Aa+1)%Ba>0)){aa=j[k-2];N.copy(J.positionScreen);ja.copy(aa.positionScreen);if(d(N,ja)){N.multiplyScalar(1/N.w);ja.multiplyScalar(1/ja.w);Ra=z[t]=z[t]||new THREE.RenderableLine;
+t++;n=Ra;n.v1.positionScreen.copy(N);n.v2.positionScreen.copy(ja);n.z=Math.max(N.z,ja.z);n.material=U.material;q.elements.push(n)}}}}}a=0;for(G=q.sprites.length;a<G;a++){U=q.sprites[a].object;Ba=U.matrixWorld;if(U instanceof THREE.Particle){H.set(Ba.n14,Ba.n24,Ba.n34,1);M.multiplyVector4(H);H.z=H.z/H.w;if(H.z>0&&H.z<1){h=A[P]=A[P]||new THREE.RenderableParticle;P++;w=h;w.x=H.x/H.w;w.y=H.y/H.w;w.z=H.z;w.rotation=U.rotation.z;w.scale.x=U.scale.x*Math.abs(w.x-(H.x+f.projectionMatrix.n11)/(H.w+f.projectionMatrix.n14));
+w.scale.y=U.scale.y*Math.abs(w.y-(H.y+f.projectionMatrix.n22)/(H.w+f.projectionMatrix.n24));w.material=U.material;q.elements.push(w)}}}g&&q.elements.sort(c);return q}};THREE.Quaternion=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=d!==void 0?d:1};
 THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this},setFromEuler:function(a){var b=Math.PI/360,c=a.x*b,d=a.y*b,f=a.z*b,a=Math.cos(d),d=Math.sin(d),b=Math.cos(-f),f=Math.sin(-f),g=Math.cos(c),c=Math.sin(c),h=a*b,i=d*f;this.w=h*g-i*c;this.x=h*c+i*g;this.y=d*b*g+a*f*c;this.z=a*f*g-d*b*c;return this},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);
 this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRotationMatrix:function(a){var b=Math.pow(a.determinant(),1/3);this.w=Math.sqrt(Math.max(0,b+a.n11+a.n22+a.n33))/2;this.x=Math.sqrt(Math.max(0,b+a.n11-a.n22-a.n33))/2;this.y=Math.sqrt(Math.max(0,b-a.n11+a.n22-a.n33))/2;this.z=Math.sqrt(Math.max(0,b-a.n11-a.n22+a.n33))/2;this.x=a.n32-a.n23<0?-Math.abs(this.x):Math.abs(this.x);this.y=a.n13-a.n31<0?-Math.abs(this.y):Math.abs(this.y);this.z=a.n21-a.n12<0?-Math.abs(this.z):Math.abs(this.z);
 this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x=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,h=a.y,i=a.z,a=a.w;this.x=b*a+f*g+c*i-d*h;this.y=c*a+f*h+d*g-b*i;this.z=d*a+f*i+b*h-c*g;this.w=f*a-b*g-c*h-d*i;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,f=a.z,g=this.x,h=this.y,i=this.z,
 k=this.w,j=k*c+h*f-i*d,m=k*d+i*c-g*f,o=k*f+g*d-h*c,c=-g*c-h*d-i*f;b.x=j*k+c*-g+m*-i-o*-h;b.y=m*k+c*-h+o*-g-j*-i;b.z=o*k+c*-i+j*-h-m*-g;return b},clone:function(){return new THREE.Quaternion(this.x,this.y,this.z,this.w)}};
-THREE.Quaternion.slerp=function(a,b,c,d){var f=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;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.001){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}b=Math.sin((1-d)*g)/f;d=Math.sin(d*g)/f;c.w=a.w*b+c.w*d;c.x=a.x*b+c.x*d;c.y=a.y*b+c.y*d;c.z=a.z*b+c.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
-THREE.Vertex.prototype={constructor:THREE.Vertex,clone:function(){return new THREE.Vertex(this.position.clone())}};THREE.Face3=function(a,b,c,d,f,g){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materialIndex=g;this.centroid=new THREE.Vector3};
+THREE.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.001){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}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.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,h){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materialIndex=h;this.centroid=new THREE.Vector3};
 THREE.Face4.prototype={constructor:THREE.Face4,clone:function(){var a=new THREE.Face4(this.a,this.b,this.c,this.d);a.normal.copy(this.normal);a.color.copy(this.color);a.centroid.copy(this.centroid);a.materialIndex=this.materialIndex;var b,c;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.UV=function(a,b){this.u=a||0;this.v=b||0};THREE.UV.prototype={constructor:THREE.UV,set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.u=a.u;this.v=a.v;return this},lerpSelf:function(a,b){this.u=this.u+(a.u-this.u)*b;this.v=this.v+(a.v-this.v)*b;return this},clone:function(){return new THREE.UV(this.u,this.v)}};
 THREE.Geometry=function(){this.id=THREE.GeometryCount++;this.vertices=[];this.colors=[];this.materials=[];this.faces=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.morphNormals=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.dynamic=this.hasTangents=false};
-THREE.Geometry.prototype={constructor:THREE.Geometry,applyMatrix:function(a){var b=new THREE.Matrix4;b.extractRotation(a);for(var c=0,d=this.vertices.length;c<d;c++)a.multiplyVector3(this.vertices[c].position);c=0;for(d=this.faces.length;c<d;c++){var f=this.faces[c];b.multiplyVector3(f.normal);for(var g=0,h=f.vertexNormals.length;g<h;g++)b.multiplyVector3(f.vertexNormals[g]);a.multiplyVector3(f.centroid)}},computeCentroids:function(){var a,b,c;a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];
-c.centroid.set(0,0,0);if(c instanceof THREE.Face3){c.centroid.addSelf(this.vertices[c.a].position);c.centroid.addSelf(this.vertices[c.b].position);c.centroid.addSelf(this.vertices[c.c].position);c.centroid.divideScalar(3)}else if(c instanceof THREE.Face4){c.centroid.addSelf(this.vertices[c.a].position);c.centroid.addSelf(this.vertices[c.b].position);c.centroid.addSelf(this.vertices[c.c].position);c.centroid.addSelf(this.vertices[c.d].position);c.centroid.divideScalar(4)}}},computeFaceNormals:function(){var a,
-b,c,d,f,g,h=new THREE.Vector3,i=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];d=this.vertices[c.a];f=this.vertices[c.b];g=this.vertices[c.c];h.sub(g.position,f.position);i.sub(d.position,f.position);h.crossSelf(i);h.isZero()||h.normalize();c.normal.copy(h)}},computeVertexNormals:function(){var a,b,c,d;if(this.__tmpVertices===void 0){d=this.__tmpVertices=Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)d[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<
-b;a++){c=this.faces[a];if(c instanceof THREE.Face3)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(c instanceof THREE.Face4)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{d=this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)d[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3){d[c.a].addSelf(c.normal);d[c.b].addSelf(c.normal);d[c.c].addSelf(c.normal)}else if(c instanceof
-THREE.Face4){d[c.a].addSelf(c.normal);d[c.b].addSelf(c.normal);d[c.c].addSelf(c.normal);d[c.d].addSelf(c.normal)}}a=0;for(b=this.vertices.length;a<b;a++)d[a].normalize();a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3){c.vertexNormals[0].copy(d[c.a]);c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c])}else if(c instanceof THREE.Face4){c.vertexNormals[0].copy(d[c.a]);c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c]);c.vertexNormals[3].copy(d[c.d])}}},
-computeMorphNormals:function(){var a,b,c,d,f;c=0;for(d=this.faces.length;c<d;c++){f=this.faces[c];f.__originalFaceNormal?f.__originalFaceNormal.copy(f.normal):f.__originalFaceNormal=f.normal.clone();if(!f.__originalVertexNormals)f.__originalVertexNormals=[];a=0;for(b=f.vertexNormals.length;a<b;a++)f.__originalVertexNormals[a]?f.__originalVertexNormals[a].copy(f.vertexNormals[a]):f.__originalVertexNormals[a]=f.vertexNormals[a].clone()}var g=new THREE.Geometry;g.faces=this.faces;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 h=this.morphNormals[a].faceNormals,i=this.morphNormals[a].vertexNormals,k,j;c=0;for(d=this.faces.length;c<d;c++){f=this.faces[c];k=new THREE.Vector3;j=f instanceof THREE.Face3?{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3}:{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3,d:new THREE.Vector3};h.push(k);i.push(j)}}h=this.morphNormals[a];g.vertices=
-this.morphTargets[a].vertices;g.computeFaceNormals();g.computeVertexNormals();c=0;for(d=this.faces.length;c<d;c++){f=this.faces[c];k=h.faceNormals[c];j=h.vertexNormals[c];k.copy(f.normal);if(f instanceof THREE.Face3){j.a.copy(f.vertexNormals[0]);j.b.copy(f.vertexNormals[1]);j.c.copy(f.vertexNormals[2])}else{j.a.copy(f.vertexNormals[0]);j.b.copy(f.vertexNormals[1]);j.c.copy(f.vertexNormals[2]);j.d.copy(f.vertexNormals[3])}}}c=0;for(d=this.faces.length;c<d;c++){f=this.faces[c];f.normal=f.__originalFaceNormal;
-f.vertexNormals=f.__originalVertexNormals}},computeTangents:function(){function a(a,b,c,d,f,g,J){i=a.vertices[b].position;k=a.vertices[c].position;j=a.vertices[d].position;m=h[f];o=h[g];l=h[J];u=k.x-i.x;r=j.x-i.x;n=k.y-i.y;t=j.y-i.y;z=k.z-i.z;w=j.z-i.z;P=o.u-m.u;A=l.u-m.u;q=o.v-m.v;G=l.v-m.v;H=1/(P*G-A*q);N.set((G*u-q*r)*H,(G*n-q*t)*H,(G*z-q*w)*H);ja.set((P*r-A*u)*H,(P*t-A*n)*H,(P*w-A*z)*H);I[b].addSelf(N);I[c].addSelf(N);I[d].addSelf(N);K[b].addSelf(ja);K[c].addSelf(ja);K[d].addSelf(ja)}var b,c,
-d,f,g,h,i,k,j,m,o,l,u,r,n,t,z,w,P,A,q,G,H,M,I=[],K=[],N=new THREE.Vector3,ja=new THREE.Vector3,oa=new THREE.Vector3,ka=new THREE.Vector3,Y=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++){I[b]=new THREE.Vector3;K[b]=new THREE.Vector3}b=0;for(c=this.faces.length;b<c;b++){g=this.faces[b];h=this.faceVertexUvs[0][b];if(g instanceof THREE.Face3)a(this,g.a,g.b,g.c,0,1,2);else if(g instanceof THREE.Face4){a(this,g.a,g.b,g.d,0,1,3);a(this,g.b,g.c,g.d,1,2,3)}}var S=["a","b","c","d"];b=0;for(c=this.faces.length;b<
-c;b++){g=this.faces[b];for(d=0;d<g.vertexNormals.length;d++){Y.copy(g.vertexNormals[d]);f=g[S[d]];M=I[f];oa.copy(M);oa.subSelf(Y.multiplyScalar(Y.dot(M))).normalize();ka.cross(g.vertexNormals[d],M);f=ka.dot(K[f]);f=f<0?-1:1;g.vertexTangents[d]=new THREE.Vector4(oa.x,oa.y,oa.z,f)}}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].position;this.boundingBox.min.copy(a);
-this.boundingBox.max.copy(a);for(var b=this.boundingBox.min,c=this.boundingBox.max,d=1,f=this.vertices.length;d<f;d++){a=this.vertices[d].position;if(a.x<b.x)b.x=a.x;else if(a.x>c.x)c.x=a.x;if(a.y<b.y)b.y=a.y;else if(a.y>c.y)c.y=a.y;if(a.z<b.z)b.z=a.z;else if(a.z>c.z)c.z=a.z}}else{this.boundingBox.min.set(0,0,0);this.boundingBox.max.set(0,0,0)}},computeBoundingSphere:function(){if(!this.boundingSphere)this.boundingSphere={radius:0};for(var a,b=0,c=0,d=this.vertices.length;c<d;c++){a=this.vertices[c].position.length();
-a>b&&(b=a)}this.boundingSphere.radius=b},mergeVertices:function(){var a={},b=[],c=[],d,f=Math.pow(10,4),g,h;g=0;for(h=this.vertices.length;g<h;g++){d=this.vertices[g].position;d=[Math.round(d.x*f),Math.round(d.y*f),Math.round(d.z*f)].join("_");if(a[d]===void 0){a[d]=g;b.push(this.vertices[g]);c[g]=b.length-1}else c[g]=c[a[d]]}g=0;for(h=this.faces.length;g<h;g++){a=this.faces[g];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.Geometry.prototype={constructor:THREE.Geometry,applyMatrix:function(a){var b=new THREE.Matrix4;b.extractRotation(a);for(var c=0,d=this.vertices.length;c<d;c++)a.multiplyVector3(this.vertices[c]);c=0;for(d=this.faces.length;c<d;c++){var f=this.faces[c];b.multiplyVector3(f.normal);for(var g=0,h=f.vertexNormals.length;g<h;g++)b.multiplyVector3(f.vertexNormals[g]);a.multiplyVector3(f.centroid)}},computeCentroids:function(){var a,b,c;a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];c.centroid.set(0,
+0,0);if(c instanceof THREE.Face3){c.centroid.addSelf(this.vertices[c.a]);c.centroid.addSelf(this.vertices[c.b]);c.centroid.addSelf(this.vertices[c.c]);c.centroid.divideScalar(3)}else if(c instanceof THREE.Face4){c.centroid.addSelf(this.vertices[c.a]);c.centroid.addSelf(this.vertices[c.b]);c.centroid.addSelf(this.vertices[c.c]);c.centroid.addSelf(this.vertices[c.d]);c.centroid.divideScalar(4)}}},computeFaceNormals:function(){var a,b,c,d,f,g,h=new THREE.Vector3,i=new THREE.Vector3;a=0;for(b=this.faces.length;a<
+b;a++){c=this.faces[a];d=this.vertices[c.a];f=this.vertices[c.b];g=this.vertices[c.c];h.sub(g,f);i.sub(d,f);h.crossSelf(i);h.isZero()||h.normalize();c.normal.copy(h)}},computeVertexNormals:function(){var a,b,c,d;if(this.__tmpVertices===void 0){d=this.__tmpVertices=Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)d[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];
+else if(c instanceof THREE.Face4)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{d=this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)d[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3){d[c.a].addSelf(c.normal);d[c.b].addSelf(c.normal);d[c.c].addSelf(c.normal)}else if(c instanceof THREE.Face4){d[c.a].addSelf(c.normal);d[c.b].addSelf(c.normal);d[c.c].addSelf(c.normal);d[c.d].addSelf(c.normal)}}a=0;
+for(b=this.vertices.length;a<b;a++)d[a].normalize();a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3){c.vertexNormals[0].copy(d[c.a]);c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c])}else if(c instanceof THREE.Face4){c.vertexNormals[0].copy(d[c.a]);c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c]);c.vertexNormals[3].copy(d[c.d])}}},computeMorphNormals:function(){var a,b,c,d,f;c=0;for(d=this.faces.length;c<d;c++){f=this.faces[c];f.__originalFaceNormal?
+f.__originalFaceNormal.copy(f.normal):f.__originalFaceNormal=f.normal.clone();if(!f.__originalVertexNormals)f.__originalVertexNormals=[];a=0;for(b=f.vertexNormals.length;a<b;a++)f.__originalVertexNormals[a]?f.__originalVertexNormals[a].copy(f.vertexNormals[a]):f.__originalVertexNormals[a]=f.vertexNormals[a].clone()}var g=new THREE.Geometry;g.faces=this.faces;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 h=this.morphNormals[a].faceNormals,i=this.morphNormals[a].vertexNormals,k,j;c=0;for(d=this.faces.length;c<d;c++){f=this.faces[c];k=new THREE.Vector3;j=f instanceof THREE.Face3?{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3}:{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3,d:new THREE.Vector3};h.push(k);i.push(j)}}h=this.morphNormals[a];g.vertices=this.morphTargets[a].vertices;g.computeFaceNormals();g.computeVertexNormals();c=0;for(d=this.faces.length;c<d;c++){f=this.faces[c];
+k=h.faceNormals[c];j=h.vertexNormals[c];k.copy(f.normal);if(f instanceof THREE.Face3){j.a.copy(f.vertexNormals[0]);j.b.copy(f.vertexNormals[1]);j.c.copy(f.vertexNormals[2])}else{j.a.copy(f.vertexNormals[0]);j.b.copy(f.vertexNormals[1]);j.c.copy(f.vertexNormals[2]);j.d.copy(f.vertexNormals[3])}}}c=0;for(d=this.faces.length;c<d;c++){f=this.faces[c];f.normal=f.__originalFaceNormal;f.vertexNormals=f.__originalVertexNormals}},computeTangents:function(){function a(a,b,c,d,f,g,J){i=a.vertices[b];k=a.vertices[c];
+j=a.vertices[d];m=h[f];o=h[g];l=h[J];u=k.x-i.x;r=j.x-i.x;n=k.y-i.y;t=j.y-i.y;z=k.z-i.z;w=j.z-i.z;P=o.u-m.u;A=l.u-m.u;q=o.v-m.v;G=l.v-m.v;H=1/(P*G-A*q);N.set((G*u-q*r)*H,(G*n-q*t)*H,(G*z-q*w)*H);ja.set((P*r-A*u)*H,(P*t-A*n)*H,(P*w-A*z)*H);I[b].addSelf(N);I[c].addSelf(N);I[d].addSelf(N);K[b].addSelf(ja);K[c].addSelf(ja);K[d].addSelf(ja)}var b,c,d,f,g,h,i,k,j,m,o,l,u,r,n,t,z,w,P,A,q,G,H,M,I=[],K=[],N=new THREE.Vector3,ja=new THREE.Vector3,oa=new THREE.Vector3,ka=new THREE.Vector3,Y=new THREE.Vector3;
+b=0;for(c=this.vertices.length;b<c;b++){I[b]=new THREE.Vector3;K[b]=new THREE.Vector3}b=0;for(c=this.faces.length;b<c;b++){g=this.faces[b];h=this.faceVertexUvs[0][b];if(g instanceof THREE.Face3)a(this,g.a,g.b,g.c,0,1,2);else if(g instanceof THREE.Face4){a(this,g.a,g.b,g.d,0,1,3);a(this,g.b,g.c,g.d,1,2,3)}}var S=["a","b","c","d"];b=0;for(c=this.faces.length;b<c;b++){g=this.faces[b];for(d=0;d<g.vertexNormals.length;d++){Y.copy(g.vertexNormals[d]);f=g[S[d]];M=I[f];oa.copy(M);oa.subSelf(Y.multiplyScalar(Y.dot(M))).normalize();
+ka.cross(g.vertexNormals[d],M);f=ka.dot(K[f]);f=f<0?-1:1;g.vertexTangents[d]=new THREE.Vector4(oa.x,oa.y,oa.z,f)}}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,f=this.vertices.length;d<f;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,f=Math.pow(10,4),g,h;g=0;for(h=this.vertices.length;g<h;g++){d=this.vertices[g];
+d=[Math.round(d.x*f),Math.round(d.y*f),Math.round(d.z*f)].join("_");if(a[d]===void 0){a[d]=g;b.push(this.vertices[g]);c[g]=b.length-1}else c[g]=c[a[d]]}g=0;for(h=this.faces.length;g<h;g++){a=this.faces[g];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,f,g,h){a=(c-a)*0.5;d=(d-b)*0.5;return(2*(b-c)+a+d)*h+(-3*(b-c)-2*a-d)*g+a*f+b}this.points=a;var c=[],d={x:0,y:0,z:0},f,g,h,i,k,j,m,o,l;this.initFromArray=function(a){this.points=[];for(var b=0;b<a.length;b++)this.points[b]={x:a[b][0],y:a[b][1],z:a[b][2]}};this.getPoint=function(a){f=(this.points.length-1)*a;g=Math.floor(f);h=f-g;c[0]=g===0?g:g-1;c[1]=g;c[2]=g>this.points.length-2?this.points.length-1:g+1;c[3]=g>this.points.length-3?this.points.length-1:
 g+2;j=this.points[c[0]];m=this.points[c[1]];o=this.points[c[2]];l=this.points[c[3]];i=h*h;k=h*i;d.x=b(j.x,m.x,o.x,l.x,h,i,k);d.y=b(j.y,m.y,o.y,l.y,h,i,k);d.z=b(j.z,m.z,o.z,l.z,h,i,k);return d};this.getControlPointsArray=function(){var a,b,c=this.points.length,d=[];for(a=0;a<c;a++){b=this.points[a];d[a]=[b.x,b.y,b.z]}return d};this.getLength=function(a){var b,c,d,f=b=b=0,g=new THREE.Vector3,h=new THREE.Vector3,i=[],j=0;i[0]=0;a||(a=100);c=this.points.length*a;g.copy(this.points[0]);for(a=1;a<c;a++){b=
 a/c;d=this.getPoint(b);h.copy(d);j=j+h.distanceTo(g);g.copy(d);b=(this.points.length-1)*b;b=Math.floor(b);if(b!=f){i[b]=j;f=b}}i[i.length]=j;return{chunks:i,total:j}};this.reparametrizeByArcLength=function(a){var b,c,d,f,g,h,i=[],j=new THREE.Vector3,l=this.getLength();i.push(j.copy(this.points[0]).clone());for(b=1;b<this.points.length;b++){c=l.chunks[b]-l.chunks[b-1];h=Math.ceil(a*c/l.total);f=(b-1)/(this.points.length-1);g=b/(this.points.length-1);for(c=1;c<h-1;c++){d=f+c*(1/h)*(g-f);d=this.getPoint(d);
@@ -150,7 +149,7 @@ THREE.SkinnedMesh=function(a,b){THREE.Mesh.call(this,a,b);this.identityMatrix=ne
 d=this.bones[c];f.parent===-1?this.add(d):this.bones[f.parent].add(d)}this.boneMatrices=new Float32Array(16*this.bones.length);this.pose()}};THREE.SkinnedMesh.prototype=new THREE.Mesh;THREE.SkinnedMesh.prototype.constructor=THREE.SkinnedMesh;THREE.SkinnedMesh.prototype.addBone=function(a){a===void 0&&(a=new THREE.Bone(this));this.bones.push(a);return a};
 THREE.SkinnedMesh.prototype.updateMatrixWorld=function(a){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||a){this.parent?this.matrixWorld.multiply(this.parent.matrixWorld,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=false}for(var a=0,b=this.children.length;a<b;a++){var c=this.children[a];c instanceof THREE.Bone?c.update(this.identityMatrix,false):c.updateMatrixWorld(true)}for(var b=this.bones.length,c=this.bones,d=this.boneMatrices,a=0;a<b;a++)c[a].skinMatrix.flattenToArrayOffset(d,
 a*16)};
-THREE.SkinnedMesh.prototype.pose=function(){this.updateMatrixWorld(true);for(var a,b=[],c=0;c<this.bones.length;c++){a=this.bones[c];var d=new THREE.Matrix4;d.getInverse(a.skinMatrix);b.push(d);a.skinMatrix.flattenToArrayOffset(this.boneMatrices,c*16)}if(this.geometry.skinVerticesA===void 0){this.geometry.skinVerticesA=[];this.geometry.skinVerticesB=[];for(a=0;a<this.geometry.skinIndices.length;a++){var c=this.geometry.vertices[a].position,f=this.geometry.skinIndices[a].x,g=this.geometry.skinIndices[a].y,d=
+THREE.SkinnedMesh.prototype.pose=function(){this.updateMatrixWorld(true);for(var a,b=[],c=0;c<this.bones.length;c++){a=this.bones[c];var d=new THREE.Matrix4;d.getInverse(a.skinMatrix);b.push(d);a.skinMatrix.flattenToArrayOffset(this.boneMatrices,c*16)}if(this.geometry.skinVerticesA===void 0){this.geometry.skinVerticesA=[];this.geometry.skinVerticesB=[];for(a=0;a<this.geometry.skinIndices.length;a++){var c=this.geometry.vertices[a],f=this.geometry.skinIndices[a].x,g=this.geometry.skinIndices[a].y,d=
 new THREE.Vector3(c.x,c.y,c.z);this.geometry.skinVerticesA.push(b[f].multiplyVector3(d));d=new THREE.Vector3(c.x,c.y,c.z);this.geometry.skinVerticesB.push(b[g].multiplyVector3(d));if(this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y!==1){c=(1-(this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y))*0.5;this.geometry.skinWeights[a].x=this.geometry.skinWeights[a].x+c;this.geometry.skinWeights[a].y=this.geometry.skinWeights[a].y+c}}}};
 THREE.Ribbon=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material=b};THREE.Ribbon.prototype=new THREE.Object3D;THREE.Ribbon.prototype.constructor=THREE.Ribbon;THREE.LOD=function(){THREE.Object3D.call(this);this.LODs=[]};THREE.LOD.prototype=new THREE.Object3D;THREE.LOD.prototype.constructor=THREE.LOD;THREE.LOD.prototype.supr=THREE.Object3D.prototype;
 THREE.LOD.prototype.addLevel=function(a,b){b===void 0&&(b=0);for(var b=Math.abs(b),c=0;c<this.LODs.length;c++)if(b<this.LODs[c].visibleAtDistance)break;this.LODs.splice(c,0,{visibleAtDistance:b,object3D:a});this.add(a)};
@@ -199,20 +198,20 @@ THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform vec3
 "}"].join("\n")},depthRGBA:{uniforms:{},vertexShader:[THREE.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n"),fragmentShader:"vec4 pack_depth( const in float depth ) {\nconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\nconst vec4 bit_mask  = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\nvec4 res = fract( depth * bit_shift );\nres -= res.xxyz * bit_mask;\nreturn res;\n}\nvoid main() {\ngl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );\n}"}};
 THREE.WebGLRenderer=function(a){function b(a,b){var c=a.vertices.length,d=b.material;if(d.attributes){if(a.__webglCustomAttributesList===void 0)a.__webglCustomAttributesList=[];for(var f in d.attributes){var g=d.attributes[f];if(!g.__webglInitialized||g.createUniqueBuffers){g.__webglInitialized=true;var h=1;g.type==="v2"?h=2:g.type==="v3"?h=3:g.type==="v4"?h=4:g.type==="c"&&(h=3);g.size=h;g.array=new Float32Array(c*h);g.buffer=e.createBuffer();g.buffer.belongsToAttribute=f;g.needsUpdate=true}a.__webglCustomAttributesList.push(g)}}}
 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 f(a){return a.map||a.lightMap||a instanceof THREE.ShaderMaterial?true:false}function g(a,b,c){var d,f,g,h,i=a.vertices;h=i.length;
-var j=a.colors,l=j.length,o=a.__vertexArray,k=a.__colorArray,m=a.__sortArray,r=a.__dirtyVertices,n=a.__dirtyColors,u=a.__webglCustomAttributesList;if(c.sortParticles){Ob.copy(mb);Ob.multiplySelf(c.matrixWorld);for(d=0;d<h;d++){f=i[d].position;Na.copy(f);Ob.multiplyVector3(Na);m[d]=[Na.z,d]}m.sort(function(a,b){return b[0]-a[0]});for(d=0;d<h;d++){f=i[m[d][1]].position;g=d*3;o[g]=f.x;o[g+1]=f.y;o[g+2]=f.z}for(d=0;d<l;d++){g=d*3;f=j[m[d][1]];k[g]=f.r;k[g+1]=f.g;k[g+2]=f.b}if(u){j=0;for(l=u.length;j<
-l;j++){i=u[j];if(i.boundTo===void 0||i.boundTo==="vertices"){g=0;f=i.value.length;if(i.size===1)for(d=0;d<f;d++){h=m[d][1];i.array[d]=i.value[h]}else if(i.size===2)for(d=0;d<f;d++){h=m[d][1];h=i.value[h];i.array[g]=h.x;i.array[g+1]=h.y;g=g+2}else if(i.size===3)if(i.type==="c")for(d=0;d<f;d++){h=m[d][1];h=i.value[h];i.array[g]=h.r;i.array[g+1]=h.g;i.array[g+2]=h.b;g=g+3}else for(d=0;d<f;d++){h=m[d][1];h=i.value[h];i.array[g]=h.x;i.array[g+1]=h.y;i.array[g+2]=h.z;g=g+3}else if(i.size===4)for(d=0;d<
-f;d++){h=m[d][1];h=i.value[h];i.array[g]=h.x;i.array[g+1]=h.y;i.array[g+2]=h.z;i.array[g+3]=h.w;g=g+4}}}}}else{if(r)for(d=0;d<h;d++){f=i[d].position;g=d*3;o[g]=f.x;o[g+1]=f.y;o[g+2]=f.z}if(n)for(d=0;d<l;d++){f=j[d];g=d*3;k[g]=f.r;k[g+1]=f.g;k[g+2]=f.b}if(u){j=0;for(l=u.length;j<l;j++){i=u[j];if(i.needsUpdate&&(i.boundTo===void 0||i.boundTo==="vertices")){f=i.value.length;g=0;if(i.size===1)for(d=0;d<f;d++)i.array[d]=i.value[d];else if(i.size===2)for(d=0;d<f;d++){h=i.value[d];i.array[g]=h.x;i.array[g+
-1]=h.y;g=g+2}else if(i.size===3)if(i.type==="c")for(d=0;d<f;d++){h=i.value[d];i.array[g]=h.r;i.array[g+1]=h.g;i.array[g+2]=h.b;g=g+3}else for(d=0;d<f;d++){h=i.value[d];i.array[g]=h.x;i.array[g+1]=h.y;i.array[g+2]=h.z;g=g+3}else if(i.size===4)for(d=0;d<f;d++){h=i.value[d];i.array[g]=h.x;i.array[g+1]=h.y;i.array[g+2]=h.z;i.array[g+3]=h.w;g=g+4}}}}}if(r||c.sortParticles){e.bindBuffer(e.ARRAY_BUFFER,a.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,o,b)}if(n||c.sortParticles){e.bindBuffer(e.ARRAY_BUFFER,
-a.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,k,b)}if(u){j=0;for(l=u.length;j<l;j++){i=u[j];if(i.needsUpdate||c.sortParticles){e.bindBuffer(e.ARRAY_BUFFER,i.buffer);e.bufferData(e.ARRAY_BUFFER,i.array,b)}}}}function h(a,b){return b.z-a.z}function i(a,b,c){if(a.length)for(var e=0,d=a.length;e<d;e++){aa=Aa=null;sa=J=Ca=Ka=Ba=-1;a[e].render(b,c,pc,qc);aa=Aa=null;sa=J=Ca=Ka=Ba=-1}}function k(a,b,c,e,d,f,g,h){var i,j,l,m;if(b){j=a.length-1;m=b=-1}else{j=0;b=a.length;m=1}for(var o=j;o!==b;o=o+m){i=
-a[o];if(i.render){j=i.object;l=i.buffer;if(h)i=h;else{i=i[c];if(!i)continue;g&&C.setBlending(i.blending,i.blendEquation,i.blendSrc,i.blendDst);C.setDepthTest(i.depthTest);C.setDepthWrite(i.depthWrite);z(i.polygonOffset,i.polygonOffsetFactor,i.polygonOffsetUnits)}C.setObjectFaces(j);l instanceof THREE.BufferGeometry?C.renderBufferDirect(e,d,f,i,l,j):C.renderBuffer(e,d,f,i,l,j)}}}function j(a,b,c,e,d,f,g){for(var i,h,j=0,l=a.length;j<l;j++){i=a[j];h=i.object;if(h.visible){if(g)i=g;else{i=i[b];if(!i)continue;
-f&&C.setBlending(i.blending,i.blendEquation,i.blendSrc,i.blendDst);C.setDepthTest(i.depthTest);C.setDepthWrite(i.depthWrite);z(i.polygonOffset,i.polygonOffsetFactor,i.polygonOffsetUnits)}C.renderImmediateObject(c,e,d,i,h)}}}function m(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})}function o(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return true;return false}function l(a){for(var b in a.attributes)a.attributes[b].needsUpdate=false}function u(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,f){if(!d.program||d.needsUpdate){C.initMaterial(d,b,c,f);d.needsUpdate=false}if(d.morphTargets&&!f.__webglMorphTargetInfluences){f.__webglMorphTargetInfluences=new Float32Array(C.maxMorphTargets);for(var g=0,i=C.maxMorphTargets;g<i;g++)f.__webglMorphTargetInfluences[g]=0}var h=false,g=d.program,i=g.uniforms,j=d.uniforms;if(g!==Aa){e.useProgram(g);Aa=g;h=true}if(d.id!==
-sa){sa=d.id;h=true}if(h||a!==aa){e.uniformMatrix4fv(i.projectionMatrix,false,a._projectionMatrixArray);a!==aa&&(aa=a)}if(h){if(c&&d.fog){j.fogColor.value=c.color;if(c instanceof THREE.Fog){j.fogNear.value=c.near;j.fogFar.value=c.far}else if(c instanceof THREE.FogExp2)j.fogDensity.value=c.density}if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){for(var l,o=0,m=0,k=0,r,n,u,t=rc,q=t.directional.colors,z=t.directional.positions,w=t.point.colors,A=t.point.positions,
-J=t.point.distances,M=0,N=0,I=u=0,c=0,h=b.length;c<h;c++){l=b[c];if(!l.onlyShadow){r=l.color;n=l.intensity;u=l.distance;if(l instanceof THREE.AmbientLight)if(C.gammaInput){o=o+r.r*r.r;m=m+r.g*r.g;k=k+r.b*r.b}else{o=o+r.r;m=m+r.g;k=k+r.b}else if(l instanceof THREE.DirectionalLight){u=M*3;if(C.gammaInput){q[u]=r.r*r.r*n*n;q[u+1]=r.g*r.g*n*n;q[u+2]=r.b*r.b*n*n}else{q[u]=r.r*n;q[u+1]=r.g*n;q[u+2]=r.b*n}nb.copy(l.matrixWorld.getPosition());nb.subSelf(l.target.matrixWorld.getPosition());nb.normalize();
-z[u]=nb.x;z[u+1]=nb.y;z[u+2]=nb.z;M=M+1}else if(l instanceof THREE.PointLight||l instanceof THREE.SpotLight){I=N*3;if(C.gammaInput){w[I]=r.r*r.r*n*n;w[I+1]=r.g*r.g*n*n;w[I+2]=r.b*r.b*n*n}else{w[I]=r.r*n;w[I+1]=r.g*n;w[I+2]=r.b*n}l=l.matrixWorld.getPosition();A[I]=l.x;A[I+1]=l.y;A[I+2]=l.z;J[N]=u;N=N+1}}}c=M*3;for(h=q.length;c<h;c++)q[c]=0;c=N*3;for(h=w.length;c<h;c++)w[c]=0;t.point.length=N;t.directional.length=M;t.ambient[0]=o;t.ambient[1]=m;t.ambient[2]=k;c=rc;j.ambientLightColor.value=c.ambient;
-j.directionalLightColor.value=c.directional.colors;j.directionalLightDirection.value=c.directional.positions;j.pointLightColor.value=c.point.colors;j.pointLightPosition.value=c.point.positions;j.pointLightDistance.value=c.point.distances}if(d instanceof THREE.MeshBasicMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.MeshPhongMaterial){j.opacity.value=d.opacity;C.gammaInput?j.diffuse.value.copyGammaToLinear(d.color):j.diffuse.value=d.color;(j.map.texture=d.map)&&j.offsetRepeat.value.set(d.map.offset.x,
-d.map.offset.y,d.map.repeat.x,d.map.repeat.y);j.lightMap.texture=d.lightMap;j.envMap.texture=d.envMap;j.flipEnvMap.value=d.envMap instanceof THREE.WebGLRenderTargetCube?1:-1;j.reflectivity.value=d.reflectivity;j.refractionRatio.value=d.refractionRatio;j.combine.value=d.combine;j.useRefract.value=d.envMap&&d.envMap.mapping instanceof THREE.CubeRefractionMapping}if(d instanceof THREE.LineBasicMaterial){j.diffuse.value=d.color;j.opacity.value=d.opacity}else if(d instanceof THREE.ParticleBasicMaterial){j.psColor.value=
-d.color;j.opacity.value=d.opacity;j.size.value=d.size;j.scale.value=H.height/2;j.map.texture=d.map}else if(d instanceof THREE.MeshPhongMaterial){j.shininess.value=d.shininess;if(C.gammaInput){j.ambient.value.copyGammaToLinear(d.ambient);j.emissive.value.copyGammaToLinear(d.emissive);j.specular.value.copyGammaToLinear(d.specular)}else{j.ambient.value=d.ambient;j.emissive.value=d.emissive;j.specular.value=d.specular}d.wrapAround&&j.wrapRGB.value.copy(d.wrapRGB)}else if(d instanceof THREE.MeshLambertMaterial){if(C.gammaInput){j.ambient.value.copyGammaToLinear(d.ambient);
+var j=a.colors,l=j.length,o=a.__vertexArray,k=a.__colorArray,m=a.__sortArray,r=a.__dirtyVertices,n=a.__dirtyColors,u=a.__webglCustomAttributesList;if(c.sortParticles){Ob.copy(mb);Ob.multiplySelf(c.matrixWorld);for(d=0;d<h;d++){f=i[d];Na.copy(f);Ob.multiplyVector3(Na);m[d]=[Na.z,d]}m.sort(function(a,b){return b[0]-a[0]});for(d=0;d<h;d++){f=i[m[d][1]];g=d*3;o[g]=f.x;o[g+1]=f.y;o[g+2]=f.z}for(d=0;d<l;d++){g=d*3;f=j[m[d][1]];k[g]=f.r;k[g+1]=f.g;k[g+2]=f.b}if(u){j=0;for(l=u.length;j<l;j++){i=u[j];if(i.boundTo===
+void 0||i.boundTo==="vertices"){g=0;f=i.value.length;if(i.size===1)for(d=0;d<f;d++){h=m[d][1];i.array[d]=i.value[h]}else if(i.size===2)for(d=0;d<f;d++){h=m[d][1];h=i.value[h];i.array[g]=h.x;i.array[g+1]=h.y;g=g+2}else if(i.size===3)if(i.type==="c")for(d=0;d<f;d++){h=m[d][1];h=i.value[h];i.array[g]=h.r;i.array[g+1]=h.g;i.array[g+2]=h.b;g=g+3}else for(d=0;d<f;d++){h=m[d][1];h=i.value[h];i.array[g]=h.x;i.array[g+1]=h.y;i.array[g+2]=h.z;g=g+3}else if(i.size===4)for(d=0;d<f;d++){h=m[d][1];h=i.value[h];
+i.array[g]=h.x;i.array[g+1]=h.y;i.array[g+2]=h.z;i.array[g+3]=h.w;g=g+4}}}}}else{if(r)for(d=0;d<h;d++){f=i[d];g=d*3;o[g]=f.x;o[g+1]=f.y;o[g+2]=f.z}if(n)for(d=0;d<l;d++){f=j[d];g=d*3;k[g]=f.r;k[g+1]=f.g;k[g+2]=f.b}if(u){j=0;for(l=u.length;j<l;j++){i=u[j];if(i.needsUpdate&&(i.boundTo===void 0||i.boundTo==="vertices")){f=i.value.length;g=0;if(i.size===1)for(d=0;d<f;d++)i.array[d]=i.value[d];else if(i.size===2)for(d=0;d<f;d++){h=i.value[d];i.array[g]=h.x;i.array[g+1]=h.y;g=g+2}else if(i.size===3)if(i.type===
+"c")for(d=0;d<f;d++){h=i.value[d];i.array[g]=h.r;i.array[g+1]=h.g;i.array[g+2]=h.b;g=g+3}else for(d=0;d<f;d++){h=i.value[d];i.array[g]=h.x;i.array[g+1]=h.y;i.array[g+2]=h.z;g=g+3}else if(i.size===4)for(d=0;d<f;d++){h=i.value[d];i.array[g]=h.x;i.array[g+1]=h.y;i.array[g+2]=h.z;i.array[g+3]=h.w;g=g+4}}}}}if(r||c.sortParticles){e.bindBuffer(e.ARRAY_BUFFER,a.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,o,b)}if(n||c.sortParticles){e.bindBuffer(e.ARRAY_BUFFER,a.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,
+k,b)}if(u){j=0;for(l=u.length;j<l;j++){i=u[j];if(i.needsUpdate||c.sortParticles){e.bindBuffer(e.ARRAY_BUFFER,i.buffer);e.bufferData(e.ARRAY_BUFFER,i.array,b)}}}}function h(a,b){return b.z-a.z}function i(a,b,c){if(a.length)for(var e=0,d=a.length;e<d;e++){aa=Aa=null;sa=J=Ca=Ka=Ba=-1;a[e].render(b,c,pc,qc);aa=Aa=null;sa=J=Ca=Ka=Ba=-1}}function k(a,b,c,e,d,f,g,h){var i,j,l,m;if(b){j=a.length-1;m=b=-1}else{j=0;b=a.length;m=1}for(var o=j;o!==b;o=o+m){i=a[o];if(i.render){j=i.object;l=i.buffer;if(h)i=h;else{i=
+i[c];if(!i)continue;g&&C.setBlending(i.blending,i.blendEquation,i.blendSrc,i.blendDst);C.setDepthTest(i.depthTest);C.setDepthWrite(i.depthWrite);z(i.polygonOffset,i.polygonOffsetFactor,i.polygonOffsetUnits)}C.setObjectFaces(j);l instanceof THREE.BufferGeometry?C.renderBufferDirect(e,d,f,i,l,j):C.renderBuffer(e,d,f,i,l,j)}}}function j(a,b,c,e,d,f,g){for(var i,h,j=0,l=a.length;j<l;j++){i=a[j];h=i.object;if(h.visible){if(g)i=g;else{i=i[b];if(!i)continue;f&&C.setBlending(i.blending,i.blendEquation,i.blendSrc,
+i.blendDst);C.setDepthTest(i.depthTest);C.setDepthWrite(i.depthWrite);z(i.polygonOffset,i.polygonOffsetFactor,i.polygonOffsetUnits)}C.renderImmediateObject(c,e,d,i,h)}}}function m(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})}function o(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return true;return false}function l(a){for(var b in a.attributes)a.attributes[b].needsUpdate=false}function u(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,f){if(!d.program||d.needsUpdate){C.initMaterial(d,b,c,f);d.needsUpdate=false}if(d.morphTargets&&!f.__webglMorphTargetInfluences){f.__webglMorphTargetInfluences=new Float32Array(C.maxMorphTargets);for(var g=0,i=C.maxMorphTargets;g<i;g++)f.__webglMorphTargetInfluences[g]=0}var h=false,g=d.program,i=g.uniforms,j=d.uniforms;if(g!==Aa){e.useProgram(g);Aa=g;h=true}if(d.id!==sa){sa=d.id;h=true}if(h||a!==aa){e.uniformMatrix4fv(i.projectionMatrix,
+false,a._projectionMatrixArray);a!==aa&&(aa=a)}if(h){if(c&&d.fog){j.fogColor.value=c.color;if(c instanceof THREE.Fog){j.fogNear.value=c.near;j.fogFar.value=c.far}else if(c instanceof THREE.FogExp2)j.fogDensity.value=c.density}if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){for(var l,o=0,m=0,k=0,r,n,u,t=rc,q=t.directional.colors,z=t.directional.positions,w=t.point.colors,A=t.point.positions,J=t.point.distances,M=0,N=0,I=u=0,c=0,h=b.length;c<h;c++){l=b[c];
+if(!l.onlyShadow){r=l.color;n=l.intensity;u=l.distance;if(l instanceof THREE.AmbientLight)if(C.gammaInput){o=o+r.r*r.r;m=m+r.g*r.g;k=k+r.b*r.b}else{o=o+r.r;m=m+r.g;k=k+r.b}else if(l instanceof THREE.DirectionalLight){u=M*3;if(C.gammaInput){q[u]=r.r*r.r*n*n;q[u+1]=r.g*r.g*n*n;q[u+2]=r.b*r.b*n*n}else{q[u]=r.r*n;q[u+1]=r.g*n;q[u+2]=r.b*n}nb.copy(l.matrixWorld.getPosition());nb.subSelf(l.target.matrixWorld.getPosition());nb.normalize();z[u]=nb.x;z[u+1]=nb.y;z[u+2]=nb.z;M=M+1}else if(l instanceof THREE.PointLight||
+l instanceof THREE.SpotLight){I=N*3;if(C.gammaInput){w[I]=r.r*r.r*n*n;w[I+1]=r.g*r.g*n*n;w[I+2]=r.b*r.b*n*n}else{w[I]=r.r*n;w[I+1]=r.g*n;w[I+2]=r.b*n}l=l.matrixWorld.getPosition();A[I]=l.x;A[I+1]=l.y;A[I+2]=l.z;J[N]=u;N=N+1}}}c=M*3;for(h=q.length;c<h;c++)q[c]=0;c=N*3;for(h=w.length;c<h;c++)w[c]=0;t.point.length=N;t.directional.length=M;t.ambient[0]=o;t.ambient[1]=m;t.ambient[2]=k;c=rc;j.ambientLightColor.value=c.ambient;j.directionalLightColor.value=c.directional.colors;j.directionalLightDirection.value=
+c.directional.positions;j.pointLightColor.value=c.point.colors;j.pointLightPosition.value=c.point.positions;j.pointLightDistance.value=c.point.distances}if(d instanceof THREE.MeshBasicMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.MeshPhongMaterial){j.opacity.value=d.opacity;C.gammaInput?j.diffuse.value.copyGammaToLinear(d.color):j.diffuse.value=d.color;(j.map.texture=d.map)&&j.offsetRepeat.value.set(d.map.offset.x,d.map.offset.y,d.map.repeat.x,d.map.repeat.y);j.lightMap.texture=
+d.lightMap;j.envMap.texture=d.envMap;j.flipEnvMap.value=d.envMap instanceof THREE.WebGLRenderTargetCube?1:-1;j.reflectivity.value=d.reflectivity;j.refractionRatio.value=d.refractionRatio;j.combine.value=d.combine;j.useRefract.value=d.envMap&&d.envMap.mapping instanceof THREE.CubeRefractionMapping}if(d instanceof THREE.LineBasicMaterial){j.diffuse.value=d.color;j.opacity.value=d.opacity}else if(d instanceof THREE.ParticleBasicMaterial){j.psColor.value=d.color;j.opacity.value=d.opacity;j.size.value=
+d.size;j.scale.value=H.height/2;j.map.texture=d.map}else if(d instanceof THREE.MeshPhongMaterial){j.shininess.value=d.shininess;if(C.gammaInput){j.ambient.value.copyGammaToLinear(d.ambient);j.emissive.value.copyGammaToLinear(d.emissive);j.specular.value.copyGammaToLinear(d.specular)}else{j.ambient.value=d.ambient;j.emissive.value=d.emissive;j.specular.value=d.specular}d.wrapAround&&j.wrapRGB.value.copy(d.wrapRGB)}else if(d instanceof THREE.MeshLambertMaterial){if(C.gammaInput){j.ambient.value.copyGammaToLinear(d.ambient);
 j.emissive.value.copyGammaToLinear(d.emissive)}else{j.ambient.value=d.ambient;j.emissive.value=d.emissive}d.wrapAround&&j.wrapRGB.value.copy(d.wrapRGB)}else if(d instanceof THREE.MeshDepthMaterial){j.mNear.value=a.near;j.mFar.value=a.far;j.opacity.value=d.opacity}else if(d instanceof THREE.MeshNormalMaterial)j.opacity.value=d.opacity;if(f.receiveShadow&&!d._shadowPass&&j.shadowMatrix){h=c=0;for(o=b.length;h<o;h++){m=b[h];if(m.castShadow&&(m instanceof THREE.SpotLight||m instanceof THREE.DirectionalLight&&
 !m.shadowCascade)){j.shadowMap.texture[c]=m.shadowMap;j.shadowMapSize.value[c]=m.shadowMapSize;j.shadowMatrix.value[c]=m.shadowMatrix;j.shadowDarkness.value[c]=m.shadowDarkness;j.shadowBias.value[c]=m.shadowBias;c++}}}b=d.uniformsList;j=0;for(c=b.length;j<c;j++)if(m=g.uniforms[b[j][1]]){h=b[j][0];k=h.type;o=h.value;if(k==="i")e.uniform1i(m,o);else if(k==="f")e.uniform1f(m,o);else if(k==="v2")e.uniform2f(m,o.x,o.y);else if(k==="v3")e.uniform3f(m,o.x,o.y,o.z);else if(k==="v4")e.uniform4f(m,o.x,o.y,
 o.z,o.w);else if(k==="c")e.uniform3f(m,o.r,o.g,o.b);else if(k==="fv1")e.uniform1fv(m,o);else if(k==="fv")e.uniform3fv(m,o);else if(k==="v2v"){if(!h._array)h._array=new Float32Array(2*o.length);k=0;for(t=o.length;k<t;k++){q=k*2;h._array[q]=o[k].x;h._array[q+1]=o[k].y}e.uniform2fv(m,h._array)}else if(k==="v3v"){if(!h._array)h._array=new Float32Array(3*o.length);k=0;for(t=o.length;k<t;k++){q=k*3;h._array[q]=o[k].x;h._array[q+1]=o[k].y;h._array[q+2]=o[k].z}e.uniform3fv(m,h._array)}else if(k=="v4v"){if(!h._array)h._array=
@@ -275,41 +274,41 @@ pc;Jc++){var Ua=a.__webglObjects[Jc].object,R=Ua.geometry,dc=void 0,Rb=void 0,Fa
 R.__dirtyTangents||Rb){var O=dc,rc=Ua,Ha=e.DYNAMIC_DRAW,sc=!R.dynamic,Jb=Fa;if(O.__inittedArrays){var Yb=d(Jb),Lc=Jb.vertexColors?Jb.vertexColors:false,Zb=f(Jb),uc=Yb===THREE.SmoothShading,v=void 0,B=void 0,Ta=void 0,y=void 0,Sb=void 0,ub=void 0,Va=void 0,vc=void 0,ob=void 0,Tb=void 0,Ub=void 0,D=void 0,E=void 0,F=void 0,Z=void 0,Xa=void 0,Ya=void 0,Za=void 0,ec=void 0,$a=void 0,ab=void 0,bb=void 0,fc=void 0,cb=void 0,db=void 0,eb=void 0,gc=void 0,fb=void 0,gb=void 0,hb=void 0,hc=void 0,ib=void 0,
 jb=void 0,kb=void 0,ic=void 0,vb=void 0,wb=void 0,xb=void 0,wc=void 0,yb=void 0,zb=void 0,Ab=void 0,xc=void 0,V=void 0,bc=void 0,Bb=void 0,Vb=void 0,Wb=void 0,ua=void 0,Tc=void 0,qa=void 0,ra=void 0,Cb=void 0,pb=void 0,la=0,pa=0,qb=0,rb=0,Pa=0,za=0,$=0,Da=0,ma=0,x=0,L=0,s=0,Ia=void 0,va=O.__vertexArray,jc=O.__uvArray,kc=O.__uv2Array,Qa=O.__normalArray,da=O.__tangentArray,wa=O.__colorArray,ea=O.__skinVertexAArray,fa=O.__skinVertexBArray,ga=O.__skinIndexArray,ha=O.__skinWeightArray,Mc=O.__morphTargetsArrays,
 Nc=O.__morphNormalsArrays,Oc=O.__webglCustomAttributesList,p=void 0,lb=O.__faceArray,Ja=O.__lineArray,Ea=rc.geometry,Ic=Ea.__dirtyElements,Uc=Ea.__dirtyUvs,ad=Ea.__dirtyNormals,bd=Ea.__dirtyTangents,cd=Ea.__dirtyColors,dd=Ea.__dirtyMorphTargets,Kb=Ea.vertices,W=O.faces3,X=O.faces4,na=Ea.faces,Pc=Ea.faceVertexUvs[0],Qc=Ea.faceVertexUvs[1],Lb=Ea.skinVerticesA,Mb=Ea.skinVerticesB,Nb=Ea.skinIndices,Db=Ea.skinWeights,Eb=Ea.morphTargets,yc=Ea.morphNormals;if(Ea.__dirtyVertices){v=0;for(B=W.length;v<B;v++){y=
-na[W[v]];D=Kb[y.a].position;E=Kb[y.b].position;F=Kb[y.c].position;va[pa]=D.x;va[pa+1]=D.y;va[pa+2]=D.z;va[pa+3]=E.x;va[pa+4]=E.y;va[pa+5]=E.z;va[pa+6]=F.x;va[pa+7]=F.y;va[pa+8]=F.z;pa=pa+9}v=0;for(B=X.length;v<B;v++){y=na[X[v]];D=Kb[y.a].position;E=Kb[y.b].position;F=Kb[y.c].position;Z=Kb[y.d].position;va[pa]=D.x;va[pa+1]=D.y;va[pa+2]=D.z;va[pa+3]=E.x;va[pa+4]=E.y;va[pa+5]=E.z;va[pa+6]=F.x;va[pa+7]=F.y;va[pa+8]=F.z;va[pa+9]=Z.x;va[pa+10]=Z.y;va[pa+11]=Z.z;pa=pa+12}e.bindBuffer(e.ARRAY_BUFFER,O.__webglVertexBuffer);
-e.bufferData(e.ARRAY_BUFFER,va,Ha)}if(dd){ua=0;for(Tc=Eb.length;ua<Tc;ua++){v=L=0;for(B=W.length;v<B;v++){Cb=W[v];y=na[Cb];D=Eb[ua].vertices[y.a].position;E=Eb[ua].vertices[y.b].position;F=Eb[ua].vertices[y.c].position;qa=Mc[ua];qa[L]=D.x;qa[L+1]=D.y;qa[L+2]=D.z;qa[L+3]=E.x;qa[L+4]=E.y;qa[L+5]=E.z;qa[L+6]=F.x;qa[L+7]=F.y;qa[L+8]=F.z;if(Jb.morphNormals){if(uc){pb=yc[ua].vertexNormals[Cb];$a=pb.a;ab=pb.b;bb=pb.c}else bb=ab=$a=yc[ua].faceNormals[Cb];ra=Nc[ua];ra[L]=$a.x;ra[L+1]=$a.y;ra[L+2]=$a.z;ra[L+
-3]=ab.x;ra[L+4]=ab.y;ra[L+5]=ab.z;ra[L+6]=bb.x;ra[L+7]=bb.y;ra[L+8]=bb.z}L=L+9}v=0;for(B=X.length;v<B;v++){Cb=X[v];y=na[Cb];D=Eb[ua].vertices[y.a].position;E=Eb[ua].vertices[y.b].position;F=Eb[ua].vertices[y.c].position;Z=Eb[ua].vertices[y.d].position;qa=Mc[ua];qa[L]=D.x;qa[L+1]=D.y;qa[L+2]=D.z;qa[L+3]=E.x;qa[L+4]=E.y;qa[L+5]=E.z;qa[L+6]=F.x;qa[L+7]=F.y;qa[L+8]=F.z;qa[L+9]=Z.x;qa[L+10]=Z.y;qa[L+11]=Z.z;if(Jb.morphNormals){if(uc){pb=yc[ua].vertexNormals[Cb];$a=pb.a;ab=pb.b;bb=pb.c;fc=pb.d}else fc=
-bb=ab=$a=yc[ua].faceNormals[Cb];ra=Nc[ua];ra[L]=$a.x;ra[L+1]=$a.y;ra[L+2]=$a.z;ra[L+3]=ab.x;ra[L+4]=ab.y;ra[L+5]=ab.z;ra[L+6]=bb.x;ra[L+7]=bb.y;ra[L+8]=bb.z;ra[L+9]=fc.x;ra[L+10]=fc.y;ra[L+11]=fc.z}L=L+12}e.bindBuffer(e.ARRAY_BUFFER,O.__webglMorphTargetsBuffers[ua]);e.bufferData(e.ARRAY_BUFFER,Mc[ua],Ha);if(Jb.morphNormals){e.bindBuffer(e.ARRAY_BUFFER,O.__webglMorphNormalsBuffers[ua]);e.bufferData(e.ARRAY_BUFFER,Nc[ua],Ha)}}}if(Db.length){v=0;for(B=W.length;v<B;v++){y=na[W[v]];fb=Db[y.a];gb=Db[y.b];
-hb=Db[y.c];ha[x]=fb.x;ha[x+1]=fb.y;ha[x+2]=fb.z;ha[x+3]=fb.w;ha[x+4]=gb.x;ha[x+5]=gb.y;ha[x+6]=gb.z;ha[x+7]=gb.w;ha[x+8]=hb.x;ha[x+9]=hb.y;ha[x+10]=hb.z;ha[x+11]=hb.w;ib=Nb[y.a];jb=Nb[y.b];kb=Nb[y.c];ga[x]=ib.x;ga[x+1]=ib.y;ga[x+2]=ib.z;ga[x+3]=ib.w;ga[x+4]=jb.x;ga[x+5]=jb.y;ga[x+6]=jb.z;ga[x+7]=jb.w;ga[x+8]=kb.x;ga[x+9]=kb.y;ga[x+10]=kb.z;ga[x+11]=kb.w;vb=Lb[y.a];wb=Lb[y.b];xb=Lb[y.c];ea[x]=vb.x;ea[x+1]=vb.y;ea[x+2]=vb.z;ea[x+3]=1;ea[x+4]=wb.x;ea[x+5]=wb.y;ea[x+6]=wb.z;ea[x+7]=1;ea[x+8]=xb.x;ea[x+
-9]=xb.y;ea[x+10]=xb.z;ea[x+11]=1;yb=Mb[y.a];zb=Mb[y.b];Ab=Mb[y.c];fa[x]=yb.x;fa[x+1]=yb.y;fa[x+2]=yb.z;fa[x+3]=1;fa[x+4]=zb.x;fa[x+5]=zb.y;fa[x+6]=zb.z;fa[x+7]=1;fa[x+8]=Ab.x;fa[x+9]=Ab.y;fa[x+10]=Ab.z;fa[x+11]=1;x=x+12}v=0;for(B=X.length;v<B;v++){y=na[X[v]];fb=Db[y.a];gb=Db[y.b];hb=Db[y.c];hc=Db[y.d];ha[x]=fb.x;ha[x+1]=fb.y;ha[x+2]=fb.z;ha[x+3]=fb.w;ha[x+4]=gb.x;ha[x+5]=gb.y;ha[x+6]=gb.z;ha[x+7]=gb.w;ha[x+8]=hb.x;ha[x+9]=hb.y;ha[x+10]=hb.z;ha[x+11]=hb.w;ha[x+12]=hc.x;ha[x+13]=hc.y;ha[x+14]=hc.z;
-ha[x+15]=hc.w;ib=Nb[y.a];jb=Nb[y.b];kb=Nb[y.c];ic=Nb[y.d];ga[x]=ib.x;ga[x+1]=ib.y;ga[x+2]=ib.z;ga[x+3]=ib.w;ga[x+4]=jb.x;ga[x+5]=jb.y;ga[x+6]=jb.z;ga[x+7]=jb.w;ga[x+8]=kb.x;ga[x+9]=kb.y;ga[x+10]=kb.z;ga[x+11]=kb.w;ga[x+12]=ic.x;ga[x+13]=ic.y;ga[x+14]=ic.z;ga[x+15]=ic.w;vb=Lb[y.a];wb=Lb[y.b];xb=Lb[y.c];wc=Lb[y.d];ea[x]=vb.x;ea[x+1]=vb.y;ea[x+2]=vb.z;ea[x+3]=1;ea[x+4]=wb.x;ea[x+5]=wb.y;ea[x+6]=wb.z;ea[x+7]=1;ea[x+8]=xb.x;ea[x+9]=xb.y;ea[x+10]=xb.z;ea[x+11]=1;ea[x+12]=wc.x;ea[x+13]=wc.y;ea[x+14]=wc.z;
-ea[x+15]=1;yb=Mb[y.a];zb=Mb[y.b];Ab=Mb[y.c];xc=Mb[y.d];fa[x]=yb.x;fa[x+1]=yb.y;fa[x+2]=yb.z;fa[x+3]=1;fa[x+4]=zb.x;fa[x+5]=zb.y;fa[x+6]=zb.z;fa[x+7]=1;fa[x+8]=Ab.x;fa[x+9]=Ab.y;fa[x+10]=Ab.z;fa[x+11]=1;fa[x+12]=xc.x;fa[x+13]=xc.y;fa[x+14]=xc.z;fa[x+15]=1;x=x+16}if(x>0){e.bindBuffer(e.ARRAY_BUFFER,O.__webglSkinVertexABuffer);e.bufferData(e.ARRAY_BUFFER,ea,Ha);e.bindBuffer(e.ARRAY_BUFFER,O.__webglSkinVertexBBuffer);e.bufferData(e.ARRAY_BUFFER,fa,Ha);e.bindBuffer(e.ARRAY_BUFFER,O.__webglSkinIndicesBuffer);
-e.bufferData(e.ARRAY_BUFFER,ga,Ha);e.bindBuffer(e.ARRAY_BUFFER,O.__webglSkinWeightsBuffer);e.bufferData(e.ARRAY_BUFFER,ha,Ha)}}if(cd&&Lc){v=0;for(B=W.length;v<B;v++){y=na[W[v]];Va=y.vertexColors;vc=y.color;if(Va.length===3&&Lc===THREE.VertexColors){cb=Va[0];db=Va[1];eb=Va[2]}else eb=db=cb=vc;wa[ma]=cb.r;wa[ma+1]=cb.g;wa[ma+2]=cb.b;wa[ma+3]=db.r;wa[ma+4]=db.g;wa[ma+5]=db.b;wa[ma+6]=eb.r;wa[ma+7]=eb.g;wa[ma+8]=eb.b;ma=ma+9}v=0;for(B=X.length;v<B;v++){y=na[X[v]];Va=y.vertexColors;vc=y.color;if(Va.length===
-4&&Lc===THREE.VertexColors){cb=Va[0];db=Va[1];eb=Va[2];gc=Va[3]}else gc=eb=db=cb=vc;wa[ma]=cb.r;wa[ma+1]=cb.g;wa[ma+2]=cb.b;wa[ma+3]=db.r;wa[ma+4]=db.g;wa[ma+5]=db.b;wa[ma+6]=eb.r;wa[ma+7]=eb.g;wa[ma+8]=eb.b;wa[ma+9]=gc.r;wa[ma+10]=gc.g;wa[ma+11]=gc.b;ma=ma+12}if(ma>0){e.bindBuffer(e.ARRAY_BUFFER,O.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,wa,Ha)}}if(bd&&Ea.hasTangents){v=0;for(B=W.length;v<B;v++){y=na[W[v]];ob=y.vertexTangents;Xa=ob[0];Ya=ob[1];Za=ob[2];da[$]=Xa.x;da[$+1]=Xa.y;da[$+2]=Xa.z;
-da[$+3]=Xa.w;da[$+4]=Ya.x;da[$+5]=Ya.y;da[$+6]=Ya.z;da[$+7]=Ya.w;da[$+8]=Za.x;da[$+9]=Za.y;da[$+10]=Za.z;da[$+11]=Za.w;$=$+12}v=0;for(B=X.length;v<B;v++){y=na[X[v]];ob=y.vertexTangents;Xa=ob[0];Ya=ob[1];Za=ob[2];ec=ob[3];da[$]=Xa.x;da[$+1]=Xa.y;da[$+2]=Xa.z;da[$+3]=Xa.w;da[$+4]=Ya.x;da[$+5]=Ya.y;da[$+6]=Ya.z;da[$+7]=Ya.w;da[$+8]=Za.x;da[$+9]=Za.y;da[$+10]=Za.z;da[$+11]=Za.w;da[$+12]=ec.x;da[$+13]=ec.y;da[$+14]=ec.z;da[$+15]=ec.w;$=$+16}e.bindBuffer(e.ARRAY_BUFFER,O.__webglTangentBuffer);e.bufferData(e.ARRAY_BUFFER,
-da,Ha)}if(ad&&Yb){v=0;for(B=W.length;v<B;v++){y=na[W[v]];Sb=y.vertexNormals;ub=y.normal;if(Sb.length===3&&uc)for(V=0;V<3;V++){Bb=Sb[V];Qa[za]=Bb.x;Qa[za+1]=Bb.y;Qa[za+2]=Bb.z;za=za+3}else for(V=0;V<3;V++){Qa[za]=ub.x;Qa[za+1]=ub.y;Qa[za+2]=ub.z;za=za+3}}v=0;for(B=X.length;v<B;v++){y=na[X[v]];Sb=y.vertexNormals;ub=y.normal;if(Sb.length===4&&uc)for(V=0;V<4;V++){Bb=Sb[V];Qa[za]=Bb.x;Qa[za+1]=Bb.y;Qa[za+2]=Bb.z;za=za+3}else for(V=0;V<4;V++){Qa[za]=ub.x;Qa[za+1]=ub.y;Qa[za+2]=ub.z;za=za+3}}e.bindBuffer(e.ARRAY_BUFFER,
-O.__webglNormalBuffer);e.bufferData(e.ARRAY_BUFFER,Qa,Ha)}if(Uc&&Pc&&Zb){v=0;for(B=W.length;v<B;v++){Ta=W[v];y=na[Ta];Tb=Pc[Ta];if(Tb!==void 0)for(V=0;V<3;V++){Vb=Tb[V];jc[qb]=Vb.u;jc[qb+1]=Vb.v;qb=qb+2}}v=0;for(B=X.length;v<B;v++){Ta=X[v];y=na[Ta];Tb=Pc[Ta];if(Tb!==void 0)for(V=0;V<4;V++){Vb=Tb[V];jc[qb]=Vb.u;jc[qb+1]=Vb.v;qb=qb+2}}if(qb>0){e.bindBuffer(e.ARRAY_BUFFER,O.__webglUVBuffer);e.bufferData(e.ARRAY_BUFFER,jc,Ha)}}if(Uc&&Qc&&Zb){v=0;for(B=W.length;v<B;v++){Ta=W[v];y=na[Ta];Ub=Qc[Ta];if(Ub!==
-void 0)for(V=0;V<3;V++){Wb=Ub[V];kc[rb]=Wb.u;kc[rb+1]=Wb.v;rb=rb+2}}v=0;for(B=X.length;v<B;v++){Ta=X[v];y=na[Ta];Ub=Qc[Ta];if(Ub!==void 0)for(V=0;V<4;V++){Wb=Ub[V];kc[rb]=Wb.u;kc[rb+1]=Wb.v;rb=rb+2}}if(rb>0){e.bindBuffer(e.ARRAY_BUFFER,O.__webglUV2Buffer);e.bufferData(e.ARRAY_BUFFER,kc,Ha)}}if(Ic){v=0;for(B=W.length;v<B;v++){y=na[W[v]];lb[Pa]=la;lb[Pa+1]=la+1;lb[Pa+2]=la+2;Pa=Pa+3;Ja[Da]=la;Ja[Da+1]=la+1;Ja[Da+2]=la;Ja[Da+3]=la+2;Ja[Da+4]=la+1;Ja[Da+5]=la+2;Da=Da+6;la=la+3}v=0;for(B=X.length;v<B;v++){y=
-na[X[v]];lb[Pa]=la;lb[Pa+1]=la+1;lb[Pa+2]=la+3;lb[Pa+3]=la+1;lb[Pa+4]=la+2;lb[Pa+5]=la+3;Pa=Pa+6;Ja[Da]=la;Ja[Da+1]=la+1;Ja[Da+2]=la;Ja[Da+3]=la+3;Ja[Da+4]=la+1;Ja[Da+5]=la+2;Ja[Da+6]=la+2;Ja[Da+7]=la+3;Da=Da+8;la=la+4}e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,O.__webglFaceBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,lb,Ha);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,O.__webglLineBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,Ja,Ha)}if(Oc){V=0;for(bc=Oc.length;V<bc;V++){p=Oc[V];if(p.__original.needsUpdate){s=0;if(p.size===
-1)if(p.boundTo===void 0||p.boundTo==="vertices"){v=0;for(B=W.length;v<B;v++){y=na[W[v]];p.array[s]=p.value[y.a];p.array[s+1]=p.value[y.b];p.array[s+2]=p.value[y.c];s=s+3}v=0;for(B=X.length;v<B;v++){y=na[X[v]];p.array[s]=p.value[y.a];p.array[s+1]=p.value[y.b];p.array[s+2]=p.value[y.c];p.array[s+3]=p.value[y.d];s=s+4}}else{if(p.boundTo==="faces"){v=0;for(B=W.length;v<B;v++){Ia=p.value[W[v]];p.array[s]=Ia;p.array[s+1]=Ia;p.array[s+2]=Ia;s=s+3}v=0;for(B=X.length;v<B;v++){Ia=p.value[X[v]];p.array[s]=Ia;
-p.array[s+1]=Ia;p.array[s+2]=Ia;p.array[s+3]=Ia;s=s+4}}}else if(p.size===2)if(p.boundTo===void 0||p.boundTo==="vertices"){v=0;for(B=W.length;v<B;v++){y=na[W[v]];D=p.value[y.a];E=p.value[y.b];F=p.value[y.c];p.array[s]=D.x;p.array[s+1]=D.y;p.array[s+2]=E.x;p.array[s+3]=E.y;p.array[s+4]=F.x;p.array[s+5]=F.y;s=s+6}v=0;for(B=X.length;v<B;v++){y=na[X[v]];D=p.value[y.a];E=p.value[y.b];F=p.value[y.c];Z=p.value[y.d];p.array[s]=D.x;p.array[s+1]=D.y;p.array[s+2]=E.x;p.array[s+3]=E.y;p.array[s+4]=F.x;p.array[s+
-5]=F.y;p.array[s+6]=Z.x;p.array[s+7]=Z.y;s=s+8}}else{if(p.boundTo==="faces"){v=0;for(B=W.length;v<B;v++){F=E=D=Ia=p.value[W[v]];p.array[s]=D.x;p.array[s+1]=D.y;p.array[s+2]=E.x;p.array[s+3]=E.y;p.array[s+4]=F.x;p.array[s+5]=F.y;s=s+6}v=0;for(B=X.length;v<B;v++){Z=F=E=D=Ia=p.value[X[v]];p.array[s]=D.x;p.array[s+1]=D.y;p.array[s+2]=E.x;p.array[s+3]=E.y;p.array[s+4]=F.x;p.array[s+5]=F.y;p.array[s+6]=Z.x;p.array[s+7]=Z.y;s=s+8}}}else if(p.size===3){var Q;Q=p.type==="c"?["r","g","b"]:["x","y","z"];if(p.boundTo===
-void 0||p.boundTo==="vertices"){v=0;for(B=W.length;v<B;v++){y=na[W[v]];D=p.value[y.a];E=p.value[y.b];F=p.value[y.c];p.array[s]=D[Q[0]];p.array[s+1]=D[Q[1]];p.array[s+2]=D[Q[2]];p.array[s+3]=E[Q[0]];p.array[s+4]=E[Q[1]];p.array[s+5]=E[Q[2]];p.array[s+6]=F[Q[0]];p.array[s+7]=F[Q[1]];p.array[s+8]=F[Q[2]];s=s+9}v=0;for(B=X.length;v<B;v++){y=na[X[v]];D=p.value[y.a];E=p.value[y.b];F=p.value[y.c];Z=p.value[y.d];p.array[s]=D[Q[0]];p.array[s+1]=D[Q[1]];p.array[s+2]=D[Q[2]];p.array[s+3]=E[Q[0]];p.array[s+4]=
-E[Q[1]];p.array[s+5]=E[Q[2]];p.array[s+6]=F[Q[0]];p.array[s+7]=F[Q[1]];p.array[s+8]=F[Q[2]];p.array[s+9]=Z[Q[0]];p.array[s+10]=Z[Q[1]];p.array[s+11]=Z[Q[2]];s=s+12}}else if(p.boundTo==="faces"){v=0;for(B=W.length;v<B;v++){F=E=D=Ia=p.value[W[v]];p.array[s]=D[Q[0]];p.array[s+1]=D[Q[1]];p.array[s+2]=D[Q[2]];p.array[s+3]=E[Q[0]];p.array[s+4]=E[Q[1]];p.array[s+5]=E[Q[2]];p.array[s+6]=F[Q[0]];p.array[s+7]=F[Q[1]];p.array[s+8]=F[Q[2]];s=s+9}v=0;for(B=X.length;v<B;v++){Z=F=E=D=Ia=p.value[X[v]];p.array[s]=
-D[Q[0]];p.array[s+1]=D[Q[1]];p.array[s+2]=D[Q[2]];p.array[s+3]=E[Q[0]];p.array[s+4]=E[Q[1]];p.array[s+5]=E[Q[2]];p.array[s+6]=F[Q[0]];p.array[s+7]=F[Q[1]];p.array[s+8]=F[Q[2]];p.array[s+9]=Z[Q[0]];p.array[s+10]=Z[Q[1]];p.array[s+11]=Z[Q[2]];s=s+12}}}else if(p.size===4)if(p.boundTo===void 0||p.boundTo==="vertices"){v=0;for(B=W.length;v<B;v++){y=na[W[v]];D=p.value[y.a];E=p.value[y.b];F=p.value[y.c];p.array[s]=D.x;p.array[s+1]=D.y;p.array[s+2]=D.z;p.array[s+3]=D.w;p.array[s+4]=E.x;p.array[s+5]=E.y;p.array[s+
-6]=E.z;p.array[s+7]=E.w;p.array[s+8]=F.x;p.array[s+9]=F.y;p.array[s+10]=F.z;p.array[s+11]=F.w;s=s+12}v=0;for(B=X.length;v<B;v++){y=na[X[v]];D=p.value[y.a];E=p.value[y.b];F=p.value[y.c];Z=p.value[y.d];p.array[s]=D.x;p.array[s+1]=D.y;p.array[s+2]=D.z;p.array[s+3]=D.w;p.array[s+4]=E.x;p.array[s+5]=E.y;p.array[s+6]=E.z;p.array[s+7]=E.w;p.array[s+8]=F.x;p.array[s+9]=F.y;p.array[s+10]=F.z;p.array[s+11]=F.w;p.array[s+12]=Z.x;p.array[s+13]=Z.y;p.array[s+14]=Z.z;p.array[s+15]=Z.w;s=s+16}}else if(p.boundTo===
-"faces"){v=0;for(B=W.length;v<B;v++){F=E=D=Ia=p.value[W[v]];p.array[s]=D.x;p.array[s+1]=D.y;p.array[s+2]=D.z;p.array[s+3]=D.w;p.array[s+4]=E.x;p.array[s+5]=E.y;p.array[s+6]=E.z;p.array[s+7]=E.w;p.array[s+8]=F.x;p.array[s+9]=F.y;p.array[s+10]=F.z;p.array[s+11]=F.w;s=s+12}v=0;for(B=X.length;v<B;v++){Z=F=E=D=Ia=p.value[X[v]];p.array[s]=D.x;p.array[s+1]=D.y;p.array[s+2]=D.z;p.array[s+3]=D.w;p.array[s+4]=E.x;p.array[s+5]=E.y;p.array[s+6]=E.z;p.array[s+7]=E.w;p.array[s+8]=F.x;p.array[s+9]=F.y;p.array[s+
-10]=F.z;p.array[s+11]=F.w;p.array[s+12]=Z.x;p.array[s+13]=Z.y;p.array[s+14]=Z.z;p.array[s+15]=Z.w;s=s+16}}e.bindBuffer(e.ARRAY_BUFFER,p.buffer);e.bufferData(e.ARRAY_BUFFER,p.array,Ha)}}}if(sc){delete O.__inittedArrays;delete O.__colorArray;delete O.__normalArray;delete O.__tangentArray;delete O.__uvArray;delete O.__uv2Array;delete O.__faceArray;delete O.__vertexArray;delete O.__lineArray;delete O.__skinVertexAArray;delete O.__skinVertexBArray;delete O.__skinIndexArray;delete O.__skinWeightArray}}}}R.__dirtyVertices=
-false;R.__dirtyMorphTargets=false;R.__dirtyElements=false;R.__dirtyUvs=false;R.__dirtyNormals=false;R.__dirtyColors=false;R.__dirtyTangents=false;Fa.attributes&&l(Fa)}else if(Ua instanceof THREE.Ribbon){if(R.__dirtyVertices||R.__dirtyColors){var Fb=R,Vc=e.DYNAMIC_DRAW,lc=void 0,mc=void 0,zc=void 0,Gb=void 0,Ac=void 0,Wc=Fb.vertices,Xc=Fb.colors,ed=Wc.length,fd=Xc.length,Bc=Fb.__vertexArray,Cc=Fb.__colorArray,gd=Fb.__dirtyColors;if(Fb.__dirtyVertices){for(lc=0;lc<ed;lc++){zc=Wc[lc].position;Gb=lc*
-3;Bc[Gb]=zc.x;Bc[Gb+1]=zc.y;Bc[Gb+2]=zc.z}e.bindBuffer(e.ARRAY_BUFFER,Fb.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,Bc,Vc)}if(gd){for(mc=0;mc<fd;mc++){Ac=Xc[mc];Gb=mc*3;Cc[Gb]=Ac.r;Cc[Gb+1]=Ac.g;Cc[Gb+2]=Ac.b}e.bindBuffer(e.ARRAY_BUFFER,Fb.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,Cc,Vc)}}R.__dirtyVertices=false;R.__dirtyColors=false}else if(Ua instanceof THREE.Line){Fa=c(Ua,dc);Rb=Fa.attributes&&o(Fa);if(R.__dirtyVertices||R.__dirtyColors||Rb){var sb=R,Rc=e.DYNAMIC_DRAW,nc=void 0,oc=
-void 0,Dc=void 0,ia=void 0,Ec=void 0,Yc=sb.vertices,Zc=sb.colors,hd=Yc.length,id=Zc.length,Fc=sb.__vertexArray,Gc=sb.__colorArray,jd=sb.__dirtyColors,Sc=sb.__webglCustomAttributesList,Hc=void 0,$c=void 0,ya=void 0,Xb=void 0,Ga=void 0,ba=void 0;if(sb.__dirtyVertices){for(nc=0;nc<hd;nc++){Dc=Yc[nc].position;ia=nc*3;Fc[ia]=Dc.x;Fc[ia+1]=Dc.y;Fc[ia+2]=Dc.z}e.bindBuffer(e.ARRAY_BUFFER,sb.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,Fc,Rc)}if(jd){for(oc=0;oc<id;oc++){Ec=Zc[oc];ia=oc*3;Gc[ia]=Ec.r;Gc[ia+
-1]=Ec.g;Gc[ia+2]=Ec.b}e.bindBuffer(e.ARRAY_BUFFER,sb.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,Gc,Rc)}if(Sc){Hc=0;for($c=Sc.length;Hc<$c;Hc++){ba=Sc[Hc];if(ba.needsUpdate&&(ba.boundTo===void 0||ba.boundTo==="vertices")){ia=0;Xb=ba.value.length;if(ba.size===1)for(ya=0;ya<Xb;ya++)ba.array[ya]=ba.value[ya];else if(ba.size===2)for(ya=0;ya<Xb;ya++){Ga=ba.value[ya];ba.array[ia]=Ga.x;ba.array[ia+1]=Ga.y;ia=ia+2}else if(ba.size===3)if(ba.type==="c")for(ya=0;ya<Xb;ya++){Ga=ba.value[ya];ba.array[ia]=
-Ga.r;ba.array[ia+1]=Ga.g;ba.array[ia+2]=Ga.b;ia=ia+3}else for(ya=0;ya<Xb;ya++){Ga=ba.value[ya];ba.array[ia]=Ga.x;ba.array[ia+1]=Ga.y;ba.array[ia+2]=Ga.z;ia=ia+3}else if(ba.size===4)for(ya=0;ya<Xb;ya++){Ga=ba.value[ya];ba.array[ia]=Ga.x;ba.array[ia+1]=Ga.y;ba.array[ia+2]=Ga.z;ba.array[ia+3]=Ga.w;ia=ia+4}e.bindBuffer(e.ARRAY_BUFFER,ba.buffer);e.bufferData(e.ARRAY_BUFFER,ba.array,Rc)}}}}R.__dirtyVertices=false;R.__dirtyColors=false;Fa.attributes&&l(Fa)}else if(Ua instanceof THREE.ParticleSystem){Fa=
-c(Ua,dc);Rb=Fa.attributes&&o(Fa);(R.__dirtyVertices||R.__dirtyColors||Ua.sortParticles||Rb)&&g(R,e.DYNAMIC_DRAW,Ua);R.__dirtyVertices=false;R.__dirtyColors=false;Fa.attributes&&l(Fa)}}};this.initMaterial=function(a,b,c,d){var f,g,h;a instanceof THREE.MeshDepthMaterial?h="depth":a instanceof THREE.MeshNormalMaterial?h="normal":a instanceof THREE.MeshBasicMaterial?h="basic":a instanceof THREE.MeshLambertMaterial?h="lambert":a instanceof THREE.MeshPhongMaterial?h="phong":a instanceof THREE.LineBasicMaterial?
-h="basic":a instanceof THREE.ParticleBasicMaterial&&(h="particle_basic");if(h){var i=THREE.ShaderLib[h];a.uniforms=THREE.UniformsUtils.clone(i.uniforms);a.vertexShader=i.vertexShader;a.fragmentShader=i.fragmentShader}var j,k,l,m;j=m=i=0;for(k=b.length;j<k;j++){l=b[j];if(!l.onlyShadow){l instanceof THREE.DirectionalLight&&m++;l instanceof THREE.PointLight&&i++;l instanceof THREE.SpotLight&&i++}}if(i+m<=S){l=m;m=i}else{l=Math.ceil(S*m/(i+m));m=S-l}var o=0,i=0;for(j=b.length;i<j;i++){k=b[i];if(k.castShadow){k instanceof
-THREE.SpotLight&&o++;k instanceof THREE.DirectionalLight&&!k.shadowCascade&&o++}}var r=50;if(d!==void 0&&d instanceof THREE.SkinnedMesh)r=d.bones.length;var n;a:{j=a.fragmentShader;k=a.vertexShader;var i=a.uniforms,b=a.attributes,c={map:!!a.map,envMap:!!a.envMap,lightMap:!!a.lightMap,vertexColors:a.vertexColors,fog:c,useFog:a.fog,sizeAttenuation:a.sizeAttenuation,skinning:a.skinning,morphTargets:a.morphTargets,morphNormals:a.morphNormals,maxMorphTargets:this.maxMorphTargets,maxMorphNormals:this.maxMorphNormals,
-maxDirLights:l,maxPointLights:m,maxBones:r,shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapDebug:this.shadowMapDebug,shadowMapCascade:this.shadowMapCascade,maxShadows:o,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel,wrapAround:a.wrapAround,doubleSided:d&&d.doubleSided},q,d=[];if(h)d.push(h);else{d.push(j);d.push(k)}for(q in c){d.push(q);d.push(c[q])}h=d.join();q=0;for(d=Wa.length;q<d;q++)if(Wa[q].code===h){n=Wa[q].program;break a}q=e.createProgram();
-d=["precision "+M+" float;",bc>0?"#define VERTEX_TEXTURES":"",C.gammaInput?"#define GAMMA_INPUT":"",C.gammaOutput?"#define GAMMA_OUTPUT":"",C.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,"#define MAX_BONES "+c.maxBones,c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.skinning?
-"#define USE_SKINNING":"",c.morphTargets?"#define USE_MORPHTARGETS":"",c.morphNormals?"#define USE_MORPHNORMALS":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.wrapAround?"#define WRAP_AROUND":"",c.doubleSided?"#define DOUBLE_SIDED":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"",c.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\n#ifdef USE_MORPHNORMALS\nattribute vec3 morphNormal0;\nattribute vec3 morphNormal1;\nattribute vec3 morphNormal2;\nattribute vec3 morphNormal3;\n#else\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
+na[W[v]];D=Kb[y.a];E=Kb[y.b];F=Kb[y.c];va[pa]=D.x;va[pa+1]=D.y;va[pa+2]=D.z;va[pa+3]=E.x;va[pa+4]=E.y;va[pa+5]=E.z;va[pa+6]=F.x;va[pa+7]=F.y;va[pa+8]=F.z;pa=pa+9}v=0;for(B=X.length;v<B;v++){y=na[X[v]];D=Kb[y.a];E=Kb[y.b];F=Kb[y.c];Z=Kb[y.d];va[pa]=D.x;va[pa+1]=D.y;va[pa+2]=D.z;va[pa+3]=E.x;va[pa+4]=E.y;va[pa+5]=E.z;va[pa+6]=F.x;va[pa+7]=F.y;va[pa+8]=F.z;va[pa+9]=Z.x;va[pa+10]=Z.y;va[pa+11]=Z.z;pa=pa+12}e.bindBuffer(e.ARRAY_BUFFER,O.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,va,Ha)}if(dd){ua=
+0;for(Tc=Eb.length;ua<Tc;ua++){v=L=0;for(B=W.length;v<B;v++){Cb=W[v];y=na[Cb];D=Eb[ua].vertices[y.a];E=Eb[ua].vertices[y.b];F=Eb[ua].vertices[y.c];qa=Mc[ua];qa[L]=D.x;qa[L+1]=D.y;qa[L+2]=D.z;qa[L+3]=E.x;qa[L+4]=E.y;qa[L+5]=E.z;qa[L+6]=F.x;qa[L+7]=F.y;qa[L+8]=F.z;if(Jb.morphNormals){if(uc){pb=yc[ua].vertexNormals[Cb];$a=pb.a;ab=pb.b;bb=pb.c}else bb=ab=$a=yc[ua].faceNormals[Cb];ra=Nc[ua];ra[L]=$a.x;ra[L+1]=$a.y;ra[L+2]=$a.z;ra[L+3]=ab.x;ra[L+4]=ab.y;ra[L+5]=ab.z;ra[L+6]=bb.x;ra[L+7]=bb.y;ra[L+8]=bb.z}L=
+L+9}v=0;for(B=X.length;v<B;v++){Cb=X[v];y=na[Cb];D=Eb[ua].vertices[y.a];E=Eb[ua].vertices[y.b];F=Eb[ua].vertices[y.c];Z=Eb[ua].vertices[y.d];qa=Mc[ua];qa[L]=D.x;qa[L+1]=D.y;qa[L+2]=D.z;qa[L+3]=E.x;qa[L+4]=E.y;qa[L+5]=E.z;qa[L+6]=F.x;qa[L+7]=F.y;qa[L+8]=F.z;qa[L+9]=Z.x;qa[L+10]=Z.y;qa[L+11]=Z.z;if(Jb.morphNormals){if(uc){pb=yc[ua].vertexNormals[Cb];$a=pb.a;ab=pb.b;bb=pb.c;fc=pb.d}else fc=bb=ab=$a=yc[ua].faceNormals[Cb];ra=Nc[ua];ra[L]=$a.x;ra[L+1]=$a.y;ra[L+2]=$a.z;ra[L+3]=ab.x;ra[L+4]=ab.y;ra[L+5]=
+ab.z;ra[L+6]=bb.x;ra[L+7]=bb.y;ra[L+8]=bb.z;ra[L+9]=fc.x;ra[L+10]=fc.y;ra[L+11]=fc.z}L=L+12}e.bindBuffer(e.ARRAY_BUFFER,O.__webglMorphTargetsBuffers[ua]);e.bufferData(e.ARRAY_BUFFER,Mc[ua],Ha);if(Jb.morphNormals){e.bindBuffer(e.ARRAY_BUFFER,O.__webglMorphNormalsBuffers[ua]);e.bufferData(e.ARRAY_BUFFER,Nc[ua],Ha)}}}if(Db.length){v=0;for(B=W.length;v<B;v++){y=na[W[v]];fb=Db[y.a];gb=Db[y.b];hb=Db[y.c];ha[x]=fb.x;ha[x+1]=fb.y;ha[x+2]=fb.z;ha[x+3]=fb.w;ha[x+4]=gb.x;ha[x+5]=gb.y;ha[x+6]=gb.z;ha[x+7]=gb.w;
+ha[x+8]=hb.x;ha[x+9]=hb.y;ha[x+10]=hb.z;ha[x+11]=hb.w;ib=Nb[y.a];jb=Nb[y.b];kb=Nb[y.c];ga[x]=ib.x;ga[x+1]=ib.y;ga[x+2]=ib.z;ga[x+3]=ib.w;ga[x+4]=jb.x;ga[x+5]=jb.y;ga[x+6]=jb.z;ga[x+7]=jb.w;ga[x+8]=kb.x;ga[x+9]=kb.y;ga[x+10]=kb.z;ga[x+11]=kb.w;vb=Lb[y.a];wb=Lb[y.b];xb=Lb[y.c];ea[x]=vb.x;ea[x+1]=vb.y;ea[x+2]=vb.z;ea[x+3]=1;ea[x+4]=wb.x;ea[x+5]=wb.y;ea[x+6]=wb.z;ea[x+7]=1;ea[x+8]=xb.x;ea[x+9]=xb.y;ea[x+10]=xb.z;ea[x+11]=1;yb=Mb[y.a];zb=Mb[y.b];Ab=Mb[y.c];fa[x]=yb.x;fa[x+1]=yb.y;fa[x+2]=yb.z;fa[x+3]=
+1;fa[x+4]=zb.x;fa[x+5]=zb.y;fa[x+6]=zb.z;fa[x+7]=1;fa[x+8]=Ab.x;fa[x+9]=Ab.y;fa[x+10]=Ab.z;fa[x+11]=1;x=x+12}v=0;for(B=X.length;v<B;v++){y=na[X[v]];fb=Db[y.a];gb=Db[y.b];hb=Db[y.c];hc=Db[y.d];ha[x]=fb.x;ha[x+1]=fb.y;ha[x+2]=fb.z;ha[x+3]=fb.w;ha[x+4]=gb.x;ha[x+5]=gb.y;ha[x+6]=gb.z;ha[x+7]=gb.w;ha[x+8]=hb.x;ha[x+9]=hb.y;ha[x+10]=hb.z;ha[x+11]=hb.w;ha[x+12]=hc.x;ha[x+13]=hc.y;ha[x+14]=hc.z;ha[x+15]=hc.w;ib=Nb[y.a];jb=Nb[y.b];kb=Nb[y.c];ic=Nb[y.d];ga[x]=ib.x;ga[x+1]=ib.y;ga[x+2]=ib.z;ga[x+3]=ib.w;ga[x+
+4]=jb.x;ga[x+5]=jb.y;ga[x+6]=jb.z;ga[x+7]=jb.w;ga[x+8]=kb.x;ga[x+9]=kb.y;ga[x+10]=kb.z;ga[x+11]=kb.w;ga[x+12]=ic.x;ga[x+13]=ic.y;ga[x+14]=ic.z;ga[x+15]=ic.w;vb=Lb[y.a];wb=Lb[y.b];xb=Lb[y.c];wc=Lb[y.d];ea[x]=vb.x;ea[x+1]=vb.y;ea[x+2]=vb.z;ea[x+3]=1;ea[x+4]=wb.x;ea[x+5]=wb.y;ea[x+6]=wb.z;ea[x+7]=1;ea[x+8]=xb.x;ea[x+9]=xb.y;ea[x+10]=xb.z;ea[x+11]=1;ea[x+12]=wc.x;ea[x+13]=wc.y;ea[x+14]=wc.z;ea[x+15]=1;yb=Mb[y.a];zb=Mb[y.b];Ab=Mb[y.c];xc=Mb[y.d];fa[x]=yb.x;fa[x+1]=yb.y;fa[x+2]=yb.z;fa[x+3]=1;fa[x+4]=zb.x;
+fa[x+5]=zb.y;fa[x+6]=zb.z;fa[x+7]=1;fa[x+8]=Ab.x;fa[x+9]=Ab.y;fa[x+10]=Ab.z;fa[x+11]=1;fa[x+12]=xc.x;fa[x+13]=xc.y;fa[x+14]=xc.z;fa[x+15]=1;x=x+16}if(x>0){e.bindBuffer(e.ARRAY_BUFFER,O.__webglSkinVertexABuffer);e.bufferData(e.ARRAY_BUFFER,ea,Ha);e.bindBuffer(e.ARRAY_BUFFER,O.__webglSkinVertexBBuffer);e.bufferData(e.ARRAY_BUFFER,fa,Ha);e.bindBuffer(e.ARRAY_BUFFER,O.__webglSkinIndicesBuffer);e.bufferData(e.ARRAY_BUFFER,ga,Ha);e.bindBuffer(e.ARRAY_BUFFER,O.__webglSkinWeightsBuffer);e.bufferData(e.ARRAY_BUFFER,
+ha,Ha)}}if(cd&&Lc){v=0;for(B=W.length;v<B;v++){y=na[W[v]];Va=y.vertexColors;vc=y.color;if(Va.length===3&&Lc===THREE.VertexColors){cb=Va[0];db=Va[1];eb=Va[2]}else eb=db=cb=vc;wa[ma]=cb.r;wa[ma+1]=cb.g;wa[ma+2]=cb.b;wa[ma+3]=db.r;wa[ma+4]=db.g;wa[ma+5]=db.b;wa[ma+6]=eb.r;wa[ma+7]=eb.g;wa[ma+8]=eb.b;ma=ma+9}v=0;for(B=X.length;v<B;v++){y=na[X[v]];Va=y.vertexColors;vc=y.color;if(Va.length===4&&Lc===THREE.VertexColors){cb=Va[0];db=Va[1];eb=Va[2];gc=Va[3]}else gc=eb=db=cb=vc;wa[ma]=cb.r;wa[ma+1]=cb.g;wa[ma+
+2]=cb.b;wa[ma+3]=db.r;wa[ma+4]=db.g;wa[ma+5]=db.b;wa[ma+6]=eb.r;wa[ma+7]=eb.g;wa[ma+8]=eb.b;wa[ma+9]=gc.r;wa[ma+10]=gc.g;wa[ma+11]=gc.b;ma=ma+12}if(ma>0){e.bindBuffer(e.ARRAY_BUFFER,O.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,wa,Ha)}}if(bd&&Ea.hasTangents){v=0;for(B=W.length;v<B;v++){y=na[W[v]];ob=y.vertexTangents;Xa=ob[0];Ya=ob[1];Za=ob[2];da[$]=Xa.x;da[$+1]=Xa.y;da[$+2]=Xa.z;da[$+3]=Xa.w;da[$+4]=Ya.x;da[$+5]=Ya.y;da[$+6]=Ya.z;da[$+7]=Ya.w;da[$+8]=Za.x;da[$+9]=Za.y;da[$+10]=Za.z;da[$+11]=Za.w;
+$=$+12}v=0;for(B=X.length;v<B;v++){y=na[X[v]];ob=y.vertexTangents;Xa=ob[0];Ya=ob[1];Za=ob[2];ec=ob[3];da[$]=Xa.x;da[$+1]=Xa.y;da[$+2]=Xa.z;da[$+3]=Xa.w;da[$+4]=Ya.x;da[$+5]=Ya.y;da[$+6]=Ya.z;da[$+7]=Ya.w;da[$+8]=Za.x;da[$+9]=Za.y;da[$+10]=Za.z;da[$+11]=Za.w;da[$+12]=ec.x;da[$+13]=ec.y;da[$+14]=ec.z;da[$+15]=ec.w;$=$+16}e.bindBuffer(e.ARRAY_BUFFER,O.__webglTangentBuffer);e.bufferData(e.ARRAY_BUFFER,da,Ha)}if(ad&&Yb){v=0;for(B=W.length;v<B;v++){y=na[W[v]];Sb=y.vertexNormals;ub=y.normal;if(Sb.length===
+3&&uc)for(V=0;V<3;V++){Bb=Sb[V];Qa[za]=Bb.x;Qa[za+1]=Bb.y;Qa[za+2]=Bb.z;za=za+3}else for(V=0;V<3;V++){Qa[za]=ub.x;Qa[za+1]=ub.y;Qa[za+2]=ub.z;za=za+3}}v=0;for(B=X.length;v<B;v++){y=na[X[v]];Sb=y.vertexNormals;ub=y.normal;if(Sb.length===4&&uc)for(V=0;V<4;V++){Bb=Sb[V];Qa[za]=Bb.x;Qa[za+1]=Bb.y;Qa[za+2]=Bb.z;za=za+3}else for(V=0;V<4;V++){Qa[za]=ub.x;Qa[za+1]=ub.y;Qa[za+2]=ub.z;za=za+3}}e.bindBuffer(e.ARRAY_BUFFER,O.__webglNormalBuffer);e.bufferData(e.ARRAY_BUFFER,Qa,Ha)}if(Uc&&Pc&&Zb){v=0;for(B=W.length;v<
+B;v++){Ta=W[v];y=na[Ta];Tb=Pc[Ta];if(Tb!==void 0)for(V=0;V<3;V++){Vb=Tb[V];jc[qb]=Vb.u;jc[qb+1]=Vb.v;qb=qb+2}}v=0;for(B=X.length;v<B;v++){Ta=X[v];y=na[Ta];Tb=Pc[Ta];if(Tb!==void 0)for(V=0;V<4;V++){Vb=Tb[V];jc[qb]=Vb.u;jc[qb+1]=Vb.v;qb=qb+2}}if(qb>0){e.bindBuffer(e.ARRAY_BUFFER,O.__webglUVBuffer);e.bufferData(e.ARRAY_BUFFER,jc,Ha)}}if(Uc&&Qc&&Zb){v=0;for(B=W.length;v<B;v++){Ta=W[v];y=na[Ta];Ub=Qc[Ta];if(Ub!==void 0)for(V=0;V<3;V++){Wb=Ub[V];kc[rb]=Wb.u;kc[rb+1]=Wb.v;rb=rb+2}}v=0;for(B=X.length;v<B;v++){Ta=
+X[v];y=na[Ta];Ub=Qc[Ta];if(Ub!==void 0)for(V=0;V<4;V++){Wb=Ub[V];kc[rb]=Wb.u;kc[rb+1]=Wb.v;rb=rb+2}}if(rb>0){e.bindBuffer(e.ARRAY_BUFFER,O.__webglUV2Buffer);e.bufferData(e.ARRAY_BUFFER,kc,Ha)}}if(Ic){v=0;for(B=W.length;v<B;v++){y=na[W[v]];lb[Pa]=la;lb[Pa+1]=la+1;lb[Pa+2]=la+2;Pa=Pa+3;Ja[Da]=la;Ja[Da+1]=la+1;Ja[Da+2]=la;Ja[Da+3]=la+2;Ja[Da+4]=la+1;Ja[Da+5]=la+2;Da=Da+6;la=la+3}v=0;for(B=X.length;v<B;v++){y=na[X[v]];lb[Pa]=la;lb[Pa+1]=la+1;lb[Pa+2]=la+3;lb[Pa+3]=la+1;lb[Pa+4]=la+2;lb[Pa+5]=la+3;Pa=
+Pa+6;Ja[Da]=la;Ja[Da+1]=la+1;Ja[Da+2]=la;Ja[Da+3]=la+3;Ja[Da+4]=la+1;Ja[Da+5]=la+2;Ja[Da+6]=la+2;Ja[Da+7]=la+3;Da=Da+8;la=la+4}e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,O.__webglFaceBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,lb,Ha);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,O.__webglLineBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,Ja,Ha)}if(Oc){V=0;for(bc=Oc.length;V<bc;V++){p=Oc[V];if(p.__original.needsUpdate){s=0;if(p.size===1)if(p.boundTo===void 0||p.boundTo==="vertices"){v=0;for(B=W.length;v<B;v++){y=na[W[v]];
+p.array[s]=p.value[y.a];p.array[s+1]=p.value[y.b];p.array[s+2]=p.value[y.c];s=s+3}v=0;for(B=X.length;v<B;v++){y=na[X[v]];p.array[s]=p.value[y.a];p.array[s+1]=p.value[y.b];p.array[s+2]=p.value[y.c];p.array[s+3]=p.value[y.d];s=s+4}}else{if(p.boundTo==="faces"){v=0;for(B=W.length;v<B;v++){Ia=p.value[W[v]];p.array[s]=Ia;p.array[s+1]=Ia;p.array[s+2]=Ia;s=s+3}v=0;for(B=X.length;v<B;v++){Ia=p.value[X[v]];p.array[s]=Ia;p.array[s+1]=Ia;p.array[s+2]=Ia;p.array[s+3]=Ia;s=s+4}}}else if(p.size===2)if(p.boundTo===
+void 0||p.boundTo==="vertices"){v=0;for(B=W.length;v<B;v++){y=na[W[v]];D=p.value[y.a];E=p.value[y.b];F=p.value[y.c];p.array[s]=D.x;p.array[s+1]=D.y;p.array[s+2]=E.x;p.array[s+3]=E.y;p.array[s+4]=F.x;p.array[s+5]=F.y;s=s+6}v=0;for(B=X.length;v<B;v++){y=na[X[v]];D=p.value[y.a];E=p.value[y.b];F=p.value[y.c];Z=p.value[y.d];p.array[s]=D.x;p.array[s+1]=D.y;p.array[s+2]=E.x;p.array[s+3]=E.y;p.array[s+4]=F.x;p.array[s+5]=F.y;p.array[s+6]=Z.x;p.array[s+7]=Z.y;s=s+8}}else{if(p.boundTo==="faces"){v=0;for(B=
+W.length;v<B;v++){F=E=D=Ia=p.value[W[v]];p.array[s]=D.x;p.array[s+1]=D.y;p.array[s+2]=E.x;p.array[s+3]=E.y;p.array[s+4]=F.x;p.array[s+5]=F.y;s=s+6}v=0;for(B=X.length;v<B;v++){Z=F=E=D=Ia=p.value[X[v]];p.array[s]=D.x;p.array[s+1]=D.y;p.array[s+2]=E.x;p.array[s+3]=E.y;p.array[s+4]=F.x;p.array[s+5]=F.y;p.array[s+6]=Z.x;p.array[s+7]=Z.y;s=s+8}}}else if(p.size===3){var Q;Q=p.type==="c"?["r","g","b"]:["x","y","z"];if(p.boundTo===void 0||p.boundTo==="vertices"){v=0;for(B=W.length;v<B;v++){y=na[W[v]];D=p.value[y.a];
+E=p.value[y.b];F=p.value[y.c];p.array[s]=D[Q[0]];p.array[s+1]=D[Q[1]];p.array[s+2]=D[Q[2]];p.array[s+3]=E[Q[0]];p.array[s+4]=E[Q[1]];p.array[s+5]=E[Q[2]];p.array[s+6]=F[Q[0]];p.array[s+7]=F[Q[1]];p.array[s+8]=F[Q[2]];s=s+9}v=0;for(B=X.length;v<B;v++){y=na[X[v]];D=p.value[y.a];E=p.value[y.b];F=p.value[y.c];Z=p.value[y.d];p.array[s]=D[Q[0]];p.array[s+1]=D[Q[1]];p.array[s+2]=D[Q[2]];p.array[s+3]=E[Q[0]];p.array[s+4]=E[Q[1]];p.array[s+5]=E[Q[2]];p.array[s+6]=F[Q[0]];p.array[s+7]=F[Q[1]];p.array[s+8]=
+F[Q[2]];p.array[s+9]=Z[Q[0]];p.array[s+10]=Z[Q[1]];p.array[s+11]=Z[Q[2]];s=s+12}}else if(p.boundTo==="faces"){v=0;for(B=W.length;v<B;v++){F=E=D=Ia=p.value[W[v]];p.array[s]=D[Q[0]];p.array[s+1]=D[Q[1]];p.array[s+2]=D[Q[2]];p.array[s+3]=E[Q[0]];p.array[s+4]=E[Q[1]];p.array[s+5]=E[Q[2]];p.array[s+6]=F[Q[0]];p.array[s+7]=F[Q[1]];p.array[s+8]=F[Q[2]];s=s+9}v=0;for(B=X.length;v<B;v++){Z=F=E=D=Ia=p.value[X[v]];p.array[s]=D[Q[0]];p.array[s+1]=D[Q[1]];p.array[s+2]=D[Q[2]];p.array[s+3]=E[Q[0]];p.array[s+4]=
+E[Q[1]];p.array[s+5]=E[Q[2]];p.array[s+6]=F[Q[0]];p.array[s+7]=F[Q[1]];p.array[s+8]=F[Q[2]];p.array[s+9]=Z[Q[0]];p.array[s+10]=Z[Q[1]];p.array[s+11]=Z[Q[2]];s=s+12}}}else if(p.size===4)if(p.boundTo===void 0||p.boundTo==="vertices"){v=0;for(B=W.length;v<B;v++){y=na[W[v]];D=p.value[y.a];E=p.value[y.b];F=p.value[y.c];p.array[s]=D.x;p.array[s+1]=D.y;p.array[s+2]=D.z;p.array[s+3]=D.w;p.array[s+4]=E.x;p.array[s+5]=E.y;p.array[s+6]=E.z;p.array[s+7]=E.w;p.array[s+8]=F.x;p.array[s+9]=F.y;p.array[s+10]=F.z;
+p.array[s+11]=F.w;s=s+12}v=0;for(B=X.length;v<B;v++){y=na[X[v]];D=p.value[y.a];E=p.value[y.b];F=p.value[y.c];Z=p.value[y.d];p.array[s]=D.x;p.array[s+1]=D.y;p.array[s+2]=D.z;p.array[s+3]=D.w;p.array[s+4]=E.x;p.array[s+5]=E.y;p.array[s+6]=E.z;p.array[s+7]=E.w;p.array[s+8]=F.x;p.array[s+9]=F.y;p.array[s+10]=F.z;p.array[s+11]=F.w;p.array[s+12]=Z.x;p.array[s+13]=Z.y;p.array[s+14]=Z.z;p.array[s+15]=Z.w;s=s+16}}else if(p.boundTo==="faces"){v=0;for(B=W.length;v<B;v++){F=E=D=Ia=p.value[W[v]];p.array[s]=D.x;
+p.array[s+1]=D.y;p.array[s+2]=D.z;p.array[s+3]=D.w;p.array[s+4]=E.x;p.array[s+5]=E.y;p.array[s+6]=E.z;p.array[s+7]=E.w;p.array[s+8]=F.x;p.array[s+9]=F.y;p.array[s+10]=F.z;p.array[s+11]=F.w;s=s+12}v=0;for(B=X.length;v<B;v++){Z=F=E=D=Ia=p.value[X[v]];p.array[s]=D.x;p.array[s+1]=D.y;p.array[s+2]=D.z;p.array[s+3]=D.w;p.array[s+4]=E.x;p.array[s+5]=E.y;p.array[s+6]=E.z;p.array[s+7]=E.w;p.array[s+8]=F.x;p.array[s+9]=F.y;p.array[s+10]=F.z;p.array[s+11]=F.w;p.array[s+12]=Z.x;p.array[s+13]=Z.y;p.array[s+14]=
+Z.z;p.array[s+15]=Z.w;s=s+16}}e.bindBuffer(e.ARRAY_BUFFER,p.buffer);e.bufferData(e.ARRAY_BUFFER,p.array,Ha)}}}if(sc){delete O.__inittedArrays;delete O.__colorArray;delete O.__normalArray;delete O.__tangentArray;delete O.__uvArray;delete O.__uv2Array;delete O.__faceArray;delete O.__vertexArray;delete O.__lineArray;delete O.__skinVertexAArray;delete O.__skinVertexBArray;delete O.__skinIndexArray;delete O.__skinWeightArray}}}}R.__dirtyVertices=false;R.__dirtyMorphTargets=false;R.__dirtyElements=false;
+R.__dirtyUvs=false;R.__dirtyNormals=false;R.__dirtyColors=false;R.__dirtyTangents=false;Fa.attributes&&l(Fa)}else if(Ua instanceof THREE.Ribbon){if(R.__dirtyVertices||R.__dirtyColors){var Fb=R,Vc=e.DYNAMIC_DRAW,lc=void 0,mc=void 0,zc=void 0,Gb=void 0,Ac=void 0,Wc=Fb.vertices,Xc=Fb.colors,ed=Wc.length,fd=Xc.length,Bc=Fb.__vertexArray,Cc=Fb.__colorArray,gd=Fb.__dirtyColors;if(Fb.__dirtyVertices){for(lc=0;lc<ed;lc++){zc=Wc[lc];Gb=lc*3;Bc[Gb]=zc.x;Bc[Gb+1]=zc.y;Bc[Gb+2]=zc.z}e.bindBuffer(e.ARRAY_BUFFER,
+Fb.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,Bc,Vc)}if(gd){for(mc=0;mc<fd;mc++){Ac=Xc[mc];Gb=mc*3;Cc[Gb]=Ac.r;Cc[Gb+1]=Ac.g;Cc[Gb+2]=Ac.b}e.bindBuffer(e.ARRAY_BUFFER,Fb.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,Cc,Vc)}}R.__dirtyVertices=false;R.__dirtyColors=false}else if(Ua instanceof THREE.Line){Fa=c(Ua,dc);Rb=Fa.attributes&&o(Fa);if(R.__dirtyVertices||R.__dirtyColors||Rb){var sb=R,Rc=e.DYNAMIC_DRAW,nc=void 0,oc=void 0,Dc=void 0,ia=void 0,Ec=void 0,Yc=sb.vertices,Zc=sb.colors,hd=Yc.length,
+id=Zc.length,Fc=sb.__vertexArray,Gc=sb.__colorArray,jd=sb.__dirtyColors,Sc=sb.__webglCustomAttributesList,Hc=void 0,$c=void 0,ya=void 0,Xb=void 0,Ga=void 0,ba=void 0;if(sb.__dirtyVertices){for(nc=0;nc<hd;nc++){Dc=Yc[nc];ia=nc*3;Fc[ia]=Dc.x;Fc[ia+1]=Dc.y;Fc[ia+2]=Dc.z}e.bindBuffer(e.ARRAY_BUFFER,sb.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,Fc,Rc)}if(jd){for(oc=0;oc<id;oc++){Ec=Zc[oc];ia=oc*3;Gc[ia]=Ec.r;Gc[ia+1]=Ec.g;Gc[ia+2]=Ec.b}e.bindBuffer(e.ARRAY_BUFFER,sb.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,
+Gc,Rc)}if(Sc){Hc=0;for($c=Sc.length;Hc<$c;Hc++){ba=Sc[Hc];if(ba.needsUpdate&&(ba.boundTo===void 0||ba.boundTo==="vertices")){ia=0;Xb=ba.value.length;if(ba.size===1)for(ya=0;ya<Xb;ya++)ba.array[ya]=ba.value[ya];else if(ba.size===2)for(ya=0;ya<Xb;ya++){Ga=ba.value[ya];ba.array[ia]=Ga.x;ba.array[ia+1]=Ga.y;ia=ia+2}else if(ba.size===3)if(ba.type==="c")for(ya=0;ya<Xb;ya++){Ga=ba.value[ya];ba.array[ia]=Ga.r;ba.array[ia+1]=Ga.g;ba.array[ia+2]=Ga.b;ia=ia+3}else for(ya=0;ya<Xb;ya++){Ga=ba.value[ya];ba.array[ia]=
+Ga.x;ba.array[ia+1]=Ga.y;ba.array[ia+2]=Ga.z;ia=ia+3}else if(ba.size===4)for(ya=0;ya<Xb;ya++){Ga=ba.value[ya];ba.array[ia]=Ga.x;ba.array[ia+1]=Ga.y;ba.array[ia+2]=Ga.z;ba.array[ia+3]=Ga.w;ia=ia+4}e.bindBuffer(e.ARRAY_BUFFER,ba.buffer);e.bufferData(e.ARRAY_BUFFER,ba.array,Rc)}}}}R.__dirtyVertices=false;R.__dirtyColors=false;Fa.attributes&&l(Fa)}else if(Ua instanceof THREE.ParticleSystem){Fa=c(Ua,dc);Rb=Fa.attributes&&o(Fa);(R.__dirtyVertices||R.__dirtyColors||Ua.sortParticles||Rb)&&g(R,e.DYNAMIC_DRAW,
+Ua);R.__dirtyVertices=false;R.__dirtyColors=false;Fa.attributes&&l(Fa)}}};this.initMaterial=function(a,b,c,d){var f,g,h;a instanceof THREE.MeshDepthMaterial?h="depth":a instanceof THREE.MeshNormalMaterial?h="normal":a instanceof THREE.MeshBasicMaterial?h="basic":a instanceof THREE.MeshLambertMaterial?h="lambert":a instanceof THREE.MeshPhongMaterial?h="phong":a instanceof THREE.LineBasicMaterial?h="basic":a instanceof THREE.ParticleBasicMaterial&&(h="particle_basic");if(h){var i=THREE.ShaderLib[h];
+a.uniforms=THREE.UniformsUtils.clone(i.uniforms);a.vertexShader=i.vertexShader;a.fragmentShader=i.fragmentShader}var j,k,l,m;j=m=i=0;for(k=b.length;j<k;j++){l=b[j];if(!l.onlyShadow){l instanceof THREE.DirectionalLight&&m++;l instanceof THREE.PointLight&&i++;l instanceof THREE.SpotLight&&i++}}if(i+m<=S){l=m;m=i}else{l=Math.ceil(S*m/(i+m));m=S-l}var o=0,i=0;for(j=b.length;i<j;i++){k=b[i];if(k.castShadow){k instanceof THREE.SpotLight&&o++;k instanceof THREE.DirectionalLight&&!k.shadowCascade&&o++}}var r=
+50;if(d!==void 0&&d instanceof THREE.SkinnedMesh)r=d.bones.length;var n;a:{j=a.fragmentShader;k=a.vertexShader;var i=a.uniforms,b=a.attributes,c={map:!!a.map,envMap:!!a.envMap,lightMap:!!a.lightMap,vertexColors:a.vertexColors,fog:c,useFog:a.fog,sizeAttenuation:a.sizeAttenuation,skinning:a.skinning,morphTargets:a.morphTargets,morphNormals:a.morphNormals,maxMorphTargets:this.maxMorphTargets,maxMorphNormals:this.maxMorphNormals,maxDirLights:l,maxPointLights:m,maxBones:r,shadowMapEnabled:this.shadowMapEnabled&&
+d.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapDebug:this.shadowMapDebug,shadowMapCascade:this.shadowMapCascade,maxShadows:o,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel,wrapAround:a.wrapAround,doubleSided:d&&d.doubleSided},q,d=[];if(h)d.push(h);else{d.push(j);d.push(k)}for(q in c){d.push(q);d.push(c[q])}h=d.join();q=0;for(d=Wa.length;q<d;q++)if(Wa[q].code===h){n=Wa[q].program;break a}q=e.createProgram();d=["precision "+M+" float;",bc>0?"#define VERTEX_TEXTURES":"",C.gammaInput?
+"#define GAMMA_INPUT":"",C.gammaOutput?"#define GAMMA_OUTPUT":"",C.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,"#define MAX_BONES "+c.maxBones,c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.skinning?"#define USE_SKINNING":"",c.morphTargets?"#define USE_MORPHTARGETS":"",c.morphNormals?
+"#define USE_MORPHNORMALS":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.wrapAround?"#define WRAP_AROUND":"",c.doubleSided?"#define DOUBLE_SIDED":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"",c.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\n#ifdef USE_MORPHNORMALS\nattribute vec3 morphNormal0;\nattribute vec3 morphNormal1;\nattribute vec3 morphNormal2;\nattribute vec3 morphNormal3;\n#else\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
 l=["precision "+M+" float;","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",C.gammaInput?"#define GAMMA_INPUT":"",C.gammaOutput?"#define GAMMA_OUTPUT":"",C.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"",c.useFog&&c.fog?"#define USE_FOG":"",c.useFog&&c.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?
 "#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.metal?"#define METAL":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.wrapAround?"#define WRAP_AROUND":"",c.doubleSided?"#define DOUBLE_SIDED":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");e.attachShader(q,w("fragment",l+j));
 e.attachShader(q,w("vertex",d+k));e.linkProgram(q);e.getProgramParameter(q,e.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+e.getProgramParameter(q,e.VALIDATE_STATUS)+", gl error ["+e.getError()+"]");q.uniforms={};q.attributes={};var t,d=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","boneGlobalMatrices","morphTargetInfluences"];for(t in i)d.push(t);t=d;d=0;for(i=t.length;d<i;d++){j=t[d];q.uniforms[j]=e.getUniformLocation(q,
@@ -335,11 +334,11 @@ 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(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]].position.copy(THREE.CameraHelper.__v)}}var b=this;THREE.CameraHelper.__c.projectionMatrix.copy(this.camera.projectionMatrix);a("c",0,0,-1);a("t",0,0,1);a("n1",-1,-1,-1);a("n2",1,-1,-1);a("n3",-1,1,-1);a("n4",1,1,-1);a("f1",
--1,-1,1);a("f2",1,-1,1);a("f3",-1,1,1);a("f4",1,1,1);a("u1",0.7,1.1,-1);a("u2",-0.7,1.1,-1);a("u3",0,2,-1);a("cf1",-1,0,1);a("cf2",1,0,1);a("cf3",0,-1,1);a("cf4",0,1,1);a("cn1",-1,0,-1);a("cn2",1,0,-1);a("cn3",0,-1,-1);a("cn4",0,1,-1);this.lineGeometry.__dirtyVertices=true};THREE.CameraHelper.__projector=new THREE.Projector;THREE.CameraHelper.__v=new THREE.Vector3;THREE.CameraHelper.__c=new THREE.Camera;
+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",
+"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,
+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.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,g){b===void 0&&(b=-1);c===void 0&&(c=0);g===void 0&&(g=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:g,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}};THREE.ImmediateRenderObject=function(){THREE.Object3D.call(this);this.render=function(){}};THREE.ImmediateRenderObject.prototype=new THREE.Object3D;

+ 2 - 2
examples/canvas_camera_orthographic.html

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

+ 5 - 5
examples/canvas_camera_orthographic2.html

@@ -119,8 +119,8 @@
 				// Grid
 
 				var geometry = new THREE.Geometry();
-				geometry.vertices.push( new THREE.Vertex( new THREE.Vector3( - 500, 0, 0 ) ) );
-				geometry.vertices.push( new THREE.Vertex( new THREE.Vector3( 500, 0, 0 ) ) );
+				geometry.vertices.push( new THREE.Vertex( - 500, 0, 0 ) );
+				geometry.vertices.push( new THREE.Vertex( 500, 0, 0 ) );
 
 				for ( var i = 0; i <= 20; i ++ ) {
 
@@ -187,10 +187,10 @@
 
 				function onWindowResize(){
 
-				    camera.setSize( window.innerWidth, window.innerHeight );
-				    camera.updateProjectionMatrix();
+					camera.setSize( window.innerWidth, window.innerHeight );
+					camera.updateProjectionMatrix();
 
-				    renderer.setSize( window.innerWidth, window.innerHeight );
+					renderer.setSize( window.innerWidth, window.innerHeight );
 
 				}
 

+ 2 - 2
examples/canvas_geometry_birds.html

@@ -21,7 +21,7 @@
 				top: 0px; width: 100%;
 				padding: 5px;
 			}
-                </style>
+		</style>
 	</head>
 	<body>
 
@@ -428,7 +428,7 @@
 					bird.rotation.z = Math.asin( boid.velocity.y / boid.velocity.length() );
 
 					bird.phase = ( bird.phase + ( Math.max( 0, bird.rotation.z ) + 0.1 )  ) % 62.83;
-					bird.geometry.vertices[ 5 ].position.y = bird.geometry.vertices[ 4 ].position.y = Math.sin( bird.phase ) * 5;
+					bird.geometry.vertices[ 5 ].y = bird.geometry.vertices[ 4 ].y = Math.sin( bird.phase ) * 5;
 
 				}
 

+ 2 - 2
examples/canvas_geometry_panorama_fisheye.html

@@ -87,8 +87,8 @@
 
 					var vertex = mesh.geometry.vertices[ i ];
 
-					vertex.position.normalize();
-					vertex.position.multiplyScalar( 550 );
+					vertex.normalize();
+					vertex.multiplyScalar( 550 );
 
 				}
 

+ 1 - 1
examples/canvas_geometry_terrain.html

@@ -75,7 +75,7 @@
 				for ( var i = 0, l = plane.vertices.length; i < l; i ++ ) {
 
 					var x = i % quality, y = ~~ ( i / quality );
-					plane.vertices[ i ].position.y = data[ ( x * step ) + ( y * step ) * 1024 ] * 2 - 128;
+					plane.vertices[ i ].y = data[ ( x * step ) + ( y * step ) * 1024 ] * 2 - 128;
 
 				}
 

+ 5 - 5
examples/canvas_interactive_voxelpainter.html

@@ -42,7 +42,7 @@
 				info.style.top = '10px';
 				info.style.width = '100%';
 				info.style.textAlign = 'center';
-				info.innerHTML = '<a href="http://github.com/mrdoob/three.js" target="_blank">three.js</a> - voxel painter<br /><strong>click</strong>: add voxel, <strong>control + click</strong>: remove voxel, <strong>shift</strong>: rotate, <a href="javascript:save();return false;">save .png</a>';
+				info.innerHTML = '<a href="http://github.com/mrdoob/three.js" target="_blank">three.js</a> - voxel painter<br><strong>click</strong>: add voxel, <strong>control + click</strong>: remove voxel, <strong>shift</strong>: rotate, <a href="javascript:save();return false;">save .png</a>';
 				container.appendChild( info );
 
 				camera = new THREE.PerspectiveCamera( 40, window.innerWidth / window.innerHeight, 1, 10000 );
@@ -55,8 +55,8 @@
 				// Grid
 
 				var geometry = new THREE.Geometry();
-				geometry.vertices.push( new THREE.Vertex( new THREE.Vector3( - 500, 0, 0 ) ) );
-				geometry.vertices.push( new THREE.Vertex( new THREE.Vector3( 500, 0, 0 ) ) );
+				geometry.vertices.push( new THREE.Vertex( - 500, 0, 0 ) );
+				geometry.vertices.push( new THREE.Vertex( 500, 0, 0 ) );
 
 				var material = new THREE.LineBasicMaterial( { color: 0x000000, opacity: 0.2 } );
 
@@ -225,8 +225,8 @@
 
 				} else if ( rollOveredFace ) {
 
-					 rollOveredFace.materials = [];
-					 rollOveredFace = null;
+					rollOveredFace.materials = [];
+					rollOveredFace = null;
 
 				}
 

+ 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( particle.position ) );
+					geometry.vertices.push( new THREE.Vertex().copy( particle.position ) );
 
 				}
 

+ 7 - 7
examples/canvas_lines_sphere.html

@@ -93,16 +93,16 @@
 
 					var geometry = new THREE.Geometry();
 
-					var vector = new THREE.Vector3( Math.random() * 2 - 1, Math.random() * 2 - 1, Math.random() * 2 - 1 );
-					vector.normalize();
-					vector.multiplyScalar( 450 );
+					var vertex = new THREE.Vertex( Math.random() * 2 - 1, Math.random() * 2 - 1, Math.random() * 2 - 1 );
+					vertex.normalize();
+					vertex.multiplyScalar( 450 );
 
-					geometry.vertices.push( new THREE.Vertex( vector ) );
+					geometry.vertices.push( vertex );
 
-					var vector2 = vector.clone();
-					vector2.multiplyScalar( Math.random() * 0.3 + 1 );
+					var vertex2 = vertex.clone();
+					vertex2.multiplyScalar( Math.random() * 0.3 + 1 );
 
-					geometry.vertices.push( new THREE.Vertex( vector2 ) );
+					geometry.vertices.push( vertex2 );
 
 					var line = new THREE.Line( geometry, new THREE.LineBasicMaterial( { color: 0xffffff, opacity: Math.random() } ) );
 					scene.add( line );

+ 2 - 2
examples/canvas_materials.html

@@ -44,8 +44,8 @@
 				// Grid
 
 				var geometry = new THREE.Geometry();
-				geometry.vertices.push( new THREE.Vertex( new THREE.Vector3( - 500, 0, 0 ) ) );
-				geometry.vertices.push( new THREE.Vertex( new THREE.Vector3( 500, 0, 0 ) ) );
+				geometry.vertices.push( new THREE.Vertex( - 500, 0, 0 ) );
+				geometry.vertices.push( new THREE.Vertex( 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( new THREE.Vector3( - 500, 0, 0 ) ) );
-				geometry.vertices.push( new THREE.Vertex( new THREE.Vector3( 500, 0, 0 ) ) );
+				geometry.vertices.push( new THREE.Vertex( - 500, 0, 0 ) );
+				geometry.vertices.push( new THREE.Vertex( 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( new THREE.Vector3( - 500, 0, 0 ) ) );
-				geometry.vertices.push( new THREE.Vertex( new THREE.Vector3( 500, 0, 0 ) ) );
+				geometry.vertices.push( new THREE.Vertex( - 500, 0, 0 ) );
+				geometry.vertices.push( new THREE.Vertex( 500, 0, 0 ) );
 
 				var material = new THREE.LineBasicMaterial( { color: 0x000000, opacity: 0.5 } );
 

+ 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( new THREE.Vector3( x, y, z ) ) );
+		scope.vertices.push( new THREE.Vertex( x, y, z ) );
 
 	};
 

+ 6 - 6
examples/misc_camera_fly.html

@@ -181,19 +181,19 @@
 
 				for ( i = 0; i < 250; i ++ ) {
 
-					vector1 = new THREE.Vector3( Math.random() * 2 - 1, Math.random() * 2 - 1, Math.random() * 2 - 1 );
-					vector1.multiplyScalar( r );
+					var vertex = new THREE.Vertex( Math.random() * 2 - 1, Math.random() * 2 - 1, Math.random() * 2 - 1 );
+					vertex.multiplyScalar( r );
 
-					starsGeometry[ 0 ].vertices.push( new THREE.Vertex( vector1 ) );
+					starsGeometry[ 0 ].vertices.push( vertex );
 
 				}
 
 				for ( i = 0; i < 1500; i ++ ) {
 
-					vector1 = new THREE.Vector3( Math.random() * 2 - 1, Math.random() * 2 - 1, Math.random() * 2 - 1 );
-					vector1.multiplyScalar( r );
+					var vertex = new THREE.Vertex( Math.random() * 2 - 1, Math.random() * 2 - 1, Math.random() * 2 - 1 );
+					vertex.multiplyScalar( r );
 
-					starsGeometry[ 1 ].vertices.push( new THREE.Vertex( vector1 ) );
+					starsGeometry[ 1 ].vertices.push( vertex );
 
 				}
 

+ 6 - 6
examples/misc_ubiquity_test.html

@@ -103,13 +103,13 @@
 
 					var v = new THREE.Vector3( Math.random() * 1000 - 500, Math.random() * 1000 - 500, Math.random() * 1000 - 500 );
 
-					var v0 = new THREE.Vertex( new THREE.Vector3( Math.random() * 100 - 50, Math.random() * 100 - 50, Math.random() * 100 - 50 ) );
-					var v1 = new THREE.Vertex( new THREE.Vector3( Math.random() * 100 - 50, Math.random() * 100 - 50, Math.random() * 100 - 50 ) );
-					var v2 = new THREE.Vertex( new THREE.Vector3( Math.random() * 100 - 50, Math.random() * 100 - 50, Math.random() * 100 - 50 ) );
+					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 );
 
-					v0.position.addSelf( v );
-					v1.position.addSelf( v );
-					v2.position.addSelf( v );
+					v0.addSelf( v );
+					v1.addSelf( v );
+					v2.addSelf( v );
 
 					var face = new THREE.Face3( geometry.vertices.push( v0 ) - 1, geometry.vertices.push( v1 ) - 1, geometry.vertices.push( v2 ) - 1, null, null, geometry.materials.length );
 

+ 1 - 1
examples/obj/Bird.js

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

+ 1 - 2
examples/webgl_camera.html

@@ -123,8 +123,7 @@
 					y = THREE.Math.randFloatSpread( 2000 );
 					z = THREE.Math.randFloatSpread( 2000 );
 
-					var p = new THREE.Vector3( x, y, z );
-					geo.vertices.push( new THREE.Vertex( p ) );
+					geo.vertices.push( new THREE.Vertex( x, y, z ) );
 
 				}
 

+ 4 - 4
examples/webgl_custom_attributes_particles.html

@@ -138,10 +138,10 @@
 
 			for ( var i = 0; i < 100000; i++ ) {
 
-				vector = new THREE.Vector3( Math.random() * 2 - 1, Math.random() * 2 - 1, Math.random() * 2 - 1 );
-				vector.multiplyScalar( radius );
+				var vertex = new THREE.Vertex( Math.random() * 2 - 1, Math.random() * 2 - 1, Math.random() * 2 - 1 );
+				vertex.multiplyScalar( radius );
 
-				geometry.vertices.push( new THREE.Vertex( vector ) );
+				geometry.vertices.push( vertex );
 
 			}
 
@@ -160,7 +160,7 @@
 				values_size[ v ] = 10;
 				values_color[ v ] = new THREE.Color( 0xffaa00 );
 
-				if ( vertices[ v ].position.x < 0 )
+				if ( vertices[ v ].x < 0 )
 					values_color[ v ].setHSV( 0.5 + 0.1 * ( v / vertices.length ), 0.7, 0.9 );
 				else
 					values_color[ v ].setHSV( 0.0 + 0.1 * ( v / vertices.length ), 0.9, 0.9 );

+ 2 - 2
examples/webgl_custom_attributes_particles2.html

@@ -152,12 +152,12 @@
 
 				if ( v < vc1 ) {
 
-					values_color[ v ].setHSV( 0.01 + 0.1 * ( v / vc1 ), 0.99, ( vertices[ v ].position.y + radius ) / ( 2 *radius ) );
+					values_color[ v ].setHSV( 0.01 + 0.1 * ( v / vc1 ), 0.99, ( vertices[ v ].y + radius ) / ( 2 *radius ) );
 
 				} else {
 
 					values_size[ v ] = 40;
-					values_color[ v ].setHSV( 0.6, 0.75, 0.5 + vertices[ v ].position.y / ( 0.8 * radius ) );
+					values_color[ v ].setHSV( 0.6, 0.75, 0.5 + vertices[ v ].y / ( 0.8 * radius ) );
 
 				}
 

+ 6 - 6
examples/webgl_custom_attributes_particles3.html

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

+ 1 - 1
examples/webgl_geometry_colors.html

@@ -110,7 +110,7 @@
 
 						vertexIndex = f[ faceIndices[ j ] ];
 
-						p = geometry.vertices[ vertexIndex ].position;
+						p = geometry.vertices[ vertexIndex ];
 
 						color = new THREE.Color( 0xffffff );
 						color.setHSV( ( p.y / radius + 1 ) / 2, 1.0, 1.0 );

+ 2 - 2
examples/webgl_geometry_dynamic.html

@@ -91,7 +91,7 @@
 
 				for ( i = 0, il = geometry.vertices.length; i < il; i ++ ) {
 
-					geometry.vertices[ i ].position.y = 35 * Math.sin( i/2 );
+					geometry.vertices[ i ].y = 35 * Math.sin( i/2 );
 
 				}
 
@@ -143,7 +143,7 @@
 
 				for ( var i = 0, l = geometry.vertices.length; i < l; i ++ ) {
 
-					geometry.vertices[ i ].position.y = 35 * Math.sin( i / 5 + ( time + i ) / 7 );
+					geometry.vertices[ i ].y = 35 * Math.sin( i / 5 + ( time + i ) / 7 );
 
 				}
 

+ 3 - 3
examples/webgl_geometry_subdivison.html

@@ -249,7 +249,7 @@
 
 						vertexIndex = f[ faceABCD.charAt( j ) ];
 
-						p = smooth.vertices[ vertexIndex ].position;
+						p = smooth.vertices[ vertexIndex ];
 
 						color = new THREE.Color( 0xffffff );
 						color.setHSV( ( p.y ) / 200 + 0.5, 1.0, 1.0 );
@@ -285,7 +285,7 @@
 					for ( var i = 0; i < smooth.vertices.length; i++ ) {
 
 						particle = new THREE.Particle( new THREE.ParticleCanvasMaterial( { color: Math.random() * 0x808008 + 0x808080, program: program } ) );
-						particle.position = smooth.vertices[i].position;
+						particle.position = smooth.vertices[ i ];
 						var pos = smooth.vertices.position
 						particle.scale.x = particle.scale.y = 5;
 						group.add( particle );
@@ -314,7 +314,7 @@
 					for ( var i = 0; i < geometry.vertices.length; i++ ) {
 
 						particle = new THREE.Particle( new THREE.ParticleCanvasMaterial( { color: Math.random() * 0x808008 + 0x808080, program: drawText(i) } ) );
-						particle.position = smooth.vertices[i].position;
+						particle.position = smooth.vertices[ i ];
 						var pos = geometry.vertices.position
 						particle.scale.x = particle.scale.y = 30;
 						group.add( particle );

+ 1 - 1
examples/webgl_geometry_terrain.html

@@ -84,7 +84,7 @@
 
 				for ( var i = 0, l = geometry.vertices.length; i < l; i ++ ) {
 
-					geometry.vertices[ i ].position.y = data[ i ] * 10;
+					geometry.vertices[ i ].y = data[ i ] * 10;
 
 				}
 

+ 1 - 1
examples/webgl_geometry_terrain_fog.html

@@ -87,7 +87,7 @@
 
 				for ( var i = 0, l = geometry.vertices.length; i < l; i ++ ) {
 
-					geometry.vertices[ i ].position.y = data[ i ] * 10;
+					geometry.vertices[ i ].y = data[ i ] * 10;
 
 				}
 

+ 3 - 3
examples/webgl_geometry_text.html

@@ -471,9 +471,9 @@
 
 							}
 
-							var va = textGeo.vertices[ face.a ].position;
-							var vb = textGeo.vertices[ face.b ].position;
-							var vc = textGeo.vertices[ face.c ].position;
+							var va = textGeo.vertices[ face.a ];
+							var vb = textGeo.vertices[ face.b ];
+							var vc = textGeo.vertices[ face.c ];
 
 							var s = THREE.GeometryUtils.triangleArea( va, vb, vc );
 

+ 4 - 4
examples/webgl_kinect.html

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

+ 1 - 1
examples/webgl_lines_colors.html

@@ -98,7 +98,7 @@
 
 				for ( i = 0; i < points.length; i ++ ) {
 
-					geometry.vertices.push( new THREE.Vertex( points[ i ] ) );
+					geometry.vertices.push( new THREE.Vertex().copy( 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( points[i] ) );
+					geometry.vertices.push( new THREE.Vertex().copy( points[i] ) );
 
 				}
 

+ 8 - 8
examples/webgl_lines_sphere.html

@@ -80,7 +80,7 @@
 				camera.position.z = 1000;
 				scene.add( camera );
 
-				var i, line, vector1, vector2, material, p,
+				var i, line, vertex1, vertex2, material, p,
 					parameters = [ [ 0.25, 0xff7700, 1, 2 ], [ 0.5, 0xff9900, 1, 1 ], [ 0.75, 0xffaa00, 0.75, 1 ], [ 1, 0xffaa00, 0.5, 1 ], [ 1.25, 0x000833, 0.8, 1 ],
 							       [ 3.0, 0xaaaaaa, 0.75, 2 ], [ 3.5, 0xffffff, 0.5, 1 ], [ 4.5, 0xffffff, 0.25, 1 ], [ 5.5, 0xffffff, 0.125, 1 ] ],
 
@@ -89,15 +89,15 @@
 
 				for ( i = 0; i < 1500; i ++ ) {
 
-					vector1 = new THREE.Vector3( Math.random() * 2 - 1, Math.random() * 2 - 1, Math.random() * 2 - 1 );
-					vector1.normalize();
-					vector1.multiplyScalar( r );
+					var vertex1 = new THREE.Vertex( Math.random() * 2 - 1, Math.random() * 2 - 1, Math.random() * 2 - 1 );
+					vertex1.normalize();
+					vertex1.multiplyScalar( r );
 
-					vector2 = vector1.clone();
-					vector2.multiplyScalar( Math.random() * 0.09 + 1 );
+					vertex2 = vertex1.clone();
+					vertex2.multiplyScalar( Math.random() * 0.09 + 1 );
 
-					geometry.vertices.push( new THREE.Vertex( vector1 ) );
-					geometry.vertices.push( new THREE.Vertex( vector2 ) );
+					geometry.vertices.push( vertex1 );
+					geometry.vertices.push( vertex2 );
 
 				}
 

+ 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( new THREE.Vector3( position.x, position.y, position.z ) );
+					geometry.vertices[ i ] = new THREE.Vertex( 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( new THREE.Vector3( - size, floor, i * step - size ) ) );
-					geometry.vertices.push( new THREE.Vertex( new THREE.Vector3(   size, floor, i * step - size ) ) );
+					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( new THREE.Vector3( i * step - size, floor, -size ) ) );
-					geometry.vertices.push( new THREE.Vertex( new THREE.Vector3( i * step - size, floor,  size ) ) );
+					geometry.vertices.push( new THREE.Vertex( i * step - size, floor, -size ) );
+					geometry.vertices.push( new THREE.Vertex( 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( new THREE.Vector3( - size, floor, i * step - size ) ) );
-					geometry.vertices.push( new THREE.Vertex( new THREE.Vector3(   size, floor, i * step - size ) ) );
-					geometry.vertices.push( new THREE.Vertex( new THREE.Vector3( i * step - size, floor, -size ) ) );
-					geometry.vertices.push( new THREE.Vertex( new THREE.Vector3( i * step - size, floor,  size ) ) );
+					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 ) );
 
 				}
 

+ 1 - 1
examples/webgl_loader_json_blender.html

@@ -54,7 +54,7 @@
 
 			var loader = new THREE.ColladaLoader();
 			loader.options.convertUpAxis = true;
-			loader.load( 'models/monster.dae', function colladaReady( collada ) {
+			loader.load( 'models/collada/monster/monster.dae', function colladaReady( collada ) {
 
 				dae = collada.scene;
 				skin = collada.skins[ 0 ];

+ 4 - 4
examples/webgl_materials.html

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

+ 4 - 4
examples/webgl_morphtargets.html

@@ -119,13 +119,13 @@
 
 					for ( var v = 0; v < geometry.vertices.length; v ++ ) {
 
-						vertices.push( new THREE.Vertex( geometry.vertices[ v ].position.clone() ) )
+						vertices.push( new THREE.Vertex().copy( geometry.vertices[ v ] ) );
 
 						if ( v === i ) {
 
-							vertices[ vertices.length - 1 ].position.x *= 2;
-							vertices[ vertices.length - 1 ].position.y *= 2;
-							vertices[ vertices.length - 1 ].position.z *= 2;
+							vertices[ vertices.length - 1 ].x *= 2;
+							vertices[ vertices.length - 1 ].y *= 2;
+							vertices[ vertices.length - 1 ].z *= 2;
 
 						}
 

+ 1 - 1
examples/webgl_multiple_canvases_circle.html

@@ -251,7 +251,7 @@
 
 							vertexIndex = f1[ faceIndices[ j ] ];
 
-							p = geometry1.vertices[ vertexIndex ].position;
+							p = geometry1.vertices[ vertexIndex ];
 
 							color = new THREE.Color( 0xffffff );
 							color.setHSV( ( p.y / radius + 1 ) / 2, 1.0, 1.0 );

+ 1 - 1
examples/webgl_multiple_canvases_complex.html

@@ -170,7 +170,7 @@
 
 							vertexIndex = f1[ faceIndices[ j ] ];
 
-							p = geometry1.vertices[ vertexIndex ].position;
+							p = geometry1.vertices[ vertexIndex ];
 
 							color = new THREE.Color( 0xffffff );
 							color.setHSV( ( p.y / radius + 1 ) / 2, 1.0, 1.0 );

+ 1 - 1
examples/webgl_multiple_canvases_grid.html

@@ -186,7 +186,7 @@
 
 							vertexIndex = f1[ faceIndices[ j ] ];
 
-							p = geometry1.vertices[ vertexIndex ].position;
+							p = geometry1.vertices[ vertexIndex ];
 
 							color = new THREE.Color( 0xffffff );
 							color.setHSV( ( p.y / radius + 1 ) / 2, 1.0, 1.0 );

+ 1 - 1
examples/webgl_multiple_views.html

@@ -167,7 +167,7 @@
 
 						vertexIndex = f[ faceIndices[ j ] ];
 
-						p = geometry.vertices[ vertexIndex ].position;
+						p = geometry.vertices[ vertexIndex ];
 
 						color = new THREE.Color( 0xffffff );
 						color.setHSV( ( p.y / radius + 1 ) / 2, 1.0, 1.0 );

+ 6 - 6
examples/webgl_particles_billboards.html

@@ -46,7 +46,7 @@
 			if ( ! Detector.webgl ) Detector.addGetWebGLMessage();
 
 			var container, stats;
-			var camera, scene, renderer, particles, geometry, material, i, h, color, sprite, size, x, y, z;
+			var camera, scene, renderer, particles, geometry, material, i, h, color, sprite, size;
 			var mouseX = 0, mouseY = 0;
 
 			var windowHalfX = window.innerWidth / 2;
@@ -73,12 +73,12 @@
 
 				for ( i = 0; i < 10000; i ++ ) {
 
-					x = 2000 * Math.random() - 1000;
-					y = 2000 * Math.random() - 1000;
-					z = 2000 * Math.random() - 1000;
+					var vertex = new THREE.Vertex();
+					vertex.x = 2000 * Math.random() - 1000;
+					vertex.y = 2000 * Math.random() - 1000;
+					vertex.z = 2000 * Math.random() - 1000;
 
-					vector = new THREE.Vector3( x, y, z );
-					geometry.vertices.push( new THREE.Vertex( vector ) );
+					geometry.vertices.push( vertex );
 
 				}
 

+ 7 - 7
examples/webgl_particles_billboards_colors.html

@@ -46,7 +46,7 @@
 			if ( ! Detector.webgl ) Detector.addGetWebGLMessage();
 
 			var container, stats;
-			var camera, scene, renderer, particles, geometry, material, i, h, color, colors = [], sprite, size, x, y, z;
+			var camera, scene, renderer, particles, geometry, material, i, h, color, colors = [], sprite, size;
 			var mouseX = 0, mouseY = 0;
 
 			var windowHalfX = window.innerWidth / 2;
@@ -73,15 +73,15 @@
 
 				for ( i = 0; i < 5000; i ++ ) {
 
-					x = 2000 * Math.random() - 1000;
-					y = 2000 * Math.random() - 1000;
-					z = 2000 * Math.random() - 1000;
+					var vertex = new THREE.Vertex();
+					vertex.x = 2000 * Math.random() - 1000;
+					vertex.y = 2000 * Math.random() - 1000;
+					vertex.z = 2000 * Math.random() - 1000;
 
-					vector = new THREE.Vector3( x, y, z );
-					geometry.vertices.push( new THREE.Vertex( vector ) );
+					geometry.vertices.push( vertex );
 
 					colors[ i ] = new THREE.Color( 0xffffff );
-					colors[ i ].setHSV( (x+1000)/2000, 1.0, 1.0 );
+					colors[ i ].setHSV( ( vertex.x + 1000 ) / 2000, 1, 1 );
 
 				}
 

+ 3 - 3
examples/webgl_particles_dynamic.html

@@ -212,9 +212,9 @@
 
 				for ( i = 0; i < vl; i ++ ) {
 
-					p = vertices[ i ].position;
+					p = vertices[ i ];
 
-					geometry.vertices[ i ] = new THREE.Vertex( p.clone() );
+					geometry.vertices[ i ] = new THREE.Vertex().copy( p );
 					vertices_tmp[ i ] = [ p.x, p.y, p.z, 0, 0 ];
 
 				}
@@ -334,7 +334,7 @@
 
 					for ( i = 0; i < vl; i ++ ) {
 
-						p = vertices[ i ].position;
+						p = vertices[ i ];
 						vt = vertices_tmp[ i ];
 
 						// falling down

+ 7 - 3
examples/webgl_particles_random.html

@@ -32,7 +32,7 @@
 	</head>
 	<body>
 
-        <div id="info">
+		<div id="info">
 			<a href="http://github.com/mrdoob/three.js" target="_blank">three.js</a> - webgl particles example
 		</div>
 
@@ -71,8 +71,12 @@
 
 				for ( i = 0; i < 20000; i ++ ) {
 
-					vector = new THREE.Vector3( Math.random() * 2000 - 1000, Math.random() * 2000 - 1000, Math.random() * 2000 - 1000 );
-					geometry.vertices.push( new THREE.Vertex( vector ) );
+					var vertex = new THREE.Vertex();
+					vertex.x = Math.random() * 2000 - 1000;
+					vertex.y = Math.random() * 2000 - 1000;
+					vertex.z = Math.random() * 2000 - 1000;
+
+					geometry.vertices.push( vertex );
 
 				}
 

+ 15 - 15
examples/webgl_particles_shapes.html

@@ -113,7 +113,7 @@
 				info.style.top = '10px';
 				info.style.width = '100%';
 				info.style.textAlign = 'center';
-				info.innerHTML = 'Three.js - simple particle systems with shapes by <a href="http://www.lab4games.net/zz85/blog">zz85</a><br/>Move your mouse. Click to pause/resume.';
+				info.innerHTML = 'Three.js - simple particle systems with shapes by <a href="http://www.lab4games.net/zz85/blog">zz85</a><br>Move your mouse. Click to pause/resume.';
 				container.appendChild( info );
 
 				// SCENE
@@ -151,8 +151,8 @@
 
 				}
 
-                var textMaterialFront = new THREE.MeshLambertMaterial( { color: 0xffffff, shading: THREE.FlatShading, opacity: 0.95 } );
-                var textMaterialSide = new THREE.MeshLambertMaterial( { color: 0xffffff } );
+				var textMaterialFront = new THREE.MeshLambertMaterial( { color: 0xffffff, shading: THREE.FlatShading, opacity: 0.95 } );
+				var textMaterialSide = new THREE.MeshLambertMaterial( { color: 0xffffff } );
 
 				var text3d = new THREE.TextGeometry( theText, {
 
@@ -182,15 +182,15 @@
 				// Potentially, we can extract the vertices or faces of the text to generate particles too.
 				// Geo > Vertices > Position
 
-                text.position.x = centerOffset;
-                text.position.y = 130;
-                text.position.z = -50;
+				text.position.x = centerOffset;
+				text.position.y = 130;
+				text.position.z = -50;
 
-                text.rotation.x = 0;
-                text.rotation.y = Math.PI * 2;
+				text.rotation.x = 0;
+				text.rotation.y = Math.PI * 2;
 
-				parent = new THREE.Object3D();
-                parent.add( text );
+						parent = new THREE.Object3D();
+				parent.add( text );
 				scene.add( parent );
 
 				///// Create particle objects for Three.js
@@ -201,7 +201,7 @@
 
 				function newpos( x, y, z ) {
 
-					return new THREE.Vertex( new THREE.Vector3( x, y, z ) );
+					return new THREE.Vertex( x, y, z );
 
 				}
 
@@ -353,7 +353,7 @@
 					values_color[ v ] = new THREE.Color( 0xffffff );
 					values_color[ v ].setHSV( 0, 0, 0 );
 
-					particles.vertices[ v ].position.set( Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY );
+					particles.vertices[ v ].set( Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY );
 
 				}
 
@@ -422,7 +422,7 @@
 						pointLight.position.y = emitterpos.y;
 						pointLight.position.z = 100;
 
-						particles.vertices[ target ].position = p.position;
+						particles.vertices[ target ] = p.position;
 
 						values_color[ target ].setHSV( hue, 0.8, 0.15 );
 
@@ -442,7 +442,7 @@
 						// Hide the particle
 
 						values_color[ target ].setHSV( 0, 0, 0 );
-						particles.vertices[ target ].position.set( Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY );
+						particles.vertices[ target ].set( Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY );
 
 						// Mark particle system as available by returning to pool
 
@@ -493,7 +493,7 @@
 
 
 				renderer = new THREE.WebGLRenderer();
-                renderer.setSize( window.innerWidth, window.innerHeight );
+				renderer.setSize( window.innerWidth, window.innerHeight );
 				renderer.setClearColorHex( 0x000000, 1 );
 
 				container.appendChild( renderer.domElement );

+ 6 - 2
examples/webgl_particles_sprites.html

@@ -78,8 +78,12 @@
 
 				for ( i = 0; i < 10000; i ++ ) {
 
-					vector = new THREE.Vector3( Math.random() * 2000 - 1000, Math.random() * 2000 - 1000, Math.random() * 2000 - 1000 );
-					geometry.vertices.push( new THREE.Vertex( vector ) );
+					var vertex = new THREE.Vertex();
+					vertex.x = Math.random() * 2000 - 1000;
+					vertex.y = Math.random() * 2000 - 1000;
+					vertex.z = Math.random() * 2000 - 1000;
+
+					geometry.vertices.push( vertex );
 
 				}
 

+ 5 - 8
examples/webgl_ribbons.html

@@ -101,11 +101,8 @@
 
 					}
 
-					vector = new THREE.Vector3( x, y, z );
-					geometry.vertices.push( new THREE.Vertex( vector ) );
-
-					vector = new THREE.Vector3( x, y, z );
-					geometry2.vertices.push( new THREE.Vertex( vector ) );
+					geometry.vertices.push( new THREE.Vertex( x, y, z ) );
+					geometry2.vertices.push( new THREE.Vertex( x, y, z ) );
 
 					h = i2 % 2 ? 1 : 0.15;
 					if( i2 % 4 <= 2 ) h -= 0.15;
@@ -118,7 +115,7 @@
 				}
 
 				var tmpRot = new THREE.Matrix4();
-				tmpRot.setRotationAxis( new THREE.Vector3( 1, 0, 0 ), Math.PI/2 );
+				tmpRot.makeRotationAxis( new THREE.Vector3( 1, 0, 0 ), Math.PI/2 );
 
 				xgrid = 34;
 				ygrid = 15;
@@ -273,8 +270,8 @@
 					z  =  10 * Math.sin( i2 * 0.1 + time*30 );
 					z2 =  20 * Math.cos( Math.sin( i2 * 0.1 + time * 20 ) );
 
-					geometry.vertices[ i2 ].position.z = z;
-					geometry2.vertices[ i2 ].position.z = z2;
+					geometry.vertices[ i2 ].z = z;
+					geometry2.vertices[ i2 ].z = z2;
 
 				}
 

+ 5 - 7
examples/webgl_trackballcamera_earth.html

@@ -194,16 +194,14 @@
 
 				// stars
 
-				var i,
-				vector,
-				starsGeometry = new THREE.Geometry();
+				var starsGeometry = new THREE.Geometry();
 
-				for ( i = 0; i < 1500; i ++ ) {
+				for ( var i = 0; i < 1500; i ++ ) {
 
-					vector = new THREE.Vector3( Math.random() * 2 - 1, Math.random() * 2 - 1, Math.random() * 2 - 1 );
-					vector.multiplyScalar( radius );
+					var vertex = new THREE.Vertex( Math.random() * 2 - 1, Math.random() * 2 - 1, Math.random() * 2 - 1 );
+					vertex.multiplyScalar( radius );
 
-					starsGeometry.vertices.push( new THREE.Vertex( vector ) );
+					starsGeometry.vertices.push( vertex );
 
 				}
 

+ 3 - 3
examples/webgl_trails.html

@@ -56,9 +56,9 @@
 				for ( var i = 0; i < 2000; i ++ ) {
 
 					var vertex = new THREE.Vertex();
-					vertex.position.x = Math.random() * 4000 - 2000;
-					vertex.position.y = Math.random() * 4000 - 2000;
-					vertex.position.z = Math.random() * 4000 - 2000;
+					vertex.x = Math.random() * 4000 - 2000;
+					vertex.y = Math.random() * 4000 - 2000;
+					vertex.z = Math.random() * 4000 - 2000;
 					geometry.vertices.push( vertex );
 
 					geometry.colors.push( new THREE.Color( colors[ Math.floor( Math.random() * colors.length ) ] ) );

+ 17 - 17
src/core/Geometry.js

@@ -49,7 +49,7 @@ THREE.Geometry.prototype = {
 
 			var vertex = this.vertices[ i ];
 
-			matrix.multiplyVector3( vertex.position );
+			matrix.multiplyVector3( vertex );
 
 		}
 
@@ -82,17 +82,17 @@ THREE.Geometry.prototype = {
 
 			if ( face instanceof THREE.Face3 ) {
 
-				face.centroid.addSelf( this.vertices[ face.a ].position );
-				face.centroid.addSelf( this.vertices[ face.b ].position );
-				face.centroid.addSelf( this.vertices[ face.c ].position );
+				face.centroid.addSelf( this.vertices[ face.a ] );
+				face.centroid.addSelf( this.vertices[ face.b ] );
+				face.centroid.addSelf( this.vertices[ face.c ] );
 				face.centroid.divideScalar( 3 );
 
 			} else if ( face instanceof THREE.Face4 ) {
 
-				face.centroid.addSelf( this.vertices[ face.a ].position );
-				face.centroid.addSelf( this.vertices[ face.b ].position );
-				face.centroid.addSelf( this.vertices[ face.c ].position );
-				face.centroid.addSelf( this.vertices[ face.d ].position );
+				face.centroid.addSelf( this.vertices[ face.a ] );
+				face.centroid.addSelf( this.vertices[ face.b ] );
+				face.centroid.addSelf( this.vertices[ face.c ] );
+				face.centroid.addSelf( this.vertices[ face.d ] );
 				face.centroid.divideScalar( 4 );
 
 			}
@@ -114,8 +114,8 @@ THREE.Geometry.prototype = {
 			vB = this.vertices[ face.b ];
 			vC = this.vertices[ face.c ];
 
-			cb.sub( vC.position, vB.position );
-			ab.sub( vA.position, vB.position );
+			cb.sub( vC, vB );
+			ab.sub( vA, vB );
 			cb.crossSelf( ab );
 
 			if ( !cb.isZero() ) {
@@ -388,9 +388,9 @@ THREE.Geometry.prototype = {
 
 		function handleTriangle( context, a, b, c, ua, ub, uc ) {
 
-			vA = context.vertices[ a ].position;
-			vB = context.vertices[ b ].position;
-			vC = context.vertices[ c ].position;
+			vA = context.vertices[ a ];
+			vB = context.vertices[ b ];
+			vC = context.vertices[ c ];
 
 			uvA = uv[ ua ];
 			uvB = uv[ ub ];
@@ -489,7 +489,7 @@ THREE.Geometry.prototype = {
 
 		if ( this.vertices.length > 0 ) {
 
-			var position, firstPosition = this.vertices[ 0 ].position;
+			var position, firstPosition = this.vertices[ 0 ];
 
 			this.boundingBox.min.copy( firstPosition );
 			this.boundingBox.max.copy( firstPosition );
@@ -499,7 +499,7 @@ THREE.Geometry.prototype = {
 
 			for ( var v = 1, vl = this.vertices.length; v < vl; v ++ ) {
 
-				position = this.vertices[ v ].position;
+				position = this.vertices[ v ];
 
 				if ( position.x < min.x ) {
 
@@ -550,7 +550,7 @@ THREE.Geometry.prototype = {
 
 		for ( var v = 0, vl = this.vertices.length; v < vl; v ++ ) {
 
-			radius = this.vertices[ v ].position.length();
+			radius = this.vertices[ v ].length();
 			if ( radius > maxRadius ) maxRadius = radius;
 
 		}
@@ -577,7 +577,7 @@ THREE.Geometry.prototype = {
 
 		for ( i = 0, il = this.vertices.length; i < il; i ++ ) {
 
-			v = this.vertices[ i ].position;
+			v = this.vertices[ i ];
 			key = [ Math.round( v.x * precision ), Math.round( v.y * precision ), Math.round( v.z * precision ) ].join( '_' );
 
 			if ( verticesMap[ key ] === undefined ) {

+ 3 - 3
src/core/Projector.js

@@ -178,7 +178,7 @@ THREE.Projector = function() {
 				for ( v = 0, vl = vertices.length; v < vl; v ++ ) {
 
 					_vertex = getNextVertexInPool();
-					_vertex.positionWorld.copy( vertices[ v ].position );
+					_vertex.positionWorld.copy( vertices[ v ] );
 
 					objectMatrixWorld.multiplyVector3( _vertex.positionWorld );
 
@@ -316,7 +316,7 @@ THREE.Projector = function() {
 				vertices = object.geometry.vertices;
 				
 				v1 = getNextVertexInPool();
-				v1.positionScreen.copy( vertices[ 0 ].position );
+				v1.positionScreen.copy( vertices[ 0 ] );
 				_projScreenobjectMatrixWorld.multiplyVector4( v1.positionScreen );
 
 				// Handle LineStrip and LinePieces
@@ -325,7 +325,7 @@ THREE.Projector = function() {
 				for ( v = 1, vl = vertices.length; v < vl; v ++ ) {
 
 					v1 = getNextVertexInPool();
-					v1.positionScreen.copy( vertices[ v ].position );
+					v1.positionScreen.copy( vertices[ v ] );
 					_projScreenobjectMatrixWorld.multiplyVector4( v1.positionScreen );
 
 					if ( ( v + 1 ) % step > 0 ) continue;

+ 8 - 8
src/core/Ray.js

@@ -108,9 +108,9 @@ THREE.Ray = function ( origin, direction ) {
 
 					if ( face instanceof THREE.Face3 ) {
 
-						a = objMatrix.multiplyVector3( a.copy( vertices[ face.a ].position ) );
-						b = objMatrix.multiplyVector3( b.copy( vertices[ face.b ].position ) );
-						c = objMatrix.multiplyVector3( c.copy( vertices[ face.c ].position ) );
+						a = objMatrix.multiplyVector3( a.copy( vertices[ face.a ] ) );
+						b = objMatrix.multiplyVector3( b.copy( vertices[ face.b ] ) );
+						c = objMatrix.multiplyVector3( c.copy( vertices[ face.c ] ) );
 
 						if ( pointInFace3( intersectPoint, a, b, c ) ) {
 
@@ -129,10 +129,10 @@ THREE.Ray = function ( origin, direction ) {
 
 					} else if ( face instanceof THREE.Face4 ) {
 
-						a = objMatrix.multiplyVector3( a.copy( vertices[ face.a ].position ) );
-						b = objMatrix.multiplyVector3( b.copy( vertices[ face.b ].position ) );
-						c = objMatrix.multiplyVector3( c.copy( vertices[ face.c ].position ) );
-						d = objMatrix.multiplyVector3( d.copy( vertices[ face.d ].position ) );
+						a = objMatrix.multiplyVector3( a.copy( vertices[ face.a ] ) );
+						b = objMatrix.multiplyVector3( b.copy( vertices[ face.b ] ) );
+						c = objMatrix.multiplyVector3( c.copy( vertices[ face.c ] ) );
+						d = objMatrix.multiplyVector3( d.copy( vertices[ face.d ] ) );
 
 						if ( pointInFace3( intersectPoint, a, b, d ) || pointInFace3( intersectPoint, b, c, d ) ) {
 
@@ -216,4 +216,4 @@ THREE.Ray = function ( origin, direction ) {
 
 	}
 
-};
+};

+ 2 - 0
src/core/Vector3.js

@@ -8,6 +8,8 @@
 
 THREE.Vector3 = function ( x, y, z ) {
 
+	if ( x instanceof THREE.Vector3 ) console.warn( 'OPS!' );
+
 	this.x = x || 0;
 	this.y = y || 0;
 	this.z = z || 0;

+ 1 - 17
src/core/Vertex.js

@@ -2,20 +2,4 @@
  * @author mr.doob / http://mrdoob.com/
  */
 
-THREE.Vertex = function ( position ) {
-
-	this.position = position || new THREE.Vector3();
-
-};
-
-THREE.Vertex.prototype = {
-
-	constructor: THREE.Vertex,
-
-	clone: function () {
-
-		return new THREE.Vertex( this.position.clone() );
-
-	}
-
-};
+THREE.Vertex = THREE.Vector3;

+ 29 - 29
src/extras/GeometryUtils.js

@@ -48,7 +48,7 @@ THREE.GeometryUtils = {
 
 			var vertexCopy = vertex.clone();
 
-			if ( matrix ) matrix.multiplyVector3( vertexCopy.position );
+			if ( matrix ) matrix.multiplyVector3( vertexCopy );
 
 			vertices1.push( vertexCopy );
 
@@ -246,18 +246,18 @@ THREE.GeometryUtils = {
 
 		if ( face instanceof THREE.Face3 ) {
 
-			vA = geometry.vertices[ face.a ].position;
-			vB = geometry.vertices[ face.b ].position;
-			vC = geometry.vertices[ face.c ].position;
+			vA = geometry.vertices[ face.a ];
+			vB = geometry.vertices[ face.b ];
+			vC = geometry.vertices[ face.c ];
 
 			return THREE.GeometryUtils.randomPointInTriangle( vA, vB, vC );
 
 		} else if ( face instanceof THREE.Face4 ) {
 
-			vA = geometry.vertices[ face.a ].position;
-			vB = geometry.vertices[ face.b ].position;
-			vC = geometry.vertices[ face.c ].position;
-			vD = geometry.vertices[ face.d ].position;
+			vA = geometry.vertices[ face.a ];
+			vB = geometry.vertices[ face.b ];
+			vC = geometry.vertices[ face.c ];
+			vD = geometry.vertices[ face.d ];
 
 			var area1, area2;
 
@@ -325,18 +325,18 @@ THREE.GeometryUtils = {
 
 			if ( face instanceof THREE.Face3 ) {
 
-				vA = vertices[ face.a ].position;
-				vB = vertices[ face.b ].position;
-				vC = vertices[ face.c ].position;
+				vA = vertices[ face.a ];
+				vB = vertices[ face.b ];
+				vC = vertices[ face.c ];
 
 				face._area = THREE.GeometryUtils.triangleArea( vA, vB, vC );
 
 			} else if ( face instanceof THREE.Face4 ) {
 
-				vA = vertices[ face.a ].position;
-				vB = vertices[ face.b ].position;
-				vC = vertices[ face.c ].position;
-				vD = vertices[ face.d ].position;
+				vA = vertices[ face.a ];
+				vB = vertices[ face.b ];
+				vC = vertices[ face.c ];
+				vD = vertices[ face.d ];
 
 				face._area1 = THREE.GeometryUtils.triangleArea( vA, vB, vD );
 				face._area2 = THREE.GeometryUtils.triangleArea( vB, vC, vD );
@@ -712,9 +712,9 @@ THREE.GeometryUtils = {
 				vb = geometry.vertices[ b ];
 				vc = geometry.vertices[ c ];
 
-				dab = va.position.distanceTo( vb.position );
-				dbc = vb.position.distanceTo( vc.position );
-				dac = va.position.distanceTo( vc.position );
+				dab = va.distanceTo( vb );
+				dbc = vb.distanceTo( vc );
+				dac = va.distanceTo( vc );
 
 				if ( dab > maxEdgeLength || dbc > maxEdgeLength || dac > maxEdgeLength ) {
 
@@ -726,7 +726,7 @@ THREE.GeometryUtils = {
 					if ( dab >= dbc && dab >= dac ) {
 
 						vm = va.clone();
-						vm.position.lerpSelf( vb.position, 0.5 );
+						vm.lerpSelf( vb, 0.5 );
 
 						triA.a = a;
 						triA.b = m;
@@ -761,7 +761,7 @@ THREE.GeometryUtils = {
 					} else if ( dbc >= dab && dbc >= dac ) {
 
 						vm = vb.clone();
-						vm.position.lerpSelf( vc.position, 0.5 );
+						vm.lerpSelf( vc, 0.5 );
 
 						triA.a = a;
 						triA.b = b;
@@ -802,7 +802,7 @@ THREE.GeometryUtils = {
 					} else {
 
 						vm = va.clone();
-						vm.position.lerpSelf( vc.position, 0.5 );
+						vm.lerpSelf( vc, 0.5 );
 
 						triA.a = a;
 						triA.b = b;
@@ -913,10 +913,10 @@ THREE.GeometryUtils = {
 				vc = geometry.vertices[ c ];
 				vd = geometry.vertices[ d ];
 
-				dab = va.position.distanceTo( vb.position );
-				dbc = vb.position.distanceTo( vc.position );
-				dcd = vc.position.distanceTo( vd.position );
-				dad = va.position.distanceTo( vd.position );
+				dab = va.distanceTo( vb );
+				dbc = vb.distanceTo( vc );
+				dcd = vc.distanceTo( vd );
+				dad = va.distanceTo( vd );
 
 				if ( dab > maxEdgeLength || dbc > maxEdgeLength || dcd > maxEdgeLength || dad > maxEdgeLength ) {
 
@@ -929,10 +929,10 @@ THREE.GeometryUtils = {
 					if ( ( dab >= dbc && dab >= dcd && dab >= dad ) || ( dcd >= dbc && dcd >= dab && dcd >= dad ) ) {
 
 						vm1 = va.clone();
-						vm1.position.lerpSelf( vb.position, 0.5 );
+						vm1.lerpSelf( vb, 0.5 );
 
 						vm2 = vc.clone();
-						vm2.position.lerpSelf( vd.position, 0.5 );
+						vm2.lerpSelf( vd, 0.5 );
 
 						quadA.a = a;
 						quadA.b = m1;
@@ -981,10 +981,10 @@ THREE.GeometryUtils = {
 					} else {
 
 						vm1 = vb.clone();
-						vm1.position.lerpSelf( vc.position, 0.5 );
+						vm1.lerpSelf( vc, 0.5 );
 
 						vm2 = vd.clone();
-						vm2.position.lerpSelf( va.position, 0.5 );
+						vm2.lerpSelf( va, 0.5 );
 
 						quadA.a = a;
 						quadA.b = b;

+ 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( new THREE.Vector3( position.x, position.y, position.z ) );
+			geometry.vertices[ i ] = new THREE.Vertex( position.x, position.y, position.z );
 
 		}
 

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

@@ -205,7 +205,7 @@ THREE.CurvePath.prototype.createGeometry = function( points ) {
 
     for( var i = 0; i < points.length; i ++ ) {
 
-        geometry.vertices.push( new THREE.Vertex( new THREE.Vector3( points[ i ].x, points[ i ].y, 0 ) ) );
+        geometry.vertices.push( new THREE.Vertex( points[ i ].x, points[ i ].y, 0 ) );
 
     }
 

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

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

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

@@ -32,7 +32,7 @@ THREE.CylinderGeometry = function ( radiusTop, radiusBottom, height, segmentsRad
 			var ypos = - v * height + heightHalf;
 			var zpos = radius * Math.cos( u * Math.PI * 2 );
 
-			this.vertices.push( new THREE.Vertex( new THREE.Vector3( xpos, ypos, zpos ) ) );
+			this.vertices.push( new THREE.Vertex( xpos, ypos, zpos ) );
 
 			verticesRow.push( this.vertices.length - 1 );
 			uvsRow.push( new THREE.UV( u, v ) );
@@ -55,10 +55,10 @@ THREE.CylinderGeometry = function ( radiusTop, radiusBottom, height, segmentsRad
 
 			// FIXME: These normals aren't right for cones.
 
-			var n1 = this.vertices[ v1 ].position.clone().setY( 0 ).normalize();
-			var n2 = this.vertices[ v2 ].position.clone().setY( 0 ).normalize();
-			var n3 = this.vertices[ v3 ].position.clone().setY( 0 ).normalize();
-			var n4 = this.vertices[ v4 ].position.clone().setY( 0 ).normalize();
+			var n1 = this.vertices[ v1 ].clone().setY( 0 ).normalize();
+			var n2 = this.vertices[ v2 ].clone().setY( 0 ).normalize();
+			var n3 = this.vertices[ v3 ].clone().setY( 0 ).normalize();
+			var n4 = this.vertices[ v4 ].clone().setY( 0 ).normalize();
 
 			var uv1 = uvs[ y ][ x ].clone();
 			var uv2 = uvs[ y + 1 ][ x ].clone();
@@ -76,7 +76,7 @@ THREE.CylinderGeometry = function ( radiusTop, radiusBottom, height, segmentsRad
 
 	if ( !openEnded && radiusTop > 0 ) {
 
-		this.vertices.push( new THREE.Vertex( new THREE.Vector3( 0, heightHalf, 0 ) ) );
+		this.vertices.push( new THREE.Vertex( 0, heightHalf, 0 ) );
 
 		for ( x = 0; x < segmentsX; x ++ ) {
 
@@ -103,7 +103,7 @@ THREE.CylinderGeometry = function ( radiusTop, radiusBottom, height, segmentsRad
 
 	if ( !openEnded && radiusBottom > 0 ) {
 
-		this.vertices.push( new THREE.Vertex( new THREE.Vector3( 0, - heightHalf, 0 ) ) );
+		this.vertices.push( new THREE.Vertex( 0, - heightHalf, 0 ) );
 
 		for ( x = 0; x < segmentsX; x ++ ) {
 

+ 19 - 19
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( new THREE.Vector3( x, y, z ) ) );
+		scope.vertices.push( new THREE.Vertex( x, y, z ) );
 	}
 
 	function f3( a, b, c, isBottom ) {
@@ -660,14 +660,14 @@ THREE.ExtrudeGeometry.prototype.addShape = function( shape, options ) {
 
 THREE.ExtrudeGeometry.WorldUVGenerator = {
 	generateTopUV: function( geometry, extrudedShape, extrudeOptions, indexA, indexB, indexC) {
-		var ax = geometry.vertices[ indexA ].position.x,
-			ay = geometry.vertices[ indexA ].position.y,
+		var ax = geometry.vertices[ indexA ].x,
+			ay = geometry.vertices[ indexA ].y,
 
-			bx = geometry.vertices[ indexB ].position.x,
-			by = geometry.vertices[ indexB ].position.y,
+			bx = geometry.vertices[ indexB ].x,
+			by = geometry.vertices[ indexB ].y,
 
-			cx = geometry.vertices[ indexC ].position.x,
-			cy = geometry.vertices[ indexC ].position.y;
+			cx = geometry.vertices[ indexC ].x,
+			cy = geometry.vertices[ indexC ].y;
 			
 		return [
 			new THREE.UV( ax, 1 - ay ),
@@ -682,21 +682,21 @@ THREE.ExtrudeGeometry.WorldUVGenerator = {
 
 	generateSideWallUV: function( geometry, extrudedShape, wallContour, extrudeOptions,
 	                              indexA, indexB, indexC, indexD, stepIndex, stepsLength) {
-		var ax = geometry.vertices[ indexA ].position.x,
-			ay = geometry.vertices[ indexA ].position.y,
-			az = geometry.vertices[ indexA ].position.z,
+		var ax = geometry.vertices[ indexA ].x,
+			ay = geometry.vertices[ indexA ].y,
+			az = geometry.vertices[ indexA ].z,
 
-			bx = geometry.vertices[ indexB ].position.x,
-			by = geometry.vertices[ indexB ].position.y,
-			bz = geometry.vertices[ indexB ].position.z,
+			bx = geometry.vertices[ indexB ].x,
+			by = geometry.vertices[ indexB ].y,
+			bz = geometry.vertices[ indexB ].z,
 
-			cx = geometry.vertices[ indexC ].position.x,
-			cy = geometry.vertices[ indexC ].position.y,
-			cz = geometry.vertices[ indexC ].position.z,
+			cx = geometry.vertices[ indexC ].x,
+			cy = geometry.vertices[ indexC ].y,
+			cz = geometry.vertices[ indexC ].z,
 
-			dx = geometry.vertices[ indexD ].position.x,
-			dy = geometry.vertices[ indexD ].position.y,
-			dz = geometry.vertices[ indexD ].position.z;
+			dx = geometry.vertices[ indexD ].x,
+			dy = geometry.vertices[ indexD ].y,
+			dz = geometry.vertices[ indexD ].z;
 		
 		if ( Math.abs( ay - by ) < 0.01 ) {
 			return [

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

@@ -16,7 +16,7 @@ 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( _newV[ j ] ) );
+		this.vertices.push( new THREE.Vertex().copy( _newV[ j ] ) );
 
 	}
 
@@ -28,7 +28,7 @@ THREE.LatheGeometry = function ( points, steps, angle ) {
 		for ( var j = 0; j < _newV.length; j ++ ) {
 
 			_newV[ j ] = _matrix.multiplyVector3( _newV[ j ].clone() );
-			this.vertices.push( new THREE.Vertex( _newV[ j ] ) );
+			this.vertices.push( new THREE.Vertex().copy( _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( new THREE.Vector3( x, 0, z ) ) );
+			this.vertices.push( new THREE.Vertex( x, 0, z ) );
 
 		}
 

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

@@ -32,7 +32,7 @@ THREE.PolyhedronGeometry = function ( vertices, faces, radius, detail ) {
 
 	for ( var i = 0, l = this.vertices.length; i < l; i ++ ) {
 
-		this.vertices[ i ].position.multiplyScalar( radius );
+		this.vertices[ i ].multiplyScalar( radius );
 
 	}
 
@@ -41,7 +41,7 @@ THREE.PolyhedronGeometry = function ( vertices, faces, radius, detail ) {
 	 */
 	function prepare( vector ) {
 
-		var vertex = new THREE.Vertex( vector.normalize() );
+		var vertex = new THREE.Vertex().copy( vector.normalize() );
 		vertex.index = that.vertices.push( vertex ) - 1;
 
 		// Texture coords are equivalent to map coords, calculate angle and convert to fraction of a circle.
@@ -60,16 +60,16 @@ THREE.PolyhedronGeometry = function ( vertices, faces, radius, detail ) {
 
 		if ( detail < 1 ) {
 
-			var face = new THREE.Face3( v1.index, v2.index, v3.index, [ v1.position.clone(), v2.position.clone(), v3.position.clone() ] );
-			face.centroid.addSelf( v1.position ).addSelf( v2.position ).addSelf( v3.position ).divideScalar( 3 );
+			var face = new THREE.Face3( v1.index, v2.index, v3.index, [ v1.clone(), v2.clone(), v3.clone() ] );
+			face.centroid.addSelf( v1 ).addSelf( v2 ).addSelf( v3 ).divideScalar( 3 );
 			face.normal = face.centroid.clone().normalize();
 			that.faces.push( face );
 
 			var azi = azimuth( face.centroid );
 			that.faceVertexUvs[ 0 ].push( [ 
-				correctUV( v1.uv, v1.position, azi ),
-				correctUV( v2.uv, v2.position, azi ),
-				correctUV( v3.uv, v3.position, azi )
+				correctUV( v1.uv, v1, azi ),
+				correctUV( v2.uv, v2, azi ),
+				correctUV( v3.uv, v3, azi )
 			] );
 
 		}
@@ -94,7 +94,7 @@ THREE.PolyhedronGeometry = function ( vertices, faces, radius, detail ) {
 		if ( mid === undefined ) {
 			// generate mean point and project to surface with prepare()
 			midpoints[ v1.index ][ v2.index ] = midpoints[ v2.index ][ v1.index ] = mid = prepare( 
-				new THREE.Vector3().add( v1.position, v2.position ).divideScalar( 2 )
+				new THREE.Vector3().add( v1, v2 ).divideScalar( 2 )
 			);
 		}
 		return mid;

+ 7 - 7
src/extras/geometries/SphereGeometry.js

@@ -33,7 +33,7 @@ THREE.SphereGeometry = function ( radius, segmentsWidth, segmentsHeight, phiStar
 			var ypos = radius * Math.cos( thetaStart + v * thetaLength );
 			var zpos = radius * Math.sin( phiStart + u * phiLength ) * Math.sin( thetaStart + v * thetaLength );
 
-			this.vertices.push( new THREE.Vertex( new THREE.Vector3( xpos, ypos, zpos ) ) );
+			this.vertices.push( new THREE.Vertex( xpos, ypos, zpos ) );
 
 			verticesRow.push( this.vertices.length - 1 );
 			uvsRow.push( new THREE.UV( u, v ) );
@@ -54,22 +54,22 @@ THREE.SphereGeometry = function ( radius, segmentsWidth, segmentsHeight, phiStar
 			var v3 = vertices[ y + 1 ][ x ];
 			var v4 = vertices[ y + 1 ][ x + 1 ];
 
-			var n1 = this.vertices[ v1 ].position.clone().normalize();
-			var n2 = this.vertices[ v2 ].position.clone().normalize();
-			var n3 = this.vertices[ v3 ].position.clone().normalize();
-			var n4 = this.vertices[ v4 ].position.clone().normalize();
+			var n1 = this.vertices[ v1 ].clone().normalize();
+			var n2 = this.vertices[ v2 ].clone().normalize();
+			var n3 = this.vertices[ v3 ].clone().normalize();
+			var n4 = this.vertices[ v4 ].clone().normalize();
 
 			var uv1 = uvs[ y ][ x + 1 ].clone();
 			var uv2 = uvs[ y ][ x ].clone();
 			var uv3 = uvs[ y + 1 ][ x ].clone();
 			var uv4 = uvs[ y + 1 ][ x + 1 ].clone();
 
-			if ( Math.abs( this.vertices[ v1 ].position.y ) == radius ) {
+			if ( Math.abs( this.vertices[ v1 ].y ) == radius ) {
 
 				this.faces.push( new THREE.Face3( v1, v3, v4, [ n1, n3, n4 ] ) );
 				this.faceVertexUvs[ 0 ].push( [ uv1, uv3, uv4 ] );
 
-			} else if ( Math.abs( this.vertices[ v3 ].position.y ) ==  radius ) {
+			} else if ( Math.abs( this.vertices[ v3 ].y ) ==  radius ) {
 
 				this.faces.push( new THREE.Face3( v1, v2, v3, [ n1, n2, n3 ] ) );
 				this.faceVertexUvs[ 0 ].push( [ uv1, uv2, uv3 ] );

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

@@ -28,15 +28,15 @@ THREE.TorusGeometry = function ( radius, tube, segmentsR, segmentsT, arc ) {
 			center.x = this.radius * Math.cos( u );
 			center.y = this.radius * Math.sin( u );
 
-			var vector = new THREE.Vector3();
-			vector.x = ( this.radius + this.tube * Math.cos( v ) ) * Math.cos( u );
-			vector.y = ( this.radius + this.tube * Math.cos( v ) ) * Math.sin( u );
-			vector.z = this.tube * Math.sin( v );
+			var vertex = new THREE.Vertex();
+			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 );
 
-			this.vertices.push( new THREE.Vertex( vector ) );
+			this.vertices.push( vertex );
 
 			uvs.push( new THREE.UV( i / this.segmentsT, 1 - j / this.segmentsR ) );
-			normals.push( vector.clone().subSelf( center ).normalize() );
+			normals.push( vertex.clone().subSelf( center ).normalize() );
 
 		}
 	}

+ 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( new THREE.Vector3( x, y, z ) ) ) - 1;
+		return scope.vertices.push( new THREE.Vertex( 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( new THREE.Vector3( x, y, z ) ) ) - 1;
+		return scope.vertices.push( new THREE.Vertex( x, y, z ) ) - 1;
 
 	}
 

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

@@ -19,8 +19,8 @@ THREE.ArrowHelper = function ( dir, origin, length, hex ) {
     if ( length === undefined ) length = 20;
 
     var lineGeometry = new THREE.Geometry();
-    lineGeometry.vertices.push( new THREE.Vertex( new THREE.Vector3( 0, 0, 0 ) ) );
-    lineGeometry.vertices.push( new THREE.Vertex( new THREE.Vector3( 0, 1, 0 ) ) );
+    lineGeometry.vertices.push( new THREE.Vertex( 0, 0, 0 ) );
+    lineGeometry.vertices.push( new THREE.Vertex( 0, 1, 0 ) );
 
     this.line = new THREE.Line( lineGeometry, new THREE.LineBasicMaterial( { color : hex } ) );
     this.add( this.line );

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

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

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

@@ -84,7 +84,7 @@ THREE.CameraHelper = function ( camera ) {
 
 	function addPoint( id, hex ) {
 
-		_this.lineGeometry.vertices.push( new THREE.Vertex( new THREE.Vector3() ) );
+		_this.lineGeometry.vertices.push( new THREE.Vertex() );
 		_this.lineGeometry.colors.push( new THREE.Color( hex ) );
 
 		if ( _this.pointMap[ id ] === undefined ) _this.pointMap[ id ] = [];
@@ -165,7 +165,7 @@ THREE.CameraHelper.prototype.update = function () {
 			for ( var i = 0, il = points.length; i < il; i ++ ) {
 
 				var j = points[ i ];
-				_this.lineGeometry.vertices[ j ].position.copy( THREE.CameraHelper.__v );
+				_this.lineGeometry.vertices[ j ].copy( THREE.CameraHelper.__v );
 
 			}
 

+ 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( new THREE.Vector3( x, y, z ) ) );
+		scope.vertices.push( new THREE.Vertex( x, y, z ) );
 
 	};
 

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

@@ -437,7 +437,7 @@ THREE.ColladaLoader = function () {
 
 			for ( var i = 0; i < geometry.vertices.length; i ++ ) {
 
-				skin.bindShapeMatrix.multiplyVector3( geometry.vertices[ i ].position );
+				skin.bindShapeMatrix.multiplyVector3( geometry.vertices[ i ] );
 
 			}
 
@@ -568,7 +568,7 @@ THREE.ColladaLoader = function () {
 
 		for ( i = 0; i < geometry.vertices.length; i ++ ) {
 
-			skinController.skin.bindShapeMatrix.multiplyVector3( geometry.vertices[i].position );
+			skinController.skin.bindShapeMatrix.multiplyVector3( geometry.vertices[i] );
 
 		}
 
@@ -583,7 +583,7 @@ THREE.ColladaLoader = function () {
 
 			for ( i = 0; i < geometry.vertices.length; i++ ) {
 
-				skinned.push( new THREE.Vertex( new THREE.Vector3() ) );
+				skinned.push( new THREE.Vertex() );
 
 			}
 
@@ -608,15 +608,15 @@ THREE.ColladaLoader = function () {
 					o = geometry.vertices[vidx];
 					s = skinned[vidx];
 
-					v.x = o.position.x;
-					v.y = o.position.y;
-					v.z = o.position.z;
+					v.x = o.x;
+					v.y = o.y;
+					v.z = o.z;
 
 					bones[i].skinningMatrix.multiplyVector3(v);
 
-					s.position.x += (v.x * weight);
-					s.position.y += (v.y * weight);
-					s.position.z += (v.z * weight);
+					s.x += (v.x * weight);
+					s.y += (v.y * weight);
+					s.z += (v.z * weight);
 
 				}
 
@@ -2306,7 +2306,7 @@ THREE.ColladaLoader = function () {
 
 		for ( i = 0; i < vertexData.length; i += 3 ) {
 
-			var v = new THREE.Vertex( getConvertedVec3( vertexData, i ) );
+			var v = new THREE.Vertex().copy( getConvertedVec3( vertexData, i ) );
 			this.geometry3js.vertices.push( v );
 
 		}

+ 4 - 4
src/extras/loaders/JSONLoader.js

@@ -161,9 +161,9 @@ THREE.JSONLoader.prototype.createModel = function ( json, callback, texturePath
 
 			vertex = new THREE.Vertex();
 
-			vertex.position.x = vertices[ offset ++ ] * scale;
-			vertex.position.y = vertices[ offset ++ ] * scale;
-			vertex.position.z = vertices[ offset ++ ] * scale;
+			vertex.x = vertices[ offset ++ ] * scale;
+			vertex.y = vertices[ offset ++ ] * scale;
+			vertex.z = vertices[ offset ++ ] * scale;
 
 			geometry.vertices.push( vertex );
 
@@ -386,7 +386,7 @@ THREE.JSONLoader.prototype.createModel = function ( json, callback, texturePath
 					y = srcVertices[ v + 1 ] * scale;
 					z = srcVertices[ v + 2 ] * scale;
 
-					dstVertices.push( new THREE.Vertex( new THREE.Vector3( x, y, z ) ) );
+					dstVertices.push( new THREE.Vertex( x, y, z ) );
 
 				}
 

+ 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( new THREE.Vector3( x, y, z ) ) );
+		scope.vertices.push( new THREE.Vertex( x, y, z ) );
 
 	};
 

+ 18 - 18
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( new THREE.Vector3( x, y, z ) ) );
+		newVertices.push( new THREE.Vertex( x, y, z ) );
 	}
 	
 	var scope = this;
@@ -292,9 +292,9 @@ THREE.SubdivisionModifier.prototype.smooth = function ( oldGeometry ) {
 			
 	var avgUv ;
 	for (i=0, il = originalFaces.length; i<il ;i++) {
-		face = originalFaces[i];
-		facePoints.push(face.centroid);
-		newPoints.push( new THREE.Vertex(face.centroid) );
+		face = originalFaces[ i ];
+		facePoints.push( face.centroid );
+		newPoints.push( new THREE.Vertex().copy( face.centroid ) );
 		
 		
 		if (!scope.supportUVs) continue;
@@ -304,14 +304,14 @@ THREE.SubdivisionModifier.prototype.smooth = function ( oldGeometry ) {
 		avgUv = new THREE.UV();
 		
 		if ( face instanceof THREE.Face3 ) {
-			avgUv.u = getUV(face.a, i).u + getUV(face.b, i).u + getUV(face.c, i).u;
-			avgUv.v = getUV(face.a, i).v + getUV(face.b, i).v + getUV(face.c, i).v;
+			avgUv.u = getUV( face.a, i ).u + getUV( face.b, i ).u + getUV( face.c, i ).u;
+			avgUv.v = getUV( face.a, i ).v + getUV( face.b, i ).v + getUV( face.c, i ).v;
 			avgUv.u /= 3;
 			avgUv.v /= 3;
 			
 		} else if ( face instanceof THREE.Face4 ) {
-			avgUv.u = getUV(face.a,i).u + getUV(face.b, i).u + getUV(face.c, i).u + getUV(face.d, i).u;
-			avgUv.v = getUV(face.a,i).v + getUV(face.b, i).v + getUV(face.c, i).v + getUV(face.d, i).v;
+			avgUv.u = getUV( face.a, i ).u + getUV( face.b, i ).u + getUV( face.c, i ).u + getUV( face.d, i ).u;
+			avgUv.v = getUV( face.a, i ).v + getUV( face.b, i ).v + getUV( face.c, i ).v + getUV( face.d, i ).v;
 			avgUv.u /= 4;
 			avgUv.v /= 4;
 		}
@@ -409,8 +409,8 @@ THREE.SubdivisionModifier.prototype.smooth = function ( oldGeometry ) {
 			//debug('warning, ', i, 'edge has only 1 connecting face', edge);
 			
 			// For a sharp edge, average the edge end points.
-			avg.addSelf(originalPoints[edgeVertexA].position);
-			avg.addSelf(originalPoints[edgeVertexB].position);
+			avg.addSelf(originalPoints[edgeVertexA]);
+			avg.addSelf(originalPoints[edgeVertexB]);
 			
 			avg.multiplyScalar(0.5);
 			
@@ -421,8 +421,8 @@ THREE.SubdivisionModifier.prototype.smooth = function ( oldGeometry ) {
 			avg.addSelf(facePoints[faceIndexA]);
 			avg.addSelf(facePoints[faceIndexB]);
 		
-			avg.addSelf(originalPoints[edgeVertexA].position);
-			avg.addSelf(originalPoints[edgeVertexB].position);
+			avg.addSelf(originalPoints[edgeVertexA]);
+			avg.addSelf(originalPoints[edgeVertexB]);
 		
 			avg.multiplyScalar(0.25);
 		
@@ -430,7 +430,7 @@ THREE.SubdivisionModifier.prototype.smooth = function ( oldGeometry ) {
 		
 		edgePoints[i] = originalVerticesLength + originalFaces.length + edgeCount;
 		
-		newPoints.push( new THREE.Vertex(avg) );
+		newPoints.push( new THREE.Vertex().copy( avg ) );
 	
 		edgeCount ++;
 		
@@ -583,22 +583,22 @@ THREE.SubdivisionModifier.prototype.smooth = function ( oldGeometry ) {
 		
 		for (j=0; j<n;j++) {
 			edge = vertexEdgeMap[i][j];
-			var midPt = originalPoints[edge[0]].position.clone().addSelf(originalPoints[edge[1]].position).divideScalar(2);
+			var midPt = originalPoints[edge[0]].clone().addSelf(originalPoints[edge[1]]).divideScalar(2);
 			R.addSelf(midPt);
-			// R.addSelf(originalPoints[edge[0]].position);
-			// R.addSelf(originalPoints[edge[1]].position);
+			// R.addSelf(originalPoints[edge[0]]);
+			// R.addSelf(originalPoints[edge[1]]);
 		}
 		
 		R.divideScalar(n);
 		
-		newPos.addSelf(originalPoints[i].position);
+		newPos.addSelf(originalPoints[i]);
 		newPos.multiplyScalar(n - 3);
 		
 		newPos.addSelf(F);
 		newPos.addSelf(R.multiplyScalar(2));
 		newPos.divideScalar(n);
 		
-		newVertices[i].position = newPos;
+		newVertices[i] = newPos;
 		
 		
 	}

+ 1 - 1
src/objects/SkinnedMesh.js

@@ -177,7 +177,7 @@ THREE.SkinnedMesh.prototype.pose = function() {
 
 		for ( var i = 0; i < this.geometry.skinIndices.length; i ++ ) {
 
-			orgVertex = this.geometry.vertices[ i ].position;
+			orgVertex = this.geometry.vertices[ i ];
 
 			var indexA = this.geometry.skinIndices[ i ].x;
 			var indexB = this.geometry.skinIndices[ i ].y;

+ 19 - 19
src/renderers/WebGLRenderer.js

@@ -886,7 +886,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 			for ( v = 0; v < vl; v ++ ) {
 
-				vertex = vertices[ v ].position;
+				vertex = vertices[ v ];
 
 				_vector3.copy( vertex );
 				_projScreenMatrixPS.multiplyVector3( _vector3 );
@@ -899,7 +899,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 			for ( v = 0; v < vl; v ++ ) {
 
-				vertex = vertices[ sortArray[v][1] ].position;
+				vertex = vertices[ sortArray[v][1] ];
 
 				offset = v * 3;
 
@@ -1023,7 +1023,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 				for ( v = 0; v < vl; v ++ ) {
 
-					vertex = vertices[ v ].position;
+					vertex = vertices[ v ];
 
 					offset = v * 3;
 
@@ -1202,7 +1202,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 			for ( v = 0; v < vl; v ++ ) {
 
-				vertex = vertices[ v ].position;
+				vertex = vertices[ v ];
 
 				offset = v * 3;
 
@@ -1350,7 +1350,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 			for ( v = 0; v < vl; v ++ ) {
 
-				vertex = vertices[ v ].position;
+				vertex = vertices[ v ];
 
 				offset = v * 3;
 
@@ -1489,9 +1489,9 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 				face = obj_faces[ chunk_faces3[ f ] ];
 
-				v1 = vertices[ face.a ].position;
-				v2 = vertices[ face.b ].position;
-				v3 = vertices[ face.c ].position;
+				v1 = vertices[ face.a ];
+				v2 = vertices[ face.b ];
+				v3 = vertices[ face.c ];
 
 				vertexArray[ offset ]     = v1.x;
 				vertexArray[ offset + 1 ] = v1.y;
@@ -1513,10 +1513,10 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 				face = obj_faces[ chunk_faces4[ f ] ];
 
-				v1 = vertices[ face.a ].position;
-				v2 = vertices[ face.b ].position;
-				v3 = vertices[ face.c ].position;
-				v4 = vertices[ face.d ].position;
+				v1 = vertices[ face.a ];
+				v2 = vertices[ face.b ];
+				v3 = vertices[ face.c ];
+				v4 = vertices[ face.d ];
 
 				vertexArray[ offset ]     = v1.x;
 				vertexArray[ offset + 1 ] = v1.y;
@@ -1556,9 +1556,9 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 					// morph positions
 
-					v1 = morphTargets[ vk ].vertices[ face.a ].position;
-					v2 = morphTargets[ vk ].vertices[ face.b ].position;
-					v3 = morphTargets[ vk ].vertices[ face.c ].position;
+					v1 = morphTargets[ vk ].vertices[ face.a ];
+					v2 = morphTargets[ vk ].vertices[ face.b ];
+					v3 = morphTargets[ vk ].vertices[ face.c ];
 
 					vka = morphTargetsArrays[ vk ];
 
@@ -1623,10 +1623,10 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 					// morph positions
 
-					v1 = morphTargets[ vk ].vertices[ face.a ].position;
-					v2 = morphTargets[ vk ].vertices[ face.b ].position;
-					v3 = morphTargets[ vk ].vertices[ face.c ].position;
-					v4 = morphTargets[ vk ].vertices[ face.d ].position;
+					v1 = morphTargets[ vk ].vertices[ face.a ];
+					v2 = morphTargets[ vk ].vertices[ face.b ];
+					v3 = morphTargets[ vk ].vertices[ face.c ];
+					v4 = morphTargets[ vk ].vertices[ face.d ];
 
 					vka = morphTargetsArrays[ vk ];