소스 검색

All WebGL examples working with array-less materials.

Noticeable difference: can't anymore assign Material references to faces directly - "face.materials" became "face.materialIndex". Materials have to go to "geometry.materials" array (to which "face.materialIndex" points). This is necessary to allow run-time changing of face materials (this indirection used to be done by arrays).

Some casualties:

- multi-materials example, this functionality isn't possible anymore
- had to simplify LOD Text examples as LODs don't handle groups (used to fake multi-materials)
- multi-materials sphere in materials example can't have faces with undefined materials (this may be fixable I guess, when there'll be some real use-case)
- scene format still has materials arrays, only the last material will be used (except when there are face materials, then materials from JSON will be used, as before)

Other renderers and their corresponding examples were not touched yet.

WebGLRenderer still needs some prettification, some things don't make sense anymore without arrays, code can be cleaned up further.
alteredq 14 년 전
부모
커밋
81b60ea2f6
39개의 변경된 파일1166개의 추가작업 그리고 1228개의 파일을 삭제
  1. 440 441
      build/Three.js
  2. 7 6
      build/custom/ThreeCanvas.js
  3. 3 4
      build/custom/ThreeDOM.js
  4. 137 138
      build/custom/ThreeExtras.js
  5. 6 5
      build/custom/ThreeSVG.js
  6. 261 262
      build/custom/ThreeWebGL.js
  7. 3 8
      examples/misc_lights_test.html
  8. 28 29
      examples/misc_materials_multimaterials.html
  9. 18 9
      examples/misc_ubiquity_test.html
  10. 8 3
      examples/obj/Qrcode.js
  11. 3 3
      examples/webgl_collisions_box.html
  12. 4 4
      examples/webgl_collisions_mesh.html
  13. 7 5
      examples/webgl_collisions_normal.html
  14. 6 4
      examples/webgl_collisions_primitives.html
  15. 2 2
      examples/webgl_collisions_trigger.html
  16. 11 12
      examples/webgl_geometries.html
  17. 1 0
      examples/webgl_geometry_blenderexport_colors.html
  18. 5 23
      examples/webgl_geometry_colors.html
  19. 1 1
      examples/webgl_geometry_shapes.html
  20. 24 24
      examples/webgl_geometry_subdivison.html
  21. 4 4
      examples/webgl_interactive_cubes.html
  22. 3 2
      examples/webgl_lod_text.html
  23. 12 1
      examples/webgl_materials.html
  24. 8 5
      examples/webgl_materials_cars_anaglyph.html
  25. 12 12
      examples/webgl_materials_cars_camaro_crosseyed.html
  26. 3 3
      examples/webgl_materials_cars_parallaxbarrier.html
  27. 1 120
      examples/webgl_materials_cubemap_dynamic.html
  28. 0 2
      examples/webgl_materials_normalmap.html
  29. 1 1
      examples/webgl_materials_shaders.html
  30. 23 13
      examples/webgl_multiple_canvases_circle.html
  31. 31 29
      examples/webgl_multiple_canvases_complex.html
  32. 31 29
      examples/webgl_multiple_canvases_grid.html
  33. 1 1
      examples/webgl_objconvert_test.html
  34. 7 5
      examples/webgl_particles_shapes.html
  35. 8 8
      examples/webgl_scene_test.html
  36. 1 1
      examples/webgl_shadowmap.html
  37. 16 0
      src/extras/SceneUtils.js
  38. 8 6
      src/extras/loaders/SceneLoader.js
  39. 21 3
      src/renderers/WebGLRenderer.js

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 440 - 441
build/Three.js


+ 7 - 6
build/custom/ThreeCanvas.js

@@ -70,9 +70,10 @@ this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRo
 this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);a==0?this.w=this.z=this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},multiplySelf:function(a){var b=
 this.x,c=this.y,d=this.z,f=this.w,e=a.x,g=a.y,h=a.z,a=a.w;this.x=b*a+f*e+c*h-d*g;this.y=c*a+f*g+d*e-b*h;this.z=d*a+f*h+b*g-c*e;this.w=f*a-b*e-c*g-d*h;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,f=a.z,e=this.x,g=this.y,h=this.z,m=this.w,k=m*c+g*f-h*d,l=m*d+h*c-e*f,i=m*f+e*d-g*c,c=-e*
 c-g*d-h*f;b.x=k*m+c*-e+l*-h-i*-g;b.y=l*m+c*-g+i*-e-k*-h;b.z=i*m+c*-h+k*-g-l*-e;return b}};THREE.Quaternion.slerp=function(a,b,c,d){var f=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(f)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var e=Math.acos(f),g=Math.sqrt(1-f*f);if(Math.abs(g)<0.0010)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;f=Math.sin((1-d)*e)/g;d=Math.sin(d*e)/g;c.w=a.w*f+b.w*d;c.x=a.x*f+b.x*d;c.y=a.y*f+b.y*d;c.z=a.z*f+b.z*d;return c};
-THREE.Vertex=function(a){this.position=a||new THREE.Vector3};THREE.Face3=function(a,b,c,d,f,e){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materials=e instanceof Array?e:[e];this.centroid=new THREE.Vector3};
-THREE.Face4=function(a,b,c,d,f,e,g){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materials=g instanceof Array?g:[g];this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.u=a||0;this.v=b||0};
-THREE.UV.prototype={constructor:THREE.UV,set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.u=a.u;this.v=a.v;return this},clone:function(){return new THREE.UV(this.u,this.v)}};THREE.Geometry=function(){this.id=THREE.GeometryCount++;this.vertices=[];this.colors=[];this.faces=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.dynamic=this.hasTangents=!1};
+THREE.Vertex=function(a){this.position=a||new THREE.Vector3};THREE.Face3=function(a,b,c,d,f,e){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materialIndex=e;this.centroid=new THREE.Vector3};
+THREE.Face4=function(a,b,c,d,f,e,g){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materialIndex=g;this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.u=a||0;this.v=b||0};
+THREE.UV.prototype={constructor:THREE.UV,set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.u=a.u;this.v=a.v;return this},clone:function(){return new THREE.UV(this.u,this.v)}};
+THREE.Geometry=function(){this.id=THREE.GeometryCount++;this.vertices=[];this.colors=[];this.materials=[];this.faces=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.dynamic=this.hasTangents=!1};
 THREE.Geometry.prototype={constructor:THREE.Geometry,applyMatrix:function(a){var b=new THREE.Matrix4;b.extractRotation(a,new THREE.Vector3(1,1,1));for(var c=0,d=this.vertices.length;c<d;c++)a.multiplyVector3(this.vertices[c].position);c=0;for(d=this.faces.length;c<d;c++){var f=this.faces[c];b.multiplyVector3(f.normal);for(var e=0,g=f.vertexNormals.length;e<g;e++)b.multiplyVector3(f.vertexNormals[e]);a.multiplyVector3(f.centroid)}},computeCentroids:function(){var a,b,c;a=0;for(b=this.faces.length;a<
 b;a++)c=this.faces[a],c.centroid.set(0,0,0),c instanceof THREE.Face3?(c.centroid.addSelf(this.vertices[c.a].position),c.centroid.addSelf(this.vertices[c.b].position),c.centroid.addSelf(this.vertices[c.c].position),c.centroid.divideScalar(3)):c instanceof THREE.Face4&&(c.centroid.addSelf(this.vertices[c.a].position),c.centroid.addSelf(this.vertices[c.b].position),c.centroid.addSelf(this.vertices[c.c].position),c.centroid.addSelf(this.vertices[c.d].position),c.centroid.divideScalar(4))},computeFaceNormals:function(a){var b,
 c,d,f,e,g,h=new THREE.Vector3,m=new THREE.Vector3;d=0;for(f=this.faces.length;d<f;d++){e=this.faces[d];if(a&&e.vertexNormals.length){h.set(0,0,0);b=0;for(c=e.vertexNormals.length;b<c;b++)h.addSelf(e.vertexNormals[b]);h.divideScalar(3)}else b=this.vertices[e.a],c=this.vertices[e.b],g=this.vertices[e.c],h.sub(g.position,c.position),m.sub(b.position,c.position),h.crossSelf(m);h.isZero()||h.normalize();e.normal.copy(h)}},computeVertexNormals:function(){var a,b,c,d;if(this.__tmpVertices==void 0){d=this.__tmpVertices=
@@ -113,9 +114,9 @@ THREE.ParticleCanvasMaterial=function(a){THREE.Material.call(this,a);a=a||{};thi
 THREE.Texture=function(a,b,c,d,f,e){this.id=THREE.TextureCount++;this.image=a;this.mapping=b!==void 0?b:new THREE.UVMapping;this.wrapS=c!==void 0?c:THREE.ClampToEdgeWrapping;this.wrapT=d!==void 0?d:THREE.ClampToEdgeWrapping;this.magFilter=f!==void 0?f:THREE.LinearFilter;this.minFilter=e!==void 0?e: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 a=new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter);a.offset.copy(this.offset);a.repeat.copy(this.repeat);return a}};THREE.TextureCount=0;THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.LatitudeReflectionMapping=function(){};THREE.LatitudeRefractionMapping=function(){};
 THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=function(){};THREE.UVMapping=function(){};THREE.RepeatWrapping=0;THREE.ClampToEdgeWrapping=1;THREE.MirroredRepeatWrapping=2;THREE.NearestFilter=3;THREE.NearestMipMapNearestFilter=4;THREE.NearestMipMapLinearFilter=5;THREE.LinearFilter=6;THREE.LinearMipMapNearestFilter=7;THREE.LinearMipMapLinearFilter=8;THREE.ByteType=9;THREE.UnsignedByteType=10;THREE.ShortType=11;THREE.UnsignedShortType=12;THREE.IntType=13;
-THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;THREE.Particle=function(a){THREE.Object3D.call(this);this.materials=a instanceof Array?a:[a]};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;THREE.Line=function(a,b,c){THREE.Object3D.call(this);this.geometry=a;this.materials=b instanceof Array?b:[b];this.type=c!=void 0?c:THREE.LineStrip};
-THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;
-THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.materials=b&&b.length?b:[b];this.overdraw=!1;if(this.geometry&&(this.geometry.boundingSphere||this.geometry.computeBoundingSphere(),this.boundRadius=a.boundingSphere.radius,this.geometry.morphTargets.length)){this.morphTargetBase=-1;this.morphTargetForcedOrder=[];this.morphTargetInfluences=[];this.morphTargetDictionary={};for(var c=0;c<this.geometry.morphTargets.length;c++)this.morphTargetInfluences.push(0),this.morphTargetDictionary[this.geometry.morphTargets[c].name]=
+THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;THREE.Particle=function(a){THREE.Object3D.call(this);this.material=a};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;THREE.Line=function(a,b,c){THREE.Object3D.call(this);this.geometry=a;this.material=b;this.type=c!=void 0?c:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;
+THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;
+THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material=b;this.overdraw=!1;if(this.geometry&&(this.geometry.boundingSphere||this.geometry.computeBoundingSphere(),this.boundRadius=a.boundingSphere.radius,this.geometry.morphTargets.length)){this.morphTargetBase=-1;this.morphTargetForcedOrder=[];this.morphTargetInfluences=[];this.morphTargetDictionary={};for(var c=0;c<this.geometry.morphTargets.length;c++)this.morphTargetInfluences.push(0),this.morphTargetDictionary[this.geometry.morphTargets[c].name]=
 c}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;THREE.Mesh.prototype.getMorphTargetIndexByName=function(a){if(this.morphTargetDictionary[a]!==void 0)return this.morphTargetDictionary[a];console.log("THREE.Mesh.getMorphTargetIndexByName: morph target "+a+" does not exist. Returning 0.");return 0};
 THREE.Bone=function(a){THREE.Object3D.call(this);this.skin=a;this.skinMatrix=new THREE.Matrix4;this.hasNoneBoneChildren=!1};THREE.Bone.prototype=new THREE.Object3D;THREE.Bone.prototype.constructor=THREE.Bone;THREE.Bone.prototype.supr=THREE.Object3D.prototype;
 THREE.Bone.prototype.update=function(a,b,c){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate)a?this.skinMatrix.multiply(a,this.matrix):this.skinMatrix.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,b=!0;var d,f=this.children.length;if(this.hasNoneBoneChildren){this.matrixWorld.multiply(this.skin.matrixWorld,this.skinMatrix);for(d=0;d<f;d++)a=this.children[d],a instanceof THREE.Bone?a.update(this.skinMatrix,b,c):a.update(this.matrixWorld,!0,c)}else for(d=0;d<f;d++)this.children[d].update(this.skinMatrix,

+ 3 - 4
build/custom/ThreeDOM.js

@@ -70,8 +70,8 @@ this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRo
 this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);a==0?this.w=this.z=this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},multiplySelf:function(a){var b=
 this.x,c=this.y,d=this.z,e=this.w,g=a.x,f=a.y,h=a.z,a=a.w;this.x=b*a+e*g+c*h-d*f;this.y=c*a+e*f+d*g-b*h;this.z=d*a+e*h+b*f-c*g;this.w=e*a-b*g-c*f-d*h;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,g=this.x,f=this.y,h=this.z,k=this.w,i=k*c+f*e-h*d,j=k*d+h*c-g*e,l=k*e+g*d-f*c,c=-g*
 c-f*d-h*e;b.x=i*k+c*-g+j*-h-l*-f;b.y=j*k+c*-f+l*-g-i*-h;b.z=l*k+c*-h+i*-f-j*-g;return b}};THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(e)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var g=Math.acos(e),f=Math.sqrt(1-e*e);if(Math.abs(f)<0.0010)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;e=Math.sin((1-d)*g)/f;d=Math.sin(d*g)/f;c.w=a.w*e+b.w*d;c.x=a.x*e+b.x*d;c.y=a.y*e+b.y*d;c.z=a.z*e+b.z*d;return c};
-THREE.Vertex=function(a){this.position=a||new THREE.Vector3};THREE.Face3=function(a,b,c,d,e,g){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materials=g instanceof Array?g:[g];this.centroid=new THREE.Vector3};
-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.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.materialIndex=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.materialIndex=f;this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.u=a||0;this.v=b||0};
 THREE.UV.prototype={constructor:THREE.UV,set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.u=a.u;this.v=a.v;return this},clone:function(){return new THREE.UV(this.u,this.v)}};
 THREE.Camera=function(){if(arguments.length)return console.warn("DEPRECATED: Camera() is now PerspectiveCamera() or OrthographicCamera()."),new THREE.PerspectiveCamera(arguments[0],arguments[1],arguments[2],arguments[3]);THREE.Object3D.call(this);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;
 THREE.Camera.prototype.lookAt=function(a){this.matrix.lookAt(this.position,a,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)};
@@ -80,8 +80,7 @@ THREE.OrthographicCamera=function(a,b,c,d,e,g){THREE.Camera.call(this);this.left
 THREE.PerspectiveCamera=function(a,b,c,d){THREE.Camera.call(this);this.fov=a!==void 0?a:50;this.aspect=b!==void 0?b:1;this.near=c!==void 0?c:0.1;this.far=d!==void 0?d:2E3;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype=new THREE.Camera;THREE.PerspectiveCamera.prototype.constructor=THREE.PerspectiveCamera;THREE.PerspectiveCamera.prototype.setLens=function(a,b){this.fov=2*Math.atan((b!==void 0?b:43.25)/(a*2));this.fov*=180/Math.PI;this.updateProjectionMatrix()};
 THREE.PerspectiveCamera.prototype.setViewOffset=function(a,b,c,d,e,g){this.fullWidth=a;this.fullHeight=b;this.x=c;this.y=d;this.width=e;this.height=g;this.updateProjectionMatrix()};
 THREE.PerspectiveCamera.prototype.updateProjectionMatrix=function(){if(this.fullWidth){var a=this.fullWidth/this.fullHeight,b=Math.tan(this.fov*Math.PI/360)*this.near,c=-b,d=a*c,a=Math.abs(a*b-d),c=Math.abs(b-c);this.projectionMatrix=THREE.Matrix4.makeFrustum(d+this.x*a/this.fullWidth,d+(this.x+this.width)*a/this.fullWidth,b-(this.y+this.height)*c/this.fullHeight,b-this.y*c/this.fullHeight,this.near,this.far)}else this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,
-this.far)};THREE.ParticleDOMMaterial=function(a){THREE.Material.call(this);this.domElement=a};THREE.Particle=function(a){THREE.Object3D.call(this);this.materials=a instanceof Array?a:[a]};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;THREE.Bone=function(a){THREE.Object3D.call(this);this.skin=a;this.skinMatrix=new THREE.Matrix4;this.hasNoneBoneChildren=!1};THREE.Bone.prototype=new THREE.Object3D;THREE.Bone.prototype.constructor=THREE.Bone;
-THREE.Bone.prototype.supr=THREE.Object3D.prototype;
+this.far)};THREE.ParticleDOMMaterial=function(a){THREE.Material.call(this);this.domElement=a};THREE.Particle=function(a){THREE.Object3D.call(this);this.material=a};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;THREE.Bone=function(a){THREE.Object3D.call(this);this.skin=a;this.skinMatrix=new THREE.Matrix4;this.hasNoneBoneChildren=!1};THREE.Bone.prototype=new THREE.Object3D;THREE.Bone.prototype.constructor=THREE.Bone;THREE.Bone.prototype.supr=THREE.Object3D.prototype;
 THREE.Bone.prototype.update=function(a,b,c){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate)a?this.skinMatrix.multiply(a,this.matrix):this.skinMatrix.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,b=!0;var d,e=this.children.length;if(this.hasNoneBoneChildren){this.matrixWorld.multiply(this.skin.matrixWorld,this.skinMatrix);for(d=0;d<e;d++)a=this.children[d],a instanceof THREE.Bone?a.update(this.skinMatrix,b,c):a.update(this.matrixWorld,!0,c)}else for(d=0;d<e;d++)this.children[d].update(this.skinMatrix,
 b,c)};THREE.Bone.prototype.add=function(a){if(this.children.indexOf(a)===-1&&(a.parent!==void 0&&a.parent.removeChild(a),a.parent=this,this.children.push(a),!(a instanceof THREE.Bone)))this.hasNoneBoneChildren=!0};THREE.Scene=function(){THREE.Object3D.call(this);this.fog=null;this.matrixAutoUpdate=!1;this.collisions=this.overrideMaterial=null;this.objects=[];this.lights=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;
 THREE.Scene.prototype.supr=THREE.Object3D.prototype;THREE.Scene.prototype.add=function(a){this.supr.add.call(this,a);this.addChildRecurse(a)};

+ 137 - 138
build/custom/ThreeExtras.js

@@ -1,19 +1,19 @@
 // ThreeExtras.js r46dev - http://github.com/mrdoob/three.js
 THREE.ColorUtils={adjustHSV:function(a,c,b,e){var f=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(a,f);f.h=THREE.Math.clamp(f.h+c,0,1);f.s=THREE.Math.clamp(f.s+b,0,1);f.v=THREE.Math.clamp(f.v+e,0,1);a.setHSV(f.h,f.s,f.v)},rgbToHsv:function(a,c){var b=a.r,e=a.g,f=a.b,h=Math.max(Math.max(b,e),f),g=Math.min(Math.min(b,e),f);if(g==h)g=b=0;else{var k=h-g,g=k/h,b=b==h?(e-f)/k:e==h?2+(f-b)/k:4+(b-e)/k;b/=6;b<0&&(b+=1);b>1&&(b-=1)}c===void 0&&(c={h:0,s:0,v:0});c.h=b;c.s=g;c.v=h;return c}};
 THREE.ColorUtils.__hsv={h:0,s:0,v:0};
-THREE.GeometryUtils={merge:function(a,c){var b,e,f=a.vertices.length,h=c instanceof THREE.Mesh?c.geometry:c,g=a.vertices,k=h.vertices,l=a.faces,m=h.faces,n=a.faceVertexUvs[0],h=h.faceVertexUvs[0];if(c instanceof THREE.Mesh)c.matrixAutoUpdate&&c.updateMatrix(),b=c.matrix,e=new THREE.Matrix4,e.extractRotation(b,c.scale);for(var o=0,t=k.length;o<t;o++){var u=new THREE.Vertex(k[o].position.clone());b&&b.multiplyVector3(u.position);g.push(u)}o=0;for(t=m.length;o<t;o++){var u=m[o],v,y,p=u.vertexNormals,
-z=u.vertexColors;u instanceof THREE.Face3?v=new THREE.Face3(u.a+f,u.b+f,u.c+f):u instanceof THREE.Face4&&(v=new THREE.Face4(u.a+f,u.b+f,u.c+f,u.d+f));v.normal.copy(u.normal);e&&e.multiplyVector3(v.normal);g=0;for(k=p.length;g<k;g++)y=p[g].clone(),e&&e.multiplyVector3(y),v.vertexNormals.push(y);v.color.copy(u.color);g=0;for(k=z.length;g<k;g++)y=z[g],v.vertexColors.push(y.clone());v.materials=u.materials.slice();v.centroid.copy(u.centroid);b&&b.multiplyVector3(v.centroid);l.push(v)}o=0;for(t=h.length;o<
-t;o++){b=h[o];e=[];g=0;for(k=b.length;g<k;g++)e.push(new THREE.UV(b[g].u,b[g].v));n.push(e)}},clone:function(a){var c=new THREE.Geometry,b,e=a.vertices,f=a.faces,h=a.faceVertexUvs[0],a=0;for(b=e.length;a<b;a++){var g=new THREE.Vertex(e[a].position.clone());c.vertices.push(g)}a=0;for(b=f.length;a<b;a++){var k=f[a],l,m,n=k.vertexNormals,o=k.vertexColors;k instanceof THREE.Face3?l=new THREE.Face3(k.a,k.b,k.c):k instanceof THREE.Face4&&(l=new THREE.Face4(k.a,k.b,k.c,k.d));l.normal.copy(k.normal);e=0;
-for(g=n.length;e<g;e++)m=n[e],l.vertexNormals.push(m.clone());l.color.copy(k.color);e=0;for(g=o.length;e<g;e++)m=o[e],l.vertexColors.push(m.clone());l.materials=k.materials.slice();l.centroid.copy(k.centroid);c.faces.push(l)}a=0;for(b=h.length;a<b;a++){f=h[a];l=[];e=0;for(g=f.length;e<g;e++)l.push(new THREE.UV(f[e].u,f[e].v));c.faceVertexUvs[0].push(l)}return c},randomPointInTriangle:function(a,c,b){var e,f,h,g=new THREE.Vector3,k=THREE.GeometryUtils.__v1;e=THREE.GeometryUtils.random();f=THREE.GeometryUtils.random();
-e+f>1&&(e=1-e,f=1-f);h=1-e-f;g.copy(a);g.multiplyScalar(e);k.copy(c);k.multiplyScalar(f);g.addSelf(k);k.copy(b);k.multiplyScalar(h);g.addSelf(k);return g},randomPointInFace:function(a,c,b){var e,f,h;if(a instanceof THREE.Face3)return e=c.vertices[a.a].position,f=c.vertices[a.b].position,h=c.vertices[a.c].position,THREE.GeometryUtils.randomPointInTriangle(e,f,h);else if(a instanceof THREE.Face4){e=c.vertices[a.a].position;f=c.vertices[a.b].position;h=c.vertices[a.c].position;var c=c.vertices[a.d].position,
-g;b?a._area1&&a._area2?(b=a._area1,g=a._area2):(b=THREE.GeometryUtils.triangleArea(e,f,c),g=THREE.GeometryUtils.triangleArea(f,h,c),a._area1=b,a._area2=g):(b=THREE.GeometryUtils.triangleArea(e,f,c),g=THREE.GeometryUtils.triangleArea(f,h,c));return THREE.GeometryUtils.random()*(b+g)<b?THREE.GeometryUtils.randomPointInTriangle(e,f,c):THREE.GeometryUtils.randomPointInTriangle(f,h,c)}},randomPointsInGeometry:function(a,c){function b(a){function b(e,c){if(c<e)return e;var g=e+Math.floor((c-e)/2);return m[g]>
-a?b(e,g-1):m[g]<a?b(g+1,c):g}return b(0,m.length-1)}var e,f,h=a.faces,g=a.vertices,k=h.length,l=0,m=[],n,o,t,u;for(f=0;f<k;f++){e=h[f];if(e instanceof THREE.Face3)n=g[e.a].position,o=g[e.b].position,t=g[e.c].position,e._area=THREE.GeometryUtils.triangleArea(n,o,t);else if(e instanceof THREE.Face4)n=g[e.a].position,o=g[e.b].position,t=g[e.c].position,u=g[e.d].position,e._area1=THREE.GeometryUtils.triangleArea(n,o,u),e._area2=THREE.GeometryUtils.triangleArea(o,t,u),e._area=e._area1+e._area2;l+=e._area;
-m[f]=l}e=[];g={};for(f=0;f<c;f++)k=THREE.GeometryUtils.random()*l,k=b(k),e[f]=THREE.GeometryUtils.randomPointInFace(h[k],a,!0),g[k]?g[k]+=1:g[k]=1;return e},triangleArea:function(a,c,b){var e,f=THREE.GeometryUtils.__v1;f.sub(a,c);e=f.length();f.sub(a,b);a=f.length();f.sub(c,b);b=f.length();c=0.5*(e+a+b);return Math.sqrt(c*(c-e)*(c-a)*(c-b))},center:function(a){a.computeBoundingBox();var c=new THREE.Matrix4;c.setTranslation(-0.5*(a.boundingBox.x[1]+a.boundingBox.x[0]),-0.5*(a.boundingBox.y[1]+a.boundingBox.y[0]),
--0.5*(a.boundingBox.z[1]+a.boundingBox.z[0]));a.applyMatrix(c);a.computeBoundingBox()}};THREE.GeometryUtils.random=THREE.Math.random16;THREE.GeometryUtils.__v1=new THREE.Vector3;
+THREE.GeometryUtils={merge:function(a,c){for(var b,e,f=a.vertices.length,h=c instanceof THREE.Mesh?c.geometry:c,g=a.vertices,k=h.vertices,l=a.faces,m=h.faces,n=a.faceVertexUvs[0],o=h.faceVertexUvs[0],u={},t=0;t<a.materials.length;t++)u[a.materials[t].id]=t;if(c instanceof THREE.Mesh)c.matrixAutoUpdate&&c.updateMatrix(),b=c.matrix,e=new THREE.Matrix4,e.extractRotation(b,c.scale);for(var t=0,z=k.length;t<z;t++){var v=new THREE.Vertex(k[t].position.clone());b&&b.multiplyVector3(v.position);g.push(v)}t=
+0;for(z=m.length;t<z;t++){var g=m[t],p,y,x=g.vertexNormals,w=g.vertexColors;g instanceof THREE.Face3?p=new THREE.Face3(g.a+f,g.b+f,g.c+f):g instanceof THREE.Face4&&(p=new THREE.Face4(g.a+f,g.b+f,g.c+f,g.d+f));p.normal.copy(g.normal);e&&e.multiplyVector3(p.normal);k=0;for(v=x.length;k<v;k++)y=x[k].clone(),e&&e.multiplyVector3(y),p.vertexNormals.push(y);p.color.copy(g.color);k=0;for(v=w.length;k<v;k++)y=w[k],p.vertexColors.push(y.clone());if(g.materialIndex!==void 0){k=h.materials[g.materialIndex];
+v=u[k.id];if(v===void 0)v=a.materials.length,a.materials.push(k);p.materialIndex=v}p.centroid.copy(g.centroid);b&&b.multiplyVector3(p.centroid);l.push(p)}t=0;for(z=o.length;t<z;t++){b=o[t];e=[];k=0;for(v=b.length;k<v;k++)e.push(new THREE.UV(b[k].u,b[k].v));n.push(e)}},clone:function(a){var c=new THREE.Geometry,b,e=a.vertices,f=a.faces,h=a.faceVertexUvs[0];if(a.materials)c.materials=a.materials.slice();a=0;for(b=e.length;a<b;a++){var g=new THREE.Vertex(e[a].position.clone());c.vertices.push(g)}a=0;
+for(b=f.length;a<b;a++){var k=f[a],l,m,n=k.vertexNormals,o=k.vertexColors;k instanceof THREE.Face3?l=new THREE.Face3(k.a,k.b,k.c):k instanceof THREE.Face4&&(l=new THREE.Face4(k.a,k.b,k.c,k.d));l.normal.copy(k.normal);e=0;for(g=n.length;e<g;e++)m=n[e],l.vertexNormals.push(m.clone());l.color.copy(k.color);e=0;for(g=o.length;e<g;e++)m=o[e],l.vertexColors.push(m.clone());l.materialIndex=k.materialIndex;l.centroid.copy(k.centroid);c.faces.push(l)}a=0;for(b=h.length;a<b;a++){f=h[a];l=[];e=0;for(g=f.length;e<
+g;e++)l.push(new THREE.UV(f[e].u,f[e].v));c.faceVertexUvs[0].push(l)}return c},randomPointInTriangle:function(a,c,b){var e,f,h,g=new THREE.Vector3,k=THREE.GeometryUtils.__v1;e=THREE.GeometryUtils.random();f=THREE.GeometryUtils.random();e+f>1&&(e=1-e,f=1-f);h=1-e-f;g.copy(a);g.multiplyScalar(e);k.copy(c);k.multiplyScalar(f);g.addSelf(k);k.copy(b);k.multiplyScalar(h);g.addSelf(k);return g},randomPointInFace:function(a,c,b){var e,f,h;if(a instanceof THREE.Face3)return e=c.vertices[a.a].position,f=c.vertices[a.b].position,
+h=c.vertices[a.c].position,THREE.GeometryUtils.randomPointInTriangle(e,f,h);else if(a instanceof THREE.Face4){e=c.vertices[a.a].position;f=c.vertices[a.b].position;h=c.vertices[a.c].position;var c=c.vertices[a.d].position,g;b?a._area1&&a._area2?(b=a._area1,g=a._area2):(b=THREE.GeometryUtils.triangleArea(e,f,c),g=THREE.GeometryUtils.triangleArea(f,h,c),a._area1=b,a._area2=g):(b=THREE.GeometryUtils.triangleArea(e,f,c),g=THREE.GeometryUtils.triangleArea(f,h,c));return THREE.GeometryUtils.random()*(b+
+g)<b?THREE.GeometryUtils.randomPointInTriangle(e,f,c):THREE.GeometryUtils.randomPointInTriangle(f,h,c)}},randomPointsInGeometry:function(a,c){function b(a){function b(e,c){if(c<e)return e;var g=e+Math.floor((c-e)/2);return m[g]>a?b(e,g-1):m[g]<a?b(g+1,c):g}return b(0,m.length-1)}var e,f,h=a.faces,g=a.vertices,k=h.length,l=0,m=[],n,o,u,t;for(f=0;f<k;f++){e=h[f];if(e instanceof THREE.Face3)n=g[e.a].position,o=g[e.b].position,u=g[e.c].position,e._area=THREE.GeometryUtils.triangleArea(n,o,u);else if(e instanceof
+THREE.Face4)n=g[e.a].position,o=g[e.b].position,u=g[e.c].position,t=g[e.d].position,e._area1=THREE.GeometryUtils.triangleArea(n,o,t),e._area2=THREE.GeometryUtils.triangleArea(o,u,t),e._area=e._area1+e._area2;l+=e._area;m[f]=l}e=[];g={};for(f=0;f<c;f++)k=THREE.GeometryUtils.random()*l,k=b(k),e[f]=THREE.GeometryUtils.randomPointInFace(h[k],a,!0),g[k]?g[k]+=1:g[k]=1;return e},triangleArea:function(a,c,b){var e,f=THREE.GeometryUtils.__v1;f.sub(a,c);e=f.length();f.sub(a,b);a=f.length();f.sub(c,b);b=f.length();
+c=0.5*(e+a+b);return Math.sqrt(c*(c-e)*(c-a)*(c-b))},center:function(a){a.computeBoundingBox();var c=new THREE.Matrix4;c.setTranslation(-0.5*(a.boundingBox.x[1]+a.boundingBox.x[0]),-0.5*(a.boundingBox.y[1]+a.boundingBox.y[0]),-0.5*(a.boundingBox.z[1]+a.boundingBox.z[0]));a.applyMatrix(c);a.computeBoundingBox()}};THREE.GeometryUtils.random=THREE.Math.random16;THREE.GeometryUtils.__v1=new THREE.Vector3;
 THREE.ImageUtils={loadTexture:function(a,c,b){var e=new Image,f=new THREE.Texture(e,c);e.onload=function(){f.needsUpdate=!0;b&&b(this)};e.crossOrigin="";e.src=a;return f},loadTextureCube:function(a,c,b){var e,f=[],h=new THREE.Texture(f,c),c=f.loadCount=0;for(e=a.length;c<e;++c)f[c]=new Image,f[c].onload=function(){f.loadCount+=1;if(f.loadCount==6)h.needsUpdate=!0;b&&b(this)},f[c].crossOrigin="",f[c].src=a[c];return h},getNormalMap:function(a,c){var b=function(a){var b=Math.sqrt(a[0]*a[0]+a[1]*a[1]+
-a[2]*a[2]);return[a[0]/b,a[1]/b,a[2]/b]};c|=1;var e=a.width,f=a.height,h=document.createElement("canvas");h.width=e;h.height=f;var g=h.getContext("2d");g.drawImage(a,0,0);for(var k=g.getImageData(0,0,e,f).data,l=g.createImageData(e,f),m=l.data,n=0;n<e;n++)for(var o=1;o<f;o++){var t=o-1<0?f-1:o-1,u=(o+1)%f,v=n-1<0?e-1:n-1,y=(n+1)%e,p=[],z=[0,0,k[(o*e+n)*4]/255*c];p.push([-1,0,k[(o*e+v)*4]/255*c]);p.push([-1,-1,k[(t*e+v)*4]/255*c]);p.push([0,-1,k[(t*e+n)*4]/255*c]);p.push([1,-1,k[(t*e+y)*4]/255*c]);
-p.push([1,0,k[(o*e+y)*4]/255*c]);p.push([1,1,k[(u*e+y)*4]/255*c]);p.push([0,1,k[(u*e+n)*4]/255*c]);p.push([-1,1,k[(u*e+v)*4]/255*c]);t=[];v=p.length;for(u=0;u<v;u++){var y=p[u],x=p[(u+1)%v],y=[y[0]-z[0],y[1]-z[1],y[2]-z[2]],x=[x[0]-z[0],x[1]-z[1],x[2]-z[2]];t.push(b([y[1]*x[2]-y[2]*x[1],y[2]*x[0]-y[0]*x[2],y[0]*x[1]-y[1]*x[0]]))}p=[0,0,0];for(u=0;u<t.length;u++)p[0]+=t[u][0],p[1]+=t[u][1],p[2]+=t[u][2];p[0]/=t.length;p[1]/=t.length;p[2]/=t.length;z=(o*e+n)*4;m[z]=(p[0]+1)/2*255|0;m[z+1]=(p[1]+0.5)*
-255|0;m[z+2]=p[2]*255|0;m[z+3]=255}g.putImageData(l,0,0);return h}};THREE.SceneUtils={showHierarchy:function(a,c){THREE.SceneUtils.traverseHierarchy(a,function(a){a.visible=c})},traverseHierarchy:function(a,c){var b,e,f=a.children.length;for(e=0;e<f;e++)b=a.children[e],c(b),THREE.SceneUtils.traverseHierarchy(b,c)}};
+a[2]*a[2]);return[a[0]/b,a[1]/b,a[2]/b]};c|=1;var e=a.width,f=a.height,h=document.createElement("canvas");h.width=e;h.height=f;var g=h.getContext("2d");g.drawImage(a,0,0);for(var k=g.getImageData(0,0,e,f).data,l=g.createImageData(e,f),m=l.data,n=0;n<e;n++)for(var o=1;o<f;o++){var u=o-1<0?f-1:o-1,t=(o+1)%f,z=n-1<0?e-1:n-1,v=(n+1)%e,p=[],y=[0,0,k[(o*e+n)*4]/255*c];p.push([-1,0,k[(o*e+z)*4]/255*c]);p.push([-1,-1,k[(u*e+z)*4]/255*c]);p.push([0,-1,k[(u*e+n)*4]/255*c]);p.push([1,-1,k[(u*e+v)*4]/255*c]);
+p.push([1,0,k[(o*e+v)*4]/255*c]);p.push([1,1,k[(t*e+v)*4]/255*c]);p.push([0,1,k[(t*e+n)*4]/255*c]);p.push([-1,1,k[(t*e+z)*4]/255*c]);u=[];z=p.length;for(t=0;t<z;t++){var v=p[t],x=p[(t+1)%z],v=[v[0]-y[0],v[1]-y[1],v[2]-y[2]],x=[x[0]-y[0],x[1]-y[1],x[2]-y[2]];u.push(b([v[1]*x[2]-v[2]*x[1],v[2]*x[0]-v[0]*x[2],v[0]*x[1]-v[1]*x[0]]))}p=[0,0,0];for(t=0;t<u.length;t++)p[0]+=u[t][0],p[1]+=u[t][1],p[2]+=u[t][2];p[0]/=u.length;p[1]/=u.length;p[2]/=u.length;y=(o*e+n)*4;m[y]=(p[0]+1)/2*255|0;m[y+1]=(p[1]+0.5)*
+255|0;m[y+2]=p[2]*255|0;m[y+3]=255}g.putImageData(l,0,0);return h}};THREE.SceneUtils={showHierarchy:function(a,c){THREE.SceneUtils.traverseHierarchy(a,function(a){a.visible=c})},traverseHierarchy:function(a,c){var b,e,f=a.children.length;for(e=0;e<f;e++)b=a.children[e],c(b),THREE.SceneUtils.traverseHierarchy(b,c)},createMultiMaterialObject:function(a,c){var b,e=c.length,f=new THREE.Object3D;for(b=0;b<e;b++){var h=new THREE.Mesh(a,c[b]);f.add(h)}return f}};
 if(THREE.WebGLRenderer)THREE.ShaderUtils={lib:{fresnel:{uniforms:{mRefractionRatio:{type:"f",value:1.02},mFresnelBias:{type:"f",value:0.1},mFresnelPower:{type:"f",value:2},mFresnelScale:{type:"f",value:1},tCube:{type:"t",value:1,texture:null}},fragmentShader:"uniform samplerCube tCube;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 reflectedColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );\nvec4 refractedColor = vec4( 1.0, 1.0, 1.0, 1.0 );\nrefractedColor.r = textureCube( tCube, vec3( -vRefract[0].x, vRefract[0].yz ) ).r;\nrefractedColor.g = textureCube( tCube, vec3( -vRefract[1].x, vRefract[1].yz ) ).g;\nrefractedColor.b = textureCube( tCube, vec3( -vRefract[2].x, vRefract[2].yz ) ).b;\nrefractedColor.a = 1.0;\ngl_FragColor = mix( refractedColor, reflectedColor, clamp( vReflectionFactor, 0.0, 1.0 ) );\n}",
 vertexShader:"uniform float mRefractionRatio;\nuniform float mFresnelBias;\nuniform float mFresnelScale;\nuniform float mFresnelPower;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = normalize ( mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal );\nvec3 I = mPosition.xyz - cameraPosition;\nvReflect = reflect( I, nWorld );\nvRefract[0] = refract( normalize( I ), nWorld, mRefractionRatio );\nvRefract[1] = refract( normalize( I ), nWorld, mRefractionRatio * 0.99 );\nvRefract[2] = refract( normalize( I ), nWorld, mRefractionRatio * 0.98 );\nvReflectionFactor = mFresnelBias + mFresnelScale * pow( 1.0 + dot( normalize( I ), nWorld ), mFresnelPower );\ngl_Position = projectionMatrix * mvPosition;\n}"},
 normal:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.fog,THREE.UniformsLib.lights,THREE.UniformsLib.shadowmap,{enableAO:{type:"i",value:0},enableDiffuse:{type:"i",value:0},enableSpecular:{type:"i",value:0},enableReflection:{type:"i",value:0},tDiffuse:{type:"t",value:0,texture:null},tCube:{type:"t",value:1,texture:null},tNormal:{type:"t",value:2,texture:null},tSpecular:{type:"t",value:3,texture:null},tAO:{type:"t",value:4,texture:null},tDisplacement:{type:"t",value:5,texture:null},uNormalScale:{type:"f",
@@ -52,9 +52,9 @@ THREE.Path.prototype.quadraticCurveTo=function(a,c,b,e){var f=Array.prototype.sl
 THREE.Path.prototype.bezierCurveTo=function(a,c,b,e,f,h){var g=Array.prototype.slice.call(arguments),k=this.actions[this.actions.length-1].args;this.curves.push(new THREE.CubicBezierCurve(new THREE.Vector2(k[k.length-2],k[k.length-1]),new THREE.Vector2(a,c),new THREE.Vector2(b,e),new THREE.Vector2(f,h)));this.actions.push({action:THREE.PathActions.BEZIER_CURVE_TO,args:g})};
 THREE.Path.prototype.splineThru=function(a){var c=Array.prototype.slice.call(arguments),b=this.actions[this.actions.length-1].args,b=[new THREE.Vector2(b[b.length-2],b[b.length-1])];Array.prototype.push.apply(b,a);this.curves.push(new THREE.SplineCurve(b));this.actions.push({action:THREE.PathActions.CSPLINE_THRU,args:c})};
 THREE.Path.prototype.arc=function(a,c,b,e,f,h){var g=Array.prototype.slice.call(arguments);this.curves.push(new THREE.ArcCurve(a,c,b,e,f,h));this.actions.push({action:THREE.PathActions.ARC,args:g})};THREE.Path.prototype.getSpacedPoints=function(a){a||(a=40);for(var c=[],b=0;b<a;b++)c.push(this.getPoint(b/a));return c};
-THREE.Path.prototype.getPoints=function(a,c){var a=a||12,b=[],e,f,h,g,k,l,m,n,o,t,u,v,y;e=0;for(f=this.actions.length;e<f;e++)switch(h=this.actions[e],g=h.action,h=h.args,g){case THREE.PathActions.LINE_TO:b.push(new THREE.Vector2(h[0],h[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:k=h[2];l=h[3];o=h[0];t=h[1];b.length>0?(g=b[b.length-1],u=g.x,v=g.y):(g=this.actions[e-1].args,u=g[g.length-2],v=g[g.length-1]);for(g=1;g<=a;g++)y=g/a,h=THREE.Shape.Utils.b2(y,u,o,k),y=THREE.Shape.Utils.b2(y,v,t,
-l),b.push(new THREE.Vector2(h,y));break;case THREE.PathActions.BEZIER_CURVE_TO:k=h[4];l=h[5];o=h[0];t=h[1];m=h[2];n=h[3];b.length>0?(g=b[b.length-1],u=g.x,v=g.y):(g=this.actions[e-1].args,u=g[g.length-2],v=g[g.length-1]);for(g=1;g<=a;g++)y=g/a,h=THREE.Shape.Utils.b3(y,u,o,m,k),y=THREE.Shape.Utils.b3(y,v,t,n,l),b.push(new THREE.Vector2(h,y));break;case THREE.PathActions.CSPLINE_THRU:g=this.actions[e-1].args;g=[new THREE.Vector2(g[g.length-2],g[g.length-1])];y=a*h[0].length;g=g.concat(h[0]);h=new THREE.SplineCurve(g);
-for(g=1;g<=y;g++)b.push(h.getPointAt(g/y));break;case THREE.PathActions.ARC:g=this.actions[e-1].args;k=h[0];l=h[1];m=h[2];o=h[3];y=h[4];t=!!h[5];n=g[g.length-2];u=g[g.length-1];g.length==0&&(n=u=0);v=y-o;var p=a*2;for(g=1;g<=p;g++)y=g/p,t||(y=1-y),y=o+y*v,h=n+k+m*Math.cos(y),y=u+l+m*Math.sin(y),b.push(new THREE.Vector2(h,y))}c&&b.push(b[0]);return b};THREE.Path.prototype.transform=function(a,c){this.getBoundingBox();return this.getWrapPoints(this.getPoints(c),a)};
+THREE.Path.prototype.getPoints=function(a,c){var a=a||12,b=[],e,f,h,g,k,l,m,n,o,u,t,z,v;e=0;for(f=this.actions.length;e<f;e++)switch(h=this.actions[e],g=h.action,h=h.args,g){case THREE.PathActions.LINE_TO:b.push(new THREE.Vector2(h[0],h[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:k=h[2];l=h[3];o=h[0];u=h[1];b.length>0?(g=b[b.length-1],t=g.x,z=g.y):(g=this.actions[e-1].args,t=g[g.length-2],z=g[g.length-1]);for(g=1;g<=a;g++)v=g/a,h=THREE.Shape.Utils.b2(v,t,o,k),v=THREE.Shape.Utils.b2(v,z,u,
+l),b.push(new THREE.Vector2(h,v));break;case THREE.PathActions.BEZIER_CURVE_TO:k=h[4];l=h[5];o=h[0];u=h[1];m=h[2];n=h[3];b.length>0?(g=b[b.length-1],t=g.x,z=g.y):(g=this.actions[e-1].args,t=g[g.length-2],z=g[g.length-1]);for(g=1;g<=a;g++)v=g/a,h=THREE.Shape.Utils.b3(v,t,o,m,k),v=THREE.Shape.Utils.b3(v,z,u,n,l),b.push(new THREE.Vector2(h,v));break;case THREE.PathActions.CSPLINE_THRU:g=this.actions[e-1].args;g=[new THREE.Vector2(g[g.length-2],g[g.length-1])];v=a*h[0].length;g=g.concat(h[0]);h=new THREE.SplineCurve(g);
+for(g=1;g<=v;g++)b.push(h.getPointAt(g/v));break;case THREE.PathActions.ARC:g=this.actions[e-1].args;k=h[0];l=h[1];m=h[2];o=h[3];v=h[4];u=!!h[5];n=g[g.length-2];t=g[g.length-1];g.length==0&&(n=t=0);z=v-o;var p=a*2;for(g=1;g<=p;g++)v=g/p,u||(v=1-v),v=o+v*z,h=n+k+m*Math.cos(v),v=t+l+m*Math.sin(v),b.push(new THREE.Vector2(h,v))}c&&b.push(b[0]);return b};THREE.Path.prototype.transform=function(a,c){this.getBoundingBox();return this.getWrapPoints(this.getPoints(c),a)};
 THREE.Path.prototype.nltransform=function(a,c,b,e,f,h){var g=this.getPoints(),k,l,m,n,o;k=0;for(l=g.length;k<l;k++)m=g[k],n=m.x,o=m.y,m.x=a*n+c*o+b,m.y=e*o+f*n+h;return g};
 THREE.Path.prototype.debug=function(a){var c=this.getBoundingBox();a||(a=document.createElement("canvas"),a.setAttribute("width",c.maxX+100),a.setAttribute("height",c.maxY+100),document.body.appendChild(a));c=a.getContext("2d");c.fillStyle="white";c.fillRect(0,0,a.width,a.height);c.strokeStyle="black";c.beginPath();var b,e,f,a=0;for(b=this.actions.length;a<b;a++)e=this.actions[a],f=e.args,e=e.action,e!=THREE.PathActions.CSPLINE_THRU&&c[e].apply(c,f);c.stroke();c.closePath();c.strokeStyle="red";e=
 this.getPoints();a=0;for(b=e.length;a<b;a++)f=e[a],c.beginPath(),c.arc(f.x,f.y,1.5,0,Math.PI*2,!1),c.stroke(),c.closePath()};
@@ -62,9 +62,9 @@ THREE.Path.prototype.toShapes=function(){var a,c,b,e,f=[],h=new THREE.Path;a=0;f
 e.curves):g.holes.push(e);h.push(g)}else{g=new THREE.Shape;a=0;for(c=f.length;a<c;a++)e=f[a],THREE.Shape.Utils.isClockWise(e.getPoints())?(g.actions=e.actions,g.curves=e.curves,h.push(g),g=new THREE.Shape):g.holes.push(e)}return h};THREE.Shape=function(){THREE.Path.apply(this,arguments);this.holes=[]};THREE.Shape.prototype=new THREE.Path;THREE.Shape.prototype.constructor=THREE.Path;THREE.Shape.prototype.extrude=function(a){return new THREE.ExtrudeGeometry(this,a)};
 THREE.Shape.prototype.getPointsHoles=function(a){var c,b=this.holes.length,e=[];for(c=0;c<b;c++)e[c]=this.holes[c].getTransformedPoints(a,this.bends);return e};THREE.Shape.prototype.getSpacedPointsHoles=function(a){var c,b=this.holes.length,e=[];for(c=0;c<b;c++)e[c]=this.holes[c].getTransformedSpacedPoints(a,this.bends);return e};THREE.Shape.prototype.extractAllPoints=function(a){return{shape:this.getTransformedPoints(a),holes:this.getPointsHoles(a)}};
 THREE.Shape.prototype.extractAllSpacedPoints=function(a){return{shape:this.getTransformedSpacedPoints(a),holes:this.getSpacedPointsHoles(a)}};
-THREE.Shape.Utils={removeHoles:function(a,c){var b=a.concat(),e=b.concat(),f,h,g,k,l,m,n,o,t,u,v=[];for(l=0;l<c.length;l++){m=c[l];Array.prototype.push.apply(e,m);h=Number.POSITIVE_INFINITY;for(f=0;f<m.length;f++){t=m[f];u=[];for(o=0;o<b.length;o++)n=b[o],n=t.distanceToSquared(n),u.push(n),n<h&&(h=n,g=f,k=o)}f=k-1>=0?k-1:b.length-1;h=g-1>=0?g-1:m.length-1;var y=[m[g],b[k],b[f]];o=THREE.FontUtils.Triangulate.area(y);var p=[m[g],m[h],b[k]];t=THREE.FontUtils.Triangulate.area(p);u=k;n=g;k+=1;g+=-1;k<
-0&&(k+=b.length);k%=b.length;g<0&&(g+=m.length);g%=m.length;f=k-1>=0?k-1:b.length-1;h=g-1>=0?g-1:m.length-1;y=[m[g],b[k],b[f]];y=THREE.FontUtils.Triangulate.area(y);p=[m[g],m[h],b[k]];p=THREE.FontUtils.Triangulate.area(p);o+t>y+p&&(k=u,g=n,k<0&&(k+=b.length),k%=b.length,g<0&&(g+=m.length),g%=m.length,f=k-1>=0?k-1:b.length-1,h=g-1>=0?g-1:m.length-1);o=b.slice(0,k);t=b.slice(k);u=m.slice(g);n=m.slice(0,g);h=[m[g],m[h],b[k]];v.push([m[g],b[k],b[f]]);v.push(h);b=o.concat(u).concat(n).concat(t)}return{shape:b,
-isolatedPts:v,allpoints:e}},triangulateShape:function(a,c){var b=THREE.Shape.Utils.removeHoles(a,c),e=b.allpoints,f=b.isolatedPts,b=THREE.FontUtils.Triangulate(b.shape,!1),h,g,k,l,m={};h=0;for(g=e.length;h<g;h++)l=e[h].x+":"+e[h].y,m[l]!==void 0&&console.log("Duplicate point",l),m[l]=h;h=0;for(g=b.length;h<g;h++){k=b[h];for(e=0;e<3;e++)l=k[e].x+":"+k[e].y,l=m[l],l!==void 0&&(k[e]=l)}h=0;for(g=f.length;h<g;h++){k=f[h];for(e=0;e<3;e++)l=k[e].x+":"+k[e].y,l=m[l],l!==void 0&&(k[e]=l)}return b.concat(f)},
+THREE.Shape.Utils={removeHoles:function(a,c){var b=a.concat(),e=b.concat(),f,h,g,k,l,m,n,o,u,t,z=[];for(l=0;l<c.length;l++){m=c[l];Array.prototype.push.apply(e,m);h=Number.POSITIVE_INFINITY;for(f=0;f<m.length;f++){u=m[f];t=[];for(o=0;o<b.length;o++)n=b[o],n=u.distanceToSquared(n),t.push(n),n<h&&(h=n,g=f,k=o)}f=k-1>=0?k-1:b.length-1;h=g-1>=0?g-1:m.length-1;var v=[m[g],b[k],b[f]];o=THREE.FontUtils.Triangulate.area(v);var p=[m[g],m[h],b[k]];u=THREE.FontUtils.Triangulate.area(p);t=k;n=g;k+=1;g+=-1;k<
+0&&(k+=b.length);k%=b.length;g<0&&(g+=m.length);g%=m.length;f=k-1>=0?k-1:b.length-1;h=g-1>=0?g-1:m.length-1;v=[m[g],b[k],b[f]];v=THREE.FontUtils.Triangulate.area(v);p=[m[g],m[h],b[k]];p=THREE.FontUtils.Triangulate.area(p);o+u>v+p&&(k=t,g=n,k<0&&(k+=b.length),k%=b.length,g<0&&(g+=m.length),g%=m.length,f=k-1>=0?k-1:b.length-1,h=g-1>=0?g-1:m.length-1);o=b.slice(0,k);u=b.slice(k);t=m.slice(g);n=m.slice(0,g);h=[m[g],m[h],b[k]];z.push([m[g],b[k],b[f]]);z.push(h);b=o.concat(t).concat(n).concat(u)}return{shape:b,
+isolatedPts:z,allpoints:e}},triangulateShape:function(a,c){var b=THREE.Shape.Utils.removeHoles(a,c),e=b.allpoints,f=b.isolatedPts,b=THREE.FontUtils.Triangulate(b.shape,!1),h,g,k,l,m={};h=0;for(g=e.length;h<g;h++)l=e[h].x+":"+e[h].y,m[l]!==void 0&&console.log("Duplicate point",l),m[l]=h;h=0;for(g=b.length;h<g;h++){k=b[h];for(e=0;e<3;e++)l=k[e].x+":"+k[e].y,l=m[l],l!==void 0&&(k[e]=l)}h=0;for(g=f.length;h<g;h++){k=f[h];for(e=0;e<3;e++)l=k[e].x+":"+k[e].y,l=m[l],l!==void 0&&(k[e]=l)}return b.concat(f)},
 isClockWise:function(a){return THREE.FontUtils.Triangulate.area(a)<0},b2p0:function(a,c){var b=1-a;return b*b*c},b2p1:function(a,c){return 2*(1-a)*a*c},b2p2:function(a,c){return a*a*c},b2:function(a,c,b,e){return this.b2p0(a,c)+this.b2p1(a,b)+this.b2p2(a,e)},b3p0:function(a,c){var b=1-a;return b*b*b*c},b3p1:function(a,c){var b=1-a;return 3*b*b*a*c},b3p2:function(a,c){return 3*(1-a)*a*a*c},b3p3:function(a,c){return a*a*a*c},b3:function(a,c,b,e,f){return this.b3p0(a,c)+this.b3p1(a,b)+this.b3p2(a,e)+
 this.b3p3(a,f)}};THREE.TextPath=function(a,c){THREE.Path.call(this);this.parameters=c||{};this.set(a)};THREE.TextPath.prototype.set=function(a,c){this.text=a;var c=c||this.parameters,b=c.curveSegments!==void 0?c.curveSegments:4,e=c.font!==void 0?c.font:"helvetiker",f=c.weight!==void 0?c.weight:"normal",h=c.style!==void 0?c.style:"normal";THREE.FontUtils.size=c.size!==void 0?c.size:100;THREE.FontUtils.divisions=b;THREE.FontUtils.face=e;THREE.FontUtils.weight=f;THREE.FontUtils.style=h};
 THREE.TextPath.prototype.toShapes=function(){for(var a=THREE.FontUtils.drawText(this.text).paths,c=[],b=0,e=a.length;b<e;b++)Array.prototype.push.apply(c,a[b].toShapes());return c};
@@ -77,11 +77,11 @@ THREE.Animation.prototype.play=function(a,c){if(!this.isPlaying){this.isPlaying=
 THREE.Bone?f.skinMatrix:f.matrix;var h=f.animationCache.prevKey;f=f.animationCache.nextKey;h.pos=this.data.hierarchy[b].keys[0];h.rot=this.data.hierarchy[b].keys[0];h.scl=this.data.hierarchy[b].keys[0];f.pos=this.getNextKeyWith("pos",b,1);f.rot=this.getNextKeyWith("rot",b,1);f.scl=this.getNextKeyWith("scl",b,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
 THREE.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
 THREE.Animation.prototype.stop=function(){this.isPaused=this.isPlaying=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.hierarchy.length;a++)if(this.hierarchy[a].animationCache!==void 0)this.hierarchy[a]instanceof THREE.Bone?this.hierarchy[a].skinMatrix=this.hierarchy[a].animationCache.originalMatrix:this.hierarchy[a].matrix=this.hierarchy[a].animationCache.originalMatrix,delete this.hierarchy[a].animationCache};
-THREE.Animation.prototype.update=function(a){if(this.isPlaying){var c=["pos","rot","scl"],b,e,f,h,g,k,l,m,n=this.data.JIT.hierarchy,o,t;this.currentTime+=a*this.timeScale;t=this.currentTime;o=this.currentTime%=this.data.length;m=parseInt(Math.min(o*this.data.fps,this.data.length*this.data.fps),10);for(var u=0,v=this.hierarchy.length;u<v;u++)if(a=this.hierarchy[u],l=a.animationCache,this.JITCompile&&n[u][m]!==void 0)a instanceof THREE.Bone?(a.skinMatrix=n[u][m],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=
-!1):(a.matrix=n[u][m],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=!0);else{if(this.JITCompile)a instanceof THREE.Bone?a.skinMatrix=a.animationCache.originalMatrix:a.matrix=a.animationCache.originalMatrix;for(var y=0;y<3;y++){b=c[y];g=l.prevKey[b];k=l.nextKey[b];if(k.time<=t){if(o<t)if(this.loop){g=this.data.hierarchy[u].keys[0];for(k=this.getNextKeyWith(b,u,1);k.time<o;)g=k,k=this.getNextKeyWith(b,u,k.index+1)}else{this.stop();return}else{do g=k,k=this.getNextKeyWith(b,u,k.index+1);while(k.time<
-o)}l.prevKey[b]=g;l.nextKey[b]=k}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;e=(o-g.time)/(k.time-g.time);f=g[b];h=k[b];if(e<0||e>1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+e+" on bone "+u),e=e<0?0:1;if(b==="pos")if(b=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)b.x=f[0]+(h[0]-f[0])*e,b.y=f[1]+(h[1]-f[1])*e,b.z=f[2]+(h[2]-f[2])*e;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
-this.getPrevKeyWith("pos",u,g.index-1).pos,this.points[1]=f,this.points[2]=h,this.points[3]=this.getNextKeyWith("pos",u,k.index+1).pos,e=e*0.33+0.33,f=this.interpolateCatmullRom(this.points,e),b.x=f[0],b.y=f[1],b.z=f[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)e=this.interpolateCatmullRom(this.points,e*1.01),this.target.set(e[0],e[1],e[2]),this.target.subSelf(b),this.target.y=0,this.target.normalize(),e=Math.atan2(this.target.x,this.target.z),a.rotation.set(0,e,0)}else if(b===
-"rot")THREE.Quaternion.slerp(f,h,a.quaternion,e);else if(b==="scl")b=a.scale,b.x=f[0]+(h[0]-f[0])*e,b.y=f[1]+(h[1]-f[1])*e,b.z=f[2]+(h[2]-f[2])*e}}if(this.JITCompile&&n[0][m]===void 0){this.hierarchy[0].update(void 0,!0);for(u=0;u<this.hierarchy.length;u++)n[u][m]=this.hierarchy[u]instanceof THREE.Bone?this.hierarchy[u].skinMatrix.clone():this.hierarchy[u].matrix.clone()}}};
+THREE.Animation.prototype.update=function(a){if(this.isPlaying){var c=["pos","rot","scl"],b,e,f,h,g,k,l,m,n=this.data.JIT.hierarchy,o,u;this.currentTime+=a*this.timeScale;u=this.currentTime;o=this.currentTime%=this.data.length;m=parseInt(Math.min(o*this.data.fps,this.data.length*this.data.fps),10);for(var t=0,z=this.hierarchy.length;t<z;t++)if(a=this.hierarchy[t],l=a.animationCache,this.JITCompile&&n[t][m]!==void 0)a instanceof THREE.Bone?(a.skinMatrix=n[t][m],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=
+!1):(a.matrix=n[t][m],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=!0);else{if(this.JITCompile)a instanceof THREE.Bone?a.skinMatrix=a.animationCache.originalMatrix:a.matrix=a.animationCache.originalMatrix;for(var v=0;v<3;v++){b=c[v];g=l.prevKey[b];k=l.nextKey[b];if(k.time<=u){if(o<u)if(this.loop){g=this.data.hierarchy[t].keys[0];for(k=this.getNextKeyWith(b,t,1);k.time<o;)g=k,k=this.getNextKeyWith(b,t,k.index+1)}else{this.stop();return}else{do g=k,k=this.getNextKeyWith(b,t,k.index+1);while(k.time<
+o)}l.prevKey[b]=g;l.nextKey[b]=k}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;e=(o-g.time)/(k.time-g.time);f=g[b];h=k[b];if(e<0||e>1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+e+" on bone "+t),e=e<0?0:1;if(b==="pos")if(b=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)b.x=f[0]+(h[0]-f[0])*e,b.y=f[1]+(h[1]-f[1])*e,b.z=f[2]+(h[2]-f[2])*e;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
+this.getPrevKeyWith("pos",t,g.index-1).pos,this.points[1]=f,this.points[2]=h,this.points[3]=this.getNextKeyWith("pos",t,k.index+1).pos,e=e*0.33+0.33,f=this.interpolateCatmullRom(this.points,e),b.x=f[0],b.y=f[1],b.z=f[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)e=this.interpolateCatmullRom(this.points,e*1.01),this.target.set(e[0],e[1],e[2]),this.target.subSelf(b),this.target.y=0,this.target.normalize(),e=Math.atan2(this.target.x,this.target.z),a.rotation.set(0,e,0)}else if(b===
+"rot")THREE.Quaternion.slerp(f,h,a.quaternion,e);else if(b==="scl")b=a.scale,b.x=f[0]+(h[0]-f[0])*e,b.y=f[1]+(h[1]-f[1])*e,b.z=f[2]+(h[2]-f[2])*e}}if(this.JITCompile&&n[0][m]===void 0){this.hierarchy[0].update(void 0,!0);for(t=0;t<this.hierarchy.length;t++)n[t][m]=this.hierarchy[t]instanceof THREE.Bone?this.hierarchy[t].skinMatrix.clone():this.hierarchy[t].matrix.clone()}}};
 THREE.Animation.prototype.interpolateCatmullRom=function(a,c){var b=[],e=[],f,h,g,k,l,m;f=(a.length-1)*c;h=Math.floor(f);f-=h;b[0]=h==0?h:h-1;b[1]=h;b[2]=h>a.length-2?h:h+1;b[3]=h>a.length-3?h:h+2;h=a[b[0]];k=a[b[1]];l=a[b[2]];m=a[b[3]];b=f*f;g=f*b;e[0]=this.interpolate(h[0],k[0],l[0],m[0],f,b,g);e[1]=this.interpolate(h[1],k[1],l[1],m[1],f,b,g);e[2]=this.interpolate(h[2],k[2],l[2],m[2],f,b,g);return e};
 THREE.Animation.prototype.interpolate=function(a,c,b,e,f,h,g){a=(b-a)*0.5;e=(e-c)*0.5;return(2*(c-b)+a+e)*g+(-3*(c-b)-2*a-e)*h+a*f+c};THREE.Animation.prototype.getNextKeyWith=function(a,c,b){var e=this.data.hierarchy[c].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?b=b<e.length-1?b:e.length-1:b%=e.length;b<e.length;b++)if(e[b][a]!==void 0)return e[b];return this.data.hierarchy[c].keys[0]};
 THREE.Animation.prototype.getPrevKeyWith=function(a,c,b){for(var e=this.data.hierarchy[c].keys,b=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?b>0?b:0:b>=0?b:b+e.length;b>=0;b--)if(e[b][a]!==void 0)return e[b];return this.data.hierarchy[c].keys[e.length-1]};
@@ -101,7 +101,7 @@ function(a){switch(a.keyCode){case 38:case 87:this.moveForward=!0;break;case 37:
 this.moveUp&&this.object.translateY(b);this.moveDown&&this.object.translateY(-b);b=a*this.lookSpeed;this.activeLook||(b=0);this.lon+=this.mouseX*b;this.lookVertical&&(this.lat-=this.mouseY*b);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;var a=this.target,c=this.object.position;a.x=c.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=c.y+100*Math.cos(this.phi);a.z=c.z+100*Math.sin(this.phi)*Math.sin(this.theta)}a=1;this.constrainVertical&&
 (a=Math.PI/(this.verticalMax-this.verticalMin));this.lon+=this.mouseX*b;this.lookVertical&&(this.lat-=this.mouseY*b*a);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;if(this.constrainVertical)this.phi=THREE.Math.mapLinear(this.phi,0,Math.PI,this.verticalMin,this.verticalMax);a=this.target;c=this.object.position;a.x=c.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=c.y+100*Math.cos(this.phi);a.z=c.z+100*Math.sin(this.phi)*Math.sin(this.theta);
 this.object.lookAt(a)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",b(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",b(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",b(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",b(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",b(this,this.onKeyUp),!1)};
-THREE.PathControls=function(a,c){function b(a){if((a*=2)<1)return 0.5*a*a;return-0.5*(--a*(a-2)-1)}function e(a,b){return function(){b.apply(a,arguments)}}function f(a,b,e,c){var g={name:e,fps:0.6,length:c,hierarchy:[]},h,f=b.getControlPointsArray(),k=b.getLength(),p=f.length,z=0;h=p-1;b={parent:-1,keys:[]};b.keys[0]={time:0,pos:f[0],rot:[0,0,0,1],scl:[1,1,1]};b.keys[h]={time:c,pos:f[h],rot:[0,0,0,1],scl:[1,1,1]};for(h=1;h<p-1;h++)z=c*k.chunks[h]/k.total,b.keys[h]={time:z,pos:f[h]};g.hierarchy[0]=
+THREE.PathControls=function(a,c){function b(a){if((a*=2)<1)return 0.5*a*a;return-0.5*(--a*(a-2)-1)}function e(a,b){return function(){b.apply(a,arguments)}}function f(a,b,e,c){var g={name:e,fps:0.6,length:c,hierarchy:[]},h,f=b.getControlPointsArray(),k=b.getLength(),p=f.length,y=0;h=p-1;b={parent:-1,keys:[]};b.keys[0]={time:0,pos:f[0],rot:[0,0,0,1],scl:[1,1,1]};b.keys[h]={time:c,pos:f[h],rot:[0,0,0,1],scl:[1,1,1]};for(h=1;h<p-1;h++)y=c*k.chunks[h]/k.total,b.keys[h]={time:y,pos:f[h]};g.hierarchy[0]=
 b;THREE.AnimationHandler.add(g);return new THREE.Animation(a,e,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function h(a,b){var e,c,g=new THREE.Geometry;for(e=0;e<a.points.length*b;e++)c=e/(a.points.length*b),c=a.getPoint(c),g.vertices[e]=new THREE.Vertex(new THREE.Vector3(c.x,c.y,c.z));return g}this.object=a;this.domElement=c!==void 0?c:document;this.id="PathControls"+THREE.PathControlsIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=
 new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.0050;this.lookHorizontal=this.lookVertical=!0;this.verticalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.horizontalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.target=new THREE.Object3D;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=
 this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));var g=Math.PI*2,k=Math.PI/180;this.update=function(a){var e;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed*a);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed*a);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*k;this.theta=this.lon*k;a=this.phi%g;this.phi=a>=0?a:a+g;e=this.verticalAngleMap.srcRange;
@@ -119,12 +119,12 @@ THREE.FlyControls=function(a,c){function b(a,b){return function(){b.apply(a,argu
 this.object.matrixWorldNeedsUpdate=!0};this.updateMovementVector=function(){var a=this.moveState.forward||this.autoForward&&!this.moveState.back?1:0;this.moveVector.x=-this.moveState.left+this.moveState.right;this.moveVector.y=-this.moveState.down+this.moveState.up;this.moveVector.z=-a+this.moveState.back};this.updateRotationVector=function(){this.rotationVector.x=-this.moveState.pitchDown+this.moveState.pitchUp;this.rotationVector.y=-this.moveState.yawRight+this.moveState.yawLeft;this.rotationVector.z=
 -this.moveState.rollRight+this.moveState.rollLeft};this.getContainerDimensions=function(){return this.domElement!=document?{size:[this.domElement.offsetWidth,this.domElement.offsetHeight],offset:[this.domElement.offsetLeft,this.domElement.offsetTop]}:{size:[window.innerWidth,window.innerHeight],offset:[0,0]}};this.domElement.addEventListener("mousemove",b(this,this.mousemove),!1);this.domElement.addEventListener("mousedown",b(this,this.mousedown),!1);this.domElement.addEventListener("mouseup",b(this,
 this.mouseup),!1);this.domElement.addEventListener("keydown",b(this,this.keydown),!1);this.domElement.addEventListener("keyup",b(this,this.keyup),!1);this.updateMovementVector();this.updateRotationVector()};
-THREE.RollControls=function(a,c){this.object=a;this.domElement=c!==void 0?c:document;this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.object.matrixAutoUpdate=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;var b=new THREE.Vector3,e=new THREE.Vector3,f=new THREE.Vector3,h=new THREE.Matrix4,g=!1,k=1,l=0,m=0,n=0,o=0,t=0,u=window.innerWidth/2,v=window.innerHeight/2;this.update=function(a){if(this.mouseLook){var c=a*this.lookSpeed;
-this.rotateHorizontally(c*o);this.rotateVertically(c*t)}c=a*this.movementSpeed;this.object.translateZ(-c*(l>0||this.autoForward&&!(l<0)?1:l));this.object.translateX(c*m);this.object.translateY(c*n);g&&(this.roll+=this.rollSpeed*a*k);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize();else if(this.forward.y<this.constrainVertical[0])this.forward.y=this.constrainVertical[0],this.forward.normalize();f.copy(this.forward);e.set(0,1,0);b.cross(e,
+THREE.RollControls=function(a,c){this.object=a;this.domElement=c!==void 0?c:document;this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.object.matrixAutoUpdate=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;var b=new THREE.Vector3,e=new THREE.Vector3,f=new THREE.Vector3,h=new THREE.Matrix4,g=!1,k=1,l=0,m=0,n=0,o=0,u=0,t=window.innerWidth/2,z=window.innerHeight/2;this.update=function(a){if(this.mouseLook){var c=a*this.lookSpeed;
+this.rotateHorizontally(c*o);this.rotateVertically(c*u)}c=a*this.movementSpeed;this.object.translateZ(-c*(l>0||this.autoForward&&!(l<0)?1:l));this.object.translateX(c*m);this.object.translateY(c*n);g&&(this.roll+=this.rollSpeed*a*k);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize();else if(this.forward.y<this.constrainVertical[0])this.forward.y=this.constrainVertical[0],this.forward.normalize();f.copy(this.forward);e.set(0,1,0);b.cross(e,
 f).normalize();e.cross(f,b).normalize();this.object.matrix.n11=b.x;this.object.matrix.n12=e.x;this.object.matrix.n13=f.x;this.object.matrix.n21=b.y;this.object.matrix.n22=e.y;this.object.matrix.n23=f.y;this.object.matrix.n31=b.z;this.object.matrix.n32=e.z;this.object.matrix.n33=f.z;h.identity();h.n11=Math.cos(this.roll);h.n12=-Math.sin(this.roll);h.n21=Math.sin(this.roll);h.n22=Math.cos(this.roll);this.object.matrix.multiplySelf(h);this.object.matrixWorldNeedsUpdate=!0;this.object.matrix.n14=this.object.position.x;
 this.object.matrix.n24=this.object.position.y;this.object.matrix.n34=this.object.position.z};this.translateX=function(a){this.object.position.x+=this.object.matrix.n11*a;this.object.position.y+=this.object.matrix.n21*a;this.object.position.z+=this.object.matrix.n31*a};this.translateY=function(a){this.object.position.x+=this.object.matrix.n12*a;this.object.position.y+=this.object.matrix.n22*a;this.object.position.z+=this.object.matrix.n32*a};this.translateZ=function(a){this.object.position.x-=this.object.matrix.n13*
 a;this.object.position.y-=this.object.matrix.n23*a;this.object.position.z-=this.object.matrix.n33*a};this.rotateHorizontally=function(a){b.set(this.object.matrix.n11,this.object.matrix.n21,this.object.matrix.n31);b.multiplyScalar(a);this.forward.subSelf(b);this.forward.normalize()};this.rotateVertically=function(a){e.set(this.object.matrix.n12,this.object.matrix.n22,this.object.matrix.n32);e.multiplyScalar(a);this.forward.addSelf(e);this.forward.normalize()};this.domElement.addEventListener("contextmenu",
-function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){o=(a.clientX-u)/window.innerWidth;t=(a.clientY-v)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:l=1;break;case 2:l=-1}},!1);this.domElement.addEventListener("mouseup",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:l=0;break;case 2:l=0}},!1);this.domElement.addEventListener("keydown",
+function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){o=(a.clientX-t)/window.innerWidth;u=(a.clientY-z)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:l=1;break;case 2:l=-1}},!1);this.domElement.addEventListener("mouseup",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:l=0;break;case 2:l=0}},!1);this.domElement.addEventListener("keydown",
 function(a){switch(a.keyCode){case 38:case 87:l=1;break;case 37:case 65:m=-1;break;case 40:case 83:l=-1;break;case 39:case 68:m=1;break;case 81:g=!0;k=1;break;case 69:g=!0;k=-1;break;case 82:n=1;break;case 70:n=-1}},!1);this.domElement.addEventListener("keyup",function(a){switch(a.keyCode){case 38:case 87:l=0;break;case 37:case 65:m=0;break;case 40:case 83:l=0;break;case 39:case 68:m=0;break;case 81:g=!1;break;case 69:g=!1;break;case 82:n=0;break;case 70:n=0}},!1)};
 THREE.TrackballControls=function(a,c){function b(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.domElement=c!==void 0?c:document;this.screen={width:window.innerWidth,height:window.innerHeight,offsetLeft:0,offsetTop:0};this.radius=(this.screen.width+this.screen.height)/4;this.rotateSpeed=1;this.zoomSpeed=1.2;this.panSpeed=0.3;this.staticMoving=this.noPan=this.noZoom=!1;this.dynamicDampingFactor=0.2;this.minDistance=0;this.maxDistance=Infinity;this.keys=[65,83,68];this.target=new THREE.Vector3(0,
 0,0);var e=!1,f=this.STATE.NONE,h=new THREE.Vector3,g=new THREE.Vector3,k=new THREE.Vector3,l=new THREE.Vector2,m=new THREE.Vector2,n=new THREE.Vector2,o=new THREE.Vector2;this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.getMouseOnScreen=function(a,b){return new THREE.Vector2((a-this.screen.offsetLeft)/this.radius*0.5,(b-this.screen.offsetTop)/this.radius*0.5)};this.getMouseProjectionOnBall=function(a,b){var c=new THREE.Vector3((a-this.screen.width*0.5-this.screen.offsetLeft)/
@@ -135,22 +135,22 @@ this.rotateCamera();this.noZoom||this.zoomCamera();this.noPan||this.panCamera();
 (f===this.STATE.ROTATE?k=this.getMouseProjectionOnBall(a.clientX,a.clientY):f===this.STATE.ZOOM&&!this.noZoom?m=this.getMouseOnScreen(a.clientX,a.clientY):f===this.STATE.PAN&&!this.noPan&&(o=this.getMouseOnScreen(a.clientX,a.clientY)))}),!1);this.domElement.addEventListener("mousedown",b(this,function(a){a.preventDefault();a.stopPropagation();if(f===this.STATE.NONE)f=a.button,f===this.STATE.ROTATE?g=k=this.getMouseProjectionOnBall(a.clientX,a.clientY):f===this.STATE.ZOOM&&!this.noZoom?l=m=this.getMouseOnScreen(a.clientX,
 a.clientY):this.noPan||(n=o=this.getMouseOnScreen(a.clientX,a.clientY))}),!1);this.domElement.addEventListener("mouseup",b(this,function(a){a.preventDefault();a.stopPropagation();f=this.STATE.NONE}),!1);window.addEventListener("keydown",b(this,function(a){if(f===this.STATE.NONE){if(a.keyCode===this.keys[this.STATE.ROTATE])f=this.STATE.ROTATE;else if(a.keyCode===this.keys[this.STATE.ZOOM]&&!this.noZoom)f=this.STATE.ZOOM;else if(a.keyCode===this.keys[this.STATE.PAN]&&!this.noPan)f=this.STATE.PAN;f!==
 this.STATE.NONE&&(e=!0)}}),!1);window.addEventListener("keyup",b(this,function(){if(f!==this.STATE.NONE)f=this.STATE.NONE}),!1)};THREE.TrackballControls.prototype.STATE={NONE:-1,ROTATE:0,ZOOM:1,PAN:2};
-THREE.CubeGeometry=function(a,c,b,e,f,h,g,k){function l(a,b,c,g,k,l,o,n){var u,t,v=e||1,K=f||1,C=k/2,F=l/2,J=m.vertices.length;if(a=="x"&&b=="y"||a=="y"&&b=="x")u="z";else if(a=="x"&&b=="z"||a=="z"&&b=="x")u="y",K=h||1;else if(a=="z"&&b=="y"||a=="y"&&b=="z")u="x",v=h||1;var M=v+1,N=K+1;k/=v;var L=l/K;for(t=0;t<N;t++)for(l=0;l<M;l++){var O=new THREE.Vector3;O[a]=(l*k-C)*c;O[b]=(t*L-F)*g;O[u]=o;m.vertices.push(new THREE.Vertex(O))}for(t=0;t<K;t++)for(l=0;l<v;l++)m.faces.push(new THREE.Face4(l+M*t+J,
-l+M*(t+1)+J,l+1+M*(t+1)+J,l+1+M*t+J,null,null,n)),m.faceVertexUvs[0].push([new THREE.UV(l/v,t/K),new THREE.UV(l/v,(t+1)/K),new THREE.UV((l+1)/v,(t+1)/K),new THREE.UV((l+1)/v,t/K)])}THREE.Geometry.call(this);var m=this,n=a/2,o=c/2,t=b/2;if(g!==void 0)if(g instanceof Array)this.materials=g;else{this.materials=[];for(var u=0;u<6;u++)this.materials.push([g])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(k!=void 0)for(var v in k)this.sides[v]!=void 0&&(this.sides[v]=k[v]);
-this.sides.px&&l("z","y",-1,-1,b,c,n,this.materials[0]);this.sides.nx&&l("z","y",1,-1,b,c,-n,this.materials[1]);this.sides.py&&l("x","z",1,1,a,b,o,this.materials[2]);this.sides.ny&&l("x","z",1,-1,a,b,-o,this.materials[3]);this.sides.pz&&l("x","y",1,-1,a,c,t,this.materials[4]);this.sides.nz&&l("x","y",-1,-1,a,c,-t,this.materials[5]);this.mergeVertices();this.computeCentroids();this.computeFaceNormals()};THREE.CubeGeometry.prototype=new THREE.Geometry;THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
-THREE.CylinderGeometry=function(a,c,b,e,f,h){THREE.Geometry.call(this);var a=a!=null?a:20,c=c!=null?c:20,b=b||100,g=b/2,e=e||8,f=f||1,k,l,m=[],n=[];for(l=0;l<=f;l++){var o=[],t=[],u=l/f,v=u*(c-a)+a;for(k=0;k<=e;k++){var y=k/e;this.vertices.push(new THREE.Vertex(new THREE.Vector3(v*Math.sin(y*Math.PI*2),-u*b+g,v*Math.cos(y*Math.PI*2))));o.push(this.vertices.length-1);t.push(new THREE.UV(y,u))}m.push(o);n.push(t)}for(l=0;l<f;l++)for(k=0;k<e;k++){var b=m[l][k],o=m[l+1][k],t=m[l+1][k+1],u=m[l][k+1],v=
-this.vertices[b].position.clone().setY(0).normalize(),y=this.vertices[o].position.clone().setY(0).normalize(),p=this.vertices[t].position.clone().setY(0).normalize(),z=this.vertices[u].position.clone().setY(0).normalize(),x=n[l][k].clone(),w=n[l+1][k].clone(),A=n[l+1][k+1].clone(),D=n[l][k+1].clone();this.faces.push(new THREE.Face4(b,o,t,u,[v,y,p,z]));this.faceVertexUvs[0].push([x,w,A,D])}if(!h&&a>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,g,0)));for(k=0;k<e;k++)b=m[0][k],o=m[0][k+
-1],t=this.vertices.length-1,v=new THREE.Vector3(0,1,0),y=new THREE.Vector3(0,1,0),p=new THREE.Vector3(0,1,0),x=n[0][k].clone(),w=n[0][k+1].clone(),A=new THREE.UV(w.u,0),this.faces.push(new THREE.Face3(b,o,t,[v,y,p])),this.faceVertexUvs[0].push([x,w,A])}if(!h&&c>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-g,0)));for(k=0;k<e;k++)b=m[l][k+1],o=m[l][k],t=this.vertices.length-1,v=new THREE.Vector3(0,-1,0),y=new THREE.Vector3(0,-1,0),p=new THREE.Vector3(0,-1,0),x=n[l][k+1].clone(),w=n[l][k].clone(),
-A=new THREE.UV(w.u,1),this.faces.push(new THREE.Face3(b,o,t,[v,y,p])),this.faceVertexUvs[0].push([x,w,A])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
+THREE.CubeGeometry=function(a,c,b,e,f,h,g,k){function l(a,b,c,g,k,l,o,n){var p,t,u=e||1,v=f||1,z=k/2,x=l/2,w=m.vertices.length;if(a=="x"&&b=="y"||a=="y"&&b=="x")p="z";else if(a=="x"&&b=="z"||a=="z"&&b=="x")p="y",v=h||1;else if(a=="z"&&b=="y"||a=="y"&&b=="z")p="x",u=h||1;var y=u+1,O=v+1;k/=u;var R=l/v;for(t=0;t<O;t++)for(l=0;l<y;l++){var U=new THREE.Vector3;U[a]=(l*k-z)*c;U[b]=(t*R-x)*g;U[p]=o;m.vertices.push(new THREE.Vertex(U))}for(t=0;t<v;t++)for(l=0;l<u;l++)m.faces.push(new THREE.Face4(l+y*t+w,
+l+y*(t+1)+w,l+1+y*(t+1)+w,l+1+y*t+w,null,null,n)),m.faceVertexUvs[0].push([new THREE.UV(l/u,t/v),new THREE.UV(l/u,(t+1)/v),new THREE.UV((l+1)/u,(t+1)/v),new THREE.UV((l+1)/u,t/v)])}THREE.Geometry.call(this);var m=this,n=a/2,o=c/2,u=b/2,t,z,v,p,y,x;if(g!==void 0){if(g instanceof Array)this.materials=g;else{this.materials=[];for(t=0;t<6;t++)this.materials.push(g)}t=0;p=1;z=2;y=3;v=4;x=5}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(k!=void 0)for(var w in k)this.sides[w]!=
+void 0&&(this.sides[w]=k[w]);this.sides.px&&l("z","y",-1,-1,b,c,n,t);this.sides.nx&&l("z","y",1,-1,b,c,-n,p);this.sides.py&&l("x","z",1,1,a,b,o,z);this.sides.ny&&l("x","z",1,-1,a,b,-o,y);this.sides.pz&&l("x","y",1,-1,a,c,u,v);this.sides.nz&&l("x","y",-1,-1,a,c,-u,x);this.mergeVertices();this.computeCentroids();this.computeFaceNormals()};THREE.CubeGeometry.prototype=new THREE.Geometry;THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
+THREE.CylinderGeometry=function(a,c,b,e,f,h){THREE.Geometry.call(this);var a=a!=null?a:20,c=c!=null?c:20,b=b||100,g=b/2,e=e||8,f=f||1,k,l,m=[],n=[];for(l=0;l<=f;l++){var o=[],u=[],t=l/f,z=t*(c-a)+a;for(k=0;k<=e;k++){var v=k/e;this.vertices.push(new THREE.Vertex(new THREE.Vector3(z*Math.sin(v*Math.PI*2),-t*b+g,z*Math.cos(v*Math.PI*2))));o.push(this.vertices.length-1);u.push(new THREE.UV(v,t))}m.push(o);n.push(u)}for(l=0;l<f;l++)for(k=0;k<e;k++){var b=m[l][k],o=m[l+1][k],u=m[l+1][k+1],t=m[l][k+1],z=
+this.vertices[b].position.clone().setY(0).normalize(),v=this.vertices[o].position.clone().setY(0).normalize(),p=this.vertices[u].position.clone().setY(0).normalize(),y=this.vertices[t].position.clone().setY(0).normalize(),x=n[l][k].clone(),w=n[l+1][k].clone(),A=n[l+1][k+1].clone(),D=n[l][k+1].clone();this.faces.push(new THREE.Face4(b,o,u,t,[z,v,p,y]));this.faceVertexUvs[0].push([x,w,A,D])}if(!h&&a>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,g,0)));for(k=0;k<e;k++)b=m[0][k],o=m[0][k+
+1],u=this.vertices.length-1,z=new THREE.Vector3(0,1,0),v=new THREE.Vector3(0,1,0),p=new THREE.Vector3(0,1,0),x=n[0][k].clone(),w=n[0][k+1].clone(),A=new THREE.UV(w.u,0),this.faces.push(new THREE.Face3(b,o,u,[z,v,p])),this.faceVertexUvs[0].push([x,w,A])}if(!h&&c>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-g,0)));for(k=0;k<e;k++)b=m[l][k+1],o=m[l][k],u=this.vertices.length-1,z=new THREE.Vector3(0,-1,0),v=new THREE.Vector3(0,-1,0),p=new THREE.Vector3(0,-1,0),x=n[l][k+1].clone(),w=n[l][k].clone(),
+A=new THREE.UV(w.u,1),this.faces.push(new THREE.Face3(b,o,u,[z,v,p])),this.faceVertexUvs[0].push([x,w,A])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
 THREE.ExtrudeGeometry=function(a,c){if(typeof a!="undefined"){THREE.Geometry.call(this);var a=a instanceof Array?a:[a],b,e=a.length,f;this.shapebb=a[e-1].getBoundingBox();for(b=0;b<e;b++)f=a[b],this.addShape(f,c);this.computeCentroids();this.computeFaceNormals()}};THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;
 THREE.ExtrudeGeometry.prototype.addShape=function(a,c){function b(a,b,c){b||console.log("die");return b.clone().multiplyScalar(c).addSelf(a)}function e(a,b,c){var e=THREE.ExtrudeGeometry.__v1,g=THREE.ExtrudeGeometry.__v2,h=THREE.ExtrudeGeometry.__v3,f=THREE.ExtrudeGeometry.__v4,k=THREE.ExtrudeGeometry.__v5,l=THREE.ExtrudeGeometry.__v6;e.set(a.x-b.x,a.y-b.y);g.set(a.x-c.x,a.y-c.y);e=e.normalize();g=g.normalize();h.set(-e.y,e.x);f.set(g.y,-g.x);k.copy(a).addSelf(h);l.copy(a).addSelf(f);if(k.equals(l))return f.clone();
-k.copy(b).addSelf(h);l.copy(c).addSelf(f);h=e.dot(f);f=l.subSelf(k).dot(f);h==0&&(console.log("Either infinite or no solutions!"),f==0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));f/=h;if(f<0)return b=Math.atan2(b.y-a.y,b.x-a.x),a=Math.atan2(c.y-a.y,c.x-a.x),b>a&&(a+=Math.PI*2),anglec=(b+a)/2,new THREE.Vector2(-Math.cos(anglec),-Math.sin(anglec));return e.multiplyScalar(f).addSelf(k).subSelf(a).clone()}function f(a){for(C=a.length;--C>=0;){R=C;S=C-1;S<0&&(S=a.length-
-1);for(var b=0,c=u+n*2,b=0;b<c;b++){var e=O*b,g=O*(b+1),h=W+R+e,f=W+R+g,m=h,e=W+S+e,g=W+S+g,o=f;m+=K;e+=K;g+=K;o+=K;G.faces.push(new THREE.Face4(m,e,g,o,null,null,A));A&&(m=b/c,e=(b+1)/c,g=k+l*2,h=(G.vertices[h].position.z+l)/g,f=(G.vertices[f].position.z+l)/g,G.faceVertexUvs[0].push([new THREE.UV(h,m),new THREE.UV(f,m),new THREE.UV(f,e),new THREE.UV(h,e)]))}}}function h(a,b,c){G.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function g(a,b,c){a+=K;b+=K;c+=K;G.faces.push(new THREE.Face3(a,
+k.copy(b).addSelf(h);l.copy(c).addSelf(f);h=e.dot(f);f=l.subSelf(k).dot(f);h==0&&(console.log("Either infinite or no solutions!"),f==0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));f/=h;if(f<0)return b=Math.atan2(b.y-a.y,b.x-a.x),a=Math.atan2(c.y-a.y,c.x-a.x),b>a&&(a+=Math.PI*2),anglec=(b+a)/2,new THREE.Vector2(-Math.cos(anglec),-Math.sin(anglec));return e.multiplyScalar(f).addSelf(k).subSelf(a).clone()}function f(a){for(C=a.length;--C>=0;){S=C;T=C-1;T<0&&(T=a.length-
+1);for(var b=0,c=t+n*2,b=0;b<c;b++){var e=P*b,g=P*(b+1),h=X+S+e,f=X+S+g,m=h,e=X+T+e,g=X+T+g,o=f;m+=L;e+=L;g+=L;o+=L;G.faces.push(new THREE.Face4(m,e,g,o,null,null,A));A&&(m=b/c,e=(b+1)/c,g=k+l*2,h=(G.vertices[h].position.z+l)/g,f=(G.vertices[f].position.z+l)/g,G.faceVertexUvs[0].push([new THREE.UV(h,m),new THREE.UV(f,m),new THREE.UV(f,e),new THREE.UV(h,e)]))}}}function h(a,b,c){G.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function g(a,b,c){a+=L;b+=L;c+=L;G.faces.push(new THREE.Face3(a,
 b,c,null,null,w));if(w){var e=D.maxY,g=D.maxX,h=G.vertices[b].position.x,b=G.vertices[b].position.y,f=G.vertices[c].position.x,c=G.vertices[c].position.y;G.faceVertexUvs[0].push([new THREE.UV(G.vertices[a].position.x/g,G.vertices[a].position.y/e),new THREE.UV(h/g,b/e),new THREE.UV(f/g,c/e)])}}var k=c.amount!==void 0?c.amount:100,l=c.bevelThickness!==void 0?c.bevelThickness:6,m=c.bevelSize!==void 0?c.bevelSize:l-2,n=c.bevelSegments!==void 0?c.bevelSegments:3,o=c.bevelEnabled!==void 0?c.bevelEnabled:
-!0,t=c.curveSegments!==void 0?c.curveSegments:12,u=c.steps!==void 0?c.steps:1,v=c.bendPath,y=c.extrudePath,p,z=!1,x=c.useSpacedPoints!==void 0?c.useSpacedPoints:!1,w=c.material,A=c.extrudeMaterial,D=this.shapebb;if(y)p=y.getPoints(t),u=p.length,z=!0,o=!1;o||(m=l=n=0);var B,E,I,G=this,K=this.vertices.length;v&&a.addWrapPath(v);t=x?a.extractAllSpacedPoints(t):a.extractAllPoints(t);v=t.shape;t=t.holes;if(y=!THREE.Shape.Utils.isClockWise(v)){v=v.reverse();E=0;for(I=t.length;E<I;E++)B=t[E],THREE.Shape.Utils.isClockWise(B)&&
-(t[E]=B.reverse());y=!1}y=THREE.Shape.Utils.triangulateShape(v,t);x=v;E=0;for(I=t.length;E<I;E++)B=t[E],v=v.concat(B);var C,F,J,M,N,L,O=v.length,H=y.length,Q=[];C=0;F=x.length;R=F-1;for(S=C+1;C<F;C++,R++,S++)R==F&&(R=0),S==F&&(S=0),Q[C]=e(x[C],x[R],x[S]);var P=[],T,X=Q.concat();E=0;for(I=t.length;E<I;E++){B=t[E];T=[];C=0;F=B.length;R=F-1;for(S=C+1;C<F;C++,R++,S++)R==F&&(R=0),S==F&&(S=0),T[C]=e(B[C],B[R],B[S]);P.push(T);X=X.concat(T)}for(J=0;J<n;J++){M=J/n;N=l*(1-M);M=m*Math.sin(M*Math.PI/2);C=0;for(F=
-x.length;C<F;C++)L=b(x[C],Q[C],M),h(L.x,L.y,-N);E=0;for(I=t.length;E<I;E++){B=t[E];T=P[E];C=0;for(F=B.length;C<F;C++)L=b(B[C],T[C],M),h(L.x,L.y,-N)}}M=m;for(C=0;C<O;C++)L=o?b(v[C],X[C],M):v[C],z?h(L.x,L.y+p[0].y,p[0].x):h(L.x,L.y,0);for(J=1;J<=u;J++)for(C=0;C<O;C++)L=o?b(v[C],X[C],M):v[C],z?h(L.x,L.y+p[J-1].y,p[J-1].x):h(L.x,L.y,k/u*J);for(J=n-1;J>=0;J--){M=J/n;N=l*(1-M);M=m*Math.sin(M*Math.PI/2);C=0;for(F=x.length;C<F;C++)L=b(x[C],Q[C],M),h(L.x,L.y,k+N);E=0;for(I=t.length;E<I;E++){B=t[E];T=P[E];
-C=0;for(F=B.length;C<F;C++)L=b(B[C],T[C],M),z?h(L.x,L.y+p[u-1].y,p[u-1].x+N):h(L.x,L.y,k+N)}}if(o){o=O*0;for(C=0;C<H;C++)m=y[C],g(m[2]+o,m[1]+o,m[0]+o);o=O*(u+n*2);for(C=0;C<H;C++)m=y[C],g(m[0]+o,m[1]+o,m[2]+o)}else{for(C=0;C<H;C++)m=y[C],g(m[2],m[1],m[0]);for(C=0;C<H;C++)m=y[C],g(m[0]+O*u,m[1]+O*u,m[2]+O*u)}var R,S,W=0;f(x);W+=x.length;E=0;for(I=t.length;E<I;E++)B=t[E],f(B),W+=B.length};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;THREE.ExtrudeGeometry.__v2=new THREE.Vector2;
+!0,u=c.curveSegments!==void 0?c.curveSegments:12,t=c.steps!==void 0?c.steps:1,z=c.bendPath,v=c.extrudePath,p,y=!1,x=c.useSpacedPoints!==void 0?c.useSpacedPoints:!1,w=c.material,A=c.extrudeMaterial,D=this.shapebb;if(v)p=v.getPoints(u),t=p.length,y=!0,o=!1;o||(m=l=n=0);var B,E,I,G=this,L=this.vertices.length;z&&a.addWrapPath(z);u=x?a.extractAllSpacedPoints(u):a.extractAllPoints(u);z=u.shape;u=u.holes;if(v=!THREE.Shape.Utils.isClockWise(z)){z=z.reverse();E=0;for(I=u.length;E<I;E++)B=u[E],THREE.Shape.Utils.isClockWise(B)&&
+(u[E]=B.reverse());v=!1}v=THREE.Shape.Utils.triangulateShape(z,u);x=z;E=0;for(I=u.length;E<I;E++)B=u[E],z=z.concat(B);var C,F,J,M,N,K,P=z.length,H=v.length,Q=[];C=0;F=x.length;S=F-1;for(T=C+1;C<F;C++,S++,T++)S==F&&(S=0),T==F&&(T=0),Q[C]=e(x[C],x[S],x[T]);var O=[],R,U=Q.concat();E=0;for(I=u.length;E<I;E++){B=u[E];R=[];C=0;F=B.length;S=F-1;for(T=C+1;C<F;C++,S++,T++)S==F&&(S=0),T==F&&(T=0),R[C]=e(B[C],B[S],B[T]);O.push(R);U=U.concat(R)}for(J=0;J<n;J++){M=J/n;N=l*(1-M);M=m*Math.sin(M*Math.PI/2);C=0;for(F=
+x.length;C<F;C++)K=b(x[C],Q[C],M),h(K.x,K.y,-N);E=0;for(I=u.length;E<I;E++){B=u[E];R=O[E];C=0;for(F=B.length;C<F;C++)K=b(B[C],R[C],M),h(K.x,K.y,-N)}}M=m;for(C=0;C<P;C++)K=o?b(z[C],U[C],M):z[C],y?h(K.x,K.y+p[0].y,p[0].x):h(K.x,K.y,0);for(J=1;J<=t;J++)for(C=0;C<P;C++)K=o?b(z[C],U[C],M):z[C],y?h(K.x,K.y+p[J-1].y,p[J-1].x):h(K.x,K.y,k/t*J);for(J=n-1;J>=0;J--){M=J/n;N=l*(1-M);M=m*Math.sin(M*Math.PI/2);C=0;for(F=x.length;C<F;C++)K=b(x[C],Q[C],M),h(K.x,K.y,k+N);E=0;for(I=u.length;E<I;E++){B=u[E];R=O[E];
+C=0;for(F=B.length;C<F;C++)K=b(B[C],R[C],M),y?h(K.x,K.y+p[t-1].y,p[t-1].x+N):h(K.x,K.y,k+N)}}if(o){o=P*0;for(C=0;C<H;C++)m=v[C],g(m[2]+o,m[1]+o,m[0]+o);o=P*(t+n*2);for(C=0;C<H;C++)m=v[C],g(m[0]+o,m[1]+o,m[2]+o)}else{for(C=0;C<H;C++)m=v[C],g(m[2],m[1],m[0]);for(C=0;C<H;C++)m=v[C],g(m[0]+P*t,m[1]+P*t,m[2]+P*t)}var S,T,X=0;f(x);X+=x.length;E=0;for(I=u.length;E<I;E++)B=u[E],f(B),X+=B.length};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;THREE.ExtrudeGeometry.__v2=new THREE.Vector2;
 THREE.ExtrudeGeometry.__v3=new THREE.Vector2;THREE.ExtrudeGeometry.__v4=new THREE.Vector2;THREE.ExtrudeGeometry.__v5=new THREE.Vector2;THREE.ExtrudeGeometry.__v6=new THREE.Vector2;
 THREE.IcosahedronGeometry=function(a){function c(a,b,c){var e=Math.sqrt(a*a+b*b+c*c);return f.vertices.push(new THREE.Vertex(new THREE.Vector3(a/e,b/e,c/e)))-1}function b(a,b,c,e){e.faces.push(new THREE.Face3(a,b,c))}function e(a,b){var e=f.vertices[a].position,g=f.vertices[b].position;return c((e.x+g.x)/2,(e.y+g.y)/2,(e.z+g.z)/2)}var f=this,h=new THREE.Geometry;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;c(-1,a,0);c(1,a,0);c(-1,-a,0);c(1,-a,0);c(0,-1,a);c(0,1,a);c(0,-1,
 -a);c(0,1,-a);c(a,0,-1);c(a,0,1);c(-a,0,-1);c(-a,0,1);b(0,11,5,h);b(0,5,1,h);b(0,1,7,h);b(0,7,10,h);b(0,10,11,h);b(1,5,9,h);b(5,11,4,h);b(11,10,2,h);b(10,7,6,h);b(7,1,8,h);b(3,9,4,h);b(3,4,2,h);b(3,2,6,h);b(3,6,8,h);b(3,8,9,h);b(4,9,5,h);b(2,4,11,h);b(6,2,10,h);b(8,6,7,h);b(9,8,1,h);for(var g=0;g<this.subdivisions;g++){var a=new THREE.Geometry,k;for(k in h.faces){var l=e(h.faces[k].a,h.faces[k].b),m=e(h.faces[k].b,h.faces[k].c),n=e(h.faces[k].c,h.faces[k].a);b(h.faces[k].a,l,n,a);b(h.faces[k].b,m,
@@ -163,18 +163,18 @@ g.faces.push(k),k=Math.atan2(k.centroid.z,-k.centroid.x),g.faceVertexUvs[0].push
 c);this.boundingSphere={radius:a}};THREE.OctahedronGeometry.prototype=new THREE.Geometry;THREE.OctahedronGeometry.prototype.constructor=THREE.OctahedronGeometry;
 THREE.PlaneGeometry=function(a,c,b,e){THREE.Geometry.call(this);var f,h=a/2,g=c/2,b=b||1,e=e||1,k=b+1,l=e+1;a/=b;var m=c/e;for(f=0;f<l;f++)for(c=0;c<k;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*a-h,-(f*m-g),0)));for(f=0;f<e;f++)for(c=0;c<b;c++)this.faces.push(new THREE.Face4(c+k*f,c+k*(f+1),c+1+k*(f+1),c+1+k*f)),this.faceVertexUvs[0].push([new THREE.UV(c/b,f/e),new THREE.UV(c/b,(f+1)/e),new THREE.UV((c+1)/b,(f+1)/e),new THREE.UV((c+1)/b,f/e)]);this.computeCentroids();this.computeFaceNormals()};
 THREE.PlaneGeometry.prototype=new THREE.Geometry;THREE.PlaneGeometry.prototype.constructor=THREE.PlaneGeometry;
-THREE.SphereGeometry=function(a,c,b){THREE.Geometry.call(this);for(var a=a||50,e,f=Math.PI,h=Math.max(3,c||8),g=Math.max(2,b||6),c=[],b=0;b<g+1;b++){e=b/g;var k=a*Math.cos(e*f),l=a*Math.sin(e*f),m=[],n=0;for(e=0;e<h;e++){var o=2*e/h,t=l*Math.sin(o*f),o=l*Math.cos(o*f);(b==0||b==g)&&e>0||(n=this.vertices.push(new THREE.Vertex(new THREE.Vector3(o,k,t)))-1);m.push(n)}c.push(m)}for(var u,v,y,f=c.length,b=0;b<f;b++)if(h=c[b].length,b>0)for(e=0;e<h;e++){m=e==h-1;g=c[b][m?0:e+1];k=c[b][m?h-1:e];l=c[b-1][m?
-h-1:e];m=c[b-1][m?0:e+1];t=b/(f-1);u=(b-1)/(f-1);v=(e+1)/h;var o=e/h,n=new THREE.UV(1-v,t),t=new THREE.UV(1-o,t),o=new THREE.UV(1-o,u),p=new THREE.UV(1-v,u);b<c.length-1&&(u=this.vertices[g].position.clone(),v=this.vertices[k].position.clone(),y=this.vertices[l].position.clone(),u.normalize(),v.normalize(),y.normalize(),this.faces.push(new THREE.Face3(g,k,l,[new THREE.Vector3(u.x,u.y,u.z),new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(y.x,y.y,y.z)])),this.faceVertexUvs[0].push([n,t,o]));b>1&&(u=
-this.vertices[g].position.clone(),v=this.vertices[l].position.clone(),y=this.vertices[m].position.clone(),u.normalize(),v.normalize(),y.normalize(),this.faces.push(new THREE.Face3(g,l,m,[new THREE.Vector3(u.x,u.y,u.z),new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(y.x,y.y,y.z)])),this.faceVertexUvs[0].push([n,o,p]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};THREE.SphereGeometry.prototype=new THREE.Geometry;
+THREE.SphereGeometry=function(a,c,b){THREE.Geometry.call(this);for(var a=a||50,e,f=Math.PI,h=Math.max(3,c||8),g=Math.max(2,b||6),c=[],b=0;b<g+1;b++){e=b/g;var k=a*Math.cos(e*f),l=a*Math.sin(e*f),m=[],n=0;for(e=0;e<h;e++){var o=2*e/h,u=l*Math.sin(o*f),o=l*Math.cos(o*f);(b==0||b==g)&&e>0||(n=this.vertices.push(new THREE.Vertex(new THREE.Vector3(o,k,u)))-1);m.push(n)}c.push(m)}for(var t,z,v,f=c.length,b=0;b<f;b++)if(h=c[b].length,b>0)for(e=0;e<h;e++){m=e==h-1;g=c[b][m?0:e+1];k=c[b][m?h-1:e];l=c[b-1][m?
+h-1:e];m=c[b-1][m?0:e+1];u=b/(f-1);t=(b-1)/(f-1);z=(e+1)/h;var o=e/h,n=new THREE.UV(1-z,u),u=new THREE.UV(1-o,u),o=new THREE.UV(1-o,t),p=new THREE.UV(1-z,t);b<c.length-1&&(t=this.vertices[g].position.clone(),z=this.vertices[k].position.clone(),v=this.vertices[l].position.clone(),t.normalize(),z.normalize(),v.normalize(),this.faces.push(new THREE.Face3(g,k,l,[new THREE.Vector3(t.x,t.y,t.z),new THREE.Vector3(z.x,z.y,z.z),new THREE.Vector3(v.x,v.y,v.z)])),this.faceVertexUvs[0].push([n,u,o]));b>1&&(t=
+this.vertices[g].position.clone(),z=this.vertices[l].position.clone(),v=this.vertices[m].position.clone(),t.normalize(),z.normalize(),v.normalize(),this.faces.push(new THREE.Face3(g,l,m,[new THREE.Vector3(t.x,t.y,t.z),new THREE.Vector3(z.x,z.y,z.z),new THREE.Vector3(v.x,v.y,v.z)])),this.faceVertexUvs[0].push([n,o,p]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};THREE.SphereGeometry.prototype=new THREE.Geometry;
 THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry;
 THREE.TextGeometry=function(a,c){var b=(new THREE.TextPath(a,c)).toShapes();c.amount=c.height!==void 0?c.height:50;if(c.bevelThickness===void 0)c.bevelThickness=10;if(c.bevelSize===void 0)c.bevelSize=8;if(c.bevelEnabled===void 0)c.bevelEnabled=!1;if(c.bend){var e=b[b.length-1].getBoundingBox().maxX;c.bendPath=new THREE.QuadraticBezierCurve(new THREE.Vector2(0,0),new THREE.Vector2(e/2,120),new THREE.Vector2(e,0))}THREE.ExtrudeGeometry.call(this,b,c)};THREE.TextGeometry.prototype=new THREE.ExtrudeGeometry;
 THREE.TextGeometry.prototype.constructor=THREE.TextGeometry;
 THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function(){return this.faces[this.face][this.weight][this.style]},getTextShapes:function(a,c){return(new TextPath(a,c)).toShapes()},loadFace:function(a){var c=a.familyName.toLowerCase();this.faces[c]=this.faces[c]||{};this.faces[c][a.cssFontWeight]=this.faces[c][a.cssFontWeight]||{};this.faces[c][a.cssFontWeight][a.cssFontStyle]=a;return this.faces[c][a.cssFontWeight][a.cssFontStyle]=a},drawText:function(a){for(var c=
-this.getFace(),b=this.size/c.resolution,e=0,f=String(a).split(""),h=f.length,g=[],a=0;a<h;a++){var k=new THREE.Path,k=this.extractGlyphPoints(f[a],c,b,e,k);e+=k.offset;g.push(k.path)}return{paths:g,offset:e/2}},extractGlyphPoints:function(a,c,b,e,f){var h=[],g,k,l,m,n,o,t,u,v,y,p=c.glyphs[a]||c.glyphs[ctxt.options.fallbackCharacter];if(p){if(p.o){c=p._cachedOutline||(p._cachedOutline=p.o.split(" "));l=c.length;for(a=0;a<l;)switch(k=c[a++],k){case "m":k=c[a++]*b+e;m=c[a++]*b;h.push(new THREE.Vector2(k,
-m));f.moveTo(k,m);break;case "l":k=c[a++]*b+e;m=c[a++]*b;h.push(new THREE.Vector2(k,m));f.lineTo(k,m);break;case "q":k=c[a++]*b+e;m=c[a++]*b;t=c[a++]*b+e;u=c[a++]*b;f.quadraticCurveTo(t,u,k,m);if(g=h[h.length-1]){n=g.x;o=g.y;g=1;for(divisions=this.divisions;g<=divisions;g++){var z=g/divisions,x=THREE.Shape.Utils.b2(z,n,t,k),z=THREE.Shape.Utils.b2(z,o,u,m);h.push(new THREE.Vector2(x,z))}}break;case "b":if(k=c[a++]*b+e,m=c[a++]*b,t=c[a++]*b+e,u=c[a++]*-b,v=c[a++]*b+e,y=c[a++]*-b,f.bezierCurveTo(k,m,
-t,u,v,y),g=h[h.length-1]){n=g.x;o=g.y;g=1;for(divisions=this.divisions;g<=divisions;g++)z=g/divisions,x=THREE.Shape.Utils.b3(z,n,t,v,k),z=THREE.Shape.Utils.b3(z,o,u,y,m),h.push(new THREE.Vector2(x,z))}}}return{offset:p.ha*b,points:h,path:f}}}};
-(function(a){var c=function(a){for(var c=a.length,f=0,h=c-1,g=0;g<c;h=g++)f+=a[h].x*a[g].y-a[g].x*a[h].y;return f*0.5};a.Triangulate=function(a,e){var f=a.length;if(f<3)return null;var h=[],g=[],k=[],l,m,n;if(c(a)>0)for(m=0;m<f;m++)g[m]=m;else for(m=0;m<f;m++)g[m]=f-1-m;var o=2*f;for(m=f-1;f>2;){if(o--<=0){console.log("Warning, unable to triangulate polygon!");if(e)return k;return h}l=m;f<=l&&(l=0);m=l+1;f<=m&&(m=0);n=m+1;f<=n&&(n=0);var t;a:{t=a;var u=l,v=m,y=n,p=f,z=g,x=void 0,w=void 0,A=void 0,
-D=void 0,B=void 0,E=void 0,I=void 0,G=void 0,K=void 0,w=t[z[u]].x,A=t[z[u]].y,D=t[z[v]].x,B=t[z[v]].y,E=t[z[y]].x,I=t[z[y]].y;if(1.0E-10>(D-w)*(I-A)-(B-A)*(E-w))t=!1;else{for(x=0;x<p;x++)if(!(x==u||x==v||x==y)){var G=t[z[x]].x,K=t[z[x]].y,C=void 0,F=void 0,J=void 0,M=void 0,N=void 0,L=void 0,O=void 0,H=void 0,Q=void 0,P=void 0,T=void 0,X=void 0,C=J=N=void 0,C=E-D,F=I-B,J=w-E,M=A-I,N=D-w,L=B-A,O=G-w,H=K-A,Q=G-D,P=K-B,T=G-E,X=K-I,C=C*P-F*Q,N=N*H-L*O,J=J*X-M*T;if(C>=0&&J>=0&&N>=0){t=!1;break a}}t=!0}}if(t){h.push([a[g[l]],
+this.getFace(),b=this.size/c.resolution,e=0,f=String(a).split(""),h=f.length,g=[],a=0;a<h;a++){var k=new THREE.Path,k=this.extractGlyphPoints(f[a],c,b,e,k);e+=k.offset;g.push(k.path)}return{paths:g,offset:e/2}},extractGlyphPoints:function(a,c,b,e,f){var h=[],g,k,l,m,n,o,u,t,z,v,p=c.glyphs[a]||c.glyphs[ctxt.options.fallbackCharacter];if(p){if(p.o){c=p._cachedOutline||(p._cachedOutline=p.o.split(" "));l=c.length;for(a=0;a<l;)switch(k=c[a++],k){case "m":k=c[a++]*b+e;m=c[a++]*b;h.push(new THREE.Vector2(k,
+m));f.moveTo(k,m);break;case "l":k=c[a++]*b+e;m=c[a++]*b;h.push(new THREE.Vector2(k,m));f.lineTo(k,m);break;case "q":k=c[a++]*b+e;m=c[a++]*b;u=c[a++]*b+e;t=c[a++]*b;f.quadraticCurveTo(u,t,k,m);if(g=h[h.length-1]){n=g.x;o=g.y;g=1;for(divisions=this.divisions;g<=divisions;g++){var y=g/divisions,x=THREE.Shape.Utils.b2(y,n,u,k),y=THREE.Shape.Utils.b2(y,o,t,m);h.push(new THREE.Vector2(x,y))}}break;case "b":if(k=c[a++]*b+e,m=c[a++]*b,u=c[a++]*b+e,t=c[a++]*-b,z=c[a++]*b+e,v=c[a++]*-b,f.bezierCurveTo(k,m,
+u,t,z,v),g=h[h.length-1]){n=g.x;o=g.y;g=1;for(divisions=this.divisions;g<=divisions;g++)y=g/divisions,x=THREE.Shape.Utils.b3(y,n,u,z,k),y=THREE.Shape.Utils.b3(y,o,t,v,m),h.push(new THREE.Vector2(x,y))}}}return{offset:p.ha*b,points:h,path:f}}}};
+(function(a){var c=function(a){for(var c=a.length,f=0,h=c-1,g=0;g<c;h=g++)f+=a[h].x*a[g].y-a[g].x*a[h].y;return f*0.5};a.Triangulate=function(a,e){var f=a.length;if(f<3)return null;var h=[],g=[],k=[],l,m,n;if(c(a)>0)for(m=0;m<f;m++)g[m]=m;else for(m=0;m<f;m++)g[m]=f-1-m;var o=2*f;for(m=f-1;f>2;){if(o--<=0){console.log("Warning, unable to triangulate polygon!");if(e)return k;return h}l=m;f<=l&&(l=0);m=l+1;f<=m&&(m=0);n=m+1;f<=n&&(n=0);var u;a:{u=a;var t=l,z=m,v=n,p=f,y=g,x=void 0,w=void 0,A=void 0,
+D=void 0,B=void 0,E=void 0,I=void 0,G=void 0,L=void 0,w=u[y[t]].x,A=u[y[t]].y,D=u[y[z]].x,B=u[y[z]].y,E=u[y[v]].x,I=u[y[v]].y;if(1.0E-10>(D-w)*(I-A)-(B-A)*(E-w))u=!1;else{for(x=0;x<p;x++)if(!(x==t||x==z||x==v)){var G=u[y[x]].x,L=u[y[x]].y,C=void 0,F=void 0,J=void 0,M=void 0,N=void 0,K=void 0,P=void 0,H=void 0,Q=void 0,O=void 0,R=void 0,U=void 0,C=J=N=void 0,C=E-D,F=I-B,J=w-E,M=A-I,N=D-w,K=B-A,P=G-w,H=L-A,Q=G-D,O=L-B,R=G-E,U=L-I,C=C*O-F*Q,N=N*H-K*P,J=J*U-M*R;if(C>=0&&J>=0&&N>=0){u=!1;break a}}u=!0}}if(u){h.push([a[g[l]],
 a[g[m]],a[g[n]]]);k.push([g[l],g[m],g[n]]);l=m;for(n=m+1;n<f;l++,n++)g[l]=g[n];f--;o=2*f}}if(e)return k;return h};a.Triangulate.area=c;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
 THREE.TorusGeometry=function(a,c,b,e,f){THREE.Geometry.call(this);this.radius=a||100;this.tube=c||40;this.segmentsR=b||8;this.segmentsT=e||6;this.arc=f||Math.PI*2;f=new THREE.Vector3;a=[];c=[];for(b=0;b<=this.segmentsR;b++)for(e=0;e<=this.segmentsT;e++){var h=e/this.segmentsT*this.arc,g=b/this.segmentsR*Math.PI*2;f.x=this.radius*Math.cos(h);f.y=this.radius*Math.sin(h);var k=new THREE.Vector3;k.x=(this.radius+this.tube*Math.cos(g))*Math.cos(h);k.y=(this.radius+this.tube*Math.cos(g))*Math.sin(h);k.z=
 this.tube*Math.sin(g);this.vertices.push(new THREE.Vertex(k));a.push(new THREE.UV(e/this.segmentsT,1-b/this.segmentsR));c.push(k.clone().subSelf(f).normalize())}for(b=1;b<=this.segmentsR;b++)for(e=1;e<=this.segmentsT;e++){var f=(this.segmentsT+1)*b+e-1,h=(this.segmentsT+1)*(b-1)+e-1,g=(this.segmentsT+1)*(b-1)+e,k=(this.segmentsT+1)*b+e,l=new THREE.Face4(f,h,g,k,[c[f],c[h],c[g],c[k]]);l.normal.addSelf(c[f]);l.normal.addSelf(c[h]);l.normal.addSelf(c[g]);l.normal.addSelf(c[k]);l.normal.normalize();this.faces.push(l);
@@ -183,136 +183,135 @@ THREE.TorusKnotGeometry=function(a,c,b,e,f,h,g){function k(a,b,c,e,g,h){b=c/e*a;
 this.segmentsT;++c){var l=a/this.segmentsR*2*this.p*Math.PI,g=c/this.segmentsT*2*Math.PI,f=k(l,g,this.q,this.p,this.radius,this.heightScale),l=k(l+0.01,g,this.q,this.p,this.radius,this.heightScale);b.x=l.x-f.x;b.y=l.y-f.y;b.z=l.z-f.z;e.x=l.x+f.x;e.y=l.y+f.y;e.z=l.z+f.z;h.cross(b,e);e.cross(h,b);h.normalize();e.normalize();l=-this.tube*Math.cos(g);g=this.tube*Math.sin(g);f.x+=l*e.x+g*h.x;f.y+=l*e.y+g*h.y;f.z+=l*e.z+g*h.z;this.grid[a][c]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(f.x,f.y,
 f.z)))-1}}for(a=0;a<this.segmentsR;++a)for(c=0;c<this.segmentsT;++c){var e=(a+1)%this.segmentsR,h=(c+1)%this.segmentsT,f=this.grid[a][c],b=this.grid[e][c],e=this.grid[e][h],h=this.grid[a][h],g=new THREE.UV(a/this.segmentsR,c/this.segmentsT),l=new THREE.UV((a+1)/this.segmentsR,c/this.segmentsT),m=new THREE.UV((a+1)/this.segmentsR,(c+1)/this.segmentsT),n=new THREE.UV(a/this.segmentsR,(c+1)/this.segmentsT);this.faces.push(new THREE.Face4(f,b,e,h));this.faceVertexUvs[0].push([g,l,m,n])}this.computeCentroids();
 this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusKnotGeometry.prototype=new THREE.Geometry;THREE.TorusKnotGeometry.prototype.constructor=THREE.TorusKnotGeometry;THREE.SubdivisionModifier=function(a){this.subdivisions=a===void 0?1:a;this.useOldVertexColors=!1;this.supportUVs=!0};THREE.SubdivisionModifier.prototype.constructor=THREE.SubdivisionModifier;THREE.SubdivisionModifier.prototype.modify=function(a){for(var c=this.subdivisions;c-- >0;)this.smooth(a)};
-THREE.SubdivisionModifier.prototype.smooth=function(a){function c(a,b,c,e,k,l){var m=new THREE.Face4(a,b,c,e,null,k.color,k.material);if(g.useOldVertexColors){m.vertexColors=[];for(var n,p,u,t=0;t<4;t++){u=l[t];n=new THREE.Color;n.setRGB(0,0,0);for(var v=0;v<u.length;v++)p=k.vertexColors[u[v]-1],n.r+=p.r,n.g+=p.g,n.b+=p.b;n.r/=u.length;n.g/=u.length;n.b/=u.length;m.vertexColors[t]=n}}f.push(m);(!g.supportUVs||o.length!=0)&&h.push([o[a],o[b],o[c],o[e]])}function b(a,b){return Math.min(a,b)+"_"+Math.max(a,
-b)}var e=[],f=[],h=[],g=this,k=a.vertices,e=a.faces,l=k.concat(),m=[],n={},o=[],t,u,v,y,p,z=a.faceVertexUvs[0];t=0;for(u=z.length;t<u;t++){v=0;for(y=z[t].length;v<y;v++)p=e[t]["abcd".charAt(v)],o[p]||(o[p]=z[t][v])}var x;t=0;for(u=e.length;t<u;t++)if(p=e[t],m.push(p.centroid),l.push(new THREE.Vertex(p.centroid)),g.supportUVs&&o.length!=0){x=new THREE.UV;if(p instanceof THREE.Face3)x.u=o[p.a].u+o[p.b].u+o[p.c].u,x.v=o[p.a].v+o[p.b].v+o[p.c].v,x.u/=3,x.v/=3;else if(p instanceof THREE.Face4)x.u=o[p.a].u+
-o[p.b].u+o[p.c].u+o[p.d].u,x.v=o[p.a].v+o[p.b].v+o[p.c].v+o[p.d].v,x.u/=4,x.v/=4;o.push(x)}y=function(a){function c(a,b,e){a[b]===void 0&&(a[b]=[]);a[b].push(e)}var e,g,h,f,k={};e=0;for(g=a.faces.length;e<g;e++)h=a.faces[e],h instanceof THREE.Face3?(f=b(h.a,h.b),c(k,f,e),f=b(h.b,h.c),c(k,f,e),f=b(h.c,h.a),c(k,f,e)):h instanceof THREE.Face4&&(f=b(h.a,h.b),c(k,f,e),f=b(h.b,h.c),c(k,f,e),f=b(h.c,h.d),c(k,f,e),f=b(h.d,h.a),c(k,f,e));return k}(a);var w,A,D=0,z=k.length,B;for(t in y)if(p=y[t],x=p[0],w=
-p[1],B=t.split("_"),u=B[0],B=B[1],A=new THREE.Vector3,p.length!=2?(A.addSelf(k[u].position),A.addSelf(k[B].position),A.multiplyScalar(0.5)):(A.addSelf(m[x]),A.addSelf(m[w]),A.addSelf(k[u].position),A.addSelf(k[B].position),A.multiplyScalar(0.25)),n[t]=z+e.length+D,l.push(new THREE.Vertex(A)),D++,g.supportUVs&&o.length!=0)x=new THREE.UV,x.u=o[u].u+o[B].u,x.v=o[u].v+o[B].v,x.u/=2,x.v/=2,o.push(x);t=0;for(u=m.length;t<u;t++)p=e[t],x=z+t,p instanceof THREE.Face3?(w=b(p.a,p.b),B=b(p.b,p.c),D=b(p.c,p.a),
+THREE.SubdivisionModifier.prototype.smooth=function(a){function c(a,b,c,e,k,l){var m=new THREE.Face4(a,b,c,e,null,k.color,k.material);if(g.useOldVertexColors){m.vertexColors=[];for(var p,n,t,u=0;u<4;u++){t=l[u];p=new THREE.Color;p.setRGB(0,0,0);for(var v=0;v<t.length;v++)n=k.vertexColors[t[v]-1],p.r+=n.r,p.g+=n.g,p.b+=n.b;p.r/=t.length;p.g/=t.length;p.b/=t.length;m.vertexColors[u]=p}}f.push(m);(!g.supportUVs||o.length!=0)&&h.push([o[a],o[b],o[c],o[e]])}function b(a,b){return Math.min(a,b)+"_"+Math.max(a,
+b)}var e=[],f=[],h=[],g=this,k=a.vertices,e=a.faces,l=k.concat(),m=[],n={},o=[],u,t,z,v,p,y=a.faceVertexUvs[0];u=0;for(t=y.length;u<t;u++){z=0;for(v=y[u].length;z<v;z++)p=e[u]["abcd".charAt(z)],o[p]||(o[p]=y[u][z])}var x;u=0;for(t=e.length;u<t;u++)if(p=e[u],m.push(p.centroid),l.push(new THREE.Vertex(p.centroid)),g.supportUVs&&o.length!=0){x=new THREE.UV;if(p instanceof THREE.Face3)x.u=o[p.a].u+o[p.b].u+o[p.c].u,x.v=o[p.a].v+o[p.b].v+o[p.c].v,x.u/=3,x.v/=3;else if(p instanceof THREE.Face4)x.u=o[p.a].u+
+o[p.b].u+o[p.c].u+o[p.d].u,x.v=o[p.a].v+o[p.b].v+o[p.c].v+o[p.d].v,x.u/=4,x.v/=4;o.push(x)}v=function(a){function c(a,b,e){a[b]===void 0&&(a[b]=[]);a[b].push(e)}var e,g,h,f,k={};e=0;for(g=a.faces.length;e<g;e++)h=a.faces[e],h instanceof THREE.Face3?(f=b(h.a,h.b),c(k,f,e),f=b(h.b,h.c),c(k,f,e),f=b(h.c,h.a),c(k,f,e)):h instanceof THREE.Face4&&(f=b(h.a,h.b),c(k,f,e),f=b(h.b,h.c),c(k,f,e),f=b(h.c,h.d),c(k,f,e),f=b(h.d,h.a),c(k,f,e));return k}(a);var w,A,D=0,y=k.length,B;for(u in v)if(p=v[u],x=p[0],w=
+p[1],B=u.split("_"),t=B[0],B=B[1],A=new THREE.Vector3,p.length!=2?(A.addSelf(k[t].position),A.addSelf(k[B].position),A.multiplyScalar(0.5)):(A.addSelf(m[x]),A.addSelf(m[w]),A.addSelf(k[t].position),A.addSelf(k[B].position),A.multiplyScalar(0.25)),n[u]=y+e.length+D,l.push(new THREE.Vertex(A)),D++,g.supportUVs&&o.length!=0)x=new THREE.UV,x.u=o[t].u+o[B].u,x.v=o[t].v+o[B].v,x.u/=2,x.v/=2,o.push(x);u=0;for(t=m.length;u<t;u++)p=e[u],x=y+u,p instanceof THREE.Face3?(w=b(p.a,p.b),B=b(p.b,p.c),D=b(p.c,p.a),
 c(x,n[w],p.b,n[B],p,["123","12","2","23"]),c(x,n[B],p.c,n[D],p,["123","23","3","31"]),c(x,n[D],p.a,n[w],p,["123","31","1","12"])):p instanceof THREE.Face4?(w=b(p.a,p.b),B=b(p.b,p.c),D=b(p.c,p.d),A=b(p.d,p.a),c(x,n[w],p.b,n[B],p,["1234","12","2","23"]),c(x,n[B],p.c,n[D],p,["1234","23","3","34"]),c(x,n[D],p.d,n[A],p,["1234","34","4","41"]),c(x,n[A],p.a,n[w],p,["1234","41","1","12"])):console.log("face should be a face!",p);var e=l,E={},I={},l=function(a,b){E[a]===void 0&&(E[a]=[]);E[a].push(b)},n=function(a,
-b){I[a]===void 0&&(I[a]={});I[a][b]=null};for(t in y)p=y[t],B=t.split("_"),u=B[0],B=B[1],l(u,[u,B]),l(B,[u,B]),x=p[0],w=p[1],n(u,x),w?n(u,w):n(u,x),n(B,x),w?n(B,w):n(B,x);l=new THREE.Vector3;n=new THREE.Vector3;t=0;for(u=k.length;t<u;t++)if(E[t]!==void 0){l.set(0,0,0);n.set(0,0,0);y=new THREE.Vector3(0,0,0);z=0;for(v in I[t])l.addSelf(m[v]),z++;l.divideScalar(z);z=E[t].length;for(v=0;v<z;v++)p=E[t][v],p=k[p[0]].position.clone().addSelf(k[p[1]].position).divideScalar(2),n.addSelf(p);n.divideScalar(z);
-y.addSelf(k[t].position);y.multiplyScalar(z-3);y.addSelf(l);y.addSelf(n.multiplyScalar(2));y.divideScalar(z);e[t].position=y}a.vertices=e;a.faces=f;a.faceVertexUvs[0]=h;delete a.__tmpVertices;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals()};THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
+b){I[a]===void 0&&(I[a]={});I[a][b]=null};for(u in v)p=v[u],B=u.split("_"),t=B[0],B=B[1],l(t,[t,B]),l(B,[t,B]),x=p[0],w=p[1],n(t,x),w?n(t,w):n(t,x),n(B,x),w?n(B,w):n(B,x);l=new THREE.Vector3;n=new THREE.Vector3;u=0;for(t=k.length;u<t;u++)if(E[u]!==void 0){l.set(0,0,0);n.set(0,0,0);v=new THREE.Vector3(0,0,0);y=0;for(z in I[u])l.addSelf(m[z]),y++;l.divideScalar(y);y=E[u].length;for(z=0;z<y;z++)p=E[u][z],p=k[p[0]].position.clone().addSelf(k[p[1]].position).divideScalar(2),n.addSelf(p);n.divideScalar(y);
+v.addSelf(k[u].position);v.multiplyScalar(y-3);v.addSelf(l);v.addSelf(n.multiplyScalar(2));v.divideScalar(y);e[u].position=v}a.vertices=e;a.faces=f;a.faceVertexUvs[0]=h;delete a.__tmpVertices;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals()};THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
 THREE.Loader.prototype={constructor:THREE.Loader,addStatusElement:function(){var a=document.createElement("div");a.style.position="absolute";a.style.right="0px";a.style.top="0px";a.style.fontSize="0.8em";a.style.textAlign="left";a.style.background="rgba(0,0,0,0.25)";a.style.color="#fff";a.style.width="120px";a.style.padding="0.5em 0.5em 0.5em 0.5em";a.style.zIndex=1E3;a.innerHTML="Loading ...";return a},updateProgress:function(a){var c="Loaded ";c+=a.total?(100*a.loaded/a.total).toFixed(0)+"%":(a.loaded/
-1E3).toFixed(2)+" KB";this.statusDomElement.innerHTML=c},extractUrlbase:function(a){a=a.split("/");a.pop();return a.length<1?"":a.join("/")+"/"},initMaterials:function(a,c,b){a.materials=[];for(var e=0;e<c.length;++e)a.materials[e]=[THREE.Loader.prototype.createMaterial(c[e],b)]},hasNormals:function(a){var c,b,e=a.materials.length;for(b=0;b<e;b++)if(c=a.materials[b][0],c instanceof THREE.ShaderMaterial)return!0;return!1},createMaterial:function(a,c){function b(a){a=Math.log(a)/Math.LN2;return Math.floor(a)==
+1E3).toFixed(2)+" KB";this.statusDomElement.innerHTML=c},extractUrlbase:function(a){a=a.split("/");a.pop();return a.length<1?"":a.join("/")+"/"},initMaterials:function(a,c,b){a.materials=[];for(var e=0;e<c.length;++e)a.materials[e]=THREE.Loader.prototype.createMaterial(c[e],b)},hasNormals:function(a){var c,b,e=a.materials.length;for(b=0;b<e;b++)if(c=a.materials[b],c instanceof THREE.ShaderMaterial)return!0;return!1},createMaterial:function(a,c){function b(a){a=Math.log(a)/Math.LN2;return Math.floor(a)==
 a}function e(a,c){var e=new Image;e.onload=function(){if(!b(this.width)||!b(this.height)){var c=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),e=Math.pow(2,Math.round(Math.log(this.height)/Math.LN2));a.image.width=c;a.image.height=e;a.image.getContext("2d").drawImage(this,0,0,c,e)}else a.image=this;a.needsUpdate=!0};e.src=c}function f(a,b,g,h,f,k){var l=document.createElement("canvas");a[b]=new THREE.Texture(l);a[b].sourceFile=g;if(h){a[b].repeat.set(h[0],h[1]);if(h[0]!=1)a[b].wrapS=THREE.RepeatWrapping;
 if(h[1]!=1)a[b].wrapT=THREE.RepeatWrapping}f&&a[b].offset.set(f[0],f[1]);if(k){h={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(h[k[0]]!==void 0)a[b].wrapS=h[k[0]];if(h[k[1]]!==void 0)a[b].wrapT=h[k[1]]}e(a[b],c+"/"+g)}function h(a){return(a[0]*255<<16)+(a[1]*255<<8)+a[2]*255}var g,k,l;k="MeshLambertMaterial";g={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:a.wireframe};a.shading&&(a.shading=="Phong"?k="MeshPhongMaterial":a.shading=="Basic"&&(k="MeshBasicMaterial"));
 if(a.blending)if(a.blending=="Additive")g.blending=THREE.AdditiveBlending;else if(a.blending=="Subtractive")g.blending=THREE.SubtractiveBlending;else if(a.blending=="Multiply")g.blending=THREE.MultiplyBlending;if(a.transparent!==void 0||a.opacity<1)g.transparent=a.transparent;if(a.depthTest!==void 0)g.depthTest=a.depthTest;if(a.vertexColors!==void 0)if(a.vertexColors=="face")g.vertexColors=THREE.FaceColors;else if(a.vertexColors)g.vertexColors=THREE.VertexColors;if(a.colorDiffuse)g.color=h(a.colorDiffuse);
 else if(a.DbgColor)g.color=a.DbgColor;if(a.colorSpecular)g.specular=h(a.colorSpecular);if(a.colorAmbient)g.ambient=h(a.colorAmbient);if(a.transparency)g.opacity=a.transparency;if(a.specularCoef)g.shininess=a.specularCoef;a.mapDiffuse&&c&&f(g,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap);a.mapLight&&c&&f(g,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap);a.mapNormal&&c&&f(g,"normalMap",a.mapNormal,a.mapNormalRepeat,a.mapNormalOffset,a.mapNormalWrap);
-a.mapSpecular&&c&&f(g,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){var m=THREE.ShaderUtils.lib.normal,n=THREE.UniformsUtils.clone(m.uniforms),o=g.color;k=g.specular;l=g.ambient;var t=g.shininess;n.tNormal.texture=g.normalMap;if(a.mapNormalFactor)n.uNormalScale.value=a.mapNormalFactor;if(g.map)n.tDiffuse.texture=g.map,n.enableDiffuse.value=!0;if(g.specularMap)n.tSpecular.texture=g.specularMap,n.enableSpecular.value=!0;if(g.lightMap)n.tAO.texture=
-g.lightMap,n.enableAO.value=!0;n.uDiffuseColor.value.setHex(o);n.uSpecularColor.value.setHex(k);n.uAmbientColor.value.setHex(l);n.uShininess.value=t;if(g.opacity)n.uOpacity.value=g.opacity;g=new THREE.ShaderMaterial({fragmentShader:m.fragmentShader,vertexShader:m.vertexShader,uniforms:n,lights:!0,fog:!0})}else g=new THREE[k](g);return g}};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;
+a.mapSpecular&&c&&f(g,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){var m=THREE.ShaderUtils.lib.normal,n=THREE.UniformsUtils.clone(m.uniforms),o=g.color;k=g.specular;l=g.ambient;var u=g.shininess;n.tNormal.texture=g.normalMap;if(a.mapNormalFactor)n.uNormalScale.value=a.mapNormalFactor;if(g.map)n.tDiffuse.texture=g.map,n.enableDiffuse.value=!0;if(g.specularMap)n.tSpecular.texture=g.specularMap,n.enableSpecular.value=!0;if(g.lightMap)n.tAO.texture=
+g.lightMap,n.enableAO.value=!0;n.uDiffuseColor.value.setHex(o);n.uSpecularColor.value.setHex(k);n.uAmbientColor.value.setHex(l);n.uShininess.value=u;if(g.opacity)n.uOpacity.value=g.opacity;g=new THREE.ShaderMaterial({fragmentShader:m.fragmentShader,vertexShader:m.vertexShader,uniforms:n,lights:!0,fog:!0})}else g=new THREE[k](g);return g}};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;
 THREE.BinaryLoader.prototype.supr=THREE.Loader.prototype;
 THREE.BinaryLoader.prototype.load=function(a,c,b,e){if(a instanceof Object){console.warn("DEPRECATED: BinaryLoader( parameters ) is now BinaryLoader( url, callback, texturePath, binaryPath ).");var f=a,a=f.model,c=f.callback,b=f.texture_path,e=f.bin_path}var b=b?b:this.extractUrlbase(a),e=e?e:this.extractUrlbase(a),f=Date.now(),a=new Worker(a),h=this.showProgress?THREE.Loader.prototype.updateProgress:null;a.onmessage=function(a){THREE.BinaryLoader.prototype.loadAjaxBuffers(a.data.buffers,a.data.materials,
 c,e,b,h)};a.onerror=function(a){alert("worker.onerror: "+a.message+"\n"+a.data);a.preventDefault()};a.postMessage(f)};
 THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,c,b,e,f,h){var g=new XMLHttpRequest,k=e+"/"+a,l=0;g.onreadystatechange=function(){g.readyState==4?g.status==200||g.status==0?THREE.BinaryLoader.prototype.createBinModel(g.responseText,b,f,c):alert("Couldn't load ["+k+"] ["+g.status+"]"):g.readyState==3?h&&(l==0&&(l=g.getResponseHeader("Content-Length")),h({total:l,loaded:g.responseText.length})):g.readyState==2&&(l=g.getResponseHeader("Content-Length"))};g.open("GET",k,!0);g.overrideMimeType("text/plain; charset=x-user-defined");
 g.setRequestHeader("Content-Type","text/plain");g.send(null)};
 THREE.BinaryLoader.prototype.createBinModel=function(a,c,b,e){var f=function(b){function c(a,b){var e=n(a,b),g=n(a,b+1),f=n(a,b+2),h=n(a,b+3),k=(h<<1&255|f>>7)-127;e|=(f&127)<<16|g<<8;if(e==0&&k==-127)return 0;return(1-2*(h>>7))*(1+e*Math.pow(2,-23))*Math.pow(2,k)}function f(a,b){var c=n(a,b),e=n(a,b+1),g=n(a,b+2);return(n(a,b+3)<<24)+(g<<16)+(e<<8)+c}function l(a,b){var c=n(a,b);return(n(a,b+1)<<8)+c}function m(a,b){var c=n(a,b);return c>127?c-256:c}function n(a,b){return a.charCodeAt(b)&255}function o(b){var c,
-e,g;c=f(a,b);e=f(a,b+B);g=f(a,b+E);b=l(a,b+I);z.faces.push(new THREE.Face3(c,e,g,null,null,z.materials[b]))}function t(b){var c,e,g,h,m,o;c=f(a,b);e=f(a,b+B);g=f(a,b+E);h=l(a,b+I);m=f(a,b+G);o=f(a,b+K);b=f(a,b+C);h=z.materials[h];var n=A[o*3],p=A[o*3+1];o=A[o*3+2];var t=A[b*3],u=A[b*3+1],b=A[b*3+2];z.faces.push(new THREE.Face3(c,e,g,[new THREE.Vector3(A[m*3],A[m*3+1],A[m*3+2]),new THREE.Vector3(n,p,o),new THREE.Vector3(t,u,b)],null,h))}function u(b){var c,e,g,h;c=f(a,b);e=f(a,b+F);g=f(a,b+J);h=f(a,
-b+M);b=l(a,b+N);z.faces.push(new THREE.Face4(c,e,g,h,null,null,z.materials[b]))}function v(b){var c,e,g,h,m,o,n,p;c=f(a,b);e=f(a,b+F);g=f(a,b+J);h=f(a,b+M);m=l(a,b+N);o=f(a,b+L);n=f(a,b+O);p=f(a,b+H);b=f(a,b+Q);m=z.materials[m];var t=A[n*3],u=A[n*3+1];n=A[n*3+2];var la=A[p*3],ma=A[p*3+1];p=A[p*3+2];var na=A[b*3],v=A[b*3+1],b=A[b*3+2];z.faces.push(new THREE.Face4(c,e,g,h,[new THREE.Vector3(A[o*3],A[o*3+1],A[o*3+2]),new THREE.Vector3(t,u,n),new THREE.Vector3(la,ma,p),new THREE.Vector3(na,v,b)],null,
-m))}function y(b){var c,e,g,h;c=f(a,b);e=f(a,b+P);g=f(a,b+T);b=D[c*2];h=D[c*2+1];c=D[e*2];var l=z.faceVertexUvs[0];e=D[e*2+1];var m=D[g*2];g=D[g*2+1];var o=[];o.push(new THREE.UV(b,h));o.push(new THREE.UV(c,e));o.push(new THREE.UV(m,g));l.push(o)}function p(b){var c,e,g,h,l,m;c=f(a,b);e=f(a,b+X);g=f(a,b+R);h=f(a,b+S);b=D[c*2];l=D[c*2+1];c=D[e*2];m=D[e*2+1];e=D[g*2];var o=z.faceVertexUvs[0];g=D[g*2+1];var n=D[h*2];h=D[h*2+1];var p=[];p.push(new THREE.UV(b,l));p.push(new THREE.UV(c,m));p.push(new THREE.UV(e,
-g));p.push(new THREE.UV(n,h));o.push(p)}var z=this,x=0,w,A=[],D=[],B,E,I,G,K,C,F,J,M,N,L,O,H,Q,P,T,X,R,S,W,U,Z,Y,$,V;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(z,e,b);w={signature:a.substr(x,8),header_bytes:n(a,x+8),vertex_coordinate_bytes:n(a,x+9),normal_coordinate_bytes:n(a,x+10),uv_coordinate_bytes:n(a,x+11),vertex_index_bytes:n(a,x+12),normal_index_bytes:n(a,x+13),uv_index_bytes:n(a,x+14),material_index_bytes:n(a,x+15),nvertices:f(a,x+16),nnormals:f(a,x+16+4),nuvs:f(a,x+16+
-8),ntri_flat:f(a,x+16+12),ntri_smooth:f(a,x+16+16),ntri_flat_uv:f(a,x+16+20),ntri_smooth_uv:f(a,x+16+24),nquad_flat:f(a,x+16+28),nquad_smooth:f(a,x+16+32),nquad_flat_uv:f(a,x+16+36),nquad_smooth_uv:f(a,x+16+40)};x+=w.header_bytes;B=w.vertex_index_bytes;E=w.vertex_index_bytes*2;I=w.vertex_index_bytes*3;G=w.vertex_index_bytes*3+w.material_index_bytes;K=w.vertex_index_bytes*3+w.material_index_bytes+w.normal_index_bytes;C=w.vertex_index_bytes*3+w.material_index_bytes+w.normal_index_bytes*2;F=w.vertex_index_bytes;
-J=w.vertex_index_bytes*2;M=w.vertex_index_bytes*3;N=w.vertex_index_bytes*4;L=w.vertex_index_bytes*4+w.material_index_bytes;O=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes;H=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes*2;Q=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes*3;P=w.uv_index_bytes;T=w.uv_index_bytes*2;X=w.uv_index_bytes;R=w.uv_index_bytes*2;S=w.uv_index_bytes*3;b=w.vertex_index_bytes*3+w.material_index_bytes;V=w.vertex_index_bytes*
-4+w.material_index_bytes;W=w.ntri_flat*b;U=w.ntri_smooth*(b+w.normal_index_bytes*3);Z=w.ntri_flat_uv*(b+w.uv_index_bytes*3);Y=w.ntri_smooth_uv*(b+w.normal_index_bytes*3+w.uv_index_bytes*3);$=w.nquad_flat*V;b=w.nquad_smooth*(V+w.normal_index_bytes*4);V=w.nquad_flat_uv*(V+w.uv_index_bytes*4);x+=function(b){for(var e,h,f,k=w.vertex_coordinate_bytes*3,l=b+w.nvertices*k;b<l;b+=k)e=c(a,b),h=c(a,b+w.vertex_coordinate_bytes),f=c(a,b+w.vertex_coordinate_bytes*2),z.vertices.push(new THREE.Vertex(new THREE.Vector3(e,
-h,f)));return w.nvertices*k}(x);x+=function(b){for(var c,e,g,h=w.normal_coordinate_bytes*3,f=b+w.nnormals*h;b<f;b+=h)c=m(a,b),e=m(a,b+w.normal_coordinate_bytes),g=m(a,b+w.normal_coordinate_bytes*2),A.push(c/127,e/127,g/127);return w.nnormals*h}(x);x+=function(b){for(var e,h,f=w.uv_coordinate_bytes*2,k=b+w.nuvs*f;b<k;b+=f)e=c(a,b),h=c(a,b+w.uv_coordinate_bytes),D.push(e,h);return w.nuvs*f}(x);W=x+W;U=W+U;Z=U+Z;Y=Z+Y;$=Y+$;b=$+b;V=b+V;(function(a){var b,c=w.vertex_index_bytes*3+w.material_index_bytes,
-e=c+w.uv_index_bytes*3,g=a+w.ntri_flat_uv*e;for(b=a;b<g;b+=e)o(b),y(b+c);return g-a})(U);(function(a){var b,c=w.vertex_index_bytes*3+w.material_index_bytes+w.normal_index_bytes*3,e=c+w.uv_index_bytes*3,g=a+w.ntri_smooth_uv*e;for(b=a;b<g;b+=e)t(b),y(b+c);return g-a})(Z);(function(a){var b,c=w.vertex_index_bytes*4+w.material_index_bytes,e=c+w.uv_index_bytes*4,g=a+w.nquad_flat_uv*e;for(b=a;b<g;b+=e)u(b),p(b+c);return g-a})(b);(function(a){var b,c=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes*
-4,e=c+w.uv_index_bytes*4,g=a+w.nquad_smooth_uv*e;for(b=a;b<g;b+=e)v(b),p(b+c);return g-a})(V);(function(a){var b,c=w.vertex_index_bytes*3+w.material_index_bytes,e=a+w.ntri_flat*c;for(b=a;b<e;b+=c)o(b);return e-a})(x);(function(a){var b,c=w.vertex_index_bytes*3+w.material_index_bytes+w.normal_index_bytes*3,e=a+w.ntri_smooth*c;for(b=a;b<e;b+=c)t(b);return e-a})(W);(function(a){var b,c=w.vertex_index_bytes*4+w.material_index_bytes,e=a+w.nquad_flat*c;for(b=a;b<e;b+=c)u(b);return e-a})(Y);(function(a){var b,
-c=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes*4,e=a+w.nquad_smooth*c;for(b=a;b<e;b+=c)v(b);return e-a})($);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};f.prototype=new THREE.Geometry;f.prototype.constructor=f;c(new f(b))};
-THREE.ColladaLoader=function(){function a(a,e,f){U=a;e=e||$;f!==void 0&&(a=f.split("/"),a.pop(),ja=a.length<1?"":a.join("/")+"/");fa=c("//dae:library_images/dae:image",g,"image");ga=c("//dae:library_materials/dae:material",I,"material");ha=c("//dae:library_effects/dae:effect",J,"effect");ba=c("//dae:library_geometries/dae:geometry",p,"geometry");aa=c("//dae:library_controllers/dae:controller",k,"controller");ca=c("//dae:library_animations/dae:animation",N,"animation");ia=c(".//dae:library_visual_scenes/dae:visual_scene",
-n,"visual_scene");da=[];ea=[];(a=U.evaluate(".//dae:scene/dae:instance_visual_scene",U,Q,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(a=a.getAttribute("url").replace(/^#/,""),Y=ia[a]):Y=null;Z=new THREE.Object3D;for(a=0;a<Y.nodes.length;a++)Z.add(h(Y.nodes[a]));b();for(var l in ca);l={scene:Z,morphs:da,skins:ea,dae:{images:fa,materials:ga,effects:ha,geometries:ba,controllers:aa,animations:ca,visualScenes:ia,scene:Y}};e&&e(l);return l}function c(a,b,c){for(var a=U.evaluate(a,U,Q,XPathResult.ORDERED_NODE_ITERATOR_TYPE,
+e,g;c=f(a,b);e=f(a,b+B);g=f(a,b+E);b=l(a,b+I);y.faces.push(new THREE.Face3(c,e,g,null,null,b))}function u(b){var c,e,g,h,m,n,o;c=f(a,b);e=f(a,b+B);g=f(a,b+E);h=l(a,b+I);m=f(a,b+G);n=f(a,b+L);o=f(a,b+C);var b=A[n*3],p=A[n*3+1];n=A[n*3+2];var t=A[o*3],u=A[o*3+1];o=A[o*3+2];y.faces.push(new THREE.Face3(c,e,g,[new THREE.Vector3(A[m*3],A[m*3+1],A[m*3+2]),new THREE.Vector3(b,p,n),new THREE.Vector3(t,u,o)],null,h))}function t(b){var c,e,g,h;c=f(a,b);e=f(a,b+F);g=f(a,b+J);h=f(a,b+M);b=l(a,b+N);y.faces.push(new THREE.Face4(c,
+e,g,h,null,null,b))}function z(b){var c,e,g,h,m,n,o,p,t;c=f(a,b);e=f(a,b+F);g=f(a,b+J);h=f(a,b+M);m=l(a,b+N);n=f(a,b+K);o=f(a,b+P);p=f(a,b+H);t=f(a,b+Q);var b=A[o*3],u=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 na=A[t*3],v=A[t*3+1];t=A[t*3+2];y.faces.push(new THREE.Face4(c,e,g,h,[new THREE.Vector3(A[n*3],A[n*3+1],A[n*3+2]),new THREE.Vector3(b,u,o),new THREE.Vector3(la,ma,p),new THREE.Vector3(na,v,t)],null,m))}function v(b){var c,e,g,h;c=f(a,b);e=f(a,b+O);g=f(a,b+R);b=D[c*2];h=D[c*
+2+1];c=D[e*2];var l=y.faceVertexUvs[0];e=D[e*2+1];var m=D[g*2];g=D[g*2+1];var o=[];o.push(new THREE.UV(b,h));o.push(new THREE.UV(c,e));o.push(new THREE.UV(m,g));l.push(o)}function p(b){var c,e,g,h,l,m;c=f(a,b);e=f(a,b+U);g=f(a,b+S);h=f(a,b+T);b=D[c*2];l=D[c*2+1];c=D[e*2];m=D[e*2+1];e=D[g*2];var o=y.faceVertexUvs[0];g=D[g*2+1];var n=D[h*2];h=D[h*2+1];var p=[];p.push(new THREE.UV(b,l));p.push(new THREE.UV(c,m));p.push(new THREE.UV(e,g));p.push(new THREE.UV(n,h));o.push(p)}var y=this,x=0,w,A=[],D=[],
+B,E,I,G,L,C,F,J,M,N,K,P,H,Q,O,R,U,S,T,X,V,Z,Y,$,W;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(y,e,b);w={signature:a.substr(x,8),header_bytes:n(a,x+8),vertex_coordinate_bytes:n(a,x+9),normal_coordinate_bytes:n(a,x+10),uv_coordinate_bytes:n(a,x+11),vertex_index_bytes:n(a,x+12),normal_index_bytes:n(a,x+13),uv_index_bytes:n(a,x+14),material_index_bytes:n(a,x+15),nvertices:f(a,x+16),nnormals:f(a,x+16+4),nuvs:f(a,x+16+8),ntri_flat:f(a,x+16+12),ntri_smooth:f(a,x+16+16),ntri_flat_uv:f(a,
+x+16+20),ntri_smooth_uv:f(a,x+16+24),nquad_flat:f(a,x+16+28),nquad_smooth:f(a,x+16+32),nquad_flat_uv:f(a,x+16+36),nquad_smooth_uv:f(a,x+16+40)};x+=w.header_bytes;B=w.vertex_index_bytes;E=w.vertex_index_bytes*2;I=w.vertex_index_bytes*3;G=w.vertex_index_bytes*3+w.material_index_bytes;L=w.vertex_index_bytes*3+w.material_index_bytes+w.normal_index_bytes;C=w.vertex_index_bytes*3+w.material_index_bytes+w.normal_index_bytes*2;F=w.vertex_index_bytes;J=w.vertex_index_bytes*2;M=w.vertex_index_bytes*3;N=w.vertex_index_bytes*
+4;K=w.vertex_index_bytes*4+w.material_index_bytes;P=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes;H=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes*2;Q=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes*3;O=w.uv_index_bytes;R=w.uv_index_bytes*2;U=w.uv_index_bytes;S=w.uv_index_bytes*2;T=w.uv_index_bytes*3;b=w.vertex_index_bytes*3+w.material_index_bytes;W=w.vertex_index_bytes*4+w.material_index_bytes;X=w.ntri_flat*b;V=w.ntri_smooth*(b+w.normal_index_bytes*
+3);Z=w.ntri_flat_uv*(b+w.uv_index_bytes*3);Y=w.ntri_smooth_uv*(b+w.normal_index_bytes*3+w.uv_index_bytes*3);$=w.nquad_flat*W;b=w.nquad_smooth*(W+w.normal_index_bytes*4);W=w.nquad_flat_uv*(W+w.uv_index_bytes*4);x+=function(b){for(var e,f,h,k=w.vertex_coordinate_bytes*3,l=b+w.nvertices*k;b<l;b+=k)e=c(a,b),f=c(a,b+w.vertex_coordinate_bytes),h=c(a,b+w.vertex_coordinate_bytes*2),y.vertices.push(new THREE.Vertex(new THREE.Vector3(e,f,h)));return w.nvertices*k}(x);x+=function(b){for(var c,e,g,f=w.normal_coordinate_bytes*
+3,h=b+w.nnormals*f;b<h;b+=f)c=m(a,b),e=m(a,b+w.normal_coordinate_bytes),g=m(a,b+w.normal_coordinate_bytes*2),A.push(c/127,e/127,g/127);return w.nnormals*f}(x);x+=function(b){for(var e,f,h=w.uv_coordinate_bytes*2,k=b+w.nuvs*h;b<k;b+=h)e=c(a,b),f=c(a,b+w.uv_coordinate_bytes),D.push(e,f);return w.nuvs*h}(x);X=x+X;V=X+V;Z=V+Z;Y=Z+Y;$=Y+$;b=$+b;W=b+W;(function(a){var b,c=w.vertex_index_bytes*3+w.material_index_bytes,e=c+w.uv_index_bytes*3,g=a+w.ntri_flat_uv*e;for(b=a;b<g;b+=e)o(b),v(b+c);return g-a})(V);
+(function(a){var b,c=w.vertex_index_bytes*3+w.material_index_bytes+w.normal_index_bytes*3,e=c+w.uv_index_bytes*3,g=a+w.ntri_smooth_uv*e;for(b=a;b<g;b+=e)u(b),v(b+c);return g-a})(Z);(function(a){var b,c=w.vertex_index_bytes*4+w.material_index_bytes,e=c+w.uv_index_bytes*4,g=a+w.nquad_flat_uv*e;for(b=a;b<g;b+=e)t(b),p(b+c);return g-a})(b);(function(a){var b,c=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes*4,e=c+w.uv_index_bytes*4,g=a+w.nquad_smooth_uv*e;for(b=a;b<g;b+=e)z(b),p(b+
+c);return g-a})(W);(function(a){var b,c=w.vertex_index_bytes*3+w.material_index_bytes,e=a+w.ntri_flat*c;for(b=a;b<e;b+=c)o(b);return e-a})(x);(function(a){var b,c=w.vertex_index_bytes*3+w.material_index_bytes+w.normal_index_bytes*3,e=a+w.ntri_smooth*c;for(b=a;b<e;b+=c)u(b);return e-a})(X);(function(a){var b,c=w.vertex_index_bytes*4+w.material_index_bytes,e=a+w.nquad_flat*c;for(b=a;b<e;b+=c)t(b);return e-a})(Y);(function(a){var b,c=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes*
+4,e=a+w.nquad_smooth*c;for(b=a;b<e;b+=c)z(b);return e-a})($);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};f.prototype=new THREE.Geometry;f.prototype.constructor=f;c(new f(b))};
+THREE.ColladaLoader=function(){function a(a,e,f){V=a;e=e||$;f!==void 0&&(a=f.split("/"),a.pop(),ja=a.length<1?"":a.join("/")+"/");fa=c("//dae:library_images/dae:image",g,"image");ga=c("//dae:library_materials/dae:material",I,"material");ha=c("//dae:library_effects/dae:effect",J,"effect");ba=c("//dae:library_geometries/dae:geometry",p,"geometry");aa=c("//dae:library_controllers/dae:controller",k,"controller");ca=c("//dae:library_animations/dae:animation",N,"animation");ia=c(".//dae:library_visual_scenes/dae:visual_scene",
+n,"visual_scene");da=[];ea=[];(a=V.evaluate(".//dae:scene/dae:instance_visual_scene",V,Q,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(a=a.getAttribute("url").replace(/^#/,""),Y=ia[a]):Y=null;Z=new THREE.Object3D;for(a=0;a<Y.nodes.length;a++)Z.add(h(Y.nodes[a]));b();for(var l in ca);l={scene:Z,morphs:da,skins:ea,dae:{images:fa,materials:ga,effects:ha,geometries:ba,controllers:aa,animations:ca,visualScenes:ia,scene:Y}};e&&e(l);return l}function c(a,b,c){for(var a=V.evaluate(a,V,Q,XPathResult.ORDERED_NODE_ITERATOR_TYPE,
 null),e={},g=a.iterateNext(),f=0;g;){g=(new b).parse(g);if(g.id.length==0)g.id=c+f++;e[g.id]=g;g=a.iterateNext()}return e}function b(){var a=1E6,b=-a,c=0,e;for(e in ca)for(var g=ca[e],f=0;f<g.sampler.length;f++){var h=g.sampler[f];h.create();a=Math.min(a,h.startTime);b=Math.max(b,h.endTime);c=Math.max(c,h.input.length)}return{start:a,end:b,frames:c}}function e(a,b,c,g){a.world=a.world||new THREE.Matrix4;a.world.copy(a.matrix);if(a.channels&&a.channels.length){var f=a.channels[0].sampler.output[c];
 f instanceof THREE.Matrix4&&a.world.copy(f)}g&&a.world.multiply(g,a.world);b.push(a);for(g=0;g<a.nodes.length;g++)e(a.nodes[g],b,c,a.world)}function f(a,c,g){var f=aa[c.url];if(!f||!f.skin)console.log("ColladaLoader: Could not find skin controller.");else if(!c.skeleton||!c.skeleton.length)console.log("ColladaLoader: Could not find the skeleton for the skin. ");else{var h=b(),c=Y.getChildById(c.skeleton[0],!0)||Y.getChildBySid(c.skeleton[0],!0),k,l,m,o,n=new THREE.Vector3,p;for(k=0;k<a.vertices.length;k++)f.skin.bindShapeMatrix.multiplyVector3(a.vertices[k].position);
-for(g=0;g<h.frames;g++){var t=[],u=[];for(k=0;k<a.vertices.length;k++)u.push(new THREE.Vertex(new THREE.Vector3));e(c,t,g);k=t;l=f.skin;for(o=0;o<k.length;o++)if(m=k[o],p=-1,m.type=="JOINT"){for(var v=0;v<l.joints.length;v++)if(m.sid==l.joints[v]){p=v;break}if(p>=0){v=l.invBindMatrices[p];m.invBindMatrix=v;m.skinningMatrix=new THREE.Matrix4;m.skinningMatrix.multiply(m.world,v);m.weights=[];for(v=0;v<l.weights.length;v++)for(var y=0;y<l.weights[v].length;y++){var w=l.weights[v][y];w.joint==p&&m.weights.push(w)}}else throw"ColladaLoader: Could not find joint '"+
+for(g=0;g<h.frames;g++){var t=[],u=[];for(k=0;k<a.vertices.length;k++)u.push(new THREE.Vertex(new THREE.Vector3));e(c,t,g);k=t;l=f.skin;for(o=0;o<k.length;o++)if(m=k[o],p=-1,m.type=="JOINT"){for(var v=0;v<l.joints.length;v++)if(m.sid==l.joints[v]){p=v;break}if(p>=0){v=l.invBindMatrices[p];m.invBindMatrix=v;m.skinningMatrix=new THREE.Matrix4;m.skinningMatrix.multiply(m.world,v);m.weights=[];for(v=0;v<l.weights.length;v++)for(var w=0;w<l.weights[v].length;w++){var x=l.weights[v][w];x.joint==p&&m.weights.push(x)}}else throw"ColladaLoader: Could not find joint '"+
 m.sid+"'.";}for(k=0;k<t.length;k++)if(t[k].type=="JOINT")for(l=0;l<t[k].weights.length;l++)m=t[k].weights[l],o=m.index,m=m.weight,p=a.vertices[o],o=u[o],n.x=p.position.x,n.y=p.position.y,n.z=p.position.z,t[k].skinningMatrix.multiplyVector3(n),o.position.x+=n.x*m,o.position.y+=n.y*m,o.position.z+=n.z*m;a.morphTargets.push({name:"target_"+g,vertices:u})}}}function h(a){var b=new THREE.Object3D,c,e,g;b.name=a.id||"";b.matrixAutoUpdate=!1;b.matrix=a.matrix;for(g=0;g<a.controllers.length;g++){var k=aa[a.controllers[g].url];
-switch(k.type){case "skin":if(ba[k.skin.source]){var l=new y;l.url=k.skin.source;l.instance_material=a.controllers[g].instance_material;a.geometries.push(l);c=a.controllers[g]}else if(aa[k.skin.source]&&(e=k=aa[k.skin.source],k.morph&&ba[k.morph.source]))l=new y,l.url=k.morph.source,l.instance_material=a.controllers[g].instance_material,a.geometries.push(l);break;case "morph":if(ba[k.morph.source])l=new y,l.url=k.morph.source,l.instance_material=a.controllers[g].instance_material,a.geometries.push(l),
+switch(k.type){case "skin":if(ba[k.skin.source]){var l=new v;l.url=k.skin.source;l.instance_material=a.controllers[g].instance_material;a.geometries.push(l);c=a.controllers[g]}else if(aa[k.skin.source]&&(e=k=aa[k.skin.source],k.morph&&ba[k.morph.source]))l=new v,l.url=k.morph.source,l.instance_material=a.controllers[g].instance_material,a.geometries.push(l);break;case "morph":if(ba[k.morph.source])l=new v,l.url=k.morph.source,l.instance_material=a.controllers[g].instance_material,a.geometries.push(l),
 e=a.controllers[g];console.log("ColladaLoader: Morph-controller partially supported.")}}for(g=0;g<a.geometries.length;g++){var k=a.geometries[g],l=k.instance_material,k=ba[k.url],m={},o=0,n;if(k&&k.mesh&&k.mesh.primitives){if(b.name.length==0)b.name=k.id;if(l)for(j=0;j<l.length;j++){n=l[j];var p=ha[ga[n.target].instance_effect.url].shader;p.material.opacity=!p.material.opacity?1:p.material.opacity;n=m[n.symbol]=p.material;o++}l=n||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});
-k=k.mesh.geometry3js;if(o>1){l=new THREE.MeshFaceMaterial;for(j=0;j<k.faces.length;j++)o=k.faces[j],o.materials=[m[o.daeMaterial]]}if(c!==void 0)f(k,c),l.morphTargets=!0,l=new THREE.SkinnedMesh(k,l),l.skeleton=c.skeleton,l.skinController=aa[c.url],l.skinInstanceController=c,l.name="skin_"+ea.length,ea.push(l);else if(e!==void 0){m=k;o=e instanceof u?aa[e.url]:e;if(!o||!o.morph)console.log("could not find morph controller!");else{o=o.morph;for(p=0;p<o.targets.length;p++){var t=ba[o.targets[p]];if(t.mesh&&
-t.mesh.primitives&&t.mesh.primitives.length)t=t.mesh.primitives[0].geometry,t.vertices.length===m.vertices.length&&m.morphTargets.push({name:"target_1",vertices:t.vertices})}m.morphTargets.push({name:"target_Z",vertices:m.vertices})}l.morphTargets=!0;l=new THREE.Mesh(k,l);l.name="morph_"+da.length;da.push(l)}else l=new THREE.Mesh(k,l);b.add(l)}}for(g=0;g<a.nodes.length;g++)b.add(h(a.nodes[g],a));return b}function g(){this.init_from=this.id=""}function k(){this.type=this.name=this.id="";this.morph=
-this.skin=null}function l(){this.weights=this.targets=this.source=this.method=null}function m(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function n(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function o(){this.sid=this.name=this.id="";this.nodes=[];this.controllers=[];this.transforms=[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function t(){this.type=this.sid="";this.data=[];this.matrix=new THREE.Matrix4}
-function u(){this.url="";this.skeleton=[];this.instance_material=[]}function v(){this.target=this.symbol=""}function y(){this.url="";this.instance_material=[]}function p(){this.id="";this.mesh=null}function z(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function x(){}function w(){this.material="";this.count=0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function A(){this.source="";this.stride=this.count=0;this.params=[]}function D(){this.input=
-{}}function B(){this.semantic="";this.offset=0;this.source="";this.set=0}function E(a){this.id=a;this.type=null}function I(){this.name=this.id="";this.instance_effect=null}function G(){this.color=new THREE.Color(0);this.color.setRGB(Math.random(),Math.random(),Math.random());this.color.a=1;this.texcoord=this.texture=null}function K(a,b){this.type=a;this.effect=b;this.material=null}function C(a){this.effect=a;this.format=this.init_from=null}function F(a){this.effect=a;this.mipfilter=this.magfilter=
-this.minfilter=this.wrap_t=this.wrap_s=this.source=null}function J(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function M(){this.url=""}function N(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function L(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=this.dotSyntax=this.sid=null}function O(a){this.id="";this.animation=a;this.inputs=[];this.endTime=this.startTime=this.interpolation=this.output=this.input=null;
-this.duration=0}function H(a){var b=a.getAttribute("id");if(V[b]!=void 0)return V[b];V[b]=(new E(b)).parse(a);return V[b]}function Q(a){if(a=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function P(a){for(var a=X(a).split(/\s+/),b=[],c=0;c<a.length;c++)b.push(parseFloat(a[c]));return b}function T(a){for(var a=X(a).split(/\s+/),b=[],c=0;c<a.length;c++)b.push(parseInt(a[c],10));return b}function X(a){return a.replace(/^\s+/,"").replace(/\s+$/,"")}function R(a,b,c){return a.hasAttribute(b)?
-parseInt(a.getAttribute(b),10):c}function S(a,b){if(a===void 0){for(var c="0.";c.length<b+2;)c+="0";return c}b=b||2;c=a.toString().split(".");for(c[1]=c.length>1?c[1].substr(0,b):"0";c[1].length<b;)c[1]+="0";return c.join(".")}function W(a,b){var c="";c+=S(a.x,b)+",";c+=S(a.y,b)+",";c+=S(a.z,b);return c}var U=null,Z=null,Y,$=null,V={},fa={},ca={},aa={},ba={},ga={},ha={},ia,ja,da,ea,ka=THREE.SmoothShading;g.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=
+k=k.mesh.geometry3js;if(o>1){l=new THREE.MeshFaceMaterial;for(j=0;j<k.faces.length;j++)o=k.faces[j],o.materials=[m[o.daeMaterial]]}if(c!==void 0)f(k,c),l.morphTargets=!0,l=new THREE.SkinnedMesh(k,l),l.skeleton=c.skeleton,l.skinController=aa[c.url],l.skinInstanceController=c,l.name="skin_"+ea.length,ea.push(l);else if(e!==void 0){m=k;o=e instanceof t?aa[e.url]:e;if(!o||!o.morph)console.log("could not find morph controller!");else{o=o.morph;for(p=0;p<o.targets.length;p++){var u=ba[o.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);b.add(l)}}for(g=0;g<a.nodes.length;g++)b.add(h(a.nodes[g],a));return b}function g(){this.init_from=this.id=""}function k(){this.type=this.name=this.id="";this.morph=
+this.skin=null}function l(){this.weights=this.targets=this.source=this.method=null}function m(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function n(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function o(){this.sid=this.name=this.id="";this.nodes=[];this.controllers=[];this.transforms=[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function u(){this.type=this.sid="";this.data=[];this.matrix=new THREE.Matrix4}
+function t(){this.url="";this.skeleton=[];this.instance_material=[]}function z(){this.target=this.symbol=""}function v(){this.url="";this.instance_material=[]}function p(){this.id="";this.mesh=null}function y(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function x(){}function w(){this.material="";this.count=0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function A(){this.source="";this.stride=this.count=0;this.params=[]}function D(){this.input=
+{}}function B(){this.semantic="";this.offset=0;this.source="";this.set=0}function E(a){this.id=a;this.type=null}function I(){this.name=this.id="";this.instance_effect=null}function G(){this.color=new THREE.Color(0);this.color.setRGB(Math.random(),Math.random(),Math.random());this.color.a=1;this.texcoord=this.texture=null}function L(a,b){this.type=a;this.effect=b;this.material=null}function C(a){this.effect=a;this.format=this.init_from=null}function F(a){this.effect=a;this.mipfilter=this.magfilter=
+this.minfilter=this.wrap_t=this.wrap_s=this.source=null}function J(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function M(){this.url=""}function N(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function K(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=this.dotSyntax=this.sid=null}function P(a){this.id="";this.animation=a;this.inputs=[];this.endTime=this.startTime=this.interpolation=this.output=this.input=null;
+this.duration=0}function H(a){var b=a.getAttribute("id");if(W[b]!=void 0)return W[b];W[b]=(new E(b)).parse(a);return W[b]}function Q(a){if(a=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function O(a){for(var a=U(a).split(/\s+/),b=[],c=0;c<a.length;c++)b.push(parseFloat(a[c]));return b}function R(a){for(var a=U(a).split(/\s+/),b=[],c=0;c<a.length;c++)b.push(parseInt(a[c],10));return b}function U(a){return a.replace(/^\s+/,"").replace(/\s+$/,"")}function S(a,b,c){return a.hasAttribute(b)?
+parseInt(a.getAttribute(b),10):c}function T(a,b){if(a===void 0){for(var c="0.";c.length<b+2;)c+="0";return c}b=b||2;c=a.toString().split(".");for(c[1]=c.length>1?c[1].substr(0,b):"0";c[1].length<b;)c[1]+="0";return c.join(".")}function X(a,b){var c="";c+=T(a.x,b)+",";c+=T(a.y,b)+",";c+=T(a.z,b);return c}var V=null,Z=null,Y,$=null,W={},fa={},ca={},aa={},ba={},ga={},ha={},ia,ja,da,ea,ka=THREE.SmoothShading;g.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=
 a.childNodes[b];if(c.nodeName=="init_from")this.init_from=c.textContent}return this};k.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.type="none";for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "skin":this.skin=(new m).parse(c);this.type=c.nodeName;break;case "morph":this.morph=(new l).parse(c),this.type=c.nodeName}}return this};l.prototype.parse=function(a){var b={},c=[],e;this.method=a.getAttribute("method");this.source=
 a.getAttribute("source").replace(/^#/,"");for(e=0;e<a.childNodes.length;e++){var g=a.childNodes[e];if(g.nodeType==1)switch(g.nodeName){case "source":g=(new E).parse(g);b[g.id]=g;break;case "targets":c=this.parseInputs(g);break;default:console.log(g.nodeName)}}for(e=0;e<c.length;e++)switch(a=c[e],g=b[a.source],a.semantic){case "MORPH_TARGET":this.targets=g.read();break;case "MORPH_WEIGHT":this.weights=g.read()}return this};l.prototype.parseInputs=function(a){for(var b=[],c=0;c<a.childNodes.length;c++){var e=
-a.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "input":b.push((new B).parse(e))}}return b};m.prototype.parse=function(a){var b={},c,e;this.source=a.getAttribute("source").replace(/^#/,"");this.invBindMatrices=[];this.joints=[];this.weights=[];for(var g=0;g<a.childNodes.length;g++){var f=a.childNodes[g];if(f.nodeType==1)switch(f.nodeName){case "bind_shape_matrix":f=P(f.textContent);this.bindShapeMatrix=new THREE.Matrix4;this.bindShapeMatrix.set(f[0],f[1],f[2],f[3],f[4],f[5],f[6],f[7],f[8],
+a.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "input":b.push((new B).parse(e))}}return b};m.prototype.parse=function(a){var b={},c,e;this.source=a.getAttribute("source").replace(/^#/,"");this.invBindMatrices=[];this.joints=[];this.weights=[];for(var g=0;g<a.childNodes.length;g++){var f=a.childNodes[g];if(f.nodeType==1)switch(f.nodeName){case "bind_shape_matrix":f=O(f.textContent);this.bindShapeMatrix=new THREE.Matrix4;this.bindShapeMatrix.set(f[0],f[1],f[2],f[3],f[4],f[5],f[6],f[7],f[8],
 f[9],f[10],f[11],f[12],f[13],f[14],f[15]);break;case "source":f=(new E).parse(f);b[f.id]=f;break;case "joints":c=f;break;case "vertex_weights":e=f;break;default:console.log(f.nodeName)}}this.parseJoints(c,b);this.parseWeights(e,b);return this};m.prototype.parseJoints=function(a,b){for(var c=0;c<a.childNodes.length;c++){var e=a.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "input":var e=(new B).parse(e),g=b[e.source];if(e.semantic=="JOINT")this.joints=g.read();else if(e.semantic=="INV_BIND_MATRIX")this.invBindMatrices=
-g.read()}}};m.prototype.parseWeights=function(a,b){for(var c,e,g=[],f=0;f<a.childNodes.length;f++){var h=a.childNodes[f];if(h.nodeType==1)switch(h.nodeName){case "input":g.push((new B).parse(h));break;case "v":c=T(h.textContent);break;case "vcount":e=T(h.textContent)}}for(f=h=0;f<e.length;f++){for(var k=e[f],l=[],m=0;m<k;m++){for(var o={},n=0;n<g.length;n++){var p=g[n],t=c[h+p.offset];switch(p.semantic){case "JOINT":o.joint=t;break;case "WEIGHT":o.weight=b[p.source].data[t]}}l.push(o);h+=g.length}for(m=
+g.read()}}};m.prototype.parseWeights=function(a,b){for(var c,e,g=[],f=0;f<a.childNodes.length;f++){var h=a.childNodes[f];if(h.nodeType==1)switch(h.nodeName){case "input":g.push((new B).parse(h));break;case "v":c=R(h.textContent);break;case "vcount":e=R(h.textContent)}}for(f=h=0;f<e.length;f++){for(var k=e[f],l=[],m=0;m<k;m++){for(var o={},n=0;n<g.length;n++){var p=g[n],t=c[h+p.offset];switch(p.semantic){case "JOINT":o.joint=t;break;case "WEIGHT":o.weight=b[p.source].data[t]}}l.push(o);h+=g.length}for(m=
 0;m<l.length;m++)l[m].index=f;this.weights.push(l)}};n.prototype.getChildById=function(a,b){for(var c=0;c<this.nodes.length;c++){var e=this.nodes[c].getChildById(a,b);if(e)return e}return null};n.prototype.getChildBySid=function(a,b){for(var c=0;c<this.nodes.length;c++){var e=this.nodes[c].getChildBySid(a,b);if(e)return e}return null};n.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.nodes=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];
 if(c.nodeType==1)switch(c.nodeName){case "node":this.nodes.push((new o).parse(c))}}return this};o.prototype.getChannelForTransform=function(a){for(var b=0;b<this.channels.length;b++){var c=this.channels[b],e=c.target.split("/");e.shift();var g=e.shift(),f=g.indexOf(".")>=0,h=g.indexOf("(")>=0,k;if(f)e=g.split("."),g=e.shift(),e.shift();else if(h){k=g.split("(");g=k.shift();for(e=0;e<k.length;e++)k[e]=parseInt(k[e].replace(/\)/,""))}if(g==a)return c.info={sid:g,dotSyntax:f,arrSyntax:h,arrIndices:k},
 c}return null};o.prototype.getChildById=function(a,b){if(this.id==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var e=this.nodes[c].getChildById(a,b);if(e)return e}return null};o.prototype.getChildBySid=function(a,b){if(this.sid==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var e=this.nodes[c].getChildBySid(a,b);if(e)return e}return null};o.prototype.getTransformBySid=function(a){for(var b=0;b<this.transforms.length;b++)if(this.transforms[b].sid==a)return this.transforms[b];return null};
-o.prototype.parse=function(a){var b;this.id=a.getAttribute("id");this.sid=a.getAttribute("sid");this.name=a.getAttribute("name");this.type=a.getAttribute("type");this.type=this.type=="JOINT"?this.type:"NODE";this.nodes=[];this.transforms=[];this.geometries=[];this.controllers=[];this.matrix=new THREE.Matrix4;for(var c=0;c<a.childNodes.length;c++)if(b=a.childNodes[c],b.nodeType==1)switch(b.nodeName){case "node":this.nodes.push((new o).parse(b));break;case "instance_camera":break;case "instance_controller":this.controllers.push((new u).parse(b));
-break;case "instance_geometry":this.geometries.push((new y).parse(b));break;case "instance_light":break;case "instance_node":b=b.getAttribute("url").replace(/^#/,"");(b=U.evaluate(".//dae:library_nodes//dae:node[@id='"+b+"']",U,Q,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new o).parse(b));break;case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new t).parse(b));break;case "extra":break;default:console.log(b.nodeName)}a=
+o.prototype.parse=function(a){var b;this.id=a.getAttribute("id");this.sid=a.getAttribute("sid");this.name=a.getAttribute("name");this.type=a.getAttribute("type");this.type=this.type=="JOINT"?this.type:"NODE";this.nodes=[];this.transforms=[];this.geometries=[];this.controllers=[];this.matrix=new THREE.Matrix4;for(var c=0;c<a.childNodes.length;c++)if(b=a.childNodes[c],b.nodeType==1)switch(b.nodeName){case "node":this.nodes.push((new o).parse(b));break;case "instance_camera":break;case "instance_controller":this.controllers.push((new t).parse(b));
+break;case "instance_geometry":this.geometries.push((new v).parse(b));break;case "instance_light":break;case "instance_node":b=b.getAttribute("url").replace(/^#/,"");(b=V.evaluate(".//dae:library_nodes//dae:node[@id='"+b+"']",V,Q,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new o).parse(b));break;case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new u).parse(b));break;case "extra":break;default:console.log(b.nodeName)}a=
 [];c=1E6;b=-1E6;for(var e in ca)for(var g=ca[e],f=0;f<g.channel.length;f++){var h=g.channel[f],k=g.sampler[f];e=h.target.split("/")[0];if(e==this.id)k.create(),h.sampler=k,c=Math.min(c,k.startTime),b=Math.max(b,k.endTime),a.push(h)}if(a.length)this.startTime=c,this.endTime=b;if((this.channels=a)&&this.channels.length){e=1E7;for(i=0;i<this.channels.length;i++){a=this.channels[i].sampler;for(c=0;c<a.input.length-1;c++)e=Math.min(e,a.input[c+1]-a.input[c])}c=[];for(a=this.startTime;a<this.endTime;a+=
 e){b=a;for(var g={},l=f=void 0,f=0;f<this.channels.length;f++)l=this.channels[f],g[l.sid]=l;h=new THREE.Matrix4;for(f=0;f<this.transforms.length;f++)if(k=this.transforms[f],l=g[k.sid],l!==void 0){for(var m=l.sampler,n,l=0;l<m.input.length-1;l++)if(m.input[l+1]>b){n=m.output[l];break}h=n!==void 0?n instanceof THREE.Matrix4?h.multiply(h,n):h.multiply(h,k.matrix):h.multiply(h,k.matrix)}else h=h.multiply(h,k.matrix);b=h;c.push({time:a,pos:[b.n14,b.n24,b.n34],rotq:[0,0,0,1],scl:[1,1,1]})}this.keys=c}this.updateMatrix();
-return this};o.prototype.updateMatrix=function(){this.matrix.identity();for(var a=0;a<this.transforms.length;a++)this.matrix.multiply(this.matrix,this.transforms[a].matrix)};t.prototype.parse=function(a){this.sid=a.getAttribute("sid");this.type=a.nodeName;this.data=P(a.textContent);this.updateMatrix();return this};t.prototype.updateMatrix=function(){var a=0;this.matrix.identity();switch(this.type){case "matrix":this.matrix.set(this.data[0],this.data[1],this.data[2],this.data[3],this.data[4],this.data[5],
-this.data[6],this.data[7],this.data[8],this.data[9],this.data[10],this.data[11],this.data[12],this.data[13],this.data[14],this.data[15]);break;case "translate":this.matrix.setTranslation(this.data[0],this.data[1],this.data[2]);break;case "rotate":a=this.data[3]*(Math.PI/180);this.matrix.setRotationAxis(new THREE.Vector3(this.data[0],this.data[1],this.data[2]),a);break;case "scale":this.matrix.setScale(this.data[0],this.data[1],this.data[2])}return this.matrix};u.prototype.parse=function(a){this.url=
-a.getAttribute("url").replace(/^#/,"");this.skeleton=[];this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "skeleton":this.skeleton.push(c.textContent.replace(/^#/,""));break;case "bind_material":if(c=U.evaluate(".//dae:instance_material",c,Q,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(var e=c.iterateNext();e;)this.instance_material.push((new v).parse(e)),e=c.iterateNext()}}return this};v.prototype.parse=function(a){this.symbol=
-a.getAttribute("symbol");this.target=a.getAttribute("target").replace(/^#/,"");return this};y.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1&&c.nodeName=="bind_material"){if(a=U.evaluate(".//dae:instance_material",c,Q,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(b=a.iterateNext();b;)this.instance_material.push((new v).parse(b)),b=a.iterateNext();break}}return this};
-p.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "mesh":this.mesh=(new z(this)).parse(c)}}return this};z.prototype.parse=function(a){function b(a,c){var e=W(a.position);g[e]===void 0&&(g[e]={v:a,index:c});return g[e]}this.primitives=[];var c;for(c=0;c<a.childNodes.length;c++){var e=a.childNodes[c];switch(e.nodeName){case "source":H(e);break;case "vertices":this.vertices=(new D).parse(e);break;case "triangles":this.primitives.push((new w).parse(e));
-break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new x).parse(e))}}var g={};this.geometry3js=new THREE.Geometry;e=V[this.vertices.input.POSITION.source].data;for(a=c=0;c<e.length;c+=3,a++){var f=new THREE.Vertex(new THREE.Vector3(e[c],e[c+1],e[c+2]));b(f,a);this.geometry3js.vertices.push(f)}for(c=0;c<this.primitives.length;c++)primitive=this.primitives[c],primitive.setVertices(this.vertices),this.handlePrimitive(primitive,this.geometry3js,
-g);this.geometry3js.computeCentroids();this.geometry3js.computeFaceNormals();this.geometry3js.computeVertexNormals();this.geometry3js.computeBoundingBox();return this};z.prototype.handlePrimitive=function(a,b,c){var e=0,g,f,h=a.p,k=a.inputs,l,m,o,n=0,p=3,t=[];for(g=0;g<k.length;g++)switch(l=k[g],l.semantic){case "TEXCOORD":t.push(l.set)}for(;e<h.length;){var u=[],v=[],y={},w=[];a.vcount&&(p=a.vcount[n++]);for(g=0;g<p;g++)for(f=0;f<k.length;f++)switch(l=k[f],source=V[l.source],m=h[e+g*k.length+l.offset],
-numParams=source.accessor.params.length,o=m*numParams,l.semantic){case "VERTEX":l=W(b.vertices[m].position);u.push(c[l].index);break;case "NORMAL":v.push(new THREE.Vector3(source.data[o],source.data[o+1],source.data[o+2]));break;case "TEXCOORD":y[l.set]===void 0&&(y[l.set]=[]);y[l.set].push(new THREE.UV(source.data[o],source.data[o+1]));break;case "COLOR":w.push((new THREE.Color).setRGB(source.data[o],source.data[o+1],source.data[o+2]))}var x;p==3?x=new THREE.Face3(u[0],u[1],u[2],[v[0],v[1],v[2]],
-w.length?w:new THREE.Color):p==4&&(x=new THREE.Face4(u[0],u[1],u[2],u[3],[v[0],v[1],v[2],v[3]],w.length?w:new THREE.Color));x.daeMaterial=a.material;b.faces.push(x);for(f=0;f<t.length;f++)g=y[t[f]],b.faceVertexUvs[f].push([g[0],g[1],g[2]]);e+=k.length*p}};x.prototype=new w;x.prototype.constructor=x;w.prototype.setVertices=function(a){for(var b=0;b<this.inputs.length;b++)if(this.inputs[b].source==a.id)this.inputs[b].source=a.input.POSITION.source};w.prototype.parse=function(a){this.inputs=[];this.material=
-a.getAttribute("material");this.count=R(a,"count",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "input":this.inputs.push((new B).parse(a.childNodes[b]));break;case "vcount":this.vcount=T(c.textContent);break;case "p":this.p=T(c.textContent)}}return this};A.prototype.parse=function(a){this.params=[];this.source=a.getAttribute("source");this.count=R(a,"count",0);this.stride=R(a,"stride",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName==
-"param"){var e={};e.name=c.getAttribute("name");e.type=c.getAttribute("type");this.params.push(e)}}return this};D.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++)a.childNodes[b].nodeName=="input"&&(input=(new B).parse(a.childNodes[b]),this.input[input.semantic]=input);return this};B.prototype.parse=function(a){this.semantic=a.getAttribute("semantic");this.source=a.getAttribute("source").replace(/^#/,"");this.set=R(a,"set",-1);this.offset=R(a,"offset",
-0);if(this.semantic=="TEXCOORD"&&this.set<0)this.set=0;return this};E.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "bool_array":for(var e=X(c.textContent).split(/\s+/),g=[],f=0;f<e.length;f++)g.push(e[f]=="true"||e[f]=="1"?!0:!1);this.data=g;this.type=c.nodeName;break;case "float_array":this.data=P(c.textContent);this.type=c.nodeName;break;case "int_array":this.data=T(c.textContent);this.type=c.nodeName;
-break;case "IDREF_array":case "Name_array":this.data=X(c.textContent).split(/\s+/);this.type=c.nodeName;break;case "technique_common":for(e=0;e<c.childNodes.length;e++)if(c.childNodes[e].nodeName=="accessor"){this.accessor=(new A).parse(c.childNodes[e]);break}}}return this};E.prototype.read=function(){var a=[],b=this.accessor.params[0];switch(b.type){case "IDREF":case "Name":case "name":case "float":return this.data;case "float4x4":for(b=0;b<this.data.length;b+=16){var c=this.data.slice(b,b+16),e=
+return this};o.prototype.updateMatrix=function(){this.matrix.identity();for(var a=0;a<this.transforms.length;a++)this.matrix.multiply(this.matrix,this.transforms[a].matrix)};u.prototype.parse=function(a){this.sid=a.getAttribute("sid");this.type=a.nodeName;this.data=O(a.textContent);this.updateMatrix();return this};u.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 b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "skeleton":this.skeleton.push(c.textContent.replace(/^#/,""));break;case "bind_material":if(c=V.evaluate(".//dae:instance_material",c,Q,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(var e=c.iterateNext();e;)this.instance_material.push((new z).parse(e)),e=c.iterateNext()}}return this};z.prototype.parse=function(a){this.symbol=
+a.getAttribute("symbol");this.target=a.getAttribute("target").replace(/^#/,"");return this};v.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1&&c.nodeName=="bind_material"){if(a=V.evaluate(".//dae:instance_material",c,Q,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(b=a.iterateNext();b;)this.instance_material.push((new z).parse(b)),b=a.iterateNext();break}}return this};
+p.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "mesh":this.mesh=(new y(this)).parse(c)}}return this};y.prototype.parse=function(a){function b(a,c){var e=X(a.position);g[e]===void 0&&(g[e]={v:a,index:c});return g[e]}this.primitives=[];var c;for(c=0;c<a.childNodes.length;c++){var e=a.childNodes[c];switch(e.nodeName){case "source":H(e);break;case "vertices":this.vertices=(new D).parse(e);break;case "triangles":this.primitives.push((new w).parse(e));
+break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new x).parse(e))}}var g={};this.geometry3js=new THREE.Geometry;e=W[this.vertices.input.POSITION.source].data;for(a=c=0;c<e.length;c+=3,a++){var f=new THREE.Vertex(new THREE.Vector3(e[c],e[c+1],e[c+2]));b(f,a);this.geometry3js.vertices.push(f)}for(c=0;c<this.primitives.length;c++)primitive=this.primitives[c],primitive.setVertices(this.vertices),this.handlePrimitive(primitive,this.geometry3js,
+g);this.geometry3js.computeCentroids();this.geometry3js.computeFaceNormals();this.geometry3js.computeVertexNormals();this.geometry3js.computeBoundingBox();return this};y.prototype.handlePrimitive=function(a,b,c){var e=0,g,f,h=a.p,k=a.inputs,l,m,o,n=0,p=3,t=[];for(g=0;g<k.length;g++)switch(l=k[g],l.semantic){case "TEXCOORD":t.push(l.set)}for(;e<h.length;){var u=[],v=[],w={},x=[];a.vcount&&(p=a.vcount[n++]);for(g=0;g<p;g++)for(f=0;f<k.length;f++)switch(l=k[f],source=W[l.source],m=h[e+g*k.length+l.offset],
+numParams=source.accessor.params.length,o=m*numParams,l.semantic){case "VERTEX":l=X(b.vertices[m].position);u.push(c[l].index);break;case "NORMAL":v.push(new THREE.Vector3(source.data[o],source.data[o+1],source.data[o+2]));break;case "TEXCOORD":w[l.set]===void 0&&(w[l.set]=[]);w[l.set].push(new THREE.UV(source.data[o],source.data[o+1]));break;case "COLOR":x.push((new THREE.Color).setRGB(source.data[o],source.data[o+1],source.data[o+2]))}var z;p==3?z=new THREE.Face3(u[0],u[1],u[2],[v[0],v[1],v[2]],
+x.length?x:new THREE.Color):p==4&&(z=new THREE.Face4(u[0],u[1],u[2],u[3],[v[0],v[1],v[2],v[3]],x.length?x:new THREE.Color));z.daeMaterial=a.material;b.faces.push(z);for(f=0;f<t.length;f++)g=w[t[f]],b.faceVertexUvs[f].push([g[0],g[1],g[2]]);e+=k.length*p}};x.prototype=new w;x.prototype.constructor=x;w.prototype.setVertices=function(a){for(var b=0;b<this.inputs.length;b++)if(this.inputs[b].source==a.id)this.inputs[b].source=a.input.POSITION.source};w.prototype.parse=function(a){this.inputs=[];this.material=
+a.getAttribute("material");this.count=S(a,"count",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "input":this.inputs.push((new B).parse(a.childNodes[b]));break;case "vcount":this.vcount=R(c.textContent);break;case "p":this.p=R(c.textContent)}}return this};A.prototype.parse=function(a){this.params=[];this.source=a.getAttribute("source");this.count=S(a,"count",0);this.stride=S(a,"stride",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName==
+"param"){var e={};e.name=c.getAttribute("name");e.type=c.getAttribute("type");this.params.push(e)}}return this};D.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++)a.childNodes[b].nodeName=="input"&&(input=(new B).parse(a.childNodes[b]),this.input[input.semantic]=input);return this};B.prototype.parse=function(a){this.semantic=a.getAttribute("semantic");this.source=a.getAttribute("source").replace(/^#/,"");this.set=S(a,"set",-1);this.offset=S(a,"offset",
+0);if(this.semantic=="TEXCOORD"&&this.set<0)this.set=0;return this};E.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "bool_array":for(var e=U(c.textContent).split(/\s+/),g=[],f=0;f<e.length;f++)g.push(e[f]=="true"||e[f]=="1"?!0:!1);this.data=g;this.type=c.nodeName;break;case "float_array":this.data=O(c.textContent);this.type=c.nodeName;break;case "int_array":this.data=R(c.textContent);this.type=c.nodeName;
+break;case "IDREF_array":case "Name_array":this.data=U(c.textContent).split(/\s+/);this.type=c.nodeName;break;case "technique_common":for(e=0;e<c.childNodes.length;e++)if(c.childNodes[e].nodeName=="accessor"){this.accessor=(new A).parse(c.childNodes[e]);break}}}return this};E.prototype.read=function(){var a=[],b=this.accessor.params[0];switch(b.type){case "IDREF":case "Name":case "name":case "float":return this.data;case "float4x4":for(b=0;b<this.data.length;b+=16){var c=this.data.slice(b,b+16),e=
 new THREE.Matrix4;e.set(c[0],c[1],c[2],c[3],c[4],c[5],c[6],c[7],c[8],c[9],c[10],c[11],c[12],c[13],c[14],c[15]);a.push(e)}break;default:console.log("ColladaLoader: Source: Read dont know how to read "+b.type+".")}return a};I.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");for(var b=0;b<a.childNodes.length;b++)if(a.childNodes[b].nodeName=="instance_effect"){this.instance_effect=(new M).parse(a.childNodes[b]);break}return this};G.prototype.isColor=function(){return this.texture==
-null};G.prototype.isTexture=function(){return this.texture!=null};G.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "color":c=P(c.textContent);this.color=new THREE.Color(0);this.color.setRGB(c[0],c[1],c[2]);this.color.a=c[3];break;case "texture":this.texture=c.getAttribute("texture"),this.texcoord=c.getAttribute("texcoord")}}return this};K.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];
-if(c.nodeType==1)switch(c.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[c.nodeName]=(new G).parse(c);break;case "shininess":case "reflectivity":case "transparency":var e;e=U.evaluate(".//dae:float",c,Q,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);for(var g=e.iterateNext(),f=[];g;)f.push(g),g=e.iterateNext();e=f;e.length>0&&(this[c.nodeName]=parseFloat(e[0].textContent))}}this.create();return this};K.prototype.create=function(){var a={},b=this.transparency!==
+null};G.prototype.isTexture=function(){return this.texture!=null};G.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "color":c=O(c.textContent);this.color=new THREE.Color(0);this.color.setRGB(c[0],c[1],c[2]);this.color.a=c[3];break;case "texture":this.texture=c.getAttribute("texture"),this.texcoord=c.getAttribute("texcoord")}}return this};L.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];
+if(c.nodeType==1)switch(c.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[c.nodeName]=(new G).parse(c);break;case "shininess":case "reflectivity":case "transparency":var e;e=V.evaluate(".//dae:float",c,Q,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);for(var g=e.iterateNext(),f=[];g;)f.push(g),g=e.iterateNext();e=f;e.length>0&&(this[c.nodeName]=parseFloat(e[0].textContent))}}this.create();return this};L.prototype.create=function(){var a={},b=this.transparency!==
 void 0&&this.transparency<1,c;for(c in this)switch(c){case "ambient":case "emission":case "diffuse":case "specular":var e=this[c];if(e instanceof G)if(e.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid&&(e=fa[this.effect.surface.init_from]))a.map=THREE.ImageUtils.loadTexture(ja+e.init_from),a.map.wrapS=THREE.RepeatWrapping,a.map.wrapT=THREE.RepeatWrapping,a.map.repeat.x=1,a.map.repeat.y=-1}else c=="diffuse"?a.color=e.color.getHex():b||(a[c]=
 e.color.getHex());break;case "shininess":case "reflectivity":a[c]=this[c];break;case "transparency":if(b)a.transparent=!0,a.opacity=this[c],b=!0}a.shading=ka;return this.material=new THREE.MeshLambertMaterial(a)};C.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "init_from":this.init_from=c.textContent;break;case "format":this.format=c.textContent;break;default:console.log("unhandled Surface prop: "+c.nodeName)}}return this};
 F.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "source":this.source=c.textContent;break;case "minfilter":this.minfilter=c.textContent;break;case "magfilter":this.magfilter=c.textContent;break;case "mipfilter":this.mipfilter=c.textContent;break;case "wrap_s":this.wrap_s=c.textContent;break;case "wrap_t":this.wrap_t=c.textContent;break;default:console.log("unhandled Sampler2D prop: "+c.nodeName)}}return this};J.prototype.create=
 function(){if(this.shader==null)return null};J.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.shader=null;for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "profile_COMMON":this.parseTechnique(this.parseProfileCOMMON(c))}}return this};J.prototype.parseNewparam=function(a){for(var b=a.getAttribute("sid"),c=0;c<a.childNodes.length;c++){var e=a.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "surface":this.surface=
 (new C(this)).parse(e);this.surface.sid=b;break;case "sampler2D":this.sampler=(new F(this)).parse(e);this.sampler.sid=b;break;case "extra":break;default:console.log(e.nodeName)}}};J.prototype.parseProfileCOMMON=function(a){for(var b,c=0;c<a.childNodes.length;c++){var e=a.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "profile_COMMON":this.parseProfileCOMMON(e);break;case "technique":b=e;break;case "newparam":this.parseNewparam(e);break;case "extra":break;default:console.log(e.nodeName)}}return b};
-J.prototype.parseTechnique=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "lambert":case "blinn":case "phong":this.shader=(new K(c.nodeName,this)).parse(c)}}};M.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");return this};N.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.source={};for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "source":c=
-(new E).parse(c);this.source[c.id]=c;break;case "sampler":this.sampler.push((new O(this)).parse(c));break;case "channel":this.channel.push((new L(this)).parse(c))}}return this};L.prototype.parse=function(a){this.source=a.getAttribute("source").replace(/^#/,"");this.target=a.getAttribute("target");var b=this.target.split("/");b.shift();var a=b.shift(),c=a.indexOf(".")>=0,e=a.indexOf("(")>=0,g,f;if(c)b=a.split("."),a=b.shift(),f=b.shift();else if(e){g=a.split("(");a=g.shift();for(b=0;b<g.length;b++)g[b]=
-parseInt(g[b].replace(/\)/,""))}this.sid=a;this.dotSyntax=c;this.arrSyntax=e;this.arrIndices=g;this.member=f;return this};O.prototype.parse=function(a){this.id=a.getAttribute("id");this.inputs=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "input":this.inputs.push((new B).parse(c))}}return this};O.prototype.create=function(){for(var a=0;a<this.inputs.length;a++){var b=this.inputs[a],c=this.animation.source[b.source];switch(b.semantic){case "INPUT":this.input=
+J.prototype.parseTechnique=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "lambert":case "blinn":case "phong":this.shader=(new L(c.nodeName,this)).parse(c)}}};M.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");return this};N.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.source={};for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "source":c=
+(new E).parse(c);this.source[c.id]=c;break;case "sampler":this.sampler.push((new P(this)).parse(c));break;case "channel":this.channel.push((new K(this)).parse(c))}}return this};K.prototype.parse=function(a){this.source=a.getAttribute("source").replace(/^#/,"");this.target=a.getAttribute("target");var b=this.target.split("/");b.shift();var a=b.shift(),c=a.indexOf(".")>=0,e=a.indexOf("(")>=0,g,f;if(c)b=a.split("."),a=b.shift(),f=b.shift();else if(e){g=a.split("(");a=g.shift();for(b=0;b<g.length;b++)g[b]=
+parseInt(g[b].replace(/\)/,""))}this.sid=a;this.dotSyntax=c;this.arrSyntax=e;this.arrIndices=g;this.member=f;return this};P.prototype.parse=function(a){this.id=a.getAttribute("id");this.inputs=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "input":this.inputs.push((new B).parse(c))}}return this};P.prototype.create=function(){for(var a=0;a<this.inputs.length;a++){var b=this.inputs[a],c=this.animation.source[b.source];switch(b.semantic){case "INPUT":this.input=
 c.read();break;case "OUTPUT":this.output=c.read();break;case "INTERPOLATION":this.interpolation=c.read();break;case "IN_TANGENT":break;case "OUT_TANGENT":break;default:console.log(b.semantic)}}this.duration=this.endTime=this.startTime=0;if(this.input.length){this.startTime=1E8;this.endTime=-1E8;for(a=0;a<this.input.length;a++)this.startTime=Math.min(this.startTime,this.input[a]),this.endTime=Math.max(this.endTime,this.input[a]);this.duration=this.endTime-this.startTime}};return{load:function(b,c){if(document.implementation&&
 document.implementation.createDocument){document.implementation.createDocument("http://www.collada.org/2005/11/COLLADASchema","COLLADA",null);b+="?rnd="+Math.random();var e=new XMLHttpRequest;e.overrideMimeType&&e.overrideMimeType("text/xml");e.onreadystatechange=function(){if(e.readyState==4&&(e.status==0||e.status==200))$=c,a(e.responseXML,void 0,b)};e.open("GET",b,!0);e.send(null)}else alert("Don't know how to parse XML!")},parse:a,setPreferredShading:function(a){ka=a},applySkin:f,geometries:ba}};
 THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;
 THREE.JSONLoader.prototype.load=function(a,c,b){var e,f=this;if(a instanceof Object)console.warn("DEPRECATED: JSONLoader( parameters ) is now JSONLoader( url, callback, texturePath )."),e=a,a=e.model,c=e.callback,b=e.texture_path;e=new Worker(a);b=b?b:this.extractUrlbase(a);e.onmessage=function(a){f.createModel(a.data,c,b);f.onLoadComplete()};this.onLoadStart();e.postMessage(Date.now())};
-THREE.JSONLoader.prototype.createModel=function(a,c,b){var e=new THREE.Geometry,f=a.scale!==void 0?1/a.scale:1;this.initMaterials(e,a.materials,b);(function(b){if(a.version===void 0||a.version!=2)console.error("Deprecated file format.");else{var c,f,l,m,n,o,t,u,v,y,p,z,x,w,A=a.faces;o=a.vertices;var D=a.normals,B=a.colors,E=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&E++;for(c=0;c<E;c++)e.faceUvs[c]=[],e.faceVertexUvs[c]=[];m=0;for(n=o.length;m<n;)t=new THREE.Vertex,t.position.x=o[m++]*b,t.position.y=
-o[m++]*b,t.position.z=o[m++]*b,e.vertices.push(t);m=0;for(n=A.length;m<n;){b=A[m++];o=b&1;l=b&2;c=b&4;f=b&8;u=b&16;t=b&32;y=b&64;b&=128;o?(p=new THREE.Face4,p.a=A[m++],p.b=A[m++],p.c=A[m++],p.d=A[m++],o=4):(p=new THREE.Face3,p.a=A[m++],p.b=A[m++],p.c=A[m++],o=3);if(l)l=A[m++],p.materials=e.materials[l];l=e.faces.length;if(c)for(c=0;c<E;c++)z=a.uvs[c],v=A[m++],w=z[v*2],v=z[v*2+1],e.faceUvs[c][l]=new THREE.UV(w,v);if(f)for(c=0;c<E;c++){z=a.uvs[c];x=[];for(f=0;f<o;f++)v=A[m++],w=z[v*2],v=z[v*2+1],x[f]=
-new THREE.UV(w,v);e.faceVertexUvs[c][l]=x}if(u)u=A[m++]*3,f=new THREE.Vector3,f.x=D[u++],f.y=D[u++],f.z=D[u],p.normal=f;if(t)for(c=0;c<o;c++)u=A[m++]*3,f=new THREE.Vector3,f.x=D[u++],f.y=D[u++],f.z=D[u],p.vertexNormals.push(f);if(y)t=A[m++],t=new THREE.Color(B[t]),p.color=t;if(b)for(c=0;c<o;c++)t=A[m++],t=new THREE.Color(B[t]),p.vertexColors.push(t);e.faces.push(p)}}})(f);(function(){var b,c,f,l;if(a.skinWeights){b=0;for(c=a.skinWeights.length;b<c;b+=2)f=a.skinWeights[b],l=a.skinWeights[b+1],e.skinWeights.push(new THREE.Vector4(f,
-l,0,0))}if(a.skinIndices){b=0;for(c=a.skinIndices.length;b<c;b+=2)f=a.skinIndices[b],l=a.skinIndices[b+1],e.skinIndices.push(new THREE.Vector4(f,l,0,0))}e.bones=a.bones;e.animation=a.animation})();(function(b){if(a.morphTargets!==void 0){var c,f,l,m,n,o,t,u,v;c=0;for(f=a.morphTargets.length;c<f;c++){e.morphTargets[c]={};e.morphTargets[c].name=a.morphTargets[c].name;e.morphTargets[c].vertices=[];u=e.morphTargets[c].vertices;v=a.morphTargets[c].vertices;l=0;for(m=v.length;l<m;l+=3)n=v[l]*b,o=v[l+1]*
-b,t=v[l+2]*b,u.push(new THREE.Vertex(new THREE.Vector3(n,o,t)))}}if(a.morphColors!==void 0){c=0;for(f=a.morphColors.length;c<f;c++){e.morphColors[c]={};e.morphColors[c].name=a.morphColors[c].name;e.morphColors[c].colors=[];m=e.morphColors[c].colors;n=a.morphColors[c].colors;b=0;for(l=n.length;b<l;b+=3)o=new THREE.Color(16755200),o.setRGB(n[b],n[b+1],n[b+2]),m.push(o)}}})(f);e.computeCentroids();e.computeFaceNormals();this.hasNormals(e)&&e.computeTangents();c(e)};
+THREE.JSONLoader.prototype.createModel=function(a,c,b){var e=new THREE.Geometry,f=a.scale!==void 0?1/a.scale:1;this.initMaterials(e,a.materials,b);(function(b){if(a.version===void 0||a.version!=2)console.error("Deprecated file format.");else{var c,f,l,m,n,o,u,t,z,v,p,y,x,w,A=a.faces;o=a.vertices;var D=a.normals,B=a.colors,E=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&E++;for(c=0;c<E;c++)e.faceUvs[c]=[],e.faceVertexUvs[c]=[];m=0;for(n=o.length;m<n;)u=new THREE.Vertex,u.position.x=o[m++]*b,u.position.y=
+o[m++]*b,u.position.z=o[m++]*b,e.vertices.push(u);m=0;for(n=A.length;m<n;){b=A[m++];o=b&1;l=b&2;c=b&4;f=b&8;t=b&16;u=b&32;v=b&64;b&=128;o?(p=new THREE.Face4,p.a=A[m++],p.b=A[m++],p.c=A[m++],p.d=A[m++],o=4):(p=new THREE.Face3,p.a=A[m++],p.b=A[m++],p.c=A[m++],o=3);if(l)l=A[m++],p.materialIndex=l;l=e.faces.length;if(c)for(c=0;c<E;c++)y=a.uvs[c],z=A[m++],w=y[z*2],z=y[z*2+1],e.faceUvs[c][l]=new THREE.UV(w,z);if(f)for(c=0;c<E;c++){y=a.uvs[c];x=[];for(f=0;f<o;f++)z=A[m++],w=y[z*2],z=y[z*2+1],x[f]=new THREE.UV(w,
+z);e.faceVertexUvs[c][l]=x}if(t)t=A[m++]*3,f=new THREE.Vector3,f.x=D[t++],f.y=D[t++],f.z=D[t],p.normal=f;if(u)for(c=0;c<o;c++)t=A[m++]*3,f=new THREE.Vector3,f.x=D[t++],f.y=D[t++],f.z=D[t],p.vertexNormals.push(f);if(v)u=A[m++],u=new THREE.Color(B[u]),p.color=u;if(b)for(c=0;c<o;c++)u=A[m++],u=new THREE.Color(B[u]),p.vertexColors.push(u);e.faces.push(p)}}})(f);(function(){var b,c,f,l;if(a.skinWeights){b=0;for(c=a.skinWeights.length;b<c;b+=2)f=a.skinWeights[b],l=a.skinWeights[b+1],e.skinWeights.push(new THREE.Vector4(f,
+l,0,0))}if(a.skinIndices){b=0;for(c=a.skinIndices.length;b<c;b+=2)f=a.skinIndices[b],l=a.skinIndices[b+1],e.skinIndices.push(new THREE.Vector4(f,l,0,0))}e.bones=a.bones;e.animation=a.animation})();(function(b){if(a.morphTargets!==void 0){var c,f,l,m,n,o,u,t,z;c=0;for(f=a.morphTargets.length;c<f;c++){e.morphTargets[c]={};e.morphTargets[c].name=a.morphTargets[c].name;e.morphTargets[c].vertices=[];t=e.morphTargets[c].vertices;z=a.morphTargets[c].vertices;l=0;for(m=z.length;l<m;l+=3)n=z[l]*b,o=z[l+1]*
+b,u=z[l+2]*b,t.push(new THREE.Vertex(new THREE.Vector3(n,o,u)))}}if(a.morphColors!==void 0){c=0;for(f=a.morphColors.length;c<f;c++){e.morphColors[c]={};e.morphColors[c].name=a.morphColors[c].name;e.morphColors[c].colors=[];m=e.morphColors[c].colors;n=a.morphColors[c].colors;b=0;for(l=n.length;b<l;b+=3)o=new THREE.Color(16755200),o.setRGB(n[b],n[b+1],n[b+2]),m.push(o)}}})(f);e.computeCentroids();e.computeFaceNormals();this.hasNormals(e)&&e.computeTangents();c(e)};
 THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};
-THREE.SceneLoader.prototype={load:function(a,c){var b=this,e=new Worker(a);e.postMessage(0);var f=THREE.Loader.prototype.extractUrlbase(a);e.onmessage=function(a){function e(a,b){return b=="relativeToHTML"?a:f+"/"+a}function k(){for(u in F.objects)if(!H.objects[u])if(x=F.objects[u],x.geometry!==void 0){if(B=H.geometries[x.geometry]){var a=!1;K=[];for(P=0;P<x.materials.length;P++)K[P]=H.materials[x.materials[P]],a=K[P]instanceof THREE.ShaderMaterial;a&&B.computeTangents();w=x.position;r=x.rotation;
-q=x.quaternion;s=x.scale;q=0;K.length==0&&(K[0]=new THREE.MeshFaceMaterial);K.length>1&&(K=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(B,K);object.name=u;object.position.set(w[0],w[1],w[2]);q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=x.visible;H.scene.add(object);H.objects[u]=object;x.meshCollider&&(a=THREE.CollisionUtils.MeshColliderWBox(object),H.scene.collisions.colliders.push(a));
-if(x.castsShadow)a=new THREE.ShadowVolume(B),H.scene.add(a),a.position=object.position,a.rotation=object.rotation,a.scale=object.scale;x.trigger&&x.trigger.toLowerCase()!="none"&&(a={type:x.trigger,object:x},H.triggers[object.name]=a)}}else w=x.position,r=x.rotation,q=x.quaternion,s=x.scale,q=0,object=new THREE.Object3D,object.name=u,object.position.set(w[0],w[1],w[2]),q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]),object.scale.set(s[0],
-s[1],s[2]),object.visible=x.visible!==void 0?x.visible:!1,H.scene.add(object),H.objects[u]=object,H.empties[u]=object,x.trigger&&x.trigger.toLowerCase()!="none"&&(a={type:x.trigger,object:x},H.triggers[object.name]=a)}function l(a){return function(c){H.geometries[a]=c;k();M-=1;b.onLoadComplete();n()}}function m(a){return function(b){H.geometries[a]=b}}function n(){b.callbackProgress({totalModels:L,totalTextures:O,loadedModels:L-M,loadedTextures:O-N},H);b.onLoadProgress();M==0&&N==0&&c(H)}var o,t,
-u,v,y,p,z,x,w,A,D,B,E,I,G,K,C,F,J,M,N,L,O,H;F=a.data;G=new THREE.BinaryLoader;J=new THREE.JSONLoader;N=M=0;H={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};a=!1;for(u in F.objects)if(x=F.objects[u],x.meshCollider){a=!0;break}if(a)H.scene.collisions=new THREE.CollisionSystem;if(F.transform){a=F.transform.position;A=F.transform.rotation;var Q=F.transform.scale;a&&H.scene.position.set(a[0],a[1],a[2]);A&&H.scene.rotation.set(A[0],
-A[1],A[2]);Q&&H.scene.scale.set(Q[0],Q[1],Q[2]);(a||A||Q)&&H.scene.updateMatrix()}a=function(){N-=1;n();b.onLoadComplete()};for(y in F.cameras)A=F.cameras[y],A.type=="perspective"?E=new THREE.PerspectiveCamera(A.fov,A.aspect,A.near,A.far):A.type=="ortho"&&(E=new THREE.OrthographicCamera(A.left,A.right,A.top,A.bottom,A.near,A.far)),w=A.position,A=A.target,E.position.set(w[0],w[1],w[2]),E.target=new THREE.Vector3(A[0],A[1],A[2]),H.cameras[y]=E;for(v in F.lights)y=F.lights[v],E=y.color!==void 0?y.color:
-16777215,A=y.intensity!==void 0?y.intensity:1,y.type=="directional"?(w=y.direction,C=new THREE.DirectionalLight(E,A),C.position.set(w[0],w[1],w[2]),C.position.normalize()):y.type=="point"?(w=y.position,d=y.distance,C=new THREE.PointLight(E,A,d),C.position.set(w[0],w[1],w[2])):y.type=="ambient"&&(C=new THREE.AmbientLight(E)),H.scene.add(C),H.lights[v]=C;for(p in F.fogs)v=F.fogs[p],v.type=="linear"?I=new THREE.Fog(0,v.near,v.far):v.type=="exp2"&&(I=new THREE.FogExp2(0,v.density)),A=v.color,I.color.setRGB(A[0],
-A[1],A[2]),H.fogs[p]=I;if(H.cameras&&F.defaults.camera)H.currentCamera=H.cameras[F.defaults.camera];if(H.fogs&&F.defaults.fog)H.scene.fog=H.fogs[F.defaults.fog];A=F.defaults.bgcolor;H.bgColor=new THREE.Color;H.bgColor.setRGB(A[0],A[1],A[2]);H.bgColorAlpha=F.defaults.bgalpha;for(o in F.geometries)if(p=F.geometries[o],p.type=="bin_mesh"||p.type=="ascii_mesh")M+=1,b.onLoadStart();L=M;for(o in F.geometries)p=F.geometries[o],p.type=="cube"?(B=new THREE.CubeGeometry(p.width,p.height,p.depth,p.segmentsWidth,
-p.segmentsHeight,p.segmentsDepth,null,p.flipped,p.sides),H.geometries[o]=B):p.type=="plane"?(B=new THREE.PlaneGeometry(p.width,p.height,p.segmentsWidth,p.segmentsHeight),H.geometries[o]=B):p.type=="sphere"?(B=new THREE.SphereGeometry(p.radius,p.segmentsWidth,p.segmentsHeight),H.geometries[o]=B):p.type=="cylinder"?(B=new THREE.CylinderGeometry(p.topRad,p.botRad,p.height,p.radSegs,p.heightSegs),H.geometries[o]=B):p.type=="torus"?(B=new THREE.TorusGeometry(p.radius,p.tube,p.segmentsR,p.segmentsT),H.geometries[o]=
-B):p.type=="icosahedron"?(B=new THREE.IcosahedronGeometry(p.subdivisions),H.geometries[o]=B):p.type=="bin_mesh"?G.load(e(p.url,F.urlBaseType),l(o)):p.type=="ascii_mesh"?J.load(e(p.url,F.urlBaseType),l(o)):p.type=="embedded_mesh"&&(p=F.embeds[p.id])&&J.createModel(p,m(o),"");for(z in F.textures)if(o=F.textures[z],o.url instanceof Array){N+=o.url.length;for(G=0;G<o.url.length;G++)b.onLoadStart()}else N+=1,b.onLoadStart();O=N;for(z in F.textures){o=F.textures[z];if(o.mapping!=void 0&&THREE[o.mapping]!=
-void 0)o.mapping=new THREE[o.mapping];if(o.url instanceof Array){G=[];for(var P=0;P<o.url.length;P++)G[P]=e(o.url[P],F.urlBaseType);G=THREE.ImageUtils.loadTextureCube(G,o.mapping,a)}else{G=THREE.ImageUtils.loadTexture(e(o.url,F.urlBaseType),o.mapping,a);if(THREE[o.minFilter]!=void 0)G.minFilter=THREE[o.minFilter];if(THREE[o.magFilter]!=void 0)G.magFilter=THREE[o.magFilter];if(o.repeat){G.repeat.set(o.repeat[0],o.repeat[1]);if(o.repeat[0]!=1)G.wrapS=THREE.RepeatWrapping;if(o.repeat[1]!=1)G.wrapT=THREE.RepeatWrapping}o.offset&&
-G.offset.set(o.offset[0],o.offset[1]);if(o.wrap){J={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(J[o.wrap[0]]!==void 0)G.wrapS=J[o.wrap[0]];if(J[o.wrap[1]]!==void 0)G.wrapT=J[o.wrap[1]]}}H.textures[z]=G}for(t in F.materials){z=F.materials[t];for(D in z.parameters)if(D=="envMap"||D=="map"||D=="lightMap")z.parameters[D]=H.textures[z.parameters[D]];else if(D=="shading")z.parameters[D]=z.parameters[D]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(D=="blending")z.parameters[D]=
-THREE[z.parameters[D]]?THREE[z.parameters[D]]:THREE.NormalBlending;else if(D=="combine")z.parameters[D]=z.parameters[D]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(D=="vertexColors")if(z.parameters[D]=="face")z.parameters[D]=THREE.FaceColors;else if(z.parameters[D])z.parameters[D]=THREE.VertexColors;if(z.parameters.opacity!==void 0&&z.parameters.opacity<1)z.parameters.transparent=!0;if(z.parameters.normalMap){o=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(o.uniforms);
-G=z.parameters.color;J=z.parameters.specular;p=z.parameters.ambient;I=z.parameters.shininess;a.tNormal.texture=H.textures[z.parameters.normalMap];if(z.parameters.normalMapFactor)a.uNormalScale.value=z.parameters.normalMapFactor;if(z.parameters.map)a.tDiffuse.texture=z.parameters.map,a.enableDiffuse.value=!0;if(z.parameters.lightMap)a.tAO.texture=z.parameters.lightMap,a.enableAO.value=!0;if(z.parameters.specularMap)a.tSpecular.texture=H.textures[z.parameters.specularMap],a.enableSpecular.value=!0;
-a.uDiffuseColor.value.setHex(G);a.uSpecularColor.value.setHex(J);a.uAmbientColor.value.setHex(p);a.uShininess.value=I;if(z.parameters.opacity)a.uOpacity.value=z.parameters.opacity;z=new THREE.ShaderMaterial({fragmentShader:o.fragmentShader,vertexShader:o.vertexShader,uniforms:a,lights:!0,fog:!0})}else z=new THREE[z.type](z.parameters);H.materials[t]=z}k();b.callbackSync(H)}},constructor:THREE.SceneLoader};THREE.UTF8Loader=function(){};THREE.UTF8Loader.prototype=new THREE.UTF8Loader;
-THREE.UTF8Loader.prototype.constructor=THREE.UTF8Loader;
+THREE.SceneLoader.prototype={load:function(a,c){var b=this,e=new Worker(a);e.postMessage(0);var f=THREE.Loader.prototype.extractUrlbase(a);e.onmessage=function(a){function e(a,b){return b=="relativeToHTML"?a:f+"/"+a}function k(){for(t in F.objects)if(!H.objects[t])if(x=F.objects[t],x.geometry!==void 0){if(B=H.geometries[x.geometry]){var a=!1;for(O=0;O<x.materials.length;O++)L=H.materials[x.materials[O]],a=L instanceof THREE.ShaderMaterial;a&&B.computeTangents();w=x.position;r=x.rotation;q=x.quaternion;
+s=x.scale;q=0;L.length==0&&(L=new THREE.MeshFaceMaterial);L.length>1&&(L=new THREE.MeshFaceMaterial);object=new THREE.Mesh(B,L);object.name=t;object.position.set(w[0],w[1],w[2]);q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=x.visible;H.scene.add(object);H.objects[t]=object;x.meshCollider&&(a=THREE.CollisionUtils.MeshColliderWBox(object),H.scene.collisions.colliders.push(a));if(x.castsShadow)a=
+new THREE.ShadowVolume(B),H.scene.add(a),a.position=object.position,a.rotation=object.rotation,a.scale=object.scale;x.trigger&&x.trigger.toLowerCase()!="none"&&(a={type:x.trigger,object:x},H.triggers[object.name]=a)}}else w=x.position,r=x.rotation,q=x.quaternion,s=x.scale,q=0,object=new THREE.Object3D,object.name=t,object.position.set(w[0],w[1],w[2]),q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]),object.scale.set(s[0],s[1],s[2]),object.visible=
+x.visible!==void 0?x.visible:!1,H.scene.add(object),H.objects[t]=object,H.empties[t]=object,x.trigger&&x.trigger.toLowerCase()!="none"&&(a={type:x.trigger,object:x},H.triggers[object.name]=a)}function l(a){return function(c){H.geometries[a]=c;k();M-=1;b.onLoadComplete();n()}}function m(a){return function(b){H.geometries[a]=b}}function n(){b.callbackProgress({totalModels:K,totalTextures:P,loadedModels:K-M,loadedTextures:P-N},H);b.onLoadProgress();M==0&&N==0&&c(H)}var o,u,t,z,v,p,y,x,w,A,D,B,E,I,G,
+L,C,F,J,M,N,K,P,H;F=a.data;G=new THREE.BinaryLoader;J=new THREE.JSONLoader;N=M=0;H={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};a=!1;for(t in F.objects)if(x=F.objects[t],x.meshCollider){a=!0;break}if(a)H.scene.collisions=new THREE.CollisionSystem;if(F.transform){a=F.transform.position;A=F.transform.rotation;var Q=F.transform.scale;a&&H.scene.position.set(a[0],a[1],a[2]);A&&H.scene.rotation.set(A[0],A[1],A[2]);Q&&H.scene.scale.set(Q[0],
+Q[1],Q[2]);(a||A||Q)&&H.scene.updateMatrix()}a=function(){N-=1;n();b.onLoadComplete()};for(v in F.cameras)A=F.cameras[v],A.type=="perspective"?E=new THREE.PerspectiveCamera(A.fov,A.aspect,A.near,A.far):A.type=="ortho"&&(E=new THREE.OrthographicCamera(A.left,A.right,A.top,A.bottom,A.near,A.far)),w=A.position,A=A.target,E.position.set(w[0],w[1],w[2]),E.target=new THREE.Vector3(A[0],A[1],A[2]),H.cameras[v]=E;for(z in F.lights)v=F.lights[z],E=v.color!==void 0?v.color:16777215,A=v.intensity!==void 0?v.intensity:
+1,v.type=="directional"?(w=v.direction,C=new THREE.DirectionalLight(E,A),C.position.set(w[0],w[1],w[2]),C.position.normalize()):v.type=="point"?(w=v.position,d=v.distance,C=new THREE.PointLight(E,A,d),C.position.set(w[0],w[1],w[2])):v.type=="ambient"&&(C=new THREE.AmbientLight(E)),H.scene.add(C),H.lights[z]=C;for(p in F.fogs)z=F.fogs[p],z.type=="linear"?I=new THREE.Fog(0,z.near,z.far):z.type=="exp2"&&(I=new THREE.FogExp2(0,z.density)),A=z.color,I.color.setRGB(A[0],A[1],A[2]),H.fogs[p]=I;if(H.cameras&&
+F.defaults.camera)H.currentCamera=H.cameras[F.defaults.camera];if(H.fogs&&F.defaults.fog)H.scene.fog=H.fogs[F.defaults.fog];A=F.defaults.bgcolor;H.bgColor=new THREE.Color;H.bgColor.setRGB(A[0],A[1],A[2]);H.bgColorAlpha=F.defaults.bgalpha;for(o in F.geometries)if(p=F.geometries[o],p.type=="bin_mesh"||p.type=="ascii_mesh")M+=1,b.onLoadStart();K=M;for(o in F.geometries)p=F.geometries[o],p.type=="cube"?(B=new THREE.CubeGeometry(p.width,p.height,p.depth,p.segmentsWidth,p.segmentsHeight,p.segmentsDepth,
+null,p.flipped,p.sides),H.geometries[o]=B):p.type=="plane"?(B=new THREE.PlaneGeometry(p.width,p.height,p.segmentsWidth,p.segmentsHeight),H.geometries[o]=B):p.type=="sphere"?(B=new THREE.SphereGeometry(p.radius,p.segmentsWidth,p.segmentsHeight),H.geometries[o]=B):p.type=="cylinder"?(B=new THREE.CylinderGeometry(p.topRad,p.botRad,p.height,p.radSegs,p.heightSegs),H.geometries[o]=B):p.type=="torus"?(B=new THREE.TorusGeometry(p.radius,p.tube,p.segmentsR,p.segmentsT),H.geometries[o]=B):p.type=="icosahedron"?
+(B=new THREE.IcosahedronGeometry(p.subdivisions),H.geometries[o]=B):p.type=="bin_mesh"?G.load(e(p.url,F.urlBaseType),l(o)):p.type=="ascii_mesh"?J.load(e(p.url,F.urlBaseType),l(o)):p.type=="embedded_mesh"&&(p=F.embeds[p.id])&&J.createModel(p,m(o),"");for(y in F.textures)if(o=F.textures[y],o.url instanceof Array){N+=o.url.length;for(G=0;G<o.url.length;G++)b.onLoadStart()}else N+=1,b.onLoadStart();P=N;for(y in F.textures){o=F.textures[y];if(o.mapping!=void 0&&THREE[o.mapping]!=void 0)o.mapping=new THREE[o.mapping];
+if(o.url instanceof Array){G=[];for(var O=0;O<o.url.length;O++)G[O]=e(o.url[O],F.urlBaseType);G=THREE.ImageUtils.loadTextureCube(G,o.mapping,a)}else{G=THREE.ImageUtils.loadTexture(e(o.url,F.urlBaseType),o.mapping,a);if(THREE[o.minFilter]!=void 0)G.minFilter=THREE[o.minFilter];if(THREE[o.magFilter]!=void 0)G.magFilter=THREE[o.magFilter];if(o.repeat){G.repeat.set(o.repeat[0],o.repeat[1]);if(o.repeat[0]!=1)G.wrapS=THREE.RepeatWrapping;if(o.repeat[1]!=1)G.wrapT=THREE.RepeatWrapping}o.offset&&G.offset.set(o.offset[0],
+o.offset[1]);if(o.wrap){J={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(J[o.wrap[0]]!==void 0)G.wrapS=J[o.wrap[0]];if(J[o.wrap[1]]!==void 0)G.wrapT=J[o.wrap[1]]}}H.textures[y]=G}for(u in F.materials){y=F.materials[u];for(D in y.parameters)if(D=="envMap"||D=="map"||D=="lightMap")y.parameters[D]=H.textures[y.parameters[D]];else if(D=="shading")y.parameters[D]=y.parameters[D]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(D=="blending")y.parameters[D]=THREE[y.parameters[D]]?
+THREE[y.parameters[D]]:THREE.NormalBlending;else if(D=="combine")y.parameters[D]=y.parameters[D]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(D=="vertexColors")if(y.parameters[D]=="face")y.parameters[D]=THREE.FaceColors;else if(y.parameters[D])y.parameters[D]=THREE.VertexColors;if(y.parameters.opacity!==void 0&&y.parameters.opacity<1)y.parameters.transparent=!0;if(y.parameters.normalMap){o=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(o.uniforms);G=y.parameters.color;
+J=y.parameters.specular;p=y.parameters.ambient;I=y.parameters.shininess;a.tNormal.texture=H.textures[y.parameters.normalMap];if(y.parameters.normalMapFactor)a.uNormalScale.value=y.parameters.normalMapFactor;if(y.parameters.map)a.tDiffuse.texture=y.parameters.map,a.enableDiffuse.value=!0;if(y.parameters.lightMap)a.tAO.texture=y.parameters.lightMap,a.enableAO.value=!0;if(y.parameters.specularMap)a.tSpecular.texture=H.textures[y.parameters.specularMap],a.enableSpecular.value=!0;a.uDiffuseColor.value.setHex(G);
+a.uSpecularColor.value.setHex(J);a.uAmbientColor.value.setHex(p);a.uShininess.value=I;if(y.parameters.opacity)a.uOpacity.value=y.parameters.opacity;y=new THREE.ShaderMaterial({fragmentShader:o.fragmentShader,vertexShader:o.vertexShader,uniforms:a,lights:!0,fog:!0})}else y=new THREE[y.type](y.parameters);H.materials[u]=y}k();b.callbackSync(H)}},constructor:THREE.SceneLoader};THREE.UTF8Loader=function(){};THREE.UTF8Loader.prototype=new THREE.UTF8Loader;THREE.UTF8Loader.prototype.constructor=THREE.UTF8Loader;
 THREE.UTF8Loader.prototype.load=function(a,c,b){if(a instanceof Object)console.warn("DEPRECATED: UTF8Loader( parameters ) is now UTF8Loader( url, callback, metaData )."),b=a,a=b.model,c=b.callback,b={scale:b.scale,offsetX:b.offsetX,offsetY:b.offsetY,offsetZ:b.offsetZ};var e=new XMLHttpRequest,f=b.scale!==void 0?b.scale:1,h=b.offsetX!==void 0?b.offsetX:0,g=b.offsetY!==void 0?b.offsetY:0,k=b.offsetZ!==void 0?b.offsetZ:0;e.onreadystatechange=function(){e.readyState==4?e.status==200||e.status==0?THREE.UTF8Loader.prototype.createModel(e.responseText,
 c,f,h,g,k):alert("Couldn't load ["+a+"] ["+e.status+"]"):e.readyState!=3&&e.readyState==2&&e.getResponseHeader("Content-Length")};e.open("GET",a,!0);e.send(null)};THREE.UTF8Loader.prototype.decompressMesh=function(a){var c=a.charCodeAt(0);c>=57344&&(c-=2048);c++;for(var b=new Float32Array(8*c),e=1,f=0;f<8;f++){for(var h=0,g=0;g<c;++g){var k=a.charCodeAt(g+e);h+=k>>1^-(k&1);b[8*g+f]=h}e+=c}c=a.length-e;h=new Uint16Array(c);for(f=g=0;f<c;f++)k=a.charCodeAt(f+e),h[f]=g-k,k==0&&g++;return[b,h]};
-THREE.UTF8Loader.prototype.createModel=function(a,c,b,e,f,h){var g=function(){var c=this;c.materials=[];THREE.Geometry.call(this);var g=THREE.UTF8Loader.prototype.decompressMesh(a),m=[],n=[];(function(a,g,l){for(var m,n,p,z=a.length;l<z;l+=g)m=a[l],n=a[l+1],p=a[l+2],m=m/16383*b,n=n/16383*b,p=p/16383*b,m+=e,n+=f,p+=h,c.vertices.push(new THREE.Vertex(new THREE.Vector3(m,n,p)))})(g[0],8,0);(function(a,b,c){for(var e,f,g=a.length;c<g;c+=b)e=a[c],f=a[c+1],e/=1023,f/=1023,n.push(e,1-f)})(g[0],8,3);(function(a,
-b,c){for(var e,f,g,h=a.length;c<h;c+=b)e=a[c],f=a[c+1],g=a[c+2],e=(e-512)/511,f=(f-512)/511,g=(g-512)/511,m.push(e,f,g)})(g[0],8,5);(function(a){var b,e,f,g,h,l,x,w,A,D=a.length;for(b=0;b<D;b+=3){e=a[b];f=a[b+1];g=a[b+2];h=c;w=e;A=f;l=g;x=e;var B=f,E=g,I=h.materials[0],G=m[B*3],K=m[B*3+1],B=m[B*3+2],C=m[E*3],F=m[E*3+1],E=m[E*3+2];x=new THREE.Vector3(m[x*3],m[x*3+1],m[x*3+2]);B=new THREE.Vector3(G,K,B);E=new THREE.Vector3(C,F,E);h.faces.push(new THREE.Face3(w,A,l,[x,B,E],null,I));h=n[e*2];e=n[e*2+
+THREE.UTF8Loader.prototype.createModel=function(a,c,b,e,f,h){var g=function(){var c=this;c.materials=[];THREE.Geometry.call(this);var g=THREE.UTF8Loader.prototype.decompressMesh(a),m=[],n=[];(function(a,g,l){for(var m,n,p,y=a.length;l<y;l+=g)m=a[l],n=a[l+1],p=a[l+2],m=m/16383*b,n=n/16383*b,p=p/16383*b,m+=e,n+=f,p+=h,c.vertices.push(new THREE.Vertex(new THREE.Vector3(m,n,p)))})(g[0],8,0);(function(a,b,c){for(var e,f,g=a.length;c<g;c+=b)e=a[c],f=a[c+1],e/=1023,f/=1023,n.push(e,1-f)})(g[0],8,3);(function(a,
+b,c){for(var e,f,g,h=a.length;c<h;c+=b)e=a[c],f=a[c+1],g=a[c+2],e=(e-512)/511,f=(f-512)/511,g=(g-512)/511,m.push(e,f,g)})(g[0],8,5);(function(a){var b,e,f,g,h,l,x,w,A,D=a.length;for(b=0;b<D;b+=3){e=a[b];f=a[b+1];g=a[b+2];h=c;w=e;A=f;l=g;x=e;var B=f,E=g,I=h.materials[0],G=m[B*3],L=m[B*3+1],B=m[B*3+2],C=m[E*3],F=m[E*3+1],E=m[E*3+2];x=new THREE.Vector3(m[x*3],m[x*3+1],m[x*3+2]);B=new THREE.Vector3(G,L,B);E=new THREE.Vector3(C,F,E);h.faces.push(new THREE.Face3(w,A,l,[x,B,E],null,I));h=n[e*2];e=n[e*2+
 1];l=n[f*2];x=n[f*2+1];w=n[g*2];A=n[g*2+1];g=c.faceVertexUvs[0];f=l;l=x;x=[];x.push(new THREE.UV(h,e));x.push(new THREE.UV(f,l));x.push(new THREE.UV(w,A));g.push(x)}})(g[1]);this.computeCentroids();this.computeFaceNormals()};g.prototype=new THREE.Geometry;g.prototype.constructor=g;c(new g)};
 THREE.Axes=function(){THREE.Object3D.call(this);var a=new THREE.Geometry;a.vertices.push(new THREE.Vertex);a.vertices.push(new THREE.Vertex(new THREE.Vector3(0,100,0)));var c=new THREE.CylinderGeometry(0,5,25,5,1),b=new THREE.Line(a,new THREE.LineBasicMaterial({color:16711680}));b.rotation.z=-Math.PI/2;this.add(b);b=new THREE.Mesh(c,new THREE.MeshBasicMaterial({color:16711680}));b.position.x=100;b.rotation.z=-Math.PI/2;this.add(b);b=new THREE.Line(a,new THREE.LineBasicMaterial({color:65280}));this.add(b);
 b=new THREE.Mesh(c,new THREE.MeshBasicMaterial({color:65280}));b.position.y=100;this.add(b);b=new THREE.Line(a,new THREE.LineBasicMaterial({color:255}));b.rotation.x=Math.PI/2;this.add(b);b=new THREE.Mesh(c,new THREE.MeshBasicMaterial({color:255}));b.position.z=100;b.rotation.x=Math.PI/2;this.add(b)};THREE.Axes.prototype=new THREE.Object3D;THREE.Axes.prototype.constructor=THREE.Axes;
 THREE.MarchingCubes=function(a,c){THREE.Object3D.call(this);this.materials=c instanceof Array?c:[c];this.init=function(a){this.isolation=80;this.size=a;this.size2=this.size*this.size;this.size3=this.size2*this.size;this.halfsize=this.size/2;this.delta=2/this.size;this.yd=this.size;this.zd=this.size2;this.field=new Float32Array(this.size3);this.normal_cache=new Float32Array(this.size3*3);this.vlist=new Float32Array(36);this.nlist=new Float32Array(36);this.firstDraw=!0;this.maxCount=4096;this.count=
 0;this.hasNormal=this.hasPos=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(a,c,f){return a+(c-a)*f};this.VIntX=function(a,c,f,h,g,k,l,m,n,o){g=(g-n)/(o-n);n=this.normal_cache;c[h]=k+g*this.delta;c[h+1]=l;c[h+2]=m;f[h]=this.lerp(n[a],n[a+3],g);f[h+1]=this.lerp(n[a+1],n[a+4],g);f[h+2]=this.lerp(n[a+2],n[a+5],g)};this.VIntY=function(a,c,f,h,g,k,l,m,n,o){g=(g-n)/(o-n);n=this.normal_cache;c[h]=k;c[h+1]=l+g*this.delta;c[h+
 2]=m;c=a+this.yd*3;f[h]=this.lerp(n[a],n[c],g);f[h+1]=this.lerp(n[a+1],n[c+1],g);f[h+2]=this.lerp(n[a+2],n[c+2],g)};this.VIntZ=function(a,c,f,h,g,k,l,m,n,o){g=(g-n)/(o-n);n=this.normal_cache;c[h]=k;c[h+1]=l;c[h+2]=m+g*this.delta;c=a+this.zd*3;f[h]=this.lerp(n[a],n[c],g);f[h+1]=this.lerp(n[a+1],n[c+1],g);f[h+2]=this.lerp(n[a+2],n[c+2],g)};this.compNorm=function(a){var c=a*3;this.normal_cache[c]==0&&(this.normal_cache[c]=this.field[a-1]-this.field[a+1],this.normal_cache[c+1]=this.field[a-this.yd]-this.field[a+
-this.yd],this.normal_cache[c+2]=this.field[a-this.zd]-this.field[a+this.zd])};this.polygonize=function(a,c,f,h,g,k){var l=h+1,m=h+this.yd,n=h+this.zd,o=l+this.yd,t=l+this.zd,u=h+this.yd+this.zd,v=l+this.yd+this.zd,y=0,p=this.field[h],z=this.field[l],x=this.field[m],w=this.field[o],A=this.field[n],D=this.field[t],B=this.field[u],E=this.field[v];p<g&&(y|=1);z<g&&(y|=2);x<g&&(y|=8);w<g&&(y|=4);A<g&&(y|=16);D<g&&(y|=32);B<g&&(y|=128);E<g&&(y|=64);var I=THREE.edgeTable[y];if(I==0)return 0;var G=this.delta,
-K=a+G,C=c+G,G=f+G;I&1&&(this.compNorm(h),this.compNorm(l),this.VIntX(h*3,this.vlist,this.nlist,0,g,a,c,f,p,z));I&2&&(this.compNorm(l),this.compNorm(o),this.VIntY(l*3,this.vlist,this.nlist,3,g,K,c,f,z,w));I&4&&(this.compNorm(m),this.compNorm(o),this.VIntX(m*3,this.vlist,this.nlist,6,g,a,C,f,x,w));I&8&&(this.compNorm(h),this.compNorm(m),this.VIntY(h*3,this.vlist,this.nlist,9,g,a,c,f,p,x));I&16&&(this.compNorm(n),this.compNorm(t),this.VIntX(n*3,this.vlist,this.nlist,12,g,a,c,G,A,D));I&32&&(this.compNorm(t),
-this.compNorm(v),this.VIntY(t*3,this.vlist,this.nlist,15,g,K,c,G,D,E));I&64&&(this.compNorm(u),this.compNorm(v),this.VIntX(u*3,this.vlist,this.nlist,18,g,a,C,G,B,E));I&128&&(this.compNorm(n),this.compNorm(u),this.VIntY(n*3,this.vlist,this.nlist,21,g,a,c,G,A,B));I&256&&(this.compNorm(h),this.compNorm(n),this.VIntZ(h*3,this.vlist,this.nlist,24,g,a,c,f,p,A));I&512&&(this.compNorm(l),this.compNorm(t),this.VIntZ(l*3,this.vlist,this.nlist,27,g,K,c,f,z,D));I&1024&&(this.compNorm(o),this.compNorm(v),this.VIntZ(o*
-3,this.vlist,this.nlist,30,g,K,C,f,w,E));I&2048&&(this.compNorm(m),this.compNorm(u),this.VIntZ(m*3,this.vlist,this.nlist,33,g,a,C,f,x,B));y<<=4;for(g=h=0;THREE.triTable[y+g]!=-1;)a=y+g,c=a+1,f=a+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[a],3*THREE.triTable[c],3*THREE.triTable[f],k),g+=3,h++;return h};this.posnormtriv=function(a,c,f,h,g,k){var l=this.count*3;this.positionArray[l]=a[f];this.positionArray[l+1]=a[f+1];this.positionArray[l+2]=a[f+2];this.positionArray[l+3]=a[h];this.positionArray[l+
+this.yd],this.normal_cache[c+2]=this.field[a-this.zd]-this.field[a+this.zd])};this.polygonize=function(a,c,f,h,g,k){var l=h+1,m=h+this.yd,n=h+this.zd,o=l+this.yd,u=l+this.zd,t=h+this.yd+this.zd,z=l+this.yd+this.zd,v=0,p=this.field[h],y=this.field[l],x=this.field[m],w=this.field[o],A=this.field[n],D=this.field[u],B=this.field[t],E=this.field[z];p<g&&(v|=1);y<g&&(v|=2);x<g&&(v|=8);w<g&&(v|=4);A<g&&(v|=16);D<g&&(v|=32);B<g&&(v|=128);E<g&&(v|=64);var I=THREE.edgeTable[v];if(I==0)return 0;var G=this.delta,
+L=a+G,C=c+G,G=f+G;I&1&&(this.compNorm(h),this.compNorm(l),this.VIntX(h*3,this.vlist,this.nlist,0,g,a,c,f,p,y));I&2&&(this.compNorm(l),this.compNorm(o),this.VIntY(l*3,this.vlist,this.nlist,3,g,L,c,f,y,w));I&4&&(this.compNorm(m),this.compNorm(o),this.VIntX(m*3,this.vlist,this.nlist,6,g,a,C,f,x,w));I&8&&(this.compNorm(h),this.compNorm(m),this.VIntY(h*3,this.vlist,this.nlist,9,g,a,c,f,p,x));I&16&&(this.compNorm(n),this.compNorm(u),this.VIntX(n*3,this.vlist,this.nlist,12,g,a,c,G,A,D));I&32&&(this.compNorm(u),
+this.compNorm(z),this.VIntY(u*3,this.vlist,this.nlist,15,g,L,c,G,D,E));I&64&&(this.compNorm(t),this.compNorm(z),this.VIntX(t*3,this.vlist,this.nlist,18,g,a,C,G,B,E));I&128&&(this.compNorm(n),this.compNorm(t),this.VIntY(n*3,this.vlist,this.nlist,21,g,a,c,G,A,B));I&256&&(this.compNorm(h),this.compNorm(n),this.VIntZ(h*3,this.vlist,this.nlist,24,g,a,c,f,p,A));I&512&&(this.compNorm(l),this.compNorm(u),this.VIntZ(l*3,this.vlist,this.nlist,27,g,L,c,f,y,D));I&1024&&(this.compNorm(o),this.compNorm(z),this.VIntZ(o*
+3,this.vlist,this.nlist,30,g,L,C,f,w,E));I&2048&&(this.compNorm(m),this.compNorm(t),this.VIntZ(m*3,this.vlist,this.nlist,33,g,a,C,f,x,B));v<<=4;for(g=h=0;THREE.triTable[v+g]!=-1;)a=v+g,c=a+1,f=a+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[a],3*THREE.triTable[c],3*THREE.triTable[f],k),g+=3,h++;return h};this.posnormtriv=function(a,c,f,h,g,k){var l=this.count*3;this.positionArray[l]=a[f];this.positionArray[l+1]=a[f+1];this.positionArray[l+2]=a[f+2];this.positionArray[l+3]=a[h];this.positionArray[l+
 4]=a[h+1];this.positionArray[l+5]=a[h+2];this.positionArray[l+6]=a[g];this.positionArray[l+7]=a[g+1];this.positionArray[l+8]=a[g+2];this.normalArray[l]=c[f];this.normalArray[l+1]=c[f+1];this.normalArray[l+2]=c[f+2];this.normalArray[l+3]=c[h];this.normalArray[l+4]=c[h+1];this.normalArray[l+5]=c[h+2];this.normalArray[l+6]=c[g];this.normalArray[l+7]=c[g+1];this.normalArray[l+8]=c[g+2];this.hasNormal=this.hasPos=!0;this.count+=3;this.count>=this.maxCount-3&&k(this)};this.begin=function(){this.count=0;
-this.hasNormal=this.hasPos=!1};this.end=function(a){if(this.count!=0){for(var c=this.count*3;c<this.positionArray.length;c++)this.positionArray[c]=0;a(this)}};this.addBall=function(a,c,f,h,g){var k=this.size*Math.sqrt(h/g),l=f*this.size,m=c*this.size,n=a*this.size,o=Math.floor(l-k);o<1&&(o=1);l=Math.floor(l+k);l>this.size-1&&(l=this.size-1);var t=Math.floor(m-k);t<1&&(t=1);m=Math.floor(m+k);m>this.size-1&&(m=this.size-1);var u=Math.floor(n-k);u<1&&(u=1);k=Math.floor(n+k);k>this.size-1&&(k=this.size-
-1);for(var v,y,p,z,x,w;o<l;o++){n=this.size2*o;y=o/this.size-f;x=y*y;for(y=t;y<m;y++){p=n+this.size*y;v=y/this.size-c;w=v*v;for(v=u;v<k;v++)z=v/this.size-a,z=h/(1.0E-6+z*z+w+x)-g,z>0&&(this.field[p+v]+=z)}}};this.addPlaneX=function(a,c){var f,h,g,k,l,m=this.size,n=this.yd,o=this.zd,t=this.field,u=m*Math.sqrt(a/c);u>m&&(u=m);for(f=0;f<u;f++)if(h=f/m,h*=h,k=a/(1.0E-4+h)-c,k>0)for(h=0;h<m;h++){l=f+h*n;for(g=0;g<m;g++)t[o*g+l]+=k}};this.addPlaneY=function(a,c){var f,h,g,k,l,m,n=this.size,o=this.yd,t=
-this.zd,u=this.field,v=n*Math.sqrt(a/c);v>n&&(v=n);for(h=0;h<v;h++)if(f=h/n,f*=f,k=a/(1.0E-4+f)-c,k>0){l=h*o;for(f=0;f<n;f++){m=l+f;for(g=0;g<n;g++)u[t*g+m]+=k}}};this.addPlaneZ=function(a,c){var f,h,g,k,l,m;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(a/c);dist>size&&(dist=size);for(g=0;g<dist;g++)if(f=g/size,f*=f,k=a/(1.0E-4+f)-c,k>0){l=zd*g;for(h=0;h<size;h++){m=l+h*yd;for(f=0;f<size;f++)field[m+f]+=k}}};this.reset=function(){var a;for(a=0;a<this.size3;a++)this.normal_cache[a*
-3]=0,this.field[a]=0};this.render=function(a){this.begin();var c,f,h,g,k,l,m,n,o,t=this.size-2;for(g=1;g<t;g++){o=this.size2*g;m=(g-this.halfsize)/this.halfsize;for(h=1;h<t;h++){n=o+this.size*h;l=(h-this.halfsize)/this.halfsize;for(f=1;f<t;f++)k=(f-this.halfsize)/this.halfsize,c=n+f,this.polygonize(k,l,m,c,this.isolation,a)}}this.end(a)};this.generateGeometry=function(){var a=0,c=new THREE.Geometry,f=[];this.render(function(h){var g,k,l,m,n,o,t,u;for(g=0;g<h.count;g++)t=g*3,n=t+1,u=t+2,k=h.positionArray[t],
-l=h.positionArray[n],m=h.positionArray[u],o=new THREE.Vector3(k,l,m),k=h.normalArray[t],l=h.normalArray[n],m=h.normalArray[u],t=new THREE.Vector3(k,l,m),t.normalize(),n=new THREE.Vertex(o),c.vertices.push(n),f.push(t);nfaces=h.count/3;for(g=0;g<nfaces;g++)t=(a+g)*3,n=t+1,u=t+2,o=f[t],k=f[n],l=f[u],t=new THREE.Face3(t,n,u,[o,k,l]),c.faces.push(t);a+=nfaces;h.count=0});return c};this.init(a)};THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
+this.hasNormal=this.hasPos=!1};this.end=function(a){if(this.count!=0){for(var c=this.count*3;c<this.positionArray.length;c++)this.positionArray[c]=0;a(this)}};this.addBall=function(a,c,f,h,g){var k=this.size*Math.sqrt(h/g),l=f*this.size,m=c*this.size,n=a*this.size,o=Math.floor(l-k);o<1&&(o=1);l=Math.floor(l+k);l>this.size-1&&(l=this.size-1);var u=Math.floor(m-k);u<1&&(u=1);m=Math.floor(m+k);m>this.size-1&&(m=this.size-1);var t=Math.floor(n-k);t<1&&(t=1);k=Math.floor(n+k);k>this.size-1&&(k=this.size-
+1);for(var z,v,p,y,x,w;o<l;o++){n=this.size2*o;v=o/this.size-f;x=v*v;for(v=u;v<m;v++){p=n+this.size*v;z=v/this.size-c;w=z*z;for(z=t;z<k;z++)y=z/this.size-a,y=h/(1.0E-6+y*y+w+x)-g,y>0&&(this.field[p+z]+=y)}}};this.addPlaneX=function(a,c){var f,h,g,k,l,m=this.size,n=this.yd,o=this.zd,u=this.field,t=m*Math.sqrt(a/c);t>m&&(t=m);for(f=0;f<t;f++)if(h=f/m,h*=h,k=a/(1.0E-4+h)-c,k>0)for(h=0;h<m;h++){l=f+h*n;for(g=0;g<m;g++)u[o*g+l]+=k}};this.addPlaneY=function(a,c){var f,h,g,k,l,m,n=this.size,o=this.yd,u=
+this.zd,t=this.field,z=n*Math.sqrt(a/c);z>n&&(z=n);for(h=0;h<z;h++)if(f=h/n,f*=f,k=a/(1.0E-4+f)-c,k>0){l=h*o;for(f=0;f<n;f++){m=l+f;for(g=0;g<n;g++)t[u*g+m]+=k}}};this.addPlaneZ=function(a,c){var f,h,g,k,l,m;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(a/c);dist>size&&(dist=size);for(g=0;g<dist;g++)if(f=g/size,f*=f,k=a/(1.0E-4+f)-c,k>0){l=zd*g;for(h=0;h<size;h++){m=l+h*yd;for(f=0;f<size;f++)field[m+f]+=k}}};this.reset=function(){var a;for(a=0;a<this.size3;a++)this.normal_cache[a*
+3]=0,this.field[a]=0};this.render=function(a){this.begin();var c,f,h,g,k,l,m,n,o,u=this.size-2;for(g=1;g<u;g++){o=this.size2*g;m=(g-this.halfsize)/this.halfsize;for(h=1;h<u;h++){n=o+this.size*h;l=(h-this.halfsize)/this.halfsize;for(f=1;f<u;f++)k=(f-this.halfsize)/this.halfsize,c=n+f,this.polygonize(k,l,m,c,this.isolation,a)}}this.end(a)};this.generateGeometry=function(){var a=0,c=new THREE.Geometry,f=[];this.render(function(h){var g,k,l,m,n,o,u,t;for(g=0;g<h.count;g++)u=g*3,n=u+1,t=u+2,k=h.positionArray[u],
+l=h.positionArray[n],m=h.positionArray[t],o=new THREE.Vector3(k,l,m),k=h.normalArray[u],l=h.normalArray[n],m=h.normalArray[t],u=new THREE.Vector3(k,l,m),u.normalize(),n=new THREE.Vertex(o),c.vertices.push(n),f.push(u);nfaces=h.count/3;for(g=0;g<nfaces;g++)u=(a+g)*3,n=u+1,t=u+2,o=f[u],k=f[n],l=f[t],u=new THREE.Face3(u,n,t,[o,k,l]),c.faces.push(u);a+=nfaces;h.count=0});return c};this.init(a)};THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
 THREE.edgeTable=new Int32Array([0,265,515,778,1030,1295,1541,1804,2060,2309,2575,2822,3082,3331,3593,3840,400,153,915,666,1430,1183,1941,1692,2460,2197,2975,2710,3482,3219,3993,3728,560,825,51,314,1590,1855,1077,1340,2620,2869,2111,2358,3642,3891,3129,3376,928,681,419,170,1958,1711,1445,1196,2988,2725,2479,2214,4010,3747,3497,3232,1120,1385,1635,1898,102,367,613,876,3180,3429,3695,3942,2154,2403,2665,2912,1520,1273,2035,1786,502,255,1013,764,3580,3317,4095,3830,2554,2291,3065,2800,1616,1881,1107,
 1370,598,863,85,348,3676,3925,3167,3414,2650,2899,2137,2384,1984,1737,1475,1226,966,719,453,204,4044,3781,3535,3270,3018,2755,2505,2240,2240,2505,2755,3018,3270,3535,3781,4044,204,453,719,966,1226,1475,1737,1984,2384,2137,2899,2650,3414,3167,3925,3676,348,85,863,598,1370,1107,1881,1616,2800,3065,2291,2554,3830,4095,3317,3580,764,1013,255,502,1786,2035,1273,1520,2912,2665,2403,2154,3942,3695,3429,3180,876,613,367,102,1898,1635,1385,1120,3232,3497,3747,4010,2214,2479,2725,2988,1196,1445,1711,1958,170,
 419,681,928,3376,3129,3891,3642,2358,2111,2869,2620,1340,1077,1855,1590,314,51,825,560,3728,3993,3219,3482,2710,2975,2197,2460,1692,1941,1183,1430,666,915,153,400,3840,3593,3331,3082,2822,2575,2309,2060,1804,1541,1295,1030,778,515,265,0]);
@@ -352,9 +351,9 @@ e;if(b<c.min.z||b>c.max.z)return Number.MAX_VALUE;c.normal.set(0,k,0);break;case
 THREE.CollisionSystem.prototype.raySphere=function(a,c){var b=c.center.clone().subSelf(a.origin);if(b.lengthSq<c.radiusSq)return-1;var e=b.dot(a.direction.clone());if(e<=0)return Number.MAX_VALUE;b=c.radiusSq-(b.lengthSq()-e*e);if(b>=0)return Math.abs(e)-Math.sqrt(b);return Number.MAX_VALUE};THREE.CollisionSystem.__v1=new THREE.Vector3;THREE.CollisionSystem.__v2=new THREE.Vector3;THREE.CollisionSystem.__v3=new THREE.Vector3;THREE.CollisionSystem.__nr=new THREE.Vector3;THREE.CollisionSystem.__m=new THREE.Matrix4;
 THREE.CollisionSystem.__r=new THREE.Ray;THREE.CollisionUtils={};THREE.CollisionUtils.MeshOBB=function(a){a.geometry.computeBoundingBox();var c=a.geometry.boundingBox,b=new THREE.Vector3(c.x[0],c.y[0],c.z[0]),c=new THREE.Vector3(c.x[1],c.y[1],c.z[1]),b=new THREE.BoxCollider(b,c);b.mesh=a;return b};THREE.CollisionUtils.MeshAABB=function(a){var c=THREE.CollisionUtils.MeshOBB(a);c.min.addSelf(a.position);c.max.addSelf(a.position);c.dynamic=!1;return c};
 THREE.CollisionUtils.MeshColliderWBox=function(a){return new THREE.MeshCollider(a,THREE.CollisionUtils.MeshOBB(a))};
-if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);var c=this,b=this.setSize,e=this.render,f=new THREE.PerspectiveCamera,h=new THREE.PerspectiveCamera,g=new THREE.Matrix4,k=new THREE.Matrix4,l,m,n;f.matrixAutoUpdate=h.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},o=new THREE.WebGLRenderTarget(512,512,a),t=new THREE.WebGLRenderTarget(512,512,a),u=new THREE.PerspectiveCamera(53,1,1,1E4);u.position.z=
-2;_material=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:o},mapRight:{type:"t",value:1,texture:t}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D mapLeft;\nuniform sampler2D mapRight;\nvarying vec2 vUv;\nvoid main() {\nvec4 colorL, colorR;\nvec2 uv = vUv;\ncolorL = texture2D( mapLeft, uv );\ncolorR = texture2D( mapRight, uv );\ngl_FragColor = vec4( colorL.g * 0.7 + colorL.b * 0.3, colorR.g, colorR.b, colorL.a + colorR.a ) * 1.1;\n}"});
-var v=new THREE.Scene;v.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));this.setSize=function(a,e){b.call(c,a,e);o.width=a;o.height=e;t.width=a;t.height=e};this.render=function(a,b){b.update(null,!0);if(l!==b.aspect||m!==b.near||n!==b.fov){l=b.aspect;m=b.near;n=b.fov;var z=b.projectionMatrix.clone(),x=125/30*0.5,w=x*m/125,A=m*Math.tan(n*Math.PI/360),D;g.n14=x;k.n14=-x;x=-A*l+w;D=A*l+w;z.n11=2*m/(D-x);z.n13=(D+x)/(D-x);f.projectionMatrix=z.clone();x=-A*l-w;D=A*l-w;z.n11=2*m/(D-x);z.n13=
-(D+x)/(D-x);h.projectionMatrix=z.clone()}f.matrix=b.matrixWorld.clone().multiplySelf(k);f.update(null,!0);f.position.copy(b.position);f.near=m;f.far=b.far;e.call(c,a,f,o,!0);h.matrix=b.matrixWorld.clone().multiplySelf(g);h.update(null,!0);h.position.copy(b.position);h.near=m;h.far=b.far;e.call(c,a,h,t,!0);e.call(c,v,u)}};
+if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);var c=this,b=this.setSize,e=this.render,f=new THREE.PerspectiveCamera,h=new THREE.PerspectiveCamera,g=new THREE.Matrix4,k=new THREE.Matrix4,l,m,n;f.matrixAutoUpdate=h.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},o=new THREE.WebGLRenderTarget(512,512,a),u=new THREE.WebGLRenderTarget(512,512,a),t=new THREE.PerspectiveCamera(53,1,1,1E4);t.position.z=
+2;_material=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:o},mapRight:{type:"t",value:1,texture:u}},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 z=new THREE.Scene;z.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));this.setSize=function(a,e){b.call(c,a,e);o.width=a;o.height=e;u.width=a;u.height=e};this.render=function(a,b){b.update(null,!0);if(l!==b.aspect||m!==b.near||n!==b.fov){l=b.aspect;m=b.near;n=b.fov;var y=b.projectionMatrix.clone(),x=125/30*0.5,w=x*m/125,A=m*Math.tan(n*Math.PI/360),D;g.n14=x;k.n14=-x;x=-A*l+w;D=A*l+w;y.n11=2*m/(D-x);y.n13=(D+x)/(D-x);f.projectionMatrix=y.clone();x=-A*l-w;D=A*l-w;y.n11=2*m/(D-x);y.n13=
+(D+x)/(D-x);h.projectionMatrix=y.clone()}f.matrix=b.matrixWorld.clone().multiplySelf(k);f.update(null,!0);f.position.copy(b.position);f.near=m;f.far=b.far;e.call(c,a,f,o,!0);h.matrix=b.matrixWorld.clone().multiplySelf(g);h.update(null,!0);h.position.copy(b.position);h.near=m;h.far=b.far;e.call(c,a,h,u,!0);e.call(c,z,t)}};
 if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoClear=!1;var c=this,b=this.setSize,e=this.render,f,h,g=new THREE.PerspectiveCamera;g.target=new THREE.Vector3(0,0,0);var k=new THREE.PerspectiveCamera;k.target=new THREE.Vector3(0,0,0);c.separation=10;if(a&&a.separation!==void 0)c.separation=a.separation;this.setSize=function(a,e){b.call(c,a,e);f=a/2;h=e};this.render=function(a,b){this.clear();g.fov=b.fov;g.aspect=0.5*b.aspect;g.near=b.near;g.far=
 b.far;g.updateProjectionMatrix();g.position.copy(b.position);g.target.copy(b.target);g.translateX(c.separation);g.lookAt(g.target);k.projectionMatrix=g.projectionMatrix;k.position.copy(b.position);k.target.copy(b.target);k.translateX(-c.separation);k.lookAt(k.target);this.setViewport(0,0,f,h);e.call(c,a,g);this.setViewport(f,0,f,h);e.call(c,a,k,!1)}};

+ 6 - 5
build/custom/ThreeSVG.js

@@ -70,9 +70,10 @@ this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRo
 this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);a==0?this.w=this.z=this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},multiplySelf:function(a){var b=
 this.x,c=this.y,d=this.z,f=this.w,e=a.x,g=a.y,i=a.z,a=a.w;this.x=b*a+f*e+c*i-d*g;this.y=c*a+f*g+d*e-b*i;this.z=d*a+f*i+b*g-c*e;this.w=f*a-b*e-c*g-d*i;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,f=a.z,e=this.x,g=this.y,i=this.z,k=this.w,h=k*c+g*f-i*d,j=k*d+i*c-e*f,m=k*f+e*d-g*c,c=-e*
 c-g*d-i*f;b.x=h*k+c*-e+j*-i-m*-g;b.y=j*k+c*-g+m*-e-h*-i;b.z=m*k+c*-i+h*-g-j*-e;return b}};THREE.Quaternion.slerp=function(a,b,c,d){var f=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(f)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var e=Math.acos(f),g=Math.sqrt(1-f*f);if(Math.abs(g)<0.0010)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;f=Math.sin((1-d)*e)/g;d=Math.sin(d*e)/g;c.w=a.w*f+b.w*d;c.x=a.x*f+b.x*d;c.y=a.y*f+b.y*d;c.z=a.z*f+b.z*d;return c};
-THREE.Vertex=function(a){this.position=a||new THREE.Vector3};THREE.Face3=function(a,b,c,d,f,e){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materials=e instanceof Array?e:[e];this.centroid=new THREE.Vector3};
-THREE.Face4=function(a,b,c,d,f,e,g){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materials=g instanceof Array?g:[g];this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.u=a||0;this.v=b||0};
-THREE.UV.prototype={constructor:THREE.UV,set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.u=a.u;this.v=a.v;return this},clone:function(){return new THREE.UV(this.u,this.v)}};THREE.Geometry=function(){this.id=THREE.GeometryCount++;this.vertices=[];this.colors=[];this.faces=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.dynamic=this.hasTangents=!1};
+THREE.Vertex=function(a){this.position=a||new THREE.Vector3};THREE.Face3=function(a,b,c,d,f,e){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materialIndex=e;this.centroid=new THREE.Vector3};
+THREE.Face4=function(a,b,c,d,f,e,g){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materialIndex=g;this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.u=a||0;this.v=b||0};
+THREE.UV.prototype={constructor:THREE.UV,set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.u=a.u;this.v=a.v;return this},clone:function(){return new THREE.UV(this.u,this.v)}};
+THREE.Geometry=function(){this.id=THREE.GeometryCount++;this.vertices=[];this.colors=[];this.materials=[];this.faces=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.dynamic=this.hasTangents=!1};
 THREE.Geometry.prototype={constructor:THREE.Geometry,applyMatrix:function(a){var b=new THREE.Matrix4;b.extractRotation(a,new THREE.Vector3(1,1,1));for(var c=0,d=this.vertices.length;c<d;c++)a.multiplyVector3(this.vertices[c].position);c=0;for(d=this.faces.length;c<d;c++){var f=this.faces[c];b.multiplyVector3(f.normal);for(var e=0,g=f.vertexNormals.length;e<g;e++)b.multiplyVector3(f.vertexNormals[e]);a.multiplyVector3(f.centroid)}},computeCentroids:function(){var a,b,c;a=0;for(b=this.faces.length;a<
 b;a++)c=this.faces[a],c.centroid.set(0,0,0),c instanceof THREE.Face3?(c.centroid.addSelf(this.vertices[c.a].position),c.centroid.addSelf(this.vertices[c.b].position),c.centroid.addSelf(this.vertices[c.c].position),c.centroid.divideScalar(3)):c instanceof THREE.Face4&&(c.centroid.addSelf(this.vertices[c.a].position),c.centroid.addSelf(this.vertices[c.b].position),c.centroid.addSelf(this.vertices[c.c].position),c.centroid.addSelf(this.vertices[c.d].position),c.centroid.divideScalar(4))},computeFaceNormals:function(a){var b,
 c,d,f,e,g,i=new THREE.Vector3,k=new THREE.Vector3;d=0;for(f=this.faces.length;d<f;d++){e=this.faces[d];if(a&&e.vertexNormals.length){i.set(0,0,0);b=0;for(c=e.vertexNormals.length;b<c;b++)i.addSelf(e.vertexNormals[b]);i.divideScalar(3)}else b=this.vertices[e.a],c=this.vertices[e.b],g=this.vertices[e.c],i.sub(g.position,c.position),k.sub(b.position,c.position),i.crossSelf(k);i.isZero()||i.normalize();e.normal.copy(i)}},computeVertexNormals:function(){var a,b,c,d;if(this.__tmpVertices==void 0){d=this.__tmpVertices=
@@ -109,8 +110,8 @@ a.wireframeLinecap!==void 0?a.wireframeLinecap:"round";this.wireframeLinejoin=a.
 THREE.MeshDepthMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.shading=a.shading!==void 0?a.shading:THREE.SmoothShading;this.wireframe=a.wireframe!==void 0?a.wireframe:!1;this.wireframeLinewidth=a.wireframeLinewidth!==void 0?a.wireframeLinewidth:1};THREE.MeshDepthMaterial.prototype=new THREE.Material;THREE.MeshDepthMaterial.prototype.constructor=THREE.MeshDepthMaterial;
 THREE.MeshNormalMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.shading=a.shading?a.shading:THREE.FlatShading;this.wireframe=a.wireframe?a.wireframe:!1;this.wireframeLinewidth=a.wireframeLinewidth?a.wireframeLinewidth:1};THREE.MeshNormalMaterial.prototype=new THREE.Material;THREE.MeshNormalMaterial.prototype.constructor=THREE.MeshNormalMaterial;THREE.MeshFaceMaterial=function(){};
 THREE.ParticleBasicMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=a.color!==void 0?new THREE.Color(a.color):new THREE.Color(16777215);this.map=a.map!==void 0?a.map:null;this.size=a.size!==void 0?a.size:1;this.sizeAttenuation=a.sizeAttenuation!==void 0?a.sizeAttenuation:!0;this.vertexColors=a.vertexColors!==void 0?a.vertexColors:!1;this.fog=a.fog!==void 0?a.fog:!0};THREE.ParticleBasicMaterial.prototype=new THREE.Material;THREE.ParticleBasicMaterial.prototype.constructor=THREE.ParticleBasicMaterial;
-THREE.Particle=function(a){THREE.Object3D.call(this);this.materials=a instanceof Array?a:[a]};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;THREE.Line=function(a,b,c){THREE.Object3D.call(this);this.geometry=a;this.materials=b instanceof Array?b:[b];this.type=c!=void 0?c:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;
-THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.materials=b&&b.length?b:[b];this.overdraw=!1;if(this.geometry&&(this.geometry.boundingSphere||this.geometry.computeBoundingSphere(),this.boundRadius=a.boundingSphere.radius,this.geometry.morphTargets.length)){this.morphTargetBase=-1;this.morphTargetForcedOrder=[];this.morphTargetInfluences=[];this.morphTargetDictionary={};for(var c=0;c<this.geometry.morphTargets.length;c++)this.morphTargetInfluences.push(0),this.morphTargetDictionary[this.geometry.morphTargets[c].name]=
+THREE.Particle=function(a){THREE.Object3D.call(this);this.material=a};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;THREE.Line=function(a,b,c){THREE.Object3D.call(this);this.geometry=a;this.material=b;this.type=c!=void 0?c:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;
+THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material=b;this.overdraw=!1;if(this.geometry&&(this.geometry.boundingSphere||this.geometry.computeBoundingSphere(),this.boundRadius=a.boundingSphere.radius,this.geometry.morphTargets.length)){this.morphTargetBase=-1;this.morphTargetForcedOrder=[];this.morphTargetInfluences=[];this.morphTargetDictionary={};for(var c=0;c<this.geometry.morphTargets.length;c++)this.morphTargetInfluences.push(0),this.morphTargetDictionary[this.geometry.morphTargets[c].name]=
 c}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;THREE.Mesh.prototype.getMorphTargetIndexByName=function(a){if(this.morphTargetDictionary[a]!==void 0)return this.morphTargetDictionary[a];console.log("THREE.Mesh.getMorphTargetIndexByName: morph target "+a+" does not exist. Returning 0.");return 0};
 THREE.Bone=function(a){THREE.Object3D.call(this);this.skin=a;this.skinMatrix=new THREE.Matrix4;this.hasNoneBoneChildren=!1};THREE.Bone.prototype=new THREE.Object3D;THREE.Bone.prototype.constructor=THREE.Bone;THREE.Bone.prototype.supr=THREE.Object3D.prototype;
 THREE.Bone.prototype.update=function(a,b,c){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate)a?this.skinMatrix.multiply(a,this.matrix):this.skinMatrix.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,b=!0;var d,f=this.children.length;if(this.hasNoneBoneChildren){this.matrixWorld.multiply(this.skin.matrixWorld,this.skinMatrix);for(d=0;d<f;d++)a=this.children[d],a instanceof THREE.Bone?a.update(this.skinMatrix,b,c):a.update(this.matrixWorld,!0,c)}else for(d=0;d<f;d++)this.children[d].update(this.skinMatrix,

+ 261 - 262
build/custom/ThreeWebGL.js

@@ -1,150 +1,151 @@
 // ThreeWebGL.js r46dev - http://github.com/mrdoob/three.js
-var THREE=THREE||{};if(!self.Int32Array)self.Int32Array=Array,self.Float32Array=Array;THREE.Color=function(b){b!==void 0&&this.setHex(b);return this};
-THREE.Color.prototype={constructor:THREE.Color,r:1,g:1,b:1,copy:function(b){this.r=b.r;this.g=b.g;this.b=b.b;return this},copyGammaToLinear:function(b){this.r=b.r*b.r;this.g=b.g*b.g;this.b=b.b*b.b;return this},copyLinearToGamma:function(b){this.r=Math.sqrt(b.r);this.g=Math.sqrt(b.g);this.b=Math.sqrt(b.b);return this},setRGB:function(b,c,d){this.r=b;this.g=c;this.b=d;return this},setHSV:function(b,c,d){var f,h,i;if(d==0)this.r=this.g=this.b=0;else switch(f=Math.floor(b*6),h=b*6-f,b=d*(1-c),i=d*(1-
-c*h),c=d*(1-c*(1-h)),f){case 1:this.r=i;this.g=d;this.b=b;break;case 2:this.r=b;this.g=d;this.b=c;break;case 3:this.r=b;this.g=i;this.b=d;break;case 4:this.r=c;this.g=b;this.b=d;break;case 5:this.r=d;this.g=b;this.b=i;break;case 6:case 0:this.r=d,this.g=c,this.b=b}return this},setHex:function(b){b=Math.floor(b);this.r=(b>>16&255)/255;this.g=(b>>8&255)/255;this.b=(b&255)/255;return this},getHex:function(){return~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},getContextStyle:function(){return"rgb("+
-Math.floor(this.r*255)+","+Math.floor(this.g*255)+","+Math.floor(this.b*255)+")"},clone:function(){return(new THREE.Color).setRGB(this.r,this.g,this.b)}};THREE.Vector2=function(b,c){this.x=b||0;this.y=c||0};
-THREE.Vector2.prototype={constructor:THREE.Vector2,set:function(b,c){this.x=b;this.y=c;return this},copy:function(b){this.x=b.x;this.y=b.y;return this},clone:function(){return new THREE.Vector2(this.x,this.y)},add:function(b,c){this.x=b.x+c.x;this.y=b.y+c.y;return this},addSelf:function(b){this.x+=b.x;this.y+=b.y;return this},sub:function(b,c){this.x=b.x-c.x;this.y=b.y-c.y;return this},subSelf:function(b){this.x-=b.x;this.y-=b.y;return this},multiplyScalar:function(b){this.x*=b;this.y*=b;return this},
-divideScalar:function(b){b?(this.x/=b,this.y/=b):this.set(0,0);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(b){return this.x*b.x+this.y*b.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.lengthSq())},normalize:function(){return this.divideScalar(this.length())},distanceTo:function(b){return Math.sqrt(this.distanceToSquared(b))},distanceToSquared:function(b){var c=this.x-b.x,b=this.y-b.y;return c*c+b*b},setLength:function(b){return this.normalize().multiplyScalar(b)},
-equals:function(b){return b.x==this.x&&b.y==this.y}};THREE.Vector3=function(b,c,d){this.x=b||0;this.y=c||0;this.z=d||0};
-THREE.Vector3.prototype={constructor:THREE.Vector3,set:function(b,c,d){this.x=b;this.y=c;this.z=d;return this},setX:function(b){this.x=b;return this},setY:function(b){this.y=b;return this},setZ:function(b){this.z=b;return this},copy:function(b){this.x=b.x;this.y=b.y;this.z=b.z;return this},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)},add:function(b,c){this.x=b.x+c.x;this.y=b.y+c.y;this.z=b.z+c.z;return this},addSelf:function(b){this.x+=b.x;this.y+=b.y;this.z+=b.z;return this},
-addScalar:function(b){this.x+=b;this.y+=b;this.z+=b;return this},sub:function(b,c){this.x=b.x-c.x;this.y=b.y-c.y;this.z=b.z-c.z;return this},subSelf:function(b){this.x-=b.x;this.y-=b.y;this.z-=b.z;return this},multiply:function(b,c){this.x=b.x*c.x;this.y=b.y*c.y;this.z=b.z*c.z;return this},multiplySelf:function(b){this.x*=b.x;this.y*=b.y;this.z*=b.z;return this},multiplyScalar:function(b){this.x*=b;this.y*=b;this.z*=b;return this},divideSelf:function(b){this.x/=b.x;this.y/=b.y;this.z/=b.z;return this},
-divideScalar:function(b){b?(this.x/=b,this.y/=b,this.z/=b):this.set(0,0,0);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(b){return this.x*b.x+this.y*b.y+this.z*b.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.lengthSq())},lengthManhattan:function(){return this.x+this.y+this.z},normalize:function(){return this.divideScalar(this.length())},setLength:function(b){return this.normalize().multiplyScalar(b)},
-cross:function(b,c){this.x=b.y*c.z-b.z*c.y;this.y=b.z*c.x-b.x*c.z;this.z=b.x*c.y-b.y*c.x;return this},crossSelf:function(b){return this.set(this.y*b.z-this.z*b.y,this.z*b.x-this.x*b.z,this.x*b.y-this.y*b.x)},distanceTo:function(b){return Math.sqrt(this.distanceToSquared(b))},distanceToSquared:function(b){return(new THREE.Vector3).sub(this,b).lengthSq()},setPositionFromMatrix:function(b){this.x=b.n14;this.y=b.n24;this.z=b.n34},setRotationFromMatrix:function(b){var c=Math.cos(this.y);this.y=Math.asin(b.n13);
-Math.abs(c)>1.0E-5?(this.x=Math.atan2(-b.n23/c,b.n33/c),this.z=Math.atan2(-b.n12/c,b.n11/c)):(this.x=0,this.z=Math.atan2(b.n21,b.n22))},isZero:function(){return this.lengthSq()<1.0E-4}};THREE.Vector4=function(b,c,d,f){this.x=b||0;this.y=c||0;this.z=d||0;this.w=f!==void 0?f:1};
-THREE.Vector4.prototype={constructor:THREE.Vector4,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!==void 0?b.w:1},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},add:function(b,c){this.x=b.x+c.x;this.y=b.y+c.y;this.z=b.z+c.z;this.w=b.w+c.w;return this},addSelf:function(b){this.x+=b.x;this.y+=b.y;this.z+=b.z;this.w+=b.w;return this},sub:function(b,c){this.x=b.x-c.x;this.y=b.y-c.y;this.z=b.z-
-c.z;this.w=b.w-c.w;return this},subSelf:function(b){this.x-=b.x;this.y-=b.y;this.z-=b.z;this.w-=b.w;return this},multiplyScalar:function(b){this.x*=b;this.y*=b;this.z*=b;this.w*=b;return this},divideScalar:function(b){b?(this.x/=b,this.y/=b,this.z/=b,this.w/=b):(this.z=this.y=this.x=0,this.w=1);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(b){return this.x*b.x+this.y*b.y+this.z*b.z+this.w*b.w},lengthSq:function(){return this.dot(this)},length:function(){return Math.sqrt(this.lengthSq())},
-normalize:function(){return this.divideScalar(this.length())},setLength:function(b){return this.normalize().multiplyScalar(b)},lerpSelf:function(b,c){this.x+=(b.x-this.x)*c;this.y+=(b.y-this.y)*c;this.z+=(b.z-this.z)*c;this.w+=(b.w-this.w)*c;return this}};THREE.Ray=function(b,c){this.origin=b||new THREE.Vector3;this.direction=c||new THREE.Vector3};
-THREE.Ray.prototype={constructor:THREE.Ray,intersectScene:function(b){return this.intersectObjects(b.objects)},intersectObjects:function(b){var c,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),h=b.clone().subSelf(c),b=f.dot(f),c=f.dot(d),f=f.dot(h),i=d.dot(d),d=d.dot(h),h=1/(b*i-c*c),i=(i*f-c*d)*h,b=(b*d-c*f)*h;return i>0&&b>0&&i+b<1}for(var f,h=[],i=0,j=b.children.length;i<j;i++)Array.prototype.push.apply(h,this.intersectObject(b.children[i]));if(b instanceof THREE.Particle){i=c(this.origin,this.direction,b.matrixWorld.getPosition());if(i==null||i>b.scale.x)return[];f={distance:i,point:b.position,face:null,object:b};h.push(f)}else if(b instanceof THREE.Mesh){i=c(this.origin,
-this.direction,b.matrixWorld.getPosition());if(i==null||i>b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)))return h;for(var k,n,m,r,o,v,w,A,F=b.geometry,L=F.vertices,i=0,j=F.faces.length;i<j;i++)if(f=F.faces[i],w=this.origin.clone(),A=this.direction.clone(),r=b.matrixWorld,k=r.multiplyVector3(f.centroid.clone()).subSelf(w),v=k.dot(A),!(v<=0)&&(k=r.multiplyVector3(L[f.a].position.clone()),n=r.multiplyVector3(L[f.b].position.clone()),m=r.multiplyVector3(L[f.c].position.clone()),
-r=f instanceof THREE.Face4?r.multiplyVector3(L[f.d].position.clone()):null,o=b.matrixRotationWorld.multiplyVector3(f.normal.clone()),v=A.dot(o),b.doubleSided||(b.flipSided?v>0:v<0)))if(v=o.dot((new THREE.Vector3).sub(k,w))/v,w=w.addSelf(A.multiplyScalar(v)),f instanceof THREE.Face3)d(w,k,n,m)&&(f={distance:this.origin.distanceTo(w),point:w,face:f,object:b},h.push(f));else if(f instanceof THREE.Face4&&(d(w,k,n,r)||d(w,n,m,r)))f={distance:this.origin.distanceTo(w),point:w,face:f,object:b},h.push(f)}return h}};
-THREE.Rectangle=function(){function b(){i=f-c;j=h-d}var c,d,f,h,i,j,k=!0;this.getX=function(){return c};this.getY=function(){return d};this.getWidth=function(){return i};this.getHeight=function(){return j};this.getLeft=function(){return c};this.getTop=function(){return d};this.getRight=function(){return f};this.getBottom=function(){return h};this.set=function(i,j,r,o){k=!1;c=i;d=j;f=r;h=o;b()};this.addPoint=function(i,j){k?(k=!1,c=i,d=j,f=i,h=j):(c=c<i?c:i,d=d<j?d:j,f=f>i?f:i,h=h>j?h:j);b()};this.add3Points=
-function(i,j,r,o,v,w){k?(k=!1,c=i<r?i<v?i:v:r<v?r:v,d=j<o?j<w?j:w:o<w?o:w,f=i>r?i>v?i:v:r>v?r:v,h=j>o?j>w?j:w:o>w?o:w):(c=i<r?i<v?i<c?i:c:v<c?v:c:r<v?r<c?r:c:v<c?v:c,d=j<o?j<w?j<d?j:d:w<d?w:d:o<w?o<d?o:d:w<d?w:d,f=i>r?i>v?i>f?i:f:v>f?v:f:r>v?r>f?r:f:v>f?v:f,h=j>o?j>w?j>h?j:h:w>h?w:h:o>w?o>h?o:h:w>h?w:h);b()};this.addRectangle=function(i){k?(k=!1,c=i.getLeft(),d=i.getTop(),f=i.getRight(),h=i.getBottom()):(c=c<i.getLeft()?c:i.getLeft(),d=d<i.getTop()?d:i.getTop(),f=f>i.getRight()?f:i.getRight(),h=h>
-i.getBottom()?h:i.getBottom());b()};this.inflate=function(i){c-=i;d-=i;f+=i;h+=i;b()};this.minSelf=function(i){c=c>i.getLeft()?c:i.getLeft();d=d>i.getTop()?d:i.getTop();f=f<i.getRight()?f:i.getRight();h=h<i.getBottom()?h:i.getBottom();b()};this.intersects=function(b){return Math.min(f,b.getRight())-Math.max(c,b.getLeft())>=0&&Math.min(h,b.getBottom())-Math.max(d,b.getTop())>=0};this.empty=function(){k=!0;h=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,h,i,j,k,n,m,r,o,v,w,A,F){this.set(b!==void 0?b:1,c||0,d||0,f||0,h||0,i!==void 0?i:1,j||0,k||0,n||0,m||0,r!==void 0?r:1,o||0,v||0,w||0,A||0,F!==void 0?F:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
-THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(b,c,d,f,h,i,j,k,n,m,r,o,v,w,A,F){this.n11=b;this.n12=c;this.n13=d;this.n14=f;this.n21=h;this.n22=i;this.n23=j;this.n24=k;this.n31=n;this.n32=m;this.n33=r;this.n34=o;this.n41=v;this.n42=w;this.n43=A;this.n44=F;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,h=THREE.Matrix4.__v2,i=THREE.Matrix4.__v3;i.sub(b,c).normalize();if(i.length()===0)i.z=1;f.cross(d,i).normalize();f.length()===0&&(i.x+=1.0E-4,f.cross(d,i).normalize());h.cross(i,f).normalize();this.n11=f.x;this.n12=h.x;this.n13=i.x;this.n21=f.y;this.n22=h.y;this.n23=i.y;this.n31=f.z;this.n32=h.z;this.n33=i.z;return this},multiplyVector3:function(b){var c=b.x,d=b.y,f=b.z,h=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)*h;
-b.y=(this.n21*c+this.n22*d+this.n23*f+this.n24)*h;b.z=(this.n31*c+this.n32*d+this.n33*f+this.n34)*h;return b},multiplyVector4:function(b){var c=b.x,d=b.y,f=b.z,h=b.w;b.x=this.n11*c+this.n12*d+this.n13*f+this.n14*h;b.y=this.n21*c+this.n22*d+this.n23*f+this.n24*h;b.z=this.n31*c+this.n32*d+this.n33*f+this.n34*h;b.w=this.n41*c+this.n42*d+this.n43*f+this.n44*h;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,h=b.n13,i=b.n14,j=b.n21,k=b.n22,n=b.n23,m=b.n24,r=b.n31,o=b.n32,v=b.n33,w=b.n34,A=b.n41,F=b.n42,L=b.n43,H=b.n44,xa=c.n11,ya=
-c.n12,ja=c.n13,sa=c.n14,ha=c.n21,O=c.n22,D=c.n23,ka=c.n24,M=c.n31,S=c.n32,la=c.n33,ia=c.n34,Ca=c.n41,aa=c.n42,J=c.n43,e=c.n44;this.n11=d*xa+f*ha+h*M+i*Ca;this.n12=d*ya+f*O+h*S+i*aa;this.n13=d*ja+f*D+h*la+i*J;this.n14=d*sa+f*ka+h*ia+i*e;this.n21=j*xa+k*ha+n*M+m*Ca;this.n22=j*ya+k*O+n*S+m*aa;this.n23=j*ja+k*D+n*la+m*J;this.n24=j*sa+k*ka+n*ia+m*e;this.n31=r*xa+o*ha+v*M+w*Ca;this.n32=r*ya+o*O+v*S+w*aa;this.n33=r*ja+o*D+v*la+w*J;this.n34=r*sa+o*ka+v*ia+w*e;this.n41=A*xa+F*ha+L*M+H*Ca;this.n42=A*ya+F*O+
-L*S+H*aa;this.n43=A*ja+F*D+L*la+H*J;this.n44=A*sa+F*ka+L*ia+H*e;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,h=this.n21,i=this.n22,j=this.n23,k=this.n24,n=this.n31,m=this.n32,r=this.n33,o=this.n34,v=this.n41,w=this.n42,A=this.n43,F=this.n44;return f*j*m*v-d*k*m*v-f*i*r*v+c*k*r*v+d*i*o*v-c*j*o*v-f*j*n*w+d*k*n*w+f*h*r*w-b*k*r*w-d*h*o*w+b*j*o*w+f*i*n*A-c*k*n*A-f*h*m*A+b*k*m*A+c*h*
-o*A-b*i*o*A-d*i*n*F+c*j*n*F+d*h*m*F-b*j*m*F-c*h*r*F+b*i*r*F},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),h=1-d,i=b.x,j=b.y,k=b.z,n=h*i,m=h*j;this.set(n*i+d,n*j-f*k,n*k+f*j,0,n*j+f*k,m*j+d,m*k-f*i,0,n*k-f*j,m*k+f*i,h*k*k+d,0,0,0,0,1);return this},setPosition:function(b){this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},getPosition:function(){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,h=b.z,i=Math.cos(d),d=Math.sin(d),j=Math.cos(f),
-f=Math.sin(f),k=Math.cos(h),h=Math.sin(h);switch(c){case "YXZ":var n=j*k,m=j*h,r=f*k,o=f*h;this.n11=n+o*d;this.n12=r*d-m;this.n13=i*f;this.n21=i*h;this.n22=i*k;this.n23=-d;this.n31=m*d-r;this.n32=o+n*d;this.n33=i*j;break;case "ZXY":n=j*k;m=j*h;r=f*k;o=f*h;this.n11=n-o*d;this.n12=-i*h;this.n13=r+m*d;this.n21=m+r*d;this.n22=i*k;this.n23=o-n*d;this.n31=-i*f;this.n32=d;this.n33=i*j;break;case "ZYX":n=i*k;m=i*h;r=d*k;o=d*h;this.n11=j*k;this.n12=r*f-m;this.n13=n*f+o;this.n21=j*h;this.n22=o*f+n;this.n23=
-m*f-r;this.n31=-f;this.n32=d*j;this.n33=i*j;break;case "YZX":n=i*j;m=i*f;r=d*j;o=d*f;this.n11=j*k;this.n12=o-n*h;this.n13=r*h+m;this.n21=h;this.n22=i*k;this.n23=-d*k;this.n31=-f*k;this.n32=m*h+r;this.n33=n-o*h;break;case "XZY":n=i*j;m=i*f;r=d*j;o=d*f;this.n11=j*k;this.n12=-h;this.n13=f*k;this.n21=n*h+o;this.n22=i*k;this.n23=m*h-r;this.n31=r*h-m;this.n32=d*k;this.n33=o*h+n;break;default:n=i*k,m=i*h,r=d*k,o=d*h,this.n11=j*k,this.n12=-j*h,this.n13=f,this.n21=m+r*f,this.n22=n-o*f,this.n23=-d*j,this.n31=
-o-n*f,this.n32=r+m*f,this.n33=i*j}return this},setRotationFromQuaternion:function(b){var c=b.x,d=b.y,f=b.z,h=b.w,i=c+c,j=d+d,k=f+f,b=c*i,n=c*j;c*=k;var m=d*j;d*=k;f*=k;i*=h;j*=h;h*=k;this.n11=1-(m+f);this.n12=n-h;this.n13=c+j;this.n21=n+h;this.n22=1-(b+f);this.n23=d-i;this.n31=c-j;this.n32=d+i;this.n33=1-(b+m);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,h=THREE.Matrix4.__m2;f.identity();f.setRotationFromQuaternion(c);h.setScale(d.x,d.y,d.z);this.multiply(f,h);this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},decompose:function(b,c,d){var f=THREE.Matrix4.__v1,h=THREE.Matrix4.__v2,i=THREE.Matrix4.__v3;f.set(this.n11,this.n21,this.n31);h.set(this.n12,this.n22,this.n32);i.set(this.n13,this.n23,this.n33);b=b instanceof THREE.Vector3?b:new THREE.Vector3;c=c instanceof THREE.Quaternion?c:
-new THREE.Quaternion;d=d instanceof THREE.Vector3?d:new THREE.Vector3;d.x=f.length();d.y=h.length();d.z=i.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,h=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*h;this.n23=b.n23*h;this.n33=b.n33*h}};
-THREE.Matrix4.makeInvert=function(b,c){var d=b.n11,f=b.n12,h=b.n13,i=b.n14,j=b.n21,k=b.n22,n=b.n23,m=b.n24,r=b.n31,o=b.n32,v=b.n33,w=b.n34,A=b.n41,F=b.n42,L=b.n43,H=b.n44;c===void 0&&(c=new THREE.Matrix4);c.n11=n*w*F-m*v*F+m*o*L-k*w*L-n*o*H+k*v*H;c.n12=i*v*F-h*w*F-i*o*L+f*w*L+h*o*H-f*v*H;c.n13=h*m*F-i*n*F+i*k*L-f*m*L-h*k*H+f*n*H;c.n14=i*n*o-h*m*o-i*k*v+f*m*v+h*k*w-f*n*w;c.n21=m*v*A-n*w*A-m*r*L+j*w*L+n*r*H-j*v*H;c.n22=h*w*A-i*v*A+i*r*L-d*w*L-h*r*H+d*v*H;c.n23=i*n*A-h*m*A-i*j*L+d*m*L+h*j*H-d*n*H;c.n24=
-h*m*r-i*n*r+i*j*v-d*m*v-h*j*w+d*n*w;c.n31=k*w*A-m*o*A+m*r*F-j*w*F-k*r*H+j*o*H;c.n32=i*o*A-f*w*A-i*r*F+d*w*F+f*r*H-d*o*H;c.n33=h*m*A-i*k*A+i*j*F-d*m*F-f*j*H+d*k*H;c.n34=i*k*r-f*m*r-i*j*o+d*m*o+f*j*w-d*k*w;c.n41=n*o*A-k*v*A-n*r*F+j*v*F+k*r*L-j*o*L;c.n42=f*v*A-h*o*A+h*r*F-d*v*F-f*r*L+d*o*L;c.n43=h*k*A-f*n*A-h*j*F+d*n*F+f*j*L-d*k*L;c.n44=f*n*r-h*k*r+h*j*o-d*n*o-f*j*v+d*k*v;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,h=-b.n33*b.n21+b.n31*b.n23,i=b.n32*b.n21-b.n31*b.n22,j=-b.n33*b.n12+b.n32*b.n13,k=b.n33*b.n11-b.n31*b.n13,n=-b.n32*b.n11+b.n31*b.n12,m=b.n23*b.n12-b.n22*b.n13,r=-b.n23*b.n11+b.n21*b.n13,o=b.n22*b.n11-b.n21*b.n12,b=b.n11*f+b.n21*j+b.n31*m;b==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");b=1/b;d[0]=b*f;d[1]=b*h;d[2]=b*i;d[3]=b*j;d[4]=b*k;d[5]=b*n;d[6]=b*m;d[7]=b*r;d[8]=b*o;return c};
-THREE.Matrix4.makeFrustum=function(b,c,d,f,h,i){var j;j=new THREE.Matrix4;j.n11=2*h/(c-b);j.n12=0;j.n13=(c+b)/(c-b);j.n14=0;j.n21=0;j.n22=2*h/(f-d);j.n23=(f+d)/(f-d);j.n24=0;j.n31=0;j.n32=0;j.n33=-(i+h)/(i-h);j.n34=-2*i*h/(i-h);j.n41=0;j.n42=0;j.n43=-1;j.n44=0;return j};THREE.Matrix4.makePerspective=function(b,c,d,f){var h,b=d*Math.tan(b*Math.PI/360);h=-b;return THREE.Matrix4.makeFrustum(h*c,b*c,h,b,d,f)};
-THREE.Matrix4.makeOrtho=function(b,c,d,f,h,i){var j,k,n,m;j=new THREE.Matrix4;k=c-b;n=d-f;m=i-h;j.n11=2/k;j.n12=0;j.n13=0;j.n14=-((c+b)/k);j.n21=0;j.n22=2/n;j.n23=0;j.n24=-((d+f)/n);j.n31=0;j.n32=0;j.n33=-2/m;j.n34=-((i+h)/m);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;
+var THREE=THREE||{};if(!self.Int32Array)self.Int32Array=Array,self.Float32Array=Array;THREE.Color=function(a){a!==void 0&&this.setHex(a);return this};
+THREE.Color.prototype={constructor:THREE.Color,r:1,g:1,b:1,copy:function(a){this.r=a.r;this.g=a.g;this.b=a.b;return this},copyGammaToLinear:function(a){this.r=a.r*a.r;this.g=a.g*a.g;this.b=a.b*a.b;return this},copyLinearToGamma:function(a){this.r=Math.sqrt(a.r);this.g=Math.sqrt(a.g);this.b=Math.sqrt(a.b);return this},setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;return this},setHSV:function(a,b,c){var e,f,h;if(c==0)this.r=this.g=this.b=0;else switch(e=Math.floor(a*6),f=a*6-e,a=c*(1-b),h=c*(1-
+b*f),b=c*(1-b*(1-f)),e){case 1:this.r=h;this.g=c;this.b=a;break;case 2:this.r=a;this.g=c;this.b=b;break;case 3:this.r=a;this.g=h;this.b=c;break;case 4:this.r=b;this.g=a;this.b=c;break;case 5:this.r=c;this.g=a;this.b=h;break;case 6:case 0:this.r=c,this.g=b,this.b=a}return this},setHex:function(a){a=Math.floor(a);this.r=(a>>16&255)/255;this.g=(a>>8&255)/255;this.b=(a&255)/255;return this},getHex:function(){return~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},getContextStyle:function(){return"rgb("+
+Math.floor(this.r*255)+","+Math.floor(this.g*255)+","+Math.floor(this.b*255)+")"},clone:function(){return(new THREE.Color).setRGB(this.r,this.g,this.b)}};THREE.Vector2=function(a,b){this.x=a||0;this.y=b||0};
+THREE.Vector2.prototype={constructor:THREE.Vector2,set:function(a,b){this.x=a;this.y=b;return this},copy:function(a){this.x=a.x;this.y=a.y;return this},clone:function(){return new THREE.Vector2(this.x,this.y)},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;return this},
+divideScalar:function(a){a?(this.x/=a,this.y/=a):this.set(0,0);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.lengthSq())},normalize:function(){return this.divideScalar(this.length())},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var b=this.x-a.x,a=this.y-a.y;return b*b+a*a},setLength:function(a){return this.normalize().multiplyScalar(a)},
+equals:function(a){return a.x==this.x&&a.y==this.y}};THREE.Vector3=function(a,b,c){this.x=a||0;this.y=b||0;this.z=c||0};
+THREE.Vector3.prototype={constructor:THREE.Vector3,set:function(a,b,c){this.x=a;this.y=b;this.z=c;return this},setX:function(a){this.x=a;return this},setY:function(a){this.y=a;return this},setZ:function(a){this.z=a;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;return this},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;return this},
+addScalar:function(a){this.x+=a;this.y+=a;this.z+=a;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;return this},multiply:function(a,b){this.x=a.x*b.x;this.y=a.y*b.y;this.z=a.z*b.z;return this},multiplySelf:function(a){this.x*=a.x;this.y*=a.y;this.z*=a.z;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;return this},divideSelf:function(a){this.x/=a.x;this.y/=a.y;this.z/=a.z;return this},
+divideScalar:function(a){a?(this.x/=a,this.y/=a,this.z/=a):this.set(0,0,0);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.lengthSq())},lengthManhattan:function(){return this.x+this.y+this.z},normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)},
+cross:function(a,b){this.x=a.y*b.z-a.z*b.y;this.y=a.z*b.x-a.x*b.z;this.z=a.x*b.y-a.y*b.x;return this},crossSelf:function(a){return this.set(this.y*a.z-this.z*a.y,this.z*a.x-this.x*a.z,this.x*a.y-this.y*a.x)},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){return(new THREE.Vector3).sub(this,a).lengthSq()},setPositionFromMatrix:function(a){this.x=a.n14;this.y=a.n24;this.z=a.n34},setRotationFromMatrix:function(a){var b=Math.cos(this.y);this.y=Math.asin(a.n13);
+Math.abs(b)>1.0E-5?(this.x=Math.atan2(-a.n23/b,a.n33/b),this.z=Math.atan2(-a.n12/b,a.n11/b)):(this.x=0,this.z=Math.atan2(a.n21,a.n22))},isZero:function(){return this.lengthSq()<1.0E-4}};THREE.Vector4=function(a,b,c,e){this.x=a||0;this.y=b||0;this.z=c||0;this.w=e!==void 0?e:1};
+THREE.Vector4.prototype={constructor:THREE.Vector4,set:function(a,b,c,e){this.x=a;this.y=b;this.z=c;this.w=e;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w!==void 0?a.w:1},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;this.w=a.w+b.w;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-
+b.z;this.w=a.w-b.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this},divideScalar:function(a){a?(this.x/=a,this.y/=a,this.z/=a,this.w/=a):(this.z=this.y=this.x=0,this.w=1);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z+this.w*a.w},lengthSq:function(){return this.dot(this)},length:function(){return Math.sqrt(this.lengthSq())},
+normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)},lerpSelf:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;this.w+=(a.w-this.w)*b;return this}};THREE.Ray=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3};
+THREE.Ray.prototype={constructor:THREE.Ray,intersectScene:function(a){return this.intersectObjects(a.objects)},intersectObjects:function(a){var b,c,e=[];b=0;for(c=a.length;b<c;b++)Array.prototype.push.apply(e,this.intersectObject(a[b]));e.sort(function(a,b){return a.distance-b.distance});return e},intersectObject:function(a){function b(a,b,c){var e;e=c.clone().subSelf(a).dot(b);if(e<=0)return null;a=a.clone().addSelf(b.clone().multiplyScalar(e));return c.distanceTo(a)}function c(a,b,c,e){var e=e.clone().subSelf(b),
+c=c.clone().subSelf(b),f=a.clone().subSelf(b),a=e.dot(e),b=e.dot(c),e=e.dot(f),h=c.dot(c),c=c.dot(f),f=1/(a*h-b*b),h=(h*e-b*c)*f,a=(a*c-b*e)*f;return h>0&&a>0&&h+a<1}for(var e,f=[],h=0,i=a.children.length;h<i;h++)Array.prototype.push.apply(f,this.intersectObject(a.children[h]));if(a instanceof THREE.Particle){h=b(this.origin,this.direction,a.matrixWorld.getPosition());if(h==null||h>a.scale.x)return[];e={distance:h,point:a.position,face:null,object:a};f.push(e)}else if(a instanceof THREE.Mesh){h=b(this.origin,
+this.direction,a.matrixWorld.getPosition());if(h==null||h>a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)))return f;for(var j,n,k,l,p,m,s,B,A=a.geometry,H=A.vertices,h=0,i=A.faces.length;h<i;h++)if(e=A.faces[h],s=this.origin.clone(),B=this.direction.clone(),l=a.matrixWorld,j=l.multiplyVector3(e.centroid.clone()).subSelf(s),m=j.dot(B),!(m<=0)&&(j=l.multiplyVector3(H[e.a].position.clone()),n=l.multiplyVector3(H[e.b].position.clone()),k=l.multiplyVector3(H[e.c].position.clone()),
+l=e instanceof THREE.Face4?l.multiplyVector3(H[e.d].position.clone()):null,p=a.matrixRotationWorld.multiplyVector3(e.normal.clone()),m=B.dot(p),a.doubleSided||(a.flipSided?m>0:m<0)))if(m=p.dot((new THREE.Vector3).sub(j,s))/m,s=s.addSelf(B.multiplyScalar(m)),e instanceof THREE.Face3)c(s,j,n,k)&&(e={distance:this.origin.distanceTo(s),point:s,face:e,object:a},f.push(e));else if(e instanceof THREE.Face4&&(c(s,j,n,l)||c(s,n,k,l)))e={distance:this.origin.distanceTo(s),point:s,face:e,object:a},f.push(e)}return f}};
+THREE.Rectangle=function(){function a(){h=e-b;i=f-c}var b,c,e,f,h,i,j=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return h};this.getHeight=function(){return i};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return e};this.getBottom=function(){return f};this.set=function(h,i,l,p){j=!1;b=h;c=i;e=l;f=p;a()};this.addPoint=function(h,i){j?(j=!1,b=h,c=i,e=h,f=i):(b=b<h?b:h,c=c<i?c:i,e=e>h?e:h,f=f>i?f:i);a()};this.add3Points=
+function(h,i,l,p,m,s){j?(j=!1,b=h<l?h<m?h:m:l<m?l:m,c=i<p?i<s?i:s:p<s?p:s,e=h>l?h>m?h:m:l>m?l:m,f=i>p?i>s?i:s:p>s?p:s):(b=h<l?h<m?h<b?h:b:m<b?m:b:l<m?l<b?l:b:m<b?m:b,c=i<p?i<s?i<c?i:c:s<c?s:c:p<s?p<c?p:c:s<c?s:c,e=h>l?h>m?h>e?h:e:m>e?m:e:l>m?l>e?l:e:m>e?m:e,f=i>p?i>s?i>f?i:f:s>f?s:f:p>s?p>f?p:f:s>f?s:f);a()};this.addRectangle=function(h){j?(j=!1,b=h.getLeft(),c=h.getTop(),e=h.getRight(),f=h.getBottom()):(b=b<h.getLeft()?b:h.getLeft(),c=c<h.getTop()?c:h.getTop(),e=e>h.getRight()?e:h.getRight(),f=f>
+h.getBottom()?f:h.getBottom());a()};this.inflate=function(h){b-=h;c-=h;e+=h;f+=h;a()};this.minSelf=function(h){b=b>h.getLeft()?b:h.getLeft();c=c>h.getTop()?c:h.getTop();e=e<h.getRight()?e:h.getRight();f=f<h.getBottom()?f:h.getBottom();a()};this.intersects=function(a){return Math.min(e,a.getRight())-Math.max(b,a.getLeft())>=0&&Math.min(f,a.getBottom())-Math.max(c,a.getTop())>=0};this.empty=function(){j=!0;f=e=c=b=0;a()};this.isEmpty=function(){return j}};THREE.Matrix3=function(){this.m=[]};
+THREE.Matrix3.prototype={constructor:THREE.Matrix3,transpose:function(){var a,b=this.m;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}};
+THREE.Matrix4=function(a,b,c,e,f,h,i,j,n,k,l,p,m,s,B,A){this.set(a!==void 0?a:1,b||0,c||0,e||0,f||0,h!==void 0?h:1,i||0,j||0,n||0,k||0,l!==void 0?l:1,p||0,m||0,s||0,B||0,A!==void 0?A:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
+THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,e,f,h,i,j,n,k,l,p,m,s,B,A){this.n11=a;this.n12=b;this.n13=c;this.n14=e;this.n21=f;this.n22=h;this.n23=i;this.n24=j;this.n31=n;this.n32=k;this.n33=l;this.n34=p;this.n41=m;this.n42=s;this.n43=B;this.n44=A;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,
+b,c){var e=THREE.Matrix4.__v1,f=THREE.Matrix4.__v2,h=THREE.Matrix4.__v3;h.sub(a,b).normalize();if(h.length()===0)h.z=1;e.cross(c,h).normalize();e.length()===0&&(h.x+=1.0E-4,e.cross(c,h).normalize());f.cross(h,e).normalize();this.n11=e.x;this.n12=f.x;this.n13=h.x;this.n21=e.y;this.n22=f.y;this.n23=h.y;this.n31=e.z;this.n32=f.z;this.n33=h.z;return this},multiplyVector3:function(a){var b=a.x,c=a.y,e=a.z,f=1/(this.n41*b+this.n42*c+this.n43*e+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*e+this.n14)*f;
+a.y=(this.n21*b+this.n22*c+this.n23*e+this.n24)*f;a.z=(this.n31*b+this.n32*c+this.n33*e+this.n34)*f;return a},multiplyVector4:function(a){var b=a.x,c=a.y,e=a.z,f=a.w;a.x=this.n11*b+this.n12*c+this.n13*e+this.n14*f;a.y=this.n21*b+this.n22*c+this.n23*e+this.n24*f;a.z=this.n31*b+this.n32*c+this.n33*e+this.n34*f;a.w=this.n41*b+this.n42*c+this.n43*e+this.n44*f;return a},rotateAxis:function(a){var b=a.x,c=a.y,e=a.z;a.x=b*this.n11+c*this.n12+e*this.n13;a.y=b*this.n21+c*this.n22+e*this.n23;a.z=b*this.n31+
+c*this.n32+e*this.n33;a.normalize();return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},multiply:function(a,b){var c=a.n11,e=a.n12,f=a.n13,h=a.n14,i=a.n21,j=a.n22,n=a.n23,k=a.n24,l=a.n31,p=a.n32,m=a.n33,s=a.n34,B=a.n41,A=a.n42,H=a.n43,C=a.n44,Q=b.n11,wa=b.n12,
+ja=b.n13,qa=b.n14,ha=b.n21,L=b.n22,z=b.n23,R=b.n24,M=b.n31,T=b.n32,ka=b.n33,Z=b.n34,Aa=b.n41,$=b.n42,F=b.n43,d=b.n44;this.n11=c*Q+e*ha+f*M+h*Aa;this.n12=c*wa+e*L+f*T+h*$;this.n13=c*ja+e*z+f*ka+h*F;this.n14=c*qa+e*R+f*Z+h*d;this.n21=i*Q+j*ha+n*M+k*Aa;this.n22=i*wa+j*L+n*T+k*$;this.n23=i*ja+j*z+n*ka+k*F;this.n24=i*qa+j*R+n*Z+k*d;this.n31=l*Q+p*ha+m*M+s*Aa;this.n32=l*wa+p*L+m*T+s*$;this.n33=l*ja+p*z+m*ka+s*F;this.n34=l*qa+p*R+m*Z+s*d;this.n41=B*Q+A*ha+H*M+C*Aa;this.n42=B*wa+A*L+H*T+C*$;this.n43=B*ja+
+A*z+H*ka+C*F;this.n44=B*qa+A*R+H*Z+C*d;return this},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;c[3]=this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplySelf:function(a){this.multiply(this,a);return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=
+a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},determinant:function(){var a=this.n11,b=this.n12,c=this.n13,e=this.n14,f=this.n21,h=this.n22,i=this.n23,j=this.n24,n=this.n31,k=this.n32,l=this.n33,p=this.n34,m=this.n41,s=this.n42,B=this.n43,A=this.n44;return e*i*k*m-c*j*k*m-e*h*l*m+b*j*l*m+c*h*p*m-b*i*p*m-e*i*n*s+c*j*n*s+e*f*l*s-a*j*l*s-c*f*p*s+a*i*p*s+e*h*n*B-b*j*n*B-e*f*k*B+a*j*k*B+b*f*p*B-a*h*p*B-c*h*n*A+b*i*
+n*A+c*f*k*A-a*i*k*A-b*f*l*A+a*h*l*A},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;
+a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(a){a[0]=
+this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,b){a[b]=this.n11;a[b+1]=this.n21;a[b+2]=this.n31;a[b+3]=this.n41;a[b+4]=this.n12;a[b+5]=this.n22;a[b+6]=this.n32;a[b+7]=this.n42;a[b+8]=this.n13;a[b+9]=this.n23;a[b+10]=this.n33;a[b+11]=this.n43;a[b+12]=this.n14;a[b+13]=this.n24;a[b+14]=
+this.n34;a[b+15]=this.n44;return a},setTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},setScale:function(a,b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},setRotationX:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},setRotationY:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},setRotationZ:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,-a,0,
+0,a,b,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(a,b){var c=Math.cos(b),e=Math.sin(b),f=1-c,h=a.x,i=a.y,j=a.z,n=f*h,k=f*i;this.set(n*h+c,n*i-e*j,n*j+e*i,0,n*i+e*j,k*i+c,k*j-e*h,0,n*j-e*i,k*j+e*h,f*j*j+c,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},getPosition:function(){if(!this.position)this.position=new THREE.Vector3;this.position.set(this.n14,this.n24,this.n34);return this.position},getColumnX:function(){if(!this.columnX)this.columnX=
+new THREE.Vector3;this.columnX.set(this.n11,this.n21,this.n31);return this.columnX},getColumnY:function(){if(!this.columnY)this.columnY=new THREE.Vector3;this.columnY.set(this.n12,this.n22,this.n32);return this.columnY},getColumnZ:function(){if(!this.columnZ)this.columnZ=new THREE.Vector3;this.columnZ.set(this.n13,this.n23,this.n33);return this.columnZ},setRotationFromEuler:function(a,b){var c=a.x,e=a.y,f=a.z,h=Math.cos(c),c=Math.sin(c),i=Math.cos(e),e=Math.sin(e),j=Math.cos(f),f=Math.sin(f);switch(b){case "YXZ":var n=
+i*j,k=i*f,l=e*j,p=e*f;this.n11=n+p*c;this.n12=l*c-k;this.n13=h*e;this.n21=h*f;this.n22=h*j;this.n23=-c;this.n31=k*c-l;this.n32=p+n*c;this.n33=h*i;break;case "ZXY":n=i*j;k=i*f;l=e*j;p=e*f;this.n11=n-p*c;this.n12=-h*f;this.n13=l+k*c;this.n21=k+l*c;this.n22=h*j;this.n23=p-n*c;this.n31=-h*e;this.n32=c;this.n33=h*i;break;case "ZYX":n=h*j;k=h*f;l=c*j;p=c*f;this.n11=i*j;this.n12=l*e-k;this.n13=n*e+p;this.n21=i*f;this.n22=p*e+n;this.n23=k*e-l;this.n31=-e;this.n32=c*i;this.n33=h*i;break;case "YZX":n=h*i;k=
+h*e;l=c*i;p=c*e;this.n11=i*j;this.n12=p-n*f;this.n13=l*f+k;this.n21=f;this.n22=h*j;this.n23=-c*j;this.n31=-e*j;this.n32=k*f+l;this.n33=n-p*f;break;case "XZY":n=h*i;k=h*e;l=c*i;p=c*e;this.n11=i*j;this.n12=-f;this.n13=e*j;this.n21=n*f+p;this.n22=h*j;this.n23=k*f-l;this.n31=l*f-k;this.n32=c*j;this.n33=p*f+n;break;default:n=h*j,k=h*f,l=c*j,p=c*f,this.n11=i*j,this.n12=-i*f,this.n13=e,this.n21=k+l*e,this.n22=n-p*e,this.n23=-c*i,this.n31=p-n*e,this.n32=l+k*e,this.n33=h*i}return this},setRotationFromQuaternion:function(a){var b=
+a.x,c=a.y,e=a.z,f=a.w,h=b+b,i=c+c,j=e+e,a=b*h,n=b*i;b*=j;var k=c*i;c*=j;e*=j;h*=f;i*=f;f*=j;this.n11=1-(k+e);this.n12=n-f;this.n13=b+i;this.n21=n+f;this.n22=1-(a+e);this.n23=c-h;this.n31=b-i;this.n32=c+h;this.n33=1-(a+k);return this},scale:function(a){var b=a.x,c=a.y,a=a.z;this.n11*=b;this.n12*=c;this.n13*=a;this.n21*=b;this.n22*=c;this.n23*=a;this.n31*=b;this.n32*=c;this.n33*=a;this.n41*=b;this.n42*=c;this.n43*=a;return this},compose:function(a,b,c){var e=THREE.Matrix4.__m1,f=THREE.Matrix4.__m2;
+e.identity();e.setRotationFromQuaternion(b);f.setScale(c.x,c.y,c.z);this.multiply(e,f);this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},decompose:function(a,b,c){var e=THREE.Matrix4.__v1,f=THREE.Matrix4.__v2,h=THREE.Matrix4.__v3;e.set(this.n11,this.n21,this.n31);f.set(this.n12,this.n22,this.n32);h.set(this.n13,this.n23,this.n33);a=a instanceof THREE.Vector3?a:new THREE.Vector3;b=b instanceof THREE.Quaternion?b:new THREE.Quaternion;c=c instanceof THREE.Vector3?c:new THREE.Vector3;c.x=e.length();
+c.y=f.length();c.z=h.length();a.x=this.n14;a.y=this.n24;a.z=this.n34;e=THREE.Matrix4.__m1;e.copy(this);e.n11/=c.x;e.n21/=c.x;e.n31/=c.x;e.n12/=c.y;e.n22/=c.y;e.n32/=c.y;e.n13/=c.z;e.n23/=c.z;e.n33/=c.z;b.setFromRotationMatrix(e);return[a,b,c]},extractPosition:function(a){this.n14=a.n14;this.n24=a.n24;this.n34=a.n34},extractRotation:function(a,b){var c=1/b.x,e=1/b.y,f=1/b.z;this.n11=a.n11*c;this.n21=a.n21*c;this.n31=a.n31*c;this.n12=a.n12*e;this.n22=a.n22*e;this.n32=a.n32*e;this.n13=a.n13*f;this.n23=
+a.n23*f;this.n33=a.n33*f}};
+THREE.Matrix4.makeInvert=function(a,b){var c=a.n11,e=a.n12,f=a.n13,h=a.n14,i=a.n21,j=a.n22,n=a.n23,k=a.n24,l=a.n31,p=a.n32,m=a.n33,s=a.n34,B=a.n41,A=a.n42,H=a.n43,C=a.n44;b===void 0&&(b=new THREE.Matrix4);b.n11=n*s*A-k*m*A+k*p*H-j*s*H-n*p*C+j*m*C;b.n12=h*m*A-f*s*A-h*p*H+e*s*H+f*p*C-e*m*C;b.n13=f*k*A-h*n*A+h*j*H-e*k*H-f*j*C+e*n*C;b.n14=h*n*p-f*k*p-h*j*m+e*k*m+f*j*s-e*n*s;b.n21=k*m*B-n*s*B-k*l*H+i*s*H+n*l*C-i*m*C;b.n22=f*s*B-h*m*B+h*l*H-c*s*H-f*l*C+c*m*C;b.n23=h*n*B-f*k*B-h*i*H+c*k*H+f*i*C-c*n*C;b.n24=
+f*k*l-h*n*l+h*i*m-c*k*m-f*i*s+c*n*s;b.n31=j*s*B-k*p*B+k*l*A-i*s*A-j*l*C+i*p*C;b.n32=h*p*B-e*s*B-h*l*A+c*s*A+e*l*C-c*p*C;b.n33=f*k*B-h*j*B+h*i*A-c*k*A-e*i*C+c*j*C;b.n34=h*j*l-e*k*l-h*i*p+c*k*p+e*i*s-c*j*s;b.n41=n*p*B-j*m*B-n*l*A+i*m*A+j*l*H-i*p*H;b.n42=e*m*B-f*p*B+f*l*A-c*m*A-e*l*H+c*p*H;b.n43=f*j*B-e*n*B-f*i*A+c*n*A+e*i*H-c*j*H;b.n44=e*n*l-f*j*l+f*i*p-c*n*p-e*i*m+c*j*m;b.multiplyScalar(1/a.determinant());return b};
+THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,e=a.n33*a.n22-a.n32*a.n23,f=-a.n33*a.n21+a.n31*a.n23,h=a.n32*a.n21-a.n31*a.n22,i=-a.n33*a.n12+a.n32*a.n13,j=a.n33*a.n11-a.n31*a.n13,n=-a.n32*a.n11+a.n31*a.n12,k=a.n23*a.n12-a.n22*a.n13,l=-a.n23*a.n11+a.n21*a.n13,p=a.n22*a.n11-a.n21*a.n12,a=a.n11*e+a.n21*i+a.n31*k;a==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");a=1/a;c[0]=a*e;c[1]=a*f;c[2]=a*h;c[3]=a*i;c[4]=a*j;c[5]=a*n;c[6]=a*k;c[7]=a*l;c[8]=a*p;return b};
+THREE.Matrix4.makeFrustum=function(a,b,c,e,f,h){var i;i=new THREE.Matrix4;i.n11=2*f/(b-a);i.n12=0;i.n13=(b+a)/(b-a);i.n14=0;i.n21=0;i.n22=2*f/(e-c);i.n23=(e+c)/(e-c);i.n24=0;i.n31=0;i.n32=0;i.n33=-(h+f)/(h-f);i.n34=-2*h*f/(h-f);i.n41=0;i.n42=0;i.n43=-1;i.n44=0;return i};THREE.Matrix4.makePerspective=function(a,b,c,e){var f,a=c*Math.tan(a*Math.PI/360);f=-a;return THREE.Matrix4.makeFrustum(f*b,a*b,f,a,c,e)};
+THREE.Matrix4.makeOrtho=function(a,b,c,e,f,h){var i,j,n,k;i=new THREE.Matrix4;j=b-a;n=c-e;k=h-f;i.n11=2/j;i.n12=0;i.n13=0;i.n14=-((b+a)/j);i.n21=0;i.n22=2/n;i.n23=0;i.n24=-((c+e)/n);i.n31=0;i.n32=0;i.n33=-2/k;i.n34=-((h+f)/k);i.n41=0;i.n42=0;i.n43=0;i.n44=1;return i};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
 THREE.Object3D=function(){this.name="";this.id=THREE.Object3DCount++;this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder="XYZ";this.scale=new THREE.Vector3(1,1,1);this.flipSided=this.doubleSided=this.dynamic=!1;this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=
 !0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=!0;this.receiveShadow=this.castShadow=!1;this.frustumCulled=!0;this._vector=new THREE.Vector3};
-THREE.Object3D.prototype={constructor:THREE.Object3D,translate:function(b,c){this.matrix.rotateAxis(c);this.position.addSelf(c.multiplyScalar(b))},translateX:function(b){this.translate(b,this._vector.set(1,0,0))},translateY:function(b){this.translate(b,this._vector.set(0,1,0))},translateZ:function(b){this.translate(b,this._vector.set(0,0,1))},lookAt:function(b){this.matrix.lookAt(b,this.position,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},add:function(b){if(this.children.indexOf(b)===
--1){b.parent!==void 0&&b.parent.remove(b);b.parent=this;this.children.push(b);for(var c=this;c.parent!==void 0;)c=c.parent;c!==void 0&&c instanceof THREE.Scene&&c.addChildRecurse(b)}},remove:function(b){var c=this,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,h;d=0;for(f=this.children.length;d<f;d++){h=this.children[d];if(h.name===
-b)return h;if(c&&(h=h.getChildByName(b,c),h!==void 0))return h}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z));this.matrixWorldNeedsUpdate=!0},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=n[k]=n[k]||new THREE.RenderableVertex;k++;return b}function c(b,c){return c.z-b.z}function d(b,c){var d=0,f=1,e=b.z+b.w,i=c.z+c.w,h=-b.z+b.w,j=-c.z+c.w;return e>=0&&i>=0&&h>=0&&j>=0?!0:e<0&&i<0||h<0&&j<0?!1:(e<0?d=Math.max(d,e/(e-i)):i<0&&(f=Math.min(f,e/(e-i))),h<0?d=Math.max(d,h/(h-j)):j<0&&(f=Math.min(f,h/(h-j))),f<d?!1:(b.lerpSelf(c,d),c.lerpSelf(b,1-f),!0))}var f,h,i=[],j,k,n=[],m,r,o=[],v,w=[],A,F,L=[],H,xa,ya=[],ja=[],sa=[],ha=new THREE.Vector4,
-O=new THREE.Vector4,D=new THREE.Matrix4,ka=new THREE.Matrix4,M=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],S=new THREE.Vector4,la=new THREE.Vector4;this.projectVector=function(b,c){D.multiply(c.projectionMatrix,c.matrixWorldInverse);D.multiplyVector3(b);return b};this.unprojectVector=function(b,c){D.multiply(c.matrixWorld,THREE.Matrix4.makeInvert(c.projectionMatrix));D.multiplyVector3(b);return b};this.pickingRay=function(b,c){var d;
-b.z=-1;d=new THREE.Vector3(b.x,b.y,1);this.unprojectVector(b,c);this.unprojectVector(d,c);d.subSelf(b).normalize();return new THREE.Ray(b,d)};this.projectObjects=function(b,d,j){var k,e;h=ja.length=0;k=b.objects;b=0;for(d=k.length;b<d;b++){e=k[b];var m;if(!(m=!e.visible))if(m=e instanceof THREE.Mesh)if(m=e.frustumCulled){a:{m=void 0;for(var n=e.matrixWorld,w=-e.geometry.boundingSphere.radius*Math.max(e.scale.x,Math.max(e.scale.y,e.scale.z)),r=0;r<6;r++)if(m=M[r].x*n.n14+M[r].y*n.n24+M[r].z*n.n34+
-M[r].w,m<=w){m=!1;break a}m=!0}m=!m}if(!m)m=i[h]=i[h]||new THREE.RenderableObject,h++,f=m,ha.copy(e.position),D.multiplyVector3(ha),f.object=e,f.z=ha.z,ja.push(f)}j&&ja.sort(c);return ja};this.projectScene=function(f,i,h){var J=i.near,e=i.far,ja,ha,U,W,G,T,X,qa,Y,N,za,Ha,Sa,Ta,va,Da,Aa;xa=F=v=r=sa.length=0;i.matrixAutoUpdate&&i.update(void 0,!0);f.update(void 0,!1,i);D.multiply(i.projectionMatrix,i.matrixWorldInverse);M[0].set(D.n41-D.n11,D.n42-D.n12,D.n43-D.n13,D.n44-D.n14);M[1].set(D.n41+D.n11,
-D.n42+D.n12,D.n43+D.n13,D.n44+D.n14);M[2].set(D.n41+D.n21,D.n42+D.n22,D.n43+D.n23,D.n44+D.n24);M[3].set(D.n41-D.n21,D.n42-D.n22,D.n43-D.n23,D.n44-D.n24);M[4].set(D.n41-D.n31,D.n42-D.n32,D.n43-D.n33,D.n44-D.n34);M[5].set(D.n41+D.n31,D.n42+D.n32,D.n43+D.n33,D.n44+D.n34);for(ja=0;ja<6;ja++)Y=M[ja],Y.divideScalar(Math.sqrt(Y.x*Y.x+Y.y*Y.y+Y.z*Y.z));Y=this.projectObjects(f,i,!0);f=0;for(ja=Y.length;f<ja;f++)if(N=Y[f].object,N.visible)if(za=N.matrixWorld,Ha=N.matrixRotationWorld,Sa=N.materials,Ta=N.overdraw,
-k=0,N instanceof THREE.Mesh){va=N.geometry;W=va.vertices;Da=va.faces;va=va.faceVertexUvs;ha=0;for(U=W.length;ha<U;ha++)j=b(),j.positionWorld.copy(W[ha].position),za.multiplyVector3(j.positionWorld),j.positionScreen.copy(j.positionWorld),D.multiplyVector4(j.positionScreen),j.positionScreen.x/=j.positionScreen.w,j.positionScreen.y/=j.positionScreen.w,j.visible=j.positionScreen.z>J&&j.positionScreen.z<e;W=0;for(ha=Da.length;W<ha;W++){U=Da[W];if(U instanceof THREE.Face3)if(G=n[U.a],T=n[U.b],X=n[U.c],
-G.visible&&T.visible&&X.visible&&(N.doubleSided||N.flipSided!=(X.positionScreen.x-G.positionScreen.x)*(T.positionScreen.y-G.positionScreen.y)-(X.positionScreen.y-G.positionScreen.y)*(T.positionScreen.x-G.positionScreen.x)<0))qa=o[r]=o[r]||new THREE.RenderableFace3,r++,m=qa,m.v1.copy(G),m.v2.copy(T),m.v3.copy(X);else continue;else if(U instanceof THREE.Face4)if(G=n[U.a],T=n[U.b],X=n[U.c],qa=n[U.d],G.visible&&T.visible&&X.visible&&qa.visible&&(N.doubleSided||N.flipSided!=((qa.positionScreen.x-G.positionScreen.x)*
-(T.positionScreen.y-G.positionScreen.y)-(qa.positionScreen.y-G.positionScreen.y)*(T.positionScreen.x-G.positionScreen.x)<0||(T.positionScreen.x-X.positionScreen.x)*(qa.positionScreen.y-X.positionScreen.y)-(T.positionScreen.y-X.positionScreen.y)*(qa.positionScreen.x-X.positionScreen.x)<0)))Aa=w[v]=w[v]||new THREE.RenderableFace4,v++,m=Aa,m.v1.copy(G),m.v2.copy(T),m.v3.copy(X),m.v4.copy(qa);else continue;m.normalWorld.copy(U.normal);Ha.multiplyVector3(m.normalWorld);m.centroidWorld.copy(U.centroid);
-za.multiplyVector3(m.centroidWorld);m.centroidScreen.copy(m.centroidWorld);D.multiplyVector3(m.centroidScreen);X=U.vertexNormals;G=0;for(T=X.length;G<T;G++)qa=m.vertexNormalsWorld[G],qa.copy(X[G]),Ha.multiplyVector3(qa);G=0;for(T=va.length;G<T;G++)if(Aa=va[G][W]){X=0;for(qa=Aa.length;X<qa;X++)m.uvs[G][X]=Aa[X]}m.meshMaterials=Sa;m.faceMaterials=U.materials;m.overdraw=Ta;m.z=m.centroidScreen.z;sa.push(m)}}else if(N instanceof THREE.Line){ka.multiply(D,za);W=N.geometry.vertices;G=b();G.positionScreen.copy(W[0].position);
-ka.multiplyVector4(G.positionScreen);ha=1;for(U=W.length;ha<U;ha++)if(G=b(),G.positionScreen.copy(W[ha].position),ka.multiplyVector4(G.positionScreen),T=n[k-2],S.copy(G.positionScreen),la.copy(T.positionScreen),d(S,la))S.multiplyScalar(1/S.w),la.multiplyScalar(1/la.w),za=L[F]=L[F]||new THREE.RenderableLine,F++,A=za,A.v1.positionScreen.copy(S),A.v2.positionScreen.copy(la),A.z=Math.max(S.z,la.z),A.materials=N.materials,sa.push(A)}else if(N instanceof THREE.Particle&&(O.set(N.matrixWorld.n14,N.matrixWorld.n24,
-N.matrixWorld.n34,1),D.multiplyVector4(O),O.z/=O.w,O.z>0&&O.z<1))za=ya[xa]=ya[xa]||new THREE.RenderableParticle,xa++,H=za,H.x=O.x/O.w,H.y=O.y/O.w,H.z=O.z,H.rotation=N.rotation.z,H.scale.x=N.scale.x*Math.abs(H.x-(O.x+i.projectionMatrix.n11)/(O.w+i.projectionMatrix.n14)),H.scale.y=N.scale.y*Math.abs(H.y-(O.y+i.projectionMatrix.n22)/(O.w+i.projectionMatrix.n24)),H.materials=N.materials,sa.push(H);h&&sa.sort(c);return sa}};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,h=b.z*c,b=Math.cos(f),f=Math.sin(f),c=Math.cos(-h),h=Math.sin(-h),i=Math.cos(d),d=Math.sin(d),j=b*c,k=f*h;this.w=j*i-k*d;this.x=j*d+k*i;this.y=f*c*i+b*h*d;this.z=b*h*i-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,h=this.w,i=b.x,j=b.y,k=b.z,b=b.w;this.x=c*b+h*i+d*k-f*j;this.y=d*b+h*j+f*i-c*k;this.z=f*b+h*k+c*j-d*i;this.w=h*b-c*i-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,h=b.z,i=this.x,j=this.y,k=this.z,n=this.w,m=n*d+j*h-k*f,r=n*f+k*d-i*h,o=n*h+i*f-j*d,d=-i*
-d-j*f-k*h;c.x=m*n+d*-i+r*-k-o*-j;c.y=r*n+d*-j+o*-i-m*-k;c.z=o*n+d*-k+m*-j-r*-i;return c}};THREE.Quaternion.slerp=function(b,c,d,f){var h=b.w*c.w+b.x*c.x+b.y*c.y+b.z*c.z;if(Math.abs(h)>=1)return d.w=b.w,d.x=b.x,d.y=b.y,d.z=b.z,d;var i=Math.acos(h),j=Math.sqrt(1-h*h);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;h=Math.sin((1-f)*i)/j;f=Math.sin(f*i)/j;d.w=b.w*h+c.w*f;d.x=b.x*h+c.x*f;d.y=b.y*h+c.y*f;d.z=b.z*h+c.z*f;return d};
-THREE.Vertex=function(b){this.position=b||new THREE.Vector3};THREE.Face3=function(b,c,d,f,h,i){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=h instanceof THREE.Color?h:new THREE.Color;this.vertexColors=h instanceof Array?h:[];this.vertexTangents=[];this.materials=i instanceof Array?i:[i];this.centroid=new THREE.Vector3};
-THREE.Face4=function(b,c,d,f,h,i,j){this.a=b;this.b=c;this.c=d;this.d=f;this.normal=h instanceof THREE.Vector3?h:new THREE.Vector3;this.vertexNormals=h instanceof Array?h:[];this.color=i instanceof THREE.Color?i:new THREE.Color;this.vertexColors=i instanceof Array?i:[];this.vertexTangents=[];this.materials=j instanceof Array?j:[j];this.centroid=new THREE.Vector3};THREE.UV=function(b,c){this.u=b||0;this.v=c||0};
-THREE.UV.prototype={constructor:THREE.UV,set:function(b,c){this.u=b;this.v=c;return this},copy:function(b){this.u=b.u;this.v=b.v;return this},clone:function(){return new THREE.UV(this.u,this.v)}};THREE.Geometry=function(){this.id=THREE.GeometryCount++;this.vertices=[];this.colors=[];this.faces=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.dynamic=this.hasTangents=!1};
-THREE.Geometry.prototype={constructor:THREE.Geometry,applyMatrix:function(b){var c=new THREE.Matrix4;c.extractRotation(b,new THREE.Vector3(1,1,1));for(var 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 h=this.faces[d];c.multiplyVector3(h.normal);for(var i=0,j=h.vertexNormals.length;i<j;i++)c.multiplyVector3(h.vertexNormals[i]);b.multiplyVector3(h.centroid)}},computeCentroids:function(){var b,c,d;b=0;for(c=this.faces.length;b<
-c;b++)d=this.faces[b],d.centroid.set(0,0,0),d instanceof THREE.Face3?(d.centroid.addSelf(this.vertices[d.a].position),d.centroid.addSelf(this.vertices[d.b].position),d.centroid.addSelf(this.vertices[d.c].position),d.centroid.divideScalar(3)):d instanceof THREE.Face4&&(d.centroid.addSelf(this.vertices[d.a].position),d.centroid.addSelf(this.vertices[d.b].position),d.centroid.addSelf(this.vertices[d.c].position),d.centroid.addSelf(this.vertices[d.d].position),d.centroid.divideScalar(4))},computeFaceNormals:function(b){var c,
-d,f,h,i,j,k=new THREE.Vector3,n=new THREE.Vector3;f=0;for(h=this.faces.length;f<h;f++){i=this.faces[f];if(b&&i.vertexNormals.length){k.set(0,0,0);c=0;for(d=i.vertexNormals.length;c<d;c++)k.addSelf(i.vertexNormals[c]);k.divideScalar(3)}else c=this.vertices[i.a],d=this.vertices[i.b],j=this.vertices[i.c],k.sub(j.position,d.position),n.sub(c.position,d.position),k.crossSelf(n);k.isZero()||k.normalize();i.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,c,d,f,i,h,D){k=b.vertices[c].position;n=b.vertices[d].position;m=b.vertices[f].position;r=j[i];o=j[h];v=j[D];w=n.x-k.x;A=m.x-k.x;F=n.y-k.y;L=m.y-k.y;H=n.z-k.z;xa=m.z-k.z;ya=o.u-r.u;ja=v.u-r.u;sa=o.v-r.v;ha=v.v-r.v;O=1/(ya*ha-ja*sa);S.set((ha*w-sa*A)*O,(ha*F-sa*L)*O,(ha*H-sa*xa)*O);la.set((ya*A-ja*w)*O,(ya*L-ja*F)*O,(ya*xa-ja*H)*O);ka[c].addSelf(S);ka[d].addSelf(S);
-ka[f].addSelf(S);M[c].addSelf(la);M[d].addSelf(la);M[f].addSelf(la)}var c,d,f,h,i,j,k,n,m,r,o,v,w,A,F,L,H,xa,ya,ja,sa,ha,O,D,ka=[],M=[],S=new THREE.Vector3,la=new THREE.Vector3,ia=new THREE.Vector3,Ca=new THREE.Vector3,aa=new THREE.Vector3;c=0;for(d=this.vertices.length;c<d;c++)ka[c]=new THREE.Vector3,M[c]=new THREE.Vector3;c=0;for(d=this.faces.length;c<d;c++)i=this.faces[c],j=this.faceVertexUvs[0][c],i instanceof THREE.Face3?b(this,i.a,i.b,i.c,0,1,2):i instanceof THREE.Face4&&(b(this,i.a,i.b,i.c,
-0,1,2),b(this,i.a,i.b,i.d,0,1,3));var J=["a","b","c","d"];c=0;for(d=this.faces.length;c<d;c++){i=this.faces[c];for(f=0;f<i.vertexNormals.length;f++)aa.copy(i.vertexNormals[f]),h=i[J[f]],D=ka[h],ia.copy(D),ia.subSelf(aa.multiplyScalar(aa.dot(D))).normalize(),Ca.cross(i.vertexNormals[f],D),h=Ca.dot(M[h]),h=h<0?-1:1,i.vertexTangents[f]=new THREE.Vector4(ia.x,ia.y,ia.z,h)}this.hasTangents=!0},computeBoundingBox:function(){var b;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,
-this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var c=1,d=this.vertices.length;c<d;c++){b=this.vertices[c];if(b.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=b.position.x;else if(b.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=b.position.x;if(b.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=b.position.y;else if(b.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=
-b.position.y;if(b.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=b.position.z;else if(b.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=b.position.z}}},computeBoundingSphere:function(){for(var b=0,c=0,d=this.vertices.length;c<d;c++)b=Math.max(b,this.vertices[c].position.length());this.boundingSphere={radius:b}},mergeVertices:function(){var b={},c=[],d=[],f,h=Math.pow(10,4),i,j;i=0;for(j=this.vertices.length;i<j;i++)f=this.vertices[i].position,f=[Math.round(f.x*h),Math.round(f.y*h),
-Math.round(f.z*h)].join("_"),b[f]===void 0?(b[f]=i,c.push(this.vertices[i]),d[i]=c.length-1):d[i]=d[b[f]];i=0;for(j=this.faces.length;i<j;i++){b=this.faces[i];if(b instanceof THREE.Face3)b.a=d[b.a],b.b=d[b.b],b.c=d[b.c];if(b instanceof THREE.Face4)b.a=d[b.a],b.b=d[b.b],b.c=d[b.c],b.d=d[b.d]}this.vertices=c}};THREE.GeometryCount=0;
-THREE.Spline=function(b){function c(b,c,d,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},h,i,j,k,n,m,r,o,v;this.initFromArray=function(b){this.points=[];for(var c=0;c<b.length;c++)this.points[c]={x:b[c][0],y:b[c][1],z:b[c][2]}};this.getPoint=function(b){h=(this.points.length-1)*b;i=Math.floor(h);j=h-i;d[0]=i==0?i:i-1;d[1]=i;d[2]=i>this.points.length-2?i:i+1;d[3]=i>this.points.length-3?i:i+2;m=this.points[d[0]];r=this.points[d[1]];
-o=this.points[d[2]];v=this.points[d[3]];k=j*j;n=j*k;f.x=c(m.x,r.x,o.x,v.x,j,k,n);f.y=c(m.y,r.y,o.y,v.y,j,k,n);f.z=c(m.z,r.z,o.z,v.z,j,k,n);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=[],m=new THREE.Vector3,n=this.getLength();k.push(m.copy(this.points[0]).clone());for(c=1;c<this.points.length;c++){d=n.chunks[c]-n.chunks[c-1];j=Math.ceil(b*d/n.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(m.copy(position).clone());
-k.push(m.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(){if(arguments.length)return console.warn("DEPRECATED: Camera() is now PerspectiveCamera() or OrthographicCamera()."),new THREE.PerspectiveCamera(arguments[0],arguments[1],arguments[2],arguments[3]);THREE.Object3D.call(this);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4};
-THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.lookAt=function(b){this.matrix.lookAt(this.position,b,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)};
-THREE.Camera.prototype.update=function(b,c,d){this.matrixAutoUpdate&&this.updateMatrix();if(c||this.matrixWorldNeedsUpdate)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,c=!0,THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);for(b=0;b<this.children.length;b++)this.children[b].update(this.matrixWorld,c,d)};
-THREE.OrthographicCamera=function(b,c,d,f,h,i){THREE.Camera.call(this);this.left=b;this.right=c;this.top=d;this.bottom=f;this.near=h!==void 0?h:0.1;this.far=i!==void 0?i:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=new THREE.Camera;THREE.OrthographicCamera.prototype.constructor=THREE.OrthographicCamera;THREE.OrthographicCamera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makeOrtho(this.left,this.right,this.top,this.bottom,this.near,this.far)};
-THREE.PerspectiveCamera=function(b,c,d,f){THREE.Camera.call(this);this.fov=b!==void 0?b:50;this.aspect=c!==void 0?c:1;this.near=d!==void 0?d:0.1;this.far=f!==void 0?f:2E3;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype=new THREE.Camera;THREE.PerspectiveCamera.prototype.constructor=THREE.PerspectiveCamera;THREE.PerspectiveCamera.prototype.setLens=function(b,c){this.fov=2*Math.atan((c!==void 0?c:43.25)/(b*2));this.fov*=180/Math.PI;this.updateProjectionMatrix()};
-THREE.PerspectiveCamera.prototype.setViewOffset=function(b,c,d,f,h,i){this.fullWidth=b;this.fullHeight=c;this.x=d;this.y=f;this.width=h;this.height=i;this.updateProjectionMatrix()};
-THREE.PerspectiveCamera.prototype.updateProjectionMatrix=function(){if(this.fullWidth){var b=this.fullWidth/this.fullHeight,c=Math.tan(this.fov*Math.PI/360)*this.near,d=-c,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.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.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:
-!0;this.shading=b.shading!==void 0?b.shading:THREE.SmoothShading;this.wireframe=b.wireframe!==void 0?b.wireframe:!1;this.wireframeLinewidth=b.wireframeLinewidth!==void 0?b.wireframeLinewidth:1;this.wireframeLinecap=b.wireframeLinecap!==void 0?b.wireframeLinecap:"round";this.wireframeLinejoin=b.wireframeLinejoin!==void 0?b.wireframeLinejoin:"round";this.vertexColors=b.vertexColors!==void 0?b.vertexColors:!1;this.skinning=b.skinning!==void 0?b.skinning:!1;this.morphTargets=b.morphTargets!==void 0?b.morphTargets:
+THREE.Object3D.prototype={constructor:THREE.Object3D,translate:function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a))},translateX:function(a){this.translate(a,this._vector.set(1,0,0))},translateY:function(a){this.translate(a,this._vector.set(0,1,0))},translateZ:function(a){this.translate(a,this._vector.set(0,0,1))},lookAt:function(a){this.matrix.lookAt(a,this.position,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},add:function(a){if(this.children.indexOf(a)===
+-1){a.parent!==void 0&&a.parent.remove(a);a.parent=this;this.children.push(a);for(var b=this;b.parent!==void 0;)b=b.parent;b!==void 0&&b instanceof THREE.Scene&&b.addChildRecurse(a)}},remove:function(a){var b=this,c=this.children.indexOf(a);if(c!==-1){a.parent=void 0;for(this.children.splice(c,1);b.parent!==void 0;)b=b.parent;b!==void 0&&b instanceof THREE.Scene&&b.removeChildRecurse(a)}},getChildByName:function(a,b){var c,e,f;c=0;for(e=this.children.length;c<e;c++){f=this.children[c];if(f.name===
+a)return f;if(b&&(f=f.getChildByName(a,b),f!==void 0))return f}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z));this.matrixWorldNeedsUpdate=!0},update:function(a,b,c){this.matrixAutoUpdate&&
+this.updateMatrix();if(this.matrixWorldNeedsUpdate||b)a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale),this.matrixWorldNeedsUpdate=!1,b=!0;for(var a=0,e=this.children.length;a<e;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=n[j]=n[j]||new THREE.RenderableVertex;j++;return a}function b(a,b){return b.z-a.z}function c(a,b){var c=0,e=1,d=a.z+a.w,h=b.z+b.w,f=-a.z+a.w,i=-b.z+b.w;return d>=0&&h>=0&&f>=0&&i>=0?!0:d<0&&h<0||f<0&&i<0?!1:(d<0?c=Math.max(c,d/(d-h)):h<0&&(e=Math.min(e,d/(d-h))),f<0?c=Math.max(c,f/(f-i)):i<0&&(e=Math.min(e,f/(f-i))),e<c?!1:(a.lerpSelf(b,c),b.lerpSelf(a,1-e),!0))}var e,f,h=[],i,j,n=[],k,l,p=[],m,s=[],B,A,H=[],C,Q,wa=[],ja=[],qa=[],ha=new THREE.Vector4,
+L=new THREE.Vector4,z=new THREE.Matrix4,R=new THREE.Matrix4,M=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],T=new THREE.Vector4,ka=new THREE.Vector4;this.projectVector=function(a,b){z.multiply(b.projectionMatrix,b.matrixWorldInverse);z.multiplyVector3(a);return a};this.unprojectVector=function(a,b){z.multiply(b.matrixWorld,THREE.Matrix4.makeInvert(b.projectionMatrix));z.multiplyVector3(a);return a};this.pickingRay=function(a,b){var c;
+a.z=-1;c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.subSelf(a).normalize();return new THREE.Ray(a,c)};this.projectObjects=function(a,c,i){var j,d;f=ja.length=0;j=a.objects;a=0;for(c=j.length;a<c;a++){d=j[a];var k;if(!(k=!d.visible))if(k=d instanceof THREE.Mesh)if(k=d.frustumCulled){a:{k=void 0;for(var n=d.matrixWorld,s=-d.geometry.boundingSphere.radius*Math.max(d.scale.x,Math.max(d.scale.y,d.scale.z)),l=0;l<6;l++)if(k=M[l].x*n.n14+M[l].y*n.n24+M[l].z*n.n34+
+M[l].w,k<=s){k=!1;break a}k=!0}k=!k}if(!k)k=h[f]=h[f]||new THREE.RenderableObject,f++,e=k,ha.copy(d.position),z.multiplyVector3(ha),e.object=d,e.z=ha.z,ja.push(e)}i&&ja.sort(b);return ja};this.projectScene=function(e,h,f){var F=h.near,d=h.far,ja,ha,aa,ma,E,ra,N,V,ia,S,xa,Ka,Pa,Qa,ya,Ba,ua;Q=A=m=l=qa.length=0;h.matrixAutoUpdate&&h.update(void 0,!0);e.update(void 0,!1,h);z.multiply(h.projectionMatrix,h.matrixWorldInverse);M[0].set(z.n41-z.n11,z.n42-z.n12,z.n43-z.n13,z.n44-z.n14);M[1].set(z.n41+z.n11,
+z.n42+z.n12,z.n43+z.n13,z.n44+z.n14);M[2].set(z.n41+z.n21,z.n42+z.n22,z.n43+z.n23,z.n44+z.n24);M[3].set(z.n41-z.n21,z.n42-z.n22,z.n43-z.n23,z.n44-z.n24);M[4].set(z.n41-z.n31,z.n42-z.n32,z.n43-z.n33,z.n44-z.n34);M[5].set(z.n41+z.n31,z.n42+z.n32,z.n43+z.n33,z.n44+z.n34);for(ja=0;ja<6;ja++)ia=M[ja],ia.divideScalar(Math.sqrt(ia.x*ia.x+ia.y*ia.y+ia.z*ia.z));ia=this.projectObjects(e,h,!0);e=0;for(ja=ia.length;e<ja;e++)if(S=ia[e].object,S.visible)if(xa=S.matrixWorld,Ka=S.matrixRotationWorld,Pa=S.materials,
+Qa=S.overdraw,j=0,S instanceof THREE.Mesh){ya=S.geometry;ma=ya.vertices;Ba=ya.faces;ya=ya.faceVertexUvs;ha=0;for(aa=ma.length;ha<aa;ha++)i=a(),i.positionWorld.copy(ma[ha].position),xa.multiplyVector3(i.positionWorld),i.positionScreen.copy(i.positionWorld),z.multiplyVector4(i.positionScreen),i.positionScreen.x/=i.positionScreen.w,i.positionScreen.y/=i.positionScreen.w,i.visible=i.positionScreen.z>F&&i.positionScreen.z<d;ma=0;for(ha=Ba.length;ma<ha;ma++){aa=Ba[ma];if(aa instanceof THREE.Face3)if(E=
+n[aa.a],ra=n[aa.b],N=n[aa.c],E.visible&&ra.visible&&N.visible&&(S.doubleSided||S.flipSided!=(N.positionScreen.x-E.positionScreen.x)*(ra.positionScreen.y-E.positionScreen.y)-(N.positionScreen.y-E.positionScreen.y)*(ra.positionScreen.x-E.positionScreen.x)<0))V=p[l]=p[l]||new THREE.RenderableFace3,l++,k=V,k.v1.copy(E),k.v2.copy(ra),k.v3.copy(N);else continue;else if(aa instanceof THREE.Face4)if(E=n[aa.a],ra=n[aa.b],N=n[aa.c],V=n[aa.d],E.visible&&ra.visible&&N.visible&&V.visible&&(S.doubleSided||S.flipSided!=
+((V.positionScreen.x-E.positionScreen.x)*(ra.positionScreen.y-E.positionScreen.y)-(V.positionScreen.y-E.positionScreen.y)*(ra.positionScreen.x-E.positionScreen.x)<0||(ra.positionScreen.x-N.positionScreen.x)*(V.positionScreen.y-N.positionScreen.y)-(ra.positionScreen.y-N.positionScreen.y)*(V.positionScreen.x-N.positionScreen.x)<0)))ua=s[m]=s[m]||new THREE.RenderableFace4,m++,k=ua,k.v1.copy(E),k.v2.copy(ra),k.v3.copy(N),k.v4.copy(V);else continue;k.normalWorld.copy(aa.normal);Ka.multiplyVector3(k.normalWorld);
+k.centroidWorld.copy(aa.centroid);xa.multiplyVector3(k.centroidWorld);k.centroidScreen.copy(k.centroidWorld);z.multiplyVector3(k.centroidScreen);N=aa.vertexNormals;E=0;for(ra=N.length;E<ra;E++)V=k.vertexNormalsWorld[E],V.copy(N[E]),Ka.multiplyVector3(V);E=0;for(ra=ya.length;E<ra;E++)if(ua=ya[E][ma]){N=0;for(V=ua.length;N<V;N++)k.uvs[E][N]=ua[N]}k.meshMaterials=Pa;k.faceMaterials=aa.materials;k.overdraw=Qa;k.z=k.centroidScreen.z;qa.push(k)}}else if(S instanceof THREE.Line){R.multiply(z,xa);ma=S.geometry.vertices;
+E=a();E.positionScreen.copy(ma[0].position);R.multiplyVector4(E.positionScreen);ha=1;for(aa=ma.length;ha<aa;ha++)if(E=a(),E.positionScreen.copy(ma[ha].position),R.multiplyVector4(E.positionScreen),ra=n[j-2],T.copy(E.positionScreen),ka.copy(ra.positionScreen),c(T,ka))T.multiplyScalar(1/T.w),ka.multiplyScalar(1/ka.w),xa=H[A]=H[A]||new THREE.RenderableLine,A++,B=xa,B.v1.positionScreen.copy(T),B.v2.positionScreen.copy(ka),B.z=Math.max(T.z,ka.z),B.materials=S.materials,qa.push(B)}else if(S instanceof THREE.Particle&&
+(L.set(S.matrixWorld.n14,S.matrixWorld.n24,S.matrixWorld.n34,1),z.multiplyVector4(L),L.z/=L.w,L.z>0&&L.z<1))xa=wa[Q]=wa[Q]||new THREE.RenderableParticle,Q++,C=xa,C.x=L.x/L.w,C.y=L.y/L.w,C.z=L.z,C.rotation=S.rotation.z,C.scale.x=S.scale.x*Math.abs(C.x-(L.x+h.projectionMatrix.n11)/(L.w+h.projectionMatrix.n14)),C.scale.y=S.scale.y*Math.abs(C.y-(L.y+h.projectionMatrix.n22)/(L.w+h.projectionMatrix.n24)),C.materials=S.materials,qa.push(C);f&&qa.sort(b);return qa}};
+THREE.Quaternion=function(a,b,c,e){this.set(a||0,b||0,c||0,e!==void 0?e:1)};
+THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,b,c,e){this.x=a;this.y=b;this.z=c;this.w=e;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,e=a.y*b,f=a.z*b,a=Math.cos(e),e=Math.sin(e),b=Math.cos(-f),f=Math.sin(-f),h=Math.cos(c),c=Math.sin(c),i=a*b,j=e*f;this.w=i*h-j*c;this.x=i*c+j*h;this.y=e*b*h+a*f*c;this.z=a*f*h-e*b*c;return this},setFromAxisAngle:function(a,b){var c=b/2,e=Math.sin(c);
+this.x=a.x*e;this.y=a.y*e;this.z=a.z*e;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,e=this.z,f=this.w,h=a.x,i=a.y,j=a.z,a=a.w;this.x=b*a+f*h+c*j-e*i;this.y=c*a+f*i+e*h-b*j;this.z=e*a+f*j+b*i-c*h;this.w=f*a-b*h-c*i-e*j;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,e=a.y,f=a.z,h=this.x,i=this.y,j=this.z,n=this.w,k=n*c+i*f-j*e,l=n*e+j*c-h*f,p=n*f+h*e-i*c,c=-h*
+c-i*e-j*f;b.x=k*n+c*-h+l*-j-p*-i;b.y=l*n+c*-i+p*-h-k*-j;b.z=p*n+c*-j+k*-i-l*-h;return b}};THREE.Quaternion.slerp=function(a,b,c,e){var f=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(f)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var h=Math.acos(f),i=Math.sqrt(1-f*f);if(Math.abs(i)<0.0010)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;f=Math.sin((1-e)*h)/i;e=Math.sin(e*h)/i;c.w=a.w*f+b.w*e;c.x=a.x*f+b.x*e;c.y=a.y*f+b.y*e;c.z=a.z*f+b.z*e;return c};
+THREE.Vertex=function(a){this.position=a||new THREE.Vector3};THREE.Face3=function(a,b,c,e,f,h){this.a=a;this.b=b;this.c=c;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materialIndex=h;this.centroid=new THREE.Vector3};
+THREE.Face4=function(a,b,c,e,f,h,i){this.a=a;this.b=b;this.c=c;this.d=e;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=h instanceof THREE.Color?h:new THREE.Color;this.vertexColors=h instanceof Array?h:[];this.vertexTangents=[];this.materialIndex=i;this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.u=a||0;this.v=b||0};
+THREE.UV.prototype={constructor:THREE.UV,set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.u=a.u;this.v=a.v;return this},clone:function(){return new THREE.UV(this.u,this.v)}};
+THREE.Geometry=function(){this.id=THREE.GeometryCount++;this.vertices=[];this.colors=[];this.materials=[];this.faces=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.dynamic=this.hasTangents=!1};
+THREE.Geometry.prototype={constructor:THREE.Geometry,applyMatrix:function(a){var b=new THREE.Matrix4;b.extractRotation(a,new THREE.Vector3(1,1,1));for(var c=0,e=this.vertices.length;c<e;c++)a.multiplyVector3(this.vertices[c].position);c=0;for(e=this.faces.length;c<e;c++){var f=this.faces[c];b.multiplyVector3(f.normal);for(var h=0,i=f.vertexNormals.length;h<i;h++)b.multiplyVector3(f.vertexNormals[h]);a.multiplyVector3(f.centroid)}},computeCentroids:function(){var a,b,c;a=0;for(b=this.faces.length;a<
+b;a++)c=this.faces[a],c.centroid.set(0,0,0),c instanceof THREE.Face3?(c.centroid.addSelf(this.vertices[c.a].position),c.centroid.addSelf(this.vertices[c.b].position),c.centroid.addSelf(this.vertices[c.c].position),c.centroid.divideScalar(3)):c instanceof THREE.Face4&&(c.centroid.addSelf(this.vertices[c.a].position),c.centroid.addSelf(this.vertices[c.b].position),c.centroid.addSelf(this.vertices[c.c].position),c.centroid.addSelf(this.vertices[c.d].position),c.centroid.divideScalar(4))},computeFaceNormals:function(a){var b,
+c,e,f,h,i,j=new THREE.Vector3,n=new THREE.Vector3;e=0;for(f=this.faces.length;e<f;e++){h=this.faces[e];if(a&&h.vertexNormals.length){j.set(0,0,0);b=0;for(c=h.vertexNormals.length;b<c;b++)j.addSelf(h.vertexNormals[b]);j.divideScalar(3)}else b=this.vertices[h.a],c=this.vertices[h.b],i=this.vertices[h.c],j.sub(i.position,c.position),n.sub(b.position,c.position),j.crossSelf(n);j.isZero()||j.normalize();h.normal.copy(j)}},computeVertexNormals:function(){var a,b,c,e;if(this.__tmpVertices==void 0){e=this.__tmpVertices=
+Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)e[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++)if(c=this.faces[a],c instanceof THREE.Face3)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(c instanceof THREE.Face4)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{e=this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)e[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],c instanceof
+THREE.Face3?(e[c.a].addSelf(c.normal),e[c.b].addSelf(c.normal),e[c.c].addSelf(c.normal)):c instanceof THREE.Face4&&(e[c.a].addSelf(c.normal),e[c.b].addSelf(c.normal),e[c.c].addSelf(c.normal),e[c.d].addSelf(c.normal));a=0;for(b=this.vertices.length;a<b;a++)e[a].normalize();a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],c instanceof THREE.Face3?(c.vertexNormals[0].copy(e[c.a]),c.vertexNormals[1].copy(e[c.b]),c.vertexNormals[2].copy(e[c.c])):c instanceof THREE.Face4&&(c.vertexNormals[0].copy(e[c.a]),
+c.vertexNormals[1].copy(e[c.b]),c.vertexNormals[2].copy(e[c.c]),c.vertexNormals[3].copy(e[c.d]))},computeTangents:function(){function a(a,b,c,e,h,f,z){j=a.vertices[b].position;n=a.vertices[c].position;k=a.vertices[e].position;l=i[h];p=i[f];m=i[z];s=n.x-j.x;B=k.x-j.x;A=n.y-j.y;H=k.y-j.y;C=n.z-j.z;Q=k.z-j.z;wa=p.u-l.u;ja=m.u-l.u;qa=p.v-l.v;ha=m.v-l.v;L=1/(wa*ha-ja*qa);T.set((ha*s-qa*B)*L,(ha*A-qa*H)*L,(ha*C-qa*Q)*L);ka.set((wa*B-ja*s)*L,(wa*H-ja*A)*L,(wa*Q-ja*C)*L);R[b].addSelf(T);R[c].addSelf(T);R[e].addSelf(T);
+M[b].addSelf(ka);M[c].addSelf(ka);M[e].addSelf(ka)}var b,c,e,f,h,i,j,n,k,l,p,m,s,B,A,H,C,Q,wa,ja,qa,ha,L,z,R=[],M=[],T=new THREE.Vector3,ka=new THREE.Vector3,Z=new THREE.Vector3,Aa=new THREE.Vector3,$=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++)R[b]=new THREE.Vector3,M[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)h=this.faces[b],i=this.faceVertexUvs[0][b],h instanceof THREE.Face3?a(this,h.a,h.b,h.c,0,1,2):h instanceof THREE.Face4&&(a(this,h.a,h.b,h.c,0,1,2),a(this,h.a,h.b,
+h.d,0,1,3));var F=["a","b","c","d"];b=0;for(c=this.faces.length;b<c;b++){h=this.faces[b];for(e=0;e<h.vertexNormals.length;e++)$.copy(h.vertexNormals[e]),f=h[F[e]],z=R[f],Z.copy(z),Z.subSelf($.multiplyScalar($.dot(z))).normalize(),Aa.cross(h.vertexNormals[e],z),f=Aa.dot(M[f]),f=f<0?-1:1,h.vertexTangents[e]=new THREE.Vector4(Z.x,Z.y,Z.z,f)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],
+y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var b=1,c=this.vertices.length;b<c;b++){a=this.vertices[b];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<
+this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else if(a.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=0,b=0,c=this.vertices.length;b<c;b++)a=Math.max(a,this.vertices[b].position.length());this.boundingSphere={radius:a}},mergeVertices:function(){var a={},b=[],c=[],e,f=Math.pow(10,4),h,i;h=0;for(i=this.vertices.length;h<i;h++)e=this.vertices[h].position,e=[Math.round(e.x*f),Math.round(e.y*f),Math.round(e.z*f)].join("_"),
+a[e]===void 0?(a[e]=h,b.push(this.vertices[h]),c[h]=b.length-1):c[h]=c[a[e]];h=0;for(i=this.faces.length;h<i;h++){a=this.faces[h];if(a instanceof THREE.Face3)a.a=c[a.a],a.b=c[a.b],a.c=c[a.c];if(a instanceof THREE.Face4)a.a=c[a.a],a.b=c[a.b],a.c=c[a.c],a.d=c[a.d]}this.vertices=b}};THREE.GeometryCount=0;
+THREE.Spline=function(a){function b(a,b,c,e,h,f,i){a=(c-a)*0.5;e=(e-b)*0.5;return(2*(b-c)+a+e)*i+(-3*(b-c)-2*a-e)*f+a*h+b}this.points=a;var c=[],e={x:0,y:0,z:0},f,h,i,j,n,k,l,p,m;this.initFromArray=function(a){this.points=[];for(var b=0;b<a.length;b++)this.points[b]={x:a[b][0],y:a[b][1],z:a[b][2]}};this.getPoint=function(a){f=(this.points.length-1)*a;h=Math.floor(f);i=f-h;c[0]=h==0?h:h-1;c[1]=h;c[2]=h>this.points.length-2?h:h+1;c[3]=h>this.points.length-3?h:h+2;k=this.points[c[0]];l=this.points[c[1]];
+p=this.points[c[2]];m=this.points[c[3]];j=i*i;n=i*j;e.x=b(k.x,l.x,p.x,m.x,i,j,n);e.y=b(k.y,l.y,p.y,m.y,i,j,n);e.z=b(k.z,l.z,p.z,m.z,i,j,n);return e};this.getControlPointsArray=function(){var a,b,c=this.points.length,e=[];for(a=0;a<c;a++)b=this.points[a],e[a]=[b.x,b.y,b.z];return e};this.getLength=function(a){var b,c,e=b=b=0,h=new THREE.Vector3,f=new THREE.Vector3,i=[],j=0;i[0]=0;a||(a=100);c=this.points.length*a;h.copy(this.points[0]);for(a=1;a<c;a++)b=a/c,position=this.getPoint(b),f.copy(position),
+j+=f.distanceTo(h),h.copy(position),b*=this.points.length-1,b=Math.floor(b),b!=e&&(i[b]=j,e=b);i[i.length]=j;return{chunks:i,total:j}};this.reparametrizeByArcLength=function(a){var b,c,e,h,f,i,j=[],k=new THREE.Vector3,n=this.getLength();j.push(k.copy(this.points[0]).clone());for(b=1;b<this.points.length;b++){c=n.chunks[b]-n.chunks[b-1];i=Math.ceil(a*c/n.total);h=(b-1)/(this.points.length-1);f=b/(this.points.length-1);for(c=1;c<i-1;c++)e=h+c*(1/i)*(f-h),position=this.getPoint(e),j.push(k.copy(position).clone());
+j.push(k.copy(this.points[b]).clone())}this.points=j}};THREE.Edge=function(a,b,c,e){this.vertices=[a,b];this.vertexIndices=[c,e];this.faces=[];this.faceIndices=[]};THREE.Camera=function(){if(arguments.length)return console.warn("DEPRECATED: Camera() is now PerspectiveCamera() or OrthographicCamera()."),new THREE.PerspectiveCamera(arguments[0],arguments[1],arguments[2],arguments[3]);THREE.Object3D.call(this);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4};
+THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.lookAt=function(a){this.matrix.lookAt(this.position,a,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)};
+THREE.Camera.prototype.update=function(a,b,c){this.matrixAutoUpdate&&this.updateMatrix();if(b||this.matrixWorldNeedsUpdate)a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,b=!0,THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);for(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,b,c)};
+THREE.OrthographicCamera=function(a,b,c,e,f,h){THREE.Camera.call(this);this.left=a;this.right=b;this.top=c;this.bottom=e;this.near=f!==void 0?f:0.1;this.far=h!==void 0?h:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=new THREE.Camera;THREE.OrthographicCamera.prototype.constructor=THREE.OrthographicCamera;THREE.OrthographicCamera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makeOrtho(this.left,this.right,this.top,this.bottom,this.near,this.far)};
+THREE.PerspectiveCamera=function(a,b,c,e){THREE.Camera.call(this);this.fov=a!==void 0?a:50;this.aspect=b!==void 0?b:1;this.near=c!==void 0?c:0.1;this.far=e!==void 0?e:2E3;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype=new THREE.Camera;THREE.PerspectiveCamera.prototype.constructor=THREE.PerspectiveCamera;THREE.PerspectiveCamera.prototype.setLens=function(a,b){this.fov=2*Math.atan((b!==void 0?b:43.25)/(a*2));this.fov*=180/Math.PI;this.updateProjectionMatrix()};
+THREE.PerspectiveCamera.prototype.setViewOffset=function(a,b,c,e,f,h){this.fullWidth=a;this.fullHeight=b;this.x=c;this.y=e;this.width=f;this.height=h;this.updateProjectionMatrix()};
+THREE.PerspectiveCamera.prototype.updateProjectionMatrix=function(){if(this.fullWidth){var a=this.fullWidth/this.fullHeight,b=Math.tan(this.fov*Math.PI/360)*this.near,c=-b,e=a*c,a=Math.abs(a*b-e),c=Math.abs(b-c);this.projectionMatrix=THREE.Matrix4.makeFrustum(e+this.x*a/this.fullWidth,e+(this.x+this.width)*a/this.fullWidth,b-(this.y+this.height)*c/this.fullHeight,b-this.y*c/this.fullHeight,this.near,this.far)}else this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,
+this.far)};THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;
+THREE.DirectionalLight=function(a,b,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=b!==void 0?b:1;this.distance=c!==void 0?c:0};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,b,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,0,0);this.intensity=b!==void 0?b:1;this.distance=c!==void 0?c:0};THREE.PointLight.prototype=new THREE.Light;
+THREE.PointLight.prototype.constructor=THREE.PointLight;THREE.SpotLight=function(a,b,c,e){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.target=new THREE.Object3D;this.intensity=b!==void 0?b:1;this.distance=c!==void 0?c:0;this.castShadow=e!==void 0?e:!1};THREE.SpotLight.prototype=new THREE.Light;THREE.SpotLight.prototype.constructor=THREE.SpotLight;
+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:
+!0;this.shading=a.shading!==void 0?a.shading:THREE.SmoothShading;this.wireframe=a.wireframe!==void 0?a.wireframe:!1;this.wireframeLinewidth=a.wireframeLinewidth!==void 0?a.wireframeLinewidth:1;this.wireframeLinecap=a.wireframeLinecap!==void 0?a.wireframeLinecap:"round";this.wireframeLinejoin=a.wireframeLinejoin!==void 0?a.wireframeLinejoin:"round";this.vertexColors=a.vertexColors!==void 0?a.vertexColors:!1;this.skinning=a.skinning!==void 0?a.skinning:!1;this.morphTargets=a.morphTargets!==void 0?a.morphTargets:
 !1};THREE.MeshBasicMaterial.prototype=new THREE.Material;THREE.MeshBasicMaterial.prototype.constructor=THREE.MeshBasicMaterial;
-THREE.MeshLambertMaterial=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.ambient=b.ambient!==void 0?new THREE.Color(b.ambient):new THREE.Color(328965);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:!0;this.shading=b.shading!==void 0?b.shading:THREE.SmoothShading;this.wireframe=b.wireframe!==void 0?b.wireframe:!1;this.wireframeLinewidth=b.wireframeLinewidth!==void 0?b.wireframeLinewidth:1;this.wireframeLinecap=b.wireframeLinecap!==void 0?b.wireframeLinecap:"round";this.wireframeLinejoin=b.wireframeLinejoin!==void 0?b.wireframeLinejoin:"round";this.vertexColors=b.vertexColors!==void 0?b.vertexColors:!1;this.skinning=
-b.skinning!==void 0?b.skinning:!1;this.morphTargets=b.morphTargets!==void 0?b.morphTargets:!1};THREE.MeshLambertMaterial.prototype=new THREE.Material;THREE.MeshLambertMaterial.prototype.constructor=THREE.MeshLambertMaterial;
-THREE.MeshPhongMaterial=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.ambient=b.ambient!==void 0?new THREE.Color(b.ambient):new THREE.Color(328965);this.specular=b.specular!==void 0?new THREE.Color(b.specular):new THREE.Color(1118481);this.shininess=b.shininess!==void 0?b.shininess:30;this.metal=b.metal!==void 0?b.metal:!1;this.perPixel=b.perPixel!==void 0?b.perPixel:!1;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:!0;this.shading=b.shading!==void 0?b.shading:THREE.SmoothShading;this.wireframe=b.wireframe!==void 0?b.wireframe:!1;this.wireframeLinewidth=b.wireframeLinewidth!==void 0?b.wireframeLinewidth:1;this.wireframeLinecap=
-b.wireframeLinecap!==void 0?b.wireframeLinecap:"round";this.wireframeLinejoin=b.wireframeLinejoin!==void 0?b.wireframeLinejoin:"round";this.vertexColors=b.vertexColors!==void 0?b.vertexColors:!1;this.skinning=b.skinning!==void 0?b.skinning:!1;this.morphTargets=b.morphTargets!==void 0?b.morphTargets:!1};THREE.MeshPhongMaterial.prototype=new THREE.Material;THREE.MeshPhongMaterial.prototype.constructor=THREE.MeshPhongMaterial;
-THREE.MeshDepthMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.shading=b.shading!==void 0?b.shading:THREE.SmoothShading;this.wireframe=b.wireframe!==void 0?b.wireframe:!1;this.wireframeLinewidth=b.wireframeLinewidth!==void 0?b.wireframeLinewidth:1};THREE.MeshDepthMaterial.prototype=new THREE.Material;THREE.MeshDepthMaterial.prototype.constructor=THREE.MeshDepthMaterial;
-THREE.MeshNormalMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.shading=b.shading?b.shading:THREE.FlatShading;this.wireframe=b.wireframe?b.wireframe:!1;this.wireframeLinewidth=b.wireframeLinewidth?b.wireframeLinewidth:1};THREE.MeshNormalMaterial.prototype=new THREE.Material;THREE.MeshNormalMaterial.prototype.constructor=THREE.MeshNormalMaterial;THREE.MeshFaceMaterial=function(){};
-THREE.MeshShaderMaterial=function(b){console.warn("DEPRECATED: MeshShaderMaterial() is now ShaderMaterial().");return new THREE.ShaderMaterial(b)};
-THREE.ParticleBasicMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.color=b.color!==void 0?new THREE.Color(b.color):new THREE.Color(16777215);this.map=b.map!==void 0?b.map:null;this.size=b.size!==void 0?b.size:1;this.sizeAttenuation=b.sizeAttenuation!==void 0?b.sizeAttenuation:!0;this.vertexColors=b.vertexColors!==void 0?b.vertexColors:!1;this.fog=b.fog!==void 0?b.fog:!0};THREE.ParticleBasicMaterial.prototype=new THREE.Material;THREE.ParticleBasicMaterial.prototype.constructor=THREE.ParticleBasicMaterial;
-THREE.ShaderMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.fragmentShader=b.fragmentShader!==void 0?b.fragmentShader:"void main() {}";this.vertexShader=b.vertexShader!==void 0?b.vertexShader:"void main() {}";this.uniforms=b.uniforms!==void 0?b.uniforms:{};this.attributes=b.attributes;this.shading=b.shading!==void 0?b.shading:THREE.SmoothShading;this.wireframe=b.wireframe!==void 0?b.wireframe:!1;this.wireframeLinewidth=b.wireframeLinewidth!==void 0?b.wireframeLinewidth:1;this.fog=b.fog!==
-void 0?b.fog:!1;this.lights=b.lights!==void 0?b.lights:!1;this.vertexColors=b.vertexColors!==void 0?b.vertexColors:!1;this.skinning=b.skinning!==void 0?b.skinning:!1;this.morphTargets=b.morphTargets!==void 0?b.morphTargets:!1};THREE.ShaderMaterial.prototype=new THREE.Material;THREE.ShaderMaterial.prototype.constructor=THREE.ShaderMaterial;
-THREE.Texture=function(b,c,d,f,h,i){this.id=THREE.TextureCount++;this.image=b;this.mapping=c!==void 0?c:new THREE.UVMapping;this.wrapS=d!==void 0?d:THREE.ClampToEdgeWrapping;this.wrapT=f!==void 0?f:THREE.ClampToEdgeWrapping;this.magFilter=h!==void 0?h:THREE.LinearFilter;this.minFilter=i!==void 0?i:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.needsUpdate=!1};
-THREE.Texture.prototype={constructor:THREE.Texture,clone:function(){var b=new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter);b.offset.copy(this.offset);b.repeat.copy(this.repeat);return b}};THREE.TextureCount=0;THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.LatitudeReflectionMapping=function(){};THREE.LatitudeRefractionMapping=function(){};
+THREE.MeshLambertMaterial=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.ambient=a.ambient!==void 0?new THREE.Color(a.ambient):new THREE.Color(328965);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:!0;this.shading=a.shading!==void 0?a.shading:THREE.SmoothShading;this.wireframe=a.wireframe!==void 0?a.wireframe:!1;this.wireframeLinewidth=a.wireframeLinewidth!==void 0?a.wireframeLinewidth:1;this.wireframeLinecap=a.wireframeLinecap!==void 0?a.wireframeLinecap:"round";this.wireframeLinejoin=a.wireframeLinejoin!==void 0?a.wireframeLinejoin:"round";this.vertexColors=a.vertexColors!==void 0?a.vertexColors:!1;this.skinning=
+a.skinning!==void 0?a.skinning:!1;this.morphTargets=a.morphTargets!==void 0?a.morphTargets:!1};THREE.MeshLambertMaterial.prototype=new THREE.Material;THREE.MeshLambertMaterial.prototype.constructor=THREE.MeshLambertMaterial;
+THREE.MeshPhongMaterial=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.ambient=a.ambient!==void 0?new THREE.Color(a.ambient):new THREE.Color(328965);this.specular=a.specular!==void 0?new THREE.Color(a.specular):new THREE.Color(1118481);this.shininess=a.shininess!==void 0?a.shininess:30;this.metal=a.metal!==void 0?a.metal:!1;this.perPixel=a.perPixel!==void 0?a.perPixel:!1;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:!0;this.shading=a.shading!==void 0?a.shading:THREE.SmoothShading;this.wireframe=a.wireframe!==void 0?a.wireframe:!1;this.wireframeLinewidth=a.wireframeLinewidth!==void 0?a.wireframeLinewidth:1;this.wireframeLinecap=
+a.wireframeLinecap!==void 0?a.wireframeLinecap:"round";this.wireframeLinejoin=a.wireframeLinejoin!==void 0?a.wireframeLinejoin:"round";this.vertexColors=a.vertexColors!==void 0?a.vertexColors:!1;this.skinning=a.skinning!==void 0?a.skinning:!1;this.morphTargets=a.morphTargets!==void 0?a.morphTargets:!1};THREE.MeshPhongMaterial.prototype=new THREE.Material;THREE.MeshPhongMaterial.prototype.constructor=THREE.MeshPhongMaterial;
+THREE.MeshDepthMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.shading=a.shading!==void 0?a.shading:THREE.SmoothShading;this.wireframe=a.wireframe!==void 0?a.wireframe:!1;this.wireframeLinewidth=a.wireframeLinewidth!==void 0?a.wireframeLinewidth:1};THREE.MeshDepthMaterial.prototype=new THREE.Material;THREE.MeshDepthMaterial.prototype.constructor=THREE.MeshDepthMaterial;
+THREE.MeshNormalMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.shading=a.shading?a.shading:THREE.FlatShading;this.wireframe=a.wireframe?a.wireframe:!1;this.wireframeLinewidth=a.wireframeLinewidth?a.wireframeLinewidth:1};THREE.MeshNormalMaterial.prototype=new THREE.Material;THREE.MeshNormalMaterial.prototype.constructor=THREE.MeshNormalMaterial;THREE.MeshFaceMaterial=function(){};
+THREE.MeshShaderMaterial=function(a){console.warn("DEPRECATED: MeshShaderMaterial() is now ShaderMaterial().");return new THREE.ShaderMaterial(a)};
+THREE.ParticleBasicMaterial=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.size=a.size!==void 0?a.size:1;this.sizeAttenuation=a.sizeAttenuation!==void 0?a.sizeAttenuation:!0;this.vertexColors=a.vertexColors!==void 0?a.vertexColors:!1;this.fog=a.fog!==void 0?a.fog:!0};THREE.ParticleBasicMaterial.prototype=new THREE.Material;THREE.ParticleBasicMaterial.prototype.constructor=THREE.ParticleBasicMaterial;
+THREE.ShaderMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.fragmentShader=a.fragmentShader!==void 0?a.fragmentShader:"void main() {}";this.vertexShader=a.vertexShader!==void 0?a.vertexShader:"void main() {}";this.uniforms=a.uniforms!==void 0?a.uniforms:{};this.attributes=a.attributes;this.shading=a.shading!==void 0?a.shading:THREE.SmoothShading;this.wireframe=a.wireframe!==void 0?a.wireframe:!1;this.wireframeLinewidth=a.wireframeLinewidth!==void 0?a.wireframeLinewidth:1;this.fog=a.fog!==
+void 0?a.fog:!1;this.lights=a.lights!==void 0?a.lights:!1;this.vertexColors=a.vertexColors!==void 0?a.vertexColors:!1;this.skinning=a.skinning!==void 0?a.skinning:!1;this.morphTargets=a.morphTargets!==void 0?a.morphTargets:!1};THREE.ShaderMaterial.prototype=new THREE.Material;THREE.ShaderMaterial.prototype.constructor=THREE.ShaderMaterial;
+THREE.Texture=function(a,b,c,e,f,h){this.id=THREE.TextureCount++;this.image=a;this.mapping=b!==void 0?b:new THREE.UVMapping;this.wrapS=c!==void 0?c:THREE.ClampToEdgeWrapping;this.wrapT=e!==void 0?e:THREE.ClampToEdgeWrapping;this.magFilter=f!==void 0?f: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 a=new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter);a.offset.copy(this.offset);a.repeat.copy(this.repeat);return a}};THREE.TextureCount=0;THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.LatitudeReflectionMapping=function(){};THREE.LatitudeRefractionMapping=function(){};
 THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=function(){};THREE.UVMapping=function(){};THREE.RepeatWrapping=0;THREE.ClampToEdgeWrapping=1;THREE.MirroredRepeatWrapping=2;THREE.NearestFilter=3;THREE.NearestMipMapNearestFilter=4;THREE.NearestMipMapLinearFilter=5;THREE.LinearFilter=6;THREE.LinearMipMapNearestFilter=7;THREE.LinearMipMapLinearFilter=8;THREE.ByteType=9;THREE.UnsignedByteType=10;THREE.ShortType=11;THREE.UnsignedShortType=12;THREE.IntType=13;
-THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;THREE.DataTexture=function(b,c,d,f,h,i,j,k,n){THREE.Texture.call(this,null,h,i,j,k,n);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;
-THREE.Mesh=function(b,c){THREE.Object3D.call(this);this.geometry=b;this.materials=c&&c.length?c:[c];this.overdraw=!1;if(this.geometry&&(this.geometry.boundingSphere||this.geometry.computeBoundingSphere(),this.boundRadius=b.boundingSphere.radius,this.geometry.morphTargets.length)){this.morphTargetBase=-1;this.morphTargetForcedOrder=[];this.morphTargetInfluences=[];this.morphTargetDictionary={};for(var d=0;d<this.geometry.morphTargets.length;d++)this.morphTargetInfluences.push(0),this.morphTargetDictionary[this.geometry.morphTargets[d].name]=
-d}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;THREE.Mesh.prototype.getMorphTargetIndexByName=function(b){if(this.morphTargetDictionary[b]!==void 0)return this.morphTargetDictionary[b];console.log("THREE.Mesh.getMorphTargetIndexByName: morph target "+b+" does not exist. Returning 0.");return 0};
-THREE.Bone=function(b){THREE.Object3D.call(this);this.skin=b;this.skinMatrix=new THREE.Matrix4;this.hasNoneBoneChildren=!1};THREE.Bone.prototype=new THREE.Object3D;THREE.Bone.prototype.constructor=THREE.Bone;THREE.Bone.prototype.supr=THREE.Object3D.prototype;
-THREE.Bone.prototype.update=function(b,c,d){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate)b?this.skinMatrix.multiply(b,this.matrix):this.skinMatrix.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,c=!0;var f,h=this.children.length;if(this.hasNoneBoneChildren){this.matrixWorld.multiply(this.skin.matrixWorld,this.skinMatrix);for(f=0;f<h;f++)b=this.children[f],b instanceof THREE.Bone?b.update(this.skinMatrix,c,d):b.update(this.matrixWorld,!0,d)}else for(f=0;f<h;f++)this.children[f].update(this.skinMatrix,
-c,d)};THREE.Bone.prototype.add=function(b){if(this.children.indexOf(b)===-1&&(b.parent!==void 0&&b.parent.removeChild(b),b.parent=this,this.children.push(b),!(b instanceof THREE.Bone)))this.hasNoneBoneChildren=!0};
-THREE.SkinnedMesh=function(b,c){THREE.Mesh.call(this,b,c);this.identityMatrix=new THREE.Matrix4;this.bones=[];this.boneMatrices=[];var d,f,h,i,j,k;if(this.geometry.bones!==void 0){for(d=0;d<this.geometry.bones.length;d++)h=this.geometry.bones[d],i=h.pos,j=h.rotq,k=h.scl,f=this.addBone(),f.name=h.name,f.position.set(i[0],i[1],i[2]),f.quaternion.set(j[0],j[1],j[2],j[3]),f.useQuaternion=!0,k!==void 0?f.scale.set(k[0],k[1],k[2]):f.scale.set(1,1,1);for(d=0;d<this.bones.length;d++)h=this.geometry.bones[d],
-f=this.bones[d],h.parent===-1?this.add(f):this.bones[h.parent].add(f);this.boneMatrices=new Float32Array(16*this.bones.length);this.pose()}};THREE.SkinnedMesh.prototype=new THREE.Mesh;THREE.SkinnedMesh.prototype.constructor=THREE.SkinnedMesh;
-THREE.SkinnedMesh.prototype.update=function(b,c,d){if(this.visible){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,c=!0;var f,h=this.children.length;for(f=0;f<h;f++)b=this.children[f],b instanceof THREE.Bone?b.update(this.identityMatrix,!1,d):b.update(this.matrixWorld,c,d);d=this.bones.length;ba=this.bones;bm=this.boneMatrices;for(c=0;c<d;c++)ba[c].skinMatrix.flattenToArrayOffset(bm,
-c*16)}};THREE.SkinnedMesh.prototype.addBone=function(b){b===void 0&&(b=new THREE.Bone(this));this.bones.push(b);return b};
-THREE.SkinnedMesh.prototype.pose=function(){this.update(void 0,!0);for(var b,c=[],d=0;d<this.bones.length;d++)b=this.bones[d],c.push(THREE.Matrix4.makeInvert(b.skinMatrix)),b.skinMatrix.flattenToArrayOffset(this.boneMatrices,d*16);if(this.geometry.skinVerticesA===void 0){this.geometry.skinVerticesA=[];this.geometry.skinVerticesB=[];var f;for(b=0;b<this.geometry.skinIndices.length;b++){var d=this.geometry.vertices[b].position,h=this.geometry.skinIndices[b].x,i=this.geometry.skinIndices[b].y;f=new THREE.Vector3(d.x,
-d.y,d.z);this.geometry.skinVerticesA.push(c[h].multiplyVector3(f));f=new THREE.Vector3(d.x,d.y,d.z);this.geometry.skinVerticesB.push(c[i].multiplyVector3(f));this.geometry.skinWeights[b].x+this.geometry.skinWeights[b].y!==1&&(d=(1-(this.geometry.skinWeights[b].x+this.geometry.skinWeights[b].y))*0.5,this.geometry.skinWeights[b].x+=d,this.geometry.skinWeights[b].y+=d)}}};THREE.Ribbon=function(b,c){THREE.Object3D.call(this);this.geometry=b;this.materials=c instanceof Array?c:[c]};
-THREE.Ribbon.prototype=new THREE.Object3D;THREE.Ribbon.prototype.constructor=THREE.Ribbon;THREE.LOD=function(){THREE.Object3D.call(this);this.LODs=[]};THREE.LOD.prototype=new THREE.Object3D;THREE.LOD.prototype.constructor=THREE.LOD;THREE.LOD.prototype.supr=THREE.Object3D.prototype;THREE.LOD.prototype.addLevel=function(b,c){c===void 0&&(c=0);for(var c=Math.abs(c),d=0;d<this.LODs.length;d++)if(c<this.LODs[d].visibleAtDistance)break;this.LODs.splice(d,0,{visibleAtDistance:c,object3D:b});this.add(b)};
-THREE.LOD.prototype.update=function(b,c,d){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,c=!0;if(this.LODs.length>1){b=d.matrixWorldInverse;b=-(b.n31*this.position.x+b.n32*this.position.y+b.n33*this.position.z+b.n34);this.LODs[0].object3D.visible=!0;for(var f=1;f<this.LODs.length;f++)if(b>=this.LODs[f].visibleAtDistance)this.LODs[f-1].object3D.visible=!1,
-this.LODs[f].object3D.visible=!0;else break;for(;f<this.LODs.length;f++)this.LODs[f].object3D.visible=!1}for(b=0;b<this.children.length;b++)this.children[b].update(this.matrixWorld,c,d)};
-THREE.Sprite=function(b){THREE.Object3D.call(this);this.color=b.color!==void 0?new THREE.Color(b.color):new THREE.Color(16777215);this.map=b.map instanceof THREE.Texture?b.map:THREE.ImageUtils.loadTexture(b.map);this.blending=b.blending!==void 0?b.blending:THREE.NormalBlending;this.useScreenCoordinates=b.useScreenCoordinates!==void 0?b.useScreenCoordinates:!0;this.mergeWith3D=b.mergeWith3D!==void 0?b.mergeWith3D:!this.useScreenCoordinates;this.affectedByDistance=b.affectedByDistance!==void 0?b.affectedByDistance:
-!this.useScreenCoordinates;this.scaleByViewport=b.scaleByViewport!==void 0?b.scaleByViewport:!this.affectedByDistance;this.alignment=b.alignment instanceof THREE.Vector2?b.alignment:THREE.SpriteAlignment.center;this.rotation3d=this.rotation;this.rotation=0;this.opacity=1;this.uvOffset=new THREE.Vector2(0,0);this.uvScale=new THREE.Vector2(1,1)};THREE.Sprite.prototype=new THREE.Object3D;THREE.Sprite.prototype.constructor=THREE.Sprite;THREE.Sprite.prototype.supr=THREE.Object3D.prototype;
+THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;THREE.DataTexture=function(a,b,c,e,f,h,i,j,n){THREE.Texture.call(this,null,f,h,i,j,n);this.image={data:a,width:b,height:c};this.format=e!==void 0?e:THREE.RGBAFormat};THREE.DataTexture.prototype=new THREE.Texture;THREE.DataTexture.prototype.constructor=THREE.DataTexture;
+THREE.DataTexture.prototype.clone=function(){var a=new THREE.DataTexture(this.data.slice(0),this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter);a.offset.copy(this.offset);a.repeat.copy(this.repeat);return a};THREE.Particle=function(a){THREE.Object3D.call(this);this.material=a};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;THREE.ParticleSystem=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material=b;this.sortParticles=!1};
+THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem;THREE.Line=function(a,b,c){THREE.Object3D.call(this);this.geometry=a;this.material=b;this.type=c!=void 0?c:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;
+THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material=b;this.overdraw=!1;if(this.geometry&&(this.geometry.boundingSphere||this.geometry.computeBoundingSphere(),this.boundRadius=a.boundingSphere.radius,this.geometry.morphTargets.length)){this.morphTargetBase=-1;this.morphTargetForcedOrder=[];this.morphTargetInfluences=[];this.morphTargetDictionary={};for(var c=0;c<this.geometry.morphTargets.length;c++)this.morphTargetInfluences.push(0),this.morphTargetDictionary[this.geometry.morphTargets[c].name]=
+c}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;THREE.Mesh.prototype.getMorphTargetIndexByName=function(a){if(this.morphTargetDictionary[a]!==void 0)return this.morphTargetDictionary[a];console.log("THREE.Mesh.getMorphTargetIndexByName: morph target "+a+" does not exist. Returning 0.");return 0};
+THREE.Bone=function(a){THREE.Object3D.call(this);this.skin=a;this.skinMatrix=new THREE.Matrix4;this.hasNoneBoneChildren=!1};THREE.Bone.prototype=new THREE.Object3D;THREE.Bone.prototype.constructor=THREE.Bone;THREE.Bone.prototype.supr=THREE.Object3D.prototype;
+THREE.Bone.prototype.update=function(a,b,c){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate)a?this.skinMatrix.multiply(a,this.matrix):this.skinMatrix.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,b=!0;var e,f=this.children.length;if(this.hasNoneBoneChildren){this.matrixWorld.multiply(this.skin.matrixWorld,this.skinMatrix);for(e=0;e<f;e++)a=this.children[e],a instanceof THREE.Bone?a.update(this.skinMatrix,b,c):a.update(this.matrixWorld,!0,c)}else for(e=0;e<f;e++)this.children[e].update(this.skinMatrix,
+b,c)};THREE.Bone.prototype.add=function(a){if(this.children.indexOf(a)===-1&&(a.parent!==void 0&&a.parent.removeChild(a),a.parent=this,this.children.push(a),!(a instanceof THREE.Bone)))this.hasNoneBoneChildren=!0};
+THREE.SkinnedMesh=function(a,b){THREE.Mesh.call(this,a,b);this.identityMatrix=new THREE.Matrix4;this.bones=[];this.boneMatrices=[];var c,e,f,h,i,j;if(this.geometry.bones!==void 0){for(c=0;c<this.geometry.bones.length;c++)f=this.geometry.bones[c],h=f.pos,i=f.rotq,j=f.scl,e=this.addBone(),e.name=f.name,e.position.set(h[0],h[1],h[2]),e.quaternion.set(i[0],i[1],i[2],i[3]),e.useQuaternion=!0,j!==void 0?e.scale.set(j[0],j[1],j[2]):e.scale.set(1,1,1);for(c=0;c<this.bones.length;c++)f=this.geometry.bones[c],
+e=this.bones[c],f.parent===-1?this.add(e):this.bones[f.parent].add(e);this.boneMatrices=new Float32Array(16*this.bones.length);this.pose()}};THREE.SkinnedMesh.prototype=new THREE.Mesh;THREE.SkinnedMesh.prototype.constructor=THREE.SkinnedMesh;
+THREE.SkinnedMesh.prototype.update=function(a,b,c){if(this.visible){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate)a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,b=!0;var e,f=this.children.length;for(e=0;e<f;e++)a=this.children[e],a instanceof THREE.Bone?a.update(this.identityMatrix,!1,c):a.update(this.matrixWorld,b,c);c=this.bones.length;ba=this.bones;bm=this.boneMatrices;for(b=0;b<c;b++)ba[b].skinMatrix.flattenToArrayOffset(bm,
+b*16)}};THREE.SkinnedMesh.prototype.addBone=function(a){a===void 0&&(a=new THREE.Bone(this));this.bones.push(a);return a};
+THREE.SkinnedMesh.prototype.pose=function(){this.update(void 0,!0);for(var a,b=[],c=0;c<this.bones.length;c++)a=this.bones[c],b.push(THREE.Matrix4.makeInvert(a.skinMatrix)),a.skinMatrix.flattenToArrayOffset(this.boneMatrices,c*16);if(this.geometry.skinVerticesA===void 0){this.geometry.skinVerticesA=[];this.geometry.skinVerticesB=[];var e;for(a=0;a<this.geometry.skinIndices.length;a++){var c=this.geometry.vertices[a].position,f=this.geometry.skinIndices[a].x,h=this.geometry.skinIndices[a].y;e=new THREE.Vector3(c.x,
+c.y,c.z);this.geometry.skinVerticesA.push(b[f].multiplyVector3(e));e=new THREE.Vector3(c.x,c.y,c.z);this.geometry.skinVerticesB.push(b[h].multiplyVector3(e));this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y!==1&&(c=(1-(this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y))*0.5,this.geometry.skinWeights[a].x+=c,this.geometry.skinWeights[a].y+=c)}}};THREE.Ribbon=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material=b};THREE.Ribbon.prototype=new THREE.Object3D;
+THREE.Ribbon.prototype.constructor=THREE.Ribbon;THREE.LOD=function(){THREE.Object3D.call(this);this.LODs=[]};THREE.LOD.prototype=new THREE.Object3D;THREE.LOD.prototype.constructor=THREE.LOD;THREE.LOD.prototype.supr=THREE.Object3D.prototype;THREE.LOD.prototype.addLevel=function(a,b){b===void 0&&(b=0);for(var b=Math.abs(b),c=0;c<this.LODs.length;c++)if(b<this.LODs[c].visibleAtDistance)break;this.LODs.splice(c,0,{visibleAtDistance:b,object3D:a});this.add(a)};
+THREE.LOD.prototype.update=function(a,b,c){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate)a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,b=!0;if(this.LODs.length>1){a=c.matrixWorldInverse;a=-(a.n31*this.position.x+a.n32*this.position.y+a.n33*this.position.z+a.n34);this.LODs[0].object3D.visible=!0;for(var e=1;e<this.LODs.length;e++)if(a>=this.LODs[e].visibleAtDistance)this.LODs[e-1].object3D.visible=!1,
+this.LODs[e].object3D.visible=!0;else break;for(;e<this.LODs.length;e++)this.LODs[e].object3D.visible=!1}for(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,b,c)};
+THREE.Sprite=function(a){THREE.Object3D.call(this);this.color=a.color!==void 0?new THREE.Color(a.color):new THREE.Color(16777215);this.map=a.map instanceof THREE.Texture?a.map:THREE.ImageUtils.loadTexture(a.map);this.blending=a.blending!==void 0?a.blending:THREE.NormalBlending;this.useScreenCoordinates=a.useScreenCoordinates!==void 0?a.useScreenCoordinates:!0;this.mergeWith3D=a.mergeWith3D!==void 0?a.mergeWith3D:!this.useScreenCoordinates;this.affectedByDistance=a.affectedByDistance!==void 0?a.affectedByDistance:
+!this.useScreenCoordinates;this.scaleByViewport=a.scaleByViewport!==void 0?a.scaleByViewport:!this.affectedByDistance;this.alignment=a.alignment instanceof THREE.Vector2?a.alignment:THREE.SpriteAlignment.center;this.rotation3d=this.rotation;this.rotation=0;this.opacity=1;this.uvOffset=new THREE.Vector2(0,0);this.uvScale=new THREE.Vector2(1,1)};THREE.Sprite.prototype=new THREE.Object3D;THREE.Sprite.prototype.constructor=THREE.Sprite;THREE.Sprite.prototype.supr=THREE.Object3D.prototype;
 THREE.Sprite.prototype.updateMatrix=function(){this.matrix.setPosition(this.position);this.rotation3d.set(0,0,this.rotation);this.matrix.setRotationFromEuler(this.rotation3d);if(this.scale.x!==1||this.scale.y!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,this.scale.y);this.matrixWorldNeedsUpdate=!0};THREE.SpriteAlignment={};THREE.SpriteAlignment.topLeft=new THREE.Vector2(1,-1);THREE.SpriteAlignment.topCenter=new THREE.Vector2(0,-1);
 THREE.SpriteAlignment.topRight=new THREE.Vector2(-1,-1);THREE.SpriteAlignment.centerLeft=new THREE.Vector2(1,0);THREE.SpriteAlignment.center=new THREE.Vector2(0,0);THREE.SpriteAlignment.centerRight=new THREE.Vector2(-1,0);THREE.SpriteAlignment.bottomLeft=new THREE.Vector2(1,1);THREE.SpriteAlignment.bottomCenter=new THREE.Vector2(0,1);THREE.SpriteAlignment.bottomRight=new THREE.Vector2(-1,1);
-THREE.Scene=function(){THREE.Object3D.call(this);this.fog=null;this.matrixAutoUpdate=!1;this.collisions=this.overrideMaterial=null;this.objects=[];this.lights=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;THREE.Scene.prototype.supr=THREE.Object3D.prototype;THREE.Scene.prototype.add=function(b){this.supr.add.call(this,b);this.addChildRecurse(b)};
-THREE.Scene.prototype.addChildRecurse=function(b){if(b instanceof THREE.Light)this.lights.indexOf(b)===-1&&this.lights.push(b);else if(!(b instanceof THREE.Camera||b instanceof THREE.Bone)&&this.objects.indexOf(b)===-1){this.objects.push(b);this.__objectsAdded.push(b);var c=this.__objectsRemoved.indexOf(b);c!==-1&&this.__objectsRemoved.splice(c,1)}for(c=0;c<b.children.length;c++)this.addChildRecurse(b.children[c])};THREE.Scene.prototype.remove=function(b){this.supr.remove.call(this,b);this.removeChildRecurse(b)};
-THREE.Scene.prototype.removeChildRecurse=function(b){if(b instanceof THREE.Light){var c=this.lights.indexOf(b);c!==-1&&this.lights.splice(c,1)}else b instanceof THREE.Camera||(c=this.objects.indexOf(b),c!==-1&&(this.objects.splice(c,1),this.__objectsRemoved.push(b),c=this.__objectsAdded.indexOf(b),c!==-1&&this.__objectsAdded.splice(c,1)));for(c=0;c<b.children.length;c++)this.removeChildRecurse(b.children[c])};
-THREE.Scene.prototype.addChild=function(b){console.warn("DEPRECATED: Scene.addChild() is now Scene.add().");this.add(b)};THREE.Scene.prototype.addObject=function(b){console.warn("DEPRECATED: Scene.addObject() is now Scene.add().");this.add(b)};THREE.Scene.prototype.addLight=function(b){console.warn("DEPRECATED: Scene.addLight() is now Scene.add().");this.add(b)};THREE.Scene.prototype.removeChild=function(b){console.warn("DEPRECATED: Scene.removeChild() is now Scene.remove().");this.remove(b)};
-THREE.Scene.prototype.removeObject=function(b){console.warn("DEPRECATED: Scene.removeObject() is now Scene.remove().");this.remove(b)};THREE.Scene.prototype.removeLight=function(b){console.warn("DEPRECATED: Scene.removeLight() is now Scene.remove().");this.remove(b)};THREE.Fog=function(b,c,d){this.color=new THREE.Color(b);this.near=c!==void 0?c:1;this.far=d!==void 0?d:1E3};THREE.FogExp2=function(b,c){this.color=new THREE.Color(b);this.density=c!==void 0?c:2.5E-4};
+THREE.Scene=function(){THREE.Object3D.call(this);this.fog=null;this.matrixAutoUpdate=!1;this.collisions=this.overrideMaterial=null;this.objects=[];this.lights=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;THREE.Scene.prototype.supr=THREE.Object3D.prototype;THREE.Scene.prototype.add=function(a){this.supr.add.call(this,a);this.addChildRecurse(a)};
+THREE.Scene.prototype.addChildRecurse=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.objects.indexOf(a)===-1){this.objects.push(a);this.__objectsAdded.push(a);var b=this.__objectsRemoved.indexOf(a);b!==-1&&this.__objectsRemoved.splice(b,1)}for(b=0;b<a.children.length;b++)this.addChildRecurse(a.children[b])};THREE.Scene.prototype.remove=function(a){this.supr.remove.call(this,a);this.removeChildRecurse(a)};
+THREE.Scene.prototype.removeChildRecurse=function(a){if(a instanceof THREE.Light){var b=this.lights.indexOf(a);b!==-1&&this.lights.splice(b,1)}else a instanceof THREE.Camera||(b=this.objects.indexOf(a),b!==-1&&(this.objects.splice(b,1),this.__objectsRemoved.push(a),b=this.__objectsAdded.indexOf(a),b!==-1&&this.__objectsAdded.splice(b,1)));for(b=0;b<a.children.length;b++)this.removeChildRecurse(a.children[b])};
+THREE.Scene.prototype.addChild=function(a){console.warn("DEPRECATED: Scene.addChild() is now Scene.add().");this.add(a)};THREE.Scene.prototype.addObject=function(a){console.warn("DEPRECATED: Scene.addObject() is now Scene.add().");this.add(a)};THREE.Scene.prototype.addLight=function(a){console.warn("DEPRECATED: Scene.addLight() is now Scene.add().");this.add(a)};THREE.Scene.prototype.removeChild=function(a){console.warn("DEPRECATED: Scene.removeChild() is now Scene.remove().");this.remove(a)};
+THREE.Scene.prototype.removeObject=function(a){console.warn("DEPRECATED: Scene.removeObject() is now Scene.remove().");this.remove(a)};THREE.Scene.prototype.removeLight=function(a){console.warn("DEPRECATED: Scene.removeLight() is now Scene.remove().");this.remove(a)};THREE.Fog=function(a,b,c){this.color=new THREE.Color(a);this.near=b!==void 0?b:1;this.far=c!==void 0?c:1E3};THREE.FogExp2=function(a,b){this.color=new THREE.Color(a);this.density=b!==void 0?b:2.5E-4};
 THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",
 envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform float flipEnvMap;\nuniform int combine;\n#endif",envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( flipEnvMap * vReflect.x, vReflect.yz ) );\n#ifdef GAMMA_INPUT\ncubeColor.xyz *= cubeColor.xyz;\n#endif\nif ( combine == 1 ) {\ngl_FragColor.xyz = mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity );\n} else {\ngl_FragColor.xyz = gl_FragColor.xyz * cubeColor.xyz;\n}\n#endif",
 envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[ 0 ].xyz, objectMatrix[ 1 ].xyz, objectMatrix[ 2 ].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",
@@ -159,7 +160,7 @@ morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\nuniform float morphTargetInflu
 default_vertex:"#ifndef USE_MORPHTARGETS\n#ifndef USE_SKINNING\ngl_Position = projectionMatrix * mvPosition;\n#endif\n#endif",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\nuniform sampler2D shadowMap[ MAX_SHADOWS ];\nuniform float shadowDarkness;\nuniform float shadowBias;\nvarying vec4 vShadowCoord[ MAX_SHADOWS ];\nfloat unpackDepth( const in vec4 rgba_depth ) {\nconst vec4 bit_shift = vec4( 1.0 / ( 256.0 * 256.0 * 256.0 ), 1.0 / ( 256.0 * 256.0 ), 1.0 / 256.0, 1.0 );\nfloat depth = dot( rgba_depth, bit_shift );\nreturn depth;\n}\n#endif",
 shadowmap_fragment:"#ifdef USE_SHADOWMAP\n#ifdef SHADOWMAP_SOFT\nconst float xPixelOffset = 1.0 / SHADOWMAP_WIDTH;\nconst float yPixelOffset = 1.0 / SHADOWMAP_HEIGHT;\n#endif\nvec3 shadowColor = vec3( 1.0 );\nfor( int i = 0; i < MAX_SHADOWS; i ++ ) {\nvec3 shadowCoord = vShadowCoord[ i ].xyz / vShadowCoord[ i ].w;\nshadowCoord.z += shadowBias;\nif ( shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0 ) {\n#ifdef SHADOWMAP_SOFT\nfloat shadow = 0.0;\nfor ( float y = -1.25; y <= 1.25; y += 1.25 )\nfor ( float x = -1.25; x <= 1.25; x += 1.25 ) {\nvec4 rgbaDepth = texture2D( shadowMap[ i ], vec2( x * xPixelOffset, y * yPixelOffset ) + shadowCoord.xy );\nfloat fDepth = unpackDepth( rgbaDepth );\nif ( fDepth < shadowCoord.z )\nshadow += 1.0;\n}\nshadow /= 9.0;\nshadowColor = shadowColor * vec3( ( 1.0 - shadowDarkness * shadow ) );\n#else\nvec4 rgbaDepth = texture2D( shadowMap[ i ], shadowCoord.xy );\nfloat fDepth = unpackDepth( rgbaDepth );\nif ( fDepth < shadowCoord.z )\nshadowColor = shadowColor * vec3( shadowDarkness );\n#endif\n}\n}\n#ifdef GAMMA_OUTPUT\nshadowColor *= shadowColor;\n#endif\ngl_FragColor.xyz = gl_FragColor.xyz * shadowColor;\n#endif",
 shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\nvarying vec4 vShadowCoord[ MAX_SHADOWS ];\nuniform mat4 shadowMatrix[ MAX_SHADOWS ];\n#endif",shadowmap_vertex:"#ifdef USE_SHADOWMAP\nfor( int i = 0; i < MAX_SHADOWS; i ++ ) {\nvShadowCoord[ i ] = shadowMatrix[ i ] * objectMatrix * vec4( position, 1.0 );\n}\n#endif",alphatest_fragment:"#ifdef ALPHATEST\nif ( gl_FragColor.a < ALPHATEST ) discard;\n#endif",linear_to_gamma_fragment:"#ifdef GAMMA_OUTPUT\ngl_FragColor.xyz = sqrt( gl_FragColor.xyz );\n#endif"};
-THREE.UniformsUtils={merge:function(b){var c,d,f,h={};for(c=0;c<b.length;c++)for(d in f=this.clone(b[c]),f)h[d]=f[d];return h},clone:function(b){var c,d,f,h={};for(c in b)for(d in h[c]={},b[c])f=b[c][d],h[c][d]=f instanceof THREE.Color||f instanceof THREE.Vector2||f instanceof THREE.Vector3||f instanceof THREE.Vector4||f instanceof THREE.Matrix4||f instanceof THREE.Texture?f.clone():f instanceof Array?f.slice():f;return h}};
+THREE.UniformsUtils={merge:function(a){var b,c,e,f={};for(b=0;b<a.length;b++)for(c in e=this.clone(a[b]),e)f[c]=e[c];return f},clone:function(a){var b,c,e,f={};for(b in a)for(c in f[b]={},a[b])e=a[b][c],f[b][c]=e instanceof THREE.Color||e instanceof THREE.Vector2||e instanceof THREE.Vector3||e instanceof THREE.Vector4||e instanceof THREE.Matrix4||e instanceof THREE.Texture?e.clone():e instanceof Array?e.slice():e;return f}};
 THREE.UniformsLib={common:{diffuse:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},map:{type:"t",value:0,texture:null},offsetRepeat:{type:"v4",value:new THREE.Vector4(0,0,1,1)},lightMap:{type:"t",value:2,texture:null},envMap:{type:"t",value:1,texture:null},flipEnvMap:{type:"f",value:-1},useRefract:{type:"i",value:0},reflectivity:{type:"f",value:1},refractionRatio:{type:"f",value:0.98},combine:{type:"i",value:0},morphTargetInfluences:{type:"f",value:0}},fog:{fogDensity:{type:"f",
 value:2.5E-4},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)}},lights:{enableLighting:{type:"i",value:1},ambientLightColor:{type:"fv",value:[]},directionalLightDirection:{type:"fv",value:[]},directionalLightColor:{type:"fv",value:[]},pointLightColor:{type:"fv",value:[]},pointLightPosition:{type:"fv",value:[]},pointLightDistance:{type:"fv1",value:[]}},particle:{psColor:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},size:{type:"f",
 value:1},scale:{type:"f",value:1},map:{type:"t",value:0,texture:null},fogDensity:{type:"f",value:2.5E-4},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)}},shadowmap:{shadowMap:{type:"tv",value:6,texture:[]},shadowMatrix:{type:"m4v",value:[]},shadowBias:{type:"f",value:0.0039},shadowDarkness:{type:"f",value:0.2}}};
@@ -179,125 +180,123 @@ THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.lights_phong_fragment,THR
 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,s=j.length,p=b.colors,k=p.length,B=b.__vertexArray,m=b.__colorArray,n=b.__sortArray,x=b.__dirtyVertices,r=b.__dirtyColors,o=b.__webglCustomAttributesList,E;if(o){h=0;for(f=o.length;h<f;h++)o[h].offset=0}if(d.sortParticles){Ea.multiplySelf(d.matrixWorld);for(f=0;f<s;f++)i=j[f].position,Ja.copy(i),Ea.multiplyVector3(Ja),n[f]=[Ja.z,f];n.sort(function(b,e){return e[0]-b[0]});for(f=0;f<s;f++)i=j[n[f][1]].position,h=f*3,B[h]=i.x,B[h+
-1]=i.y,B[h+2]=i.z;for(f=0;f<k;f++)h=f*3,color=p[n[f][1]],m[h]=color.r,m[h+1]=color.g,m[h+2]=color.b;if(o){h=0;for(f=o.length;h<f;h++){s=o[h];k=s.value.length;for(p=0;p<k;p++){index=n[p][1];j=s.offset;if(s.size===1){if(s.boundTo===void 0||s.boundTo==="vertices")s.array[j]=s.value[index]}else{if(s.boundTo===void 0||s.boundTo==="vertices")E=s.value[index];s.size===2?(s.array[j]=E.x,s.array[j+1]=E.y):s.size===3?s.type==="c"?(s.array[j]=E.r,s.array[j+1]=E.g,s.array[j+2]=E.b):(s.array[j]=E.x,s.array[j+
-1]=E.y,s.array[j+2]=E.z):(s.array[j]=E.x,s.array[j+1]=E.y,s.array[j+2]=E.z,s.array[j+3]=E.w)}s.offset+=s.size}}}}else{if(x)for(f=0;f<s;f++)i=j[f].position,h=f*3,B[h]=i.x,B[h+1]=i.y,B[h+2]=i.z;if(r)for(f=0;f<k;f++)color=p[f],h=f*3,m[h]=color.r,m[h+1]=color.g,m[h+2]=color.b;if(o){h=0;for(f=o.length;h<f;h++)if(s=o[h],s.__original.needsUpdate){k=s.value.length;for(p=0;p<k;p++){j=s.offset;if(s.size===1){if(s.boundTo===void 0||s.boundTo==="vertices")s.array[j]=s.value[p]}else{if(s.boundTo===void 0||s.boundTo===
-"vertices")E=s.value[p];s.size===2?(s.array[j]=E.x,s.array[j+1]=E.y):s.size===3?s.type==="c"?(s.array[j]=E.r,s.array[j+1]=E.g,s.array[j+2]=E.b):(s.array[j]=E.x,s.array[j+1]=E.y,s.array[j+2]=E.z):(s.array[j]=E.x,s.array[j+1]=E.y,s.array[j+2]=E.z,s.array[j+3]=E.w)}s.offset+=s.size}}}}if(x||d.sortParticles)e.bindBuffer(e.ARRAY_BUFFER,b.__webglVertexBuffer),e.bufferData(e.ARRAY_BUFFER,B,c);if(r||d.sortParticles)e.bindBuffer(e.ARRAY_BUFFER,b.__webglColorBuffer),e.bufferData(e.ARRAY_BUFFER,m,c);if(o){h=
-0;for(f=o.length;h<f;h++)if(s=o[h],s.__original.needsUpdate||d.sortParticles)e.bindBuffer(e.ARRAY_BUFFER,s.buffer),e.bufferData(e.ARRAY_BUFFER,s.array,c)}}function d(b,c,d,f,i){f.program||J.initMaterial(f,c,d,i);if(f.morphTargets&&!i.__webglMorphTargetInfluences){i.__webglMorphTargetInfluences=new Float32Array(J.maxMorphTargets);for(var h=0,j=J.maxMorphTargets;h<j;h++)i.__webglMorphTargetInfluences[h]=0}var s=!1,h=f.program,j=h.uniforms,p=f.uniforms;h!=Ya&&(e.useProgram(h),Ya=h,s=!0);if(f.id!=W)W=
-f.id,s=!0;if(s){e.uniformMatrix4fv(j.projectionMatrix,!1,Va);if(d&&f.fog)if(p.fogColor.value=d.color,d instanceof THREE.Fog)p.fogNear.value=d.near,p.fogFar.value=d.far;else if(d instanceof THREE.FogExp2)p.fogDensity.value=d.density;if(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f.lights){for(var k,B,m=0,n=0,x=0,r,o,E,v=$a,w=v.directional.colors,u=v.directional.positions,C=v.point.colors,A=v.point.positions,F=v.point.distances,H=0,G=0,d=k=E=0,s=c.length;d<s;d++)if(k=
-c[d],B=k.color,r=k.position,o=k.intensity,E=k.distance,k instanceof THREE.AmbientLight)J.gammaInput?(m+=B.r*B.r,n+=B.g*B.g,x+=B.b*B.b):(m+=B.r,n+=B.g,x+=B.b);else if(k instanceof THREE.DirectionalLight)E=H*3,J.gammaInput?(w[E]=B.r*B.r*o*o,w[E+1]=B.g*B.g*o*o,w[E+2]=B.b*B.b*o*o):(w[E]=B.r*o,w[E+1]=B.g*o,w[E+2]=B.b*o),u[E]=r.x,u[E+1]=r.y,u[E+2]=r.z,H+=1;else if(k instanceof THREE.SpotLight)E=H*3,J.gammaInput?(w[E]=B.r*B.r*o*o,w[E+1]=B.g*B.g*o*o,w[E+2]=B.b*B.b*o*o):(w[E]=B.r*o,w[E+1]=B.g*o,w[E+2]=B.b*
-o),B=1/r.length(),u[E]=r.x*B,u[E+1]=r.y*B,u[E+2]=r.z*B,H+=1;else if(k instanceof THREE.PointLight)k=G*3,J.gammaInput?(C[k]=B.r*B.r*o*o,C[k+1]=B.g*B.g*o*o,C[k+2]=B.b*B.b*o*o):(C[k]=B.r*o,C[k+1]=B.g*o,C[k+2]=B.b*o),A[k]=r.x,A[k+1]=r.y,A[k+2]=r.z,F[G]=E,G+=1;d=H*3;for(s=w.length;d<s;d++)w[d]=0;d=G*3;for(s=C.length;d<s;d++)C[d]=0;v.point.length=G;v.directional.length=H;v.ambient[0]=m;v.ambient[1]=n;v.ambient[2]=x;c=$a;p.enableLighting.value=c.directional.length+c.point.length;p.ambientLightColor.value=
-c.ambient;p.directionalLightColor.value=c.directional.colors;p.directionalLightDirection.value=c.directional.positions;p.pointLightColor.value=c.point.colors;p.pointLightPosition.value=c.point.positions;p.pointLightDistance.value=c.point.distances}if(f instanceof THREE.MeshBasicMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshPhongMaterial)p.opacity.value=f.opacity,J.gammaInput?p.diffuse.value.copyGammaToLinear(f.color):p.diffuse.value=f.color,(p.map.texture=f.map)&&p.offsetRepeat.value.set(f.map.offset.x,
-f.map.offset.y,f.map.repeat.x,f.map.repeat.y),p.lightMap.texture=f.lightMap,p.envMap.texture=f.envMap,p.flipEnvMap.value=f.envMap instanceof THREE.WebGLRenderTargetCube?1:-1,p.reflectivity.value=f.reflectivity,p.refractionRatio.value=f.refractionRatio,p.combine.value=f.combine,p.useRefract.value=f.envMap&&f.envMap.mapping instanceof THREE.CubeRefractionMapping;if(f instanceof THREE.LineBasicMaterial)p.diffuse.value=f.color,p.opacity.value=f.opacity;else if(f instanceof THREE.ParticleBasicMaterial)p.psColor.value=
-f.color,p.opacity.value=f.opacity,p.size.value=f.size,p.scale.value=Ba.height/2,p.map.texture=f.map;else if(f instanceof THREE.MeshPhongMaterial)p.shininess.value=f.shininess,J.gammaInput?(p.ambient.value.copyGammaToLinear(f.ambient),p.specular.value.copyGammaToLinear(f.specular)):(p.ambient.value=f.ambient,p.specular.value=f.specular);else if(f instanceof THREE.MeshLambertMaterial)J.gammaInput?p.ambient.value.copyGammaToLinear(f.ambient):p.ambient.value=f.ambient;else if(f instanceof THREE.MeshDepthMaterial)p.mNear.value=
-b.near,p.mFar.value=b.far,p.opacity.value=f.opacity;else if(f instanceof THREE.MeshNormalMaterial)p.opacity.value=f.opacity;if(i.receiveShadow&&!f._shadowPass&&p.shadowMatrix){for(c=0;c<Ua.length;c++)p.shadowMatrix.value[c]=Ua[c],p.shadowMap.texture[c]=J.shadowMap[c];p.shadowDarkness.value=J.shadowMapDarkness;p.shadowBias.value=J.shadowMapBias}c=f.uniformsList;p=0;for(d=c.length;p<d;p++)if(n=h.uniforms[c[p][1]])if(m=c[p][0],x=m.type,s=m.value,x=="i")e.uniform1i(n,s);else if(x=="f")e.uniform1f(n,s);
-else if(x=="v2")e.uniform2f(n,s.x,s.y);else if(x=="v3")e.uniform3f(n,s.x,s.y,s.z);else if(x=="v4")e.uniform4f(n,s.x,s.y,s.z,s.w);else if(x=="c")e.uniform3f(n,s.r,s.g,s.b);else if(x=="fv1")e.uniform1fv(n,s);else if(x=="fv")e.uniform3fv(n,s);else if(x=="v3v"){if(!m._array)m._array=new Float32Array(3*s.length);x=0;for(r=s.length;x<r;x++)v=x*3,m._array[v]=s[x].x,m._array[v+1]=s[x].y,m._array[v+2]=s[x].z;e.uniform3fv(n,m._array)}else if(x=="m4"){if(!m._array)m._array=new Float32Array(16);s.flattenToArray(m._array);
-e.uniformMatrix4fv(n,!1,m._array)}else if(x=="m4v"){if(!m._array)m._array=new Float32Array(16*s.length);x=0;for(r=s.length;x<r;x++)s[x].flattenToArrayOffset(m._array,x*16);e.uniformMatrix4fv(n,!1,m._array)}else if(x=="t"){if(e.uniform1i(n,s),n=m.texture)if(n.image instanceof Array&&n.image.length==6){if(m=n,m.image.length==6)if(m.needsUpdate){if(!m.image.__webglTextureCube)m.image.__webglTextureCube=e.createTexture();e.activeTexture(e.TEXTURE0+s);e.bindTexture(e.TEXTURE_CUBE_MAP,m.image.__webglTextureCube);
-for(s=0;s<6;s++)e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+s,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,m.image[s]);D(e.TEXTURE_CUBE_MAP,m,m.image[0]);m.needsUpdate=!1}else e.activeTexture(e.TEXTURE0+s),e.bindTexture(e.TEXTURE_CUBE_MAP,m.image.__webglTextureCube)}else n instanceof THREE.WebGLRenderTargetCube?(m=n,e.activeTexture(e.TEXTURE0+s),e.bindTexture(e.TEXTURE_CUBE_MAP,m.__webglTexture)):ka(n,s)}else if(x=="tv"){if(!m._array){m._array=[];x=0;for(r=m.texture.length;x<r;x++)m._array[x]=s+x}e.uniform1iv(n,
-m._array);x=0;for(r=m.texture.length;x<r;x++)(n=m.texture[x])&&ka(n,m._array[x])}(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,s,f=d(b,c,f,i,j),b=f.attributes,c=!1,f=h.id*16777215+f.id*2+(i.wireframe?1:0);f!=
-G&&(G=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){k=
-0;var p=j.morphTargetForcedOrder;for(s=j.morphTargetInfluences;k<i.numSupportedMorphTargets&&k<p.length;)e.bindBuffer(e.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[p[k]]),e.vertexAttribPointer(f["morphTarget"+k],3,e.FLOAT,!1,0,0),j.__webglMorphTargetInfluences[k]=s[p[k]],k++}else{var p=[],m=-1,B=0;s=j.morphTargetInfluences;var n,o=s.length;k=0;for(j.morphTargetBase!==-1&&(p[j.morphTargetBase]=!0);k<i.numSupportedMorphTargets;){for(n=0;n<o;n++)!p[n]&&s[n]>m&&(B=n,m=s[B]);e.bindBuffer(e.ARRAY_BUFFER,
-h.__webglMorphTargetsBuffers[B]);e.vertexAttribPointer(f["morphTarget"+k],3,e.FLOAT,!1,0,0);j.__webglMorphTargetInfluences[k]=m;p[B]=1;m=-1;k++}}i.program.uniforms.morphTargetInfluences!==null&&e.uniform1fv(i.program.uniforms.morphTargetInfluences,j.__webglMorphTargetInfluences)}if(c){if(h.__webglCustomAttributesList){k=0;for(s=h.__webglCustomAttributesList.length;k<s;k++)f=h.__webglCustomAttributesList[k],b[f.buffer.belongsToAttribute]>=0&&(e.bindBuffer(e.ARRAY_BUFFER,f.buffer),e.vertexAttribPointer(b[f.buffer.belongsToAttribute],
-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)),J.info.render.calls++,J.info.render.vertices+=h.__webglFaceCount,J.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),J.info.render.calls++):j instanceof THREE.ParticleSystem?(e.drawArrays(e.POINTS,0,h.__webglParticleCount),J.info.render.calls++):j instanceof THREE.Ribbon&&(e.drawArrays(e.TRIANGLE_STRIP,0,h.__webglVertexCount),J.info.render.calls++)}}
-function h(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,s,p,k,m,n,o,r=b.count*
-3;for(o=0;o<r;o+=9)d=b.normalArray,f=d[o],h=d[o+1],i=d[o+2],j=d[o+3],p=d[o+4],m=d[o+5],s=d[o+6],k=d[o+7],n=d[o+8],f=(f+j+s)/3,h=(h+p+k)/3,i=(i+m+n)/3,d[o]=f,d[o+1]=h,d[o+2]=i,d[o+3]=f,d[o+4]=h,d[o+5]=i,d[o+6]=f,d[o+7]=h,d[o+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 i(b){if(X!=b.doubleSided)b.doubleSided?e.disable(e.CULL_FACE):
-e.enable(e.CULL_FACE),X=b.doubleSided;if(qa!=b.flipSided)b.flipSided?e.frontFace(e.CW):e.frontFace(e.CCW),qa=b.flipSided}function j(b){N!=b&&(b?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST),N=b)}function k(b){za!=b&&(e.depthMask(b),za=b)}function n(b,c,d){Ha!=b&&(b?e.enable(e.POLYGON_OFFSET_FILL):e.disable(e.POLYGON_OFFSET_FILL),Ha=b);if(b&&(Sa!=c||Ta!=d))e.polygonOffset(c,d),Sa=c,Ta=d}function m(b){wa[0].set(b.n41-b.n11,b.n42-b.n12,b.n43-b.n13,b.n44-b.n14);wa[1].set(b.n41+b.n11,b.n42+b.n12,b.n43+
-b.n13,b.n44+b.n14);wa[2].set(b.n41+b.n21,b.n42+b.n22,b.n43+b.n23,b.n44+b.n24);wa[3].set(b.n41-b.n21,b.n42-b.n22,b.n43-b.n23,b.n44-b.n24);wa[4].set(b.n41-b.n31,b.n42-b.n32,b.n43-b.n33,b.n44-b.n34);wa[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=wa[b],c.divideScalar(Math.sqrt(c.x*c.x+c.y*c.y+c.z*c.z))}function r(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=wa[d].x*c.n14+wa[d].y*c.n24+
-wa[d].z*c.n34+wa[d].w,b<=e)return!1;return!0}function o(b,c){b.list[b.count]=c;b.count+=1}function v(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?o(h,e):o(f,e)}function w(b){var c,e,d,f,h=b.object,i=b.buffer,j=b.opaque,p=b.transparent;p.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?
-o(p,f):o(j,f))}else(f=c)&&(f.transparent?o(p,f):o(j,f))}function A(b,c){return c.z-b.z}function F(b){var c,k,o,K=0,n,ra,s,p,v=b.lights;Z||(Z=new THREE.PerspectiveCamera(J.shadowCameraFov,J.shadowMapWidth/J.shadowMapHeight,J.shadowCameraNear,J.shadowCameraFar));c=0;for(k=v.length;c<k;c++)if(o=v[c],o instanceof THREE.SpotLight&&o.castShadow){W=-1;J.shadowMap[K]||(J.shadowMap[K]=new THREE.WebGLRenderTarget(J.shadowMapWidth,J.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,
-format:THREE.RGBAFormat}));Ua[K]||(Ua[K]=new THREE.Matrix4);n=J.shadowMap[K];ra=Ua[K];Z.position.copy(o.position);Z.lookAt(o.target.position);Z.update(void 0,!0);b.update(void 0,!1,Z);ra.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);ra.multiplySelf(Z.projectionMatrix);ra.multiplySelf(Z.matrixWorldInverse);Z.matrixWorldInverse.flattenToArray(Wa);Z.projectionMatrix.flattenToArray(Va);Ea.multiply(Z.projectionMatrix,Z.matrixWorldInverse);m(Ea);J.initWebGLObjects(b);S(n);e.clearColor(1,1,1,1);J.clear();
-e.clearColor(ta.r,ta.g,ta.b,Fa);ra=b.__webglObjects.length;o=b.__webglObjectsImmediate.length;for(n=0;n<ra;n++)s=b.__webglObjects[n],p=s.object,p.visible&&p.castShadow?!(p instanceof THREE.Mesh)||!p.frustumCulled||r(p)?(p.matrixWorld.flattenToArray(p._objectMatrixArray),H(p,Z,!1),s.render=!0):s.render=!1:s.render=!1;j(!0);O(THREE.NormalBlending);for(n=0;n<ra;n++)if(s=b.__webglObjects[n],s.render)p=s.object,buffer=s.buffer,i(p),s=p.customDepthMaterial?p.customDepthMaterial:p.geometry.morphTargets.length?
-ab:Xa,f(Z,v,null,s,buffer,p);for(n=0;n<o;n++)s=b.__webglObjectsImmediate[n],p=s.object,p.visible&&p.castShadow&&(p.matrixAutoUpdate&&p.matrixWorld.flattenToArray(p._objectMatrixArray),G=-1,H(p,Z,!1),i(p),program=d(Z,v,null,Xa,p),p.immediateRenderCallback?p.immediateRenderCallback(program,e,wa):p.render(function(b){h(b,program,Xa.shading)}));K++}}function L(b,c){var d,f,h;d=u.attributes;var i=u.uniforms,j=Ra/Aa,s,p=[],k=Aa*0.5,m=Ra*0.5,n=!0;e.useProgram(u.program);Ya=u.program;G=N=Y=-1;bb||(e.enableVertexAttribArray(u.attributes.position),
-e.enableVertexAttribArray(u.attributes.uv),bb=!0);e.disable(e.CULL_FACE);e.enable(e.BLEND);e.depthMask(!0);e.bindBuffer(e.ARRAY_BUFFER,u.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,u.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(A);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-k)/k,(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)),s=h.map.image.width/(h.scaleByViewport?Ra:1),p[0]=s*j*h.scale.x,p[1]=s*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,p),
-h.mergeWith3D&&!n?(e.enable(e.DEPTH_TEST),n=!0):!h.mergeWith3D&&n&&(e.disable(e.DEPTH_TEST),n=!1),O(h.blending),ka(h.map,0),e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0));e.enable(e.CULL_FACE);e.enable(e.DEPTH_TEST);e.depthMask(za)}function H(b,c,e){b._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);e&&THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}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)if(d.attributes[c].needsUpdate)return!0;return!1}function ya(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 ja(b,c){var e;for(e=b.length-1;e>=0;e--)b[e].object==c&&b.splice(e,1)}function sa(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,m,n={},o=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),n[k]==void 0&&(n[k]={hash:k,counter:0}),m=n[k].hash+"_"+n[k].counter,b.geometryGroups[m]==void 0&&(b.geometryGroups[m]={faces:[],materials:j,vertices:0,numMorphTargets:o}),i=i instanceof THREE.Face3?3:4,b.geometryGroups[m].vertices+i>65535&&(n[k].counter+=1,m=n[k].hash+"_"+n[k].counter,b.geometryGroups[m]==void 0&&(b.geometryGroups[m]={faces:[],materials:j,vertices:0,numMorphTargets:o})),
-b.geometryGroups[m].faces.push(f),b.geometryGroups[m].vertices+=i;b.geometryGroupsList=[];for(var r in b.geometryGroups)b.geometryGroups[r].id=T++,b.geometryGroupsList.push(b.geometryGroups[r])}function ha(b,c,e){b.push({buffer:c,object:e,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function O(b){if(b!=Y){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)}Y=b}}function D(b,c,d){(d.width&d.width-1)==0&&(d.height&d.height-1)==0?(e.texParameteri(b,e.TEXTURE_WRAP_S,aa(c.wrapS)),e.texParameteri(b,e.TEXTURE_WRAP_T,aa(c.wrapT)),e.texParameteri(b,e.TEXTURE_MAG_FILTER,aa(c.magFilter)),e.texParameteri(b,e.TEXTURE_MIN_FILTER,
-aa(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,Ca(c.magFilter)),e.texParameteri(b,e.TEXTURE_MIN_FILTER,Ca(c.minFilter)))}function ka(b,c){if(b.needsUpdate){if(!b.__webglInit)b.__webglInit=!0,b.__webglTexture=e.createTexture(),J.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,aa(b.format),b.image.width,b.image.height,0,aa(b.format),e.UNSIGNED_BYTE,b.image.data):e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,b.image);D(e.TEXTURE_2D,b,b.image);b.needsUpdate=!1}else e.activeTexture(e.TEXTURE0+c),e.bindTexture(e.TEXTURE_2D,b.__webglTexture)}function M(b,c){e.bindRenderbuffer(e.RENDERBUFFER,b);c.depthBuffer&&!c.stencilBuffer?(e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_COMPONENT16,c.width,c.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,
-b)):c.depthBuffer&&c.stencilBuffer?(e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_STENCIL,c.width,c.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,b)):e.renderbufferStorage(e.RENDERBUFFER,e.RGBA4,c.width,c.height)}function S(b){var c=b instanceof THREE.WebGLRenderTargetCube;if(b&&!b.__webglFramebuffer){if(b.depthBuffer===void 0)b.depthBuffer=!0;if(b.stencilBuffer===void 0)b.stencilBuffer=!0;b.__webglTexture=e.createTexture();if(c){b.__webglFramebuffer=[];
-b.__webglRenderbuffer=[];e.bindTexture(e.TEXTURE_CUBE_MAP,b.__webglTexture);D(e.TEXTURE_CUBE_MAP,b,b);for(var d=0;d<6;d++){b.__webglFramebuffer[d]=e.createFramebuffer();b.__webglRenderbuffer[d]=e.createRenderbuffer();e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+d,0,aa(b.format),b.width,b.height,0,aa(b.format),aa(b.type),null);var f=b,h=e.TEXTURE_CUBE_MAP_POSITIVE_X+d;e.bindFramebuffer(e.FRAMEBUFFER,b.__webglFramebuffer[d]);e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,h,f.__webglTexture,
-0);M(b.__webglRenderbuffer[d],b)}}else b.__webglFramebuffer=e.createFramebuffer(),b.__webglRenderbuffer=e.createRenderbuffer(),e.bindTexture(e.TEXTURE_2D,b.__webglTexture),D(e.TEXTURE_2D,b,b),e.texImage2D(e.TEXTURE_2D,0,aa(b.format),b.width,b.height,0,aa(b.format),aa(b.type),null),d=e.TEXTURE_2D,e.bindFramebuffer(e.FRAMEBUFFER,b.__webglFramebuffer),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,d,b.__webglTexture,0),e.bindRenderbuffer(e.RENDERBUFFER,b.__webglRenderbuffer),M(b.__webglRenderbuffer,
-b);c?e.bindTexture(e.TEXTURE_CUBE_MAP,null):e.bindTexture(e.TEXTURE_2D,null);e.bindRenderbuffer(e.RENDERBUFFER,null);e.bindFramebuffer(e.FRAMEBUFFER,null)}b?(c=c?b.__webglFramebuffer[b.activeCubeFace]:b.__webglFramebuffer,d=b.width,b=b.height,h=f=0):(c=null,d=Aa,b=Ra,f=va,h=Da);c!=U&&(e.bindFramebuffer(e.FRAMEBUFFER,c),e.viewport(f,h,d,b),U=c)}function la(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 ia(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 Ca(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return e.NEAREST;
-default:return e.LINEAR}}function aa(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 J=this,e,La=[],Ya=null,U=null,W=-1,G=null,T=0,X=null,qa=null,Y=null,N=null,za=null,Ha=null,Sa=null,Ta=null,va=0,Da=0,Aa=0,Ra=0,wa=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Ea=new THREE.Matrix4,Va=new Float32Array(16),Wa=new Float32Array(16),Ja=new THREE.Vector4,$a={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"),
-P=b.stencil!==void 0?b.stencil:!0,eb=b.preserveDrawingBuffer!==void 0?b.preserveDrawingBuffer:!1,fb=b.antialias!==void 0?b.antialias:!1,ta=b.clearColor!==void 0?new THREE.Color(b.clearColor):new THREE.Color(0),Fa=b.clearAlpha!==void 0?b.clearAlpha:0,Za=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.autoClearStencil=this.autoClearDepth=this.autoClearColor=
-this.autoClear=!0;this.physicallyBasedShading=this.gammaOutput=this.gammaInput=!1;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=this.shadowMapAutoUpdate=!0;var Z,Ua=[],b=THREE.ShaderLib.depthRGBA,cb=THREE.UniformsUtils.clone(b.uniforms),Xa=new THREE.ShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,
-uniforms:cb}),ab=new THREE.ShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:cb,morphTargets:!0});Xa._shadowPass=!0;ab._shadowPass=!0;try{if(!(e=Ba.getContext("experimental-webgl",{antialias:fb,stencil:P,preserveDrawingBuffer:eb})))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(gb){console.error(gb)}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(ta.r,ta.g,ta.b,Fa);this.context=e;var db=e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,u={};u.vertices=new Float32Array(16);u.faces=new Uint16Array(6);P=0;u.vertices[P++]=-1;u.vertices[P++]=-1;u.vertices[P++]=0;u.vertices[P++]=1;u.vertices[P++]=
-1;u.vertices[P++]=-1;u.vertices[P++]=1;u.vertices[P++]=1;u.vertices[P++]=1;u.vertices[P++]=1;u.vertices[P++]=1;u.vertices[P++]=0;u.vertices[P++]=-1;u.vertices[P++]=1;u.vertices[P++]=0;P=u.vertices[P++]=0;u.faces[P++]=0;u.faces[P++]=1;u.faces[P++]=2;u.faces[P++]=0;u.faces[P++]=2;u.faces[P++]=3;u.vertexBuffer=e.createBuffer();u.elementBuffer=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,u.vertexBuffer);e.bufferData(e.ARRAY_BUFFER,u.vertices,e.STATIC_DRAW);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,u.elementBuffer);
-e.bufferData(e.ELEMENT_ARRAY_BUFFER,u.faces,e.STATIC_DRAW);u.program=e.createProgram();e.attachShader(u.program,ia("fragment",THREE.ShaderLib.sprite.fragmentShader));e.attachShader(u.program,ia("vertex",THREE.ShaderLib.sprite.vertexShader));e.linkProgram(u.program);u.attributes={};u.uniforms={};u.attributes.position=e.getAttribLocation(u.program,"position");u.attributes.uv=e.getAttribLocation(u.program,"uv");u.uniforms.uvOffset=e.getUniformLocation(u.program,"uvOffset");u.uniforms.uvScale=e.getUniformLocation(u.program,
-"uvScale");u.uniforms.rotation=e.getUniformLocation(u.program,"rotation");u.uniforms.scale=e.getUniformLocation(u.program,"scale");u.uniforms.alignment=e.getUniformLocation(u.program,"alignment");u.uniforms.color=e.getUniformLocation(u.program,"color");u.uniforms.map=e.getUniformLocation(u.program,"map");u.uniforms.opacity=e.getUniformLocation(u.program,"opacity");u.uniforms.useScreenCoordinates=e.getUniformLocation(u.program,"useScreenCoordinates");u.uniforms.affectedByDistance=e.getUniformLocation(u.program,
-"affectedByDistance");u.uniforms.screenPosition=e.getUniformLocation(u.program,"screenPosition");u.uniforms.modelViewMatrix=e.getUniformLocation(u.program,"modelViewMatrix");u.uniforms.projectionMatrix=e.getUniformLocation(u.program,"projectionMatrix");var bb=!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){va=b;Da=c;Aa=d;Ra=f;e.viewport(va,Da,Aa,Ra)};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){ta.setHex(b);Fa=c;e.clearColor(ta.r,ta.g,ta.b,Fa)};this.setClearColor=function(b,c){ta.copy(b);Fa=c;e.clearColor(ta.r,ta.g,ta.b,Fa)};this.getClearColor=function(){return ta};this.getClearAlpha=function(){return Fa};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]);J.info.memory.geometries--}else if(b instanceof THREE.Ribbon)b=b.geometry,e.deleteBuffer(b.__webglVertexBuffer),e.deleteBuffer(b.__webglColorBuffer),J.info.memory.geometries--;else if(b instanceof
-THREE.Line)b=b.geometry,e.deleteBuffer(b.__webglVertexBuffer),e.deleteBuffer(b.__webglColorBuffer),J.info.memory.geometries--;else if(b instanceof THREE.ParticleSystem)b=b.geometry,e.deleteBuffer(b.__webglVertexBuffer),e.deleteBuffer(b.__webglColorBuffer),J.info.memory.geometries--};this.deallocateTexture=function(b){if(b.__webglInit)b.__webglInit=!1,e.deleteTexture(b.__webglTexture),J.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 p=THREE.ShaderLib[k];b.uniforms=THREE.UniformsUtils.clone(p.uniforms);b.vertexShader=p.vertexShader;b.fragmentShader=p.fragmentShader}var m,n,o;m=o=p=0;for(n=c.length;m<n;m++)j=c[m],j instanceof
-THREE.SpotLight&&o++,j instanceof THREE.DirectionalLight&&o++,j instanceof THREE.PointLight&&p++;p+o<=Za?m=o:(m=Math.ceil(Za*o/(p+o)),p=Za-m);j={directional:m,point:p};p=o=0;for(m=c.length;p<m;p++)n=c[p],n instanceof THREE.SpotLight&&n.castShadow&&o++;var r=50;if(f!==void 0&&f instanceof THREE.SkinnedMesh)r=f.bones.length;var x;a:{m=b.fragmentShader;n=b.vertexShader;var p=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:r,shadowMapEnabled:this.shadowMapEnabled&&f.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:o,alphaTest:b.alphaTest,metal:b.metal,perPixel:b.perPixel},v,f=[];k?f.push(k):(f.push(m),f.push(n));for(v in d)f.push(v),f.push(d[v]);k=f.join();v=0;
-for(f=La.length;v<f;v++)if(La[v].code==k){x=La[v].program;break a}v=e.createProgram();f=[db?"#define VERTEX_TEXTURES":"",J.gammaInput?"#define GAMMA_INPUT":"",J.gammaOutput?"#define GAMMA_OUTPUT":"",J.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"","#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:"",J.gammaInput?"#define GAMMA_INPUT":"",J.gammaOutput?"#define GAMMA_OUTPUT":"",J.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"",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.metal?"#define METAL":"",d.perPixel?"#define PHONG_PER_PIXEL":"",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(v,ia("fragment",j+m));e.attachShader(v,
-ia("vertex",f+n));e.linkProgram(v);e.getProgramParameter(v,e.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+e.getProgramParameter(v,e.VALIDATE_STATUS)+", gl error ["+e.getError()+"]");v.uniforms={};v.attributes={};var w,f=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(w in p)f.push(w);w=f;f=0;for(p=w.length;f<p;f++)m=w[f],v.uniforms[m]=e.getUniformLocation(v,
-m);f=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(w=0;w<d.maxMorphTargets;w++)f.push("morphTarget"+w);for(x in c)f.push(x);x=f;w=0;for(c=x.length;w<c;w++)d=x[w],v.attributes[d]=e.getAttribLocation(v,d);v.id=La.length;La.push({program:v,code:k});J.info.memory.programs=La.length;x=v}b.program=x;x=b.program.attributes;x.position>=0&&e.enableVertexAttribArray(x.position);x.color>=0&&e.enableVertexAttribArray(x.color);x.normal>=0&&e.enableVertexAttribArray(x.normal);
-x.tangent>=0&&e.enableVertexAttribArray(x.tangent);b.skinning&&x.skinVertexA>=0&&x.skinVertexB>=0&&x.skinIndex>=0&&x.skinWeight>=0&&(e.enableVertexAttribArray(x.skinVertexA),e.enableVertexAttribArray(x.skinVertexB),e.enableVertexAttribArray(x.skinIndex),e.enableVertexAttribArray(x.skinWeight));if(b.attributes)for(i in b.attributes)x[i]!==void 0&&x[i]>=0&&e.enableVertexAttribArray(x[i]);if(b.morphTargets)for(i=b.numSupportedMorphTargets=0;i<this.maxMorphTargets;i++)w="morphTarget"+i,x[w]>=0&&(e.enableVertexAttribArray(x[w]),
-b.numSupportedMorphTargets++);b.uniformsList=[];for(h in b.uniforms)b.uniformsList.push([b.uniforms[h],h])};this.clearTarget=function(b,c,d,e){S(b);this.clear(c,d,e)};this.updateShadowMap=function(b,c){F(b,c)};this.render=function(b,c,o,u){var K,Ia,ra,s,p,D,B,Pa,Qa=b.lights,x=b.fog;W=-1;this.shadowMapEnabled&&this.shadowMapAutoUpdate&&F(b,c);J.info.render.calls=0;J.info.render.vertices=0;J.info.render.faces=0;if(c.matrixAutoUpdate){for(p=c;p.parent;)p=p.parent;p.update(void 0,!0)}b.update(void 0,
-!1,c);c.matrixWorldInverse.flattenToArray(Wa);c.projectionMatrix.flattenToArray(Va);Ea.multiply(c.projectionMatrix,c.matrixWorldInverse);m(Ea);this.initWebGLObjects(b);S(o);(this.autoClear||u)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);p=b.__webglObjects.length;for(u=0;u<p;u++)if(K=b.__webglObjects[u],B=K.object,B.visible)if(!(B instanceof THREE.Mesh)||!B.frustumCulled||r(B)){if(B.matrixWorld.flattenToArray(B._objectMatrixArray),H(B,c,!0),w(K),K.render=!0,this.sortObjects)K.object.renderDepth?
-K.z=K.object.renderDepth:(Ja.copy(B.position),Ea.multiplyVector3(Ja),K.z=Ja.z)}else K.render=!1;else K.render=!1;this.sortObjects&&b.__webglObjects.sort(A);D=b.__webglObjectsImmediate.length;for(u=0;u<D;u++)K=b.__webglObjectsImmediate[u],B=K.object,B.visible&&(B.matrixAutoUpdate&&B.matrixWorld.flattenToArray(B._objectMatrixArray),H(B,c,!0),v(K));if(b.overrideMaterial){j(b.overrideMaterial.depthTest);O(b.overrideMaterial.blending);for(u=0;u<p;u++)if(K=b.__webglObjects[u],K.render)B=K.object,Pa=K.buffer,
-i(B),f(c,Qa,x,b.overrideMaterial,Pa,B);for(u=0;u<D;u++)K=b.__webglObjectsImmediate[u],B=K.object,B.visible&&(G=-1,i(B),Ia=d(c,Qa,x,b.overrideMaterial,B),B.immediateRenderCallback?B.immediateRenderCallback(Ia,e,wa):B.render(function(c){h(c,Ia,b.overrideMaterial.shading)}))}else{O(THREE.NormalBlending);for(u=p-1;u>=0;u--)if(K=b.__webglObjects[u],K.render){B=K.object;Pa=K.buffer;ra=K.opaque;i(B);for(K=0;K<ra.count;K++)s=ra.list[K],j(s.depthTest),k(s.depthWrite),n(s.polygonOffset,s.polygonOffsetFactor,
-s.polygonOffsetUnits),f(c,Qa,x,s,Pa,B)}for(u=0;u<D;u++)if(K=b.__webglObjectsImmediate[u],B=K.object,B.visible){G=-1;ra=K.opaque;i(B);for(K=0;K<ra.count;K++)s=ra.list[K],j(s.depthTest),k(s.depthWrite),n(s.polygonOffset,s.polygonOffsetFactor,s.polygonOffsetUnits),Ia=d(c,Qa,x,s,B),B.immediateRenderCallback?B.immediateRenderCallback(Ia,e,wa):B.render(function(b){h(b,Ia,s.shading)})}for(u=0;u<p;u++)if(K=b.__webglObjects[u],K.render){B=K.object;Pa=K.buffer;ra=K.transparent;i(B);for(K=0;K<ra.count;K++)s=
-ra.list[K],O(s.blending),j(s.depthTest),k(s.depthWrite),n(s.polygonOffset,s.polygonOffsetFactor,s.polygonOffsetUnits),f(c,Qa,x,s,Pa,B)}for(u=0;u<D;u++)if(K=b.__webglObjectsImmediate[u],B=K.object,B.visible){G=-1;ra=K.transparent;i(B);for(K=0;K<ra.count;K++)s=ra.list[K],O(s.blending),j(s.depthTest),k(s.depthWrite),n(s.polygonOffset,s.polygonOffsetFactor,s.polygonOffsetUnits),Ia=d(c,Qa,x,s,B),B.immediateRenderCallback?B.immediateRenderCallback(Ia,e,wa):B.render(function(b){h(b,Ia,s.shading)})}}b.__webglSprites.length&&
-L(b,c);o&&o.minFilter!==THREE.NearestFilter&&o.minFilter!==THREE.LinearFilter&&la(o)};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&&sa(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 m=void 0,p=void 0;k.__webglMorphTargetsBuffers=[];m=0;for(p=k.numMorphTargets;m<p;m++)k.__webglMorphTargetsBuffers.push(e.createBuffer())}J.info.memory.geometries++;for(var k=d,n=void 0,o=void 0,r=void 0,v=r=void 0,x=void 0,u=void 0,w=u=m=0,E=r=o=void 0,r=p=E=o=n=void 0,v=k.geometry,x=v.faces,E=
-j.faces,n=0,o=E.length;n<o;n++)r=E[n],r=x[r],r instanceof THREE.Face3?(m+=3,u+=1,w+=3):r instanceof THREE.Face4&&(m+=4,u+=2,w+=4);for(var n=j,o=k,D=E=x=void 0,A=void 0,D=void 0,r=[],x=0,E=o.materials.length;x<E;x++)if(D=o.materials[x],D instanceof THREE.MeshFaceMaterial){D=0;for(l=n.materials.length;D<l;D++)(A=n.materials[D])&&r.push(A)}else(A=D)&&r.push(A);n=r;j.__materials=n;a:{x=o=void 0;E=n.length;for(o=0;o<E;o++)if(x=n[o],x.map||x.lightMap||x instanceof THREE.ShaderMaterial){o=!0;break a}o=!1}a:{E=
-x=void 0;r=n.length;for(x=0;x<r;x++)if(E=n[x],!(E instanceof THREE.MeshBasicMaterial&&!E.envMap||E instanceof THREE.MeshDepthMaterial)){E=E&&E.shading!=void 0&&E.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}E=!1}a:{r=x=void 0;D=n.length;for(x=0;x<D;x++)if(r=n[x],r.vertexColors){r=r.vertexColors;break a}r=!1}j.__vertexArray=new Float32Array(m*3);if(E)j.__normalArray=new Float32Array(m*3);if(v.hasTangents)j.__tangentArray=new Float32Array(m*4);if(r)j.__colorArray=new Float32Array(m*
-3);if(o){if(v.faceUvs.length>0||v.faceVertexUvs.length>0)j.__uvArray=new Float32Array(m*2);if(v.faceUvs.length>1||v.faceVertexUvs.length>1)j.__uv2Array=new Float32Array(m*2)}if(k.geometry.skinWeights.length&&k.geometry.skinIndices.length)j.__skinVertexAArray=new Float32Array(m*4),j.__skinVertexBArray=new Float32Array(m*4),j.__skinIndexArray=new Float32Array(m*4),j.__skinWeightArray=new Float32Array(m*4);j.__faceArray=new Uint16Array(u*3+(k.geometry.edgeFaces?k.geometry.edgeFaces.length*6:0));j.__lineArray=
-new Uint16Array(w*2);if(j.numMorphTargets){j.__morphTargetsArrays=[];v=0;for(x=j.numMorphTargets;v<x;v++)j.__morphTargetsArrays.push(new Float32Array(m*3))}j.__needsSmoothNormals=E==THREE.SmoothShading;j.__uvType=o;j.__vertexColorType=r;j.__normalType=E;j.__webglFaceCount=u*3+(k.geometry.edgeFaces?k.geometry.edgeFaces.length*6:0);j.__webglLineCount=w*2;v=0;for(x=n.length;v<x;v++)if(o=n[v],o.attributes){if(j.__webglCustomAttributesList===void 0)j.__webglCustomAttributesList=[];for(a in o.attributes){r=
-o.attributes[a];E={};for(p in r)E[p]=r[p];if(!E.__webglInitialized||E.createUniqueBuffers)E.__webglInitialized=!0,u=1,E.type==="v2"?u=2:E.type==="v3"?u=3:E.type==="v4"?u=4:E.type==="c"&&(u=3),E.size=u,E.array=new Float32Array(m*u),E.buffer=e.createBuffer(),E.buffer.belongsToAttribute=a,r.needsUpdate=!0,E.__original=r;j.__webglCustomAttributesList.push(E)}}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(),J.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(),
-J.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();J.info.geometries++;j=i;k=d;m=j.vertices.length;j.__vertexArray=new Float32Array(m*3);j.__colorArray=new Float32Array(m*3);j.__sortArray=[];j.__webglParticleCount=
-m;j.__materials=k.materials;w=u=p=void 0;p=0;for(u=k.materials.length;p<u;p++)if(w=k.materials[p],w.attributes){if(j.__webglCustomAttributesList===void 0)j.__webglCustomAttributesList=[];for(a in w.attributes){originalAttribute=w.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(m*size),attribute.buffer=e.createBuffer(),attribute.buffer.belongsToAttribute=a,originalAttribute.needsUpdate=!0,attribute.__original=originalAttribute;j.__webglCustomAttributesList.push(attribute)}}i.__dirtyVertices=!0;i.__dirtyColors=!0}if(!d.__webglActive){if(d instanceof THREE.Mesh)for(h in i=d.geometry,i.geometryGroups)j=i.geometryGroups[h],ha(f.__webglObjects,j,d);else d instanceof THREE.Ribbon||
-d instanceof THREE.Line||d instanceof THREE.ParticleSystem?(i=d.geometry,ha(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)ja(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)&&ja(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,p=j=h=void 0,i instanceof THREE.Mesh){h=i.geometry;k=0;for(m=h.geometryGroupsList.length;k<
-m;k++)if(j=h.geometryGroupsList[k],p=xa(j),h.__dirtyVertices||h.__dirtyMorphTargets||h.__dirtyElements||h.__dirtyUvs||h.__dirtyNormals||h.__dirtyColors||h.__dirtyTangents||p)if(p=j,u=e.DYNAMIC_DRAW,w=!h.dynamic,p.__inittedArrays){var F=n=v=void 0,C=void 0,H=F=void 0,G=void 0,L=void 0,O=void 0,Q=A=D=r=E=x=o=void 0,R=void 0,N=void 0,y=C=O=C=L=G=void 0,I=void 0,t=I=y=G=void 0,q=void 0,t=I=y=F=F=H=I=y=C=t=I=y=q=t=I=y=q=t=I=y=void 0,M=0,P=0,X=0,aa=0,U=0,S=0,$=0,T=0,ma=0,z=0,na=0,V=t=0,V=void 0,oa=p.__vertexArray,
-ka=p.__uvArray,la=p.__uv2Array,W=p.__normalArray,ca=p.__tangentArray,pa=p.__colorArray,da=p.__skinVertexAArray,ea=p.__skinVertexBArray,fa=p.__skinIndexArray,ga=p.__skinWeightArray,qa=p.__morphTargetsArrays,Z=p.__webglCustomAttributesList,q=void 0,ia=p.__faceArray,Y=p.__lineArray,wa=p.__needsSmoothNormals,x=p.__vertexColorType,o=p.__uvType,E=p.__normalType,ua=i.geometry,ta=ua.__dirtyVertices,za=ua.__dirtyElements,va=ua.__dirtyUvs,Aa=ua.__dirtyNormals,Ca=ua.__dirtyTangents,Da=ua.__dirtyColors,Ea=ua.__dirtyMorphTargets,
-Ba=ua.vertices,Fa=p.faces,La=ua.faces,Ha=ua.faceVertexUvs[0],Ja=ua.faceVertexUvs[1],Ma=ua.skinVerticesA,Na=ua.skinVerticesB,Oa=ua.skinIndices,Ka=ua.skinWeights,Ga=ua.morphTargets;if(Z){y=0;for(I=Z.length;y<I;y++)Z[y].offset=0,Z[y].offsetSrc=0}v=0;for(n=Fa.length;v<n;v++)if(F=Fa[v],C=La[F],Ha&&(r=Ha[F]),Ja&&(D=Ja[F]),F=C.vertexNormals,H=C.normal,G=C.vertexColors,L=C.color,O=C.vertexTangents,C instanceof THREE.Face3){if(ta)A=Ba[C.a].position,Q=Ba[C.b].position,R=Ba[C.c].position,oa[P]=A.x,oa[P+1]=A.y,
-oa[P+2]=A.z,oa[P+3]=Q.x,oa[P+4]=Q.y,oa[P+5]=Q.z,oa[P+6]=R.x,oa[P+7]=R.y,oa[P+8]=R.z,P+=9;if(Z){y=0;for(I=Z.length;y<I;y++)if(q=Z[y],q.__original.needsUpdate)t=q.offset,V=q.offsetSrc,q.size===1?(q.boundTo===void 0||q.boundTo==="vertices"?(q.array[t]=q.value[C.a],q.array[t+1]=q.value[C.b],q.array[t+2]=q.value[C.c]):q.boundTo==="faces"?(V=q.value[V],q.array[t]=V,q.array[t+1]=V,q.array[t+2]=V,q.offsetSrc++):q.boundTo==="faceVertices"&&(q.array[t]=q.value[V],q.array[t+1]=q.value[V+1],q.array[t+2]=q.value[V+
-2],q.offsetSrc+=3),q.offset+=3):(q.boundTo===void 0||q.boundTo==="vertices"?(A=q.value[C.a],Q=q.value[C.b],R=q.value[C.c]):q.boundTo==="faces"?(R=Q=A=V=q.value[V],q.offsetSrc++):q.boundTo==="faceVertices"&&(A=q.value[V],Q=q.value[V+1],R=q.value[V+2],q.offsetSrc+=3),q.size===2?(q.array[t]=A.x,q.array[t+1]=A.y,q.array[t+2]=Q.x,q.array[t+3]=Q.y,q.array[t+4]=R.x,q.array[t+5]=R.y,q.offset+=6):q.size===3?(q.type==="c"?(q.array[t]=A.r,q.array[t+1]=A.g,q.array[t+2]=A.b,q.array[t+3]=Q.r,q.array[t+4]=Q.g,q.array[t+
-5]=Q.b,q.array[t+6]=R.r,q.array[t+7]=R.g,q.array[t+8]=R.b):(q.array[t]=A.x,q.array[t+1]=A.y,q.array[t+2]=A.z,q.array[t+3]=Q.x,q.array[t+4]=Q.y,q.array[t+5]=Q.z,q.array[t+6]=R.x,q.array[t+7]=R.y,q.array[t+8]=R.z),q.offset+=9):(q.array[t]=A.x,q.array[t+1]=A.y,q.array[t+2]=A.z,q.array[t+3]=A.w,q.array[t+4]=Q.x,q.array[t+5]=Q.y,q.array[t+6]=Q.z,q.array[t+7]=Q.w,q.array[t+8]=R.x,q.array[t+9]=R.y,q.array[t+10]=R.z,q.array[t+11]=R.w,q.offset+=12))}if(Ea){y=0;for(I=Ga.length;y<I;y++)A=Ga[y].vertices[C.a].position,
-Q=Ga[y].vertices[C.b].position,R=Ga[y].vertices[C.c].position,t=qa[y],t[na]=A.x,t[na+1]=A.y,t[na+2]=A.z,t[na+3]=Q.x,t[na+4]=Q.y,t[na+5]=Q.z,t[na+6]=R.x,t[na+7]=R.y,t[na+8]=R.z;na+=9}if(Ka.length)y=Ka[C.a],I=Ka[C.b],t=Ka[C.c],ga[z]=y.x,ga[z+1]=y.y,ga[z+2]=y.z,ga[z+3]=y.w,ga[z+4]=I.x,ga[z+5]=I.y,ga[z+6]=I.z,ga[z+7]=I.w,ga[z+8]=t.x,ga[z+9]=t.y,ga[z+10]=t.z,ga[z+11]=t.w,y=Oa[C.a],I=Oa[C.b],t=Oa[C.c],fa[z]=y.x,fa[z+1]=y.y,fa[z+2]=y.z,fa[z+3]=y.w,fa[z+4]=I.x,fa[z+5]=I.y,fa[z+6]=I.z,fa[z+7]=I.w,fa[z+8]=
-t.x,fa[z+9]=t.y,fa[z+10]=t.z,fa[z+11]=t.w,y=Ma[C.a],I=Ma[C.b],t=Ma[C.c],da[z]=y.x,da[z+1]=y.y,da[z+2]=y.z,da[z+3]=1,da[z+4]=I.x,da[z+5]=I.y,da[z+6]=I.z,da[z+7]=1,da[z+8]=t.x,da[z+9]=t.y,da[z+10]=t.z,da[z+11]=1,y=Na[C.a],I=Na[C.b],t=Na[C.c],ea[z]=y.x,ea[z+1]=y.y,ea[z+2]=y.z,ea[z+3]=1,ea[z+4]=I.x,ea[z+5]=I.y,ea[z+6]=I.z,ea[z+7]=1,ea[z+8]=t.x,ea[z+9]=t.y,ea[z+10]=t.z,ea[z+11]=1,z+=12;if(Da&&x)G.length==3&&x==THREE.VertexColors?(C=G[0],y=G[1],I=G[2]):I=y=C=L,pa[ma]=C.r,pa[ma+1]=C.g,pa[ma+2]=C.b,pa[ma+
-3]=y.r,pa[ma+4]=y.g,pa[ma+5]=y.b,pa[ma+6]=I.r,pa[ma+7]=I.g,pa[ma+8]=I.b,ma+=9;if(Ca&&ua.hasTangents)G=O[0],L=O[1],C=O[2],ca[$]=G.x,ca[$+1]=G.y,ca[$+2]=G.z,ca[$+3]=G.w,ca[$+4]=L.x,ca[$+5]=L.y,ca[$+6]=L.z,ca[$+7]=L.w,ca[$+8]=C.x,ca[$+9]=C.y,ca[$+10]=C.z,ca[$+11]=C.w,$+=12;if(Aa&&E)if(F.length==3&&wa)for(y=0;y<3;y++)H=F[y],W[S]=H.x,W[S+1]=H.y,W[S+2]=H.z,S+=3;else for(y=0;y<3;y++)W[S]=H.x,W[S+1]=H.y,W[S+2]=H.z,S+=3;if(va&&r!==void 0&&o)for(y=0;y<3;y++)F=r[y],ka[X]=F.u,ka[X+1]=F.v,X+=2;if(va&&D!==void 0&&
-o)for(y=0;y<3;y++)F=D[y],la[aa]=F.u,la[aa+1]=F.v,aa+=2;za&&(ia[U]=M,ia[U+1]=M+1,ia[U+2]=M+2,U+=3,Y[T]=M,Y[T+1]=M+1,Y[T+2]=M,Y[T+3]=M+2,Y[T+4]=M+1,Y[T+5]=M+2,T+=6,M+=3)}else if(C instanceof THREE.Face4){if(ta)A=Ba[C.a].position,Q=Ba[C.b].position,R=Ba[C.c].position,N=Ba[C.d].position,oa[P]=A.x,oa[P+1]=A.y,oa[P+2]=A.z,oa[P+3]=Q.x,oa[P+4]=Q.y,oa[P+5]=Q.z,oa[P+6]=R.x,oa[P+7]=R.y,oa[P+8]=R.z,oa[P+9]=N.x,oa[P+10]=N.y,oa[P+11]=N.z,P+=12;if(Z){y=0;for(I=Z.length;y<I;y++)if(q=Z[y],q.__original.needsUpdate)t=
-q.offset,V=q.offsetSrc,q.size===1?(q.boundTo===void 0||q.boundTo==="vertices"?(q.array[t]=q.value[C.a],q.array[t+1]=q.value[C.b],q.array[t+2]=q.value[C.c],q.array[t+3]=q.value[C.d]):q.boundTo==="faces"?(V=q.value[V],q.array[t]=V,q.array[t+1]=V,q.array[t+2]=V,q.array[t+3]=V,q.offsetSrc++):q.boundTo==="faceVertices"&&(q.array[t]=q.value[V],q.array[t+1]=q.value[V+1],q.array[t+2]=q.value[V+2],q.array[t+3]=q.value[V+3],q.offsetSrc+=4),q.offset+=4):(q.boundTo===void 0||q.boundTo==="vertices"?(A=q.value[C.a],
-Q=q.value[C.b],R=q.value[C.c],N=q.value[C.d]):q.boundTo==="faces"?(N=R=Q=A=V=q.value[V],q.offsetSrc++):q.boundTo==="faceVertices"&&(A=q.value[V],Q=q.value[V+1],R=q.value[V+2],N=q.value[V+3],q.offsetSrc+=4),q.size===2?(q.array[t]=A.x,q.array[t+1]=A.y,q.array[t+2]=Q.x,q.array[t+3]=Q.y,q.array[t+4]=R.x,q.array[t+5]=R.y,q.array[t+6]=N.x,q.array[t+7]=N.y,q.offset+=8):q.size===3?(q.type==="c"?(q.array[t]=A.r,q.array[t+1]=A.g,q.array[t+2]=A.b,q.array[t+3]=Q.r,q.array[t+4]=Q.g,q.array[t+5]=Q.b,q.array[t+
-6]=R.r,q.array[t+7]=R.g,q.array[t+8]=R.b,q.array[t+9]=N.r,q.array[t+10]=N.g,q.array[t+11]=N.b):(q.array[t]=A.x,q.array[t+1]=A.y,q.array[t+2]=A.z,q.array[t+3]=Q.x,q.array[t+4]=Q.y,q.array[t+5]=Q.z,q.array[t+6]=R.x,q.array[t+7]=R.y,q.array[t+8]=R.z,q.array[t+9]=N.x,q.array[t+10]=N.y,q.array[t+11]=N.z),q.offset+=12):(q.array[t]=A.x,q.array[t+1]=A.y,q.array[t+2]=A.z,q.array[t+3]=A.w,q.array[t+4]=Q.x,q.array[t+5]=Q.y,q.array[t+6]=Q.z,q.array[t+7]=Q.w,q.array[t+8]=R.x,q.array[t+9]=R.y,q.array[t+10]=R.z,
-q.array[t+11]=R.w,q.array[t+12]=N.x,q.array[t+13]=N.y,q.array[t+14]=N.z,q.array[t+15]=N.w,q.offset+=16))}if(Ea){y=0;for(I=Ga.length;y<I;y++)A=Ga[y].vertices[C.a].position,Q=Ga[y].vertices[C.b].position,R=Ga[y].vertices[C.c].position,N=Ga[y].vertices[C.d].position,t=qa[y],t[na]=A.x,t[na+1]=A.y,t[na+2]=A.z,t[na+3]=Q.x,t[na+4]=Q.y,t[na+5]=Q.z,t[na+6]=R.x,t[na+7]=R.y,t[na+8]=R.z,t[na+9]=N.x,t[na+10]=N.y,t[na+11]=N.z;na+=12}if(Ka.length)y=Ka[C.a],I=Ka[C.b],t=Ka[C.c],q=Ka[C.d],ga[z]=y.x,ga[z+1]=y.y,ga[z+
-2]=y.z,ga[z+3]=y.w,ga[z+4]=I.x,ga[z+5]=I.y,ga[z+6]=I.z,ga[z+7]=I.w,ga[z+8]=t.x,ga[z+9]=t.y,ga[z+10]=t.z,ga[z+11]=t.w,ga[z+12]=q.x,ga[z+13]=q.y,ga[z+14]=q.z,ga[z+15]=q.w,y=Oa[C.a],I=Oa[C.b],t=Oa[C.c],q=Oa[C.d],fa[z]=y.x,fa[z+1]=y.y,fa[z+2]=y.z,fa[z+3]=y.w,fa[z+4]=I.x,fa[z+5]=I.y,fa[z+6]=I.z,fa[z+7]=I.w,fa[z+8]=t.x,fa[z+9]=t.y,fa[z+10]=t.z,fa[z+11]=t.w,fa[z+12]=q.x,fa[z+13]=q.y,fa[z+14]=q.z,fa[z+15]=q.w,y=Ma[C.a],I=Ma[C.b],t=Ma[C.c],q=Ma[C.d],da[z]=y.x,da[z+1]=y.y,da[z+2]=y.z,da[z+3]=1,da[z+4]=I.x,
-da[z+5]=I.y,da[z+6]=I.z,da[z+7]=1,da[z+8]=t.x,da[z+9]=t.y,da[z+10]=t.z,da[z+11]=1,da[z+12]=q.x,da[z+13]=q.y,da[z+14]=q.z,da[z+15]=1,y=Na[C.a],I=Na[C.b],t=Na[C.c],C=Na[C.d],ea[z]=y.x,ea[z+1]=y.y,ea[z+2]=y.z,ea[z+3]=1,ea[z+4]=I.x,ea[z+5]=I.y,ea[z+6]=I.z,ea[z+7]=1,ea[z+8]=t.x,ea[z+9]=t.y,ea[z+10]=t.z,ea[z+11]=1,ea[z+12]=C.x,ea[z+13]=C.y,ea[z+14]=C.z,ea[z+15]=1,z+=16;if(Da&&x)G.length==4&&x==THREE.VertexColors?(C=G[0],y=G[1],I=G[2],G=G[3]):G=I=y=C=L,pa[ma]=C.r,pa[ma+1]=C.g,pa[ma+2]=C.b,pa[ma+3]=y.r,pa[ma+
-4]=y.g,pa[ma+5]=y.b,pa[ma+6]=I.r,pa[ma+7]=I.g,pa[ma+8]=I.b,pa[ma+9]=G.r,pa[ma+10]=G.g,pa[ma+11]=G.b,ma+=12;if(Ca&&ua.hasTangents)G=O[0],L=O[1],C=O[2],O=O[3],ca[$]=G.x,ca[$+1]=G.y,ca[$+2]=G.z,ca[$+3]=G.w,ca[$+4]=L.x,ca[$+5]=L.y,ca[$+6]=L.z,ca[$+7]=L.w,ca[$+8]=C.x,ca[$+9]=C.y,ca[$+10]=C.z,ca[$+11]=C.w,ca[$+12]=O.x,ca[$+13]=O.y,ca[$+14]=O.z,ca[$+15]=O.w,$+=16;if(Aa&&E)if(F.length==4&&wa)for(y=0;y<4;y++)H=F[y],W[S]=H.x,W[S+1]=H.y,W[S+2]=H.z,S+=3;else for(y=0;y<4;y++)W[S]=H.x,W[S+1]=H.y,W[S+2]=H.z,S+=
-3;if(va&&r!==void 0&&o)for(y=0;y<4;y++)F=r[y],ka[X]=F.u,ka[X+1]=F.v,X+=2;if(va&&D!==void 0&&o)for(y=0;y<4;y++)F=D[y],la[aa]=F.u,la[aa+1]=F.v,aa+=2;za&&(ia[U]=M,ia[U+1]=M+1,ia[U+2]=M+3,ia[U+3]=M+1,ia[U+4]=M+2,ia[U+5]=M+3,U+=6,Y[T]=M,Y[T+1]=M+1,Y[T+2]=M,Y[T+3]=M+3,Y[T+4]=M+1,Y[T+5]=M+2,Y[T+6]=M+2,Y[T+7]=M+3,T+=8,M+=4)}ta&&(e.bindBuffer(e.ARRAY_BUFFER,p.__webglVertexBuffer),e.bufferData(e.ARRAY_BUFFER,oa,u));if(Z){y=0;for(I=Z.length;y<I;y++)q=Z[y],q.__original.needsUpdate&&(e.bindBuffer(e.ARRAY_BUFFER,
-q.buffer),e.bufferData(e.ARRAY_BUFFER,q.array,u))}if(Ea){y=0;for(I=Ga.length;y<I;y++)e.bindBuffer(e.ARRAY_BUFFER,p.__webglMorphTargetsBuffers[y]),e.bufferData(e.ARRAY_BUFFER,qa[y],u)}Da&&ma>0&&(e.bindBuffer(e.ARRAY_BUFFER,p.__webglColorBuffer),e.bufferData(e.ARRAY_BUFFER,pa,u));Aa&&(e.bindBuffer(e.ARRAY_BUFFER,p.__webglNormalBuffer),e.bufferData(e.ARRAY_BUFFER,W,u));Ca&&ua.hasTangents&&(e.bindBuffer(e.ARRAY_BUFFER,p.__webglTangentBuffer),e.bufferData(e.ARRAY_BUFFER,ca,u));va&&X>0&&(e.bindBuffer(e.ARRAY_BUFFER,
-p.__webglUVBuffer),e.bufferData(e.ARRAY_BUFFER,ka,u));va&&aa>0&&(e.bindBuffer(e.ARRAY_BUFFER,p.__webglUV2Buffer),e.bufferData(e.ARRAY_BUFFER,la,u));za&&(e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,p.__webglFaceBuffer),e.bufferData(e.ELEMENT_ARRAY_BUFFER,ia,u),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,p.__webglLineBuffer),e.bufferData(e.ELEMENT_ARRAY_BUFFER,Y,u));z>0&&(e.bindBuffer(e.ARRAY_BUFFER,p.__webglSkinVertexABuffer),e.bufferData(e.ARRAY_BUFFER,da,u),e.bindBuffer(e.ARRAY_BUFFER,p.__webglSkinVertexBBuffer),
-e.bufferData(e.ARRAY_BUFFER,ea,u),e.bindBuffer(e.ARRAY_BUFFER,p.__webglSkinIndicesBuffer),e.bufferData(e.ARRAY_BUFFER,fa,u),e.bindBuffer(e.ARRAY_BUFFER,p.__webglSkinWeightsBuffer),e.bufferData(e.ARRAY_BUFFER,ga,u));w&&(delete p.__inittedArrays,delete p.__colorArray,delete p.__normalArray,delete p.__tangentArray,delete p.__uvArray,delete p.__uv2Array,delete p.__faceArray,delete p.__vertexArray,delete p.__lineArray,delete p.__skinVertexAArray,delete p.__skinVertexBArray,delete p.__skinIndexArray,delete p.__skinWeightArray)}h.__dirtyVertices=
-!1;h.__dirtyMorphTargets=!1;h.__dirtyElements=!1;h.__dirtyUvs=!1;h.__dirtyNormals=!1;h.__dirtyTangents=!1;h.__dirtyColors=!1;ya(j)}else if(i instanceof THREE.Ribbon){h=i.geometry;if(h.__dirtyVertices||h.__dirtyColors){i=h;j=e.DYNAMIC_DRAW;k=v=w=w=void 0;n=i.vertices;m=i.colors;o=n.length;p=m.length;x=i.__vertexArray;u=i.__colorArray;E=i.__dirtyColors;if(i.__dirtyVertices){for(w=0;w<o;w++)v=n[w].position,k=w*3,x[k]=v.x,x[k+1]=v.y,x[k+2]=v.z;e.bindBuffer(e.ARRAY_BUFFER,i.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,
-x,j)}if(E){for(w=0;w<p;w++)color=m[w],k=w*3,u[k]=color.r,u[k+1]=color.g,u[k+2]=color.b;e.bindBuffer(e.ARRAY_BUFFER,i.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,u,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=v=w=w=void 0;n=i.vertices;m=i.colors;o=n.length;p=m.length;x=i.__vertexArray;u=i.__colorArray;E=i.__dirtyColors;if(i.__dirtyVertices){for(w=0;w<o;w++)v=n[w].position,k=w*3,x[k]=v.x,x[k+
-1]=v.y,x[k+2]=v.z;e.bindBuffer(e.ARRAY_BUFFER,i.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,x,j)}if(E){for(w=0;w<p;w++)color=m[w],k=w*3,u[k]=color.r,u[k+1]=color.g,u[k+2]=color.b;e.bindBuffer(e.ARRAY_BUFFER,i.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,u,j)}}h.__dirtyVertices=!1;h.__dirtyColors=!1}else if(i instanceof THREE.ParticleSystem)h=i.geometry,p=xa(h),(h.__dirtyVertices||h.__dirtyColors||i.sortParticles||p)&&c(h,e.DYNAMIC_DRAW,i),h.__dirtyVertices=!1,h.__dirtyColors=!1,ya(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 db}};
-THREE.WebGLRenderTarget=function(b,c,d){this.width=b;this.height=c;d=d||{};this.wrapS=d.wrapS!==void 0?d.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=d.wrapT!==void 0?d.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=d.magFilter!==void 0?d.magFilter:THREE.LinearFilter;this.minFilter=d.minFilter!==void 0?d.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=d.format!==void 0?d.format:THREE.RGBAFormat;this.type=d.type!==void 0?d.type:
-THREE.UnsignedByteType;this.depthBuffer=d.depthBuffer!==void 0?d.depthBuffer:!0;this.stencilBuffer=d.stencilBuffer!==void 0?d.stencilBuffer:!0};
-THREE.WebGLRenderTarget.prototype.clone=function(){var b=new THREE.WebGLRenderTarget(this.width,this.height);b.wrapS=this.wrapS;b.wrapT=this.wrapT;b.magFilter=this.magFilter;b.minFilter=this.minFilter;b.offset.copy(this.offset);b.repeat.copy(this.repeat);b.format=this.format;b.type=this.type;b.depthBuffer=this.depthBuffer;b.stencilBuffer=this.stencilBuffer;return b};THREE.WebGLRenderTargetCube=function(b,c,d){THREE.WebGLRenderTarget.call(this,b,c,d);this.activeCubeFace=0};
+THREE.WebGLRenderer=function(a){function b(a,d){var b;a.material&&!(a.material instanceof THREE.MeshFaceMaterial)?b=a.material:d.materialIndex>=0&&(b=a.geometry.materials[d.materialIndex]);return b}function c(a,b,c){var e,h,f,i=a.vertices,r=i.length,J=a.colors,j=J.length,t=a.__vertexArray,k=a.__colorArray,n=a.__sortArray,v=a.__dirtyVertices,l=a.__dirtyColors,p=a.__webglCustomAttributesList,m;if(p){f=0;for(e=p.length;f<e;f++)p[f].offset=0}if(c.sortParticles){Ca.multiplySelf(c.matrixWorld);for(e=0;e<
+r;e++)h=i[e].position,Ha.copy(h),Ca.multiplyVector3(Ha),n[e]=[Ha.z,e];n.sort(function(a,d){return d[0]-a[0]});for(e=0;e<r;e++)h=i[n[e][1]].position,f=e*3,t[f]=h.x,t[f+1]=h.y,t[f+2]=h.z;for(e=0;e<j;e++)f=e*3,color=J[n[e][1]],k[f]=color.r,k[f+1]=color.g,k[f+2]=color.b;if(p){f=0;for(e=p.length;f<e;f++){r=p[f];j=r.value.length;for(J=0;J<j;J++){index=n[J][1];i=r.offset;if(r.size===1){if(r.boundTo===void 0||r.boundTo==="vertices")r.array[i]=r.value[index]}else{if(r.boundTo===void 0||r.boundTo==="vertices")m=
+r.value[index];r.size===2?(r.array[i]=m.x,r.array[i+1]=m.y):r.size===3?r.type==="c"?(r.array[i]=m.r,r.array[i+1]=m.g,r.array[i+2]=m.b):(r.array[i]=m.x,r.array[i+1]=m.y,r.array[i+2]=m.z):(r.array[i]=m.x,r.array[i+1]=m.y,r.array[i+2]=m.z,r.array[i+3]=m.w)}r.offset+=r.size}}}}else{if(v)for(e=0;e<r;e++)h=i[e].position,f=e*3,t[f]=h.x,t[f+1]=h.y,t[f+2]=h.z;if(l)for(e=0;e<j;e++)color=J[e],f=e*3,k[f]=color.r,k[f+1]=color.g,k[f+2]=color.b;if(p){f=0;for(e=p.length;f<e;f++)if(r=p[f],r.__original.needsUpdate){j=
+r.value.length;for(J=0;J<j;J++){i=r.offset;if(r.size===1){if(r.boundTo===void 0||r.boundTo==="vertices")r.array[i]=r.value[J]}else{if(r.boundTo===void 0||r.boundTo==="vertices")m=r.value[J];r.size===2?(r.array[i]=m.x,r.array[i+1]=m.y):r.size===3?r.type==="c"?(r.array[i]=m.r,r.array[i+1]=m.g,r.array[i+2]=m.b):(r.array[i]=m.x,r.array[i+1]=m.y,r.array[i+2]=m.z):(r.array[i]=m.x,r.array[i+1]=m.y,r.array[i+2]=m.z,r.array[i+3]=m.w)}r.offset+=r.size}}}}if(v||c.sortParticles)d.bindBuffer(d.ARRAY_BUFFER,a.__webglVertexBuffer),
+d.bufferData(d.ARRAY_BUFFER,t,b);if(l||c.sortParticles)d.bindBuffer(d.ARRAY_BUFFER,a.__webglColorBuffer),d.bufferData(d.ARRAY_BUFFER,k,b);if(p){f=0;for(e=p.length;f<e;f++)if(r=p[f],r.__original.needsUpdate||c.sortParticles)d.bindBuffer(d.ARRAY_BUFFER,r.buffer),d.bufferData(d.ARRAY_BUFFER,r.array,b)}}function e(a,b,c,e,h){e.program||F.initMaterial(e,b,c,h);if(e.morphTargets&&!h.__webglMorphTargetInfluences){h.__webglMorphTargetInfluences=new Float32Array(F.maxMorphTargets);for(var f=0,i=F.maxMorphTargets;f<
+i;f++)h.__webglMorphTargetInfluences[f]=0}var r=!1,f=e.program,i=f.uniforms,j=e.uniforms;f!=Va&&(d.useProgram(f),Va=f,r=!0);if(e.id!=ma)ma=e.id,r=!0;if(r){d.uniformMatrix4fv(i.projectionMatrix,!1,Sa);if(c&&e.fog)if(j.fogColor.value=c.color,c instanceof THREE.Fog)j.fogNear.value=c.near,j.fogFar.value=c.far;else if(c instanceof THREE.FogExp2)j.fogDensity.value=c.density;if(e instanceof THREE.MeshPhongMaterial||e instanceof THREE.MeshLambertMaterial||e.lights){for(var W,t,k=0,n=0,v=0,l,m,p,s=Xa,y=s.directional.colors,
+u=s.directional.positions,B=s.point.colors,A=s.point.positions,C=s.point.distances,E=0,I=0,c=W=p=0,r=b.length;c<r;c++)if(W=b[c],t=W.color,l=W.position,m=W.intensity,p=W.distance,W instanceof THREE.AmbientLight)F.gammaInput?(k+=t.r*t.r,n+=t.g*t.g,v+=t.b*t.b):(k+=t.r,n+=t.g,v+=t.b);else if(W instanceof THREE.DirectionalLight)p=E*3,F.gammaInput?(y[p]=t.r*t.r*m*m,y[p+1]=t.g*t.g*m*m,y[p+2]=t.b*t.b*m*m):(y[p]=t.r*m,y[p+1]=t.g*m,y[p+2]=t.b*m),u[p]=l.x,u[p+1]=l.y,u[p+2]=l.z,E+=1;else if(W instanceof THREE.SpotLight)p=
+E*3,F.gammaInput?(y[p]=t.r*t.r*m*m,y[p+1]=t.g*t.g*m*m,y[p+2]=t.b*t.b*m*m):(y[p]=t.r*m,y[p+1]=t.g*m,y[p+2]=t.b*m),t=1/l.length(),u[p]=l.x*t,u[p+1]=l.y*t,u[p+2]=l.z*t,E+=1;else if(W instanceof THREE.PointLight)W=I*3,F.gammaInput?(B[W]=t.r*t.r*m*m,B[W+1]=t.g*t.g*m*m,B[W+2]=t.b*t.b*m*m):(B[W]=t.r*m,B[W+1]=t.g*m,B[W+2]=t.b*m),A[W]=l.x,A[W+1]=l.y,A[W+2]=l.z,C[I]=p,I+=1;c=E*3;for(r=y.length;c<r;c++)y[c]=0;c=I*3;for(r=B.length;c<r;c++)B[c]=0;s.point.length=I;s.directional.length=E;s.ambient[0]=k;s.ambient[1]=
+n;s.ambient[2]=v;b=Xa;j.enableLighting.value=b.directional.length+b.point.length;j.ambientLightColor.value=b.ambient;j.directionalLightColor.value=b.directional.colors;j.directionalLightDirection.value=b.directional.positions;j.pointLightColor.value=b.point.colors;j.pointLightPosition.value=b.point.positions;j.pointLightDistance.value=b.point.distances}if(e instanceof THREE.MeshBasicMaterial||e instanceof THREE.MeshLambertMaterial||e instanceof THREE.MeshPhongMaterial)j.opacity.value=e.opacity,F.gammaInput?
+j.diffuse.value.copyGammaToLinear(e.color):j.diffuse.value=e.color,(j.map.texture=e.map)&&j.offsetRepeat.value.set(e.map.offset.x,e.map.offset.y,e.map.repeat.x,e.map.repeat.y),j.lightMap.texture=e.lightMap,j.envMap.texture=e.envMap,j.flipEnvMap.value=e.envMap instanceof THREE.WebGLRenderTargetCube?1:-1,j.reflectivity.value=e.reflectivity,j.refractionRatio.value=e.refractionRatio,j.combine.value=e.combine,j.useRefract.value=e.envMap&&e.envMap.mapping instanceof THREE.CubeRefractionMapping;if(e instanceof
+THREE.LineBasicMaterial)j.diffuse.value=e.color,j.opacity.value=e.opacity;else if(e instanceof THREE.ParticleBasicMaterial)j.psColor.value=e.color,j.opacity.value=e.opacity,j.size.value=e.size,j.scale.value=Da.height/2,j.map.texture=e.map;else if(e instanceof THREE.MeshPhongMaterial)j.shininess.value=e.shininess,F.gammaInput?(j.ambient.value.copyGammaToLinear(e.ambient),j.specular.value.copyGammaToLinear(e.specular)):(j.ambient.value=e.ambient,j.specular.value=e.specular);else if(e instanceof THREE.MeshLambertMaterial)F.gammaInput?
+j.ambient.value.copyGammaToLinear(e.ambient):j.ambient.value=e.ambient;else if(e instanceof THREE.MeshDepthMaterial)j.mNear.value=a.near,j.mFar.value=a.far,j.opacity.value=e.opacity;else if(e instanceof THREE.MeshNormalMaterial)j.opacity.value=e.opacity;if(h.receiveShadow&&!e._shadowPass&&j.shadowMatrix){for(b=0;b<Ra.length;b++)j.shadowMatrix.value[b]=Ra[b],j.shadowMap.texture[b]=F.shadowMap[b];j.shadowDarkness.value=F.shadowMapDarkness;j.shadowBias.value=F.shadowMapBias}b=e.uniformsList;j=0;for(c=
+b.length;j<c;j++)if(n=f.uniforms[b[j][1]])if(k=b[j][0],v=k.type,r=k.value,v=="i")d.uniform1i(n,r);else if(v=="f")d.uniform1f(n,r);else if(v=="v2")d.uniform2f(n,r.x,r.y);else if(v=="v3")d.uniform3f(n,r.x,r.y,r.z);else if(v=="v4")d.uniform4f(n,r.x,r.y,r.z,r.w);else if(v=="c")d.uniform3f(n,r.r,r.g,r.b);else if(v=="fv1")d.uniform1fv(n,r);else if(v=="fv")d.uniform3fv(n,r);else if(v=="v3v"){if(!k._array)k._array=new Float32Array(3*r.length);v=0;for(l=r.length;v<l;v++)s=v*3,k._array[s]=r[v].x,k._array[s+
+1]=r[v].y,k._array[s+2]=r[v].z;d.uniform3fv(n,k._array)}else if(v=="m4"){if(!k._array)k._array=new Float32Array(16);r.flattenToArray(k._array);d.uniformMatrix4fv(n,!1,k._array)}else if(v=="m4v"){if(!k._array)k._array=new Float32Array(16*r.length);v=0;for(l=r.length;v<l;v++)r[v].flattenToArrayOffset(k._array,v*16);d.uniformMatrix4fv(n,!1,k._array)}else if(v=="t"){if(d.uniform1i(n,r),n=k.texture)if(n.image instanceof Array&&n.image.length==6){if(k=n,k.image.length==6)if(k.needsUpdate){if(!k.image.__webglTextureCube)k.image.__webglTextureCube=
+d.createTexture();d.activeTexture(d.TEXTURE0+r);d.bindTexture(d.TEXTURE_CUBE_MAP,k.image.__webglTextureCube);for(r=0;r<6;r++)d.texImage2D(d.TEXTURE_CUBE_MAP_POSITIVE_X+r,0,d.RGBA,d.RGBA,d.UNSIGNED_BYTE,k.image[r]);z(d.TEXTURE_CUBE_MAP,k,k.image[0]);k.needsUpdate=!1}else d.activeTexture(d.TEXTURE0+r),d.bindTexture(d.TEXTURE_CUBE_MAP,k.image.__webglTextureCube)}else n instanceof THREE.WebGLRenderTargetCube?(k=n,d.activeTexture(d.TEXTURE0+r),d.bindTexture(d.TEXTURE_CUBE_MAP,k.__webglTexture)):R(n,r)}else if(v==
+"tv"){if(!k._array){k._array=[];v=0;for(l=k.texture.length;v<l;v++)k._array[v]=r+v}d.uniform1iv(n,k._array);v=0;for(l=k.texture.length;v<l;v++)(n=k.texture[v])&&R(n,k._array[v])}(e instanceof THREE.ShaderMaterial||e instanceof THREE.MeshPhongMaterial||e.envMap)&&i.cameraPosition!==null&&d.uniform3f(i.cameraPosition,a.position.x,a.position.y,a.position.z);(e instanceof THREE.MeshPhongMaterial||e instanceof THREE.MeshLambertMaterial||e instanceof THREE.ShaderMaterial||e.skinning)&&i.viewMatrix!==null&&
+d.uniformMatrix4fv(i.viewMatrix,!1,Ta);e.skinning&&(d.uniformMatrix4fv(i.cameraInverseMatrix,!1,Ta),d.uniformMatrix4fv(i.boneGlobalMatrices,!1,h.boneMatrices))}d.uniformMatrix4fv(i.modelViewMatrix,!1,h._modelViewMatrixArray);i.normalMatrix&&d.uniformMatrix3fv(i.normalMatrix,!1,h._normalMatrixArray);(e instanceof THREE.ShaderMaterial||e.envMap||e.skinning||h.receiveShadow)&&i.objectMatrix!==null&&d.uniformMatrix4fv(i.objectMatrix,!1,h._objectMatrixArray);return f}function f(a,b,c,h,f,i){if(h.opacity!=
+0){var j,r,c=e(a,b,c,h,i),a=c.attributes,b=!1,c=f.id*16777215+c.id*2+(h.wireframe?1:0);c!=E&&(E=c,b=!0);if(!h.morphTargets&&a.position>=0)b&&(d.bindBuffer(d.ARRAY_BUFFER,f.__webglVertexBuffer),d.vertexAttribPointer(a.position,3,d.FLOAT,!1,0,0));else if(i.morphTargetBase){c=h.program.attributes;i.morphTargetBase!==-1?(d.bindBuffer(d.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[i.morphTargetBase]),d.vertexAttribPointer(c.position,3,d.FLOAT,!1,0,0)):c.position>=0&&(d.bindBuffer(d.ARRAY_BUFFER,f.__webglVertexBuffer),
+d.vertexAttribPointer(c.position,3,d.FLOAT,!1,0,0));if(i.morphTargetForcedOrder.length){j=0;var k=i.morphTargetForcedOrder;for(r=i.morphTargetInfluences;j<h.numSupportedMorphTargets&&j<k.length;)d.bindBuffer(d.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[k[j]]),d.vertexAttribPointer(c["morphTarget"+j],3,d.FLOAT,!1,0,0),i.__webglMorphTargetInfluences[j]=r[k[j]],j++}else{var k=[],n=-1,t=0;r=i.morphTargetInfluences;var m,l=r.length;j=0;for(i.morphTargetBase!==-1&&(k[i.morphTargetBase]=!0);j<h.numSupportedMorphTargets;){for(m=
+0;m<l;m++)!k[m]&&r[m]>n&&(t=m,n=r[t]);d.bindBuffer(d.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[t]);d.vertexAttribPointer(c["morphTarget"+j],3,d.FLOAT,!1,0,0);i.__webglMorphTargetInfluences[j]=n;k[t]=1;n=-1;j++}}h.program.uniforms.morphTargetInfluences!==null&&d.uniform1fv(h.program.uniforms.morphTargetInfluences,i.__webglMorphTargetInfluences)}if(b){if(f.__webglCustomAttributesList){j=0;for(r=f.__webglCustomAttributesList.length;j<r;j++)c=f.__webglCustomAttributesList[j],a[c.buffer.belongsToAttribute]>=
+0&&(d.bindBuffer(d.ARRAY_BUFFER,c.buffer),d.vertexAttribPointer(a[c.buffer.belongsToAttribute],c.size,d.FLOAT,!1,0,0))}a.color>=0&&(d.bindBuffer(d.ARRAY_BUFFER,f.__webglColorBuffer),d.vertexAttribPointer(a.color,3,d.FLOAT,!1,0,0));a.normal>=0&&(d.bindBuffer(d.ARRAY_BUFFER,f.__webglNormalBuffer),d.vertexAttribPointer(a.normal,3,d.FLOAT,!1,0,0));a.tangent>=0&&(d.bindBuffer(d.ARRAY_BUFFER,f.__webglTangentBuffer),d.vertexAttribPointer(a.tangent,4,d.FLOAT,!1,0,0));a.uv>=0&&(f.__webglUVBuffer?(d.bindBuffer(d.ARRAY_BUFFER,
+f.__webglUVBuffer),d.vertexAttribPointer(a.uv,2,d.FLOAT,!1,0,0),d.enableVertexAttribArray(a.uv)):d.disableVertexAttribArray(a.uv));a.uv2>=0&&(f.__webglUV2Buffer?(d.bindBuffer(d.ARRAY_BUFFER,f.__webglUV2Buffer),d.vertexAttribPointer(a.uv2,2,d.FLOAT,!1,0,0),d.enableVertexAttribArray(a.uv2)):d.disableVertexAttribArray(a.uv2));h.skinning&&a.skinVertexA>=0&&a.skinVertexB>=0&&a.skinIndex>=0&&a.skinWeight>=0&&(d.bindBuffer(d.ARRAY_BUFFER,f.__webglSkinVertexABuffer),d.vertexAttribPointer(a.skinVertexA,4,
+d.FLOAT,!1,0,0),d.bindBuffer(d.ARRAY_BUFFER,f.__webglSkinVertexBBuffer),d.vertexAttribPointer(a.skinVertexB,4,d.FLOAT,!1,0,0),d.bindBuffer(d.ARRAY_BUFFER,f.__webglSkinIndicesBuffer),d.vertexAttribPointer(a.skinIndex,4,d.FLOAT,!1,0,0),d.bindBuffer(d.ARRAY_BUFFER,f.__webglSkinWeightsBuffer),d.vertexAttribPointer(a.skinWeight,4,d.FLOAT,!1,0,0))}i instanceof THREE.Mesh?(h.wireframe?(d.lineWidth(h.wireframeLinewidth),b&&d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,f.__webglLineBuffer),d.drawElements(d.LINES,f.__webglLineCount,
+d.UNSIGNED_SHORT,0)):(b&&d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,f.__webglFaceBuffer),d.drawElements(d.TRIANGLES,f.__webglFaceCount,d.UNSIGNED_SHORT,0)),F.info.render.calls++,F.info.render.vertices+=f.__webglFaceCount,F.info.render.faces+=f.__webglFaceCount/3):i instanceof THREE.Line?(i=i.type==THREE.LineStrip?d.LINE_STRIP:d.LINES,d.lineWidth(h.linewidth),d.drawArrays(i,0,f.__webglLineCount),F.info.render.calls++):i instanceof THREE.ParticleSystem?(d.drawArrays(d.POINTS,0,f.__webglParticleCount),F.info.render.calls++):
+i instanceof THREE.Ribbon&&(d.drawArrays(d.TRIANGLE_STRIP,0,f.__webglVertexCount),F.info.render.calls++)}}function h(a,b,c){if(!a.__webglVertexBuffer)a.__webglVertexBuffer=d.createBuffer();if(!a.__webglNormalBuffer)a.__webglNormalBuffer=d.createBuffer();a.hasPos&&(d.bindBuffer(d.ARRAY_BUFFER,a.__webglVertexBuffer),d.bufferData(d.ARRAY_BUFFER,a.positionArray,d.DYNAMIC_DRAW),d.enableVertexAttribArray(b.attributes.position),d.vertexAttribPointer(b.attributes.position,3,d.FLOAT,!1,0,0));if(a.hasNormal){d.bindBuffer(d.ARRAY_BUFFER,
+a.__webglNormalBuffer);if(c==THREE.FlatShading){var e,f,h,i,j,k,n,t,m,l,p=a.count*3;for(l=0;l<p;l+=9)c=a.normalArray,e=c[l],f=c[l+1],h=c[l+2],i=c[l+3],k=c[l+4],t=c[l+5],j=c[l+6],n=c[l+7],m=c[l+8],e=(e+i+j)/3,f=(f+k+n)/3,h=(h+t+m)/3,c[l]=e,c[l+1]=f,c[l+2]=h,c[l+3]=e,c[l+4]=f,c[l+5]=h,c[l+6]=e,c[l+7]=f,c[l+8]=h}d.bufferData(d.ARRAY_BUFFER,a.normalArray,d.DYNAMIC_DRAW);d.enableVertexAttribArray(b.attributes.normal);d.vertexAttribPointer(b.attributes.normal,3,d.FLOAT,!1,0,0)}d.drawArrays(d.TRIANGLES,
+0,a.count);a.count=0}function i(a){if(N!=a.doubleSided)a.doubleSided?d.disable(d.CULL_FACE):d.enable(d.CULL_FACE),N=a.doubleSided;if(V!=a.flipSided)a.flipSided?d.frontFace(d.CW):d.frontFace(d.CCW),V=a.flipSided}function j(a){S!=a&&(a?d.enable(d.DEPTH_TEST):d.disable(d.DEPTH_TEST),S=a)}function n(a){xa!=a&&(d.depthMask(a),xa=a)}function k(a,b,c){Ka!=a&&(a?d.enable(d.POLYGON_OFFSET_FILL):d.disable(d.POLYGON_OFFSET_FILL),Ka=a);if(a&&(Pa!=b||Qa!=c))d.polygonOffset(b,c),Pa=b,Qa=c}function l(a){X[0].set(a.n41-
+a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);X[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);X[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+a.n23,a.n44+a.n24);X[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);X[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);X[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+a.n33,a.n44+a.n34);for(var b,a=0;a<6;a++)b=X[a],b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}function p(a){for(var b=a.matrixWorld,d=-a.geometry.boundingSphere.radius*Math.max(a.scale.x,
+Math.max(a.scale.y,a.scale.z)),c=0;c<6;c++)if(a=X[c].x*b.n14+X[c].y*b.n24+X[c].z*b.n34+X[c].w,a<=d)return!1;return!0}function m(a,b){a.list[a.count]=b;a.count+=1}function s(a){var b;b=a.object;var d=a.opaque,a=a.transparent;a.count=0;d.count=0;b=b.material;b.transparent?m(a,b):m(d,b)}function B(a){var b,d;b=a.object;var c=a.buffer,e=a.opaque,a=a.transparent;a.count=0;e.count=0;d=b.material;d instanceof THREE.MeshFaceMaterial?(materialIndex=c.materialIndex,materialIndex>=0&&(b=b.geometry.materials[materialIndex],
+b.transparent?m(a,b):m(e,b))):(b=d)&&(b.transparent?m(a,b):m(e,b))}function A(a,b){return b.z-a.z}function H(a){var b,c,k,G=0,n,m,r,J,W=a.lights;sa||(sa=new THREE.PerspectiveCamera(F.shadowCameraFov,F.shadowMapWidth/F.shadowMapHeight,F.shadowCameraNear,F.shadowCameraFar));b=0;for(c=W.length;b<c;b++)if(k=W[b],k instanceof THREE.SpotLight&&k.castShadow){ma=-1;F.shadowMap[G]||(F.shadowMap[G]=new THREE.WebGLRenderTarget(F.shadowMapWidth,F.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,
+format:THREE.RGBAFormat}));Ra[G]||(Ra[G]=new THREE.Matrix4);n=F.shadowMap[G];m=Ra[G];sa.position.copy(k.position);sa.lookAt(k.target.position);sa.update(void 0,!0);a.update(void 0,!1,sa);m.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);m.multiplySelf(sa.projectionMatrix);m.multiplySelf(sa.matrixWorldInverse);sa.matrixWorldInverse.flattenToArray(Ta);sa.projectionMatrix.flattenToArray(Sa);Ca.multiply(sa.projectionMatrix,sa.matrixWorldInverse);l(Ca);F.initWebGLObjects(a);T(n);d.clearColor(1,1,1,1);
+F.clear();d.clearColor(va.r,va.g,va.b,za);m=a.__webglObjects.length;k=a.__webglObjectsImmediate.length;for(n=0;n<m;n++)r=a.__webglObjects[n],J=r.object,J.visible&&J.castShadow?!(J instanceof THREE.Mesh)||!J.frustumCulled||p(J)?(J.matrixWorld.flattenToArray(J._objectMatrixArray),Q(J,sa,!1),r.render=!0):r.render=!1:r.render=!1;j(!0);L(THREE.NormalBlending);for(n=0;n<m;n++)if(r=a.__webglObjects[n],r.render)J=r.object,buffer=r.buffer,i(J),r=J.customDepthMaterial?J.customDepthMaterial:J.geometry.morphTargets.length?
+Ya:Ua,f(sa,W,null,r,buffer,J);for(n=0;n<k;n++)r=a.__webglObjectsImmediate[n],J=r.object,J.visible&&J.castShadow&&(J.matrixAutoUpdate&&J.matrixWorld.flattenToArray(J._objectMatrixArray),E=-1,Q(J,sa,!1),i(J),program=e(sa,W,null,Ua,J),J.immediateRenderCallback?J.immediateRenderCallback(program,d,X):J.render(function(a){h(a,program,Ua.shading)}));G++}}function C(a,b){var c,e,f;c=u.attributes;var h=u.uniforms,i=Ia/ua,j,k=[],n=ua*0.5,t=Ia*0.5,l=!0;d.useProgram(u.program);Va=u.program;E=S=ia=-1;Za||(d.enableVertexAttribArray(u.attributes.position),
+d.enableVertexAttribArray(u.attributes.uv),Za=!0);d.disable(d.CULL_FACE);d.enable(d.BLEND);d.depthMask(!0);d.bindBuffer(d.ARRAY_BUFFER,u.vertexBuffer);d.vertexAttribPointer(c.position,2,d.FLOAT,!1,16,0);d.vertexAttribPointer(c.uv,2,d.FLOAT,!1,16,8);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,u.elementBuffer);d.uniformMatrix4fv(h.projectionMatrix,!1,Sa);d.activeTexture(d.TEXTURE0);d.uniform1i(h.map,0);c=0;for(e=a.__webglSprites.length;c<e;c++)if(f=a.__webglSprites[c],f.visible&&f.opacity!=0)f.useScreenCoordinates?
+f.z=-f.position.z:(f._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,f.matrixWorld,f._modelViewMatrixArray),f.z=-f._modelViewMatrix.n34);a.__webglSprites.sort(A);c=0;for(e=a.__webglSprites.length;c<e;c++)f=a.__webglSprites[c],f.visible&&f.opacity!=0&&f.map&&f.map.image&&f.map.image.width&&(f.useScreenCoordinates?(d.uniform1i(h.useScreenCoordinates,1),d.uniform3f(h.screenPosition,(f.position.x-n)/n,(t-f.position.y)/t,Math.max(0,Math.min(1,f.position.z)))):(d.uniform1i(h.useScreenCoordinates,
+0),d.uniform1i(h.affectedByDistance,f.affectedByDistance?1:0),d.uniformMatrix4fv(h.modelViewMatrix,!1,f._modelViewMatrixArray)),j=f.map.image.width/(f.scaleByViewport?Ia:1),k[0]=j*i*f.scale.x,k[1]=j*f.scale.y,d.uniform2f(h.uvScale,f.uvScale.x,f.uvScale.y),d.uniform2f(h.uvOffset,f.uvOffset.x,f.uvOffset.y),d.uniform2f(h.alignment,f.alignment.x,f.alignment.y),d.uniform1f(h.opacity,f.opacity),d.uniform3f(h.color,f.color.r,f.color.g,f.color.b),d.uniform1f(h.rotation,f.rotation),d.uniform2fv(h.scale,k),
+f.mergeWith3D&&!l?(d.enable(d.DEPTH_TEST),l=!0):!f.mergeWith3D&&l&&(d.disable(d.DEPTH_TEST),l=!1),L(f.blending),R(f.map,0),d.drawElements(d.TRIANGLES,6,d.UNSIGNED_SHORT,0));d.enable(d.CULL_FACE);d.enable(d.DEPTH_TEST);d.depthMask(xa)}function Q(a,b,d){a._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,a.matrixWorld,a._modelViewMatrixArray);d&&THREE.Matrix4.makeInvert3x3(a._modelViewMatrix).transposeIntoArray(a._normalMatrixArray)}function wa(a,d){var c=b(d,a);if(c.attributes)for(var e in c.attributes)if(c.attributes[e].needsUpdate)return!0;
+return!1}function ja(a,d){var c=b(d,a);if(c.attributes)for(var e in c.attributes)c.attributes[e].needsUpdate=!1}function qa(a,b){var d;for(d=a.length-1;d>=0;d--)a[d].object==b&&a.splice(d,1)}function ha(a,b,d){a.push({buffer:b,object:d,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function L(a){if(a!=ia){switch(a){case THREE.AdditiveBlending:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.SRC_ALPHA,d.ONE);break;case THREE.SubtractiveBlending:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.ZERO,d.ONE_MINUS_SRC_COLOR);
+break;case THREE.MultiplyBlending:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.ZERO,d.SRC_COLOR);break;default:d.blendEquationSeparate(d.FUNC_ADD,d.FUNC_ADD),d.blendFuncSeparate(d.SRC_ALPHA,d.ONE_MINUS_SRC_ALPHA,d.ONE,d.ONE_MINUS_SRC_ALPHA)}ia=a}}function z(a,b,c){(c.width&c.width-1)==0&&(c.height&c.height-1)==0?(d.texParameteri(a,d.TEXTURE_WRAP_S,$(b.wrapS)),d.texParameteri(a,d.TEXTURE_WRAP_T,$(b.wrapT)),d.texParameteri(a,d.TEXTURE_MAG_FILTER,$(b.magFilter)),d.texParameteri(a,d.TEXTURE_MIN_FILTER,$(b.minFilter)),
+d.generateMipmap(a)):(d.texParameteri(a,d.TEXTURE_WRAP_S,d.CLAMP_TO_EDGE),d.texParameteri(a,d.TEXTURE_WRAP_T,d.CLAMP_TO_EDGE),d.texParameteri(a,d.TEXTURE_MAG_FILTER,Aa(b.magFilter)),d.texParameteri(a,d.TEXTURE_MIN_FILTER,Aa(b.minFilter)))}function R(a,b){if(a.needsUpdate){if(!a.__webglInit)a.__webglInit=!0,a.__webglTexture=d.createTexture(),F.info.memory.textures++;d.activeTexture(d.TEXTURE0+b);d.bindTexture(d.TEXTURE_2D,a.__webglTexture);a instanceof THREE.DataTexture?d.texImage2D(d.TEXTURE_2D,0,
+$(a.format),a.image.width,a.image.height,0,$(a.format),d.UNSIGNED_BYTE,a.image.data):d.texImage2D(d.TEXTURE_2D,0,d.RGBA,d.RGBA,d.UNSIGNED_BYTE,a.image);z(d.TEXTURE_2D,a,a.image);a.needsUpdate=!1}else d.activeTexture(d.TEXTURE0+b),d.bindTexture(d.TEXTURE_2D,a.__webglTexture)}function M(a,b){d.bindRenderbuffer(d.RENDERBUFFER,a);b.depthBuffer&&!b.stencilBuffer?(d.renderbufferStorage(d.RENDERBUFFER,d.DEPTH_COMPONENT16,b.width,b.height),d.framebufferRenderbuffer(d.FRAMEBUFFER,d.DEPTH_ATTACHMENT,d.RENDERBUFFER,
+a)):b.depthBuffer&&b.stencilBuffer?(d.renderbufferStorage(d.RENDERBUFFER,d.DEPTH_STENCIL,b.width,b.height),d.framebufferRenderbuffer(d.FRAMEBUFFER,d.DEPTH_STENCIL_ATTACHMENT,d.RENDERBUFFER,a)):d.renderbufferStorage(d.RENDERBUFFER,d.RGBA4,b.width,b.height)}function T(a){var b=a instanceof THREE.WebGLRenderTargetCube;if(a&&!a.__webglFramebuffer){if(a.depthBuffer===void 0)a.depthBuffer=!0;if(a.stencilBuffer===void 0)a.stencilBuffer=!0;a.__webglTexture=d.createTexture();if(b){a.__webglFramebuffer=[];
+a.__webglRenderbuffer=[];d.bindTexture(d.TEXTURE_CUBE_MAP,a.__webglTexture);z(d.TEXTURE_CUBE_MAP,a,a);for(var c=0;c<6;c++){a.__webglFramebuffer[c]=d.createFramebuffer();a.__webglRenderbuffer[c]=d.createRenderbuffer();d.texImage2D(d.TEXTURE_CUBE_MAP_POSITIVE_X+c,0,$(a.format),a.width,a.height,0,$(a.format),$(a.type),null);var e=a,f=d.TEXTURE_CUBE_MAP_POSITIVE_X+c;d.bindFramebuffer(d.FRAMEBUFFER,a.__webglFramebuffer[c]);d.framebufferTexture2D(d.FRAMEBUFFER,d.COLOR_ATTACHMENT0,f,e.__webglTexture,0);
+M(a.__webglRenderbuffer[c],a)}}else a.__webglFramebuffer=d.createFramebuffer(),a.__webglRenderbuffer=d.createRenderbuffer(),d.bindTexture(d.TEXTURE_2D,a.__webglTexture),z(d.TEXTURE_2D,a,a),d.texImage2D(d.TEXTURE_2D,0,$(a.format),a.width,a.height,0,$(a.format),$(a.type),null),c=d.TEXTURE_2D,d.bindFramebuffer(d.FRAMEBUFFER,a.__webglFramebuffer),d.framebufferTexture2D(d.FRAMEBUFFER,d.COLOR_ATTACHMENT0,c,a.__webglTexture,0),d.bindRenderbuffer(d.RENDERBUFFER,a.__webglRenderbuffer),M(a.__webglRenderbuffer,
+a);b?d.bindTexture(d.TEXTURE_CUBE_MAP,null):d.bindTexture(d.TEXTURE_2D,null);d.bindRenderbuffer(d.RENDERBUFFER,null);d.bindFramebuffer(d.FRAMEBUFFER,null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,c=a.width,a=a.height,f=e=0):(b=null,c=ua,a=Ia,e=ya,f=Ba);b!=aa&&(d.bindFramebuffer(d.FRAMEBUFFER,b),d.viewport(e,f,c,a),aa=b)}function ka(a){a instanceof THREE.WebGLRenderTargetCube?(d.bindTexture(d.TEXTURE_CUBE_MAP,a.__webglTexture),d.generateMipmap(d.TEXTURE_CUBE_MAP),d.bindTexture(d.TEXTURE_CUBE_MAP,
+null)):(d.bindTexture(d.TEXTURE_2D,a.__webglTexture),d.generateMipmap(d.TEXTURE_2D),d.bindTexture(d.TEXTURE_2D,null))}function Z(a,b){var c;a=="fragment"?c=d.createShader(d.FRAGMENT_SHADER):a=="vertex"&&(c=d.createShader(d.VERTEX_SHADER));d.shaderSource(c,b);d.compileShader(c);if(!d.getShaderParameter(c,d.COMPILE_STATUS))return console.error(d.getShaderInfoLog(c)),console.error(b),null;return c}function Aa(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return d.NEAREST;
+default:return d.LINEAR}}function $(a){switch(a){case THREE.RepeatWrapping:return d.REPEAT;case THREE.ClampToEdgeWrapping:return d.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return d.MIRRORED_REPEAT;case THREE.NearestFilter:return d.NEAREST;case THREE.NearestMipMapNearestFilter:return d.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return d.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return d.LINEAR;case THREE.LinearMipMapNearestFilter:return d.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return d.LINEAR_MIPMAP_LINEAR;
+case THREE.ByteType:return d.BYTE;case THREE.UnsignedByteType:return d.UNSIGNED_BYTE;case THREE.ShortType:return d.SHORT;case THREE.UnsignedShortType:return d.UNSIGNED_SHORT;case THREE.IntType:return d.INT;case THREE.UnsignedShortType:return d.UNSIGNED_INT;case THREE.FloatType:return d.FLOAT;case THREE.AlphaFormat:return d.ALPHA;case THREE.RGBFormat:return d.RGB;case THREE.RGBAFormat:return d.RGBA;case THREE.LuminanceFormat:return d.LUMINANCE;case THREE.LuminanceAlphaFormat:return d.LUMINANCE_ALPHA}return 0}
+var F=this,d,Fa=[],Va=null,aa=null,ma=-1,E=null,ra=0,N=null,V=null,ia=null,S=null,xa=null,Ka=null,Pa=null,Qa=null,ya=0,Ba=0,ua=0,Ia=0,X=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Ca=new THREE.Matrix4,Sa=new Float32Array(16),Ta=new Float32Array(16),Ha=new THREE.Vector4,Xa={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},a=a||{},Da=a.canvas!==void 0?a.canvas:document.createElement("canvas"),
+K=a.stencil!==void 0?a.stencil:!0,bb=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:!1,cb=a.antialias!==void 0?a.antialias:!1,va=a.clearColor!==void 0?new THREE.Color(a.clearColor):new THREE.Color(0),za=a.clearAlpha!==void 0?a.clearAlpha:0,Wa=a.maxLights!==void 0?a.maxLights:4;this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0}};this.maxMorphTargets=8;this.domElement=Da;this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=
+this.autoClear=!0;this.physicallyBasedShading=this.gammaOutput=this.gammaInput=!1;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=this.shadowMapAutoUpdate=!0;var sa,Ra=[],a=THREE.ShaderLib.depthRGBA,$a=THREE.UniformsUtils.clone(a.uniforms),Ua=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,
+uniforms:$a}),Ya=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:$a,morphTargets:!0});Ua._shadowPass=!0;Ya._shadowPass=!0;try{if(!(d=Da.getContext("experimental-webgl",{antialias:cb,stencil:K,preserveDrawingBuffer:bb})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+d.getParameter(d.VERSION)+" | "+d.getParameter(d.VENDOR)+" | "+d.getParameter(d.RENDERER)+" | "+d.getParameter(d.SHADING_LANGUAGE_VERSION))}catch(db){console.error(db)}d.clearColor(0,
+0,0,1);d.clearDepth(1);d.clearStencil(0);d.enable(d.DEPTH_TEST);d.depthFunc(d.LEQUAL);d.frontFace(d.CCW);d.cullFace(d.BACK);d.enable(d.CULL_FACE);d.enable(d.BLEND);d.blendEquation(d.FUNC_ADD);d.blendFunc(d.SRC_ALPHA,d.ONE_MINUS_SRC_ALPHA);d.clearColor(va.r,va.g,va.b,za);this.context=d;var ab=d.getParameter(d.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,u={};u.vertices=new Float32Array(16);u.faces=new Uint16Array(6);K=0;u.vertices[K++]=-1;u.vertices[K++]=-1;u.vertices[K++]=0;u.vertices[K++]=1;u.vertices[K++]=
+1;u.vertices[K++]=-1;u.vertices[K++]=1;u.vertices[K++]=1;u.vertices[K++]=1;u.vertices[K++]=1;u.vertices[K++]=1;u.vertices[K++]=0;u.vertices[K++]=-1;u.vertices[K++]=1;u.vertices[K++]=0;K=u.vertices[K++]=0;u.faces[K++]=0;u.faces[K++]=1;u.faces[K++]=2;u.faces[K++]=0;u.faces[K++]=2;u.faces[K++]=3;u.vertexBuffer=d.createBuffer();u.elementBuffer=d.createBuffer();d.bindBuffer(d.ARRAY_BUFFER,u.vertexBuffer);d.bufferData(d.ARRAY_BUFFER,u.vertices,d.STATIC_DRAW);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,u.elementBuffer);
+d.bufferData(d.ELEMENT_ARRAY_BUFFER,u.faces,d.STATIC_DRAW);u.program=d.createProgram();d.attachShader(u.program,Z("fragment",THREE.ShaderLib.sprite.fragmentShader));d.attachShader(u.program,Z("vertex",THREE.ShaderLib.sprite.vertexShader));d.linkProgram(u.program);u.attributes={};u.uniforms={};u.attributes.position=d.getAttribLocation(u.program,"position");u.attributes.uv=d.getAttribLocation(u.program,"uv");u.uniforms.uvOffset=d.getUniformLocation(u.program,"uvOffset");u.uniforms.uvScale=d.getUniformLocation(u.program,
+"uvScale");u.uniforms.rotation=d.getUniformLocation(u.program,"rotation");u.uniforms.scale=d.getUniformLocation(u.program,"scale");u.uniforms.alignment=d.getUniformLocation(u.program,"alignment");u.uniforms.color=d.getUniformLocation(u.program,"color");u.uniforms.map=d.getUniformLocation(u.program,"map");u.uniforms.opacity=d.getUniformLocation(u.program,"opacity");u.uniforms.useScreenCoordinates=d.getUniformLocation(u.program,"useScreenCoordinates");u.uniforms.affectedByDistance=d.getUniformLocation(u.program,
+"affectedByDistance");u.uniforms.screenPosition=d.getUniformLocation(u.program,"screenPosition");u.uniforms.modelViewMatrix=d.getUniformLocation(u.program,"modelViewMatrix");u.uniforms.projectionMatrix=d.getUniformLocation(u.program,"projectionMatrix");var Za=!1;this.setSize=function(a,b){Da.width=a;Da.height=b;this.setViewport(0,0,Da.width,Da.height)};this.setViewport=function(a,b,c,e){ya=a;Ba=b;ua=c;Ia=e;d.viewport(ya,Ba,ua,Ia)};this.setScissor=function(a,b,c,e){d.scissor(a,b,c,e)};this.enableScissorTest=
+function(a){a?d.enable(d.SCISSOR_TEST):d.disable(d.SCISSOR_TEST)};this.setClearColorHex=function(a,b){va.setHex(a);za=b;d.clearColor(va.r,va.g,va.b,za)};this.setClearColor=function(a,b){va.copy(a);za=b;d.clearColor(va.r,va.g,va.b,za)};this.getClearColor=function(){return va};this.getClearAlpha=function(){return za};this.clear=function(a,b,c){var e=0;if(a==void 0||a)e|=d.COLOR_BUFFER_BIT;if(b==void 0||b)e|=d.DEPTH_BUFFER_BIT;if(c==void 0||c)e|=d.STENCIL_BUFFER_BIT;d.clear(e)};this.getContext=function(){return d};
+this.deallocateObject=function(a){if(a.__webglInit)if(a.__webglInit=!1,delete a._modelViewMatrix,delete a._normalMatrixArray,delete a._modelViewMatrixArray,delete a._objectMatrixArray,a instanceof THREE.Mesh)for(g in a.geometry.geometryGroups){var b=a.geometry.geometryGroups[g];d.deleteBuffer(b.__webglVertexBuffer);d.deleteBuffer(b.__webglNormalBuffer);d.deleteBuffer(b.__webglTangentBuffer);d.deleteBuffer(b.__webglColorBuffer);d.deleteBuffer(b.__webglUVBuffer);d.deleteBuffer(b.__webglUV2Buffer);d.deleteBuffer(b.__webglSkinVertexABuffer);
+d.deleteBuffer(b.__webglSkinVertexBBuffer);d.deleteBuffer(b.__webglSkinIndicesBuffer);d.deleteBuffer(b.__webglSkinWeightsBuffer);d.deleteBuffer(b.__webglFaceBuffer);d.deleteBuffer(b.__webglLineBuffer);if(b.numMorphTargets)for(var c=0,e=b.numMorphTargets;c<e;c++)d.deleteBuffer(b.__webglMorphTargetsBuffers[c]);F.info.memory.geometries--}else if(a instanceof THREE.Ribbon)a=a.geometry,d.deleteBuffer(a.__webglVertexBuffer),d.deleteBuffer(a.__webglColorBuffer),F.info.memory.geometries--;else if(a instanceof
+THREE.Line)a=a.geometry,d.deleteBuffer(a.__webglVertexBuffer),d.deleteBuffer(a.__webglColorBuffer),F.info.memory.geometries--;else if(a instanceof THREE.ParticleSystem)a=a.geometry,d.deleteBuffer(a.__webglVertexBuffer),d.deleteBuffer(a.__webglColorBuffer),F.info.memory.geometries--};this.deallocateTexture=function(a){if(a.__webglInit)a.__webglInit=!1,d.deleteTexture(a.__webglTexture),F.info.memory.textures--};this.initMaterial=function(a,b,c,e){var f,h,i,j;a instanceof THREE.MeshDepthMaterial?j="depth":
+a instanceof THREE.MeshNormalMaterial?j="normal":a instanceof THREE.MeshBasicMaterial?j="basic":a instanceof THREE.MeshLambertMaterial?j="lambert":a instanceof THREE.MeshPhongMaterial?j="phong":a instanceof THREE.LineBasicMaterial?j="basic":a instanceof THREE.ParticleBasicMaterial&&(j="particle_basic");if(j){var k=THREE.ShaderLib[j];a.uniforms=THREE.UniformsUtils.clone(k.uniforms);a.vertexShader=k.vertexShader;a.fragmentShader=k.fragmentShader}var n,l,m;n=m=k=0;for(l=b.length;n<l;n++)i=b[n],i instanceof
+THREE.SpotLight&&m++,i instanceof THREE.DirectionalLight&&m++,i instanceof THREE.PointLight&&k++;k+m<=Wa?n=m:(n=Math.ceil(Wa*m/(k+m)),k=Wa-n);i={directional:n,point:k};k=m=0;for(n=b.length;k<n;k++)l=b[k],l instanceof THREE.SpotLight&&l.castShadow&&m++;var p=50;if(e!==void 0&&e instanceof THREE.SkinnedMesh)p=e.bones.length;var v;a:{n=a.fragmentShader;l=a.vertexShader;var k=a.uniforms,b=a.attributes,c={map:!!a.map,envMap:!!a.envMap,lightMap:!!a.lightMap,vertexColors:a.vertexColors,fog:c,useFog:a.fog,
+sizeAttenuation:a.sizeAttenuation,skinning:a.skinning,morphTargets:a.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:i.directional,maxPointLights:i.point,maxBones:p,shadowMapEnabled:this.shadowMapEnabled&&e.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:m,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel},s,e=[];j?e.push(j):(e.push(n),e.push(l));for(s in c)e.push(s),e.push(c[s]);j=e.join();s=0;
+for(e=Fa.length;s<e;s++)if(Fa[s].code==j){v=Fa[s].program;break a}s=d.createProgram();e=[ab?"#define VERTEX_TEXTURES":"",F.gammaInput?"#define GAMMA_INPUT":"",F.gammaOutput?"#define GAMMA_OUTPUT":"",F.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,"#define MAX_BONES "+c.maxBones,c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":
+"",c.vertexColors?"#define USE_COLOR":"",c.skinning?"#define USE_SKINNING":"",c.morphTargets?"#define USE_MORPHTARGETS":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.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");
+i=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",F.gammaInput?"#define GAMMA_INPUT":"",F.gammaOutput?"#define GAMMA_OUTPUT":"",F.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"",c.useFog&&c.fog?"#define USE_FOG":"",c.useFog&&c.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":
+"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.metal?"#define METAL":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapSoft?"#define SHADOWMAP_WIDTH "+c.shadowMapWidth.toFixed(1):"",c.shadowMapSoft?"#define SHADOWMAP_HEIGHT "+c.shadowMapHeight.toFixed(1):"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");d.attachShader(s,Z("fragment",i+n));d.attachShader(s,
+Z("vertex",e+l));d.linkProgram(s);d.getProgramParameter(s,d.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+d.getProgramParameter(s,d.VALIDATE_STATUS)+", gl error ["+d.getError()+"]");s.uniforms={};s.attributes={};var u,e=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(u in k)e.push(u);u=e;e=0;for(k=u.length;e<k;e++)n=u[e],s.uniforms[n]=d.getUniformLocation(s,
+n);e=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(u=0;u<c.maxMorphTargets;u++)e.push("morphTarget"+u);for(v in b)e.push(v);v=e;u=0;for(b=v.length;u<b;u++)c=v[u],s.attributes[c]=d.getAttribLocation(s,c);s.id=Fa.length;Fa.push({program:s,code:j});F.info.memory.programs=Fa.length;v=s}a.program=v;v=a.program.attributes;v.position>=0&&d.enableVertexAttribArray(v.position);v.color>=0&&d.enableVertexAttribArray(v.color);v.normal>=0&&d.enableVertexAttribArray(v.normal);
+v.tangent>=0&&d.enableVertexAttribArray(v.tangent);a.skinning&&v.skinVertexA>=0&&v.skinVertexB>=0&&v.skinIndex>=0&&v.skinWeight>=0&&(d.enableVertexAttribArray(v.skinVertexA),d.enableVertexAttribArray(v.skinVertexB),d.enableVertexAttribArray(v.skinIndex),d.enableVertexAttribArray(v.skinWeight));if(a.attributes)for(h in a.attributes)v[h]!==void 0&&v[h]>=0&&d.enableVertexAttribArray(v[h]);if(a.morphTargets)for(h=a.numSupportedMorphTargets=0;h<this.maxMorphTargets;h++)u="morphTarget"+h,v[u]>=0&&(d.enableVertexAttribArray(v[u]),
+a.numSupportedMorphTargets++);a.uniformsList=[];for(f in a.uniforms)a.uniformsList.push([a.uniforms[f],f])};this.clearTarget=function(a,b,c,d){T(a);this.clear(b,c,d)};this.updateShadowMap=function(a,b){H(a,b)};this.render=function(a,b,c,m){var G,Ga,u,r,J,W,t,z,Oa=a.lights,v=a.fog;ma=-1;this.shadowMapEnabled&&this.shadowMapAutoUpdate&&H(a,b);F.info.render.calls=0;F.info.render.vertices=0;F.info.render.faces=0;if(b.matrixAutoUpdate){for(J=b;J.parent;)J=J.parent;J.update(void 0,!0)}a.update(void 0,!1,
+b);b.matrixWorldInverse.flattenToArray(Ta);b.projectionMatrix.flattenToArray(Sa);Ca.multiply(b.projectionMatrix,b.matrixWorldInverse);l(Ca);this.initWebGLObjects(a);T(c);(this.autoClear||m)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);J=a.__webglObjects.length;for(m=0;m<J;m++)if(G=a.__webglObjects[m],t=G.object,t.visible)if(!(t instanceof THREE.Mesh)||!t.frustumCulled||p(t)){if(t.matrixWorld.flattenToArray(t._objectMatrixArray),Q(t,b,!0),B(G),G.render=!0,this.sortObjects)G.object.renderDepth?
+G.z=G.object.renderDepth:(Ha.copy(t.position),Ca.multiplyVector3(Ha),G.z=Ha.z)}else G.render=!1;else G.render=!1;this.sortObjects&&a.__webglObjects.sort(A);W=a.__webglObjectsImmediate.length;for(m=0;m<W;m++)G=a.__webglObjectsImmediate[m],t=G.object,t.visible&&(t.matrixAutoUpdate&&t.matrixWorld.flattenToArray(t._objectMatrixArray),Q(t,b,!0),s(G));if(a.overrideMaterial){j(a.overrideMaterial.depthTest);L(a.overrideMaterial.blending);for(m=0;m<J;m++)if(G=a.__webglObjects[m],G.render)t=G.object,z=G.buffer,
+i(t),f(b,Oa,v,a.overrideMaterial,z,t);for(m=0;m<W;m++)G=a.__webglObjectsImmediate[m],t=G.object,t.visible&&(E=-1,i(t),Ga=e(b,Oa,v,a.overrideMaterial,t),t.immediateRenderCallback?t.immediateRenderCallback(Ga,d,X):t.render(function(b){h(b,Ga,a.overrideMaterial.shading)}))}else{L(THREE.NormalBlending);for(m=J-1;m>=0;m--)if(G=a.__webglObjects[m],G.render){t=G.object;z=G.buffer;u=G.opaque;i(t);for(G=0;G<u.count;G++)r=u.list[G],j(r.depthTest),n(r.depthWrite),k(r.polygonOffset,r.polygonOffsetFactor,r.polygonOffsetUnits),
+f(b,Oa,v,r,z,t)}for(m=0;m<W;m++)if(G=a.__webglObjectsImmediate[m],t=G.object,t.visible){E=-1;u=G.opaque;i(t);for(G=0;G<u.count;G++)r=u.list[G],j(r.depthTest),n(r.depthWrite),k(r.polygonOffset,r.polygonOffsetFactor,r.polygonOffsetUnits),Ga=e(b,Oa,v,r,t),t.immediateRenderCallback?t.immediateRenderCallback(Ga,d,X):t.render(function(a){h(a,Ga,r.shading)})}for(m=0;m<J;m++)if(G=a.__webglObjects[m],G.render){t=G.object;z=G.buffer;u=G.transparent;i(t);for(G=0;G<u.count;G++)r=u.list[G],L(r.blending),j(r.depthTest),
+n(r.depthWrite),k(r.polygonOffset,r.polygonOffsetFactor,r.polygonOffsetUnits),f(b,Oa,v,r,z,t)}for(m=0;m<W;m++)if(G=a.__webglObjectsImmediate[m],t=G.object,t.visible){E=-1;u=G.transparent;i(t);for(G=0;G<u.count;G++)r=u.list[G],L(r.blending),j(r.depthTest),n(r.depthWrite),k(r.polygonOffset,r.polygonOffsetFactor,r.polygonOffsetUnits),Ga=e(b,Oa,v,r,t),t.immediateRenderCallback?t.immediateRenderCallback(Ga,d,X):t.render(function(a){h(a,Ga,r.shading)})}}a.__webglSprites.length&&C(a,b);c&&c.minFilter!==
+THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&ka(c)};this.initWebGLObjects=function(a){if(!a.__webglObjects)a.__webglObjects=[],a.__webglObjectsImmediate=[],a.__webglSprites=[];for(;a.__objectsAdded.length;){var e=a.__objectsAdded[0],f=a,h=void 0,i=void 0,j=void 0;if(!e.__webglInit)if(e.__webglInit=!0,e._modelViewMatrix=new THREE.Matrix4,e._normalMatrixArray=new Float32Array(9),e._modelViewMatrixArray=new Float32Array(16),e._objectMatrixArray=new Float32Array(16),e.matrixWorld.flattenToArray(e._objectMatrixArray),
+e instanceof THREE.Mesh){i=e.geometry;if(i.geometryGroups==void 0){var j=i,k=void 0,m=void 0,n=void 0,l=void 0,t=n=void 0,p=void 0,s={},v=j.morphTargets!==void 0?j.morphTargets.length:0;j.geometryGroups={};k=0;for(m=j.faces.length;k<m;k++)n=j.faces[k],l=n.materialIndex,t=l!==void 0?l:-1,s[t]==void 0&&(s[t]={hash:t,counter:0}),p=s[t].hash+"_"+s[t].counter,j.geometryGroups[p]==void 0&&(j.geometryGroups[p]={faces:[],materialIndex:l,vertices:0,numMorphTargets:v}),n=n instanceof THREE.Face3?3:4,j.geometryGroups[p].vertices+
+n>65535&&(s[t].counter+=1,p=s[t].hash+"_"+s[t].counter,j.geometryGroups[p]==void 0&&(j.geometryGroups[p]={faces:[],materialIndex:l,vertices:0,numMorphTargets:v})),j.geometryGroups[p].faces.push(k),j.geometryGroups[p].vertices+=n;j.geometryGroupsList=[];k=void 0;for(k in j.geometryGroups)j.geometryGroups[k].id=ra++,j.geometryGroupsList.push(j.geometryGroups[k])}for(h in i.geometryGroups)if(j=i.geometryGroups[h],!j.__webglVertexBuffer){k=j;k.__webglVertexBuffer=d.createBuffer();k.__webglNormalBuffer=
+d.createBuffer();k.__webglTangentBuffer=d.createBuffer();k.__webglColorBuffer=d.createBuffer();k.__webglUVBuffer=d.createBuffer();k.__webglUV2Buffer=d.createBuffer();k.__webglSkinVertexABuffer=d.createBuffer();k.__webglSkinVertexBBuffer=d.createBuffer();k.__webglSkinIndicesBuffer=d.createBuffer();k.__webglSkinWeightsBuffer=d.createBuffer();k.__webglFaceBuffer=d.createBuffer();k.__webglLineBuffer=d.createBuffer();if(k.numMorphTargets){l=m=void 0;k.__webglMorphTargetsBuffers=[];m=0;for(l=k.numMorphTargets;m<
+l;m++)k.__webglMorphTargetsBuffers.push(d.createBuffer())}F.info.memory.geometries++;for(var l=e,u=n=s=void 0,t=u=v=u=void 0,p=t=k=0,z=n=void 0,B=void 0,n=m=v=s=void 0,v=l.geometry,z=v.faces,B=j.faces,s=0,n=B.length;s<n;s++)u=B[s],u=z[u],u instanceof THREE.Face3?(k+=3,t+=1,p+=3):u instanceof THREE.Face4&&(k+=4,t+=2,p+=4);s=b(l,j);n=s.map||s.lightMap||s instanceof THREE.ShaderMaterial?!0:!1;B=s instanceof THREE.MeshBasicMaterial&&!s.envMap||s instanceof THREE.MeshDepthMaterial?!1:s&&s.shading!=void 0&&
+s.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;z=s.vertexColors?s.vertexColors:!1;j.__vertexArray=new Float32Array(k*3);if(B)j.__normalArray=new Float32Array(k*3);if(v.hasTangents)j.__tangentArray=new Float32Array(k*4);if(z)j.__colorArray=new Float32Array(k*3);if(n){if(v.faceUvs.length>0||v.faceVertexUvs.length>0)j.__uvArray=new Float32Array(k*2);if(v.faceUvs.length>1||v.faceVertexUvs.length>1)j.__uv2Array=new Float32Array(k*2)}if(l.geometry.skinWeights.length&&l.geometry.skinIndices.length)j.__skinVertexAArray=
+new Float32Array(k*4),j.__skinVertexBArray=new Float32Array(k*4),j.__skinIndexArray=new Float32Array(k*4),j.__skinWeightArray=new Float32Array(k*4);j.__faceArray=new Uint16Array(t*3+(l.geometry.edgeFaces?l.geometry.edgeFaces.length*6:0));j.__lineArray=new Uint16Array(p*2);if(j.numMorphTargets){j.__morphTargetsArrays=[];v=0;for(u=j.numMorphTargets;v<u;v++)j.__morphTargetsArrays.push(new Float32Array(k*3))}j.__needsSmoothNormals=B==THREE.SmoothShading;j.__uvType=n;j.__vertexColorType=z;j.__normalType=
+B;j.__webglFaceCount=t*3+(l.geometry.edgeFaces?l.geometry.edgeFaces.length*6:0);j.__webglLineCount=p*2;if(s.attributes){if(j.__webglCustomAttributesList===void 0)j.__webglCustomAttributesList=[];l=void 0;for(l in s.attributes){n=s.attributes[l];v={};for(m in n)v[m]=n[m];if(!v.__webglInitialized||v.createUniqueBuffers)v.__webglInitialized=!0,t=1,v.type==="v2"?t=2:v.type==="v3"?t=3:v.type==="v4"?t=4:v.type==="c"&&(t=3),v.size=t,v.array=new Float32Array(k*t),v.buffer=d.createBuffer(),v.buffer.belongsToAttribute=
+l,n.needsUpdate=!0,v.__original=n;j.__webglCustomAttributesList.push(v)}}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(e instanceof THREE.Ribbon){if(i=e.geometry,!i.__webglVertexBuffer)j=i,j.__webglVertexBuffer=d.createBuffer(),j.__webglColorBuffer=d.createBuffer(),F.info.memory.geometries++,j=i,k=j.vertices.length,j.__vertexArray=new Float32Array(k*3),j.__colorArray=new Float32Array(k*
+3),j.__webglVertexCount=k,i.__dirtyVertices=!0,i.__dirtyColors=!0}else if(e instanceof THREE.Line){if(i=e.geometry,!i.__webglVertexBuffer)j=i,j.__webglVertexBuffer=d.createBuffer(),j.__webglColorBuffer=d.createBuffer(),F.info.memory.geometries++,j=i,k=j.vertices.length,j.__vertexArray=new Float32Array(k*3),j.__colorArray=new Float32Array(k*3),j.__webglLineCount=k,i.__dirtyVertices=!0,i.__dirtyColors=!0}else if(e instanceof THREE.ParticleSystem&&(i=e.geometry,!i.__webglVertexBuffer)){j=i;j.__webglVertexBuffer=
+d.createBuffer();j.__webglColorBuffer=d.createBuffer();F.info.geometries++;j=i;m=e;k=j.vertices.length;j.__vertexArray=new Float32Array(k*3);j.__colorArray=new Float32Array(k*3);j.__sortArray=[];j.__webglParticleCount=k;m=m.material;if(m.attributes){if(j.__webglCustomAttributesList===void 0)j.__webglCustomAttributesList=[];l=void 0;for(l in m.attributes){originalAttribute=m.attributes[l];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(k*size),attribute.buffer=d.createBuffer(),attribute.buffer.belongsToAttribute=l,originalAttribute.needsUpdate=!0,attribute.__original=originalAttribute;j.__webglCustomAttributesList.push(attribute)}}i.__dirtyVertices=!0;i.__dirtyColors=!0}if(!e.__webglActive){if(e instanceof
+THREE.Mesh)for(h in i=e.geometry,i.geometryGroups)j=i.geometryGroups[h],ha(f.__webglObjects,j,e);else e instanceof THREE.Ribbon||e instanceof THREE.Line||e instanceof THREE.ParticleSystem?(i=e.geometry,ha(f.__webglObjects,i,e)):THREE.MarchingCubes!==void 0&&e instanceof THREE.MarchingCubes||e.immediateRenderCallback?f.__webglObjectsImmediate.push({object:e,opaque:{list:[],count:0},transparent:{list:[],count:0}}):e instanceof THREE.Sprite&&f.__webglSprites.push(e);e.__webglActive=!0}a.__objectsAdded.splice(0,
+1)}for(;a.__objectsRemoved.length;){e=a.__objectsRemoved[0];f=a;if(e instanceof THREE.Mesh||e instanceof THREE.ParticleSystem||e instanceof THREE.Ribbon||e instanceof THREE.Line)qa(f.__webglObjects,e);else if(e instanceof THREE.Sprite){f=f.__webglSprites;h=e;i=void 0;for(i=f.length-1;i>=0;i--)f[i]==h&&f.splice(i,1)}else(e instanceof THREE.MarchingCubes||e.immediateRenderCallback)&&qa(f.__webglObjectsImmediate,e);e.__webglActive=!1;a.__objectsRemoved.splice(0,1)}e=0;for(f=a.__webglObjects.length;e<
+f;e++)if(i=a.__webglObjects[e].object,l=j=h=void 0,i instanceof THREE.Mesh){h=i.geometry;k=0;for(m=h.geometryGroupsList.length;k<m;k++)if(j=h.geometryGroupsList[k],l=wa(j,i),h.__dirtyVertices||h.__dirtyMorphTargets||h.__dirtyElements||h.__dirtyUvs||h.__dirtyNormals||h.__dirtyColors||h.__dirtyTangents||l)if(l=j,t=d.DYNAMIC_DRAW,p=!h.dynamic,l.__inittedArrays){var A=v=s=void 0,y=void 0,E=A=void 0,C=void 0,H=void 0,L=void 0,S=u=B=z=n=void 0,I=void 0,O=void 0,P=void 0,M=void 0,w=y=L=y=H=C=void 0,D=void 0,
+q=D=w=C=void 0,o=void 0,q=D=w=A=A=E=D=w=y=q=D=w=o=q=D=w=o=q=D=w=void 0,K=0,N=0,$=0,aa=0,T=0,Q=0,Y=0,R=0,la=0,x=0,na=0,U=q=0,U=void 0,oa=l.__vertexArray,ka=l.__uvArray,ma=l.__uv2Array,V=l.__normalArray,ca=l.__tangentArray,pa=l.__colorArray,da=l.__skinVertexAArray,ea=l.__skinVertexBArray,fa=l.__skinIndexArray,ga=l.__skinWeightArray,sa=l.__morphTargetsArrays,Z=l.__webglCustomAttributesList,o=void 0,ia=l.__faceArray,X=l.__lineArray,va=l.__needsSmoothNormals,z=l.__vertexColorType,n=l.__uvType,B=l.__normalType,
+ta=i.geometry,xa=ta.__dirtyVertices,ya=ta.__dirtyElements,ua=ta.__dirtyUvs,Aa=ta.__dirtyNormals,Ba=ta.__dirtyTangents,Ca=ta.__dirtyColors,Da=ta.__dirtyMorphTargets,za=ta.vertices,Fa=l.faces,Ka=ta.faces,Ha=ta.faceVertexUvs[0],Ia=ta.faceVertexUvs[1],La=ta.skinVerticesA,Ma=ta.skinVerticesB,Na=ta.skinIndices,Ja=ta.skinWeights,Ea=ta.morphTargets;if(Z){w=0;for(D=Z.length;w<D;w++)Z[w].offset=0,Z[w].offsetSrc=0}s=0;for(v=Fa.length;s<v;s++)if(A=Fa[s],y=Ka[A],Ha&&(u=Ha[A]),Ia&&(S=Ia[A]),A=y.vertexNormals,E=
+y.normal,C=y.vertexColors,H=y.color,L=y.vertexTangents,y instanceof THREE.Face3){if(xa)I=za[y.a].position,O=za[y.b].position,P=za[y.c].position,oa[N]=I.x,oa[N+1]=I.y,oa[N+2]=I.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(Z){w=0;for(D=Z.length;w<D;w++)if(o=Z[w],o.__original.needsUpdate)q=o.offset,U=o.offsetSrc,o.size===1?(o.boundTo===void 0||o.boundTo==="vertices"?(o.array[q]=o.value[y.a],o.array[q+1]=o.value[y.b],o.array[q+2]=o.value[y.c]):o.boundTo==="faces"?
+(U=o.value[U],o.array[q]=U,o.array[q+1]=U,o.array[q+2]=U,o.offsetSrc++):o.boundTo==="faceVertices"&&(o.array[q]=o.value[U],o.array[q+1]=o.value[U+1],o.array[q+2]=o.value[U+2],o.offsetSrc+=3),o.offset+=3):(o.boundTo===void 0||o.boundTo==="vertices"?(I=o.value[y.a],O=o.value[y.b],P=o.value[y.c]):o.boundTo==="faces"?(P=O=I=U=o.value[U],o.offsetSrc++):o.boundTo==="faceVertices"&&(I=o.value[U],O=o.value[U+1],P=o.value[U+2],o.offsetSrc+=3),o.size===2?(o.array[q]=I.x,o.array[q+1]=I.y,o.array[q+2]=O.x,o.array[q+
+3]=O.y,o.array[q+4]=P.x,o.array[q+5]=P.y,o.offset+=6):o.size===3?(o.type==="c"?(o.array[q]=I.r,o.array[q+1]=I.g,o.array[q+2]=I.b,o.array[q+3]=O.r,o.array[q+4]=O.g,o.array[q+5]=O.b,o.array[q+6]=P.r,o.array[q+7]=P.g,o.array[q+8]=P.b):(o.array[q]=I.x,o.array[q+1]=I.y,o.array[q+2]=I.z,o.array[q+3]=O.x,o.array[q+4]=O.y,o.array[q+5]=O.z,o.array[q+6]=P.x,o.array[q+7]=P.y,o.array[q+8]=P.z),o.offset+=9):(o.array[q]=I.x,o.array[q+1]=I.y,o.array[q+2]=I.z,o.array[q+3]=I.w,o.array[q+4]=O.x,o.array[q+5]=O.y,o.array[q+
+6]=O.z,o.array[q+7]=O.w,o.array[q+8]=P.x,o.array[q+9]=P.y,o.array[q+10]=P.z,o.array[q+11]=P.w,o.offset+=12))}if(Da){w=0;for(D=Ea.length;w<D;w++)I=Ea[w].vertices[y.a].position,O=Ea[w].vertices[y.b].position,P=Ea[w].vertices[y.c].position,q=sa[w],q[na]=I.x,q[na+1]=I.y,q[na+2]=I.z,q[na+3]=O.x,q[na+4]=O.y,q[na+5]=O.z,q[na+6]=P.x,q[na+7]=P.y,q[na+8]=P.z;na+=9}if(Ja.length)w=Ja[y.a],D=Ja[y.b],q=Ja[y.c],ga[x]=w.x,ga[x+1]=w.y,ga[x+2]=w.z,ga[x+3]=w.w,ga[x+4]=D.x,ga[x+5]=D.y,ga[x+6]=D.z,ga[x+7]=D.w,ga[x+8]=
+q.x,ga[x+9]=q.y,ga[x+10]=q.z,ga[x+11]=q.w,w=Na[y.a],D=Na[y.b],q=Na[y.c],fa[x]=w.x,fa[x+1]=w.y,fa[x+2]=w.z,fa[x+3]=w.w,fa[x+4]=D.x,fa[x+5]=D.y,fa[x+6]=D.z,fa[x+7]=D.w,fa[x+8]=q.x,fa[x+9]=q.y,fa[x+10]=q.z,fa[x+11]=q.w,w=La[y.a],D=La[y.b],q=La[y.c],da[x]=w.x,da[x+1]=w.y,da[x+2]=w.z,da[x+3]=1,da[x+4]=D.x,da[x+5]=D.y,da[x+6]=D.z,da[x+7]=1,da[x+8]=q.x,da[x+9]=q.y,da[x+10]=q.z,da[x+11]=1,w=Ma[y.a],D=Ma[y.b],q=Ma[y.c],ea[x]=w.x,ea[x+1]=w.y,ea[x+2]=w.z,ea[x+3]=1,ea[x+4]=D.x,ea[x+5]=D.y,ea[x+6]=D.z,ea[x+7]=
+1,ea[x+8]=q.x,ea[x+9]=q.y,ea[x+10]=q.z,ea[x+11]=1,x+=12;if(Ca&&z)C.length==3&&z==THREE.VertexColors?(y=C[0],w=C[1],D=C[2]):D=w=y=H,pa[la]=y.r,pa[la+1]=y.g,pa[la+2]=y.b,pa[la+3]=w.r,pa[la+4]=w.g,pa[la+5]=w.b,pa[la+6]=D.r,pa[la+7]=D.g,pa[la+8]=D.b,la+=9;if(Ba&&ta.hasTangents)C=L[0],H=L[1],y=L[2],ca[Y]=C.x,ca[Y+1]=C.y,ca[Y+2]=C.z,ca[Y+3]=C.w,ca[Y+4]=H.x,ca[Y+5]=H.y,ca[Y+6]=H.z,ca[Y+7]=H.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&&B)if(A.length==3&&va)for(w=0;w<3;w++)E=A[w],V[Q]=
+E.x,V[Q+1]=E.y,V[Q+2]=E.z,Q+=3;else for(w=0;w<3;w++)V[Q]=E.x,V[Q+1]=E.y,V[Q+2]=E.z,Q+=3;if(ua&&u!==void 0&&n)for(w=0;w<3;w++)A=u[w],ka[$]=A.u,ka[$+1]=A.v,$+=2;if(ua&&S!==void 0&&n)for(w=0;w<3;w++)A=S[w],ma[aa]=A.u,ma[aa+1]=A.v,aa+=2;ya&&(ia[T]=K,ia[T+1]=K+1,ia[T+2]=K+2,T+=3,X[R]=K,X[R+1]=K+1,X[R+2]=K,X[R+3]=K+2,X[R+4]=K+1,X[R+5]=K+2,R+=6,K+=3)}else if(y instanceof THREE.Face4){if(xa)I=za[y.a].position,O=za[y.b].position,P=za[y.c].position,M=za[y.d].position,oa[N]=I.x,oa[N+1]=I.y,oa[N+2]=I.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]=M.x,oa[N+10]=M.y,oa[N+11]=M.z,N+=12;if(Z){w=0;for(D=Z.length;w<D;w++)if(o=Z[w],o.__original.needsUpdate)q=o.offset,U=o.offsetSrc,o.size===1?(o.boundTo===void 0||o.boundTo==="vertices"?(o.array[q]=o.value[y.a],o.array[q+1]=o.value[y.b],o.array[q+2]=o.value[y.c],o.array[q+3]=o.value[y.d]):o.boundTo==="faces"?(U=o.value[U],o.array[q]=U,o.array[q+1]=U,o.array[q+2]=U,o.array[q+3]=U,o.offsetSrc++):o.boundTo==="faceVertices"&&(o.array[q]=
+o.value[U],o.array[q+1]=o.value[U+1],o.array[q+2]=o.value[U+2],o.array[q+3]=o.value[U+3],o.offsetSrc+=4),o.offset+=4):(o.boundTo===void 0||o.boundTo==="vertices"?(I=o.value[y.a],O=o.value[y.b],P=o.value[y.c],M=o.value[y.d]):o.boundTo==="faces"?(M=P=O=I=U=o.value[U],o.offsetSrc++):o.boundTo==="faceVertices"&&(I=o.value[U],O=o.value[U+1],P=o.value[U+2],M=o.value[U+3],o.offsetSrc+=4),o.size===2?(o.array[q]=I.x,o.array[q+1]=I.y,o.array[q+2]=O.x,o.array[q+3]=O.y,o.array[q+4]=P.x,o.array[q+5]=P.y,o.array[q+
+6]=M.x,o.array[q+7]=M.y,o.offset+=8):o.size===3?(o.type==="c"?(o.array[q]=I.r,o.array[q+1]=I.g,o.array[q+2]=I.b,o.array[q+3]=O.r,o.array[q+4]=O.g,o.array[q+5]=O.b,o.array[q+6]=P.r,o.array[q+7]=P.g,o.array[q+8]=P.b,o.array[q+9]=M.r,o.array[q+10]=M.g,o.array[q+11]=M.b):(o.array[q]=I.x,o.array[q+1]=I.y,o.array[q+2]=I.z,o.array[q+3]=O.x,o.array[q+4]=O.y,o.array[q+5]=O.z,o.array[q+6]=P.x,o.array[q+7]=P.y,o.array[q+8]=P.z,o.array[q+9]=M.x,o.array[q+10]=M.y,o.array[q+11]=M.z),o.offset+=12):(o.array[q]=I.x,
+o.array[q+1]=I.y,o.array[q+2]=I.z,o.array[q+3]=I.w,o.array[q+4]=O.x,o.array[q+5]=O.y,o.array[q+6]=O.z,o.array[q+7]=O.w,o.array[q+8]=P.x,o.array[q+9]=P.y,o.array[q+10]=P.z,o.array[q+11]=P.w,o.array[q+12]=M.x,o.array[q+13]=M.y,o.array[q+14]=M.z,o.array[q+15]=M.w,o.offset+=16))}if(Da){w=0;for(D=Ea.length;w<D;w++)I=Ea[w].vertices[y.a].position,O=Ea[w].vertices[y.b].position,P=Ea[w].vertices[y.c].position,M=Ea[w].vertices[y.d].position,q=sa[w],q[na]=I.x,q[na+1]=I.y,q[na+2]=I.z,q[na+3]=O.x,q[na+4]=O.y,
+q[na+5]=O.z,q[na+6]=P.x,q[na+7]=P.y,q[na+8]=P.z,q[na+9]=M.x,q[na+10]=M.y,q[na+11]=M.z;na+=12}if(Ja.length)w=Ja[y.a],D=Ja[y.b],q=Ja[y.c],o=Ja[y.d],ga[x]=w.x,ga[x+1]=w.y,ga[x+2]=w.z,ga[x+3]=w.w,ga[x+4]=D.x,ga[x+5]=D.y,ga[x+6]=D.z,ga[x+7]=D.w,ga[x+8]=q.x,ga[x+9]=q.y,ga[x+10]=q.z,ga[x+11]=q.w,ga[x+12]=o.x,ga[x+13]=o.y,ga[x+14]=o.z,ga[x+15]=o.w,w=Na[y.a],D=Na[y.b],q=Na[y.c],o=Na[y.d],fa[x]=w.x,fa[x+1]=w.y,fa[x+2]=w.z,fa[x+3]=w.w,fa[x+4]=D.x,fa[x+5]=D.y,fa[x+6]=D.z,fa[x+7]=D.w,fa[x+8]=q.x,fa[x+9]=q.y,fa[x+
+10]=q.z,fa[x+11]=q.w,fa[x+12]=o.x,fa[x+13]=o.y,fa[x+14]=o.z,fa[x+15]=o.w,w=La[y.a],D=La[y.b],q=La[y.c],o=La[y.d],da[x]=w.x,da[x+1]=w.y,da[x+2]=w.z,da[x+3]=1,da[x+4]=D.x,da[x+5]=D.y,da[x+6]=D.z,da[x+7]=1,da[x+8]=q.x,da[x+9]=q.y,da[x+10]=q.z,da[x+11]=1,da[x+12]=o.x,da[x+13]=o.y,da[x+14]=o.z,da[x+15]=1,w=Ma[y.a],D=Ma[y.b],q=Ma[y.c],y=Ma[y.d],ea[x]=w.x,ea[x+1]=w.y,ea[x+2]=w.z,ea[x+3]=1,ea[x+4]=D.x,ea[x+5]=D.y,ea[x+6]=D.z,ea[x+7]=1,ea[x+8]=q.x,ea[x+9]=q.y,ea[x+10]=q.z,ea[x+11]=1,ea[x+12]=y.x,ea[x+13]=
+y.y,ea[x+14]=y.z,ea[x+15]=1,x+=16;if(Ca&&z)C.length==4&&z==THREE.VertexColors?(y=C[0],w=C[1],D=C[2],C=C[3]):C=D=w=y=H,pa[la]=y.r,pa[la+1]=y.g,pa[la+2]=y.b,pa[la+3]=w.r,pa[la+4]=w.g,pa[la+5]=w.b,pa[la+6]=D.r,pa[la+7]=D.g,pa[la+8]=D.b,pa[la+9]=C.r,pa[la+10]=C.g,pa[la+11]=C.b,la+=12;if(Ba&&ta.hasTangents)C=L[0],H=L[1],y=L[2],L=L[3],ca[Y]=C.x,ca[Y+1]=C.y,ca[Y+2]=C.z,ca[Y+3]=C.w,ca[Y+4]=H.x,ca[Y+5]=H.y,ca[Y+6]=H.z,ca[Y+7]=H.w,ca[Y+8]=y.x,ca[Y+9]=y.y,ca[Y+10]=y.z,ca[Y+11]=y.w,ca[Y+12]=L.x,ca[Y+13]=L.y,
+ca[Y+14]=L.z,ca[Y+15]=L.w,Y+=16;if(Aa&&B)if(A.length==4&&va)for(w=0;w<4;w++)E=A[w],V[Q]=E.x,V[Q+1]=E.y,V[Q+2]=E.z,Q+=3;else for(w=0;w<4;w++)V[Q]=E.x,V[Q+1]=E.y,V[Q+2]=E.z,Q+=3;if(ua&&u!==void 0&&n)for(w=0;w<4;w++)A=u[w],ka[$]=A.u,ka[$+1]=A.v,$+=2;if(ua&&S!==void 0&&n)for(w=0;w<4;w++)A=S[w],ma[aa]=A.u,ma[aa+1]=A.v,aa+=2;ya&&(ia[T]=K,ia[T+1]=K+1,ia[T+2]=K+3,ia[T+3]=K+1,ia[T+4]=K+2,ia[T+5]=K+3,T+=6,X[R]=K,X[R+1]=K+1,X[R+2]=K,X[R+3]=K+3,X[R+4]=K+1,X[R+5]=K+2,X[R+6]=K+2,X[R+7]=K+3,R+=8,K+=4)}xa&&(d.bindBuffer(d.ARRAY_BUFFER,
+l.__webglVertexBuffer),d.bufferData(d.ARRAY_BUFFER,oa,t));if(Z){w=0;for(D=Z.length;w<D;w++)o=Z[w],o.__original.needsUpdate&&(d.bindBuffer(d.ARRAY_BUFFER,o.buffer),d.bufferData(d.ARRAY_BUFFER,o.array,t))}if(Da){w=0;for(D=Ea.length;w<D;w++)d.bindBuffer(d.ARRAY_BUFFER,l.__webglMorphTargetsBuffers[w]),d.bufferData(d.ARRAY_BUFFER,sa[w],t)}Ca&&la>0&&(d.bindBuffer(d.ARRAY_BUFFER,l.__webglColorBuffer),d.bufferData(d.ARRAY_BUFFER,pa,t));Aa&&(d.bindBuffer(d.ARRAY_BUFFER,l.__webglNormalBuffer),d.bufferData(d.ARRAY_BUFFER,
+V,t));Ba&&ta.hasTangents&&(d.bindBuffer(d.ARRAY_BUFFER,l.__webglTangentBuffer),d.bufferData(d.ARRAY_BUFFER,ca,t));ua&&$>0&&(d.bindBuffer(d.ARRAY_BUFFER,l.__webglUVBuffer),d.bufferData(d.ARRAY_BUFFER,ka,t));ua&&aa>0&&(d.bindBuffer(d.ARRAY_BUFFER,l.__webglUV2Buffer),d.bufferData(d.ARRAY_BUFFER,ma,t));ya&&(d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,l.__webglFaceBuffer),d.bufferData(d.ELEMENT_ARRAY_BUFFER,ia,t),d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,l.__webglLineBuffer),d.bufferData(d.ELEMENT_ARRAY_BUFFER,X,t));
+x>0&&(d.bindBuffer(d.ARRAY_BUFFER,l.__webglSkinVertexABuffer),d.bufferData(d.ARRAY_BUFFER,da,t),d.bindBuffer(d.ARRAY_BUFFER,l.__webglSkinVertexBBuffer),d.bufferData(d.ARRAY_BUFFER,ea,t),d.bindBuffer(d.ARRAY_BUFFER,l.__webglSkinIndicesBuffer),d.bufferData(d.ARRAY_BUFFER,fa,t),d.bindBuffer(d.ARRAY_BUFFER,l.__webglSkinWeightsBuffer),d.bufferData(d.ARRAY_BUFFER,ga,t));p&&(delete l.__inittedArrays,delete l.__colorArray,delete l.__normalArray,delete l.__tangentArray,delete l.__uvArray,delete l.__uv2Array,
+delete l.__faceArray,delete l.__vertexArray,delete l.__lineArray,delete l.__skinVertexAArray,delete l.__skinVertexBArray,delete l.__skinIndexArray,delete l.__skinWeightArray)}h.__dirtyVertices=!1;h.__dirtyMorphTargets=!1;h.__dirtyElements=!1;h.__dirtyUvs=!1;h.__dirtyNormals=!1;h.__dirtyTangents=!1;h.__dirtyColors=!1;ja(j,i)}else if(i instanceof THREE.Ribbon){h=i.geometry;if(h.__dirtyVertices||h.__dirtyColors){i=h;j=d.DYNAMIC_DRAW;k=s=p=p=void 0;v=i.vertices;m=i.colors;n=v.length;l=m.length;z=i.__vertexArray;
+t=i.__colorArray;B=i.__dirtyColors;if(i.__dirtyVertices){for(p=0;p<n;p++)s=v[p].position,k=p*3,z[k]=s.x,z[k+1]=s.y,z[k+2]=s.z;d.bindBuffer(d.ARRAY_BUFFER,i.__webglVertexBuffer);d.bufferData(d.ARRAY_BUFFER,z,j)}if(B){for(p=0;p<l;p++)color=m[p],k=p*3,t[k]=color.r,t[k+1]=color.g,t[k+2]=color.b;d.bindBuffer(d.ARRAY_BUFFER,i.__webglColorBuffer);d.bufferData(d.ARRAY_BUFFER,t,j)}}h.__dirtyVertices=!1;h.__dirtyColors=!1}else if(i instanceof THREE.Line){h=i.geometry;if(h.__dirtyVertices||h.__dirtyColors){i=
+h;j=d.DYNAMIC_DRAW;k=s=p=p=void 0;v=i.vertices;m=i.colors;n=v.length;l=m.length;z=i.__vertexArray;t=i.__colorArray;B=i.__dirtyColors;if(i.__dirtyVertices){for(p=0;p<n;p++)s=v[p].position,k=p*3,z[k]=s.x,z[k+1]=s.y,z[k+2]=s.z;d.bindBuffer(d.ARRAY_BUFFER,i.__webglVertexBuffer);d.bufferData(d.ARRAY_BUFFER,z,j)}if(B){for(p=0;p<l;p++)color=m[p],k=p*3,t[k]=color.r,t[k+1]=color.g,t[k+2]=color.b;d.bindBuffer(d.ARRAY_BUFFER,i.__webglColorBuffer);d.bufferData(d.ARRAY_BUFFER,t,j)}}h.__dirtyVertices=!1;h.__dirtyColors=
+!1}else if(i instanceof THREE.ParticleSystem)h=i.geometry,l=wa(h,i),(h.__dirtyVertices||h.__dirtyColors||i.sortParticles||l)&&c(h,d.DYNAMIC_DRAW,i),h.__dirtyVertices=!1,h.__dirtyColors=!1,ja(h,i)};this.setFaceCulling=function(a,b){a?(!b||b=="ccw"?d.frontFace(d.CCW):d.frontFace(d.CW),a=="back"?d.cullFace(d.BACK):a=="front"?d.cullFace(d.FRONT):d.cullFace(d.FRONT_AND_BACK),d.enable(d.CULL_FACE)):d.disable(d.CULL_FACE)};this.supportsVertexTextures=function(){return ab}};
+THREE.WebGLRenderTarget=function(a,b,c){this.width=a;this.height=b;c=c||{};this.wrapS=c.wrapS!==void 0?c.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=c.wrapT!==void 0?c.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=c.magFilter!==void 0?c.magFilter:THREE.LinearFilter;this.minFilter=c.minFilter!==void 0?c.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=c.format!==void 0?c.format:THREE.RGBAFormat;this.type=c.type!==void 0?c.type:
+THREE.UnsignedByteType;this.depthBuffer=c.depthBuffer!==void 0?c.depthBuffer:!0;this.stencilBuffer=c.stencilBuffer!==void 0?c.stencilBuffer:!0};
+THREE.WebGLRenderTarget.prototype.clone=function(){var a=new THREE.WebGLRenderTarget(this.width,this.height);a.wrapS=this.wrapS;a.wrapT=this.wrapT;a.magFilter=this.magFilter;a.minFilter=this.minFilter;a.offset.copy(this.offset);a.repeat.copy(this.repeat);a.format=this.format;a.type=this.type;a.depthBuffer=this.depthBuffer;a.stencilBuffer=this.stencilBuffer;return a};THREE.WebGLRenderTargetCube=function(a,b,c){THREE.WebGLRenderTarget.call(this,a,b,c);this.activeCubeFace=0};
 THREE.WebGLRenderTargetCube.prototype=new THREE.WebGLRenderTarget;THREE.WebGLRenderTargetCube.prototype.constructor=THREE.WebGLRenderTargetCube;

+ 3 - 8
examples/misc_lights_test.html

@@ -59,7 +59,7 @@
 			var windowHalfX = window.innerWidth / 2;
 			var windowHalfY = window.innerHeight / 2;
 
-			var render_canvas = 1, render_gl = 1;
+			var render_canvas = 0, render_gl = 1;
 			var has_gl = 0;
 
 			var bcanvas = document.getElementById( 'rcanvas' );
@@ -115,22 +115,17 @@
 				scene.add( ambient );
 
 				directionalLight = new THREE.DirectionalLight( 0xffffff );
-				directionalLight.position.y = -70;
-				directionalLight.position.z = 100;
-				directionalLight.position.normalize();
+				directionalLight.position.set( 0, -70, 100 ).normalize();
 				scene.add( directionalLight );
 
 				pointLight = new THREE.PointLight( 0xffaa00 );
-				pointLight.position.x = 0;
-				pointLight.position.y = 0;
-				pointLight.position.z = 0;
 				scene.add( pointLight );
 
 				lightMesh = new THREE.Mesh( geometry, new THREE.MeshBasicMaterial( { color: 0xffaa00 } ) );
 				lightMesh.scale.x = lightMesh.scale.y = lightMesh.scale.z = 0.05;
 				lightMesh.position = pointLight.position;
 				lightMesh.overdraw = true;
-				scene.add(lightMesh);
+				scene.add( lightMesh );
 
 
 				if ( render_canvas ) {

+ 28 - 29
examples/misc_materials_multimaterials.html

@@ -67,7 +67,7 @@
 			var windowHalfX = window.innerWidth / 2;
 			var windowHalfY = window.innerHeight / 2;
 
-			var render_canvas = 1, render_gl = 1;
+			var render_canvas = 0, render_gl = 1;
 			var has_gl = 0;
 
 			var bcanvas = document.getElementById( 'rcanvas' );
@@ -96,19 +96,28 @@
 
 				// SPHERES
 
+				var m1 = new THREE.MeshLambertMaterial( { color: 0xffffff } );
+				var m2 = new THREE.MeshBasicMaterial( { color: 0x000000, wireframe: true, wireframeLinewidth: 1.5, transparent: true } );
+
 				sphere = new THREE.SphereGeometry( 100, 16, 8 );
 
 				for ( var i = 0; i < 10; i ++ ) {
 
-					mesh = new THREE.Mesh( sphere, [ new THREE.MeshLambertMaterial( { color: 0xffffff } ), new THREE.MeshBasicMaterial( { color: 0x000000, wireframe: true,  wireframeLinewidth: 1.5 } ) ] );
+					var group = new THREE.Object3D();
 
-					mesh.position.x = 500 * ( Math.random() - 0.5 );
-					mesh.position.y = 500 * ( Math.random() - 0.5 );
-					mesh.position.z = 500 * ( Math.random() - 0.5 );
+					group.position.x = 500 * ( Math.random() - 0.5 );
+					group.position.y = 500 * ( Math.random() - 0.5 );
+					group.position.z = 500 * ( Math.random() - 0.5 );
 
-					mesh.scale.x = mesh.scale.y = mesh.scale.z = 0.25 * ( Math.random() + 0.5 );
+					group.scale.x = group.scale.y = group.scale.z = 0.25 * ( Math.random() + 0.5 );
 
-					scene.add( mesh );
+					scene.add( group );
+
+					var mesh1 = new THREE.Mesh( sphere, m1 );
+					var mesh2 = new THREE.Mesh( sphere, m2 );
+
+					group.add( mesh1 );
+					group.add( mesh2 );
 
 				}
 
@@ -119,8 +128,7 @@
 				scene.add( ambient );
 
 				directionalLight = new THREE.DirectionalLight( 0xffffff );
-				directionalLight.position.set( 0, -70, 100 );
-				directionalLight.position.normalize();
+				directionalLight.position.set( 0, -70, 100 ).normalize();
 				scene.add( directionalLight );
 
 				mesh = new THREE.Mesh( sphere, new THREE.MeshBasicMaterial( { color: 0xff0000 } ) );
@@ -212,26 +220,16 @@
 				xm1.map.needsUpdate = true;
 				xm2.map.needsUpdate = true;
 
-				geometry.materials[0].push( xm1 ); // goes to faces with material 0
-				geometry.materials[1].push( xm2 ); // goes to faces with material 1
-
-				geometry.materials[4].push( new THREE.MeshLambertMaterial( { color: 0xff0000, opacity: 0.5, transparent: true } ) );
+				geometry.materials[ 0 ] = xm1; // goes to faces with material 0
+				geometry.materials[ 1 ] = xm2; // goes to faces with material 1
 
-				var materials = [ new THREE.MeshFaceMaterial() ];
+				geometry.materials[ 4 ] = new THREE.MeshLambertMaterial( { color: 0xff0000, opacity: 0.5, transparent: true } );
 
-				// full-mesh wireframe overlay
-				//materials.push( new THREE.MeshBasicMaterial( { color: 0xff0000, wireframe: true, wireframeLinewidth: 1.5 } ) );
-
-				// full-mesh color overlay
-				//materials.push( new THREE.MeshBasicMaterial { color: 0xff0000, opacity: 0.5 } ) );
-
-				zmesh = new THREE.Mesh( geometry, materials );
-				zmesh.position.x = -80;
-				zmesh.position.z = 50;
-				zmesh.position.y = FLOOR;
+				zmesh = new THREE.Mesh( geometry, new THREE.MeshFaceMaterial() );
+				zmesh.position.set( -80, FLOOR, 50 );
 				zmesh.scale.x = zmesh.scale.y = zmesh.scale.z = 3;
 				zmesh.overdraw = true;
-				scene.add(zmesh);
+				scene.add( zmesh );
 
 				// PLANES with all materials from the model
 
@@ -250,7 +248,7 @@
 					mesh.position.z = -100;
 					mesh.scale.x = mesh.scale.y = mesh.scale.z = 1;
 					mesh.doubleSided = true;
-					scene.add(mesh);
+					scene.add( mesh );
 
 					// number
 					var x = document.createElement( "canvas" );
@@ -260,7 +258,7 @@
 					xc.shadowBlur = 7;
 					xc.fillStyle = "orange";
 					xc.font = "50pt arial bold";
-					xc.fillText(i, 10, 64);
+					xc.fillText( i, 10, 64 );
 
 					var xm = new THREE.MeshBasicMaterial( { map: new THREE.Texture( x ), transparent: true  } );
 					xm.map.needsUpdate = true;
@@ -271,12 +269,12 @@
 					mesh.position.z = - 99;
 					mesh.scale.x = mesh.scale.y = mesh.scale.z = 1;
 					mesh.doubleSided = true;
-					scene.add(mesh);
+					scene.add( mesh );
 				}
 
 			}
 
-			function onDocumentMouseMove(event) {
+			function onDocumentMouseMove( event ) {
 
 				mouseX = ( event.clientX - windowHalfX );
 				mouseY = ( event.clientY - windowHalfY );
@@ -298,6 +296,7 @@
 
 				camera.position.x += ( mouseX - camera.position.x ) * .05;
 				camera.position.y += ( - mouseY - camera.position.y ) * .05;
+
 				camera.lookAt( target );
 
 				if ( render_canvas ) canvasRenderer.render( scene, camera );

+ 18 - 9
examples/misc_ubiquity_test.html

@@ -32,7 +32,7 @@
 			var camera, scene;
 			var canvasRenderer, svgRenderer, webglRenderer;
 
-			var mesh, qrcode;
+			var mesh, group, qrcode;
 
 			var mouseX = 0, mouseY = 0;
 
@@ -97,7 +97,7 @@
 
 				var geometry = new THREE.Geometry();
 
-				for (var i = 0; i < 100; i ++) {
+				for ( var i = 0; i < 100; i ++ ) {
 
 					var v = new THREE.Vector3( Math.random() * 1000 - 500, Math.random() * 1000 - 500, Math.random() * 1000 - 500 );
 
@@ -109,19 +109,28 @@
 					v1.position.addSelf( v );
 					v2.position.addSelf( v );
 
-					var face = new THREE.Face3( geometry.vertices.push( v0 ) - 1, geometry.vertices.push( v1 ) - 1, geometry.vertices.push( v2 ) - 1, null, new THREE.MeshBasicMaterial( { color: Math.random() * 0xffffff } ) );
+					var face = new THREE.Face3( geometry.vertices.push( v0 ) - 1, geometry.vertices.push( v1 ) - 1, geometry.vertices.push( v2 ) - 1, null, null, geometry.materials.length );
+
+					geometry.materials.push( new THREE.MeshBasicMaterial( { color: Math.random() * 0xffffff } ) );
 
 					geometry.faces.push( face );
+
 				}
 
 				geometry.computeFaceNormals();
 				geometry.computeCentroids();
 
-				mesh = new THREE.Mesh( geometry, [ new THREE.MeshFaceMaterial(), new THREE.MeshBasicMaterial( { color: 0xff0000, opacity: 0.5, transparent: true, wireframe: true, wireframeLinewidth: 10 } ) ] );
+				group = new THREE.Object3D();
+				group.scale.x = group.scale.y = group.scale.z = 2;
+				scene.add( group );
+
+				mesh = new THREE.Mesh( geometry, new THREE.MeshFaceMaterial() );
 				mesh.doubleSided = true;
-				mesh.scale.x = mesh.scale.y = mesh.scale.z = 2;
-				scene.add( mesh );
+				group.add( mesh );
 
+				mesh = new THREE.Mesh( geometry, new THREE.MeshBasicMaterial( { color: 0xff0000, opacity: 0.5, transparent: true, wireframe: true, wireframeLinewidth: 10 } ) );
+				mesh.doubleSided = true;
+				group.add( mesh );
 
 				// LIGHTS
 
@@ -178,15 +187,15 @@
 				camera.position.y += ( - mouseY - camera.position.y ) * .05;
 				camera.lookAt( scene.position );
 
-				mesh.rotation.y += 0.01;
+				group.rotation.y += 0.01;
 
 				/*
 				qrcode.rotation.x += 0.01;
 				qrcode.rotation.z += 0.02;
 				*/
 
-				canvasRenderer.render( scene, camera );
-				svgRenderer.render( scene, camera );
+				//canvasRenderer.render( scene, camera );
+				//svgRenderer.render( scene, camera );
 				webglRenderer.render( scene, camera );
 
 			}

+ 8 - 3
examples/obj/Qrcode.js

@@ -2,9 +2,14 @@ var Qrcode = function () {
 
 	THREE.Geometry.call( this );
 
-	var scope = this,
-	m1 = new THREE.MeshLambertMaterial( { color: 0x000000, shading: THREE.FlatShading } ),
-	m2 = new THREE.MeshLambertMaterial( { color: 0xc0c0c0, shading: THREE.FlatShading } );
+	var scope = this;
+
+	scope.materials = [
+		new THREE.MeshLambertMaterial( { color: 0x000000, ambient: 0x000000, shading: THREE.FlatShading } ),
+		new THREE.MeshLambertMaterial( { color: 0xc0c0c0, ambient: 0xbbbbbb, shading: THREE.FlatShading } )
+	];
+
+	var m1 = 0, m2 = 1;
 
 	v(-54,134,58);
 	v(-54,146,58);

+ 3 - 3
examples/webgl_collisions_box.html

@@ -63,7 +63,7 @@
 
 				renderer = new THREE.WebGLRenderer();
 				renderer.setSize( window.innerWidth, window.innerHeight );
-				container.appendChild(renderer.domElement);
+				container.appendChild( renderer.domElement );
 
 				var ambientLight = new THREE.AmbientLight( 0x606060 );
 				scene.add( ambientLight );
@@ -122,12 +122,12 @@
 				if ( c ) {
 
 					info.innerHTML += "Found @ distance " + c.distance.toFixed(2);
-					c.mesh.materials[ 0 ].color.setHex( 0xaa0000 );
+					c.mesh.material.color.setHex( 0xaa0000 );
 
 				} else {
 
 					info.innerHTML += "No intersection";
-					cube.materials[0].color.setHex( 0x003300 );
+					cube.material.color.setHex( 0x003300 );
 
 				}
 

+ 4 - 4
examples/webgl_collisions_mesh.html

@@ -164,7 +164,7 @@
 				mesh.position = p;
 
 				scene.add( mesh );
-				var mc = THREE.CollisionUtils.MeshColliderWBox(mesh);
+				var mc = THREE.CollisionUtils.MeshColliderWBox( mesh) ;
 				THREE.Collisions.colliders.push( mc );
 				meshes.push( mesh );
 
@@ -187,9 +187,9 @@
 
 				var i, l = meshes.length;
 
-				for ( i = 0; i < l; i++ ) {
+				for ( i = 0; i < l; i ++ ) {
 
-					meshes[ i ].materials[ 0 ].color.setHex( 0x003300 );
+					meshes[ i ].material.color.setHex( 0x003300 );
 
 				}
 
@@ -203,7 +203,7 @@
 				if( c ) {
 
 					//info.innerHTML += "Found @ distance " + c.distance;
-					c.mesh.materials[ 0 ].color.setHex( 0xbb0000 );
+					c.mesh.material.color.setHex( 0xbb0000 );
 
 				} else {
 

+ 7 - 5
examples/webgl_collisions_normal.html

@@ -126,7 +126,7 @@
 				mesh.position = p;
 
 				scene.add( mesh );
-				var mc = THREE.CollisionUtils.MeshColliderWBox(mesh);
+				var mc = THREE.CollisionUtils.MeshColliderWBox( mesh );
 				THREE.Collisions.colliders.push( mc );
 				meshes.push( mesh );
 
@@ -154,8 +154,10 @@
 
 				var i, l = meshes.length;
 
-				for ( i = 0; i < l; i++ ) {
-					meshes[ i ].materials[ 0 ].color.setHex( 0x003300 );
+				for ( i = 0; i < l; i ++ ) {
+
+					meshes[ i ].material.color.setHex( 0x003300 );
+
 				}
 
 				info.innerHTML = "";
@@ -165,7 +167,7 @@
 
 				if( c ) {
 
-					info.innerHTML += "Found @ normal " + vts(c.normal);
+					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;
@@ -173,7 +175,7 @@
 					line.geometry.__dirtyVertices = true;
 					line.geometry.__dirtyElements = true;
 
-					c.mesh.materials[ 0 ].color.setHex( 0xbb0000 );
+					c.mesh.material.color.setHex( 0xbb0000 );
 
 				} else {
 

+ 6 - 4
examples/webgl_collisions_primitives.html

@@ -163,8 +163,10 @@
 
 				var ray = new THREE.Ray( camera.position, vector.subSelf( camera.position ).normalize() );
 
-				for ( var i = 0; i < geoms.length; i++) {
-					geoms[i].materials[0].color = new THREE.Color(0x007700);
+				for ( var i = 0; i < geoms.length; i ++ ) {
+
+					geoms[ i ].material.color.setHex( 0x007700 );
+
 				}
 
 				if ( !document.getElementById( "nearest" ).checked ) {
@@ -181,7 +183,7 @@
 
 						for ( var i = 0; i < cs.length; i ++ ) {
 
-							cs[ i ].mesh.materials[ 0 ].color.setHex( 0xaa0000 );
+							cs[ i ].mesh.material.color.setHex( 0xaa0000 );
 
 						}
 
@@ -202,7 +204,7 @@
 					if ( c ) {
 
 						info.innerHTML = "Found in " + tt + " @ distance " + c.distance;
-						c.mesh.materials[ 0 ].color.setHex( 0xaa0000 );
+						c.mesh.material.color.setHex( 0xaa0000 );
 
 					} else {
 

+ 2 - 2
examples/webgl_collisions_trigger.html

@@ -130,7 +130,7 @@
 
 				for ( var i = 0; i < cubes.length; i++ ) {
 
-					cubes[ i ].materials[ 0 ].color.setHex( 0x003300 );
+					cubes[ i ].material.color.setHex( 0x003300 );
 
 				}
 
@@ -141,7 +141,7 @@
 				if ( c && c.distance == -1 ) {
 
 					info.innerHTML = "Colliding!";
-					c.mesh.materials[ 0 ].color.setHex( 0xff0000 );
+					c.mesh.material.color.setHex( 0xff0000 );
 
 				} else if( c && c.distance >= 0 ) {
 

+ 11 - 12
examples/webgl_geometries.html

@@ -42,15 +42,15 @@
 
 				scene = new THREE.Scene();
 
-				var light, object, material;
+				var light, object, materials;
 
 				scene.add( new THREE.AmbientLight( 0x404040 ) );
 
-				light = new THREE.DirectionalLight( 0xffffff, 1 );
+				light = new THREE.DirectionalLight( 0xffffff );
 				light.position.z = 1;
 				scene.add( light );
 
-				material = [
+				materials = [
 					new THREE.MeshLambertMaterial( { ambient: 0xbbbbbb, map: THREE.ImageUtils.loadTexture( 'textures/UV.jpg' ) } ),
 					new THREE.MeshBasicMaterial( { color: 0xffffff, wireframe: true, transparent: true, opacity: 0.1 } )
 				];
@@ -58,25 +58,24 @@
 				group = new THREE.Object3D();
 				scene.add( group );
 
-				object = new THREE.Mesh( new THREE.CubeGeometry( 100, 100, 100, 4, 4, 4 ), material );
+				object = THREE.SceneUtils.createMultiMaterialObject( new THREE.CubeGeometry( 100, 100, 100, 4, 4, 4 ), materials );
 				object.position.set( -200, 0, 200 );
 				group.add( object );
 
-
-				object = new THREE.Mesh( new THREE.CylinderGeometry( 25, 75, 100, 40, 5 ), material );
+				object = THREE.SceneUtils.createMultiMaterialObject( new THREE.CylinderGeometry( 25, 75, 100, 40, 5 ), materials );
 				object.position.set( 0, 0, 200 );
 				group.add( object );
 
-				object = new THREE.Mesh( new THREE.IcosahedronGeometry( 2 ), material );
+				object = THREE.SceneUtils.createMultiMaterialObject( new THREE.IcosahedronGeometry( 2 ), materials );
 				object.position.set( 200, 0, 200 );
 				object.scale.x = object.scale.y = object.scale.z = 75;
 				group.add( object );
 
-				object = new THREE.Mesh( new THREE.PlaneGeometry( 100, 100, 4, 4 ), material );
+				object = THREE.SceneUtils.createMultiMaterialObject( new THREE.PlaneGeometry( 100, 100, 4, 4 ), materials );
 				object.position.set( -200, 0, 0 );
 				group.add( object );
 
-				object = new THREE.Mesh( new THREE.SphereGeometry( 75, 20, 10 ), material );
+				object = THREE.SceneUtils.createMultiMaterialObject( new THREE.SphereGeometry( 75, 20, 10 ), materials );
 				object.position.set( 0, 0, 0 );
 				group.add( object );
 
@@ -88,15 +87,15 @@
 
 				}
 
-				object = new THREE.Mesh( new THREE.LatheGeometry( points, 20 ), material );
+				object = THREE.SceneUtils.createMultiMaterialObject( new THREE.LatheGeometry( points, 20 ), materials );
 				object.position.set( 200, 0, 0 );
 				group.add( object );
 
-				object = new THREE.Mesh( new THREE.TorusGeometry( 50, 20, 20, 20 ), material );
+				object = THREE.SceneUtils.createMultiMaterialObject( new THREE.TorusGeometry( 50, 20, 20, 20 ), materials );
 				object.position.set( -200, 0, -200 );
 				group.add( object );
 
-				object = new THREE.Mesh( new THREE.TorusKnotGeometry( 50, 10, 50, 20 ), material );
+				object = THREE.SceneUtils.createMultiMaterialObject( new THREE.TorusKnotGeometry( 50, 10, 50, 20 ), materials );
 				object.position.set( 0, 0, -200 );
 				group.add( object );
 

+ 1 - 0
examples/webgl_geometry_blenderexport_colors.html

@@ -72,6 +72,7 @@
 				scene.add( light );
 
 				var loader = new THREE.JSONLoader();
+
 				loader.load( "obj/cubecolors/cubecolors.js", createScene1 );
 				loader.load( "obj/cubecolors/cube_fvc.js", createScene2 );
 

+ 5 - 23
examples/webgl_geometry_colors.html

@@ -48,7 +48,7 @@
 
 			var camera, scene, renderer;
 
-			var group1, group2, group3, light;
+			var mesh, group1, group2, group3, light;
 
 			var mouseX = 0, mouseY = 0;
 
@@ -141,42 +141,24 @@
 
 				];
 
-				group1 = new THREE.Object3D();
+				group1 = THREE.SceneUtils.createMultiMaterialObject( geometry, materials );
 				group1.position.x = -400;
-				group1.scale.x = group1.scale.y = group1.scale.z = 200;
 				group1.rotation.x = -1.87;
+				group1.scale.set( 200, 200, 200 );
 				scene.add( group1 );
 
-				var p1 = new THREE.Mesh( geometry, materials[ 0 ] );
-				var p2 = new THREE.Mesh( geometry, materials[ 1 ] );
-
-				group1.add( p1 );
-				group1.add( p2 );
-
-				group2 = new THREE.Object3D();
+				group2 = THREE.SceneUtils.createMultiMaterialObject( geometry2, materials );
 				group2.position.x = 400;
 				group2.rotation.x = 0;
 				group2.scale = group1.scale;
 				scene.add( group2 );
 
-				var p1 = new THREE.Mesh( geometry2, materials[ 0 ] );
-				var p2 = new THREE.Mesh( geometry2, materials[ 1 ] );
-
-				group2.add( p1 );
-				group2.add( p2 );
-
-				group3 = new THREE.Object3D();
+				group3 = THREE.SceneUtils.createMultiMaterialObject( geometry3, materials );
 				group3.position.x = 0;
 				group3.rotation.x = 0;
 				group3.scale = group1.scale;
 				scene.add( group3 );
 
-				var p1 = new THREE.Mesh( geometry3, materials[ 0 ] );
-				var p2 = new THREE.Mesh( geometry3, materials[ 1 ] );
-
-				group3.add( p1 );
-				group3.add( p2 );
-
 				renderer = new THREE.WebGLRenderer( { antialias: true } );
 				renderer.setSize( window.innerWidth, window.innerHeight );
 

+ 1 - 1
examples/webgl_geometry_shapes.html

@@ -74,7 +74,7 @@
 
 					// 3d shape
 
-					var mesh = new THREE.Mesh( geometry, [ new THREE.MeshLambertMaterial( { color: color } ), new THREE.MeshBasicMaterial( { color: 0x000000, wireframe: true } ) ] );
+					var mesh = THREE.SceneUtils.createMultiMaterialObject( geometry, [ new THREE.MeshLambertMaterial( { color: color } ), new THREE.MeshBasicMaterial( { color: 0x000000, wireframe: true, transparent: true } ) ] );
 					mesh.position.set( x, y, z - 75 );
 					mesh.rotation.set( rx, ry, rz );
 					mesh.scale.set( s, s, s );

+ 24 - 24
examples/webgl_geometry_subdivison.html

@@ -190,57 +190,57 @@
 
 
 				group = new THREE.Object3D();
-				group.add( new THREE.Mesh( geometry, new THREE.MeshBasicMaterial( { color: 0xfefefe, wireframe: true, opacity:0.5 } ) ) );
+				group.add( new THREE.Mesh( geometry, new THREE.MeshBasicMaterial( { color: 0xfefefe, wireframe: true, opacity: 0.5 } ) ) );
 				scene.add( group );
 
 
 				var debugNewPoints = false;
 				var debugOldPoints = false;
-				
+
 				// Debug new Points
-				
+
 				if (debugNewPoints) {
 					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 } ) );
 						particle.position = smooth.vertices[i].position;
 						var pos = smooth.vertices.position
 						particle.scale.x = particle.scale.y = 5;
 						group.add( particle );
 					}
-				
+
 				}
-				
-				
+
+
 				//Debug original points
-				
+
 				if (debugOldPoints) {
-					
+
 					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) } ) );
 						particle.position = smooth.vertices[i].position;
 						var pos = geometry.vertices.position
@@ -248,21 +248,21 @@
 						group.add( particle );
 					}
 				}
-				
+
 
 				var meshmaterials = [
 				 	// new THREE.MeshBasicMaterial( { color: 0x000000, shading: THREE.FlatShading, wireframe: true } )
 					new THREE.MeshLambertMaterial( { color: 0xffffff, shading: THREE.FlatShading, vertexColors: THREE.VertexColors } ),
-					new THREE.MeshBasicMaterial( { color: 0x405040, wireframe:true,  opacity:0.8 } )
+					new THREE.MeshBasicMaterial( { color: 0x405040, wireframe: true, opacity: 0.8, transparent: true } )
 				];
 
 				// 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.MeshFaceMaterial()
 				// new THREE.MeshPhongMaterial( { color: 0xffffff, shading: THREE.FlatShading } );
 				// new THREE.MeshPhongMaterial( { color: 0xffffff, shading: THREE.SmoothShading } );
 
-				cube = new THREE.Mesh( smooth, meshmaterials ); 
+				cube = THREE.SceneUtils.createMultiMaterialObject( smooth, meshmaterials );
 
 				var toscale =  params.scale ? params.scale : 1;
 
@@ -300,7 +300,7 @@
 
 				addStuff();
 
-				renderer = new THREE.WebGLRenderer(); // WebGLRenderer CanvasRenderer
+				renderer = new THREE.WebGLRenderer( { antialias: true } ); // WebGLRenderer CanvasRenderer
 				renderer.setSize( window.innerWidth, window.innerHeight );
 
 				container.appendChild( renderer.domElement );

+ 4 - 4
examples/webgl_interactive_cubes.html

@@ -143,17 +143,17 @@
 
 					if ( INTERSECTED != intersects[ 0 ].object ) {
 
-						if ( INTERSECTED ) INTERSECTED.materials[ 0 ].color.setHex( INTERSECTED.currentHex );
+						if ( INTERSECTED ) INTERSECTED.material.color.setHex( INTERSECTED.currentHex );
 
 						INTERSECTED = intersects[ 0 ].object;
-						INTERSECTED.currentHex = INTERSECTED.materials[ 0 ].color.getHex();
-						INTERSECTED.materials[ 0 ].color.setHex( 0xff0000 );
+						INTERSECTED.currentHex = INTERSECTED.material.color.getHex();
+						INTERSECTED.material.color.setHex( 0xff0000 );
 
 					}
 
 				} else {
 
-					if ( INTERSECTED ) INTERSECTED.materials[ 0 ].color.setHex( INTERSECTED.currentHex );
+					if ( INTERSECTED ) INTERSECTED.material.color.setHex( INTERSECTED.currentHex );
 
 					INTERSECTED = null;
 

+ 3 - 2
examples/webgl_lod_text.html

@@ -85,7 +85,7 @@
 				light.position.set( 0, 0, 1 ).normalize();
 				scene.add( light );
 
-				var wireMaterial = new THREE.MeshLambertMaterial( { color: 0xffffff, opacity: 0.5, wireframe: true } );
+				var wireMaterial = new THREE.MeshLambertMaterial( { color: 0xffffff, opacity: 0.5, wireframe: true, transparent: true } );
 
 				function getOptionsWithSegments( x, b, bevel ) {
 
@@ -109,6 +109,7 @@
 				var theText = "&"; // Try $ :)
 
 				// we could use TextPath and ExtrudeGeometry if we wish to optimize stuff futher
+
 				var geometry = [
 
 					[ new THREE.TextGeometry( theText, getOptionsWithSegments(8, 6, true)),
@@ -132,7 +133,7 @@
 
 					for ( i = 0; i < geometry.length; i++ ) {
 
-						mesh = new THREE.Mesh( geometry[ i ][ 0 ], geometry[ i ][ 2 ] );
+						mesh = new THREE.Mesh( geometry[ i ][ 0 ], geometry[ i ][ 2 ][ 1 ] );
 						mesh.scale.set( 1.5, 1.5, 1.5 );
 						mesh.updateMatrix();
 						mesh.matrixAutoUpdate = false;

+ 12 - 1
examples/webgl_materials.html

@@ -92,10 +92,21 @@
 				for ( var i = 0, l = geometry_pieces.faces.length; i < l; i ++ ) {
 
 					var face = geometry_pieces.faces[ i ];
-					if ( Math.random() > 0.7 ) face.materials = [ materials[ Math.floor( Math.random() * materials.length )  ] ];
+
+					if ( Math.random() > 0.7 )  {
+
+						face.materialIndex = Math.floor( Math.random() * materials.length );
+
+					} else {
+
+						face.materialIndex = 0;
+
+					}
 
 				}
 
+				geometry_pieces.materials = materials;
+
 				materials.push( new THREE.MeshFaceMaterial() );
 
 				objects = [];

+ 8 - 5
examples/webgl_materials_cars_anaglyph.html

@@ -503,7 +503,7 @@
 
 				var buttons, i, src = "";
 
-				for( i = 0; i < materials.length; i++ ) {
+				for( i = 0; i < materials.length; i ++ ) {
 
 					src += '<button id="' + button_name( car, i ) + '">' + materials[ i ][ 0 ] + '</button> ';
 
@@ -520,14 +520,14 @@
 
 			function attachButtonMaterials( materials, geometry, material_indices, car ) {
 
-				for( var i = 0; i < materials.length; i++ ) {
+				for( var i = 0; i < materials.length; i ++ ) {
 
 					$( button_name( car, i ) ).counter = i;
 					$( button_name( car, i ) ).addEventListener( 'click', function() {
 
-						for ( var j = 0; j < material_indices.length; j++ ) {
+						for ( var j = 0; j < material_indices.length; j ++ ) {
 
-							geometry.materials[ material_indices [ j ] ][ 0 ] = materials[ this.counter ][ 1 ];
+							geometry.materials[ material_indices [ j ] ] = materials[ this.counter ][ 1 ];
 
 						}
 
@@ -550,15 +550,18 @@
 
 				for( var i in CARS[ car ].mmap ) {
 
-					geometry.materials[ i ][ 0 ] = CARS[ car ].mmap[ i ];
+					geometry.materials[ i ] = CARS[ car ].mmap[ i ];
 
 				}
 
 				var mesh = new THREE.Mesh( geometry, m );
+
 				mesh.rotation.x = r[ 0 ];
 				mesh.rotation.y = r[ 1 ];
 				mesh.rotation.z = r[ 2 ];
+
 				mesh.scale.x = mesh.scale.y = mesh.scale.z = s;
+
 				scene.add( mesh );
 
 				CARS[ car ].object = mesh;

+ 12 - 12
examples/webgl_materials_cars_camaro_crosseyed.html

@@ -154,7 +154,7 @@
 
 				var i, src = "", parent = $( "buttons" );
 
-				for( i = 0; i < materials.length; i++ ) {
+				for( i = 0; i < materials.length; i ++ ) {
 
 					src += '<button id="m' + i + '">' + materials[ i ][ 0 ] + '</button>';
 
@@ -162,10 +162,10 @@
 
 				parent.innerHTML = src;
 
-				for( i = 0; i < materials.length; i++ ) {
+				for( i = 0; i < materials.length; i ++ ) {
 
 					$( "m" + i ).counter = i;
-					$( "m" + i ).addEventListener( 'click', function() { geometry.materials[ 0 ][ 0 ] = materials[ this.counter ][ 1 ] }, false );
+					$( "m" + i ).addEventListener( 'click', function() { geometry.materials[ 0 ] = materials[ this.counter ][ 1 ] }, false );
 
 				}
 
@@ -175,15 +175,15 @@
 
 				var s = 75, m = new THREE.MeshFaceMaterial();
 
-				geometry.materials[ 0 ][ 0 ] = materials.body[ 0 ][ 1 ]; // car body
-				geometry.materials[ 1 ][ 0 ] = materials.chrome; // wheels chrome
-				geometry.materials[ 2 ][ 0 ] = materials.chrome; // grille chrome
-				geometry.materials[ 3 ][ 0 ] = materials.darkchrome; // door lines
-				geometry.materials[ 4 ][ 0 ] = materials.glass; // windshield
-				geometry.materials[ 5 ][ 0 ] = materials.interior; // interior
-				geometry.materials[ 6 ][ 0 ] = materials.tire; // tire
-				geometry.materials[ 7 ][ 0 ] = materials.black; // tireling
-				geometry.materials[ 8 ][ 0 ] = materials.black; // behind grille
+				geometry.materials[ 0 ] = materials.body[ 0 ][ 1 ]; // car body
+				geometry.materials[ 1 ] = materials.chrome; // wheels chrome
+				geometry.materials[ 2 ] = materials.chrome; // grille chrome
+				geometry.materials[ 3 ] = materials.darkchrome; // door lines
+				geometry.materials[ 4 ] = materials.glass; // windshield
+				geometry.materials[ 5 ] = materials.interior; // interior
+				geometry.materials[ 6 ] = materials.tire; // tire
+				geometry.materials[ 7 ] = materials.black; // tireling
+				geometry.materials[ 8 ] = materials.black; // behind grille
 
 				var mesh = new THREE.Mesh( geometry, m );
 				mesh.rotation.y = 1;

+ 3 - 3
examples/webgl_materials_cars_parallaxbarrier.html

@@ -526,9 +526,9 @@
 					$( button_name( car, i ) ).counter = i;
 					$( button_name( car, i ) ).addEventListener( 'click', function() {
 
-						for ( var j = 0; j < material_indices.length; j++ ) {
+						for ( var j = 0; j < material_indices.length; j ++ ) {
 
-							geometry.materials[ material_indices [ j ] ][ 0 ] = materials[ this.counter ][ 1 ];
+							geometry.materials[ material_indices [ j ] ] = materials[ this.counter ][ 1 ];
 
 						}
 
@@ -551,7 +551,7 @@
 
 				for( var i in CARS[ car ].mmap ) {
 
-					geometry.materials[ i ][ 0 ] = CARS[ car ].mmap[ i ];
+					geometry.materials[ i ] = CARS[ car ].mmap[ i ];
 
 				}
 

+ 1 - 120
examples/webgl_materials_cubemap_dynamic.html

@@ -51,127 +51,8 @@
 			motion blur: <span class="h">b</span>
 			</div>
 		</div>
-<!--
+
 		<script src="../build/Three.js"></script>
--->
-		<script type="text/javascript" src="../src/Three.js"></script>
-		<script type="text/javascript" src="../src/core/Clock.js"></script>
-		<script type="text/javascript" src="../src/core/Color.js"></script>
-		<script type="text/javascript" src="../src/core/Vector2.js"></script>
-		<script type="text/javascript" src="../src/core/Vector3.js"></script>
-		<script type="text/javascript" src="../src/core/Vector4.js"></script>
-		<script type="text/javascript" src="../src/core/Ray.js"></script>
-		<script type="text/javascript" src="../src/core/Rectangle.js"></script>
-		<script type="text/javascript" src="../src/core/Math.js"></script>
-		<script type="text/javascript" src="../src/core/Matrix3.js"></script>
-		<script type="text/javascript" src="../src/core/Matrix4.js"></script>
-		<script type="text/javascript" src="../src/core/Object3D.js"></script>
-		<script type="text/javascript" src="../src/core/Projector.js"></script>
-		<script type="text/javascript" src="../src/core/Quaternion.js"></script>
-		<script type="text/javascript" src="../src/core/Vertex.js"></script>
-		<script type="text/javascript" src="../src/core/Face3.js"></script>
-		<script type="text/javascript" src="../src/core/Face4.js"></script>
-		<script type="text/javascript" src="../src/core/UV.js"></script>
-		<script type="text/javascript" src="../src/core/Geometry.js"></script>
-		<script type="text/javascript" src="../src/core/Spline.js"></script>
-		<script type="text/javascript" src="../src/core/Edge.js"></script>
-		<script type="text/javascript" src="../src/cameras/Camera.js"></script>
-		<script type="text/javascript" src="../src/cameras/OrthographicCamera.js"></script>
-		<script type="text/javascript" src="../src/cameras/PerspectiveCamera.js"></script>
-		<script type="text/javascript" src="../src/lights/Light.js"></script>
-		<script type="text/javascript" src="../src/lights/AmbientLight.js"></script>
-		<script type="text/javascript" src="../src/lights/DirectionalLight.js"></script>
-		<script type="text/javascript" src="../src/lights/PointLight.js"></script>
-		<script type="text/javascript" src="../src/lights/SpotLight.js"></script>
-		<script type="text/javascript" src="../src/materials/Material.js"></script>
-		<script type="text/javascript" src="../src/materials/LineBasicMaterial.js"></script>
-		<script type="text/javascript" src="../src/materials/MeshBasicMaterial.js"></script>
-		<script type="text/javascript" src="../src/materials/MeshLambertMaterial.js"></script>
-		<script type="text/javascript" src="../src/materials/MeshPhongMaterial.js"></script>
-		<script type="text/javascript" src="../src/materials/MeshDepthMaterial.js"></script>
-		<script type="text/javascript" src="../src/materials/MeshNormalMaterial.js"></script>
-		<script type="text/javascript" src="../src/materials/MeshFaceMaterial.js"></script>
-		<script type="text/javascript" src="../src/materials/MeshShaderMaterial.js"></script>
-		<script type="text/javascript" src="../src/materials/ParticleBasicMaterial.js"></script>
-		<script type="text/javascript" src="../src/materials/ParticleCanvasMaterial.js"></script>
-		<script type="text/javascript" src="../src/materials/ParticleDOMMaterial.js"></script>
-		<script type="text/javascript" src="../src/materials/ShaderMaterial.js"></script>
-		<script type="text/javascript" src="../src/textures/Texture.js"></script>
-		<script type="text/javascript" src="../src/textures/DataTexture.js"></script>
-		<script type="text/javascript" src="../src/objects/Particle.js"></script>
-		<script type="text/javascript" src="../src/objects/ParticleSystem.js"></script>
-		<script type="text/javascript" src="../src/objects/Line.js"></script>
-		<script type="text/javascript" src="../src/objects/Mesh.js"></script>
-		<script type="text/javascript" src="../src/objects/Bone.js"></script>
-		<script type="text/javascript" src="../src/objects/SkinnedMesh.js"></script>
-		<script type="text/javascript" src="../src/objects/MorphAnimMesh.js"></script>
-		<script type="text/javascript" src="../src/objects/Ribbon.js"></script>
-		<script type="text/javascript" src="../src/objects/LOD.js"></script>
-		<script type="text/javascript" src="../src/objects/Sprite.js"></script>
-		<script type="text/javascript" src="../src/scenes/Scene.js"></script>
-		<script type="text/javascript" src="../src/scenes/Fog.js"></script>
-		<script type="text/javascript" src="../src/scenes/FogExp2.js"></script>
-		<script type="text/javascript" src="../src/renderers/DOMRenderer.js"></script>
-		<script type="text/javascript" src="../src/renderers/CanvasRenderer.js"></script>
-		<script type="text/javascript" src="../src/renderers/SVGRenderer.js"></script>
-		<script type="text/javascript" src="../src/renderers/WebGLShaders.js"></script>
-		<script type="text/javascript" src="../src/renderers/WebGLRenderer.js"></script>
-		<script type="text/javascript" src="../src/renderers/WebGLRenderTarget.js"></script>
-		<script type="text/javascript" src="../src/renderers/WebGLRenderTargetCube.js"></script>
-		<script type="text/javascript" src="../src/renderers/renderables/RenderableVertex.js"></script>
-		<script type="text/javascript" src="../src/renderers/renderables/RenderableFace3.js"></script>
-		<script type="text/javascript" src="../src/renderers/renderables/RenderableFace4.js"></script>
-		<script type="text/javascript" src="../src/renderers/renderables/RenderableObject.js"></script>
-		<script type="text/javascript" src="../src/renderers/renderables/RenderableParticle.js"></script>
-		<script type="text/javascript" src="../src/renderers/renderables/RenderableLine.js"></script>
-		<script type="text/javascript" src="../src/extras/ColorUtils.js"></script>
-		<script type="text/javascript" src="../src/extras/GeometryUtils.js"></script>
-		<script type="text/javascript" src="../src/extras/ImageUtils.js"></script>
-		<script type="text/javascript" src="../src/extras/SceneUtils.js"></script>
-		<script type="text/javascript" src="../src/extras/ShaderUtils.js"></script>
-		<script type="text/javascript" src="../src/extras/core/Curve.js"></script>
-		<script type="text/javascript" src="../src/extras/core/CurvePath.js"></script>
-		<script type="text/javascript" src="../src/extras/core/Path.js"></script>
-		<script type="text/javascript" src="../src/extras/core/Shape.js"></script>
-		<script type="text/javascript" src="../src/extras/core/TextPath.js"></script>
-		<script type="text/javascript" src="../src/extras/animation/AnimationHandler.js"></script>
-		<script type="text/javascript" src="../src/extras/animation/Animation.js"></script>
-		<script type="text/javascript" src="../src/extras/cameras/CubeCamera.js"></script>
-		<script type="text/javascript" src="../src/extras/cameras/FirstPersonCamera.js"></script>
-		<script type="text/javascript" src="../src/extras/cameras/PathCamera.js"></script>
-		<script type="text/javascript" src="../src/extras/cameras/FlyCamera.js"></script>
-		<script type="text/javascript" src="../src/extras/cameras/RollCamera.js"></script>
-		<script type="text/javascript" src="../src/extras/cameras/TrackballCamera.js"></script>
-		<script type="text/javascript" src="../src/extras/cameras/CombinedCamera.js"></script>
-		<script type="text/javascript" src="../src/extras/controls/FirstPersonControls.js"></script>
-		<script type="text/javascript" src="../src/extras/controls/PathControls.js"></script>
-		<script type="text/javascript" src="../src/extras/controls/FlyControls.js"></script>
-		<script type="text/javascript" src="../src/extras/controls/RollControls.js"></script>
-		<script type="text/javascript" src="../src/extras/controls/TrackballControls.js"></script>
-		<script type="text/javascript" src="../src/extras/geometries/CubeGeometry.js"></script>
-		<script type="text/javascript" src="../src/extras/geometries/CylinderGeometry.js"></script>
-		<script type="text/javascript" src="../src/extras/geometries/ExtrudeGeometry.js"></script>
-		<script type="text/javascript" src="../src/extras/geometries/IcosahedronGeometry.js"></script>
-		<script type="text/javascript" src="../src/extras/geometries/LatheGeometry.js"></script>
-		<script type="text/javascript" src="../src/extras/geometries/OctahedronGeometry.js"></script>
-		<script type="text/javascript" src="../src/extras/geometries/PlaneGeometry.js"></script>
-		<script type="text/javascript" src="../src/extras/geometries/SphereGeometry.js"></script>
-		<script type="text/javascript" src="../src/extras/geometries/TextGeometry.js"></script>
-		<script type="text/javascript" src="../src/extras/geometries/TorusGeometry.js"></script>
-		<script type="text/javascript" src="../src/extras/geometries/TorusKnotGeometry.js"></script>
-		<script type="text/javascript" src="../src/extras/modifiers/SubdivisionModifier.js"></script>
-		<script type="text/javascript" src="../src/extras/loaders/Loader.js"></script>
-		<script type="text/javascript" src="../src/extras/loaders/BinaryLoader.js"></script>
-		<script type="text/javascript" src="../src/extras/loaders/ColladaLoader.js"></script>
-		<script type="text/javascript" src="../src/extras/loaders/JSONLoader.js"></script>
-		<script type="text/javascript" src="../src/extras/loaders/SceneLoader.js"></script>
-		<script type="text/javascript" src="../src/extras/loaders/UTF8Loader.js"></script>
-		<script type="text/javascript" src="../src/extras/objects/Axes.js"></script>
-		<script type="text/javascript" src="../src/extras/objects/MarchingCubes.js"></script>
-		<script type="text/javascript" src="../src/extras/physics/Collisions.js"></script>
-		<script type="text/javascript" src="../src/extras/physics/CollisionUtils.js"></script>
-		<script type="text/javascript" src="../src/extras/renderers/AnaglyphWebGLRenderer.js"></script>
-		<script type="text/javascript" src="../src/extras/renderers/CrosseyedWebGLRenderer.js"></script>
 
 		<script src="js/Detector.js"></script>
 		<script src="js/RequestAnimationFrame.js"></script>

+ 0 - 2
examples/webgl_materials_normalmap.html

@@ -222,8 +222,6 @@
 
 				geometry.computeTangents();
 
-				geometry.materials = [ material1 ];
-
 				mesh1 = new THREE.Mesh( geometry, material1 );
 				mesh1.position.x = - scale * 12;
 				mesh1.scale.set( scale, scale, scale );

+ 1 - 1
examples/webgl_materials_shaders.html

@@ -64,7 +64,7 @@
 			var windowHalfX = window.innerWidth / 2;
 			var windowHalfY = window.innerHeight / 2;
 
-			var render_canvas = 1, render_gl = 1;
+			var render_canvas = 0, render_gl = 1;
 			var has_gl = 0;
 
 			var bcanvas = document.getElementById( "rcanvas" );

+ 23 - 13
examples/webgl_multiple_canvases_circle.html

@@ -33,7 +33,7 @@
       -moz-transform-style: preserve-3d;
       transform-style: preserve-3d;
     }
-    
+
     #shape {
       position: relative;
       top: 160px;
@@ -47,7 +47,7 @@
 			transform: translateZ(-0px);
 			transform-style: preserve-3d;
     }
-    
+
     .ring {
       position: absolute;
       height: 300px;
@@ -111,7 +111,7 @@
         background-color: rgba(0,0,0,0.3);
         width: 50%;
     }
-    
+
   </style>
 </head>
 <body>
@@ -127,7 +127,7 @@
       </div>
     </div>
   </div>
-  
+
 	<div id="info"><a href="http://github.com/mrdoob/three.js" target="_blank">three.js</a> webgl - multiple canvases - circle</div>
   <div id="help" gstyle="display: none">
     <div>
@@ -157,7 +157,7 @@
         }
 
 				var rot = degToRad(30);
- 
+
 				var fudge = 0.45; // I don't know why this is needed :-(
 
 				apps.push( new App( 'container1', rot * -2 * fudge ) );
@@ -219,12 +219,14 @@
 					var shadowMaterial = new THREE.MeshBasicMaterial( { map: THREE.ImageUtils.loadTexture( 'textures/shadow.png' ) } );
 					var shadowGeo = new THREE.PlaneGeometry( 300, 300, 1, 1 );
 
-					for ( var i = 0; i < noof_balls; i++ ) { // create shadows
+					for ( var i = 0; i < noof_balls; i ++ ) { // create shadows
+
 						var mesh = new THREE.Mesh( shadowGeo, shadowMaterial );
 						mesh.position.y = - 250;
 						mesh.position.x = - (noof_balls - 1) /2 *400 + i * 400;
 						mesh.rotation.x = - 90 * Math.PI / 180;
 						scene.add( mesh );
+
 					}
 
 					var faceIndices = [ 'a', 'b', 'c', 'd' ];
@@ -233,13 +235,13 @@
 
 					geometry1 = new THREE.IcosahedronGeometry( 1 );
 
-					for ( var i = 0; i < geometry1.faces.length; i++ ) {
+					for ( var i = 0; i < geometry1.faces.length; i ++ ) {
 
 						f1 = geometry1.faces[ i ];
 
 						n = ( f1 instanceof THREE.Face3 ) ? 3 : 4;
 
-						for( var j = 0; j < n; j++ ) {
+						for( var j = 0; j < n; j ++ ) {
 
 							vertexIndex = f1[ faceIndices[ j ] ];
 
@@ -253,20 +255,28 @@
 							color = new THREE.Color( 0xffffff );
 							color.setHSV( 0.0, ( p.y + 1 ) / 2, 1.0 );
 						}
+
 					}
 
 
 					var materials = [
+
 						new THREE.MeshLambertMaterial( { color: 0xffffff, shading: THREE.FlatShading, vertexColors: THREE.VertexColors } ),
 						new THREE.MeshBasicMaterial( { color: 0x000000, shading: THREE.FlatShading, wireframe: true } )
+
 					];
 
-					for ( var i = 0; i < noof_balls; i++ ) { // create balls
-						var mesh = new THREE.Mesh( geometry1, materials );
+					var scaleMatrix = new THREE.Matrix4().setScale( 200, 200, 200 );
+					geometry1.applyMatrix( scaleMatrix );
+
+					for ( var i = 0; i < noof_balls; i ++ ) { // create balls
+
+						var mesh = THREE.SceneUtils.createMultiMaterialObject( geometry1, materials );
+
 						mesh.position.x = - (noof_balls - 1) /2 *400 + i *400;
-						mesh.scale.x = mesh.scale.y = mesh.scale.z = 200;
 						mesh.rotation.x = i * 0.5;
 						scene.add( mesh );
+
 					}
 
 					renderer = new THREE.WebGLRenderer( { antialias: true } );
@@ -284,7 +294,7 @@
 				}
 
 				function onDocumentMouseWheel (event ) {
-					
+
 					var delta = 0;
 					if (event.wheelDelta) {
 						delta = event.wheelDelta / 120;
@@ -306,7 +316,7 @@
 				};
 
 				function render() {
-                    
+
 					virtualCamera.position.x = -mouseX * 4;
 					virtualCamera.position.y = -mouseY * 4;
 					virtualCamera.position.z = cameraZ;

+ 31 - 29
examples/webgl_multiple_canvases_complex.html

@@ -108,7 +108,7 @@
 
 				var camera, scene, renderer;
 
-				var mesh, mesh2, mesh3, light;
+				var mesh, group1, group2, group3, light;
 
 				var mouseX = 0, mouseY = 0;
 
@@ -153,30 +153,30 @@
 
 					var faceIndices = [ 'a', 'b', 'c', 'd' ];
 
-					var color, f, f2, f3, p, n, vertexIndex,
+					var color, f1, f2, f3, p, n, vertexIndex,
 
-						geometry  = new THREE.IcosahedronGeometry( 1 ),
+						geometry1 = new THREE.IcosahedronGeometry( 1 ),
 						geometry2 = new THREE.IcosahedronGeometry( 1 ),
 						geometry3 = new THREE.IcosahedronGeometry( 1 );
 
-					for ( var i = 0; i < geometry.faces.length; i++ ) {
+					for ( var i = 0; i < geometry1.faces.length; i ++ ) {
 
-						f  = geometry.faces[ i ];
+						f1 = geometry1.faces[ i ];
 						f2 = geometry2.faces[ i ];
 						f3 = geometry3.faces[ i ];
 
-						n = ( f instanceof THREE.Face3 ) ? 3 : 4;
+						n = ( f1 instanceof THREE.Face3 ) ? 3 : 4;
 
-						for( var j = 0; j < n; j++ ) {
+						for( var j = 0; j < n; j ++ ) {
 
-							vertexIndex = f[ faceIndices[ j ] ];
+							vertexIndex = f1[ faceIndices[ j ] ];
 
-							p = geometry.vertices[ vertexIndex ].position;
+							p = geometry1.vertices[ vertexIndex ].position;
 
 							color = new THREE.Color( 0xffffff );
 							color.setHSV( ( p.y + 1 ) / 2, 1.0, 1.0 );
 
-							f.vertexColors[ j ] = color;
+							f1.vertexColors[ j ] = color;
 
 							color = new THREE.Color( 0xffffff );
 							color.setHSV( 0.0, ( p.y + 1 ) / 2, 1.0 );
@@ -184,7 +184,7 @@
 							f2.vertexColors[ j ] = color;
 
 							color = new THREE.Color( 0xffffff );
-							color.setHSV( 0.125 * vertexIndex/geometry.vertices.length, 1.0, 1.0 );
+							color.setHSV( 0.125 * vertexIndex / geometry1.vertices.length, 1.0, 1.0 );
 
 							f3.vertexColors[ j ] = color;
 
@@ -196,27 +196,29 @@
 					var materials = [
 
 						new THREE.MeshLambertMaterial( { color: 0xffffff, shading: THREE.FlatShading, vertexColors: THREE.VertexColors } ),
-						new THREE.MeshBasicMaterial( { color: 0x000000, shading: THREE.FlatShading, wireframe: true } )
+						new THREE.MeshBasicMaterial( { color: 0x000000, shading: THREE.FlatShading, wireframe: true, transparent: true } )
 
 					];
 
-					mesh = new THREE.Mesh( geometry, materials  );
-					mesh.position.x = -400;
-					mesh.scale.x = mesh.scale.y = mesh.scale.z = 200;
-					mesh.rotation.x = -1.87;
-					scene.add( mesh );
-
-					mesh2 = new THREE.Mesh( geometry2, materials  );
-					mesh2.position.x = 400;
-					mesh2.rotation.x = 0;
-					mesh2.scale = mesh.scale;
-					scene.add( mesh2 );
-
-					mesh3 = new THREE.Mesh( geometry3, materials  );
-					mesh3.position.x = 0;
-					mesh3.rotation.x = 0;
-					mesh3.scale = mesh.scale;
-					scene.add( mesh3 );
+					var scaleMatrix = new THREE.Matrix4().setScale( 200, 200, 200 );
+					geometry1.applyMatrix( scaleMatrix );
+					geometry2.applyMatrix( scaleMatrix );
+					geometry3.applyMatrix( scaleMatrix );
+
+					group1 = THREE.SceneUtils.createMultiMaterialObject( geometry1, materials );
+					group1.position.x = -400;
+					group1.rotation.x = -1.87;
+					scene.add( group1 );
+
+					group2 = THREE.SceneUtils.createMultiMaterialObject( geometry2, materials );
+					group2.position.x = 400;
+					group2.rotation.x = 0;
+					scene.add( group2 );
+
+					group3 = THREE.SceneUtils.createMultiMaterialObject( geometry3, materials );
+					group3.position.x = 0;
+					group3.rotation.x = 0;
+					scene.add( group3 );
 
 					renderer = new THREE.WebGLRenderer( { antialias: true } );
 					renderer.setSize( container.clientWidth, container.clientHeight );

+ 31 - 29
examples/webgl_multiple_canvases_grid.html

@@ -124,7 +124,7 @@
 
 				var camera, scene, renderer;
 
-				var mesh, mesh2, mesh3, light;
+				var mesh, group1, group2, group3, light;
 
 				var mouseX = 0, mouseY = 0;
 
@@ -169,30 +169,30 @@
 
 					var faceIndices = [ 'a', 'b', 'c', 'd' ];
 
-					var color, f, f2, f3, p, n, vertexIndex,
+					var color, f1, f2, f3, p, n, vertexIndex,
 
-						geometry  = new THREE.IcosahedronGeometry( 1 ),
+						geometry1 = new THREE.IcosahedronGeometry( 1 ),
 						geometry2 = new THREE.IcosahedronGeometry( 1 ),
 						geometry3 = new THREE.IcosahedronGeometry( 1 );
 
-					for ( var i = 0; i < geometry.faces.length; i++ ) {
+					for ( var i = 0; i < geometry1.faces.length; i ++ ) {
 
-						f  = geometry.faces[ i ];
+						f1 = geometry1.faces[ i ];
 						f2 = geometry2.faces[ i ];
 						f3 = geometry3.faces[ i ];
 
-						n = ( f instanceof THREE.Face3 ) ? 3 : 4;
+						n = ( f1 instanceof THREE.Face3 ) ? 3 : 4;
 
-						for( var j = 0; j < n; j++ ) {
+						for( var j = 0; j < n; j ++ ) {
 
-							vertexIndex = f[ faceIndices[ j ] ];
+							vertexIndex = f1[ faceIndices[ j ] ];
 
-							p = geometry.vertices[ vertexIndex ].position;
+							p = geometry1.vertices[ vertexIndex ].position;
 
 							color = new THREE.Color( 0xffffff );
 							color.setHSV( ( p.y + 1 ) / 2, 1.0, 1.0 );
 
-							f.vertexColors[ j ] = color;
+							f1.vertexColors[ j ] = color;
 
 							color = new THREE.Color( 0xffffff );
 							color.setHSV( 0.0, ( p.y + 1 ) / 2, 1.0 );
@@ -200,7 +200,7 @@
 							f2.vertexColors[ j ] = color;
 
 							color = new THREE.Color( 0xffffff );
-							color.setHSV( 0.125 * vertexIndex/geometry.vertices.length, 1.0, 1.0 );
+							color.setHSV( 0.125 * vertexIndex / geometry1.vertices.length, 1.0, 1.0 );
 
 							f3.vertexColors[ j ] = color;
 
@@ -212,27 +212,29 @@
 					var materials = [
 
 						new THREE.MeshLambertMaterial( { color: 0xffffff, shading: THREE.FlatShading, vertexColors: THREE.VertexColors } ),
-						new THREE.MeshBasicMaterial( { color: 0x000000, shading: THREE.FlatShading, wireframe: true } )
+						new THREE.MeshBasicMaterial( { color: 0x000000, shading: THREE.FlatShading, wireframe: true, transparent: true } )
 
 					];
 
-					mesh = new THREE.Mesh( geometry, materials  );
-					mesh.position.x = -400;
-					mesh.scale.x = mesh.scale.y = mesh.scale.z = 200;
-					mesh.rotation.x = -1.87;
-					scene.add( mesh );
-
-					mesh2 = new THREE.Mesh( geometry2, materials  );
-					mesh2.position.x = 400;
-					mesh2.rotation.x = 0;
-					mesh2.scale = mesh.scale;
-					scene.add( mesh2 );
-
-					mesh3 = new THREE.Mesh( geometry3, materials  );
-					mesh3.position.x = 0;
-					mesh3.rotation.x = 0;
-					mesh3.scale = mesh.scale;
-					scene.add( mesh3 );
+					var scaleMatrix = new THREE.Matrix4().setScale( 200, 200, 200 );
+					geometry1.applyMatrix( scaleMatrix );
+					geometry2.applyMatrix( scaleMatrix );
+					geometry3.applyMatrix( scaleMatrix );
+
+					group1 = THREE.SceneUtils.createMultiMaterialObject( geometry1, materials );
+					group1.position.x = -400;
+					group1.rotation.x = -1.87;
+					scene.add( group1 );
+
+					group2 = THREE.SceneUtils.createMultiMaterialObject( geometry2, materials );
+					group2.position.x = 400;
+					group2.rotation.x = 0;
+					scene.add( group2 );
+
+					group3 = THREE.SceneUtils.createMultiMaterialObject( geometry3, materials );
+					group3.position.x = 0;
+					group3.rotation.x = 0;
+					scene.add( group3 );
 
 					renderer = new THREE.WebGLRenderer( { antialias: true } );
 					renderer.setSize( container.clientWidth, container.clientHeight );

+ 1 - 1
examples/webgl_objconvert_test.html

@@ -59,7 +59,7 @@
 			var windowHalfX = window.innerWidth / 2;
 			var windowHalfY = window.innerHeight / 2;
 
-			var render_canvas = 1, render_gl = 1;
+			var render_canvas = 0, render_gl = 1;
 			var has_gl = 0;
 
 			var bcanvas = document.getElementById( "rcanvas" );

+ 7 - 5
examples/webgl_particles_shapes.html

@@ -163,11 +163,13 @@
 					bevelThickness: 2,
 					bevelSize: 2,
 
-					material: textMaterialFront,
-					extrudeMaterial: textMaterialSide
+					material: 0,
+					extrudeMaterial: 1
 
 				});
 
+				text3d.materials = [ textMaterialFront, textMaterialSide ];
+
 				text3d.computeVertexNormals();
 				text3d.computeBoundingBox();
 
@@ -186,8 +188,8 @@
                 text.rotation.y = Math.PI * 2;
 
 				parent = new THREE.Object3D();
-                parent.addChild( text );
-				scene.addObject( parent );
+                parent.add( text );
+				scene.add( parent );
 
 				///// Create particle objects for Three.js
 
@@ -353,7 +355,7 @@
 
 				}
 
-				parent.addChild( particleCloud );
+				parent.add( particleCloud );
 				particleCloud.y = 800;
 
 

+ 8 - 8
examples/webgl_scene_test.html

@@ -281,14 +281,14 @@
 
 					var mat_veyron = result.geometries[ "veyron" ].materials;
 
-					mat_veyron[ 0 ][ 0 ] = result.materials[ "interior" ];
-					mat_veyron[ 1 ][ 0 ] = result.materials[ "chrome" ];
-					mat_veyron[ 2 ][ 0 ] = result.materials[ "darkerchrome" ];
-					mat_veyron[ 3 ][ 0 ] = result.materials[ "glass" ];
-					mat_veyron[ 4 ][ 0 ] = result.materials[ "chrome" ];
-					mat_veyron[ 5 ][ 0 ] = result.materials[ "chrome" ];
-					mat_veyron[ 6 ][ 0 ] = result.materials[ "backlights" ];
-					mat_veyron[ 7 ][ 0 ] = result.materials[ "backsignals" ];
+					mat_veyron[ 0 ] = result.materials[ "interior" ];
+					mat_veyron[ 1 ] = result.materials[ "chrome" ];
+					mat_veyron[ 2 ] = result.materials[ "darkerchrome" ];
+					mat_veyron[ 3 ] = result.materials[ "glass" ];
+					mat_veyron[ 4 ] = result.materials[ "chrome" ];
+					mat_veyron[ 5 ] = result.materials[ "chrome" ];
+					mat_veyron[ 6 ] = result.materials[ "backlights" ];
+					mat_veyron[ 7 ] = result.materials[ "backsignals" ];
 
 					$( "message" ).style.display = "none";
 					$( "progressbar" ).style.display = "none";

+ 1 - 1
examples/webgl_shadowmap.html

@@ -247,7 +247,7 @@
 
 					var material = new THREE.MeshLambertMaterial( { color: 0xffaa55, morphTargets: true, vertexColors: THREE.FaceColors } );
 
-					geometry.materials[ 0 ] = material;
+					//geometry.materials[ 0 ] = material;
 
 					if ( fudgeColor ) {
 

+ 16 - 0
src/extras/SceneUtils.js

@@ -24,6 +24,22 @@ THREE.SceneUtils = {
 
 		}
 
+	},
+
+	createMultiMaterialObject : function ( geometry, materials ) {
+
+		var i, il = materials.length,
+			group = new THREE.Object3D();
+
+		for ( i = 0; i < il; i ++ ) {
+
+			var object = new THREE.Mesh( geometry, materials[ i ] );
+			group.add( object );
+
+		}
+
+		return group;
+
 	}
 
 };

+ 8 - 6
src/extras/loaders/SceneLoader.js

@@ -134,12 +134,14 @@ THREE.SceneLoader.prototype = {
 
 								var hasNormals = false;
 
-								materials = [];
-								for( i = 0; i < o.materials.length; i++ ) {
+								// not anymore support for multiple materials
+								// shouldn't really be array
 
-									materials[ i ] = result.materials[ o.materials[i] ];
+								for( i = 0; i < o.materials.length; i ++ ) {
 
-									hasNormals = materials[ i ] instanceof THREE.ShaderMaterial;
+									materials = result.materials[ o.materials[ i ] ];
+
+									hasNormals = materials instanceof THREE.ShaderMaterial;
 
 								}
 
@@ -160,7 +162,7 @@ THREE.SceneLoader.prototype = {
 
 								if ( materials.length == 0 ) {
 
-									materials[ 0 ] = new THREE.MeshFaceMaterial();
+									materials = new THREE.MeshFaceMaterial();
 
 								}
 
@@ -169,7 +171,7 @@ THREE.SceneLoader.prototype = {
 
 								if ( materials.length > 1 ) {
 
-									materials = [ new THREE.MeshFaceMaterial() ];
+									materials = new THREE.MeshFaceMaterial();
 
 								}
 

+ 21 - 3
src/renderers/WebGLRenderer.js

@@ -748,6 +748,24 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 	};
 
+	function getBufferMaterial( object, geometryGroup ) {
+
+		var material;
+
+		if ( object.material && ! ( object.material instanceof THREE.MeshFaceMaterial ) ) {
+
+			material = object.material;
+
+		} else if ( geometryGroup.materialIndex >= 0 ) {
+
+			material = object.geometry.materials[ geometryGroup.materialIndex ];
+
+		}
+
+		return material;
+
+	};
+
 	function initMeshBuffers ( geometryGroup, object ) {
 
 		var f, fl, fi, face,
@@ -785,7 +803,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 		}
 
-		material = ( geometryGroup.materialIndex >= 0 ) ? geometry.materials[ geometryGroup.materialIndex ] : object.material;
+		material = getBufferMaterial( object, geometryGroup );
 
 		uvType = bufferGuessUVType( material );
 		normalType = bufferGuessNormalType( material );
@@ -4408,7 +4426,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 	function areCustomAttributesDirty( geometryGroup, object ) {
 
-		var material = ( geometryGroup.materialIndex >= 0 ) ? object.geometry.materials[ geometryGroup.materialIndex ] : object.material;
+		var material = getBufferMaterial( object, geometryGroup );
 
 		if ( material.attributes ) {
 
@@ -4426,7 +4444,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 	function clearCustomAttributes( geometryGroup, object ) {
 
-		var material = ( geometryGroup.materialIndex >= 0 ) ? object.geometry.materials[ geometryGroup.materialIndex ] : object.material;
+		var material = getBufferMaterial( object, geometryGroup );
 
 		if ( material.attributes ) {
 

이 변경점에서 너무 많은 파일들이 변경되어 몇몇 파일들은 표시되지 않았습니다.