Browse Source

added more generic geometry creation functions in canvas_geometry_subdivison.html

zz85 14 năm trước cách đây
mục cha
commit
b4332d6a24
100 tập tin đã thay đổi với 2096 bổ sung1166 xóa
  1. 460 457
      build/Three.js
  2. 9 9
      build/custom/ThreeCanvas.js
  3. 8 8
      build/custom/ThreeDOM.js
  4. 74 73
      build/custom/ThreeExtras.js
  5. 9 9
      build/custom/ThreeSVG.js
  6. 157 157
      build/custom/ThreeWebGL.js
  7. 1 0
      examples/canvas_camera_orthographic.html
  8. 0 1
      examples/canvas_geometry_cube.html
  9. 1 0
      examples/canvas_geometry_earth.html
  10. 1 0
      examples/canvas_geometry_hierarchy.html
  11. 1 0
      examples/canvas_geometry_panorama.html
  12. 1 0
      examples/canvas_geometry_panorama_fisheye.html
  13. 80 50
      examples/canvas_geometry_subdivison.html
  14. 1 0
      examples/canvas_geometry_terrain.html
  15. 0 1
      examples/canvas_geometry_text.html
  16. 1 0
      examples/canvas_interactive_cubes.html
  17. 1 0
      examples/canvas_interactive_cubes_tween.html
  18. 1 0
      examples/canvas_interactive_particles.html
  19. 2 1
      examples/canvas_interactive_voxelpainter.html
  20. 1 0
      examples/canvas_lines.html
  21. 1 0
      examples/canvas_lines_sphere.html
  22. 1 0
      examples/canvas_materials.html
  23. 2 12
      examples/canvas_materials_depth.html
  24. 1 0
      examples/canvas_materials_video.html
  25. 1 0
      examples/canvas_particles_floor.html
  26. 1 0
      examples/canvas_particles_random.html
  27. 1 4
      examples/canvas_particles_shapes.html
  28. 1 0
      examples/canvas_particles_sprites.html
  29. 1 0
      examples/canvas_particles_waves.html
  30. 1 0
      examples/canvas_performance.html
  31. 2 107
      examples/canvas_sandbox.html
  32. 1 2
      examples/misc_camera_path.html
  33. 1 1
      examples/misc_lights_test.html
  34. 1 0
      examples/misc_lookat.html
  35. 1 5
      examples/misc_materials_multimaterials.html
  36. 2 3
      examples/misc_ubiquity_test.html
  37. 0 1
      examples/models/animated/horse.js
  38. 8 7
      examples/obj/cubecolors/cube_fvc.js
  39. 5 4
      examples/obj/cubecolors/cubecolors.js
  40. 13 14
      examples/obj/female02/Female02_slim.js
  41. 1 2
      examples/obj/lucy/Lucy100k_slim.js
  42. 11 12
      examples/obj/male02/Male02_slim.js
  43. 2 3
      examples/obj/walt/WaltHead_slim.js
  44. 1 0
      examples/webgl_animation_skinning.html
  45. 1 0
      examples/webgl_collada.html
  46. 2 1
      examples/webgl_collisions_box.html
  47. 35 43
      examples/webgl_collisions_mesh.html
  48. 27 26
      examples/webgl_collisions_normal.html
  49. 1 4
      examples/webgl_collisions_primitives.html
  50. 2 0
      examples/webgl_collisions_reaction.html
  51. 2 0
      examples/webgl_collisions_terrain.html
  52. 1 0
      examples/webgl_collisions_trigger.html
  53. 1 0
      examples/webgl_geometries.html
  54. 1 0
      examples/webgl_geometry_blenderexport_colors.html
  55. 1 0
      examples/webgl_geometry_colors.html
  56. 1 0
      examples/webgl_geometry_hierarchy.html
  57. 1 0
      examples/webgl_geometry_hierarchy2.html
  58. 1 7
      examples/webgl_geometry_large_mesh.html
  59. 0 1
      examples/webgl_geometry_shapes.html
  60. 2 1
      examples/webgl_geometry_text.html
  61. 1 0
      examples/webgl_interactive_cubes.html
  62. 1 0
      examples/webgl_interactive_voxelpainter.html
  63. 1 12
      examples/webgl_lights_pointlights.html
  64. 1 0
      examples/webgl_lines_colors.html
  65. 1 0
      examples/webgl_lines_cubes.html
  66. 1 0
      examples/webgl_lines_sphere.html
  67. 1 0
      examples/webgl_lines_splines.html
  68. 1 0
      examples/webgl_lod.html
  69. 2 12
      examples/webgl_lod_text.html
  70. 1 0
      examples/webgl_materials.html
  71. 2 2
      examples/webgl_materials_cars.html
  72. 1 2
      examples/webgl_materials_cars_anaglyph.html
  73. 1 2
      examples/webgl_materials_cars_camaro.html
  74. 2 4
      examples/webgl_materials_cars_camaro_crosseyed.html
  75. 2 0
      examples/webgl_materials_cubemap.html
  76. 2 0
      examples/webgl_materials_cubemap_balls_reflection.html
  77. 1 0
      examples/webgl_materials_cubemap_balls_reflection_anaglyph.html
  78. 2 0
      examples/webgl_materials_cubemap_balls_refraction.html
  79. 1 0
      examples/webgl_materials_cubemap_balls_refraction_crosseyed.html
  80. 1020 0
      examples/webgl_materials_cubemap_dynamic.html
  81. 1 0
      examples/webgl_materials_cubemap_escher.html
  82. 2 0
      examples/webgl_materials_cubemap_refraction.html
  83. 1 0
      examples/webgl_materials_grass.html
  84. 1 1
      examples/webgl_materials_shaders.html
  85. 2 0
      examples/webgl_materials_shaders_fresnel.html
  86. 1 0
      examples/webgl_materials_texture_filters.html
  87. 2 13
      examples/webgl_materials_video.html
  88. 1 0
      examples/webgl_morphtargets.html
  89. 1 0
      examples/webgl_morphtargets_horse.html
  90. 1 0
      examples/webgl_multiple_canvases_complex.html
  91. 1 0
      examples/webgl_multiple_canvases_grid.html
  92. 1 1
      examples/webgl_objconvert_test.html
  93. 1 0
      examples/webgl_panorama_equirectangular.html
  94. 1 0
      examples/webgl_particles_billboards.html
  95. 1 0
      examples/webgl_particles_billboards_colors.html
  96. 80 89
      examples/webgl_particles_dynamic.html
  97. 1 0
      examples/webgl_particles_random.html
  98. 0 1
      examples/webgl_particles_shapes.html
  99. 1 0
      examples/webgl_particles_sprites.html
  100. 3 1
      examples/webgl_performance.html

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 460 - 457
build/Three.js


+ 9 - 9
build/custom/ThreeCanvas.js

@@ -47,13 +47,13 @@ e*j*n-g*l*n+g*f*o-c*j*o-e*f*k+c*l*k;b.n31=h*k*r-j*i*r+j*n*s-f*k*s-h*n*u+f*i*u;b.
 THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,d=a.n33*a.n22-a.n32*a.n23,e=-a.n33*a.n21+a.n31*a.n23,g=a.n32*a.n21-a.n31*a.n22,f=-a.n33*a.n12+a.n32*a.n13,h=a.n33*a.n11-a.n31*a.n13,l=-a.n32*a.n11+a.n31*a.n12,j=a.n23*a.n12-a.n22*a.n13,n=-a.n23*a.n11+a.n21*a.n13,i=a.n22*a.n11-a.n21*a.n12,a=a.n11*d+a.n21*f+a.n31*j;a==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");a=1/a;c[0]=a*d;c[1]=a*e;c[2]=a*g;c[3]=a*f;c[4]=a*h;c[5]=a*l;c[6]=a*j;c[7]=a*n;c[8]=a*i;return b};
 THREE.Matrix4.makeFrustum=function(a,b,c,d,e,g){var f;f=new THREE.Matrix4;f.n11=2*e/(b-a);f.n12=0;f.n13=(b+a)/(b-a);f.n14=0;f.n21=0;f.n22=2*e/(d-c);f.n23=(d+c)/(d-c);f.n24=0;f.n31=0;f.n32=0;f.n33=-(g+e)/(g-e);f.n34=-2*g*e/(g-e);f.n41=0;f.n42=0;f.n43=-1;f.n44=0;return f};THREE.Matrix4.makePerspective=function(a,b,c,d){var e,a=c*Math.tan(a*Math.PI/360);e=-a;return THREE.Matrix4.makeFrustum(e*b,a*b,e,a,c,d)};
 THREE.Matrix4.makeOrtho=function(a,b,c,d,e,g){var f,h,l,j;f=new THREE.Matrix4;h=b-a;l=c-d;j=g-e;f.n11=2/h;f.n12=0;f.n13=0;f.n14=-((b+a)/h);f.n21=0;f.n22=2/l;f.n23=0;f.n24=-((c+d)/l);f.n31=0;f.n32=0;f.n33=-2/j;f.n34=-((g+e)/j);f.n41=0;f.n42=0;f.n43=0;f.n44=1;return f};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
-THREE.Object3D=function(){this.id=THREE.Object3DCount++;this.name="";this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder="XYZ";this.scale=new THREE.Vector3(1,1,1);this.flipSided=this.doubleSided=this.dynamic=!1;this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=
+THREE.Object3D=function(){this.name="";this.id=THREE.Object3DCount++;this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder="XYZ";this.scale=new THREE.Vector3(1,1,1);this.flipSided=this.doubleSided=this.dynamic=!1;this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=
 !0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=!0;this.receiveShadow=this.castShadow=!1;this.frustumCulled=!0;this._vector=new THREE.Vector3};
-THREE.Object3D.prototype={constructor:THREE.Object3D,translate:function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a))},translateX:function(a){this.translate(a,this._vector.set(1,0,0))},translateY:function(a){this.translate(a,this._vector.set(0,1,0))},translateZ:function(a){this.translate(a,this._vector.set(0,0,1))},lookAt:function(a){this.matrix.lookAt(a,this.position,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},add:function(a){if(this.children.indexOf(a)===
--1){a.parent!==void 0&&a.parent.removeChild(a);a.parent=this;this.children.push(a);for(var b=this;b.parent!==void 0;)b=b.parent;b!==void 0&&b instanceof THREE.Scene&&b.addChildRecurse(a)}},remove:function(a){var b=this,c=this.children.indexOf(a);if(c!==-1){a.parent=void 0;for(this.children.splice(c,1);b.parent!==void 0;)b=b.parent;b!==void 0&&b instanceof THREE.Scene&&b.removeChildRecurse(a)}},getChildByName:function(a,b){var c,d,e;c=0;for(d=this.children.length;c<d;c++){e=this.children[c];if(e.name===
-a)return e;if(b&&(e=e.getChildByName(a,b),e!==void 0))return e}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z));this.matrixWorldNeedsUpdate=!0},update:function(a,b,c){this.matrixAutoUpdate&&
-this.updateMatrix();if(this.matrixWorldNeedsUpdate||b)a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale),this.matrixWorldNeedsUpdate=!1,b=!0;for(var a=0,d=this.children.length;a<d;a++)this.children[a].update(this.matrixWorld,b,c)},addChild:function(a){console.warn("DEPRECATED: Object3D.addChild() is now Object3D.add().");this.add(a)},removeChild:function(a){console.warn("DEPRECATED: Object3D.removeChild() is now Object3D.remove().");
-this.remove(a)}};THREE.Object3DCount=0;
+THREE.Object3D.prototype={constructor:THREE.Object3D,translate:function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a))},translateX:function(a){this.translate(a,this._vector.set(1,0,0))},translateY:function(a){this.translate(a,this._vector.set(0,1,0))},translateZ:function(a){this.translate(a,this._vector.set(0,0,1))},lookAt:function(a){this instanceof THREE.Camera?this.matrix.lookAt(this.position,a,this.up):this.matrix.lookAt(a,this.position,this.up);this.rotationAutoUpdate&&
+this.rotation.setRotationFromMatrix(this.matrix)},add:function(a){if(this.children.indexOf(a)===-1){a.parent!==void 0&&a.parent.removeChild(a);a.parent=this;this.children.push(a);for(var b=this;b.parent!==void 0;)b=b.parent;b!==void 0&&b instanceof THREE.Scene&&b.addChildRecurse(a)}},remove:function(a){var b=this,c=this.children.indexOf(a);if(c!==-1){a.parent=void 0;for(this.children.splice(c,1);b.parent!==void 0;)b=b.parent;b!==void 0&&b instanceof THREE.Scene&&b.removeChildRecurse(a)}},getChildByName:function(a,
+b){var c,d,e;c=0;for(d=this.children.length;c<d;c++){e=this.children[c];if(e.name===a)return e;if(b&&(e=e.getChildByName(a,b),e!==void 0))return e}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,
+this.scale.z));this.matrixWorldNeedsUpdate=!0},update:function(a,b,c){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||b)a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale),this.matrixWorldNeedsUpdate=!1,b=!0;for(var a=0,d=this.children.length;a<d;a++)this.children[a].update(this.matrixWorld,b,c)},addChild:function(a){console.warn("DEPRECATED: Object3D.addChild() is now Object3D.add().");
+this.add(a)},removeChild:function(a){console.warn("DEPRECATED: Object3D.removeChild() is now Object3D.remove().");this.remove(a)}};THREE.Object3DCount=0;
 THREE.Projector=function(){function a(){var a=l[h]=l[h]||new THREE.RenderableVertex;h++;return a}function b(a,b){return b.z-a.z}function c(a,b){var c=0,d=1,e=a.z+a.w,f=b.z+b.w,g=-a.z+a.w,h=-b.z+b.w;return e>=0&&f>=0&&g>=0&&h>=0?!0:e<0&&f<0||g<0&&h<0?!1:(e<0?c=Math.max(c,e/(e-f)):f<0&&(d=Math.min(d,e/(e-f))),g<0?c=Math.max(c,g/(g-h)):h<0&&(d=Math.min(d,g/(g-h))),d<c?!1:(a.lerpSelf(b,c),b.lerpSelf(a,1-d),!0))}var d,e,g=[],f,h,l=[],j,n,i=[],o,k=[],r,s,w=[],u,M,R=[],B=[],N=[],O=new THREE.Vector4,t=new THREE.Vector4,
 m=new THREE.Matrix4,C=new THREE.Matrix4,D=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],T=new THREE.Vector4,U=new THREE.Vector4;this.projectVector=function(a,b){m.multiply(b.projectionMatrix,b.matrixWorldInverse);m.multiplyVector3(a);return a};this.unprojectVector=function(a,b){m.multiply(b.matrixWorld,THREE.Matrix4.makeInvert(b.projectionMatrix));m.multiplyVector3(a);return a};this.projectObjects=function(a,c,f){var h,k;e=B.length=0;
 h=a.objects;a=0;for(c=h.length;a<c;a++){k=h[a];var j;if(!(j=!k.visible))if(j=k instanceof THREE.Mesh)if(j=k.frustumCulled){a:{j=void 0;for(var i=k.matrixWorld,l=-k.geometry.boundingSphere.radius*Math.max(k.scale.x,Math.max(k.scale.y,k.scale.z)),n=0;n<6;n++)if(j=D[n].x*i.n14+D[n].y*i.n24+D[n].z*i.n34+D[n].w,j<=l){j=!1;break a}j=!0}j=!j}if(!j)j=g[e]=g[e]||new THREE.RenderableObject,e++,d=j,O.copy(k.position),m.multiplyVector3(O),d.object=k,d.z=O.z,B.push(d)}f&&B.sort(b);return B};this.projectScene=
@@ -65,7 +65,7 @@ j.v2.copy(L),j.v3.copy(H);else continue;else if(E instanceof THREE.Face4)if(y=l[
 W[H]}j.meshMaterials=O;j.faceMaterials=E.materials;j.overdraw=ea;j.z=j.centroidScreen.z;N.push(j)}}else if(q instanceof THREE.Line){C.multiply(m,v);B=q.geometry.vertices;y=a();y.positionScreen.copy(B[0].position);C.multiplyVector4(y.positionScreen);V=1;for(E=B.length;V<E;V++)if(y=a(),y.positionScreen.copy(B[V].position),C.multiplyVector4(y.positionScreen),L=l[h-2],T.copy(y.positionScreen),U.copy(L.positionScreen),c(T,U))T.multiplyScalar(1/T.w),U.multiplyScalar(1/U.w),v=w[s]=w[s]||new THREE.RenderableLine,
 s++,r=v,r.v1.positionScreen.copy(T),r.v2.positionScreen.copy(U),r.z=Math.max(T.z,U.z),r.materials=q.materials,N.push(r)}else if(q instanceof THREE.Particle&&(t.set(q.matrixWorld.n14,q.matrixWorld.n24,q.matrixWorld.n34,1),m.multiplyVector4(t),t.z/=t.w,t.z>0&&t.z<1))v=R[M]=R[M]||new THREE.RenderableParticle,M++,u=v,u.x=t.x/t.w,u.y=t.y/t.w,u.z=t.z,u.rotation=q.rotation.z,u.scale.x=q.scale.x*Math.abs(u.x-(t.x+e.projectionMatrix.n11)/(t.w+e.projectionMatrix.n14)),u.scale.y=q.scale.y*Math.abs(u.y-(t.y+
 e.projectionMatrix.n22)/(t.w+e.projectionMatrix.n24)),u.materials=q.materials,N.push(u);g&&N.sort(b);return N}};THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,d!==void 0?d:1)};
-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=0.5*Math.PI/360,c=a.x*b,d=a.y*b,e=a.z*b,a=Math.cos(d),d=Math.sin(d),b=Math.cos(-e),e=Math.sin(-e),g=Math.cos(c),c=Math.sin(c),f=a*b,h=d*e;this.w=f*g-h*c;this.x=f*c+h*g;this.y=d*b*g+a*e*c;this.z=a*e*g-d*b*c;return this},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);
+THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this},setFromEuler:function(a){var b=Math.PI/360,c=a.x*b,d=a.y*b,e=a.z*b,a=Math.cos(d),d=Math.sin(d),b=Math.cos(-e),e=Math.sin(-e),g=Math.cos(c),c=Math.sin(c),f=a*b,h=d*e;this.w=f*g-h*c;this.x=f*c+h*g;this.y=d*b*g+a*e*c;this.z=a*e*g-d*b*c;return this},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);
 this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRotationMatrix:function(a){var b=Math.pow(a.determinant(),1/3);this.w=Math.sqrt(Math.max(0,b+a.n11+a.n22+a.n33))/2;this.x=Math.sqrt(Math.max(0,b+a.n11-a.n22-a.n33))/2;this.y=Math.sqrt(Math.max(0,b-a.n11+a.n22-a.n33))/2;this.z=Math.sqrt(Math.max(0,b-a.n11-a.n22+a.n33))/2;this.x=a.n32-a.n23<0?-Math.abs(this.x):Math.abs(this.x);this.y=a.n13-a.n31<0?-Math.abs(this.y):Math.abs(this.y);this.z=a.n21-a.n12<0?-Math.abs(this.z):Math.abs(this.z);
 this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);a==0?this.w=this.z=this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},multiplySelf:function(a){var b=
 this.x,c=this.y,d=this.z,e=this.w,g=a.x,f=a.y,h=a.z,a=a.w;this.x=b*a+e*g+c*h-d*f;this.y=c*a+e*f+d*g-b*h;this.z=d*a+e*h+b*f-c*g;this.w=e*a-b*g-c*f-d*h;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,g=this.x,f=this.y,h=this.z,l=this.w,j=l*c+f*e-h*d,n=l*d+h*c-g*e,i=l*e+g*d-f*c,c=-g*
@@ -85,7 +85,7 @@ D[c].addSelf(U);D[d].addSelf(U)}var b,c,d,e,g,f,h,l,j,n,i,o,k,r,s,w,u,M,R,B,N,O,
 this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var b=1,c=this.vertices.length;b<c;b++){a=this.vertices[b];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=
 a.position.z;else if(a.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=0,b=0,c=this.vertices.length;b<c;b++)a=Math.max(a,this.vertices[b].position.length());this.boundingSphere={radius:a}},computeEdgeFaces:function(){function a(a,b){return Math.min(a,b)+"_"+Math.max(a,b)}function b(a,b,c){a[b]===void 0?(a[b]={set:{},array:[]},a[b].set[c]=1,a[b].array.push(c)):a[b].set[c]===void 0&&(a[b].set[c]=1,a[b].array.push(c))}var c,d,e,g,f,h=
 {};c=0;for(d=this.faces.length;c<d;c++)f=this.faces[c],f instanceof THREE.Face3?(e=a(f.a,f.b),b(h,e,c),e=a(f.b,f.c),b(h,e,c),e=a(f.a,f.c),b(h,e,c)):f instanceof THREE.Face4&&(e=a(f.b,f.d),b(h,e,c),e=a(f.a,f.b),b(h,e,c),e=a(f.a,f.d),b(h,e,c),e=a(f.b,f.c),b(h,e,c),e=a(f.c,f.d),b(h,e,c));c=0;for(d=this.edges.length;c<d;c++){f=this.edges[c];e=f.vertexIndices[0];g=f.vertexIndices[1];f.faceIndices=h[a(e,g)].array;for(e=0;e<f.faceIndices.length;e++)g=f.faceIndices[e],f.faces.push(this.faces[g])}}};
-THREE.GeometryCount=0;THREE.Camera=function(a,b,c,d,e){THREE.Object3D.call(this);this.fov=a||50;this.aspect=b||1;this.near=c!==void 0?c:0.1;this.far=d!==void 0?d:2E3;this.target=e||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;
+THREE.GeometryCount=0;THREE.Camera=function(a,b,c,d,e){THREE.Object3D.call(this);this.fov=a||50;this.aspect=b||1;this.near=c!==void 0?c:0.1;this.far=d!==void 0?d:2E3;this.target=e||new THREE.Object3D;this.useTarget=!1;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;
 THREE.Camera.prototype.translate=function(a,b){this.matrix.rotateAxis(b);b.multiplyScalar(a);this.position.addSelf(b);this.target.position.addSelf(b)};
 THREE.Camera.prototype.updateProjectionMatrix=function(){if(this.fullWidth){var a=this.fullWidth/this.fullHeight,b=Math.tan(this.fov*Math.PI/360)*this.near,c=-b,d=a*c,a=Math.abs(a*b-d),c=Math.abs(b-c);this.projectionMatrix=THREE.Matrix4.makeFrustum(d+this.x*a/this.fullWidth,d+(this.x+this.width)*a/this.fullWidth,b-(this.y+this.height)*c/this.fullHeight,b-this.y*c/this.fullHeight,this.near,this.far)}else this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};
 THREE.Camera.prototype.setViewOffset=function(a,b,c,d,e,g){this.fullWidth=a;this.fullHeight=b;this.x=c;this.y=d;this.width=e;this.height=g;this.updateProjectionMatrix()};
@@ -94,7 +94,7 @@ THREE.Camera.prototype.update=function(a,b,c){if(this.useTarget)this.matrix.look
 THREE.OrthoCamera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makeOrtho(this.left,this.right,this.top,this.bottom,this.near,this.far)};THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;
 THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;THREE.DirectionalLight=function(a,b,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=b!==void 0?b:1;this.distance=c!==void 0?c:0};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,b,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,0,0);this.intensity=b!==void 0?b:1;this.distance=c!==void 0?c:0};
 THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight;
-THREE.Material=function(a){this.id=THREE.MaterialCount++;a=a||{};this.opacity=a.opacity!==void 0?a.opacity:1;this.transparent=a.transparent!==void 0?a.transparent:!1;this.blending=a.blending!==void 0?a.blending:THREE.NormalBlending;this.depthTest=a.depthTest!==void 0?a.depthTest:!0;this.depthWrite=a.depthWrite!==void 0?a.depthWrite:!0;this.polygonOffset=a.polygonOffset!==void 0?a.polygonOffset:!1;this.polygonOffsetFactor=a.polygonOffsetFactor!==void 0?a.polygonOffsetFactor:0;this.polygonOffsetUnits=
+THREE.Material=function(a){this.name="";this.id=THREE.MaterialCount++;a=a||{};this.opacity=a.opacity!==void 0?a.opacity:1;this.transparent=a.transparent!==void 0?a.transparent:!1;this.blending=a.blending!==void 0?a.blending:THREE.NormalBlending;this.depthTest=a.depthTest!==void 0?a.depthTest:!0;this.depthWrite=a.depthWrite!==void 0?a.depthWrite:!0;this.polygonOffset=a.polygonOffset!==void 0?a.polygonOffset:!1;this.polygonOffsetFactor=a.polygonOffsetFactor!==void 0?a.polygonOffsetFactor:0;this.polygonOffsetUnits=
 a.polygonOffsetUnits!==void 0?a.polygonOffsetUnits:0;this.alphaTest=a.alphaTest!==void 0?a.alphaTest:0};THREE.MaterialCount=0;THREE.NoShading=0;THREE.FlatShading=1;THREE.SmoothShading=2;THREE.NoColors=0;THREE.FaceColors=1;THREE.VertexColors=2;THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;THREE.MultiplyBlending=3;THREE.AdditiveAlphaBlending=4;
 THREE.LineBasicMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=a.color!==void 0?new THREE.Color(a.color):new THREE.Color(16777215);this.linewidth=a.linewidth!==void 0?a.linewidth:1;this.linecap=a.linecap!==void 0?a.linecap:"round";this.linejoin=a.linejoin!==void 0?a.linejoin:"round";this.vertexColors=a.vertexColors?a.vertexColors:!1;this.fog=a.fog!==void 0?a.fog:!0};THREE.LineBasicMaterial.prototype=new THREE.Material;THREE.LineBasicMaterial.prototype.constructor=THREE.LineBasicMaterial;
 THREE.MeshBasicMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=a.color!==void 0?new THREE.Color(a.color):new THREE.Color(16777215);this.map=a.map!==void 0?a.map:null;this.lightMap=a.lightMap!==void 0?a.lightMap:null;this.envMap=a.envMap!==void 0?a.envMap:null;this.combine=a.combine!==void 0?a.combine:THREE.MultiplyOperation;this.reflectivity=a.reflectivity!==void 0?a.reflectivity:1;this.refractionRatio=a.refractionRatio!==void 0?a.refractionRatio:0.98;this.fog=a.fog!==void 0?a.fog:

+ 8 - 8
build/custom/ThreeDOM.js

@@ -47,13 +47,13 @@ e*i*k-g*j*k+g*f*m-c*i*m-e*f*n+c*j*n;b.n31=h*n*p-i*l*p+i*k*q-f*n*q-h*k*r+f*l*r;b.
 THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,d=a.n33*a.n22-a.n32*a.n23,e=-a.n33*a.n21+a.n31*a.n23,g=a.n32*a.n21-a.n31*a.n22,f=-a.n33*a.n12+a.n32*a.n13,h=a.n33*a.n11-a.n31*a.n13,j=-a.n32*a.n11+a.n31*a.n12,i=a.n23*a.n12-a.n22*a.n13,k=-a.n23*a.n11+a.n21*a.n13,l=a.n22*a.n11-a.n21*a.n12,a=a.n11*d+a.n21*f+a.n31*i;a==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");a=1/a;c[0]=a*d;c[1]=a*e;c[2]=a*g;c[3]=a*f;c[4]=a*h;c[5]=a*j;c[6]=a*i;c[7]=a*k;c[8]=a*l;return b};
 THREE.Matrix4.makeFrustum=function(a,b,c,d,e,g){var f;f=new THREE.Matrix4;f.n11=2*e/(b-a);f.n12=0;f.n13=(b+a)/(b-a);f.n14=0;f.n21=0;f.n22=2*e/(d-c);f.n23=(d+c)/(d-c);f.n24=0;f.n31=0;f.n32=0;f.n33=-(g+e)/(g-e);f.n34=-2*g*e/(g-e);f.n41=0;f.n42=0;f.n43=-1;f.n44=0;return f};THREE.Matrix4.makePerspective=function(a,b,c,d){var e,a=c*Math.tan(a*Math.PI/360);e=-a;return THREE.Matrix4.makeFrustum(e*b,a*b,e,a,c,d)};
 THREE.Matrix4.makeOrtho=function(a,b,c,d,e,g){var f,h,j,i;f=new THREE.Matrix4;h=b-a;j=c-d;i=g-e;f.n11=2/h;f.n12=0;f.n13=0;f.n14=-((b+a)/h);f.n21=0;f.n22=2/j;f.n23=0;f.n24=-((c+d)/j);f.n31=0;f.n32=0;f.n33=-2/i;f.n34=-((g+e)/i);f.n41=0;f.n42=0;f.n43=0;f.n44=1;return f};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
-THREE.Object3D=function(){this.id=THREE.Object3DCount++;this.name="";this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder="XYZ";this.scale=new THREE.Vector3(1,1,1);this.flipSided=this.doubleSided=this.dynamic=!1;this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=
+THREE.Object3D=function(){this.name="";this.id=THREE.Object3DCount++;this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder="XYZ";this.scale=new THREE.Vector3(1,1,1);this.flipSided=this.doubleSided=this.dynamic=!1;this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=
 !0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=!0;this.receiveShadow=this.castShadow=!1;this.frustumCulled=!0;this._vector=new THREE.Vector3};
-THREE.Object3D.prototype={constructor:THREE.Object3D,translate:function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a))},translateX:function(a){this.translate(a,this._vector.set(1,0,0))},translateY:function(a){this.translate(a,this._vector.set(0,1,0))},translateZ:function(a){this.translate(a,this._vector.set(0,0,1))},lookAt:function(a){this.matrix.lookAt(a,this.position,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},add:function(a){if(this.children.indexOf(a)===
--1){a.parent!==void 0&&a.parent.removeChild(a);a.parent=this;this.children.push(a);for(var b=this;b.parent!==void 0;)b=b.parent;b!==void 0&&b instanceof THREE.Scene&&b.addChildRecurse(a)}},remove:function(a){var b=this,c=this.children.indexOf(a);if(c!==-1){a.parent=void 0;for(this.children.splice(c,1);b.parent!==void 0;)b=b.parent;b!==void 0&&b instanceof THREE.Scene&&b.removeChildRecurse(a)}},getChildByName:function(a,b){var c,d,e;c=0;for(d=this.children.length;c<d;c++){e=this.children[c];if(e.name===
-a)return e;if(b&&(e=e.getChildByName(a,b),e!==void 0))return e}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z));this.matrixWorldNeedsUpdate=!0},update:function(a,b,c){this.matrixAutoUpdate&&
-this.updateMatrix();if(this.matrixWorldNeedsUpdate||b)a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale),this.matrixWorldNeedsUpdate=!1,b=!0;for(var a=0,d=this.children.length;a<d;a++)this.children[a].update(this.matrixWorld,b,c)},addChild:function(a){console.warn("DEPRECATED: Object3D.addChild() is now Object3D.add().");this.add(a)},removeChild:function(a){console.warn("DEPRECATED: Object3D.removeChild() is now Object3D.remove().");
-this.remove(a)}};THREE.Object3DCount=0;
+THREE.Object3D.prototype={constructor:THREE.Object3D,translate:function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a))},translateX:function(a){this.translate(a,this._vector.set(1,0,0))},translateY:function(a){this.translate(a,this._vector.set(0,1,0))},translateZ:function(a){this.translate(a,this._vector.set(0,0,1))},lookAt:function(a){this instanceof THREE.Camera?this.matrix.lookAt(this.position,a,this.up):this.matrix.lookAt(a,this.position,this.up);this.rotationAutoUpdate&&
+this.rotation.setRotationFromMatrix(this.matrix)},add:function(a){if(this.children.indexOf(a)===-1){a.parent!==void 0&&a.parent.removeChild(a);a.parent=this;this.children.push(a);for(var b=this;b.parent!==void 0;)b=b.parent;b!==void 0&&b instanceof THREE.Scene&&b.addChildRecurse(a)}},remove:function(a){var b=this,c=this.children.indexOf(a);if(c!==-1){a.parent=void 0;for(this.children.splice(c,1);b.parent!==void 0;)b=b.parent;b!==void 0&&b instanceof THREE.Scene&&b.removeChildRecurse(a)}},getChildByName:function(a,
+b){var c,d,e;c=0;for(d=this.children.length;c<d;c++){e=this.children[c];if(e.name===a)return e;if(b&&(e=e.getChildByName(a,b),e!==void 0))return e}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,
+this.scale.z));this.matrixWorldNeedsUpdate=!0},update:function(a,b,c){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||b)a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale),this.matrixWorldNeedsUpdate=!1,b=!0;for(var a=0,d=this.children.length;a<d;a++)this.children[a].update(this.matrixWorld,b,c)},addChild:function(a){console.warn("DEPRECATED: Object3D.addChild() is now Object3D.add().");
+this.add(a)},removeChild:function(a){console.warn("DEPRECATED: Object3D.removeChild() is now Object3D.remove().");this.remove(a)}};THREE.Object3DCount=0;
 THREE.Projector=function(){function a(){var a=j[h]=j[h]||new THREE.RenderableVertex;h++;return a}function b(a,b){return b.z-a.z}function c(a,b){var c=0,d=1,f=a.z+a.w,e=b.z+b.w,g=-a.z+a.w,h=-b.z+b.w;return f>=0&&e>=0&&g>=0&&h>=0?!0:f<0&&e<0||g<0&&h<0?!1:(f<0?c=Math.max(c,f/(f-e)):e<0&&(d=Math.min(d,f/(f-e))),g<0?c=Math.max(c,g/(g-h)):h<0&&(d=Math.min(d,g/(g-h))),d<c?!1:(a.lerpSelf(b,c),b.lerpSelf(a,1-d),!0))}var d,e,g=[],f,h,j=[],i,k,l=[],m,n=[],p,q,s=[],r,J,M=[],C=[],D=[],H=new THREE.Vector4,v=new THREE.Vector4,
 o=new THREE.Matrix4,K=new THREE.Matrix4,z=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],E=new THREE.Vector4,F=new THREE.Vector4;this.projectVector=function(a,b){o.multiply(b.projectionMatrix,b.matrixWorldInverse);o.multiplyVector3(a);return a};this.unprojectVector=function(a,b){o.multiply(b.matrixWorld,THREE.Matrix4.makeInvert(b.projectionMatrix));o.multiplyVector3(a);return a};this.projectObjects=function(a,c,f){var h,i;e=C.length=0;
 h=a.objects;a=0;for(c=h.length;a<c;a++){i=h[a];var j;if(!(j=!i.visible))if(j=i instanceof THREE.Mesh)if(j=i.frustumCulled){a:{j=void 0;for(var k=i.matrixWorld,l=-i.geometry.boundingSphere.radius*Math.max(i.scale.x,Math.max(i.scale.y,i.scale.z)),m=0;m<6;m++)if(j=z[m].x*k.n14+z[m].y*k.n24+z[m].z*k.n34+z[m].w,j<=l){j=!1;break a}j=!0}j=!j}if(!j)j=g[e]=g[e]||new THREE.RenderableObject,e++,d=j,H.copy(i.position),o.multiplyVector3(H),d.object=i,d.z=H.z,C.push(d)}f&&C.sort(b);return C};this.projectScene=
@@ -65,14 +65,14 @@ i.v2.copy(y),i.v3.copy(w);else continue;else if(x instanceof THREE.Face4)if(t=j[
 P[w]}i.meshMaterials=X;i.faceMaterials=x.materials;i.overdraw=Y;i.z=i.centroidScreen.z;D.push(i)}}else if(u instanceof THREE.Line){K.multiply(o,L);B=u.geometry.vertices;t=a();t.positionScreen.copy(B[0].position);K.multiplyVector4(t.positionScreen);I=1;for(x=B.length;I<x;I++)if(t=a(),t.positionScreen.copy(B[I].position),K.multiplyVector4(t.positionScreen),y=j[h-2],E.copy(t.positionScreen),F.copy(y.positionScreen),c(E,F))E.multiplyScalar(1/E.w),F.multiplyScalar(1/F.w),L=s[q]=s[q]||new THREE.RenderableLine,
 q++,p=L,p.v1.positionScreen.copy(E),p.v2.positionScreen.copy(F),p.z=Math.max(E.z,F.z),p.materials=u.materials,D.push(p)}else if(u instanceof THREE.Particle&&(v.set(u.matrixWorld.n14,u.matrixWorld.n24,u.matrixWorld.n34,1),o.multiplyVector4(v),v.z/=v.w,v.z>0&&v.z<1))L=M[J]=M[J]||new THREE.RenderableParticle,J++,r=L,r.x=v.x/v.w,r.y=v.y/v.w,r.z=v.z,r.rotation=u.rotation.z,r.scale.x=u.scale.x*Math.abs(r.x-(v.x+e.projectionMatrix.n11)/(v.w+e.projectionMatrix.n14)),r.scale.y=u.scale.y*Math.abs(r.y-(v.y+
 e.projectionMatrix.n22)/(v.w+e.projectionMatrix.n24)),r.materials=u.materials,D.push(r);g&&D.sort(b);return D}};THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,d!==void 0?d:1)};
-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=0.5*Math.PI/360,c=a.x*b,d=a.y*b,e=a.z*b,a=Math.cos(d),d=Math.sin(d),b=Math.cos(-e),e=Math.sin(-e),g=Math.cos(c),c=Math.sin(c),f=a*b,h=d*e;this.w=f*g-h*c;this.x=f*c+h*g;this.y=d*b*g+a*e*c;this.z=a*e*g-d*b*c;return this},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);
+THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this},setFromEuler:function(a){var b=Math.PI/360,c=a.x*b,d=a.y*b,e=a.z*b,a=Math.cos(d),d=Math.sin(d),b=Math.cos(-e),e=Math.sin(-e),g=Math.cos(c),c=Math.sin(c),f=a*b,h=d*e;this.w=f*g-h*c;this.x=f*c+h*g;this.y=d*b*g+a*e*c;this.z=a*e*g-d*b*c;return this},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);
 this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRotationMatrix:function(a){var b=Math.pow(a.determinant(),1/3);this.w=Math.sqrt(Math.max(0,b+a.n11+a.n22+a.n33))/2;this.x=Math.sqrt(Math.max(0,b+a.n11-a.n22-a.n33))/2;this.y=Math.sqrt(Math.max(0,b-a.n11+a.n22-a.n33))/2;this.z=Math.sqrt(Math.max(0,b-a.n11-a.n22+a.n33))/2;this.x=a.n32-a.n23<0?-Math.abs(this.x):Math.abs(this.x);this.y=a.n13-a.n31<0?-Math.abs(this.y):Math.abs(this.y);this.z=a.n21-a.n12<0?-Math.abs(this.z):Math.abs(this.z);
 this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);a==0?this.w=this.z=this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},multiplySelf:function(a){var b=
 this.x,c=this.y,d=this.z,e=this.w,g=a.x,f=a.y,h=a.z,a=a.w;this.x=b*a+e*g+c*h-d*f;this.y=c*a+e*f+d*g-b*h;this.z=d*a+e*h+b*f-c*g;this.w=e*a-b*g-c*f-d*h;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,g=this.x,f=this.y,h=this.z,j=this.w,i=j*c+f*e-h*d,k=j*d+h*c-g*e,l=j*e+g*d-f*c,c=-g*
 c-f*d-h*e;b.x=i*j+c*-g+k*-h-l*-f;b.y=k*j+c*-f+l*-g-i*-h;b.z=l*j+c*-h+i*-f-k*-g;return b}};THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(e)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var g=Math.acos(e),f=Math.sqrt(1-e*e);if(Math.abs(f)<0.0010)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;e=Math.sin((1-d)*g)/f;d=Math.sin(d*g)/f;c.w=a.w*e+b.w*d;c.x=a.x*e+b.x*d;c.y=a.y*e+b.y*d;c.z=a.z*e+b.z*d;return c};
 THREE.Vertex=function(a){this.position=a||new THREE.Vector3};THREE.Face3=function(a,b,c,d,e,g){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materials=g instanceof Array?g:[g];this.centroid=new THREE.Vector3};
 THREE.Face4=function(a,b,c,d,e,g,f){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materials=f instanceof Array?f:[f];this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.u=a||0;this.v=b||0};
-THREE.UV.prototype={constructor:THREE.UV,set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.u=a.u;this.v=a.v;return this},clone:function(){return new THREE.UV(this.u,this.v)}};THREE.Camera=function(a,b,c,d,e){THREE.Object3D.call(this);this.fov=a||50;this.aspect=b||1;this.near=c!==void 0?c:0.1;this.far=d!==void 0?d:2E3;this.target=e||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};
+THREE.UV.prototype={constructor:THREE.UV,set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.u=a.u;this.v=a.v;return this},clone:function(){return new THREE.UV(this.u,this.v)}};THREE.Camera=function(a,b,c,d,e){THREE.Object3D.call(this);this.fov=a||50;this.aspect=b||1;this.near=c!==void 0?c:0.1;this.far=d!==void 0?d:2E3;this.target=e||new THREE.Object3D;this.useTarget=!1;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};
 THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;THREE.Camera.prototype.translate=function(a,b){this.matrix.rotateAxis(b);b.multiplyScalar(a);this.position.addSelf(b);this.target.position.addSelf(b)};
 THREE.Camera.prototype.updateProjectionMatrix=function(){if(this.fullWidth){var a=this.fullWidth/this.fullHeight,b=Math.tan(this.fov*Math.PI/360)*this.near,c=-b,d=a*c,a=Math.abs(a*b-d),c=Math.abs(b-c);this.projectionMatrix=THREE.Matrix4.makeFrustum(d+this.x*a/this.fullWidth,d+(this.x+this.width)*a/this.fullWidth,b-(this.y+this.height)*c/this.fullHeight,b-this.y*c/this.fullHeight,this.near,this.far)}else this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};
 THREE.Camera.prototype.setViewOffset=function(a,b,c,d,e,g){this.fullWidth=a;this.fullHeight=b;this.x=c;this.y=d;this.width=e;this.height=g;this.updateProjectionMatrix()};

+ 74 - 73
build/custom/ThreeExtras.js

@@ -81,27 +81,28 @@ this.getPrevKeyWith("pos",p,f.index-1).pos,this.points[1]=g,this.points[2]=h,thi
 THREE.Animation.prototype.interpolateCatmullRom=function(a,b){var c=[],e=[],g,h,f,k,l,m;g=(a.length-1)*b;h=Math.floor(g);g-=h;c[0]=h==0?h:h-1;c[1]=h;c[2]=h>a.length-2?h:h+1;c[3]=h>a.length-3?h:h+2;h=a[c[0]];k=a[c[1]];l=a[c[2]];m=a[c[3]];c=g*g;f=g*c;e[0]=this.interpolate(h[0],k[0],l[0],m[0],g,c,f);e[1]=this.interpolate(h[1],k[1],l[1],m[1],g,c,f);e[2]=this.interpolate(h[2],k[2],l[2],m[2],g,c,f);return e};
 THREE.Animation.prototype.interpolate=function(a,b,c,e,g,h,f){a=(c-a)*0.5;e=(e-b)*0.5;return(2*(b-c)+a+e)*f+(-3*(b-c)-2*a-e)*h+a*g+b};THREE.Animation.prototype.getNextKeyWith=function(a,b,c){var e=this.data.hierarchy[b].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c=c<e.length-1?c:e.length-1:c%=e.length;c<e.length;c++)if(e[c][a]!==void 0)return e[c];return this.data.hierarchy[b].keys[0]};
 THREE.Animation.prototype.getPrevKeyWith=function(a,b,c){for(var e=this.data.hierarchy[b].keys,c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c>0?c:0:c>=0?c:c+e.length;c>=0;c--)if(e[c][a]!==void 0)return e[c];return this.data.hierarchy[b].keys[e.length-1]};
-THREE.CubeCamera=function(a,b,c,e){this.cameraPX=new THREE.Camera(90,1,a,b);this.cameraNX=new THREE.Camera(90,1,a,b);this.cameraPY=new THREE.Camera(90,1,a,b);this.cameraNY=new THREE.Camera(90,1,a,b);this.cameraPZ=new THREE.Camera(90,1,a,b);this.cameraNZ=new THREE.Camera(90,1,a,b);this.height=c;this.position=new THREE.Vector3(0,c,0);this.cameraPX.position=this.position;this.cameraNX.position=this.position;this.cameraPY.position=this.position;this.cameraNY.position=this.position;this.cameraPZ.position=
-this.position;this.cameraNZ.position=this.position;this.cameraPY.up.set(0,0,1);this.cameraPZ.up.set(0,-1,0);this.cameraNZ.up.set(0,-1,0);this.renderTarget=new THREE.WebGLRenderTargetCube(e,e,{format:THREE.RGBFormat,magFilter:THREE.LinearFilter,minFilter:THREE.LinearFilter});this.updatePosition=function(a){this.position.x=a.x;this.position.z=a.z;this.cameraPX.target.position.add(this.position,new THREE.Vector3(-1,0,0));this.cameraNX.target.position.add(this.position,new THREE.Vector3(1,0,0));this.cameraPY.target.position.add(this.position,
-new THREE.Vector3(0,1,0));this.cameraNY.target.position.add(this.position,new THREE.Vector3(0,-1,0));this.cameraPZ.target.position.add(this.position,new THREE.Vector3(0,0,1));this.cameraNZ.target.position.add(this.position,new THREE.Vector3(0,0,-1))};this.updateCubeMap=function(a,c){var b=this.renderTarget;a.setFaceCulling("back","cw");c.scale.y=-1;c.position.y=2*this.height;c.updateMatrix();b.activeCubeFace=0;a.render(c,this.cameraPX,b);b.activeCubeFace=1;a.render(c,this.cameraNX,b);c.scale.y=1;
-c.position.y=0;c.updateMatrix();c.scale.x=-1;c.updateMatrix();b.activeCubeFace=2;a.render(c,this.cameraPY,b);c.scale.x=1;c.updateMatrix();a.setFaceCulling("back","ccw");b.activeCubeFace=3;a.render(c,this.cameraNY,b);c.scale.x=-1;c.updateMatrix();a.setFaceCulling("back","cw");b.activeCubeFace=4;a.render(c,this.cameraPZ,b);b.activeCubeFace=5;a.render(c,this.cameraNZ,b);c.scale.x=1;c.updateMatrix();a.setFaceCulling("back","ccw")}};
-THREE.FirstPersonCamera=function(a){function b(a,b){return function(){b.apply(a,arguments)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.movementSpeed=1;this.lookSpeed=0.0050;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=Math.PI;this.domElement=document;this.lastUpdate=(new Date).getTime();this.tdiff=0;if(a){if(a.movementSpeed!==void 0)this.movementSpeed=
-a.movementSpeed;if(a.lookSpeed!==void 0)this.lookSpeed=a.lookSpeed;if(a.noFly!==void 0)this.noFly=a.noFly;if(a.lookVertical!==void 0)this.lookVertical=a.lookVertical;if(a.autoForward!==void 0)this.autoForward=a.autoForward;if(a.activeLook!==void 0)this.activeLook=a.activeLook;if(a.heightSpeed!==void 0)this.heightSpeed=a.heightSpeed;if(a.heightCoef!==void 0)this.heightCoef=a.heightCoef;if(a.heightMin!==void 0)this.heightMin=a.heightMin;if(a.heightMax!==void 0)this.heightMax=a.heightMax;if(a.constrainVertical!==
-void 0)this.constrainVertical=a.constrainVertical;if(a.verticalMin!==void 0)this.verticalMin=a.verticalMin;if(a.verticalMax!==void 0)this.verticalMax=a.verticalMax;if(a.domElement!==void 0)this.domElement=a.domElement}this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=this.autoSpeedFactor=0;this.mouseDragOn=this.freeze=this.moveRight=this.moveLeft=this.moveBackward=this.moveForward=!1;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=
-this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));this.onMouseDown=function(a){this.domElement!==document&&this.domElement.focus();a.preventDefault();a.stopPropagation();if(this.activeLook)switch(a.button){case 0:this.moveForward=!0;break;case 2:this.moveBackward=!0}this.mouseDragOn=!0};this.onMouseUp=function(a){a.preventDefault();a.stopPropagation();if(this.activeLook)switch(a.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=
-!1}this.mouseDragOn=!1};this.onMouseMove=function(a){this.domElement===document?(this.mouseX=a.pageX-this.viewHalfX,this.mouseY=a.pageY-this.viewHalfY):(this.mouseX=a.pageX-this.domElement.offsetLeft-this.viewHalfX,this.mouseY=a.pageY-this.domElement.offsetTop-this.viewHalfY)};this.onKeyDown=function(a){switch(a.keyCode){case 38:case 87:this.moveForward=!0;break;case 37:case 65:this.moveLeft=!0;break;case 40:case 83:this.moveBackward=!0;break;case 39:case 68:this.moveRight=!0;break;case 82:this.moveUp=
-!0;break;case 70:this.moveDown=!0;break;case 81:this.freeze=!this.freeze}};this.onKeyUp=function(a){switch(a.keyCode){case 38:case 87:this.moveForward=!1;break;case 37:case 65:this.moveLeft=!1;break;case 40:case 83:this.moveBackward=!1;break;case 39:case 68:this.moveRight=!1;break;case 82:this.moveUp=!1;break;case 70:this.moveDown=!1}};this.update=function(){var a=(new Date).getTime();this.tdiff=(a-this.lastUpdate)/1E3;this.lastUpdate=a;if(!this.freeze){this.autoSpeedFactor=this.heightSpeed?this.tdiff*
-((this.position.y<this.heightMin?this.heightMin:this.position.y>this.heightMax?this.heightMax:this.position.y)-this.heightMin)*this.heightCoef:0;var b=this.tdiff*this.movementSpeed;(this.moveForward||this.autoForward&&!this.moveBackward)&&this.translateZ(-(b+this.autoSpeedFactor));this.moveBackward&&this.translateZ(b);this.moveLeft&&this.translateX(-b);this.moveRight&&this.translateX(b);this.moveUp&&this.translateY(b);this.moveDown&&this.translateY(-b);b=this.tdiff*this.lookSpeed;this.activeLook||
-(b=0);this.lon+=this.mouseX*b;this.lookVertical&&(this.lat-=this.mouseY*b);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;var a=this.target.position,g=this.position;a.x=g.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=g.y+100*Math.cos(this.phi);a.z=g.z+100*Math.sin(this.phi)*Math.sin(this.theta)}a=1;this.constrainVertical&&(a=Math.PI/(this.verticalMax-this.verticalMin));this.lon+=this.mouseX*b;this.lookVertical&&(this.lat-=this.mouseY*
-b*a);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;if(this.constrainVertical)this.phi=(this.phi-0)*(this.verticalMax-this.verticalMin)/(Math.PI-0)+this.verticalMin;a=this.target.position;g=this.position;a.x=g.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=g.y+100*Math.cos(this.phi);a.z=g.z+100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},
-!1);this.domElement.addEventListener("mousemove",b(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",b(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",b(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",b(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",b(this,this.onKeyUp),!1)};THREE.FirstPersonCamera.prototype=new THREE.Camera;THREE.FirstPersonCamera.prototype.constructor=THREE.FirstPersonCamera;
+THREE.CubeCamera=function(a,b,c,e){this.cameraPX=new THREE.Camera(90,1,a,b);this.cameraNX=new THREE.Camera(90,1,a,b);this.cameraPY=new THREE.Camera(90,1,a,b);this.cameraNY=new THREE.Camera(90,1,a,b);this.cameraPZ=new THREE.Camera(90,1,a,b);this.cameraNZ=new THREE.Camera(90,1,a,b);this.cameraPX.useTarget=!0;this.cameraNX.useTarget=!0;this.cameraPY.useTarget=!0;this.cameraNY.useTarget=!0;this.cameraPZ.useTarget=!0;this.cameraNZ.useTarget=!0;this.height=c;this.position=new THREE.Vector3(0,c,0);this.cameraPX.position=
+this.position;this.cameraNX.position=this.position;this.cameraPY.position=this.position;this.cameraNY.position=this.position;this.cameraPZ.position=this.position;this.cameraNZ.position=this.position;this.cameraPY.up.set(0,0,1);this.cameraPZ.up.set(0,-1,0);this.cameraNZ.up.set(0,-1,0);this.renderTarget=new THREE.WebGLRenderTargetCube(e,e,{format:THREE.RGBFormat,magFilter:THREE.LinearFilter,minFilter:THREE.LinearFilter});this.updatePosition=function(a){this.position.x=a.x;this.position.z=a.z;this.cameraPX.target.position.add(this.position,
+new THREE.Vector3(-1,0,0));this.cameraNX.target.position.add(this.position,new THREE.Vector3(1,0,0));this.cameraPY.target.position.add(this.position,new THREE.Vector3(0,1,0));this.cameraNY.target.position.add(this.position,new THREE.Vector3(0,-1,0));this.cameraPZ.target.position.add(this.position,new THREE.Vector3(0,0,1));this.cameraNZ.target.position.add(this.position,new THREE.Vector3(0,0,-1))};this.updateCubeMap=function(a,c){var b=this.renderTarget;a.setFaceCulling("back","cw");c.scale.y=-1;c.position.y=
+2*this.height;c.updateMatrix();b.activeCubeFace=0;a.render(c,this.cameraPX,b);b.activeCubeFace=1;a.render(c,this.cameraNX,b);c.scale.y=1;c.position.y=0;c.updateMatrix();c.scale.x=-1;c.updateMatrix();b.activeCubeFace=2;a.render(c,this.cameraPY,b);c.scale.x=1;c.updateMatrix();a.setFaceCulling("back","ccw");b.activeCubeFace=3;a.render(c,this.cameraNY,b);c.scale.x=-1;c.updateMatrix();a.setFaceCulling("back","cw");b.activeCubeFace=4;a.render(c,this.cameraPZ,b);b.activeCubeFace=5;a.render(c,this.cameraNZ,
+b);c.scale.x=1;c.updateMatrix();a.setFaceCulling("back","ccw")}};
+THREE.FirstPersonCamera=function(a){function b(a,b){return function(){b.apply(a,arguments)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.useTarget=!0;this.movementSpeed=1;this.lookSpeed=0.0050;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=Math.PI;this.domElement=document;this.lastUpdate=(new Date).getTime();this.tdiff=0;if(a){if(a.movementSpeed!==
+void 0)this.movementSpeed=a.movementSpeed;if(a.lookSpeed!==void 0)this.lookSpeed=a.lookSpeed;if(a.noFly!==void 0)this.noFly=a.noFly;if(a.lookVertical!==void 0)this.lookVertical=a.lookVertical;if(a.autoForward!==void 0)this.autoForward=a.autoForward;if(a.activeLook!==void 0)this.activeLook=a.activeLook;if(a.heightSpeed!==void 0)this.heightSpeed=a.heightSpeed;if(a.heightCoef!==void 0)this.heightCoef=a.heightCoef;if(a.heightMin!==void 0)this.heightMin=a.heightMin;if(a.heightMax!==void 0)this.heightMax=
+a.heightMax;if(a.constrainVertical!==void 0)this.constrainVertical=a.constrainVertical;if(a.verticalMin!==void 0)this.verticalMin=a.verticalMin;if(a.verticalMax!==void 0)this.verticalMax=a.verticalMax;if(a.domElement!==void 0)this.domElement=a.domElement}this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=this.autoSpeedFactor=0;this.mouseDragOn=this.freeze=this.moveRight=this.moveLeft=this.moveBackward=this.moveForward=!1;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=
+window.innerHeight/2):(this.viewHalfX=this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));this.onMouseDown=function(a){this.domElement!==document&&this.domElement.focus();a.preventDefault();a.stopPropagation();if(this.activeLook)switch(a.button){case 0:this.moveForward=!0;break;case 2:this.moveBackward=!0}this.mouseDragOn=!0};this.onMouseUp=function(a){a.preventDefault();a.stopPropagation();if(this.activeLook)switch(a.button){case 0:this.moveForward=
+!1;break;case 2:this.moveBackward=!1}this.mouseDragOn=!1};this.onMouseMove=function(a){this.domElement===document?(this.mouseX=a.pageX-this.viewHalfX,this.mouseY=a.pageY-this.viewHalfY):(this.mouseX=a.pageX-this.domElement.offsetLeft-this.viewHalfX,this.mouseY=a.pageY-this.domElement.offsetTop-this.viewHalfY)};this.onKeyDown=function(a){switch(a.keyCode){case 38:case 87:this.moveForward=!0;break;case 37:case 65:this.moveLeft=!0;break;case 40:case 83:this.moveBackward=!0;break;case 39:case 68:this.moveRight=
+!0;break;case 82:this.moveUp=!0;break;case 70:this.moveDown=!0;break;case 81:this.freeze=!this.freeze}};this.onKeyUp=function(a){switch(a.keyCode){case 38:case 87:this.moveForward=!1;break;case 37:case 65:this.moveLeft=!1;break;case 40:case 83:this.moveBackward=!1;break;case 39:case 68:this.moveRight=!1;break;case 82:this.moveUp=!1;break;case 70:this.moveDown=!1}};this.update=function(){var a=(new Date).getTime();this.tdiff=(a-this.lastUpdate)/1E3;this.lastUpdate=a;if(!this.freeze){this.autoSpeedFactor=
+this.heightSpeed?this.tdiff*((this.position.y<this.heightMin?this.heightMin:this.position.y>this.heightMax?this.heightMax:this.position.y)-this.heightMin)*this.heightCoef:0;var b=this.tdiff*this.movementSpeed;(this.moveForward||this.autoForward&&!this.moveBackward)&&this.translateZ(-(b+this.autoSpeedFactor));this.moveBackward&&this.translateZ(b);this.moveLeft&&this.translateX(-b);this.moveRight&&this.translateX(b);this.moveUp&&this.translateY(b);this.moveDown&&this.translateY(-b);b=this.tdiff*this.lookSpeed;
+this.activeLook||(b=0);this.lon+=this.mouseX*b;this.lookVertical&&(this.lat-=this.mouseY*b);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;var a=this.target.position,g=this.position;a.x=g.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=g.y+100*Math.cos(this.phi);a.z=g.z+100*Math.sin(this.phi)*Math.sin(this.theta)}a=1;this.constrainVertical&&(a=Math.PI/(this.verticalMax-this.verticalMin));this.lon+=this.mouseX*b;this.lookVertical&&
+(this.lat-=this.mouseY*b*a);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;if(this.constrainVertical)this.phi=(this.phi-0)*(this.verticalMax-this.verticalMin)/(Math.PI-0)+this.verticalMin;a=this.target.position;g=this.position;a.x=g.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=g.y+100*Math.cos(this.phi);a.z=g.z+100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this)};this.domElement.addEventListener("contextmenu",
+function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",b(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",b(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",b(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",b(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",b(this,this.onKeyUp),!1)};THREE.FirstPersonCamera.prototype=new THREE.Camera;THREE.FirstPersonCamera.prototype.constructor=THREE.FirstPersonCamera;
 THREE.FirstPersonCamera.prototype.supr=THREE.Camera.prototype;THREE.FirstPersonCamera.prototype.translate=function(a,b){this.matrix.rotateAxis(b);if(this.noFly)b.y=0;this.position.addSelf(b.multiplyScalar(a));this.target.position.addSelf(b.multiplyScalar(a))};
 THREE.PathCamera=function(a){function b(a,c,b,e){var f={name:b,fps:0.6,length:e,hierarchy:[]},h,g=c.getControlPointsArray(),k=c.getLength(),l=g.length,y=0;h=l-1;c={parent:-1,keys:[]};c.keys[0]={time:0,pos:g[0],rot:[0,0,0,1],scl:[1,1,1]};c.keys[h]={time:e,pos:g[h],rot:[0,0,0,1],scl:[1,1,1]};for(h=1;h<l-1;h++)y=e*k.chunks[h]/k.total,c.keys[h]={time:y,pos:g[h]};f.hierarchy[0]=c;THREE.AnimationHandler.add(f);return new THREE.Animation(a,b,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function c(a,c){var b,
 e,f=new THREE.Geometry;for(b=0;b<a.points.length*c;b++)e=b/(a.points.length*c),e=a.getPoint(e),f.vertices[b]=new THREE.Vertex(new THREE.Vector3(e.x,e.y,e.z));return f}function e(a,b){var e=c(b,10),f=c(b,10),h=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(e,h);particleObj=new THREE.ParticleSystem(f,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);a.addChild(lineObj);particleObj.scale.set(1,1,1);a.addChild(particleObj);f=new THREE.SphereGeometry(1,
-16,8);h=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<b.points.length;i++)e=new THREE.Mesh(f,h),e.position.copy(b.points[i]),e.updateMatrix(),a.addChild(e)}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.id="PathCamera"+THREE.PathCameraIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.0050;this.lookHorizontal=
-this.lookVertical=!0;this.verticalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.horizontalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.domElement=document;if(a){if(a.duration!==void 0)this.duration=a.duration*1E3;if(a.waypoints!==void 0)this.waypoints=a.waypoints;if(a.useConstantSpeed!==void 0)this.useConstantSpeed=a.useConstantSpeed;if(a.resamplingCoef!==void 0)this.resamplingCoef=a.resamplingCoef;if(a.createDebugPath!==void 0)this.createDebugPath=a.createDebugPath;
-if(a.createDebugDummy!==void 0)this.createDebugDummy=a.createDebugDummy;if(a.lookSpeed!==void 0)this.lookSpeed=a.lookSpeed;if(a.lookVertical!==void 0)this.lookVertical=a.lookVertical;if(a.lookHorizontal!==void 0)this.lookHorizontal=a.lookHorizontal;if(a.verticalAngleMap!==void 0)this.verticalAngleMap=a.verticalAngleMap;if(a.horizontalAngleMap!==void 0)this.horizontalAngleMap=a.horizontalAngleMap;if(a.domElement!==void 0)this.domElement=a.domElement}this.theta=this.phi=this.lon=this.lat=this.mouseY=
-this.mouseX=0;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));var g=Math.PI*2,h=Math.PI/180;this.update=function(a,c,b){var e,f;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,
+16,8);h=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<b.points.length;i++)e=new THREE.Mesh(f,h),e.position.copy(b.points[i]),e.updateMatrix(),a.addChild(e)}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.id="PathCamera"+THREE.PathCameraIdCounter++;this.useTarget=!0;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.0050;
+this.lookHorizontal=this.lookVertical=!0;this.verticalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.horizontalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.domElement=document;if(a){if(a.duration!==void 0)this.duration=a.duration*1E3;if(a.waypoints!==void 0)this.waypoints=a.waypoints;if(a.useConstantSpeed!==void 0)this.useConstantSpeed=a.useConstantSpeed;if(a.resamplingCoef!==void 0)this.resamplingCoef=a.resamplingCoef;if(a.createDebugPath!==void 0)this.createDebugPath=
+a.createDebugPath;if(a.createDebugDummy!==void 0)this.createDebugDummy=a.createDebugDummy;if(a.lookSpeed!==void 0)this.lookSpeed=a.lookSpeed;if(a.lookVertical!==void 0)this.lookVertical=a.lookVertical;if(a.lookHorizontal!==void 0)this.lookHorizontal=a.lookHorizontal;if(a.verticalAngleMap!==void 0)this.verticalAngleMap=a.verticalAngleMap;if(a.horizontalAngleMap!==void 0)this.horizontalAngleMap=a.horizontalAngleMap;if(a.domElement!==void 0)this.domElement=a.domElement}this.theta=this.phi=this.lon=this.lat=
+this.mouseY=this.mouseX=0;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));var g=Math.PI*2,h=Math.PI/180;this.update=function(a,c,b){var e,f;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,
 Math.min(85,this.lat));this.phi=(90-this.lat)*h;this.theta=this.lon*h;e=this.phi%g;this.phi=e>=0?e:e+g;e=this.verticalAngleMap.srcRange;f=this.verticalAngleMap.dstRange;var k=f[1]-f[0];this.phi=TWEEN.Easing.Quadratic.EaseInOut(((this.phi-e[0])*(f[1]-f[0])/(e[1]-e[0])+f[0]-f[0])/k)*k+f[0];e=this.horizontalAngleMap.srcRange;f=this.horizontalAngleMap.dstRange;k=f[1]-f[0];this.theta=TWEEN.Easing.Quadratic.EaseInOut(((this.theta-e[0])*(f[1]-f[0])/(e[1]-e[0])+f[0]-f[0])/k)*k+f[0];e=this.target.position;
 e.x=100*Math.sin(this.phi)*Math.cos(this.theta);e.y=100*Math.cos(this.phi);e.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this,a,c,b)};this.onMouseMove=function(a){this.domElement===document?(this.mouseX=a.pageX-this.viewHalfX,this.mouseY=a.pageY-this.viewHalfY):(this.mouseX=a.pageX-this.domElement.offsetLeft-this.viewHalfX,this.mouseY=a.pageY-this.domElement.offsetTop-this.viewHalfY)};this.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}),f=new THREE.MeshLambertMaterial({color:65280}),k=new THREE.CubeGeometry(10,10,20),l=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(k,a);a=new THREE.Mesh(l,f);a.position.set(0,10,0);this.animation=b(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this);this.animationParent.addChild(this.target);this.animationParent.addChild(a)}else this.animation=
@@ -133,8 +134,8 @@ g.lengthSq()<this.minDistance*this.minDistance&&this.position.add(this.target.po
 b(this,function(a){c&&(h=f=this.getMouseProjectionOnBall(a.clientX,a.clientY),k=l=this.getMouseOnScreen(a.clientX,a.clientY),m=n=this.getMouseOnScreen(a.clientX,a.clientY),c=!1);e!==this.STATE.NONE&&(e===this.STATE.ROTATE?f=this.getMouseProjectionOnBall(a.clientX,a.clientY):e===this.STATE.ZOOM&&!this.noZoom?l=this.getMouseOnScreen(a.clientX,a.clientY):e===this.STATE.PAN&&!this.noPan&&(n=this.getMouseOnScreen(a.clientX,a.clientY)))}),!1);this.domElement.addEventListener("mousedown",b(this,function(a){a.preventDefault();
 a.stopPropagation();if(e===this.STATE.NONE)e=a.button,e===this.STATE.ROTATE?h=f=this.getMouseProjectionOnBall(a.clientX,a.clientY):e===this.STATE.ZOOM&&!this.noZoom?k=l=this.getMouseOnScreen(a.clientX,a.clientY):this.noPan||(m=n=this.getMouseOnScreen(a.clientX,a.clientY))}),!1);this.domElement.addEventListener("mouseup",b(this,function(a){a.preventDefault();a.stopPropagation();e=this.STATE.NONE}),!1);window.addEventListener("keydown",b(this,function(a){if(e===this.STATE.NONE){if(a.keyCode===this.keys[this.STATE.ROTATE])e=
 this.STATE.ROTATE;else if(a.keyCode===this.keys[this.STATE.ZOOM]&&!this.noZoom)e=this.STATE.ZOOM;else if(a.keyCode===this.keys[this.STATE.PAN]&&!this.noPan)e=this.STATE.PAN;e!==this.STATE.NONE&&(c=!0)}}),!1);window.addEventListener("keyup",b(this,function(){if(e!==this.STATE.NONE)e=this.STATE.NONE}),!1)};THREE.TrackballCamera.prototype=new THREE.Camera;THREE.TrackballCamera.prototype.constructor=THREE.TrackballCamera;THREE.TrackballCamera.prototype.supr=THREE.Camera.prototype;
-THREE.TrackballCamera.prototype.STATE={NONE:-1,ROTATE:0,ZOOM:1,PAN:2};THREE.QuakeCamera=THREE.FirstPersonCamera;
-THREE.CubeGeometry=function(a,b,c,e,g,h,f,k,l){function m(a,c,b,f,k,l,m,o){var p,t,x=e||1,v=g||1,D=k/2,J=l/2,L=n.vertices.length;if(a=="x"&&c=="y"||a=="y"&&c=="x")p="z";else if(a=="x"&&c=="z"||a=="z"&&c=="x")p="y",v=h||1;else if(a=="z"&&c=="y"||a=="y"&&c=="z")p="x",x=h||1;var N=x+1,K=v+1;k/=x;var P=l/v;for(t=0;t<K;t++)for(l=0;l<N;l++){var E=new THREE.Vector3;E[a]=(l*k-D)*b;E[c]=(t*P-J)*f;E[p]=m;n.vertices.push(new THREE.Vertex(E))}for(t=0;t<v;t++)for(l=0;l<x;l++)n.faces.push(new THREE.Face4(l+N*t+
+THREE.TrackballCamera.prototype.STATE={NONE:-1,ROTATE:0,ZOOM:1,PAN:2};
+THREE.CubeGeometry=function(a,b,c,e,g,h,f,k,l){function m(a,c,b,f,k,l,m,o){var p,t,x=e||1,v=g||1,D=k/2,J=l/2,L=n.vertices.length;if(a=="x"&&c=="y"||a=="y"&&c=="x")p="z";else if(a=="x"&&c=="z"||a=="z"&&c=="x")p="y",v=h||1;else if(a=="z"&&c=="y"||a=="y"&&c=="z")p="x",x=h||1;var N=x+1,K=v+1;k/=x;var P=l/v;for(t=0;t<K;t++)for(l=0;l<N;l++){var F=new THREE.Vector3;F[a]=(l*k-D)*b;F[c]=(t*P-J)*f;F[p]=m;n.vertices.push(new THREE.Vertex(F))}for(t=0;t<v;t++)for(l=0;l<x;l++)n.faces.push(new THREE.Face4(l+N*t+
 L,l+N*(t+1)+L,l+1+N*(t+1)+L,l+1+N*t+L,null,null,o)),n.faceVertexUvs[0].push([new THREE.UV(l/x,t/v),new THREE.UV(l/x,(t+1)/v),new THREE.UV((l+1)/x,(t+1)/v),new THREE.UV((l+1)/x,t/v)])}THREE.Geometry.call(this);var n=this,o=a/2,t=b/2,p=c/2,k=k?-1:1;if(f!==void 0)if(f instanceof Array)this.materials=f;else{this.materials=[];for(var x=0;x<6;x++)this.materials.push([f])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(l!=void 0)for(var v in l)this.sides[v]!=void 0&&(this.sides[v]=
 l[v]);this.sides.px&&m("z","y",1*k,-1,c,b,-o,this.materials[0]);this.sides.nx&&m("z","y",-1*k,-1,c,b,o,this.materials[1]);this.sides.py&&m("x","z",1*k,1,a,c,t,this.materials[2]);this.sides.ny&&m("x","z",1*k,-1,a,c,-t,this.materials[3]);this.sides.pz&&m("x","y",1*k,-1,a,b,p,this.materials[4]);this.sides.nz&&m("x","y",-1*k,-1,a,b,-p,this.materials[5]);(function(){for(var a=[],c=[],b=0,e=n.vertices.length;b<e;b++){for(var f=n.vertices[b],h=!1,g=0,k=a.length;g<k;g++){var l=a[g];if(f.position.x==l.position.x&&
 f.position.y==l.position.y&&f.position.z==l.position.z){c[b]=g;h=!0;break}}if(!h)c[b]=a.length,a.push(new THREE.Vertex(f.position.clone()))}b=0;for(e=n.faces.length;b<e;b++)f=n.faces[b],f.a=c[f.a],f.b=c[f.b],f.c=c[f.c],f.d=c[f.d];n.vertices=a})();this.computeCentroids();this.computeFaceNormals()};THREE.CubeGeometry.prototype=new THREE.Geometry;THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
@@ -147,10 +148,10 @@ THREE.ExtrudeGeometry.prototype.addShape=function(a,b){function c(a,c,b){c||cons
 k.copy(c).addSelf(h);l.copy(b).addSelf(g);h=e.dot(g);g=l.subSelf(k).dot(g);h==0&&(console.log("Either infinite or no solutions!"),g==0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));g/=h;if(g<0)return c=Math.atan2(c.y-a.y,c.x-a.x),a=Math.atan2(b.y-a.y,b.x-a.x),c>a&&(a+=Math.PI*2),anglec=(c+a)/2,new THREE.Vector2(-Math.cos(anglec),-Math.sin(anglec));return e.multiplyScalar(g).addSelf(k).subSelf(a).clone()}function g(a){for(B=a.length;--B>=0;){T=B;R=B-1;R<0&&(R=a.length-
 1);for(var c=0,b=p+n*2,c=0;c<b;c++){var e=P*c,f=P*(c+1),h=Q+T+e,g=Q+T+f,m=h,e=Q+R+e,f=Q+R+f,o=g;m+=M;e+=M;f+=M;o+=M;H.faces.push(new THREE.Face4(m,e,f,o,null,null,A));A&&(m=c/b,e=(c+1)/b,f=k+l*2,h=(H.vertices[h].position.z+l)/f,g=(H.vertices[g].position.z+l)/f,H.faceVertexUvs[0].push([new THREE.UV(h,m),new THREE.UV(g,m),new THREE.UV(g,e),new THREE.UV(h,e)]))}}}function h(a,c,b){H.vertices.push(new THREE.Vertex(new THREE.Vector3(a,c,b)))}function f(a,c,b){a+=M;c+=M;b+=M;H.faces.push(new THREE.Face3(a,
 c,b,null,null,w));if(w){var e=C.maxY,f=C.maxX,h=H.vertices[c].position.x,c=H.vertices[c].position.y,g=H.vertices[b].position.x,b=H.vertices[b].position.y;H.faceVertexUvs[0].push([new THREE.UV(H.vertices[a].position.x/f,H.vertices[a].position.y/e),new THREE.UV(h/f,c/e),new THREE.UV(g/f,b/e)])}}var k=b.amount!==void 0?b.amount:100,l=b.bevelThickness!==void 0?b.bevelThickness:6,m=b.bevelSize!==void 0?b.bevelSize:l-2,n=b.bevelSegments!==void 0?b.bevelSegments:3,o=b.bevelEnabled!==void 0?b.bevelEnabled:
-!0,t=b.curveSegments!==void 0?b.curveSegments:12,p=b.steps!==void 0?b.steps:1,x=b.bendPath,v=b.extrudePath,u,z=!1,y=b.useSpacedPoints!==void 0?b.useSpacedPoints:!1,w=b.material,A=b.extrudeMaterial,C=this.shapebb;if(v)u=v.getPoints(t),p=u.length,z=!0,o=!1;o||(m=l=n=0);var F,G,I,H=this,M=this.vertices.length;x&&a.addWrapPath(x);t=y?a.extractAllSpacedPoints(t):a.extractAllPoints(t);x=t.shape;t=t.holes;if(v=!THREE.Shape.Utils.isClockWise(x)){x=x.reverse();G=0;for(I=t.length;G<I;G++)F=t[G],THREE.Shape.Utils.isClockWise(F)&&
-(t[G]=F.reverse());v=!1}v=THREE.Shape.Utils.triangulateShape(x,t);y=x;G=0;for(I=t.length;G<I;G++)F=t[G],x=x.concat(F);var B,D,J,L,N,K,P=x.length,E=v.length,S=[];B=0;D=y.length;T=D-1;for(R=B+1;B<D;B++,T++,R++)T==D&&(T=0),R==D&&(R=0),S[B]=e(y[B],y[T],y[R]);var O=[],U,V=S.concat();G=0;for(I=t.length;G<I;G++){F=t[G];U=[];B=0;D=F.length;T=D-1;for(R=B+1;B<D;B++,T++,R++)T==D&&(T=0),R==D&&(R=0),U[B]=e(F[B],F[T],F[R]);O.push(U);V=V.concat(U)}for(J=0;J<n;J++){L=J/n;N=l*(1-L);L=m*Math.sin(L*Math.PI/2);B=0;for(D=
-y.length;B<D;B++)K=c(y[B],S[B],L),h(K.x,K.y,-N);G=0;for(I=t.length;G<I;G++){F=t[G];U=O[G];B=0;for(D=F.length;B<D;B++)K=c(F[B],U[B],L),h(K.x,K.y,-N)}}L=m;for(B=0;B<P;B++)K=o?c(x[B],V[B],L):x[B],z?h(K.x,K.y+u[0].y,u[0].x):h(K.x,K.y,0);for(J=1;J<=p;J++)for(B=0;B<P;B++)K=o?c(x[B],V[B],L):x[B],z?h(K.x,K.y+u[J-1].y,u[J-1].x):h(K.x,K.y,k/p*J);for(J=n-1;J>=0;J--){L=J/n;N=l*(1-L);L=m*Math.sin(L*Math.PI/2);B=0;for(D=y.length;B<D;B++)K=c(y[B],S[B],L),h(K.x,K.y,k+N);G=0;for(I=t.length;G<I;G++){F=t[G];U=O[G];
-B=0;for(D=F.length;B<D;B++)K=c(F[B],U[B],L),z?h(K.x,K.y+u[p-1].y,u[p-1].x+N):h(K.x,K.y,k+N)}}if(o){o=P*0;for(B=0;B<E;B++)m=v[B],f(m[2]+o,m[1]+o,m[0]+o);o=P*(p+n*2);for(B=0;B<E;B++)m=v[B],f(m[0]+o,m[1]+o,m[2]+o)}else{for(B=0;B<E;B++)m=v[B],f(m[2],m[1],m[0]);for(B=0;B<E;B++)m=v[B],f(m[0]+P*p,m[1]+P*p,m[2]+P*p)}var T,R,Q=0;g(y);Q+=y.length;G=0;for(I=t.length;G<I;G++)F=t[G],g(F),Q+=F.length};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;THREE.ExtrudeGeometry.__v2=new THREE.Vector2;
+!0,t=b.curveSegments!==void 0?b.curveSegments:12,p=b.steps!==void 0?b.steps:1,x=b.bendPath,v=b.extrudePath,u,z=!1,y=b.useSpacedPoints!==void 0?b.useSpacedPoints:!1,w=b.material,A=b.extrudeMaterial,C=this.shapebb;if(v)u=v.getPoints(t),p=u.length,z=!0,o=!1;o||(m=l=n=0);var G,E,I,H=this,M=this.vertices.length;x&&a.addWrapPath(x);t=y?a.extractAllSpacedPoints(t):a.extractAllPoints(t);x=t.shape;t=t.holes;if(v=!THREE.Shape.Utils.isClockWise(x)){x=x.reverse();E=0;for(I=t.length;E<I;E++)G=t[E],THREE.Shape.Utils.isClockWise(G)&&
+(t[E]=G.reverse());v=!1}v=THREE.Shape.Utils.triangulateShape(x,t);y=x;E=0;for(I=t.length;E<I;E++)G=t[E],x=x.concat(G);var B,D,J,L,N,K,P=x.length,F=v.length,S=[];B=0;D=y.length;T=D-1;for(R=B+1;B<D;B++,T++,R++)T==D&&(T=0),R==D&&(R=0),S[B]=e(y[B],y[T],y[R]);var O=[],U,V=S.concat();E=0;for(I=t.length;E<I;E++){G=t[E];U=[];B=0;D=G.length;T=D-1;for(R=B+1;B<D;B++,T++,R++)T==D&&(T=0),R==D&&(R=0),U[B]=e(G[B],G[T],G[R]);O.push(U);V=V.concat(U)}for(J=0;J<n;J++){L=J/n;N=l*(1-L);L=m*Math.sin(L*Math.PI/2);B=0;for(D=
+y.length;B<D;B++)K=c(y[B],S[B],L),h(K.x,K.y,-N);E=0;for(I=t.length;E<I;E++){G=t[E];U=O[E];B=0;for(D=G.length;B<D;B++)K=c(G[B],U[B],L),h(K.x,K.y,-N)}}L=m;for(B=0;B<P;B++)K=o?c(x[B],V[B],L):x[B],z?h(K.x,K.y+u[0].y,u[0].x):h(K.x,K.y,0);for(J=1;J<=p;J++)for(B=0;B<P;B++)K=o?c(x[B],V[B],L):x[B],z?h(K.x,K.y+u[J-1].y,u[J-1].x):h(K.x,K.y,k/p*J);for(J=n-1;J>=0;J--){L=J/n;N=l*(1-L);L=m*Math.sin(L*Math.PI/2);B=0;for(D=y.length;B<D;B++)K=c(y[B],S[B],L),h(K.x,K.y,k+N);E=0;for(I=t.length;E<I;E++){G=t[E];U=O[E];
+B=0;for(D=G.length;B<D;B++)K=c(G[B],U[B],L),z?h(K.x,K.y+u[p-1].y,u[p-1].x+N):h(K.x,K.y,k+N)}}if(o){o=P*0;for(B=0;B<F;B++)m=v[B],f(m[2]+o,m[1]+o,m[0]+o);o=P*(p+n*2);for(B=0;B<F;B++)m=v[B],f(m[0]+o,m[1]+o,m[2]+o)}else{for(B=0;B<F;B++)m=v[B],f(m[2],m[1],m[0]);for(B=0;B<F;B++)m=v[B],f(m[0]+P*p,m[1]+P*p,m[2]+P*p)}var T,R,Q=0;g(y);Q+=y.length;E=0;for(I=t.length;E<I;E++)G=t[E],g(G),Q+=G.length};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;THREE.ExtrudeGeometry.__v2=new THREE.Vector2;
 THREE.ExtrudeGeometry.__v3=new THREE.Vector2;THREE.ExtrudeGeometry.__v4=new THREE.Vector2;THREE.ExtrudeGeometry.__v5=new THREE.Vector2;THREE.ExtrudeGeometry.__v6=new THREE.Vector2;
 THREE.IcosahedronGeometry=function(a){function b(a,c,b){var e=Math.sqrt(a*a+c*c+b*b);return g.vertices.push(new THREE.Vertex(new THREE.Vector3(a/e,c/e,b/e)))-1}function c(a,c,b,e){e.faces.push(new THREE.Face3(a,c,b))}function e(a,c){var e=g.vertices[a].position,f=g.vertices[c].position;return b((e.x+f.x)/2,(e.y+f.y)/2,(e.z+f.z)/2)}var g=this,h=new THREE.Geometry;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;b(-1,a,0);b(1,a,0);b(-1,-a,0);b(1,-a,0);b(0,-1,a);b(0,1,a);b(0,-1,
 -a);b(0,1,-a);b(a,0,-1);b(a,0,1);b(-a,0,-1);b(-a,0,1);c(0,11,5,h);c(0,5,1,h);c(0,1,7,h);c(0,7,10,h);c(0,10,11,h);c(1,5,9,h);c(5,11,4,h);c(11,10,2,h);c(10,7,6,h);c(7,1,8,h);c(3,9,4,h);c(3,4,2,h);c(3,2,6,h);c(3,6,8,h);c(3,8,9,h);c(4,9,5,h);c(2,4,11,h);c(6,2,10,h);c(8,6,7,h);c(9,8,1,h);for(var f=0;f<this.subdivisions;f++){var a=new THREE.Geometry,k;for(k in h.faces){var l=e(h.faces[k].a,h.faces[k].b),m=e(h.faces[k].b,h.faces[k].c),n=e(h.faces[k].c,h.faces[k].a);c(h.faces[k].a,l,n,a);c(h.faces[k].b,m,
@@ -170,7 +171,7 @@ this.getFace(),c=this.size/b.resolution,e=0,g=String(a).split(""),h=g.length,f=[
 m));g.moveTo(k,m);break;case "l":k=b[a++]*c+e;m=b[a++]*c;h.push(new THREE.Vector2(k,m));g.lineTo(k,m);break;case "q":k=b[a++]*c+e;m=b[a++]*c;t=b[a++]*c+e;p=b[a++]*c;g.quadraticCurveTo(t,p,k,m);if(f=h[h.length-1]){n=f.x;o=f.y;f=1;for(divisions=this.divisions;f<=divisions;f++){var z=f/divisions,y=THREE.Shape.Utils.b2(z,n,t,k),z=THREE.Shape.Utils.b2(z,o,p,m);h.push(new THREE.Vector2(y,z))}}break;case "b":if(k=b[a++]*c+e,m=b[a++]*c,t=b[a++]*c+e,p=b[a++]*-c,x=b[a++]*c+e,v=b[a++]*-c,g.bezierCurveTo(k,m,
 t,p,x,v),f=h[h.length-1]){n=f.x;o=f.y;f=1;for(divisions=this.divisions;f<=divisions;f++)z=f/divisions,y=THREE.Shape.Utils.b3(z,n,t,x,k),z=THREE.Shape.Utils.b3(z,o,p,v,m),h.push(new THREE.Vector2(y,z))}}}return{offset:u.ha*c,points:h,path:g}}}};
 (function(a){var b=function(a){for(var b=a.length,g=0,h=b-1,f=0;f<b;h=f++)g+=a[h].x*a[f].y-a[f].x*a[h].y;return g*0.5};a.Triangulate=function(a,e){var g=a.length;if(g<3)return null;var h=[],f=[],k=[],l,m,n;if(b(a)>0)for(m=0;m<g;m++)f[m]=m;else for(m=0;m<g;m++)f[m]=g-1-m;var o=2*g;for(m=g-1;g>2;){if(o--<=0){console.log("Warning, unable to triangulate polygon!");if(e)return k;return h}l=m;g<=l&&(l=0);m=l+1;g<=m&&(m=0);n=m+1;g<=n&&(n=0);var t;a:{t=a;var p=l,x=m,v=n,u=g,z=f,y=void 0,w=void 0,A=void 0,
-C=void 0,F=void 0,G=void 0,I=void 0,H=void 0,M=void 0,w=t[z[p]].x,A=t[z[p]].y,C=t[z[x]].x,F=t[z[x]].y,G=t[z[v]].x,I=t[z[v]].y;if(1.0E-10>(C-w)*(I-A)-(F-A)*(G-w))t=!1;else{for(y=0;y<u;y++)if(!(y==p||y==x||y==v)){var H=t[z[y]].x,M=t[z[y]].y,B=void 0,D=void 0,J=void 0,L=void 0,N=void 0,K=void 0,P=void 0,E=void 0,S=void 0,O=void 0,U=void 0,V=void 0,B=J=N=void 0,B=G-C,D=I-F,J=w-G,L=A-I,N=C-w,K=F-A,P=H-w,E=M-A,S=H-C,O=M-F,U=H-G,V=M-I,B=B*O-D*S,N=N*E-K*P,J=J*V-L*U;if(B>=0&&J>=0&&N>=0){t=!1;break a}}t=!0}}if(t){h.push([a[f[l]],
+C=void 0,G=void 0,E=void 0,I=void 0,H=void 0,M=void 0,w=t[z[p]].x,A=t[z[p]].y,C=t[z[x]].x,G=t[z[x]].y,E=t[z[v]].x,I=t[z[v]].y;if(1.0E-10>(C-w)*(I-A)-(G-A)*(E-w))t=!1;else{for(y=0;y<u;y++)if(!(y==p||y==x||y==v)){var H=t[z[y]].x,M=t[z[y]].y,B=void 0,D=void 0,J=void 0,L=void 0,N=void 0,K=void 0,P=void 0,F=void 0,S=void 0,O=void 0,U=void 0,V=void 0,B=J=N=void 0,B=E-C,D=I-G,J=w-E,L=A-I,N=C-w,K=G-A,P=H-w,F=M-A,S=H-C,O=M-G,U=H-E,V=M-I,B=B*O-D*S,N=N*F-K*P,J=J*V-L*U;if(B>=0&&J>=0&&N>=0){t=!1;break a}}t=!0}}if(t){h.push([a[f[l]],
 a[f[m]],a[f[n]]]);k.push([f[l],f[m],f[n]]);l=m;for(n=m+1;n<g;l++,n++)f[l]=f[n];g--;o=2*g}}if(e)return k;return h};a.Triangulate.area=b;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
 THREE.TorusGeometry=function(a,b,c,e,g){THREE.Geometry.call(this);this.radius=a||100;this.tube=b||40;this.segmentsR=c||8;this.segmentsT=e||6;this.arc=g||Math.PI*2;g=new THREE.Vector3;a=[];b=[];for(c=0;c<=this.segmentsR;c++)for(e=0;e<=this.segmentsT;e++){var h=e/this.segmentsT*this.arc,f=c/this.segmentsR*Math.PI*2;g.x=this.radius*Math.cos(h);g.y=this.radius*Math.sin(h);var k=new THREE.Vector3;k.x=(this.radius+this.tube*Math.cos(f))*Math.cos(h);k.y=(this.radius+this.tube*Math.cos(f))*Math.sin(h);k.z=
 this.tube*Math.sin(f);this.vertices.push(new THREE.Vertex(k));a.push(new THREE.UV(e/this.segmentsT,1-c/this.segmentsR));b.push(k.clone().subSelf(g).normalize())}for(c=1;c<=this.segmentsR;c++)for(e=1;e<=this.segmentsT;e++){var g=(this.segmentsT+1)*c+e-1,h=(this.segmentsT+1)*(c-1)+e-1,f=(this.segmentsT+1)*(c-1)+e,k=(this.segmentsT+1)*c+e,l=new THREE.Face4(g,h,f,k,[b[g],b[h],b[f],b[k]]);l.normal.addSelf(b[g]);l.normal.addSelf(b[h]);l.normal.addSelf(b[f]);l.normal.addSelf(b[k]);l.normal.normalize();this.faces.push(l);
@@ -179,32 +180,32 @@ THREE.TorusKnotGeometry=function(a,b,c,e,g,h,f){function k(a,c,b,e,f,h){c=b/e*a;
 this.segmentsT;++b){var l=a/this.segmentsR*2*this.p*Math.PI,f=b/this.segmentsT*2*Math.PI,g=k(l,f,this.q,this.p,this.radius,this.heightScale),l=k(l+0.01,f,this.q,this.p,this.radius,this.heightScale);c.x=l.x-g.x;c.y=l.y-g.y;c.z=l.z-g.z;e.x=l.x+g.x;e.y=l.y+g.y;e.z=l.z+g.z;h.cross(c,e);e.cross(h,c);h.normalize();e.normalize();l=-this.tube*Math.cos(f);f=this.tube*Math.sin(f);g.x+=l*e.x+f*h.x;g.y+=l*e.y+f*h.y;g.z+=l*e.z+f*h.z;this.grid[a][b]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(g.x,g.y,
 g.z)))-1}}for(a=0;a<this.segmentsR;++a)for(b=0;b<this.segmentsT;++b){var e=(a+1)%this.segmentsR,h=(b+1)%this.segmentsT,g=this.grid[a][b],c=this.grid[e][b],e=this.grid[e][h],h=this.grid[a][h],f=new THREE.UV(a/this.segmentsR,b/this.segmentsT),l=new THREE.UV((a+1)/this.segmentsR,b/this.segmentsT),m=new THREE.UV((a+1)/this.segmentsR,(b+1)/this.segmentsT),n=new THREE.UV(a/this.segmentsR,(b+1)/this.segmentsT);this.faces.push(new THREE.Face4(g,c,e,h));this.faceVertexUvs[0].push([f,l,m,n])}this.computeCentroids();
 this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusKnotGeometry.prototype=new THREE.Geometry;THREE.TorusKnotGeometry.prototype.constructor=THREE.TorusKnotGeometry;THREE.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={addStatusElement:function(){var a=document.createElement("div");a.style.position="absolute";a.style.right="0px";a.style.top="0px";a.style.fontSize="0.8em";a.style.textAlign="left";a.style.background="rgba(0,0,0,0.25)";a.style.color="#fff";a.style.width="120px";a.style.padding="0.5em 0.5em 0.5em 0.5em";a.style.zIndex=1E3;a.innerHTML="Loading ...";return a},updateProgress:function(a){var b="Loaded ";b+=a.total?(100*a.loaded/a.total).toFixed(0)+"%":(a.loaded/1E3).toFixed(2)+" KB";
-this.statusDomElement.innerHTML=b},extractUrlbase:function(a){a=a.split("/");a.pop();return a.length<1?".":a.join("/")},init_materials:function(a,b,c){a.materials=[];for(var e=0;e<b.length;++e)a.materials[e]=[THREE.Loader.prototype.createMaterial(b[e],c)]},hasNormals:function(a){var b,c,e=a.materials.length;for(c=0;c<e;c++)if(b=a.materials[c][0],b instanceof THREE.ShaderMaterial)return!0;return!1},createMaterial:function(a,b){function c(a){a=Math.log(a)/Math.LN2;return Math.floor(a)==a}function e(a,
-b){var e=new Image;e.onload=function(){if(!c(this.width)||!c(this.height)){var b=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),e=Math.pow(2,Math.round(Math.log(this.height)/Math.LN2));a.image.width=b;a.image.height=e;a.image.getContext("2d").drawImage(this,0,0,b,e)}else a.image=this;a.needsUpdate=!0};e.src=b}function g(a,c,f,h,g,k){var l=document.createElement("canvas");a[c]=new THREE.Texture(l);a[c].sourceFile=f;if(h){a[c].repeat.set(h[0],h[1]);if(h[0]!=1)a[c].wrapS=THREE.RepeatWrapping;
+THREE.Loader.prototype={constructor:THREE.Loader,addStatusElement:function(){var a=document.createElement("div");a.style.position="absolute";a.style.right="0px";a.style.top="0px";a.style.fontSize="0.8em";a.style.textAlign="left";a.style.background="rgba(0,0,0,0.25)";a.style.color="#fff";a.style.width="120px";a.style.padding="0.5em 0.5em 0.5em 0.5em";a.style.zIndex=1E3;a.innerHTML="Loading ...";return a},updateProgress:function(a){var b="Loaded ";b+=a.total?(100*a.loaded/a.total).toFixed(0)+"%":(a.loaded/
+1E3).toFixed(2)+" KB";this.statusDomElement.innerHTML=b},extractUrlbase:function(a){a=a.split("/");a.pop();return a.length<1?".":a.join("/")},init_materials:function(a,b,c){a.materials=[];for(var e=0;e<b.length;++e)a.materials[e]=[THREE.Loader.prototype.createMaterial(b[e],c)]},hasNormals:function(a){var b,c,e=a.materials.length;for(c=0;c<e;c++)if(b=a.materials[c][0],b instanceof THREE.ShaderMaterial)return!0;return!1},createMaterial:function(a,b){function c(a){a=Math.log(a)/Math.LN2;return Math.floor(a)==
+a}function e(a,b){var e=new Image;e.onload=function(){if(!c(this.width)||!c(this.height)){var b=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),e=Math.pow(2,Math.round(Math.log(this.height)/Math.LN2));a.image.width=b;a.image.height=e;a.image.getContext("2d").drawImage(this,0,0,b,e)}else a.image=this;a.needsUpdate=!0};e.src=b}function g(a,c,f,h,g,k){var l=document.createElement("canvas");a[c]=new THREE.Texture(l);a[c].sourceFile=f;if(h){a[c].repeat.set(h[0],h[1]);if(h[0]!=1)a[c].wrapS=THREE.RepeatWrapping;
 if(h[1]!=1)a[c].wrapT=THREE.RepeatWrapping}g&&a[c].offset.set(g[0],g[1]);if(k){h={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(h[k[0]]!==void 0)a[c].wrapS=h[k[0]];if(h[k[1]]!==void 0)a[c].wrapT=h[k[1]]}e(a[c],b+"/"+f)}function h(a){return(a[0]*255<<16)+(a[1]*255<<8)+a[2]*255}var f,k,l;k="MeshLambertMaterial";f={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:a.wireframe};a.shading&&(a.shading=="Phong"?k="MeshPhongMaterial":a.shading=="Basic"&&(k="MeshBasicMaterial"));
 if(a.blending)if(a.blending=="Additive")f.blending=THREE.AdditiveBlending;else if(a.blending=="Subtractive")f.blending=THREE.SubtractiveBlending;else if(a.blending=="Multiply")f.blending=THREE.MultiplyBlending;if(a.transparent!==void 0||a.opacity<1)f.transparent=a.transparent;if(a.depthTest!==void 0)f.depthTest=a.depthTest;if(a.vertexColors!==void 0)if(a.vertexColors=="face")f.vertexColors=THREE.FaceColors;else if(a.vertexColors)f.vertexColors=THREE.VertexColors;if(a.colorDiffuse)f.color=h(a.colorDiffuse);
 else if(a.DbgColor)f.color=a.DbgColor;if(a.colorSpecular)f.specular=h(a.colorSpecular);if(a.colorAmbient)f.ambient=h(a.colorAmbient);if(a.transparency)f.opacity=a.transparency;if(a.specularCoef)f.shininess=a.specularCoef;a.mapDiffuse&&b&&g(f,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap);a.mapLight&&b&&g(f,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap);a.mapNormal&&b&&g(f,"normalMap",a.mapNormal,a.mapNormalRepeat,a.mapNormalOffset,a.mapNormalWrap);
 a.mapSpecular&&b&&g(f,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){var m=THREE.ShaderUtils.lib.normal,n=THREE.UniformsUtils.clone(m.uniforms),o=f.color;k=f.specular;l=f.ambient;var t=f.shininess;n.tNormal.texture=f.normalMap;if(a.mapNormalFactor)n.uNormalScale.value=a.mapNormalFactor;if(f.map)n.tDiffuse.texture=f.map,n.enableDiffuse.value=!0;if(f.specularMap)n.tSpecular.texture=f.specularMap,n.enableSpecular.value=!0;if(f.lightMap)n.tAO.texture=
-f.lightMap,n.enableAO.value=!0;n.uDiffuseColor.value.setHex(o);n.uSpecularColor.value.setHex(k);n.uAmbientColor.value.setHex(l);n.uShininess.value=t;if(f.opacity)n.uOpacity.value=f.opacity;f=new THREE.ShaderMaterial({fragmentShader:m.fragmentShader,vertexShader:m.vertexShader,uniforms:n,lights:!0,fog:!0})}else f=new THREE[k](f);return f},constructor:THREE.Loader};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};THREE.BinaryLoader.prototype=new THREE.Loader;
-THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;THREE.BinaryLoader.prototype.supr=THREE.Loader.prototype;
+f.lightMap,n.enableAO.value=!0;n.uDiffuseColor.value.setHex(o);n.uSpecularColor.value.setHex(k);n.uAmbientColor.value.setHex(l);n.uShininess.value=t;if(f.opacity)n.uOpacity.value=f.opacity;f=new THREE.ShaderMaterial({fragmentShader:m.fragmentShader,vertexShader:m.vertexShader,uniforms:n,lights:!0,fog:!0})}else f=new THREE[k](f);return f}};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;
+THREE.BinaryLoader.prototype.supr=THREE.Loader.prototype;
 THREE.BinaryLoader.prototype.load=function(a){var b=a.model,c=a.callback,e=a.texture_path?a.texture_path:THREE.Loader.prototype.extractUrlbase(b),g=a.bin_path?a.bin_path:THREE.Loader.prototype.extractUrlbase(b),a=(new Date).getTime(),b=new Worker(b),h=this.showProgress?THREE.Loader.prototype.updateProgress:null;b.onmessage=function(a){THREE.BinaryLoader.prototype.loadAjaxBuffers(a.data.buffers,a.data.materials,c,g,e,h)};b.onerror=function(a){alert("worker.onerror: "+a.message+"\n"+a.data);a.preventDefault()};
 b.postMessage(a)};
 THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,b,c,e,g,h){var f=new XMLHttpRequest,k=e+"/"+a,l=0;f.onreadystatechange=function(){f.readyState==4?f.status==200||f.status==0?THREE.BinaryLoader.prototype.createBinModel(f.responseText,c,g,b):alert("Couldn't load ["+k+"] ["+f.status+"]"):f.readyState==3?h&&(l==0&&(l=f.getResponseHeader("Content-Length")),h({total:l,loaded:f.responseText.length})):f.readyState==2&&(l=f.getResponseHeader("Content-Length"))};f.open("GET",k,!0);f.overrideMimeType("text/plain; charset=x-user-defined");
 f.setRequestHeader("Content-Type","text/plain");f.send(null)};
 THREE.BinaryLoader.prototype.createBinModel=function(a,b,c,e){var g=function(c){function b(a,c){var e=n(a,c),f=n(a,c+1),g=n(a,c+2),h=n(a,c+3),k=(h<<1&255|g>>7)-127;e|=(g&127)<<16|f<<8;if(e==0&&k==-127)return 0;return(1-2*(h>>7))*(1+e*Math.pow(2,-23))*Math.pow(2,k)}function g(a,c){var b=n(a,c),e=n(a,c+1),f=n(a,c+2);return(n(a,c+3)<<24)+(f<<16)+(e<<8)+b}function l(a,c){var b=n(a,c);return(n(a,c+1)<<8)+b}function m(a,c){var b=n(a,c);return b>127?b-256:b}function n(a,c){return a.charCodeAt(c)&255}function o(c){var b,
-e,f;b=g(a,c);e=g(a,c+F);f=g(a,c+G);c=l(a,c+I);z.faces.push(new THREE.Face3(b,e,f,null,null,z.materials[c]))}function t(c){var b,e,f,h,m,n;b=g(a,c);e=g(a,c+F);f=g(a,c+G);h=l(a,c+I);m=g(a,c+H);n=g(a,c+M);c=g(a,c+B);h=z.materials[h];var o=A[n*3],p=A[n*3+1];n=A[n*3+2];var t=A[c*3],ia=A[c*3+1],c=A[c*3+2];z.faces.push(new THREE.Face3(b,e,f,[new THREE.Vector3(A[m*3],A[m*3+1],A[m*3+2]),new THREE.Vector3(o,p,n),new THREE.Vector3(t,ia,c)],null,h))}function p(c){var b,e,f,h;b=g(a,c);e=g(a,c+D);f=g(a,c+J);h=
-g(a,c+L);c=l(a,c+N);z.faces.push(new THREE.Face4(b,e,f,h,null,null,z.materials[c]))}function x(c){var b,e,f,h,m,n,o,p;b=g(a,c);e=g(a,c+D);f=g(a,c+J);h=g(a,c+L);m=l(a,c+N);n=g(a,c+K);o=g(a,c+P);p=g(a,c+E);c=g(a,c+S);m=z.materials[m];var t=A[o*3],ia=A[o*3+1];o=A[o*3+2];var la=A[p*3],ma=A[p*3+1];p=A[p*3+2];var v=A[c*3],u=A[c*3+1],c=A[c*3+2];z.faces.push(new THREE.Face4(b,e,f,h,[new THREE.Vector3(A[n*3],A[n*3+1],A[n*3+2]),new THREE.Vector3(t,ia,o),new THREE.Vector3(la,ma,p),new THREE.Vector3(v,u,c)],
+e,f;b=g(a,c);e=g(a,c+G);f=g(a,c+E);c=l(a,c+I);z.faces.push(new THREE.Face3(b,e,f,null,null,z.materials[c]))}function t(c){var b,e,f,h,m,n;b=g(a,c);e=g(a,c+G);f=g(a,c+E);h=l(a,c+I);m=g(a,c+H);n=g(a,c+M);c=g(a,c+B);h=z.materials[h];var o=A[n*3],p=A[n*3+1];n=A[n*3+2];var t=A[c*3],ia=A[c*3+1],c=A[c*3+2];z.faces.push(new THREE.Face3(b,e,f,[new THREE.Vector3(A[m*3],A[m*3+1],A[m*3+2]),new THREE.Vector3(o,p,n),new THREE.Vector3(t,ia,c)],null,h))}function p(c){var b,e,f,h;b=g(a,c);e=g(a,c+D);f=g(a,c+J);h=
+g(a,c+L);c=l(a,c+N);z.faces.push(new THREE.Face4(b,e,f,h,null,null,z.materials[c]))}function x(c){var b,e,f,h,m,n,o,p;b=g(a,c);e=g(a,c+D);f=g(a,c+J);h=g(a,c+L);m=l(a,c+N);n=g(a,c+K);o=g(a,c+P);p=g(a,c+F);c=g(a,c+S);m=z.materials[m];var t=A[o*3],ia=A[o*3+1];o=A[o*3+2];var la=A[p*3],ma=A[p*3+1];p=A[p*3+2];var v=A[c*3],u=A[c*3+1],c=A[c*3+2];z.faces.push(new THREE.Face4(b,e,f,h,[new THREE.Vector3(A[n*3],A[n*3+1],A[n*3+2]),new THREE.Vector3(t,ia,o),new THREE.Vector3(la,ma,p),new THREE.Vector3(v,u,c)],
 null,m))}function v(c){var b,e,f,h;b=g(a,c);e=g(a,c+O);f=g(a,c+U);c=C[b*2];h=C[b*2+1];b=C[e*2];var l=z.faceVertexUvs[0];e=C[e*2+1];var m=C[f*2];f=C[f*2+1];var n=[];n.push(new THREE.UV(c,h));n.push(new THREE.UV(b,e));n.push(new THREE.UV(m,f));l.push(n)}function u(c){var b,e,f,h,l,m;b=g(a,c);e=g(a,c+V);f=g(a,c+T);h=g(a,c+R);c=C[b*2];l=C[b*2+1];b=C[e*2];m=C[e*2+1];e=C[f*2];var n=z.faceVertexUvs[0];f=C[f*2+1];var o=C[h*2];h=C[h*2+1];var p=[];p.push(new THREE.UV(c,l));p.push(new THREE.UV(b,m));p.push(new THREE.UV(e,
-f));p.push(new THREE.UV(o,h));n.push(p)}var z=this,y=0,w,A=[],C=[],F,G,I,H,M,B,D,J,L,N,K,P,E,S,O,U,V,T,R,Q,Z,W,$,X,Y;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(z,e,c);w={signature:a.substr(y,8),header_bytes:n(a,y+8),vertex_coordinate_bytes:n(a,y+9),normal_coordinate_bytes:n(a,y+10),uv_coordinate_bytes:n(a,y+11),vertex_index_bytes:n(a,y+12),normal_index_bytes:n(a,y+13),uv_index_bytes:n(a,y+14),material_index_bytes:n(a,y+15),nvertices:g(a,y+16),nnormals:g(a,y+16+4),nuvs:g(a,y+16+
-8),ntri_flat:g(a,y+16+12),ntri_smooth:g(a,y+16+16),ntri_flat_uv:g(a,y+16+20),ntri_smooth_uv:g(a,y+16+24),nquad_flat:g(a,y+16+28),nquad_smooth:g(a,y+16+32),nquad_flat_uv:g(a,y+16+36),nquad_smooth_uv:g(a,y+16+40)};y+=w.header_bytes;F=w.vertex_index_bytes;G=w.vertex_index_bytes*2;I=w.vertex_index_bytes*3;H=w.vertex_index_bytes*3+w.material_index_bytes;M=w.vertex_index_bytes*3+w.material_index_bytes+w.normal_index_bytes;B=w.vertex_index_bytes*3+w.material_index_bytes+w.normal_index_bytes*2;D=w.vertex_index_bytes;
-J=w.vertex_index_bytes*2;L=w.vertex_index_bytes*3;N=w.vertex_index_bytes*4;K=w.vertex_index_bytes*4+w.material_index_bytes;P=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes;E=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes*2;S=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes*3;O=w.uv_index_bytes;U=w.uv_index_bytes*2;V=w.uv_index_bytes;T=w.uv_index_bytes*2;R=w.uv_index_bytes*3;c=w.vertex_index_bytes*3+w.material_index_bytes;Y=w.vertex_index_bytes*
+f));p.push(new THREE.UV(o,h));n.push(p)}var z=this,y=0,w,A=[],C=[],G,E,I,H,M,B,D,J,L,N,K,P,F,S,O,U,V,T,R,Q,Z,W,$,X,Y;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(z,e,c);w={signature:a.substr(y,8),header_bytes:n(a,y+8),vertex_coordinate_bytes:n(a,y+9),normal_coordinate_bytes:n(a,y+10),uv_coordinate_bytes:n(a,y+11),vertex_index_bytes:n(a,y+12),normal_index_bytes:n(a,y+13),uv_index_bytes:n(a,y+14),material_index_bytes:n(a,y+15),nvertices:g(a,y+16),nnormals:g(a,y+16+4),nuvs:g(a,y+16+
+8),ntri_flat:g(a,y+16+12),ntri_smooth:g(a,y+16+16),ntri_flat_uv:g(a,y+16+20),ntri_smooth_uv:g(a,y+16+24),nquad_flat:g(a,y+16+28),nquad_smooth:g(a,y+16+32),nquad_flat_uv:g(a,y+16+36),nquad_smooth_uv:g(a,y+16+40)};y+=w.header_bytes;G=w.vertex_index_bytes;E=w.vertex_index_bytes*2;I=w.vertex_index_bytes*3;H=w.vertex_index_bytes*3+w.material_index_bytes;M=w.vertex_index_bytes*3+w.material_index_bytes+w.normal_index_bytes;B=w.vertex_index_bytes*3+w.material_index_bytes+w.normal_index_bytes*2;D=w.vertex_index_bytes;
+J=w.vertex_index_bytes*2;L=w.vertex_index_bytes*3;N=w.vertex_index_bytes*4;K=w.vertex_index_bytes*4+w.material_index_bytes;P=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes;F=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes*2;S=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes*3;O=w.uv_index_bytes;U=w.uv_index_bytes*2;V=w.uv_index_bytes;T=w.uv_index_bytes*2;R=w.uv_index_bytes*3;c=w.vertex_index_bytes*3+w.material_index_bytes;Y=w.vertex_index_bytes*
 4+w.material_index_bytes;Q=w.ntri_flat*c;Z=w.ntri_smooth*(c+w.normal_index_bytes*3);W=w.ntri_flat_uv*(c+w.uv_index_bytes*3);$=w.ntri_smooth_uv*(c+w.normal_index_bytes*3+w.uv_index_bytes*3);X=w.nquad_flat*Y;c=w.nquad_smooth*(Y+w.normal_index_bytes*4);Y=w.nquad_flat_uv*(Y+w.uv_index_bytes*4);y+=function(c){for(var e,h,g,k=w.vertex_coordinate_bytes*3,l=c+w.nvertices*k;c<l;c+=k)e=b(a,c),h=b(a,c+w.vertex_coordinate_bytes),g=b(a,c+w.vertex_coordinate_bytes*2),z.vertices.push(new THREE.Vertex(new THREE.Vector3(e,
 h,g)));return w.nvertices*k}(y);y+=function(c){for(var b,e,f,h=w.normal_coordinate_bytes*3,g=c+w.nnormals*h;c<g;c+=h)b=m(a,c),e=m(a,c+w.normal_coordinate_bytes),f=m(a,c+w.normal_coordinate_bytes*2),A.push(b/127,e/127,f/127);return w.nnormals*h}(y);y+=function(c){for(var e,h,g=w.uv_coordinate_bytes*2,k=c+w.nuvs*g;c<k;c+=g)e=b(a,c),h=b(a,c+w.uv_coordinate_bytes),C.push(e,h);return w.nuvs*g}(y);Q=y+Q;Z=Q+Z;W=Z+W;$=W+$;X=$+X;c=X+c;Y=c+Y;(function(a){var c,b=w.vertex_index_bytes*3+w.material_index_bytes,
 e=b+w.uv_index_bytes*3,f=a+w.ntri_flat_uv*e;for(c=a;c<f;c+=e)o(c),v(c+b);return f-a})(Z);(function(a){var c,b=w.vertex_index_bytes*3+w.material_index_bytes+w.normal_index_bytes*3,e=b+w.uv_index_bytes*3,f=a+w.ntri_smooth_uv*e;for(c=a;c<f;c+=e)t(c),v(c+b);return f-a})(W);(function(a){var c,b=w.vertex_index_bytes*4+w.material_index_bytes,e=b+w.uv_index_bytes*4,f=a+w.nquad_flat_uv*e;for(c=a;c<f;c+=e)p(c),u(c+b);return f-a})(c);(function(a){var c,b=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes*
 4,e=b+w.uv_index_bytes*4,f=a+w.nquad_smooth_uv*e;for(c=a;c<f;c+=e)x(c),u(c+b);return f-a})(Y);(function(a){var c,b=w.vertex_index_bytes*3+w.material_index_bytes,e=a+w.ntri_flat*b;for(c=a;c<e;c+=b)o(c);return e-a})(y);(function(a){var c,b=w.vertex_index_bytes*3+w.material_index_bytes+w.normal_index_bytes*3,e=a+w.ntri_smooth*b;for(c=a;c<e;c+=b)t(c);return e-a})(Q);(function(a){var c,b=w.vertex_index_bytes*4+w.material_index_bytes,e=a+w.nquad_flat*b;for(c=a;c<e;c+=b)p(c);return e-a})($);(function(a){var c,
 b=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes*4,e=a+w.nquad_smooth*b;for(c=a;c<e;c+=b)x(c);return e-a})(X);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};g.prototype=new THREE.Geometry;g.prototype.constructor=g;b(new g(c))};
-THREE.ColladaLoader=function(){function a(a,c,b){for(var a=Q.evaluate(a,Q,E,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null),e={},f=a.iterateNext(),h=0;f;){f=(new c).parse(f);if(f.id.length==0)f.id=b+h++;e[f.id]=f;f=a.iterateNext()}return e}function b(){var a=1E6,c=-a,b=0,e;for(e in ca)for(var f=ca[e],h=0;h<f.sampler.length;h++){var g=f.sampler[h];g.create();a=Math.min(a,g.startTime);c=Math.max(c,g.endTime);b=Math.max(b,g.input.length)}return{start:a,end:c,frames:b}}function c(a,b,e,f){a.world=a.world||
+THREE.ColladaLoader=function(){function a(a,c,b){for(var a=Q.evaluate(a,Q,F,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null),e={},f=a.iterateNext(),h=0;f;){f=(new c).parse(f);if(f.id.length==0)f.id=b+h++;e[f.id]=f;f=a.iterateNext()}return e}function b(){var a=1E6,c=-a,b=0,e;for(e in ca)for(var f=ca[e],h=0;h<f.sampler.length;h++){var g=f.sampler[h];g.create();a=Math.min(a,g.startTime);c=Math.max(c,g.endTime);b=Math.max(b,g.input.length)}return{start:a,end:c,frames:b}}function c(a,b,e,f){a.world=a.world||
 new THREE.Matrix4;a.world.copy(a.matrix);if(a.channels&&a.channels.length){var h=a.channels[0].sampler.output[e];h instanceof THREE.Matrix4&&a.world.copy(h)}f&&a.world.multiply(f,a.world);b.push(a);for(f=0;f<a.nodes.length;f++)c(a.nodes[f],b,e,a.world)}function e(a,e,f){var h=aa[e.url];if(!h||!h.skin)console.log("could not find skin controller!");else if(!e.skeleton||!e.skeleton.length)console.log("could not find the skeleton for the skin!");else{var g=b(),e=W.getChildById(e.skeleton[0],!0)||W.getChildBySid(e.skeleton[0],
 !0),k,l,m,n,o=new THREE.Vector3,p;for(k=0;k<a.vertices.length;k++)h.skin.bindShapeMatrix.multiplyVector3(a.vertices[k].position);for(f=0;f<g.frames;f++){var t=[],v=[];for(k=0;k<a.vertices.length;k++)v.push(new THREE.Vertex(new THREE.Vector3));c(e,t,f);k=t;l=h.skin;for(n=0;n<k.length;n++){m=k[n];p=-1;for(var u=0;u<l.joints.length;u++)if(m.sid==l.joints[u]){p=u;break}if(p>=0){u=l.invBindMatrices[p];m.invBindMatrix=u;m.skinningMatrix=new THREE.Matrix4;m.skinningMatrix.multiply(m.world,u);m.weights=[];
 for(u=0;u<l.weights.length;u++)for(var x=0;x<l.weights[u].length;x++){var w=l.weights[u][x];w.joint==p&&m.weights.push(w)}}else throw"could not find joint!";}for(k=0;k<t.length;k++)for(l=0;l<t[k].weights.length;l++)m=t[k].weights[l],n=m.index,m=m.weight,p=a.vertices[n],n=v[n],o.x=p.position.x,o.y=p.position.y,o.z=p.position.z,t[k].skinningMatrix.multiplyVector3(o),n.position.x+=o.x*m,n.position.y+=o.y*m,n.position.z+=o.z*m;a.morphTargets.push({name:"target_"+f,vertices:v})}}}function g(a){var c=new THREE.Object3D,
@@ -214,26 +215,26 @@ p.material;n++}l=o||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.
 else{n=n.morph;for(p=0;p<n.targets.length;p++){var u=ba[n.targets[p]];if(u.mesh&&u.mesh.primitives&&u.mesh.primitives.length)u=u.mesh.primitives[0].geometry,u.vertices.length===m.vertices.length&&m.morphTargets.push({name:"target_1",vertices:u.vertices})}m.morphTargets.push({name:"target_Z",vertices:m.vertices})}l.morphTargets=!0;l=new THREE.Mesh(k,l);l.name="morph_"+da.length;da.push(l)}else l=new THREE.Mesh(k,l);c.add(l)}}for(h=0;h<a.nodes.length;h++)c.add(g(a.nodes[h],a));return c}function h(){this.init_from=
 this.id=""}function f(){this.type=this.name=this.id="";this.morph=this.skin=null}function k(){this.weights=this.targets=this.source=this.method=null}function l(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function m(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function n(){this.sid=this.name=this.id="";this.nodes=[];this.controllers=[];this.transforms=[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function o(){this.type=
 this.sid="";this.data=[];this.matrix=new THREE.Matrix4}function t(){this.url="";this.skeleton=[];this.instance_material=[]}function p(){this.target=this.symbol=""}function x(){this.url="";this.instance_material=[]}function v(){this.id="";this.mesh=null}function u(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function z(){}function y(){this.material="";this.count=0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function w(){this.source="";
-this.stride=this.count=0;this.params=[]}function A(){this.input={}}function C(){this.semantic="";this.offset=0;this.source="";this.set=0}function F(a){this.id=a;this.type=null}function G(){this.name=this.id="";this.instance_effect=null}function I(){this.color=new THREE.Color(0);this.color.setRGB(Math.random(),Math.random(),Math.random());this.color.a=1;this.texcoord=this.texture=null}function H(a,c){this.type=a;this.effect=c;this.material=null}function M(a){this.effect=a;this.format=this.init_from=
+this.stride=this.count=0;this.params=[]}function A(){this.input={}}function C(){this.semantic="";this.offset=0;this.source="";this.set=0}function G(a){this.id=a;this.type=null}function E(){this.name=this.id="";this.instance_effect=null}function I(){this.color=new THREE.Color(0);this.color.setRGB(Math.random(),Math.random(),Math.random());this.color.a=1;this.texcoord=this.texture=null}function H(a,c){this.type=a;this.effect=c;this.material=null}function M(a){this.effect=a;this.format=this.init_from=
 null}function B(a){this.effect=a;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=this.source=null}function D(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function J(){this.url=""}function L(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function N(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=this.dotSyntax=this.sid=null}function K(a){this.id="";this.animation=a;this.inputs=[];this.endTime=
-this.startTime=this.interpolation=this.output=this.input=null;this.duration=0}function P(a){var c=a.getAttribute("id");if(X[c]!=void 0)return X[c];X[c]=(new F(c)).parse(a);return X[c]}function E(a){if(a=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function S(a){for(var a=U(a).split(/\s+/),c=[],b=0;b<a.length;b++)c.push(parseFloat(a[b]));return c}function O(a){for(var a=U(a).split(/\s+/),c=[],b=0;b<a.length;b++)c.push(parseInt(a[b],10));return c}function U(a){return a.replace(/^\s+/,
+this.startTime=this.interpolation=this.output=this.input=null;this.duration=0}function P(a){var c=a.getAttribute("id");if(X[c]!=void 0)return X[c];X[c]=(new G(c)).parse(a);return X[c]}function F(a){if(a=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function S(a){for(var a=U(a).split(/\s+/),c=[],b=0;b<a.length;b++)c.push(parseFloat(a[b]));return c}function O(a){for(var a=U(a).split(/\s+/),c=[],b=0;b<a.length;b++)c.push(parseInt(a[b],10));return c}function U(a){return a.replace(/^\s+/,
 "").replace(/\s+$/,"")}function V(a,c,b){return a.hasAttribute(c)?parseInt(a.getAttribute(c),10):b}function T(a,c){if(a===void 0){for(var b="0.";b.length<c+2;)b+="0";return b}c=c||2;b=a.toString().split(".");for(b[1]=b.length>1?b[1].substr(0,c):"0";b[1].length<c;)b[1]+="0";return b.join(".")}function R(a,c){var b="";b+=T(a.x,c)+",";b+=T(a.y,c)+",";b+=T(a.z,c);return b}var Q=null,Z=null,W,$=null,X={},Y={},ca={},aa={},ba={},fa={},ga={},ha,ja,da,ea,ka=THREE.SmoothShading;h.prototype.parse=function(a){this.id=
 a.getAttribute("id");for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeName=="init_from")this.init_from=b.textContent}return this};f.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.type="none";for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];switch(b.nodeName){case "skin":this.skin=(new l).parse(b);this.type=b.nodeName;break;case "morph":this.morph=(new k).parse(b),this.type=b.nodeName}}return this};k.prototype.parse=function(a){var c=
-{},b=[],e;this.method=a.getAttribute("method");this.source=a.getAttribute("source").replace(/^#/,"");for(e=0;e<a.childNodes.length;e++){var f=a.childNodes[e];if(f.nodeType==1)switch(f.nodeName){case "source":f=(new F).parse(f);c[f.id]=f;break;case "targets":b=this.parseInputs(f);break;default:console.log(f.nodeName)}}for(e=0;e<b.length;e++)switch(a=b[e],f=c[a.source],a.semantic){case "MORPH_TARGET":this.targets=f.read();break;case "MORPH_WEIGHT":this.weights=f.read()}return this};k.prototype.parseInputs=
+{},b=[],e;this.method=a.getAttribute("method");this.source=a.getAttribute("source").replace(/^#/,"");for(e=0;e<a.childNodes.length;e++){var f=a.childNodes[e];if(f.nodeType==1)switch(f.nodeName){case "source":f=(new G).parse(f);c[f.id]=f;break;case "targets":b=this.parseInputs(f);break;default:console.log(f.nodeName)}}for(e=0;e<b.length;e++)switch(a=b[e],f=c[a.source],a.semantic){case "MORPH_TARGET":this.targets=f.read();break;case "MORPH_WEIGHT":this.weights=f.read()}return this};k.prototype.parseInputs=
 function(a){for(var c=[],b=0;b<a.childNodes.length;b++){var e=a.childNodes[b];if(e.nodeType==1)switch(e.nodeName){case "input":c.push((new C).parse(e))}}return c};l.prototype.parse=function(a){var c={},b,e;this.source=a.getAttribute("source").replace(/^#/,"");this.invBindMatrices=[];this.joints=[];this.weights=[];for(var f=0;f<a.childNodes.length;f++){var h=a.childNodes[f];if(h.nodeType==1)switch(h.nodeName){case "bind_shape_matrix":h=S(h.textContent);this.bindShapeMatrix=new THREE.Matrix4;this.bindShapeMatrix.set(h[0],
-h[1],h[2],h[3],h[4],h[5],h[6],h[7],h[8],h[9],h[10],h[11],h[12],h[13],h[14],h[15]);break;case "source":h=(new F).parse(h);c[h.id]=h;break;case "joints":b=h;break;case "vertex_weights":e=h;break;default:console.log(h.nodeName)}}this.parseJoints(b,c);this.parseWeights(e,c);return this};l.prototype.parseJoints=function(a,c){for(var b=0;b<a.childNodes.length;b++){var e=a.childNodes[b];if(e.nodeType==1)switch(e.nodeName){case "input":var e=(new C).parse(e),f=c[e.source];if(e.semantic=="JOINT")this.joints=
+h[1],h[2],h[3],h[4],h[5],h[6],h[7],h[8],h[9],h[10],h[11],h[12],h[13],h[14],h[15]);break;case "source":h=(new G).parse(h);c[h.id]=h;break;case "joints":b=h;break;case "vertex_weights":e=h;break;default:console.log(h.nodeName)}}this.parseJoints(b,c);this.parseWeights(e,c);return this};l.prototype.parseJoints=function(a,c){for(var b=0;b<a.childNodes.length;b++){var e=a.childNodes[b];if(e.nodeType==1)switch(e.nodeName){case "input":var e=(new C).parse(e),f=c[e.source];if(e.semantic=="JOINT")this.joints=
 f.read();else if(e.semantic=="INV_BIND_MATRIX")this.invBindMatrices=f.read()}}};l.prototype.parseWeights=function(a,c){for(var b,e,f=[],h=0;h<a.childNodes.length;h++){var g=a.childNodes[h];if(g.nodeType==1)switch(g.nodeName){case "input":f.push((new C).parse(g));break;case "v":b=O(g.textContent);break;case "vcount":e=O(g.textContent)}}for(h=g=0;h<e.length;h++){for(var k=e[h],l=[],m=0;m<k;m++){for(var n={},o=0;o<f.length;o++){var p=f[o],t=b[g+p.offset];switch(p.semantic){case "JOINT":n.joint=t;break;
 case "WEIGHT":n.weight=c[p.source].data[t]}}l.push(n);g+=f.length}for(m=0;m<l.length;m++)l[m].index=h;this.weights.push(l)}};m.prototype.getChildById=function(a,c){for(var b=0;b<this.nodes.length;b++){var e=this.nodes[b].getChildById(a,c);if(e)return e}return null};m.prototype.getChildBySid=function(a,c){for(var b=0;b<this.nodes.length;b++){var e=this.nodes[b].getChildBySid(a,c);if(e)return e}return null};m.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");
 this.nodes=[];for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeType==1)switch(b.nodeName){case "node":this.nodes.push((new n).parse(b))}}return this};n.prototype.getChannelForTransform=function(a){for(var c=0;c<this.channels.length;c++){var b=this.channels[c],e=b.target.split("/");e.shift();var f=e.shift(),h=f.indexOf(".")>=0,g=f.indexOf("(")>=0,k;if(h)e=f.split("."),f=e.shift(),e.shift();else if(g){k=f.split("(");f=k.shift();for(e=0;e<k.length;e++)k[e]=parseInt(k[e].replace(/\)/,
 ""))}if(f==a)return b.info={sid:f,dotSyntax:h,arrSyntax:g,arrIndices:k},b}return null};n.prototype.getChildById=function(a,c){if(this.id==a)return this;if(c)for(var b=0;b<this.nodes.length;b++){var e=this.nodes[b].getChildById(a,c);if(e)return e}return null};n.prototype.getChildBySid=function(a,c){if(this.sid==a)return this;if(c)for(var b=0;b<this.nodes.length;b++){var e=this.nodes[b].getChildBySid(a,c);if(e)return e}return null};n.prototype.getTransformBySid=function(a){for(var c=0;c<this.transforms.length;c++)if(this.transforms[c].sid==
 a)return this.transforms[c];return null};n.prototype.parse=function(a){var c;this.id=a.getAttribute("id");this.sid=a.getAttribute("sid");this.name=a.getAttribute("name");this.type=a.getAttribute("type");this.type=this.type=="JOINT"?this.type:"NODE";this.nodes=[];this.transforms=[];this.geometries=[];this.controllers=[];this.matrix=new THREE.Matrix4;for(var b=0;b<a.childNodes.length;b++)if(c=a.childNodes[b],c.nodeType==1)switch(c.nodeName){case "node":this.nodes.push((new n).parse(c));break;case "instance_camera":break;
-case "instance_controller":this.controllers.push((new t).parse(c));break;case "instance_geometry":this.geometries.push((new x).parse(c));break;case "instance_light":break;case "instance_node":c=c.getAttribute("url").replace(/^#/,"");(c=Q.evaluate(".//dae:library_nodes//dae:node[@id='"+c+"']",Q,E,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new n).parse(c));break;case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new o).parse(c));
+case "instance_controller":this.controllers.push((new t).parse(c));break;case "instance_geometry":this.geometries.push((new x).parse(c));break;case "instance_light":break;case "instance_node":c=c.getAttribute("url").replace(/^#/,"");(c=Q.evaluate(".//dae:library_nodes//dae:node[@id='"+c+"']",Q,F,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new n).parse(c));break;case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new o).parse(c));
 break;case "extra":break;default:console.log(c.nodeName)}a=[];b=1E6;c=-1E6;for(var e in ca)for(var f=ca[e],h=0;h<f.channel.length;h++){var g=f.channel[h],k=f.sampler[h];e=g.target.split("/")[0];if(e==this.id)k.create(),g.sampler=k,b=Math.min(b,k.startTime),c=Math.max(c,k.endTime),a.push(g)}if(a.length)this.startTime=b,this.endTime=c;if((this.channels=a)&&this.channels.length){e=1E7;for(i=0;i<this.channels.length;i++){a=this.channels[i].sampler;for(b=0;b<a.input.length-1;b++)e=Math.min(e,a.input[b+
 1]-a.input[b])}b=[];for(a=this.startTime;a<this.endTime;a+=e){c=a;for(var f={},l=h=void 0,h=0;h<this.channels.length;h++)l=this.channels[h],f[l.sid]=l;g=new THREE.Matrix4;for(h=0;h<this.transforms.length;h++)if(k=this.transforms[h],l=f[k.sid],l!==void 0){for(var m=l.sampler,p,l=0;l<m.input.length-1;l++)if(m.input[l+1]>c){p=m.output[l];break}g=p!==void 0?p instanceof THREE.Matrix4?g.multiply(g,p):g.multiply(g,k.matrix):g.multiply(g,k.matrix)}else g=g.multiply(g,k.matrix);c=g;b.push({time:a,pos:[c.n14,
 c.n24,c.n34],rotq:[0,0,0,1],scl:[1,1,1]})}this.keys=b}this.updateMatrix();return this};n.prototype.updateMatrix=function(){this.matrix.identity();for(var a=0;a<this.transforms.length;a++)this.matrix.multiply(this.matrix,this.transforms[a].matrix)};o.prototype.parse=function(a){this.sid=a.getAttribute("sid");this.type=a.nodeName;this.data=S(a.textContent);this.updateMatrix();return this};o.prototype.updateMatrix=function(){var a=0;this.matrix.identity();switch(this.type){case "matrix":this.matrix.set(this.data[0],
 this.data[1],this.data[2],this.data[3],this.data[4],this.data[5],this.data[6],this.data[7],this.data[8],this.data[9],this.data[10],this.data[11],this.data[12],this.data[13],this.data[14],this.data[15]);break;case "translate":this.matrix.setTranslation(this.data[0],this.data[1],this.data[2]);break;case "rotate":a=this.data[3]*(Math.PI/180);this.matrix.setRotationAxis(new THREE.Vector3(this.data[0],this.data[1],this.data[2]),a);break;case "scale":this.matrix.setScale(this.data[0],this.data[1],this.data[2])}return this.matrix};
-t.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.skeleton=[];this.instance_material=[];for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeType==1)switch(b.nodeName){case "skeleton":this.skeleton.push(b.textContent.replace(/^#/,""));break;case "bind_material":if(b=Q.evaluate(".//dae:instance_material",b,E,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(var e=b.iterateNext();e;)this.instance_material.push((new p).parse(e)),e=b.iterateNext()}}return this};
-p.prototype.parse=function(a){this.symbol=a.getAttribute("symbol");this.target=a.getAttribute("target").replace(/^#/,"");return this};x.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.instance_material=[];for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeType==1&&b.nodeName=="bind_material"){if(a=Q.evaluate(".//dae:instance_material",b,E,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(c=a.iterateNext();c;)this.instance_material.push((new p).parse(c)),
+t.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.skeleton=[];this.instance_material=[];for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeType==1)switch(b.nodeName){case "skeleton":this.skeleton.push(b.textContent.replace(/^#/,""));break;case "bind_material":if(b=Q.evaluate(".//dae:instance_material",b,F,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(var e=b.iterateNext();e;)this.instance_material.push((new p).parse(e)),e=b.iterateNext()}}return this};
+p.prototype.parse=function(a){this.symbol=a.getAttribute("symbol");this.target=a.getAttribute("target").replace(/^#/,"");return this};x.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.instance_material=[];for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeType==1&&b.nodeName=="bind_material"){if(a=Q.evaluate(".//dae:instance_material",b,F,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(c=a.iterateNext();c;)this.instance_material.push((new p).parse(c)),
 c=a.iterateNext();break}}return this};v.prototype.parse=function(a){this.id=a.getAttribute("id");for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];switch(b.nodeName){case "mesh":this.mesh=(new u(this)).parse(b)}}return this};u.prototype.parse=function(a){function c(a,b){var e=R(a.position);f[e]===void 0&&(f[e]={v:a,index:b});return f[e]}this.primitives=[];var b;for(b=0;b<a.childNodes.length;b++){var e=a.childNodes[b];switch(e.nodeName){case "source":P(e);break;case "vertices":this.vertices=
 (new A).parse(e);break;case "triangles":this.primitives.push((new y).parse(e));break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new z).parse(e))}}var f={};this.geometry3js=new THREE.Geometry;e=X[this.vertices.input.POSITION.source].data;for(a=b=0;b<e.length;b+=3,a++){var h=new THREE.Vertex(new THREE.Vector3(e[b],e[b+1],e[b+2]));c(h,a);this.geometry3js.vertices.push(h)}for(b=0;b<this.primitives.length;b++)primitive=this.primitives[b],primitive.setVertices(this.vertices),
 this.handlePrimitive(primitive,this.geometry3js,f);this.geometry3js.computeCentroids();this.geometry3js.computeFaceNormals();this.geometry3js.computeVertexNormals();this.geometry3js.computeBoundingBox();return this};u.prototype.handlePrimitive=function(a,c,b){var e=0,f,h,g=a.p,k=a.inputs,l,m,n,o=0,p=3,t=[];for(f=0;f<k.length;f++)switch(l=k[f],l.semantic){case "TEXCOORD":t.push(l.set)}for(;e<g.length;){var u=[],v=[],x={},w=[];a.vcount&&(p=a.vcount[o++]);for(f=0;f<p;f++)for(h=0;h<k.length;h++)switch(l=
@@ -241,58 +242,58 @@ k[h],source=X[l.source],m=g[e+f*k.length+l.offset],numParams=source.accessor.par
 3?y=new THREE.Face3(u[0],u[1],u[2],[v[0],v[1],v[2]],w.length?w:new THREE.Color):p==4&&(y=new THREE.Face4(u[0],u[1],u[2],u[3],[v[0],v[1],v[2],v[3]],w.length?w:new THREE.Color));y.daeMaterial=a.material;c.faces.push(y);for(h=0;h<t.length;h++)f=x[t[h]],c.faceVertexUvs[h].push([f[0],f[1],f[2]]);e+=k.length*p}};z.prototype=new y;z.prototype.constructor=z;y.prototype.setVertices=function(a){for(var c=0;c<this.inputs.length;c++)if(this.inputs[c].source==a.id)this.inputs[c].source=a.input.POSITION.source};
 y.prototype.parse=function(a){this.inputs=[];this.material=a.getAttribute("material");this.count=V(a,"count",0);for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];switch(b.nodeName){case "input":this.inputs.push((new C).parse(a.childNodes[c]));break;case "vcount":this.vcount=O(b.textContent);break;case "p":this.p=O(b.textContent)}}return this};w.prototype.parse=function(a){this.params=[];this.source=a.getAttribute("source");this.count=V(a,"count",0);this.stride=V(a,"stride",0);for(var c=
 0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeName=="param"){var e={};e.name=b.getAttribute("name");e.type=b.getAttribute("type");this.params.push(e)}}return this};A.prototype.parse=function(a){this.id=a.getAttribute("id");for(var c=0;c<a.childNodes.length;c++)a.childNodes[c].nodeName=="input"&&(input=(new C).parse(a.childNodes[c]),this.input[input.semantic]=input);return this};C.prototype.parse=function(a){this.semantic=a.getAttribute("semantic");this.source=a.getAttribute("source").replace(/^#/,
-"");this.set=V(a,"set",-1);this.offset=V(a,"offset",0);if(this.semantic=="TEXCOORD"&&this.set<0)this.set=0;return this};F.prototype.parse=function(a){this.id=a.getAttribute("id");for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];switch(b.nodeName){case "bool_array":for(var e=U(b.textContent).split(/\s+/),f=[],h=0;h<e.length;h++)f.push(e[h]=="true"||e[h]=="1"?!0:!1);this.data=f;this.type=b.nodeName;break;case "float_array":this.data=S(b.textContent);this.type=b.nodeName;break;case "int_array":this.data=
-O(b.textContent);this.type=b.nodeName;break;case "IDREF_array":case "Name_array":this.data=U(b.textContent).split(/\s+/);this.type=b.nodeName;break;case "technique_common":for(e=0;e<b.childNodes.length;e++)if(b.childNodes[e].nodeName=="accessor"){this.accessor=(new w).parse(b.childNodes[e]);break}}}return this};F.prototype.read=function(){var a=[],c=this.accessor.params[0];switch(c.type){case "IDREF":case "Name":case "name":case "float":return this.data;case "float4x4":for(c=0;c<this.data.length;c+=
-16){var b=this.data.slice(c,c+16),e=new THREE.Matrix4;e.set(b[0],b[1],b[2],b[3],b[4],b[5],b[6],b[7],b[8],b[9],b[10],b[11],b[12],b[13],b[14],b[15]);a.push(e)}break;default:console.log("Dae::Source:read dont know how to read "+c.type)}return a};G.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");for(var c=0;c<a.childNodes.length;c++)if(a.childNodes[c].nodeName=="instance_effect"){this.instance_effect=(new J).parse(a.childNodes[c]);break}return this};I.prototype.isColor=
+"");this.set=V(a,"set",-1);this.offset=V(a,"offset",0);if(this.semantic=="TEXCOORD"&&this.set<0)this.set=0;return this};G.prototype.parse=function(a){this.id=a.getAttribute("id");for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];switch(b.nodeName){case "bool_array":for(var e=U(b.textContent).split(/\s+/),f=[],h=0;h<e.length;h++)f.push(e[h]=="true"||e[h]=="1"?!0:!1);this.data=f;this.type=b.nodeName;break;case "float_array":this.data=S(b.textContent);this.type=b.nodeName;break;case "int_array":this.data=
+O(b.textContent);this.type=b.nodeName;break;case "IDREF_array":case "Name_array":this.data=U(b.textContent).split(/\s+/);this.type=b.nodeName;break;case "technique_common":for(e=0;e<b.childNodes.length;e++)if(b.childNodes[e].nodeName=="accessor"){this.accessor=(new w).parse(b.childNodes[e]);break}}}return this};G.prototype.read=function(){var a=[],c=this.accessor.params[0];switch(c.type){case "IDREF":case "Name":case "name":case "float":return this.data;case "float4x4":for(c=0;c<this.data.length;c+=
+16){var b=this.data.slice(c,c+16),e=new THREE.Matrix4;e.set(b[0],b[1],b[2],b[3],b[4],b[5],b[6],b[7],b[8],b[9],b[10],b[11],b[12],b[13],b[14],b[15]);a.push(e)}break;default:console.log("Dae::Source:read dont know how to read "+c.type)}return a};E.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");for(var c=0;c<a.childNodes.length;c++)if(a.childNodes[c].nodeName=="instance_effect"){this.instance_effect=(new J).parse(a.childNodes[c]);break}return this};I.prototype.isColor=
 function(){return this.texture==null};I.prototype.isTexture=function(){return this.texture!=null};I.prototype.parse=function(a){for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeType==1)switch(b.nodeName){case "color":b=S(b.textContent);this.color=new THREE.Color(0);this.color.setRGB(b[0],b[1],b[2]);this.color.a=b[3];break;case "texture":this.texture=b.getAttribute("texture"),this.texcoord=b.getAttribute("texcoord")}}return this};H.prototype.parse=function(a){for(var c=0;c<a.childNodes.length;c++){var b=
-a.childNodes[c];if(b.nodeType==1)switch(b.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[b.nodeName]=(new I).parse(b);break;case "shininess":case "reflectivity":case "transparency":var e;e=Q.evaluate(".//dae:float",b,E,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);for(var f=e.iterateNext(),h=[];f;)h.push(f),f=e.iterateNext();e=h;e.length>0&&(this[b.nodeName]=parseFloat(e[0].textContent))}}this.create();return this};H.prototype.create=function(){var a=
+a.childNodes[c];if(b.nodeType==1)switch(b.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[b.nodeName]=(new I).parse(b);break;case "shininess":case "reflectivity":case "transparency":var e;e=Q.evaluate(".//dae:float",b,F,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);for(var f=e.iterateNext(),h=[];f;)h.push(f),f=e.iterateNext();e=h;e.length>0&&(this[b.nodeName]=parseFloat(e[0].textContent))}}this.create();return this};H.prototype.create=function(){var a=
 {},c=this.transparency!==void 0&&this.transparency<1,b;for(b in this)switch(b){case "ambient":case "emission":case "diffuse":case "specular":var e=this[b];if(e instanceof I)if(e.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid&&(e=Y[this.effect.surface.init_from]))a.map=THREE.ImageUtils.loadTexture(ja+e.init_from),a.map.wrapS=THREE.RepeatWrapping,a.map.wrapT=THREE.RepeatWrapping,a.map.repeat.x=1,a.map.repeat.y=-1}else b=="diffuse"?a.color=
 e.color.getHex():c||(a[b]=e.color.getHex());break;case "shininess":case "reflectivity":a[b]=this[b];break;case "transparency":if(c)a.transparent=!0,a.opacity=this[b],c=!0}a.shading=ka;return this.material=new THREE.MeshLambertMaterial(a)};M.prototype.parse=function(a){for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeType==1)switch(b.nodeName){case "init_from":this.init_from=b.textContent;break;case "format":this.format=b.textContent;break;default:console.log("unhandled Surface prop: "+
 b.nodeName)}}return this};B.prototype.parse=function(a){for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeType==1)switch(b.nodeName){case "source":this.source=b.textContent;break;case "minfilter":this.minfilter=b.textContent;break;case "magfilter":this.magfilter=b.textContent;break;case "mipfilter":this.mipfilter=b.textContent;break;case "wrap_s":this.wrap_s=b.textContent;break;case "wrap_t":this.wrap_t=b.textContent;break;default:console.log("unhandled Sampler2D prop: "+b.nodeName)}}return this};
 D.prototype.create=function(){if(this.shader==null)return null};D.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.shader=null;for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeType==1)switch(b.nodeName){case "profile_COMMON":this.parseTechnique(this.parseProfileCOMMON(b))}}return this};D.prototype.parseNewparam=function(a){for(var c=a.getAttribute("sid"),b=0;b<a.childNodes.length;b++){var e=a.childNodes[b];if(e.nodeType==1)switch(e.nodeName){case "surface":this.surface=
 (new M(this)).parse(e);this.surface.sid=c;break;case "sampler2D":this.sampler=(new B(this)).parse(e);this.sampler.sid=c;break;case "extra":break;default:console.log(e.nodeName)}}};D.prototype.parseProfileCOMMON=function(a){for(var c,b=0;b<a.childNodes.length;b++){var e=a.childNodes[b];if(e.nodeType==1)switch(e.nodeName){case "profile_COMMON":this.parseProfileCOMMON(e);break;case "technique":c=e;break;case "newparam":this.parseNewparam(e);break;case "extra":break;default:console.log(e.nodeName)}}return c};
 D.prototype.parseTechnique=function(a){for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeType==1)switch(b.nodeName){case "lambert":case "blinn":case "phong":this.shader=(new H(b.nodeName,this)).parse(b)}}};J.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");return this};L.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.source={};for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeType==1)switch(b.nodeName){case "source":b=
-(new F).parse(b);this.source[b.id]=b;break;case "sampler":this.sampler.push((new K(this)).parse(b));break;case "channel":this.channel.push((new N(this)).parse(b))}}return this};N.prototype.parse=function(a){this.source=a.getAttribute("source").replace(/^#/,"");this.target=a.getAttribute("target");var c=this.target.split("/");c.shift();var a=c.shift(),b=a.indexOf(".")>=0,e=a.indexOf("(")>=0,f,h;if(b)c=a.split("."),a=c.shift(),h=c.shift();else if(e){f=a.split("(");a=f.shift();for(c=0;c<f.length;c++)f[c]=
+(new G).parse(b);this.source[b.id]=b;break;case "sampler":this.sampler.push((new K(this)).parse(b));break;case "channel":this.channel.push((new N(this)).parse(b))}}return this};N.prototype.parse=function(a){this.source=a.getAttribute("source").replace(/^#/,"");this.target=a.getAttribute("target");var c=this.target.split("/");c.shift();var a=c.shift(),b=a.indexOf(".")>=0,e=a.indexOf("(")>=0,f,h;if(b)c=a.split("."),a=c.shift(),h=c.shift();else if(e){f=a.split("(");a=f.shift();for(c=0;c<f.length;c++)f[c]=
 parseInt(f[c].replace(/\)/,""))}this.sid=a;this.dotSyntax=b;this.arrSyntax=e;this.arrIndices=f;this.member=h;return this};K.prototype.parse=function(a){this.id=a.getAttribute("id");this.inputs=[];for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeType==1)switch(b.nodeName){case "input":this.inputs.push((new C).parse(b))}}return this};K.prototype.create=function(){for(var a=0;a<this.inputs.length;a++){var c=this.inputs[a],b=this.animation.source[c.source];switch(c.semantic){case "INPUT":this.input=
 b.read();break;case "OUTPUT":this.output=b.read();break;case "INTERPOLATION":this.interpolation=b.read();break;case "IN_TANGENT":break;case "OUT_TANGENT":break;default:console.log(c.semantic)}}this.duration=this.endTime=this.startTime=0;if(this.input.length){this.startTime=1E8;this.endTime=-1E8;for(a=0;a<this.input.length;a++)this.startTime=Math.min(this.startTime,this.input[a]),this.endTime=Math.max(this.endTime,this.input[a]);this.duration=this.endTime-this.startTime}};return{load:function(c,e){if(document.implementation&&
 document.implementation.createDocument){document.implementation.createDocument("http://www.collada.org/2005/11/COLLADASchema","COLLADA",null);c+="?rnd="+Math.random();var k=new XMLHttpRequest;k.overrideMimeType&&k.overrideMimeType("text/xml");k.onreadystatechange=function(){if(k.readyState==4&&(k.status==0||k.status==200)){$=e;var l,n=c;Q=k.responseXML;l=$;n!==void 0&&(n=n.split("/"),n.pop(),ja=n.join("/")+"/");Y=a("//dae:library_images/dae:image",h,"image");fa=a("//dae:library_materials/dae:material",
-G,"material");ga=a("//dae:library_effects/dae:effect",D,"effect");ba=a("//dae:library_geometries/dae:geometry",v,"geometry");aa=a("//dae:library_controllers/dae:controller",f,"controller");ca=a("//dae:library_animations/dae:animation",L,"animation");ha=a(".//dae:library_visual_scenes/dae:visual_scene",m,"visual_scene");da=[];ea=[];(n=Q.evaluate(".//dae:scene/dae:instance_visual_scene",Q,E,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(n=n.getAttribute("url").replace(/^#/,""),W=ha[n]):
+E,"material");ga=a("//dae:library_effects/dae:effect",D,"effect");ba=a("//dae:library_geometries/dae:geometry",v,"geometry");aa=a("//dae:library_controllers/dae:controller",f,"controller");ca=a("//dae:library_animations/dae:animation",L,"animation");ha=a(".//dae:library_visual_scenes/dae:visual_scene",m,"visual_scene");da=[];ea=[];(n=Q.evaluate(".//dae:scene/dae:instance_visual_scene",Q,F,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(n=n.getAttribute("url").replace(/^#/,""),W=ha[n]):
 W=null;Z=new THREE.Object3D;for(n=0;n<W.nodes.length;n++)Z.add(g(W.nodes[n]));b();for(var o in ca);o={scene:Z,morphs:da,skins:ea,dae:{images:Y,materials:fa,effects:ga,geometries:ba,controllers:aa,animations:ca,visualScenes:ha,scene:W}};l&&l(o)}};k.open("GET",c,!0);k.send(null)}else alert("Don't know how to parse XML!")},setPreferredShading:function(a){ka=a},applySkin:e,geometries:ba}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=new THREE.Loader;
 THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;THREE.JSONLoader.prototype.load=function(a){var b=this,c=a.model,e=a.callback,g=a.texture_path?a.texture_path:this.extractUrlbase(c),a=new Worker(c);a.onmessage=function(a){b.createModel(a.data,e,g);b.onLoadComplete()};this.onLoadStart();a.postMessage((new Date).getTime())};
-THREE.JSONLoader.prototype.createModel=function(a,b,c){var e=new THREE.Geometry,g=a.scale!==void 0?1/a.scale:1;this.init_materials(e,a.materials,c);(function(c){if(a.version===void 0||a.version!=2)console.error("Deprecated file format.");else{var b,g,l,m,n,o,t,p,x,v,u,z,y,w,A=a.faces;o=a.vertices;var C=a.normals,F=a.colors,G=0;for(b=0;b<a.uvs.length;b++)a.uvs[b].length&&G++;for(b=0;b<G;b++)e.faceUvs[b]=[],e.faceVertexUvs[b]=[];m=0;for(n=o.length;m<n;)t=new THREE.Vertex,t.position.x=o[m++]*c,t.position.y=
-o[m++]*c,t.position.z=o[m++]*c,e.vertices.push(t);m=0;for(n=A.length;m<n;){c=A[m++];o=c&1;l=c&2;b=c&4;g=c&8;p=c&16;t=c&32;v=c&64;c&=128;o?(u=new THREE.Face4,u.a=A[m++],u.b=A[m++],u.c=A[m++],u.d=A[m++],o=4):(u=new THREE.Face3,u.a=A[m++],u.b=A[m++],u.c=A[m++],o=3);if(l)l=A[m++],u.materials=e.materials[l];l=e.faces.length;if(b)for(b=0;b<G;b++)z=a.uvs[b],x=A[m++],w=z[x*2],x=z[x*2+1],e.faceUvs[b][l]=new THREE.UV(w,x);if(g)for(b=0;b<G;b++){z=a.uvs[b];y=[];for(g=0;g<o;g++)x=A[m++],w=z[x*2],x=z[x*2+1],y[g]=
-new THREE.UV(w,x);e.faceVertexUvs[b][l]=y}if(p)p=A[m++]*3,g=new THREE.Vector3,g.x=C[p++],g.y=C[p++],g.z=C[p],u.normal=g;if(t)for(b=0;b<o;b++)p=A[m++]*3,g=new THREE.Vector3,g.x=C[p++],g.y=C[p++],g.z=C[p],u.vertexNormals.push(g);if(v)t=A[m++],t=new THREE.Color(F[t]),u.color=t;if(c)for(b=0;b<o;b++)t=A[m++],t=new THREE.Color(F[t]),u.vertexColors.push(t);e.faces.push(u)}}})(g);(function(){var c,b,g,l;if(a.skinWeights){c=0;for(b=a.skinWeights.length;c<b;c+=2)g=a.skinWeights[c],l=a.skinWeights[c+1],e.skinWeights.push(new THREE.Vector4(g,
+THREE.JSONLoader.prototype.createModel=function(a,b,c){var e=new THREE.Geometry,g=a.scale!==void 0?1/a.scale:1;this.init_materials(e,a.materials,c);(function(c){if(a.version===void 0||a.version!=2)console.error("Deprecated file format.");else{var b,g,l,m,n,o,t,p,x,v,u,z,y,w,A=a.faces;o=a.vertices;var C=a.normals,G=a.colors,E=0;for(b=0;b<a.uvs.length;b++)a.uvs[b].length&&E++;for(b=0;b<E;b++)e.faceUvs[b]=[],e.faceVertexUvs[b]=[];m=0;for(n=o.length;m<n;)t=new THREE.Vertex,t.position.x=o[m++]*c,t.position.y=
+o[m++]*c,t.position.z=o[m++]*c,e.vertices.push(t);m=0;for(n=A.length;m<n;){c=A[m++];o=c&1;l=c&2;b=c&4;g=c&8;p=c&16;t=c&32;v=c&64;c&=128;o?(u=new THREE.Face4,u.a=A[m++],u.b=A[m++],u.c=A[m++],u.d=A[m++],o=4):(u=new THREE.Face3,u.a=A[m++],u.b=A[m++],u.c=A[m++],o=3);if(l)l=A[m++],u.materials=e.materials[l];l=e.faces.length;if(b)for(b=0;b<E;b++)z=a.uvs[b],x=A[m++],w=z[x*2],x=z[x*2+1],e.faceUvs[b][l]=new THREE.UV(w,x);if(g)for(b=0;b<E;b++){z=a.uvs[b];y=[];for(g=0;g<o;g++)x=A[m++],w=z[x*2],x=z[x*2+1],y[g]=
+new THREE.UV(w,x);e.faceVertexUvs[b][l]=y}if(p)p=A[m++]*3,g=new THREE.Vector3,g.x=C[p++],g.y=C[p++],g.z=C[p],u.normal=g;if(t)for(b=0;b<o;b++)p=A[m++]*3,g=new THREE.Vector3,g.x=C[p++],g.y=C[p++],g.z=C[p],u.vertexNormals.push(g);if(v)t=A[m++],t=new THREE.Color(G[t]),u.color=t;if(c)for(b=0;b<o;b++)t=A[m++],t=new THREE.Color(G[t]),u.vertexColors.push(t);e.faces.push(u)}}})(g);(function(){var c,b,g,l;if(a.skinWeights){c=0;for(b=a.skinWeights.length;c<b;c+=2)g=a.skinWeights[c],l=a.skinWeights[c+1],e.skinWeights.push(new THREE.Vector4(g,
 l,0,0))}if(a.skinIndices){c=0;for(b=a.skinIndices.length;c<b;c+=2)g=a.skinIndices[c],l=a.skinIndices[c+1],e.skinIndices.push(new THREE.Vector4(g,l,0,0))}e.bones=a.bones;e.animation=a.animation})();(function(c){if(a.morphTargets!==void 0){var b,g,l,m,n,o,t,p,x;b=0;for(g=a.morphTargets.length;b<g;b++){e.morphTargets[b]={};e.morphTargets[b].name=a.morphTargets[b].name;e.morphTargets[b].vertices=[];p=e.morphTargets[b].vertices;x=a.morphTargets[b].vertices;l=0;for(m=x.length;l<m;l+=3)n=x[l]*c,o=x[l+1]*
-c,t=x[l+2]*c,p.push(new THREE.Vertex(new THREE.Vector3(n,o,t)))}}if(a.morphColors!==void 0){b=0;for(g=a.morphColors.length;b<g;b++){e.morphColors[b]={};e.morphColors[b].name=a.morphColors[b].name;e.morphColors[b].colors=[];m=e.morphColors[b].colors;n=a.morphColors[b].colors;c=0;for(l=n.length;c<l;c+=3)o=new THREE.Color(16755200),o.setRGB(n[c],n[c+1],n[c+2]),m.push(o)}}})(g);(function(){if(a.edges!==void 0){var c,b,g;for(c=0;c<a.edges.length;c+=2)b=a.edges[c],g=a.edges[c+1],e.edges.push(new THREE.Edge(e.vertices[b],
-e.vertices[g],b,g))}})();e.computeCentroids();e.computeFaceNormals();this.hasNormals(e)&&e.computeTangents();b(e)};THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};
-THREE.SceneLoader.prototype={load:function(a,b){var c=this,e=new Worker(a);e.postMessage(0);var g=THREE.Loader.prototype.extractUrlbase(a);e.onmessage=function(a){function e(a,c){return c=="relativeToHTML"?a:g+"/"+a}function k(){for(p in D.objects)if(!E.objects[p])if(y=D.objects[p],y.geometry!==void 0){if(F=E.geometries[y.geometry]){var a=!1;M=[];for(O=0;O<y.materials.length;O++)M[O]=E.materials[y.materials[O]],a=M[O]instanceof THREE.ShaderMaterial;a&&F.computeTangents();w=y.position;r=y.rotation;
-q=y.quaternion;s=y.scale;q=0;M.length==0&&(M[0]=new THREE.MeshFaceMaterial);M.length>1&&(M=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(F,M);object.name=p;object.position.set(w[0],w[1],w[2]);q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=y.visible;E.scene.add(object);E.objects[p]=object;y.meshCollider&&(a=THREE.CollisionUtils.MeshColliderWBox(object),E.scene.collisions.colliders.push(a));
-if(y.castsShadow)a=new THREE.ShadowVolume(F),E.scene.add(a),a.position=object.position,a.rotation=object.rotation,a.scale=object.scale;y.trigger&&y.trigger.toLowerCase()!="none"&&(a={type:y.trigger,object:y},E.triggers[object.name]=a)}}else w=y.position,r=y.rotation,q=y.quaternion,s=y.scale,q=0,object=new THREE.Object3D,object.name=p,object.position.set(w[0],w[1],w[2]),q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]),object.scale.set(s[0],
-s[1],s[2]),object.visible=y.visible!==void 0?y.visible:!1,E.scene.add(object),E.objects[p]=object,E.empties[p]=object,y.trigger&&y.trigger.toLowerCase()!="none"&&(a={type:y.trigger,object:y},E.triggers[object.name]=a)}function l(a){return function(b){E.geometries[a]=b;k();L-=1;c.onLoadComplete();n()}}function m(a){return function(c){E.geometries[a]=c}}function n(){c.callbackProgress({totalModels:K,totalTextures:P,loadedModels:K-L,loadedTextures:P-N},E);c.onLoadProgress();L==0&&N==0&&b(E)}var o,t,
-p,x,v,u,z,y,w,A,C,F,G,I,H,M,B,D,J,L,N,K,P,E;D=a.data;H=new THREE.BinaryLoader;J=new THREE.JSONLoader;N=L=0;E={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};a=!1;for(p in D.objects)if(y=D.objects[p],y.meshCollider){a=!0;break}if(a)E.scene.collisions=new THREE.CollisionSystem;if(D.transform){a=D.transform.position;A=D.transform.rotation;var S=D.transform.scale;a&&E.scene.position.set(a[0],a[1],a[2]);A&&E.scene.rotation.set(A[0],
-A[1],A[2]);S&&E.scene.scale.set(S[0],S[1],S[2]);(a||A||S)&&E.scene.updateMatrix()}a=function(){N-=1;n();c.onLoadComplete()};for(v in D.cameras){A=D.cameras[v];if(A.type=="perspective")G=new THREE.Camera(A.fov,A.aspect,A.near,A.far);else if(A.type=="ortho")G=new THREE.Camera,G.projectionMatrix=THREE.Matrix4.makeOrtho(A.left,A.right,A.top,A.bottom,A.near,A.far);w=A.position;A=A.target;G.position.set(w[0],w[1],w[2]);G.target.position.set(A[0],A[1],A[2]);E.cameras[v]=G}for(x in D.lights)v=D.lights[x],
-G=v.color!==void 0?v.color:16777215,A=v.intensity!==void 0?v.intensity:1,v.type=="directional"?(w=v.direction,B=new THREE.DirectionalLight(G,A),B.position.set(w[0],w[1],w[2]),B.position.normalize()):v.type=="point"?(w=v.position,d=v.distance,B=new THREE.PointLight(G,A,d),B.position.set(w[0],w[1],w[2])):v.type=="ambient"&&(B=new THREE.AmbientLight(G)),E.scene.add(B),E.lights[x]=B;for(u in D.fogs)x=D.fogs[u],x.type=="linear"?I=new THREE.Fog(0,x.near,x.far):x.type=="exp2"&&(I=new THREE.FogExp2(0,x.density)),
-A=x.color,I.color.setRGB(A[0],A[1],A[2]),E.fogs[u]=I;if(E.cameras&&D.defaults.camera)E.currentCamera=E.cameras[D.defaults.camera];if(E.fogs&&D.defaults.fog)E.scene.fog=E.fogs[D.defaults.fog];A=D.defaults.bgcolor;E.bgColor=new THREE.Color;E.bgColor.setRGB(A[0],A[1],A[2]);E.bgColorAlpha=D.defaults.bgalpha;for(o in D.geometries)if(u=D.geometries[o],u.type=="bin_mesh"||u.type=="ascii_mesh")L+=1,c.onLoadStart();K=L;for(o in D.geometries)u=D.geometries[o],u.type=="cube"?(F=new THREE.CubeGeometry(u.width,
-u.height,u.depth,u.segmentsWidth,u.segmentsHeight,u.segmentsDepth,null,u.flipped,u.sides),E.geometries[o]=F):u.type=="plane"?(F=new THREE.PlaneGeometry(u.width,u.height,u.segmentsWidth,u.segmentsHeight),E.geometries[o]=F):u.type=="sphere"?(F=new THREE.SphereGeometry(u.radius,u.segmentsWidth,u.segmentsHeight),E.geometries[o]=F):u.type=="cylinder"?(F=new THREE.CylinderGeometry(u.topRad,u.botRad,u.height,u.radSegs,u.heightSegs),E.geometries[o]=F):u.type=="torus"?(F=new THREE.TorusGeometry(u.radius,u.tube,
-u.segmentsR,u.segmentsT),E.geometries[o]=F):u.type=="icosahedron"?(F=new THREE.IcosahedronGeometry(u.subdivisions),E.geometries[o]=F):u.type=="bin_mesh"?H.load({model:e(u.url,D.urlBaseType),callback:l(o)}):u.type=="ascii_mesh"?J.load({model:e(u.url,D.urlBaseType),callback:l(o)}):u.type=="embedded_mesh"&&(u=D.embeds[u.id])&&J.createModel(u,m(o),"");for(z in D.textures)if(o=D.textures[z],o.url instanceof Array){N+=o.url.length;for(H=0;H<o.url.length;H++)c.onLoadStart()}else N+=1,c.onLoadStart();P=N;
+c,t=x[l+2]*c,p.push(new THREE.Vertex(new THREE.Vector3(n,o,t)))}}if(a.morphColors!==void 0){b=0;for(g=a.morphColors.length;b<g;b++){e.morphColors[b]={};e.morphColors[b].name=a.morphColors[b].name;e.morphColors[b].colors=[];m=e.morphColors[b].colors;n=a.morphColors[b].colors;c=0;for(l=n.length;c<l;c+=3)o=new THREE.Color(16755200),o.setRGB(n[c],n[c+1],n[c+2]),m.push(o)}}})(g);e.computeCentroids();e.computeFaceNormals();this.hasNormals(e)&&e.computeTangents();b(e)};
+THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};
+THREE.SceneLoader.prototype={load:function(a,b){var c=this,e=new Worker(a);e.postMessage(0);var g=THREE.Loader.prototype.extractUrlbase(a);e.onmessage=function(a){function e(a,c){return c=="relativeToHTML"?a:g+"/"+a}function k(){for(p in D.objects)if(!F.objects[p])if(y=D.objects[p],y.geometry!==void 0){if(G=F.geometries[y.geometry]){var a=!1;M=[];for(O=0;O<y.materials.length;O++)M[O]=F.materials[y.materials[O]],a=M[O]instanceof THREE.ShaderMaterial;a&&G.computeTangents();w=y.position;r=y.rotation;
+q=y.quaternion;s=y.scale;q=0;M.length==0&&(M[0]=new THREE.MeshFaceMaterial);M.length>1&&(M=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(G,M);object.name=p;object.position.set(w[0],w[1],w[2]);q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=y.visible;F.scene.add(object);F.objects[p]=object;y.meshCollider&&(a=THREE.CollisionUtils.MeshColliderWBox(object),F.scene.collisions.colliders.push(a));
+if(y.castsShadow)a=new THREE.ShadowVolume(G),F.scene.add(a),a.position=object.position,a.rotation=object.rotation,a.scale=object.scale;y.trigger&&y.trigger.toLowerCase()!="none"&&(a={type:y.trigger,object:y},F.triggers[object.name]=a)}}else w=y.position,r=y.rotation,q=y.quaternion,s=y.scale,q=0,object=new THREE.Object3D,object.name=p,object.position.set(w[0],w[1],w[2]),q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]),object.scale.set(s[0],
+s[1],s[2]),object.visible=y.visible!==void 0?y.visible:!1,F.scene.add(object),F.objects[p]=object,F.empties[p]=object,y.trigger&&y.trigger.toLowerCase()!="none"&&(a={type:y.trigger,object:y},F.triggers[object.name]=a)}function l(a){return function(b){F.geometries[a]=b;k();L-=1;c.onLoadComplete();n()}}function m(a){return function(c){F.geometries[a]=c}}function n(){c.callbackProgress({totalModels:K,totalTextures:P,loadedModels:K-L,loadedTextures:P-N},F);c.onLoadProgress();L==0&&N==0&&b(F)}var o,t,
+p,x,v,u,z,y,w,A,C,G,E,I,H,M,B,D,J,L,N,K,P,F;D=a.data;H=new THREE.BinaryLoader;J=new THREE.JSONLoader;N=L=0;F={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};a=!1;for(p in D.objects)if(y=D.objects[p],y.meshCollider){a=!0;break}if(a)F.scene.collisions=new THREE.CollisionSystem;if(D.transform){a=D.transform.position;A=D.transform.rotation;var S=D.transform.scale;a&&F.scene.position.set(a[0],a[1],a[2]);A&&F.scene.rotation.set(A[0],
+A[1],A[2]);S&&F.scene.scale.set(S[0],S[1],S[2]);(a||A||S)&&F.scene.updateMatrix()}a=function(){N-=1;n();c.onLoadComplete()};for(v in D.cameras){A=D.cameras[v];if(A.type=="perspective")E=new THREE.Camera(A.fov,A.aspect,A.near,A.far),E.useTarget=!0;else if(A.type=="ortho")E=new THREE.Camera,E.useTarget=!0,E.projectionMatrix=THREE.Matrix4.makeOrtho(A.left,A.right,A.top,A.bottom,A.near,A.far);w=A.position;A=A.target;E.position.set(w[0],w[1],w[2]);E.target.position.set(A[0],A[1],A[2]);F.cameras[v]=E}for(x in D.lights)v=
+D.lights[x],E=v.color!==void 0?v.color:16777215,A=v.intensity!==void 0?v.intensity:1,v.type=="directional"?(w=v.direction,B=new THREE.DirectionalLight(E,A),B.position.set(w[0],w[1],w[2]),B.position.normalize()):v.type=="point"?(w=v.position,d=v.distance,B=new THREE.PointLight(E,A,d),B.position.set(w[0],w[1],w[2])):v.type=="ambient"&&(B=new THREE.AmbientLight(E)),F.scene.add(B),F.lights[x]=B;for(u in D.fogs)x=D.fogs[u],x.type=="linear"?I=new THREE.Fog(0,x.near,x.far):x.type=="exp2"&&(I=new THREE.FogExp2(0,
+x.density)),A=x.color,I.color.setRGB(A[0],A[1],A[2]),F.fogs[u]=I;if(F.cameras&&D.defaults.camera)F.currentCamera=F.cameras[D.defaults.camera];if(F.fogs&&D.defaults.fog)F.scene.fog=F.fogs[D.defaults.fog];A=D.defaults.bgcolor;F.bgColor=new THREE.Color;F.bgColor.setRGB(A[0],A[1],A[2]);F.bgColorAlpha=D.defaults.bgalpha;for(o in D.geometries)if(u=D.geometries[o],u.type=="bin_mesh"||u.type=="ascii_mesh")L+=1,c.onLoadStart();K=L;for(o in D.geometries)u=D.geometries[o],u.type=="cube"?(G=new THREE.CubeGeometry(u.width,
+u.height,u.depth,u.segmentsWidth,u.segmentsHeight,u.segmentsDepth,null,u.flipped,u.sides),F.geometries[o]=G):u.type=="plane"?(G=new THREE.PlaneGeometry(u.width,u.height,u.segmentsWidth,u.segmentsHeight),F.geometries[o]=G):u.type=="sphere"?(G=new THREE.SphereGeometry(u.radius,u.segmentsWidth,u.segmentsHeight),F.geometries[o]=G):u.type=="cylinder"?(G=new THREE.CylinderGeometry(u.topRad,u.botRad,u.height,u.radSegs,u.heightSegs),F.geometries[o]=G):u.type=="torus"?(G=new THREE.TorusGeometry(u.radius,u.tube,
+u.segmentsR,u.segmentsT),F.geometries[o]=G):u.type=="icosahedron"?(G=new THREE.IcosahedronGeometry(u.subdivisions),F.geometries[o]=G):u.type=="bin_mesh"?H.load({model:e(u.url,D.urlBaseType),callback:l(o)}):u.type=="ascii_mesh"?J.load({model:e(u.url,D.urlBaseType),callback:l(o)}):u.type=="embedded_mesh"&&(u=D.embeds[u.id])&&J.createModel(u,m(o),"");for(z in D.textures)if(o=D.textures[z],o.url instanceof Array){N+=o.url.length;for(H=0;H<o.url.length;H++)c.onLoadStart()}else N+=1,c.onLoadStart();P=N;
 for(z in D.textures){o=D.textures[z];if(o.mapping!=void 0&&THREE[o.mapping]!=void 0)o.mapping=new THREE[o.mapping];if(o.url instanceof Array){H=[];for(var O=0;O<o.url.length;O++)H[O]=e(o.url[O],D.urlBaseType);H=THREE.ImageUtils.loadTextureCube(H,o.mapping,a)}else{H=THREE.ImageUtils.loadTexture(e(o.url,D.urlBaseType),o.mapping,a);if(THREE[o.minFilter]!=void 0)H.minFilter=THREE[o.minFilter];if(THREE[o.magFilter]!=void 0)H.magFilter=THREE[o.magFilter];if(o.repeat){H.repeat.set(o.repeat[0],o.repeat[1]);
-if(o.repeat[0]!=1)H.wrapS=THREE.RepeatWrapping;if(o.repeat[1]!=1)H.wrapT=THREE.RepeatWrapping}o.offset&&H.offset.set(o.offset[0],o.offset[1]);if(o.wrap){J={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(J[o.wrap[0]]!==void 0)H.wrapS=J[o.wrap[0]];if(J[o.wrap[1]]!==void 0)H.wrapT=J[o.wrap[1]]}}E.textures[z]=H}for(t in D.materials){z=D.materials[t];for(C in z.parameters)if(C=="envMap"||C=="map"||C=="lightMap")z.parameters[C]=E.textures[z.parameters[C]];else if(C=="shading")z.parameters[C]=
+if(o.repeat[0]!=1)H.wrapS=THREE.RepeatWrapping;if(o.repeat[1]!=1)H.wrapT=THREE.RepeatWrapping}o.offset&&H.offset.set(o.offset[0],o.offset[1]);if(o.wrap){J={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(J[o.wrap[0]]!==void 0)H.wrapS=J[o.wrap[0]];if(J[o.wrap[1]]!==void 0)H.wrapT=J[o.wrap[1]]}}F.textures[z]=H}for(t in D.materials){z=D.materials[t];for(C in z.parameters)if(C=="envMap"||C=="map"||C=="lightMap")z.parameters[C]=F.textures[z.parameters[C]];else if(C=="shading")z.parameters[C]=
 z.parameters[C]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(C=="blending")z.parameters[C]=THREE[z.parameters[C]]?THREE[z.parameters[C]]:THREE.NormalBlending;else if(C=="combine")z.parameters[C]=z.parameters[C]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(C=="vertexColors")if(z.parameters[C]=="face")z.parameters[C]=THREE.FaceColors;else if(z.parameters[C])z.parameters[C]=THREE.VertexColors;if(z.parameters.opacity!==void 0&&z.parameters.opacity<1)z.parameters.transparent=
-!0;if(z.parameters.normalMap){o=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(o.uniforms);H=z.parameters.color;J=z.parameters.specular;u=z.parameters.ambient;I=z.parameters.shininess;a.tNormal.texture=E.textures[z.parameters.normalMap];if(z.parameters.normalMapFactor)a.uNormalScale.value=z.parameters.normalMapFactor;if(z.parameters.map)a.tDiffuse.texture=z.parameters.map,a.enableDiffuse.value=!0;if(z.parameters.lightMap)a.tAO.texture=z.parameters.lightMap,a.enableAO.value=!0;if(z.parameters.specularMap)a.tSpecular.texture=
-E.textures[z.parameters.specularMap],a.enableSpecular.value=!0;a.uDiffuseColor.value.setHex(H);a.uSpecularColor.value.setHex(J);a.uAmbientColor.value.setHex(u);a.uShininess.value=I;if(z.parameters.opacity)a.uOpacity.value=z.parameters.opacity;z=new THREE.ShaderMaterial({fragmentShader:o.fragmentShader,vertexShader:o.vertexShader,uniforms:a,lights:!0,fog:!0})}else z=new THREE[z.type](z.parameters);E.materials[t]=z}k();c.callbackSync(E)}},constructor:THREE.SceneLoader};THREE.UTF8Loader=function(){};
+!0;if(z.parameters.normalMap){o=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(o.uniforms);H=z.parameters.color;J=z.parameters.specular;u=z.parameters.ambient;I=z.parameters.shininess;a.tNormal.texture=F.textures[z.parameters.normalMap];if(z.parameters.normalMapFactor)a.uNormalScale.value=z.parameters.normalMapFactor;if(z.parameters.map)a.tDiffuse.texture=z.parameters.map,a.enableDiffuse.value=!0;if(z.parameters.lightMap)a.tAO.texture=z.parameters.lightMap,a.enableAO.value=!0;if(z.parameters.specularMap)a.tSpecular.texture=
+F.textures[z.parameters.specularMap],a.enableSpecular.value=!0;a.uDiffuseColor.value.setHex(H);a.uSpecularColor.value.setHex(J);a.uAmbientColor.value.setHex(u);a.uShininess.value=I;if(z.parameters.opacity)a.uOpacity.value=z.parameters.opacity;z=new THREE.ShaderMaterial({fragmentShader:o.fragmentShader,vertexShader:o.vertexShader,uniforms:a,lights:!0,fog:!0})}else z=new THREE[z.type](z.parameters);F.materials[t]=z}k();c.callbackSync(F)}},constructor:THREE.SceneLoader};THREE.UTF8Loader=function(){};
 THREE.UTF8Loader.prototype=new THREE.UTF8Loader;THREE.UTF8Loader.prototype.constructor=THREE.UTF8Loader;
 THREE.UTF8Loader.prototype.load=function(a){var b=new XMLHttpRequest,c=a.model,e=a.callback,g=a.scale!==void 0?a.scale:1,h=a.offsetX!==void 0?a.offsetX:0,f=a.offsetY!==void 0?a.offsetY:0,k=a.offsetZ!==void 0?a.offsetZ:0;b.onreadystatechange=function(){b.readyState==4?b.status==200||b.status==0?THREE.UTF8Loader.prototype.createModel(b.responseText,e,g,h,f,k):alert("Couldn't load ["+c+"] ["+b.status+"]"):b.readyState!=3&&b.readyState==2&&b.getResponseHeader("Content-Length")};b.open("GET",c,!0);b.send(null)};
 THREE.UTF8Loader.prototype.decompressMesh=function(a){var b=a.charCodeAt(0);b>=57344&&(b-=2048);b++;for(var c=new Float32Array(8*b),e=1,g=0;g<8;g++){for(var h=0,f=0;f<b;++f){var k=a.charCodeAt(f+e);h+=k>>1^-(k&1);c[8*f+g]=h}e+=b}b=a.length-e;h=new Uint16Array(b);for(g=f=0;g<b;g++)k=a.charCodeAt(g+e),h[g]=f-k,k==0&&f++;return[c,h]};
 THREE.UTF8Loader.prototype.createModel=function(a,b,c,e,g,h){var f=function(){var b=this;b.materials=[];THREE.Geometry.call(this);var f=THREE.UTF8Loader.prototype.decompressMesh(a),m=[],n=[];(function(a,f,l){for(var m,n,u,z=a.length;l<z;l+=f)m=a[l],n=a[l+1],u=a[l+2],m=m/16383*c,n=n/16383*c,u=u/16383*c,m+=e,n+=g,u+=h,b.vertices.push(new THREE.Vertex(new THREE.Vector3(m,n,u)))})(f[0],8,0);(function(a,c,b){for(var e,f,g=a.length;b<g;b+=c)e=a[b],f=a[b+1],e/=1023,f/=1023,n.push(e,1-f)})(f[0],8,3);(function(a,
-c,b){for(var e,f,g,h=a.length;b<h;b+=c)e=a[b],f=a[b+1],g=a[b+2],e=(e-512)/511,f=(f-512)/511,g=(g-512)/511,m.push(e,f,g)})(f[0],8,5);(function(a){var c,e,f,g,h,l,y,w,A,C=a.length;for(c=0;c<C;c+=3){e=a[c];f=a[c+1];g=a[c+2];h=b;w=e;A=f;l=g;y=e;var F=f,G=g,I=h.materials[0],H=m[F*3],M=m[F*3+1],F=m[F*3+2],B=m[G*3],D=m[G*3+1],G=m[G*3+2];y=new THREE.Vector3(m[y*3],m[y*3+1],m[y*3+2]);F=new THREE.Vector3(H,M,F);G=new THREE.Vector3(B,D,G);h.faces.push(new THREE.Face3(w,A,l,[y,F,G],null,I));h=n[e*2];e=n[e*2+
+c,b){for(var e,f,g,h=a.length;b<h;b+=c)e=a[b],f=a[b+1],g=a[b+2],e=(e-512)/511,f=(f-512)/511,g=(g-512)/511,m.push(e,f,g)})(f[0],8,5);(function(a){var c,e,f,g,h,l,y,w,A,C=a.length;for(c=0;c<C;c+=3){e=a[c];f=a[c+1];g=a[c+2];h=b;w=e;A=f;l=g;y=e;var G=f,E=g,I=h.materials[0],H=m[G*3],M=m[G*3+1],G=m[G*3+2],B=m[E*3],D=m[E*3+1],E=m[E*3+2];y=new THREE.Vector3(m[y*3],m[y*3+1],m[y*3+2]);G=new THREE.Vector3(H,M,G);E=new THREE.Vector3(B,D,E);h.faces.push(new THREE.Face3(w,A,l,[y,G,E],null,I));h=n[e*2];e=n[e*2+
 1];l=n[f*2];y=n[f*2+1];w=n[g*2];A=n[g*2+1];g=b.faceVertexUvs[0];f=l;l=y;y=[];y.push(new THREE.UV(h,e));y.push(new THREE.UV(f,l));y.push(new THREE.UV(w,A));g.push(y)}})(f[1]);this.computeCentroids();this.computeFaceNormals()};f.prototype=new THREE.Geometry;f.prototype.constructor=f;b(new f)};
 THREE.MarchingCubes=function(a,b){THREE.Object3D.call(this);this.materials=b instanceof Array?b:[b];this.init=function(a){this.isolation=80;this.size=a;this.size2=this.size*this.size;this.size3=this.size2*this.size;this.halfsize=this.size/2;this.delta=2/this.size;this.yd=this.size;this.zd=this.size2;this.field=new Float32Array(this.size3);this.normal_cache=new Float32Array(this.size3*3);this.vlist=new Float32Array(36);this.nlist=new Float32Array(36);this.firstDraw=!0;this.maxCount=4096;this.count=
 0;this.hasNormal=this.hasPos=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(a,b,g){return a+(b-a)*g};this.VIntX=function(a,b,g,h,f,k,l,m,n,o){f=(f-n)/(o-n);n=this.normal_cache;b[h]=k+f*this.delta;b[h+1]=l;b[h+2]=m;g[h]=this.lerp(n[a],n[a+3],f);g[h+1]=this.lerp(n[a+1],n[a+4],f);g[h+2]=this.lerp(n[a+2],n[a+5],f)};this.VIntY=function(a,b,g,h,f,k,l,m,n,o){f=(f-n)/(o-n);n=this.normal_cache;b[h]=k;b[h+1]=l+f*this.delta;b[h+
 2]=m;b=a+this.yd*3;g[h]=this.lerp(n[a],n[b],f);g[h+1]=this.lerp(n[a+1],n[b+1],f);g[h+2]=this.lerp(n[a+2],n[b+2],f)};this.VIntZ=function(a,b,g,h,f,k,l,m,n,o){f=(f-n)/(o-n);n=this.normal_cache;b[h]=k;b[h+1]=l;b[h+2]=m+f*this.delta;b=a+this.zd*3;g[h]=this.lerp(n[a],n[b],f);g[h+1]=this.lerp(n[a+1],n[b+1],f);g[h+2]=this.lerp(n[a+2],n[b+2],f)};this.compNorm=function(a){var b=a*3;this.normal_cache[b]==0&&(this.normal_cache[b]=this.field[a-1]-this.field[a+1],this.normal_cache[b+1]=this.field[a-this.yd]-this.field[a+
-this.yd],this.normal_cache[b+2]=this.field[a-this.zd]-this.field[a+this.zd])};this.polygonize=function(a,b,g,h,f,k){var l=h+1,m=h+this.yd,n=h+this.zd,o=l+this.yd,t=l+this.zd,p=h+this.yd+this.zd,x=l+this.yd+this.zd,v=0,u=this.field[h],z=this.field[l],y=this.field[m],w=this.field[o],A=this.field[n],C=this.field[t],F=this.field[p],G=this.field[x];u<f&&(v|=1);z<f&&(v|=2);y<f&&(v|=8);w<f&&(v|=4);A<f&&(v|=16);C<f&&(v|=32);F<f&&(v|=128);G<f&&(v|=64);var I=THREE.edgeTable[v];if(I==0)return 0;var H=this.delta,
+this.yd],this.normal_cache[b+2]=this.field[a-this.zd]-this.field[a+this.zd])};this.polygonize=function(a,b,g,h,f,k){var l=h+1,m=h+this.yd,n=h+this.zd,o=l+this.yd,t=l+this.zd,p=h+this.yd+this.zd,x=l+this.yd+this.zd,v=0,u=this.field[h],z=this.field[l],y=this.field[m],w=this.field[o],A=this.field[n],C=this.field[t],G=this.field[p],E=this.field[x];u<f&&(v|=1);z<f&&(v|=2);y<f&&(v|=8);w<f&&(v|=4);A<f&&(v|=16);C<f&&(v|=32);G<f&&(v|=128);E<f&&(v|=64);var I=THREE.edgeTable[v];if(I==0)return 0;var H=this.delta,
 M=a+H,B=b+H,H=g+H;I&1&&(this.compNorm(h),this.compNorm(l),this.VIntX(h*3,this.vlist,this.nlist,0,f,a,b,g,u,z));I&2&&(this.compNorm(l),this.compNorm(o),this.VIntY(l*3,this.vlist,this.nlist,3,f,M,b,g,z,w));I&4&&(this.compNorm(m),this.compNorm(o),this.VIntX(m*3,this.vlist,this.nlist,6,f,a,B,g,y,w));I&8&&(this.compNorm(h),this.compNorm(m),this.VIntY(h*3,this.vlist,this.nlist,9,f,a,b,g,u,y));I&16&&(this.compNorm(n),this.compNorm(t),this.VIntX(n*3,this.vlist,this.nlist,12,f,a,b,H,A,C));I&32&&(this.compNorm(t),
-this.compNorm(x),this.VIntY(t*3,this.vlist,this.nlist,15,f,M,b,H,C,G));I&64&&(this.compNorm(p),this.compNorm(x),this.VIntX(p*3,this.vlist,this.nlist,18,f,a,B,H,F,G));I&128&&(this.compNorm(n),this.compNorm(p),this.VIntY(n*3,this.vlist,this.nlist,21,f,a,b,H,A,F));I&256&&(this.compNorm(h),this.compNorm(n),this.VIntZ(h*3,this.vlist,this.nlist,24,f,a,b,g,u,A));I&512&&(this.compNorm(l),this.compNorm(t),this.VIntZ(l*3,this.vlist,this.nlist,27,f,M,b,g,z,C));I&1024&&(this.compNorm(o),this.compNorm(x),this.VIntZ(o*
-3,this.vlist,this.nlist,30,f,M,B,g,w,G));I&2048&&(this.compNorm(m),this.compNorm(p),this.VIntZ(m*3,this.vlist,this.nlist,33,f,a,B,g,y,F));v<<=4;for(f=h=0;THREE.triTable[v+f]!=-1;)a=v+f,b=a+1,g=a+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[a],3*THREE.triTable[b],3*THREE.triTable[g],k),f+=3,h++;return h};this.posnormtriv=function(a,b,g,h,f,k){var l=this.count*3;this.positionArray[l]=a[g];this.positionArray[l+1]=a[g+1];this.positionArray[l+2]=a[g+2];this.positionArray[l+3]=a[h];this.positionArray[l+
+this.compNorm(x),this.VIntY(t*3,this.vlist,this.nlist,15,f,M,b,H,C,E));I&64&&(this.compNorm(p),this.compNorm(x),this.VIntX(p*3,this.vlist,this.nlist,18,f,a,B,H,G,E));I&128&&(this.compNorm(n),this.compNorm(p),this.VIntY(n*3,this.vlist,this.nlist,21,f,a,b,H,A,G));I&256&&(this.compNorm(h),this.compNorm(n),this.VIntZ(h*3,this.vlist,this.nlist,24,f,a,b,g,u,A));I&512&&(this.compNorm(l),this.compNorm(t),this.VIntZ(l*3,this.vlist,this.nlist,27,f,M,b,g,z,C));I&1024&&(this.compNorm(o),this.compNorm(x),this.VIntZ(o*
+3,this.vlist,this.nlist,30,f,M,B,g,w,E));I&2048&&(this.compNorm(m),this.compNorm(p),this.VIntZ(m*3,this.vlist,this.nlist,33,f,a,B,g,y,G));v<<=4;for(f=h=0;THREE.triTable[v+f]!=-1;)a=v+f,b=a+1,g=a+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[a],3*THREE.triTable[b],3*THREE.triTable[g],k),f+=3,h++;return h};this.posnormtriv=function(a,b,g,h,f,k){var l=this.count*3;this.positionArray[l]=a[g];this.positionArray[l+1]=a[g+1];this.positionArray[l+2]=a[g+2];this.positionArray[l+3]=a[h];this.positionArray[l+
 4]=a[h+1];this.positionArray[l+5]=a[h+2];this.positionArray[l+6]=a[f];this.positionArray[l+7]=a[f+1];this.positionArray[l+8]=a[f+2];this.normalArray[l]=b[g];this.normalArray[l+1]=b[g+1];this.normalArray[l+2]=b[g+2];this.normalArray[l+3]=b[h];this.normalArray[l+4]=b[h+1];this.normalArray[l+5]=b[h+2];this.normalArray[l+6]=b[f];this.normalArray[l+7]=b[f+1];this.normalArray[l+8]=b[f+2];this.hasNormal=this.hasPos=!0;this.count+=3;this.count>=this.maxCount-3&&k(this)};this.begin=function(){this.count=0;
 this.hasNormal=this.hasPos=!1};this.end=function(a){if(this.count!=0){for(var b=this.count*3;b<this.positionArray.length;b++)this.positionArray[b]=0;a(this)}};this.addBall=function(a,b,g,h,f){var k=this.size*Math.sqrt(h/f),l=g*this.size,m=b*this.size,n=a*this.size,o=Math.floor(l-k);o<1&&(o=1);l=Math.floor(l+k);l>this.size-1&&(l=this.size-1);var t=Math.floor(m-k);t<1&&(t=1);m=Math.floor(m+k);m>this.size-1&&(m=this.size-1);var p=Math.floor(n-k);p<1&&(p=1);k=Math.floor(n+k);k>this.size-1&&(k=this.size-
 1);for(var x,v,u,z,y,w;o<l;o++){n=this.size2*o;v=o/this.size-g;y=v*v;for(v=t;v<m;v++){u=n+this.size*v;x=v/this.size-b;w=x*x;for(x=p;x<k;x++)z=x/this.size-a,z=h/(1.0E-6+z*z+w+y)-f,z>0&&(this.field[u+x]+=z)}}};this.addPlaneX=function(a,b){var g,h,f,k,l,m=this.size,n=this.yd,o=this.zd,t=this.field,p=m*Math.sqrt(a/b);p>m&&(p=m);for(g=0;g<p;g++)if(h=g/m,h*=h,k=a/(1.0E-4+h)-b,k>0)for(h=0;h<m;h++){l=g+h*n;for(f=0;f<m;f++)t[o*f+l]+=k}};this.addPlaneY=function(a,b){var g,h,f,k,l,m,n=this.size,o=this.yd,t=
@@ -344,5 +345,5 @@ if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRender
 2;_material=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:o},mapRight:{type:"t",value:1,texture:t}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D mapLeft;\nuniform sampler2D mapRight;\nvarying vec2 vUv;\nvoid main() {\nvec4 colorL, colorR;\nvec2 uv = vUv;\ncolorL = texture2D( mapLeft, uv );\ncolorR = texture2D( mapRight, uv );\ngl_FragColor = vec4( colorL.g * 0.7 + colorL.b * 0.3, colorR.g, colorR.b, colorL.a + colorR.a ) * 1.1;\n}"});
 var x=new THREE.Scene;x.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));this.setSize=function(a,e){c.call(b,a,e);o.width=a;o.height=e;t.width=a;t.height=e};this.render=function(a,c){c.update(null,!0);if(l!==c.aspect||m!==c.near||n!==c.fov){l=c.aspect;m=c.near;n=c.fov;var z=c.projectionMatrix.clone(),y=125/30*0.5,w=y*m/125,A=m*Math.tan(n*Math.PI/360),C;f.n14=y;k.n14=-y;y=-A*l+w;C=A*l+w;z.n11=2*m/(C-y);z.n13=(C+y)/(C-y);g.projectionMatrix=z.clone();y=-A*l-w;C=A*l-w;z.n11=2*m/(C-y);z.n13=
 (C+y)/(C-y);h.projectionMatrix=z.clone()}g.matrix=c.matrixWorld.clone().multiplySelf(k);g.update(null,!0);g.position.copy(c.position);g.near=m;g.far=c.far;e.call(b,a,g,o,!0);h.matrix=c.matrixWorld.clone().multiplySelf(f);h.update(null,!0);h.position.copy(c.position);h.near=m;h.far=c.far;e.call(b,a,h,t,!0);e.call(b,x,p)}};
-if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoClear=!1;var b=this,c=this.setSize,e=this.render,g,h,f=new THREE.Camera,k=new THREE.Camera;b.separation=10;if(a&&a.separation!==void 0)b.separation=a.separation;(new THREE.Camera(53,window.innerWidth/2/window.innerHeight,1,1E4)).position.z=-10;this.setSize=function(a,e){c.call(b,a,e);g=a/2;h=e};this.render=function(a,c){this.clear();f.fov=c.fov;f.aspect=0.5*c.aspect;f.near=c.near;f.far=c.far;
-f.updateProjectionMatrix();f.position.copy(c.position);f.target.position.copy(c.target.position);f.translateX(b.separation);k.projectionMatrix=f.projectionMatrix;k.position.copy(c.position);k.target.position.copy(c.target.position);k.translateX(-b.separation);this.setViewport(0,0,g,h);e.call(b,a,f);this.setViewport(g,0,g,h);e.call(b,a,k,!1)}};
+if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoClear=!1;var b=this,c=this.setSize,e=this.render,g,h,f=new THREE.Camera;f.useTarget=!0;var k=new THREE.Camera;k.useTarget=!0;b.separation=10;if(a&&a.separation!==void 0)b.separation=a.separation;this.setSize=function(a,e){c.call(b,a,e);g=a/2;h=e};this.render=function(a,c){this.clear();f.fov=c.fov;f.aspect=0.5*c.aspect;f.near=c.near;f.far=c.far;f.updateProjectionMatrix();f.position.copy(c.position);
+f.target.position.copy(c.target.position);f.translateX(b.separation);k.projectionMatrix=f.projectionMatrix;k.position.copy(c.position);k.target.position.copy(c.target.position);k.translateX(-b.separation);this.setViewport(0,0,g,h);e.call(b,a,f);this.setViewport(g,0,g,h);e.call(b,a,k,!1)}};

+ 9 - 9
build/custom/ThreeSVG.js

@@ -47,13 +47,13 @@ e*i*l-g*k*l+g*f*m-c*i*m-e*f*n+c*k*n;b.n31=h*n*p-i*j*p+i*l*q-f*n*q-h*l*u+f*j*u;b.
 THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,d=a.n33*a.n22-a.n32*a.n23,e=-a.n33*a.n21+a.n31*a.n23,g=a.n32*a.n21-a.n31*a.n22,f=-a.n33*a.n12+a.n32*a.n13,h=a.n33*a.n11-a.n31*a.n13,k=-a.n32*a.n11+a.n31*a.n12,i=a.n23*a.n12-a.n22*a.n13,l=-a.n23*a.n11+a.n21*a.n13,j=a.n22*a.n11-a.n21*a.n12,a=a.n11*d+a.n21*f+a.n31*i;a==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");a=1/a;c[0]=a*d;c[1]=a*e;c[2]=a*g;c[3]=a*f;c[4]=a*h;c[5]=a*k;c[6]=a*i;c[7]=a*l;c[8]=a*j;return b};
 THREE.Matrix4.makeFrustum=function(a,b,c,d,e,g){var f;f=new THREE.Matrix4;f.n11=2*e/(b-a);f.n12=0;f.n13=(b+a)/(b-a);f.n14=0;f.n21=0;f.n22=2*e/(d-c);f.n23=(d+c)/(d-c);f.n24=0;f.n31=0;f.n32=0;f.n33=-(g+e)/(g-e);f.n34=-2*g*e/(g-e);f.n41=0;f.n42=0;f.n43=-1;f.n44=0;return f};THREE.Matrix4.makePerspective=function(a,b,c,d){var e,a=c*Math.tan(a*Math.PI/360);e=-a;return THREE.Matrix4.makeFrustum(e*b,a*b,e,a,c,d)};
 THREE.Matrix4.makeOrtho=function(a,b,c,d,e,g){var f,h,k,i;f=new THREE.Matrix4;h=b-a;k=c-d;i=g-e;f.n11=2/h;f.n12=0;f.n13=0;f.n14=-((b+a)/h);f.n21=0;f.n22=2/k;f.n23=0;f.n24=-((c+d)/k);f.n31=0;f.n32=0;f.n33=-2/i;f.n34=-((g+e)/i);f.n41=0;f.n42=0;f.n43=0;f.n44=1;return f};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
-THREE.Object3D=function(){this.id=THREE.Object3DCount++;this.name="";this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder="XYZ";this.scale=new THREE.Vector3(1,1,1);this.flipSided=this.doubleSided=this.dynamic=!1;this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=
+THREE.Object3D=function(){this.name="";this.id=THREE.Object3DCount++;this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder="XYZ";this.scale=new THREE.Vector3(1,1,1);this.flipSided=this.doubleSided=this.dynamic=!1;this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=
 !0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=!0;this.receiveShadow=this.castShadow=!1;this.frustumCulled=!0;this._vector=new THREE.Vector3};
-THREE.Object3D.prototype={constructor:THREE.Object3D,translate:function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a))},translateX:function(a){this.translate(a,this._vector.set(1,0,0))},translateY:function(a){this.translate(a,this._vector.set(0,1,0))},translateZ:function(a){this.translate(a,this._vector.set(0,0,1))},lookAt:function(a){this.matrix.lookAt(a,this.position,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},add:function(a){if(this.children.indexOf(a)===
--1){a.parent!==void 0&&a.parent.removeChild(a);a.parent=this;this.children.push(a);for(var b=this;b.parent!==void 0;)b=b.parent;b!==void 0&&b instanceof THREE.Scene&&b.addChildRecurse(a)}},remove:function(a){var b=this,c=this.children.indexOf(a);if(c!==-1){a.parent=void 0;for(this.children.splice(c,1);b.parent!==void 0;)b=b.parent;b!==void 0&&b instanceof THREE.Scene&&b.removeChildRecurse(a)}},getChildByName:function(a,b){var c,d,e;c=0;for(d=this.children.length;c<d;c++){e=this.children[c];if(e.name===
-a)return e;if(b&&(e=e.getChildByName(a,b),e!==void 0))return e}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z));this.matrixWorldNeedsUpdate=!0},update:function(a,b,c){this.matrixAutoUpdate&&
-this.updateMatrix();if(this.matrixWorldNeedsUpdate||b)a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale),this.matrixWorldNeedsUpdate=!1,b=!0;for(var a=0,d=this.children.length;a<d;a++)this.children[a].update(this.matrixWorld,b,c)},addChild:function(a){console.warn("DEPRECATED: Object3D.addChild() is now Object3D.add().");this.add(a)},removeChild:function(a){console.warn("DEPRECATED: Object3D.removeChild() is now Object3D.remove().");
-this.remove(a)}};THREE.Object3DCount=0;
+THREE.Object3D.prototype={constructor:THREE.Object3D,translate:function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a))},translateX:function(a){this.translate(a,this._vector.set(1,0,0))},translateY:function(a){this.translate(a,this._vector.set(0,1,0))},translateZ:function(a){this.translate(a,this._vector.set(0,0,1))},lookAt:function(a){this instanceof THREE.Camera?this.matrix.lookAt(this.position,a,this.up):this.matrix.lookAt(a,this.position,this.up);this.rotationAutoUpdate&&
+this.rotation.setRotationFromMatrix(this.matrix)},add:function(a){if(this.children.indexOf(a)===-1){a.parent!==void 0&&a.parent.removeChild(a);a.parent=this;this.children.push(a);for(var b=this;b.parent!==void 0;)b=b.parent;b!==void 0&&b instanceof THREE.Scene&&b.addChildRecurse(a)}},remove:function(a){var b=this,c=this.children.indexOf(a);if(c!==-1){a.parent=void 0;for(this.children.splice(c,1);b.parent!==void 0;)b=b.parent;b!==void 0&&b instanceof THREE.Scene&&b.removeChildRecurse(a)}},getChildByName:function(a,
+b){var c,d,e;c=0;for(d=this.children.length;c<d;c++){e=this.children[c];if(e.name===a)return e;if(b&&(e=e.getChildByName(a,b),e!==void 0))return e}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,
+this.scale.z));this.matrixWorldNeedsUpdate=!0},update:function(a,b,c){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||b)a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale),this.matrixWorldNeedsUpdate=!1,b=!0;for(var a=0,d=this.children.length;a<d;a++)this.children[a].update(this.matrixWorld,b,c)},addChild:function(a){console.warn("DEPRECATED: Object3D.addChild() is now Object3D.add().");
+this.add(a)},removeChild:function(a){console.warn("DEPRECATED: Object3D.removeChild() is now Object3D.remove().");this.remove(a)}};THREE.Object3DCount=0;
 THREE.Projector=function(){function a(){var a=k[h]=k[h]||new THREE.RenderableVertex;h++;return a}function b(a,b){return b.z-a.z}function c(a,b){var c=0,d=1,e=a.z+a.w,f=b.z+b.w,g=-a.z+a.w,h=-b.z+b.w;return e>=0&&f>=0&&g>=0&&h>=0?!0:e<0&&f<0||g<0&&h<0?!1:(e<0?c=Math.max(c,e/(e-f)):f<0&&(d=Math.min(d,e/(e-f))),g<0?c=Math.max(c,g/(g-h)):h<0&&(d=Math.min(d,g/(g-h))),d<c?!1:(a.lerpSelf(b,c),b.lerpSelf(a,1-d),!0))}var d,e,g=[],f,h,k=[],i,l,j=[],m,n=[],p,q,v=[],u,C,K=[],t=[],w=[],z=new THREE.Vector4,y=new THREE.Vector4,
 o=new THREE.Matrix4,E=new THREE.Matrix4,D=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],F=new THREE.Vector4,G=new THREE.Vector4;this.projectVector=function(a,b){o.multiply(b.projectionMatrix,b.matrixWorldInverse);o.multiplyVector3(a);return a};this.unprojectVector=function(a,b){o.multiply(b.matrixWorld,THREE.Matrix4.makeInvert(b.projectionMatrix));o.multiplyVector3(a);return a};this.projectObjects=function(a,c,f){var h,i;e=t.length=0;
 h=a.objects;a=0;for(c=h.length;a<c;a++){i=h[a];var k;if(!(k=!i.visible))if(k=i instanceof THREE.Mesh)if(k=i.frustumCulled){a:{k=void 0;for(var j=i.matrixWorld,l=-i.geometry.boundingSphere.radius*Math.max(i.scale.x,Math.max(i.scale.y,i.scale.z)),m=0;m<6;m++)if(k=D[m].x*j.n14+D[m].y*j.n24+D[m].z*j.n34+D[m].w,k<=l){k=!1;break a}k=!0}k=!k}if(!k)k=g[e]=g[e]||new THREE.RenderableObject,e++,d=k,z.copy(i.position),o.multiplyVector3(z),d.object=i,d.z=z.z,t.push(d)}f&&t.sort(b);return t};this.projectScene=
@@ -65,7 +65,7 @@ i.v2.copy(J),i.v3.copy(H);else continue;else if(I instanceof THREE.Face4)if(r=k[
 T[H]}i.meshMaterials=W;i.faceMaterials=I.materials;i.overdraw=X;i.z=i.centroidScreen.z;w.push(i)}}else if(B instanceof THREE.Line){E.multiply(o,Q);L=B.geometry.vertices;r=a();r.positionScreen.copy(L[0].position);E.multiplyVector4(r.positionScreen);P=1;for(I=L.length;P<I;P++)if(r=a(),r.positionScreen.copy(L[P].position),E.multiplyVector4(r.positionScreen),J=k[h-2],F.copy(r.positionScreen),G.copy(J.positionScreen),c(F,G))F.multiplyScalar(1/F.w),G.multiplyScalar(1/G.w),Q=v[q]=v[q]||new THREE.RenderableLine,
 q++,p=Q,p.v1.positionScreen.copy(F),p.v2.positionScreen.copy(G),p.z=Math.max(F.z,G.z),p.materials=B.materials,w.push(p)}else if(B instanceof THREE.Particle&&(y.set(B.matrixWorld.n14,B.matrixWorld.n24,B.matrixWorld.n34,1),o.multiplyVector4(y),y.z/=y.w,y.z>0&&y.z<1))Q=K[C]=K[C]||new THREE.RenderableParticle,C++,u=Q,u.x=y.x/y.w,u.y=y.y/y.w,u.z=y.z,u.rotation=B.rotation.z,u.scale.x=B.scale.x*Math.abs(u.x-(y.x+e.projectionMatrix.n11)/(y.w+e.projectionMatrix.n14)),u.scale.y=B.scale.y*Math.abs(u.y-(y.y+
 e.projectionMatrix.n22)/(y.w+e.projectionMatrix.n24)),u.materials=B.materials,w.push(u);g&&w.sort(b);return w}};THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,d!==void 0?d:1)};
-THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this},setFromEuler:function(a){var b=0.5*Math.PI/360,c=a.x*b,d=a.y*b,e=a.z*b,a=Math.cos(d),d=Math.sin(d),b=Math.cos(-e),e=Math.sin(-e),g=Math.cos(c),c=Math.sin(c),f=a*b,h=d*e;this.w=f*g-h*c;this.x=f*c+h*g;this.y=d*b*g+a*e*c;this.z=a*e*g-d*b*c;return this},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);
+THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this},setFromEuler:function(a){var b=Math.PI/360,c=a.x*b,d=a.y*b,e=a.z*b,a=Math.cos(d),d=Math.sin(d),b=Math.cos(-e),e=Math.sin(-e),g=Math.cos(c),c=Math.sin(c),f=a*b,h=d*e;this.w=f*g-h*c;this.x=f*c+h*g;this.y=d*b*g+a*e*c;this.z=a*e*g-d*b*c;return this},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);
 this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRotationMatrix:function(a){var b=Math.pow(a.determinant(),1/3);this.w=Math.sqrt(Math.max(0,b+a.n11+a.n22+a.n33))/2;this.x=Math.sqrt(Math.max(0,b+a.n11-a.n22-a.n33))/2;this.y=Math.sqrt(Math.max(0,b-a.n11+a.n22-a.n33))/2;this.z=Math.sqrt(Math.max(0,b-a.n11-a.n22+a.n33))/2;this.x=a.n32-a.n23<0?-Math.abs(this.x):Math.abs(this.x);this.y=a.n13-a.n31<0?-Math.abs(this.y):Math.abs(this.y);this.z=a.n21-a.n12<0?-Math.abs(this.z):Math.abs(this.z);
 this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);a==0?this.w=this.z=this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},multiplySelf:function(a){var b=
 this.x,c=this.y,d=this.z,e=this.w,g=a.x,f=a.y,h=a.z,a=a.w;this.x=b*a+e*g+c*h-d*f;this.y=c*a+e*f+d*g-b*h;this.z=d*a+e*h+b*f-c*g;this.w=e*a-b*g-c*f-d*h;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,g=this.x,f=this.y,h=this.z,k=this.w,i=k*c+f*e-h*d,l=k*d+h*c-g*e,j=k*e+g*d-f*c,c=-g*
@@ -85,7 +85,7 @@ D[c].addSelf(G);D[d].addSelf(G)}var b,c,d,e,g,f,h,k,i,l,j,m,n,p,q,v,u,C,K,t,w,z,
 this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var b=1,c=this.vertices.length;b<c;b++){a=this.vertices[b];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=
 a.position.z;else if(a.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=0,b=0,c=this.vertices.length;b<c;b++)a=Math.max(a,this.vertices[b].position.length());this.boundingSphere={radius:a}},computeEdgeFaces:function(){function a(a,b){return Math.min(a,b)+"_"+Math.max(a,b)}function b(a,b,c){a[b]===void 0?(a[b]={set:{},array:[]},a[b].set[c]=1,a[b].array.push(c)):a[b].set[c]===void 0&&(a[b].set[c]=1,a[b].array.push(c))}var c,d,e,g,f,h=
 {};c=0;for(d=this.faces.length;c<d;c++)f=this.faces[c],f instanceof THREE.Face3?(e=a(f.a,f.b),b(h,e,c),e=a(f.b,f.c),b(h,e,c),e=a(f.a,f.c),b(h,e,c)):f instanceof THREE.Face4&&(e=a(f.b,f.d),b(h,e,c),e=a(f.a,f.b),b(h,e,c),e=a(f.a,f.d),b(h,e,c),e=a(f.b,f.c),b(h,e,c),e=a(f.c,f.d),b(h,e,c));c=0;for(d=this.edges.length;c<d;c++){f=this.edges[c];e=f.vertexIndices[0];g=f.vertexIndices[1];f.faceIndices=h[a(e,g)].array;for(e=0;e<f.faceIndices.length;e++)g=f.faceIndices[e],f.faces.push(this.faces[g])}}};
-THREE.GeometryCount=0;THREE.Camera=function(a,b,c,d,e){THREE.Object3D.call(this);this.fov=a||50;this.aspect=b||1;this.near=c!==void 0?c:0.1;this.far=d!==void 0?d:2E3;this.target=e||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;
+THREE.GeometryCount=0;THREE.Camera=function(a,b,c,d,e){THREE.Object3D.call(this);this.fov=a||50;this.aspect=b||1;this.near=c!==void 0?c:0.1;this.far=d!==void 0?d:2E3;this.target=e||new THREE.Object3D;this.useTarget=!1;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;
 THREE.Camera.prototype.translate=function(a,b){this.matrix.rotateAxis(b);b.multiplyScalar(a);this.position.addSelf(b);this.target.position.addSelf(b)};
 THREE.Camera.prototype.updateProjectionMatrix=function(){if(this.fullWidth){var a=this.fullWidth/this.fullHeight,b=Math.tan(this.fov*Math.PI/360)*this.near,c=-b,d=a*c,a=Math.abs(a*b-d),c=Math.abs(b-c);this.projectionMatrix=THREE.Matrix4.makeFrustum(d+this.x*a/this.fullWidth,d+(this.x+this.width)*a/this.fullWidth,b-(this.y+this.height)*c/this.fullHeight,b-this.y*c/this.fullHeight,this.near,this.far)}else this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};
 THREE.Camera.prototype.setViewOffset=function(a,b,c,d,e,g){this.fullWidth=a;this.fullHeight=b;this.x=c;this.y=d;this.width=e;this.height=g;this.updateProjectionMatrix()};
@@ -94,7 +94,7 @@ THREE.Camera.prototype.update=function(a,b,c){if(this.useTarget)this.matrix.look
 THREE.OrthoCamera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makeOrtho(this.left,this.right,this.top,this.bottom,this.near,this.far)};THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;
 THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;THREE.DirectionalLight=function(a,b,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=b!==void 0?b:1;this.distance=c!==void 0?c:0};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,b,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,0,0);this.intensity=b!==void 0?b:1;this.distance=c!==void 0?c:0};
 THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight;
-THREE.Material=function(a){this.id=THREE.MaterialCount++;a=a||{};this.opacity=a.opacity!==void 0?a.opacity:1;this.transparent=a.transparent!==void 0?a.transparent:!1;this.blending=a.blending!==void 0?a.blending:THREE.NormalBlending;this.depthTest=a.depthTest!==void 0?a.depthTest:!0;this.depthWrite=a.depthWrite!==void 0?a.depthWrite:!0;this.polygonOffset=a.polygonOffset!==void 0?a.polygonOffset:!1;this.polygonOffsetFactor=a.polygonOffsetFactor!==void 0?a.polygonOffsetFactor:0;this.polygonOffsetUnits=
+THREE.Material=function(a){this.name="";this.id=THREE.MaterialCount++;a=a||{};this.opacity=a.opacity!==void 0?a.opacity:1;this.transparent=a.transparent!==void 0?a.transparent:!1;this.blending=a.blending!==void 0?a.blending:THREE.NormalBlending;this.depthTest=a.depthTest!==void 0?a.depthTest:!0;this.depthWrite=a.depthWrite!==void 0?a.depthWrite:!0;this.polygonOffset=a.polygonOffset!==void 0?a.polygonOffset:!1;this.polygonOffsetFactor=a.polygonOffsetFactor!==void 0?a.polygonOffsetFactor:0;this.polygonOffsetUnits=
 a.polygonOffsetUnits!==void 0?a.polygonOffsetUnits:0;this.alphaTest=a.alphaTest!==void 0?a.alphaTest:0};THREE.MaterialCount=0;THREE.NoShading=0;THREE.FlatShading=1;THREE.SmoothShading=2;THREE.NoColors=0;THREE.FaceColors=1;THREE.VertexColors=2;THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;THREE.MultiplyBlending=3;THREE.AdditiveAlphaBlending=4;
 THREE.LineBasicMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=a.color!==void 0?new THREE.Color(a.color):new THREE.Color(16777215);this.linewidth=a.linewidth!==void 0?a.linewidth:1;this.linecap=a.linecap!==void 0?a.linecap:"round";this.linejoin=a.linejoin!==void 0?a.linejoin:"round";this.vertexColors=a.vertexColors?a.vertexColors:!1;this.fog=a.fog!==void 0?a.fog:!0};THREE.LineBasicMaterial.prototype=new THREE.Material;THREE.LineBasicMaterial.prototype.constructor=THREE.LineBasicMaterial;
 THREE.MeshBasicMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=a.color!==void 0?new THREE.Color(a.color):new THREE.Color(16777215);this.map=a.map!==void 0?a.map:null;this.lightMap=a.lightMap!==void 0?a.lightMap:null;this.envMap=a.envMap!==void 0?a.envMap:null;this.combine=a.combine!==void 0?a.combine:THREE.MultiplyOperation;this.reflectivity=a.reflectivity!==void 0?a.reflectivity:1;this.refractionRatio=a.refractionRatio!==void 0?a.refractionRatio:0.98;this.fog=a.fog!==void 0?a.fog:

+ 157 - 157
build/custom/ThreeWebGL.js

@@ -16,80 +16,80 @@ c.z;this.w=b.w-c.w;return this},subSelf:function(b){this.x-=b.x;this.y-=b.y;this
 normalize:function(){return this.divideScalar(this.length())},setLength:function(b){return this.normalize().multiplyScalar(b)},lerpSelf:function(b,c){this.x+=(b.x-this.x)*c;this.y+=(b.y-this.y)*c;this.z+=(b.z-this.z)*c;this.w+=(b.w-this.w)*c;return this}};THREE.Ray=function(b,c){this.origin=b||new THREE.Vector3;this.direction=c||new THREE.Vector3};
 THREE.Ray.prototype={constructor:THREE.Ray,intersectScene:function(b){return this.intersectObjects(b.objects)},intersectObjects:function(b){var c,d,f=[];c=0;for(d=b.length;c<d;c++)Array.prototype.push.apply(f,this.intersectObject(b[c]));f.sort(function(b,c){return b.distance-c.distance});return f},intersectObject:function(b){function c(b,c,d){var f;f=d.clone().subSelf(b).dot(c);if(f<=0)return null;b=b.clone().addSelf(c.clone().multiplyScalar(f));return d.distanceTo(b)}function d(b,c,d,f){var f=f.clone().subSelf(c),
 d=d.clone().subSelf(c),i=b.clone().subSelf(c),b=f.dot(f),c=f.dot(d),f=f.dot(i),h=d.dot(d),d=d.dot(i),i=1/(b*h-c*c),h=(h*f-c*d)*i,b=(b*d-c*f)*i;return h>0&&b>0&&h+b<1}if(b instanceof THREE.Particle){var f=c(this.origin,this.direction,b.matrixWorld.getPosition());if(f==null||f>b.scale.x)return[];return[{distance:f,point:b.position,face:null,object:b}]}else if(b instanceof THREE.Mesh){f=c(this.origin,this.direction,b.matrixWorld.getPosition());if(f==null||f>b.geometry.boundingSphere.radius*Math.max(b.scale.x,
-Math.max(b.scale.y,b.scale.z)))return[];var i,h,j,k,p,n,q,m,t,v,B=b.geometry,x=B.vertices,D=[],f=0;for(i=B.faces.length;f<i;f++)if(h=B.faces[f],t=this.origin.clone(),v=this.direction.clone(),n=b.matrixWorld,j=n.multiplyVector3(h.centroid.clone()).subSelf(t),m=j.dot(v),!(m<=0)&&(j=n.multiplyVector3(x[h.a].position.clone()),k=n.multiplyVector3(x[h.b].position.clone()),p=n.multiplyVector3(x[h.c].position.clone()),n=h instanceof THREE.Face4?n.multiplyVector3(x[h.d].position.clone()):null,q=b.matrixRotationWorld.multiplyVector3(h.normal.clone()),
-m=v.dot(q),b.doubleSided||(b.flipSided?m>0:m<0)))if(m=q.dot((new THREE.Vector3).sub(j,t))/m,t=t.addSelf(v.multiplyScalar(m)),h instanceof THREE.Face3)d(t,j,k,p)&&(h={distance:this.origin.distanceTo(t),point:t,face:h,object:b},D.push(h));else if(h instanceof THREE.Face4&&(d(t,j,k,n)||d(t,k,p,n)))h={distance:this.origin.distanceTo(t),point:t,face:h,object:b},D.push(h);D.sort(function(b,c){return b.distance-c.distance});return D}else return[]}};
-THREE.Rectangle=function(){function b(){h=f-c;j=i-d}var c,d,f,i,h,j,k=!0;this.getX=function(){return c};this.getY=function(){return d};this.getWidth=function(){return h};this.getHeight=function(){return j};this.getLeft=function(){return c};this.getTop=function(){return d};this.getRight=function(){return f};this.getBottom=function(){return i};this.set=function(h,j,q,m){k=!1;c=h;d=j;f=q;i=m;b()};this.addPoint=function(h,j){k?(k=!1,c=h,d=j,f=h,i=j):(c=c<h?c:h,d=d<j?d:j,f=f>h?f:h,i=i>j?i:j);b()};this.add3Points=
-function(h,j,q,m,t,v){k?(k=!1,c=h<q?h<t?h:t:q<t?q:t,d=j<m?j<v?j:v:m<v?m:v,f=h>q?h>t?h:t:q>t?q:t,i=j>m?j>v?j:v:m>v?m:v):(c=h<q?h<t?h<c?h:c:t<c?t:c:q<t?q<c?q:c:t<c?t:c,d=j<m?j<v?j<d?j:d:v<d?v:d:m<v?m<d?m:d:v<d?v:d,f=h>q?h>t?h>f?h:f:t>f?t:f:q>t?q>f?q:f:t>f?t:f,i=j>m?j>v?j>i?j:i:v>i?v:i:m>v?m>i?m:i:v>i?v:i);b()};this.addRectangle=function(h){k?(k=!1,c=h.getLeft(),d=h.getTop(),f=h.getRight(),i=h.getBottom()):(c=c<h.getLeft()?c:h.getLeft(),d=d<h.getTop()?d:h.getTop(),f=f>h.getRight()?f:h.getRight(),i=i>
+Math.max(b.scale.y,b.scale.z)))return[];var i,h,j,k,m,n,q,p,t,v,B=b.geometry,x=B.vertices,E=[],f=0;for(i=B.faces.length;f<i;f++)if(h=B.faces[f],t=this.origin.clone(),v=this.direction.clone(),n=b.matrixWorld,j=n.multiplyVector3(h.centroid.clone()).subSelf(t),p=j.dot(v),!(p<=0)&&(j=n.multiplyVector3(x[h.a].position.clone()),k=n.multiplyVector3(x[h.b].position.clone()),m=n.multiplyVector3(x[h.c].position.clone()),n=h instanceof THREE.Face4?n.multiplyVector3(x[h.d].position.clone()):null,q=b.matrixRotationWorld.multiplyVector3(h.normal.clone()),
+p=v.dot(q),b.doubleSided||(b.flipSided?p>0:p<0)))if(p=q.dot((new THREE.Vector3).sub(j,t))/p,t=t.addSelf(v.multiplyScalar(p)),h instanceof THREE.Face3)d(t,j,k,m)&&(h={distance:this.origin.distanceTo(t),point:t,face:h,object:b},E.push(h));else if(h instanceof THREE.Face4&&(d(t,j,k,n)||d(t,k,m,n)))h={distance:this.origin.distanceTo(t),point:t,face:h,object:b},E.push(h);E.sort(function(b,c){return b.distance-c.distance});return E}else return[]}};
+THREE.Rectangle=function(){function b(){h=f-c;j=i-d}var c,d,f,i,h,j,k=!0;this.getX=function(){return c};this.getY=function(){return d};this.getWidth=function(){return h};this.getHeight=function(){return j};this.getLeft=function(){return c};this.getTop=function(){return d};this.getRight=function(){return f};this.getBottom=function(){return i};this.set=function(h,j,q,p){k=!1;c=h;d=j;f=q;i=p;b()};this.addPoint=function(h,j){k?(k=!1,c=h,d=j,f=h,i=j):(c=c<h?c:h,d=d<j?d:j,f=f>h?f:h,i=i>j?i:j);b()};this.add3Points=
+function(h,j,q,p,t,v){k?(k=!1,c=h<q?h<t?h:t:q<t?q:t,d=j<p?j<v?j:v:p<v?p:v,f=h>q?h>t?h:t:q>t?q:t,i=j>p?j>v?j:v:p>v?p:v):(c=h<q?h<t?h<c?h:c:t<c?t:c:q<t?q<c?q:c:t<c?t:c,d=j<p?j<v?j<d?j:d:v<d?v:d:p<v?p<d?p:d:v<d?v:d,f=h>q?h>t?h>f?h:f:t>f?t:f:q>t?q>f?q:f:t>f?t:f,i=j>p?j>v?j>i?j:i:v>i?v:i:p>v?p>i?p:i:v>i?v:i);b()};this.addRectangle=function(h){k?(k=!1,c=h.getLeft(),d=h.getTop(),f=h.getRight(),i=h.getBottom()):(c=c<h.getLeft()?c:h.getLeft(),d=d<h.getTop()?d:h.getTop(),f=f>h.getRight()?f:h.getRight(),i=i>
 h.getBottom()?i:h.getBottom());b()};this.inflate=function(h){c-=h;d-=h;f+=h;i+=h;b()};this.minSelf=function(h){c=c>h.getLeft()?c:h.getLeft();d=d>h.getTop()?d:h.getTop();f=f<h.getRight()?f:h.getRight();i=i<h.getBottom()?i:h.getBottom();b()};this.intersects=function(b){return Math.min(f,b.getRight())-Math.max(c,b.getLeft())>=0&&Math.min(i,b.getBottom())-Math.max(d,b.getTop())>=0};this.empty=function(){k=!0;i=f=d=c=0;b()};this.isEmpty=function(){return k}};THREE.Matrix3=function(){this.m=[]};
 THREE.Matrix3.prototype={constructor:THREE.Matrix3,transpose:function(){var b,c=this.m;b=c[1];c[1]=c[3];c[3]=b;b=c[2];c[2]=c[6];c[6]=b;b=c[5];c[5]=c[7];c[7]=b;return this},transposeIntoArray:function(b){var c=this.m;b[0]=c[0];b[1]=c[3];b[2]=c[6];b[3]=c[1];b[4]=c[4];b[5]=c[7];b[6]=c[2];b[7]=c[5];b[8]=c[8];return this}};
-THREE.Matrix4=function(b,c,d,f,i,h,j,k,p,n,q,m,t,v,B,x){this.set(b!==void 0?b:1,c||0,d||0,f||0,i||0,h!==void 0?h:1,j||0,k||0,p||0,n||0,q!==void 0?q:1,m||0,t||0,v||0,B||0,x!==void 0?x:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
-THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(b,c,d,f,i,h,j,k,p,n,q,m,t,v,B,x){this.n11=b;this.n12=c;this.n13=d;this.n14=f;this.n21=i;this.n22=h;this.n23=j;this.n24=k;this.n31=p;this.n32=n;this.n33=q;this.n34=m;this.n41=t;this.n42=v;this.n43=B;this.n44=x;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b,
+THREE.Matrix4=function(b,c,d,f,i,h,j,k,m,n,q,p,t,v,B,x){this.set(b!==void 0?b:1,c||0,d||0,f||0,i||0,h!==void 0?h:1,j||0,k||0,m||0,n||0,q!==void 0?q:1,p||0,t||0,v||0,B||0,x!==void 0?x:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
+THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(b,c,d,f,i,h,j,k,m,n,q,p,t,v,B,x){this.n11=b;this.n12=c;this.n13=d;this.n14=f;this.n21=i;this.n22=h;this.n23=j;this.n24=k;this.n31=m;this.n32=n;this.n33=q;this.n34=p;this.n41=t;this.n42=v;this.n43=B;this.n44=x;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b,
 c,d){var f=THREE.Matrix4.__v1,i=THREE.Matrix4.__v2,h=THREE.Matrix4.__v3;h.sub(b,c).normalize();if(h.length()===0)h.z=1;f.cross(d,h).normalize();f.length()===0&&(h.x+=1.0E-4,f.cross(d,h).normalize());i.cross(h,f).normalize();this.n11=f.x;this.n12=i.x;this.n13=h.x;this.n21=f.y;this.n22=i.y;this.n23=h.y;this.n31=f.z;this.n32=i.z;this.n33=h.z;return this},multiplyVector3:function(b){var c=b.x,d=b.y,f=b.z,i=1/(this.n41*c+this.n42*d+this.n43*f+this.n44);b.x=(this.n11*c+this.n12*d+this.n13*f+this.n14)*i;
 b.y=(this.n21*c+this.n22*d+this.n23*f+this.n24)*i;b.z=(this.n31*c+this.n32*d+this.n33*f+this.n34)*i;return b},multiplyVector4:function(b){var c=b.x,d=b.y,f=b.z,i=b.w;b.x=this.n11*c+this.n12*d+this.n13*f+this.n14*i;b.y=this.n21*c+this.n22*d+this.n23*f+this.n24*i;b.z=this.n31*c+this.n32*d+this.n33*f+this.n34*i;b.w=this.n41*c+this.n42*d+this.n43*f+this.n44*i;return b},rotateAxis:function(b){var c=b.x,d=b.y,f=b.z;b.x=c*this.n11+d*this.n12+f*this.n13;b.y=c*this.n21+d*this.n22+f*this.n23;b.z=c*this.n31+
-d*this.n32+f*this.n33;b.normalize();return b},crossVector:function(b){var c=new THREE.Vector4;c.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;c.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;c.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;c.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return c},multiply:function(b,c){var d=b.n11,f=b.n12,i=b.n13,h=b.n14,j=b.n21,k=b.n22,p=b.n23,n=b.n24,q=b.n31,m=b.n32,t=b.n33,v=b.n34,B=b.n41,x=b.n42,D=b.n43,F=b.n44,va=c.n11,wa=
-c.n12,qa=c.n13,ra=c.n14,ia=c.n21,G=c.n22,u=c.n23,T=c.n24,L=c.n31,U=c.n32,Z=c.n33,ja=c.n34,W=c.n41,M=c.n42,e=c.n43,za=c.n44;this.n11=d*va+f*ia+i*L+h*W;this.n12=d*wa+f*G+i*U+h*M;this.n13=d*qa+f*u+i*Z+h*e;this.n14=d*ra+f*T+i*ja+h*za;this.n21=j*va+k*ia+p*L+n*W;this.n22=j*wa+k*G+p*U+n*M;this.n23=j*qa+k*u+p*Z+n*e;this.n24=j*ra+k*T+p*ja+n*za;this.n31=q*va+m*ia+t*L+v*W;this.n32=q*wa+m*G+t*U+v*M;this.n33=q*qa+m*u+t*Z+v*e;this.n34=q*ra+m*T+t*ja+v*za;this.n41=B*va+x*ia+D*L+F*W;this.n42=B*wa+x*G+D*U+F*M;this.n43=
-B*qa+x*u+D*Z+F*e;this.n44=B*ra+x*T+D*ja+F*za;return this},multiplyToArray:function(b,c,d){this.multiply(b,c);d[0]=this.n11;d[1]=this.n21;d[2]=this.n31;d[3]=this.n41;d[4]=this.n12;d[5]=this.n22;d[6]=this.n32;d[7]=this.n42;d[8]=this.n13;d[9]=this.n23;d[10]=this.n33;d[11]=this.n43;d[12]=this.n14;d[13]=this.n24;d[14]=this.n34;d[15]=this.n44;return this},multiplySelf:function(b){this.multiply(this,b);return this},multiplyScalar:function(b){this.n11*=b;this.n12*=b;this.n13*=b;this.n14*=b;this.n21*=b;this.n22*=
-b;this.n23*=b;this.n24*=b;this.n31*=b;this.n32*=b;this.n33*=b;this.n34*=b;this.n41*=b;this.n42*=b;this.n43*=b;this.n44*=b;return this},determinant:function(){var b=this.n11,c=this.n12,d=this.n13,f=this.n14,i=this.n21,h=this.n22,j=this.n23,k=this.n24,p=this.n31,n=this.n32,q=this.n33,m=this.n34,t=this.n41,v=this.n42,B=this.n43,x=this.n44;return f*j*n*t-d*k*n*t-f*h*q*t+c*k*q*t+d*h*m*t-c*j*m*t-f*j*p*v+d*k*p*v+f*i*q*v-b*k*q*v-d*i*m*v+b*j*m*v+f*h*p*B-c*k*p*B-f*i*n*B+b*k*n*B+c*i*m*B-b*h*m*B-d*h*p*x+c*j*
-p*x+d*i*n*x-b*j*n*x-c*i*q*x+b*h*q*x},transpose:function(){var b;b=this.n21;this.n21=this.n12;this.n12=b;b=this.n31;this.n31=this.n13;this.n13=b;b=this.n32;this.n32=this.n23;this.n23=b;b=this.n41;this.n41=this.n14;this.n14=b;b=this.n42;this.n42=this.n24;this.n24=b;b=this.n43;this.n43=this.n34;this.n43=b;return this},clone:function(){var b=new THREE.Matrix4;b.n11=this.n11;b.n12=this.n12;b.n13=this.n13;b.n14=this.n14;b.n21=this.n21;b.n22=this.n22;b.n23=this.n23;b.n24=this.n24;b.n31=this.n31;b.n32=this.n32;
+d*this.n32+f*this.n33;b.normalize();return b},crossVector:function(b){var c=new THREE.Vector4;c.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;c.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;c.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;c.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return c},multiply:function(b,c){var d=b.n11,f=b.n12,i=b.n13,h=b.n14,j=b.n21,k=b.n22,m=b.n23,n=b.n24,q=b.n31,p=b.n32,t=b.n33,v=b.n34,B=b.n41,x=b.n42,E=b.n43,F=b.n44,wa=c.n11,xa=
+c.n12,qa=c.n13,ra=c.n14,ja=c.n21,G=c.n22,u=c.n23,S=c.n24,L=c.n31,T=c.n32,Z=c.n33,ya=c.n34,V=c.n41,M=c.n42,e=c.n43,ua=c.n44;this.n11=d*wa+f*ja+i*L+h*V;this.n12=d*xa+f*G+i*T+h*M;this.n13=d*qa+f*u+i*Z+h*e;this.n14=d*ra+f*S+i*ya+h*ua;this.n21=j*wa+k*ja+m*L+n*V;this.n22=j*xa+k*G+m*T+n*M;this.n23=j*qa+k*u+m*Z+n*e;this.n24=j*ra+k*S+m*ya+n*ua;this.n31=q*wa+p*ja+t*L+v*V;this.n32=q*xa+p*G+t*T+v*M;this.n33=q*qa+p*u+t*Z+v*e;this.n34=q*ra+p*S+t*ya+v*ua;this.n41=B*wa+x*ja+E*L+F*V;this.n42=B*xa+x*G+E*T+F*M;this.n43=
+B*qa+x*u+E*Z+F*e;this.n44=B*ra+x*S+E*ya+F*ua;return this},multiplyToArray:function(b,c,d){this.multiply(b,c);d[0]=this.n11;d[1]=this.n21;d[2]=this.n31;d[3]=this.n41;d[4]=this.n12;d[5]=this.n22;d[6]=this.n32;d[7]=this.n42;d[8]=this.n13;d[9]=this.n23;d[10]=this.n33;d[11]=this.n43;d[12]=this.n14;d[13]=this.n24;d[14]=this.n34;d[15]=this.n44;return this},multiplySelf:function(b){this.multiply(this,b);return this},multiplyScalar:function(b){this.n11*=b;this.n12*=b;this.n13*=b;this.n14*=b;this.n21*=b;this.n22*=
+b;this.n23*=b;this.n24*=b;this.n31*=b;this.n32*=b;this.n33*=b;this.n34*=b;this.n41*=b;this.n42*=b;this.n43*=b;this.n44*=b;return this},determinant:function(){var b=this.n11,c=this.n12,d=this.n13,f=this.n14,i=this.n21,h=this.n22,j=this.n23,k=this.n24,m=this.n31,n=this.n32,q=this.n33,p=this.n34,t=this.n41,v=this.n42,B=this.n43,x=this.n44;return f*j*n*t-d*k*n*t-f*h*q*t+c*k*q*t+d*h*p*t-c*j*p*t-f*j*m*v+d*k*m*v+f*i*q*v-b*k*q*v-d*i*p*v+b*j*p*v+f*h*m*B-c*k*m*B-f*i*n*B+b*k*n*B+c*i*p*B-b*h*p*B-d*h*m*x+c*j*
+m*x+d*i*n*x-b*j*n*x-c*i*q*x+b*h*q*x},transpose:function(){var b;b=this.n21;this.n21=this.n12;this.n12=b;b=this.n31;this.n31=this.n13;this.n13=b;b=this.n32;this.n32=this.n23;this.n23=b;b=this.n41;this.n41=this.n14;this.n14=b;b=this.n42;this.n42=this.n24;this.n24=b;b=this.n43;this.n43=this.n34;this.n43=b;return this},clone:function(){var b=new THREE.Matrix4;b.n11=this.n11;b.n12=this.n12;b.n13=this.n13;b.n14=this.n14;b.n21=this.n21;b.n22=this.n22;b.n23=this.n23;b.n24=this.n24;b.n31=this.n31;b.n32=this.n32;
 b.n33=this.n33;b.n34=this.n34;b.n41=this.n41;b.n42=this.n42;b.n43=this.n43;b.n44=this.n44;return b},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(b){b[0]=
 this.n11;b[1]=this.n21;b[2]=this.n31;b[3]=this.n41;b[4]=this.n12;b[5]=this.n22;b[6]=this.n32;b[7]=this.n42;b[8]=this.n13;b[9]=this.n23;b[10]=this.n33;b[11]=this.n43;b[12]=this.n14;b[13]=this.n24;b[14]=this.n34;b[15]=this.n44;return b},flattenToArrayOffset:function(b,c){b[c]=this.n11;b[c+1]=this.n21;b[c+2]=this.n31;b[c+3]=this.n41;b[c+4]=this.n12;b[c+5]=this.n22;b[c+6]=this.n32;b[c+7]=this.n42;b[c+8]=this.n13;b[c+9]=this.n23;b[c+10]=this.n33;b[c+11]=this.n43;b[c+12]=this.n14;b[c+13]=this.n24;b[c+14]=
 this.n34;b[c+15]=this.n44;return b},setTranslation:function(b,c,d){this.set(1,0,0,b,0,1,0,c,0,0,1,d,0,0,0,1);return this},setScale:function(b,c,d){this.set(b,0,0,0,0,c,0,0,0,0,d,0,0,0,0,1);return this},setRotationX:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(1,0,0,0,0,c,-b,0,0,b,c,0,0,0,0,1);return this},setRotationY:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(c,0,b,0,0,1,0,0,-b,0,c,0,0,0,0,1);return this},setRotationZ:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(c,-b,0,
-0,b,c,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(b,c){var d=Math.cos(c),f=Math.sin(c),i=1-d,h=b.x,j=b.y,k=b.z,p=i*h,n=i*j;this.set(p*h+d,p*j-f*k,p*k+f*j,0,p*j+f*k,n*j+d,n*k-f*h,0,p*k-f*j,n*k+f*h,i*k*k+d,0,0,0,0,1);return this},setPosition:function(b){this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},getPosition:function(){if(!this.position)this.position=new THREE.Vector3;this.position.set(this.n14,this.n24,this.n34);return this.position},getColumnX:function(){if(!this.columnX)this.columnX=
-new THREE.Vector3;this.columnX.set(this.n11,this.n21,this.n31);return this.columnX},getColumnY:function(){if(!this.columnY)this.columnY=new THREE.Vector3;this.columnY.set(this.n12,this.n22,this.n32);return this.columnY},getColumnZ:function(){if(!this.columnZ)this.columnZ=new THREE.Vector3;this.columnZ.set(this.n13,this.n23,this.n33);return this.columnZ},setRotationFromEuler:function(b,c){var d=b.x,f=b.y,i=b.z,h=Math.cos(d),d=Math.sin(d),j=Math.cos(f),f=Math.sin(f),k=Math.cos(i),i=Math.sin(i);switch(c){case "YXZ":var p=
-j*k,n=j*i,q=f*k,m=f*i;this.n11=p+m*d;this.n12=q*d-n;this.n13=h*f;this.n21=h*i;this.n22=h*k;this.n23=-d;this.n31=n*d-q;this.n32=m+p*d;this.n33=h*j;break;case "ZXY":p=j*k;n=j*i;q=f*k;m=f*i;this.n11=p-m*d;this.n12=-h*i;this.n13=q+n*d;this.n21=n+q*d;this.n22=h*k;this.n23=m-p*d;this.n31=-h*f;this.n32=d;this.n33=h*j;break;case "ZYX":p=h*k;n=h*i;q=d*k;m=d*i;this.n11=j*k;this.n12=q*f-n;this.n13=p*f+m;this.n21=j*i;this.n22=m*f+p;this.n23=n*f-q;this.n31=-f;this.n32=d*j;this.n33=h*j;break;case "YZX":p=h*j;n=
-h*f;q=d*j;m=d*f;this.n11=j*k;this.n12=m-p*i;this.n13=q*i+n;this.n21=i;this.n22=h*k;this.n23=-d*k;this.n31=-f*k;this.n32=n*i+q;this.n33=p-m*i;break;case "XZY":p=h*j;n=h*f;q=d*j;m=d*f;this.n11=j*k;this.n12=-i;this.n13=f*k;this.n21=p*i+m;this.n22=h*k;this.n23=n*i-q;this.n31=q*i-n;this.n32=d*k;this.n33=m*i+p;break;default:p=h*k,n=h*i,q=d*k,m=d*i,this.n11=j*k,this.n12=-j*i,this.n13=f,this.n21=n+q*f,this.n22=p-m*f,this.n23=-d*j,this.n31=m-p*f,this.n32=q+n*f,this.n33=h*j}return this},setRotationFromQuaternion:function(b){var c=
-b.x,d=b.y,f=b.z,i=b.w,h=c+c,j=d+d,k=f+f,b=c*h,p=c*j;c*=k;var n=d*j;d*=k;f*=k;h*=i;j*=i;i*=k;this.n11=1-(n+f);this.n12=p-i;this.n13=c+j;this.n21=p+i;this.n22=1-(b+f);this.n23=d-h;this.n31=c-j;this.n32=d+h;this.n33=1-(b+n);return this},scale:function(b){var c=b.x,d=b.y,b=b.z;this.n11*=c;this.n12*=d;this.n13*=b;this.n21*=c;this.n22*=d;this.n23*=b;this.n31*=c;this.n32*=d;this.n33*=b;this.n41*=c;this.n42*=d;this.n43*=b;return this},compose:function(b,c,d){var f=THREE.Matrix4.__m1,i=THREE.Matrix4.__m2;
+0,b,c,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(b,c){var d=Math.cos(c),f=Math.sin(c),i=1-d,h=b.x,j=b.y,k=b.z,m=i*h,n=i*j;this.set(m*h+d,m*j-f*k,m*k+f*j,0,m*j+f*k,n*j+d,n*k-f*h,0,m*k-f*j,n*k+f*h,i*k*k+d,0,0,0,0,1);return this},setPosition:function(b){this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},getPosition:function(){if(!this.position)this.position=new THREE.Vector3;this.position.set(this.n14,this.n24,this.n34);return this.position},getColumnX:function(){if(!this.columnX)this.columnX=
+new THREE.Vector3;this.columnX.set(this.n11,this.n21,this.n31);return this.columnX},getColumnY:function(){if(!this.columnY)this.columnY=new THREE.Vector3;this.columnY.set(this.n12,this.n22,this.n32);return this.columnY},getColumnZ:function(){if(!this.columnZ)this.columnZ=new THREE.Vector3;this.columnZ.set(this.n13,this.n23,this.n33);return this.columnZ},setRotationFromEuler:function(b,c){var d=b.x,f=b.y,i=b.z,h=Math.cos(d),d=Math.sin(d),j=Math.cos(f),f=Math.sin(f),k=Math.cos(i),i=Math.sin(i);switch(c){case "YXZ":var m=
+j*k,n=j*i,q=f*k,p=f*i;this.n11=m+p*d;this.n12=q*d-n;this.n13=h*f;this.n21=h*i;this.n22=h*k;this.n23=-d;this.n31=n*d-q;this.n32=p+m*d;this.n33=h*j;break;case "ZXY":m=j*k;n=j*i;q=f*k;p=f*i;this.n11=m-p*d;this.n12=-h*i;this.n13=q+n*d;this.n21=n+q*d;this.n22=h*k;this.n23=p-m*d;this.n31=-h*f;this.n32=d;this.n33=h*j;break;case "ZYX":m=h*k;n=h*i;q=d*k;p=d*i;this.n11=j*k;this.n12=q*f-n;this.n13=m*f+p;this.n21=j*i;this.n22=p*f+m;this.n23=n*f-q;this.n31=-f;this.n32=d*j;this.n33=h*j;break;case "YZX":m=h*j;n=
+h*f;q=d*j;p=d*f;this.n11=j*k;this.n12=p-m*i;this.n13=q*i+n;this.n21=i;this.n22=h*k;this.n23=-d*k;this.n31=-f*k;this.n32=n*i+q;this.n33=m-p*i;break;case "XZY":m=h*j;n=h*f;q=d*j;p=d*f;this.n11=j*k;this.n12=-i;this.n13=f*k;this.n21=m*i+p;this.n22=h*k;this.n23=n*i-q;this.n31=q*i-n;this.n32=d*k;this.n33=p*i+m;break;default:m=h*k,n=h*i,q=d*k,p=d*i,this.n11=j*k,this.n12=-j*i,this.n13=f,this.n21=n+q*f,this.n22=m-p*f,this.n23=-d*j,this.n31=p-m*f,this.n32=q+n*f,this.n33=h*j}return this},setRotationFromQuaternion:function(b){var c=
+b.x,d=b.y,f=b.z,i=b.w,h=c+c,j=d+d,k=f+f,b=c*h,m=c*j;c*=k;var n=d*j;d*=k;f*=k;h*=i;j*=i;i*=k;this.n11=1-(n+f);this.n12=m-i;this.n13=c+j;this.n21=m+i;this.n22=1-(b+f);this.n23=d-h;this.n31=c-j;this.n32=d+h;this.n33=1-(b+n);return this},scale:function(b){var c=b.x,d=b.y,b=b.z;this.n11*=c;this.n12*=d;this.n13*=b;this.n21*=c;this.n22*=d;this.n23*=b;this.n31*=c;this.n32*=d;this.n33*=b;this.n41*=c;this.n42*=d;this.n43*=b;return this},compose:function(b,c,d){var f=THREE.Matrix4.__m1,i=THREE.Matrix4.__m2;
 f.identity();f.setRotationFromQuaternion(c);i.setScale(d.x,d.y,d.z);this.multiply(f,i);this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},decompose:function(b,c,d){var f=THREE.Matrix4.__v1,i=THREE.Matrix4.__v2,h=THREE.Matrix4.__v3;f.set(this.n11,this.n21,this.n31);i.set(this.n12,this.n22,this.n32);h.set(this.n13,this.n23,this.n33);b=b instanceof THREE.Vector3?b:new THREE.Vector3;c=c instanceof THREE.Quaternion?c:new THREE.Quaternion;d=d instanceof THREE.Vector3?d:new THREE.Vector3;d.x=f.length();
 d.y=i.length();d.z=h.length();b.x=this.n14;b.y=this.n24;b.z=this.n34;f=THREE.Matrix4.__m1;f.copy(this);f.n11/=d.x;f.n21/=d.x;f.n31/=d.x;f.n12/=d.y;f.n22/=d.y;f.n32/=d.y;f.n13/=d.z;f.n23/=d.z;f.n33/=d.z;c.setFromRotationMatrix(f);return[b,c,d]},extractPosition:function(b){this.n14=b.n14;this.n24=b.n24;this.n34=b.n34},extractRotation:function(b,c){var d=1/c.x,f=1/c.y,i=1/c.z;this.n11=b.n11*d;this.n21=b.n21*d;this.n31=b.n31*d;this.n12=b.n12*f;this.n22=b.n22*f;this.n32=b.n32*f;this.n13=b.n13*i;this.n23=
 b.n23*i;this.n33=b.n33*i}};
-THREE.Matrix4.makeInvert=function(b,c){var d=b.n11,f=b.n12,i=b.n13,h=b.n14,j=b.n21,k=b.n22,p=b.n23,n=b.n24,q=b.n31,m=b.n32,t=b.n33,v=b.n34,B=b.n41,x=b.n42,D=b.n43,F=b.n44;c===void 0&&(c=new THREE.Matrix4);c.n11=p*v*x-n*t*x+n*m*D-k*v*D-p*m*F+k*t*F;c.n12=h*t*x-i*v*x-h*m*D+f*v*D+i*m*F-f*t*F;c.n13=i*n*x-h*p*x+h*k*D-f*n*D-i*k*F+f*p*F;c.n14=h*p*m-i*n*m-h*k*t+f*n*t+i*k*v-f*p*v;c.n21=n*t*B-p*v*B-n*q*D+j*v*D+p*q*F-j*t*F;c.n22=i*v*B-h*t*B+h*q*D-d*v*D-i*q*F+d*t*F;c.n23=h*p*B-i*n*B-h*j*D+d*n*D+i*j*F-d*p*F;c.n24=
-i*n*q-h*p*q+h*j*t-d*n*t-i*j*v+d*p*v;c.n31=k*v*B-n*m*B+n*q*x-j*v*x-k*q*F+j*m*F;c.n32=h*m*B-f*v*B-h*q*x+d*v*x+f*q*F-d*m*F;c.n33=i*n*B-h*k*B+h*j*x-d*n*x-f*j*F+d*k*F;c.n34=h*k*q-f*n*q-h*j*m+d*n*m+f*j*v-d*k*v;c.n41=p*m*B-k*t*B-p*q*x+j*t*x+k*q*D-j*m*D;c.n42=f*t*B-i*m*B+i*q*x-d*t*x-f*q*D+d*m*D;c.n43=i*k*B-f*p*B-i*j*x+d*p*x+f*j*D-d*k*D;c.n44=f*p*q-i*k*q+i*j*m-d*p*m-f*j*t+d*k*t;c.multiplyScalar(1/b.determinant());return c};
-THREE.Matrix4.makeInvert3x3=function(b){var c=b.m33,d=c.m,f=b.n33*b.n22-b.n32*b.n23,i=-b.n33*b.n21+b.n31*b.n23,h=b.n32*b.n21-b.n31*b.n22,j=-b.n33*b.n12+b.n32*b.n13,k=b.n33*b.n11-b.n31*b.n13,p=-b.n32*b.n11+b.n31*b.n12,n=b.n23*b.n12-b.n22*b.n13,q=-b.n23*b.n11+b.n21*b.n13,m=b.n22*b.n11-b.n21*b.n12,b=b.n11*f+b.n21*j+b.n31*n;b==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");b=1/b;d[0]=b*f;d[1]=b*i;d[2]=b*h;d[3]=b*j;d[4]=b*k;d[5]=b*p;d[6]=b*n;d[7]=b*q;d[8]=b*m;return c};
+THREE.Matrix4.makeInvert=function(b,c){var d=b.n11,f=b.n12,i=b.n13,h=b.n14,j=b.n21,k=b.n22,m=b.n23,n=b.n24,q=b.n31,p=b.n32,t=b.n33,v=b.n34,B=b.n41,x=b.n42,E=b.n43,F=b.n44;c===void 0&&(c=new THREE.Matrix4);c.n11=m*v*x-n*t*x+n*p*E-k*v*E-m*p*F+k*t*F;c.n12=h*t*x-i*v*x-h*p*E+f*v*E+i*p*F-f*t*F;c.n13=i*n*x-h*m*x+h*k*E-f*n*E-i*k*F+f*m*F;c.n14=h*m*p-i*n*p-h*k*t+f*n*t+i*k*v-f*m*v;c.n21=n*t*B-m*v*B-n*q*E+j*v*E+m*q*F-j*t*F;c.n22=i*v*B-h*t*B+h*q*E-d*v*E-i*q*F+d*t*F;c.n23=h*m*B-i*n*B-h*j*E+d*n*E+i*j*F-d*m*F;c.n24=
+i*n*q-h*m*q+h*j*t-d*n*t-i*j*v+d*m*v;c.n31=k*v*B-n*p*B+n*q*x-j*v*x-k*q*F+j*p*F;c.n32=h*p*B-f*v*B-h*q*x+d*v*x+f*q*F-d*p*F;c.n33=i*n*B-h*k*B+h*j*x-d*n*x-f*j*F+d*k*F;c.n34=h*k*q-f*n*q-h*j*p+d*n*p+f*j*v-d*k*v;c.n41=m*p*B-k*t*B-m*q*x+j*t*x+k*q*E-j*p*E;c.n42=f*t*B-i*p*B+i*q*x-d*t*x-f*q*E+d*p*E;c.n43=i*k*B-f*m*B-i*j*x+d*m*x+f*j*E-d*k*E;c.n44=f*m*q-i*k*q+i*j*p-d*m*p-f*j*t+d*k*t;c.multiplyScalar(1/b.determinant());return c};
+THREE.Matrix4.makeInvert3x3=function(b){var c=b.m33,d=c.m,f=b.n33*b.n22-b.n32*b.n23,i=-b.n33*b.n21+b.n31*b.n23,h=b.n32*b.n21-b.n31*b.n22,j=-b.n33*b.n12+b.n32*b.n13,k=b.n33*b.n11-b.n31*b.n13,m=-b.n32*b.n11+b.n31*b.n12,n=b.n23*b.n12-b.n22*b.n13,q=-b.n23*b.n11+b.n21*b.n13,p=b.n22*b.n11-b.n21*b.n12,b=b.n11*f+b.n21*j+b.n31*n;b==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");b=1/b;d[0]=b*f;d[1]=b*i;d[2]=b*h;d[3]=b*j;d[4]=b*k;d[5]=b*m;d[6]=b*n;d[7]=b*q;d[8]=b*p;return c};
 THREE.Matrix4.makeFrustum=function(b,c,d,f,i,h){var j;j=new THREE.Matrix4;j.n11=2*i/(c-b);j.n12=0;j.n13=(c+b)/(c-b);j.n14=0;j.n21=0;j.n22=2*i/(f-d);j.n23=(f+d)/(f-d);j.n24=0;j.n31=0;j.n32=0;j.n33=-(h+i)/(h-i);j.n34=-2*h*i/(h-i);j.n41=0;j.n42=0;j.n43=-1;j.n44=0;return j};THREE.Matrix4.makePerspective=function(b,c,d,f){var i,b=d*Math.tan(b*Math.PI/360);i=-b;return THREE.Matrix4.makeFrustum(i*c,b*c,i,b,d,f)};
-THREE.Matrix4.makeOrtho=function(b,c,d,f,i,h){var j,k,p,n;j=new THREE.Matrix4;k=c-b;p=d-f;n=h-i;j.n11=2/k;j.n12=0;j.n13=0;j.n14=-((c+b)/k);j.n21=0;j.n22=2/p;j.n23=0;j.n24=-((d+f)/p);j.n31=0;j.n32=0;j.n33=-2/n;j.n34=-((h+i)/n);j.n41=0;j.n42=0;j.n43=0;j.n44=1;return j};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
-THREE.Object3D=function(){this.id=THREE.Object3DCount++;this.name="";this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder="XYZ";this.scale=new THREE.Vector3(1,1,1);this.flipSided=this.doubleSided=this.dynamic=!1;this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=
+THREE.Matrix4.makeOrtho=function(b,c,d,f,i,h){var j,k,m,n;j=new THREE.Matrix4;k=c-b;m=d-f;n=h-i;j.n11=2/k;j.n12=0;j.n13=0;j.n14=-((c+b)/k);j.n21=0;j.n22=2/m;j.n23=0;j.n24=-((d+f)/m);j.n31=0;j.n32=0;j.n33=-2/n;j.n34=-((h+i)/n);j.n41=0;j.n42=0;j.n43=0;j.n44=1;return j};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
+THREE.Object3D=function(){this.name="";this.id=THREE.Object3DCount++;this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder="XYZ";this.scale=new THREE.Vector3(1,1,1);this.flipSided=this.doubleSided=this.dynamic=!1;this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=
 !0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=!0;this.receiveShadow=this.castShadow=!1;this.frustumCulled=!0;this._vector=new THREE.Vector3};
-THREE.Object3D.prototype={constructor:THREE.Object3D,translate:function(b,c){this.matrix.rotateAxis(c);this.position.addSelf(c.multiplyScalar(b))},translateX:function(b){this.translate(b,this._vector.set(1,0,0))},translateY:function(b){this.translate(b,this._vector.set(0,1,0))},translateZ:function(b){this.translate(b,this._vector.set(0,0,1))},lookAt:function(b){this.matrix.lookAt(b,this.position,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},add:function(b){if(this.children.indexOf(b)===
--1){b.parent!==void 0&&b.parent.removeChild(b);b.parent=this;this.children.push(b);for(var c=this;c.parent!==void 0;)c=c.parent;c!==void 0&&c instanceof THREE.Scene&&c.addChildRecurse(b)}},remove:function(b){var c=this,d=this.children.indexOf(b);if(d!==-1){b.parent=void 0;for(this.children.splice(d,1);c.parent!==void 0;)c=c.parent;c!==void 0&&c instanceof THREE.Scene&&c.removeChildRecurse(b)}},getChildByName:function(b,c){var d,f,i;d=0;for(f=this.children.length;d<f;d++){i=this.children[d];if(i.name===
-b)return i;if(c&&(i=i.getChildByName(b,c),i!==void 0))return i}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z));this.matrixWorldNeedsUpdate=!0},update:function(b,c,d){this.matrixAutoUpdate&&
-this.updateMatrix();if(this.matrixWorldNeedsUpdate||c)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale),this.matrixWorldNeedsUpdate=!1,c=!0;for(var b=0,f=this.children.length;b<f;b++)this.children[b].update(this.matrixWorld,c,d)},addChild:function(b){console.warn("DEPRECATED: Object3D.addChild() is now Object3D.add().");this.add(b)},removeChild:function(b){console.warn("DEPRECATED: Object3D.removeChild() is now Object3D.remove().");
-this.remove(b)}};THREE.Object3DCount=0;
-THREE.Projector=function(){function b(){var b=p[k]=p[k]||new THREE.RenderableVertex;k++;return b}function c(b,c){return c.z-b.z}function d(b,c){var d=0,e=1,f=b.z+b.w,i=c.z+c.w,h=-b.z+b.w,j=-c.z+c.w;return f>=0&&i>=0&&h>=0&&j>=0?!0:f<0&&i<0||h<0&&j<0?!1:(f<0?d=Math.max(d,f/(f-i)):i<0&&(e=Math.min(e,f/(f-i))),h<0?d=Math.max(d,h/(h-j)):j<0&&(e=Math.min(e,h/(h-j))),e<d?!1:(b.lerpSelf(c,d),c.lerpSelf(b,1-e),!0))}var f,i,h=[],j,k,p=[],n,q,m=[],t,v=[],B,x,D=[],F,va,wa=[],qa=[],ra=[],ia=new THREE.Vector4,
-G=new THREE.Vector4,u=new THREE.Matrix4,T=new THREE.Matrix4,L=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],U=new THREE.Vector4,Z=new THREE.Vector4;this.projectVector=function(b,c){u.multiply(c.projectionMatrix,c.matrixWorldInverse);u.multiplyVector3(b);return b};this.unprojectVector=function(b,c){u.multiply(c.matrixWorld,THREE.Matrix4.makeInvert(c.projectionMatrix));u.multiplyVector3(b);return b};this.projectObjects=function(b,d,j){var e,
-k;i=qa.length=0;e=b.objects;b=0;for(d=e.length;b<d;b++){k=e[b];var n;if(!(n=!k.visible))if(n=k instanceof THREE.Mesh)if(n=k.frustumCulled){a:{n=void 0;for(var p=k.matrixWorld,q=-k.geometry.boundingSphere.radius*Math.max(k.scale.x,Math.max(k.scale.y,k.scale.z)),m=0;m<6;m++)if(n=L[m].x*p.n14+L[m].y*p.n24+L[m].z*p.n34+L[m].w,n<=q){n=!1;break a}n=!0}n=!n}if(!n)n=h[i]=h[i]||new THREE.RenderableObject,i++,f=n,ia.copy(k.position),u.multiplyVector3(ia),f.object=k,f.z=ia.z,qa.push(f)}j&&qa.sort(c);return qa};
-this.projectScene=function(f,i,h){var e=i.near,qa=i.far,ia,xa,V,na,J,$,N,ka,sa,R,ua,La,Ra,Ia,Aa,Ea,ya;va=x=t=q=ra.length=0;i.matrixAutoUpdate&&i.update(void 0,!0);f.update(void 0,!1,i);u.multiply(i.projectionMatrix,i.matrixWorldInverse);L[0].set(u.n41-u.n11,u.n42-u.n12,u.n43-u.n13,u.n44-u.n14);L[1].set(u.n41+u.n11,u.n42+u.n12,u.n43+u.n13,u.n44+u.n14);L[2].set(u.n41+u.n21,u.n42+u.n22,u.n43+u.n23,u.n44+u.n24);L[3].set(u.n41-u.n21,u.n42-u.n22,u.n43-u.n23,u.n44-u.n24);L[4].set(u.n41-u.n31,u.n42-u.n32,
-u.n43-u.n33,u.n44-u.n34);L[5].set(u.n41+u.n31,u.n42+u.n32,u.n43+u.n33,u.n44+u.n34);for(ia=0;ia<6;ia++)sa=L[ia],sa.divideScalar(Math.sqrt(sa.x*sa.x+sa.y*sa.y+sa.z*sa.z));sa=this.projectObjects(f,i,!0);f=0;for(ia=sa.length;f<ia;f++)if(R=sa[f].object,R.visible)if(ua=R.matrixWorld,La=R.matrixRotationWorld,Ra=R.materials,Ia=R.overdraw,k=0,R instanceof THREE.Mesh){Aa=R.geometry;na=Aa.vertices;Ea=Aa.faces;Aa=Aa.faceVertexUvs;xa=0;for(V=na.length;xa<V;xa++)j=b(),j.positionWorld.copy(na[xa].position),ua.multiplyVector3(j.positionWorld),
-j.positionScreen.copy(j.positionWorld),u.multiplyVector4(j.positionScreen),j.positionScreen.x/=j.positionScreen.w,j.positionScreen.y/=j.positionScreen.w,j.visible=j.positionScreen.z>e&&j.positionScreen.z<qa;na=0;for(xa=Ea.length;na<xa;na++){V=Ea[na];if(V instanceof THREE.Face3)if(J=p[V.a],$=p[V.b],N=p[V.c],J.visible&&$.visible&&N.visible&&(R.doubleSided||R.flipSided!=(N.positionScreen.x-J.positionScreen.x)*($.positionScreen.y-J.positionScreen.y)-(N.positionScreen.y-J.positionScreen.y)*($.positionScreen.x-
-J.positionScreen.x)<0))ka=m[q]=m[q]||new THREE.RenderableFace3,q++,n=ka,n.v1.copy(J),n.v2.copy($),n.v3.copy(N);else continue;else if(V instanceof THREE.Face4)if(J=p[V.a],$=p[V.b],N=p[V.c],ka=p[V.d],J.visible&&$.visible&&N.visible&&ka.visible&&(R.doubleSided||R.flipSided!=((ka.positionScreen.x-J.positionScreen.x)*($.positionScreen.y-J.positionScreen.y)-(ka.positionScreen.y-J.positionScreen.y)*($.positionScreen.x-J.positionScreen.x)<0||($.positionScreen.x-N.positionScreen.x)*(ka.positionScreen.y-N.positionScreen.y)-
-($.positionScreen.y-N.positionScreen.y)*(ka.positionScreen.x-N.positionScreen.x)<0)))ya=v[t]=v[t]||new THREE.RenderableFace4,t++,n=ya,n.v1.copy(J),n.v2.copy($),n.v3.copy(N),n.v4.copy(ka);else continue;n.normalWorld.copy(V.normal);La.multiplyVector3(n.normalWorld);n.centroidWorld.copy(V.centroid);ua.multiplyVector3(n.centroidWorld);n.centroidScreen.copy(n.centroidWorld);u.multiplyVector3(n.centroidScreen);N=V.vertexNormals;J=0;for($=N.length;J<$;J++)ka=n.vertexNormalsWorld[J],ka.copy(N[J]),La.multiplyVector3(ka);
-J=0;for($=Aa.length;J<$;J++)if(ya=Aa[J][na]){N=0;for(ka=ya.length;N<ka;N++)n.uvs[J][N]=ya[N]}n.meshMaterials=Ra;n.faceMaterials=V.materials;n.overdraw=Ia;n.z=n.centroidScreen.z;ra.push(n)}}else if(R instanceof THREE.Line){T.multiply(u,ua);na=R.geometry.vertices;J=b();J.positionScreen.copy(na[0].position);T.multiplyVector4(J.positionScreen);xa=1;for(V=na.length;xa<V;xa++)if(J=b(),J.positionScreen.copy(na[xa].position),T.multiplyVector4(J.positionScreen),$=p[k-2],U.copy(J.positionScreen),Z.copy($.positionScreen),
-d(U,Z))U.multiplyScalar(1/U.w),Z.multiplyScalar(1/Z.w),ua=D[x]=D[x]||new THREE.RenderableLine,x++,B=ua,B.v1.positionScreen.copy(U),B.v2.positionScreen.copy(Z),B.z=Math.max(U.z,Z.z),B.materials=R.materials,ra.push(B)}else if(R instanceof THREE.Particle&&(G.set(R.matrixWorld.n14,R.matrixWorld.n24,R.matrixWorld.n34,1),u.multiplyVector4(G),G.z/=G.w,G.z>0&&G.z<1))ua=wa[va]=wa[va]||new THREE.RenderableParticle,va++,F=ua,F.x=G.x/G.w,F.y=G.y/G.w,F.z=G.z,F.rotation=R.rotation.z,F.scale.x=R.scale.x*Math.abs(F.x-
-(G.x+i.projectionMatrix.n11)/(G.w+i.projectionMatrix.n14)),F.scale.y=R.scale.y*Math.abs(F.y-(G.y+i.projectionMatrix.n22)/(G.w+i.projectionMatrix.n24)),F.materials=R.materials,ra.push(F);h&&ra.sort(c);return ra}};THREE.Quaternion=function(b,c,d,f){this.set(b||0,c||0,d||0,f!==void 0?f:1)};
-THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(b,c,d,f){this.x=b;this.y=c;this.z=d;this.w=f;return this},copy:function(b){this.x=b.x;this.y=b.y;this.z=b.z;this.w=b.w;return this},setFromEuler:function(b){var c=0.5*Math.PI/360,d=b.x*c,f=b.y*c,i=b.z*c,b=Math.cos(f),f=Math.sin(f),c=Math.cos(-i),i=Math.sin(-i),h=Math.cos(d),d=Math.sin(d),j=b*c,k=f*i;this.w=j*h-k*d;this.x=j*d+k*h;this.y=f*c*h+b*i*d;this.z=b*i*h-f*c*d;return this},setFromAxisAngle:function(b,c){var d=c/2,f=Math.sin(d);
+THREE.Object3D.prototype={constructor:THREE.Object3D,translate:function(b,c){this.matrix.rotateAxis(c);this.position.addSelf(c.multiplyScalar(b))},translateX:function(b){this.translate(b,this._vector.set(1,0,0))},translateY:function(b){this.translate(b,this._vector.set(0,1,0))},translateZ:function(b){this.translate(b,this._vector.set(0,0,1))},lookAt:function(b){this instanceof THREE.Camera?this.matrix.lookAt(this.position,b,this.up):this.matrix.lookAt(b,this.position,this.up);this.rotationAutoUpdate&&
+this.rotation.setRotationFromMatrix(this.matrix)},add:function(b){if(this.children.indexOf(b)===-1){b.parent!==void 0&&b.parent.removeChild(b);b.parent=this;this.children.push(b);for(var c=this;c.parent!==void 0;)c=c.parent;c!==void 0&&c instanceof THREE.Scene&&c.addChildRecurse(b)}},remove:function(b){var c=this,d=this.children.indexOf(b);if(d!==-1){b.parent=void 0;for(this.children.splice(d,1);c.parent!==void 0;)c=c.parent;c!==void 0&&c instanceof THREE.Scene&&c.removeChildRecurse(b)}},getChildByName:function(b,
+c){var d,f,i;d=0;for(f=this.children.length;d<f;d++){i=this.children[d];if(i.name===b)return i;if(c&&(i=i.getChildByName(b,c),i!==void 0))return i}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,
+this.scale.z));this.matrixWorldNeedsUpdate=!0},update:function(b,c,d){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||c)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale),this.matrixWorldNeedsUpdate=!1,c=!0;for(var b=0,f=this.children.length;b<f;b++)this.children[b].update(this.matrixWorld,c,d)},addChild:function(b){console.warn("DEPRECATED: Object3D.addChild() is now Object3D.add().");
+this.add(b)},removeChild:function(b){console.warn("DEPRECATED: Object3D.removeChild() is now Object3D.remove().");this.remove(b)}};THREE.Object3DCount=0;
+THREE.Projector=function(){function b(){var b=m[k]=m[k]||new THREE.RenderableVertex;k++;return b}function c(b,c){return c.z-b.z}function d(b,c){var d=0,e=1,f=b.z+b.w,i=c.z+c.w,h=-b.z+b.w,j=-c.z+c.w;return f>=0&&i>=0&&h>=0&&j>=0?!0:f<0&&i<0||h<0&&j<0?!1:(f<0?d=Math.max(d,f/(f-i)):i<0&&(e=Math.min(e,f/(f-i))),h<0?d=Math.max(d,h/(h-j)):j<0&&(e=Math.min(e,h/(h-j))),e<d?!1:(b.lerpSelf(c,d),c.lerpSelf(b,1-e),!0))}var f,i,h=[],j,k,m=[],n,q,p=[],t,v=[],B,x,E=[],F,wa,xa=[],qa=[],ra=[],ja=new THREE.Vector4,
+G=new THREE.Vector4,u=new THREE.Matrix4,S=new THREE.Matrix4,L=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],T=new THREE.Vector4,Z=new THREE.Vector4;this.projectVector=function(b,c){u.multiply(c.projectionMatrix,c.matrixWorldInverse);u.multiplyVector3(b);return b};this.unprojectVector=function(b,c){u.multiply(c.matrixWorld,THREE.Matrix4.makeInvert(c.projectionMatrix));u.multiplyVector3(b);return b};this.projectObjects=function(b,d,j){var e,
+k;i=qa.length=0;e=b.objects;b=0;for(d=e.length;b<d;b++){k=e[b];var n;if(!(n=!k.visible))if(n=k instanceof THREE.Mesh)if(n=k.frustumCulled){a:{n=void 0;for(var m=k.matrixWorld,q=-k.geometry.boundingSphere.radius*Math.max(k.scale.x,Math.max(k.scale.y,k.scale.z)),p=0;p<6;p++)if(n=L[p].x*m.n14+L[p].y*m.n24+L[p].z*m.n34+L[p].w,n<=q){n=!1;break a}n=!0}n=!n}if(!n)n=h[i]=h[i]||new THREE.RenderableObject,i++,f=n,ja.copy(k.position),u.multiplyVector3(ja),f.object=k,f.z=ja.z,qa.push(f)}j&&qa.sort(c);return qa};
+this.projectScene=function(f,i,h){var e=i.near,qa=i.far,ja,va,U,W,J,$,N,ka,sa,Q,Aa,Ja,Ta,Ka,Ba,Ea,za;wa=x=t=q=ra.length=0;i.matrixAutoUpdate&&i.update(void 0,!0);f.update(void 0,!1,i);u.multiply(i.projectionMatrix,i.matrixWorldInverse);L[0].set(u.n41-u.n11,u.n42-u.n12,u.n43-u.n13,u.n44-u.n14);L[1].set(u.n41+u.n11,u.n42+u.n12,u.n43+u.n13,u.n44+u.n14);L[2].set(u.n41+u.n21,u.n42+u.n22,u.n43+u.n23,u.n44+u.n24);L[3].set(u.n41-u.n21,u.n42-u.n22,u.n43-u.n23,u.n44-u.n24);L[4].set(u.n41-u.n31,u.n42-u.n32,
+u.n43-u.n33,u.n44-u.n34);L[5].set(u.n41+u.n31,u.n42+u.n32,u.n43+u.n33,u.n44+u.n34);for(ja=0;ja<6;ja++)sa=L[ja],sa.divideScalar(Math.sqrt(sa.x*sa.x+sa.y*sa.y+sa.z*sa.z));sa=this.projectObjects(f,i,!0);f=0;for(ja=sa.length;f<ja;f++)if(Q=sa[f].object,Q.visible)if(Aa=Q.matrixWorld,Ja=Q.matrixRotationWorld,Ta=Q.materials,Ka=Q.overdraw,k=0,Q instanceof THREE.Mesh){Ba=Q.geometry;W=Ba.vertices;Ea=Ba.faces;Ba=Ba.faceVertexUvs;va=0;for(U=W.length;va<U;va++)j=b(),j.positionWorld.copy(W[va].position),Aa.multiplyVector3(j.positionWorld),
+j.positionScreen.copy(j.positionWorld),u.multiplyVector4(j.positionScreen),j.positionScreen.x/=j.positionScreen.w,j.positionScreen.y/=j.positionScreen.w,j.visible=j.positionScreen.z>e&&j.positionScreen.z<qa;W=0;for(va=Ea.length;W<va;W++){U=Ea[W];if(U instanceof THREE.Face3)if(J=m[U.a],$=m[U.b],N=m[U.c],J.visible&&$.visible&&N.visible&&(Q.doubleSided||Q.flipSided!=(N.positionScreen.x-J.positionScreen.x)*($.positionScreen.y-J.positionScreen.y)-(N.positionScreen.y-J.positionScreen.y)*($.positionScreen.x-
+J.positionScreen.x)<0))ka=p[q]=p[q]||new THREE.RenderableFace3,q++,n=ka,n.v1.copy(J),n.v2.copy($),n.v3.copy(N);else continue;else if(U instanceof THREE.Face4)if(J=m[U.a],$=m[U.b],N=m[U.c],ka=m[U.d],J.visible&&$.visible&&N.visible&&ka.visible&&(Q.doubleSided||Q.flipSided!=((ka.positionScreen.x-J.positionScreen.x)*($.positionScreen.y-J.positionScreen.y)-(ka.positionScreen.y-J.positionScreen.y)*($.positionScreen.x-J.positionScreen.x)<0||($.positionScreen.x-N.positionScreen.x)*(ka.positionScreen.y-N.positionScreen.y)-
+($.positionScreen.y-N.positionScreen.y)*(ka.positionScreen.x-N.positionScreen.x)<0)))za=v[t]=v[t]||new THREE.RenderableFace4,t++,n=za,n.v1.copy(J),n.v2.copy($),n.v3.copy(N),n.v4.copy(ka);else continue;n.normalWorld.copy(U.normal);Ja.multiplyVector3(n.normalWorld);n.centroidWorld.copy(U.centroid);Aa.multiplyVector3(n.centroidWorld);n.centroidScreen.copy(n.centroidWorld);u.multiplyVector3(n.centroidScreen);N=U.vertexNormals;J=0;for($=N.length;J<$;J++)ka=n.vertexNormalsWorld[J],ka.copy(N[J]),Ja.multiplyVector3(ka);
+J=0;for($=Ba.length;J<$;J++)if(za=Ba[J][W]){N=0;for(ka=za.length;N<ka;N++)n.uvs[J][N]=za[N]}n.meshMaterials=Ta;n.faceMaterials=U.materials;n.overdraw=Ka;n.z=n.centroidScreen.z;ra.push(n)}}else if(Q instanceof THREE.Line){S.multiply(u,Aa);W=Q.geometry.vertices;J=b();J.positionScreen.copy(W[0].position);S.multiplyVector4(J.positionScreen);va=1;for(U=W.length;va<U;va++)if(J=b(),J.positionScreen.copy(W[va].position),S.multiplyVector4(J.positionScreen),$=m[k-2],T.copy(J.positionScreen),Z.copy($.positionScreen),
+d(T,Z))T.multiplyScalar(1/T.w),Z.multiplyScalar(1/Z.w),Aa=E[x]=E[x]||new THREE.RenderableLine,x++,B=Aa,B.v1.positionScreen.copy(T),B.v2.positionScreen.copy(Z),B.z=Math.max(T.z,Z.z),B.materials=Q.materials,ra.push(B)}else if(Q instanceof THREE.Particle&&(G.set(Q.matrixWorld.n14,Q.matrixWorld.n24,Q.matrixWorld.n34,1),u.multiplyVector4(G),G.z/=G.w,G.z>0&&G.z<1))Aa=xa[wa]=xa[wa]||new THREE.RenderableParticle,wa++,F=Aa,F.x=G.x/G.w,F.y=G.y/G.w,F.z=G.z,F.rotation=Q.rotation.z,F.scale.x=Q.scale.x*Math.abs(F.x-
+(G.x+i.projectionMatrix.n11)/(G.w+i.projectionMatrix.n14)),F.scale.y=Q.scale.y*Math.abs(F.y-(G.y+i.projectionMatrix.n22)/(G.w+i.projectionMatrix.n24)),F.materials=Q.materials,ra.push(F);h&&ra.sort(c);return ra}};THREE.Quaternion=function(b,c,d,f){this.set(b||0,c||0,d||0,f!==void 0?f:1)};
+THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(b,c,d,f){this.x=b;this.y=c;this.z=d;this.w=f;return this},copy:function(b){this.x=b.x;this.y=b.y;this.z=b.z;this.w=b.w;return this},setFromEuler:function(b){var c=Math.PI/360,d=b.x*c,f=b.y*c,i=b.z*c,b=Math.cos(f),f=Math.sin(f),c=Math.cos(-i),i=Math.sin(-i),h=Math.cos(d),d=Math.sin(d),j=b*c,k=f*i;this.w=j*h-k*d;this.x=j*d+k*h;this.y=f*c*h+b*i*d;this.z=b*i*h-f*c*d;return this},setFromAxisAngle:function(b,c){var d=c/2,f=Math.sin(d);
 this.x=b.x*f;this.y=b.y*f;this.z=b.z*f;this.w=Math.cos(d);return this},setFromRotationMatrix:function(b){var c=Math.pow(b.determinant(),1/3);this.w=Math.sqrt(Math.max(0,c+b.n11+b.n22+b.n33))/2;this.x=Math.sqrt(Math.max(0,c+b.n11-b.n22-b.n33))/2;this.y=Math.sqrt(Math.max(0,c-b.n11+b.n22-b.n33))/2;this.z=Math.sqrt(Math.max(0,c-b.n11-b.n22+b.n33))/2;this.x=b.n32-b.n23<0?-Math.abs(this.x):Math.abs(this.x);this.y=b.n13-b.n31<0?-Math.abs(this.y):Math.abs(this.y);this.z=b.n21-b.n12<0?-Math.abs(this.z):Math.abs(this.z);
 this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var b=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);b==0?this.w=this.z=this.y=this.x=0:(b=1/b,this.x*=b,this.y*=b,this.z*=b,this.w*=b);return this},multiplySelf:function(b){var c=
-this.x,d=this.y,f=this.z,i=this.w,h=b.x,j=b.y,k=b.z,b=b.w;this.x=c*b+i*h+d*k-f*j;this.y=d*b+i*j+f*h-c*k;this.z=f*b+i*k+c*j-d*h;this.w=i*b-c*h-d*j-f*k;return this},multiply:function(b,c){this.x=b.x*c.w+b.y*c.z-b.z*c.y+b.w*c.x;this.y=-b.x*c.z+b.y*c.w+b.z*c.x+b.w*c.y;this.z=b.x*c.y-b.y*c.x+b.z*c.w+b.w*c.z;this.w=-b.x*c.x-b.y*c.y-b.z*c.z+b.w*c.w;return this},multiplyVector3:function(b,c){c||(c=b);var d=b.x,f=b.y,i=b.z,h=this.x,j=this.y,k=this.z,p=this.w,n=p*d+j*i-k*f,q=p*f+k*d-h*i,m=p*i+h*f-j*d,d=-h*
-d-j*f-k*i;c.x=n*p+d*-h+q*-k-m*-j;c.y=q*p+d*-j+m*-h-n*-k;c.z=m*p+d*-k+n*-j-q*-h;return c}};THREE.Quaternion.slerp=function(b,c,d,f){var i=b.w*c.w+b.x*c.x+b.y*c.y+b.z*c.z;if(Math.abs(i)>=1)return d.w=b.w,d.x=b.x,d.y=b.y,d.z=b.z,d;var h=Math.acos(i),j=Math.sqrt(1-i*i);if(Math.abs(j)<0.0010)return d.w=0.5*(b.w+c.w),d.x=0.5*(b.x+c.x),d.y=0.5*(b.y+c.y),d.z=0.5*(b.z+c.z),d;i=Math.sin((1-f)*h)/j;f=Math.sin(f*h)/j;d.w=b.w*i+c.w*f;d.x=b.x*i+c.x*f;d.y=b.y*i+c.y*f;d.z=b.z*i+c.z*f;return d};
+this.x,d=this.y,f=this.z,i=this.w,h=b.x,j=b.y,k=b.z,b=b.w;this.x=c*b+i*h+d*k-f*j;this.y=d*b+i*j+f*h-c*k;this.z=f*b+i*k+c*j-d*h;this.w=i*b-c*h-d*j-f*k;return this},multiply:function(b,c){this.x=b.x*c.w+b.y*c.z-b.z*c.y+b.w*c.x;this.y=-b.x*c.z+b.y*c.w+b.z*c.x+b.w*c.y;this.z=b.x*c.y-b.y*c.x+b.z*c.w+b.w*c.z;this.w=-b.x*c.x-b.y*c.y-b.z*c.z+b.w*c.w;return this},multiplyVector3:function(b,c){c||(c=b);var d=b.x,f=b.y,i=b.z,h=this.x,j=this.y,k=this.z,m=this.w,n=m*d+j*i-k*f,q=m*f+k*d-h*i,p=m*i+h*f-j*d,d=-h*
+d-j*f-k*i;c.x=n*m+d*-h+q*-k-p*-j;c.y=q*m+d*-j+p*-h-n*-k;c.z=p*m+d*-k+n*-j-q*-h;return c}};THREE.Quaternion.slerp=function(b,c,d,f){var i=b.w*c.w+b.x*c.x+b.y*c.y+b.z*c.z;if(Math.abs(i)>=1)return d.w=b.w,d.x=b.x,d.y=b.y,d.z=b.z,d;var h=Math.acos(i),j=Math.sqrt(1-i*i);if(Math.abs(j)<0.0010)return d.w=0.5*(b.w+c.w),d.x=0.5*(b.x+c.x),d.y=0.5*(b.y+c.y),d.z=0.5*(b.z+c.z),d;i=Math.sin((1-f)*h)/j;f=Math.sin(f*h)/j;d.w=b.w*i+c.w*f;d.x=b.x*i+c.x*f;d.y=b.y*i+c.y*f;d.z=b.z*i+c.z*f;return d};
 THREE.Vertex=function(b){this.position=b||new THREE.Vector3};THREE.Face3=function(b,c,d,f,i,h){this.a=b;this.b=c;this.c=d;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=i instanceof THREE.Color?i:new THREE.Color;this.vertexColors=i instanceof Array?i:[];this.vertexTangents=[];this.materials=h instanceof Array?h:[h];this.centroid=new THREE.Vector3};
 THREE.Face4=function(b,c,d,f,i,h,j){this.a=b;this.b=c;this.c=d;this.d=f;this.normal=i instanceof THREE.Vector3?i:new THREE.Vector3;this.vertexNormals=i instanceof Array?i:[];this.color=h instanceof THREE.Color?h:new THREE.Color;this.vertexColors=h instanceof Array?h:[];this.vertexTangents=[];this.materials=j instanceof Array?j:[j];this.centroid=new THREE.Vector3};THREE.UV=function(b,c){this.u=b||0;this.v=c||0};
 THREE.UV.prototype={constructor:THREE.UV,set:function(b,c){this.u=b;this.v=c;return this},copy:function(b){this.u=b.u;this.v=b.v;return this},clone:function(){return new THREE.UV(this.u,this.v)}};
 THREE.Geometry=function(){this.id=THREE.GeometryCount++;this.vertices=[];this.colors=[];this.faces=[];this.edges=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.dynamic=this.hasTangents=!1};
 THREE.Geometry.prototype={constructor:THREE.Geometry,applyMatrix:function(b){var c=new THREE.Matrix4;c.extractRotation(b,new THREE.Vector3(1,1,1));for(var d=0,f=this.vertices.length;d<f;d++)b.multiplyVector3(this.vertices[d].position);d=0;for(f=this.faces.length;d<f;d++){var i=this.faces[d];c.multiplyVector3(i.normal);for(var h=0,j=i.vertexNormals.length;h<j;h++)c.multiplyVector3(i.vertexNormals[h]);b.multiplyVector3(i.centroid)}},computeCentroids:function(){var b,c,d;b=0;for(c=this.faces.length;b<
 c;b++)d=this.faces[b],d.centroid.set(0,0,0),d instanceof THREE.Face3?(d.centroid.addSelf(this.vertices[d.a].position),d.centroid.addSelf(this.vertices[d.b].position),d.centroid.addSelf(this.vertices[d.c].position),d.centroid.divideScalar(3)):d instanceof THREE.Face4&&(d.centroid.addSelf(this.vertices[d.a].position),d.centroid.addSelf(this.vertices[d.b].position),d.centroid.addSelf(this.vertices[d.c].position),d.centroid.addSelf(this.vertices[d.d].position),d.centroid.divideScalar(4))},computeFaceNormals:function(b){var c,
-d,f,i,h,j,k=new THREE.Vector3,p=new THREE.Vector3;f=0;for(i=this.faces.length;f<i;f++){h=this.faces[f];if(b&&h.vertexNormals.length){k.set(0,0,0);c=0;for(d=h.vertexNormals.length;c<d;c++)k.addSelf(h.vertexNormals[c]);k.divideScalar(3)}else c=this.vertices[h.a],d=this.vertices[h.b],j=this.vertices[h.c],k.sub(j.position,d.position),p.sub(c.position,d.position),k.crossSelf(p);k.isZero()||k.normalize();h.normal.copy(k)}},computeVertexNormals:function(){var b,c,d,f;if(this.__tmpVertices==void 0){f=this.__tmpVertices=
+d,f,i,h,j,k=new THREE.Vector3,m=new THREE.Vector3;f=0;for(i=this.faces.length;f<i;f++){h=this.faces[f];if(b&&h.vertexNormals.length){k.set(0,0,0);c=0;for(d=h.vertexNormals.length;c<d;c++)k.addSelf(h.vertexNormals[c]);k.divideScalar(3)}else c=this.vertices[h.a],d=this.vertices[h.b],j=this.vertices[h.c],k.sub(j.position,d.position),m.sub(c.position,d.position),k.crossSelf(m);k.isZero()||k.normalize();h.normal.copy(k)}},computeVertexNormals:function(){var b,c,d,f;if(this.__tmpVertices==void 0){f=this.__tmpVertices=
 Array(this.vertices.length);b=0;for(c=this.vertices.length;b<c;b++)f[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)if(d=this.faces[b],d instanceof THREE.Face3)d.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(d instanceof THREE.Face4)d.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{f=this.__tmpVertices;b=0;for(c=this.vertices.length;b<c;b++)f[b].set(0,0,0)}b=0;for(c=this.faces.length;b<c;b++)d=this.faces[b],d instanceof
 THREE.Face3?(f[d.a].addSelf(d.normal),f[d.b].addSelf(d.normal),f[d.c].addSelf(d.normal)):d instanceof THREE.Face4&&(f[d.a].addSelf(d.normal),f[d.b].addSelf(d.normal),f[d.c].addSelf(d.normal),f[d.d].addSelf(d.normal));b=0;for(c=this.vertices.length;b<c;b++)f[b].normalize();b=0;for(c=this.faces.length;b<c;b++)d=this.faces[b],d instanceof THREE.Face3?(d.vertexNormals[0].copy(f[d.a]),d.vertexNormals[1].copy(f[d.b]),d.vertexNormals[2].copy(f[d.c])):d instanceof THREE.Face4&&(d.vertexNormals[0].copy(f[d.a]),
-d.vertexNormals[1].copy(f[d.b]),d.vertexNormals[2].copy(f[d.c]),d.vertexNormals[3].copy(f[d.d]))},computeTangents:function(){function b(b,e,c,d,f,i,h){k=b.vertices[e].position;p=b.vertices[c].position;n=b.vertices[d].position;q=j[f];m=j[i];t=j[h];v=p.x-k.x;B=n.x-k.x;x=p.y-k.y;D=n.y-k.y;F=p.z-k.z;va=n.z-k.z;wa=m.u-q.u;qa=t.u-q.u;ra=m.v-q.v;ia=t.v-q.v;G=1/(wa*ia-qa*ra);U.set((ia*v-ra*B)*G,(ia*x-ra*D)*G,(ia*F-ra*va)*G);Z.set((wa*B-qa*v)*G,(wa*D-qa*x)*G,(wa*va-qa*F)*G);T[e].addSelf(U);T[c].addSelf(U);
-T[d].addSelf(U);L[e].addSelf(Z);L[c].addSelf(Z);L[d].addSelf(Z)}var c,d,f,i,h,j,k,p,n,q,m,t,v,B,x,D,F,va,wa,qa,ra,ia,G,u,T=[],L=[],U=new THREE.Vector3,Z=new THREE.Vector3,ja=new THREE.Vector3,W=new THREE.Vector3,M=new THREE.Vector3;c=0;for(d=this.vertices.length;c<d;c++)T[c]=new THREE.Vector3,L[c]=new THREE.Vector3;c=0;for(d=this.faces.length;c<d;c++)h=this.faces[c],j=this.faceVertexUvs[0][c],h instanceof THREE.Face3?b(this,h.a,h.b,h.c,0,1,2):h instanceof THREE.Face4&&(b(this,h.a,h.b,h.c,0,1,2),b(this,
-h.a,h.b,h.d,0,1,3));var e=["a","b","c","d"];c=0;for(d=this.faces.length;c<d;c++){h=this.faces[c];for(f=0;f<h.vertexNormals.length;f++)M.copy(h.vertexNormals[f]),i=h[e[f]],u=T[i],ja.copy(u),ja.subSelf(M.multiplyScalar(M.dot(u))).normalize(),W.cross(h.vertexNormals[f],u),i=W.dot(L[i]),i=i<0?-1:1,h.vertexTangents[f]=new THREE.Vector4(ja.x,ja.y,ja.z,i)}this.hasTangents=!0},computeBoundingBox:function(){var b;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],
+d.vertexNormals[1].copy(f[d.b]),d.vertexNormals[2].copy(f[d.c]),d.vertexNormals[3].copy(f[d.d]))},computeTangents:function(){function b(b,e,c,d,f,i,h){k=b.vertices[e].position;m=b.vertices[c].position;n=b.vertices[d].position;q=j[f];p=j[i];t=j[h];v=m.x-k.x;B=n.x-k.x;x=m.y-k.y;E=n.y-k.y;F=m.z-k.z;wa=n.z-k.z;xa=p.u-q.u;qa=t.u-q.u;ra=p.v-q.v;ja=t.v-q.v;G=1/(xa*ja-qa*ra);T.set((ja*v-ra*B)*G,(ja*x-ra*E)*G,(ja*F-ra*wa)*G);Z.set((xa*B-qa*v)*G,(xa*E-qa*x)*G,(xa*wa-qa*F)*G);S[e].addSelf(T);S[c].addSelf(T);
+S[d].addSelf(T);L[e].addSelf(Z);L[c].addSelf(Z);L[d].addSelf(Z)}var c,d,f,i,h,j,k,m,n,q,p,t,v,B,x,E,F,wa,xa,qa,ra,ja,G,u,S=[],L=[],T=new THREE.Vector3,Z=new THREE.Vector3,ya=new THREE.Vector3,V=new THREE.Vector3,M=new THREE.Vector3;c=0;for(d=this.vertices.length;c<d;c++)S[c]=new THREE.Vector3,L[c]=new THREE.Vector3;c=0;for(d=this.faces.length;c<d;c++)h=this.faces[c],j=this.faceVertexUvs[0][c],h instanceof THREE.Face3?b(this,h.a,h.b,h.c,0,1,2):h instanceof THREE.Face4&&(b(this,h.a,h.b,h.c,0,1,2),b(this,
+h.a,h.b,h.d,0,1,3));var e=["a","b","c","d"];c=0;for(d=this.faces.length;c<d;c++){h=this.faces[c];for(f=0;f<h.vertexNormals.length;f++)M.copy(h.vertexNormals[f]),i=h[e[f]],u=S[i],ya.copy(u),ya.subSelf(M.multiplyScalar(M.dot(u))).normalize(),V.cross(h.vertexNormals[f],u),i=V.dot(L[i]),i=i<0?-1:1,h.vertexTangents[f]=new THREE.Vector4(ya.x,ya.y,ya.z,i)}this.hasTangents=!0},computeBoundingBox:function(){var b;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],
 y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var c=1,d=this.vertices.length;c<d;c++){b=this.vertices[c];if(b.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=b.position.x;else if(b.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=b.position.x;if(b.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=b.position.y;else if(b.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=b.position.y;if(b.position.z<
 this.boundingBox.z[0])this.boundingBox.z[0]=b.position.z;else if(b.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=b.position.z}}},computeBoundingSphere:function(){for(var b=0,c=0,d=this.vertices.length;c<d;c++)b=Math.max(b,this.vertices[c].position.length());this.boundingSphere={radius:b}},computeEdgeFaces:function(){function b(b,c){return Math.min(b,c)+"_"+Math.max(b,c)}function c(b,c,d){b[c]===void 0?(b[c]={set:{},array:[]},b[c].set[d]=1,b[c].array.push(d)):b[c].set[d]===void 0&&(b[c].set[d]=
 1,b[c].array.push(d))}var d,f,i,h,j,k={};d=0;for(f=this.faces.length;d<f;d++)j=this.faces[d],j instanceof THREE.Face3?(i=b(j.a,j.b),c(k,i,d),i=b(j.b,j.c),c(k,i,d),i=b(j.a,j.c),c(k,i,d)):j instanceof THREE.Face4&&(i=b(j.b,j.d),c(k,i,d),i=b(j.a,j.b),c(k,i,d),i=b(j.a,j.d),c(k,i,d),i=b(j.b,j.c),c(k,i,d),i=b(j.c,j.d),c(k,i,d));d=0;for(f=this.edges.length;d<f;d++){j=this.edges[d];i=j.vertexIndices[0];h=j.vertexIndices[1];j.faceIndices=k[b(i,h)].array;for(i=0;i<j.faceIndices.length;i++)h=j.faceIndices[i],
 j.faces.push(this.faces[h])}}};THREE.GeometryCount=0;
-THREE.Spline=function(b){function c(b,c,d,f,i,h,j){b=(d-b)*0.5;f=(f-c)*0.5;return(2*(c-d)+b+f)*j+(-3*(c-d)-2*b-f)*h+b*i+c}this.points=b;var d=[],f={x:0,y:0,z:0},i,h,j,k,p,n,q,m,t;this.initFromArray=function(b){this.points=[];for(var c=0;c<b.length;c++)this.points[c]={x:b[c][0],y:b[c][1],z:b[c][2]}};this.getPoint=function(b){i=(this.points.length-1)*b;h=Math.floor(i);j=i-h;d[0]=h==0?h:h-1;d[1]=h;d[2]=h>this.points.length-2?h:h+1;d[3]=h>this.points.length-3?h:h+2;n=this.points[d[0]];q=this.points[d[1]];
-m=this.points[d[2]];t=this.points[d[3]];k=j*j;p=j*k;f.x=c(n.x,q.x,m.x,t.x,j,k,p);f.y=c(n.y,q.y,m.y,t.y,j,k,p);f.z=c(n.z,q.z,m.z,t.z,j,k,p);return f};this.getControlPointsArray=function(){var b,c,d=this.points.length,f=[];for(b=0;b<d;b++)c=this.points[b],f[b]=[c.x,c.y,c.z];return f};this.getLength=function(b){var c,d,f=c=c=0,i=new THREE.Vector3,h=new THREE.Vector3,j=[],k=0;j[0]=0;b||(b=100);d=this.points.length*b;i.copy(this.points[0]);for(b=1;b<d;b++)c=b/d,position=this.getPoint(c),h.copy(position),
-k+=h.distanceTo(i),i.copy(position),c*=this.points.length-1,c=Math.floor(c),c!=f&&(j[c]=k,f=c);j[j.length]=k;return{chunks:j,total:k}};this.reparametrizeByArcLength=function(b){var c,d,f,i,h,j,k=[],n=new THREE.Vector3,p=this.getLength();k.push(n.copy(this.points[0]).clone());for(c=1;c<this.points.length;c++){d=p.chunks[c]-p.chunks[c-1];j=Math.ceil(b*d/p.total);i=(c-1)/(this.points.length-1);h=c/(this.points.length-1);for(d=1;d<j-1;d++)f=i+d*(1/j)*(h-i),position=this.getPoint(f),k.push(n.copy(position).clone());
-k.push(n.copy(this.points[c]).clone())}this.points=k}};THREE.Edge=function(b,c,d,f){this.vertices=[b,c];this.vertexIndices=[d,f];this.faces=[];this.faceIndices=[]};THREE.Camera=function(b,c,d,f,i){THREE.Object3D.call(this);this.fov=b||50;this.aspect=c||1;this.near=d!==void 0?d:0.1;this.far=f!==void 0?f:2E3;this.target=i||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;
+THREE.Spline=function(b){function c(b,c,d,f,i,h,j){b=(d-b)*0.5;f=(f-c)*0.5;return(2*(c-d)+b+f)*j+(-3*(c-d)-2*b-f)*h+b*i+c}this.points=b;var d=[],f={x:0,y:0,z:0},i,h,j,k,m,n,q,p,t;this.initFromArray=function(b){this.points=[];for(var c=0;c<b.length;c++)this.points[c]={x:b[c][0],y:b[c][1],z:b[c][2]}};this.getPoint=function(b){i=(this.points.length-1)*b;h=Math.floor(i);j=i-h;d[0]=h==0?h:h-1;d[1]=h;d[2]=h>this.points.length-2?h:h+1;d[3]=h>this.points.length-3?h:h+2;n=this.points[d[0]];q=this.points[d[1]];
+p=this.points[d[2]];t=this.points[d[3]];k=j*j;m=j*k;f.x=c(n.x,q.x,p.x,t.x,j,k,m);f.y=c(n.y,q.y,p.y,t.y,j,k,m);f.z=c(n.z,q.z,p.z,t.z,j,k,m);return f};this.getControlPointsArray=function(){var b,c,d=this.points.length,f=[];for(b=0;b<d;b++)c=this.points[b],f[b]=[c.x,c.y,c.z];return f};this.getLength=function(b){var c,d,f=c=c=0,i=new THREE.Vector3,h=new THREE.Vector3,j=[],k=0;j[0]=0;b||(b=100);d=this.points.length*b;i.copy(this.points[0]);for(b=1;b<d;b++)c=b/d,position=this.getPoint(c),h.copy(position),
+k+=h.distanceTo(i),i.copy(position),c*=this.points.length-1,c=Math.floor(c),c!=f&&(j[c]=k,f=c);j[j.length]=k;return{chunks:j,total:k}};this.reparametrizeByArcLength=function(b){var c,d,f,i,h,j,k=[],n=new THREE.Vector3,m=this.getLength();k.push(n.copy(this.points[0]).clone());for(c=1;c<this.points.length;c++){d=m.chunks[c]-m.chunks[c-1];j=Math.ceil(b*d/m.total);i=(c-1)/(this.points.length-1);h=c/(this.points.length-1);for(d=1;d<j-1;d++)f=i+d*(1/j)*(h-i),position=this.getPoint(f),k.push(n.copy(position).clone());
+k.push(n.copy(this.points[c]).clone())}this.points=k}};THREE.Edge=function(b,c,d,f){this.vertices=[b,c];this.vertexIndices=[d,f];this.faces=[];this.faceIndices=[]};THREE.Camera=function(b,c,d,f,i){THREE.Object3D.call(this);this.fov=b||50;this.aspect=c||1;this.near=d!==void 0?d:0.1;this.far=f!==void 0?f:2E3;this.target=i||new THREE.Object3D;this.useTarget=!1;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;
 THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;THREE.Camera.prototype.translate=function(b,c){this.matrix.rotateAxis(c);c.multiplyScalar(b);this.position.addSelf(c);this.target.position.addSelf(c)};
 THREE.Camera.prototype.updateProjectionMatrix=function(){if(this.fullWidth){var b=this.fullWidth/this.fullHeight,c=Math.tan(this.fov*Math.PI/360)*this.near,d=-c,f=b*d,b=Math.abs(b*c-f),d=Math.abs(c-d);this.projectionMatrix=THREE.Matrix4.makeFrustum(f+this.x*b/this.fullWidth,f+(this.x+this.width)*b/this.fullWidth,c-(this.y+this.height)*d/this.fullHeight,c-this.y*d/this.fullHeight,this.near,this.far)}else this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};
 THREE.Camera.prototype.setViewOffset=function(b,c,d,f,i,h){this.fullWidth=b;this.fullHeight=c;this.x=d;this.y=f;this.width=i;this.height=h;this.updateProjectionMatrix()};
@@ -98,7 +98,7 @@ THREE.Camera.prototype.update=function(b,c,d){if(this.useTarget)this.matrix.look
 THREE.OrthoCamera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makeOrtho(this.left,this.right,this.top,this.bottom,this.near,this.far)};THREE.Light=function(b){THREE.Object3D.call(this);this.color=new THREE.Color(b)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(b){THREE.Light.call(this,b)};THREE.AmbientLight.prototype=new THREE.Light;
 THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;THREE.DirectionalLight=function(b,c,d){THREE.Light.call(this,b);this.position=new THREE.Vector3(0,1,0);this.intensity=c!==void 0?c:1;this.distance=d!==void 0?d:0};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(b,c,d){THREE.Light.call(this,b);this.position=new THREE.Vector3(0,0,0);this.intensity=c!==void 0?c:1;this.distance=d!==void 0?d:0};
 THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight;THREE.SpotLight=function(b,c,d,f){THREE.Light.call(this,b);this.position=new THREE.Vector3(0,1,0);this.target=new THREE.Object3D;this.intensity=c!==void 0?c:1;this.distance=d!==void 0?d:0;this.castShadow=f!==void 0?f:!1};THREE.SpotLight.prototype=new THREE.Light;THREE.SpotLight.prototype.constructor=THREE.SpotLight;
-THREE.Material=function(b){this.id=THREE.MaterialCount++;b=b||{};this.opacity=b.opacity!==void 0?b.opacity:1;this.transparent=b.transparent!==void 0?b.transparent:!1;this.blending=b.blending!==void 0?b.blending:THREE.NormalBlending;this.depthTest=b.depthTest!==void 0?b.depthTest:!0;this.depthWrite=b.depthWrite!==void 0?b.depthWrite:!0;this.polygonOffset=b.polygonOffset!==void 0?b.polygonOffset:!1;this.polygonOffsetFactor=b.polygonOffsetFactor!==void 0?b.polygonOffsetFactor:0;this.polygonOffsetUnits=
+THREE.Material=function(b){this.name="";this.id=THREE.MaterialCount++;b=b||{};this.opacity=b.opacity!==void 0?b.opacity:1;this.transparent=b.transparent!==void 0?b.transparent:!1;this.blending=b.blending!==void 0?b.blending:THREE.NormalBlending;this.depthTest=b.depthTest!==void 0?b.depthTest:!0;this.depthWrite=b.depthWrite!==void 0?b.depthWrite:!0;this.polygonOffset=b.polygonOffset!==void 0?b.polygonOffset:!1;this.polygonOffsetFactor=b.polygonOffsetFactor!==void 0?b.polygonOffsetFactor:0;this.polygonOffsetUnits=
 b.polygonOffsetUnits!==void 0?b.polygonOffsetUnits:0;this.alphaTest=b.alphaTest!==void 0?b.alphaTest:0};THREE.MaterialCount=0;THREE.NoShading=0;THREE.FlatShading=1;THREE.SmoothShading=2;THREE.NoColors=0;THREE.FaceColors=1;THREE.VertexColors=2;THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;THREE.MultiplyBlending=3;THREE.AdditiveAlphaBlending=4;
 THREE.LineBasicMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.color=b.color!==void 0?new THREE.Color(b.color):new THREE.Color(16777215);this.linewidth=b.linewidth!==void 0?b.linewidth:1;this.linecap=b.linecap!==void 0?b.linecap:"round";this.linejoin=b.linejoin!==void 0?b.linejoin:"round";this.vertexColors=b.vertexColors?b.vertexColors:!1;this.fog=b.fog!==void 0?b.fog:!0};THREE.LineBasicMaterial.prototype=new THREE.Material;THREE.LineBasicMaterial.prototype.constructor=THREE.LineBasicMaterial;
 THREE.MeshBasicMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.color=b.color!==void 0?new THREE.Color(b.color):new THREE.Color(16777215);this.map=b.map!==void 0?b.map:null;this.lightMap=b.lightMap!==void 0?b.lightMap:null;this.envMap=b.envMap!==void 0?b.envMap:null;this.combine=b.combine!==void 0?b.combine:THREE.MultiplyOperation;this.reflectivity=b.reflectivity!==void 0?b.reflectivity:1;this.refractionRatio=b.refractionRatio!==void 0?b.refractionRatio:0.98;this.fog=b.fog!==void 0?b.fog:
@@ -119,7 +119,7 @@ void 0?b.fog:!1;this.lights=b.lights!==void 0?b.lights:!1;this.vertexColors=b.ve
 THREE.Texture=function(b,c,d,f,i,h){this.id=THREE.TextureCount++;this.image=b;this.mapping=c!==void 0?c:new THREE.UVMapping;this.wrapS=d!==void 0?d:THREE.ClampToEdgeWrapping;this.wrapT=f!==void 0?f:THREE.ClampToEdgeWrapping;this.magFilter=i!==void 0?i:THREE.LinearFilter;this.minFilter=h!==void 0?h:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.needsUpdate=!1};
 THREE.Texture.prototype={constructor:THREE.Texture,clone:function(){var b=new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter);b.offset.copy(this.offset);b.repeat.copy(this.repeat);return b}};THREE.TextureCount=0;THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.LatitudeReflectionMapping=function(){};THREE.LatitudeRefractionMapping=function(){};
 THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=function(){};THREE.UVMapping=function(){};THREE.RepeatWrapping=0;THREE.ClampToEdgeWrapping=1;THREE.MirroredRepeatWrapping=2;THREE.NearestFilter=3;THREE.NearestMipMapNearestFilter=4;THREE.NearestMipMapLinearFilter=5;THREE.LinearFilter=6;THREE.LinearMipMapNearestFilter=7;THREE.LinearMipMapLinearFilter=8;THREE.ByteType=9;THREE.UnsignedByteType=10;THREE.ShortType=11;THREE.UnsignedShortType=12;THREE.IntType=13;
-THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;THREE.DataTexture=function(b,c,d,f,i,h,j,k,p){THREE.Texture.call(this,null,i,h,j,k,p);this.image={data:b,width:c,height:d};this.format=f!==void 0?f:THREE.RGBAFormat};THREE.DataTexture.prototype=new THREE.Texture;THREE.DataTexture.prototype.constructor=THREE.DataTexture;
+THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;THREE.DataTexture=function(b,c,d,f,i,h,j,k,m){THREE.Texture.call(this,null,i,h,j,k,m);this.image={data:b,width:c,height:d};this.format=f!==void 0?f:THREE.RGBAFormat};THREE.DataTexture.prototype=new THREE.Texture;THREE.DataTexture.prototype.constructor=THREE.DataTexture;
 THREE.DataTexture.prototype.clone=function(){var b=new THREE.DataTexture(this.data.slice(0),this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter);b.offset.copy(this.offset);b.repeat.copy(this.repeat);return b};THREE.Particle=function(b){THREE.Object3D.call(this);this.materials=b instanceof Array?b:[b]};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;
 THREE.ParticleSystem=function(b,c){THREE.Object3D.call(this);this.geometry=b;this.materials=c instanceof Array?c:[c];this.sortParticles=!1};THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem;THREE.Line=function(b,c,d){THREE.Object3D.call(this);this.geometry=b;this.materials=c instanceof Array?c:[c];this.type=d!=void 0?d:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;
 THREE.Line.prototype.constructor=THREE.Line;
@@ -178,120 +178,120 @@ THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_pars_fragment,THREE.
 THREE.ShaderChunk.envmap_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n")},particle_basic:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.particle,THREE.UniformsLib.shadowmap]),vertexShader:["uniform float size;\nuniform float scale;",THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * ( scale / length( mvPosition.xyz ) );\n#else\ngl_PointSize = size;\n#endif\ngl_Position = projectionMatrix * mvPosition;",
 THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform vec3 psColor;\nuniform float opacity;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_particle_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.shadowmap_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.fog_fragment,
 "}"].join("\n")},depthRGBA:{uniforms:{},vertexShader:[THREE.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n"),fragmentShader:"vec4 pack_depth( const in float depth ) {\nconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\nconst vec4 bit_mask  = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\nvec4 res = fract( depth * bit_shift );\nres -= res.xxyz * bit_mask;\nreturn res;\n}\nvoid main() {\ngl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );\n}"}};
-THREE.WebGLRenderer=function(b){function c(b,c,d){var f,i,h,j=b.vertices,k=j.length,z=b.colors,n=z.length,E=b.__vertexArray,p=b.__colorArray,m=b.__sortArray,C=b.__dirtyVertices,q=b.__dirtyColors,t=b.__webglCustomAttributes,s,u;if(t)for(s in t)t[s].offset=0;if(d.sortParticles){Fa.multiplySelf(d.matrixWorld);for(f=0;f<k;f++)i=j[f].position,Ja.copy(i),Fa.multiplyVector3(Ja),m[f]=[Ja.z,f];m.sort(function(b,c){return c[0]-b[0]});for(f=0;f<k;f++)i=j[m[f][1]].position,h=f*3,E[h]=i.x,E[h+1]=i.y,E[h+2]=i.z;
-for(f=0;f<n;f++)h=f*3,color=z[m[f][1]],p[h]=color.r,p[h+1]=color.g,p[h+2]=color.b;if(t)for(s in t){f=t[s];z=f.value.length;for(h=0;h<z;h++){index=m[h][1];n=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[n]=f.value[index]}else{if(f.boundTo===void 0||f.boundTo==="vertices")u=f.value[index];f.size===2?(f.array[n]=u.x,f.array[n+1]=u.y):f.size===3?f.type==="c"?(f.array[n]=u.r,f.array[n+1]=u.g,f.array[n+2]=u.b):(f.array[n]=u.x,f.array[n+1]=u.y,f.array[n+2]=u.z):(f.array[n]=
-u.x,f.array[n+1]=u.y,f.array[n+2]=u.z,f.array[n+3]=u.w)}f.offset+=f.size}}}else{if(C)for(f=0;f<k;f++)i=j[f].position,h=f*3,E[h]=i.x,E[h+1]=i.y,E[h+2]=i.z;if(q)for(f=0;f<n;f++)color=z[f],h=f*3,p[h]=color.r,p[h+1]=color.g,p[h+2]=color.b;if(t)for(s in t)if(f=t[s],f.__original.needsUpdate){z=f.value.length;for(h=0;h<z;h++){n=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[n]=f.value[h]}else{if(f.boundTo===void 0||f.boundTo==="vertices")u=f.value[h];f.size===2?(f.array[n]=
-u.x,f.array[n+1]=u.y):f.size===3?f.type==="c"?(f.array[n]=u.r,f.array[n+1]=u.g,f.array[n+2]=u.b):(f.array[n]=u.x,f.array[n+1]=u.y,f.array[n+2]=u.z):(f.array[n]=u.x,f.array[n+1]=u.y,f.array[n+2]=u.z,f.array[n+3]=u.w)}f.offset+=f.size}}}if(C||d.sortParticles)e.bindBuffer(e.ARRAY_BUFFER,b.__webglVertexBuffer),e.bufferData(e.ARRAY_BUFFER,E,c);if(q||d.sortParticles)e.bindBuffer(e.ARRAY_BUFFER,b.__webglColorBuffer),e.bufferData(e.ARRAY_BUFFER,p,c);if(t)for(s in t)if(f=t[s],f.__original.needsUpdate||d.sortParticles)e.bindBuffer(e.ARRAY_BUFFER,
-f.buffer),e.bufferData(e.ARRAY_BUFFER,f.array,c)}function d(b,c,d,f,i){f.program||M.initMaterial(f,c,d,i);if(f.morphTargets&&!i.__webglMorphTargetInfluences){i.__webglMorphTargetInfluences=new Float32Array(M.maxMorphTargets);for(var h=0,j=M.maxMorphTargets;h<j;h++)i.__webglMorphTargetInfluences[h]=0}var k=!1,h=f.program,j=h.uniforms,z=f.uniforms;h!=Wa&&(e.useProgram(h),Wa=h,k=!0);if(f.id!=V)V=f.id,k=!0;if(k){e.uniformMatrix4fv(j.projectionMatrix,!1,Ta);if(d&&f.fog)if(z.fogColor.value=d.color,d instanceof
-THREE.Fog)z.fogNear.value=d.near,z.fogFar.value=d.far;else if(d instanceof THREE.FogExp2)z.fogDensity.value=d.density;if(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f.lights){for(var n,E,p=0,m=0,C=0,q,t,s,v=Ya,H=v.directional.colors,B=v.directional.positions,y=v.point.colors,x=v.point.positions,F=v.point.distances,D=0,K=0,d=n=s=0,k=c.length;d<k;d++)if(n=c[d],E=n.color,q=n.position,t=n.intensity,s=n.distance,n instanceof THREE.AmbientLight)p+=E.r,m+=E.g,C+=E.b;else if(n instanceof
-THREE.DirectionalLight)s=D*3,H[s]=E.r*t,H[s+1]=E.g*t,H[s+2]=E.b*t,B[s]=q.x,B[s+1]=q.y,B[s+2]=q.z,D+=1;else if(n instanceof THREE.SpotLight)s=D*3,H[s]=E.r*t,H[s+1]=E.g*t,H[s+2]=E.b*t,E=1/q.length(),B[s]=q.x*E,B[s+1]=q.y*E,B[s+2]=q.z*E,D+=1;else if(n instanceof THREE.PointLight)n=K*3,y[n]=E.r*t,y[n+1]=E.g*t,y[n+2]=E.b*t,x[n]=q.x,x[n+1]=q.y,x[n+2]=q.z,F[K]=s,K+=1;d=D*3;for(k=H.length;d<k;d++)H[d]=0;d=K*3;for(k=y.length;d<k;d++)y[d]=0;v.point.length=K;v.directional.length=D;v.ambient[0]=p;v.ambient[1]=
-m;v.ambient[2]=C;c=Ya;z.enableLighting.value=c.directional.length+c.point.length;z.ambientLightColor.value=c.ambient;z.directionalLightColor.value=c.directional.colors;z.directionalLightDirection.value=c.directional.positions;z.pointLightColor.value=c.point.colors;z.pointLightPosition.value=c.point.positions;z.pointLightDistance.value=c.point.distances}if(f instanceof THREE.MeshBasicMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshPhongMaterial)z.diffuse.value=f.color,z.opacity.value=
-f.opacity,(z.map.texture=f.map)&&z.offsetRepeat.value.set(f.map.offset.x,f.map.offset.y,f.map.repeat.x,f.map.repeat.y),z.lightMap.texture=f.lightMap,z.envMap.texture=f.envMap,z.reflectivity.value=f.reflectivity,z.refractionRatio.value=f.refractionRatio,z.combine.value=f.combine,z.useRefract.value=f.envMap&&f.envMap.mapping instanceof THREE.CubeRefractionMapping;if(f instanceof THREE.LineBasicMaterial)z.diffuse.value=f.color,z.opacity.value=f.opacity;else if(f instanceof THREE.ParticleBasicMaterial)z.psColor.value=
-f.color,z.opacity.value=f.opacity,z.size.value=f.size,z.scale.value=Ba.height/2,z.map.texture=f.map;else if(f instanceof THREE.MeshPhongMaterial)z.ambient.value=f.ambient,z.specular.value=f.specular,z.shininess.value=f.shininess;else if(f instanceof THREE.MeshDepthMaterial)z.mNear.value=b.near,z.mFar.value=b.far,z.opacity.value=f.opacity;else if(f instanceof THREE.MeshNormalMaterial)z.opacity.value=f.opacity;if(i.receiveShadow&&!f._shadowPass&&z.shadowMatrix){for(c=0;c<Sa.length;c++)z.shadowMatrix.value[c]=
-Sa[c],z.shadowMap.texture[c]=M.shadowMap[c];z.shadowDarkness.value=M.shadowMapDarkness;z.shadowBias.value=M.shadowMapBias}c=f.uniformsList;z=0;for(d=c.length;z<d;z++)if(m=h.uniforms[c[z][1]])if(p=c[z][0],C=p.type,k=p.value,C=="i")e.uniform1i(m,k);else if(C=="f")e.uniform1f(m,k);else if(C=="v2")e.uniform2f(m,k.x,k.y);else if(C=="v3")e.uniform3f(m,k.x,k.y,k.z);else if(C=="v4")e.uniform4f(m,k.x,k.y,k.z,k.w);else if(C=="c")e.uniform3f(m,k.r,k.g,k.b);else if(C=="fv1")e.uniform1fv(m,k);else if(C=="fv")e.uniform3fv(m,
-k);else if(C=="v3v"){if(!p._array)p._array=new Float32Array(3*k.length);C=0;for(q=k.length;C<q;C++)v=C*3,p._array[v]=k[C].x,p._array[v+1]=k[C].y,p._array[v+2]=k[C].z;e.uniform3fv(m,p._array)}else if(C=="m4"){if(!p._array)p._array=new Float32Array(16);k.flattenToArray(p._array);e.uniformMatrix4fv(m,!1,p._array)}else if(C=="m4v"){if(!p._array)p._array=new Float32Array(16*k.length);C=0;for(q=k.length;C<q;C++)k[C].flattenToArrayOffset(p._array,C*16);e.uniformMatrix4fv(m,!1,p._array)}else if(C=="t"){if(e.uniform1i(m,
-k),m=p.texture)if(m.image instanceof Array&&m.image.length==6){if(p=m,p.image.length==6)if(p.needsUpdate){if(!p.image.__webglTextureCube)p.image.__webglTextureCube=e.createTexture();e.activeTexture(e.TEXTURE0+k);e.bindTexture(e.TEXTURE_CUBE_MAP,p.image.__webglTextureCube);for(k=0;k<6;k++)e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+k,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,p.image[k]);u(e.TEXTURE_CUBE_MAP,p,p.image[0]);p.needsUpdate=!1}else e.activeTexture(e.TEXTURE0+k),e.bindTexture(e.TEXTURE_CUBE_MAP,p.image.__webglTextureCube)}else m instanceof
-THREE.WebGLRenderTargetCube?(p=m,e.activeTexture(e.TEXTURE0+k),e.bindTexture(e.TEXTURE_CUBE_MAP,p.__webglTexture)):T(m,k)}else if(C=="tv"){if(!p._array){p._array=[];C=0;for(q=p.texture.length;C<q;C++)p._array[C]=k+C}e.uniform1iv(m,p._array);C=0;for(q=p.texture.length;C<q;C++)(m=p.texture[C])&&T(m,p._array[C])}(f instanceof THREE.ShaderMaterial||f instanceof THREE.MeshPhongMaterial||f.envMap)&&j.cameraPosition!==null&&e.uniform3f(j.cameraPosition,b.position.x,b.position.y,b.position.z);(f instanceof
-THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.ShaderMaterial||f.skinning)&&j.viewMatrix!==null&&e.uniformMatrix4fv(j.viewMatrix,!1,Ua);f.skinning&&(e.uniformMatrix4fv(j.cameraInverseMatrix,!1,Ua),e.uniformMatrix4fv(j.boneGlobalMatrices,!1,i.boneMatrices))}e.uniformMatrix4fv(j.modelViewMatrix,!1,i._modelViewMatrixArray);j.normalMatrix&&e.uniformMatrix3fv(j.normalMatrix,!1,i._normalMatrixArray);(f instanceof THREE.ShaderMaterial||f.envMap||f.skinning||i.receiveShadow)&&
-j.objectMatrix!==null&&e.uniformMatrix4fv(j.objectMatrix,!1,i._objectMatrixArray);return h}function f(b,c,f,i,h,j){if(i.opacity!=0){var k,f=d(b,c,f,i,j),b=f.attributes,c=!1,f=h.id*16777215+f.id;f!=na&&(na=f,c=!0);if(!i.morphTargets&&b.position>=0)c&&(e.bindBuffer(e.ARRAY_BUFFER,h.__webglVertexBuffer),e.vertexAttribPointer(b.position,3,e.FLOAT,!1,0,0));else if(j.morphTargetBase){f=i.program.attributes;j.morphTargetBase!==-1?(e.bindBuffer(e.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[j.morphTargetBase]),
-e.vertexAttribPointer(f.position,3,e.FLOAT,!1,0,0)):f.position>=0&&(e.bindBuffer(e.ARRAY_BUFFER,h.__webglVertexBuffer),e.vertexAttribPointer(f.position,3,e.FLOAT,!1,0,0));if(j.morphTargetForcedOrder.length)for(var n=0,z=j.morphTargetForcedOrder,p=j.morphTargetInfluences;n<i.numSupportedMorphTargets&&n<z.length;)e.bindBuffer(e.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[z[n]]),e.vertexAttribPointer(f["morphTarget"+n],3,e.FLOAT,!1,0,0),j.__webglMorphTargetInfluences[n]=p[z[n]],n++;else{var z=[],m=-1,
-q=0,p=j.morphTargetInfluences,t,C=p.length,n=0;for(j.morphTargetBase!==-1&&(z[j.morphTargetBase]=!0);n<i.numSupportedMorphTargets;){for(t=0;t<C;t++)!z[t]&&p[t]>m&&(q=t,m=p[q]);e.bindBuffer(e.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[q]);e.vertexAttribPointer(f["morphTarget"+n],3,e.FLOAT,!1,0,0);j.__webglMorphTargetInfluences[n]=m;z[q]=1;m=-1;n++}}i.program.uniforms.morphTargetInfluences!==null&&e.uniform1fv(i.program.uniforms.morphTargetInfluences,j.__webglMorphTargetInfluences)}if(c){if(h.__webglCustomAttributes)for(k in h.__webglCustomAttributes)b[k]>=
+THREE.WebGLRenderer=function(b){function c(b,c,d){var f,i,h,j=b.vertices,k=j.length,y=b.colors,n=y.length,D=b.__vertexArray,m=b.__colorArray,p=b.__sortArray,C=b.__dirtyVertices,q=b.__dirtyColors,t=b.__webglCustomAttributes,r,u;if(t)for(r in t)t[r].offset=0;if(d.sortParticles){Ga.multiplySelf(d.matrixWorld);for(f=0;f<k;f++)i=j[f].position,Sa.copy(i),Ga.multiplyVector3(Sa),p[f]=[Sa.z,f];p.sort(function(b,c){return c[0]-b[0]});for(f=0;f<k;f++)i=j[p[f][1]].position,h=f*3,D[h]=i.x,D[h+1]=i.y,D[h+2]=i.z;
+for(f=0;f<n;f++)h=f*3,color=y[p[f][1]],m[h]=color.r,m[h+1]=color.g,m[h+2]=color.b;if(t)for(r in t){f=t[r];y=f.value.length;for(h=0;h<y;h++){index=p[h][1];n=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[n]=f.value[index]}else{if(f.boundTo===void 0||f.boundTo==="vertices")u=f.value[index];f.size===2?(f.array[n]=u.x,f.array[n+1]=u.y):f.size===3?f.type==="c"?(f.array[n]=u.r,f.array[n+1]=u.g,f.array[n+2]=u.b):(f.array[n]=u.x,f.array[n+1]=u.y,f.array[n+2]=u.z):(f.array[n]=
+u.x,f.array[n+1]=u.y,f.array[n+2]=u.z,f.array[n+3]=u.w)}f.offset+=f.size}}}else{if(C)for(f=0;f<k;f++)i=j[f].position,h=f*3,D[h]=i.x,D[h+1]=i.y,D[h+2]=i.z;if(q)for(f=0;f<n;f++)color=y[f],h=f*3,m[h]=color.r,m[h+1]=color.g,m[h+2]=color.b;if(t)for(r in t)if(f=t[r],f.__original.needsUpdate){y=f.value.length;for(h=0;h<y;h++){n=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[n]=f.value[h]}else{if(f.boundTo===void 0||f.boundTo==="vertices")u=f.value[h];f.size===2?(f.array[n]=
+u.x,f.array[n+1]=u.y):f.size===3?f.type==="c"?(f.array[n]=u.r,f.array[n+1]=u.g,f.array[n+2]=u.b):(f.array[n]=u.x,f.array[n+1]=u.y,f.array[n+2]=u.z):(f.array[n]=u.x,f.array[n+1]=u.y,f.array[n+2]=u.z,f.array[n+3]=u.w)}f.offset+=f.size}}}if(C||d.sortParticles)e.bindBuffer(e.ARRAY_BUFFER,b.__webglVertexBuffer),e.bufferData(e.ARRAY_BUFFER,D,c);if(q||d.sortParticles)e.bindBuffer(e.ARRAY_BUFFER,b.__webglColorBuffer),e.bufferData(e.ARRAY_BUFFER,m,c);if(t)for(r in t)if(f=t[r],f.__original.needsUpdate||d.sortParticles)e.bindBuffer(e.ARRAY_BUFFER,
+f.buffer),e.bufferData(e.ARRAY_BUFFER,f.array,c)}function d(b,c,d,f,i){f.program||M.initMaterial(f,c,d,i);if(f.morphTargets&&!i.__webglMorphTargetInfluences){i.__webglMorphTargetInfluences=new Float32Array(M.maxMorphTargets);for(var h=0,j=M.maxMorphTargets;h<j;h++)i.__webglMorphTargetInfluences[h]=0}var k=!1,h=f.program,j=h.uniforms,y=f.uniforms;h!=Xa&&(e.useProgram(h),Xa=h,k=!0);if(f.id!=U)U=f.id,k=!0;if(k){e.uniformMatrix4fv(j.projectionMatrix,!1,Va);if(d&&f.fog)if(y.fogColor.value=d.color,d instanceof
+THREE.Fog)y.fogNear.value=d.near,y.fogFar.value=d.far;else if(d instanceof THREE.FogExp2)y.fogDensity.value=d.density;if(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f.lights){for(var n,D,m=0,p=0,C=0,q,t,r,v=Za,H=v.directional.colors,B=v.directional.positions,z=v.point.colors,x=v.point.positions,F=v.point.distances,E=0,K=0,d=n=r=0,k=c.length;d<k;d++)if(n=c[d],D=n.color,q=n.position,t=n.intensity,r=n.distance,n instanceof THREE.AmbientLight)m+=D.r,p+=D.g,C+=D.b;else if(n instanceof
+THREE.DirectionalLight)r=E*3,H[r]=D.r*t,H[r+1]=D.g*t,H[r+2]=D.b*t,B[r]=q.x,B[r+1]=q.y,B[r+2]=q.z,E+=1;else if(n instanceof THREE.SpotLight)r=E*3,H[r]=D.r*t,H[r+1]=D.g*t,H[r+2]=D.b*t,D=1/q.length(),B[r]=q.x*D,B[r+1]=q.y*D,B[r+2]=q.z*D,E+=1;else if(n instanceof THREE.PointLight)n=K*3,z[n]=D.r*t,z[n+1]=D.g*t,z[n+2]=D.b*t,x[n]=q.x,x[n+1]=q.y,x[n+2]=q.z,F[K]=r,K+=1;d=E*3;for(k=H.length;d<k;d++)H[d]=0;d=K*3;for(k=z.length;d<k;d++)z[d]=0;v.point.length=K;v.directional.length=E;v.ambient[0]=m;v.ambient[1]=
+p;v.ambient[2]=C;c=Za;y.enableLighting.value=c.directional.length+c.point.length;y.ambientLightColor.value=c.ambient;y.directionalLightColor.value=c.directional.colors;y.directionalLightDirection.value=c.directional.positions;y.pointLightColor.value=c.point.colors;y.pointLightPosition.value=c.point.positions;y.pointLightDistance.value=c.point.distances}if(f instanceof THREE.MeshBasicMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshPhongMaterial)y.diffuse.value=f.color,y.opacity.value=
+f.opacity,(y.map.texture=f.map)&&y.offsetRepeat.value.set(f.map.offset.x,f.map.offset.y,f.map.repeat.x,f.map.repeat.y),y.lightMap.texture=f.lightMap,y.envMap.texture=f.envMap,y.reflectivity.value=f.reflectivity,y.refractionRatio.value=f.refractionRatio,y.combine.value=f.combine,y.useRefract.value=f.envMap&&f.envMap.mapping instanceof THREE.CubeRefractionMapping;if(f instanceof THREE.LineBasicMaterial)y.diffuse.value=f.color,y.opacity.value=f.opacity;else if(f instanceof THREE.ParticleBasicMaterial)y.psColor.value=
+f.color,y.opacity.value=f.opacity,y.size.value=f.size,y.scale.value=Ca.height/2,y.map.texture=f.map;else if(f instanceof THREE.MeshPhongMaterial)y.ambient.value=f.ambient,y.specular.value=f.specular,y.shininess.value=f.shininess;else if(f instanceof THREE.MeshDepthMaterial)y.mNear.value=b.near,y.mFar.value=b.far,y.opacity.value=f.opacity;else if(f instanceof THREE.MeshNormalMaterial)y.opacity.value=f.opacity;if(i.receiveShadow&&!f._shadowPass&&y.shadowMatrix){for(c=0;c<Ua.length;c++)y.shadowMatrix.value[c]=
+Ua[c],y.shadowMap.texture[c]=M.shadowMap[c];y.shadowDarkness.value=M.shadowMapDarkness;y.shadowBias.value=M.shadowMapBias}c=f.uniformsList;y=0;for(d=c.length;y<d;y++)if(p=h.uniforms[c[y][1]])if(m=c[y][0],C=m.type,k=m.value,C=="i")e.uniform1i(p,k);else if(C=="f")e.uniform1f(p,k);else if(C=="v2")e.uniform2f(p,k.x,k.y);else if(C=="v3")e.uniform3f(p,k.x,k.y,k.z);else if(C=="v4")e.uniform4f(p,k.x,k.y,k.z,k.w);else if(C=="c")e.uniform3f(p,k.r,k.g,k.b);else if(C=="fv1")e.uniform1fv(p,k);else if(C=="fv")e.uniform3fv(p,
+k);else if(C=="v3v"){if(!m._array)m._array=new Float32Array(3*k.length);C=0;for(q=k.length;C<q;C++)v=C*3,m._array[v]=k[C].x,m._array[v+1]=k[C].y,m._array[v+2]=k[C].z;e.uniform3fv(p,m._array)}else if(C=="m4"){if(!m._array)m._array=new Float32Array(16);k.flattenToArray(m._array);e.uniformMatrix4fv(p,!1,m._array)}else if(C=="m4v"){if(!m._array)m._array=new Float32Array(16*k.length);C=0;for(q=k.length;C<q;C++)k[C].flattenToArrayOffset(m._array,C*16);e.uniformMatrix4fv(p,!1,m._array)}else if(C=="t"){if(e.uniform1i(p,
+k),p=m.texture)if(p.image instanceof Array&&p.image.length==6){if(m=p,m.image.length==6)if(m.needsUpdate){if(!m.image.__webglTextureCube)m.image.__webglTextureCube=e.createTexture();e.activeTexture(e.TEXTURE0+k);e.bindTexture(e.TEXTURE_CUBE_MAP,m.image.__webglTextureCube);for(k=0;k<6;k++)e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+k,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,m.image[k]);u(e.TEXTURE_CUBE_MAP,m,m.image[0]);m.needsUpdate=!1}else e.activeTexture(e.TEXTURE0+k),e.bindTexture(e.TEXTURE_CUBE_MAP,m.image.__webglTextureCube)}else p instanceof
+THREE.WebGLRenderTargetCube?(m=p,e.activeTexture(e.TEXTURE0+k),e.bindTexture(e.TEXTURE_CUBE_MAP,m.__webglTexture)):S(p,k)}else if(C=="tv"){if(!m._array){m._array=[];C=0;for(q=m.texture.length;C<q;C++)m._array[C]=k+C}e.uniform1iv(p,m._array);C=0;for(q=m.texture.length;C<q;C++)(p=m.texture[C])&&S(p,m._array[C])}(f instanceof THREE.ShaderMaterial||f instanceof THREE.MeshPhongMaterial||f.envMap)&&j.cameraPosition!==null&&e.uniform3f(j.cameraPosition,b.position.x,b.position.y,b.position.z);(f instanceof
+THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.ShaderMaterial||f.skinning)&&j.viewMatrix!==null&&e.uniformMatrix4fv(j.viewMatrix,!1,Wa);f.skinning&&(e.uniformMatrix4fv(j.cameraInverseMatrix,!1,Wa),e.uniformMatrix4fv(j.boneGlobalMatrices,!1,i.boneMatrices))}e.uniformMatrix4fv(j.modelViewMatrix,!1,i._modelViewMatrixArray);j.normalMatrix&&e.uniformMatrix3fv(j.normalMatrix,!1,i._normalMatrixArray);(f instanceof THREE.ShaderMaterial||f.envMap||f.skinning||i.receiveShadow)&&
+j.objectMatrix!==null&&e.uniformMatrix4fv(j.objectMatrix,!1,i._objectMatrixArray);return h}function f(b,c,f,i,h,j){if(i.opacity!=0){var k,f=d(b,c,f,i,j),b=f.attributes,c=!1,f=h.id*16777215+f.id;f!=W&&(W=f,c=!0);if(!i.morphTargets&&b.position>=0)c&&(e.bindBuffer(e.ARRAY_BUFFER,h.__webglVertexBuffer),e.vertexAttribPointer(b.position,3,e.FLOAT,!1,0,0));else if(j.morphTargetBase){f=i.program.attributes;j.morphTargetBase!==-1?(e.bindBuffer(e.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[j.morphTargetBase]),
+e.vertexAttribPointer(f.position,3,e.FLOAT,!1,0,0)):f.position>=0&&(e.bindBuffer(e.ARRAY_BUFFER,h.__webglVertexBuffer),e.vertexAttribPointer(f.position,3,e.FLOAT,!1,0,0));if(j.morphTargetForcedOrder.length)for(var n=0,y=j.morphTargetForcedOrder,m=j.morphTargetInfluences;n<i.numSupportedMorphTargets&&n<y.length;)e.bindBuffer(e.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[y[n]]),e.vertexAttribPointer(f["morphTarget"+n],3,e.FLOAT,!1,0,0),j.__webglMorphTargetInfluences[n]=m[y[n]],n++;else{var y=[],p=-1,
+q=0,m=j.morphTargetInfluences,t,C=m.length,n=0;for(j.morphTargetBase!==-1&&(y[j.morphTargetBase]=!0);n<i.numSupportedMorphTargets;){for(t=0;t<C;t++)!y[t]&&m[t]>p&&(q=t,p=m[q]);e.bindBuffer(e.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[q]);e.vertexAttribPointer(f["morphTarget"+n],3,e.FLOAT,!1,0,0);j.__webglMorphTargetInfluences[n]=p;y[q]=1;p=-1;n++}}i.program.uniforms.morphTargetInfluences!==null&&e.uniform1fv(i.program.uniforms.morphTargetInfluences,j.__webglMorphTargetInfluences)}if(c){if(h.__webglCustomAttributes)for(k in h.__webglCustomAttributes)b[k]>=
 0&&(f=h.__webglCustomAttributes[k],e.bindBuffer(e.ARRAY_BUFFER,f.buffer),e.vertexAttribPointer(b[k],f.size,e.FLOAT,!1,0,0));b.color>=0&&(e.bindBuffer(e.ARRAY_BUFFER,h.__webglColorBuffer),e.vertexAttribPointer(b.color,3,e.FLOAT,!1,0,0));b.normal>=0&&(e.bindBuffer(e.ARRAY_BUFFER,h.__webglNormalBuffer),e.vertexAttribPointer(b.normal,3,e.FLOAT,!1,0,0));b.tangent>=0&&(e.bindBuffer(e.ARRAY_BUFFER,h.__webglTangentBuffer),e.vertexAttribPointer(b.tangent,4,e.FLOAT,!1,0,0));b.uv>=0&&(h.__webglUVBuffer?(e.bindBuffer(e.ARRAY_BUFFER,
 h.__webglUVBuffer),e.vertexAttribPointer(b.uv,2,e.FLOAT,!1,0,0),e.enableVertexAttribArray(b.uv)):e.disableVertexAttribArray(b.uv));b.uv2>=0&&(h.__webglUV2Buffer?(e.bindBuffer(e.ARRAY_BUFFER,h.__webglUV2Buffer),e.vertexAttribPointer(b.uv2,2,e.FLOAT,!1,0,0),e.enableVertexAttribArray(b.uv2)):e.disableVertexAttribArray(b.uv2));i.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(e.bindBuffer(e.ARRAY_BUFFER,h.__webglSkinVertexABuffer),e.vertexAttribPointer(b.skinVertexA,4,
 e.FLOAT,!1,0,0),e.bindBuffer(e.ARRAY_BUFFER,h.__webglSkinVertexBBuffer),e.vertexAttribPointer(b.skinVertexB,4,e.FLOAT,!1,0,0),e.bindBuffer(e.ARRAY_BUFFER,h.__webglSkinIndicesBuffer),e.vertexAttribPointer(b.skinIndex,4,e.FLOAT,!1,0,0),e.bindBuffer(e.ARRAY_BUFFER,h.__webglSkinWeightsBuffer),e.vertexAttribPointer(b.skinWeight,4,e.FLOAT,!1,0,0))}j instanceof THREE.Mesh?(i.wireframe?(e.lineWidth(i.wireframeLinewidth),c&&e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,h.__webglLineBuffer),e.drawElements(e.LINES,h.__webglLineCount,
 e.UNSIGNED_SHORT,0)):(c&&e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,h.__webglFaceBuffer),e.drawElements(e.TRIANGLES,h.__webglFaceCount,e.UNSIGNED_SHORT,0)),M.info.render.calls++,M.info.render.vertices+=h.__webglFaceCount,M.info.render.faces+=h.__webglFaceCount/3):j instanceof THREE.Line?(j=j.type==THREE.LineStrip?e.LINE_STRIP:e.LINES,e.lineWidth(i.linewidth),e.drawArrays(j,0,h.__webglLineCount),M.info.render.calls++):j instanceof THREE.ParticleSystem?(e.drawArrays(e.POINTS,0,h.__webglParticleCount),M.info.render.calls++):
 j instanceof THREE.Ribbon&&(e.drawArrays(e.TRIANGLE_STRIP,0,h.__webglVertexCount),M.info.render.calls++)}}function i(b,c,d){if(!b.__webglVertexBuffer)b.__webglVertexBuffer=e.createBuffer();if(!b.__webglNormalBuffer)b.__webglNormalBuffer=e.createBuffer();b.hasPos&&(e.bindBuffer(e.ARRAY_BUFFER,b.__webglVertexBuffer),e.bufferData(e.ARRAY_BUFFER,b.positionArray,e.DYNAMIC_DRAW),e.enableVertexAttribArray(c.attributes.position),e.vertexAttribPointer(c.attributes.position,3,e.FLOAT,!1,0,0));if(b.hasNormal){e.bindBuffer(e.ARRAY_BUFFER,
-b.__webglNormalBuffer);if(d==THREE.FlatShading){var f,h,i,j,k,z,n,p,m,q,C=b.count*3;for(q=0;q<C;q+=9)d=b.normalArray,f=d[q],h=d[q+1],i=d[q+2],j=d[q+3],z=d[q+4],p=d[q+5],k=d[q+6],n=d[q+7],m=d[q+8],f=(f+j+k)/3,h=(h+z+n)/3,i=(i+p+m)/3,d[q]=f,d[q+1]=h,d[q+2]=i,d[q+3]=f,d[q+4]=h,d[q+5]=i,d[q+6]=f,d[q+7]=h,d[q+8]=i}e.bufferData(e.ARRAY_BUFFER,b.normalArray,e.DYNAMIC_DRAW);e.enableVertexAttribArray(c.attributes.normal);e.vertexAttribPointer(c.attributes.normal,3,e.FLOAT,!1,0,0)}e.drawArrays(e.TRIANGLES,
-0,b.count);b.count=0}function h(b){if($!=b.doubleSided)b.doubleSided?e.disable(e.CULL_FACE):e.enable(e.CULL_FACE),$=b.doubleSided;if(N!=b.flipSided)b.flipSided?e.frontFace(e.CW):e.frontFace(e.CCW),N=b.flipSided}function j(b){sa!=b&&(b?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST),sa=b)}function k(b){R!=b&&(e.depthMask(b),R=b)}function p(b,c,d){ua!=b&&(b?e.enable(e.POLYGON_OFFSET_FILL):e.disable(e.POLYGON_OFFSET_FILL),ua=b);if(b&&(La!=c||Ra!=d))e.polygonOffset(c,d),La=c,Ra=d}function n(b){Ca[0].set(b.n41-
-b.n11,b.n42-b.n12,b.n43-b.n13,b.n44-b.n14);Ca[1].set(b.n41+b.n11,b.n42+b.n12,b.n43+b.n13,b.n44+b.n14);Ca[2].set(b.n41+b.n21,b.n42+b.n22,b.n43+b.n23,b.n44+b.n24);Ca[3].set(b.n41-b.n21,b.n42-b.n22,b.n43-b.n23,b.n44-b.n24);Ca[4].set(b.n41-b.n31,b.n42-b.n32,b.n43-b.n33,b.n44-b.n34);Ca[5].set(b.n41+b.n31,b.n42+b.n32,b.n43+b.n33,b.n44+b.n34);for(var c,b=0;b<6;b++)c=Ca[b],c.divideScalar(Math.sqrt(c.x*c.x+c.y*c.y+c.z*c.z))}function q(b){for(var c=b.matrixWorld,e=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,
-Math.max(b.scale.y,b.scale.z)),d=0;d<6;d++)if(b=Ca[d].x*c.n14+Ca[d].y*c.n24+Ca[d].z*c.n34+Ca[d].w,b<=e)return!1;return!0}function m(b,c){b.list[b.count]=c;b.count+=1}function t(b){var c,e,d=b.object,f=b.opaque,h=b.transparent;h.count=0;b=f.count=0;for(c=d.materials.length;b<c;b++)e=d.materials[b],e.transparent?m(h,e):m(f,e)}function v(b){var c,e,d,f,h=b.object,i=b.buffer,j=b.opaque,k=b.transparent;k.count=0;b=j.count=0;for(d=h.materials.length;b<d;b++)if(c=h.materials[b],c instanceof THREE.MeshFaceMaterial){c=
-0;for(e=i.materials.length;c<e;c++)(f=i.materials[c])&&(f.transparent?m(k,f):m(j,f))}else(f=c)&&(f.transparent?m(k,f):m(j,f))}function B(b,c){return c.z-b.z}function x(b){var c,k,p,I=0,m,t,O,z,s=b.lights;X||(X=new THREE.Camera(M.shadowCameraFov,M.shadowMapWidth/M.shadowMapHeight,M.shadowCameraNear,M.shadowCameraFar));c=0;for(k=s.length;c<k;c++)if(p=s[c],p instanceof THREE.SpotLight&&p.castShadow){V=-1;M.shadowMap[I]||(M.shadowMap[I]=new THREE.WebGLRenderTarget(M.shadowMapWidth,M.shadowMapHeight,{minFilter:THREE.LinearFilter,
-magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}));Sa[I]||(Sa[I]=new THREE.Matrix4);m=M.shadowMap[I];t=Sa[I];X.position.copy(p.position);X.target.position.copy(p.target.position);X.update(void 0,!0);b.update(void 0,!1,X);t.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);t.multiplySelf(X.projectionMatrix);t.multiplySelf(X.matrixWorldInverse);X.matrixWorldInverse.flattenToArray(Ua);X.projectionMatrix.flattenToArray(Ta);Fa.multiply(X.projectionMatrix,X.matrixWorldInverse);n(Fa);M.initWebGLObjects(b);
-L(m);e.clearColor(1,1,1,1);M.clear();e.clearColor(aa.r,aa.g,aa.b,Ga);t=b.__webglObjects.length;p=b.__webglObjectsImmediate.length;for(m=0;m<t;m++)O=b.__webglObjects[m],z=O.object,z.visible&&z.castShadow?!(z instanceof THREE.Mesh)||!z.frustumCulled||q(z)?(z.matrixWorld.flattenToArray(z._objectMatrixArray),F(z,X,!1),O.render=!0):O.render=!1:O.render=!1;j(!0);G(THREE.NormalBlending);for(m=0;m<t;m++)if(O=b.__webglObjects[m],O.render)z=O.object,buffer=O.buffer,h(z),O=z.customDepthMaterial?z.customDepthMaterial:
-z.geometry.morphTargets.length?Za:Va,f(X,s,null,O,buffer,z);for(m=0;m<p;m++)O=b.__webglObjectsImmediate[m],z=O.object,z.visible&&z.castShadow&&(z.matrixAutoUpdate&&z.matrixWorld.flattenToArray(z._objectMatrixArray),F(z,X,!1),h(z),program=d(X,s,null,Va,z),z.render(function(b){i(b,program,Va.shading)}));I++}}function D(b,c){var d,f,h;d=s.attributes;var i=s.uniforms,j=ya/Ea,k,n=[],p=Ea*0.5,m=ya*0.5,q=!0;e.useProgram(s.program);Wa=s.program;na=sa=ka=-1;$a||(e.enableVertexAttribArray(s.attributes.position),
-e.enableVertexAttribArray(s.attributes.uv),$a=!0);e.disable(e.CULL_FACE);e.enable(e.BLEND);e.depthMask(!0);e.bindBuffer(e.ARRAY_BUFFER,s.vertexBuffer);e.vertexAttribPointer(d.position,2,e.FLOAT,!1,16,0);e.vertexAttribPointer(d.uv,2,e.FLOAT,!1,16,8);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,s.elementBuffer);e.uniformMatrix4fv(i.projectionMatrix,!1,Ta);e.activeTexture(e.TEXTURE0);e.uniform1i(i.map,0);d=0;for(f=b.__webglSprites.length;d<f;d++)if(h=b.__webglSprites[d],h.visible&&h.opacity!=0)h.useScreenCoordinates?
-h.z=-h.position.z:(h._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,h.matrixWorld,h._modelViewMatrixArray),h.z=-h._modelViewMatrix.n34);b.__webglSprites.sort(B);d=0;for(f=b.__webglSprites.length;d<f;d++)h=b.__webglSprites[d],h.visible&&h.opacity!=0&&h.map&&h.map.image&&h.map.image.width&&(h.useScreenCoordinates?(e.uniform1i(i.useScreenCoordinates,1),e.uniform3f(i.screenPosition,(h.position.x-p)/p,(m-h.position.y)/m,Math.max(0,Math.min(1,h.position.z)))):(e.uniform1i(i.useScreenCoordinates,
-0),e.uniform1i(i.affectedByDistance,h.affectedByDistance?1:0),e.uniformMatrix4fv(i.modelViewMatrix,!1,h._modelViewMatrixArray)),k=h.map.image.width/(h.scaleByViewport?ya:1),n[0]=k*j*h.scale.x,n[1]=k*h.scale.y,e.uniform2f(i.uvScale,h.uvScale.x,h.uvScale.y),e.uniform2f(i.uvOffset,h.uvOffset.x,h.uvOffset.y),e.uniform2f(i.alignment,h.alignment.x,h.alignment.y),e.uniform1f(i.opacity,h.opacity),e.uniform3f(i.color,h.color.r,h.color.g,h.color.b),e.uniform1f(i.rotation,h.rotation),e.uniform2fv(i.scale,n),
-h.mergeWith3D&&!q?(e.enable(e.DEPTH_TEST),q=!0):!h.mergeWith3D&&q&&(e.disable(e.DEPTH_TEST),q=!1),G(h.blending),T(h.map,0),e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0));e.enable(e.CULL_FACE);e.enable(e.DEPTH_TEST);e.depthMask(R)}function F(b,c,e){b._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);e&&THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}function va(b){var c,e,d,f;f=b.__materials;b=0;for(e=f.length;b<
-e;b++)if(d=f[b],d.attributes)for(c in d.attributes)if(d.attributes[c].needsUpdate)return!0;return!1}function wa(b){var c,e,d,f;f=b.__materials;b=0;for(e=f.length;b<e;b++)if(d=f[b],d.attributes)for(c in d.attributes)d.attributes[c].needsUpdate=!1}function qa(b,c){var e;for(e=b.length-1;e>=0;e--)b[e].object==c&&b.splice(e,1)}function ra(b){function c(b){var f=[];e=0;for(d=b.length;e<d;e++)b[e]==void 0?f.push("undefined"):f.push(b[e].id);return f.join("_")}var e,d,f,h,i,j,k,n,p={},m=b.morphTargets!==
-void 0?b.morphTargets.length:0;b.geometryGroups={};f=0;for(h=b.faces.length;f<h;f++)i=b.faces[f],j=i.materials,k=c(j),p[k]==void 0&&(p[k]={hash:k,counter:0}),n=p[k].hash+"_"+p[k].counter,b.geometryGroups[n]==void 0&&(b.geometryGroups[n]={faces:[],materials:j,vertices:0,numMorphTargets:m}),i=i instanceof THREE.Face3?3:4,b.geometryGroups[n].vertices+i>65535&&(p[k].counter+=1,n=p[k].hash+"_"+p[k].counter,b.geometryGroups[n]==void 0&&(b.geometryGroups[n]={faces:[],materials:j,vertices:0,numMorphTargets:m})),
-b.geometryGroups[n].faces.push(f),b.geometryGroups[n].vertices+=i;b.geometryGroupsList=[];for(var q in b.geometryGroups)b.geometryGroups[q].id=J++,b.geometryGroupsList.push(b.geometryGroups[q])}function ia(b,c,e){b.push({buffer:c,object:e,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function G(b){if(b!=ka){switch(b){case THREE.AdditiveBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.SRC_ALPHA,e.ONE);break;case THREE.SubtractiveBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.ZERO,
-e.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.ZERO,e.SRC_COLOR);break;default:e.blendEquationSeparate(e.FUNC_ADD,e.FUNC_ADD),e.blendFuncSeparate(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA)}ka=b}}function u(b,c,d){(d.width&d.width-1)==0&&(d.height&d.height-1)==0?(e.texParameteri(b,e.TEXTURE_WRAP_S,W(c.wrapS)),e.texParameteri(b,e.TEXTURE_WRAP_T,W(c.wrapT)),e.texParameteri(b,e.TEXTURE_MAG_FILTER,W(c.magFilter)),e.texParameteri(b,
-e.TEXTURE_MIN_FILTER,W(c.minFilter)),e.generateMipmap(b)):(e.texParameteri(b,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(b,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameteri(b,e.TEXTURE_MAG_FILTER,ja(c.magFilter)),e.texParameteri(b,e.TEXTURE_MIN_FILTER,ja(c.minFilter)))}function T(b,c){if(b.needsUpdate){if(!b.__webglInit)b.__webglInit=!0,b.__webglTexture=e.createTexture(),M.info.memory.textures++;e.activeTexture(e.TEXTURE0+c);e.bindTexture(e.TEXTURE_2D,b.__webglTexture);b instanceof THREE.DataTexture?
-e.texImage2D(e.TEXTURE_2D,0,W(b.format),b.image.width,b.image.height,0,W(b.format),e.UNSIGNED_BYTE,b.image.data):e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,b.image);u(e.TEXTURE_2D,b,b.image);b.needsUpdate=!1}else e.activeTexture(e.TEXTURE0+c),e.bindTexture(e.TEXTURE_2D,b.__webglTexture)}function L(b){var c=b instanceof THREE.WebGLRenderTargetCube;if(b&&!b.__webglFramebuffer){if(b.depthBuffer===void 0)b.depthBuffer=!0;if(b.stencilBuffer===void 0)b.stencilBuffer=!0;b.__webglRenderbuffer=
-e.createRenderbuffer();b.__webglTexture=e.createTexture();if(c){e.bindTexture(e.TEXTURE_CUBE_MAP,b.__webglTexture);u(e.TEXTURE_CUBE_MAP,b,b);b.__webglFramebuffer=[];for(var d=0;d<6;d++)b.__webglFramebuffer[d]=e.createFramebuffer(),e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+d,0,W(b.format),b.width,b.height,0,W(b.format),W(b.type),null)}else b.__webglFramebuffer=e.createFramebuffer(),e.bindTexture(e.TEXTURE_2D,b.__webglTexture),u(e.TEXTURE_2D,b,b),e.texImage2D(e.TEXTURE_2D,0,W(b.format),b.width,b.height,
-0,W(b.format),W(b.type),null);e.bindRenderbuffer(e.RENDERBUFFER,b.__webglRenderbuffer);if(c)for(d=0;d<6;++d)e.bindFramebuffer(e.FRAMEBUFFER,b.__webglFramebuffer[d]),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+d,b.__webglTexture,0);else e.bindFramebuffer(e.FRAMEBUFFER,b.__webglFramebuffer),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,b.__webglTexture,0);b.depthBuffer&&!b.stencilBuffer?(e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_COMPONENT16,
-b.width,b.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,b.__webglRenderbuffer)):b.depthBuffer&&b.stencilBuffer?(e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_STENCIL,b.width,b.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,b.__webglRenderbuffer)):e.renderbufferStorage(e.RENDERBUFFER,e.RGBA4,b.width,b.height);c?e.bindTexture(e.TEXTURE_CUBE_MAP,null):e.bindTexture(e.TEXTURE_2D,null);e.bindRenderbuffer(e.RENDERBUFFER,null);
-e.bindFramebuffer(e.FRAMEBUFFER,null)}var f,h;b?(c=c?b.__webglFramebuffer[b.activeCubeFace]:b.__webglFramebuffer,d=b.width,b=b.height,h=f=0):(c=null,d=Ea,b=ya,f=Ia,h=Aa);c!=xa&&(e.bindFramebuffer(e.FRAMEBUFFER,c),e.viewport(f,h,d,b),xa=c)}function U(b){b instanceof THREE.WebGLRenderTargetCube?(e.bindTexture(e.TEXTURE_CUBE_MAP,b.__webglTexture),e.generateMipmap(e.TEXTURE_CUBE_MAP),e.bindTexture(e.TEXTURE_CUBE_MAP,null)):(e.bindTexture(e.TEXTURE_2D,b.__webglTexture),e.generateMipmap(e.TEXTURE_2D),e.bindTexture(e.TEXTURE_2D,
-null))}function Z(b,c){var d;b=="fragment"?d=e.createShader(e.FRAGMENT_SHADER):b=="vertex"&&(d=e.createShader(e.VERTEX_SHADER));e.shaderSource(d,c);e.compileShader(d);if(!e.getShaderParameter(d,e.COMPILE_STATUS))return console.error(e.getShaderInfoLog(d)),console.error(c),null;return d}function ja(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return e.NEAREST;default:return e.LINEAR}}function W(b){switch(b){case THREE.RepeatWrapping:return e.REPEAT;
+b.__webglNormalBuffer);if(d==THREE.FlatShading){var f,h,i,j,k,y,n,m,p,q,C=b.count*3;for(q=0;q<C;q+=9)d=b.normalArray,f=d[q],h=d[q+1],i=d[q+2],j=d[q+3],y=d[q+4],m=d[q+5],k=d[q+6],n=d[q+7],p=d[q+8],f=(f+j+k)/3,h=(h+y+n)/3,i=(i+m+p)/3,d[q]=f,d[q+1]=h,d[q+2]=i,d[q+3]=f,d[q+4]=h,d[q+5]=i,d[q+6]=f,d[q+7]=h,d[q+8]=i}e.bufferData(e.ARRAY_BUFFER,b.normalArray,e.DYNAMIC_DRAW);e.enableVertexAttribArray(c.attributes.normal);e.vertexAttribPointer(c.attributes.normal,3,e.FLOAT,!1,0,0)}e.drawArrays(e.TRIANGLES,
+0,b.count);b.count=0}function h(b){if($!=b.doubleSided)b.doubleSided?e.disable(e.CULL_FACE):e.enable(e.CULL_FACE),$=b.doubleSided;if(N!=b.flipSided)b.flipSided?e.frontFace(e.CW):e.frontFace(e.CCW),N=b.flipSided}function j(b){sa!=b&&(b?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST),sa=b)}function k(b){Q!=b&&(e.depthMask(b),Q=b)}function m(b,c,d){Aa!=b&&(b?e.enable(e.POLYGON_OFFSET_FILL):e.disable(e.POLYGON_OFFSET_FILL),Aa=b);if(b&&(Ja!=c||Ta!=d))e.polygonOffset(c,d),Ja=c,Ta=d}function n(b){aa[0].set(b.n41-
+b.n11,b.n42-b.n12,b.n43-b.n13,b.n44-b.n14);aa[1].set(b.n41+b.n11,b.n42+b.n12,b.n43+b.n13,b.n44+b.n14);aa[2].set(b.n41+b.n21,b.n42+b.n22,b.n43+b.n23,b.n44+b.n24);aa[3].set(b.n41-b.n21,b.n42-b.n22,b.n43-b.n23,b.n44-b.n24);aa[4].set(b.n41-b.n31,b.n42-b.n32,b.n43-b.n33,b.n44-b.n34);aa[5].set(b.n41+b.n31,b.n42+b.n32,b.n43+b.n33,b.n44+b.n34);for(var c,b=0;b<6;b++)c=aa[b],c.divideScalar(Math.sqrt(c.x*c.x+c.y*c.y+c.z*c.z))}function q(b){for(var c=b.matrixWorld,e=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,
+Math.max(b.scale.y,b.scale.z)),d=0;d<6;d++)if(b=aa[d].x*c.n14+aa[d].y*c.n24+aa[d].z*c.n34+aa[d].w,b<=e)return!1;return!0}function p(b,c){b.list[b.count]=c;b.count+=1}function t(b){var c,e,d=b.object,f=b.opaque,h=b.transparent;h.count=0;b=f.count=0;for(c=d.materials.length;b<c;b++)e=d.materials[b],e.transparent?p(h,e):p(f,e)}function v(b){var c,e,d,f,h=b.object,i=b.buffer,j=b.opaque,k=b.transparent;k.count=0;b=j.count=0;for(d=h.materials.length;b<d;b++)if(c=h.materials[b],c instanceof THREE.MeshFaceMaterial){c=
+0;for(e=i.materials.length;c<e;c++)(f=i.materials[c])&&(f.transparent?p(k,f):p(j,f))}else(f=c)&&(f.transparent?p(k,f):p(j,f))}function B(b,c){return c.z-b.z}function x(b){var c,k,m,I=0,p,t,r,y,u=b.lights;if(!ma)ma=new THREE.Camera(M.shadowCameraFov,M.shadowMapWidth/M.shadowMapHeight,M.shadowCameraNear,M.shadowCameraFar),ma.useTarget=!0;c=0;for(k=u.length;c<k;c++)if(m=u[c],m instanceof THREE.SpotLight&&m.castShadow){U=-1;M.shadowMap[I]||(M.shadowMap[I]=new THREE.WebGLRenderTarget(M.shadowMapWidth,
+M.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}));Ua[I]||(Ua[I]=new THREE.Matrix4);p=M.shadowMap[I];t=Ua[I];ma.position.copy(m.position);ma.target.position.copy(m.target.position);ma.update(void 0,!0);b.update(void 0,!1,ma);t.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);t.multiplySelf(ma.projectionMatrix);t.multiplySelf(ma.matrixWorldInverse);ma.matrixWorldInverse.flattenToArray(Wa);ma.projectionMatrix.flattenToArray(Va);Ga.multiply(ma.projectionMatrix,
+ma.matrixWorldInverse);n(Ga);M.initWebGLObjects(b);L(p);e.clearColor(1,1,1,1);M.clear();e.clearColor(ha.r,ha.g,ha.b,Ha);t=b.__webglObjects.length;m=b.__webglObjectsImmediate.length;for(p=0;p<t;p++)r=b.__webglObjects[p],y=r.object,y.visible&&y.castShadow?!(y instanceof THREE.Mesh)||!y.frustumCulled||q(y)?(y.matrixWorld.flattenToArray(y._objectMatrixArray),F(y,ma,!1),r.render=!0):r.render=!1:r.render=!1;j(!0);G(THREE.NormalBlending);for(p=0;p<t;p++)if(r=b.__webglObjects[p],r.render)y=r.object,buffer=
+r.buffer,h(y),r=y.customDepthMaterial?y.customDepthMaterial:y.geometry.morphTargets.length?$a:La,f(ma,u,null,r,buffer,y);for(p=0;p<m;p++)r=b.__webglObjectsImmediate[p],y=r.object,y.visible&&y.castShadow&&(y.matrixAutoUpdate&&y.matrixWorld.flattenToArray(y._objectMatrixArray),F(y,ma,!1),h(y),program=d(ma,u,null,La,y),y.immediateRenderCallback?y.immediateRenderCallback(program,e,aa):y.render(function(b){i(b,program,La.shading)}));I++}}function E(b,c){var d,f,h;d=r.attributes;var i=r.uniforms,j=za/Ea,
+k,n=[],m=Ea*0.5,p=za*0.5,q=!0;e.useProgram(r.program);Xa=r.program;W=sa=ka=-1;ab||(e.enableVertexAttribArray(r.attributes.position),e.enableVertexAttribArray(r.attributes.uv),ab=!0);e.disable(e.CULL_FACE);e.enable(e.BLEND);e.depthMask(!0);e.bindBuffer(e.ARRAY_BUFFER,r.vertexBuffer);e.vertexAttribPointer(d.position,2,e.FLOAT,!1,16,0);e.vertexAttribPointer(d.uv,2,e.FLOAT,!1,16,8);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,r.elementBuffer);e.uniformMatrix4fv(i.projectionMatrix,!1,Va);e.activeTexture(e.TEXTURE0);
+e.uniform1i(i.map,0);d=0;for(f=b.__webglSprites.length;d<f;d++)if(h=b.__webglSprites[d],h.visible&&h.opacity!=0)h.useScreenCoordinates?h.z=-h.position.z:(h._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,h.matrixWorld,h._modelViewMatrixArray),h.z=-h._modelViewMatrix.n34);b.__webglSprites.sort(B);d=0;for(f=b.__webglSprites.length;d<f;d++)h=b.__webglSprites[d],h.visible&&h.opacity!=0&&h.map&&h.map.image&&h.map.image.width&&(h.useScreenCoordinates?(e.uniform1i(i.useScreenCoordinates,1),e.uniform3f(i.screenPosition,
+(h.position.x-m)/m,(p-h.position.y)/p,Math.max(0,Math.min(1,h.position.z)))):(e.uniform1i(i.useScreenCoordinates,0),e.uniform1i(i.affectedByDistance,h.affectedByDistance?1:0),e.uniformMatrix4fv(i.modelViewMatrix,!1,h._modelViewMatrixArray)),k=h.map.image.width/(h.scaleByViewport?za:1),n[0]=k*j*h.scale.x,n[1]=k*h.scale.y,e.uniform2f(i.uvScale,h.uvScale.x,h.uvScale.y),e.uniform2f(i.uvOffset,h.uvOffset.x,h.uvOffset.y),e.uniform2f(i.alignment,h.alignment.x,h.alignment.y),e.uniform1f(i.opacity,h.opacity),
+e.uniform3f(i.color,h.color.r,h.color.g,h.color.b),e.uniform1f(i.rotation,h.rotation),e.uniform2fv(i.scale,n),h.mergeWith3D&&!q?(e.enable(e.DEPTH_TEST),q=!0):!h.mergeWith3D&&q&&(e.disable(e.DEPTH_TEST),q=!1),G(h.blending),S(h.map,0),e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0));e.enable(e.CULL_FACE);e.enable(e.DEPTH_TEST);e.depthMask(Q)}function F(b,c,e){b._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);e&&THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}
+function wa(b){var c,e,d,f;f=b.__materials;b=0;for(e=f.length;b<e;b++)if(d=f[b],d.attributes)for(c in d.attributes)if(d.attributes[c].needsUpdate)return!0;return!1}function xa(b){var c,e,d,f;f=b.__materials;b=0;for(e=f.length;b<e;b++)if(d=f[b],d.attributes)for(c in d.attributes)d.attributes[c].needsUpdate=!1}function qa(b,c){var e;for(e=b.length-1;e>=0;e--)b[e].object==c&&b.splice(e,1)}function ra(b){function c(b){var f=[];e=0;for(d=b.length;e<d;e++)b[e]==void 0?f.push("undefined"):f.push(b[e].id);
+return f.join("_")}var e,d,f,h,i,j,k,n,m={},p=b.morphTargets!==void 0?b.morphTargets.length:0;b.geometryGroups={};f=0;for(h=b.faces.length;f<h;f++)i=b.faces[f],j=i.materials,k=c(j),m[k]==void 0&&(m[k]={hash:k,counter:0}),n=m[k].hash+"_"+m[k].counter,b.geometryGroups[n]==void 0&&(b.geometryGroups[n]={faces:[],materials:j,vertices:0,numMorphTargets:p}),i=i instanceof THREE.Face3?3:4,b.geometryGroups[n].vertices+i>65535&&(m[k].counter+=1,n=m[k].hash+"_"+m[k].counter,b.geometryGroups[n]==void 0&&(b.geometryGroups[n]=
+{faces:[],materials:j,vertices:0,numMorphTargets:p})),b.geometryGroups[n].faces.push(f),b.geometryGroups[n].vertices+=i;b.geometryGroupsList=[];for(var q in b.geometryGroups)b.geometryGroups[q].id=J++,b.geometryGroupsList.push(b.geometryGroups[q])}function ja(b,c,e){b.push({buffer:c,object:e,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function G(b){if(b!=ka){switch(b){case THREE.AdditiveBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.SRC_ALPHA,e.ONE);break;case THREE.SubtractiveBlending:e.blendEquation(e.FUNC_ADD);
+e.blendFunc(e.ZERO,e.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.ZERO,e.SRC_COLOR);break;default:e.blendEquationSeparate(e.FUNC_ADD,e.FUNC_ADD),e.blendFuncSeparate(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA)}ka=b}}function u(b,c,d){(d.width&d.width-1)==0&&(d.height&d.height-1)==0?(e.texParameteri(b,e.TEXTURE_WRAP_S,V(c.wrapS)),e.texParameteri(b,e.TEXTURE_WRAP_T,V(c.wrapT)),e.texParameteri(b,e.TEXTURE_MAG_FILTER,V(c.magFilter)),
+e.texParameteri(b,e.TEXTURE_MIN_FILTER,V(c.minFilter)),e.generateMipmap(b)):(e.texParameteri(b,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(b,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameteri(b,e.TEXTURE_MAG_FILTER,ya(c.magFilter)),e.texParameteri(b,e.TEXTURE_MIN_FILTER,ya(c.minFilter)))}function S(b,c){if(b.needsUpdate){if(!b.__webglInit)b.__webglInit=!0,b.__webglTexture=e.createTexture(),M.info.memory.textures++;e.activeTexture(e.TEXTURE0+c);e.bindTexture(e.TEXTURE_2D,b.__webglTexture);b instanceof
+THREE.DataTexture?e.texImage2D(e.TEXTURE_2D,0,V(b.format),b.image.width,b.image.height,0,V(b.format),e.UNSIGNED_BYTE,b.image.data):e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,b.image);u(e.TEXTURE_2D,b,b.image);b.needsUpdate=!1}else e.activeTexture(e.TEXTURE0+c),e.bindTexture(e.TEXTURE_2D,b.__webglTexture)}function L(b){var c=b instanceof THREE.WebGLRenderTargetCube;if(b&&!b.__webglFramebuffer){if(b.depthBuffer===void 0)b.depthBuffer=!0;if(b.stencilBuffer===void 0)b.stencilBuffer=!0;
+b.__webglRenderbuffer=e.createRenderbuffer();b.__webglTexture=e.createTexture();if(c){e.bindTexture(e.TEXTURE_CUBE_MAP,b.__webglTexture);u(e.TEXTURE_CUBE_MAP,b,b);b.__webglFramebuffer=[];for(var d=0;d<6;d++)b.__webglFramebuffer[d]=e.createFramebuffer(),e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+d,0,V(b.format),b.width,b.height,0,V(b.format),V(b.type),null)}else b.__webglFramebuffer=e.createFramebuffer(),e.bindTexture(e.TEXTURE_2D,b.__webglTexture),u(e.TEXTURE_2D,b,b),e.texImage2D(e.TEXTURE_2D,0,V(b.format),
+b.width,b.height,0,V(b.format),V(b.type),null);e.bindRenderbuffer(e.RENDERBUFFER,b.__webglRenderbuffer);if(c)for(d=0;d<6;++d)e.bindFramebuffer(e.FRAMEBUFFER,b.__webglFramebuffer[d]),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+d,b.__webglTexture,0);else e.bindFramebuffer(e.FRAMEBUFFER,b.__webglFramebuffer),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,b.__webglTexture,0);b.depthBuffer&&!b.stencilBuffer?(e.renderbufferStorage(e.RENDERBUFFER,
+e.DEPTH_COMPONENT16,b.width,b.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,b.__webglRenderbuffer)):b.depthBuffer&&b.stencilBuffer?(e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_STENCIL,b.width,b.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,b.__webglRenderbuffer)):e.renderbufferStorage(e.RENDERBUFFER,e.RGBA4,b.width,b.height);c?e.bindTexture(e.TEXTURE_CUBE_MAP,null):e.bindTexture(e.TEXTURE_2D,null);e.bindRenderbuffer(e.RENDERBUFFER,
+null);e.bindFramebuffer(e.FRAMEBUFFER,null)}var f,h;b?(c=c?b.__webglFramebuffer[b.activeCubeFace]:b.__webglFramebuffer,d=b.width,b=b.height,h=f=0):(c=null,d=Ea,b=za,f=Ka,h=Ba);c!=va&&(e.bindFramebuffer(e.FRAMEBUFFER,c),e.viewport(f,h,d,b),va=c)}function T(b){b instanceof THREE.WebGLRenderTargetCube?(e.bindTexture(e.TEXTURE_CUBE_MAP,b.__webglTexture),e.generateMipmap(e.TEXTURE_CUBE_MAP),e.bindTexture(e.TEXTURE_CUBE_MAP,null)):(e.bindTexture(e.TEXTURE_2D,b.__webglTexture),e.generateMipmap(e.TEXTURE_2D),
+e.bindTexture(e.TEXTURE_2D,null))}function Z(b,c){var d;b=="fragment"?d=e.createShader(e.FRAGMENT_SHADER):b=="vertex"&&(d=e.createShader(e.VERTEX_SHADER));e.shaderSource(d,c);e.compileShader(d);if(!e.getShaderParameter(d,e.COMPILE_STATUS))return console.error(e.getShaderInfoLog(d)),console.error(c),null;return d}function ya(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return e.NEAREST;default:return e.LINEAR}}function V(b){switch(b){case THREE.RepeatWrapping:return e.REPEAT;
 case THREE.ClampToEdgeWrapping:return e.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return e.MIRRORED_REPEAT;case THREE.NearestFilter:return e.NEAREST;case THREE.NearestMipMapNearestFilter:return e.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return e.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return e.LINEAR;case THREE.LinearMipMapNearestFilter:return e.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return e.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return e.BYTE;
-case THREE.UnsignedByteType:return e.UNSIGNED_BYTE;case THREE.ShortType:return e.SHORT;case THREE.UnsignedShortType:return e.UNSIGNED_SHORT;case THREE.IntType:return e.INT;case THREE.UnsignedShortType:return e.UNSIGNED_INT;case THREE.FloatType:return e.FLOAT;case THREE.AlphaFormat:return e.ALPHA;case THREE.RGBFormat:return e.RGB;case THREE.RGBAFormat:return e.RGBA;case THREE.LuminanceFormat:return e.LUMINANCE;case THREE.LuminanceAlphaFormat:return e.LUMINANCE_ALPHA}return 0}var M=this,e,za=[],Wa=
-null,xa=null,V=-1,na=null,J=0,$=null,N=null,ka=null,sa=null,R=null,ua=null,La=null,Ra=null,Ia=0,Aa=0,Ea=0,ya=0,Ca=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Fa=new THREE.Matrix4,Ta=new Float32Array(16),Ua=new Float32Array(16),Ja=new THREE.Vector4,Ya={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},Ba=b.canvas!==void 0?b.canvas:document.createElement("canvas"),
-S=b.stencil!==void 0?b.stencil:!0,cb=b.preserveDrawingBuffer!==void 0?b.preserveDrawingBuffer:!1,db=b.antialias!==void 0?b.antialias:!1,aa=b.clearColor!==void 0?new THREE.Color(b.clearColor):new THREE.Color(0),Ga=b.clearAlpha!==void 0?b.clearAlpha:0,Xa=b.maxLights!==void 0?b.maxLights:4;this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0}};this.maxMorphTargets=8;this.domElement=Ba;this.sortObjects=this.autoClear=!0;this.shadowMapBias=0.0039;this.shadowMapDarkness=
-0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowCameraNear=1;this.shadowCameraFar=5E3;this.shadowCameraFov=50;this.shadowMap=[];this.shadowMapEnabled=!1;this.shadowMapSoft=!0;var X,Sa=[],b=THREE.ShaderLib.depthRGBA,ab=THREE.UniformsUtils.clone(b.uniforms),Va=new THREE.ShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:ab}),Za=new THREE.ShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:ab,morphTargets:!0});Va._shadowPass=
-!0;Za._shadowPass=!0;try{if(!(e=Ba.getContext("experimental-webgl",{antialias:db,stencil:S,preserveDrawingBuffer:cb})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+e.getParameter(e.VERSION)+" | "+e.getParameter(e.VENDOR)+" | "+e.getParameter(e.RENDERER)+" | "+e.getParameter(e.SHADING_LANGUAGE_VERSION))}catch(eb){console.error(eb)}e.clearColor(0,0,0,1);e.clearDepth(1);e.clearStencil(0);e.enable(e.DEPTH_TEST);e.depthFunc(e.LEQUAL);e.frontFace(e.CCW);e.cullFace(e.BACK);
-e.enable(e.CULL_FACE);e.enable(e.BLEND);e.blendEquation(e.FUNC_ADD);e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA);e.clearColor(aa.r,aa.g,aa.b,Ga);this.context=e;var bb=e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,s={};s.vertices=new Float32Array(16);s.faces=new Uint16Array(6);S=0;s.vertices[S++]=-1;s.vertices[S++]=-1;s.vertices[S++]=0;s.vertices[S++]=1;s.vertices[S++]=1;s.vertices[S++]=-1;s.vertices[S++]=1;s.vertices[S++]=1;s.vertices[S++]=1;s.vertices[S++]=1;s.vertices[S++]=1;s.vertices[S++]=
-0;s.vertices[S++]=-1;s.vertices[S++]=1;s.vertices[S++]=0;S=s.vertices[S++]=0;s.faces[S++]=0;s.faces[S++]=1;s.faces[S++]=2;s.faces[S++]=0;s.faces[S++]=2;s.faces[S++]=3;s.vertexBuffer=e.createBuffer();s.elementBuffer=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,s.vertexBuffer);e.bufferData(e.ARRAY_BUFFER,s.vertices,e.STATIC_DRAW);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,s.elementBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,s.faces,e.STATIC_DRAW);s.program=e.createProgram();e.attachShader(s.program,Z("fragment",
-THREE.ShaderLib.sprite.fragmentShader));e.attachShader(s.program,Z("vertex",THREE.ShaderLib.sprite.vertexShader));e.linkProgram(s.program);s.attributes={};s.uniforms={};s.attributes.position=e.getAttribLocation(s.program,"position");s.attributes.uv=e.getAttribLocation(s.program,"uv");s.uniforms.uvOffset=e.getUniformLocation(s.program,"uvOffset");s.uniforms.uvScale=e.getUniformLocation(s.program,"uvScale");s.uniforms.rotation=e.getUniformLocation(s.program,"rotation");s.uniforms.scale=e.getUniformLocation(s.program,
-"scale");s.uniforms.alignment=e.getUniformLocation(s.program,"alignment");s.uniforms.color=e.getUniformLocation(s.program,"color");s.uniforms.map=e.getUniformLocation(s.program,"map");s.uniforms.opacity=e.getUniformLocation(s.program,"opacity");s.uniforms.useScreenCoordinates=e.getUniformLocation(s.program,"useScreenCoordinates");s.uniforms.affectedByDistance=e.getUniformLocation(s.program,"affectedByDistance");s.uniforms.screenPosition=e.getUniformLocation(s.program,"screenPosition");s.uniforms.modelViewMatrix=
-e.getUniformLocation(s.program,"modelViewMatrix");s.uniforms.projectionMatrix=e.getUniformLocation(s.program,"projectionMatrix");var $a=!1;this.setSize=function(b,c){Ba.width=b;Ba.height=c;this.setViewport(0,0,Ba.width,Ba.height)};this.setViewport=function(b,c,d,f){Ia=b;Aa=c;Ea=d;ya=f;e.viewport(Ia,Aa,Ea,ya)};this.setScissor=function(b,c,d,f){e.scissor(b,c,d,f)};this.enableScissorTest=function(b){b?e.enable(e.SCISSOR_TEST):e.disable(e.SCISSOR_TEST)};this.setClearColorHex=function(b,c){aa.setHex(b);
-Ga=c;e.clearColor(aa.r,aa.g,aa.b,Ga)};this.setClearColor=function(b,c){aa.copy(b);Ga=c;e.clearColor(aa.r,aa.g,aa.b,Ga)};this.getClearColor=function(){return aa};this.getClearAlpha=function(){return Ga};this.clear=function(){e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT|e.STENCIL_BUFFER_BIT)};this.getContext=function(){return e};this.deallocateObject=function(b){if(b.__webglInit)if(b.__webglInit=!1,delete b._modelViewMatrix,delete b._normalMatrixArray,delete b._modelViewMatrixArray,delete b._objectMatrixArray,
-b instanceof THREE.Mesh)for(g in b.geometry.geometryGroups){var c=b.geometry.geometryGroups[g];e.deleteBuffer(c.__webglVertexBuffer);e.deleteBuffer(c.__webglNormalBuffer);e.deleteBuffer(c.__webglTangentBuffer);e.deleteBuffer(c.__webglColorBuffer);e.deleteBuffer(c.__webglUVBuffer);e.deleteBuffer(c.__webglUV2Buffer);e.deleteBuffer(c.__webglSkinVertexABuffer);e.deleteBuffer(c.__webglSkinVertexBBuffer);e.deleteBuffer(c.__webglSkinIndicesBuffer);e.deleteBuffer(c.__webglSkinWeightsBuffer);e.deleteBuffer(c.__webglFaceBuffer);
-e.deleteBuffer(c.__webglLineBuffer);if(c.numMorphTargets)for(var d=0,f=c.numMorphTargets;d<f;d++)e.deleteBuffer(c.__webglMorphTargetsBuffers[d]);M.info.memory.geometries--}else if(b instanceof THREE.Ribbon)b=b.geometry,e.deleteBuffer(b.__webglVertexBuffer),e.deleteBuffer(b.__webglColorBuffer),M.info.memory.geometries--;else if(b instanceof THREE.Line)b=b.geometry,e.deleteBuffer(b.__webglVertexBuffer),e.deleteBuffer(b.__webglColorBuffer),M.info.memory.geometries--;else if(b instanceof THREE.ParticleSystem)b=
-b.geometry,e.deleteBuffer(b.__webglVertexBuffer),e.deleteBuffer(b.__webglColorBuffer),M.info.memory.geometries--};this.deallocateTexture=function(b){if(b.__webglInit)b.__webglInit=!1,e.deleteTexture(b.__webglTexture),M.info.memory.textures--};this.initMaterial=function(b,c,d,f){var h,i,j,k;b instanceof THREE.MeshDepthMaterial?k="depth":b instanceof THREE.MeshNormalMaterial?k="normal":b instanceof THREE.MeshBasicMaterial?k="basic":b instanceof THREE.MeshLambertMaterial?k="lambert":b instanceof THREE.MeshPhongMaterial?
-k="phong":b instanceof THREE.LineBasicMaterial?k="basic":b instanceof THREE.ParticleBasicMaterial&&(k="particle_basic");if(k){var n=THREE.ShaderLib[k];b.uniforms=THREE.UniformsUtils.clone(n.uniforms);b.vertexShader=n.vertexShader;b.fragmentShader=n.fragmentShader}var p,m,q;p=q=n=0;for(m=c.length;p<m;p++)j=c[p],j instanceof THREE.SpotLight&&q++,j instanceof THREE.DirectionalLight&&q++,j instanceof THREE.PointLight&&n++;n+q<=Xa?p=q:(p=Math.ceil(Xa*q/(n+q)),n=Xa-p);j={directional:p,point:n};n=q=0;for(p=
-c.length;n<p;n++)m=c[n],m instanceof THREE.SpotLight&&m.castShadow&&q++;var t=50;if(f!==void 0&&f instanceof THREE.SkinnedMesh)t=f.bones.length;var C;a:{p=b.fragmentShader;m=b.vertexShader;var n=b.uniforms,c=b.attributes,d={map:!!b.map,envMap:!!b.envMap,lightMap:!!b.lightMap,vertexColors:b.vertexColors,fog:d,useFog:b.fog,sizeAttenuation:b.sizeAttenuation,skinning:b.skinning,morphTargets:b.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:j.directional,maxPointLights:j.point,maxBones:t,
-shadowMapEnabled:this.shadowMapEnabled&&f.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:q,alphaTest:b.alphaTest},s,f=[];k?f.push(k):(f.push(p),f.push(m));for(s in d)f.push(s),f.push(d[s]);k=f.join();s=0;for(f=za.length;s<f;s++)if(za[s].code==k){C=za[s].program;break a}s=e.createProgram();f=[bb?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+d.maxDirLights,"#define MAX_POINT_LIGHTS "+d.maxPointLights,"#define MAX_SHADOWS "+
-d.maxShadows,"#define MAX_BONES "+d.maxBones,d.map?"#define USE_MAP":"",d.envMap?"#define USE_ENVMAP":"",d.lightMap?"#define USE_LIGHTMAP":"",d.vertexColors?"#define USE_COLOR":"",d.skinning?"#define USE_SKINNING":"",d.morphTargets?"#define USE_MORPHTARGETS":"",d.shadowMapEnabled?"#define USE_SHADOWMAP":"",d.shadowMapSoft?"#define SHADOWMAP_SOFT":"",d.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
+case THREE.UnsignedByteType:return e.UNSIGNED_BYTE;case THREE.ShortType:return e.SHORT;case THREE.UnsignedShortType:return e.UNSIGNED_SHORT;case THREE.IntType:return e.INT;case THREE.UnsignedShortType:return e.UNSIGNED_INT;case THREE.FloatType:return e.FLOAT;case THREE.AlphaFormat:return e.ALPHA;case THREE.RGBFormat:return e.RGB;case THREE.RGBAFormat:return e.RGBA;case THREE.LuminanceFormat:return e.LUMINANCE;case THREE.LuminanceAlphaFormat:return e.LUMINANCE_ALPHA}return 0}var M=this,e,ua=[],Xa=
+null,va=null,U=-1,W=null,J=0,$=null,N=null,ka=null,sa=null,Q=null,Aa=null,Ja=null,Ta=null,Ka=0,Ba=0,Ea=0,za=0,aa=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Ga=new THREE.Matrix4,Va=new Float32Array(16),Wa=new Float32Array(16),Sa=new THREE.Vector4,Za={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},Ca=b.canvas!==void 0?b.canvas:document.createElement("canvas"),
+R=b.stencil!==void 0?b.stencil:!0,db=b.preserveDrawingBuffer!==void 0?b.preserveDrawingBuffer:!1,eb=b.antialias!==void 0?b.antialias:!1,ha=b.clearColor!==void 0?new THREE.Color(b.clearColor):new THREE.Color(0),Ha=b.clearAlpha!==void 0?b.clearAlpha:0,Ya=b.maxLights!==void 0?b.maxLights:4;this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0}};this.maxMorphTargets=8;this.domElement=Ca;this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=
+this.autoClear=!0;this.shadowMapBias=0.0039;this.shadowMapDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowCameraNear=1;this.shadowCameraFar=5E3;this.shadowCameraFov=50;this.shadowMap=[];this.shadowMapEnabled=!1;this.shadowMapSoft=!0;var ma,Ua=[],b=THREE.ShaderLib.depthRGBA,bb=THREE.UniformsUtils.clone(b.uniforms),La=new THREE.ShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:bb}),$a=new THREE.ShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,
+uniforms:bb,morphTargets:!0});La._shadowPass=!0;$a._shadowPass=!0;try{if(!(e=Ca.getContext("experimental-webgl",{antialias:eb,stencil:R,preserveDrawingBuffer:db})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+e.getParameter(e.VERSION)+" | "+e.getParameter(e.VENDOR)+" | "+e.getParameter(e.RENDERER)+" | "+e.getParameter(e.SHADING_LANGUAGE_VERSION))}catch(fb){console.error(fb)}e.clearColor(0,0,0,1);e.clearDepth(1);e.clearStencil(0);e.enable(e.DEPTH_TEST);e.depthFunc(e.LEQUAL);
+e.frontFace(e.CCW);e.cullFace(e.BACK);e.enable(e.CULL_FACE);e.enable(e.BLEND);e.blendEquation(e.FUNC_ADD);e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA);e.clearColor(ha.r,ha.g,ha.b,Ha);this.context=e;var cb=e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,r={};r.vertices=new Float32Array(16);r.faces=new Uint16Array(6);R=0;r.vertices[R++]=-1;r.vertices[R++]=-1;r.vertices[R++]=0;r.vertices[R++]=1;r.vertices[R++]=1;r.vertices[R++]=-1;r.vertices[R++]=1;r.vertices[R++]=1;r.vertices[R++]=1;r.vertices[R++]=
+1;r.vertices[R++]=1;r.vertices[R++]=0;r.vertices[R++]=-1;r.vertices[R++]=1;r.vertices[R++]=0;R=r.vertices[R++]=0;r.faces[R++]=0;r.faces[R++]=1;r.faces[R++]=2;r.faces[R++]=0;r.faces[R++]=2;r.faces[R++]=3;r.vertexBuffer=e.createBuffer();r.elementBuffer=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,r.vertexBuffer);e.bufferData(e.ARRAY_BUFFER,r.vertices,e.STATIC_DRAW);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,r.elementBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,r.faces,e.STATIC_DRAW);r.program=e.createProgram();
+e.attachShader(r.program,Z("fragment",THREE.ShaderLib.sprite.fragmentShader));e.attachShader(r.program,Z("vertex",THREE.ShaderLib.sprite.vertexShader));e.linkProgram(r.program);r.attributes={};r.uniforms={};r.attributes.position=e.getAttribLocation(r.program,"position");r.attributes.uv=e.getAttribLocation(r.program,"uv");r.uniforms.uvOffset=e.getUniformLocation(r.program,"uvOffset");r.uniforms.uvScale=e.getUniformLocation(r.program,"uvScale");r.uniforms.rotation=e.getUniformLocation(r.program,"rotation");
+r.uniforms.scale=e.getUniformLocation(r.program,"scale");r.uniforms.alignment=e.getUniformLocation(r.program,"alignment");r.uniforms.color=e.getUniformLocation(r.program,"color");r.uniforms.map=e.getUniformLocation(r.program,"map");r.uniforms.opacity=e.getUniformLocation(r.program,"opacity");r.uniforms.useScreenCoordinates=e.getUniformLocation(r.program,"useScreenCoordinates");r.uniforms.affectedByDistance=e.getUniformLocation(r.program,"affectedByDistance");r.uniforms.screenPosition=e.getUniformLocation(r.program,
+"screenPosition");r.uniforms.modelViewMatrix=e.getUniformLocation(r.program,"modelViewMatrix");r.uniforms.projectionMatrix=e.getUniformLocation(r.program,"projectionMatrix");var ab=!1;this.setSize=function(b,c){Ca.width=b;Ca.height=c;this.setViewport(0,0,Ca.width,Ca.height)};this.setViewport=function(b,c,d,f){Ka=b;Ba=c;Ea=d;za=f;e.viewport(Ka,Ba,Ea,za)};this.setScissor=function(b,c,d,f){e.scissor(b,c,d,f)};this.enableScissorTest=function(b){b?e.enable(e.SCISSOR_TEST):e.disable(e.SCISSOR_TEST)};this.setClearColorHex=
+function(b,c){ha.setHex(b);Ha=c;e.clearColor(ha.r,ha.g,ha.b,Ha)};this.setClearColor=function(b,c){ha.copy(b);Ha=c;e.clearColor(ha.r,ha.g,ha.b,Ha)};this.getClearColor=function(){return ha};this.getClearAlpha=function(){return Ha};this.clear=function(b,c,d){var f=0;if(b==void 0||b)f|=e.COLOR_BUFFER_BIT;if(c==void 0||c)f|=e.DEPTH_BUFFER_BIT;if(d==void 0||d)f|=e.STENCIL_BUFFER_BIT;e.clear(f)};this.getContext=function(){return e};this.deallocateObject=function(b){if(b.__webglInit)if(b.__webglInit=!1,delete b._modelViewMatrix,
+delete b._normalMatrixArray,delete b._modelViewMatrixArray,delete b._objectMatrixArray,b instanceof THREE.Mesh)for(g in b.geometry.geometryGroups){var c=b.geometry.geometryGroups[g];e.deleteBuffer(c.__webglVertexBuffer);e.deleteBuffer(c.__webglNormalBuffer);e.deleteBuffer(c.__webglTangentBuffer);e.deleteBuffer(c.__webglColorBuffer);e.deleteBuffer(c.__webglUVBuffer);e.deleteBuffer(c.__webglUV2Buffer);e.deleteBuffer(c.__webglSkinVertexABuffer);e.deleteBuffer(c.__webglSkinVertexBBuffer);e.deleteBuffer(c.__webglSkinIndicesBuffer);
+e.deleteBuffer(c.__webglSkinWeightsBuffer);e.deleteBuffer(c.__webglFaceBuffer);e.deleteBuffer(c.__webglLineBuffer);if(c.numMorphTargets)for(var d=0,f=c.numMorphTargets;d<f;d++)e.deleteBuffer(c.__webglMorphTargetsBuffers[d]);M.info.memory.geometries--}else if(b instanceof THREE.Ribbon)b=b.geometry,e.deleteBuffer(b.__webglVertexBuffer),e.deleteBuffer(b.__webglColorBuffer),M.info.memory.geometries--;else if(b instanceof THREE.Line)b=b.geometry,e.deleteBuffer(b.__webglVertexBuffer),e.deleteBuffer(b.__webglColorBuffer),
+M.info.memory.geometries--;else if(b instanceof THREE.ParticleSystem)b=b.geometry,e.deleteBuffer(b.__webglVertexBuffer),e.deleteBuffer(b.__webglColorBuffer),M.info.memory.geometries--};this.deallocateTexture=function(b){if(b.__webglInit)b.__webglInit=!1,e.deleteTexture(b.__webglTexture),M.info.memory.textures--};this.initMaterial=function(b,c,d,f){var h,i,j,k;b instanceof THREE.MeshDepthMaterial?k="depth":b instanceof THREE.MeshNormalMaterial?k="normal":b instanceof THREE.MeshBasicMaterial?k="basic":
+b instanceof THREE.MeshLambertMaterial?k="lambert":b instanceof THREE.MeshPhongMaterial?k="phong":b instanceof THREE.LineBasicMaterial?k="basic":b instanceof THREE.ParticleBasicMaterial&&(k="particle_basic");if(k){var n=THREE.ShaderLib[k];b.uniforms=THREE.UniformsUtils.clone(n.uniforms);b.vertexShader=n.vertexShader;b.fragmentShader=n.fragmentShader}var m,p,q;m=q=n=0;for(p=c.length;m<p;m++)j=c[m],j instanceof THREE.SpotLight&&q++,j instanceof THREE.DirectionalLight&&q++,j instanceof THREE.PointLight&&
+n++;n+q<=Ya?m=q:(m=Math.ceil(Ya*q/(n+q)),n=Ya-m);j={directional:m,point:n};n=q=0;for(m=c.length;n<m;n++)p=c[n],p instanceof THREE.SpotLight&&p.castShadow&&q++;var t=50;if(f!==void 0&&f instanceof THREE.SkinnedMesh)t=f.bones.length;var C;a:{m=b.fragmentShader;p=b.vertexShader;var n=b.uniforms,c=b.attributes,d={map:!!b.map,envMap:!!b.envMap,lightMap:!!b.lightMap,vertexColors:b.vertexColors,fog:d,useFog:b.fog,sizeAttenuation:b.sizeAttenuation,skinning:b.skinning,morphTargets:b.morphTargets,maxMorphTargets:this.maxMorphTargets,
+maxDirLights:j.directional,maxPointLights:j.point,maxBones:t,shadowMapEnabled:this.shadowMapEnabled&&f.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:q,alphaTest:b.alphaTest},r,f=[];k?f.push(k):(f.push(m),f.push(p));for(r in d)f.push(r),f.push(d[r]);k=f.join();r=0;for(f=ua.length;r<f;r++)if(ua[r].code==k){C=ua[r].program;break a}r=e.createProgram();f=[cb?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+d.maxDirLights,
+"#define MAX_POINT_LIGHTS "+d.maxPointLights,"#define MAX_SHADOWS "+d.maxShadows,"#define MAX_BONES "+d.maxBones,d.map?"#define USE_MAP":"",d.envMap?"#define USE_ENVMAP":"",d.lightMap?"#define USE_LIGHTMAP":"",d.vertexColors?"#define USE_COLOR":"",d.skinning?"#define USE_SKINNING":"",d.morphTargets?"#define USE_MORPHTARGETS":"",d.shadowMapEnabled?"#define USE_SHADOWMAP":"",d.shadowMapSoft?"#define SHADOWMAP_SOFT":"",d.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
 j=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+d.maxDirLights,"#define MAX_POINT_LIGHTS "+d.maxPointLights,"#define MAX_SHADOWS "+d.maxShadows,d.alphaTest?"#define ALPHATEST "+d.alphaTest:"",d.useFog&&d.fog?"#define USE_FOG":"",d.useFog&&d.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",d.map?"#define USE_MAP":"",d.envMap?"#define USE_ENVMAP":"",d.lightMap?"#define USE_LIGHTMAP":"",d.vertexColors?"#define USE_COLOR":"",d.shadowMapEnabled?"#define USE_SHADOWMAP":"",
-d.shadowMapSoft?"#define SHADOWMAP_SOFT":"",d.shadowMapSoft?"#define SHADOWMAP_WIDTH "+d.shadowMapWidth.toFixed(1):"",d.shadowMapSoft?"#define SHADOWMAP_HEIGHT "+d.shadowMapHeight.toFixed(1):"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");e.attachShader(s,Z("fragment",j+p));e.attachShader(s,Z("vertex",f+m));e.linkProgram(s);e.getProgramParameter(s,e.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+e.getProgramParameter(s,e.VALIDATE_STATUS)+", gl error ["+
-e.getError()+"]");s.uniforms={};s.attributes={};var u,f=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(u in n)f.push(u);u=f;f=0;for(n=u.length;f<n;f++)p=u[f],s.uniforms[p]=e.getUniformLocation(s,p);f=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(u=0;u<d.maxMorphTargets;u++)f.push("morphTarget"+u);for(C in c)f.push(C);
-C=f;u=0;for(c=C.length;u<c;u++)d=C[u],s.attributes[d]=e.getAttribLocation(s,d);s.id=za.length;za.push({program:s,code:k});M.info.memory.programs=za.length;C=s}b.program=C;C=b.program.attributes;C.position>=0&&e.enableVertexAttribArray(C.position);C.color>=0&&e.enableVertexAttribArray(C.color);C.normal>=0&&e.enableVertexAttribArray(C.normal);C.tangent>=0&&e.enableVertexAttribArray(C.tangent);b.skinning&&C.skinVertexA>=0&&C.skinVertexB>=0&&C.skinIndex>=0&&C.skinWeight>=0&&(e.enableVertexAttribArray(C.skinVertexA),
-e.enableVertexAttribArray(C.skinVertexB),e.enableVertexAttribArray(C.skinIndex),e.enableVertexAttribArray(C.skinWeight));if(b.attributes)for(i in b.attributes)C[i]!==void 0&&C[i]>=0&&e.enableVertexAttribArray(C[i]);if(b.morphTargets)for(i=b.numSupportedMorphTargets=0;i<this.maxMorphTargets;i++)u="morphTarget"+i,C[u]>=0&&(e.enableVertexAttribArray(C[u]),b.numSupportedMorphTargets++);b.uniformsList=[];for(h in b.uniforms)b.uniformsList.push([b.uniforms[h],h])};this.clearTarget=function(b,c,d,f){L(b);
-b=0;c&&(b|=e.COLOR_BUFFER_BIT);d&&(b|=e.DEPTH_BUFFER_BIT);f&&(b|=e.STENCIL_BUFFER_BIT);e.clear(b)};this.render=function(b,c,e,m){var I,s,u,O,z,J,E,Pa,Qa=b.lights,C=b.fog;V=-1;this.shadowMapEnabled&&x(b,c);M.info.render.calls=0;M.info.render.vertices=0;M.info.render.faces=0;c.matrixAutoUpdate&&c.update(void 0,!0);b.update(void 0,!1,c);c.matrixWorldInverse.flattenToArray(Ua);c.projectionMatrix.flattenToArray(Ta);Fa.multiply(c.projectionMatrix,c.matrixWorldInverse);n(Fa);this.initWebGLObjects(b);L(e);
-(this.autoClear||m)&&this.clear();z=b.__webglObjects.length;for(m=0;m<z;m++)if(I=b.__webglObjects[m],E=I.object,E.visible)if(!(E instanceof THREE.Mesh)||!E.frustumCulled||q(E)){if(E.matrixWorld.flattenToArray(E._objectMatrixArray),F(E,c,!0),v(I),I.render=!0,this.sortObjects)I.object.renderDepth?I.z=I.object.renderDepth:(Ja.copy(E.position),Fa.multiplyVector3(Ja),I.z=Ja.z)}else I.render=!1;else I.render=!1;this.sortObjects&&b.__webglObjects.sort(B);J=b.__webglObjectsImmediate.length;for(m=0;m<J;m++)I=
-b.__webglObjectsImmediate[m],E=I.object,E.visible&&(E.matrixAutoUpdate&&E.matrixWorld.flattenToArray(E._objectMatrixArray),F(E,c,!0),t(I));if(b.overrideMaterial){j(b.overrideMaterial.depthTest);G(b.overrideMaterial.blending);for(m=0;m<z;m++)if(I=b.__webglObjects[m],I.render)E=I.object,Pa=I.buffer,h(E),f(c,Qa,C,b.overrideMaterial,Pa,E);for(m=0;m<J;m++)I=b.__webglObjectsImmediate[m],E=I.object,E.visible&&(h(E),s=d(c,Qa,C,b.overrideMaterial,E),E.render(function(c){i(c,s,b.overrideMaterial.shading)}))}else{G(THREE.NormalBlending);
-for(m=z-1;m>=0;m--)if(I=b.__webglObjects[m],I.render){E=I.object;Pa=I.buffer;u=I.opaque;h(E);for(I=0;I<u.count;I++)O=u.list[I],j(O.depthTest),k(O.depthWrite),p(O.polygonOffset,O.polygonOffsetFactor,O.polygonOffsetUnits),f(c,Qa,C,O,Pa,E)}for(m=0;m<J;m++)if(I=b.__webglObjectsImmediate[m],E=I.object,E.visible){u=I.opaque;h(E);for(I=0;I<u.count;I++)O=u.list[I],j(O.depthTest),k(O.depthWrite),p(O.polygonOffset,O.polygonOffsetFactor,O.polygonOffsetUnits),s=d(c,Qa,C,O,E),E.render(function(b){i(b,s,O.shading)})}for(m=
-0;m<z;m++)if(I=b.__webglObjects[m],I.render){E=I.object;Pa=I.buffer;u=I.transparent;h(E);for(I=0;I<u.count;I++)O=u.list[I],G(O.blending),j(O.depthTest),k(O.depthWrite),p(O.polygonOffset,O.polygonOffsetFactor,O.polygonOffsetUnits),f(c,Qa,C,O,Pa,E)}for(m=0;m<J;m++)if(I=b.__webglObjectsImmediate[m],E=I.object,E.visible){u=I.transparent;h(E);for(I=0;I<u.count;I++)O=u.list[I],G(O.blending),j(O.depthTest),k(O.depthWrite),p(O.polygonOffset,O.polygonOffsetFactor,O.polygonOffsetUnits),s=d(c,Qa,C,O,E),E.render(function(b){i(b,
-s,O.shading)})}}b.__webglSprites.length&&D(b,c);e&&e.minFilter!==THREE.NearestFilter&&e.minFilter!==THREE.LinearFilter&&U(e)};this.initWebGLObjects=function(b){if(!b.__webglObjects)b.__webglObjects=[],b.__webglObjectsImmediate=[],b.__webglSprites=[];for(;b.__objectsAdded.length;){var d=b.__objectsAdded[0],f=b,h=void 0,i=void 0,j=void 0;if(!d.__webglInit)if(d.__webglInit=!0,d._modelViewMatrix=new THREE.Matrix4,d._normalMatrixArray=new Float32Array(9),d._modelViewMatrixArray=new Float32Array(16),d._objectMatrixArray=
-new Float32Array(16),d.matrixWorld.flattenToArray(d._objectMatrixArray),d instanceof THREE.Mesh)for(h in i=d.geometry,i.geometryGroups==void 0&&ra(i),i.geometryGroups){if(j=i.geometryGroups[h],!j.__webglVertexBuffer){var k=j;k.__webglVertexBuffer=e.createBuffer();k.__webglNormalBuffer=e.createBuffer();k.__webglTangentBuffer=e.createBuffer();k.__webglColorBuffer=e.createBuffer();k.__webglUVBuffer=e.createBuffer();k.__webglUV2Buffer=e.createBuffer();k.__webglSkinVertexABuffer=e.createBuffer();k.__webglSkinVertexBBuffer=
-e.createBuffer();k.__webglSkinIndicesBuffer=e.createBuffer();k.__webglSkinWeightsBuffer=e.createBuffer();k.__webglFaceBuffer=e.createBuffer();k.__webglLineBuffer=e.createBuffer();if(k.numMorphTargets){var n=void 0,m=void 0;k.__webglMorphTargetsBuffers=[];n=0;for(m=k.numMorphTargets;n<m;n++)k.__webglMorphTargetsBuffers.push(e.createBuffer())}M.info.memory.geometries++;for(var k=d,p=void 0,q=void 0,s=void 0,u=s=void 0,t=void 0,v=void 0,B=v=n=0,x=s=q=void 0,s=m=x=q=p=void 0,u=k.geometry,t=u.faces,x=
-j.faces,p=0,q=x.length;p<q;p++)s=x[p],s=t[s],s instanceof THREE.Face3?(n+=3,v+=1,B+=3):s instanceof THREE.Face4&&(n+=4,v+=2,B+=4);for(var p=j,q=k,F=x=t=void 0,H=void 0,F=void 0,s=[],t=0,x=q.materials.length;t<x;t++)if(F=q.materials[t],F instanceof THREE.MeshFaceMaterial){F=0;for(l=p.materials.length;F<l;F++)(H=p.materials[F])&&s.push(H)}else(H=F)&&s.push(H);p=s;j.__materials=p;a:{t=q=void 0;x=p.length;for(q=0;q<x;q++)if(t=p[q],t.map||t.lightMap||t instanceof THREE.ShaderMaterial){q=!0;break a}q=!1}a:{x=
-t=void 0;s=p.length;for(t=0;t<s;t++)if(x=p[t],!(x instanceof THREE.MeshBasicMaterial&&!x.envMap||x instanceof THREE.MeshDepthMaterial)){x=x&&x.shading!=void 0&&x.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}x=!1}a:{s=t=void 0;F=p.length;for(t=0;t<F;t++)if(s=p[t],s.vertexColors){s=s.vertexColors;break a}s=!1}j.__vertexArray=new Float32Array(n*3);if(x)j.__normalArray=new Float32Array(n*3);if(u.hasTangents)j.__tangentArray=new Float32Array(n*4);if(s)j.__colorArray=new Float32Array(n*
-3);if(q){if(u.faceUvs.length>0||u.faceVertexUvs.length>0)j.__uvArray=new Float32Array(n*2);if(u.faceUvs.length>1||u.faceVertexUvs.length>1)j.__uv2Array=new Float32Array(n*2)}if(k.geometry.skinWeights.length&&k.geometry.skinIndices.length)j.__skinVertexAArray=new Float32Array(n*4),j.__skinVertexBArray=new Float32Array(n*4),j.__skinIndexArray=new Float32Array(n*4),j.__skinWeightArray=new Float32Array(n*4);j.__faceArray=new Uint16Array(v*3+(k.geometry.edgeFaces?k.geometry.edgeFaces.length*6:0));j.__lineArray=
-new Uint16Array(B*2);if(j.numMorphTargets){j.__morphTargetsArrays=[];u=0;for(t=j.numMorphTargets;u<t;u++)j.__morphTargetsArrays.push(new Float32Array(n*3))}j.__needsSmoothNormals=x==THREE.SmoothShading;j.__uvType=q;j.__vertexColorType=s;j.__normalType=x;j.__webglFaceCount=v*3+(k.geometry.edgeFaces?k.geometry.edgeFaces.length*6:0);j.__webglLineCount=B*2;u=0;for(t=p.length;u<t;u++)if(q=p[u],q.attributes){if(j.__webglCustomAttributes===void 0)j.__webglCustomAttributes={};for(a in q.attributes){s=q.attributes[a];
-x={};for(m in s)x[m]=s[m];if(!x.__webglInitialized||x.createUniqueBuffers)x.__webglInitialized=!0,v=1,x.type==="v2"?v=2:x.type==="v3"?v=3:x.type==="v4"?v=4:x.type==="c"&&(v=3),x.size=v,x.array=new Float32Array(n*v),x.buffer=e.createBuffer(),x.buffer.belongsToAttribute=a,s.needsUpdate=!0,x.__original=s;j.__webglCustomAttributes[a]=x}}j.__inittedArrays=!0;i.__dirtyVertices=!0;i.__dirtyMorphTargets=!0;i.__dirtyElements=!0;i.__dirtyUvs=!0;i.__dirtyNormals=!0;i.__dirtyTangents=!0;i.__dirtyColors=!0}}else if(d instanceof
-THREE.Ribbon){if(i=d.geometry,!i.__webglVertexBuffer)j=i,j.__webglVertexBuffer=e.createBuffer(),j.__webglColorBuffer=e.createBuffer(),M.info.memory.geometries++,j=i,k=j.vertices.length,j.__vertexArray=new Float32Array(k*3),j.__colorArray=new Float32Array(k*3),j.__webglVertexCount=k,i.__dirtyVertices=!0,i.__dirtyColors=!0}else if(d instanceof THREE.Line){if(i=d.geometry,!i.__webglVertexBuffer)j=i,j.__webglVertexBuffer=e.createBuffer(),j.__webglColorBuffer=e.createBuffer(),M.info.memory.geometries++,
-j=i,k=j.vertices.length,j.__vertexArray=new Float32Array(k*3),j.__colorArray=new Float32Array(k*3),j.__webglLineCount=k,i.__dirtyVertices=!0,i.__dirtyColors=!0}else if(d instanceof THREE.ParticleSystem&&(i=d.geometry,!i.__webglVertexBuffer)){j=i;j.__webglVertexBuffer=e.createBuffer();j.__webglColorBuffer=e.createBuffer();M.info.geometries++;j=i;k=d;n=j.vertices.length;j.__vertexArray=new Float32Array(n*3);j.__colorArray=new Float32Array(n*3);j.__sortArray=[];j.__webglParticleCount=n;j.__materials=
-k.materials;B=v=m=void 0;m=0;for(v=k.materials.length;m<v;m++)if(B=k.materials[m],B.attributes){if(j.__webglCustomAttributes===void 0)j.__webglCustomAttributes={};for(a in B.attributes){originalAttribute=B.attributes[a];attribute={};for(property in originalAttribute)attribute[property]=originalAttribute[property];if(!attribute.__webglInitialized||attribute.createUniqueBuffers)attribute.__webglInitialized=!0,size=1,attribute.type==="v2"?size=2:attribute.type==="v3"?size=3:attribute.type==="v4"?size=
-4:attribute.type==="c"&&(size=3),attribute.size=size,attribute.array=new Float32Array(n*size),attribute.buffer=e.createBuffer(),attribute.buffer.belongsToAttribute=a,originalAttribute.needsUpdate=!0,attribute.__original=originalAttribute;j.__webglCustomAttributes[a]=attribute}}i.__dirtyVertices=!0;i.__dirtyColors=!0}if(!d.__webglActive){if(d instanceof THREE.Mesh)for(h in i=d.geometry,i.geometryGroups)j=i.geometryGroups[h],ia(f.__webglObjects,j,d);else d instanceof THREE.Ribbon||d instanceof THREE.Line||
-d instanceof THREE.ParticleSystem?(i=d.geometry,ia(f.__webglObjects,i,d)):THREE.MarchingCubes!==void 0&&d instanceof THREE.MarchingCubes?f.__webglObjectsImmediate.push({object:d,opaque:{list:[],count:0},transparent:{list:[],count:0}}):d instanceof THREE.Sprite&&f.__webglSprites.push(d);d.__webglActive=!0}b.__objectsAdded.splice(0,1)}for(;b.__objectsRemoved.length;){d=b.__objectsRemoved[0];f=b;if(d instanceof THREE.Mesh||d instanceof THREE.ParticleSystem||d instanceof THREE.Ribbon||d instanceof THREE.Line)qa(f.__webglObjects,
-d);else if(d instanceof THREE.Sprite){f=f.__webglSprites;h=d;i=void 0;for(i=f.length-1;i>=0;i--)f[i]==h&&f.splice(i,1)}else d instanceof THREE.MarchingCubes&&qa(f.__webglObjectsImmediate,d);d.__webglActive=!1;b.__objectsRemoved.splice(0,1)}d=0;for(f=b.__webglObjects.length;d<f;d++)if(i=b.__webglObjects[d].object,m=j=h=void 0,i instanceof THREE.Mesh){h=i.geometry;k=0;for(n=h.geometryGroupsList.length;k<n;k++)if(j=h.geometryGroupsList[k],m=va(j),h.__dirtyVertices||h.__dirtyMorphTargets||h.__dirtyElements||
-h.__dirtyUvs||h.__dirtyNormals||h.__dirtyColors||h.__dirtyTangents||m)if(m=j,v=e.DYNAMIC_DRAW,B=!h.dynamic,m.__inittedArrays){var D=p=u=void 0,y=void 0,J=D=void 0,G=void 0,R=void 0,K=void 0,P=H=F=s=x=t=q=void 0,Q=void 0,L=void 0,r=y=K=y=R=G=void 0,o=void 0,A=o=r=G=void 0,S=void 0,V=A=o=r=D=D=J=K=y=A=o=r=S=A=o=r=S=A=o=r=void 0,ha=0,N=0,Z=0,$=0,W=0,T=0,Y=0,U=0,la=0,w=0,ma=0,A=r=0,A=void 0,oa=m.__vertexArray,ka=m.__uvArray,na=m.__uv2Array,X=m.__normalArray,ca=m.__tangentArray,pa=m.__colorArray,da=m.__skinVertexAArray,
-ea=m.__skinVertexBArray,fa=m.__skinIndexArray,ga=m.__skinWeightArray,sa=m.__morphTargetsArrays,aa=m.__webglCustomAttributes,o=void 0,ja=m.__faceArray,Da=m.__lineArray,xa=m.__needsSmoothNormals,t=m.__vertexColorType,q=m.__uvType,x=m.__normalType,ta=i.geometry,ya=ta.__dirtyVertices,za=ta.__dirtyElements,ua=ta.__dirtyUvs,Aa=ta.__dirtyNormals,Ca=ta.__dirtyTangents,Ea=ta.__dirtyColors,Fa=ta.__dirtyMorphTargets,Ba=ta.vertices,Ga=m.faces,La=ta.faces,Ia=ta.faceVertexUvs[0],Ja=ta.faceVertexUvs[1],Ma=ta.skinVerticesA,
-Na=ta.skinVerticesB,Oa=ta.skinIndices,Ka=ta.skinWeights,Ha=ta.morphTargets;if(aa)for(V in aa)aa[V].offset=0,aa[V].offsetSrc=0;u=0;for(p=Ga.length;u<p;u++)if(D=Ga[u],y=La[D],Ia&&(s=Ia[D]),Ja&&(F=Ja[D]),D=y.vertexNormals,J=y.normal,G=y.vertexColors,R=y.color,K=y.vertexTangents,y instanceof THREE.Face3){if(ya)H=Ba[y.a].position,P=Ba[y.b].position,Q=Ba[y.c].position,oa[N]=H.x,oa[N+1]=H.y,oa[N+2]=H.z,oa[N+3]=P.x,oa[N+4]=P.y,oa[N+5]=P.z,oa[N+6]=Q.x,oa[N+7]=Q.y,oa[N+8]=Q.z,N+=9;if(aa)for(V in aa)if(o=aa[V],
-o.__original.needsUpdate)r=o.offset,A=o.offsetSrc,o.size===1?(o.boundTo===void 0||o.boundTo==="vertices"?(o.array[r]=o.value[y.a],o.array[r+1]=o.value[y.b],o.array[r+2]=o.value[y.c]):o.boundTo==="faces"?(A=o.value[A],o.array[r]=A,o.array[r+1]=A,o.array[r+2]=A,o.offsetSrc++):o.boundTo==="faceVertices"&&(o.array[r]=o.value[A],o.array[r+1]=o.value[A+1],o.array[r+2]=o.value[A+2],o.offsetSrc+=3),o.offset+=3):(o.boundTo===void 0||o.boundTo==="vertices"?(H=o.value[y.a],P=o.value[y.b],Q=o.value[y.c]):o.boundTo===
-"faces"?(Q=P=H=A=o.value[A],o.offsetSrc++):o.boundTo==="faceVertices"&&(H=o.value[A],P=o.value[A+1],Q=o.value[A+2],o.offsetSrc+=3),o.size===2?(o.array[r]=H.x,o.array[r+1]=H.y,o.array[r+2]=P.x,o.array[r+3]=P.y,o.array[r+4]=Q.x,o.array[r+5]=Q.y,o.offset+=6):o.size===3?(o.type==="c"?(o.array[r]=H.r,o.array[r+1]=H.g,o.array[r+2]=H.b,o.array[r+3]=P.r,o.array[r+4]=P.g,o.array[r+5]=P.b,o.array[r+6]=Q.r,o.array[r+7]=Q.g,o.array[r+8]=Q.b):(o.array[r]=H.x,o.array[r+1]=H.y,o.array[r+2]=H.z,o.array[r+3]=P.x,
-o.array[r+4]=P.y,o.array[r+5]=P.z,o.array[r+6]=Q.x,o.array[r+7]=Q.y,o.array[r+8]=Q.z),o.offset+=9):(o.array[r]=H.x,o.array[r+1]=H.y,o.array[r+2]=H.z,o.array[r+3]=H.w,o.array[r+4]=P.x,o.array[r+5]=P.y,o.array[r+6]=P.z,o.array[r+7]=P.w,o.array[r+8]=Q.x,o.array[r+9]=Q.y,o.array[r+10]=Q.z,o.array[r+11]=Q.w,o.offset+=12));if(Fa){r=0;for(o=Ha.length;r<o;r++)H=Ha[r].vertices[y.a].position,P=Ha[r].vertices[y.b].position,Q=Ha[r].vertices[y.c].position,A=sa[r],A[ma]=H.x,A[ma+1]=H.y,A[ma+2]=H.z,A[ma+3]=P.x,
-A[ma+4]=P.y,A[ma+5]=P.z,A[ma+6]=Q.x,A[ma+7]=Q.y,A[ma+8]=Q.z;ma+=9}if(Ka.length)r=Ka[y.a],o=Ka[y.b],A=Ka[y.c],ga[w]=r.x,ga[w+1]=r.y,ga[w+2]=r.z,ga[w+3]=r.w,ga[w+4]=o.x,ga[w+5]=o.y,ga[w+6]=o.z,ga[w+7]=o.w,ga[w+8]=A.x,ga[w+9]=A.y,ga[w+10]=A.z,ga[w+11]=A.w,r=Oa[y.a],o=Oa[y.b],A=Oa[y.c],fa[w]=r.x,fa[w+1]=r.y,fa[w+2]=r.z,fa[w+3]=r.w,fa[w+4]=o.x,fa[w+5]=o.y,fa[w+6]=o.z,fa[w+7]=o.w,fa[w+8]=A.x,fa[w+9]=A.y,fa[w+10]=A.z,fa[w+11]=A.w,r=Ma[y.a],o=Ma[y.b],A=Ma[y.c],da[w]=r.x,da[w+1]=r.y,da[w+2]=r.z,da[w+3]=1,
-da[w+4]=o.x,da[w+5]=o.y,da[w+6]=o.z,da[w+7]=1,da[w+8]=A.x,da[w+9]=A.y,da[w+10]=A.z,da[w+11]=1,r=Na[y.a],o=Na[y.b],A=Na[y.c],ea[w]=r.x,ea[w+1]=r.y,ea[w+2]=r.z,ea[w+3]=1,ea[w+4]=o.x,ea[w+5]=o.y,ea[w+6]=o.z,ea[w+7]=1,ea[w+8]=A.x,ea[w+9]=A.y,ea[w+10]=A.z,ea[w+11]=1,w+=12;if(Ea&&t)G.length==3&&t==THREE.VertexColors?(y=G[0],r=G[1],o=G[2]):o=r=y=R,pa[la]=y.r,pa[la+1]=y.g,pa[la+2]=y.b,pa[la+3]=r.r,pa[la+4]=r.g,pa[la+5]=r.b,pa[la+6]=o.r,pa[la+7]=o.g,pa[la+8]=o.b,la+=9;if(Ca&&ta.hasTangents)G=K[0],R=K[1],y=
-K[2],ca[Y]=G.x,ca[Y+1]=G.y,ca[Y+2]=G.z,ca[Y+3]=G.w,ca[Y+4]=R.x,ca[Y+5]=R.y,ca[Y+6]=R.z,ca[Y+7]=R.w,ca[Y+8]=y.x,ca[Y+9]=y.y,ca[Y+10]=y.z,ca[Y+11]=y.w,Y+=12;if(Aa&&x)if(D.length==3&&xa)for(K=0;K<3;K++)J=D[K],X[T]=J.x,X[T+1]=J.y,X[T+2]=J.z,T+=3;else for(K=0;K<3;K++)X[T]=J.x,X[T+1]=J.y,X[T+2]=J.z,T+=3;if(ua&&s!==void 0&&q)for(K=0;K<3;K++)D=s[K],ka[Z]=D.u,ka[Z+1]=D.v,Z+=2;if(ua&&F!==void 0&&q)for(K=0;K<3;K++)D=F[K],na[$]=D.u,na[$+1]=D.v,$+=2;za&&(ja[W]=ha,ja[W+1]=ha+1,ja[W+2]=ha+2,W+=3,Da[U]=ha,Da[U+1]=
-ha+1,Da[U+2]=ha,Da[U+3]=ha+2,Da[U+4]=ha+1,Da[U+5]=ha+2,U+=6,ha+=3)}else if(y instanceof THREE.Face4){if(ya)H=Ba[y.a].position,P=Ba[y.b].position,Q=Ba[y.c].position,L=Ba[y.d].position,oa[N]=H.x,oa[N+1]=H.y,oa[N+2]=H.z,oa[N+3]=P.x,oa[N+4]=P.y,oa[N+5]=P.z,oa[N+6]=Q.x,oa[N+7]=Q.y,oa[N+8]=Q.z,oa[N+9]=L.x,oa[N+10]=L.y,oa[N+11]=L.z,N+=12;if(aa)for(V in aa)if(o=aa[V],o.__original.needsUpdate)r=o.offset,A=o.offsetSrc,o.size===1?(o.boundTo===void 0||o.boundTo==="vertices"?(o.array[r]=o.value[y.a],o.array[r+
-1]=o.value[y.b],o.array[r+2]=o.value[y.c],o.array[r+3]=o.value[y.d]):o.boundTo==="faces"?(A=o.value[A],o.array[r]=A,o.array[r+1]=A,o.array[r+2]=A,o.array[r+3]=A,o.offsetSrc++):o.boundTo==="faceVertices"&&(o.array[r]=o.value[A],o.array[r+1]=o.value[A+1],o.array[r+2]=o.value[A+2],o.array[r+3]=o.value[A+3],o.offsetSrc+=4),o.offset+=4):(o.boundTo===void 0||o.boundTo==="vertices"?(H=o.value[y.a],P=o.value[y.b],Q=o.value[y.c],L=o.value[y.d]):o.boundTo==="faces"?(L=Q=P=H=A=o.value[A],o.offsetSrc++):o.boundTo===
-"faceVertices"&&(H=o.value[A],P=o.value[A+1],Q=o.value[A+2],L=o.value[A+3],o.offsetSrc+=4),o.size===2?(o.array[r]=H.x,o.array[r+1]=H.y,o.array[r+2]=P.x,o.array[r+3]=P.y,o.array[r+4]=Q.x,o.array[r+5]=Q.y,o.array[r+6]=L.x,o.array[r+7]=L.y,o.offset+=8):o.size===3?(o.type==="c"?(o.array[r]=H.r,o.array[r+1]=H.g,o.array[r+2]=H.b,o.array[r+3]=P.r,o.array[r+4]=P.g,o.array[r+5]=P.b,o.array[r+6]=Q.r,o.array[r+7]=Q.g,o.array[r+8]=Q.b,o.array[r+9]=L.r,o.array[r+10]=L.g,o.array[r+11]=L.b):(o.array[r]=H.x,o.array[r+
-1]=H.y,o.array[r+2]=H.z,o.array[r+3]=P.x,o.array[r+4]=P.y,o.array[r+5]=P.z,o.array[r+6]=Q.x,o.array[r+7]=Q.y,o.array[r+8]=Q.z,o.array[r+9]=L.x,o.array[r+10]=L.y,o.array[r+11]=L.z),o.offset+=12):(o.array[r]=H.x,o.array[r+1]=H.y,o.array[r+2]=H.z,o.array[r+3]=H.w,o.array[r+4]=P.x,o.array[r+5]=P.y,o.array[r+6]=P.z,o.array[r+7]=P.w,o.array[r+8]=Q.x,o.array[r+9]=Q.y,o.array[r+10]=Q.z,o.array[r+11]=Q.w,o.array[r+12]=L.x,o.array[r+13]=L.y,o.array[r+14]=L.z,o.array[r+15]=L.w,o.offset+=16));if(Fa){r=0;for(o=
-Ha.length;r<o;r++)H=Ha[r].vertices[y.a].position,P=Ha[r].vertices[y.b].position,Q=Ha[r].vertices[y.c].position,L=Ha[r].vertices[y.d].position,A=sa[r],A[ma]=H.x,A[ma+1]=H.y,A[ma+2]=H.z,A[ma+3]=P.x,A[ma+4]=P.y,A[ma+5]=P.z,A[ma+6]=Q.x,A[ma+7]=Q.y,A[ma+8]=Q.z,A[ma+9]=L.x,A[ma+10]=L.y,A[ma+11]=L.z;ma+=12}if(Ka.length)r=Ka[y.a],o=Ka[y.b],A=Ka[y.c],S=Ka[y.d],ga[w]=r.x,ga[w+1]=r.y,ga[w+2]=r.z,ga[w+3]=r.w,ga[w+4]=o.x,ga[w+5]=o.y,ga[w+6]=o.z,ga[w+7]=o.w,ga[w+8]=A.x,ga[w+9]=A.y,ga[w+10]=A.z,ga[w+11]=A.w,ga[w+
-12]=S.x,ga[w+13]=S.y,ga[w+14]=S.z,ga[w+15]=S.w,r=Oa[y.a],o=Oa[y.b],A=Oa[y.c],S=Oa[y.d],fa[w]=r.x,fa[w+1]=r.y,fa[w+2]=r.z,fa[w+3]=r.w,fa[w+4]=o.x,fa[w+5]=o.y,fa[w+6]=o.z,fa[w+7]=o.w,fa[w+8]=A.x,fa[w+9]=A.y,fa[w+10]=A.z,fa[w+11]=A.w,fa[w+12]=S.x,fa[w+13]=S.y,fa[w+14]=S.z,fa[w+15]=S.w,r=Ma[y.a],o=Ma[y.b],A=Ma[y.c],S=Ma[y.d],da[w]=r.x,da[w+1]=r.y,da[w+2]=r.z,da[w+3]=1,da[w+4]=o.x,da[w+5]=o.y,da[w+6]=o.z,da[w+7]=1,da[w+8]=A.x,da[w+9]=A.y,da[w+10]=A.z,da[w+11]=1,da[w+12]=S.x,da[w+13]=S.y,da[w+14]=S.z,da[w+
-15]=1,r=Na[y.a],o=Na[y.b],A=Na[y.c],y=Na[y.d],ea[w]=r.x,ea[w+1]=r.y,ea[w+2]=r.z,ea[w+3]=1,ea[w+4]=o.x,ea[w+5]=o.y,ea[w+6]=o.z,ea[w+7]=1,ea[w+8]=A.x,ea[w+9]=A.y,ea[w+10]=A.z,ea[w+11]=1,ea[w+12]=y.x,ea[w+13]=y.y,ea[w+14]=y.z,ea[w+15]=1,w+=16;if(Ea&&t)G.length==4&&t==THREE.VertexColors?(y=G[0],r=G[1],o=G[2],G=G[3]):G=o=r=y=R,pa[la]=y.r,pa[la+1]=y.g,pa[la+2]=y.b,pa[la+3]=r.r,pa[la+4]=r.g,pa[la+5]=r.b,pa[la+6]=o.r,pa[la+7]=o.g,pa[la+8]=o.b,pa[la+9]=G.r,pa[la+10]=G.g,pa[la+11]=G.b,la+=12;if(Ca&&ta.hasTangents)G=
-K[0],R=K[1],y=K[2],K=K[3],ca[Y]=G.x,ca[Y+1]=G.y,ca[Y+2]=G.z,ca[Y+3]=G.w,ca[Y+4]=R.x,ca[Y+5]=R.y,ca[Y+6]=R.z,ca[Y+7]=R.w,ca[Y+8]=y.x,ca[Y+9]=y.y,ca[Y+10]=y.z,ca[Y+11]=y.w,ca[Y+12]=K.x,ca[Y+13]=K.y,ca[Y+14]=K.z,ca[Y+15]=K.w,Y+=16;if(Aa&&x)if(D.length==4&&xa)for(K=0;K<4;K++)J=D[K],X[T]=J.x,X[T+1]=J.y,X[T+2]=J.z,T+=3;else for(K=0;K<4;K++)X[T]=J.x,X[T+1]=J.y,X[T+2]=J.z,T+=3;if(ua&&s!==void 0&&q)for(K=0;K<4;K++)D=s[K],ka[Z]=D.u,ka[Z+1]=D.v,Z+=2;if(ua&&F!==void 0&&q)for(K=0;K<4;K++)D=F[K],na[$]=D.u,na[$+
-1]=D.v,$+=2;za&&(ja[W]=ha,ja[W+1]=ha+1,ja[W+2]=ha+3,ja[W+3]=ha+1,ja[W+4]=ha+2,ja[W+5]=ha+3,W+=6,Da[U]=ha,Da[U+1]=ha+1,Da[U+2]=ha,Da[U+3]=ha+3,Da[U+4]=ha+1,Da[U+5]=ha+2,Da[U+6]=ha+2,Da[U+7]=ha+3,U+=8,ha+=4)}ya&&(e.bindBuffer(e.ARRAY_BUFFER,m.__webglVertexBuffer),e.bufferData(e.ARRAY_BUFFER,oa,v));if(aa)for(V in aa)o=aa[V],o.__original.needsUpdate&&(e.bindBuffer(e.ARRAY_BUFFER,o.buffer),e.bufferData(e.ARRAY_BUFFER,o.array,v));if(Fa){r=0;for(o=Ha.length;r<o;r++)e.bindBuffer(e.ARRAY_BUFFER,m.__webglMorphTargetsBuffers[r]),
-e.bufferData(e.ARRAY_BUFFER,sa[r],v)}Ea&&la>0&&(e.bindBuffer(e.ARRAY_BUFFER,m.__webglColorBuffer),e.bufferData(e.ARRAY_BUFFER,pa,v));Aa&&(e.bindBuffer(e.ARRAY_BUFFER,m.__webglNormalBuffer),e.bufferData(e.ARRAY_BUFFER,X,v));Ca&&ta.hasTangents&&(e.bindBuffer(e.ARRAY_BUFFER,m.__webglTangentBuffer),e.bufferData(e.ARRAY_BUFFER,ca,v));ua&&Z>0&&(e.bindBuffer(e.ARRAY_BUFFER,m.__webglUVBuffer),e.bufferData(e.ARRAY_BUFFER,ka,v));ua&&$>0&&(e.bindBuffer(e.ARRAY_BUFFER,m.__webglUV2Buffer),e.bufferData(e.ARRAY_BUFFER,
-na,v));za&&(e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,m.__webglFaceBuffer),e.bufferData(e.ELEMENT_ARRAY_BUFFER,ja,v),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,m.__webglLineBuffer),e.bufferData(e.ELEMENT_ARRAY_BUFFER,Da,v));w>0&&(e.bindBuffer(e.ARRAY_BUFFER,m.__webglSkinVertexABuffer),e.bufferData(e.ARRAY_BUFFER,da,v),e.bindBuffer(e.ARRAY_BUFFER,m.__webglSkinVertexBBuffer),e.bufferData(e.ARRAY_BUFFER,ea,v),e.bindBuffer(e.ARRAY_BUFFER,m.__webglSkinIndicesBuffer),e.bufferData(e.ARRAY_BUFFER,fa,v),e.bindBuffer(e.ARRAY_BUFFER,
-m.__webglSkinWeightsBuffer),e.bufferData(e.ARRAY_BUFFER,ga,v));B&&(delete m.__inittedArrays,delete m.__colorArray,delete m.__normalArray,delete m.__tangentArray,delete m.__uvArray,delete m.__uv2Array,delete m.__faceArray,delete m.__vertexArray,delete m.__lineArray,delete m.__skinVertexAArray,delete m.__skinVertexBArray,delete m.__skinIndexArray,delete m.__skinWeightArray)}h.__dirtyVertices=!1;h.__dirtyMorphTargets=!1;h.__dirtyElements=!1;h.__dirtyUvs=!1;h.__dirtyNormals=!1;h.__dirtyTangents=!1;h.__dirtyColors=
-!1;wa(j)}else if(i instanceof THREE.Ribbon){h=i.geometry;if(h.__dirtyVertices||h.__dirtyColors){i=h;j=e.DYNAMIC_DRAW;k=u=B=B=void 0;p=i.vertices;n=i.colors;q=p.length;m=n.length;t=i.__vertexArray;v=i.__colorArray;x=i.__dirtyColors;if(i.__dirtyVertices){for(B=0;B<q;B++)u=p[B].position,k=B*3,t[k]=u.x,t[k+1]=u.y,t[k+2]=u.z;e.bindBuffer(e.ARRAY_BUFFER,i.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,t,j)}if(x){for(B=0;B<m;B++)color=n[B],k=B*3,v[k]=color.r,v[k+1]=color.g,v[k+2]=color.b;e.bindBuffer(e.ARRAY_BUFFER,
-i.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,v,j)}}h.__dirtyVertices=!1;h.__dirtyColors=!1}else if(i instanceof THREE.Line){h=i.geometry;if(h.__dirtyVertices||h.__dirtyColors){i=h;j=e.DYNAMIC_DRAW;k=u=B=B=void 0;p=i.vertices;n=i.colors;q=p.length;m=n.length;t=i.__vertexArray;v=i.__colorArray;x=i.__dirtyColors;if(i.__dirtyVertices){for(B=0;B<q;B++)u=p[B].position,k=B*3,t[k]=u.x,t[k+1]=u.y,t[k+2]=u.z;e.bindBuffer(e.ARRAY_BUFFER,i.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,t,j)}if(x){for(B=
-0;B<m;B++)color=n[B],k=B*3,v[k]=color.r,v[k+1]=color.g,v[k+2]=color.b;e.bindBuffer(e.ARRAY_BUFFER,i.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,v,j)}}h.__dirtyVertices=!1;h.__dirtyColors=!1}else if(i instanceof THREE.ParticleSystem)h=i.geometry,m=va(h),(h.__dirtyVertices||h.__dirtyColors||i.sortParticles||m)&&c(h,e.DYNAMIC_DRAW,i),h.__dirtyVertices=!1,h.__dirtyColors=!1,wa(h)};this.setFaceCulling=function(b,c){b?(!c||c=="ccw"?e.frontFace(e.CCW):e.frontFace(e.CW),b=="back"?e.cullFace(e.BACK):b==
-"front"?e.cullFace(e.FRONT):e.cullFace(e.FRONT_AND_BACK),e.enable(e.CULL_FACE)):e.disable(e.CULL_FACE)};this.supportsVertexTextures=function(){return bb}};
+d.shadowMapSoft?"#define SHADOWMAP_SOFT":"",d.shadowMapSoft?"#define SHADOWMAP_WIDTH "+d.shadowMapWidth.toFixed(1):"",d.shadowMapSoft?"#define SHADOWMAP_HEIGHT "+d.shadowMapHeight.toFixed(1):"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");e.attachShader(r,Z("fragment",j+m));e.attachShader(r,Z("vertex",f+p));e.linkProgram(r);e.getProgramParameter(r,e.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+e.getProgramParameter(r,e.VALIDATE_STATUS)+", gl error ["+
+e.getError()+"]");r.uniforms={};r.attributes={};var u,f=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(u in n)f.push(u);u=f;f=0;for(n=u.length;f<n;f++)m=u[f],r.uniforms[m]=e.getUniformLocation(r,m);f=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(u=0;u<d.maxMorphTargets;u++)f.push("morphTarget"+u);for(C in c)f.push(C);
+C=f;u=0;for(c=C.length;u<c;u++)d=C[u],r.attributes[d]=e.getAttribLocation(r,d);r.id=ua.length;ua.push({program:r,code:k});M.info.memory.programs=ua.length;C=r}b.program=C;C=b.program.attributes;C.position>=0&&e.enableVertexAttribArray(C.position);C.color>=0&&e.enableVertexAttribArray(C.color);C.normal>=0&&e.enableVertexAttribArray(C.normal);C.tangent>=0&&e.enableVertexAttribArray(C.tangent);b.skinning&&C.skinVertexA>=0&&C.skinVertexB>=0&&C.skinIndex>=0&&C.skinWeight>=0&&(e.enableVertexAttribArray(C.skinVertexA),
+e.enableVertexAttribArray(C.skinVertexB),e.enableVertexAttribArray(C.skinIndex),e.enableVertexAttribArray(C.skinWeight));if(b.attributes)for(i in b.attributes)C[i]!==void 0&&C[i]>=0&&e.enableVertexAttribArray(C[i]);if(b.morphTargets)for(i=b.numSupportedMorphTargets=0;i<this.maxMorphTargets;i++)u="morphTarget"+i,C[u]>=0&&(e.enableVertexAttribArray(C[u]),b.numSupportedMorphTargets++);b.uniformsList=[];for(h in b.uniforms)b.uniformsList.push([b.uniforms[h],h])};this.clearTarget=function(b,c,d,e){L(b);
+this.clear(c,d,e)};this.render=function(b,c,p,r){var I,u,Fa,X,y,J,D,Qa,Ra=b.lights,C=b.fog;U=-1;this.shadowMapEnabled&&x(b,c);M.info.render.calls=0;M.info.render.vertices=0;M.info.render.faces=0;c.matrixAutoUpdate&&c.update(void 0,!0);b.update(void 0,!1,c);c.matrixWorldInverse.flattenToArray(Wa);c.projectionMatrix.flattenToArray(Va);Ga.multiply(c.projectionMatrix,c.matrixWorldInverse);n(Ga);this.initWebGLObjects(b);L(p);(this.autoClear||r)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);
+y=b.__webglObjects.length;for(r=0;r<y;r++)if(I=b.__webglObjects[r],D=I.object,D.visible)if(!(D instanceof THREE.Mesh)||!D.frustumCulled||q(D)){if(D.matrixWorld.flattenToArray(D._objectMatrixArray),F(D,c,!0),v(I),I.render=!0,this.sortObjects)I.object.renderDepth?I.z=I.object.renderDepth:(Sa.copy(D.position),Ga.multiplyVector3(Sa),I.z=Sa.z)}else I.render=!1;else I.render=!1;this.sortObjects&&b.__webglObjects.sort(B);J=b.__webglObjectsImmediate.length;for(r=0;r<J;r++)I=b.__webglObjectsImmediate[r],D=
+I.object,D.visible&&(D.matrixAutoUpdate&&D.matrixWorld.flattenToArray(D._objectMatrixArray),F(D,c,!0),t(I));if(b.overrideMaterial){j(b.overrideMaterial.depthTest);G(b.overrideMaterial.blending);for(r=0;r<y;r++)if(I=b.__webglObjects[r],I.render)D=I.object,Qa=I.buffer,h(D),f(c,Ra,C,b.overrideMaterial,Qa,D);for(r=0;r<J;r++)I=b.__webglObjectsImmediate[r],D=I.object,D.visible&&(h(D),u=d(c,Ra,C,b.overrideMaterial,D),D.immediateRenderCallback?D.immediateRenderCallback(u,e,aa):D.render(function(b){i(b,u,
+La.shading)}))}else{G(THREE.NormalBlending);for(r=y-1;r>=0;r--)if(I=b.__webglObjects[r],I.render){D=I.object;Qa=I.buffer;Fa=I.opaque;h(D);for(I=0;I<Fa.count;I++)X=Fa.list[I],j(X.depthTest),k(X.depthWrite),m(X.polygonOffset,X.polygonOffsetFactor,X.polygonOffsetUnits),f(c,Ra,C,X,Qa,D)}for(r=0;r<J;r++)if(I=b.__webglObjectsImmediate[r],D=I.object,D.visible){Fa=I.opaque;h(D);for(I=0;I<Fa.count;I++)X=Fa.list[I],j(X.depthTest),k(X.depthWrite),m(X.polygonOffset,X.polygonOffsetFactor,X.polygonOffsetUnits),
+u=d(c,Ra,C,X,D),D.immediateRenderCallback?D.immediateRenderCallback(u,e,aa):D.render(function(b){i(b,u,La.shading)})}for(r=0;r<y;r++)if(I=b.__webglObjects[r],I.render){D=I.object;Qa=I.buffer;Fa=I.transparent;h(D);for(I=0;I<Fa.count;I++)X=Fa.list[I],G(X.blending),j(X.depthTest),k(X.depthWrite),m(X.polygonOffset,X.polygonOffsetFactor,X.polygonOffsetUnits),f(c,Ra,C,X,Qa,D)}for(r=0;r<J;r++)if(I=b.__webglObjectsImmediate[r],D=I.object,D.visible){Fa=I.transparent;h(D);for(I=0;I<Fa.count;I++)X=Fa.list[I],
+G(X.blending),j(X.depthTest),k(X.depthWrite),m(X.polygonOffset,X.polygonOffsetFactor,X.polygonOffsetUnits),u=d(c,Ra,C,X,D),D.immediateRenderCallback?D.immediateRenderCallback(u,e,aa):D.render(function(b){i(b,u,La.shading)})}}b.__webglSprites.length&&E(b,c);p&&p.minFilter!==THREE.NearestFilter&&p.minFilter!==THREE.LinearFilter&&T(p)};this.initWebGLObjects=function(b){if(!b.__webglObjects)b.__webglObjects=[],b.__webglObjectsImmediate=[],b.__webglSprites=[];for(;b.__objectsAdded.length;){var d=b.__objectsAdded[0],
+f=b,h=void 0,i=void 0,j=void 0;if(!d.__webglInit)if(d.__webglInit=!0,d._modelViewMatrix=new THREE.Matrix4,d._normalMatrixArray=new Float32Array(9),d._modelViewMatrixArray=new Float32Array(16),d._objectMatrixArray=new Float32Array(16),d.matrixWorld.flattenToArray(d._objectMatrixArray),d instanceof THREE.Mesh)for(h in i=d.geometry,i.geometryGroups==void 0&&ra(i),i.geometryGroups){if(j=i.geometryGroups[h],!j.__webglVertexBuffer){var k=j;k.__webglVertexBuffer=e.createBuffer();k.__webglNormalBuffer=e.createBuffer();
+k.__webglTangentBuffer=e.createBuffer();k.__webglColorBuffer=e.createBuffer();k.__webglUVBuffer=e.createBuffer();k.__webglUV2Buffer=e.createBuffer();k.__webglSkinVertexABuffer=e.createBuffer();k.__webglSkinVertexBBuffer=e.createBuffer();k.__webglSkinIndicesBuffer=e.createBuffer();k.__webglSkinWeightsBuffer=e.createBuffer();k.__webglFaceBuffer=e.createBuffer();k.__webglLineBuffer=e.createBuffer();if(k.numMorphTargets){var n=void 0,m=void 0;k.__webglMorphTargetsBuffers=[];n=0;for(m=k.numMorphTargets;n<
+m;n++)k.__webglMorphTargetsBuffers.push(e.createBuffer())}M.info.memory.geometries++;for(var k=d,p=void 0,r=void 0,q=void 0,u=q=void 0,t=void 0,v=void 0,B=v=n=0,x=q=r=void 0,q=m=x=r=p=void 0,u=k.geometry,t=u.faces,x=j.faces,p=0,r=x.length;p<r;p++)q=x[p],q=t[q],q instanceof THREE.Face3?(n+=3,v+=1,B+=3):q instanceof THREE.Face4&&(n+=4,v+=2,B+=4);for(var p=j,r=k,F=x=t=void 0,H=void 0,F=void 0,q=[],t=0,x=r.materials.length;t<x;t++)if(F=r.materials[t],F instanceof THREE.MeshFaceMaterial){F=0;for(l=p.materials.length;F<
+l;F++)(H=p.materials[F])&&q.push(H)}else(H=F)&&q.push(H);p=q;j.__materials=p;a:{t=r=void 0;x=p.length;for(r=0;r<x;r++)if(t=p[r],t.map||t.lightMap||t instanceof THREE.ShaderMaterial){r=!0;break a}r=!1}a:{x=t=void 0;q=p.length;for(t=0;t<q;t++)if(x=p[t],!(x instanceof THREE.MeshBasicMaterial&&!x.envMap||x instanceof THREE.MeshDepthMaterial)){x=x&&x.shading!=void 0&&x.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}x=!1}a:{q=t=void 0;F=p.length;for(t=0;t<F;t++)if(q=p[t],q.vertexColors){q=
+q.vertexColors;break a}q=!1}j.__vertexArray=new Float32Array(n*3);if(x)j.__normalArray=new Float32Array(n*3);if(u.hasTangents)j.__tangentArray=new Float32Array(n*4);if(q)j.__colorArray=new Float32Array(n*3);if(r){if(u.faceUvs.length>0||u.faceVertexUvs.length>0)j.__uvArray=new Float32Array(n*2);if(u.faceUvs.length>1||u.faceVertexUvs.length>1)j.__uv2Array=new Float32Array(n*2)}if(k.geometry.skinWeights.length&&k.geometry.skinIndices.length)j.__skinVertexAArray=new Float32Array(n*4),j.__skinVertexBArray=
+new Float32Array(n*4),j.__skinIndexArray=new Float32Array(n*4),j.__skinWeightArray=new Float32Array(n*4);j.__faceArray=new Uint16Array(v*3+(k.geometry.edgeFaces?k.geometry.edgeFaces.length*6:0));j.__lineArray=new Uint16Array(B*2);if(j.numMorphTargets){j.__morphTargetsArrays=[];u=0;for(t=j.numMorphTargets;u<t;u++)j.__morphTargetsArrays.push(new Float32Array(n*3))}j.__needsSmoothNormals=x==THREE.SmoothShading;j.__uvType=r;j.__vertexColorType=q;j.__normalType=x;j.__webglFaceCount=v*3+(k.geometry.edgeFaces?
+k.geometry.edgeFaces.length*6:0);j.__webglLineCount=B*2;u=0;for(t=p.length;u<t;u++)if(r=p[u],r.attributes){if(j.__webglCustomAttributes===void 0)j.__webglCustomAttributes={};for(a in r.attributes){q=r.attributes[a];x={};for(m in q)x[m]=q[m];if(!x.__webglInitialized||x.createUniqueBuffers)x.__webglInitialized=!0,v=1,x.type==="v2"?v=2:x.type==="v3"?v=3:x.type==="v4"?v=4:x.type==="c"&&(v=3),x.size=v,x.array=new Float32Array(n*v),x.buffer=e.createBuffer(),x.buffer.belongsToAttribute=a,q.needsUpdate=!0,
+x.__original=q;j.__webglCustomAttributes[a]=x}}j.__inittedArrays=!0;i.__dirtyVertices=!0;i.__dirtyMorphTargets=!0;i.__dirtyElements=!0;i.__dirtyUvs=!0;i.__dirtyNormals=!0;i.__dirtyTangents=!0;i.__dirtyColors=!0}}else if(d instanceof THREE.Ribbon){if(i=d.geometry,!i.__webglVertexBuffer)j=i,j.__webglVertexBuffer=e.createBuffer(),j.__webglColorBuffer=e.createBuffer(),M.info.memory.geometries++,j=i,k=j.vertices.length,j.__vertexArray=new Float32Array(k*3),j.__colorArray=new Float32Array(k*3),j.__webglVertexCount=
+k,i.__dirtyVertices=!0,i.__dirtyColors=!0}else if(d instanceof THREE.Line){if(i=d.geometry,!i.__webglVertexBuffer)j=i,j.__webglVertexBuffer=e.createBuffer(),j.__webglColorBuffer=e.createBuffer(),M.info.memory.geometries++,j=i,k=j.vertices.length,j.__vertexArray=new Float32Array(k*3),j.__colorArray=new Float32Array(k*3),j.__webglLineCount=k,i.__dirtyVertices=!0,i.__dirtyColors=!0}else if(d instanceof THREE.ParticleSystem&&(i=d.geometry,!i.__webglVertexBuffer)){j=i;j.__webglVertexBuffer=e.createBuffer();
+j.__webglColorBuffer=e.createBuffer();M.info.geometries++;j=i;k=d;n=j.vertices.length;j.__vertexArray=new Float32Array(n*3);j.__colorArray=new Float32Array(n*3);j.__sortArray=[];j.__webglParticleCount=n;j.__materials=k.materials;B=v=m=void 0;m=0;for(v=k.materials.length;m<v;m++)if(B=k.materials[m],B.attributes){if(j.__webglCustomAttributes===void 0)j.__webglCustomAttributes={};for(a in B.attributes){originalAttribute=B.attributes[a];attribute={};for(property in originalAttribute)attribute[property]=
+originalAttribute[property];if(!attribute.__webglInitialized||attribute.createUniqueBuffers)attribute.__webglInitialized=!0,size=1,attribute.type==="v2"?size=2:attribute.type==="v3"?size=3:attribute.type==="v4"?size=4:attribute.type==="c"&&(size=3),attribute.size=size,attribute.array=new Float32Array(n*size),attribute.buffer=e.createBuffer(),attribute.buffer.belongsToAttribute=a,originalAttribute.needsUpdate=!0,attribute.__original=originalAttribute;j.__webglCustomAttributes[a]=attribute}}i.__dirtyVertices=
+!0;i.__dirtyColors=!0}if(!d.__webglActive){if(d instanceof THREE.Mesh)for(h in i=d.geometry,i.geometryGroups)j=i.geometryGroups[h],ja(f.__webglObjects,j,d);else d instanceof THREE.Ribbon||d instanceof THREE.Line||d instanceof THREE.ParticleSystem?(i=d.geometry,ja(f.__webglObjects,i,d)):THREE.MarchingCubes!==void 0&&d instanceof THREE.MarchingCubes||d.immediateRenderCallback?f.__webglObjectsImmediate.push({object:d,opaque:{list:[],count:0},transparent:{list:[],count:0}}):d instanceof THREE.Sprite&&
+f.__webglSprites.push(d);d.__webglActive=!0}b.__objectsAdded.splice(0,1)}for(;b.__objectsRemoved.length;){d=b.__objectsRemoved[0];f=b;if(d instanceof THREE.Mesh||d instanceof THREE.ParticleSystem||d instanceof THREE.Ribbon||d instanceof THREE.Line)qa(f.__webglObjects,d);else if(d instanceof THREE.Sprite){f=f.__webglSprites;h=d;i=void 0;for(i=f.length-1;i>=0;i--)f[i]==h&&f.splice(i,1)}else(d instanceof THREE.MarchingCubes||d.immediateRenderCallback)&&qa(f.__webglObjectsImmediate,d);d.__webglActive=
+!1;b.__objectsRemoved.splice(0,1)}d=0;for(f=b.__webglObjects.length;d<f;d++)if(i=b.__webglObjects[d].object,m=j=h=void 0,i instanceof THREE.Mesh){h=i.geometry;k=0;for(n=h.geometryGroupsList.length;k<n;k++)if(j=h.geometryGroupsList[k],m=wa(j),h.__dirtyVertices||h.__dirtyMorphTargets||h.__dirtyElements||h.__dirtyUvs||h.__dirtyNormals||h.__dirtyColors||h.__dirtyTangents||m)if(m=j,v=e.DYNAMIC_DRAW,B=!h.dynamic,m.__inittedArrays){var E=p=u=void 0,z=void 0,J=E=void 0,G=void 0,Q=void 0,K=void 0,O=H=F=q=
+x=t=r=void 0,P=void 0,L=void 0,s=z=K=z=Q=G=void 0,o=void 0,A=o=s=G=void 0,R=void 0,U=A=o=s=E=E=J=K=z=A=o=s=R=A=o=s=R=A=o=s=void 0,ia=0,N=0,Z=0,$=0,V=0,S=0,Y=0,T=0,la=0,w=0,na=0,A=s=0,A=void 0,oa=m.__vertexArray,ka=m.__uvArray,ma=m.__uv2Array,W=m.__normalArray,ca=m.__tangentArray,pa=m.__colorArray,da=m.__skinVertexAArray,ea=m.__skinVertexBArray,fa=m.__skinIndexArray,ga=m.__skinWeightArray,sa=m.__morphTargetsArrays,aa=m.__webglCustomAttributes,o=void 0,ha=m.__faceArray,Da=m.__lineArray,ya=m.__needsSmoothNormals,
+t=m.__vertexColorType,r=m.__uvType,x=m.__normalType,ta=i.geometry,va=ta.__dirtyVertices,za=ta.__dirtyElements,ua=ta.__dirtyUvs,Aa=ta.__dirtyNormals,Ba=ta.__dirtyTangents,Ea=ta.__dirtyColors,Ga=ta.__dirtyMorphTargets,Ca=ta.vertices,Ha=m.faces,La=ta.faces,Ja=ta.faceVertexUvs[0],Ka=ta.faceVertexUvs[1],Na=ta.skinVerticesA,Oa=ta.skinVerticesB,Pa=ta.skinIndices,Ma=ta.skinWeights,Ia=ta.morphTargets;if(aa)for(U in aa)aa[U].offset=0,aa[U].offsetSrc=0;u=0;for(p=Ha.length;u<p;u++)if(E=Ha[u],z=La[E],Ja&&(q=Ja[E]),
+Ka&&(F=Ka[E]),E=z.vertexNormals,J=z.normal,G=z.vertexColors,Q=z.color,K=z.vertexTangents,z instanceof THREE.Face3){if(va)H=Ca[z.a].position,O=Ca[z.b].position,P=Ca[z.c].position,oa[N]=H.x,oa[N+1]=H.y,oa[N+2]=H.z,oa[N+3]=O.x,oa[N+4]=O.y,oa[N+5]=O.z,oa[N+6]=P.x,oa[N+7]=P.y,oa[N+8]=P.z,N+=9;if(aa)for(U in aa)if(o=aa[U],o.__original.needsUpdate)s=o.offset,A=o.offsetSrc,o.size===1?(o.boundTo===void 0||o.boundTo==="vertices"?(o.array[s]=o.value[z.a],o.array[s+1]=o.value[z.b],o.array[s+2]=o.value[z.c]):
+o.boundTo==="faces"?(A=o.value[A],o.array[s]=A,o.array[s+1]=A,o.array[s+2]=A,o.offsetSrc++):o.boundTo==="faceVertices"&&(o.array[s]=o.value[A],o.array[s+1]=o.value[A+1],o.array[s+2]=o.value[A+2],o.offsetSrc+=3),o.offset+=3):(o.boundTo===void 0||o.boundTo==="vertices"?(H=o.value[z.a],O=o.value[z.b],P=o.value[z.c]):o.boundTo==="faces"?(P=O=H=A=o.value[A],o.offsetSrc++):o.boundTo==="faceVertices"&&(H=o.value[A],O=o.value[A+1],P=o.value[A+2],o.offsetSrc+=3),o.size===2?(o.array[s]=H.x,o.array[s+1]=H.y,
+o.array[s+2]=O.x,o.array[s+3]=O.y,o.array[s+4]=P.x,o.array[s+5]=P.y,o.offset+=6):o.size===3?(o.type==="c"?(o.array[s]=H.r,o.array[s+1]=H.g,o.array[s+2]=H.b,o.array[s+3]=O.r,o.array[s+4]=O.g,o.array[s+5]=O.b,o.array[s+6]=P.r,o.array[s+7]=P.g,o.array[s+8]=P.b):(o.array[s]=H.x,o.array[s+1]=H.y,o.array[s+2]=H.z,o.array[s+3]=O.x,o.array[s+4]=O.y,o.array[s+5]=O.z,o.array[s+6]=P.x,o.array[s+7]=P.y,o.array[s+8]=P.z),o.offset+=9):(o.array[s]=H.x,o.array[s+1]=H.y,o.array[s+2]=H.z,o.array[s+3]=H.w,o.array[s+
+4]=O.x,o.array[s+5]=O.y,o.array[s+6]=O.z,o.array[s+7]=O.w,o.array[s+8]=P.x,o.array[s+9]=P.y,o.array[s+10]=P.z,o.array[s+11]=P.w,o.offset+=12));if(Ga){s=0;for(o=Ia.length;s<o;s++)H=Ia[s].vertices[z.a].position,O=Ia[s].vertices[z.b].position,P=Ia[s].vertices[z.c].position,A=sa[s],A[na]=H.x,A[na+1]=H.y,A[na+2]=H.z,A[na+3]=O.x,A[na+4]=O.y,A[na+5]=O.z,A[na+6]=P.x,A[na+7]=P.y,A[na+8]=P.z;na+=9}if(Ma.length)s=Ma[z.a],o=Ma[z.b],A=Ma[z.c],ga[w]=s.x,ga[w+1]=s.y,ga[w+2]=s.z,ga[w+3]=s.w,ga[w+4]=o.x,ga[w+5]=o.y,
+ga[w+6]=o.z,ga[w+7]=o.w,ga[w+8]=A.x,ga[w+9]=A.y,ga[w+10]=A.z,ga[w+11]=A.w,s=Pa[z.a],o=Pa[z.b],A=Pa[z.c],fa[w]=s.x,fa[w+1]=s.y,fa[w+2]=s.z,fa[w+3]=s.w,fa[w+4]=o.x,fa[w+5]=o.y,fa[w+6]=o.z,fa[w+7]=o.w,fa[w+8]=A.x,fa[w+9]=A.y,fa[w+10]=A.z,fa[w+11]=A.w,s=Na[z.a],o=Na[z.b],A=Na[z.c],da[w]=s.x,da[w+1]=s.y,da[w+2]=s.z,da[w+3]=1,da[w+4]=o.x,da[w+5]=o.y,da[w+6]=o.z,da[w+7]=1,da[w+8]=A.x,da[w+9]=A.y,da[w+10]=A.z,da[w+11]=1,s=Oa[z.a],o=Oa[z.b],A=Oa[z.c],ea[w]=s.x,ea[w+1]=s.y,ea[w+2]=s.z,ea[w+3]=1,ea[w+4]=o.x,
+ea[w+5]=o.y,ea[w+6]=o.z,ea[w+7]=1,ea[w+8]=A.x,ea[w+9]=A.y,ea[w+10]=A.z,ea[w+11]=1,w+=12;if(Ea&&t)G.length==3&&t==THREE.VertexColors?(z=G[0],s=G[1],o=G[2]):o=s=z=Q,pa[la]=z.r,pa[la+1]=z.g,pa[la+2]=z.b,pa[la+3]=s.r,pa[la+4]=s.g,pa[la+5]=s.b,pa[la+6]=o.r,pa[la+7]=o.g,pa[la+8]=o.b,la+=9;if(Ba&&ta.hasTangents)G=K[0],Q=K[1],z=K[2],ca[Y]=G.x,ca[Y+1]=G.y,ca[Y+2]=G.z,ca[Y+3]=G.w,ca[Y+4]=Q.x,ca[Y+5]=Q.y,ca[Y+6]=Q.z,ca[Y+7]=Q.w,ca[Y+8]=z.x,ca[Y+9]=z.y,ca[Y+10]=z.z,ca[Y+11]=z.w,Y+=12;if(Aa&&x)if(E.length==3&&
+ya)for(K=0;K<3;K++)J=E[K],W[S]=J.x,W[S+1]=J.y,W[S+2]=J.z,S+=3;else for(K=0;K<3;K++)W[S]=J.x,W[S+1]=J.y,W[S+2]=J.z,S+=3;if(ua&&q!==void 0&&r)for(K=0;K<3;K++)E=q[K],ka[Z]=E.u,ka[Z+1]=E.v,Z+=2;if(ua&&F!==void 0&&r)for(K=0;K<3;K++)E=F[K],ma[$]=E.u,ma[$+1]=E.v,$+=2;za&&(ha[V]=ia,ha[V+1]=ia+1,ha[V+2]=ia+2,V+=3,Da[T]=ia,Da[T+1]=ia+1,Da[T+2]=ia,Da[T+3]=ia+2,Da[T+4]=ia+1,Da[T+5]=ia+2,T+=6,ia+=3)}else if(z instanceof THREE.Face4){if(va)H=Ca[z.a].position,O=Ca[z.b].position,P=Ca[z.c].position,L=Ca[z.d].position,
+oa[N]=H.x,oa[N+1]=H.y,oa[N+2]=H.z,oa[N+3]=O.x,oa[N+4]=O.y,oa[N+5]=O.z,oa[N+6]=P.x,oa[N+7]=P.y,oa[N+8]=P.z,oa[N+9]=L.x,oa[N+10]=L.y,oa[N+11]=L.z,N+=12;if(aa)for(U in aa)if(o=aa[U],o.__original.needsUpdate)s=o.offset,A=o.offsetSrc,o.size===1?(o.boundTo===void 0||o.boundTo==="vertices"?(o.array[s]=o.value[z.a],o.array[s+1]=o.value[z.b],o.array[s+2]=o.value[z.c],o.array[s+3]=o.value[z.d]):o.boundTo==="faces"?(A=o.value[A],o.array[s]=A,o.array[s+1]=A,o.array[s+2]=A,o.array[s+3]=A,o.offsetSrc++):o.boundTo===
+"faceVertices"&&(o.array[s]=o.value[A],o.array[s+1]=o.value[A+1],o.array[s+2]=o.value[A+2],o.array[s+3]=o.value[A+3],o.offsetSrc+=4),o.offset+=4):(o.boundTo===void 0||o.boundTo==="vertices"?(H=o.value[z.a],O=o.value[z.b],P=o.value[z.c],L=o.value[z.d]):o.boundTo==="faces"?(L=P=O=H=A=o.value[A],o.offsetSrc++):o.boundTo==="faceVertices"&&(H=o.value[A],O=o.value[A+1],P=o.value[A+2],L=o.value[A+3],o.offsetSrc+=4),o.size===2?(o.array[s]=H.x,o.array[s+1]=H.y,o.array[s+2]=O.x,o.array[s+3]=O.y,o.array[s+4]=
+P.x,o.array[s+5]=P.y,o.array[s+6]=L.x,o.array[s+7]=L.y,o.offset+=8):o.size===3?(o.type==="c"?(o.array[s]=H.r,o.array[s+1]=H.g,o.array[s+2]=H.b,o.array[s+3]=O.r,o.array[s+4]=O.g,o.array[s+5]=O.b,o.array[s+6]=P.r,o.array[s+7]=P.g,o.array[s+8]=P.b,o.array[s+9]=L.r,o.array[s+10]=L.g,o.array[s+11]=L.b):(o.array[s]=H.x,o.array[s+1]=H.y,o.array[s+2]=H.z,o.array[s+3]=O.x,o.array[s+4]=O.y,o.array[s+5]=O.z,o.array[s+6]=P.x,o.array[s+7]=P.y,o.array[s+8]=P.z,o.array[s+9]=L.x,o.array[s+10]=L.y,o.array[s+11]=L.z),
+o.offset+=12):(o.array[s]=H.x,o.array[s+1]=H.y,o.array[s+2]=H.z,o.array[s+3]=H.w,o.array[s+4]=O.x,o.array[s+5]=O.y,o.array[s+6]=O.z,o.array[s+7]=O.w,o.array[s+8]=P.x,o.array[s+9]=P.y,o.array[s+10]=P.z,o.array[s+11]=P.w,o.array[s+12]=L.x,o.array[s+13]=L.y,o.array[s+14]=L.z,o.array[s+15]=L.w,o.offset+=16));if(Ga){s=0;for(o=Ia.length;s<o;s++)H=Ia[s].vertices[z.a].position,O=Ia[s].vertices[z.b].position,P=Ia[s].vertices[z.c].position,L=Ia[s].vertices[z.d].position,A=sa[s],A[na]=H.x,A[na+1]=H.y,A[na+2]=
+H.z,A[na+3]=O.x,A[na+4]=O.y,A[na+5]=O.z,A[na+6]=P.x,A[na+7]=P.y,A[na+8]=P.z,A[na+9]=L.x,A[na+10]=L.y,A[na+11]=L.z;na+=12}if(Ma.length)s=Ma[z.a],o=Ma[z.b],A=Ma[z.c],R=Ma[z.d],ga[w]=s.x,ga[w+1]=s.y,ga[w+2]=s.z,ga[w+3]=s.w,ga[w+4]=o.x,ga[w+5]=o.y,ga[w+6]=o.z,ga[w+7]=o.w,ga[w+8]=A.x,ga[w+9]=A.y,ga[w+10]=A.z,ga[w+11]=A.w,ga[w+12]=R.x,ga[w+13]=R.y,ga[w+14]=R.z,ga[w+15]=R.w,s=Pa[z.a],o=Pa[z.b],A=Pa[z.c],R=Pa[z.d],fa[w]=s.x,fa[w+1]=s.y,fa[w+2]=s.z,fa[w+3]=s.w,fa[w+4]=o.x,fa[w+5]=o.y,fa[w+6]=o.z,fa[w+7]=o.w,
+fa[w+8]=A.x,fa[w+9]=A.y,fa[w+10]=A.z,fa[w+11]=A.w,fa[w+12]=R.x,fa[w+13]=R.y,fa[w+14]=R.z,fa[w+15]=R.w,s=Na[z.a],o=Na[z.b],A=Na[z.c],R=Na[z.d],da[w]=s.x,da[w+1]=s.y,da[w+2]=s.z,da[w+3]=1,da[w+4]=o.x,da[w+5]=o.y,da[w+6]=o.z,da[w+7]=1,da[w+8]=A.x,da[w+9]=A.y,da[w+10]=A.z,da[w+11]=1,da[w+12]=R.x,da[w+13]=R.y,da[w+14]=R.z,da[w+15]=1,s=Oa[z.a],o=Oa[z.b],A=Oa[z.c],z=Oa[z.d],ea[w]=s.x,ea[w+1]=s.y,ea[w+2]=s.z,ea[w+3]=1,ea[w+4]=o.x,ea[w+5]=o.y,ea[w+6]=o.z,ea[w+7]=1,ea[w+8]=A.x,ea[w+9]=A.y,ea[w+10]=A.z,ea[w+
+11]=1,ea[w+12]=z.x,ea[w+13]=z.y,ea[w+14]=z.z,ea[w+15]=1,w+=16;if(Ea&&t)G.length==4&&t==THREE.VertexColors?(z=G[0],s=G[1],o=G[2],G=G[3]):G=o=s=z=Q,pa[la]=z.r,pa[la+1]=z.g,pa[la+2]=z.b,pa[la+3]=s.r,pa[la+4]=s.g,pa[la+5]=s.b,pa[la+6]=o.r,pa[la+7]=o.g,pa[la+8]=o.b,pa[la+9]=G.r,pa[la+10]=G.g,pa[la+11]=G.b,la+=12;if(Ba&&ta.hasTangents)G=K[0],Q=K[1],z=K[2],K=K[3],ca[Y]=G.x,ca[Y+1]=G.y,ca[Y+2]=G.z,ca[Y+3]=G.w,ca[Y+4]=Q.x,ca[Y+5]=Q.y,ca[Y+6]=Q.z,ca[Y+7]=Q.w,ca[Y+8]=z.x,ca[Y+9]=z.y,ca[Y+10]=z.z,ca[Y+11]=z.w,
+ca[Y+12]=K.x,ca[Y+13]=K.y,ca[Y+14]=K.z,ca[Y+15]=K.w,Y+=16;if(Aa&&x)if(E.length==4&&ya)for(K=0;K<4;K++)J=E[K],W[S]=J.x,W[S+1]=J.y,W[S+2]=J.z,S+=3;else for(K=0;K<4;K++)W[S]=J.x,W[S+1]=J.y,W[S+2]=J.z,S+=3;if(ua&&q!==void 0&&r)for(K=0;K<4;K++)E=q[K],ka[Z]=E.u,ka[Z+1]=E.v,Z+=2;if(ua&&F!==void 0&&r)for(K=0;K<4;K++)E=F[K],ma[$]=E.u,ma[$+1]=E.v,$+=2;za&&(ha[V]=ia,ha[V+1]=ia+1,ha[V+2]=ia+3,ha[V+3]=ia+1,ha[V+4]=ia+2,ha[V+5]=ia+3,V+=6,Da[T]=ia,Da[T+1]=ia+1,Da[T+2]=ia,Da[T+3]=ia+3,Da[T+4]=ia+1,Da[T+5]=ia+2,Da[T+
+6]=ia+2,Da[T+7]=ia+3,T+=8,ia+=4)}va&&(e.bindBuffer(e.ARRAY_BUFFER,m.__webglVertexBuffer),e.bufferData(e.ARRAY_BUFFER,oa,v));if(aa)for(U in aa)o=aa[U],o.__original.needsUpdate&&(e.bindBuffer(e.ARRAY_BUFFER,o.buffer),e.bufferData(e.ARRAY_BUFFER,o.array,v));if(Ga){s=0;for(o=Ia.length;s<o;s++)e.bindBuffer(e.ARRAY_BUFFER,m.__webglMorphTargetsBuffers[s]),e.bufferData(e.ARRAY_BUFFER,sa[s],v)}Ea&&la>0&&(e.bindBuffer(e.ARRAY_BUFFER,m.__webglColorBuffer),e.bufferData(e.ARRAY_BUFFER,pa,v));Aa&&(e.bindBuffer(e.ARRAY_BUFFER,
+m.__webglNormalBuffer),e.bufferData(e.ARRAY_BUFFER,W,v));Ba&&ta.hasTangents&&(e.bindBuffer(e.ARRAY_BUFFER,m.__webglTangentBuffer),e.bufferData(e.ARRAY_BUFFER,ca,v));ua&&Z>0&&(e.bindBuffer(e.ARRAY_BUFFER,m.__webglUVBuffer),e.bufferData(e.ARRAY_BUFFER,ka,v));ua&&$>0&&(e.bindBuffer(e.ARRAY_BUFFER,m.__webglUV2Buffer),e.bufferData(e.ARRAY_BUFFER,ma,v));za&&(e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,m.__webglFaceBuffer),e.bufferData(e.ELEMENT_ARRAY_BUFFER,ha,v),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,m.__webglLineBuffer),
+e.bufferData(e.ELEMENT_ARRAY_BUFFER,Da,v));w>0&&(e.bindBuffer(e.ARRAY_BUFFER,m.__webglSkinVertexABuffer),e.bufferData(e.ARRAY_BUFFER,da,v),e.bindBuffer(e.ARRAY_BUFFER,m.__webglSkinVertexBBuffer),e.bufferData(e.ARRAY_BUFFER,ea,v),e.bindBuffer(e.ARRAY_BUFFER,m.__webglSkinIndicesBuffer),e.bufferData(e.ARRAY_BUFFER,fa,v),e.bindBuffer(e.ARRAY_BUFFER,m.__webglSkinWeightsBuffer),e.bufferData(e.ARRAY_BUFFER,ga,v));B&&(delete m.__inittedArrays,delete m.__colorArray,delete m.__normalArray,delete m.__tangentArray,
+delete m.__uvArray,delete m.__uv2Array,delete m.__faceArray,delete m.__vertexArray,delete m.__lineArray,delete m.__skinVertexAArray,delete m.__skinVertexBArray,delete m.__skinIndexArray,delete m.__skinWeightArray)}h.__dirtyVertices=!1;h.__dirtyMorphTargets=!1;h.__dirtyElements=!1;h.__dirtyUvs=!1;h.__dirtyNormals=!1;h.__dirtyTangents=!1;h.__dirtyColors=!1;xa(j)}else if(i instanceof THREE.Ribbon){h=i.geometry;if(h.__dirtyVertices||h.__dirtyColors){i=h;j=e.DYNAMIC_DRAW;k=u=B=B=void 0;p=i.vertices;n=
+i.colors;r=p.length;m=n.length;t=i.__vertexArray;v=i.__colorArray;x=i.__dirtyColors;if(i.__dirtyVertices){for(B=0;B<r;B++)u=p[B].position,k=B*3,t[k]=u.x,t[k+1]=u.y,t[k+2]=u.z;e.bindBuffer(e.ARRAY_BUFFER,i.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,t,j)}if(x){for(B=0;B<m;B++)color=n[B],k=B*3,v[k]=color.r,v[k+1]=color.g,v[k+2]=color.b;e.bindBuffer(e.ARRAY_BUFFER,i.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,v,j)}}h.__dirtyVertices=!1;h.__dirtyColors=!1}else if(i instanceof THREE.Line){h=i.geometry;
+if(h.__dirtyVertices||h.__dirtyColors){i=h;j=e.DYNAMIC_DRAW;k=u=B=B=void 0;p=i.vertices;n=i.colors;r=p.length;m=n.length;t=i.__vertexArray;v=i.__colorArray;x=i.__dirtyColors;if(i.__dirtyVertices){for(B=0;B<r;B++)u=p[B].position,k=B*3,t[k]=u.x,t[k+1]=u.y,t[k+2]=u.z;e.bindBuffer(e.ARRAY_BUFFER,i.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,t,j)}if(x){for(B=0;B<m;B++)color=n[B],k=B*3,v[k]=color.r,v[k+1]=color.g,v[k+2]=color.b;e.bindBuffer(e.ARRAY_BUFFER,i.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,
+v,j)}}h.__dirtyVertices=!1;h.__dirtyColors=!1}else if(i instanceof THREE.ParticleSystem)h=i.geometry,m=wa(h),(h.__dirtyVertices||h.__dirtyColors||i.sortParticles||m)&&c(h,e.DYNAMIC_DRAW,i),h.__dirtyVertices=!1,h.__dirtyColors=!1,xa(h)};this.setFaceCulling=function(b,c){b?(!c||c=="ccw"?e.frontFace(e.CCW):e.frontFace(e.CW),b=="back"?e.cullFace(e.BACK):b=="front"?e.cullFace(e.FRONT):e.cullFace(e.FRONT_AND_BACK),e.enable(e.CULL_FACE)):e.disable(e.CULL_FACE)};this.supportsVertexTextures=function(){return cb}};
 THREE.WebGLRenderTarget=function(b,c,d){this.width=b;this.height=c;d=d||{};this.wrapS=d.wrapS!==void 0?d.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=d.wrapT!==void 0?d.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=d.magFilter!==void 0?d.magFilter:THREE.LinearFilter;this.minFilter=d.minFilter!==void 0?d.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=d.format!==void 0?d.format:THREE.RGBAFormat;this.type=d.type!==void 0?d.type:
 THREE.UnsignedByteType;this.depthBuffer=d.depthBuffer!==void 0?d.depthBuffer:!0;this.stencilBuffer=d.stencilBuffer!==void 0?d.stencilBuffer:!0};
 THREE.WebGLRenderTarget.prototype.clone=function(){var b=new THREE.WebGLRenderTarget(this.width,this.height);b.wrapS=this.wrapS;b.wrapT=this.wrapT;b.magFilter=this.magFilter;b.minFilter=this.minFilter;b.offset.copy(this.offset);b.repeat.copy(this.repeat);b.format=this.format;b.type=this.type;b.depthBuffer=this.depthBuffer;b.stencilBuffer=this.stencilBuffer;return b};THREE.WebGLRenderTargetCube=function(b,c,d){THREE.WebGLRenderTarget.call(this,b,c,d);this.activeCubeFace=0};

+ 1 - 0
examples/canvas_camera_orthographic.html

@@ -46,6 +46,7 @@
 				camera.position.x = 200;
 				camera.position.y = 100;
 				camera.position.z = 200;
+				camera.useTarget = true;
 
 				scene = new THREE.Scene();
 

+ 0 - 1
examples/canvas_geometry_cube.html

@@ -56,7 +56,6 @@
 				camera = new THREE.Camera( 70, window.innerWidth / window.innerHeight, 1, 1000 );
 				camera.position.y = 150;
 				camera.position.z = 500;
-				camera.target.position.y = 150;
 
 				scene = new THREE.Scene();
 

+ 1 - 0
examples/canvas_geometry_earth.html

@@ -61,6 +61,7 @@
 
 				camera = new THREE.Camera( 60, window.innerWidth / window.innerHeight, 1, 10000 );
 				camera.position.z = 500;
+				camera.useTarget = true;
 
 				scene = new THREE.Scene();
 

+ 1 - 0
examples/canvas_geometry_hierarchy.html

@@ -46,6 +46,7 @@
 
 				camera = new THREE.Camera( 60, window.innerWidth / window.innerHeight, 1, 10000 );
 				camera.position.z = 500;
+				camera.useTarget = true;
 
 				scene = new THREE.Scene();
 

+ 1 - 0
examples/canvas_geometry_panorama.html

@@ -55,6 +55,7 @@
 				container = document.getElementById( 'container' );
 
 				camera = new THREE.Camera( fov, window.innerWidth / window.innerHeight, 1, 1100 );
+				camera.useTarget = true;
 
 				scene = new THREE.Scene();
 

+ 1 - 0
examples/canvas_geometry_panorama_fisheye.html

@@ -55,6 +55,7 @@
 				container = document.getElementById( 'container' );
 
 				camera = new THREE.Camera( fov, window.innerWidth / window.innerHeight, 1, 1100 );
+				camera.useTarget = true;
 
 				scene = new THREE.Scene();
 

+ 80 - 50
examples/canvas_geometry_subdivison.html

@@ -56,20 +56,32 @@
 				return smooth;
 			}
 			
+			// Create new object by parameters
+			var createSomething = function(klass, args) {
+				var F = function(klass, args) {
+				    return klass.apply(this, args);
+				}
+				F.prototype = klass.prototype;
+
+				return new F(klass, args);
+			};
+			
 			init();
 			animate();
+			
+			var info;
 
 			function init() {
 
 				container = document.createElement( 'div' );
 				document.body.appendChild( container );
 
-				var info = document.createElement( 'div' );
+				info = document.createElement( 'div' );
 				info.style.position = 'absolute';
 				info.style.top = '10px';
 				info.style.width = '100%';
 				info.style.textAlign = 'center';
-				info.innerHTML = 'Drag to spin the cube';
+				info.innerHTML = 'Drag to spin the geometry ';
 				container.appendChild( info );
 
 				camera = new THREE.Camera( 70, window.innerWidth / window.innerHeight, 1, 1000 );
@@ -92,57 +104,45 @@
 
 				}
 				
+				var createGeometry = function(i, subdivisions) {
+					var params = geometriesParams[i];
+					
+					info.innerHTML = 'Drag to spin the geometry THREE.' + params.type
+					 	+ ' with ' + subdivisions + ' subdivisions'; //+ params.args;
+					
+					geometry = createSomething(THREE[params.type], params.args);
+					
+					geometry.mergeVertices();
+					smooth = createSubdivision(geometry, subdivisions);
+					return smooth;
+				};
 				
-				//geometry = new THREE.CubeGeometry( 200, 200, 200, 2, 2, 2, materials );
-				geometry = new THREE.CubeGeometry( 200, 200, 200, 1, 1, 3, materials );
 				
-				//geometry = new THREE.IcosahedronGeometry( 1 );
-				
-				//geometry = new THREE.TorusGeometry( 100, 60, 4, 8, Math.PI*2 );
-				//geometry = new THREE.SphereGeometry( 200, 1, 1);
-				//geometry = new THREE.CylinderGeometry( 50, 50, 200 );
-				// geometry = new THREE.TextGeometry( '&', {
-				// 						size: 200,
-				// 						height: 50,
-				// 						curveSegments: 1,
-				// 						font: "helvetiker"
-				// 
-				// 					});
-					
-				//PlaneGeometry not supported 
+				var geometriesParams = [
 				
+					{type: 'CubeGeometry', args: [ 200, 200, 200, 2, 2, 2, materials ] }, 
+					{type: 'TorusGeometry', args: [ 100, 60, 4, 8, Math.PI*2 ] }, 
+					{type: 'SphereGeometry', args: [ 200, 1, 1 ] }, 
+					{type: 'CylinderGeometry', args: [ 25, 75, 200, 8, 3 ] }, 
+					{type: 'TextGeometry', args: ['&', {
+											size: 200,
+											height: 50,
+											curveSegments: 1,
+											font: "helvetiker"
+
+										}]}, 
 				
-				// make sure mergeVertices(); is run to fix quick duplicated vertices
-				geometry.mergeVertices();
-
+				];
 				
-				//console.log(geometry);
+				smooth = createGeometry(3, 2);
 				
-				smooth = createSubdivision(geometry, 2);
+				//geometry = new THREE.CubeGeometry( 200, 200, 200, 2, 2, 2, materials );
+				// make sure mergeVertices(); is run to fix quick duplicated vertices
+				// geometry.mergeVertices();
+				// smooth = createSubdivision(geometry, 2);
 				
-				var PI2 = Math.PI * 2;
-				var program = function ( context ) {
-
-					context.beginPath();
-					context.arc( 0, 0, 1, 0, PI2, true );
-					context.closePath();
-					context.fill();
-
-				}
 				
-				var drawText = function(i) {
-					
-					return function ( context ) {
 
-						context.beginPath();
-						context.scale(0.1,-0.1);
-
-						context.fillText(i, 0,0);
-						
-					};
-					
-
-				}
 
 
 
@@ -151,6 +151,16 @@
 				scene.add( group );
 
 				// Debug new Points
+				// var PI2 = Math.PI * 2;
+				// var program = function ( context ) {
+				// 
+				// 	context.beginPath();
+				// 	context.arc( 0, 0, 1, 0, PI2, true );
+				// 	context.closePath();
+				// 	context.fill();
+				// 
+				// }
+				// 
 				// for ( var i = 0; i < smooth.vertices.length; i++ ) {
 				// 
 				// 	particle = new THREE.Particle( new THREE.ParticleCanvasMaterial( { color: Math.random() * 0x808008 + 0x808080, program: program } ) );
@@ -161,6 +171,19 @@
 				// }
 				
 				//Debug original points
+				
+				// var drawText = function(i) {
+				// 	
+				// 	return function ( context ) {
+				// 
+				// 		context.beginPath();
+				// 		context.scale(0.1,-0.1);
+				// 
+				// 		context.fillText(i, 0,0);
+				// 		
+				// 	};
+				// 						
+				// }
 				// for ( var i = 0; i < geometry.vertices.length; i++ ) {
 				// 
 				// 	particle = new THREE.Particle( new THREE.ParticleCanvasMaterial( { color: Math.random() * 0x808008 + 0x808080, program: drawText(i) } ) );
@@ -171,16 +194,23 @@
 				// }
 				
 
-				 cube = new THREE.Mesh( smooth, new THREE.MeshBasicMaterial( { color: 0x405040, wireframe:true,  opacity:0.8 } ) ); 
-				//cube = new THREE.Mesh( smooth, new THREE.MeshFaceMaterial() ); 
-				// material =  new THREE.MeshPhongMaterial( { color: 0xffffff, shading: THREE.FlatShading } );
-				// 	 new THREE.MeshPhongMaterial( { color: 0xffffff, shading: THREE.SmoothShading } );
+				var meshmaterials = [
+					new THREE.MeshBasicMaterial( { color: 0x405040, wireframe:true,  opacity:0.8 } )
+				];
+
+				// new THREE.MeshLambertMaterial( { color: 0xffffff, shading: THREE.FlatShading, vertexColors: THREE.VertexColors } ),
+				// new THREE.MeshBasicMaterial( { color: 0x000000, shading: THREE.FlatShading, wireframe: true } )
+				// new THREE.MeshFaceMaterial() 
+				// new THREE.MeshPhongMaterial( { color: 0xffffff, shading: THREE.FlatShading } );
+				// new THREE.MeshPhongMaterial( { color: 0xffffff, shading: THREE.SmoothShading } );
+
+				 cube = new THREE.Mesh( smooth, meshmaterials ); 
+
 				// cube.scale.x = 200;
 				// cube.scale.y = 200;
 				// cube.scale.z = 200;
 				
 				
-				//
 				cube.doubleSided = true;
 				cube.position.y = 150;
 				cube.overdraw = true;
@@ -193,7 +223,7 @@
 				plane.overdraw = true;
 				scene.add( plane );
 
-				renderer = new THREE.CanvasRenderer();
+				renderer = new THREE.CanvasRenderer(); // WebGLRenderer CanvasRenderer
 				renderer.setSize( window.innerWidth, window.innerHeight );
 
 				container.appendChild( renderer.domElement );

+ 1 - 0
examples/canvas_geometry_terrain.html

@@ -64,6 +64,7 @@
 
 				camera = new THREE.Camera( 60, window.innerWidth / window.innerHeight, 1, 10000 );
 				camera.position.z = 500;
+				camera.useTarget = true;
 
 				scene = new THREE.Scene();
 

+ 0 - 1
examples/canvas_geometry_text.html

@@ -62,7 +62,6 @@
 				camera = new THREE.Camera( 50, window.innerWidth / window.innerHeight, 1, 1000 );
 				camera.position.y = 150;
 				camera.position.z = 500;
-				camera.target.position.y = 150;
 
 				scene = new THREE.Scene();
 

+ 1 - 0
examples/canvas_interactive_cubes.html

@@ -47,6 +47,7 @@
 				camera = new THREE.Camera( 70, window.innerWidth / window.innerHeight, 1, 10000 );
 				camera.position.y = 300;
 				camera.position.z = 500;
+				camera.useTarget = true;
 
 				scene = new THREE.Scene();
 

+ 1 - 0
examples/canvas_interactive_cubes_tween.html

@@ -45,6 +45,7 @@
 				camera = new THREE.Camera( 70, window.innerWidth / window.innerHeight, 1, 10000 );
 				camera.position.y = 300;
 				camera.position.z = 500;
+				camera.useTarget = true;
 
 				scene = new THREE.Scene();
 

+ 1 - 0
examples/canvas_interactive_particles.html

@@ -67,6 +67,7 @@
 				camera = new THREE.Camera( 70, window.innerWidth / window.innerHeight, 1, 10000 );
 				camera.position.y = 300;
 				camera.position.z = 500;
+				camera.useTarget = true;
 
 				scene = new THREE.Scene();
 

+ 2 - 1
examples/canvas_interactive_voxelpainter.html

@@ -42,11 +42,12 @@
 				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 + click</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.Camera( 40, window.innerWidth / window.innerHeight, 1, 10000 );
 				camera.position.y = 800;
+				camera.useTarget = true;
 				camera.target.position.y = 200;
 
 				scene = new THREE.Scene();

+ 1 - 0
examples/canvas_lines.html

@@ -48,6 +48,7 @@
 
 				camera = new THREE.Camera( 75, window.innerWidth / window.innerHeight, 1, 10000 );
 				camera.position.z = 100;
+				camera.useTarget = true;
 
 				scene = new THREE.Scene();
 

+ 1 - 0
examples/canvas_lines_sphere.html

@@ -51,6 +51,7 @@
 
 				camera = new THREE.Camera( 75, SCREEN_WIDTH / SCREEN_HEIGHT, 1, 10000 );
 				camera.position.z = 1000;
+				camera.useTarget = true;
 
 				scene = new THREE.Scene();
 

+ 1 - 0
examples/canvas_materials.html

@@ -38,6 +38,7 @@
 				camera = new THREE.Camera( 45, window.innerWidth / window.innerHeight, 1, 2000 );
 				camera.position.y = 200;
 				camera.position.z = 800;
+				camera.useTarget = true;
 
 				scene = new THREE.Scene();
 

+ 2 - 12
examples/canvas_materials_depth.html

@@ -65,7 +65,7 @@
 				camera.position.x = 1000;
 				camera.position.y = 1000;
 				camera.position.z = 1000;
-				// camera.target.position.y = 150;
+				camera.useTarget = true;
 
 				scene = new THREE.Scene();
 
@@ -76,7 +76,7 @@
 				plane = new THREE.Mesh( new THREE.PlaneGeometry( 1000, 1000, 10, 10 ), material );
 				plane.overdraw = true;
 				plane.doubleSided = true;
-				
+
 				plane.rotation.x = - 90 * ( Math.PI / 180 );
 				plane.position.y = - 100;
 
@@ -95,20 +95,10 @@
 					cube.position.x = ( i % 5 ) * 200 - 400;
 					cube.position.z = Math.floor( i / 5 ) * 200 - 350;
 
-					/*
-					cube.position.x = Math.random() * 1000 - 500;
-					cube.position.y = Math.random() * 1000 - 500;
-					cube.position.z = Math.random() * 1000 - 500;
-					*/
-
 					cube.rotation.x = Math.random() * 200 - 100;
 					cube.rotation.y = Math.random() * 200 - 100;
 					cube.rotation.z = Math.random() * 200 - 100;
 
-					/*
-					cube.scale.x = cube.scale.y = cube.scale.z = Math.random() + 0.5;
-					*/
-
 					scene.add(cube);
 
 				}

+ 1 - 0
examples/canvas_materials_video.html

@@ -63,6 +63,7 @@
 
 				camera = new THREE.Camera( 45, window.innerWidth / window.innerHeight, 1, 10000 );
 				camera.position.z = 1000;
+				camera.useTarget = true;
 
 				scene = new THREE.Scene();
 

+ 1 - 0
examples/canvas_particles_floor.html

@@ -46,6 +46,7 @@
 
 				camera = new THREE.Camera( 75, window.innerWidth / window.innerHeight, 1, 10000 );
 				camera.position.z = 1000;
+				camera.useTarget = true;
 
 				scene = new THREE.Scene();
 

+ 1 - 0
examples/canvas_particles_random.html

@@ -42,6 +42,7 @@
 
 				camera = new THREE.Camera( 75, window.innerWidth / window.innerHeight, 1, 3000 );
 				camera.position.z = 1000;
+				camera.useTarget = true;
 
 				scene = new THREE.Scene();
 

+ 1 - 4
examples/canvas_particles_shapes.html

@@ -22,7 +22,6 @@
 		<script src="js/Stats.js"></script>
 		<script src="js/Tween.js"></script>
 		<script src="js/Sparks.js"></script>
-		
 
 		<!-- load the font file from canvas-text -->
 
@@ -45,8 +44,7 @@
 
 			var windowHalfX = window.innerWidth / 2;
 			var windowHalfY = window.innerHeight / 2;
-			
-			
+
 			var heartShape, particleCloud, sparksEmitter, emitterPos;
 			var _rotation = 0;
 			var timeOnShapePath = 0;
@@ -70,7 +68,6 @@
 				camera = new THREE.Camera( 50, window.innerWidth / window.innerHeight, 1, 1000 );
 				camera.position.y = 150;
 				camera.position.z = 700;
-				camera.target.position.y = 150;
 
 				scene = new THREE.Scene();
 

+ 1 - 0
examples/canvas_particles_sprites.html

@@ -43,6 +43,7 @@
 
 				camera = new THREE.Camera( 75, window.innerWidth / window.innerHeight, 1, 5000 );
 				camera.position.z = 1000;
+				camera.useTarget = true;
 
 				scene = new THREE.Scene();
 

+ 1 - 0
examples/canvas_particles_waves.html

@@ -46,6 +46,7 @@
 
 				camera = new THREE.Camera( 75, window.innerWidth / window.innerHeight, 1, 10000 );
 				camera.position.z = 1000;
+				camera.useTarget = true;
 
 				scene = new THREE.Scene();
 

+ 1 - 0
examples/canvas_performance.html

@@ -49,6 +49,7 @@
 				camera.position.z = 1000;
 				camera.position.y = 1000;
 				camera.position.z = 1000;
+				camera.useTarget = true;
 
 				scene = new THREE.Scene();
 

+ 2 - 107
examples/canvas_sandbox.html

@@ -15,113 +15,7 @@
 	</head>
 	<body>
 
-		<!-- <script src="../build/Three.js"></script> -->
-
-		<script src="../src/Three.js"></script>
-		<script src="../src/core/Color.js"></script>
-		<script src="../src/core/Vector2.js"></script>
-		<script src="../src/core/Vector3.js"></script>
-		<script src="../src/core/Vector4.js"></script>
-		<script src="../src/core/Ray.js"></script>
-		<script src="../src/core/Rectangle.js"></script>
-		<script src="../src/core/Matrix3.js"></script>
-		<script src="../src/core/Matrix4.js"></script>
-		<script src="../src/core/Object3D.js"></script>
-		<script src="../src/core/Projector.js"></script>
-		<script src="../src/core/Quaternion.js"></script>
-		<script src="../src/core/Vertex.js"></script>
-		<script src="../src/core/Face3.js"></script>
-		<script src="../src/core/Face4.js"></script>
-		<script src="../src/core/UV.js"></script>
-		<script src="../src/core/Geometry.js"></script>
-		<script src="../src/core/Spline.js"></script>
-		<script src="../src/core/Edge.js"></script>
-		<script src="../src/cameras/Camera.js"></script>
-		<script src="../src/cameras/OrthoCamera.js"></script>
-		<script src="../src/lights/Light.js"></script>
-		<script src="../src/lights/AmbientLight.js"></script>
-		<script src="../src/lights/DirectionalLight.js"></script>
-		<script src="../src/lights/PointLight.js"></script>
-		<script src="../src/lights/SpotLight.js"></script>
-		<script src="../src/materials/Material.js"></script>
-		<script src="../src/materials/LineBasicMaterial.js"></script>
-		<script src="../src/materials/MeshBasicMaterial.js"></script>
-		<script src="../src/materials/MeshLambertMaterial.js"></script>
-		<script src="../src/materials/MeshPhongMaterial.js"></script>
-		<script src="../src/materials/MeshDepthMaterial.js"></script>
-		<script src="../src/materials/MeshNormalMaterial.js"></script>
-		<script src="../src/materials/MeshFaceMaterial.js"></script>
-		<script src="../src/materials/ShaderMaterial.js"></script>
-		<script src="../src/materials/ParticleBasicMaterial.js"></script>
-		<script src="../src/materials/ParticleCanvasMaterial.js"></script>
-		<script src="../src/materials/ParticleDOMMaterial.js"></script>
-		<script src="../src/textures/Texture.js"></script>
-		<script src="../src/textures/DataTexture.js"></script>
-		<script src="../src/objects/Particle.js"></script>
-		<script src="../src/objects/ParticleSystem.js"></script>
-		<script src="../src/objects/Line.js"></script>
-		<script src="../src/objects/Mesh.js"></script>
-		<script src="../src/objects/Bone.js"></script>
-		<script src="../src/objects/SkinnedMesh.js"></script>
-		<script src="../src/objects/Ribbon.js"></script>
-		<script src="../src/objects/LOD.js"></script>
-		<script src="../src/objects/Sprite.js"></script>
-		<script src="../src/scenes/Scene.js"></script>
-		<script src="../src/scenes/Fog.js"></script>
-		<script src="../src/scenes/FogExp2.js"></script>
-		<script src="../src/renderers/DOMRenderer.js"></script>
-		<script src="../src/renderers/CanvasRenderer.js"></script>
-		<script src="../src/renderers/SVGRenderer.js"></script>
-		<script src="../src/renderers/WebGLShaders.js"></script>
-		<script src="../src/renderers/WebGLRenderer.js"></script>
-		<script src="../src/renderers/WebGLRenderTarget.js"></script>
-		<script src="../src/renderers/WebGLRenderTargetCube.js"></script>
-		<script src="../src/renderers/renderables/RenderableVertex.js"></script>
-		<script src="../src/renderers/renderables/RenderableFace3.js"></script>
-		<script src="../src/renderers/renderables/RenderableFace4.js"></script>
-		<script src="../src/renderers/renderables/RenderableObject.js"></script>
-		<script src="../src/renderers/renderables/RenderableParticle.js"></script>
-		<script src="../src/renderers/renderables/RenderableLine.js"></script>
-		<script src="../src/extras/ColorUtils.js"></script>
-		<script src="../src/extras/GeometryUtils.js"></script>
-		<script src="../src/extras/ImageUtils.js"></script>
-		<script src="../src/extras/SceneUtils.js"></script>
-		<script src="../src/extras/ShaderUtils.js"></script>
-		<script src="../src/extras/core/Curve.js"></script>
-		<script src="../src/extras/core/CurvePath.js"></script>
-		<script src="../src/extras/core/Path.js"></script>
-		<script src="../src/extras/core/Shape.js"></script>
-		<script src="../src/extras/core/TextPath.js"></script>
-		<script src="../src/extras/animation/AnimationHandler.js"></script>
-		<script src="../src/extras/animation/Animation.js"></script>
-		<script src="../src/extras/cameras/FirstPersonCamera.js"></script>
-		<script src="../src/extras/cameras/PathCamera.js"></script>
-		<script src="../src/extras/cameras/FlyCamera.js"></script>
-		<script src="../src/extras/cameras/RollCamera.js"></script>
-		<script src="../src/extras/cameras/TrackballCamera.js"></script>
-		<script src="../src/extras/cameras/QuakeCamera.js"></script>
-		<script src="../src/extras/geometries/CubeGeometry.js"></script>
-		<script src="../src/extras/geometries/CylinderGeometry.js"></script>
-		<script src="../src/extras/geometries/ExtrudeGeometry.js"></script>
-		<script src="../src/extras/geometries/IcosahedronGeometry.js"></script>
-		<script src="../src/extras/geometries/LatheGeometry.js"></script>
-		<script src="../src/extras/geometries/PlaneGeometry.js"></script>
-		<script src="../src/extras/geometries/SphereGeometry.js"></script>
-		<script src="../src/extras/geometries/TextGeometry.js"></script>
-		<script src="../src/extras/geometries/TorusGeometry.js"></script>
-		<script src="../src/extras/geometries/TorusKnotGeometry.js"></script>
-		<script src="../src/extras/loaders/Loader.js"></script>
-		<script src="../src/extras/loaders/BinaryLoader.js"></script>
-		<script src="../src/extras/loaders/ColladaLoader.js"></script>
-		<script src="../src/extras/loaders/JSONLoader.js"></script>
-		<script src="../src/extras/loaders/SceneLoader.js"></script>
-		<script src="../src/extras/loaders/UTF8Loader.js"></script>
-		<script src="../src/extras/objects/MarchingCubes.js"></script>
-		<script src="../src/extras/objects/Trident.js"></script>
-		<script src="../src/extras/physics/Collisions.js"></script>
-		<script src="../src/extras/physics/CollisionUtils.js"></script>
-		<script src="../src/extras/renderers/AnaglyphWebGLRenderer.js"></script>
-		<script src="../src/extras/renderers/CrosseyedWebGLRenderer.js"></script>
+		<script src="../build/Three.js"></script>
 
 		<script src="js/RequestAnimationFrame.js"></script>
 		<script src="js/Stats.js"></script>
@@ -165,6 +59,7 @@
 				camera = new THREE.Camera( 45, window.innerWidth / window.innerHeight, 1, 10000 );
 				camera.position.y = 150;
 				camera.position.z = 400;
+				camera.useTarget = true;
 				camera.target.position.y = 150;
 
 				scene = new THREE.Scene();

+ 1 - 2
examples/misc_camera_path.html

@@ -78,8 +78,7 @@
 					verticalAngleMap:   { srcRange: [ 0, 2 * Math.PI ], dstRange: [ 1.1, 3.8 ] },
 					horizontalAngleMap: { srcRange: [ 0, 2 * Math.PI ], dstRange: [ 0.3, Math.PI - 0.3 ] }
 
-				 } );
-
+				} );
 
 				camera.lon = 180;
 

+ 1 - 1
examples/misc_lights_test.html

@@ -81,7 +81,7 @@
 
 				camera = new THREE.Camera( 75, SCREEN_WIDTH / SCREEN_HEIGHT, 1, 100000 );
 				camera.position.z = 500;
-				camera.updateMatrix();
+				camera.useTarget = true;
 
 				scene = new THREE.Scene();
 

+ 1 - 0
examples/misc_lookat.html

@@ -62,6 +62,7 @@
 
 				camera = new THREE.Camera( 60, window.innerWidth / window.innerHeight, 1, 10000 );
 				camera.position.z = 3200;
+				camera.useTarget = true;
 
 				scene = new THREE.Scene();
 

+ 1 - 5
examples/misc_materials_multimaterials.html

@@ -89,7 +89,7 @@
 
 				camera = new THREE.Camera( 75, SCREEN_WIDTH / SCREEN_HEIGHT, 1, 100000 );
 				camera.position.z = 500;
-				camera.updateMatrix();
+				camera.useTarget = true;
 
 				scene = new THREE.Scene();
 
@@ -222,7 +222,6 @@
 				zmesh.position.y = FLOOR;
 				zmesh.scale.x = zmesh.scale.y = zmesh.scale.z = 3;
 				zmesh.overdraw = true;
-				zmesh.updateMatrix();
 				scene.add(zmesh);
 
 				// PLANES with all materials from the model
@@ -242,7 +241,6 @@
 					mesh.position.z = -100;
 					mesh.scale.x = mesh.scale.y = mesh.scale.z = 1;
 					mesh.doubleSided = true;
-					mesh.updateMatrix();
 					scene.add(mesh);
 
 					// number
@@ -264,7 +262,6 @@
 					mesh.position.z = - 99;
 					mesh.scale.x = mesh.scale.y = mesh.scale.z = 1;
 					mesh.doubleSided = true;
-					mesh.updateMatrix();
 					scene.add(mesh);
 				}
 
@@ -292,7 +289,6 @@
 
 				camera.position.x += ( mouseX - camera.position.x ) * .05;
 				camera.position.y += ( - mouseY - camera.position.y ) * .05;
-				camera.updateMatrix();
 
 				if ( render_canvas ) canvasRenderer.render( scene, camera );
 				if ( render_gl && has_gl ) webglRenderer.render( scene, camera );

+ 2 - 3
examples/misc_ubiquity_test.html

@@ -48,9 +48,8 @@
 				document.body.appendChild(container);
 
 				camera = new THREE.Camera( 75, SCREEN_WIDTH / SCREEN_HEIGHT, 1, 100000 );
-				// camera.position.x = - 5000;
-				// camera.position.y = 50000;
-				camera.position.z = 500
+				camera.position.z = 500;
+				camera.useTarget = true;
 
 				scene = new THREE.Scene();
 

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 0 - 1
examples/models/animated/horse.js


+ 8 - 7
examples/obj/cubecolors/cube_fvc.js

@@ -1,5 +1,5 @@
 /*
- * File generated with Blender 2.56 Exporter
+ * File generated with Blender 2.59 Exporter
  * https://github.com/mrdoob/three.js/tree/master/utils/exporters/blender/
  *
  * vertices: 8
@@ -8,16 +8,16 @@
  * uvs: 0
  * colors: 22
  * materials: 1
- * edges: 0
+ * morphTargets: 0
  *
  */
 
 var model = {
 
     "version" : 2,
-    
+
     "scale" : 1.000000,
-    
+
     "materials": [	{
 	"DbgColor" : 15658734,
 	"DbgIndex" : 0,
@@ -25,12 +25,13 @@ var model = {
 	"colorAmbient" : [0.0, 0.0, 0.0],
 	"colorDiffuse" : [0.800000011920929, 0.800000011920929, 0.800000011920929],
 	"colorSpecular" : [0.5, 0.5, 0.5],
+	"shading" : "Lambert",
 	"specularCoef" : 50,
 	"transparency" : 1.0,
 	"vertexColors" : true
 	}],
 
-    "vertices": [1.000000,-1.000000,-1.000000,1.000000,-1.000000,1.000000,-1.000000,-1.000000,1.000000,-1.000000,-1.000000,-1.000000,1.000000,1.000000,-1.000000,0.999999,1.000000,1.000001,-1.000000,1.000000,1.000000,-1.000000,1.000000,-1.000000],
+    "vertices": [1.000000,-1.000000,-1.000000,1.000000,-1.000000,1.000000,-1.000000,-1.000000,1.000000,-1.000000,-1.000000,-1.000000,1.000000,1.000000,-1.000000,0.999999,1.000000,1.000000,-1.000000,1.000000,0.999999,-1.000000,1.000000,-1.000000],
 
     "morphTargets": [],
 
@@ -40,9 +41,9 @@ var model = {
 
     "uvs": [[]],
 
-    "faces": [131,0,1,2,3,0,0,1,2,3,131,4,7,6,5,0,4,5,6,7,131,0,4,5,1,0,0,8,9,10,131,1,5,6,2,0,0,11,12,13,131,2,6,7,3,0,14,15,16,17,131,4,0,3,7,0,18,19,20,21],
+    "faces": [131,0,1,2,3,0,0,1,2,3,131,4,7,6,5,0,4,5,6,7,131,0,4,5,1,0,0,8,9,10,131,1,5,6,2,0,0,11,12,13,131,2,6,7,3,0,14,15,16,17,131,4,0,3,7,0,18,19,20,21]
+
 
-    "edges" : []
 
 };
 

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 5 - 4
examples/obj/cubecolors/cubecolors.js


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 13 - 14
examples/obj/female02/Female02_slim.js


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 1 - 2
examples/obj/lucy/Lucy100k_slim.js


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 11 - 12
examples/obj/male02/Male02_slim.js


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 2 - 3
examples/obj/walt/WaltHead_slim.js


+ 1 - 0
examples/webgl_animation_skinning.html

@@ -78,6 +78,7 @@
 				camera = new THREE.Camera( 25, window.innerWidth / height, 1, 10000 );
 				camera.position.y = 185;
 				camera.position.z = 2500;
+				camera.useTarget = true;
 
 				scene = new THREE.Scene();
 				scene.fog = new THREE.FogExp2( 0xffffff, 0.0003 );

+ 1 - 0
examples/webgl_collada.html

@@ -54,6 +54,7 @@
 				camera.position.x = 2;
 				camera.position.y = 2;
 				camera.position.z = 3;
+				camera.useTarget = true;
 
 				scene = new THREE.Scene();
 

+ 2 - 1
examples/webgl_collisions_box.html

@@ -55,7 +55,8 @@
 				info = document.getElementById("info");
 
 				camera = new THREE.Camera( 40, window.innerWidth / window.innerHeight, 1, 10000 );
-				camera.position.z = -500;
+				camera.position.z = - 500;
+				camera.useTarget = true;
 
 				scene = new THREE.Scene();
 

+ 35 - 43
examples/webgl_collisions_mesh.html

@@ -11,7 +11,7 @@
 				margin: 0px;
 				overflow: hidden;
 			}
-			 
+
 			#oldie { background-color: #ddd !important }
 
 			#info {
@@ -36,7 +36,7 @@
 				z-index:100;
 			}
 		</style>
-		 
+
 		<script src="../build/Three.js"></script> 
 		<script src="js/RequestAnimationFrame.js"></script>
 		<script src="js/Stats.js"></script>
@@ -57,13 +57,14 @@
 
 				container = document.createElement( 'div' );
 				document.body.appendChild( container );
-	
+
 				info = document.getElementById("info");
-	
+
 				camera = new THREE.Camera( 40, window.innerWidth / window.innerHeight, 1, 10000 );
 				camera.position.z = camdist;
-	
-				loader = new THREE.JSONLoader(  );
+				camera.useTarget = true;
+
+				loader = new THREE.JSONLoader();
 
 				scene = new THREE.Scene();
 
@@ -72,14 +73,14 @@
 				renderer = new THREE.WebGLRenderer();
 				renderer.setSize( window.innerWidth, window.innerHeight );
 				container.appendChild( renderer.domElement );
-	
+
 				var ambientLight = new THREE.AmbientLight( 0x606060 );
 				scene.add( ambientLight );
 
 				sun = new THREE.DirectionalLight( 0xffffff );
 				sun.position = camera.position.clone();
 				scene.add( sun );
-	
+
 				loadCube();
 
 				stats = new Stats();
@@ -95,65 +96,64 @@
 			function loadCube(p) {
 
 				var onGeometry = function( geometry ) {	
-	
+
 					var sx = 300;
 					var sy = 240;
 					var sz = 300;
-		
+
 					addCube( new THREE.Vector3(-sx,	0,	0), geometry );
 					addCube( new THREE.Vector3(	0,	0,	0), geometry );
 					addCube( new THREE.Vector3( sx,	0,	0), geometry );
-		
+
 					addCube( new THREE.Vector3(-sx, sy,	0), geometry );
 					addCube( new THREE.Vector3(	0,  sy,	0), geometry );
 					addCube( new THREE.Vector3( sx, sy,	0), geometry );
-		
+
 					addCube( new THREE.Vector3(-sx,-sy,	0), geometry );
 					addCube( new THREE.Vector3(	0, -sy,	0), geometry );
 					addCube( new THREE.Vector3( sx,-sy,	0), geometry );
-		
+
 					addCube( new THREE.Vector3(-sx,	0,	sz), geometry );
 					addCube( new THREE.Vector3(	0,	0,	sz), geometry );
 					addCube( new THREE.Vector3( sx,	0,	sz), geometry );
-		
+
 					addCube( new THREE.Vector3(-sx, sy,	sz), geometry );
 					addCube( new THREE.Vector3(	0,  sy,	sz), geometry );
 					addCube( new THREE.Vector3( sx, sy,	sz), geometry );
-		
+
 					addCube( new THREE.Vector3(-sx,-sy,	sz), geometry );
 					addCube( new THREE.Vector3(	0, -sy,	sz), geometry );
 					addCube( new THREE.Vector3( sx,-sy,	sz), geometry );
-		
+
 					addCube( new THREE.Vector3(-sx,	0,	-sz), geometry );
 					addCube( new THREE.Vector3(	0,	0,	-sz), geometry );
 					addCube( new THREE.Vector3( sx,	0,	-sz), geometry );
-		
+
 					addCube( new THREE.Vector3(-sx, sy,	-sz), geometry );
 					addCube( new THREE.Vector3(	0,  sy,	-sz), geometry );
 					addCube( new THREE.Vector3( sx, sy,	-sz), geometry );
-		
+
 					addCube( new THREE.Vector3(-sx,-sy,	-sz), geometry );
 					addCube( new THREE.Vector3(	0, -sy,	-sz), geometry );
 					addCube( new THREE.Vector3( sx,-sy,	-sz), geometry );
-		
+
 					addCube( new THREE.Vector3(-sx,	0,	-sz*2), geometry );
 					addCube( new THREE.Vector3(	0,	0,	-sz*2), geometry );
 					addCube( new THREE.Vector3( sx,	0,	-sz*2), geometry );
-		
+
 					addCube( new THREE.Vector3(-sx, sy,	-sz*2), geometry );
 					addCube( new THREE.Vector3(	0,  sy,	-sz*2), geometry );
 					addCube( new THREE.Vector3( sx, sy,	-sz*2), geometry );
-		
+
 					addCube( new THREE.Vector3(-sx,-sy,	-sz*2), geometry );
 					addCube( new THREE.Vector3(	0, -sy,	-sz*2), geometry );
 					addCube( new THREE.Vector3( sx,-sy,	-sz*2), geometry );
-		
-					// info.innerHTML = "Total colliders: " + totalColliders + " (Faces: " + totalFaces + ")<br>";
-	
+
 				};
 
-	
+
 				loader.load( { model: "obj/suzanne/suzanneHi.js", callback: onGeometry } );
+
 			}
 
 			function addCube( p, g) {
@@ -163,15 +163,7 @@
 
 				var mesh = new THREE.Mesh( g, new THREE.MeshLambertMaterial( { color: 0x003300 } ) );
 				mesh.position = p;
-	
-				//mesh.rotation.x = Math.random() * Math.PI;
-				//mesh.rotation.y = Math.random() * Math.PI;
-				//mesh.rotation.z = Math.random() * Math.PI;
-	
-				//mesh.scale.x = Math.random() + 0.5;
-				//mesh.scale.y = Math.random() + 0.5;
-				//mesh.scale.z = Math.random() + 0.5;
-	
+
 				scene.add( mesh );
 				var mc = THREE.CollisionUtils.MeshColliderWBox(mesh);
 				THREE.Collisions.colliders.push( mc );
@@ -191,11 +183,11 @@
 			function animate() {
 
 				requestAnimationFrame( animate );
-	
+
 				if( meshes.length == 0 ) return;
-	
+
 				var i, l = meshes.length;
-	
+
 				for ( i = 0; i < l; i++ ) {
 
 					meshes[ i ].materials[ 0 ].color.setHex( 0x003300 );
@@ -208,14 +200,14 @@
 				var ray = new THREE.Ray( camera.position, vector.subSelf( camera.position ).normalize() );
 
 				var c = THREE.Collisions.rayCastNearest( ray );
-	
+
 				if( c ) {
-	
+
 					//info.innerHTML += "Found @ distance " + c.distance;
 					c.mesh.materials[ 0 ].color.setHex( 0xbb0000 );
 
 				} else {
-	
+
 					//info.innerHTML += "No intersection";
 
 				}
@@ -227,12 +219,12 @@
 				sun.position.copy( camera.position );
 				sun.position.normalize();
 
-				theta += 0.005;		
+				theta += 0.005;
 
 				renderer.render( scene, camera );
-	
+
 				stats.update();
-	
+
 			};
 
 			function vts(v) {

+ 27 - 26
examples/webgl_collisions_normal.html

@@ -11,7 +11,7 @@
 				margin: 0px;
 				overflow: hidden;
 			}
-			 
+
 			#oldie { background-color: #ddd !important }
 
 			#info {
@@ -36,7 +36,7 @@
 				z-index:100;
 			}
 		</style>
-		 
+
 		<script src="../build/Three.js"></script> 
 		<script src="js/RequestAnimationFrame.js"></script>
 		<script src="js/Stats.js"></script>
@@ -57,12 +57,13 @@
 
 				container = document.createElement( 'div' );
 				document.body.appendChild( container );
-	
+
 				info = document.getElementById("info");
-	
+
 				camera = new THREE.Camera( 40, window.innerWidth / window.innerHeight, 1, 10000 );
 				camera.position.z = camdist;
-	
+				camera.useTarget = true;
+
 				loader = new THREE.JSONLoader(  );
 
 				scene = new THREE.Scene();
@@ -72,22 +73,22 @@
 				renderer = new THREE.WebGLRenderer();
 				renderer.setSize( window.innerWidth, window.innerHeight );
 				container.appendChild( renderer.domElement );
-	
+
 				var ambientLight = new THREE.AmbientLight( 0x606060 );
 				scene.add( ambientLight );
 
 				sun = new THREE.DirectionalLight( 0xffffff );
 				sun.position = camera.position.clone();
 				scene.add( sun );
-	
+
 				loadCube();
-	
+
 				var lineMat = new THREE.LineBasicMaterial( { color: 0xff0000, opacity: 1, linewidth: 3 } );
-	
+
 				var geom = new THREE.Geometry();
 				geom.vertices.push( new THREE.Vertex( new THREE.Vector3(-100, 0, 0) ) );
 				geom.vertices.push( new THREE.Vertex( new THREE.Vector3( 100, 0, 0) ) );
-	
+
 				line = new THREE.Line(geom, lineMat);
 				scene.add( line );
 
@@ -104,16 +105,16 @@
 			function loadCube(p) {
 
 				var onGeometry = function( geometry ) {	
-	
+
 					var sx = 300;
 					var sy = 240;
 					var sz = 300;
-		
+
 					addCube( new THREE.Vector3(	0,	0,	0), geometry );
-		
+
 				};
 
-	
+
 				loader.load( { model: "obj/suzanne/suzanneHi.js", callback: onGeometry } );
 			}
 
@@ -149,34 +150,34 @@
 				projector.unprojectVector( vector, camera );
 
 				var ray = new THREE.Ray( camera.position, vector.subSelf( camera.position ).normalize() );
-	
+
 				if ( meshes.length == 0 ) return;
-	
+
 				var i, l = meshes.length;
-	
+
 				for ( i = 0; i < l; i++ ) {
 					meshes[ i ].materials[ 0 ].color.setHex( 0x003300 );
 				}
-	
+
 				info.innerHTML = "";
 
 
 				var c = THREE.Collisions.rayCastNearest( ray );
-	
+
 				if( c ) {
-	
+
 					info.innerHTML += "Found @ normal " + vts(c.normal);
-		
+
 					var poi = ray.origin.clone().addSelf( ray.direction.clone().multiplyScalar(c.distance) );
 					line.geometry.vertices[0].position = poi;
 					line.geometry.vertices[1].position = poi.clone().addSelf(c.normal.multiplyScalar(100));
 					line.geometry.__dirtyVertices = true; 
 					line.geometry.__dirtyElements = true;
-		
+
 					c.mesh.materials[ 0 ].color.setHex( 0xbb0000 );
 
 				} else {
-	
+
 					info.innerHTML += "No intersection";
 
 				}
@@ -188,12 +189,12 @@
 				sun.position.copy( camera.position );
 				sun.position.normalize();
 
-				theta += 0.005;		
+				theta += 0.005;
 
 				renderer.render( scene, camera );
-	
+
 				stats.update();
-	
+
 			};
 
 			function vts(v) {

+ 1 - 4
examples/webgl_collisions_primitives.html

@@ -63,6 +63,7 @@
 				info = document.getElementById("info");
 
 				camera = new THREE.Camera(40, window.innerWidth / window.innerHeight, 1, 10000);
+				camera.useTarget = true;
 
 				scene = new THREE.Scene();
 
@@ -78,15 +79,11 @@
 				sun = new THREE.DirectionalLight(0xffffff);
 				scene.add(sun);
 
-				//makeWall(480);
-				//makeWall(360);
 				makeWall(240);
 				makeWall(120);
 				makeWall(0);
 				makeWall(-120);
 				makeWall(-240);
-				//makeWall(-360);
-				//makeWall(-480);
 
 				plane = new THREE.Mesh( new THREE.PlaneGeometry( 30000, 30000, 10, 10 ), new THREE.MeshLambertMaterial( { color: 0x003300 } ) );
 				plane.position.y = - 480;

+ 2 - 0
examples/webgl_collisions_reaction.html

@@ -65,6 +65,8 @@
 				camera.position.y = 120;
 				camera.position.x = 300;
 				camera.position.z = 0;
+				camera.useTarget = true;
+
 				mouse2d = new THREE.Vector3(0, 0, 1);
 
 				loader = new THREE.Loader(true);

+ 2 - 0
examples/webgl_collisions_terrain.html

@@ -57,6 +57,8 @@
 
 				camera = new THREE.Camera( 40, window.innerWidth / window.innerHeight, 1, 10000 );
 				camera.position.y = 120;
+				camera.useTarget = true;
+
 				mouse2d = new THREE.Vector3( 0, 0, 1 );
 
 				loader = new THREE.JSONLoader();

+ 1 - 0
examples/webgl_collisions_trigger.html

@@ -65,6 +65,7 @@
 				camera.position.y = 120;
 				camera.position.x = 300;
 				camera.position.z = 0;
+				camera.useTarget = true;
 
 				mouse2d = new THREE.Vector3( 0, 0, 1 );
 

+ 1 - 0
examples/webgl_geometries.html

@@ -42,6 +42,7 @@
 				camera = new THREE.Camera( 45, window.innerWidth / window.innerHeight, 1, 2000 );
 				camera.position.y = 200;
 				camera.position.z = 800;
+				camera.useTarget = true;
 
 				scene = new THREE.Scene();
 

+ 1 - 0
examples/webgl_geometry_blenderexport_colors.html

@@ -64,6 +64,7 @@
 
 				camera = new THREE.Camera( 40, window.innerWidth / window.innerHeight, 1, 10000 );
 				camera.position.z = 1800;
+				camera.useTarget = true;
 
 				scene = new THREE.Scene();
 

+ 1 - 0
examples/webgl_geometry_colors.html

@@ -64,6 +64,7 @@
 
 				camera = new THREE.Camera( 20, window.innerWidth / window.innerHeight, 1, 10000 );
 				camera.position.z = 1800;
+				camera.useTarget = true;
 
 				scene = new THREE.Scene();
 

+ 1 - 0
examples/webgl_geometry_hierarchy.html

@@ -46,6 +46,7 @@
 
 				camera = new THREE.Camera( 60, window.innerWidth / window.innerHeight, 1, 10000 );
 				camera.position.z = 500;
+				camera.useTarget = true;
 
 				scene = new THREE.Scene();
 				scene.fog = new THREE.Fog( 0xffffff, 1, 10000 );

+ 1 - 0
examples/webgl_geometry_hierarchy2.html

@@ -46,6 +46,7 @@
 
 				camera = new THREE.Camera( 60, window.innerWidth / window.innerHeight, 1, 10000 );
 				camera.position.z = 500;
+				camera.useTarget = true;
 
 				scene = new THREE.Scene();
 				scene.fog = new THREE.Fog( 0xffffff, 1, 10000 );

+ 1 - 7
examples/webgl_geometry_large_mesh.html

@@ -96,8 +96,6 @@
 				mesh.rotation.x = rx;
 				mesh.rotation.y = ry;
 				mesh.rotation.z = rz;
-				mesh.overdraw = true;
-				mesh.updateMatrix();
 				scene.add(mesh);
 
 			}
@@ -109,7 +107,7 @@
 
 				camera = new THREE.Camera( 50, SCREEN_WIDTH / SCREEN_HEIGHT, 1, 100000 );
 				camera.position.z = 1500;
-				camera.updateMatrix();
+				camera.useTarget = true;
 
 				scene = new THREE.Scene();
 
@@ -136,8 +134,6 @@
 				lightMesh = new THREE.Mesh( sphere, new THREE.MeshBasicMaterial( { color: 0xffaa00 } ) );
 				lightMesh.scale.x = lightMesh.scale.y = lightMesh.scale.z = 0.05;
 				lightMesh.position = pointLight.position;
-				lightMesh.overdraw = true;
-				lightMesh.updateMatrix();
 				scene.add( lightMesh );
 
 
@@ -222,11 +218,9 @@
 
 				camera.position.x += ( mouseX - camera.position.x ) * .05;
 				camera.position.y += ( - mouseY - camera.position.y ) * .05;
-				camera.updateMatrix();
 
 				lightMesh.position.x = 700*Math.cos(r);
 				lightMesh.position.z = 700*Math.sin(r);
-				lightMesh.updateMatrix();
 
 				r += 0.01;
 

+ 0 - 1
examples/webgl_geometry_shapes.html

@@ -58,7 +58,6 @@
 				camera = new THREE.Camera( 50, window.innerWidth / window.innerHeight, 1, 1000 );
 				camera.position.y = 150;
 				camera.position.z = 500;
-				camera.target.position.y = 150;
 
 				scene = new THREE.Scene();
 

+ 2 - 1
examples/webgl_geometry_text.html

@@ -164,7 +164,8 @@
 				camera = new THREE.Camera( 30, window.innerWidth / window.innerHeight, 1, 1500 );
 				camera.position.y = 400;
 				camera.position.z = 700;
-				camera.target.position.y = 100;
+				camera.useTarget = true;
+				camera.target.position.y = 150;
 
 				// SCENE
 

+ 1 - 0
examples/webgl_interactive_cubes.html

@@ -46,6 +46,7 @@
 				camera = new THREE.Camera( 70, window.innerWidth / window.innerHeight, 1, 10000 );
 				camera.position.y = 300;
 				camera.position.z = 500;
+				camera.useTarget = true;
 
 				scene = new THREE.Scene();
 

+ 1 - 0
examples/webgl_interactive_voxelpainter.html

@@ -56,6 +56,7 @@
 
 				camera = new THREE.Camera( 40, window.innerWidth / window.innerHeight, 1, 10000 );
 				camera.position.y = 800;
+				camera.useTarget = true;
 				camera.target.position.y = 200;
 
 				scene = new THREE.Scene();

+ 1 - 12
examples/webgl_lights_pointlights.html

@@ -43,7 +43,6 @@
 
 		<script src="js/Detector.js"></script>
 		<script src="js/RequestAnimationFrame.js"></script>
-		<script src="js/Stats.js"></script>
 
 		<script>
 
@@ -52,7 +51,7 @@
 			var camera, scene, renderer,
 			particle1, particle2, particle2,
 			light1, light2, light3, light4,
-			object,loader;
+			object, loader;
 
 			init();
 			animate();
@@ -66,7 +65,6 @@
 
 				scene = new THREE.Scene();
 
-				//loader = new THREE.JSONLoader( true );
 				loader = new THREE.BinaryLoader( true );
 				document.body.appendChild( loader.statusDomElement );
 
@@ -118,13 +116,6 @@
 				renderer.setSize( window.innerWidth, window.innerHeight );
 				container.appendChild( renderer.domElement );
 
-
-				stats = new Stats();
-				stats.domElement.style.position = 'absolute';
-				stats.domElement.style.top = '0px';
-				stats.domElement.style.zIndex = 100;
-				//container.appendChild( stats.domElement );
-
 			}
 
 			//
@@ -135,8 +126,6 @@
 
 				render();
 
-				stats.update();
-
 			}
 
 			function render() {

+ 1 - 0
examples/webgl_lines_colors.html

@@ -81,6 +81,7 @@
 
 				camera = new THREE.Camera( 33, window.innerWidth / window.innerHeight, 1, 10000 );
 				camera.position.z = 700;
+				camera.useTarget = true;
 
 				scene = new THREE.Scene();
 

+ 1 - 0
examples/webgl_lines_cubes.html

@@ -73,6 +73,7 @@
 
 				camera = new THREE.Camera( 33, window.innerWidth / window.innerHeight, 1, 10000 );
 				camera.position.z = 700;
+				camera.useTarget = true;
 
 				scene = new THREE.Scene();
 

+ 1 - 0
examples/webgl_lines_sphere.html

@@ -77,6 +77,7 @@
 
 				camera = new THREE.Camera( 80, SCREEN_WIDTH / SCREEN_HEIGHT, 1, 3000 );
 				camera.position.z = 1000;
+				camera.useTarget = true;
 
 				scene = new THREE.Scene();
 

+ 1 - 0
examples/webgl_lines_splines.html

@@ -73,6 +73,7 @@
 
 				camera = new THREE.Camera( 33, window.innerWidth / window.innerHeight, 1, 10000 );
 				camera.position.z = 700;
+				camera.useTarget = true;
 
 				scene = new THREE.Scene();
 

+ 1 - 0
examples/webgl_lod.html

@@ -69,6 +69,7 @@
 
 				camera = new THREE.Camera( 45, window.innerWidth / window.innerHeight, 1, 15000 );
 				camera.position.z = 1000;
+				camera.useTarget = true;
 
 				scene = new THREE.Scene();
 				scene.fog = new THREE.Fog( 0x000000, 1, 15000 );

+ 2 - 12
examples/webgl_lod_text.html

@@ -41,17 +41,6 @@
 		<script src="js/Detector.js"></script>
 		<script src="js/RequestAnimationFrame.js"></script>
 		<script src="js/Stats.js"></script>
-		
-		<!--
-		<script src="../src/extras/geometries/Curve.js"></script>
-		<script src="../src/extras/geometries/CurvePath.js"></script>
-		<script src="../src/extras/geometries/Path.js"></script>
-		<script src="../src/extras/geometries/Shape.js"></script>
-		<script src="../src/extras/geometries/TextPath.js"></script>		
-		<script src="../src/extras/geometries/ExtrudeGeometry.js"></script>
-		<script src="../src/extras/geometries/TextGeometry.js"></script>
-		-->
-
 
 		<!-- load the font file from canvas-text -->
 
@@ -84,6 +73,7 @@
 
 				camera = new THREE.Camera( 45, window.innerWidth / window.innerHeight, 1, 15000 );
 				camera.position.z = 1000;
+				camera.useTarget = true;
 
 				scene = new THREE.Scene();
 				scene.fog = new THREE.Fog( 0x000000, 1, 15000 );
@@ -98,7 +88,7 @@
 				scene.add( light );
 
 				var wireMaterial = new THREE.MeshLambertMaterial( { color: 0xffffff, opacity: 0.5, wireframe: true } );
-				
+
 				function getOptionsWithSegments(x,b, bevel) {
 					return {
 

+ 1 - 0
examples/webgl_materials.html

@@ -41,6 +41,7 @@
 				camera = new THREE.Camera( 45, window.innerWidth / window.innerHeight, 1, 2000 );
 				camera.position.y = 200;
 				camera.position.z = 800;
+				camera.useTarget = true;
 
 				scene = new THREE.Scene();
 

+ 2 - 2
examples/webgl_materials_cars.html

@@ -164,10 +164,10 @@
 				document.body.appendChild(container);
 
 				camera = new THREE.Camera( 70, window.innerWidth / window.innerHeight, 1, 100000 );
-				// camera.position.z = 1000;
-				camera.updateMatrix();
+				camera.useTarget = true;
 
 				cameraCube = new THREE.Camera( 70, window.innerWidth / window.innerHeight, 1, 100000 );
+				cameraCube.useTarget = true;
 
 				scene = new THREE.Scene();
 				sceneCube = new THREE.Scene();

+ 1 - 2
examples/webgl_materials_cars_anaglyph.html

@@ -163,8 +163,7 @@
 				document.body.appendChild(container);
 
 				camera = new THREE.Camera( 70, window.innerWidth / window.innerHeight, 1, 100000 );
-				// camera.position.z = 1000;
-				camera.updateMatrix();
+				camera.useTarget = true;
 
 				scene = new THREE.Scene();
 

+ 1 - 2
examples/webgl_materials_cars_camaro.html

@@ -70,7 +70,7 @@
 
 				camera = new THREE.Camera( 70, SCREEN_WIDTH / SCREEN_HEIGHT, 1, 100000 );
 				camera.position.z = 1000;
-				camera.updateMatrix();
+				camera.useTarget = true;
 
 				scene = new THREE.Scene();
 
@@ -98,7 +98,6 @@
 				lightMesh.scale.x = lightMesh.scale.y = lightMesh.scale.z = 0.05;
 				lightMesh.position = pointLight.position;
 				lightMesh.overdraw = true;
-				lightMesh.updateMatrix();
 				scene.add(lightMesh);
 
 

+ 2 - 4
examples/webgl_materials_cars_camaro_crosseyed.html

@@ -31,14 +31,13 @@
 				<a href="http://github.com/mrdoob/three.js" target="_blank">three.js</a> - webgl cube reflection demo. chevrolet camaro by <a href="http://www.turbosquid.com/3d-models/blender-camaro/411348" target="_blank">dskfnwn</a>
 					- O, P : change eye separation
 				</div>
-				
 			<div id="buttons"></div>
 		</div>
 
 		<div id="log"></div>
 
 		<script src="../build/Three.js"></script>
-		
+
 		<script src="js/Detector.js"></script>
 		<script src="js/RequestAnimationFrame.js"></script>
 		<script src="js/Stats.js"></script>
@@ -73,7 +72,7 @@
 
 				camera = new THREE.Camera( 70, SCREEN_WIDTH / SCREEN_HEIGHT, 1, 100000 );
 				camera.position.z = 1000;
-				camera.updateMatrix();
+				camera.useTarget = true;
 
 				scene = new THREE.Scene();
 
@@ -101,7 +100,6 @@
 				lightMesh.scale.x = lightMesh.scale.y = lightMesh.scale.z = 0.05;
 				lightMesh.position = pointLight.position;
 				lightMesh.overdraw = true;
-				lightMesh.updateMatrix();
 				scene.add(lightMesh);
 
 

+ 2 - 0
examples/webgl_materials_cubemap.html

@@ -74,8 +74,10 @@
 
 				camera = new THREE.Camera( 50, window.innerWidth / window.innerHeight, 1, 5000 );
 				camera.position.z = 2000;
+				camera.useTarget = true;
 
 				cameraCube = new THREE.Camera( 50, window.innerWidth / window.innerHeight, 1, 100 );
+				cameraCube.useTarget = true;
 
 				scene = new THREE.Scene();
 				sceneCube = new THREE.Scene();

+ 2 - 0
examples/webgl_materials_cubemap_balls_reflection.html

@@ -72,8 +72,10 @@
 
 				camera = new THREE.Camera( 60, window.innerWidth / window.innerHeight, 1, 100000 );
 				camera.position.z = 3200;
+				camera.useTarget = true;
 
 				cameraCube = new THREE.Camera( 60, window.innerWidth / window.innerHeight, 1, 100000 );
+				cameraCube.useTarget = true;
 
 				scene = new THREE.Scene();
 				sceneCube = new THREE.Scene();

+ 1 - 0
examples/webgl_materials_cubemap_balls_reflection_anaglyph.html

@@ -71,6 +71,7 @@
 
 				camera = new THREE.Camera( 60, window.innerWidth / window.innerHeight, 1, 100000 );
 				camera.position.z = 3200;
+				camera.useTarget = true;
 
 				scene = new THREE.Scene();
 

+ 2 - 0
examples/webgl_materials_cubemap_balls_refraction.html

@@ -71,8 +71,10 @@
 
 				camera = new THREE.Camera( 60, window.innerWidth / window.innerHeight, 1, 100000 );
 				camera.position.z = 3200;
+				camera.useTarget = true;
 
 				cameraCube = new THREE.Camera( 60, window.innerWidth / window.innerHeight, 1, 100000 );
+				cameraCube.useTarget = true;
 
 				scene = new THREE.Scene();
 				sceneCube = new THREE.Scene();

+ 1 - 0
examples/webgl_materials_cubemap_balls_refraction_crosseyed.html

@@ -73,6 +73,7 @@
 
 				camera = new THREE.Camera( 60, window.innerWidth / window.innerHeight, 1, 100000 );
 				camera.position.z = 3200;
+				camera.useTarget = true;
 
 				scene = new THREE.Scene();
 

+ 1020 - 0
examples/webgl_materials_cubemap_dynamic.html

@@ -0,0 +1,1020 @@
+<!DOCTYPE HTML>
+<html lang="en">
+	<head>
+		<title>three.js webgl - materials - dynamic cube reflection</title>
+		<meta charset="utf-8">
+		<style>
+			body {
+				background: #000;
+				color: #999;
+				padding: 0;
+				margin: 0;
+				overflow: hidden;
+				font-family: georgia;
+				font-size:1em;
+				text-align: center;
+			}
+			a { color: white }
+
+			#info { margin-top: 2em; }
+			#footer { width: 100%; margin: 2em auto; text-align: center; position: absolute; bottom: 0 }
+			#loading { color: orange; margin-top: 1em }
+
+			.h { color: skyblue }
+			.c { display: inline; margin-left: 1em }
+		</style>
+	</head>
+
+	<body>
+		<div id="info">
+			<a href="http://github.com/mrdoob/three.js" target="_blank">three.js</a> - webgl dynamic cube reflection demo -
+			veyron by <a href="http://artist-3d.com/free_3d_models/dnm/model_disp.php?uid=1129" target="_blank">Troyano</a> -
+			gallardo by <a href="http://artist-3d.com/free_3d_models/dnm/model_disp.php?uid=1711" target="_blank">machman_3d</a>
+		</div>
+
+		<div id="loading">Loading...</div>
+
+		<div id="container"></div>
+
+		<div id="footer">
+			cars control: <span class="h">WASD</span> / <span class="h">arrows</span>
+
+			<div class="c">cameras: <span class="h">1</span> / <span class="h">2</span> / <span class="h">3</span> / <span class="h">4</span>
+			/ <span class="h">5</span> / <span class="h">6</span>
+			</div>
+
+			<div class="c">
+			day / night: <span class="h">n</span>
+			</div>
+
+			<div class="c">
+			motion blur: <span class="h">b</span>
+			</div>
+		</div>
+
+		<script src="../build/Three.js"></script>
+
+		<script src="js/Detector.js"></script>
+		<script src="js/RequestAnimationFrame.js"></script>
+		<script src="js/Stats.js"></script>
+
+		<script src="js/ShaderExtras.js"></script>
+
+		<script src="js/postprocessing/EffectComposer.js"></script>
+		<script src="js/postprocessing/RenderPass.js"></script>
+		<script src="js/postprocessing/BloomPass.js"></script>
+		<script src="js/postprocessing/ShaderPass.js"></script>
+		<script src="js/postprocessing/MaskPass.js"></script>
+		<script src="js/postprocessing/SavePass.js"></script>
+
+		<script src="js/Car.js"></script>
+
+		<script>
+
+			if ( ! Detector.webgl ) Detector.addGetWebGLMessage();
+
+			var FOLLOW_CAMERA = false;
+
+			var MARGIN = 100;
+
+			var SCREEN_WIDTH = window.innerWidth;
+			var SCREEN_HEIGHT = window.innerHeight - 2 * MARGIN;
+
+			var SHADOW_MAP_WIDTH = 1024, SHADOW_MAP_HEIGHT = 1024;
+
+			var CUBE_HEIGHT = 0;
+
+			var container, stats;
+
+			var camera, scene, renderer;
+			var renderTarget, renderTargetParameters;
+
+			var spotLight, ambientLight;
+
+			var cubeCamera;
+
+			var oldTime = new Date().getTime();
+
+			var controlsGallardo = {
+
+				moveForward: false,
+				moveBackward: false,
+				moveLeft: false,
+				moveRight: false
+
+			};
+
+			var controlsVeyron = {
+
+				moveForward: false,
+				moveBackward: false,
+				moveLeft: false,
+				moveRight: false
+
+			};
+
+			var mlib;
+
+			var gallardo, veyron, currentCar;
+
+			var effectDirt, hblur, vblur, effectBloom, effectKeep, effectBlend, effectFXAA;
+
+			var config = {
+				"veyron"	: { r: 0.5,	 model: null, backCam: new THREE.Vector3( 550, 100, -1000 ) },
+				"gallardo"	: { r: 0.35, model: null, backCam: new THREE.Vector3( 550,   0, -1500 ) }
+			};
+
+			var flareA, flareB;
+			var sprites = [];
+
+			var ground, groundBasic;
+
+			var blur = false;
+
+			var v = 0.9, vdir = 1;
+
+			init();
+			animate();
+
+			function init() {
+
+				container = document.getElementById( 'container' );
+
+				// SCENE CAMERA
+
+				camera = new THREE.Camera( 18, SCREEN_WIDTH / SCREEN_HEIGHT, 1, 100000 );
+				camera.useTarget = true;
+				camera.position.set( 2000, 0, 2000 );
+
+				// SCENE
+
+				scene = new THREE.Scene();
+
+				scene.fog = new THREE.Fog( 0xffffff, 3000, 10000 );
+				scene.fog.color.setHSV( 0.51, 0.5, 0.9 );
+
+				createScene();
+
+				// LIGHTS
+
+				ambientLight = new THREE.AmbientLight( 0x555555 );
+				scene.add( ambientLight );
+
+				spotLight = new THREE.SpotLight( 0xffffff );
+				spotLight.position.set( 0, 1800, 1500 );
+				spotLight.target.position.set( 0, 0, 0 );
+				spotLight.castShadow = true;
+				scene.add( spotLight );
+
+				directionalLight2 = new THREE.PointLight( 0xff9900, 0.25 );
+				directionalLight2.position.set( 0.5, -1, 0.5 );
+				//directionalLight2.position.normalize();
+				//scene.add( directionalLight2 );
+
+				// RENDERER
+
+				renderer = new THREE.WebGLRenderer( { antialias: false } );
+
+				renderer.setSize( SCREEN_WIDTH, SCREEN_HEIGHT );
+				renderer.setClearColor( scene.fog.color, 1 );
+
+				renderer.domElement.style.position = "absolute";
+				renderer.domElement.style.top = MARGIN + "px";
+				renderer.domElement.style.left = "0px";
+
+				container.appendChild( renderer.domElement );
+
+				// SHADOW
+
+				renderer.shadowCameraNear = 2;
+				renderer.shadowCameraFar = camera.far;
+				renderer.shadowCameraFov = 50;
+
+				renderer.shadowMapBias = 0.003885;
+				renderer.shadowMapDarkness = 0.55;
+				renderer.shadowMapWidth = SHADOW_MAP_WIDTH;
+				renderer.shadowMapHeight = SHADOW_MAP_HEIGHT;
+
+				renderer.shadowMapEnabled = true;
+				//renderer.shadowMapSoft = false;
+
+				// STATS
+
+				stats = new Stats();
+				stats.domElement.style.position = 'absolute';
+				stats.domElement.style.top = '0px';
+				stats.domElement.style.zIndex = 100;
+				container.appendChild( stats.domElement );
+
+				stats.domElement.children[ 0 ].children[ 0 ].style.color = "#888";
+				stats.domElement.children[ 0 ].style.background = "#000";
+				stats.domElement.children[ 0 ].children[ 1 ].style.display = "none";
+
+				// CUBE CAMERA
+
+				cubeCamera = new THREE.CubeCamera( 1, 100000, CUBE_HEIGHT, 128 );
+
+				// MATERIALS
+
+				var cubeTarget = cubeCamera.renderTarget;
+
+				mlib = {
+
+					body: [],
+
+					"Chrome": 		new THREE.MeshLambertMaterial( { color: 0xffffff, envMap: cubeTarget  } ),
+					"ChromeN": 		new THREE.MeshLambertMaterial( { color: 0xffffff, envMap: cubeTarget, combine: THREE.MixOperation, reflectivity: 0.75  } ),
+					"Dark chrome": 	new THREE.MeshLambertMaterial( { color: 0x444444, envMap: cubeTarget } ),
+
+					"Black rough":	new THREE.MeshLambertMaterial( { color: 0x050505 } ),
+
+					"Dark glass":	new THREE.MeshLambertMaterial( { color: 0x101020, envMap: cubeTarget, opacity: 0.5, transparent: true } ),
+					"Orange glass":	new THREE.MeshLambertMaterial( { color: 0xffbb00, opacity: 0.5, transparent: true } ),
+					"Red glass": 	new THREE.MeshLambertMaterial( { color: 0xff0000, opacity: 0.5, transparent: true } ),
+
+					"Black metal":	new THREE.MeshLambertMaterial( { color: 0x222222, envMap: cubeTarget, combine: THREE.MultiplyOperation } ),
+					"Orange metal": new THREE.MeshLambertMaterial( { color: 0xff6600, envMap: cubeTarget, combine: THREE.MultiplyOperation } )
+
+				}
+
+				mlib.body.push( [ "Orange", new THREE.MeshLambertMaterial( { color: 0x883300, envMap: cubeTarget, combine: THREE.MixOperation, reflectivity: 0.1 } ) ] );
+				mlib.body.push( [ "Blue", 	new THREE.MeshLambertMaterial( { color: 0x113355, envMap: cubeTarget, combine: THREE.MixOperation, reflectivity: 0.1 } ) ] );
+				mlib.body.push( [ "Red", 	new THREE.MeshLambertMaterial( { color: 0x660000, envMap: cubeTarget, combine: THREE.MixOperation, reflectivity: 0.1 } ) ] );
+				mlib.body.push( [ "Black", 	new THREE.MeshLambertMaterial( { color: 0x000000, envMap: cubeTarget, combine: THREE.MixOperation, reflectivity: 0.2 } ) ] );
+				mlib.body.push( [ "White", 	new THREE.MeshLambertMaterial( { color: 0xffffff, envMap: cubeTarget, combine: THREE.MixOperation, reflectivity: 0.2 } ) ] );
+
+				mlib.body.push( [ "Carmine", new THREE.MeshPhongMaterial( { color: 0x770000, specular: 0xffaaaa, envMap: cubeTarget, combine: THREE.MultiplyOperation } ) ] );
+				mlib.body.push( [ "Gold", 	 new THREE.MeshPhongMaterial( { color: 0xaa9944, specular: 0xbbaa99, shininess: 50, envMap: cubeTarget, combine: THREE.MultiplyOperation } ) ] );
+				mlib.body.push( [ "Bronze",  new THREE.MeshPhongMaterial( { color: 0x150505, specular: 0xee6600, shininess: 10, envMap: cubeTarget, combine: THREE.MixOperation, reflectivity: 0.2 } ) ] );
+				mlib.body.push( [ "Chrome",  new THREE.MeshPhongMaterial( { color: 0xffffff, specular: 0xffffff, envMap: cubeTarget, combine: THREE.MultiplyOperation } ) ] );
+
+				// FLARES
+
+				flareA = THREE.ImageUtils.loadTexture( "textures/lensflare2.jpg" );
+				flareB = THREE.ImageUtils.loadTexture( "textures/lensflare0.png" );
+
+				// CARS - VEYRON
+
+				veyron = new THREE.Car();
+
+				veyron.modelScale = 3;
+				veyron.backWheelOffset = 2;
+
+				veyron.callback = function( object ) {
+
+					addCar( object, -300, -215, 0, 0 );
+					setMaterialsVeyron( object );
+
+					var sa = 2, sb = 5;
+
+					var params  = {
+
+						"a" : { map: flareA, useScreenCoordinates: false, color: 0xffffff, blending: THREE.AdditiveBlending },
+						"b" : { map: flareB, useScreenCoordinates: false, color: 0xffffff, blending: THREE.AdditiveBlending },
+
+						"ar" : { map: flareA, useScreenCoordinates: false, color: 0xff0000, blending: THREE.AdditiveBlending },
+						"br" : { map: flareB, useScreenCoordinates: false, color: 0xff0000, blending: THREE.AdditiveBlending }
+
+					};
+
+					var flares = [ // front
+								   [ "a", sa, [ 47, 38, 120 ] ], [ "a", sa, [ 40, 38, 120 ] ], [ "a", sa, [ 32, 38, 122 ] ],
+								   [ "b", sb, [ 47, 38, 120 ] ], [ "b", sb, [ 40, 38, 120 ] ], [ "b", sb, [ 32, 38, 122 ] ],
+
+								   [ "a", sa, [ -47, 38, 120 ] ], [ "a", sa, [ -40, 38, 120 ] ], [ "a", sa, [ -32, 38, 122 ] ],
+								   [ "b", sb, [ -47, 38, 120 ] ], [ "b", sb, [ -40, 38, 120 ] ], [ "b", sb, [ -32, 38, 122 ] ],
+
+								   // back
+								   [ "ar", sa, [ 22, 50, -123 ] ], [ "ar", sa, [ 32, 49, -123 ] ],
+								   [ "br", sb, [ 22, 50, -123 ] ], [ "br", sb, [ 32, 49, -123 ] ],
+
+								   [ "ar", sa, [ -22, 50, -123 ] ], [ "ar", sa, [ -32, 49, -123 ] ],
+								   [ "br", sb, [ -22, 50, -123 ] ], [ "br", sb, [ -32, 49, -123 ] ],
+
+								 ];
+
+					for ( var i = 0; i < flares.length; i ++ ) {
+
+						var p = params[ flares[ i ][ 0 ] ];
+
+						var s = flares[ i ][ 1 ];
+
+						var x = flares[ i ][ 2 ][ 0 ];
+						var y = flares[ i ][ 2 ][ 1 ];
+						var z = flares[ i ][ 2 ][ 2 ];
+
+						var sprite = new THREE.Sprite( p );
+
+						sprite.scale.set( s, s, s );
+						sprite.position.set( x, y, z );
+
+						object.bodyMesh.add( sprite );
+
+						sprites.push( sprite );
+
+					}
+
+					checkStatus();
+
+				};
+
+				veyron.loadPartsBinary( "obj/veyron/parts/veyron_body_bin.js", "obj/veyron/parts/veyron_wheel_bin.js" );
+
+				// CARS - GALLARDO
+
+				gallardo = new THREE.Car();
+
+				gallardo.modelScale = 2;
+				gallardo.backWheelOffset = 45;
+
+				gallardo.callback = function( object ) {
+
+					addCar( object, 300, -110, 0, -110 );
+					setMaterialsGallardo( object );
+
+					var sa = 2, sb = 5;
+
+					var params  = {
+
+						"a" : { map: flareA, useScreenCoordinates: false, color: 0xffffff, blending: THREE.AdditiveBlending },
+						"b" : { map: flareB, useScreenCoordinates: false, color: 0xffffff, blending: THREE.AdditiveBlending },
+
+						"ar" : { map: flareA, useScreenCoordinates: false, color: 0xff0000, blending: THREE.AdditiveBlending },
+						"br" : { map: flareB, useScreenCoordinates: false, color: 0xff0000, blending: THREE.AdditiveBlending }
+
+					};
+
+					var flares = [ // front
+								   [ "a", sa, [ 70, 10, 160 ] ], [ "a", sa, [ 66, -1, 175 ] ], [ "a", sa, [ 66, -1, 165 ] ],
+								   [ "b", sb, [ 70, 10, 160 ] ], [ "b", sb, [ 66, -1, 175 ] ], [ "b", sb, [ 66, -1, 165 ] ],
+
+								   [ "a", sa, [ -70, 10, 160 ] ], [ "a", sa, [ -66, -1, 175 ] ], [ "a", sa, [ -66, -1, 165 ] ],
+								   [ "b", sb, [ -70, 10, 160 ] ], [ "b", sb, [ -66, -1, 175 ] ], [ "b", sb, [ -66, -1, 165 ] ],
+
+								   // back
+								   [ "ar", sa, [ 61, 19, -185 ] ], [ "ar", sa, [ 55, 19, -185 ] ],
+								   [ "br", sb, [ 61, 19, -185 ] ], [ "br", sb, [ 55, 19, -185 ] ],
+
+								   [ "ar", sa, [ -61, 19, -185 ] ], [ "ar", sa, [ -55, 19, -185 ] ],
+								   [ "br", sb, [ -61, 19, -185 ] ], [ "br", sb, [ -55, 19, -185 ] ],
+								 ];
+
+
+					for ( var i = 0; i < flares.length; i ++ ) {
+
+						var p = params[ flares[ i ][ 0 ] ];
+
+						var s = flares[ i ][ 1 ];
+
+						var x = flares[ i ][ 2 ][ 0 ];
+						var y = flares[ i ][ 2 ][ 1 ];
+						var z = flares[ i ][ 2 ][ 2 ];
+
+						var sprite = new THREE.Sprite( p );
+
+						sprite.scale.set( s, s, s );
+						sprite.position.set( x, y, z );
+
+						object.bodyMesh.add( sprite );
+
+						sprites.push( sprite );
+
+					}
+
+					checkStatus();
+
+				};
+
+				gallardo.loadPartsBinary( "obj/gallardo/parts/gallardo_body_bin.js", "obj/gallardo/parts/gallardo_wheel_bin.js" );
+
+				//
+
+				config[ "gallardo" ].model = gallardo;
+				config[ "veyron" ].model = veyron;
+
+				currentCar = gallardo;
+
+				// EVENTS
+
+				document.addEventListener( 'keydown', onKeyDown, false );
+				document.addEventListener( 'keyup', onKeyUp, false );
+
+				window.addEventListener( 'resize', onWindowResize, false );
+
+				// POSTPROCESSING
+
+				renderer.autoClear = false;
+
+				renderTargetParameters = { minFilter: THREE.LinearFilter, magFilter: THREE.LinearFilter, format: THREE.RGBFormat, stencilBufer: false };
+				renderTarget = new THREE.WebGLRenderTarget( SCREEN_WIDTH, SCREEN_HEIGHT, renderTargetParameters );
+
+				effectSave = new THREE.SavePass( new THREE.WebGLRenderTarget( SCREEN_WIDTH, SCREEN_HEIGHT, renderTargetParameters ) );
+
+				effectBlend = new THREE.ShaderPass( THREE.ShaderExtras[ "blend" ], "tDiffuse1" );
+
+				effectFXAA = new THREE.ShaderPass( THREE.ShaderExtras[ "fxaa" ] );
+				var effectVignette = new THREE.ShaderPass( THREE.ShaderExtras[ "vignette" ] );
+				var effectBleach = new THREE.ShaderPass( THREE.ShaderExtras[ "bleachbypass" ] );
+				effectBloom = new THREE.BloomPass( 0.75 );
+
+				effectFXAA.uniforms[ 'resolution' ].value.set( 1 / SCREEN_WIDTH, 1 / SCREEN_HEIGHT );
+
+				// tilt shift
+
+				hblur = new THREE.ShaderPass( THREE.ShaderExtras[ "horizontalTiltShift" ] );
+				vblur = new THREE.ShaderPass( THREE.ShaderExtras[ "verticalTiltShift" ] );
+
+				var bluriness = 7;
+
+				hblur.uniforms[ 'h' ].value = bluriness / SCREEN_WIDTH;
+				vblur.uniforms[ 'v' ].value = bluriness / SCREEN_HEIGHT;
+
+				if ( FOLLOW_CAMERA ) {
+
+					if ( currentCar == gallardo ) {
+
+						hblur.uniforms[ 'r' ].value = vblur.uniforms[ 'r' ].value = rMap[ "gallardo" ];
+
+					} else if ( currentCar == veyron ) {
+
+						hblur.uniforms[ 'r' ].value = vblur.uniforms[ 'r' ].value = rMap[ "veyron" ];
+
+					}
+
+				} else {
+
+					hblur.uniforms[ 'r' ].value = vblur.uniforms[ 'r' ].value = 0.35;
+
+				}
+
+				effectVignette.uniforms[ "offset" ].value = 1.05;
+				effectVignette.uniforms[ "darkness" ].value = 1.5;
+
+				// motion blur
+
+				effectBlend.uniforms[ 'tDiffuse2' ].texture = effectSave.renderTarget;
+				effectBlend.uniforms[ 'mixRatio' ].value = 0.65;
+
+				var renderModel = new THREE.RenderPass( scene, camera );
+
+				effectVignette.renderToScreen = true;
+
+				composer = new THREE.EffectComposer( renderer, renderTarget );
+
+				composer.addPass( renderModel );
+
+				composer.addPass( effectFXAA );
+
+				composer.addPass( effectBlend );
+				composer.addPass( effectSave );
+
+				composer.addPass( effectBloom );
+				composer.addPass( effectBleach );
+
+				composer.addPass( hblur );
+				composer.addPass( vblur );
+
+				composer.addPass( effectVignette );
+
+			}
+
+			//
+
+			function checkStatus() {
+
+				if ( gallardo.loaded && veyron.loaded ) {
+
+					document.getElementById( "loading" ).style.display = "none";
+
+				}
+
+			}
+
+			//
+
+			function setSpritesOpacity( opacity ) {
+
+				for ( var i = 0; i < sprites.length; i ++ ) {
+
+					sprites[ i ].opacity = opacity;
+
+				}
+
+			}
+
+			//
+
+
+			function createScene() {
+
+				// GROUND
+
+				var texture = THREE.ImageUtils.loadTexture( "textures/cube/Park3Med/ny.jpg" );
+				texture.wrapS = texture.wrapT = THREE.RepeatWrapping;
+				texture.repeat.set( 50, 50 );
+
+				groundBasic = new THREE.MeshBasicMaterial( { color: 0xffffff, map: texture } );
+				groundBasic.color.setHSV( 0.1, 0.45, 0.995 );
+
+				ground = new THREE.Mesh( new THREE.PlaneGeometry( 50000, 50000 ), groundBasic );
+				ground.rotation.x = - Math.PI / 2;
+				ground.position.y = - 215;
+				scene.add( ground );
+
+				ground.castShadow = false;
+				ground.receiveShadow = true;
+
+				// OBJECTS
+
+				var cylinderGeometry = new THREE.CylinderGeometry( 2, 50, 1000, 32 );
+				var sphereGeometry = new THREE.SphereGeometry( 100, 32, 16 );
+
+				var sy1 = -500 + 38;
+				var sy2 = -88;
+
+				addObject( cylinderGeometry, 0xff0000, 1500, 250, 0, sy1 );
+				addObject( cylinderGeometry, 0xffaa00, -1500, 250, 0, sy1 );
+				addObject( cylinderGeometry, 0x00ff00, 0, 250, 1500, sy1 );
+				addObject( cylinderGeometry, 0x00ffaa, 0, 250, -1500, sy1 );
+
+				addObject( sphereGeometry, 0xff0000, 1500, -125, 200, sy2 );
+				addObject( sphereGeometry, 0xffaa00, -1500, -125, 200, sy2 );
+				addObject( sphereGeometry, 0x00ff00, 200, -125, 1500, sy2 );
+				addObject( sphereGeometry, 0x00ffaa, 200, -125, -1500, sy2 );
+
+			}
+
+			//
+
+			function addObject( geometry, color, x, y, z, sy ) {
+
+				var object = new THREE.Mesh( geometry, new THREE.MeshLambertMaterial( { color: color } ) );
+				object.position.set( x, y, z );
+				scene.add( object );
+
+				object.castShadow = true;
+				object.receiveShadow = true;
+
+				var shadowTexture = THREE.ImageUtils.loadTexture( "textures/shadowAlpha.png" );
+
+				var shadowPlane = new THREE.PlaneGeometry( 400, 400 );
+				var shadowMaterial = new THREE.MeshBasicMaterial( { color: 0xff0000, opacity: 0.35, transparent: true,
+														  map: shadowTexture,
+														  polygonOffset: false, polygonOffsetFactor: -0.5, polygonOffsetUnits: 1 } );
+
+				var shadow = new THREE.Mesh( shadowPlane, shadowMaterial );
+				shadow.rotation.x = -Math.PI/2;
+				shadow.rotation.z = Math.PI/2;
+
+				shadow.position.y = sy;
+
+				object.add( shadow );
+
+			}
+
+			//
+
+			function generateDropShadowTexture( object, width, height, bluriness ) {
+
+				var renderTargetParameters = { minFilter: THREE.LinearMipmapLinearFilter, magFilter: THREE.LinearFilter, format: THREE.RGBAFormat, stencilBufer: false };
+				var shadowTarget = new THREE.WebGLRenderTarget( width, height, renderTargetParameters );
+
+				var shadowMaterial = new THREE.MeshBasicMaterial( { color: 0x000000 } );
+				var shadowGeometry = THREE.GeometryUtils.clone( object.geometry );
+
+				var shadowObject = new THREE.Mesh( shadowGeometry, shadowMaterial );
+
+				var shadowScene = new THREE.Scene();
+				shadowScene.add( shadowObject );
+
+				shadowObject.geometry.computeBoundingBox();
+
+				var bb = shadowObject.geometry.boundingBox;
+
+				var margin = 0.15,
+
+					width  = bb.z[ 1 ] - bb.z[ 0 ],
+					height = bb.x[ 1 ] - bb.x[ 0 ],
+					depth  = bb.y[ 1 ] - bb.y[ 0 ],
+
+					left   = bb.z[ 0 ] - margin * width,
+					right  = bb.z[ 1 ] + margin * width,
+
+					top    = bb.x[ 1 ] + margin * height,
+					bottom = bb.x[ 0 ] - margin * height,
+
+					near = bb.y[ 1 ] + margin * depth,
+					far  = bb.y[ 0 ] - margin * depth;
+
+				var topCamera = new THREE.OrthoCamera( left, right, top, bottom, near, far );
+				topCamera.useTarget = true;
+				topCamera.position.y = bb.y[ 1 ];
+
+				var renderShadow = new THREE.RenderPass( shadowScene, topCamera );
+
+				var blurShader = THREE.ShaderExtras[ "triangleBlur" ];
+				var effectBlurX = new THREE.ShaderPass( blurShader, 'texture' );
+				var effectBlurY = new THREE.ShaderPass( blurShader, 'texture' );
+
+				renderShadow.clearColor = new THREE.Color( 0x000000 );
+				renderShadow.clearAlpha = 0;
+
+				var blurAmountX = bluriness / width;
+				var blurAmountY = bluriness / height;
+
+				effectBlurX.uniforms[ 'delta' ].value = new THREE.Vector2( blurAmountX, 0 );
+				effectBlurY.uniforms[ 'delta' ].value = new THREE.Vector2( 0, blurAmountY );
+
+				var shadowComposer = new THREE.EffectComposer( renderer, shadowTarget );
+
+				shadowComposer.addPass( renderShadow );
+				shadowComposer.addPass( effectBlurX );
+				shadowComposer.addPass( effectBlurY );
+
+				renderer.clear();
+				shadowComposer.render( 0.1 );
+
+				return shadowTarget;
+
+			}
+
+
+			//
+
+			function addCar( object, x, y, z, s ) {
+
+				object.root.position.set( x, y, z );
+				scene.add( object.root );
+
+				object.enableShadows( true );
+
+				if ( FOLLOW_CAMERA && object == currentCar ) {
+
+					object.root.add( camera );
+
+					camera.position.set( 350, 500, 2200 );
+					//camera.position.set( 0, 3000, -500 );
+
+					camera.target.position.z = 500;
+					camera.target.position.y = 150;
+
+				}
+
+				var shadowTexture = generateDropShadowTexture( object.bodyMesh, 64, 32, 15 );
+
+				object.bodyMesh.geometry.computeBoundingBox();
+				var bb = object.bodyMesh.geometry.boundingBox;
+
+				var ss = object.modelScale * 1.0;
+				var shadowWidth  = ss * ( bb.z[ 1 ] - bb.z[ 0 ] );
+				var shadowHeight = 1.25 * ss * ( bb.x[ 1 ] - bb.x[ 0 ] );
+
+				var shadowPlane = new THREE.PlaneGeometry( shadowWidth, shadowHeight );
+				var shadowMaterial = new THREE.MeshBasicMaterial( { color: 0xffffff, opacity: 0.5, transparent: true,
+														  map: shadowTexture,
+														  polygonOffset: false, polygonOffsetFactor: -0.5, polygonOffsetUnits: 1 } );
+
+				var shadow = new THREE.Mesh( shadowPlane, shadowMaterial );
+				shadow.rotation.x = -Math.PI/2;
+				shadow.rotation.z = Math.PI/2;
+				shadow.position.y = s + 10;
+
+				object.root.add( shadow );
+
+			}
+
+			//
+
+			function setCurrentCar( car, cameraType ) {
+
+				var oldCar = currentCar;
+
+				currentCar = config[ car ].model;
+
+				if ( cameraType == "front" || cameraType == "back" ) {
+
+					hblur.uniforms[ 'r' ].value = vblur.uniforms[ 'r' ].value = config[ car ].r;
+
+					FOLLOW_CAMERA = true;
+
+					oldCar.root.remove( camera );
+					currentCar.root.add( camera );
+
+					if ( cameraType == "front" ) {
+
+						camera.position.set( 350, 500, 2200 );
+
+					} else if ( cameraType == "back" ) {
+
+						camera.position.copy( config[ car ].backCam );
+
+					}
+
+					camera.target.position.set( 0, 150, 500 );
+
+				} else {
+
+					FOLLOW_CAMERA = false;
+
+					oldCar.root.remove( camera );
+
+					camera.position.set( 2000, 0, 2000 );
+					camera.target.position.set( 0, 0, 0 );
+
+					spotLight.position.set( 0, 1800, 1500 );
+
+					hblur.uniforms[ 'r' ].value = vblur.uniforms[ 'r' ].value = 0.35;
+
+				}
+
+			}
+
+			//
+
+			function onWindowResize( event ) {
+
+				SCREEN_WIDTH = window.innerWidth;
+				SCREEN_HEIGHT = window.innerHeight - 2 * MARGIN;
+
+				renderer.setSize( SCREEN_WIDTH, SCREEN_HEIGHT );
+
+				camera.aspect = SCREEN_WIDTH / SCREEN_HEIGHT;
+				camera.updateProjectionMatrix();
+
+				renderTarget = new THREE.WebGLRenderTarget( SCREEN_WIDTH, SCREEN_HEIGHT, renderTargetParameters );
+
+				composer.reset( renderTarget );
+
+				hblur.uniforms[ 'h' ].value = 10.75 / SCREEN_WIDTH;
+				vblur.uniforms[ 'v' ].value = 10.75 / SCREEN_HEIGHT;
+
+				effectFXAA.uniforms[ 'resolution' ].value.set( 1 / SCREEN_WIDTH, 1 / SCREEN_HEIGHT );
+
+			}
+
+			//
+
+			function onKeyDown ( event ) {
+
+				switch( event.keyCode ) {
+
+					case 38: /*up*/	controlsGallardo.moveForward = true; break;
+					case 87: /*W*/ 	controlsVeyron.moveForward = true; break;
+
+					case 40: /*down*/controlsGallardo.moveBackward = true; break;
+					case 83: /*S*/ 	 controlsVeyron.moveBackward = true; break;
+
+					case 37: /*left*/controlsGallardo.moveLeft = true; break;
+					case 65: /*A*/   controlsVeyron.moveLeft = true; break;
+
+					case 39: /*right*/controlsGallardo.moveRight = true; break;
+					case 68: /*D*/    controlsVeyron.moveRight = true; break;
+
+					case 49: /*1*/	setCurrentCar( "gallardo", "center" ); break;
+					case 50: /*2*/	setCurrentCar( "veyron", "center" ); break;
+					case 51: /*3*/	setCurrentCar( "gallardo", "front" ); break;
+					case 52: /*4*/	setCurrentCar( "veyron", "front" ); break;
+					case 53: /*5*/	setCurrentCar( "gallardo", "back" ); break;
+					case 54: /*6*/	setCurrentCar( "veyron", "back" ); break;
+
+					case 78: /*N*/   vdir *= -1; break;
+
+					case 66: /*B*/   blur = !blur; break;
+
+				}
+
+			};
+
+			function onKeyUp ( event ) {
+
+				switch( event.keyCode ) {
+
+					case 38: /*up*/controlsGallardo.moveForward = false; break;
+					case 87: /*W*/ controlsVeyron.moveForward = false; break;
+
+					case 40: /*down*/controlsGallardo.moveBackward = false; break;
+					case 83: /*S*/ 	 controlsVeyron.moveBackward = false; break;
+
+					case 37: /*left*/controlsGallardo.moveLeft = false; break;
+					case 65: /*A*/ 	 controlsVeyron.moveLeft = false; break;
+
+					case 39: /*right*/controlsGallardo.moveRight = false; break;
+					case 68: /*D*/ 	  controlsVeyron.moveRight = false; break;
+
+				}
+
+			};
+
+
+			//
+
+			function setMaterialsGallardo( car ) {
+
+				// BODY
+
+				var materials = car.bodyGeometry.materials;
+
+				materials[ 0 ][ 0 ] = mlib.body[ 0 ][ 1 ]; 		// body
+				materials[ 1 ][ 0 ] = mlib[ "Dark chrome" ]; 	// front under lights, back
+
+				// WHEELS
+
+				materials = car.wheelGeometry.materials;
+
+				materials[ 0 ][ 0 ] = mlib[ "Chrome" ];			// insides
+				materials[ 1 ][ 0 ] = mlib[ "Black rough" ];	// tire
+
+			}
+
+			function setMaterialsVeyron( car ) {
+
+				// 0 - top, front center, back sides
+				// 1 - front sides
+				// 2 - engine
+				// 3 - small chrome things
+				// 4 - backlights
+				// 5 - back signals
+				// 6 - bottom, interior
+				// 7 - windshield
+
+				// BODY
+
+				var materials = car.bodyGeometry.materials;
+
+				materials[ 0 ][ 0 ] = mlib[ "Black metal" ];	// top, front center, back sides
+				materials[ 1 ][ 0 ] = mlib[ "Chrome" ];			// front sides
+				materials[ 2 ][ 0 ] = mlib[ "Chrome" ];			// engine
+				materials[ 3 ][ 0 ] = mlib[ "Dark chrome" ];	// small chrome things
+				materials[ 4 ][ 0 ] = mlib[ "Red glass" ];		// backlights
+				materials[ 5 ][ 0 ] = mlib[ "Orange glass" ];	// back signals
+				materials[ 6 ][ 0 ] = mlib[ "Black rough" ];	// bottom, interior
+				materials[ 7 ][ 0 ] = mlib[ "Dark glass" ];		// windshield
+
+				// WHEELS
+
+				materials = car.wheelGeometry.materials;
+
+				materials[ 0 ][ 0 ] = mlib[ "Chrome" ];			// insides
+				materials[ 1 ][ 0 ] = mlib[ "Black rough" ];	// tire
+
+			}
+
+			//
+
+			function animate() {
+
+				requestAnimationFrame( animate );
+
+				render();
+				stats.update();
+
+			}
+
+			function clamp( x, a, b ) { return x < a ? a : ( x > b ? b : x ); }
+
+			function map_linear( x, sa, sb, ea, eb ) {
+
+				return ( x  - sa ) * ( eb - ea ) / ( sb - sa ) + ea;
+
+			};
+
+			function render() {
+
+				var newTime = new Date().getTime();
+				var delta = 0.001 * ( newTime - oldTime );
+				oldTime = newTime;
+
+				// day / night
+
+				v = clamp( v + 0.5 * delta * vdir, 0.1, 0.9 );
+				scene.fog.color.setHSV( 0.51, 0.5, v );
+
+				renderer.setClearColor( scene.fog.color, 1 );
+
+				var vnorm = ( v - 0.05 ) / ( 0.9 - 0.05 );
+
+				if ( vnorm < 0.3 ) {
+
+					setSpritesOpacity( 1 - v / 0.3 );
+
+				} else {
+
+					setSpritesOpacity( 0 );
+
+				}
+
+				if ( vnorm < 0.4 ) {
+
+					if ( veyron.loaded ) {
+
+						veyron.bodyGeometry.materials[ 1 ][ 0 ] = mlib[ "ChromeN" ];
+						veyron.bodyGeometry.materials[ 2 ][ 0 ] = mlib[ "ChromeN" ];
+
+						veyron.wheelGeometry.materials[ 0 ][ 0 ] = mlib[ "ChromeN" ];
+
+					}
+
+					if ( gallardo.loaded ) {
+
+						gallardo.wheelGeometry.materials[ 0 ][ 0 ] = mlib[ "ChromeN" ];
+
+					}
+
+				} else {
+
+					if ( veyron.loaded ) {
+
+						veyron.bodyGeometry.materials[ 1 ][ 0 ] = mlib[ "Chrome" ];
+						veyron.bodyGeometry.materials[ 2 ][ 0 ] = mlib[ "Chrome" ];
+
+						veyron.wheelGeometry.materials[ 0 ][ 0 ] = mlib[ "Chrome" ];
+
+					}
+
+					if ( gallardo.loaded ) {
+
+						gallardo.wheelGeometry.materials[ 0 ][ 0 ] = mlib[ "Chrome" ];
+
+					}
+
+				}
+
+				effectBloom.screenUniforms[ "opacity" ].value = map_linear( vnorm, 0, 1, 1, 0.75 );
+
+				ambientLight.color.setHSV( 0, 0, map_linear( vnorm, 0, 1, 0.07, 0.33 ) );
+				groundBasic.color.setHSV( 0.1, 0.45, map_linear( vnorm, 0, 1, 0.725, 0.995 ) );
+
+				// blur
+
+				if ( blur ) {
+
+					effectSave.enabled = true;
+					effectBlend.enabled = true;
+
+				} else {
+
+					effectSave.enabled = false;
+					effectBlend.enabled = false;
+
+				}
+
+				// update car model
+
+				veyron.updateCarModel( delta, controlsVeyron );
+				gallardo.updateCarModel( delta, controlsGallardo );
+
+				// update camera
+
+				if ( ! FOLLOW_CAMERA ) {
+
+					camera.target.position.x = currentCar.root.position.x;
+					camera.target.position.z = currentCar.root.position.z;
+
+				} else {
+
+					spotLight.position.x = currentCar.root.position.x - 500;
+					spotLight.position.z = currentCar.root.position.z - 500;
+
+
+				}
+
+				// update shadows
+
+				spotLight.target.position.x = currentCar.root.position.x;
+				spotLight.target.position.z = currentCar.root.position.z;
+
+				// render cube map
+
+				var updateCubemap = true;
+
+				if ( updateCubemap ) {
+
+					veyron.setVisible( false );
+					gallardo.setVisible( false );
+
+					cubeCamera.updatePosition( currentCar.root.position );
+
+					renderer.autoClear = true;
+					cubeCamera.updateCubeMap( renderer, scene );
+
+					veyron.setVisible( true );
+					gallardo.setVisible( true );
+
+				}
+
+				// render scene
+
+				renderer.autoClear = false;
+				renderer.shadowMapEnabled = true;
+
+				renderer.clear();
+				composer.render( 0.1 );
+
+				renderer.shadowMapEnabled = false;
+
+			}
+
+		</script>
+
+	</body>
+</html>

+ 1 - 0
examples/webgl_materials_cubemap_escher.html

@@ -68,6 +68,7 @@
 
 				camera = new THREE.Camera( 75, window.innerWidth / window.innerHeight, 1, 100000 );
 				camera.position.z = 3200;
+				camera.useTarget = true;
 
 				scene = new THREE.Scene();
 

+ 2 - 0
examples/webgl_materials_cubemap_refraction.html

@@ -72,8 +72,10 @@
 
 				camera = new THREE.Camera( 50, window.innerWidth / window.innerHeight, 1, 100000 );
 				camera.position.z = 2000;
+				camera.useTarget = true;
 
 				cameraCube = new THREE.Camera( 50, window.innerWidth / window.innerHeight, 1, 100000 );
+				cameraCube.useTarget = true;
 
 				scene = new THREE.Scene();
 				sceneCube = new THREE.Scene();

+ 1 - 0
examples/webgl_materials_grass.html

@@ -38,6 +38,7 @@
 				camera = new THREE.Camera( 60, window.innerWidth / window.innerHeight, 1, 1000 );
 				camera.position.y = 75;
 				camera.position.z = 100;
+				camera.useTarget = true;
 
 				scene = new THREE.Scene();
 

+ 1 - 1
examples/webgl_materials_shaders.html

@@ -98,7 +98,7 @@
 
 				camera = new THREE.Camera( 75, SCREEN_WIDTH / SCREEN_HEIGHT, 1, 100000 );
 				camera.position.z = 1000;
-				camera.updateMatrix();
+				camera.useTarget = true;
 
 				scene = new THREE.Scene();
 

+ 2 - 0
examples/webgl_materials_shaders_fresnel.html

@@ -70,8 +70,10 @@
 
 				camera = new THREE.Camera( 60, window.innerWidth / window.innerHeight, 1, 100000 );
 				camera.position.z = 3200;
+				camera.useTarget = true;
 
 				cameraCube = new THREE.Camera( 60, window.innerWidth / window.innerHeight, 1, 100000 );
+				cameraCube.useTarget = true;
 
 				scene = new THREE.Scene();
 				sceneCube = new THREE.Scene();

+ 1 - 0
examples/webgl_materials_texture_filters.html

@@ -94,6 +94,7 @@
 
 				camera = new THREE.Camera( 35, SCREEN_WIDTH / SCREEN_HEIGHT, 1, 5000 );
 				camera.position.z = 1500;
+				camera.useTarget = true;
 
 				scene = new THREE.Scene();
 				scene2 = new THREE.Scene();

+ 2 - 13
examples/webgl_materials_video.html

@@ -49,7 +49,6 @@
 
 		<script src="js/Detector.js"></script>
 		<script src="js/RequestAnimationFrame.js"></script>
-		<script src="js/Stats.js"></script>
 
 		<video id="video" autoplay loop style="display:none">
 			<source src="textures/sintel.mp4" type='video/mp4; codecs="avc1.42E01E, mp4a.40.2"'>
@@ -60,7 +59,7 @@
 
 			if ( ! Detector.webgl ) Detector.addGetWebGLMessage();
 
-			var container, stats;
+			var container;
 
 			var camera, scene, renderer;
 
@@ -92,6 +91,7 @@
 
 				camera = new THREE.Camera( 40, window.innerWidth / window.innerHeight, 1, 10000 );
 				camera.position.z = 500;
+				camera.useTarget = true;
 
 				scene = new THREE.Scene();
 
@@ -107,9 +107,6 @@
 
 				video = document.getElementById( 'video' );
 
-				//video.volume = 0;
-				//video.muted = true;
-
 				texture = new THREE.Texture( video );
 				texture.minFilter = THREE.LinearFilter;
 				texture.magFilter = THREE.LinearFilter;
@@ -146,8 +143,6 @@
 
 					material = materials[ cube_count ];
 
-					//material.program = material_base.program;
-
 					material.hue = i/xgrid;
 					material.saturation = j/ygrid;
 
@@ -174,11 +169,6 @@
 
 				renderer.autoClear = false;
 
-				stats = new Stats();
-				stats.domElement.style.position = 'absolute';
-				stats.domElement.style.top = '0px';
-				//container.appendChild( stats.domElement );
-
 				document.addEventListener( 'mousemove', onDocumentMouseMove, false );
 
 				// postprocessing
@@ -231,7 +221,6 @@
 				requestAnimationFrame( animate );
 
 				render();
-				stats.update();
 
 			}
 

+ 1 - 0
examples/webgl_morphtargets.html

@@ -96,6 +96,7 @@
 
 				camera = new THREE.Camera( 45, window.innerWidth / window.innerHeight, 1, 15000 );
 				camera.position.z = 500;
+				camera.useTarget = true;
 
 
 				scene = new THREE.Scene();

+ 1 - 0
examples/webgl_morphtargets_horse.html

@@ -44,6 +44,7 @@
 
 				camera = new THREE.Camera( 50, window.innerWidth / window.innerHeight, 1, 10000 );
 				camera.position.y = 300;
+				camera.useTarget = true;
 				camera.target.position.y = 150;
 
 				scene = new THREE.Scene();

+ 1 - 0
examples/webgl_multiple_canvases_complex.html

@@ -124,6 +124,7 @@
 					camera = new THREE.Camera( 20, container.clientWidth / container.clientHeight, 1, 10000 );
 					camera.setViewOffset(fullWidth, fullHeight, viewX, viewY, viewWidth, viewHeight);
 					camera.position.z = 1800;
+					camera.useTarget = true;
 
 					scene = new THREE.Scene();
 

+ 1 - 0
examples/webgl_multiple_canvases_grid.html

@@ -140,6 +140,7 @@
 					camera = new THREE.Camera( 20, container.clientWidth / container.clientHeight, 1, 10000 );
 					camera.setViewOffset( fullWidth, fullHeight, viewX, viewY, viewWidth, viewHeight );
 					camera.position.z = 1800;
+					camera.useTarget = true;
 
 					scene = new THREE.Scene();
 

+ 1 - 1
examples/webgl_objconvert_test.html

@@ -81,7 +81,7 @@
 
 				camera = new THREE.Camera( 75, SCREEN_WIDTH / SCREEN_HEIGHT, 1, 100000 );
 				camera.position.z = 500;
-				camera.updateMatrix();
+				camera.useTarget = true;
 
 				scene = new THREE.Scene();
 

+ 1 - 0
examples/webgl_panorama_equirectangular.html

@@ -57,6 +57,7 @@
 				container = document.getElementById( 'container' );
 
 				camera = new THREE.Camera( fov, window.innerWidth / window.innerHeight, 1, 1100 );
+				camera.useTarget = true;
 
 				scene = new THREE.Scene();
 

+ 1 - 0
examples/webgl_particles_billboards.html

@@ -63,6 +63,7 @@
 
 				camera = new THREE.Camera( 55, window.innerWidth / window.innerHeight, 1, 3000 );
 				camera.position.z = 1000;
+				camera.useTarget = true;
 
 				scene = new THREE.Scene();
 				scene.fog = new THREE.FogExp2( 0x000000, 0.001 );

+ 1 - 0
examples/webgl_particles_billboards_colors.html

@@ -63,6 +63,7 @@
 
 				camera = new THREE.Camera( 50, window.innerWidth / window.innerHeight, 1, 3000 );
 				camera.position.z = 1400;
+				camera.useTarget = true;
 
 				scene = new THREE.Scene();
 				scene.fog = new THREE.FogExp2( 0x000000, 0.0009 );

+ 80 - 89
examples/webgl_particles_dynamic.html

@@ -1,46 +1,46 @@
 <!doctype html>
 <html lang="en">
-    <head>
-        <title>three.js webgl - particles - dynamic - postprocessing</title>
-        <meta charset="utf-8">
-        <meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
-        <style>
-            body {
-                color: #fff;
-                font-family:Monospace;
-                font-size:13px;
-                text-align:center;
-                font-weight: bold;
-
-                background-color: #000;
-                margin: 0px;
-                overflow: hidden;
-            }
-
-            #info {
-				color:#fff;
-                position: absolute;
-                top: 0px; width: 100%;
-                padding: 5px;
-
-            }
-
-            a { color: red; }
-
-        </style>
-    </head>
-    <body>
-
-        <div id="container"></div>
-        <div id="info">
-			<a href="http://github.com/mrdoob/three.js" target="_blank">three.js</a> - webgl dynamic particles + postprocessing
-			- models by <a href="http://sketchup.google.com/3dwarehouse/details?mid=2c6fd128fca34052adc5f5b98d513da1" target="_blank">Reallusion</a>
-			<a href="http://sketchup.google.com/3dwarehouse/details?mid=f526cc4abf7cb68d76cab47c765b7255" target="_blank">iClone</a>,
-			<a href="http://artist-3d.com/free_3d_models/dnm/model_disp.php?uid=1129" target="_blank">Troyano</a>
-
-		</div>
-
-        <script src="../build/Three.js"></script>
+	<head>
+		<title>three.js webgl - particles - dynamic - postprocessing</title>
+		<meta charset="utf-8">
+		<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
+		<style>
+		    body {
+			color: #fff;
+			font-family:Monospace;
+			font-size:13px;
+			text-align:center;
+			font-weight: bold;
+
+			background-color: #000;
+			margin: 0px;
+			overflow: hidden;
+		    }
+
+		    #info {
+					color:#fff;
+			position: absolute;
+			top: 0px; width: 100%;
+			padding: 5px;
+
+		    }
+
+		    a { color: red; }
+
+		</style>
+	</head>
+	<body>
+
+		<div id="container"></div>
+		<div id="info">
+				<a href="http://github.com/mrdoob/three.js" target="_blank">three.js</a> - webgl dynamic particles + postprocessing
+				- models by <a href="http://sketchup.google.com/3dwarehouse/details?mid=2c6fd128fca34052adc5f5b98d513da1" target="_blank">Reallusion</a>
+				<a href="http://sketchup.google.com/3dwarehouse/details?mid=f526cc4abf7cb68d76cab47c765b7255" target="_blank">iClone</a>,
+				<a href="http://artist-3d.com/free_3d_models/dnm/model_disp.php?uid=1129" target="_blank">Troyano</a>
+
+			</div>
+
+		<script src="../build/Three.js"></script>
 
 		<script src="js/ShaderExtras.js"></script>
 
@@ -51,23 +51,21 @@
 		<script src="js/postprocessing/ShaderPass.js"></script>
 		<script src="js/postprocessing/FilmPass.js"></script>
 
-        <script src="js/Stats.js"></script>
-        <script src="js/Detector.js"></script>
+		<script src="js/Detector.js"></script>
 		<script src="js/RequestAnimationFrame.js"></script>
 
-        <script>
+		<script>
 
 			if ( ! Detector.webgl ) Detector.addGetWebGLMessage();
 
 			var SCREEN_HEIGHT = window.innerHeight;
 			var SCREEN_WIDTH = window.innerWidth;
 
-            var container, stats;
+			var container;
 
-            var camera, scene, renderer, mesh, directionalLight;
+			var camera, scene, renderer, mesh, directionalLight;
 
-			var parent,
-				meshes = [], clonemeshes = [];
+			var parent, meshes = [], clonemeshes = [];
 
 			var p;
 
@@ -77,18 +75,18 @@
 
 			var composer, effectFocus;
 
-            init();
-            animate();
+			init();
+			animate();
 
-            function init() {
+			function init() {
 
-                container = document.getElementById( 'container' );
+				container = document.getElementById( 'container' );
 
 				camera = new THREE.Camera( 20, SCREEN_WIDTH / SCREEN_HEIGHT, 1, 50000 );
 				camera.position.z = 7000;
-				camera.position.y = 700;
+				camera.position.y = 200;
 
-                scene = new THREE.Scene();
+				scene = new THREE.Scene();
 
 				scene.fog = new THREE.FogExp2( 0x000104, 0.0000675 );
 
@@ -138,23 +136,16 @@
 
 				//
 
-                renderer = new THREE.WebGLRenderer( { clearColor: 0x000000, clearAlpha: 1, antialias: false } );
+				renderer = new THREE.WebGLRenderer( { clearColor: 0x000000, clearAlpha: 1, antialias: false } );
 				renderer.setSize( SCREEN_WIDTH, SCREEN_HEIGHT );
 				renderer.autoClear = false;
 				renderer.sortObjects = false;
-                container.appendChild( renderer.domElement );
+				container.appendChild( renderer.domElement );
 
 				renderer.setClearColor( scene.fog.color, 1 );
 
 				//
 
-                stats = new Stats();
-                stats.domElement.style.position = 'absolute';
-                stats.domElement.style.top = '0px';
-                //container.appendChild( stats.domElement );
-
-				//
-
 				parent = new THREE.Object3D();
 				scene.add( parent );
 
@@ -190,7 +181,7 @@
 
 				window.addEventListener( 'resize', onWindowResize, false );
 
-            }
+			}
 
 			//
 
@@ -220,7 +211,7 @@
 				var geometry = new THREE.Geometry();
 				var vertices_tmp = [];
 
-				for( i = 0; i < vl; i++ ) {
+				for ( i = 0; i < vl; i ++ ) {
 
 					p = vertices[ i ].position;
 
@@ -230,21 +221,22 @@
 				}
 
 				var clones = [
-								[  6000, 0, -4000 ],
-								[  5000, 0, 0 ],
-								[  1000, 0, 5000 ],
-								[  1000, 0, -5000 ],
-								[  4000, 0, 2000 ],
-								[ -4000, 0, 1000 ],
-								[ -5000, 0, -5000 ],
 
-								[ 0, 0, 0 ]
+					[  6000, 0, -4000 ],
+					[  5000, 0, 0 ],
+					[  1000, 0, 5000 ],
+					[  1000, 0, -5000 ],
+					[  4000, 0, 2000 ],
+					[ -4000, 0, 1000 ],
+					[ -5000, 0, -5000 ],
+
+					[ 0, 0, 0 ]
 
-							  ];
+				];
 
 				if ( dynamic ) {
 
-					for( i = 0; i < clones.length; i++ ) {
+					for ( i = 0; i < clones.length; i ++ ) {
 
 						c = ( i < clones.length -1 ) ? 0x252525 : color;
 
@@ -282,13 +274,13 @@
 
 				bloader.statusDomElement.style.display = "none";
 
-				meshes.push( { mesh: mesh, vertices: geometry.vertices, vertices_tmp: vertices_tmp, vl: vl,
-							  down: 0, up: 0, direction: 0, speed: 35, delay: Math.floor( 200 + 200 * Math.random() ),
-							  started: false, start: Math.floor( 100 + 200 * Math.random() ),
-							  dynamic: dynamic,
-							  bb: geometry.boundingBox } );
-
-				//console.log( total, totaln );
+				meshes.push( {
+					mesh: mesh, vertices: geometry.vertices, vertices_tmp: vertices_tmp, vl: vl,
+					down: 0, up: 0, direction: 0, speed: 35, delay: Math.floor( 200 + 200 * Math.random() ),
+					started: false, start: Math.floor( 100 + 200 * Math.random() ),
+					dynamic: dynamic,
+					bb: geometry.boundingBox
+				} );
 
 			}
 
@@ -296,16 +288,14 @@
 			var j, jl, cm, data, vertices, vertices_tmp, vl, d, vt,
 				time, oldTime, delta;
 
-			function animate() {
+			function animate () {
 
 				requestAnimationFrame( animate );
-
 				render();
-				stats.update();
 
 			}
 
-            function render() {
+			function render () {
 
 				if ( ! oldTime ) {
 
@@ -478,9 +468,10 @@
 				renderer.clear();
 				composer.render( 0.01 );
 
-            }
+			}
+
+		</script>
 
-        </script>
+	</body>
 
-    </body>
 </html>

+ 1 - 0
examples/webgl_particles_random.html

@@ -63,6 +63,7 @@
 
 				camera = new THREE.Camera( 75, window.innerWidth / window.innerHeight, 1, 3000 );
 				camera.position.z = 1000;
+				camera.useTarget = true;
 
 				scene = new THREE.Scene();
 				scene.fog = new THREE.FogExp2( 0x000000, 0.0007 );

+ 0 - 1
examples/webgl_particles_shapes.html

@@ -122,7 +122,6 @@
 				camera = new THREE.Camera( 70, window.innerWidth / window.innerHeight, 1, 2000 );
 				camera.position.y = 150;
 				camera.position.z = 400;
-				camera.target.position.y = 150;
 
 				// SCENE
 

+ 1 - 0
examples/webgl_particles_sprites.html

@@ -64,6 +64,7 @@
 
 				camera = new THREE.Camera( 75, window.innerWidth / window.innerHeight, 1, 3000 );
 				camera.position.z = 1000;
+				camera.useTarget = true;
 
 				scene = new THREE.Scene();
 				scene.fog = new THREE.FogExp2( 0x000000, 0.0008 );

+ 3 - 1
examples/webgl_performance.html

@@ -47,6 +47,7 @@
 				document.body.appendChild( container );
 
 				camera = new THREE.Camera( 60, window.innerWidth / window.innerHeight, 1, 10000 );
+				camera.useTarget = true;
 				camera.position.z = 3200;
 
 				scene = new THREE.Scene();
@@ -79,9 +80,10 @@
 
 				} } );
 
-				renderer = new THREE.WebGLRenderer();
+				renderer = new THREE.WebGLRenderer( { preserveDrawingBuffer: true } );
 				renderer.setSize( window.innerWidth, window.innerHeight );
 				renderer.sortObjects = false;
+				renderer.autoClearColor = false;
 				container.appendChild( renderer.domElement );
 
 				stats = new Stats();

Một số tệp đã không được hiển thị bởi vì quá nhiều tập tin thay đổi trong này khác