Browse Source

Moved computeMorphNormals from JSONLoader into Geometry.

alteredq 13 years ago
parent
commit
a372d5ee6c

File diff suppressed because it is too large
+ 114 - 112
build/Three.js


+ 8 - 6
build/custom/ThreeCanvas.js

@@ -87,12 +87,14 @@ THREE.Geometry.prototype={constructor:THREE.Geometry,applyMatrix:function(a){var
 b;a++)c=this.faces[a],c.centroid.set(0,0,0),c instanceof THREE.Face3?(c.centroid.addSelf(this.vertices[c.a].position),c.centroid.addSelf(this.vertices[c.b].position),c.centroid.addSelf(this.vertices[c.c].position),c.centroid.divideScalar(3)):c instanceof THREE.Face4&&(c.centroid.addSelf(this.vertices[c.a].position),c.centroid.addSelf(this.vertices[c.b].position),c.centroid.addSelf(this.vertices[c.c].position),c.centroid.addSelf(this.vertices[c.d].position),c.centroid.divideScalar(4))},computeFaceNormals:function(){var a,
 b,c,d,e,f,g=new THREE.Vector3,i=new THREE.Vector3;for(a=0,b=this.faces.length;a<b;a++)c=this.faces[a],d=this.vertices[c.a],e=this.vertices[c.b],f=this.vertices[c.c],g.sub(f.position,e.position),i.sub(d.position,e.position),g.crossSelf(i),g.isZero()||g.normalize(),c.normal.copy(g)},computeVertexNormals:function(){var a,b,c,d;if(void 0===this.__tmpVertices){d=this.__tmpVertices=Array(this.vertices.length);for(a=0,b=this.vertices.length;a<b;a++)d[a]=new THREE.Vector3;for(a=0,b=this.faces.length;a<b;a++)if(c=
 this.faces[a],c instanceof THREE.Face3)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(c instanceof THREE.Face4)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{d=this.__tmpVertices;for(a=0,b=this.vertices.length;a<b;a++)d[a].set(0,0,0)}for(a=0,b=this.faces.length;a<b;a++)c=this.faces[a],c instanceof THREE.Face3?(d[c.a].addSelf(c.normal),d[c.b].addSelf(c.normal),d[c.c].addSelf(c.normal)):c instanceof THREE.Face4&&(d[c.a].addSelf(c.normal),
-d[c.b].addSelf(c.normal),d[c.c].addSelf(c.normal),d[c.d].addSelf(c.normal));for(a=0,b=this.vertices.length;a<b;a++)d[a].normalize();for(a=0,b=this.faces.length;a<b;a++)c=this.faces[a],c instanceof THREE.Face3?(c.vertexNormals[0].copy(d[c.a]),c.vertexNormals[1].copy(d[c.b]),c.vertexNormals[2].copy(d[c.c])):c instanceof THREE.Face4&&(c.vertexNormals[0].copy(d[c.a]),c.vertexNormals[1].copy(d[c.b]),c.vertexNormals[2].copy(d[c.c]),c.vertexNormals[3].copy(d[c.d]))},computeTangents:function(){function a(a,
-b,c,d,e,f,F){i=a.vertices[b].position;m=a.vertices[c].position;h=a.vertices[d].position;l=g[e];o=g[f];n=g[F];j=m.x-i.x;p=h.x-i.x;k=m.y-i.y;q=h.y-i.y;x=m.z-i.z;v=h.z-i.z;I=o.u-l.u;G=n.u-l.u;w=o.v-l.v;H=n.v-l.v;A=1/(I*H-G*w);D.set((H*j-w*p)*A,(H*k-w*q)*A,(H*x-w*v)*A);J.set((I*p-G*j)*A,(I*q-G*k)*A,(I*v-G*x)*A);r[b].addSelf(D);r[c].addSelf(D);r[d].addSelf(D);s[b].addSelf(J);s[c].addSelf(J);s[d].addSelf(J)}var b,c,d,e,f,g,i,m,h,l,o,n,j,p,k,q,x,v,I,G,w,H,A,F,r=[],s=[],D=new THREE.Vector3,J=new THREE.Vector3,
-Z=new THREE.Vector3,ca=new THREE.Vector3,N=new THREE.Vector3;for(b=0,c=this.vertices.length;b<c;b++)r[b]=new THREE.Vector3,s[b]=new THREE.Vector3;for(b=0,c=this.faces.length;b<c;b++)f=this.faces[b],g=this.faceVertexUvs[0][b],f instanceof THREE.Face3?a(this,f.a,f.b,f.c,0,1,2):f instanceof THREE.Face4&&(a(this,f.a,f.b,f.c,0,1,2),a(this,f.a,f.b,f.d,0,1,3));var P=["a","b","c","d"];for(b=0,c=this.faces.length;b<c;b++){f=this.faces[b];for(d=0;d<f.vertexNormals.length;d++)N.copy(f.vertexNormals[d]),e=f[P[d]],
-F=r[e],Z.copy(F),Z.subSelf(N.multiplyScalar(N.dot(F))).normalize(),ca.cross(f.vertexNormals[d],F),e=ca.dot(s[e]),e=0>e?-1:1,f.vertexTangents[d]=new THREE.Vector4(Z.x,Z.y,Z.z,e)}this.hasTangents=!0},computeBoundingBox:function(){if(!this.boundingBox)this.boundingBox={min:new THREE.Vector3,max:new THREE.Vector3};if(0<this.vertices.length){var a;a=this.vertices[0].position;this.boundingBox.min.copy(a);this.boundingBox.max.copy(a);for(var b=this.boundingBox.min,c=this.boundingBox.max,d=1,e=this.vertices.length;d<
-e;d++){a=this.vertices[d].position;if(a.x<b.x)b.x=a.x;else if(a.x>c.x)c.x=a.x;if(a.y<b.y)b.y=a.y;else if(a.y>c.y)c.y=a.y;if(a.z<b.z)b.z=a.z;else if(a.z>c.z)c.z=a.z}}else this.boundingBox.min.set(0,0,0),this.boundingBox.max.set(0,0,0)},computeBoundingSphere:function(){if(!this.boundingSphere)this.boundingSphere={radius:0};for(var a,b=0,c=0,d=this.vertices.length;c<d;c++)a=this.vertices[c].position.length(),a>b&&(b=a);this.boundingSphere.radius=b},mergeVertices:function(){var a={},b=[],c=[],d,e=Math.pow(10,
-4),f,g;for(f=0,g=this.vertices.length;f<g;f++)d=this.vertices[f].position,d=[Math.round(d.x*e),Math.round(d.y*e),Math.round(d.z*e)].join("_"),void 0===a[d]?(a[d]=f,b.push(this.vertices[f]),c[f]=b.length-1):c[f]=c[a[d]];for(f=0,g=this.faces.length;f<g;f++)if(a=this.faces[f],a instanceof THREE.Face3)a.a=c[a.a],a.b=c[a.b],a.c=c[a.c];else if(a instanceof THREE.Face4)a.a=c[a.a],a.b=c[a.b],a.c=c[a.c],a.d=c[a.d];this.vertices=b}};THREE.GeometryCount=0;
+d[c.b].addSelf(c.normal),d[c.c].addSelf(c.normal),d[c.d].addSelf(c.normal));for(a=0,b=this.vertices.length;a<b;a++)d[a].normalize();for(a=0,b=this.faces.length;a<b;a++)c=this.faces[a],c instanceof THREE.Face3?(c.vertexNormals[0].copy(d[c.a]),c.vertexNormals[1].copy(d[c.b]),c.vertexNormals[2].copy(d[c.c])):c instanceof THREE.Face4&&(c.vertexNormals[0].copy(d[c.a]),c.vertexNormals[1].copy(d[c.b]),c.vertexNormals[2].copy(d[c.c]),c.vertexNormals[3].copy(d[c.d]))},computeMorphNormals:function(){var a,
+b,c,d,e;for(c=0,d=this.faces.length;c<d;c++){e=this.faces[c];e.__originalVertexNormals=[];for(a=0,b=e.vertexNormals.length;a<b;a++)e.__originalVertexNormals[a]=e.vertexNormals[a].clone()}var f=new THREE.Geometry;f.faces=this.faces;for(a=0,b=this.morphTargets.length;a<b;a++){var g=this.morphNormals[a];f.vertices=this.morphTargets[a].vertices;f.computeFaceNormals();f.computeVertexNormals();var i,m;for(c=0,d=this.faces.length;c<d;c++)e=this.faces[c],i=g.faceNormals[c],m=g.vertexNormals[c],i.copy(e.normal),
+e instanceof THREE.Face3?(m.a.copy(e.vertexNormals[0]),m.b.copy(e.vertexNormals[1]),m.c.copy(e.vertexNormals[2])):(m.a.copy(e.vertexNormals[0]),m.b.copy(e.vertexNormals[1]),m.c.copy(e.vertexNormals[2]),m.d.copy(e.vertexNormals[3]))}for(c=0,d=this.faces.length;c<d;c++)e=this.faces[c],e.vertexNormals=e.__originalVertexNormals},computeTangents:function(){function a(a,b,c,d,e,f,F){i=a.vertices[b].position;m=a.vertices[c].position;h=a.vertices[d].position;l=g[e];o=g[f];n=g[F];j=m.x-i.x;p=h.x-i.x;k=m.y-
+i.y;q=h.y-i.y;x=m.z-i.z;v=h.z-i.z;I=o.u-l.u;G=n.u-l.u;w=o.v-l.v;H=n.v-l.v;A=1/(I*H-G*w);D.set((H*j-w*p)*A,(H*k-w*q)*A,(H*x-w*v)*A);J.set((I*p-G*j)*A,(I*q-G*k)*A,(I*v-G*x)*A);r[b].addSelf(D);r[c].addSelf(D);r[d].addSelf(D);s[b].addSelf(J);s[c].addSelf(J);s[d].addSelf(J)}var b,c,d,e,f,g,i,m,h,l,o,n,j,p,k,q,x,v,I,G,w,H,A,F,r=[],s=[],D=new THREE.Vector3,J=new THREE.Vector3,Z=new THREE.Vector3,ca=new THREE.Vector3,N=new THREE.Vector3;for(b=0,c=this.vertices.length;b<c;b++)r[b]=new THREE.Vector3,s[b]=new THREE.Vector3;
+for(b=0,c=this.faces.length;b<c;b++)f=this.faces[b],g=this.faceVertexUvs[0][b],f instanceof THREE.Face3?a(this,f.a,f.b,f.c,0,1,2):f instanceof THREE.Face4&&(a(this,f.a,f.b,f.c,0,1,2),a(this,f.a,f.b,f.d,0,1,3));var P=["a","b","c","d"];for(b=0,c=this.faces.length;b<c;b++){f=this.faces[b];for(d=0;d<f.vertexNormals.length;d++)N.copy(f.vertexNormals[d]),e=f[P[d]],F=r[e],Z.copy(F),Z.subSelf(N.multiplyScalar(N.dot(F))).normalize(),ca.cross(f.vertexNormals[d],F),e=ca.dot(s[e]),e=0>e?-1:1,f.vertexTangents[d]=
+new THREE.Vector4(Z.x,Z.y,Z.z,e)}this.hasTangents=!0},computeBoundingBox:function(){if(!this.boundingBox)this.boundingBox={min:new THREE.Vector3,max:new THREE.Vector3};if(0<this.vertices.length){var a;a=this.vertices[0].position;this.boundingBox.min.copy(a);this.boundingBox.max.copy(a);for(var b=this.boundingBox.min,c=this.boundingBox.max,d=1,e=this.vertices.length;d<e;d++){a=this.vertices[d].position;if(a.x<b.x)b.x=a.x;else if(a.x>c.x)c.x=a.x;if(a.y<b.y)b.y=a.y;else if(a.y>c.y)c.y=a.y;if(a.z<b.z)b.z=
+a.z;else if(a.z>c.z)c.z=a.z}}else this.boundingBox.min.set(0,0,0),this.boundingBox.max.set(0,0,0)},computeBoundingSphere:function(){if(!this.boundingSphere)this.boundingSphere={radius:0};for(var a,b=0,c=0,d=this.vertices.length;c<d;c++)a=this.vertices[c].position.length(),a>b&&(b=a);this.boundingSphere.radius=b},mergeVertices:function(){var a={},b=[],c=[],d,e=Math.pow(10,4),f,g;for(f=0,g=this.vertices.length;f<g;f++)d=this.vertices[f].position,d=[Math.round(d.x*e),Math.round(d.y*e),Math.round(d.z*
+e)].join("_"),void 0===a[d]?(a[d]=f,b.push(this.vertices[f]),c[f]=b.length-1):c[f]=c[a[d]];for(f=0,g=this.faces.length;f<g;f++)if(a=this.faces[f],a instanceof THREE.Face3)a.a=c[a.a],a.b=c[a.b],a.c=c[a.c];else if(a instanceof THREE.Face4)a.a=c[a.a],a.b=c[a.b],a.c=c[a.c],a.d=c[a.d];this.vertices=b}};THREE.GeometryCount=0;
 THREE.Camera=function(){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;this.projectionMatrixInverse=new THREE.Matrix4};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;
 THREE.Camera.prototype.lookAt=function(a){this.matrix.lookAt(this.position,a,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)};THREE.OrthographicCamera=function(a,b,c,d,e,f){THREE.Camera.call(this);this.left=a;this.right=b;this.top=c;this.bottom=d;this.near=void 0!==e?e:0.1;this.far=void 0!==f?f:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=new THREE.Camera;THREE.OrthographicCamera.prototype.constructor=THREE.OrthographicCamera;
 THREE.OrthographicCamera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makeOrtho(this.left,this.right,this.top,this.bottom,this.near,this.far)};THREE.PerspectiveCamera=function(a,b,c,d){THREE.Camera.call(this);this.fov=void 0!==a?a:50;this.aspect=void 0!==b?b:1;this.near=void 0!==c?c:0.1;this.far=void 0!==d?d:2E3;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype=new THREE.Camera;THREE.PerspectiveCamera.prototype.constructor=THREE.PerspectiveCamera;

+ 126 - 127
build/custom/ThreeExtras.js

@@ -1,20 +1,20 @@
 // ThreeExtras.js - http://github.com/mrdoob/three.js
 'use strict';THREE.ColorUtils={adjustHSV:function(a,b,c,d){var f=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(a,f);f.h=THREE.Math.clamp(f.h+b,0,1);f.s=THREE.Math.clamp(f.s+c,0,1);f.v=THREE.Math.clamp(f.v+d,0,1);a.setHSV(f.h,f.s,f.v)},rgbToHsv:function(a,b){var c=a.r,d=a.g,f=a.b,g=Math.max(Math.max(c,d),f),e=Math.min(Math.min(c,d),f);if(e===g)e=c=0;else{var h=g-e,e=h/g,c=(c===g?(d-f)/h:d===g?2+(f-c)/h:4+(c-d)/h)/6;0>c&&(c+=1);1<c&&(c-=1)}void 0===b&&(b={h:0,s:0,v:0});b.h=c;b.s=e;b.v=g;return b}};
 THREE.ColorUtils.__hsv={h:0,s:0,v:0};
-THREE.GeometryUtils={merge:function(a,b){for(var c,d,f=a.vertices.length,g=b instanceof THREE.Mesh?b.geometry:b,e=a.vertices,h=g.vertices,i=a.faces,j=g.faces,k=a.faceVertexUvs[0],q=g.faceVertexUvs[0],l={},n=0;n<a.materials.length;n++)l[a.materials[n].id]=n;if(b instanceof THREE.Mesh)b.matrixAutoUpdate&&b.updateMatrix(),c=b.matrix,d=new THREE.Matrix4,d.extractRotation(c,b.scale);for(var n=0,r=h.length;n<r;n++){var m=new THREE.Vertex(h[n].position.clone());c&&c.multiplyVector3(m.position);e.push(m)}for(n=
-0,r=j.length;n<r;n++){var e=j[n],o,p,s=e.vertexNormals,t=e.vertexColors;e instanceof THREE.Face3?o=new THREE.Face3(e.a+f,e.b+f,e.c+f):e instanceof THREE.Face4&&(o=new THREE.Face4(e.a+f,e.b+f,e.c+f,e.d+f));o.normal.copy(e.normal);d&&d.multiplyVector3(o.normal);h=0;for(m=s.length;h<m;h++)p=s[h].clone(),d&&d.multiplyVector3(p),o.vertexNormals.push(p);o.color.copy(e.color);h=0;for(m=t.length;h<m;h++)p=t[h],o.vertexColors.push(p.clone());if(void 0!==e.materialIndex){h=g.materials[e.materialIndex];m=h.id;
-t=l[m];if(void 0===t)t=a.materials.length,l[m]=t,a.materials.push(h);o.materialIndex=t}o.centroid.copy(e.centroid);c&&c.multiplyVector3(o.centroid);i.push(o)}for(n=0,r=q.length;n<r;n++){c=q[n];d=[];h=0;for(m=c.length;h<m;h++)d.push(new THREE.UV(c[h].u,c[h].v));k.push(d)}},clone:function(a){var b=new THREE.Geometry,c,d=a.vertices,f=a.faces,g=a.faceVertexUvs[0];if(a.materials)b.materials=a.materials.slice();for(a=0,c=d.length;a<c;a++){var e=new THREE.Vertex(d[a].position.clone());b.vertices.push(e)}for(a=
-0,c=f.length;a<c;a++){var h=f[a],i,j,k=h.vertexNormals,q=h.vertexColors;h instanceof THREE.Face3?i=new THREE.Face3(h.a,h.b,h.c):h instanceof THREE.Face4&&(i=new THREE.Face4(h.a,h.b,h.c,h.d));i.normal.copy(h.normal);d=0;for(e=k.length;d<e;d++)j=k[d],i.vertexNormals.push(j.clone());i.color.copy(h.color);d=0;for(e=q.length;d<e;d++)j=q[d],i.vertexColors.push(j.clone());i.materialIndex=h.materialIndex;i.centroid.copy(h.centroid);b.faces.push(i)}for(a=0,c=g.length;a<c;a++){f=g[a];i=[];d=0;for(e=f.length;d<
+THREE.GeometryUtils={merge:function(a,b){for(var c,d,f=a.vertices.length,g=b instanceof THREE.Mesh?b.geometry:b,e=a.vertices,h=g.vertices,i=a.faces,k=g.faces,j=a.faceVertexUvs[0],q=g.faceVertexUvs[0],l={},n=0;n<a.materials.length;n++)l[a.materials[n].id]=n;if(b instanceof THREE.Mesh)b.matrixAutoUpdate&&b.updateMatrix(),c=b.matrix,d=new THREE.Matrix4,d.extractRotation(c,b.scale);for(var n=0,r=h.length;n<r;n++){var m=new THREE.Vertex(h[n].position.clone());c&&c.multiplyVector3(m.position);e.push(m)}for(n=
+0,r=k.length;n<r;n++){var e=k[n],o,p,s=e.vertexNormals,t=e.vertexColors;e instanceof THREE.Face3?o=new THREE.Face3(e.a+f,e.b+f,e.c+f):e instanceof THREE.Face4&&(o=new THREE.Face4(e.a+f,e.b+f,e.c+f,e.d+f));o.normal.copy(e.normal);d&&d.multiplyVector3(o.normal);h=0;for(m=s.length;h<m;h++)p=s[h].clone(),d&&d.multiplyVector3(p),o.vertexNormals.push(p);o.color.copy(e.color);h=0;for(m=t.length;h<m;h++)p=t[h],o.vertexColors.push(p.clone());if(void 0!==e.materialIndex){h=g.materials[e.materialIndex];m=h.id;
+t=l[m];if(void 0===t)t=a.materials.length,l[m]=t,a.materials.push(h);o.materialIndex=t}o.centroid.copy(e.centroid);c&&c.multiplyVector3(o.centroid);i.push(o)}for(n=0,r=q.length;n<r;n++){c=q[n];d=[];h=0;for(m=c.length;h<m;h++)d.push(new THREE.UV(c[h].u,c[h].v));j.push(d)}},clone:function(a){var b=new THREE.Geometry,c,d=a.vertices,f=a.faces,g=a.faceVertexUvs[0];if(a.materials)b.materials=a.materials.slice();for(a=0,c=d.length;a<c;a++){var e=new THREE.Vertex(d[a].position.clone());b.vertices.push(e)}for(a=
+0,c=f.length;a<c;a++){var h=f[a],i,k,j=h.vertexNormals,q=h.vertexColors;h instanceof THREE.Face3?i=new THREE.Face3(h.a,h.b,h.c):h instanceof THREE.Face4&&(i=new THREE.Face4(h.a,h.b,h.c,h.d));i.normal.copy(h.normal);d=0;for(e=j.length;d<e;d++)k=j[d],i.vertexNormals.push(k.clone());i.color.copy(h.color);d=0;for(e=q.length;d<e;d++)k=q[d],i.vertexColors.push(k.clone());i.materialIndex=h.materialIndex;i.centroid.copy(h.centroid);b.faces.push(i)}for(a=0,c=g.length;a<c;a++){f=g[a];i=[];d=0;for(e=f.length;d<
 e;d++)i.push(new THREE.UV(f[d].u,f[d].v));b.faceVertexUvs[0].push(i)}return b},randomPointInTriangle:function(a,b,c){var d,f,g,e=new THREE.Vector3,h=THREE.GeometryUtils.__v1;d=THREE.GeometryUtils.random();f=THREE.GeometryUtils.random();1<d+f&&(d=1-d,f=1-f);g=1-d-f;e.copy(a);e.multiplyScalar(d);h.copy(b);h.multiplyScalar(f);e.addSelf(h);h.copy(c);h.multiplyScalar(g);e.addSelf(h);return e},randomPointInFace:function(a,b,c){var d,f,g;if(a instanceof THREE.Face3)return d=b.vertices[a.a].position,f=b.vertices[a.b].position,
 g=b.vertices[a.c].position,THREE.GeometryUtils.randomPointInTriangle(d,f,g);if(a instanceof THREE.Face4){d=b.vertices[a.a].position;f=b.vertices[a.b].position;g=b.vertices[a.c].position;var b=b.vertices[a.d].position,e;c?a._area1&&a._area2?(c=a._area1,e=a._area2):(c=THREE.GeometryUtils.triangleArea(d,f,b),e=THREE.GeometryUtils.triangleArea(f,g,b),a._area1=c,a._area2=e):(c=THREE.GeometryUtils.triangleArea(d,f,b),e=THREE.GeometryUtils.triangleArea(f,g,b));return THREE.GeometryUtils.random()*(c+e)<c?
-THREE.GeometryUtils.randomPointInTriangle(d,f,b):THREE.GeometryUtils.randomPointInTriangle(f,g,b)}},randomPointsInGeometry:function(a,b){function c(a){function b(c,d){if(d<c)return c;var f=c+Math.floor((d-c)/2);return j[f]>a?b(c,f-1):j[f]<a?b(f+1,d):f}return b(0,j.length-1)}var d,f,g=a.faces,e=a.vertices,h=g.length,i=0,j=[],k,q,l,n;for(f=0;f<h;f++){d=g[f];if(d instanceof THREE.Face3)k=e[d.a].position,q=e[d.b].position,l=e[d.c].position,d._area=THREE.GeometryUtils.triangleArea(k,q,l);else if(d instanceof
-THREE.Face4)k=e[d.a].position,q=e[d.b].position,l=e[d.c].position,n=e[d.d].position,d._area1=THREE.GeometryUtils.triangleArea(k,q,n),d._area2=THREE.GeometryUtils.triangleArea(q,l,n),d._area=d._area1+d._area2;i+=d._area;j[f]=i}d=[];for(f=0;f<b;f++)e=THREE.GeometryUtils.random()*i,e=c(e),d[f]=THREE.GeometryUtils.randomPointInFace(g[e],a,!0);return d},triangleArea:function(a,b,c){var d,f=THREE.GeometryUtils.__v1;f.sub(a,b);d=f.length();f.sub(a,c);a=f.length();f.sub(b,c);c=f.length();b=0.5*(d+a+c);return Math.sqrt(b*
+THREE.GeometryUtils.randomPointInTriangle(d,f,b):THREE.GeometryUtils.randomPointInTriangle(f,g,b)}},randomPointsInGeometry:function(a,b){function c(a){function b(c,d){if(d<c)return c;var f=c+Math.floor((d-c)/2);return k[f]>a?b(c,f-1):k[f]<a?b(f+1,d):f}return b(0,k.length-1)}var d,f,g=a.faces,e=a.vertices,h=g.length,i=0,k=[],j,q,l,n;for(f=0;f<h;f++){d=g[f];if(d instanceof THREE.Face3)j=e[d.a].position,q=e[d.b].position,l=e[d.c].position,d._area=THREE.GeometryUtils.triangleArea(j,q,l);else if(d instanceof
+THREE.Face4)j=e[d.a].position,q=e[d.b].position,l=e[d.c].position,n=e[d.d].position,d._area1=THREE.GeometryUtils.triangleArea(j,q,n),d._area2=THREE.GeometryUtils.triangleArea(q,l,n),d._area=d._area1+d._area2;i+=d._area;k[f]=i}d=[];for(f=0;f<b;f++)e=THREE.GeometryUtils.random()*i,e=c(e),d[f]=THREE.GeometryUtils.randomPointInFace(g[e],a,!0);return d},triangleArea:function(a,b,c){var d,f=THREE.GeometryUtils.__v1;f.sub(a,b);d=f.length();f.sub(a,c);a=f.length();f.sub(b,c);c=f.length();b=0.5*(d+a+c);return Math.sqrt(b*
 (b-d)*(b-a)*(b-c))},center:function(a){a.computeBoundingBox();var b=a.boundingBox,c=new THREE.Vector3;c.add(b.min,b.max);c.multiplyScalar(-0.5);a.applyMatrix((new THREE.Matrix4).setTranslation(c.x,c.y,c.z));a.computeBoundingBox();return c},normalizeUVs:function(a){for(var a=a.faceVertexUvs[0],b=0,c=a.length;b<c;b++)for(var d=a[b],f=0,g=d.length;f<g;f++)1!==d[f].u&&(d[f].u-=Math.floor(d[f].u)),1!==d[f].v&&(d[f].v-=Math.floor(d[f].v))}};THREE.GeometryUtils.random=THREE.Math.random16;
 THREE.GeometryUtils.__v1=new THREE.Vector3;
 THREE.ImageUtils={crossOrigin:"anonymous",loadTexture:function(a,b,c){var d=new Image,f=new THREE.Texture(d,b);d.onload=function(){f.needsUpdate=!0;c&&c(this)};d.crossOrigin=this.crossOrigin;d.src=a;return f},loadTextureCube:function(a,b,c){var d,f=[],g=new THREE.Texture(f,b);f.loadCount=0;for(b=0,d=a.length;b<d;++b)f[b]=new Image,f[b].onload=function(){f.loadCount+=1;if(6===f.loadCount)g.needsUpdate=!0;c&&c(this)},f[b].crossOrigin=this.crossOrigin,f[b].src=a[b];return g},getNormalMap:function(a,
-b){var c=function(a){var b=Math.sqrt(a[0]*a[0]+a[1]*a[1]+a[2]*a[2]);return[a[0]/b,a[1]/b,a[2]/b]},b=b|1,d=a.width,f=a.height,g=document.createElement("canvas");g.width=d;g.height=f;var e=g.getContext("2d");e.drawImage(a,0,0);for(var h=e.getImageData(0,0,d,f).data,i=e.createImageData(d,f),j=i.data,k=0;k<d;k++)for(var q=1;q<f;q++){var l=0>q-1?f-1:q-1,n=(q+1)%f,r=0>k-1?d-1:k-1,m=(k+1)%d,o=[],p=[0,0,h[4*(q*d+k)]/255*b];o.push([-1,0,h[4*(q*d+r)]/255*b]);o.push([-1,-1,h[4*(l*d+r)]/255*b]);o.push([0,-1,
-h[4*(l*d+k)]/255*b]);o.push([1,-1,h[4*(l*d+m)]/255*b]);o.push([1,0,h[4*(q*d+m)]/255*b]);o.push([1,1,h[4*(n*d+m)]/255*b]);o.push([0,1,h[4*(n*d+k)]/255*b]);o.push([-1,1,h[4*(n*d+r)]/255*b]);l=[];r=o.length;for(n=0;n<r;n++){var m=o[n],s=o[(n+1)%r],m=[m[0]-p[0],m[1]-p[1],m[2]-p[2]],s=[s[0]-p[0],s[1]-p[1],s[2]-p[2]];l.push(c([m[1]*s[2]-m[2]*s[1],m[2]*s[0]-m[0]*s[2],m[0]*s[1]-m[1]*s[0]]))}o=[0,0,0];for(n=0;n<l.length;n++)o[0]+=l[n][0],o[1]+=l[n][1],o[2]+=l[n][2];o[0]/=l.length;o[1]/=l.length;o[2]/=l.length;
-p=4*(q*d+k);j[p]=255*((o[0]+1)/2)|0;j[p+1]=255*(o[1]+0.5)|0;j[p+2]=255*o[2]|0;j[p+3]=255}e.putImageData(i,0,0);return g}};
+b){var c=function(a){var b=Math.sqrt(a[0]*a[0]+a[1]*a[1]+a[2]*a[2]);return[a[0]/b,a[1]/b,a[2]/b]},b=b|1,d=a.width,f=a.height,g=document.createElement("canvas");g.width=d;g.height=f;var e=g.getContext("2d");e.drawImage(a,0,0);for(var h=e.getImageData(0,0,d,f).data,i=e.createImageData(d,f),k=i.data,j=0;j<d;j++)for(var q=1;q<f;q++){var l=0>q-1?f-1:q-1,n=(q+1)%f,r=0>j-1?d-1:j-1,m=(j+1)%d,o=[],p=[0,0,h[4*(q*d+j)]/255*b];o.push([-1,0,h[4*(q*d+r)]/255*b]);o.push([-1,-1,h[4*(l*d+r)]/255*b]);o.push([0,-1,
+h[4*(l*d+j)]/255*b]);o.push([1,-1,h[4*(l*d+m)]/255*b]);o.push([1,0,h[4*(q*d+m)]/255*b]);o.push([1,1,h[4*(n*d+m)]/255*b]);o.push([0,1,h[4*(n*d+j)]/255*b]);o.push([-1,1,h[4*(n*d+r)]/255*b]);l=[];r=o.length;for(n=0;n<r;n++){var m=o[n],s=o[(n+1)%r],m=[m[0]-p[0],m[1]-p[1],m[2]-p[2]],s=[s[0]-p[0],s[1]-p[1],s[2]-p[2]];l.push(c([m[1]*s[2]-m[2]*s[1],m[2]*s[0]-m[0]*s[2],m[0]*s[1]-m[1]*s[0]]))}o=[0,0,0];for(n=0;n<l.length;n++)o[0]+=l[n][0],o[1]+=l[n][1],o[2]+=l[n][2];o[0]/=l.length;o[1]/=l.length;o[2]/=l.length;
+p=4*(q*d+j);k[p]=255*((o[0]+1)/2)|0;k[p+1]=255*(o[1]+0.5)|0;k[p+2]=255*o[2]|0;k[p+3]=255}e.putImageData(i,0,0);return g}};
 THREE.SceneUtils={showHierarchy:function(a,b){THREE.SceneUtils.traverseHierarchy(a,function(a){a.visible=b})},traverseHierarchy:function(a,b){var c,d,f=a.children.length;for(d=0;d<f;d++)c=a.children[d],b(c),THREE.SceneUtils.traverseHierarchy(c,b)},createMultiMaterialObject:function(a,b){var c,d=b.length,f=new THREE.Object3D;for(c=0;c<d;c++){var g=new THREE.Mesh(a,b[c]);f.add(g)}return f},cloneObject:function(a){var b;a instanceof THREE.MorphAnimMesh?(b=new THREE.MorphAnimMesh(a.geometry,a.material),
 b.duration=a.duration,b.mirroredLoop=a.mirroredLoop,b.time=a.time,b.lastKeyframe=a.lastKeyframe,b.currentKeyframe=a.currentKeyframe,b.direction=a.direction,b.directionBackwards=a.directionBackwards):a instanceof THREE.SkinnedMesh?b=new THREE.SkinnedMesh(a.geometry,a.material):a instanceof THREE.Mesh?b=new THREE.Mesh(a.geometry,a.material):a instanceof THREE.Line?b=new THREE.Line(a.geometry,a.material,a.type):a instanceof THREE.Ribbon?b=new THREE.Ribbon(a.geometry,a.material):a instanceof THREE.ParticleSystem?
 (b=new THREE.ParticleSystem(a.geometry,a.material),b.sortParticles=a.sortParticles):a instanceof THREE.Particle?b=new THREE.Particle(a.material):a instanceof THREE.Sprite?(b=new THREE.Sprite({}),b.color.copy(a.color),b.map=a.map,b.blending=a.blending,b.useScreenCoordinates=a.useScreenCoordinates,b.mergeWith3D=a.mergeWith3D,b.affectedByDistance=a.affectedByDistance,b.scaleByViewport=a.scaleByViewport,b.alignment=a.alignment,b.rotation3d.copy(a.rotation3d),b.rotation=a.rotation,b.opacity=a.opacity,
@@ -63,37 +63,37 @@ THREE.Path.prototype.quadraticCurveTo=function(a,b,c,d){var f=Array.prototype.sl
 THREE.Path.prototype.bezierCurveTo=function(a,b,c,d,f,g){var e=Array.prototype.slice.call(arguments),h=this.actions[this.actions.length-1].args;this.curves.push(new THREE.CubicBezierCurve(new THREE.Vector2(h[h.length-2],h[h.length-1]),new THREE.Vector2(a,b),new THREE.Vector2(c,d),new THREE.Vector2(f,g)));this.actions.push({action:THREE.PathActions.BEZIER_CURVE_TO,args:e})};
 THREE.Path.prototype.splineThru=function(a){var b=Array.prototype.slice.call(arguments),c=this.actions[this.actions.length-1].args,c=[new THREE.Vector2(c[c.length-2],c[c.length-1])];Array.prototype.push.apply(c,a);this.curves.push(new THREE.SplineCurve(c));this.actions.push({action:THREE.PathActions.CSPLINE_THRU,args:b})};
 THREE.Path.prototype.arc=function(a,b,c,d,f,g){var e=Array.prototype.slice.call(arguments);this.curves.push(new THREE.ArcCurve(a,b,c,d,f,g));this.actions.push({action:THREE.PathActions.ARC,args:e})};THREE.Path.prototype.getSpacedPoints=function(a){a||(a=40);for(var b=[],c=0;c<a;c++)b.push(this.getPoint(c/a));return b};
-THREE.Path.prototype.getPoints=function(a,b){var a=a||12,c=[],d,f,g,e,h,i,j,k,q,l,n,r,m;for(d=0,f=this.actions.length;d<f;d++)switch(g=this.actions[d],e=g.action,g=g.args,e){case THREE.PathActions.LINE_TO:c.push(new THREE.Vector2(g[0],g[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:h=g[2];i=g[3];q=g[0];l=g[1];0<c.length?(e=c[c.length-1],n=e.x,r=e.y):(e=this.actions[d-1].args,n=e[e.length-2],r=e[e.length-1]);for(e=1;e<=a;e++)m=e/a,g=THREE.Shape.Utils.b2(m,n,q,h),m=THREE.Shape.Utils.b2(m,r,l,
-i),c.push(new THREE.Vector2(g,m));break;case THREE.PathActions.BEZIER_CURVE_TO:h=g[4];i=g[5];q=g[0];l=g[1];j=g[2];k=g[3];0<c.length?(e=c[c.length-1],n=e.x,r=e.y):(e=this.actions[d-1].args,n=e[e.length-2],r=e[e.length-1]);for(e=1;e<=a;e++)m=e/a,g=THREE.Shape.Utils.b3(m,n,q,j,h),m=THREE.Shape.Utils.b3(m,r,l,k,i),c.push(new THREE.Vector2(g,m));break;case THREE.PathActions.CSPLINE_THRU:e=this.actions[d-1].args;e=[new THREE.Vector2(e[e.length-2],e[e.length-1])];m=a*g[0].length;e=e.concat(g[0]);g=new THREE.SplineCurve(e);
-for(e=1;e<=m;e++)c.push(g.getPointAt(e/m));break;case THREE.PathActions.ARC:e=this.actions[d-1].args;h=g[0];i=g[1];j=g[2];q=g[3];m=g[4];l=!!g[5];k=e[e.length-2];n=e[e.length-1];0==e.length&&(k=n=0);r=m-q;var o=2*a;for(e=1;e<=o;e++)m=e/o,l||(m=1-m),m=q+m*r,g=k+h+j*Math.cos(m),m=n+i+j*Math.sin(m),c.push(new THREE.Vector2(g,m))}b&&c.push(c[0]);return c};THREE.Path.prototype.transform=function(a,b){this.getBoundingBox();return this.getWrapPoints(this.getPoints(b),a)};
-THREE.Path.prototype.nltransform=function(a,b,c,d,f,g){var e=this.getPoints(),h,i,j,k,q;for(h=0,i=e.length;h<i;h++)j=e[h],k=j.x,q=j.y,j.x=a*k+b*q+c,j.y=d*q+f*k+g;return e};
+THREE.Path.prototype.getPoints=function(a,b){var a=a||12,c=[],d,f,g,e,h,i,k,j,q,l,n,r,m;for(d=0,f=this.actions.length;d<f;d++)switch(g=this.actions[d],e=g.action,g=g.args,e){case THREE.PathActions.LINE_TO:c.push(new THREE.Vector2(g[0],g[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:h=g[2];i=g[3];q=g[0];l=g[1];0<c.length?(e=c[c.length-1],n=e.x,r=e.y):(e=this.actions[d-1].args,n=e[e.length-2],r=e[e.length-1]);for(e=1;e<=a;e++)m=e/a,g=THREE.Shape.Utils.b2(m,n,q,h),m=THREE.Shape.Utils.b2(m,r,l,
+i),c.push(new THREE.Vector2(g,m));break;case THREE.PathActions.BEZIER_CURVE_TO:h=g[4];i=g[5];q=g[0];l=g[1];k=g[2];j=g[3];0<c.length?(e=c[c.length-1],n=e.x,r=e.y):(e=this.actions[d-1].args,n=e[e.length-2],r=e[e.length-1]);for(e=1;e<=a;e++)m=e/a,g=THREE.Shape.Utils.b3(m,n,q,k,h),m=THREE.Shape.Utils.b3(m,r,l,j,i),c.push(new THREE.Vector2(g,m));break;case THREE.PathActions.CSPLINE_THRU:e=this.actions[d-1].args;e=[new THREE.Vector2(e[e.length-2],e[e.length-1])];m=a*g[0].length;e=e.concat(g[0]);g=new THREE.SplineCurve(e);
+for(e=1;e<=m;e++)c.push(g.getPointAt(e/m));break;case THREE.PathActions.ARC:e=this.actions[d-1].args;h=g[0];i=g[1];k=g[2];q=g[3];m=g[4];l=!!g[5];j=e[e.length-2];n=e[e.length-1];0==e.length&&(j=n=0);r=m-q;var o=2*a;for(e=1;e<=o;e++)m=e/o,l||(m=1-m),m=q+m*r,g=j+h+k*Math.cos(m),m=n+i+k*Math.sin(m),c.push(new THREE.Vector2(g,m))}b&&c.push(c[0]);return c};THREE.Path.prototype.transform=function(a,b){this.getBoundingBox();return this.getWrapPoints(this.getPoints(b),a)};
+THREE.Path.prototype.nltransform=function(a,b,c,d,f,g){var e=this.getPoints(),h,i,k,j,q;for(h=0,i=e.length;h<i;h++)k=e[h],j=k.x,q=k.y,k.x=a*j+b*q+c,k.y=d*q+f*j+g;return e};
 THREE.Path.prototype.debug=function(a){var b=this.getBoundingBox();a||(a=document.createElement("canvas"),a.setAttribute("width",b.maxX+100),a.setAttribute("height",b.maxY+100),document.body.appendChild(a));b=a.getContext("2d");b.fillStyle="white";b.fillRect(0,0,a.width,a.height);b.strokeStyle="black";b.beginPath();var c,d,f;for(a=0,c=this.actions.length;a<c;a++)d=this.actions[a],f=d.args,d=d.action,d!=THREE.PathActions.CSPLINE_THRU&&b[d].apply(b,f);b.stroke();b.closePath();b.strokeStyle="red";d=
 this.getPoints();for(a=0,c=d.length;a<c;a++)f=d[a],b.beginPath(),b.arc(f.x,f.y,1.5,0,2*Math.PI,!1),b.stroke(),b.closePath()};
 THREE.Path.prototype.toShapes=function(){var a,b,c,d,f=[],g=new THREE.Path;for(a=0,b=this.actions.length;a<b;a++)c=this.actions[a],d=c.args,c=c.action,c==THREE.PathActions.MOVE_TO&&0!=g.actions.length&&(f.push(g),g=new THREE.Path),g[c].apply(g,d);0!=g.actions.length&&f.push(g);if(0==f.length)return[];var e;d=[];a=!THREE.Shape.Utils.isClockWise(f[0].getPoints());if(1==f.length)return g=f[0],e=new THREE.Shape,e.actions=g.actions,e.curves=g.curves,d.push(e),d;if(a){e=new THREE.Shape;for(a=0,b=f.length;a<
 b;a++)g=f[a],THREE.Shape.Utils.isClockWise(g.getPoints())?(e.actions=g.actions,e.curves=g.curves,d.push(e),e=new THREE.Shape):e.holes.push(g)}else{for(a=0,b=f.length;a<b;a++)g=f[a],THREE.Shape.Utils.isClockWise(g.getPoints())?(e&&d.push(e),e=new THREE.Shape,e.actions=g.actions,e.curves=g.curves):e.holes.push(g);d.push(e)}return d};THREE.Shape=function(){THREE.Path.apply(this,arguments);this.holes=[]};THREE.Shape.prototype=new THREE.Path;THREE.Shape.prototype.constructor=THREE.Path;
 THREE.Shape.prototype.extrude=function(a){return new THREE.ExtrudeGeometry(this,a)};THREE.Shape.prototype.getPointsHoles=function(a){var b,c=this.holes.length,d=[];for(b=0;b<c;b++)d[b]=this.holes[b].getTransformedPoints(a,this.bends);return d};THREE.Shape.prototype.getSpacedPointsHoles=function(a){var b,c=this.holes.length,d=[];for(b=0;b<c;b++)d[b]=this.holes[b].getTransformedSpacedPoints(a,this.bends);return d};
 THREE.Shape.prototype.extractAllPoints=function(a){return{shape:this.getTransformedPoints(a),holes:this.getPointsHoles(a)}};THREE.Shape.prototype.extractAllSpacedPoints=function(a){return{shape:this.getTransformedSpacedPoints(a),holes:this.getSpacedPointsHoles(a)}};
-THREE.Shape.Utils={removeHoles:function(a,b){var c=a.concat(),d=c.concat(),f,g,e,h,i,j,k,q,l,n,r=[];for(i=0;i<b.length;i++){j=b[i];Array.prototype.push.apply(d,j);g=Number.POSITIVE_INFINITY;for(f=0;f<j.length;f++){l=j[f];n=[];for(q=0;q<c.length;q++)k=c[q],k=l.distanceToSquared(k),n.push(k),k<g&&(g=k,e=f,h=q)}f=0<=h-1?h-1:c.length-1;g=0<=e-1?e-1:j.length-1;var m=[j[e],c[h],c[f]];q=THREE.FontUtils.Triangulate.area(m);var o=[j[e],j[g],c[h]];l=THREE.FontUtils.Triangulate.area(o);n=h;k=e;h+=1;e+=-1;0>
-h&&(h+=c.length);h%=c.length;0>e&&(e+=j.length);e%=j.length;f=0<=h-1?h-1:c.length-1;g=0<=e-1?e-1:j.length-1;m=[j[e],c[h],c[f]];m=THREE.FontUtils.Triangulate.area(m);o=[j[e],j[g],c[h]];o=THREE.FontUtils.Triangulate.area(o);q+l>m+o&&(h=n,e=k,0>h&&(h+=c.length),h%=c.length,0>e&&(e+=j.length),e%=j.length,f=0<=h-1?h-1:c.length-1,g=0<=e-1?e-1:j.length-1);q=c.slice(0,h);l=c.slice(h);n=j.slice(e);k=j.slice(0,e);g=[j[e],j[g],c[h]];r.push([j[e],c[h],c[f]]);r.push(g);c=q.concat(n).concat(k).concat(l)}return{shape:c,
-isolatedPts:r,allpoints:d}},triangulateShape:function(a,b){var c=THREE.Shape.Utils.removeHoles(a,b),d=c.allpoints,f=c.isolatedPts,c=THREE.FontUtils.Triangulate(c.shape,!1),g,e,h,i,j={};for(g=0,e=d.length;g<e;g++)i=d[g].x+":"+d[g].y,void 0!==j[i]&&console.log("Duplicate point",i),j[i]=g;for(g=0,e=c.length;g<e;g++){h=c[g];for(d=0;3>d;d++)i=h[d].x+":"+h[d].y,i=j[i],void 0!==i&&(h[d]=i)}for(g=0,e=f.length;g<e;g++){h=f[g];for(d=0;3>d;d++)i=h[d].x+":"+h[d].y,i=j[i],void 0!==i&&(h[d]=i)}return c.concat(f)},
+THREE.Shape.Utils={removeHoles:function(a,b){var c=a.concat(),d=c.concat(),f,g,e,h,i,k,j,q,l,n,r=[];for(i=0;i<b.length;i++){k=b[i];Array.prototype.push.apply(d,k);g=Number.POSITIVE_INFINITY;for(f=0;f<k.length;f++){l=k[f];n=[];for(q=0;q<c.length;q++)j=c[q],j=l.distanceToSquared(j),n.push(j),j<g&&(g=j,e=f,h=q)}f=0<=h-1?h-1:c.length-1;g=0<=e-1?e-1:k.length-1;var m=[k[e],c[h],c[f]];q=THREE.FontUtils.Triangulate.area(m);var o=[k[e],k[g],c[h]];l=THREE.FontUtils.Triangulate.area(o);n=h;j=e;h+=1;e+=-1;0>
+h&&(h+=c.length);h%=c.length;0>e&&(e+=k.length);e%=k.length;f=0<=h-1?h-1:c.length-1;g=0<=e-1?e-1:k.length-1;m=[k[e],c[h],c[f]];m=THREE.FontUtils.Triangulate.area(m);o=[k[e],k[g],c[h]];o=THREE.FontUtils.Triangulate.area(o);q+l>m+o&&(h=n,e=j,0>h&&(h+=c.length),h%=c.length,0>e&&(e+=k.length),e%=k.length,f=0<=h-1?h-1:c.length-1,g=0<=e-1?e-1:k.length-1);q=c.slice(0,h);l=c.slice(h);n=k.slice(e);j=k.slice(0,e);g=[k[e],k[g],c[h]];r.push([k[e],c[h],c[f]]);r.push(g);c=q.concat(n).concat(j).concat(l)}return{shape:c,
+isolatedPts:r,allpoints:d}},triangulateShape:function(a,b){var c=THREE.Shape.Utils.removeHoles(a,b),d=c.allpoints,f=c.isolatedPts,c=THREE.FontUtils.Triangulate(c.shape,!1),g,e,h,i,k={};for(g=0,e=d.length;g<e;g++)i=d[g].x+":"+d[g].y,void 0!==k[i]&&console.log("Duplicate point",i),k[i]=g;for(g=0,e=c.length;g<e;g++){h=c[g];for(d=0;3>d;d++)i=h[d].x+":"+h[d].y,i=k[i],void 0!==i&&(h[d]=i)}for(g=0,e=f.length;g<e;g++){h=f[g];for(d=0;3>d;d++)i=h[d].x+":"+h[d].y,i=k[i],void 0!==i&&(h[d]=i)}return c.concat(f)},
 isClockWise:function(a){return 0>THREE.FontUtils.Triangulate.area(a)},b2p0:function(a,b){var c=1-a;return c*c*b},b2p1:function(a,b){return 2*(1-a)*a*b},b2p2:function(a,b){return a*a*b},b2:function(a,b,c,d){return this.b2p0(a,b)+this.b2p1(a,c)+this.b2p2(a,d)},b3p0:function(a,b){var c=1-a;return c*c*c*b},b3p1:function(a,b){var c=1-a;return 3*c*c*a*b},b3p2:function(a,b){return 3*(1-a)*a*a*b},b3p3:function(a,b){return a*a*a*b},b3:function(a,b,c,d,f){return this.b3p0(a,b)+this.b3p1(a,c)+this.b3p2(a,d)+
 this.b3p3(a,f)}};THREE.TextPath=function(a,b){THREE.Path.call(this);this.parameters=b||{};this.set(a)};THREE.TextPath.prototype.set=function(a,b){b=b||this.parameters;this.text=a;var c=void 0!==b.curveSegments?b.curveSegments:4,d=void 0!==b.font?b.font:"helvetiker",f=void 0!==b.weight?b.weight:"normal",g=void 0!==b.style?b.style:"normal";THREE.FontUtils.size=void 0!==b.size?b.size:100;THREE.FontUtils.divisions=c;THREE.FontUtils.face=d;THREE.FontUtils.weight=f;THREE.FontUtils.style=g};
 THREE.TextPath.prototype.toShapes=function(){for(var a=THREE.FontUtils.drawText(this.text).paths,b=[],c=0,d=a.length;c<d;c++)Array.prototype.push.apply(b,a[c].toShapes());return b};
 THREE.AnimationHandler=function(){var a=[],b={},c={update:function(b){for(var c=0;c<a.length;c++)a[c].update(b)},addToUpdate:function(b){-1===a.indexOf(b)&&a.push(b)},removeFromUpdate:function(b){b=a.indexOf(b);-1!==b&&a.splice(b,1)},add:function(a){void 0!==b[a.name]&&console.log("THREE.AnimationHandler.add: Warning! "+a.name+" already exists in library. Overwriting.");b[a.name]=a;if(!0!==a.initialized){for(var c=0;c<a.hierarchy.length;c++){for(var d=0;d<a.hierarchy[c].keys.length;d++){if(0>a.hierarchy[c].keys[d].time)a.hierarchy[c].keys[d].time=
-0;if(void 0!==a.hierarchy[c].keys[d].rot&&!(a.hierarchy[c].keys[d].rot instanceof THREE.Quaternion)){var h=a.hierarchy[c].keys[d].rot;a.hierarchy[c].keys[d].rot=new THREE.Quaternion(h[0],h[1],h[2],h[3])}}if(a.hierarchy[c].keys.length&&void 0!==a.hierarchy[c].keys[0].morphTargets){h={};for(d=0;d<a.hierarchy[c].keys.length;d++)for(var i=0;i<a.hierarchy[c].keys[d].morphTargets.length;i++){var j=a.hierarchy[c].keys[d].morphTargets[i];h[j]=-1}a.hierarchy[c].usedMorphTargets=h;for(d=0;d<a.hierarchy[c].keys.length;d++){var k=
-{};for(j in h){for(i=0;i<a.hierarchy[c].keys[d].morphTargets.length;i++)if(a.hierarchy[c].keys[d].morphTargets[i]===j){k[j]=a.hierarchy[c].keys[d].morphTargetsInfluences[i];break}i===a.hierarchy[c].keys[d].morphTargets.length&&(k[j]=0)}a.hierarchy[c].keys[d].morphTargetsInfluences=k}}for(d=1;d<a.hierarchy[c].keys.length;d++)a.hierarchy[c].keys[d].time===a.hierarchy[c].keys[d-1].time&&(a.hierarchy[c].keys.splice(d,1),d--);for(d=0;d<a.hierarchy[c].keys.length;d++)a.hierarchy[c].keys[d].index=d}d=parseInt(a.length*
+0;if(void 0!==a.hierarchy[c].keys[d].rot&&!(a.hierarchy[c].keys[d].rot instanceof THREE.Quaternion)){var h=a.hierarchy[c].keys[d].rot;a.hierarchy[c].keys[d].rot=new THREE.Quaternion(h[0],h[1],h[2],h[3])}}if(a.hierarchy[c].keys.length&&void 0!==a.hierarchy[c].keys[0].morphTargets){h={};for(d=0;d<a.hierarchy[c].keys.length;d++)for(var i=0;i<a.hierarchy[c].keys[d].morphTargets.length;i++){var k=a.hierarchy[c].keys[d].morphTargets[i];h[k]=-1}a.hierarchy[c].usedMorphTargets=h;for(d=0;d<a.hierarchy[c].keys.length;d++){var j=
+{};for(k in h){for(i=0;i<a.hierarchy[c].keys[d].morphTargets.length;i++)if(a.hierarchy[c].keys[d].morphTargets[i]===k){j[k]=a.hierarchy[c].keys[d].morphTargetsInfluences[i];break}i===a.hierarchy[c].keys[d].morphTargets.length&&(j[k]=0)}a.hierarchy[c].keys[d].morphTargetsInfluences=j}}for(d=1;d<a.hierarchy[c].keys.length;d++)a.hierarchy[c].keys[d].time===a.hierarchy[c].keys[d-1].time&&(a.hierarchy[c].keys.splice(d,1),d--);for(d=0;d<a.hierarchy[c].keys.length;d++)a.hierarchy[c].keys[d].index=d}d=parseInt(a.length*
 a.fps,10);a.JIT={};a.JIT.hierarchy=[];for(c=0;c<a.hierarchy.length;c++)a.JIT.hierarchy.push(Array(d));a.initialized=!0}},get:function(a){if("string"===typeof a){if(b[a])return b[a];console.log("THREE.AnimationHandler.get: Couldn't find animation "+a);return null}},parse:function(a){var b=[];if(a instanceof THREE.SkinnedMesh)for(var c=0;c<a.bones.length;c++)b.push(a.bones[c]);else d(a,b);return b}},d=function(a,b){b.push(a);for(var c=0;c<a.children.length;c++)d(a.children[c],b)};c.LINEAR=0;c.CATMULLROM=
 1;c.CATMULLROM_FORWARD=2;return c}();THREE.Animation=function(a,b,c,d){this.root=a;this.data=THREE.AnimationHandler.get(b);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.loop=this.isPaused=!0;this.interpolationType=void 0!==c?c:THREE.AnimationHandler.LINEAR;this.JITCompile=void 0!==d?d:!0;this.points=[];this.target=new THREE.Vector3};
 THREE.Animation.prototype.play=function(a,b){if(!this.isPlaying){this.isPlaying=!0;this.loop=void 0!==a?a:!0;this.currentTime=void 0!==b?b:0;var c,d=this.hierarchy.length,f;for(c=0;c<d;c++){f=this.hierarchy[c];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)f.useQuaternion=!0;f.matrixAutoUpdate=!0;if(void 0===f.animationCache)f.animationCache={},f.animationCache.prevKey={pos:0,rot:0,scl:0},f.animationCache.nextKey={pos:0,rot:0,scl:0},f.animationCache.originalMatrix=f instanceof
 THREE.Bone?f.skinMatrix:f.matrix;var g=f.animationCache.prevKey;f=f.animationCache.nextKey;g.pos=this.data.hierarchy[c].keys[0];g.rot=this.data.hierarchy[c].keys[0];g.scl=this.data.hierarchy[c].keys[0];f.pos=this.getNextKeyWith("pos",c,1);f.rot=this.getNextKeyWith("rot",c,1);f.scl=this.getNextKeyWith("scl",c,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
 THREE.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
 THREE.Animation.prototype.stop=function(){this.isPaused=this.isPlaying=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.hierarchy.length;a++)if(void 0!==this.hierarchy[a].animationCache)this.hierarchy[a]instanceof THREE.Bone?this.hierarchy[a].skinMatrix=this.hierarchy[a].animationCache.originalMatrix:this.hierarchy[a].matrix=this.hierarchy[a].animationCache.originalMatrix,delete this.hierarchy[a].animationCache};
-THREE.Animation.prototype.update=function(a){if(this.isPlaying){var b=["pos","rot","scl"],c,d,f,g,e,h,i,j,k=this.data.JIT.hierarchy,q,l;l=this.currentTime+=a*this.timeScale;q=this.currentTime%=this.data.length;j=parseInt(Math.min(q*this.data.fps,this.data.length*this.data.fps),10);for(var n=0,r=this.hierarchy.length;n<r;n++)if(a=this.hierarchy[n],i=a.animationCache,this.JITCompile&&void 0!==k[n][j])a instanceof THREE.Bone?(a.skinMatrix=k[n][j],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=!1):(a.matrix=
-k[n][j],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=!0);else{if(this.JITCompile)a instanceof THREE.Bone?a.skinMatrix=a.animationCache.originalMatrix:a.matrix=a.animationCache.originalMatrix;for(var m=0;3>m;m++){c=b[m];e=i.prevKey[c];h=i.nextKey[c];if(h.time<=l){if(q<l)if(this.loop){e=this.data.hierarchy[n].keys[0];for(h=this.getNextKeyWith(c,n,1);h.time<q;)e=h,h=this.getNextKeyWith(c,n,h.index+1)}else{this.stop();return}else{do e=h,h=this.getNextKeyWith(c,n,h.index+1);while(h.time<q)}i.prevKey[c]=
+THREE.Animation.prototype.update=function(a){if(this.isPlaying){var b=["pos","rot","scl"],c,d,f,g,e,h,i,k,j=this.data.JIT.hierarchy,q,l;l=this.currentTime+=a*this.timeScale;q=this.currentTime%=this.data.length;k=parseInt(Math.min(q*this.data.fps,this.data.length*this.data.fps),10);for(var n=0,r=this.hierarchy.length;n<r;n++)if(a=this.hierarchy[n],i=a.animationCache,this.JITCompile&&void 0!==j[n][k])a instanceof THREE.Bone?(a.skinMatrix=j[n][k],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=!1):(a.matrix=
+j[n][k],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 m=0;3>m;m++){c=b[m];e=i.prevKey[c];h=i.nextKey[c];if(h.time<=l){if(q<l)if(this.loop){e=this.data.hierarchy[n].keys[0];for(h=this.getNextKeyWith(c,n,1);h.time<q;)e=h,h=this.getNextKeyWith(c,n,h.index+1)}else{this.stop();return}else{do e=h,h=this.getNextKeyWith(c,n,h.index+1);while(h.time<q)}i.prevKey[c]=
 e;i.nextKey[c]=h}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;d=(q-e.time)/(h.time-e.time);f=e[c];g=h[c];if(0>d||1<d)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+d+" on bone "+n),d=0>d?0:1;if("pos"===c)if(c=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)c.x=f[0]+(g[0]-f[0])*d,c.y=f[1]+(g[1]-f[1])*d,c.z=f[2]+(g[2]-f[2])*d;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
 this.getPrevKeyWith("pos",n,e.index-1).pos,this.points[1]=f,this.points[2]=g,this.points[3]=this.getNextKeyWith("pos",n,h.index+1).pos,d=0.33*d+0.33,f=this.interpolateCatmullRom(this.points,d),c.x=f[0],c.y=f[1],c.z=f[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)d=this.interpolateCatmullRom(this.points,1.01*d),this.target.set(d[0],d[1],d[2]),this.target.subSelf(c),this.target.y=0,this.target.normalize(),d=Math.atan2(this.target.x,this.target.z),a.rotation.set(0,d,0)}else if("rot"===
-c)THREE.Quaternion.slerp(f,g,a.quaternion,d);else if("scl"===c)c=a.scale,c.x=f[0]+(g[0]-f[0])*d,c.y=f[1]+(g[1]-f[1])*d,c.z=f[2]+(g[2]-f[2])*d}}if(this.JITCompile&&void 0===k[0][j]){this.hierarchy[0].updateMatrixWorld(!0);for(n=0;n<this.hierarchy.length;n++)k[n][j]=this.hierarchy[n]instanceof THREE.Bone?this.hierarchy[n].skinMatrix.clone():this.hierarchy[n].matrix.clone()}}};
-THREE.Animation.prototype.interpolateCatmullRom=function(a,b){var c=[],d=[],f,g,e,h,i,j;f=(a.length-1)*b;g=Math.floor(f);f-=g;c[0]=0===g?g:g-1;c[1]=g;c[2]=g>a.length-2?g:g+1;c[3]=g>a.length-3?g:g+2;g=a[c[0]];h=a[c[1]];i=a[c[2]];j=a[c[3]];c=f*f;e=f*c;d[0]=this.interpolate(g[0],h[0],i[0],j[0],f,c,e);d[1]=this.interpolate(g[1],h[1],i[1],j[1],f,c,e);d[2]=this.interpolate(g[2],h[2],i[2],j[2],f,c,e);return d};
+c)THREE.Quaternion.slerp(f,g,a.quaternion,d);else if("scl"===c)c=a.scale,c.x=f[0]+(g[0]-f[0])*d,c.y=f[1]+(g[1]-f[1])*d,c.z=f[2]+(g[2]-f[2])*d}}if(this.JITCompile&&void 0===j[0][k]){this.hierarchy[0].updateMatrixWorld(!0);for(n=0;n<this.hierarchy.length;n++)j[n][k]=this.hierarchy[n]instanceof THREE.Bone?this.hierarchy[n].skinMatrix.clone():this.hierarchy[n].matrix.clone()}}};
+THREE.Animation.prototype.interpolateCatmullRom=function(a,b){var c=[],d=[],f,g,e,h,i,k;f=(a.length-1)*b;g=Math.floor(f);f-=g;c[0]=0===g?g:g-1;c[1]=g;c[2]=g>a.length-2?g:g+1;c[3]=g>a.length-3?g:g+2;g=a[c[0]];h=a[c[1]];i=a[c[2]];k=a[c[3]];c=f*f;e=f*c;d[0]=this.interpolate(g[0],h[0],i[0],k[0],f,c,e);d[1]=this.interpolate(g[1],h[1],i[1],k[1],f,c,e);d[2]=this.interpolate(g[2],h[2],i[2],k[2],f,c,e);return d};
 THREE.Animation.prototype.interpolate=function(a,b,c,d,f,g,e){a=0.5*(c-a);d=0.5*(d-b);return(2*(b-c)+a+d)*e+(-3*(b-c)-2*a-d)*g+a*f+b};THREE.Animation.prototype.getNextKeyWith=function(a,b,c){for(var d=this.data.hierarchy[b].keys,c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c<d.length-1?c:d.length-1:c%d.length;c<d.length;c++)if(void 0!==d[c][a])return d[c];return this.data.hierarchy[b].keys[0]};
 THREE.Animation.prototype.getPrevKeyWith=function(a,b,c){for(var d=this.data.hierarchy[b].keys,c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?0<c?c:0:0<=c?c:c+d.length;0<=c;c--)if(void 0!==d[c][a])return d[c];return this.data.hierarchy[b].keys[d.length-1]};
 THREE.KeyFrameAnimation=function(a,b,c){this.root=a;this.data=THREE.AnimationHandler.get(b);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=0.0010;this.isPlaying=!1;this.loop=this.isPaused=!0;this.JITCompile=void 0!==c?c:!0;a=0;for(b=this.hierarchy.length;a<b;a++){var c=this.data.hierarchy[a].sids,d=this.hierarchy[a];if(this.data.hierarchy[a].keys.length&&c){for(var f=0;f<c.length;f++){var g=c[f],e=this.getNextKeyWith(g,a,0);e&&e.apply(g)}d.matrixAutoUpdate=!1;this.data.hierarchy[a].node.updateMatrix();
@@ -101,9 +101,9 @@ d.matrixWorldNeedsUpdate=!0}}};
 THREE.KeyFrameAnimation.prototype.play=function(a,b){if(!this.isPlaying){this.isPlaying=!0;this.loop=void 0!==a?a:!0;this.currentTime=void 0!==b?b:0;this.startTimeMs=b;this.startTime=1E7;this.endTime=-this.startTime;var c,d=this.hierarchy.length,f,g;for(c=0;c<d;c++){f=this.hierarchy[c];g=this.data.hierarchy[c];f.useQuaternion=!0;if(void 0===g.animationCache)g.animationCache={},g.animationCache.prevKey=null,g.animationCache.nextKey=null,g.animationCache.originalMatrix=f instanceof THREE.Bone?f.skinMatrix:
 f.matrix;f=this.data.hierarchy[c].keys;if(f.length)g.animationCache.prevKey=f[0],g.animationCache.nextKey=f[1],this.startTime=Math.min(f[0].time,this.startTime),this.endTime=Math.max(f[f.length-1].time,this.endTime)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};THREE.KeyFrameAnimation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
 THREE.KeyFrameAnimation.prototype.stop=function(){this.isPaused=this.isPlaying=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.hierarchy.length;a++){var b=this.hierarchy[a];if(void 0!==b.animationCache){var c=b.animationCache.originalMatrix;b instanceof THREE.Bone?(c.copy(b.skinMatrix),b.skinMatrix=c):(c.copy(b.matrix),b.matrix=c);delete b.animationCache}}};
-THREE.KeyFrameAnimation.prototype.update=function(a){if(this.isPlaying){var b,c,d,f,g=this.data.JIT.hierarchy,e,h,i;h=this.currentTime+=a*this.timeScale;e=this.currentTime%=this.data.length;if(e<this.startTimeMs)e=this.currentTime=this.startTimeMs+e;f=parseInt(Math.min(e*this.data.fps,this.data.length*this.data.fps),10);if((i=e<h)&&!this.loop){for(var a=0,j=this.hierarchy.length;a<j;a++){var k=this.data.hierarchy[a].keys,g=this.data.hierarchy[a].sids;d=k.length-1;f=this.hierarchy[a];if(k.length){for(k=
-0;k<g.length;k++)e=g[k],(h=this.getPrevKeyWith(e,a,d))&&h.apply(e);this.data.hierarchy[a].node.updateMatrix();f.matrixWorldNeedsUpdate=!0}}this.stop()}else if(!(e<this.startTime)){a=0;for(j=this.hierarchy.length;a<j;a++){d=this.hierarchy[a];b=this.data.hierarchy[a];var k=b.keys,q=b.animationCache;if(this.JITCompile&&void 0!==g[a][f])d instanceof THREE.Bone?(d.skinMatrix=g[a][f],d.matrixWorldNeedsUpdate=!1):(d.matrix=g[a][f],d.matrixWorldNeedsUpdate=!0);else if(k.length){if(this.JITCompile&&q)d instanceof
-THREE.Bone?d.skinMatrix=q.originalMatrix:d.matrix=q.originalMatrix;b=q.prevKey;c=q.nextKey;if(b&&c){if(c.time<=h){if(i&&this.loop){b=k[0];for(c=k[1];c.time<e;)b=c,c=k[b.index+1]}else if(!i)for(var l=k.length-1;c.time<e&&c.index!==l;)b=c,c=k[b.index+1];q.prevKey=b;q.nextKey=c}b.interpolate(c,e)}this.data.hierarchy[a].node.updateMatrix();d.matrixWorldNeedsUpdate=!0}}if(this.JITCompile&&void 0===g[0][f]){this.hierarchy[0].updateMatrixWorld(!0);for(a=0;a<this.hierarchy.length;a++)g[a][f]=this.hierarchy[a]instanceof
+THREE.KeyFrameAnimation.prototype.update=function(a){if(this.isPlaying){var b,c,d,f,g=this.data.JIT.hierarchy,e,h,i;h=this.currentTime+=a*this.timeScale;e=this.currentTime%=this.data.length;if(e<this.startTimeMs)e=this.currentTime=this.startTimeMs+e;f=parseInt(Math.min(e*this.data.fps,this.data.length*this.data.fps),10);if((i=e<h)&&!this.loop){for(var a=0,k=this.hierarchy.length;a<k;a++){var j=this.data.hierarchy[a].keys,g=this.data.hierarchy[a].sids;d=j.length-1;f=this.hierarchy[a];if(j.length){for(j=
+0;j<g.length;j++)e=g[j],(h=this.getPrevKeyWith(e,a,d))&&h.apply(e);this.data.hierarchy[a].node.updateMatrix();f.matrixWorldNeedsUpdate=!0}}this.stop()}else if(!(e<this.startTime)){a=0;for(k=this.hierarchy.length;a<k;a++){d=this.hierarchy[a];b=this.data.hierarchy[a];var j=b.keys,q=b.animationCache;if(this.JITCompile&&void 0!==g[a][f])d instanceof THREE.Bone?(d.skinMatrix=g[a][f],d.matrixWorldNeedsUpdate=!1):(d.matrix=g[a][f],d.matrixWorldNeedsUpdate=!0);else if(j.length){if(this.JITCompile&&q)d instanceof
+THREE.Bone?d.skinMatrix=q.originalMatrix:d.matrix=q.originalMatrix;b=q.prevKey;c=q.nextKey;if(b&&c){if(c.time<=h){if(i&&this.loop){b=j[0];for(c=j[1];c.time<e;)b=c,c=j[b.index+1]}else if(!i)for(var l=j.length-1;c.time<e&&c.index!==l;)b=c,c=j[b.index+1];q.prevKey=b;q.nextKey=c}b.interpolate(c,e)}this.data.hierarchy[a].node.updateMatrix();d.matrixWorldNeedsUpdate=!0}}if(this.JITCompile&&void 0===g[0][f]){this.hierarchy[0].updateMatrixWorld(!0);for(a=0;a<this.hierarchy.length;a++)g[a][f]=this.hierarchy[a]instanceof
 THREE.Bone?this.hierarchy[a].skinMatrix.clone():this.hierarchy[a].matrix.clone()}}}};THREE.KeyFrameAnimation.prototype.getNextKeyWith=function(a,b,c){b=this.data.hierarchy[b].keys;for(c%=b.length;c<b.length;c++)if(b[c].hasTarget(a))return b[c];return b[0]};THREE.KeyFrameAnimation.prototype.getPrevKeyWith=function(a,b,c){b=this.data.hierarchy[b].keys;for(c=0<=c?c:c+b.length;0<=c;c--)if(b[c].hasTarget(a))return b[c];return b[b.length-1]};
 THREE.CubeCamera=function(a,b,c,d){this.heightOffset=c;this.position=new THREE.Vector3(0,c,0);this.cameraPX=new THREE.PerspectiveCamera(90,1,a,b);this.cameraNX=new THREE.PerspectiveCamera(90,1,a,b);this.cameraPY=new THREE.PerspectiveCamera(90,1,a,b);this.cameraNY=new THREE.PerspectiveCamera(90,1,a,b);this.cameraPZ=new THREE.PerspectiveCamera(90,1,a,b);this.cameraNZ=new THREE.PerspectiveCamera(90,1,a,b);this.cameraPX.position=this.position;this.cameraNX.position=this.position;this.cameraPY.position=
 this.position;this.cameraNY.position=this.position;this.cameraPZ.position=this.position;this.cameraNZ.position=this.position;this.cameraPX.up.set(0,-1,0);this.cameraNX.up.set(0,-1,0);this.cameraPY.up.set(0,0,1);this.cameraNY.up.set(0,0,-1);this.cameraPZ.up.set(0,-1,0);this.cameraNZ.up.set(0,-1,0);this.targetPX=new THREE.Vector3(0,0,0);this.targetNX=new THREE.Vector3(0,0,0);this.targetPY=new THREE.Vector3(0,0,0);this.targetNY=new THREE.Vector3(0,0,0);this.targetPZ=new THREE.Vector3(0,0,0);this.targetNZ=
@@ -125,7 +125,7 @@ this.moveUp&&this.object.translateY(b);this.moveDown&&this.object.translateY(-b)
 (b=Math.PI/(this.verticalMax-this.verticalMin));this.lon+=this.mouseX*a;this.lookVertical&&(this.lat-=this.mouseY*a*b);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;if(this.constrainVertical)this.phi=THREE.Math.mapLinear(this.phi,0,Math.PI,this.verticalMin,this.verticalMax);b=this.target;c=this.object.position;b.x=c.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=c.y+100*Math.cos(this.phi);b.z=c.z+100*Math.sin(this.phi)*Math.sin(this.theta);
 this.object.lookAt(b)}};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",c(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",c(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",c(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",c(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",c(this,this.onKeyUp),!1)};
 THREE.PathControls=function(a,b){function c(a){return 1>(a*=2)?0.5*a*a:-0.5*(--a*(a-2)-1)}function d(a,b){return function(){b.apply(a,arguments)}}function f(a,b,c,d){var e={name:c,fps:0.6,length:d,hierarchy:[]},f,g=b.getControlPointsArray(),h=b.getLength(),o=g.length,p=0;f=o-1;b={parent:-1,keys:[]};b.keys[0]={time:0,pos:g[0],rot:[0,0,0,1],scl:[1,1,1]};b.keys[f]={time:d,pos:g[f],rot:[0,0,0,1],scl:[1,1,1]};for(f=1;f<o-1;f++)p=d*h.chunks[f]/h.total,b.keys[f]={time:p,pos:g[f]};e.hierarchy[0]=b;THREE.AnimationHandler.add(e);
-return new THREE.Animation(a,c,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function g(a,b){var c,d,e=new THREE.Geometry;for(c=0;c<a.points.length*b;c++)d=c/(a.points.length*b),d=a.getPoint(d),e.vertices[c]=new THREE.Vertex(new THREE.Vector3(d.x,d.y,d.z));return e}this.object=a;this.domElement=void 0!==b?b:document;this.id="PathControls"+THREE.PathControlsIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=new THREE.Object3D;this.debugDummy=
+return new THREE.Animation(a,c,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function g(a,b){var c,d,f=new THREE.Geometry;for(c=0;c<a.points.length*b;c++)d=c/(a.points.length*b),d=a.getPoint(d),f.vertices[c]=new THREE.Vertex(new THREE.Vector3(d.x,d.y,d.z));return f}this.object=a;this.domElement=void 0!==b?b:document;this.id="PathControls"+THREE.PathControlsIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=new THREE.Object3D;this.debugDummy=
 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 e=2*Math.PI,h=Math.PI/180;this.update=function(a){var b;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed*a);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed*a);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*h;this.theta=this.lon*h;a=this.phi%e;this.phi=0<=a?a:a+e;b=this.verticalAngleMap.srcRange;a=this.verticalAngleMap.dstRange;
 b=THREE.Math.mapLinear(this.phi,b[0],b[1],a[0],a[1]);var d=a[1]-a[0];this.phi=c((b-a[0])/d)*d+a[0];b=this.horizontalAngleMap.srcRange;a=this.horizontalAngleMap.dstRange;b=THREE.Math.mapLinear(this.theta,b[0],b[1],a[0],a[1]);d=a[1]-a[0];this.theta=c((b-a[0])/d)*d+a[0];a=this.target.position;a.x=100*Math.sin(this.phi)*Math.cos(this.theta);a.y=100*Math.cos(this.phi);a.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.object.lookAt(this.target.position)};this.onMouseMove=function(a){this.domElement===
@@ -142,65 +142,65 @@ THREE.FlyControls=function(a,b){function c(a,b){return function(){b.apply(a,argu
 this.object.matrixWorldNeedsUpdate=!0};this.updateMovementVector=function(){var a=this.moveState.forward||this.autoForward&&!this.moveState.back?1:0;this.moveVector.x=-this.moveState.left+this.moveState.right;this.moveVector.y=-this.moveState.down+this.moveState.up;this.moveVector.z=-a+this.moveState.back};this.updateRotationVector=function(){this.rotationVector.x=-this.moveState.pitchDown+this.moveState.pitchUp;this.rotationVector.y=-this.moveState.yawRight+this.moveState.yawLeft;this.rotationVector.z=
 -this.moveState.rollRight+this.moveState.rollLeft};this.getContainerDimensions=function(){return this.domElement!=document?{size:[this.domElement.offsetWidth,this.domElement.offsetHeight],offset:[this.domElement.offsetLeft,this.domElement.offsetTop]}:{size:[window.innerWidth,window.innerHeight],offset:[0,0]}};this.domElement.addEventListener("mousemove",c(this,this.mousemove),!1);this.domElement.addEventListener("mousedown",c(this,this.mousedown),!1);this.domElement.addEventListener("mouseup",c(this,
 this.mouseup),!1);this.domElement.addEventListener("keydown",c(this,this.keydown),!1);this.domElement.addEventListener("keyup",c(this,this.keyup),!1);this.updateMovementVector();this.updateRotationVector()};
-THREE.RollControls=function(a,b){this.object=a;this.domElement=void 0!==b?b:document;this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.object.matrixAutoUpdate=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;var c=new THREE.Vector3,d=new THREE.Vector3,f=new THREE.Vector3,g=new THREE.Matrix4,e=!1,h=1,i=0,j=0,k=0,q=0,l=0,n=window.innerWidth/2,r=window.innerHeight/2;this.update=function(a){if(this.mouseLook){var b=a*this.lookSpeed;
-this.rotateHorizontally(b*q);this.rotateVertically(b*l)}b=a*this.movementSpeed;this.object.translateZ(-b*(0<i||this.autoForward&&!(0>i)?1:i));this.object.translateX(b*j);this.object.translateY(b*k);e&&(this.roll+=this.rollSpeed*a*h);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize();else if(this.forward.y<this.constrainVertical[0])this.forward.y=this.constrainVertical[0],this.forward.normalize();f.copy(this.forward);d.set(0,1,0);c.cross(d,
+THREE.RollControls=function(a,b){this.object=a;this.domElement=void 0!==b?b:document;this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.object.matrixAutoUpdate=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;var c=new THREE.Vector3,d=new THREE.Vector3,f=new THREE.Vector3,g=new THREE.Matrix4,e=!1,h=1,i=0,k=0,j=0,q=0,l=0,n=window.innerWidth/2,r=window.innerHeight/2;this.update=function(a){if(this.mouseLook){var b=a*this.lookSpeed;
+this.rotateHorizontally(b*q);this.rotateVertically(b*l)}b=a*this.movementSpeed;this.object.translateZ(-b*(0<i||this.autoForward&&!(0>i)?1:i));this.object.translateX(b*k);this.object.translateY(b*j);e&&(this.roll+=this.rollSpeed*a*h);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize();else if(this.forward.y<this.constrainVertical[0])this.forward.y=this.constrainVertical[0],this.forward.normalize();f.copy(this.forward);d.set(0,1,0);c.cross(d,
 f).normalize();d.cross(f,c).normalize();this.object.matrix.n11=c.x;this.object.matrix.n12=d.x;this.object.matrix.n13=f.x;this.object.matrix.n21=c.y;this.object.matrix.n22=d.y;this.object.matrix.n23=f.y;this.object.matrix.n31=c.z;this.object.matrix.n32=d.z;this.object.matrix.n33=f.z;g.identity();g.n11=Math.cos(this.roll);g.n12=-Math.sin(this.roll);g.n21=Math.sin(this.roll);g.n22=Math.cos(this.roll);this.object.matrix.multiplySelf(g);this.object.matrixWorldNeedsUpdate=!0;this.object.matrix.n14=this.object.position.x;
 this.object.matrix.n24=this.object.position.y;this.object.matrix.n34=this.object.position.z};this.translateX=function(a){this.object.position.x+=this.object.matrix.n11*a;this.object.position.y+=this.object.matrix.n21*a;this.object.position.z+=this.object.matrix.n31*a};this.translateY=function(a){this.object.position.x+=this.object.matrix.n12*a;this.object.position.y+=this.object.matrix.n22*a;this.object.position.z+=this.object.matrix.n32*a};this.translateZ=function(a){this.object.position.x-=this.object.matrix.n13*
 a;this.object.position.y-=this.object.matrix.n23*a;this.object.position.z-=this.object.matrix.n33*a};this.rotateHorizontally=function(a){c.set(this.object.matrix.n11,this.object.matrix.n21,this.object.matrix.n31);c.multiplyScalar(a);this.forward.subSelf(c);this.forward.normalize()};this.rotateVertically=function(a){d.set(this.object.matrix.n12,this.object.matrix.n22,this.object.matrix.n32);d.multiplyScalar(a);this.forward.addSelf(d);this.forward.normalize()};this.domElement.addEventListener("contextmenu",
 function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){q=(a.clientX-n)/window.innerWidth;l=(a.clientY-r)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:i=1;break;case 2:i=-1}},!1);this.domElement.addEventListener("mouseup",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:i=0;break;case 2:i=0}},!1);this.domElement.addEventListener("keydown",
-function(a){switch(a.keyCode){case 38:case 87:i=1;break;case 37:case 65:j=-1;break;case 40:case 83:i=-1;break;case 39:case 68:j=1;break;case 81:e=!0;h=1;break;case 69:e=!0;h=-1;break;case 82:k=1;break;case 70:k=-1}},!1);this.domElement.addEventListener("keyup",function(a){switch(a.keyCode){case 38:case 87:i=0;break;case 37:case 65:j=0;break;case 40:case 83:i=0;break;case 39:case 68:j=0;break;case 81:e=!1;break;case 69:e=!1;break;case 82:k=0;break;case 70:k=0}},!1)};
+function(a){switch(a.keyCode){case 38:case 87:i=1;break;case 37:case 65:k=-1;break;case 40:case 83:i=-1;break;case 39:case 68:k=1;break;case 81:e=!0;h=1;break;case 69:e=!0;h=-1;break;case 82:j=1;break;case 70:j=-1}},!1);this.domElement.addEventListener("keyup",function(a){switch(a.keyCode){case 38:case 87:i=0;break;case 37:case 65:k=0;break;case 40:case 83:i=0;break;case 39:case 68:k=0;break;case 81:e=!1;break;case 69:e=!1;break;case 82:j=0;break;case 70:j=0}},!1)};
 THREE.TrackballControls=function(a,b){var c=this;this.object=a;this.domElement=void 0!==b?b:document;this.enabled=!0;this.screen={width:window.innerWidth,height:window.innerHeight,offsetLeft:0,offsetTop:0};this.radius=(this.screen.width+this.screen.height)/4;this.rotateSpeed=1;this.zoomSpeed=1.2;this.panSpeed=0.3;this.staticMoving=this.noPan=this.noZoom=this.noRotate=!1;this.dynamicDampingFactor=0.2;this.minDistance=0;this.maxDistance=Infinity;this.keys=[65,83,68];this.target=new THREE.Vector3(0,
-0,0);var d=!1,f=-1,g=new THREE.Vector3,e=new THREE.Vector3,h=new THREE.Vector3,i=new THREE.Vector2,j=new THREE.Vector2,k=new THREE.Vector2,q=new THREE.Vector2;this.handleEvent=function(a){if("function"==typeof this[a.type])this[a.type](a)};this.getMouseOnScreen=function(a,b){return new THREE.Vector2(0.5*((a-c.screen.offsetLeft)/c.radius),0.5*((b-c.screen.offsetTop)/c.radius))};this.getMouseProjectionOnBall=function(a,b){var d=new THREE.Vector3((a-0.5*c.screen.width-c.screen.offsetLeft)/c.radius,(0.5*
+0,0);var d=!1,f=-1,g=new THREE.Vector3,e=new THREE.Vector3,h=new THREE.Vector3,i=new THREE.Vector2,k=new THREE.Vector2,j=new THREE.Vector2,q=new THREE.Vector2;this.handleEvent=function(a){if("function"==typeof this[a.type])this[a.type](a)};this.getMouseOnScreen=function(a,b){return new THREE.Vector2(0.5*((a-c.screen.offsetLeft)/c.radius),0.5*((b-c.screen.offsetTop)/c.radius))};this.getMouseProjectionOnBall=function(a,b){var d=new THREE.Vector3((a-0.5*c.screen.width-c.screen.offsetLeft)/c.radius,(0.5*
 c.screen.height+c.screen.offsetTop-b)/c.radius,0),e=d.length();1<e?d.normalize():d.z=Math.sqrt(1-e*e);g.copy(c.object.position).subSelf(c.target);e=c.object.up.clone().setLength(d.y);e.addSelf(c.object.up.clone().crossSelf(g).setLength(d.x));e.addSelf(g.setLength(d.z));return e};this.rotateCamera=function(){var a=Math.acos(e.dot(h)/e.length()/h.length());if(a){var b=(new THREE.Vector3).cross(e,h).normalize(),d=new THREE.Quaternion,a=a*c.rotateSpeed;d.setFromAxisAngle(b,-a);d.multiplyVector3(g);d.multiplyVector3(c.object.up);
-d.multiplyVector3(h);c.staticMoving?e=h:(d.setFromAxisAngle(b,a*(c.dynamicDampingFactor-1)),d.multiplyVector3(e))}};this.zoomCamera=function(){var a=1+(j.y-i.y)*c.zoomSpeed;1!==a&&0<a&&(g.multiplyScalar(a),c.staticMoving?i=j:i.y+=(j.y-i.y)*this.dynamicDampingFactor)};this.panCamera=function(){var a=q.clone().subSelf(k);if(a.lengthSq()){a.multiplyScalar(g.length()*c.panSpeed);var b=g.clone().crossSelf(c.object.up).setLength(a.x);b.addSelf(c.object.up.clone().setLength(a.y));c.object.position.addSelf(b);
-c.target.addSelf(b);c.staticMoving?k=q:k.addSelf(a.sub(q,k).multiplyScalar(c.dynamicDampingFactor))}};this.checkDistances=function(){if(!c.noZoom||!c.noPan)c.object.position.lengthSq()>c.maxDistance*c.maxDistance&&c.object.position.setLength(c.maxDistance),g.lengthSq()<c.minDistance*c.minDistance&&c.object.position.add(c.target,g.setLength(c.minDistance))};this.update=function(){g.copy(c.object.position).subSelf(this.target);c.noRotate||c.rotateCamera();c.noZoom||c.zoomCamera();c.noPan||c.panCamera();
-c.object.position.add(c.target,g);c.checkDistances();c.object.lookAt(c.target)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){c.enabled&&(d&&(e=h=c.getMouseProjectionOnBall(a.clientX,a.clientY),i=j=c.getMouseOnScreen(a.clientX,a.clientY),k=q=c.getMouseOnScreen(a.clientX,a.clientY),d=!1),-1!==f&&(0===f&&!c.noRotate?h=c.getMouseProjectionOnBall(a.clientX,a.clientY):1===f&&!c.noZoom?j=c.getMouseOnScreen(a.clientX,
-a.clientY):2===f&&!c.noPan&&(q=c.getMouseOnScreen(a.clientX,a.clientY))))},!1);this.domElement.addEventListener("mousedown",function(a){if(c.enabled&&(a.preventDefault(),a.stopPropagation(),-1===f))f=a.button,0===f&&!c.noRotate?e=h=c.getMouseProjectionOnBall(a.clientX,a.clientY):1===f&&!c.noZoom?i=j=c.getMouseOnScreen(a.clientX,a.clientY):this.noPan||(k=q=c.getMouseOnScreen(a.clientX,a.clientY))},!1);this.domElement.addEventListener("mouseup",function(a){c.enabled&&(a.preventDefault(),a.stopPropagation(),
+d.multiplyVector3(h);c.staticMoving?e=h:(d.setFromAxisAngle(b,a*(c.dynamicDampingFactor-1)),d.multiplyVector3(e))}};this.zoomCamera=function(){var a=1+(k.y-i.y)*c.zoomSpeed;1!==a&&0<a&&(g.multiplyScalar(a),c.staticMoving?i=k:i.y+=(k.y-i.y)*this.dynamicDampingFactor)};this.panCamera=function(){var a=q.clone().subSelf(j);if(a.lengthSq()){a.multiplyScalar(g.length()*c.panSpeed);var b=g.clone().crossSelf(c.object.up).setLength(a.x);b.addSelf(c.object.up.clone().setLength(a.y));c.object.position.addSelf(b);
+c.target.addSelf(b);c.staticMoving?j=q:j.addSelf(a.sub(q,j).multiplyScalar(c.dynamicDampingFactor))}};this.checkDistances=function(){if(!c.noZoom||!c.noPan)c.object.position.lengthSq()>c.maxDistance*c.maxDistance&&c.object.position.setLength(c.maxDistance),g.lengthSq()<c.minDistance*c.minDistance&&c.object.position.add(c.target,g.setLength(c.minDistance))};this.update=function(){g.copy(c.object.position).subSelf(this.target);c.noRotate||c.rotateCamera();c.noZoom||c.zoomCamera();c.noPan||c.panCamera();
+c.object.position.add(c.target,g);c.checkDistances();c.object.lookAt(c.target)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){c.enabled&&(d&&(e=h=c.getMouseProjectionOnBall(a.clientX,a.clientY),i=k=c.getMouseOnScreen(a.clientX,a.clientY),j=q=c.getMouseOnScreen(a.clientX,a.clientY),d=!1),-1!==f&&(0===f&&!c.noRotate?h=c.getMouseProjectionOnBall(a.clientX,a.clientY):1===f&&!c.noZoom?k=c.getMouseOnScreen(a.clientX,
+a.clientY):2===f&&!c.noPan&&(q=c.getMouseOnScreen(a.clientX,a.clientY))))},!1);this.domElement.addEventListener("mousedown",function(a){if(c.enabled&&(a.preventDefault(),a.stopPropagation(),-1===f))f=a.button,0===f&&!c.noRotate?e=h=c.getMouseProjectionOnBall(a.clientX,a.clientY):1===f&&!c.noZoom?i=k=c.getMouseOnScreen(a.clientX,a.clientY):this.noPan||(j=q=c.getMouseOnScreen(a.clientX,a.clientY))},!1);this.domElement.addEventListener("mouseup",function(a){c.enabled&&(a.preventDefault(),a.stopPropagation(),
 f=-1)},!1);window.addEventListener("keydown",function(a){c.enabled&&-1===f&&(a.keyCode===c.keys[0]&&!c.noRotate?f=0:a.keyCode===c.keys[1]&&!c.noZoom?f=1:a.keyCode===c.keys[2]&&!c.noPan&&(f=2),-1!==f&&(d=!0))},!1);window.addEventListener("keyup",function(){c.enabled&&-1!==f&&(f=-1)},!1)};
-THREE.CubeGeometry=function(a,b,c,d,f,g,e,h){function i(a,b,c,e,h,i,l,k){var m,n=d||1,q=f||1,r=h/2,p=i/2,o=j.vertices.length;if("x"===a&&"y"===b||"y"===a&&"x"===b)m="z";else if("x"===a&&"z"===b||"z"===a&&"x"===b)m="y",q=g||1;else if("z"===a&&"y"===b||"y"===a&&"z"===b)m="x",n=g||1;var s=n+1,t=q+1,C=h/n,L=i/q,N=new THREE.Vector3;N[m]=0<l?1:-1;for(h=0;h<t;h++)for(i=0;i<s;i++){var M=new THREE.Vector3;M[a]=(i*C-r)*c;M[b]=(h*L-p)*e;M[m]=l;j.vertices.push(new THREE.Vertex(M))}for(h=0;h<q;h++)for(i=0;i<n;i++)a=
-new THREE.Face4(i+s*h+o,i+s*(h+1)+o,i+1+s*(h+1)+o,i+1+s*h+o),a.normal.copy(N),a.vertexNormals.push(N.clone(),N.clone(),N.clone(),N.clone()),a.materialIndex=k,j.faces.push(a),j.faceVertexUvs[0].push([new THREE.UV(i/n,h/q),new THREE.UV(i/n,(h+1)/q),new THREE.UV((i+1)/n,(h+1)/q),new THREE.UV((i+1)/n,h/q)])}THREE.Geometry.call(this);var j=this,k=a/2,q=b/2,l=c/2,n,r,m,o,p,s;if(void 0!==e){if(e instanceof Array)this.materials=e;else{this.materials=[];for(n=0;6>n;n++)this.materials.push(e)}n=0;o=1;r=2;p=
-3;m=4;s=5}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(void 0!=h)for(var t in h)void 0!==this.sides[t]&&(this.sides[t]=h[t]);this.sides.px&&i("z","y",-1,-1,c,b,k,n);this.sides.nx&&i("z","y",1,-1,c,b,-k,o);this.sides.py&&i("x","z",1,1,a,c,q,r);this.sides.ny&&i("x","z",1,-1,a,c,-q,p);this.sides.pz&&i("x","y",1,-1,a,b,l,m);this.sides.nz&&i("x","y",-1,-1,a,b,-l,s);this.computeCentroids();this.mergeVertices()};THREE.CubeGeometry.prototype=new THREE.Geometry;
+THREE.CubeGeometry=function(a,b,c,d,f,g,e,h){function i(a,b,c,e,h,i,l,m){var j,n=d||1,q=f||1,r=h/2,p=i/2,o=k.vertices.length;if("x"===a&&"y"===b||"y"===a&&"x"===b)j="z";else if("x"===a&&"z"===b||"z"===a&&"x"===b)j="y",q=g||1;else if("z"===a&&"y"===b||"y"===a&&"z"===b)j="x",n=g||1;var s=n+1,t=q+1,C=h/n,L=i/q,N=new THREE.Vector3;N[j]=0<l?1:-1;for(h=0;h<t;h++)for(i=0;i<s;i++){var M=new THREE.Vector3;M[a]=(i*C-r)*c;M[b]=(h*L-p)*e;M[j]=l;k.vertices.push(new THREE.Vertex(M))}for(h=0;h<q;h++)for(i=0;i<n;i++)a=
+new THREE.Face4(i+s*h+o,i+s*(h+1)+o,i+1+s*(h+1)+o,i+1+s*h+o),a.normal.copy(N),a.vertexNormals.push(N.clone(),N.clone(),N.clone(),N.clone()),a.materialIndex=m,k.faces.push(a),k.faceVertexUvs[0].push([new THREE.UV(i/n,h/q),new THREE.UV(i/n,(h+1)/q),new THREE.UV((i+1)/n,(h+1)/q),new THREE.UV((i+1)/n,h/q)])}THREE.Geometry.call(this);var k=this,j=a/2,q=b/2,l=c/2,n,r,m,o,p,s;if(void 0!==e){if(e instanceof Array)this.materials=e;else{this.materials=[];for(n=0;6>n;n++)this.materials.push(e)}n=0;o=1;r=2;p=
+3;m=4;s=5}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(void 0!=h)for(var t in h)void 0!==this.sides[t]&&(this.sides[t]=h[t]);this.sides.px&&i("z","y",-1,-1,c,b,j,n);this.sides.nx&&i("z","y",1,-1,c,b,-j,o);this.sides.py&&i("x","z",1,1,a,c,q,r);this.sides.ny&&i("x","z",1,-1,a,c,-q,p);this.sides.pz&&i("x","y",1,-1,a,b,l,m);this.sides.nz&&i("x","y",-1,-1,a,b,-l,s);this.computeCentroids();this.mergeVertices()};THREE.CubeGeometry.prototype=new THREE.Geometry;
 THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
-THREE.CylinderGeometry=function(a,b,c,d,f,g){THREE.Geometry.call(this);var a=void 0!==a?a:20,b=void 0!==b?b:20,c=void 0!==c?c:100,e=c/2,d=d||8,f=f||1,h,i,j=[],k=[];for(i=0;i<=f;i++){var q=[],l=[],n=i/f,r=n*(b-a)+a;for(h=0;h<=d;h++){var m=h/d,o=r*Math.sin(2*m*Math.PI),p=-n*c+e,s=r*Math.cos(2*m*Math.PI);this.vertices.push(new THREE.Vertex(new THREE.Vector3(o,p,s)));q.push(this.vertices.length-1);l.push(new THREE.UV(m,n))}j.push(q);k.push(l)}for(i=0;i<f;i++)for(h=0;h<d;h++){var c=j[i][h],q=j[i+1][h],
-l=j[i+1][h+1],n=j[i][h+1],r=this.vertices[c].position.clone().setY(0).normalize(),m=this.vertices[q].position.clone().setY(0).normalize(),o=this.vertices[l].position.clone().setY(0).normalize(),p=this.vertices[n].position.clone().setY(0).normalize(),s=k[i][h].clone(),t=k[i+1][h].clone(),u=k[i+1][h+1].clone(),v=k[i][h+1].clone();this.faces.push(new THREE.Face4(c,q,l,n,[r,m,o,p]));this.faceVertexUvs[0].push([s,t,u,v])}if(!g&&0<a){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,e,0)));for(h=
-0;h<d;h++)c=j[0][h],q=j[0][h+1],l=this.vertices.length-1,r=new THREE.Vector3(0,1,0),m=new THREE.Vector3(0,1,0),o=new THREE.Vector3(0,1,0),s=k[0][h].clone(),t=k[0][h+1].clone(),u=new THREE.UV(t.u,0),this.faces.push(new THREE.Face3(c,q,l,[r,m,o])),this.faceVertexUvs[0].push([s,t,u])}if(!g&&0<b){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-e,0)));for(h=0;h<d;h++)c=j[i][h+1],q=j[i][h],l=this.vertices.length-1,r=new THREE.Vector3(0,-1,0),m=new THREE.Vector3(0,-1,0),o=new THREE.Vector3(0,-1,
-0),s=k[i][h+1].clone(),t=k[i][h].clone(),u=new THREE.UV(t.u,1),this.faces.push(new THREE.Face3(c,q,l,[r,m,o])),this.faceVertexUvs[0].push([s,t,u])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
+THREE.CylinderGeometry=function(a,b,c,d,f,g){THREE.Geometry.call(this);var a=void 0!==a?a:20,b=void 0!==b?b:20,c=void 0!==c?c:100,e=c/2,d=d||8,f=f||1,h,i,k=[],j=[];for(i=0;i<=f;i++){var q=[],l=[],n=i/f,r=n*(b-a)+a;for(h=0;h<=d;h++){var m=h/d,o=r*Math.sin(2*m*Math.PI),p=-n*c+e,s=r*Math.cos(2*m*Math.PI);this.vertices.push(new THREE.Vertex(new THREE.Vector3(o,p,s)));q.push(this.vertices.length-1);l.push(new THREE.UV(m,n))}k.push(q);j.push(l)}for(i=0;i<f;i++)for(h=0;h<d;h++){var c=k[i][h],q=k[i+1][h],
+l=k[i+1][h+1],n=k[i][h+1],r=this.vertices[c].position.clone().setY(0).normalize(),m=this.vertices[q].position.clone().setY(0).normalize(),o=this.vertices[l].position.clone().setY(0).normalize(),p=this.vertices[n].position.clone().setY(0).normalize(),s=j[i][h].clone(),t=j[i+1][h].clone(),u=j[i+1][h+1].clone(),v=j[i][h+1].clone();this.faces.push(new THREE.Face4(c,q,l,n,[r,m,o,p]));this.faceVertexUvs[0].push([s,t,u,v])}if(!g&&0<a){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,e,0)));for(h=
+0;h<d;h++)c=k[0][h],q=k[0][h+1],l=this.vertices.length-1,r=new THREE.Vector3(0,1,0),m=new THREE.Vector3(0,1,0),o=new THREE.Vector3(0,1,0),s=j[0][h].clone(),t=j[0][h+1].clone(),u=new THREE.UV(t.u,0),this.faces.push(new THREE.Face3(c,q,l,[r,m,o])),this.faceVertexUvs[0].push([s,t,u])}if(!g&&0<b){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-e,0)));for(h=0;h<d;h++)c=k[i][h+1],q=k[i][h],l=this.vertices.length-1,r=new THREE.Vector3(0,-1,0),m=new THREE.Vector3(0,-1,0),o=new THREE.Vector3(0,-1,
+0),s=j[i][h+1].clone(),t=j[i][h].clone(),u=new THREE.UV(t.u,1),this.faces.push(new THREE.Face3(c,q,l,[r,m,o])),this.faceVertexUvs[0].push([s,t,u])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
 THREE.ExtrudeGeometry=function(a,b){if("undefined"!==typeof a){THREE.Geometry.call(this);var a=a instanceof Array?a:[a],c,d,f=a.length;this.shapebb=a[f-1].getBoundingBox();for(d=0;d<f;d++)c=a[d],this.addShape(c,b);this.computeCentroids();this.computeFaceNormals()}};THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;
 THREE.ExtrudeGeometry.prototype.addShape=function(a,b){function c(a,b,c){b||console.log("die");return b.clone().multiplyScalar(c).addSelf(a)}function d(a,b,c){var d=THREE.ExtrudeGeometry.__v1,e=THREE.ExtrudeGeometry.__v2,f=THREE.ExtrudeGeometry.__v3,g=THREE.ExtrudeGeometry.__v4,h=THREE.ExtrudeGeometry.__v5,i=THREE.ExtrudeGeometry.__v6;d.set(a.x-b.x,a.y-b.y);e.set(a.x-c.x,a.y-c.y);d=d.normalize();e=e.normalize();f.set(-d.y,d.x);g.set(e.y,-e.x);h.copy(a).addSelf(f);i.copy(a).addSelf(g);if(h.equals(i))return g.clone();
 h.copy(b).addSelf(f);i.copy(c).addSelf(g);f=d.dot(g);g=i.subSelf(h).dot(g);0===f&&(console.log("Either infinite or no solutions!"),0===g?console.log("Its finite solutions."):console.log("Too bad, no solutions."));g/=f;return 0>g?(b=Math.atan2(b.y-a.y,b.x-a.x),a=Math.atan2(c.y-a.y,c.x-a.x),b>a&&(a+=2*Math.PI),c=(b+a)/2,a=-Math.cos(c),c=-Math.sin(c),new THREE.Vector2(a,c)):d.multiplyScalar(g).addSelf(h).subSelf(a).clone()}function f(a){for(y=a.length;0<=--y;){C=y;L=y-1;0>L&&(L=a.length-1);for(var b=
-0,c=n+2*k,b=0;b<c;b++){var d=H*b,e=H*(b+1),f=O+C+d,g=O+C+e,j=f,d=O+L+d,e=O+L+e,l=g,j=j+F,d=d+F,e=e+F,l=l+F;A.faces.push(new THREE.Face4(j,d,e,l,null,null,u));void 0!==u&&(j=b/c,d=(b+1)/c,e=h+2*i,f=(A.vertices[f].position.z+i)/e,g=(A.vertices[g].position.z+i)/e,A.faceVertexUvs[0].push([new THREE.UV(f,j),new THREE.UV(g,j),new THREE.UV(g,d),new THREE.UV(f,d)]))}}}function g(a,b,c){A.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function e(a,b,c){a+=F;b+=F;c+=F;A.faces.push(new THREE.Face3(a,
-b,c,null,null,t));if(void 0!==t){var d=v.minX,e=v.minY,f=v.maxY,g=v.maxX,h=A.vertices[b].position.x-d,b=A.vertices[b].position.y-e,i=A.vertices[c].position.x-d,c=A.vertices[c].position.y-e;A.faceVertexUvs[0].push([new THREE.UV((A.vertices[a].position.x-d)/g,(A.vertices[a].position.y-e)/f),new THREE.UV(h/g,b/f),new THREE.UV(i/g,c/f)])}}var h=void 0!==b.amount?b.amount:100,i=void 0!==b.bevelThickness?b.bevelThickness:6,j=void 0!==b.bevelSize?b.bevelSize:i-2,k=void 0!==b.bevelSegments?b.bevelSegments:
-3,q=void 0!==b.bevelEnabled?b.bevelEnabled:!0,l=void 0!==b.curveSegments?b.curveSegments:12,n=void 0!==b.steps?b.steps:1,r=b.bendPath,m=b.extrudePath,o,p=!1,s=void 0!==b.useSpacedPoints?b.useSpacedPoints:!1,t=b.material,u=b.extrudeMaterial,v=this.shapebb;if(m)o=m.getPoints(l),n=o.length,p=!0,q=!1;q||(j=i=k=0);var w,z,x,A=this,F=this.vertices.length;r&&a.addWrapPath(r);l=s?a.extractAllSpacedPoints(l):a.extractAllPoints(l);r=l.shape;l=l.holes;if(m=!THREE.Shape.Utils.isClockWise(r)){r=r.reverse();for(z=
+0,c=n+2*j,b=0;b<c;b++){var d=H*b,e=H*(b+1),f=O+C+d,g=O+C+e,l=f,d=O+L+d,e=O+L+e,k=g,l=l+F,d=d+F,e=e+F,k=k+F;A.faces.push(new THREE.Face4(l,d,e,k,null,null,u));void 0!==u&&(l=b/c,d=(b+1)/c,e=h+2*i,f=(A.vertices[f].position.z+i)/e,g=(A.vertices[g].position.z+i)/e,A.faceVertexUvs[0].push([new THREE.UV(f,l),new THREE.UV(g,l),new THREE.UV(g,d),new THREE.UV(f,d)]))}}}function g(a,b,c){A.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function e(a,b,c){a+=F;b+=F;c+=F;A.faces.push(new THREE.Face3(a,
+b,c,null,null,t));if(void 0!==t){var d=v.minX,e=v.minY,f=v.maxY,g=v.maxX,h=A.vertices[b].position.x-d,b=A.vertices[b].position.y-e,i=A.vertices[c].position.x-d,c=A.vertices[c].position.y-e;A.faceVertexUvs[0].push([new THREE.UV((A.vertices[a].position.x-d)/g,(A.vertices[a].position.y-e)/f),new THREE.UV(h/g,b/f),new THREE.UV(i/g,c/f)])}}var h=void 0!==b.amount?b.amount:100,i=void 0!==b.bevelThickness?b.bevelThickness:6,k=void 0!==b.bevelSize?b.bevelSize:i-2,j=void 0!==b.bevelSegments?b.bevelSegments:
+3,q=void 0!==b.bevelEnabled?b.bevelEnabled:!0,l=void 0!==b.curveSegments?b.curveSegments:12,n=void 0!==b.steps?b.steps:1,r=b.bendPath,m=b.extrudePath,o,p=!1,s=void 0!==b.useSpacedPoints?b.useSpacedPoints:!1,t=b.material,u=b.extrudeMaterial,v=this.shapebb;if(m)o=m.getPoints(l),n=o.length,p=!0,q=!1;q||(k=i=j=0);var w,z,x,A=this,F=this.vertices.length;r&&a.addWrapPath(r);l=s?a.extractAllSpacedPoints(l):a.extractAllPoints(l);r=l.shape;l=l.holes;if(m=!THREE.Shape.Utils.isClockWise(r)){r=r.reverse();for(z=
 0,x=l.length;z<x;z++)w=l[z],THREE.Shape.Utils.isClockWise(w)&&(l[z]=w.reverse());m=!1}m=THREE.Shape.Utils.triangulateShape(r,l);s=r;for(z=0,x=l.length;z<x;z++)w=l[z],r=r.concat(w);for(var E,J,G,B,H=r.length,D=m.length,I=[],y=0,K=s.length,C=K-1,L=y+1;y<K;y++,C++,L++)C===K&&(C=0),L===K&&(L=0),I[y]=d(s[y],s[C],s[L]);var N=[],M,S=I.concat();for(z=0,x=l.length;z<x;z++){w=l[z];M=[];for(y=0,K=w.length,C=K-1,L=y+1;y<K;y++,C++,L++)C===K&&(C=0),L===K&&(L=0),M[y]=d(w[y],w[C],w[L]);N.push(M);S=S.concat(M)}for(E=
-0;E<k;E++){J=E/k;G=i*(1-J);J=j*Math.sin(J*Math.PI/2);for(y=0,K=s.length;y<K;y++)B=c(s[y],I[y],J),g(B.x,B.y,-G);for(z=0,x=l.length;z<x;z++){w=l[z];M=N[z];for(y=0,K=w.length;y<K;y++)B=c(w[y],M[y],J),g(B.x,B.y,-G)}}J=j;for(y=0;y<H;y++)B=q?c(r[y],S[y],J):r[y],p?g(B.x,B.y+o[0].y,o[0].x):g(B.x,B.y,0);for(E=1;E<=n;E++)for(y=0;y<H;y++)B=q?c(r[y],S[y],J):r[y],p?g(B.x,B.y+o[E-1].y,o[E-1].x):g(B.x,B.y,h/n*E);for(E=k-1;0<=E;E--){J=E/k;G=i*(1-J);J=j*Math.sin(J*Math.PI/2);for(y=0,K=s.length;y<K;y++)B=c(s[y],I[y],
-J),g(B.x,B.y,h+G);for(z=0,x=l.length;z<x;z++){w=l[z];M=N[z];for(y=0,K=w.length;y<K;y++)B=c(w[y],M[y],J),p?g(B.x,B.y+o[n-1].y,o[n-1].x+G):g(B.x,B.y,h+G)}}if(q){q=0*H;for(y=0;y<D;y++)j=m[y],e(j[2]+q,j[1]+q,j[0]+q);q=H*(n+2*k);for(y=0;y<D;y++)j=m[y],e(j[0]+q,j[1]+q,j[2]+q)}else{for(y=0;y<D;y++)j=m[y],e(j[2],j[1],j[0]);for(y=0;y<D;y++)j=m[y],e(j[0]+H*n,j[1]+H*n,j[2]+H*n)}var O=0;f(s);O+=s.length;for(z=0,x=l.length;z<x;z++)w=l[z],f(w),O+=w.length};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;
+0;E<j;E++){J=E/j;G=i*(1-J);J=k*Math.sin(J*Math.PI/2);for(y=0,K=s.length;y<K;y++)B=c(s[y],I[y],J),g(B.x,B.y,-G);for(z=0,x=l.length;z<x;z++){w=l[z];M=N[z];for(y=0,K=w.length;y<K;y++)B=c(w[y],M[y],J),g(B.x,B.y,-G)}}J=k;for(y=0;y<H;y++)B=q?c(r[y],S[y],J):r[y],p?g(B.x,B.y+o[0].y,o[0].x):g(B.x,B.y,0);for(E=1;E<=n;E++)for(y=0;y<H;y++)B=q?c(r[y],S[y],J):r[y],p?g(B.x,B.y+o[E-1].y,o[E-1].x):g(B.x,B.y,h/n*E);for(E=j-1;0<=E;E--){J=E/j;G=i*(1-J);J=k*Math.sin(J*Math.PI/2);for(y=0,K=s.length;y<K;y++)B=c(s[y],I[y],
+J),g(B.x,B.y,h+G);for(z=0,x=l.length;z<x;z++){w=l[z];M=N[z];for(y=0,K=w.length;y<K;y++)B=c(w[y],M[y],J),p?g(B.x,B.y+o[n-1].y,o[n-1].x+G):g(B.x,B.y,h+G)}}if(q){q=0*H;for(y=0;y<D;y++)k=m[y],e(k[2]+q,k[1]+q,k[0]+q);q=H*(n+2*j);for(y=0;y<D;y++)k=m[y],e(k[0]+q,k[1]+q,k[2]+q)}else{for(y=0;y<D;y++)k=m[y],e(k[2],k[1],k[0]);for(y=0;y<D;y++)k=m[y],e(k[0]+H*n,k[1]+H*n,k[2]+H*n)}var O=0;f(s);O+=s.length;for(z=0,x=l.length;z<x;z++)w=l[z],f(w),O+=w.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.LatheGeometry=function(a,b,c){THREE.Geometry.call(this);this.steps=b||12;this.angle=c||2*Math.PI;for(var b=this.angle/this.steps,c=[],d=[],f=[],g=[],e=(new THREE.Matrix4).setRotationZ(b),h=0;h<a.length;h++)this.vertices.push(new THREE.Vertex(a[h])),c[h]=a[h].clone(),d[h]=this.vertices.length-1;for(var i=0;i<=this.angle+0.0010;i+=b){for(h=0;h<c.length;h++)i<this.angle?(c[h]=e.multiplyVector3(c[h].clone()),this.vertices.push(new THREE.Vertex(c[h])),f[h]=this.vertices.length-1):f=g;0==i&&(g=d);
 for(h=0;h<d.length-1;h++)this.faces.push(new THREE.Face4(f[h],f[h+1],d[h+1],d[h])),this.faceVertexUvs[0].push([new THREE.UV(1-i/this.angle,h/a.length),new THREE.UV(1-i/this.angle,(h+1)/a.length),new THREE.UV(1-(i-b)/this.angle,(h+1)/a.length),new THREE.UV(1-(i-b)/this.angle,h/a.length)]);d=f;f=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=new THREE.Geometry;THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry;
-THREE.PlaneGeometry=function(a,b,c,d){THREE.Geometry.call(this);for(var f=a/2,g=b/2,c=c||1,d=d||1,e=c+1,h=d+1,i=a/c,j=b/d,k=new THREE.Vector3(0,0,1),a=0;a<h;a++)for(b=0;b<e;b++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(b*i-f,-(a*j-g),0)));for(a=0;a<d;a++)for(b=0;b<c;b++)f=new THREE.Face4(b+e*a,b+e*(a+1),b+1+e*(a+1),b+1+e*a),f.normal.copy(k),f.vertexNormals.push(k.clone(),k.clone(),k.clone(),k.clone()),this.faces.push(f),this.faceVertexUvs[0].push([new THREE.UV(b/c,a/d),new THREE.UV(b/
+THREE.PlaneGeometry=function(a,b,c,d){THREE.Geometry.call(this);for(var f=a/2,g=b/2,c=c||1,d=d||1,e=c+1,h=d+1,i=a/c,k=b/d,j=new THREE.Vector3(0,0,1),a=0;a<h;a++)for(b=0;b<e;b++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(b*i-f,-(a*k-g),0)));for(a=0;a<d;a++)for(b=0;b<c;b++)f=new THREE.Face4(b+e*a,b+e*(a+1),b+1+e*(a+1),b+1+e*a),f.normal.copy(j),f.vertexNormals.push(j.clone(),j.clone(),j.clone(),j.clone()),this.faces.push(f),this.faceVertexUvs[0].push([new THREE.UV(b/c,a/d),new THREE.UV(b/
 c,(a+1)/d),new THREE.UV((b+1)/c,(a+1)/d),new THREE.UV((b+1)/c,a/d)]);this.computeCentroids()};THREE.PlaneGeometry.prototype=new THREE.Geometry;THREE.PlaneGeometry.prototype.constructor=THREE.PlaneGeometry;
-THREE.SphereGeometry=function(a,b,c,d,f,g,e){THREE.Geometry.call(this);var a=a||50,d=void 0!==d?d:0,f=void 0!==f?f:2*Math.PI,g=void 0!==g?g:0,e=void 0!==e?e:Math.PI,b=Math.max(3,Math.floor(b)||8),c=Math.max(2,Math.floor(c)||6),h,i,j=[],k=[];for(i=0;i<=c;i++){var q=[],l=[];for(h=0;h<=b;h++){var n=h/b,r=i/c,m=-a*Math.cos(d+n*f)*Math.sin(g+r*e),o=a*Math.cos(g+r*e),p=a*Math.sin(d+n*f)*Math.sin(g+r*e);this.vertices.push(new THREE.Vertex(new THREE.Vector3(m,o,p)));q.push(this.vertices.length-1);l.push(new THREE.UV(n,
-r))}j.push(q);k.push(l)}for(i=0;i<c;i++)for(h=0;h<b;h++){var d=j[i][h+1],f=j[i][h],g=j[i+1][h],e=j[i+1][h+1],q=this.vertices[d].position.clone().normalize(),l=this.vertices[f].position.clone().normalize(),n=this.vertices[g].position.clone().normalize(),r=this.vertices[e].position.clone().normalize(),m=k[i][h+1].clone(),o=k[i][h].clone(),p=k[i+1][h].clone(),s=k[i+1][h+1].clone();Math.abs(this.vertices[d].position.y)==a?(this.faces.push(new THREE.Face3(d,g,e,[q,n,r])),this.faceVertexUvs[0].push([m,
+THREE.SphereGeometry=function(a,b,c,d,f,g,e){THREE.Geometry.call(this);var a=a||50,d=void 0!==d?d:0,f=void 0!==f?f:2*Math.PI,g=void 0!==g?g:0,e=void 0!==e?e:Math.PI,b=Math.max(3,Math.floor(b)||8),c=Math.max(2,Math.floor(c)||6),h,i,k=[],j=[];for(i=0;i<=c;i++){var q=[],l=[];for(h=0;h<=b;h++){var n=h/b,r=i/c,m=-a*Math.cos(d+n*f)*Math.sin(g+r*e),o=a*Math.cos(g+r*e),p=a*Math.sin(d+n*f)*Math.sin(g+r*e);this.vertices.push(new THREE.Vertex(new THREE.Vector3(m,o,p)));q.push(this.vertices.length-1);l.push(new THREE.UV(n,
+r))}k.push(q);j.push(l)}for(i=0;i<c;i++)for(h=0;h<b;h++){var d=k[i][h+1],f=k[i][h],g=k[i+1][h],e=k[i+1][h+1],q=this.vertices[d].position.clone().normalize(),l=this.vertices[f].position.clone().normalize(),n=this.vertices[g].position.clone().normalize(),r=this.vertices[e].position.clone().normalize(),m=j[i][h+1].clone(),o=j[i][h].clone(),p=j[i+1][h].clone(),s=j[i+1][h+1].clone();Math.abs(this.vertices[d].position.y)==a?(this.faces.push(new THREE.Face3(d,g,e,[q,n,r])),this.faceVertexUvs[0].push([m,
 p,s])):Math.abs(this.vertices[g].position.y)==a?(this.faces.push(new THREE.Face3(d,f,g,[q,l,n])),this.faceVertexUvs[0].push([m,o,p])):(this.faces.push(new THREE.Face4(d,f,g,e,[q,l,n,r])),this.faceVertexUvs[0].push([m,o,p,s]))}this.computeCentroids();this.computeFaceNormals();this.boundingSphere={radius:a}};THREE.SphereGeometry.prototype=new THREE.Geometry;THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry;
 THREE.TextGeometry=function(a,b){var c=(new THREE.TextPath(a,b)).toShapes();b.amount=void 0!==b.height?b.height:50;if(void 0===b.bevelThickness)b.bevelThickness=10;if(void 0===b.bevelSize)b.bevelSize=8;if(void 0===b.bevelEnabled)b.bevelEnabled=!1;if(b.bend){var d=c[c.length-1].getBoundingBox().maxX;b.bendPath=new THREE.QuadraticBezierCurve(new THREE.Vector2(0,0),new THREE.Vector2(d/2,120),new THREE.Vector2(d,0))}THREE.ExtrudeGeometry.call(this,c,b)};THREE.TextGeometry.prototype=new THREE.ExtrudeGeometry;
 THREE.TextGeometry.prototype.constructor=THREE.TextGeometry;
 THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function(){return this.faces[this.face][this.weight][this.style]},loadFace:function(a){var b=a.familyName.toLowerCase();this.faces[b]=this.faces[b]||{};this.faces[b][a.cssFontWeight]=this.faces[b][a.cssFontWeight]||{};this.faces[b][a.cssFontWeight][a.cssFontStyle]=a;return this.faces[b][a.cssFontWeight][a.cssFontStyle]=a},drawText:function(a){for(var b=this.getFace(),c=this.size/b.resolution,d=
-0,f=(""+a).split(""),g=f.length,e=[],a=0;a<g;a++){var h=new THREE.Path,h=this.extractGlyphPoints(f[a],b,c,d,h),d=d+h.offset;e.push(h.path)}return{paths:e,offset:d/2}},extractGlyphPoints:function(a,b,c,d,f){var g=[],e,h,i,j,k,q,l,n,r,m,o,p=b.glyphs[a]||b.glyphs["?"];if(p){if(p.o){b=p._cachedOutline||(p._cachedOutline=p.o.split(" "));j=b.length;for(a=0;a<j;)switch(i=b[a++],i){case "m":i=b[a++]*c+d;k=b[a++]*c;g.push(new THREE.Vector2(i,k));f.moveTo(i,k);break;case "l":i=b[a++]*c+d;k=b[a++]*c;g.push(new THREE.Vector2(i,
-k));f.lineTo(i,k);break;case "q":i=b[a++]*c+d;k=b[a++]*c;n=b[a++]*c+d;r=b[a++]*c;f.quadraticCurveTo(n,r,i,k);if(e=g[g.length-1]){q=e.x;l=e.y;for(e=1,h=this.divisions;e<=h;e++){var s=e/h,t=THREE.Shape.Utils.b2(s,q,n,i),s=THREE.Shape.Utils.b2(s,l,r,k);g.push(new THREE.Vector2(t,s))}}break;case "b":if(i=b[a++]*c+d,k=b[a++]*c,n=b[a++]*c+d,r=b[a++]*-c,m=b[a++]*c+d,o=b[a++]*-c,f.bezierCurveTo(i,k,n,r,m,o),e=g[g.length-1]){q=e.x;l=e.y;for(e=1,h=this.divisions;e<=h;e++)s=e/h,t=THREE.Shape.Utils.b3(s,q,n,
-m,i),s=THREE.Shape.Utils.b3(s,l,r,o,k),g.push(new THREE.Vector2(t,s))}}}return{offset:p.ha*c,points:g,path:f}}}};
-(function(a){var b=function(a){for(var b=a.length,f=0,g=b-1,e=0;e<b;g=e++)f+=a[g].x*a[e].y-a[e].x*a[g].y;return 0.5*f};a.Triangulate=function(a,d){var f=a.length;if(3>f)return null;var g=[],e=[],h=[],i,j,k;if(0<b(a))for(j=0;j<f;j++)e[j]=j;else for(j=0;j<f;j++)e[j]=f-1-j;var q=2*f;for(j=f-1;2<f;){if(0>=q--){console.log("Warning, unable to triangulate polygon!");break}i=j;f<=i&&(i=0);j=i+1;f<=j&&(j=0);k=j+1;f<=k&&(k=0);var l;a:{l=a;var n=i,r=j,m=k,o=f,p=e,s=void 0,t=void 0,u=void 0,v=void 0,w=void 0,
+0,f=(""+a).split(""),g=f.length,e=[],a=0;a<g;a++){var h=new THREE.Path,h=this.extractGlyphPoints(f[a],b,c,d,h),d=d+h.offset;e.push(h.path)}return{paths:e,offset:d/2}},extractGlyphPoints:function(a,b,c,d,f){var g=[],e,h,i,k,j,q,l,n,r,m,o,p=b.glyphs[a]||b.glyphs["?"];if(p){if(p.o){b=p._cachedOutline||(p._cachedOutline=p.o.split(" "));k=b.length;for(a=0;a<k;)switch(i=b[a++],i){case "m":i=b[a++]*c+d;j=b[a++]*c;g.push(new THREE.Vector2(i,j));f.moveTo(i,j);break;case "l":i=b[a++]*c+d;j=b[a++]*c;g.push(new THREE.Vector2(i,
+j));f.lineTo(i,j);break;case "q":i=b[a++]*c+d;j=b[a++]*c;n=b[a++]*c+d;r=b[a++]*c;f.quadraticCurveTo(n,r,i,j);if(e=g[g.length-1]){q=e.x;l=e.y;for(e=1,h=this.divisions;e<=h;e++){var s=e/h,t=THREE.Shape.Utils.b2(s,q,n,i),s=THREE.Shape.Utils.b2(s,l,r,j);g.push(new THREE.Vector2(t,s))}}break;case "b":if(i=b[a++]*c+d,j=b[a++]*c,n=b[a++]*c+d,r=b[a++]*-c,m=b[a++]*c+d,o=b[a++]*-c,f.bezierCurveTo(i,j,n,r,m,o),e=g[g.length-1]){q=e.x;l=e.y;for(e=1,h=this.divisions;e<=h;e++)s=e/h,t=THREE.Shape.Utils.b3(s,q,n,
+m,i),s=THREE.Shape.Utils.b3(s,l,r,o,j),g.push(new THREE.Vector2(t,s))}}}return{offset:p.ha*c,points:g,path:f}}}};
+(function(a){var b=function(a){for(var b=a.length,f=0,g=b-1,e=0;e<b;g=e++)f+=a[g].x*a[e].y-a[e].x*a[g].y;return 0.5*f};a.Triangulate=function(a,d){var f=a.length;if(3>f)return null;var g=[],e=[],h=[],i,k,j;if(0<b(a))for(k=0;k<f;k++)e[k]=k;else for(k=0;k<f;k++)e[k]=f-1-k;var q=2*f;for(k=f-1;2<f;){if(0>=q--){console.log("Warning, unable to triangulate polygon!");break}i=k;f<=i&&(i=0);k=i+1;f<=k&&(k=0);j=k+1;f<=j&&(j=0);var l;a:{l=a;var n=i,r=k,m=j,o=f,p=e,s=void 0,t=void 0,u=void 0,v=void 0,w=void 0,
 z=void 0,x=void 0,A=void 0,F=void 0,t=l[p[n]].x,u=l[p[n]].y,v=l[p[r]].x,w=l[p[r]].y,z=l[p[m]].x,x=l[p[m]].y;if(1.0E-10>(v-t)*(x-u)-(w-u)*(z-t))l=!1;else{for(s=0;s<o;s++)if(!(s==n||s==r||s==m)){var A=l[p[s]].x,F=l[p[s]].y,E=void 0,J=void 0,G=void 0,B=void 0,H=void 0,D=void 0,I=void 0,y=void 0,K=void 0,C=void 0,L=void 0,N=void 0,E=G=H=void 0,E=z-v,J=x-w,G=t-z,B=u-x,H=v-t,D=w-u,I=A-t,y=F-u,K=A-v,C=F-w,L=A-z,N=F-x,E=E*C-J*K,H=H*y-D*I,G=G*N-B*L;if(0<=E&&0<=G&&0<=H){l=!1;break a}}l=!0}}if(l){g.push([a[e[i]],
-a[e[j]],a[e[k]]]);h.push([e[i],e[j],e[k]]);for(i=j,k=j+1;k<f;i++,k++)e[i]=e[k];f--;q=2*f}}return d?h:g};a.Triangulate.area=b;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
+a[e[k]],a[e[j]]]);h.push([e[i],e[k],e[j]]);for(i=k,j=k+1;j<f;i++,j++)e[i]=e[j];f--;q=2*f}}return d?h:g};a.Triangulate.area=b;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
 THREE.TorusGeometry=function(a,b,c,d,f){THREE.Geometry.call(this);this.radius=a||100;this.tube=b||40;this.segmentsR=c||8;this.segmentsT=d||6;this.arc=f||2*Math.PI;f=new THREE.Vector3;a=[];b=[];for(c=0;c<=this.segmentsR;c++)for(d=0;d<=this.segmentsT;d++){var g=d/this.segmentsT*this.arc,e=2*c/this.segmentsR*Math.PI;f.x=this.radius*Math.cos(g);f.y=this.radius*Math.sin(g);var h=new THREE.Vector3;h.x=(this.radius+this.tube*Math.cos(e))*Math.cos(g);h.y=(this.radius+this.tube*Math.cos(e))*Math.sin(g);h.z=
 this.tube*Math.sin(e);this.vertices.push(new THREE.Vertex(h));a.push(new THREE.UV(d/this.segmentsT,1-c/this.segmentsR));b.push(h.clone().subSelf(f).normalize())}for(c=1;c<=this.segmentsR;c++)for(d=1;d<=this.segmentsT;d++){var f=(this.segmentsT+1)*c+d-1,g=(this.segmentsT+1)*(c-1)+d-1,e=(this.segmentsT+1)*(c-1)+d,h=(this.segmentsT+1)*c+d,i=new THREE.Face4(f,g,e,h,[b[f],b[g],b[e],b[h]]);i.normal.addSelf(b[f]);i.normal.addSelf(b[g]);i.normal.addSelf(b[e]);i.normal.addSelf(b[h]);i.normal.normalize();this.faces.push(i);
 this.faceVertexUvs[0].push([a[f].clone(),a[g].clone(),a[e].clone(),a[h].clone()])}this.computeCentroids()};THREE.TorusGeometry.prototype=new THREE.Geometry;THREE.TorusGeometry.prototype.constructor=THREE.TorusGeometry;
 THREE.TorusKnotGeometry=function(a,b,c,d,f,g,e){function h(a,b,c,d,e,f){var g=Math.cos(a);Math.cos(b);b=Math.sin(a);a*=c/d;c=Math.cos(a);g*=0.5*e*(2+c);b=0.5*e*(2+c)*b;e=0.5*f*e*Math.sin(a);return new THREE.Vector3(g,b,e)}THREE.Geometry.call(this);this.radius=a||200;this.tube=b||40;this.segmentsR=c||64;this.segmentsT=d||8;this.p=f||2;this.q=g||3;this.heightScale=e||1;this.grid=Array(this.segmentsR);c=new THREE.Vector3;d=new THREE.Vector3;f=new THREE.Vector3;for(a=0;a<this.segmentsR;++a){this.grid[a]=
 Array(this.segmentsT);for(b=0;b<this.segmentsT;++b){var i=2*(a/this.segmentsR)*this.p*Math.PI,e=2*(b/this.segmentsT)*Math.PI,g=h(i,e,this.q,this.p,this.radius,this.heightScale),i=h(i+0.01,e,this.q,this.p,this.radius,this.heightScale);c.sub(i,g);d.add(i,g);f.cross(c,d);d.cross(f,c);f.normalize();d.normalize();i=-this.tube*Math.cos(e);e=this.tube*Math.sin(e);g.x+=i*d.x+e*f.x;g.y+=i*d.y+e*f.y;g.z+=i*d.z+e*f.z;this.grid[a][b]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(g.x,g.y,g.z)))-1}}for(a=
-0;a<this.segmentsR;++a)for(b=0;b<this.segmentsT;++b){var f=(a+1)%this.segmentsR,g=(b+1)%this.segmentsT,c=this.grid[a][b],d=this.grid[f][b],f=this.grid[f][g],g=this.grid[a][g],e=new THREE.UV(a/this.segmentsR,b/this.segmentsT),i=new THREE.UV((a+1)/this.segmentsR,b/this.segmentsT),j=new THREE.UV((a+1)/this.segmentsR,(b+1)/this.segmentsT),k=new THREE.UV(a/this.segmentsR,(b+1)/this.segmentsT);this.faces.push(new THREE.Face4(c,d,f,g));this.faceVertexUvs[0].push([e,i,j,k])}this.computeCentroids();this.computeFaceNormals();
+0;a<this.segmentsR;++a)for(b=0;b<this.segmentsT;++b){var f=(a+1)%this.segmentsR,g=(b+1)%this.segmentsT,c=this.grid[a][b],d=this.grid[f][b],f=this.grid[f][g],g=this.grid[a][g],e=new THREE.UV(a/this.segmentsR,b/this.segmentsT),i=new THREE.UV((a+1)/this.segmentsR,b/this.segmentsT),k=new THREE.UV((a+1)/this.segmentsR,(b+1)/this.segmentsT),j=new THREE.UV(a/this.segmentsR,(b+1)/this.segmentsT);this.faces.push(new THREE.Face4(c,d,f,g));this.faceVertexUvs[0].push([e,i,k,j])}this.computeCentroids();this.computeFaceNormals();
 this.computeVertexNormals()};THREE.TorusKnotGeometry.prototype=new THREE.Geometry;THREE.TorusKnotGeometry.prototype.constructor=THREE.TorusKnotGeometry;
 THREE.PolyhedronGeometry=function(a,b,c,d){function f(a){var b=new THREE.Vertex(a.normalize());b.index=i.vertices.push(b)-1;var c=Math.atan2(a.z,-a.x)/2/Math.PI+0.5,a=Math.atan2(-a.y,Math.sqrt(a.x*a.x+a.z*a.z))/Math.PI+0.5;b.uv=new THREE.UV(c,a);return b}function g(a,b,c,d){1>d?(d=new THREE.Face3(a.index,b.index,c.index,[a.position.clone(),b.position.clone(),c.position.clone()]),d.centroid.addSelf(a.position).addSelf(b.position).addSelf(c.position).divideScalar(3),d.normal=d.centroid.clone().normalize(),
 i.faces.push(d),d=Math.atan2(d.centroid.z,-d.centroid.x),i.faceVertexUvs[0].push([h(a.uv,a.position,d),h(b.uv,b.position,d),h(c.uv,c.position,d)])):(d-=1,g(a,e(a,b),e(a,c),d),g(e(a,b),b,e(b,c),d),g(e(a,c),e(b,c),c,d),g(e(a,b),e(b,c),e(a,c),d))}function e(a,b){q[a.index]||(q[a.index]=[]);q[b.index]||(q[b.index]=[]);var c=q[a.index][b.index];void 0===c&&(q[a.index][b.index]=q[b.index][a.index]=c=f((new THREE.Vector3).add(a.position,b.position).divideScalar(2)));return c}function h(a,b,c){0>c&&1===a.u&&
-(a=new THREE.UV(a.u-1,a.v));0===b.x&&0===b.z&&(a=new THREE.UV(c/2/Math.PI+0.5,a.v));return a}THREE.Geometry.call(this);for(var c=c||1,d=d||0,i=this,j=0,k=a.length;j<k;j++)f(new THREE.Vector3(a[j][0],a[j][1],a[j][2]));for(var q=[],a=this.vertices,j=0,k=b.length;j<k;j++)g(a[b[j][0]],a[b[j][1]],a[b[j][2]],d);this.mergeVertices();j=0;for(k=this.vertices.length;j<k;j++)this.vertices[j].position.multiplyScalar(c);this.boundingSphere={radius:c}};THREE.PolyhedronGeometry.prototype=new THREE.Geometry;
+(a=new THREE.UV(a.u-1,a.v));0===b.x&&0===b.z&&(a=new THREE.UV(c/2/Math.PI+0.5,a.v));return a}THREE.Geometry.call(this);for(var c=c||1,d=d||0,i=this,k=0,j=a.length;k<j;k++)f(new THREE.Vector3(a[k][0],a[k][1],a[k][2]));for(var q=[],a=this.vertices,k=0,j=b.length;k<j;k++)g(a[b[k][0]],a[b[k][1]],a[b[k][2]],d);this.mergeVertices();k=0;for(j=this.vertices.length;k<j;k++)this.vertices[k].position.multiplyScalar(c);this.boundingSphere={radius:c}};THREE.PolyhedronGeometry.prototype=new THREE.Geometry;
 THREE.PolyhedronGeometry.prototype.constructor=THREE.PolyhedronGeometry;THREE.IcosahedronGeometry=function(a,b){var c=(1+Math.sqrt(5))/2;THREE.PolyhedronGeometry.call(this,[[-1,c,0],[1,c,0],[-1,-c,0],[1,-c,0],[0,-1,c],[0,1,c],[0,-1,-c],[0,1,-c],[c,0,-1],[c,0,1],[-c,0,-1],[-c,0,1]],[[0,11,5],[0,5,1],[0,1,7],[0,7,10],[0,10,11],[1,5,9],[5,11,4],[11,10,2],[10,7,6],[7,1,8],[3,9,4],[3,4,2],[3,2,6],[3,6,8],[3,8,9],[4,9,5],[2,4,11],[6,2,10],[8,6,7],[9,8,1]],a,b)};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;
 THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;THREE.OctahedronGeometry=function(a,b){THREE.PolyhedronGeometry.call(this,[[1,0,0],[-1,0,0],[0,1,0],[0,-1,0],[0,0,1],[0,0,-1]],[[0,2,4],[0,4,3],[0,3,5],[0,5,2],[1,2,5],[1,5,3],[1,3,4],[1,4,2]],a,b)};THREE.OctahedronGeometry.prototype=new THREE.Geometry;THREE.OctahedronGeometry.prototype.constructor=THREE.OctahedronGeometry;
 THREE.TetrahedronGeometry=function(a,b){THREE.PolyhedronGeometry.call(this,[[1,1,1],[-1,-1,1],[-1,1,-1],[1,-1,-1]],[[2,1,0],[0,3,2],[1,3,0],[2,3,1]],a,b)};THREE.TetrahedronGeometry.prototype=new THREE.Geometry;THREE.TetrahedronGeometry.prototype.constructor=THREE.TetrahedronGeometry;
@@ -212,40 +212,40 @@ this.update(a);this.lines=new THREE.Line(this.lineGeometry,this.lineMaterial,THR
 THREE.CameraHelper.prototype.update=function(a){function b(a,b,g,e){THREE.CameraHelper.__v.set(b,g,e);THREE.CameraHelper.__projector.unprojectVector(THREE.CameraHelper.__v,THREE.CameraHelper.__c);a=c.pointMap[a];if(void 0!==a){b=0;for(g=a.length;b<g;b++)c.lineGeometry.vertices[a[b]].position.copy(THREE.CameraHelper.__v)}}var c=this;THREE.CameraHelper.__c.projectionMatrix.copy(a.projectionMatrix);b("c",0,0,-1);b("t",0,0,1);b("n1",-1,-1,-1);b("n2",1,-1,-1);b("n3",-1,1,-1);b("n4",1,1,-1);b("f1",-1,-1,
 1);b("f2",1,-1,1);b("f3",-1,1,1);b("f4",1,1,1);b("u1",0.7,1.1,-1);b("u2",-0.7,1.1,-1);b("u3",0,2,-1);b("cf1",-1,0,1);b("cf2",1,0,1);b("cf3",0,-1,1);b("cf4",0,1,1);b("cn1",-1,0,-1);b("cn2",1,0,-1);b("cn3",0,-1,-1);b("cn4",0,1,-1);this.lineGeometry.__dirtyVertices=!0};THREE.CameraHelper.__projector=new THREE.Projector;THREE.CameraHelper.__v=new THREE.Vector3;THREE.CameraHelper.__c=new THREE.Camera;
 THREE.SubdivisionModifier=function(a){this.subdivisions=void 0===a?1:a;this.useOldVertexColors=!1;this.supportUVs=!0};THREE.SubdivisionModifier.prototype.constructor=THREE.SubdivisionModifier;THREE.SubdivisionModifier.prototype.modify=function(a){for(var b=this.subdivisions;0<b--;)this.smooth(a)};
-THREE.SubdivisionModifier.prototype.smooth=function(a){function b(a,b,c,d,h,i){var j=new THREE.Face4(a,b,c,d,null,h.color,h.material);if(e.useOldVertexColors){j.vertexColors=[];for(var k,m,q,n=0;4>n;n++){q=i[n];k=new THREE.Color;k.setRGB(0,0,0);for(var o=0;o<q.length;o++)m=h.vertexColors[q[o]-1],k.r+=m.r,k.g+=m.g,k.b+=m.b;k.r/=q.length;k.g/=q.length;k.b/=q.length;j.vertexColors[n]=k}}f.push(j);(!e.supportUVs||0!=l.length)&&g.push([l[a],l[b],l[c],l[d]])}function c(a,b){return Math.min(a,b)+"_"+Math.max(a,
-b)}var d=[],f=[],g=[],e=this,h=a.vertices,d=a.faces,i=h.concat(),j=[],k={},q={},l=[],n,r,m,o,p,s=a.faceVertexUvs[0];for(n=0,r=s.length;n<r;n++)for(m=0,o=s[n].length;m<o;m++)p=d[n]["abcd".charAt(m)],l[p]||(l[p]=s[n][m]);var t;for(n=0,r=d.length;n<r;n++)if(p=d[n],j.push(p.centroid),i.push(new THREE.Vertex(p.centroid)),e.supportUVs&&0!=l.length){t=new THREE.UV;if(p instanceof THREE.Face3)t.u=l[p.a].u+l[p.b].u+l[p.c].u,t.v=l[p.a].v+l[p.b].v+l[p.c].v,t.u/=3,t.v/=3;else if(p instanceof THREE.Face4)t.u=
+THREE.SubdivisionModifier.prototype.smooth=function(a){function b(a,b,c,d,h,i){var k=new THREE.Face4(a,b,c,d,null,h.color,h.material);if(e.useOldVertexColors){k.vertexColors=[];for(var j,m,q,n=0;4>n;n++){q=i[n];j=new THREE.Color;j.setRGB(0,0,0);for(var o=0;o<q.length;o++)m=h.vertexColors[q[o]-1],j.r+=m.r,j.g+=m.g,j.b+=m.b;j.r/=q.length;j.g/=q.length;j.b/=q.length;k.vertexColors[n]=j}}f.push(k);(!e.supportUVs||0!=l.length)&&g.push([l[a],l[b],l[c],l[d]])}function c(a,b){return Math.min(a,b)+"_"+Math.max(a,
+b)}var d=[],f=[],g=[],e=this,h=a.vertices,d=a.faces,i=h.concat(),k=[],j={},q={},l=[],n,r,m,o,p,s=a.faceVertexUvs[0];for(n=0,r=s.length;n<r;n++)for(m=0,o=s[n].length;m<o;m++)p=d[n]["abcd".charAt(m)],l[p]||(l[p]=s[n][m]);var t;for(n=0,r=d.length;n<r;n++)if(p=d[n],k.push(p.centroid),i.push(new THREE.Vertex(p.centroid)),e.supportUVs&&0!=l.length){t=new THREE.UV;if(p instanceof THREE.Face3)t.u=l[p.a].u+l[p.b].u+l[p.c].u,t.v=l[p.a].v+l[p.b].v+l[p.c].v,t.u/=3,t.v/=3;else if(p instanceof THREE.Face4)t.u=
 l[p.a].u+l[p.b].u+l[p.c].u+l[p.d].u,t.v=l[p.a].v+l[p.b].v+l[p.c].v+l[p.d].v,t.u/=4,t.v/=4;l.push(t)}r=function(a){function b(a,c,d){void 0===a[c]&&(a[c]=[]);a[c].push(d)}var d,e,f,g,h={};for(d=0,e=a.faces.length;d<e;d++)f=a.faces[d],f instanceof THREE.Face3?(g=c(f.a,f.b),b(h,g,d),g=c(f.b,f.c),b(h,g,d),g=c(f.c,f.a),b(h,g,d)):f instanceof THREE.Face4&&(g=c(f.a,f.b),b(h,g,d),g=c(f.b,f.c),b(h,g,d),g=c(f.c,f.d),b(h,g,d),g=c(f.d,f.a),b(h,g,d));return h}(a);var u=0,s=h.length,v,w,z={},x={},A=function(a,
-b){void 0===z[a]&&(z[a]=[]);z[a].push(b)},F=function(a,b){void 0===x[a]&&(x[a]={});x[a][b]=null};for(n in r){t=r[n];v=n.split("_");w=v[0];v=v[1];A(w,[w,v]);A(v,[w,v]);for(m=0,o=t.length;m<o;m++)p=t[m],F(w,p,n),F(v,p,n);2>t.length&&(q[n]=!0)}for(n in r)if(t=r[n],p=t[0],t=t[1],v=n.split("_"),w=v[0],v=v[1],o=new THREE.Vector3,q[n]?(o.addSelf(h[w].position),o.addSelf(h[v].position),o.multiplyScalar(0.5)):(o.addSelf(j[p]),o.addSelf(j[t]),o.addSelf(h[w].position),o.addSelf(h[v].position),o.multiplyScalar(0.25)),
-k[n]=s+d.length+u,i.push(new THREE.Vertex(o)),u++,e.supportUVs&&0!=l.length)t=new THREE.UV,t.u=l[w].u+l[v].u,t.v=l[w].v+l[v].v,t.u/=2,t.v/=2,l.push(t);var E,J;v=["123","12","2","23"];o=["123","23","3","31"];var A=["123","31","1","12"],F=["1234","12","2","23"],G=["1234","23","3","34"],B=["1234","34","4","41"],H=["1234","41","1","12"];for(n=0,r=j.length;n<r;n++)p=d[n],t=s+n,p instanceof THREE.Face3?(u=c(p.a,p.b),w=c(p.b,p.c),E=c(p.c,p.a),b(t,k[u],p.b,k[w],p,v),b(t,k[w],p.c,k[E],p,o),b(t,k[E],p.a,k[u],
-p,A)):p instanceof THREE.Face4?(u=c(p.a,p.b),w=c(p.b,p.c),E=c(p.c,p.d),J=c(p.d,p.a),b(t,k[u],p.b,k[w],p,F),b(t,k[w],p.c,k[E],p,G),b(t,k[E],p.d,k[J],p,B),b(t,k[J],p.a,k[u],p,H)):console.log("face should be a face!",p);d=i;i=new THREE.Vector3;k=new THREE.Vector3;for(n=0,r=h.length;n<r;n++)if(void 0!==z[n]){i.set(0,0,0);k.set(0,0,0);p=new THREE.Vector3(0,0,0);t=0;for(m in x[n])i.addSelf(j[m]),t++;u=0;s=z[n].length;for(m=0;m<s;m++)q[c(z[n][m][0],z[n][m][1])]&&u++;if(2!=u){i.divideScalar(t);for(m=0;m<
-s;m++)t=z[n][m],t=h[t[0]].position.clone().addSelf(h[t[1]].position).divideScalar(2),k.addSelf(t);k.divideScalar(s);p.addSelf(h[n].position);p.multiplyScalar(s-3);p.addSelf(i);p.addSelf(k.multiplyScalar(2));p.divideScalar(s);d[n].position=p}}a.vertices=d;a.faces=f;a.faceVertexUvs[0]=g;delete a.__tmpVertices;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals()};
+b){void 0===z[a]&&(z[a]=[]);z[a].push(b)},F=function(a,b){void 0===x[a]&&(x[a]={});x[a][b]=null};for(n in r){t=r[n];v=n.split("_");w=v[0];v=v[1];A(w,[w,v]);A(v,[w,v]);for(m=0,o=t.length;m<o;m++)p=t[m],F(w,p,n),F(v,p,n);2>t.length&&(q[n]=!0)}for(n in r)if(t=r[n],p=t[0],t=t[1],v=n.split("_"),w=v[0],v=v[1],o=new THREE.Vector3,q[n]?(o.addSelf(h[w].position),o.addSelf(h[v].position),o.multiplyScalar(0.5)):(o.addSelf(k[p]),o.addSelf(k[t]),o.addSelf(h[w].position),o.addSelf(h[v].position),o.multiplyScalar(0.25)),
+j[n]=s+d.length+u,i.push(new THREE.Vertex(o)),u++,e.supportUVs&&0!=l.length)t=new THREE.UV,t.u=l[w].u+l[v].u,t.v=l[w].v+l[v].v,t.u/=2,t.v/=2,l.push(t);var E,J;v=["123","12","2","23"];o=["123","23","3","31"];var A=["123","31","1","12"],F=["1234","12","2","23"],G=["1234","23","3","34"],B=["1234","34","4","41"],H=["1234","41","1","12"];for(n=0,r=k.length;n<r;n++)p=d[n],t=s+n,p instanceof THREE.Face3?(u=c(p.a,p.b),w=c(p.b,p.c),E=c(p.c,p.a),b(t,j[u],p.b,j[w],p,v),b(t,j[w],p.c,j[E],p,o),b(t,j[E],p.a,j[u],
+p,A)):p instanceof THREE.Face4?(u=c(p.a,p.b),w=c(p.b,p.c),E=c(p.c,p.d),J=c(p.d,p.a),b(t,j[u],p.b,j[w],p,F),b(t,j[w],p.c,j[E],p,G),b(t,j[E],p.d,j[J],p,B),b(t,j[J],p.a,j[u],p,H)):console.log("face should be a face!",p);d=i;i=new THREE.Vector3;j=new THREE.Vector3;for(n=0,r=h.length;n<r;n++)if(void 0!==z[n]){i.set(0,0,0);j.set(0,0,0);p=new THREE.Vector3(0,0,0);t=0;for(m in x[n])i.addSelf(k[m]),t++;u=0;s=z[n].length;for(m=0;m<s;m++)q[c(z[n][m][0],z[n][m][1])]&&u++;if(2!=u){i.divideScalar(t);for(m=0;m<
+s;m++)t=z[n][m],t=h[t[0]].position.clone().addSelf(h[t[1]].position).divideScalar(2),j.addSelf(t);j.divideScalar(s);p.addSelf(h[n].position);p.multiplyScalar(s-3);p.addSelf(i);p.addSelf(j.multiplyScalar(2));p.divideScalar(s);d[n].position=p}}a.vertices=d;a.faces=f;a.faceVertexUvs[0]=g;delete a.__tmpVertices;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals()};
 THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
 THREE.Loader.prototype={constructor:THREE.Loader,crossOrigin:"anonymous",addStatusElement:function(){var a=document.createElement("div");a.style.position="absolute";a.style.right="0px";a.style.top="0px";a.style.fontSize="0.8em";a.style.textAlign="left";a.style.background="rgba(0,0,0,0.25)";a.style.color="#fff";a.style.width="120px";a.style.padding="0.5em 0.5em 0.5em 0.5em";a.style.zIndex=1E3;a.innerHTML="Loading ...";return a},updateProgress:function(a){var b="Loaded ",b=a.total?b+((100*a.loaded/
 a.total).toFixed(0)+"%"):b+((a.loaded/1E3).toFixed(2)+" KB");this.statusDomElement.innerHTML=b},extractUrlbase:function(a){a=a.split("/");a.pop();return 1>a.length?"":a.join("/")+"/"},initMaterials:function(a,b,c){a.materials=[];for(var d=0;d<b.length;++d)a.materials[d]=THREE.Loader.prototype.createMaterial(b[d],c)},hasNormals:function(a){var b,c,d=a.materials.length;for(c=0;c<d;c++)if(b=a.materials[c],b instanceof THREE.ShaderMaterial)return!0;return!1},createMaterial:function(a,b){function c(a){a=
 Math.log(a)/Math.LN2;return Math.floor(a)==a}function d(a){a=Math.log(a)/Math.LN2;return Math.pow(2,Math.round(a))}function f(a,b){var e=new Image;e.onload=function(){if(!c(this.width)||!c(this.height)){var b=d(this.width),e=d(this.height);a.image.width=b;a.image.height=e;a.image.getContext("2d").drawImage(this,0,0,b,e)}else a.image=this;a.needsUpdate=!0};e.crossOrigin=h.crossOrigin;e.src=b}function g(a,c,d,e,g,h){var i=document.createElement("canvas");a[c]=new THREE.Texture(i);a[c].sourceFile=d;
-if(e){a[c].repeat.set(e[0],e[1]);if(1!=e[0])a[c].wrapS=THREE.RepeatWrapping;if(1!=e[1])a[c].wrapT=THREE.RepeatWrapping}g&&a[c].offset.set(g[0],g[1]);if(h){e={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(void 0!==e[h[0]])a[c].wrapS=e[h[0]];if(void 0!==e[h[1]])a[c].wrapT=e[h[1]]}f(a[c],b+"/"+d)}function e(a){return(255*a[0]<<16)+(255*a[1]<<8)+255*a[2]}var h=this,i="MeshLambertMaterial",j={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:a.wireframe};a.shading&&
-("Phong"==a.shading?i="MeshPhongMaterial":"Basic"==a.shading&&(i="MeshBasicMaterial"));if(a.blending)if("Additive"==a.blending)j.blending=THREE.AdditiveBlending;else if("Subtractive"==a.blending)j.blending=THREE.SubtractiveBlending;else if("Multiply"==a.blending)j.blending=THREE.MultiplyBlending;if(void 0!==a.transparent||1>a.opacity)j.transparent=a.transparent;if(void 0!==a.depthTest)j.depthTest=a.depthTest;if(void 0!==a.vertexColors)if("face"==a.vertexColors)j.vertexColors=THREE.FaceColors;else if(a.vertexColors)j.vertexColors=
-THREE.VertexColors;if(a.colorDiffuse)j.color=e(a.colorDiffuse);else if(a.DbgColor)j.color=a.DbgColor;if(a.colorSpecular)j.specular=e(a.colorSpecular);if(a.colorAmbient)j.ambient=e(a.colorAmbient);if(a.transparency)j.opacity=a.transparency;if(a.specularCoef)j.shininess=a.specularCoef;a.mapDiffuse&&b&&g(j,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap);a.mapLight&&b&&g(j,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap);a.mapNormal&&b&&g(j,"normalMap",
-a.mapNormal,a.mapNormalRepeat,a.mapNormalOffset,a.mapNormalWrap);a.mapSpecular&&b&&g(j,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){var i=THREE.ShaderUtils.lib.normal,k=THREE.UniformsUtils.clone(i.uniforms);k.tNormal.texture=j.normalMap;if(a.mapNormalFactor)k.uNormalScale.value=a.mapNormalFactor;if(j.map)k.tDiffuse.texture=j.map,k.enableDiffuse.value=!0;if(j.specularMap)k.tSpecular.texture=j.specularMap,k.enableSpecular.value=!0;if(j.lightMap)k.tAO.texture=
-j.lightMap,k.enableAO.value=!0;k.uDiffuseColor.value.setHex(j.color);k.uSpecularColor.value.setHex(j.specular);k.uAmbientColor.value.setHex(j.ambient);k.uShininess.value=j.shininess;if(void 0!==j.opacity)k.uOpacity.value=j.opacity;j=new THREE.ShaderMaterial({fragmentShader:i.fragmentShader,vertexShader:i.vertexShader,uniforms:k,lights:!0,fog:!0})}else j=new THREE[i](j);if(void 0!==a.DbgName)j.name=a.DbgName;return j}};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};
+if(e){a[c].repeat.set(e[0],e[1]);if(1!=e[0])a[c].wrapS=THREE.RepeatWrapping;if(1!=e[1])a[c].wrapT=THREE.RepeatWrapping}g&&a[c].offset.set(g[0],g[1]);if(h){e={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(void 0!==e[h[0]])a[c].wrapS=e[h[0]];if(void 0!==e[h[1]])a[c].wrapT=e[h[1]]}f(a[c],b+"/"+d)}function e(a){return(255*a[0]<<16)+(255*a[1]<<8)+255*a[2]}var h=this,i="MeshLambertMaterial",k={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:a.wireframe};a.shading&&
+("Phong"==a.shading?i="MeshPhongMaterial":"Basic"==a.shading&&(i="MeshBasicMaterial"));if(a.blending)if("Additive"==a.blending)k.blending=THREE.AdditiveBlending;else if("Subtractive"==a.blending)k.blending=THREE.SubtractiveBlending;else if("Multiply"==a.blending)k.blending=THREE.MultiplyBlending;if(void 0!==a.transparent||1>a.opacity)k.transparent=a.transparent;if(void 0!==a.depthTest)k.depthTest=a.depthTest;if(void 0!==a.vertexColors)if("face"==a.vertexColors)k.vertexColors=THREE.FaceColors;else if(a.vertexColors)k.vertexColors=
+THREE.VertexColors;if(a.colorDiffuse)k.color=e(a.colorDiffuse);else if(a.DbgColor)k.color=a.DbgColor;if(a.colorSpecular)k.specular=e(a.colorSpecular);if(a.colorAmbient)k.ambient=e(a.colorAmbient);if(a.transparency)k.opacity=a.transparency;if(a.specularCoef)k.shininess=a.specularCoef;a.mapDiffuse&&b&&g(k,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap);a.mapLight&&b&&g(k,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap);a.mapNormal&&b&&g(k,"normalMap",
+a.mapNormal,a.mapNormalRepeat,a.mapNormalOffset,a.mapNormalWrap);a.mapSpecular&&b&&g(k,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){var i=THREE.ShaderUtils.lib.normal,j=THREE.UniformsUtils.clone(i.uniforms);j.tNormal.texture=k.normalMap;if(a.mapNormalFactor)j.uNormalScale.value=a.mapNormalFactor;if(k.map)j.tDiffuse.texture=k.map,j.enableDiffuse.value=!0;if(k.specularMap)j.tSpecular.texture=k.specularMap,j.enableSpecular.value=!0;if(k.lightMap)j.tAO.texture=
+k.lightMap,j.enableAO.value=!0;j.uDiffuseColor.value.setHex(k.color);j.uSpecularColor.value.setHex(k.specular);j.uAmbientColor.value.setHex(k.ambient);j.uShininess.value=k.shininess;if(void 0!==k.opacity)j.uOpacity.value=k.opacity;k=new THREE.ShaderMaterial({fragmentShader:i.fragmentShader,vertexShader:i.vertexShader,uniforms:j,lights:!0,fog:!0})}else k=new THREE[i](k);if(void 0!==a.DbgName)k.name=a.DbgName;return k}};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};
 THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;THREE.BinaryLoader.prototype.supr=THREE.Loader.prototype;
 THREE.BinaryLoader.prototype.load=function(a,b,c,d){if(a instanceof Object)console.warn("DEPRECATED: BinaryLoader( parameters ) is now BinaryLoader( url, callback, texturePath, binaryPath )."),d=a,a=d.model,b=d.callback,c=d.texture_path,d=d.bin_path;var c=c?c:this.extractUrlbase(a),d=d?d:this.extractUrlbase(a),f=this.showProgress?THREE.Loader.prototype.updateProgress:null;this.onLoadStart();this.loadAjaxJSON(this,a,b,c,d,f)};
 THREE.BinaryLoader.prototype.loadAjaxJSON=function(a,b,c,d,f,g){var e=new XMLHttpRequest;e.onreadystatechange=function(){if(4==e.readyState)if(200==e.status||0==e.status)try{var h=JSON.parse(e.responseText);void 0===h.metadata||void 0===h.metadata.formatVersion||3!==h.metadata.formatVersion?console.error("Deprecated file format."):a.loadAjaxBuffers(h,c,f,d,g)}catch(i){console.error(i),console.warn("DEPRECATED: ["+b+"] seems to be using old model format")}else console.error("Couldn't load ["+b+"] ["+
 e.status+"]")};e.open("GET",b,!0);e.overrideMimeType&&e.overrideMimeType("text/plain; charset=x-user-defined");e.setRequestHeader("Content-Type","text/plain");e.send(null)};
 THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,b,c,d,f){var g=new XMLHttpRequest,e=c+"/"+a.buffers,h=0;g.onreadystatechange=function(){4==g.readyState?200==g.status||0==g.status?THREE.BinaryLoader.prototype.createBinModel(g.response,b,d,a.materials):console.error("Couldn't load ["+e+"] ["+g.status+"]"):3==g.readyState?f&&(0==h&&(h=g.getResponseHeader("Content-Length")),f({total:h,loaded:g.responseText.length})):2==g.readyState&&(h=g.getResponseHeader("Content-Length"))};g.open("GET",e,!0);
 g.responseType="arraybuffer";g.send(null)};
-THREE.BinaryLoader.prototype.createBinModel=function(a,b,c,d){var f=function(b){var c,f,i,j,k,q,l,n,r,m,o,p,s,t,u,v;function w(a){return a%4?4-a%4:0}function z(a,b){return(new Uint8Array(a,b,1))[0]}function x(a,b){return(new Uint32Array(a,b,1))[0]}function A(b,c){var d,e,f,g,h,i,j,k,m=new Uint32Array(a,c,3*b);for(d=0;d<b;d++){e=m[3*d];f=m[3*d+1];g=m[3*d+2];h=y[2*e];e=y[2*e+1];i=y[2*f];j=y[2*f+1];f=y[2*g];k=y[2*g+1];g=H.faceVertexUvs[0];var l=[];l.push(new THREE.UV(h,e));l.push(new THREE.UV(i,j));
+THREE.BinaryLoader.prototype.createBinModel=function(a,b,c,d){var f=function(b){var c,f,i,k,j,q,l,n,r,m,o,p,s,t,u,v;function w(a){return a%4?4-a%4:0}function z(a,b){return(new Uint8Array(a,b,1))[0]}function x(a,b){return(new Uint32Array(a,b,1))[0]}function A(b,c){var d,e,f,g,h,i,j,k,m=new Uint32Array(a,c,3*b);for(d=0;d<b;d++){e=m[3*d];f=m[3*d+1];g=m[3*d+2];h=y[2*e];e=y[2*e+1];i=y[2*f];j=y[2*f+1];f=y[2*g];k=y[2*g+1];g=H.faceVertexUvs[0];var l=[];l.push(new THREE.UV(h,e));l.push(new THREE.UV(i,j));
 l.push(new THREE.UV(f,k));g.push(l)}}function F(b,c){var d,e,f,g,h,i,j,k,m,l,n=new Uint32Array(a,c,4*b);for(d=0;d<b;d++){e=n[4*d];f=n[4*d+1];g=n[4*d+2];h=n[4*d+3];i=y[2*e];e=y[2*e+1];j=y[2*f];m=y[2*f+1];k=y[2*g];l=y[2*g+1];g=y[2*h];f=y[2*h+1];h=H.faceVertexUvs[0];var q=[];q.push(new THREE.UV(i,e));q.push(new THREE.UV(j,m));q.push(new THREE.UV(k,l));q.push(new THREE.UV(g,f));h.push(q)}}function E(b,c,d){for(var e,f,g,h,c=new Uint32Array(a,c,3*b),i=new Uint16Array(a,d,b),d=0;d<b;d++)e=c[3*d],f=c[3*
 d+1],g=c[3*d+2],h=i[d],H.faces.push(new THREE.Face3(e,f,g,null,null,h))}function J(b,c,d){for(var e,f,g,h,i,c=new Uint32Array(a,c,4*b),j=new Uint16Array(a,d,b),d=0;d<b;d++)e=c[4*d],f=c[4*d+1],g=c[4*d+2],h=c[4*d+3],i=j[d],H.faces.push(new THREE.Face4(e,f,g,h,null,null,i))}function G(b,c,d,e){for(var f,g,h,i,j,k,m,c=new Uint32Array(a,c,3*b),d=new Uint32Array(a,d,3*b),l=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[3*e];g=c[3*e+1];h=c[3*e+2];j=d[3*e];k=d[3*e+1];m=d[3*e+2];i=l[e];var n=I[3*k],q=I[3*k+1];k=
 I[3*k+2];var o=I[3*m],p=I[3*m+1];m=I[3*m+2];H.faces.push(new THREE.Face3(f,g,h,[new THREE.Vector3(I[3*j],I[3*j+1],I[3*j+2]),new THREE.Vector3(n,q,k),new THREE.Vector3(o,p,m)],null,i))}}function B(b,c,d,e){for(var f,g,h,i,j,k,m,l,n,c=new Uint32Array(a,c,4*b),d=new Uint32Array(a,d,4*b),q=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[4*e];g=c[4*e+1];h=c[4*e+2];i=c[4*e+3];k=d[4*e];m=d[4*e+1];l=d[4*e+2];n=d[4*e+3];j=q[e];var o=I[3*m],p=I[3*m+1];m=I[3*m+2];var r=I[3*l],s=I[3*l+1];l=I[3*l+2];var t=I[3*n],u=I[3*
-n+1];n=I[3*n+2];H.faces.push(new THREE.Face4(f,g,h,i,[new THREE.Vector3(I[3*k],I[3*k+1],I[3*k+2]),new THREE.Vector3(o,p,m),new THREE.Vector3(r,s,l),new THREE.Vector3(t,u,n)],null,j))}}var H=this,D=0,I=[],y=[],K,C;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(H,d,b);c=function(a,b,c){for(var a=new Uint8Array(a,b,c),d="",e=0;e<c;e++)d+=String.fromCharCode(a[b+e]);return d}(a,D,12);f=z(a,D+12);z(a,D+13);z(a,D+14);z(a,D+15);i=z(a,D+16);j=z(a,D+17);k=z(a,D+18);q=z(a,D+19);l=x(a,D+20);
-n=x(a,D+20+4);r=x(a,D+20+8);b=x(a,D+20+12);m=x(a,D+20+16);o=x(a,D+20+20);p=x(a,D+20+24);s=x(a,D+20+28);t=x(a,D+20+32);u=x(a,D+20+36);v=x(a,D+20+40);"Three.js 003"!==c&&console.warn("DEPRECATED: binary model seems to be using old format");D+=f;c=3*i+q;C=4*i+q;f=b*c;K=m*(c+3*j);i=o*(c+3*k);q=p*(c+3*j+3*k);c=s*C;j=t*(C+4*j);k=u*(C+4*k);D+=function(b){var b=new Float32Array(a,b,3*l),c,d,e,f;for(c=0;c<l;c++)d=b[3*c],e=b[3*c+1],f=b[3*c+2],H.vertices.push(new THREE.Vertex(new THREE.Vector3(d,e,f)));return 3*
-l*Float32Array.BYTES_PER_ELEMENT}(D);D+=function(b){if(n){var b=new Int8Array(a,b,3*n),c,d,e,f;for(c=0;c<n;c++)d=b[3*c],e=b[3*c+1],f=b[3*c+2],I.push(d/127,e/127,f/127)}return 3*n*Int8Array.BYTES_PER_ELEMENT}(D);D+=w(3*n);D+=function(b){if(r){var b=new Float32Array(a,b,2*r),c,d,e;for(c=0;c<r;c++)d=b[2*c],e=b[2*c+1],y.push(d,e)}return 2*r*Float32Array.BYTES_PER_ELEMENT}(D);f=D+f+w(2*b);K=f+K+w(2*m);i=K+i+w(2*o);q=i+q+w(2*p);c=q+c+w(2*s);j=c+j+w(2*t);k=j+k+w(2*u);(function(a){if(o){var b=a+3*o*Uint32Array.BYTES_PER_ELEMENT;
-E(o,a,b+3*o*Uint32Array.BYTES_PER_ELEMENT);A(o,b)}})(K);(function(a){if(p){var b=a+3*p*Uint32Array.BYTES_PER_ELEMENT,c=b+3*p*Uint32Array.BYTES_PER_ELEMENT;G(p,a,b,c+3*p*Uint32Array.BYTES_PER_ELEMENT);A(p,c)}})(i);(function(a){if(u){var b=a+4*u*Uint32Array.BYTES_PER_ELEMENT;J(u,a,b+4*u*Uint32Array.BYTES_PER_ELEMENT);F(u,b)}})(j);(function(a){if(v){var b=a+4*v*Uint32Array.BYTES_PER_ELEMENT,c=b+4*v*Uint32Array.BYTES_PER_ELEMENT;B(v,a,b,c+4*v*Uint32Array.BYTES_PER_ELEMENT);F(v,c)}})(k);b&&E(b,D,D+3*b*
+n+1];n=I[3*n+2];H.faces.push(new THREE.Face4(f,g,h,i,[new THREE.Vector3(I[3*k],I[3*k+1],I[3*k+2]),new THREE.Vector3(o,p,m),new THREE.Vector3(r,s,l),new THREE.Vector3(t,u,n)],null,j))}}var H=this,D=0,I=[],y=[],K,C;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(H,d,b);c=function(a,b,c){for(var a=new Uint8Array(a,b,c),d="",e=0;e<c;e++)d+=String.fromCharCode(a[b+e]);return d}(a,D,12);f=z(a,D+12);z(a,D+13);z(a,D+14);z(a,D+15);i=z(a,D+16);k=z(a,D+17);j=z(a,D+18);q=z(a,D+19);l=x(a,D+20);
+n=x(a,D+20+4);r=x(a,D+20+8);b=x(a,D+20+12);m=x(a,D+20+16);o=x(a,D+20+20);p=x(a,D+20+24);s=x(a,D+20+28);t=x(a,D+20+32);u=x(a,D+20+36);v=x(a,D+20+40);"Three.js 003"!==c&&console.warn("DEPRECATED: binary model seems to be using old format");D+=f;c=3*i+q;C=4*i+q;f=b*c;K=m*(c+3*k);i=o*(c+3*j);q=p*(c+3*k+3*j);c=s*C;k=t*(C+4*k);j=u*(C+4*j);D+=function(b){var b=new Float32Array(a,b,3*l),c,d,e,f;for(c=0;c<l;c++)d=b[3*c],e=b[3*c+1],f=b[3*c+2],H.vertices.push(new THREE.Vertex(new THREE.Vector3(d,e,f)));return 3*
+l*Float32Array.BYTES_PER_ELEMENT}(D);D+=function(b){if(n){var b=new Int8Array(a,b,3*n),c,d,e,f;for(c=0;c<n;c++)d=b[3*c],e=b[3*c+1],f=b[3*c+2],I.push(d/127,e/127,f/127)}return 3*n*Int8Array.BYTES_PER_ELEMENT}(D);D+=w(3*n);D+=function(b){if(r){var b=new Float32Array(a,b,2*r),c,d,e;for(c=0;c<r;c++)d=b[2*c],e=b[2*c+1],y.push(d,e)}return 2*r*Float32Array.BYTES_PER_ELEMENT}(D);f=D+f+w(2*b);K=f+K+w(2*m);i=K+i+w(2*o);q=i+q+w(2*p);c=q+c+w(2*s);k=c+k+w(2*t);j=k+j+w(2*u);(function(a){if(o){var b=a+3*o*Uint32Array.BYTES_PER_ELEMENT;
+E(o,a,b+3*o*Uint32Array.BYTES_PER_ELEMENT);A(o,b)}})(K);(function(a){if(p){var b=a+3*p*Uint32Array.BYTES_PER_ELEMENT,c=b+3*p*Uint32Array.BYTES_PER_ELEMENT;G(p,a,b,c+3*p*Uint32Array.BYTES_PER_ELEMENT);A(p,c)}})(i);(function(a){if(u){var b=a+4*u*Uint32Array.BYTES_PER_ELEMENT;J(u,a,b+4*u*Uint32Array.BYTES_PER_ELEMENT);F(u,b)}})(k);(function(a){if(v){var b=a+4*v*Uint32Array.BYTES_PER_ELEMENT,c=b+4*v*Uint32Array.BYTES_PER_ELEMENT;B(v,a,b,c+4*v*Uint32Array.BYTES_PER_ELEMENT);F(v,c)}})(j);b&&E(b,D,D+3*b*
 Uint32Array.BYTES_PER_ELEMENT);(function(a){if(m){var b=a+3*m*Uint32Array.BYTES_PER_ELEMENT;G(m,a,b,b+3*m*Uint32Array.BYTES_PER_ELEMENT)}})(f);s&&J(s,q,q+4*s*Uint32Array.BYTES_PER_ELEMENT);(function(a){if(t){var b=a+4*t*Uint32Array.BYTES_PER_ELEMENT;B(t,a,b,b+4*t*Uint32Array.BYTES_PER_ELEMENT)}})(c);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};f.prototype=new THREE.Geometry;f.prototype.constructor=f;b(new f(c))};
 THREE.ColladaLoader=function(){function a(a,d,f){Q=a;d=d||la;void 0!==f&&(a=f.split("/"),a.pop(),ma=1>a.length?"":a.join("/")+"/");if((a=Q.evaluate("//dae:asset",Q,L,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&a.childNodes)for(f=0;f<a.childNodes.length;f++){var i=a.childNodes[f];switch(i.nodeName){case "unit":(i=i.getAttribute("meter"))&&parseFloat(i);break;case "up_axis":$=i.textContent.charAt(0)}}if(!R.convertUpAxis||$===R.upAxis)W=null;else switch($){case "X":W="Y"===R.upAxis?
 "XtoY":"XtoZ";break;case "Y":W="X"===R.upAxis?"YtoX":"YtoZ";break;case "Z":W="X"===R.upAxis?"ZtoX":"ZtoY"}da=b("//dae:library_images/dae:image",e,"image");ea=b("//dae:library_materials/dae:material",x,"material");fa=b("//dae:library_effects/dae:effect",G,"effect");V=b("//dae:library_geometries/dae:geometry",o,"geometry");ga=b(".//dae:library_cameras/dae:camera",K,"camera");U=b("//dae:library_controllers/dae:controller",h,"controller");X=b("//dae:library_animations/dae:animation",H,"animation");ha=
-b(".//dae:library_visual_scenes/dae:visual_scene",k,"visual_scene");aa=[];ba=[];(a=Q.evaluate(".//dae:scene/dae:instance_visual_scene",Q,L,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(a=a.getAttribute("url").replace(/^#/,""),T=ha[a]):T=null;Y=new THREE.Object3D;for(a=0;a<T.nodes.length;a++)Y.add(g(T.nodes[a]));ia=[];c(Y);a={scene:Y,morphs:aa,skins:ba,animations:ia,dae:{images:da,materials:ea,cameras:ga,effects:fa,geometries:V,controllers:U,animations:X,visualScenes:ha,scene:T}};d&&
+b(".//dae:library_visual_scenes/dae:visual_scene",j,"visual_scene");aa=[];ba=[];(a=Q.evaluate(".//dae:scene/dae:instance_visual_scene",Q,L,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(a=a.getAttribute("url").replace(/^#/,""),T=ha[a]):T=null;Y=new THREE.Object3D;for(a=0;a<T.nodes.length;a++)Y.add(g(T.nodes[a]));ia=[];c(Y);a={scene:Y,morphs:aa,skins:ba,animations:ia,dae:{images:da,materials:ea,cameras:ga,effects:fa,geometries:V,controllers:U,animations:X,visualScenes:ha,scene:T}};d&&
 d(a);return a}function b(a,b,c){for(var a=Q.evaluate(a,Q,L,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null),d={},e=a.iterateNext(),f=0;e;){e=(new b).parse(e);if(!e.id||0==e.id.length)e.id=c+f++;d[e.id]=e;e=a.iterateNext()}return d}function c(a){var b=T.getChildById(a.name,!0),d=null;if(b&&b.keys){d={fps:60,hierarchy:[{node:b,keys:b.keys,sids:b.sids}],node:a,name:"animation_"+a.name,length:0};ia.push(d);for(var e=0,f=b.keys.length;e<f;e++)d.length=Math.max(d.length,b.keys[e].time)}else d={hierarchy:[{keys:[],
 sids:[]}]};e=0;for(f=a.children.length;e<f;e++)for(var b=0,g=c(a.children[e]).hierarchy.length;b<g;b++)d.hierarchy.push({keys:[],sids:[]});return d}function d(a,b,c,e){a.world=a.world||new THREE.Matrix4;a.world.copy(a.matrix);if(a.channels&&a.channels.length){var f=a.channels[0].sampler.output[c];f instanceof THREE.Matrix4&&a.world.copy(f)}e&&a.world.multiply(e,a.world);b.push(a);for(e=0;e<a.nodes.length;e++)d(a.nodes[e],b,c,a.world)}function f(a,b,c){var e,f=U[b.url];if(!f||!f.skin)console.log("ColladaLoader: Could not find skin controller.");
 else if(!b.skeleton||!b.skeleton.length)console.log("ColladaLoader: Could not find the skeleton for the skin. ");else{var c=1E6,g=-c,h=0;for(e in X)for(var i=X[e],j=0;j<i.sampler.length;j++){var k=i.sampler[j];k.create();c=Math.min(c,k.startTime);g=Math.max(g,k.endTime);h=Math.max(h,k.input.length)}e=h;for(var b=T.getChildById(b.skeleton[0],!0)||T.getChildBySid(b.skeleton[0],!0),m,l,g=new THREE.Vector3,n,j=0;j<a.vertices.length;j++)f.skin.bindShapeMatrix.multiplyVector3(a.vertices[j].position);for(c=
@@ -255,20 +255,20 @@ new m;j.url=i.skin.source;j.instance_material=a.controllers[e].instance_material
 0;e<a.geometries.length;e++){var i=a.geometries[e],j=i.instance_material,i=V[i.url],k={},l=[],q=0,o;if(i&&i.mesh&&i.mesh.primitives){if(0==b.name.length)b.name=i.id;if(j)for(h=0;h<j.length;h++){o=j[h];var p=fa[ea[o.target].instance_effect.url].shader;p.material.opacity=!p.material.opacity?1:p.material.opacity;k[o.symbol]=q;l.push(p.material);o=p.material;q++}j=o||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});i=i.mesh.geometry3js;if(1<q){j=new THREE.MeshFaceMaterial;i.materials=
 l;for(h=0;h<i.faces.length;h++)l=i.faces[h],l.materialIndex=k[l.daeMaterial]}if(void 0!==c)f(i,c),j.morphTargets=!0,j=new THREE.SkinnedMesh(i,j),j.skeleton=c.skeleton,j.skinController=U[c.url],j.skinInstanceController=c,j.name="skin_"+ba.length,ba.push(j);else if(void 0!==d){h=i;k=d instanceof n?U[d.url]:d;if(!k||!k.morph)console.log("could not find morph controller!");else{k=k.morph;for(l=0;l<k.targets.length;l++)if(q=V[k.targets[l]],q.mesh&&q.mesh.primitives&&q.mesh.primitives.length)q=q.mesh.primitives[0].geometry,
 q.vertices.length===h.vertices.length&&h.morphTargets.push({name:"target_1",vertices:q.vertices});h.morphTargets.push({name:"target_Z",vertices:h.vertices})}j.morphTargets=!0;j=new THREE.Mesh(i,j);j.name="morph_"+aa.length;aa.push(j)}else j=new THREE.Mesh(i,j);1<a.geometries.length?b.add(j):b=j}}for(e=0;e<a.cameras.length;e++)b=ga[a.cameras[e].url],b=new THREE.PerspectiveCamera(b.fov,b.aspect_ratio,b.znear,b.zfar);b.name=a.id||"";b.matrix=a.matrix;e=a.matrix.decompose();b.position=e[0];b.quaternion=
-e[1];b.useQuaternion=!0;b.scale=e[2];R.centerGeometry&&b.geometry&&(e=THREE.GeometryUtils.center(b.geometry),b.quaternion.multiplyVector3(e.multiplySelf(b.scale)),b.position.subSelf(e));for(e=0;e<a.nodes.length;e++)b.add(g(a.nodes[e],a));return b}function e(){this.init_from=this.id=""}function h(){this.type=this.name=this.id="";this.morph=this.skin=null}function i(){this.weights=this.targets=this.source=this.method=null}function j(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];
-this.joints=[];this.weights=[]}function k(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function q(){this.sid=this.name=this.id="";this.nodes=[];this.controllers=[];this.transforms=[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function l(){this.type=this.sid="";this.data=[];this.obj=null}function n(){this.url="";this.skeleton=[];this.instance_material=[]}function r(){this.target=this.symbol=""}function m(){this.url="";this.instance_material=[]}function o(){this.id=
+e[1];b.useQuaternion=!0;b.scale=e[2];R.centerGeometry&&b.geometry&&(e=THREE.GeometryUtils.center(b.geometry),b.quaternion.multiplyVector3(e.multiplySelf(b.scale)),b.position.subSelf(e));for(e=0;e<a.nodes.length;e++)b.add(g(a.nodes[e],a));return b}function e(){this.init_from=this.id=""}function h(){this.type=this.name=this.id="";this.morph=this.skin=null}function i(){this.weights=this.targets=this.source=this.method=null}function k(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];
+this.joints=[];this.weights=[]}function j(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function q(){this.sid=this.name=this.id="";this.nodes=[];this.controllers=[];this.transforms=[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function l(){this.type=this.sid="";this.data=[];this.obj=null}function n(){this.url="";this.skeleton=[];this.instance_material=[]}function r(){this.target=this.symbol=""}function m(){this.url="";this.instance_material=[]}function o(){this.id=
 "";this.mesh=null}function p(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function s(){}function t(){this.material="";this.count=0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function u(){this.source="";this.stride=this.count=0;this.params=[]}function v(){this.input={}}function w(){this.semantic="";this.offset=0;this.source="";this.set=0}function z(a){this.id=a;this.type=null}function x(){this.name=this.id="";this.instance_effect=null}
 function A(){this.color=new THREE.Color(0);this.color.setRGB(Math.random(),Math.random(),Math.random());this.color.a=1;this.texOpts=this.texcoord=this.texture=null}function F(a,b){this.type=a;this.effect=b;this.material=null}function E(a){this.effect=a;this.format=this.init_from=null}function J(a){this.effect=a;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=this.source=null}function G(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function B(){this.url=""}
 function H(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function D(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=this.dotSyntax=this.sid=this.fullSid=null}function I(a){this.id="";this.animation=a;this.inputs=[];this.endTime=this.startTime=this.interpolation=this.strideOut=this.output=this.input=null;this.duration=0}function y(a){this.targets=[];this.time=a}function K(){this.name=this.id=""}function C(){this.url=""}function L(a){return"dae"==
 a?"http://www.collada.org/2005/11/COLLADASchema":null}function N(a){for(var a=S(a),b=[],c=0,d=a.length;c<d;c++)b.push(parseFloat(a[c]));return b}function M(a){for(var a=S(a),b=[],c=0,d=a.length;c<d;c++)b.push(parseInt(a[c],10));return b}function S(a){return 0<a.length?a.replace(/^\s+/,"").replace(/\s+$/,"").split(/\s+/):[]}function O(a,b,c){return a.hasAttribute(b)?parseInt(a.getAttribute(b),10):c}function P(a,b){if(R.convertUpAxis&&$!==R.upAxis)switch(W){case "XtoY":var c=a[0];a[0]=b*a[1];a[1]=c;
 break;case "XtoZ":c=a[2];a[2]=a[1];a[1]=a[0];a[0]=c;break;case "YtoX":c=a[0];a[0]=a[1];a[1]=b*c;break;case "YtoZ":c=a[1];a[1]=b*a[2];a[2]=c;break;case "ZtoX":c=a[0];a[0]=a[1];a[1]=a[2];a[2]=c;break;case "ZtoY":c=a[1],a[1]=a[2],a[2]=b*c}}function ka(a,b){var c=[a[b],a[b+1],a[b+2]];P(c,-1);return new THREE.Vector3(c[0],c[1],c[2])}function ca(a){if(R.convertUpAxis){var b=[a[0],a[4],a[8]];P(b,-1);a[0]=b[0];a[4]=b[1];a[8]=b[2];b=[a[1],a[5],a[9]];P(b,-1);a[1]=b[0];a[5]=b[1];a[9]=b[2];b=[a[2],a[6],a[10]];
 P(b,-1);a[2]=b[0];a[6]=b[1];a[10]=b[2];b=[a[0],a[1],a[2]];P(b,-1);a[0]=b[0];a[1]=b[1];a[2]=b[2];b=[a[4],a[5],a[6]];P(b,-1);a[4]=b[0];a[5]=b[1];a[6]=b[2];b=[a[8],a[9],a[10]];P(b,-1);a[8]=b[0];a[9]=b[1];a[10]=b[2];b=[a[3],a[7],a[11]];P(b,-1);a[3]=b[0];a[7]=b[1];a[11]=b[2]}return new THREE.Matrix4(a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8],a[9],a[10],a[11],a[12],a[13],a[14],a[15])}var Q=null,Y=null,T,la=null,Z={},da={},X={},U={},V={},ea={},fa={},ga={},ia,ha,ma,aa,ba,na=THREE.SmoothShading,R={centerGeometry:!1,
-convertUpAxis:!1,subdivideFaces:!0,upAxis:"Y"},$="Y",W=null,ja=Math.PI/180;e.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if("init_from"==c.nodeName)this.init_from=c.textContent}return this};h.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.type="none";for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "skin":this.skin=(new j).parse(c);this.type=
+convertUpAxis:!1,subdivideFaces:!0,upAxis:"Y"},$="Y",W=null,ja=Math.PI/180;e.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if("init_from"==c.nodeName)this.init_from=c.textContent}return this};h.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.type="none";for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "skin":this.skin=(new k).parse(c);this.type=
 c.nodeName;break;case "morph":this.morph=(new i).parse(c),this.type=c.nodeName}}return this};i.prototype.parse=function(a){var b={},c=[],d;this.method=a.getAttribute("method");this.source=a.getAttribute("source").replace(/^#/,"");for(d=0;d<a.childNodes.length;d++){var e=a.childNodes[d];if(1==e.nodeType)switch(e.nodeName){case "source":e=(new z).parse(e);b[e.id]=e;break;case "targets":c=this.parseInputs(e);break;default:console.log(e.nodeName)}}for(d=0;d<c.length;d++)switch(a=c[d],e=b[a.source],a.semantic){case "MORPH_TARGET":this.targets=
-e.read();break;case "MORPH_WEIGHT":this.weights=e.read()}return this};i.prototype.parseInputs=function(a){for(var b=[],c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(1==d.nodeType)switch(d.nodeName){case "input":b.push((new w).parse(d))}}return b};j.prototype.parse=function(a){var b={},c,d;this.source=a.getAttribute("source").replace(/^#/,"");this.invBindMatrices=[];this.joints=[];this.weights=[];for(var e=0;e<a.childNodes.length;e++){var f=a.childNodes[e];if(1==f.nodeType)switch(f.nodeName){case "bind_shape_matrix":f=
-N(f.textContent);this.bindShapeMatrix=ca(f);break;case "source":f=(new z).parse(f);b[f.id]=f;break;case "joints":c=f;break;case "vertex_weights":d=f;break;default:console.log(f.nodeName)}}this.parseJoints(c,b);this.parseWeights(d,b);return this};j.prototype.parseJoints=function(a,b){for(var c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(1==d.nodeType)switch(d.nodeName){case "input":var d=(new w).parse(d),e=b[d.source];if("JOINT"==d.semantic)this.joints=e.read();else if("INV_BIND_MATRIX"==
-d.semantic)this.invBindMatrices=e.read()}}};j.prototype.parseWeights=function(a,b){for(var c,d,e=[],f=0;f<a.childNodes.length;f++){var g=a.childNodes[f];if(1==g.nodeType)switch(g.nodeName){case "input":e.push((new w).parse(g));break;case "v":c=M(g.textContent);break;case "vcount":d=M(g.textContent)}}for(f=g=0;f<d.length;f++){for(var h=d[f],i=[],j=0;j<h;j++){for(var k={},m=0;m<e.length;m++){var l=e[m],n=c[g+l.offset];switch(l.semantic){case "JOINT":k.joint=n;break;case "WEIGHT":k.weight=b[l.source].data[n]}}i.push(k);
-g+=e.length}for(j=0;j<i.length;j++)i[j].index=f;this.weights.push(i)}};k.prototype.getChildById=function(a,b){for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildById(a,b);if(d)return d}return null};k.prototype.getChildBySid=function(a,b){for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildBySid(a,b);if(d)return d}return null};k.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.nodes=[];for(var b=0;b<a.childNodes.length;b++){var c=
+e.read();break;case "MORPH_WEIGHT":this.weights=e.read()}return this};i.prototype.parseInputs=function(a){for(var b=[],c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(1==d.nodeType)switch(d.nodeName){case "input":b.push((new w).parse(d))}}return b};k.prototype.parse=function(a){var b={},c,d;this.source=a.getAttribute("source").replace(/^#/,"");this.invBindMatrices=[];this.joints=[];this.weights=[];for(var e=0;e<a.childNodes.length;e++){var f=a.childNodes[e];if(1==f.nodeType)switch(f.nodeName){case "bind_shape_matrix":f=
+N(f.textContent);this.bindShapeMatrix=ca(f);break;case "source":f=(new z).parse(f);b[f.id]=f;break;case "joints":c=f;break;case "vertex_weights":d=f;break;default:console.log(f.nodeName)}}this.parseJoints(c,b);this.parseWeights(d,b);return this};k.prototype.parseJoints=function(a,b){for(var c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(1==d.nodeType)switch(d.nodeName){case "input":var d=(new w).parse(d),e=b[d.source];if("JOINT"==d.semantic)this.joints=e.read();else if("INV_BIND_MATRIX"==
+d.semantic)this.invBindMatrices=e.read()}}};k.prototype.parseWeights=function(a,b){for(var c,d,e=[],f=0;f<a.childNodes.length;f++){var g=a.childNodes[f];if(1==g.nodeType)switch(g.nodeName){case "input":e.push((new w).parse(g));break;case "v":c=M(g.textContent);break;case "vcount":d=M(g.textContent)}}for(f=g=0;f<d.length;f++){for(var h=d[f],i=[],j=0;j<h;j++){for(var k={},m=0;m<e.length;m++){var l=e[m],n=c[g+l.offset];switch(l.semantic){case "JOINT":k.joint=n;break;case "WEIGHT":k.weight=b[l.source].data[n]}}i.push(k);
+g+=e.length}for(j=0;j<i.length;j++)i[j].index=f;this.weights.push(i)}};j.prototype.getChildById=function(a,b){for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildById(a,b);if(d)return d}return null};j.prototype.getChildBySid=function(a,b){for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildBySid(a,b);if(d)return d}return null};j.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.nodes=[];for(var b=0;b<a.childNodes.length;b++){var c=
 a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "node":this.nodes.push((new q).parse(c))}}return this};q.prototype.getChannelForTransform=function(a){for(var b=0;b<this.channels.length;b++){var c=this.channels[b],d=c.target.split("/");d.shift();var e=d.shift(),f=0<=e.indexOf("."),g=0<=e.indexOf("("),h;if(f)d=e.split("."),e=d.shift(),d.shift();else if(g){h=e.split("(");e=h.shift();for(d=0;d<h.length;d++)h[d]=parseInt(h[d].replace(/\)/,""))}if(e==a)return c.info={sid:e,dotSyntax:f,arrSyntax:g,
 arrIndices:h},c}return null};q.prototype.getChildById=function(a,b){if(this.id==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildById(a,b);if(d)return d}return null};q.prototype.getChildBySid=function(a,b){if(this.sid==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildBySid(a,b);if(d)return d}return null};q.prototype.getTransformBySid=function(a){for(var b=0;b<this.transforms.length;b++)if(this.transforms[b].sid==a)return this.transforms[b];
 return null};q.prototype.parse=function(a){var b;this.id=a.getAttribute("id");this.sid=a.getAttribute("sid");this.name=a.getAttribute("name");this.type=a.getAttribute("type");this.type="JOINT"==this.type?this.type:"NODE";this.nodes=[];this.transforms=[];this.geometries=[];this.cameras=[];this.controllers=[];this.matrix=new THREE.Matrix4;for(var c=0;c<a.childNodes.length;c++)if(b=a.childNodes[c],1==b.nodeType)switch(b.nodeName){case "node":this.nodes.push((new q).parse(b));break;case "instance_camera":this.cameras.push((new C).parse(b));
@@ -313,49 +313,48 @@ d({total:e,loaded:f.responseText.length}))};f.open("GET",b,!0);f.send(null)}else
 THREE.JSONLoader.prototype.load=function(a,b,c){if(a instanceof Object)console.warn("DEPRECATED: JSONLoader( parameters ) is now JSONLoader( url, callback, texturePath )."),c=a,a=c.model,b=c.callback,c=c.texture_path;c=c?c:this.extractUrlbase(a);this.onLoadStart();this.loadAjaxJSON(this,a,b,c)};
 THREE.JSONLoader.prototype.loadAjaxJSON=function(a,b,c,d,f){var g=new XMLHttpRequest,e=0;g.onreadystatechange=function(){if(4==g.readyState)if(200==g.status||0==g.status){try{var h=JSON.parse(g.responseText)}catch(i){console.warn("DEPRECATED: ["+b+"] seems to be using old model format")}a.createModel(h,c,d);a.onLoadComplete()}else console.error("Couldn't load ["+b+"] ["+g.status+"]");else 3==g.readyState?f&&(0==e&&(e=g.getResponseHeader("Content-Length")),f({total:e,loaded:g.responseText.length})):
 2==g.readyState&&(e=g.getResponseHeader("Content-Length"))};g.open("GET",b,!0);g.overrideMimeType&&g.overrideMimeType("text/plain; charset=x-user-defined");g.setRequestHeader("Content-Type","text/plain");g.send(null)};
-THREE.JSONLoader.prototype.createModel=function(a,b,c){var d=new THREE.Geometry,f=void 0!==a.scale?1/a.scale:1;this.initMaterials(d,a.materials,c);(function(b){if(void 0===a.metadata||void 0===a.metadata.formatVersion||3!==a.metadata.formatVersion)console.error("Deprecated file format.");else{var c,f,i,j,k,q,l,n,r,m,o,p,s,t,u=a.faces;q=a.vertices;var v=a.normals,w=a.colors,z=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&z++;for(c=0;c<z;c++)d.faceUvs[c]=[],d.faceVertexUvs[c]=[];j=0;for(k=q.length;j<
-k;)l=new THREE.Vertex,l.position.x=q[j++]*b,l.position.y=q[j++]*b,l.position.z=q[j++]*b,d.vertices.push(l);j=0;for(k=u.length;j<k;){b=u[j++];q=b&1;i=b&2;c=b&4;f=b&8;n=b&16;l=b&32;m=b&64;b&=128;q?(o=new THREE.Face4,o.a=u[j++],o.b=u[j++],o.c=u[j++],o.d=u[j++],q=4):(o=new THREE.Face3,o.a=u[j++],o.b=u[j++],o.c=u[j++],q=3);if(i)i=u[j++],o.materialIndex=i;i=d.faces.length;if(c)for(c=0;c<z;c++)p=a.uvs[c],r=u[j++],t=p[2*r],r=p[2*r+1],d.faceUvs[c][i]=new THREE.UV(t,r);if(f)for(c=0;c<z;c++){p=a.uvs[c];s=[];
-for(f=0;f<q;f++)r=u[j++],t=p[2*r],r=p[2*r+1],s[f]=new THREE.UV(t,r);d.faceVertexUvs[c][i]=s}if(n)n=3*u[j++],f=new THREE.Vector3,f.x=v[n++],f.y=v[n++],f.z=v[n],o.normal=f;if(l)for(c=0;c<q;c++)n=3*u[j++],f=new THREE.Vector3,f.x=v[n++],f.y=v[n++],f.z=v[n],o.vertexNormals.push(f);if(m)l=u[j++],l=new THREE.Color(w[l]),o.color=l;if(b)for(c=0;c<q;c++)l=u[j++],l=new THREE.Color(w[l]),o.vertexColors.push(l);d.faces.push(o)}}})(f);(function(){var b,c,f,i;if(a.skinWeights)for(b=0,c=a.skinWeights.length;b<c;b+=
-2)f=a.skinWeights[b],i=a.skinWeights[b+1],d.skinWeights.push(new THREE.Vector4(f,i,0,0));if(a.skinIndices)for(b=0,c=a.skinIndices.length;b<c;b+=2)f=a.skinIndices[b],i=a.skinIndices[b+1],d.skinIndices.push(new THREE.Vector4(f,i,0,0));d.bones=a.bones;d.animation=a.animation})();(function(b){if(void 0!==a.morphTargets){var c,f,i,j,k,q,l,n,r,m,o;for(c=0,f=a.morphTargets.length;c<f;c++){d.morphTargets[c]={};d.morphTargets[c].name=a.morphTargets[c].name;d.morphTargets[c].vertices=[];d.morphNormals[c]={};
-d.morphNormals[c].faceNormals=[];d.morphNormals[c].vertexNormals=[];n=d.morphTargets[c].vertices;r=a.morphTargets[c].vertices;m=d.morphNormals[c].faceNormals;o=d.morphNormals[c].vertexNormals;for(i=0,j=r.length;i<j;i+=3)k=r[i]*b,q=r[i+1]*b,l=r[i+2]*b,n.push(new THREE.Vertex(new THREE.Vector3(k,q,l)));for(i=0,j=d.faces.length;i<j;i++)q=d.faces[i],k=new THREE.Vector3,q=q instanceof THREE.Face3?{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3}:{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3,
-d:new THREE.Vector3},m.push(k),o.push(q)}}if(void 0!==a.morphColors)for(c=0,f=a.morphColors.length;c<f;c++){d.morphColors[c]={};d.morphColors[c].name=a.morphColors[c].name;d.morphColors[c].colors=[];o=d.morphColors[c].colors;i=a.morphColors[c].colors;for(b=0,m=i.length;b<m;b+=3)j=new THREE.Color(16755200),j.setRGB(i[b],i[b+1],i[b+2]),o.push(j)}})(f);d.computeCentroids();(function(){var a,b,c,f,j;for(c=0,f=d.faces.length;c<f;c++){j=d.faces[c];j.__originalVertexNormals=[];for(a=0,b=j.vertexNormals.length;a<
-b;a++)j.__originalVertexNormals[a]=j.vertexNormals[a].clone()}var k=new THREE.Geometry;k.faces=d.faces;for(a=0,b=d.morphTargets.length;a<b;a++){var q=d.morphNormals[a];k.vertices=d.morphTargets[a].vertices;k.computeFaceNormals();k.computeVertexNormals();var l,n;for(c=0,f=d.faces.length;c<f;c++)j=d.faces[c],l=q.faceNormals[c],n=q.vertexNormals[c],l.copy(j.normal),j instanceof THREE.Face3?(n.a.copy(j.vertexNormals[0]),n.b.copy(j.vertexNormals[1]),n.c.copy(j.vertexNormals[2])):(n.a.copy(j.vertexNormals[0]),
-n.b.copy(j.vertexNormals[1]),n.c.copy(j.vertexNormals[2]),n.d.copy(j.vertexNormals[3]))}for(c=0,f=d.faces.length;c<f;c++)j=d.faces[c],j.vertexNormals=j.__originalVertexNormals})();d.computeFaceNormals();this.hasNormals(d)&&d.computeTangents();b(d)};THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};THREE.SceneLoader.prototype.constructor=THREE.SceneLoader;
+THREE.JSONLoader.prototype.createModel=function(a,b,c){var d=new THREE.Geometry,f=void 0!==a.scale?1/a.scale:1;this.initMaterials(d,a.materials,c);(function(b){if(void 0===a.metadata||void 0===a.metadata.formatVersion||3!==a.metadata.formatVersion)console.error("Deprecated file format.");else{var c,f,i,k,j,q,l,n,r,m,o,p,s,t,u=a.faces;q=a.vertices;var v=a.normals,w=a.colors,z=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&z++;for(c=0;c<z;c++)d.faceUvs[c]=[],d.faceVertexUvs[c]=[];k=0;for(j=q.length;k<
+j;)l=new THREE.Vertex,l.position.x=q[k++]*b,l.position.y=q[k++]*b,l.position.z=q[k++]*b,d.vertices.push(l);k=0;for(j=u.length;k<j;){b=u[k++];q=b&1;i=b&2;c=b&4;f=b&8;n=b&16;l=b&32;m=b&64;b&=128;q?(o=new THREE.Face4,o.a=u[k++],o.b=u[k++],o.c=u[k++],o.d=u[k++],q=4):(o=new THREE.Face3,o.a=u[k++],o.b=u[k++],o.c=u[k++],q=3);if(i)i=u[k++],o.materialIndex=i;i=d.faces.length;if(c)for(c=0;c<z;c++)p=a.uvs[c],r=u[k++],t=p[2*r],r=p[2*r+1],d.faceUvs[c][i]=new THREE.UV(t,r);if(f)for(c=0;c<z;c++){p=a.uvs[c];s=[];
+for(f=0;f<q;f++)r=u[k++],t=p[2*r],r=p[2*r+1],s[f]=new THREE.UV(t,r);d.faceVertexUvs[c][i]=s}if(n)n=3*u[k++],f=new THREE.Vector3,f.x=v[n++],f.y=v[n++],f.z=v[n],o.normal=f;if(l)for(c=0;c<q;c++)n=3*u[k++],f=new THREE.Vector3,f.x=v[n++],f.y=v[n++],f.z=v[n],o.vertexNormals.push(f);if(m)l=u[k++],l=new THREE.Color(w[l]),o.color=l;if(b)for(c=0;c<q;c++)l=u[k++],l=new THREE.Color(w[l]),o.vertexColors.push(l);d.faces.push(o)}}})(f);(function(){var b,c,f,i;if(a.skinWeights)for(b=0,c=a.skinWeights.length;b<c;b+=
+2)f=a.skinWeights[b],i=a.skinWeights[b+1],d.skinWeights.push(new THREE.Vector4(f,i,0,0));if(a.skinIndices)for(b=0,c=a.skinIndices.length;b<c;b+=2)f=a.skinIndices[b],i=a.skinIndices[b+1],d.skinIndices.push(new THREE.Vector4(f,i,0,0));d.bones=a.bones;d.animation=a.animation})();(function(b){if(void 0!==a.morphTargets){var c,f,i,k,j,q,l,n,r,m,o;for(c=0,f=a.morphTargets.length;c<f;c++){d.morphTargets[c]={};d.morphTargets[c].name=a.morphTargets[c].name;d.morphTargets[c].vertices=[];d.morphNormals[c]={};
+d.morphNormals[c].faceNormals=[];d.morphNormals[c].vertexNormals=[];n=d.morphTargets[c].vertices;r=a.morphTargets[c].vertices;m=d.morphNormals[c].faceNormals;o=d.morphNormals[c].vertexNormals;for(i=0,k=r.length;i<k;i+=3)j=r[i]*b,q=r[i+1]*b,l=r[i+2]*b,n.push(new THREE.Vertex(new THREE.Vector3(j,q,l)));for(i=0,k=d.faces.length;i<k;i++)q=d.faces[i],j=new THREE.Vector3,q=q instanceof THREE.Face3?{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3}:{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3,
+d:new THREE.Vector3},m.push(j),o.push(q)}}if(void 0!==a.morphColors)for(c=0,f=a.morphColors.length;c<f;c++){d.morphColors[c]={};d.morphColors[c].name=a.morphColors[c].name;d.morphColors[c].colors=[];o=d.morphColors[c].colors;i=a.morphColors[c].colors;for(b=0,m=i.length;b<m;b+=3)k=new THREE.Color(16755200),k.setRGB(i[b],i[b+1],i[b+2]),o.push(k)}})(f);d.computeCentroids();d.computeMorphNormals();d.computeFaceNormals();this.hasNormals(d)&&d.computeTangents();b(d)};
+THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};THREE.SceneLoader.prototype.constructor=THREE.SceneLoader;
 THREE.SceneLoader.prototype.load=function(a,b){var c=this,d=new XMLHttpRequest;d.onreadystatechange=function(){if(4==d.readyState)if(200==d.status||0==d.status){try{var f=JSON.parse(d.responseText)}catch(g){console.warn("DEPRECATED: ["+a+"] seems to be using old model format")}c.createScene(f,b,a)}else console.error("Couldn't load ["+a+"] ["+d.status+"]")};d.open("GET",a,!0);d.overrideMimeType&&d.overrideMimeType("text/plain; charset=x-user-defined");d.setRequestHeader("Content-Type","text/plain");
 d.send(null)};
-THREE.SceneLoader.prototype.createScene=function(a,b,c){function d(a,b){return"relativeToHTML"==b?a:j+"/"+a}function f(){var a;for(l in B.objects)if(!C.objects[l])if(p=B.objects[l],void 0!==p.geometry){if(F=C.geometries[p.geometry]){a=!1;E=C.materials[p.materials[0]];(a=E instanceof THREE.ShaderMaterial)&&F.computeTangents();u=p.position;v=p.rotation;w=p.quaternion;z=p.scale;w=0;0==p.materials.length&&(E=new THREE.MeshFaceMaterial);1<p.materials.length&&(E=new THREE.MeshFaceMaterial);a=new THREE.Mesh(F,
+THREE.SceneLoader.prototype.createScene=function(a,b,c){function d(a,b){return"relativeToHTML"==b?a:k+"/"+a}function f(){var a;for(l in B.objects)if(!C.objects[l])if(p=B.objects[l],void 0!==p.geometry){if(F=C.geometries[p.geometry]){a=!1;E=C.materials[p.materials[0]];(a=E instanceof THREE.ShaderMaterial)&&F.computeTangents();u=p.position;v=p.rotation;w=p.quaternion;z=p.scale;w=0;0==p.materials.length&&(E=new THREE.MeshFaceMaterial);1<p.materials.length&&(E=new THREE.MeshFaceMaterial);a=new THREE.Mesh(F,
 E);a.name=l;a.position.set(u[0],u[1],u[2]);w?(a.quaternion.set(w[0],w[1],w[2],w[3]),a.useQuaternion=!0):a.rotation.set(v[0],v[1],v[2]);a.scale.set(z[0],z[1],z[2]);a.visible=p.visible;C.scene.add(a);C.objects[l]=a;if(p.meshCollider){var b=THREE.CollisionUtils.MeshColliderWBox(a);C.scene.collisions.colliders.push(b)}if(p.castsShadow)b=new THREE.ShadowVolume(F),C.scene.add(b),b.position=a.position,b.rotation=a.rotation,b.scale=a.scale;p.trigger&&"none"!=p.trigger.toLowerCase()&&(b={type:p.trigger,object:p},
 C.triggers[a.name]=b)}}else u=p.position,v=p.rotation,w=p.quaternion,z=p.scale,w=0,a=new THREE.Object3D,a.name=l,a.position.set(u[0],u[1],u[2]),w?(a.quaternion.set(w[0],w[1],w[2],w[3]),a.useQuaternion=!0):a.rotation.set(v[0],v[1],v[2]),a.scale.set(z[0],z[1],z[2]),a.visible=void 0!==p.visible?p.visible:!1,C.scene.add(a),C.objects[l]=a,C.empties[l]=a,p.trigger&&"none"!=p.trigger.toLowerCase()&&(b={type:p.trigger,object:p},C.triggers[a.name]=b)}function g(a){return function(b){C.geometries[a]=b;f();
-D-=1;i.onLoadComplete();h()}}function e(a){return function(b){C.geometries[a]=b}}function h(){i.callbackProgress({totalModels:y,totalTextures:K,loadedModels:y-D,loadedTextures:K-I},C);i.onLoadProgress();0==D&&0==I&&b(C)}var i=this,j=THREE.Loader.prototype.extractUrlbase(c),k,q,l,n,r,m,o,p,s,t,u,v,w,z,x,A,F,E,J,G,B,H,D,I,y,K,C;B=a;c=new THREE.BinaryLoader;H=new THREE.JSONLoader;I=D=0;C={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},
+D-=1;i.onLoadComplete();h()}}function e(a){return function(b){C.geometries[a]=b}}function h(){i.callbackProgress({totalModels:y,totalTextures:K,loadedModels:y-D,loadedTextures:K-I},C);i.onLoadProgress();0==D&&0==I&&b(C)}var i=this,k=THREE.Loader.prototype.extractUrlbase(c),j,q,l,n,r,m,o,p,s,t,u,v,w,z,x,A,F,E,J,G,B,H,D,I,y,K,C;B=a;c=new THREE.BinaryLoader;H=new THREE.JSONLoader;I=D=0;C={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},
 empties:{}};a=!1;for(l in B.objects)if(p=B.objects[l],p.meshCollider){a=!0;break}if(a)C.scene.collisions=new THREE.CollisionSystem;if(B.transform)a=B.transform.position,s=B.transform.rotation,x=B.transform.scale,a&&C.scene.position.set(a[0],a[1],a[2]),s&&C.scene.rotation.set(s[0],s[1],s[2]),x&&C.scene.scale.set(x[0],x[1],x[2]),(a||s||x)&&C.scene.updateMatrix();a=function(){I-=1;h();i.onLoadComplete()};for(r in B.cameras)x=B.cameras[r],"perspective"==x.type?J=new THREE.PerspectiveCamera(x.fov,x.aspect,
 x.near,x.far):"ortho"==x.type&&(J=new THREE.OrthographicCamera(x.left,x.right,x.top,x.bottom,x.near,x.far)),u=x.position,s=x.target,x=x.up,J.position.set(u[0],u[1],u[2]),J.target=new THREE.Vector3(s[0],s[1],s[2]),x&&J.up.set(x[0],x[1],x[2]),C.cameras[r]=J;for(n in B.lights)s=B.lights[n],r=void 0!==s.color?s.color:16777215,J=void 0!==s.intensity?s.intensity:1,"directional"==s.type?(u=s.direction,t=new THREE.DirectionalLight(r,J),t.position.set(u[0],u[1],u[2]),t.position.normalize()):"point"==s.type?
 (u=s.position,t=s.distance,t=new THREE.PointLight(r,J,t),t.position.set(u[0],u[1],u[2])):"ambient"==s.type&&(t=new THREE.AmbientLight(r)),C.scene.add(t),C.lights[n]=t;for(m in B.fogs)n=B.fogs[m],"linear"==n.type?G=new THREE.Fog(0,n.near,n.far):"exp2"==n.type&&(G=new THREE.FogExp2(0,n.density)),x=n.color,G.color.setRGB(x[0],x[1],x[2]),C.fogs[m]=G;if(C.cameras&&B.defaults.camera)C.currentCamera=C.cameras[B.defaults.camera];if(C.fogs&&B.defaults.fog)C.scene.fog=C.fogs[B.defaults.fog];x=B.defaults.bgcolor;
-C.bgColor=new THREE.Color;C.bgColor.setRGB(x[0],x[1],x[2]);C.bgColorAlpha=B.defaults.bgalpha;for(k in B.geometries)if(m=B.geometries[k],"bin_mesh"==m.type||"ascii_mesh"==m.type)D+=1,i.onLoadStart();y=D;for(k in B.geometries)if(m=B.geometries[k],"cube"==m.type)F=new THREE.CubeGeometry(m.width,m.height,m.depth,m.segmentsWidth,m.segmentsHeight,m.segmentsDepth,null,m.flipped,m.sides),C.geometries[k]=F;else if("plane"==m.type)F=new THREE.PlaneGeometry(m.width,m.height,m.segmentsWidth,m.segmentsHeight),
-C.geometries[k]=F;else if("sphere"==m.type)F=new THREE.SphereGeometry(m.radius,m.segmentsWidth,m.segmentsHeight),C.geometries[k]=F;else if("cylinder"==m.type)F=new THREE.CylinderGeometry(m.topRad,m.botRad,m.height,m.radSegs,m.heightSegs),C.geometries[k]=F;else if("torus"==m.type)F=new THREE.TorusGeometry(m.radius,m.tube,m.segmentsR,m.segmentsT),C.geometries[k]=F;else if("icosahedron"==m.type)F=new THREE.IcosahedronGeometry(m.radius,m.subdivisions),C.geometries[k]=F;else if("bin_mesh"==m.type)c.load(d(m.url,
-B.urlBaseType),g(k));else if("ascii_mesh"==m.type)H.load(d(m.url,B.urlBaseType),g(k));else if("embedded_mesh"==m.type)m=B.embeds[m.id],m.metadata=B.metadata,m&&H.createModel(m,e(k),"");for(o in B.textures)if(k=B.textures[o],k.url instanceof Array){I+=k.url.length;for(m=0;m<k.url.length;m++)i.onLoadStart()}else I+=1,i.onLoadStart();K=I;for(o in B.textures){k=B.textures[o];if(void 0!=k.mapping&&void 0!=THREE[k.mapping])k.mapping=new THREE[k.mapping];if(k.url instanceof Array){m=[];for(G=0;G<k.url.length;G++)m[G]=
-d(k.url[G],B.urlBaseType);m=THREE.ImageUtils.loadTextureCube(m,k.mapping,a)}else{m=THREE.ImageUtils.loadTexture(d(k.url,B.urlBaseType),k.mapping,a);if(void 0!=THREE[k.minFilter])m.minFilter=THREE[k.minFilter];if(void 0!=THREE[k.magFilter])m.magFilter=THREE[k.magFilter];if(k.repeat){m.repeat.set(k.repeat[0],k.repeat[1]);if(1!=k.repeat[0])m.wrapS=THREE.RepeatWrapping;if(1!=k.repeat[1])m.wrapT=THREE.RepeatWrapping}k.offset&&m.offset.set(k.offset[0],k.offset[1]);if(k.wrap){G={repeat:THREE.RepeatWrapping,
-mirror:THREE.MirroredRepeatWrapping};if(void 0!==G[k.wrap[0]])m.wrapS=G[k.wrap[0]];if(void 0!==G[k.wrap[1]])m.wrapT=G[k.wrap[1]]}}C.textures[o]=m}for(q in B.materials){o=B.materials[q];for(A in o.parameters)if("envMap"==A||"map"==A||"lightMap"==A)o.parameters[A]=C.textures[o.parameters[A]];else if("shading"==A)o.parameters[A]="flat"==o.parameters[A]?THREE.FlatShading:THREE.SmoothShading;else if("blending"==A)o.parameters[A]=THREE[o.parameters[A]]?THREE[o.parameters[A]]:THREE.NormalBlending;else if("combine"==
-A)o.parameters[A]="MixOperation"==o.parameters[A]?THREE.MixOperation:THREE.MultiplyOperation;else if("vertexColors"==A)if("face"==o.parameters[A])o.parameters[A]=THREE.FaceColors;else if(o.parameters[A])o.parameters[A]=THREE.VertexColors;if(void 0!==o.parameters.opacity&&1>o.parameters.opacity)o.parameters.transparent=!0;if(o.parameters.normalMap){k=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(k.uniforms);m=o.parameters.color;G=o.parameters.specular;c=o.parameters.ambient;H=o.parameters.shininess;
+C.bgColor=new THREE.Color;C.bgColor.setRGB(x[0],x[1],x[2]);C.bgColorAlpha=B.defaults.bgalpha;for(j in B.geometries)if(m=B.geometries[j],"bin_mesh"==m.type||"ascii_mesh"==m.type)D+=1,i.onLoadStart();y=D;for(j in B.geometries)if(m=B.geometries[j],"cube"==m.type)F=new THREE.CubeGeometry(m.width,m.height,m.depth,m.segmentsWidth,m.segmentsHeight,m.segmentsDepth,null,m.flipped,m.sides),C.geometries[j]=F;else if("plane"==m.type)F=new THREE.PlaneGeometry(m.width,m.height,m.segmentsWidth,m.segmentsHeight),
+C.geometries[j]=F;else if("sphere"==m.type)F=new THREE.SphereGeometry(m.radius,m.segmentsWidth,m.segmentsHeight),C.geometries[j]=F;else if("cylinder"==m.type)F=new THREE.CylinderGeometry(m.topRad,m.botRad,m.height,m.radSegs,m.heightSegs),C.geometries[j]=F;else if("torus"==m.type)F=new THREE.TorusGeometry(m.radius,m.tube,m.segmentsR,m.segmentsT),C.geometries[j]=F;else if("icosahedron"==m.type)F=new THREE.IcosahedronGeometry(m.radius,m.subdivisions),C.geometries[j]=F;else if("bin_mesh"==m.type)c.load(d(m.url,
+B.urlBaseType),g(j));else if("ascii_mesh"==m.type)H.load(d(m.url,B.urlBaseType),g(j));else if("embedded_mesh"==m.type)m=B.embeds[m.id],m.metadata=B.metadata,m&&H.createModel(m,e(j),"");for(o in B.textures)if(j=B.textures[o],j.url instanceof Array){I+=j.url.length;for(m=0;m<j.url.length;m++)i.onLoadStart()}else I+=1,i.onLoadStart();K=I;for(o in B.textures){j=B.textures[o];if(void 0!=j.mapping&&void 0!=THREE[j.mapping])j.mapping=new THREE[j.mapping];if(j.url instanceof Array){m=[];for(G=0;G<j.url.length;G++)m[G]=
+d(j.url[G],B.urlBaseType);m=THREE.ImageUtils.loadTextureCube(m,j.mapping,a)}else{m=THREE.ImageUtils.loadTexture(d(j.url,B.urlBaseType),j.mapping,a);if(void 0!=THREE[j.minFilter])m.minFilter=THREE[j.minFilter];if(void 0!=THREE[j.magFilter])m.magFilter=THREE[j.magFilter];if(j.repeat){m.repeat.set(j.repeat[0],j.repeat[1]);if(1!=j.repeat[0])m.wrapS=THREE.RepeatWrapping;if(1!=j.repeat[1])m.wrapT=THREE.RepeatWrapping}j.offset&&m.offset.set(j.offset[0],j.offset[1]);if(j.wrap){G={repeat:THREE.RepeatWrapping,
+mirror:THREE.MirroredRepeatWrapping};if(void 0!==G[j.wrap[0]])m.wrapS=G[j.wrap[0]];if(void 0!==G[j.wrap[1]])m.wrapT=G[j.wrap[1]]}}C.textures[o]=m}for(q in B.materials){o=B.materials[q];for(A in o.parameters)if("envMap"==A||"map"==A||"lightMap"==A)o.parameters[A]=C.textures[o.parameters[A]];else if("shading"==A)o.parameters[A]="flat"==o.parameters[A]?THREE.FlatShading:THREE.SmoothShading;else if("blending"==A)o.parameters[A]=THREE[o.parameters[A]]?THREE[o.parameters[A]]:THREE.NormalBlending;else if("combine"==
+A)o.parameters[A]="MixOperation"==o.parameters[A]?THREE.MixOperation:THREE.MultiplyOperation;else if("vertexColors"==A)if("face"==o.parameters[A])o.parameters[A]=THREE.FaceColors;else if(o.parameters[A])o.parameters[A]=THREE.VertexColors;if(void 0!==o.parameters.opacity&&1>o.parameters.opacity)o.parameters.transparent=!0;if(o.parameters.normalMap){j=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(j.uniforms);m=o.parameters.color;G=o.parameters.specular;c=o.parameters.ambient;H=o.parameters.shininess;
 a.tNormal.texture=C.textures[o.parameters.normalMap];if(o.parameters.normalMapFactor)a.uNormalScale.value=o.parameters.normalMapFactor;if(o.parameters.map)a.tDiffuse.texture=o.parameters.map,a.enableDiffuse.value=!0;if(o.parameters.lightMap)a.tAO.texture=o.parameters.lightMap,a.enableAO.value=!0;if(o.parameters.specularMap)a.tSpecular.texture=C.textures[o.parameters.specularMap],a.enableSpecular.value=!0;a.uDiffuseColor.value.setHex(m);a.uSpecularColor.value.setHex(G);a.uAmbientColor.value.setHex(c);
-a.uShininess.value=H;if(o.parameters.opacity)a.uOpacity.value=o.parameters.opacity;E=new THREE.ShaderMaterial({fragmentShader:k.fragmentShader,vertexShader:k.vertexShader,uniforms:a,lights:!0,fog:!0})}else E=new THREE[o.type](o.parameters);C.materials[q]=E}f();i.callbackSync(C);h()};THREE.UTF8Loader=function(){};THREE.UTF8Loader.prototype=new THREE.UTF8Loader;THREE.UTF8Loader.prototype.constructor=THREE.UTF8Loader;
+a.uShininess.value=H;if(o.parameters.opacity)a.uOpacity.value=o.parameters.opacity;E=new THREE.ShaderMaterial({fragmentShader:j.fragmentShader,vertexShader:j.vertexShader,uniforms:a,lights:!0,fog:!0})}else E=new THREE[o.type](o.parameters);C.materials[q]=E}f();i.callbackSync(C);h()};THREE.UTF8Loader=function(){};THREE.UTF8Loader.prototype=new THREE.UTF8Loader;THREE.UTF8Loader.prototype.constructor=THREE.UTF8Loader;
 THREE.UTF8Loader.prototype.load=function(a,b,c){if(a instanceof Object)console.warn("DEPRECATED: UTF8Loader( parameters ) is now UTF8Loader( url, callback, metaData )."),c=a,a=c.model,b=c.callback,c={scale:c.scale,offsetX:c.offsetX,offsetY:c.offsetY,offsetZ:c.offsetZ};var d=new XMLHttpRequest,f=void 0!==c.scale?c.scale:1,g=void 0!==c.offsetX?c.offsetX:0,e=void 0!==c.offsetY?c.offsetY:0,h=void 0!==c.offsetZ?c.offsetZ:0;d.onreadystatechange=function(){4==d.readyState?200==d.status||0==d.status?THREE.UTF8Loader.prototype.createModel(d.responseText,
 b,f,g,e,h):alert("Couldn't load ["+a+"] ["+d.status+"]"):3!=d.readyState&&2==d.readyState&&d.getResponseHeader("Content-Length")};d.open("GET",a,!0);d.send(null)};THREE.UTF8Loader.prototype.decompressMesh=function(a){var b=a.charCodeAt(0);57344<=b&&(b-=2048);b++;for(var c=new Float32Array(8*b),d=1,f=0;8>f;f++){for(var g=0,e=0;e<b;++e){var h=a.charCodeAt(e+d),g=g+(h>>1^-(h&1));c[8*e+f]=g}d+=b}b=a.length-d;g=new Uint16Array(b);for(f=e=0;f<b;f++)h=a.charCodeAt(f+d),g[f]=e-h,0==h&&e++;return[c,g]};
-THREE.UTF8Loader.prototype.createModel=function(a,b,c,d,f,g){var e=function(){var b=this;b.materials=[];THREE.Geometry.call(this);var e=THREE.UTF8Loader.prototype.decompressMesh(a),j=[],k=[];(function(a,e,i){for(var j,k,o,p=a.length;i<p;i+=e)j=a[i],k=a[i+1],o=a[i+2],j=j/16383*c,k=k/16383*c,o=o/16383*c,j+=d,k+=f,o+=g,b.vertices.push(new THREE.Vertex(new THREE.Vector3(j,k,o)))})(e[0],8,0);(function(a,b,c){for(var d,e,f=a.length;c<f;c+=b)d=a[c],e=a[c+1],d/=1023,e/=1023,k.push(d,1-e)})(e[0],8,3);(function(a,
-b,c){for(var d,e,f,g=a.length;c<g;c+=b)d=a[c],e=a[c+1],f=a[c+2],d=(d-512)/511,e=(e-512)/511,f=(f-512)/511,j.push(d,e,f)})(e[0],8,5);(function(a){var c,d,e,f,g,i,s,t,u,v=a.length;for(c=0;c<v;c+=3){d=a[c];e=a[c+1];f=a[c+2];g=b;t=d;u=e;i=f;var w=j[3*e],z=j[3*e+1],x=j[3*e+2],A=j[3*f],F=j[3*f+1],E=j[3*f+2];s=new THREE.Vector3(j[3*d],j[3*d+1],j[3*d+2]);w=new THREE.Vector3(w,z,x);A=new THREE.Vector3(A,F,E);g.faces.push(new THREE.Face3(t,u,i,[s,w,A],null,0));g=k[2*d];d=k[2*d+1];i=k[2*e];s=k[2*e+1];t=k[2*
-f];u=k[2*f+1];f=b.faceVertexUvs[0];e=i;i=s;s=[];s.push(new THREE.UV(g,d));s.push(new THREE.UV(e,i));s.push(new THREE.UV(t,u));f.push(s)}})(e[1]);this.computeCentroids();this.computeFaceNormals()};e.prototype=new THREE.Geometry;e.prototype.constructor=e;b(new e)};
+THREE.UTF8Loader.prototype.createModel=function(a,b,c,d,f,g){var e=function(){var b=this;b.materials=[];THREE.Geometry.call(this);var e=THREE.UTF8Loader.prototype.decompressMesh(a),k=[],j=[];(function(a,e,i){for(var j,k,o,p=a.length;i<p;i+=e)j=a[i],k=a[i+1],o=a[i+2],j=j/16383*c,k=k/16383*c,o=o/16383*c,j+=d,k+=f,o+=g,b.vertices.push(new THREE.Vertex(new THREE.Vector3(j,k,o)))})(e[0],8,0);(function(a,b,c){for(var d,e,f=a.length;c<f;c+=b)d=a[c],e=a[c+1],d/=1023,e/=1023,j.push(d,1-e)})(e[0],8,3);(function(a,
+b,c){for(var d,e,f,g=a.length;c<g;c+=b)d=a[c],e=a[c+1],f=a[c+2],d=(d-512)/511,e=(e-512)/511,f=(f-512)/511,k.push(d,e,f)})(e[0],8,5);(function(a){var c,d,e,f,g,i,s,t,u,v=a.length;for(c=0;c<v;c+=3){d=a[c];e=a[c+1];f=a[c+2];g=b;t=d;u=e;i=f;var w=k[3*e],z=k[3*e+1],x=k[3*e+2],A=k[3*f],F=k[3*f+1],E=k[3*f+2];s=new THREE.Vector3(k[3*d],k[3*d+1],k[3*d+2]);w=new THREE.Vector3(w,z,x);A=new THREE.Vector3(A,F,E);g.faces.push(new THREE.Face3(t,u,i,[s,w,A],null,0));g=j[2*d];d=j[2*d+1];i=j[2*e];s=j[2*e+1];t=j[2*
+f];u=j[2*f+1];f=b.faceVertexUvs[0];e=i;i=s;s=[];s.push(new THREE.UV(g,d));s.push(new THREE.UV(e,i));s.push(new THREE.UV(t,u));f.push(s)}})(e[1]);this.computeCentroids();this.computeFaceNormals()};e.prototype=new THREE.Geometry;e.prototype.constructor=e;b(new e)};
 THREE.MarchingCubes=function(a,b){THREE.Object3D.call(this);this.material=b;this.init=function(a){this.resolution=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(3*this.size3);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(3*this.maxCount);this.normalArray=new Float32Array(3*this.maxCount)};this.lerp=function(a,b,f){return a+(b-a)*f};this.VIntX=function(a,b,f,g,e,h,i,j,k,q){e=(e-k)/(q-k);k=this.normal_cache;b[g]=h+e*this.delta;b[g+1]=i;b[g+2]=j;f[g]=this.lerp(k[a],k[a+3],e);f[g+1]=this.lerp(k[a+1],k[a+4],e);f[g+2]=this.lerp(k[a+2],k[a+5],e)};this.VIntY=function(a,b,f,g,e,h,i,j,k,q){e=(e-k)/(q-k);k=this.normal_cache;b[g]=h;b[g+1]=i+e*this.delta;b[g+2]=j;b=a+3*this.yd;
-f[g]=this.lerp(k[a],k[b],e);f[g+1]=this.lerp(k[a+1],k[b+1],e);f[g+2]=this.lerp(k[a+2],k[b+2],e)};this.VIntZ=function(a,b,f,g,e,h,i,j,k,q){e=(e-k)/(q-k);k=this.normal_cache;b[g]=h;b[g+1]=i;b[g+2]=j+e*this.delta;b=a+3*this.zd;f[g]=this.lerp(k[a],k[b],e);f[g+1]=this.lerp(k[a+1],k[b+1],e);f[g+2]=this.lerp(k[a+2],k[b+2],e)};this.compNorm=function(a){var b=3*a;0===this.normal_cache[b]&&(this.normal_cache[b]=this.field[a-1]-this.field[a+1],this.normal_cache[b+1]=this.field[a-this.yd]-this.field[a+this.yd],
-this.normal_cache[b+2]=this.field[a-this.zd]-this.field[a+this.zd])};this.polygonize=function(a,b,f,g,e,h){var i=g+1,j=g+this.yd,k=g+this.zd,q=i+this.yd,l=i+this.zd,n=g+this.yd+this.zd,r=i+this.yd+this.zd,m=0,o=this.field[g],p=this.field[i],s=this.field[j],t=this.field[q],u=this.field[k],v=this.field[l],w=this.field[n],z=this.field[r];o<e&&(m|=1);p<e&&(m|=2);s<e&&(m|=8);t<e&&(m|=4);u<e&&(m|=16);v<e&&(m|=32);w<e&&(m|=128);z<e&&(m|=64);var x=THREE.edgeTable[m];if(0===x)return 0;var A=this.delta,F=a+
-A,E=b+A,A=f+A;x&1&&(this.compNorm(g),this.compNorm(i),this.VIntX(3*g,this.vlist,this.nlist,0,e,a,b,f,o,p));x&2&&(this.compNorm(i),this.compNorm(q),this.VIntY(3*i,this.vlist,this.nlist,3,e,F,b,f,p,t));x&4&&(this.compNorm(j),this.compNorm(q),this.VIntX(3*j,this.vlist,this.nlist,6,e,a,E,f,s,t));x&8&&(this.compNorm(g),this.compNorm(j),this.VIntY(3*g,this.vlist,this.nlist,9,e,a,b,f,o,s));x&16&&(this.compNorm(k),this.compNorm(l),this.VIntX(3*k,this.vlist,this.nlist,12,e,a,b,A,u,v));x&32&&(this.compNorm(l),
-this.compNorm(r),this.VIntY(3*l,this.vlist,this.nlist,15,e,F,b,A,v,z));x&64&&(this.compNorm(n),this.compNorm(r),this.VIntX(3*n,this.vlist,this.nlist,18,e,a,E,A,w,z));x&128&&(this.compNorm(k),this.compNorm(n),this.VIntY(3*k,this.vlist,this.nlist,21,e,a,b,A,u,w));x&256&&(this.compNorm(g),this.compNorm(k),this.VIntZ(3*g,this.vlist,this.nlist,24,e,a,b,f,o,u));x&512&&(this.compNorm(i),this.compNorm(l),this.VIntZ(3*i,this.vlist,this.nlist,27,e,F,b,f,p,v));x&1024&&(this.compNorm(q),this.compNorm(r),this.VIntZ(3*
-q,this.vlist,this.nlist,30,e,F,E,f,t,z));x&2048&&(this.compNorm(j),this.compNorm(n),this.VIntZ(3*j,this.vlist,this.nlist,33,e,a,E,f,s,w));m<<=4;for(e=g=0;-1!=THREE.triTable[m+e];)a=m+e,b=a+1,f=a+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[a],3*THREE.triTable[b],3*THREE.triTable[f],h),e+=3,g++;return g};this.posnormtriv=function(a,b,f,g,e,h){var i=3*this.count;this.positionArray[i]=a[f];this.positionArray[i+1]=a[f+1];this.positionArray[i+2]=a[f+2];this.positionArray[i+3]=a[g];this.positionArray[i+
+this.hasPos=!1;this.positionArray=new Float32Array(3*this.maxCount);this.normalArray=new Float32Array(3*this.maxCount)};this.lerp=function(a,b,f){return a+(b-a)*f};this.VIntX=function(a,b,f,g,e,h,i,k,j,q){e=(e-j)/(q-j);j=this.normal_cache;b[g]=h+e*this.delta;b[g+1]=i;b[g+2]=k;f[g]=this.lerp(j[a],j[a+3],e);f[g+1]=this.lerp(j[a+1],j[a+4],e);f[g+2]=this.lerp(j[a+2],j[a+5],e)};this.VIntY=function(a,b,f,g,e,h,i,k,j,q){e=(e-j)/(q-j);j=this.normal_cache;b[g]=h;b[g+1]=i+e*this.delta;b[g+2]=k;b=a+3*this.yd;
+f[g]=this.lerp(j[a],j[b],e);f[g+1]=this.lerp(j[a+1],j[b+1],e);f[g+2]=this.lerp(j[a+2],j[b+2],e)};this.VIntZ=function(a,b,f,g,e,h,i,k,j,q){e=(e-j)/(q-j);j=this.normal_cache;b[g]=h;b[g+1]=i;b[g+2]=k+e*this.delta;b=a+3*this.zd;f[g]=this.lerp(j[a],j[b],e);f[g+1]=this.lerp(j[a+1],j[b+1],e);f[g+2]=this.lerp(j[a+2],j[b+2],e)};this.compNorm=function(a){var b=3*a;0===this.normal_cache[b]&&(this.normal_cache[b]=this.field[a-1]-this.field[a+1],this.normal_cache[b+1]=this.field[a-this.yd]-this.field[a+this.yd],
+this.normal_cache[b+2]=this.field[a-this.zd]-this.field[a+this.zd])};this.polygonize=function(a,b,f,g,e,h){var i=g+1,k=g+this.yd,j=g+this.zd,q=i+this.yd,l=i+this.zd,n=g+this.yd+this.zd,r=i+this.yd+this.zd,m=0,o=this.field[g],p=this.field[i],s=this.field[k],t=this.field[q],u=this.field[j],v=this.field[l],w=this.field[n],z=this.field[r];o<e&&(m|=1);p<e&&(m|=2);s<e&&(m|=8);t<e&&(m|=4);u<e&&(m|=16);v<e&&(m|=32);w<e&&(m|=128);z<e&&(m|=64);var x=THREE.edgeTable[m];if(0===x)return 0;var A=this.delta,F=a+
+A,E=b+A,A=f+A;x&1&&(this.compNorm(g),this.compNorm(i),this.VIntX(3*g,this.vlist,this.nlist,0,e,a,b,f,o,p));x&2&&(this.compNorm(i),this.compNorm(q),this.VIntY(3*i,this.vlist,this.nlist,3,e,F,b,f,p,t));x&4&&(this.compNorm(k),this.compNorm(q),this.VIntX(3*k,this.vlist,this.nlist,6,e,a,E,f,s,t));x&8&&(this.compNorm(g),this.compNorm(k),this.VIntY(3*g,this.vlist,this.nlist,9,e,a,b,f,o,s));x&16&&(this.compNorm(j),this.compNorm(l),this.VIntX(3*j,this.vlist,this.nlist,12,e,a,b,A,u,v));x&32&&(this.compNorm(l),
+this.compNorm(r),this.VIntY(3*l,this.vlist,this.nlist,15,e,F,b,A,v,z));x&64&&(this.compNorm(n),this.compNorm(r),this.VIntX(3*n,this.vlist,this.nlist,18,e,a,E,A,w,z));x&128&&(this.compNorm(j),this.compNorm(n),this.VIntY(3*j,this.vlist,this.nlist,21,e,a,b,A,u,w));x&256&&(this.compNorm(g),this.compNorm(j),this.VIntZ(3*g,this.vlist,this.nlist,24,e,a,b,f,o,u));x&512&&(this.compNorm(i),this.compNorm(l),this.VIntZ(3*i,this.vlist,this.nlist,27,e,F,b,f,p,v));x&1024&&(this.compNorm(q),this.compNorm(r),this.VIntZ(3*
+q,this.vlist,this.nlist,30,e,F,E,f,t,z));x&2048&&(this.compNorm(k),this.compNorm(n),this.VIntZ(3*k,this.vlist,this.nlist,33,e,a,E,f,s,w));m<<=4;for(e=g=0;-1!=THREE.triTable[m+e];)a=m+e,b=a+1,f=a+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[a],3*THREE.triTable[b],3*THREE.triTable[f],h),e+=3,g++;return g};this.posnormtriv=function(a,b,f,g,e,h){var i=3*this.count;this.positionArray[i]=a[f];this.positionArray[i+1]=a[f+1];this.positionArray[i+2]=a[f+2];this.positionArray[i+3]=a[g];this.positionArray[i+
 4]=a[g+1];this.positionArray[i+5]=a[g+2];this.positionArray[i+6]=a[e];this.positionArray[i+7]=a[e+1];this.positionArray[i+8]=a[e+2];this.normalArray[i]=b[f];this.normalArray[i+1]=b[f+1];this.normalArray[i+2]=b[f+2];this.normalArray[i+3]=b[g];this.normalArray[i+4]=b[g+1];this.normalArray[i+5]=b[g+2];this.normalArray[i+6]=b[e];this.normalArray[i+7]=b[e+1];this.normalArray[i+8]=b[e+2];this.hasNormal=this.hasPos=!0;this.count+=3;this.count>=this.maxCount-3&&h(this)};this.begin=function(){this.count=0;
-this.hasNormal=this.hasPos=!1};this.end=function(a){if(0!==this.count){for(var b=3*this.count;b<this.positionArray.length;b++)this.positionArray[b]=0;a(this)}};this.addBall=function(a,b,f,g,e){var h=this.size*Math.sqrt(g/e),i=f*this.size,j=b*this.size,k=a*this.size,q=Math.floor(i-h);1>q&&(q=1);i=Math.floor(i+h);i>this.size-1&&(i=this.size-1);var l=Math.floor(j-h);1>l&&(l=1);j=Math.floor(j+h);j>this.size-1&&(j=this.size-1);var n=Math.floor(k-h);1>n&&(n=1);h=Math.floor(k+h);h>this.size-1&&(h=this.size-
-1);for(var r,m,o,p,s,t,u,k=q;k<i;k++){o=this.size2*k;s=k/this.size-f;t=s*s;for(q=l;q<j;q++){m=o+this.size*q;r=q/this.size-b;u=r*r;for(r=n;r<h;r++)p=r/this.size-a,p=g/(1.0E-6+p*p+u+t)-e,0<p&&(this.field[m+r]+=p)}}};this.addPlaneX=function(a,b){var f,g,e,h,i,j=this.size,k=this.yd,q=this.zd,l=this.field,n=j*Math.sqrt(a/b);n>j&&(n=j);for(f=0;f<n;f++)if(g=f/j,g*=g,h=a/(1.0E-4+g)-b,0<h)for(g=0;g<j;g++){i=f+g*k;for(e=0;e<j;e++)l[q*e+i]+=h}};this.addPlaneY=function(a,b){var f,g,e,h,i,j,k=this.size,q=this.yd,
-l=this.zd,n=this.field,r=k*Math.sqrt(a/b);r>k&&(r=k);for(g=0;g<r;g++)if(f=g/k,f*=f,h=a/(1.0E-4+f)-b,0<h){i=g*q;for(f=0;f<k;f++){j=i+f;for(e=0;e<k;e++)n[l*e+j]+=h}}};this.addPlaneZ=function(a,b){var f,g,e,h,i,j,k=this.size,q=this.yd,l=this.zd,n=this.field,r=k*Math.sqrt(a/b);r>k&&(r=k);for(e=0;e<r;e++)if(f=e/k,f*=f,h=a/(1.0E-4+f)-b,0<h){i=l*e;for(g=0;g<k;g++){j=i+g*q;for(f=0;f<k;f++)n[j+f]+=h}}};this.reset=function(){var a;for(a=0;a<this.size3;a++)this.normal_cache[3*a]=0,this.field[a]=0};this.render=
-function(a){this.begin();var b,f,g,e,h,i,j,k,q,l=this.size-2;for(e=1;e<l;e++){q=this.size2*e;j=(e-this.halfsize)/this.halfsize;for(g=1;g<l;g++){k=q+this.size*g;i=(g-this.halfsize)/this.halfsize;for(f=1;f<l;f++)h=(f-this.halfsize)/this.halfsize,b=k+f,this.polygonize(h,i,j,b,this.isolation,a)}}this.end(a)};this.generateGeometry=function(){var a=0,b=new THREE.Geometry,f=[];this.render(function(g){var e,h,i,j,k,q,l,n;for(e=0;e<g.count;e++)l=3*e,k=l+1,n=l+2,h=g.positionArray[l],i=g.positionArray[k],j=
-g.positionArray[n],q=new THREE.Vector3(h,i,j),h=g.normalArray[l],i=g.normalArray[k],j=g.normalArray[n],l=new THREE.Vector3(h,i,j),l.normalize(),k=new THREE.Vertex(q),b.vertices.push(k),f.push(l);q=g.count/3;for(e=0;e<q;e++)l=3*(a+e),k=l+1,n=l+2,h=f[l],i=f[k],j=f[n],l=new THREE.Face3(l,k,n,[h,i,j]),b.faces.push(l);a+=q;g.count=0});return b};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(0!==this.count){for(var b=3*this.count;b<this.positionArray.length;b++)this.positionArray[b]=0;a(this)}};this.addBall=function(a,b,f,g,e){var h=this.size*Math.sqrt(g/e),i=f*this.size,k=b*this.size,j=a*this.size,q=Math.floor(i-h);1>q&&(q=1);i=Math.floor(i+h);i>this.size-1&&(i=this.size-1);var l=Math.floor(k-h);1>l&&(l=1);k=Math.floor(k+h);k>this.size-1&&(k=this.size-1);var n=Math.floor(j-h);1>n&&(n=1);h=Math.floor(j+h);h>this.size-1&&(h=this.size-
+1);for(var r,m,o,p,s,t,u,j=q;j<i;j++){o=this.size2*j;s=j/this.size-f;t=s*s;for(q=l;q<k;q++){m=o+this.size*q;r=q/this.size-b;u=r*r;for(r=n;r<h;r++)p=r/this.size-a,p=g/(1.0E-6+p*p+u+t)-e,0<p&&(this.field[m+r]+=p)}}};this.addPlaneX=function(a,b){var f,g,e,h,i,k=this.size,j=this.yd,q=this.zd,l=this.field,n=k*Math.sqrt(a/b);n>k&&(n=k);for(f=0;f<n;f++)if(g=f/k,g*=g,h=a/(1.0E-4+g)-b,0<h)for(g=0;g<k;g++){i=f+g*j;for(e=0;e<k;e++)l[q*e+i]+=h}};this.addPlaneY=function(a,b){var f,g,e,h,i,k,j=this.size,q=this.yd,
+l=this.zd,n=this.field,r=j*Math.sqrt(a/b);r>j&&(r=j);for(g=0;g<r;g++)if(f=g/j,f*=f,h=a/(1.0E-4+f)-b,0<h){i=g*q;for(f=0;f<j;f++){k=i+f;for(e=0;e<j;e++)n[l*e+k]+=h}}};this.addPlaneZ=function(a,b){var f,g,e,h,i,k,j=this.size,q=this.yd,l=this.zd,n=this.field,r=j*Math.sqrt(a/b);r>j&&(r=j);for(e=0;e<r;e++)if(f=e/j,f*=f,h=a/(1.0E-4+f)-b,0<h){i=l*e;for(g=0;g<j;g++){k=i+g*q;for(f=0;f<j;f++)n[k+f]+=h}}};this.reset=function(){var a;for(a=0;a<this.size3;a++)this.normal_cache[3*a]=0,this.field[a]=0};this.render=
+function(a){this.begin();var b,f,g,e,h,i,k,j,q,l=this.size-2;for(e=1;e<l;e++){q=this.size2*e;k=(e-this.halfsize)/this.halfsize;for(g=1;g<l;g++){j=q+this.size*g;i=(g-this.halfsize)/this.halfsize;for(f=1;f<l;f++)h=(f-this.halfsize)/this.halfsize,b=j+f,this.polygonize(h,i,k,b,this.isolation,a)}}this.end(a)};this.generateGeometry=function(){var a=0,b=new THREE.Geometry,f=[];this.render(function(g){var e,h,i,k,j,q,l,n;for(e=0;e<g.count;e++)l=3*e,j=l+1,n=l+2,h=g.positionArray[l],i=g.positionArray[j],k=
+g.positionArray[n],q=new THREE.Vector3(h,i,k),h=g.normalArray[l],i=g.normalArray[j],k=g.normalArray[n],l=new THREE.Vector3(h,i,k),l.normalize(),j=new THREE.Vertex(q),b.vertices.push(j),f.push(l);q=g.count/3;for(e=0;e<q;e++)l=3*(a+e),j=l+1,n=l+2,h=f[l],i=f[j],k=f[n],l=new THREE.Face3(l,j,n,[h,i,k]),b.faces.push(l);a+=q;g.count=0});return b};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]);
@@ -382,38 +381,38 @@ THREE.triTable=new Int32Array([-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0
 2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,3,8,9,1,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,9,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,3,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1]);THREE.LensFlare=function(a,b,c,d,f){THREE.Object3D.call(this);this.lensFlares=[];this.positionScreen=new THREE.Vector3;this.customUpdateCallback=void 0;void 0!==a&&this.add(a,b,c,d,f)};THREE.LensFlare.prototype=new THREE.Object3D;THREE.LensFlare.prototype.constructor=THREE.LensFlare;
 THREE.LensFlare.prototype.supr=THREE.Object3D.prototype;THREE.LensFlare.prototype.add=function(a,b,c,d,f,g){void 0===b&&(b=-1);void 0===c&&(c=0);void 0===g&&(g=1);void 0===f&&(f=new THREE.Color(16777215));if(void 0===d)d=THREE.NormalBlending;c=Math.min(c,Math.max(0,c));this.lensFlares.push({texture:a,size:b,distance:c,x:0,y:0,z:0,scale:1,rotation:1,opacity:g,color:f,blending:d})};
 THREE.LensFlare.prototype.updateLensFlares=function(){var a,b=this.lensFlares.length,c,d=2*-this.positionScreen.x,f=2*-this.positionScreen.y;for(a=0;a<b;a++)c=this.lensFlares[a],c.x=this.positionScreen.x+d*c.distance,c.y=this.positionScreen.y+f*c.distance,c.wantedRotation=0.25*c.x*Math.PI,c.rotation+=0.25*(c.wantedRotation-c.rotation)};
-THREE.LensFlarePlugin=function(){function a(a){var c=b.createProgram(),d=b.createShader(b.FRAGMENT_SHADER),e=b.createShader(b.VERTEX_SHADER);b.shaderSource(d,a.fragmentShader);b.shaderSource(e,a.vertexShader);b.compileShader(d);b.compileShader(e);b.attachShader(c,d);b.attachShader(c,e);b.linkProgram(c);return c}var b,c,d,f,g,e,h,i,j,k,q,l,n;this.init=function(r){b=r.context;c=r;d=new Float32Array(16);f=new Uint16Array(6);r=0;d[r++]=-1;d[r++]=-1;d[r++]=0;d[r++]=0;d[r++]=1;d[r++]=-1;d[r++]=1;d[r++]=
+THREE.LensFlarePlugin=function(){function a(a){var c=b.createProgram(),d=b.createShader(b.FRAGMENT_SHADER),e=b.createShader(b.VERTEX_SHADER);b.shaderSource(d,a.fragmentShader);b.shaderSource(e,a.vertexShader);b.compileShader(d);b.compileShader(e);b.attachShader(c,d);b.attachShader(c,e);b.linkProgram(c);return c}var b,c,d,f,g,e,h,i,k,j,q,l,n;this.init=function(r){b=r.context;c=r;d=new Float32Array(16);f=new Uint16Array(6);r=0;d[r++]=-1;d[r++]=-1;d[r++]=0;d[r++]=0;d[r++]=1;d[r++]=-1;d[r++]=1;d[r++]=
 0;d[r++]=1;d[r++]=1;d[r++]=1;d[r++]=1;d[r++]=-1;d[r++]=1;d[r++]=0;d[r++]=1;r=0;f[r++]=0;f[r++]=1;f[r++]=2;f[r++]=0;f[r++]=2;f[r++]=3;g=b.createBuffer();e=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,g);b.bufferData(b.ARRAY_BUFFER,d,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,e);b.bufferData(b.ELEMENT_ARRAY_BUFFER,f,b.STATIC_DRAW);h=b.createTexture();i=b.createTexture();b.bindTexture(b.TEXTURE_2D,h);b.texImage2D(b.TEXTURE_2D,0,b.RGB,16,16,0,b.RGB,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,
 b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);b.bindTexture(b.TEXTURE_2D,i);b.texImage2D(b.TEXTURE_2D,0,b.RGBA,16,16,0,b.RGBA,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);
-b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);0>=b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)?(j=!1,k=a(THREE.ShaderFlares.lensFlare)):(j=!0,k=a(THREE.ShaderFlares.lensFlareVertexTexture));q={};l={};q.vertex=b.getAttribLocation(k,"position");q.uv=b.getAttribLocation(k,"uv");l.renderType=b.getUniformLocation(k,"renderType");l.map=b.getUniformLocation(k,"map");l.occlusionMap=b.getUniformLocation(k,"occlusionMap");l.opacity=b.getUniformLocation(k,"opacity");l.color=b.getUniformLocation(k,
-"color");l.scale=b.getUniformLocation(k,"scale");l.rotation=b.getUniformLocation(k,"rotation");l.screenPosition=b.getUniformLocation(k,"screenPosition");n=!1};this.render=function(a,d,f,p){var a=a.__webglFlares,s=a.length;if(s){var t=new THREE.Vector3,u=p/f,v=0.5*f,w=0.5*p,z=16/p,x=new THREE.Vector2(z*u,z),A=new THREE.Vector3(1,1,0),F=new THREE.Vector2(1,1),E=l,z=q;b.useProgram(k);n||(b.enableVertexAttribArray(q.vertex),b.enableVertexAttribArray(q.uv),n=!0);b.uniform1i(E.occlusionMap,0);b.uniform1i(E.map,
-1);b.bindBuffer(b.ARRAY_BUFFER,g);b.vertexAttribPointer(z.vertex,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(z.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,e);b.disable(b.CULL_FACE);b.depthMask(!1);var J,G,B,H,D;for(J=0;J<s;J++)if(z=16/p,x.set(z*u,z),H=a[J],t.set(H.matrixWorld.n14,H.matrixWorld.n24,H.matrixWorld.n34),d.matrixWorldInverse.multiplyVector3(t),d.projectionMatrix.multiplyVector3(t),A.copy(t),F.x=A.x*v+v,F.y=A.y*w+w,j||0<F.x&&F.x<f&&0<F.y&&F.y<p){b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,
+b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);0>=b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)?(k=!1,j=a(THREE.ShaderFlares.lensFlare)):(k=!0,j=a(THREE.ShaderFlares.lensFlareVertexTexture));q={};l={};q.vertex=b.getAttribLocation(j,"position");q.uv=b.getAttribLocation(j,"uv");l.renderType=b.getUniformLocation(j,"renderType");l.map=b.getUniformLocation(j,"map");l.occlusionMap=b.getUniformLocation(j,"occlusionMap");l.opacity=b.getUniformLocation(j,"opacity");l.color=b.getUniformLocation(j,
+"color");l.scale=b.getUniformLocation(j,"scale");l.rotation=b.getUniformLocation(j,"rotation");l.screenPosition=b.getUniformLocation(j,"screenPosition");n=!1};this.render=function(a,d,f,p){var a=a.__webglFlares,s=a.length;if(s){var t=new THREE.Vector3,u=p/f,v=0.5*f,w=0.5*p,z=16/p,x=new THREE.Vector2(z*u,z),A=new THREE.Vector3(1,1,0),F=new THREE.Vector2(1,1),E=l,z=q;b.useProgram(j);n||(b.enableVertexAttribArray(q.vertex),b.enableVertexAttribArray(q.uv),n=!0);b.uniform1i(E.occlusionMap,0);b.uniform1i(E.map,
+1);b.bindBuffer(b.ARRAY_BUFFER,g);b.vertexAttribPointer(z.vertex,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(z.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,e);b.disable(b.CULL_FACE);b.depthMask(!1);var J,G,B,H,D;for(J=0;J<s;J++)if(z=16/p,x.set(z*u,z),H=a[J],t.set(H.matrixWorld.n14,H.matrixWorld.n24,H.matrixWorld.n34),d.matrixWorldInverse.multiplyVector3(t),d.projectionMatrix.multiplyVector3(t),A.copy(t),F.x=A.x*v+v,F.y=A.y*w+w,k||0<F.x&&F.x<f&&0<F.y&&F.y<p){b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,
 h);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,F.x-8,F.y-8,16,16,0);b.uniform1i(E.renderType,0);b.uniform2f(E.scale,x.x,x.y);b.uniform3f(E.screenPosition,A.x,A.y,A.z);b.disable(b.BLEND);b.enable(b.DEPTH_TEST);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);b.activeTexture(b.TEXTURE0);b.bindTexture(b.TEXTURE_2D,i);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGBA,F.x-8,F.y-8,16,16,0);b.uniform1i(E.renderType,1);b.disable(b.DEPTH_TEST);b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,h);b.drawElements(b.TRIANGLES,
 6,b.UNSIGNED_SHORT,0);H.positionScreen.copy(A);H.customUpdateCallback?H.customUpdateCallback(H):H.updateLensFlares();b.uniform1i(E.renderType,2);b.enable(b.BLEND);for(G=0,B=H.lensFlares.length;G<B;G++)if(D=H.lensFlares[G],0.0010<D.opacity&&0.0010<D.scale)A.x=D.x,A.y=D.y,A.z=D.z,z=D.size*D.scale/p,x.x=z*u,x.y=z,b.uniform3f(E.screenPosition,A.x,A.y,A.z),b.uniform2f(E.scale,x.x,x.y),b.uniform1f(E.rotation,D.rotation),b.uniform1f(E.opacity,D.opacity),b.uniform3f(E.color,D.color.r,D.color.g,D.color.b),
 c.setBlending(D.blending),c.setTexture(D.texture,1),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0)}b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(!0)}}};
 THREE.ShadowMapPlugin=function(){var a,b,c,d,f=new THREE.Frustum,g=new THREE.Matrix4,e=new THREE.Vector3,h=new THREE.Vector3;this.init=function(e){a=e.context;b=e;var e=THREE.ShaderLib.depthRGBA,f=THREE.UniformsUtils.clone(e.uniforms);c=new THREE.ShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:f});d=new THREE.ShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:f,morphTargets:!0});c._shadowPass=!0;d._shadowPass=!0};this.render=function(a,
-c){b.shadowMapEnabled&&b.shadowMapAutoUpdate&&this.update(a,c)};this.update=function(i,j){var k,q,l,n,r,m,o,p,s,t=[];n=0;a.clearColor(1,1,1,1);a.disable(a.BLEND);b.shadowMapCullFrontFaces&&a.cullFace(a.FRONT);b.setDepthTest(!0);for(k=0,q=i.lights.length;k<q;k++)if(l=i.lights[k],l.castShadow)if(l instanceof THREE.DirectionalLight&&l.shadowCascade)for(r=0;r<l.shadowCascadeCount;r++){var u;if(l.shadowCascadeArray[r])u=l.shadowCascadeArray[r];else{s=l;o=r;u=new THREE.DirectionalLight;u.isVirtual=!0;u.onlyShadow=
+c){b.shadowMapEnabled&&b.shadowMapAutoUpdate&&this.update(a,c)};this.update=function(i,k){var j,q,l,n,r,m,o,p,s,t=[];n=0;a.clearColor(1,1,1,1);a.disable(a.BLEND);b.shadowMapCullFrontFaces&&a.cullFace(a.FRONT);b.setDepthTest(!0);for(j=0,q=i.lights.length;j<q;j++)if(l=i.lights[j],l.castShadow)if(l instanceof THREE.DirectionalLight&&l.shadowCascade)for(r=0;r<l.shadowCascadeCount;r++){var u;if(l.shadowCascadeArray[r])u=l.shadowCascadeArray[r];else{s=l;o=r;u=new THREE.DirectionalLight;u.isVirtual=!0;u.onlyShadow=
 !0;u.castShadow=!0;u.shadowCameraNear=s.shadowCameraNear;u.shadowCameraFar=s.shadowCameraFar;u.shadowCameraLeft=s.shadowCameraLeft;u.shadowCameraRight=s.shadowCameraRight;u.shadowCameraBottom=s.shadowCameraBottom;u.shadowCameraTop=s.shadowCameraTop;u.shadowCameraVisible=s.shadowCameraVisible;u.shadowDarkness=s.shadowDarkness;u.shadowBias=s.shadowCascadeBias[o];u.shadowMapWidth=s.shadowCascadeWidth[o];u.shadowMapHeight=s.shadowCascadeHeight[o];u.pointsWorld=[];u.pointsFrustum=[];p=u.pointsWorld;m=
-u.pointsFrustum;for(var v=0;8>v;v++)p[v]=new THREE.Vector3,m[v]=new THREE.Vector3;p=s.shadowCascadeNearZ[o];s=s.shadowCascadeFarZ[o];m[0].set(-1,-1,p);m[1].set(1,-1,p);m[2].set(-1,1,p);m[3].set(1,1,p);m[4].set(-1,-1,s);m[5].set(1,-1,s);m[6].set(-1,1,s);m[7].set(1,1,s);u.originalCamera=j;m=new THREE.Gyroscope;m.position=l.shadowCascadeOffset;m.add(u);m.add(u.target);j.add(m);l.shadowCascadeArray[r]=u;console.log("Created virtualLight",u)}o=l;p=r;s=o.shadowCascadeArray[p];s.position.copy(o.position);
-s.target.position.copy(o.target.position);s.lookAt(s.target);s.shadowCameraVisible=o.shadowCameraVisible;s.shadowDarkness=o.shadowDarkness;s.shadowBias=o.shadowCascadeBias[p];m=o.shadowCascadeNearZ[p];o=o.shadowCascadeFarZ[p];s=s.pointsFrustum;s[0].z=m;s[1].z=m;s[2].z=m;s[3].z=m;s[4].z=o;s[5].z=o;s[6].z=o;s[7].z=o;t[n]=u;n++}else t[n]=l,n++;for(k=0,q=t.length;k<q;k++){l=t[k];if(!l.shadowMap)l.shadowMap=new THREE.WebGLRenderTarget(l.shadowMapWidth,l.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,
+u.pointsFrustum;for(var v=0;8>v;v++)p[v]=new THREE.Vector3,m[v]=new THREE.Vector3;p=s.shadowCascadeNearZ[o];s=s.shadowCascadeFarZ[o];m[0].set(-1,-1,p);m[1].set(1,-1,p);m[2].set(-1,1,p);m[3].set(1,1,p);m[4].set(-1,-1,s);m[5].set(1,-1,s);m[6].set(-1,1,s);m[7].set(1,1,s);u.originalCamera=k;m=new THREE.Gyroscope;m.position=l.shadowCascadeOffset;m.add(u);m.add(u.target);k.add(m);l.shadowCascadeArray[r]=u;console.log("Created virtualLight",u)}o=l;p=r;s=o.shadowCascadeArray[p];s.position.copy(o.position);
+s.target.position.copy(o.target.position);s.lookAt(s.target);s.shadowCameraVisible=o.shadowCameraVisible;s.shadowDarkness=o.shadowDarkness;s.shadowBias=o.shadowCascadeBias[p];m=o.shadowCascadeNearZ[p];o=o.shadowCascadeFarZ[p];s=s.pointsFrustum;s[0].z=m;s[1].z=m;s[2].z=m;s[3].z=m;s[4].z=o;s[5].z=o;s[6].z=o;s[7].z=o;t[n]=u;n++}else t[n]=l,n++;for(j=0,q=t.length;j<q;j++){l=t[j];if(!l.shadowMap)l.shadowMap=new THREE.WebGLRenderTarget(l.shadowMapWidth,l.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,
 format:THREE.RGBAFormat}),l.shadowMapSize=new THREE.Vector2(l.shadowMapWidth,l.shadowMapHeight),l.shadowMatrix=new THREE.Matrix4;if(!l.shadowCamera){if(l instanceof THREE.SpotLight)l.shadowCamera=new THREE.PerspectiveCamera(l.shadowCameraFov,l.shadowMapWidth/l.shadowMapHeight,l.shadowCameraNear,l.shadowCameraFar);else if(l instanceof THREE.DirectionalLight)l.shadowCamera=new THREE.OrthographicCamera(l.shadowCameraLeft,l.shadowCameraRight,l.shadowCameraTop,l.shadowCameraBottom,l.shadowCameraNear,l.shadowCameraFar);
-else{console.error("Unsupported light type for shadow");continue}i.add(l.shadowCamera);b.autoUpdateScene&&i.updateMatrixWorld()}if(l.shadowCameraVisible&&!l.cameraHelper)l.cameraHelper=new THREE.CameraHelper(l.shadowCamera),l.shadowCamera.add(l.cameraHelper);if(l.isVirtual&&u.originalCamera==j){r=j;n=l.shadowCamera;m=l.pointsFrustum;s=l.pointsWorld;e.set(Infinity,Infinity,Infinity);h.set(-Infinity,-Infinity,-Infinity);for(o=0;8>o;o++){p=s[o];p.copy(m[o]);THREE.ShadowMapPlugin.__projector.unprojectVector(p,
+else{console.error("Unsupported light type for shadow");continue}i.add(l.shadowCamera);b.autoUpdateScene&&i.updateMatrixWorld()}if(l.shadowCameraVisible&&!l.cameraHelper)l.cameraHelper=new THREE.CameraHelper(l.shadowCamera),l.shadowCamera.add(l.cameraHelper);if(l.isVirtual&&u.originalCamera==k){r=k;n=l.shadowCamera;m=l.pointsFrustum;s=l.pointsWorld;e.set(Infinity,Infinity,Infinity);h.set(-Infinity,-Infinity,-Infinity);for(o=0;8>o;o++){p=s[o];p.copy(m[o]);THREE.ShadowMapPlugin.__projector.unprojectVector(p,
 r);n.matrixWorldInverse.multiplyVector3(p);if(p.x<e.x)e.x=p.x;if(p.x>h.x)h.x=p.x;if(p.y<e.y)e.y=p.y;if(p.y>h.y)h.y=p.y;if(p.z<e.z)e.z=p.z;if(p.z>h.z)h.z=p.z}n.left=e.x;n.right=h.x;n.top=h.y;n.bottom=e.y;n.updateProjectionMatrix()}n=l.shadowMap;m=l.shadowMatrix;r=l.shadowCamera;r.position.copy(l.matrixWorld.getPosition());r.lookAt(l.target.matrixWorld.getPosition());r.updateMatrixWorld();r.matrixWorldInverse.getInverse(r.matrixWorld);if(l.cameraHelper)l.cameraHelper.lines.visible=l.shadowCameraVisible;
 l.shadowCameraVisible&&l.cameraHelper.update(l.shadowCamera);m.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);m.multiplySelf(r.projectionMatrix);m.multiplySelf(r.matrixWorldInverse);if(!r._viewMatrixArray)r._viewMatrixArray=new Float32Array(16);r.matrixWorldInverse.flattenToArray(r._viewMatrixArray);if(!r._projectionMatrixArray)r._projectionMatrixArray=new Float32Array(16);r.projectionMatrix.flattenToArray(r._projectionMatrixArray);g.multiply(r.projectionMatrix,r.matrixWorldInverse);f.setFromMatrix(g);
 b.setRenderTarget(n);b.clear();s=i.__webglObjects;for(l=0,n=s.length;l<n;l++)if(o=s[l],m=o.object,o.render=!1,m.visible&&m.castShadow&&(!(m instanceof THREE.Mesh)||!m.frustumCulled||f.contains(m)))m.matrixWorld.flattenToArray(m._objectMatrixArray),m._modelViewMatrix.multiplyToArray(r.matrixWorldInverse,m.matrixWorld,m._modelViewMatrixArray),o.render=!0;for(l=0,n=s.length;l<n;l++)if(o=s[l],o.render)m=o.object,o=o.buffer,b.setObjectFaces(m),p=m.customDepthMaterial?m.customDepthMaterial:m.geometry.morphTargets.length?
-d:c,o instanceof THREE.BufferGeometry?b.renderBufferDirect(r,i.lights,null,p,o,m):b.renderBuffer(r,i.lights,null,p,o,m);s=i.__webglObjectsImmediate;for(l=0,n=s.length;l<n;l++)o=s[l],m=o.object,m.visible&&m.castShadow&&(m.matrixAutoUpdate&&m.matrixWorld.flattenToArray(m._objectMatrixArray),m._modelViewMatrix.multiplyToArray(r.matrixWorldInverse,m.matrixWorld,m._modelViewMatrixArray),b.renderImmediateObject(r,i.lights,null,c,m))}k=b.getClearColor();q=b.getClearAlpha();a.clearColor(k.r,k.g,k.b,q);a.enable(a.BLEND);
+d:c,o instanceof THREE.BufferGeometry?b.renderBufferDirect(r,i.lights,null,p,o,m):b.renderBuffer(r,i.lights,null,p,o,m);s=i.__webglObjectsImmediate;for(l=0,n=s.length;l<n;l++)o=s[l],m=o.object,m.visible&&m.castShadow&&(m.matrixAutoUpdate&&m.matrixWorld.flattenToArray(m._objectMatrixArray),m._modelViewMatrix.multiplyToArray(r.matrixWorldInverse,m.matrixWorld,m._modelViewMatrixArray),b.renderImmediateObject(r,i.lights,null,c,m))}j=b.getClearColor();q=b.getClearAlpha();a.clearColor(j.r,j.g,j.b,q);a.enable(a.BLEND);
 b.shadowMapCullFrontFaces&&a.cullFace(a.BACK)}};THREE.ShadowMapPlugin.__projector=new THREE.Projector;
-THREE.SpritePlugin=function(){function a(a,b){return b.z-a.z}var b,c,d,f,g,e,h,i,j,k;this.init=function(a){b=a.context;c=a;d=new Float32Array(16);f=new Uint16Array(6);a=0;d[a++]=-1;d[a++]=-1;d[a++]=0;d[a++]=1;d[a++]=1;d[a++]=-1;d[a++]=1;d[a++]=1;d[a++]=1;d[a++]=1;d[a++]=1;d[a++]=0;d[a++]=-1;d[a++]=1;d[a++]=0;a=d[a++]=0;f[a++]=0;f[a++]=1;f[a++]=2;f[a++]=0;f[a++]=2;f[a++]=3;g=b.createBuffer();e=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,g);b.bufferData(b.ARRAY_BUFFER,d,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,
-e);b.bufferData(b.ELEMENT_ARRAY_BUFFER,f,b.STATIC_DRAW);var a=THREE.ShaderSprite.sprite,l=b.createProgram(),n=b.createShader(b.FRAGMENT_SHADER),r=b.createShader(b.VERTEX_SHADER);b.shaderSource(n,a.fragmentShader);b.shaderSource(r,a.vertexShader);b.compileShader(n);b.compileShader(r);b.attachShader(l,n);b.attachShader(l,r);b.linkProgram(l);h=l;i={};j={};i.position=b.getAttribLocation(h,"position");i.uv=b.getAttribLocation(h,"uv");j.uvOffset=b.getUniformLocation(h,"uvOffset");j.uvScale=b.getUniformLocation(h,
-"uvScale");j.rotation=b.getUniformLocation(h,"rotation");j.scale=b.getUniformLocation(h,"scale");j.alignment=b.getUniformLocation(h,"alignment");j.color=b.getUniformLocation(h,"color");j.map=b.getUniformLocation(h,"map");j.opacity=b.getUniformLocation(h,"opacity");j.useScreenCoordinates=b.getUniformLocation(h,"useScreenCoordinates");j.affectedByDistance=b.getUniformLocation(h,"affectedByDistance");j.screenPosition=b.getUniformLocation(h,"screenPosition");j.modelViewMatrix=b.getUniformLocation(h,"modelViewMatrix");
-j.projectionMatrix=b.getUniformLocation(h,"projectionMatrix");k=!1};this.render=function(d,f,n,r){var d=d.__webglSprites,m=d.length;if(m){var o=i,p=j,s=r/n,n=0.5*n,t=0.5*r,u=!0;b.useProgram(h);k||(b.enableVertexAttribArray(o.position),b.enableVertexAttribArray(o.uv),k=!0);b.disable(b.CULL_FACE);b.enable(b.BLEND);b.depthMask(!0);b.bindBuffer(b.ARRAY_BUFFER,g);b.vertexAttribPointer(o.position,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(o.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,e);b.uniformMatrix4fv(p.projectionMatrix,
+THREE.SpritePlugin=function(){function a(a,b){return b.z-a.z}var b,c,d,f,g,e,h,i,k,j;this.init=function(a){b=a.context;c=a;d=new Float32Array(16);f=new Uint16Array(6);a=0;d[a++]=-1;d[a++]=-1;d[a++]=0;d[a++]=1;d[a++]=1;d[a++]=-1;d[a++]=1;d[a++]=1;d[a++]=1;d[a++]=1;d[a++]=1;d[a++]=0;d[a++]=-1;d[a++]=1;d[a++]=0;a=d[a++]=0;f[a++]=0;f[a++]=1;f[a++]=2;f[a++]=0;f[a++]=2;f[a++]=3;g=b.createBuffer();e=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,g);b.bufferData(b.ARRAY_BUFFER,d,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,
+e);b.bufferData(b.ELEMENT_ARRAY_BUFFER,f,b.STATIC_DRAW);var a=THREE.ShaderSprite.sprite,l=b.createProgram(),n=b.createShader(b.FRAGMENT_SHADER),r=b.createShader(b.VERTEX_SHADER);b.shaderSource(n,a.fragmentShader);b.shaderSource(r,a.vertexShader);b.compileShader(n);b.compileShader(r);b.attachShader(l,n);b.attachShader(l,r);b.linkProgram(l);h=l;i={};k={};i.position=b.getAttribLocation(h,"position");i.uv=b.getAttribLocation(h,"uv");k.uvOffset=b.getUniformLocation(h,"uvOffset");k.uvScale=b.getUniformLocation(h,
+"uvScale");k.rotation=b.getUniformLocation(h,"rotation");k.scale=b.getUniformLocation(h,"scale");k.alignment=b.getUniformLocation(h,"alignment");k.color=b.getUniformLocation(h,"color");k.map=b.getUniformLocation(h,"map");k.opacity=b.getUniformLocation(h,"opacity");k.useScreenCoordinates=b.getUniformLocation(h,"useScreenCoordinates");k.affectedByDistance=b.getUniformLocation(h,"affectedByDistance");k.screenPosition=b.getUniformLocation(h,"screenPosition");k.modelViewMatrix=b.getUniformLocation(h,"modelViewMatrix");
+k.projectionMatrix=b.getUniformLocation(h,"projectionMatrix");j=!1};this.render=function(d,f,n,r){var d=d.__webglSprites,m=d.length;if(m){var o=i,p=k,s=r/n,n=0.5*n,t=0.5*r,u=!0;b.useProgram(h);j||(b.enableVertexAttribArray(o.position),b.enableVertexAttribArray(o.uv),j=!0);b.disable(b.CULL_FACE);b.enable(b.BLEND);b.depthMask(!0);b.bindBuffer(b.ARRAY_BUFFER,g);b.vertexAttribPointer(o.position,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(o.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,e);b.uniformMatrix4fv(p.projectionMatrix,
 !1,f._projectionMatrixArray);b.activeTexture(b.TEXTURE0);b.uniform1i(p.map,0);for(var v,w=[],o=0;o<m;o++)if(v=d[o],v.visible&&0!==v.opacity)v.useScreenCoordinates?v.z=-v.position.z:(v._modelViewMatrix.multiplyToArray(f.matrixWorldInverse,v.matrixWorld,v._modelViewMatrixArray),v.z=-v._modelViewMatrix.n34);d.sort(a);for(o=0;o<m;o++)v=d[o],v.visible&&0!==v.opacity&&v.map&&v.map.image&&v.map.image.width&&(v.useScreenCoordinates?(b.uniform1i(p.useScreenCoordinates,1),b.uniform3f(p.screenPosition,(v.position.x-
 n)/n,(t-v.position.y)/t,Math.max(0,Math.min(1,v.position.z)))):(b.uniform1i(p.useScreenCoordinates,0),b.uniform1i(p.affectedByDistance,v.affectedByDistance?1:0),b.uniformMatrix4fv(p.modelViewMatrix,!1,v._modelViewMatrixArray)),f=v.map.image.width/(v.scaleByViewport?r:1),w[0]=f*s*v.scale.x,w[1]=f*v.scale.y,b.uniform2f(p.uvScale,v.uvScale.x,v.uvScale.y),b.uniform2f(p.uvOffset,v.uvOffset.x,v.uvOffset.y),b.uniform2f(p.alignment,v.alignment.x,v.alignment.y),b.uniform1f(p.opacity,v.opacity),b.uniform3f(p.color,
 v.color.r,v.color.g,v.color.b),b.uniform1f(p.rotation,v.rotation),b.uniform2fv(p.scale,w),v.mergeWith3D&&!u?(b.enable(b.DEPTH_TEST),u=!0):!v.mergeWith3D&&u&&(b.disable(b.DEPTH_TEST),u=!1),c.setBlending(v.blending),c.setTexture(v.map,0),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0));b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(!0)}}};
-if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoUpdateScene=!1;var b=this,c=this.setSize,d=this.render,f=new THREE.PerspectiveCamera,g=new THREE.PerspectiveCamera,e=new THREE.Matrix4,h=new THREE.Matrix4,i,j,k,q;f.matrixAutoUpdate=g.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},l=new THREE.WebGLRenderTarget(512,512,a),n=new THREE.WebGLRenderTarget(512,512,a),r=new THREE.PerspectiveCamera(53,
+if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoUpdateScene=!1;var b=this,c=this.setSize,d=this.render,f=new THREE.PerspectiveCamera,g=new THREE.PerspectiveCamera,e=new THREE.Matrix4,h=new THREE.Matrix4,i,k,j,q;f.matrixAutoUpdate=g.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},l=new THREE.WebGLRenderTarget(512,512,a),n=new THREE.WebGLRenderTarget(512,512,a),r=new THREE.PerspectiveCamera(53,
 1,1,1E4);r.position.z=2;var a=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:l},mapRight:{type:"t",value:1,texture:n}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D mapLeft;\nuniform sampler2D mapRight;\nvarying vec2 vUv;\nvoid main() {\nvec4 colorL, colorR;\nvec2 uv = vUv;\ncolorL = texture2D( mapLeft, uv );\ncolorR = texture2D( mapRight, uv );\ngl_FragColor = vec4( colorL.g * 0.7 + colorL.b * 0.3, colorR.g, colorR.b, colorL.a + colorR.a ) * 1.1;\n}"}),
-m=new THREE.Scene;m.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),a));m.add(r);this.setSize=function(a,d){c.call(b,a,d);l.width=a;l.height=d;n.width=a;n.height=d};this.render=function(a,c){a.updateMatrixWorld();if(i!==c.aspect||j!==c.near||k!==c.far||q!==c.fov){i=c.aspect;j=c.near;k=c.far;q=c.fov;var s=c.projectionMatrix.clone(),t=0.5*(125/30),u=t*j/125,v=j*Math.tan(q*Math.PI/360),w;e.n14=t;h.n14=-t;t=-v*i+u;w=v*i+u;s.n11=2*j/(w-t);s.n13=(w+t)/(w-t);f.projectionMatrix.copy(s);t=-v*i-u;w=v*i-u;s.n11=
-2*j/(w-t);s.n13=(w+t)/(w-t);g.projectionMatrix.copy(s)}f.matrixWorld.copy(c.matrixWorld).multiplySelf(h);f.position.copy(c.position);f.near=c.near;f.far=c.far;d.call(b,a,f,l,!0);g.matrixWorld.copy(c.matrixWorld).multiplySelf(e);g.position.copy(c.position);g.near=c.near;g.far=c.far;d.call(b,a,g,n,!0);m.updateMatrixWorld();d.call(b,m,r)}};
+m=new THREE.Scene;m.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),a));m.add(r);this.setSize=function(a,d){c.call(b,a,d);l.width=a;l.height=d;n.width=a;n.height=d};this.render=function(a,c){a.updateMatrixWorld();if(i!==c.aspect||k!==c.near||j!==c.far||q!==c.fov){i=c.aspect;k=c.near;j=c.far;q=c.fov;var s=c.projectionMatrix.clone(),t=0.5*(125/30),u=t*k/125,v=k*Math.tan(q*Math.PI/360),w;e.n14=t;h.n14=-t;t=-v*i+u;w=v*i+u;s.n11=2*k/(w-t);s.n13=(w+t)/(w-t);f.projectionMatrix.copy(s);t=-v*i-u;w=v*i-u;s.n11=
+2*k/(w-t);s.n13=(w+t)/(w-t);g.projectionMatrix.copy(s)}f.matrixWorld.copy(c.matrixWorld).multiplySelf(h);f.position.copy(c.position);f.near=c.near;f.far=c.far;d.call(b,a,f,l,!0);g.matrixWorld.copy(c.matrixWorld).multiplySelf(e);g.position.copy(c.position);g.near=c.near;g.far=c.far;d.call(b,a,g,n,!0);m.updateMatrixWorld();d.call(b,m,r)}};
 if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoClear=!1;var b=this,c=this.setSize,d=this.render,f,g,e=new THREE.PerspectiveCamera;e.target=new THREE.Vector3(0,0,0);var h=new THREE.PerspectiveCamera;h.target=new THREE.Vector3(0,0,0);b.separation=10;if(a&&void 0!==a.separation)b.separation=a.separation;this.setSize=function(a,d){c.call(b,a,d);f=a/2;g=d};this.render=function(a,c){this.clear();e.fov=c.fov;e.aspect=0.5*c.aspect;e.near=c.near;e.far=
 c.far;e.updateProjectionMatrix();e.position.copy(c.position);e.target.copy(c.target);e.translateX(b.separation);e.lookAt(e.target);h.projectionMatrix=e.projectionMatrix;h.position.copy(c.position);h.target.copy(c.target);h.translateX(-b.separation);h.lookAt(h.target);this.setViewport(0,0,f,g);d.call(b,a,e);this.setViewport(f,0,f,g);d.call(b,a,h,!1)}};
 THREE.ShaderFlares={lensFlareVertexTexture:{vertexShader:"uniform vec3 screenPosition;\nuniform vec2 scale;\nuniform float rotation;\nuniform int renderType;\nuniform sampler2D occlusionMap;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nvUV = uv;\nvec2 pos = position;\nif( renderType == 2 ) {\nvec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.5 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.1, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.1, 0.5 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.5 ) );\nvVisibility = (       visibility.r / 9.0 ) *\n( 1.0 - visibility.g / 9.0 ) *\n(       visibility.b / 9.0 ) *\n( 1.0 - visibility.a / 9.0 );\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",fragmentShader:"precision mediump float;\nuniform sampler2D map;\nuniform float opacity;\nuniform int renderType;\nuniform vec3 color;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nif( renderType == 0 ) {\ngl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );\n} else if( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nvec4 texture = texture2D( map, vUV );\ntexture.a *= opacity * vVisibility;\ngl_FragColor = texture;\ngl_FragColor.rgb *= color;\n}\n}"},

+ 49 - 47
build/custom/ThreeSVG.js

@@ -18,66 +18,66 @@ this.z=a.z-b.z;this.w=a.w-b.w;return this},subSelf:function(a){this.x-=a.x;this.
 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.Frustum=function(){this.planes=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4]};
 THREE.Frustum.prototype.setFromMatrix=function(a){var b,c=this.planes;c[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);c[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);c[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+a.n23,a.n44+a.n24);c[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);c[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);c[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+a.n33,a.n44+a.n34);for(a=0;6>a;a++)b=c[a],b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))};
 THREE.Frustum.prototype.contains=function(a){for(var b=this.planes,c=a.matrixWorld,d=THREE.Frustum.__v1.set(c.getColumnX().length(),c.getColumnY().length(),c.getColumnZ().length()),d=-a.geometry.boundingSphere.radius*Math.max(d.x,Math.max(d.y,d.z)),e=0;6>e;e++)if(a=b[e].x*c.n14+b[e].y*c.n24+b[e].z*c.n34+b[e].w,a<=d)return!1;return!0};THREE.Frustum.__v1=new THREE.Vector3;
-THREE.Ray=function(a,b){function c(a,b,c){k.sub(c,a);q=k.dot(b);y=p.add(a,o.copy(b).multiplyScalar(q));return u=c.distanceTo(y)}function d(a,b,c,d){k.sub(d,b);p.sub(c,b);o.sub(a,b);E=k.dot(k);t=k.dot(p);v=k.dot(o);B=p.dot(p);w=p.dot(o);z=1/(E*B-t*t);G=(B*v-t*w)*z;C=(E*w-t*v)*z;return 0<=G&&0<=C&&1>G+C}this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3;this.intersectScene=function(a){return this.intersectObjects(a.children)};this.intersectObjects=function(a){var b,c,d=[];for(b=0,
-c=a.length;b<c;b++)Array.prototype.push.apply(d,this.intersectObject(a[b]));d.sort(function(a,b){return a.distance-b.distance});return d};var e=new THREE.Vector3,f=new THREE.Vector3,g=new THREE.Vector3,h=new THREE.Vector3,l=new THREE.Vector3,j=new THREE.Vector3,i=new THREE.Vector3,m=new THREE.Vector3,n=new THREE.Vector3;this.intersectObject=function(a){for(var b,k=[],o=0,p=a.children.length;o<p;o++)Array.prototype.push.apply(k,this.intersectObject(a.children[o]));if(a instanceof THREE.Particle){o=
-c(this.origin,this.direction,a.matrixWorld.getPosition());if(o>a.scale.x)return[];b={distance:o,point:a.position,face:null,object:a};k.push(b)}else if(a instanceof THREE.Mesh){o=c(this.origin,this.direction,a.matrixWorld.getPosition());p=THREE.Frustum.__v1.set(a.matrixWorld.getColumnX().length(),a.matrixWorld.getColumnY().length(),a.matrixWorld.getColumnZ().length());if(o>a.geometry.boundingSphere.radius*Math.max(p.x,Math.max(p.y,p.z)))return k;var q,t,v=a.geometry,u=v.vertices,r;a.matrixRotationWorld.extractRotation(a.matrixWorld);
-for(o=0,p=v.faces.length;o<p;o++)if(b=v.faces[o],l.copy(this.origin),j.copy(this.direction),r=a.matrixWorld,i=r.multiplyVector3(i.copy(b.centroid)).subSelf(l),m=a.matrixRotationWorld.multiplyVector3(m.copy(b.normal)),q=j.dot(m),!(1.0E-4>Math.abs(q))&&(t=m.dot(i)/q,!(0>t)&&(a.doubleSided||(a.flipSided?0<q:0>q))))if(n.add(l,j.multiplyScalar(t)),b instanceof THREE.Face3)e=r.multiplyVector3(e.copy(u[b.a].position)),f=r.multiplyVector3(f.copy(u[b.b].position)),g=r.multiplyVector3(g.copy(u[b.c].position)),
-d(n,e,f,g)&&(b={distance:l.distanceTo(n),point:n.clone(),face:b,object:a},k.push(b));else if(b instanceof THREE.Face4&&(e=r.multiplyVector3(e.copy(u[b.a].position)),f=r.multiplyVector3(f.copy(u[b.b].position)),g=r.multiplyVector3(g.copy(u[b.c].position)),h=r.multiplyVector3(h.copy(u[b.d].position)),d(n,e,f,h)||d(n,f,g,h)))b={distance:l.distanceTo(n),point:n.clone(),face:b,object:a},k.push(b)}return k};var k=new THREE.Vector3,p=new THREE.Vector3,o=new THREE.Vector3,q,y,u,E,t,v,B,w,z,G,C};
+THREE.Ray=function(a,b){function c(a,b,c){l.sub(c,a);q=l.dot(b);y=p.add(a,o.copy(b).multiplyScalar(q));return u=c.distanceTo(y)}function d(a,b,c,d){l.sub(d,b);p.sub(c,b);o.sub(a,b);E=l.dot(l);t=l.dot(p);v=l.dot(o);B=p.dot(p);w=p.dot(o);z=1/(E*B-t*t);G=(B*v-t*w)*z;C=(E*w-t*v)*z;return 0<=G&&0<=C&&1>G+C}this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3;this.intersectScene=function(a){return this.intersectObjects(a.children)};this.intersectObjects=function(a){var b,c,d=[];for(b=0,
+c=a.length;b<c;b++)Array.prototype.push.apply(d,this.intersectObject(a[b]));d.sort(function(a,b){return a.distance-b.distance});return d};var e=new THREE.Vector3,f=new THREE.Vector3,g=new THREE.Vector3,h=new THREE.Vector3,k=new THREE.Vector3,j=new THREE.Vector3,i=new THREE.Vector3,m=new THREE.Vector3,n=new THREE.Vector3;this.intersectObject=function(a){for(var b,l=[],o=0,p=a.children.length;o<p;o++)Array.prototype.push.apply(l,this.intersectObject(a.children[o]));if(a instanceof THREE.Particle){o=
+c(this.origin,this.direction,a.matrixWorld.getPosition());if(o>a.scale.x)return[];b={distance:o,point:a.position,face:null,object:a};l.push(b)}else if(a instanceof THREE.Mesh){o=c(this.origin,this.direction,a.matrixWorld.getPosition());p=THREE.Frustum.__v1.set(a.matrixWorld.getColumnX().length(),a.matrixWorld.getColumnY().length(),a.matrixWorld.getColumnZ().length());if(o>a.geometry.boundingSphere.radius*Math.max(p.x,Math.max(p.y,p.z)))return l;var q,t,v=a.geometry,u=v.vertices,r;a.matrixRotationWorld.extractRotation(a.matrixWorld);
+for(o=0,p=v.faces.length;o<p;o++)if(b=v.faces[o],k.copy(this.origin),j.copy(this.direction),r=a.matrixWorld,i=r.multiplyVector3(i.copy(b.centroid)).subSelf(k),m=a.matrixRotationWorld.multiplyVector3(m.copy(b.normal)),q=j.dot(m),!(1.0E-4>Math.abs(q))&&(t=m.dot(i)/q,!(0>t)&&(a.doubleSided||(a.flipSided?0<q:0>q))))if(n.add(k,j.multiplyScalar(t)),b instanceof THREE.Face3)e=r.multiplyVector3(e.copy(u[b.a].position)),f=r.multiplyVector3(f.copy(u[b.b].position)),g=r.multiplyVector3(g.copy(u[b.c].position)),
+d(n,e,f,g)&&(b={distance:k.distanceTo(n),point:n.clone(),face:b,object:a},l.push(b));else if(b instanceof THREE.Face4&&(e=r.multiplyVector3(e.copy(u[b.a].position)),f=r.multiplyVector3(f.copy(u[b.b].position)),g=r.multiplyVector3(g.copy(u[b.c].position)),h=r.multiplyVector3(h.copy(u[b.d].position)),d(n,e,f,h)||d(n,f,g,h)))b={distance:k.distanceTo(n),point:n.clone(),face:b,object:a},l.push(b)}return l};var l=new THREE.Vector3,p=new THREE.Vector3,o=new THREE.Vector3,q,y,u,E,t,v,B,w,z,G,C};
 THREE.Rectangle=function(){function a(){f=d-b;g=e-c}var b,c,d,e,f,g,h=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return f};this.getHeight=function(){return g};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return e};this.set=function(f,g,i,m){h=!1;b=f;c=g;d=i;e=m;a()};this.addPoint=function(f,g){h?(h=!1,b=f,c=g,d=f,e=g):(b=b<f?b:f,c=c<g?c:g,d=d>f?d:f,e=e>g?e:g);a()};this.add3Points=
-function(f,g,i,m,n,k){h?(h=!1,b=f<i?f<n?f:n:i<n?i:n,c=g<m?g<k?g:k:m<k?m:k,d=f>i?f>n?f:n:i>n?i:n,e=g>m?g>k?g:k:m>k?m:k):(b=f<i?f<n?f<b?f:b:n<b?n:b:i<n?i<b?i:b:n<b?n:b,c=g<m?g<k?g<c?g:c:k<c?k:c:m<k?m<c?m:c:k<c?k:c,d=f>i?f>n?f>d?f:d:n>d?n:d:i>n?i>d?i:d:n>d?n:d,e=g>m?g>k?g>e?g:e:k>e?k:e:m>k?m>e?m:e:k>e?k:e);a()};this.addRectangle=function(f){h?(h=!1,b=f.getLeft(),c=f.getTop(),d=f.getRight(),e=f.getBottom()):(b=b<f.getLeft()?b:f.getLeft(),c=c<f.getTop()?c:f.getTop(),d=d>f.getRight()?d:f.getRight(),e=e>
+function(f,g,i,m,n,l){h?(h=!1,b=f<i?f<n?f:n:i<n?i:n,c=g<m?g<l?g:l:m<l?m:l,d=f>i?f>n?f:n:i>n?i:n,e=g>m?g>l?g:l:m>l?m:l):(b=f<i?f<n?f<b?f:b:n<b?n:b:i<n?i<b?i:b:n<b?n:b,c=g<m?g<l?g<c?g:c:l<c?l:c:m<l?m<c?m:c:l<c?l:c,d=f>i?f>n?f>d?f:d:n>d?n:d:i>n?i>d?i:d:n>d?n:d,e=g>m?g>l?g>e?g:e:l>e?l:e:m>l?m>e?m:e:l>e?l:e);a()};this.addRectangle=function(f){h?(h=!1,b=f.getLeft(),c=f.getTop(),d=f.getRight(),e=f.getBottom()):(b=b<f.getLeft()?b:f.getLeft(),c=c<f.getTop()?c:f.getTop(),d=d>f.getRight()?d:f.getRight(),e=e>
 f.getBottom()?e:f.getBottom());a()};this.inflate=function(f){b-=f;c-=f;d+=f;e+=f;a()};this.minSelf=function(f){b=b>f.getLeft()?b:f.getLeft();c=c>f.getTop()?c:f.getTop();d=d<f.getRight()?d:f.getRight();e=e<f.getBottom()?e:f.getBottom();a()};this.intersects=function(a){return d<a.getLeft()||b>a.getRight()||e<a.getTop()||c>a.getBottom()?!1:!0};this.empty=function(){h=!0;e=d=c=b=0;a()};this.isEmpty=function(){return h}};
 THREE.Math={clamp:function(a,b,c){return a<b?b:a>c?c:a},clampBottom:function(a,b){return a<b?b:a},mapLinear:function(a,b,c,d,e){return d+(a-b)*(e-d)/(c-b)},random16:function(){return(65280*Math.random()+255*Math.random())/65535},randInt:function(a,b){return a+Math.floor(Math.random()*(b-a+1))},randFloat:function(a,b){return a+Math.random()*(b-a)},randFloatSpread:function(a){return a*(0.5-Math.random())}};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,d,e,f,g,h,l,j,i,m,n,k,p,o){this.set(void 0!==a?a:1,b||0,c||0,d||0,e||0,void 0!==f?f:1,g||0,h||0,l||0,j||0,void 0!==i?i:1,m||0,n||0,k||0,p||0,void 0!==o?o:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
-THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,e,f,g,h,l,j,i,m,n,k,p,o){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=e;this.n22=f;this.n23=g;this.n24=h;this.n31=l;this.n32=j;this.n33=i;this.n34=m;this.n41=n;this.n42=k;this.n43=p;this.n44=o;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,
-b,c){var d=THREE.Matrix4.__v1,e=THREE.Matrix4.__v2,f=THREE.Matrix4.__v3;f.sub(a,b).normalize();if(0===f.length())f.z=1;d.cross(c,f).normalize();0===d.length()&&(f.x+=1.0E-4,d.cross(c,f).normalize());e.cross(f,d).normalize();this.n11=d.x;this.n12=e.x;this.n13=f.x;this.n21=d.y;this.n22=e.y;this.n23=f.y;this.n31=d.z;this.n32=e.z;this.n33=f.z;return this},multiply:function(a,b){var c=a.n11,d=a.n12,e=a.n13,f=a.n14,g=a.n21,h=a.n22,l=a.n23,j=a.n24,i=a.n31,m=a.n32,n=a.n33,k=a.n34,p=a.n41,o=a.n42,q=a.n43,
-y=a.n44,u=b.n11,E=b.n12,t=b.n13,v=b.n14,B=b.n21,w=b.n22,z=b.n23,G=b.n24,C=b.n31,I=b.n32,A=b.n33,K=b.n34,M=b.n41,L=b.n42,Q=b.n43,S=b.n44;this.n11=c*u+d*B+e*C+f*M;this.n12=c*E+d*w+e*I+f*L;this.n13=c*t+d*z+e*A+f*Q;this.n14=c*v+d*G+e*K+f*S;this.n21=g*u+h*B+l*C+j*M;this.n22=g*E+h*w+l*I+j*L;this.n23=g*t+h*z+l*A+j*Q;this.n24=g*v+h*G+l*K+j*S;this.n31=i*u+m*B+n*C+k*M;this.n32=i*E+m*w+n*I+k*L;this.n33=i*t+m*z+n*A+k*Q;this.n34=i*v+m*G+n*K+k*S;this.n41=p*u+o*B+q*C+y*M;this.n42=p*E+o*w+q*I+y*L;this.n43=p*t+o*
+THREE.Matrix4=function(a,b,c,d,e,f,g,h,k,j,i,m,n,l,p,o){this.set(void 0!==a?a:1,b||0,c||0,d||0,e||0,void 0!==f?f:1,g||0,h||0,k||0,j||0,void 0!==i?i:1,m||0,n||0,l||0,p||0,void 0!==o?o:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
+THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,e,f,g,h,k,j,i,m,n,l,p,o){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=e;this.n22=f;this.n23=g;this.n24=h;this.n31=k;this.n32=j;this.n33=i;this.n34=m;this.n41=n;this.n42=l;this.n43=p;this.n44=o;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,
+b,c){var d=THREE.Matrix4.__v1,e=THREE.Matrix4.__v2,f=THREE.Matrix4.__v3;f.sub(a,b).normalize();if(0===f.length())f.z=1;d.cross(c,f).normalize();0===d.length()&&(f.x+=1.0E-4,d.cross(c,f).normalize());e.cross(f,d).normalize();this.n11=d.x;this.n12=e.x;this.n13=f.x;this.n21=d.y;this.n22=e.y;this.n23=f.y;this.n31=d.z;this.n32=e.z;this.n33=f.z;return this},multiply:function(a,b){var c=a.n11,d=a.n12,e=a.n13,f=a.n14,g=a.n21,h=a.n22,k=a.n23,j=a.n24,i=a.n31,m=a.n32,n=a.n33,l=a.n34,p=a.n41,o=a.n42,q=a.n43,
+y=a.n44,u=b.n11,E=b.n12,t=b.n13,v=b.n14,B=b.n21,w=b.n22,z=b.n23,G=b.n24,C=b.n31,I=b.n32,A=b.n33,K=b.n34,M=b.n41,L=b.n42,Q=b.n43,S=b.n44;this.n11=c*u+d*B+e*C+f*M;this.n12=c*E+d*w+e*I+f*L;this.n13=c*t+d*z+e*A+f*Q;this.n14=c*v+d*G+e*K+f*S;this.n21=g*u+h*B+k*C+j*M;this.n22=g*E+h*w+k*I+j*L;this.n23=g*t+h*z+k*A+j*Q;this.n24=g*v+h*G+k*K+j*S;this.n31=i*u+m*B+n*C+l*M;this.n32=i*E+m*w+n*I+l*L;this.n33=i*t+m*z+n*A+l*Q;this.n34=i*v+m*G+n*K+l*S;this.n41=p*u+o*B+q*C+y*M;this.n42=p*E+o*w+q*I+y*L;this.n43=p*t+o*
 z+q*A+y*Q;this.n44=p*v+o*G+q*K+y*S;return this},multiplySelf:function(a){return this.multiply(this,a)},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;c[3]=this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=
 a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},multiplyVector3:function(a){var b=a.x,c=a.y,d=a.z,e=1/(this.n41*b+this.n42*c+this.n43*d+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*d+this.n14)*e;a.y=(this.n21*b+this.n22*c+this.n23*d+this.n24)*e;a.z=(this.n31*b+this.n32*c+this.n33*d+this.n34)*e;return a},multiplyVector4:function(a){var b=a.x,c=a.y,d=a.z,e=a.w;a.x=this.n11*b+this.n12*c+this.n13*d+this.n14*e;a.y=this.n21*b+this.n22*
 c+this.n23*d+this.n24*e;a.z=this.n31*b+this.n32*c+this.n33*d+this.n34*e;a.w=this.n41*b+this.n42*c+this.n43*d+this.n44*e;return a},rotateAxis:function(a){var b=a.x,c=a.y,d=a.z;a.x=b*this.n11+c*this.n12+d*this.n13;a.y=b*this.n21+c*this.n22+d*this.n23;a.z=b*this.n31+c*this.n32+d*this.n33;a.normalize();return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*
-a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},determinant:function(){var a=this.n11,b=this.n12,c=this.n13,d=this.n14,e=this.n21,f=this.n22,g=this.n23,h=this.n24,l=this.n31,j=this.n32,i=this.n33,m=this.n34,n=this.n41,k=this.n42,p=this.n43,o=this.n44;return d*g*j*n-c*h*j*n-d*f*i*n+b*h*i*n+c*f*m*n-b*g*m*n-d*g*l*k+c*h*l*k+d*e*i*k-a*h*i*k-c*e*m*k+a*g*m*k+d*f*l*p-b*h*l*p-d*e*j*p+a*h*j*p+b*e*m*p-a*f*m*p-c*f*l*o+b*g*l*o+c*e*j*o-a*g*j*o-b*e*i*o+a*f*i*o},transpose:function(){var a;
+a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},determinant:function(){var a=this.n11,b=this.n12,c=this.n13,d=this.n14,e=this.n21,f=this.n22,g=this.n23,h=this.n24,k=this.n31,j=this.n32,i=this.n33,m=this.n34,n=this.n41,l=this.n42,p=this.n43,o=this.n44;return d*g*j*n-c*h*j*n-d*f*i*n+b*h*i*n+c*f*m*n-b*g*m*n-d*g*k*l+c*h*k*l+d*e*i*l-a*h*i*l-c*e*m*l+a*g*m*l+d*f*k*p-b*h*k*p-d*e*j*p+a*h*j*p+b*e*m*p-a*f*m*p-c*f*k*o+b*g*k*o+c*e*j*o-a*g*j*o-b*e*i*o+a*f*i*o},transpose:function(){var a;
 a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n34=a;return this},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),d=Math.sin(b),e=1-c,f=a.x,g=a.y,h=a.z,l=e*f,j=e*g;this.set(l*f+c,l*g-d*h,l*h+d*g,0,l*g+d*h,j*g+c,j*h-d*f,0,l*h-d*g,j*h+d*f,e*h*h+c,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},getPosition:function(){return THREE.Matrix4.__v1.set(this.n14,this.n24,this.n34)},getColumnX:function(){return THREE.Matrix4.__v1.set(this.n11,this.n21,this.n31)},getColumnY:function(){return THREE.Matrix4.__v1.set(this.n12,
-this.n22,this.n32)},getColumnZ:function(){return THREE.Matrix4.__v1.set(this.n13,this.n23,this.n33)},getInverse:function(a){var b=a.n11,c=a.n12,d=a.n13,e=a.n14,f=a.n21,g=a.n22,h=a.n23,l=a.n24,j=a.n31,i=a.n32,m=a.n33,n=a.n34,k=a.n41,p=a.n42,o=a.n43,q=a.n44;this.n11=h*n*p-l*m*p+l*i*o-g*n*o-h*i*q+g*m*q;this.n12=e*m*p-d*n*p-e*i*o+c*n*o+d*i*q-c*m*q;this.n13=d*l*p-e*h*p+e*g*o-c*l*o-d*g*q+c*h*q;this.n14=e*h*i-d*l*i-e*g*m+c*l*m+d*g*n-c*h*n;this.n21=l*m*k-h*n*k-l*j*o+f*n*o+h*j*q-f*m*q;this.n22=d*n*k-e*m*k+
-e*j*o-b*n*o-d*j*q+b*m*q;this.n23=e*h*k-d*l*k-e*f*o+b*l*o+d*f*q-b*h*q;this.n24=d*l*j-e*h*j+e*f*m-b*l*m-d*f*n+b*h*n;this.n31=g*n*k-l*i*k+l*j*p-f*n*p-g*j*q+f*i*q;this.n32=e*i*k-c*n*k-e*j*p+b*n*p+c*j*q-b*i*q;this.n33=c*l*k-e*g*k+e*f*p-b*l*p-c*f*q+b*g*q;this.n34=e*g*j-c*l*j-e*f*i+b*l*i+c*f*n-b*g*n;this.n41=h*i*k-g*m*k-h*j*p+f*m*p+g*j*o-f*i*o;this.n42=c*m*k-d*i*k+d*j*p-b*m*p-c*j*o+b*i*o;this.n43=d*g*k-c*h*k-d*f*p+b*h*p+c*f*o-b*g*o;this.n44=c*h*j-d*g*j+d*f*i-b*h*i-c*f*m+b*g*m;this.multiplyScalar(1/a.determinant());
-return this},setRotationFromEuler:function(a,b){var c=a.x,d=a.y,e=a.z,f=Math.cos(c),c=Math.sin(c),g=Math.cos(d),d=Math.sin(d),h=Math.cos(e),e=Math.sin(e);switch(b){case "YXZ":var l=g*h,j=g*e,i=d*h,m=d*e;this.n11=l+m*c;this.n12=i*c-j;this.n13=f*d;this.n21=f*e;this.n22=f*h;this.n23=-c;this.n31=j*c-i;this.n32=m+l*c;this.n33=f*g;break;case "ZXY":l=g*h;j=g*e;i=d*h;m=d*e;this.n11=l-m*c;this.n12=-f*e;this.n13=i+j*c;this.n21=j+i*c;this.n22=f*h;this.n23=m-l*c;this.n31=-f*d;this.n32=c;this.n33=f*g;break;case "ZYX":l=
-f*h;j=f*e;i=c*h;m=c*e;this.n11=g*h;this.n12=i*d-j;this.n13=l*d+m;this.n21=g*e;this.n22=m*d+l;this.n23=j*d-i;this.n31=-d;this.n32=c*g;this.n33=f*g;break;case "YZX":l=f*g;j=f*d;i=c*g;m=c*d;this.n11=g*h;this.n12=m-l*e;this.n13=i*e+j;this.n21=e;this.n22=f*h;this.n23=-c*h;this.n31=-d*h;this.n32=j*e+i;this.n33=l-m*e;break;case "XZY":l=f*g;j=f*d;i=c*g;m=c*d;this.n11=g*h;this.n12=-e;this.n13=d*h;this.n21=l*e+m;this.n22=f*h;this.n23=j*e-i;this.n31=i*e-j;this.n32=c*h;this.n33=m*e+l;break;default:l=f*h,j=f*
-e,i=c*h,m=c*e,this.n11=g*h,this.n12=-g*e,this.n13=d,this.n21=j+i*d,this.n22=l-m*d,this.n23=-c*g,this.n31=m-l*d,this.n32=i+j*d,this.n33=f*g}return this},setRotationFromQuaternion:function(a){var b=a.x,c=a.y,d=a.z,e=a.w,f=b+b,g=c+c,h=d+d,a=b*f,l=b*g,b=b*h,j=c*g,c=c*h,d=d*h,f=e*f,g=e*g,e=e*h;this.n11=1-(j+d);this.n12=l-e;this.n13=b+g;this.n21=l+e;this.n22=1-(a+d);this.n23=c-f;this.n31=b-g;this.n32=c+f;this.n33=1-(a+j);return this},scale:function(a){var b=a.x,c=a.y,a=a.z;this.n11*=b;this.n12*=c;this.n13*=
+setRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),e=1-c,f=a.x,g=a.y,h=a.z,k=e*f,j=e*g;this.set(k*f+c,k*g-d*h,k*h+d*g,0,k*g+d*h,j*g+c,j*h-d*f,0,k*h-d*g,j*h+d*f,e*h*h+c,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},getPosition:function(){return THREE.Matrix4.__v1.set(this.n14,this.n24,this.n34)},getColumnX:function(){return THREE.Matrix4.__v1.set(this.n11,this.n21,this.n31)},getColumnY:function(){return THREE.Matrix4.__v1.set(this.n12,
+this.n22,this.n32)},getColumnZ:function(){return THREE.Matrix4.__v1.set(this.n13,this.n23,this.n33)},getInverse:function(a){var b=a.n11,c=a.n12,d=a.n13,e=a.n14,f=a.n21,g=a.n22,h=a.n23,k=a.n24,j=a.n31,i=a.n32,m=a.n33,n=a.n34,l=a.n41,p=a.n42,o=a.n43,q=a.n44;this.n11=h*n*p-k*m*p+k*i*o-g*n*o-h*i*q+g*m*q;this.n12=e*m*p-d*n*p-e*i*o+c*n*o+d*i*q-c*m*q;this.n13=d*k*p-e*h*p+e*g*o-c*k*o-d*g*q+c*h*q;this.n14=e*h*i-d*k*i-e*g*m+c*k*m+d*g*n-c*h*n;this.n21=k*m*l-h*n*l-k*j*o+f*n*o+h*j*q-f*m*q;this.n22=d*n*l-e*m*l+
+e*j*o-b*n*o-d*j*q+b*m*q;this.n23=e*h*l-d*k*l-e*f*o+b*k*o+d*f*q-b*h*q;this.n24=d*k*j-e*h*j+e*f*m-b*k*m-d*f*n+b*h*n;this.n31=g*n*l-k*i*l+k*j*p-f*n*p-g*j*q+f*i*q;this.n32=e*i*l-c*n*l-e*j*p+b*n*p+c*j*q-b*i*q;this.n33=c*k*l-e*g*l+e*f*p-b*k*p-c*f*q+b*g*q;this.n34=e*g*j-c*k*j-e*f*i+b*k*i+c*f*n-b*g*n;this.n41=h*i*l-g*m*l-h*j*p+f*m*p+g*j*o-f*i*o;this.n42=c*m*l-d*i*l+d*j*p-b*m*p-c*j*o+b*i*o;this.n43=d*g*l-c*h*l-d*f*p+b*h*p+c*f*o-b*g*o;this.n44=c*h*j-d*g*j+d*f*i-b*h*i-c*f*m+b*g*m;this.multiplyScalar(1/a.determinant());
+return this},setRotationFromEuler:function(a,b){var c=a.x,d=a.y,e=a.z,f=Math.cos(c),c=Math.sin(c),g=Math.cos(d),d=Math.sin(d),h=Math.cos(e),e=Math.sin(e);switch(b){case "YXZ":var k=g*h,j=g*e,i=d*h,m=d*e;this.n11=k+m*c;this.n12=i*c-j;this.n13=f*d;this.n21=f*e;this.n22=f*h;this.n23=-c;this.n31=j*c-i;this.n32=m+k*c;this.n33=f*g;break;case "ZXY":k=g*h;j=g*e;i=d*h;m=d*e;this.n11=k-m*c;this.n12=-f*e;this.n13=i+j*c;this.n21=j+i*c;this.n22=f*h;this.n23=m-k*c;this.n31=-f*d;this.n32=c;this.n33=f*g;break;case "ZYX":k=
+f*h;j=f*e;i=c*h;m=c*e;this.n11=g*h;this.n12=i*d-j;this.n13=k*d+m;this.n21=g*e;this.n22=m*d+k;this.n23=j*d-i;this.n31=-d;this.n32=c*g;this.n33=f*g;break;case "YZX":k=f*g;j=f*d;i=c*g;m=c*d;this.n11=g*h;this.n12=m-k*e;this.n13=i*e+j;this.n21=e;this.n22=f*h;this.n23=-c*h;this.n31=-d*h;this.n32=j*e+i;this.n33=k-m*e;break;case "XZY":k=f*g;j=f*d;i=c*g;m=c*d;this.n11=g*h;this.n12=-e;this.n13=d*h;this.n21=k*e+m;this.n22=f*h;this.n23=j*e-i;this.n31=i*e-j;this.n32=c*h;this.n33=m*e+k;break;default:k=f*h,j=f*
+e,i=c*h,m=c*e,this.n11=g*h,this.n12=-g*e,this.n13=d,this.n21=j+i*d,this.n22=k-m*d,this.n23=-c*g,this.n31=m-k*d,this.n32=i+j*d,this.n33=f*g}return this},setRotationFromQuaternion:function(a){var b=a.x,c=a.y,d=a.z,e=a.w,f=b+b,g=c+c,h=d+d,a=b*f,k=b*g,b=b*h,j=c*g,c=c*h,d=d*h,f=e*f,g=e*g,e=e*h;this.n11=1-(j+d);this.n12=k-e;this.n13=b+g;this.n21=k+e;this.n22=1-(a+d);this.n23=c-f;this.n31=b-g;this.n32=c+f;this.n33=1-(a+j);return this},scale:function(a){var b=a.x,c=a.y,a=a.z;this.n11*=b;this.n12*=c;this.n13*=
 a;this.n21*=b;this.n22*=c;this.n23*=a;this.n31*=b;this.n32*=c;this.n33*=a;this.n41*=b;this.n42*=c;this.n43*=a;return this},compose:function(a,b,c){var d=THREE.Matrix4.__m1,e=THREE.Matrix4.__m2;d.identity();d.setRotationFromQuaternion(b);e.setScale(c.x,c.y,c.z);this.multiply(d,e);this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},decompose:function(a,b,c){var d=THREE.Matrix4.__v1,e=THREE.Matrix4.__v2,f=THREE.Matrix4.__v3;d.set(this.n11,this.n21,this.n31);e.set(this.n12,this.n22,this.n32);f.set(this.n13,
 this.n23,this.n33);a=a instanceof THREE.Vector3?a:new THREE.Vector3;b=b instanceof THREE.Quaternion?b:new THREE.Quaternion;c=c instanceof THREE.Vector3?c:new THREE.Vector3;c.x=d.length();c.y=e.length();c.z=f.length();a.x=this.n14;a.y=this.n24;a.z=this.n34;d=THREE.Matrix4.__m1;d.copy(this);d.n11/=c.x;d.n21/=c.x;d.n31/=c.x;d.n12/=c.y;d.n22/=c.y;d.n32/=c.y;d.n13/=c.z;d.n23/=c.z;d.n33/=c.z;b.setFromRotationMatrix(d);return[a,b,c]},extractPosition:function(a){this.n14=a.n14;this.n24=a.n24;this.n34=a.n34;
 return this},extractRotation:function(a){var b=THREE.Matrix4.__v1,c=1/b.set(a.n11,a.n21,a.n31).length(),d=1/b.set(a.n12,a.n22,a.n32).length(),b=1/b.set(a.n13,a.n23,a.n33).length();this.n11=a.n11*c;this.n21=a.n21*c;this.n31=a.n31*c;this.n12=a.n12*d;this.n22=a.n22*d;this.n32=a.n32*d;this.n13=a.n13*b;this.n23=a.n23*b;this.n33=a.n33*b;return this},rotateByAxis:function(a,b){if(1===a.x&&0===a.y&&0===a.z)return this.rotateX(b);if(0===a.x&&1===a.y&&0===a.z)return this.rotateY(b);if(0===a.x&&0===a.y&&1===
-a.z)return this.rotateZ(b);var c=a.x,d=a.y,e=a.z,f=Math.sqrt(c*c+d*d+e*e),c=c/f,d=d/f,e=e/f,f=c*c,g=d*d,h=e*e,l=Math.cos(b),j=Math.sin(b),i=1-l,m=c*d*i,n=c*e*i,i=d*e*i,c=c*j,k=d*j,j=e*j,e=f+(1-f)*l,f=m+j,d=n-k,m=m-j,g=g+(1-g)*l,j=i+c,n=n+k,i=i-c,h=h+(1-h)*l,l=this.n11,c=this.n21,k=this.n31,p=this.n41,o=this.n12,q=this.n22,y=this.n32,u=this.n42,E=this.n13,t=this.n23,v=this.n33,B=this.n43;this.n11=e*l+f*o+d*E;this.n21=e*c+f*q+d*t;this.n31=e*k+f*y+d*v;this.n41=e*p+f*u+d*B;this.n12=m*l+g*o+j*E;this.n22=
-m*c+g*q+j*t;this.n32=m*k+g*y+j*v;this.n42=m*p+g*u+j*B;this.n13=n*l+i*o+h*E;this.n23=n*c+i*q+h*t;this.n33=n*k+i*y+h*v;this.n43=n*p+i*u+h*B;return this},rotateX:function(a){var b=this.n12,c=this.n22,d=this.n32,e=this.n42,f=this.n13,g=this.n23,h=this.n33,l=this.n43,j=Math.cos(a),a=Math.sin(a);this.n12=j*b+a*f;this.n22=j*c+a*g;this.n32=j*d+a*h;this.n42=j*e+a*l;this.n13=j*f-a*b;this.n23=j*g-a*c;this.n33=j*h-a*d;this.n43=j*l-a*e;return this},rotateY:function(a){var b=this.n11,c=this.n21,d=this.n31,e=this.n41,
-f=this.n13,g=this.n23,h=this.n33,l=this.n43,j=Math.cos(a),a=Math.sin(a);this.n11=j*b-a*f;this.n21=j*c-a*g;this.n31=j*d-a*h;this.n41=j*e-a*l;this.n13=j*f+a*b;this.n23=j*g+a*c;this.n33=j*h+a*d;this.n43=j*l+a*e;return this},rotateZ:function(a){var b=this.n11,c=this.n21,d=this.n31,e=this.n41,f=this.n12,g=this.n22,h=this.n32,l=this.n42,j=Math.cos(a),a=Math.sin(a);this.n11=j*b+a*f;this.n21=j*c+a*g;this.n31=j*d+a*h;this.n41=j*e+a*l;this.n12=j*f-a*b;this.n22=j*g-a*c;this.n32=j*h-a*d;this.n42=j*l-a*e;return this},
+a.z)return this.rotateZ(b);var c=a.x,d=a.y,e=a.z,f=Math.sqrt(c*c+d*d+e*e),c=c/f,d=d/f,e=e/f,f=c*c,g=d*d,h=e*e,k=Math.cos(b),j=Math.sin(b),i=1-k,m=c*d*i,n=c*e*i,i=d*e*i,c=c*j,l=d*j,j=e*j,e=f+(1-f)*k,f=m+j,d=n-l,m=m-j,g=g+(1-g)*k,j=i+c,n=n+l,i=i-c,h=h+(1-h)*k,k=this.n11,c=this.n21,l=this.n31,p=this.n41,o=this.n12,q=this.n22,y=this.n32,u=this.n42,E=this.n13,t=this.n23,v=this.n33,B=this.n43;this.n11=e*k+f*o+d*E;this.n21=e*c+f*q+d*t;this.n31=e*l+f*y+d*v;this.n41=e*p+f*u+d*B;this.n12=m*k+g*o+j*E;this.n22=
+m*c+g*q+j*t;this.n32=m*l+g*y+j*v;this.n42=m*p+g*u+j*B;this.n13=n*k+i*o+h*E;this.n23=n*c+i*q+h*t;this.n33=n*l+i*y+h*v;this.n43=n*p+i*u+h*B;return this},rotateX:function(a){var b=this.n12,c=this.n22,d=this.n32,e=this.n42,f=this.n13,g=this.n23,h=this.n33,k=this.n43,j=Math.cos(a),a=Math.sin(a);this.n12=j*b+a*f;this.n22=j*c+a*g;this.n32=j*d+a*h;this.n42=j*e+a*k;this.n13=j*f-a*b;this.n23=j*g-a*c;this.n33=j*h-a*d;this.n43=j*k-a*e;return this},rotateY:function(a){var b=this.n11,c=this.n21,d=this.n31,e=this.n41,
+f=this.n13,g=this.n23,h=this.n33,k=this.n43,j=Math.cos(a),a=Math.sin(a);this.n11=j*b-a*f;this.n21=j*c-a*g;this.n31=j*d-a*h;this.n41=j*e-a*k;this.n13=j*f+a*b;this.n23=j*g+a*c;this.n33=j*h+a*d;this.n43=j*k+a*e;return this},rotateZ:function(a){var b=this.n11,c=this.n21,d=this.n31,e=this.n41,f=this.n12,g=this.n22,h=this.n32,k=this.n42,j=Math.cos(a),a=Math.sin(a);this.n11=j*b+a*f;this.n21=j*c+a*g;this.n31=j*d+a*h;this.n41=j*e+a*k;this.n12=j*f-a*b;this.n22=j*g-a*c;this.n32=j*h-a*d;this.n42=j*k-a*e;return this},
 translate:function(a){var b=a.x,c=a.y,a=a.z;this.n14=this.n11*b+this.n12*c+this.n13*a+this.n14;this.n24=this.n21*b+this.n22*c+this.n23*a+this.n24;this.n34=this.n31*b+this.n32*c+this.n33*a+this.n34;this.n44=this.n41*b+this.n42*c+this.n43*a+this.n44;return this}};
-THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,d=a.n33*a.n22-a.n32*a.n23,e=-a.n33*a.n21+a.n31*a.n23,f=a.n32*a.n21-a.n31*a.n22,g=-a.n33*a.n12+a.n32*a.n13,h=a.n33*a.n11-a.n31*a.n13,l=-a.n32*a.n11+a.n31*a.n12,j=a.n23*a.n12-a.n22*a.n13,i=-a.n23*a.n11+a.n21*a.n13,m=a.n22*a.n11-a.n21*a.n12,a=a.n11*d+a.n21*g+a.n31*j;if(0===a)return null;a=1/a;c[0]=a*d;c[1]=a*e;c[2]=a*f;c[3]=a*g;c[4]=a*h;c[5]=a*l;c[6]=a*j;c[7]=a*i;c[8]=a*m;return b};
+THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,d=a.n33*a.n22-a.n32*a.n23,e=-a.n33*a.n21+a.n31*a.n23,f=a.n32*a.n21-a.n31*a.n22,g=-a.n33*a.n12+a.n32*a.n13,h=a.n33*a.n11-a.n31*a.n13,k=-a.n32*a.n11+a.n31*a.n12,j=a.n23*a.n12-a.n22*a.n13,i=-a.n23*a.n11+a.n21*a.n13,m=a.n22*a.n11-a.n21*a.n12,a=a.n11*d+a.n21*g+a.n31*j;if(0===a)return null;a=1/a;c[0]=a*d;c[1]=a*e;c[2]=a*f;c[3]=a*g;c[4]=a*h;c[5]=a*k;c[6]=a*j;c[7]=a*i;c[8]=a*m;return b};
 THREE.Matrix4.makeFrustum=function(a,b,c,d,e,f){var g;g=new THREE.Matrix4;g.n11=2*e/(b-a);g.n12=0;g.n13=(b+a)/(b-a);g.n14=0;g.n21=0;g.n22=2*e/(d-c);g.n23=(d+c)/(d-c);g.n24=0;g.n31=0;g.n32=0;g.n33=-(f+e)/(f-e);g.n34=-2*f*e/(f-e);g.n41=0;g.n42=0;g.n43=-1;g.n44=0;return g};THREE.Matrix4.makePerspective=function(a,b,c,d){var e,a=c*Math.tan(a*Math.PI/360);e=-a;return THREE.Matrix4.makeFrustum(e*b,a*b,e,a,c,d)};
-THREE.Matrix4.makeOrtho=function(a,b,c,d,e,f){var g,h,l,j;g=new THREE.Matrix4;h=b-a;l=c-d;j=f-e;g.n11=2/h;g.n12=0;g.n13=0;g.n14=-((b+a)/h);g.n21=0;g.n22=2/l;g.n23=0;g.n24=-((c+d)/l);g.n31=0;g.n32=0;g.n33=-2/j;g.n34=-((f+e)/j);g.n41=0;g.n42=0;g.n43=0;g.n44=1;return g};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
+THREE.Matrix4.makeOrtho=function(a,b,c,d,e,f){var g,h,k,j;g=new THREE.Matrix4;h=b-a;k=c-d;j=f-e;g.n11=2/h;g.n12=0;g.n13=0;g.n14=-((b+a)/h);g.n21=0;g.n22=2/k;g.n23=0;g.n24=-((c+d)/k);g.n31=0;g.n32=0;g.n33=-2/j;g.n34=-((f+e)/j);g.n41=0;g.n42=0;g.n43=0;g.n44=1;return g};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
 THREE.Object3D=function(){this.id=THREE.Object3DCount++;this.name="";this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder="XYZ";this.scale=new THREE.Vector3(1,1,1);this.flipSided=this.doubleSided=!1;this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=
 !0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=!0;this.receiveShadow=this.castShadow=!1;this.frustumCulled=!0;this._vector=new THREE.Vector3};
 THREE.Object3D.prototype={constructor:THREE.Object3D,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(a===
 this)console.warn("THREE: Object3D.add(): An object can't be added as a child of itself.");else if(-1===this.children.indexOf(a)){void 0!==a.parent&&a.parent.remove(a);a.parent=this;this.children.push(a);for(var b=this;void 0!==b.parent;)b=b.parent;void 0!==b&&b instanceof THREE.Scene&&b.addObject(a)}},remove:function(a){var b=this.children.indexOf(a);if(-1!==b){a.parent=void 0;this.children.splice(b,1);for(b=this;void 0!==b.parent;)b=b.parent;void 0!==b&&b instanceof THREE.Scene&&b.removeObject(a)}},
 getChildByName:function(a,b){var c,d,e;for(c=0,d=this.children.length;c<d;c++){e=this.children[c];if(e.name===a||b&&(e=e.getChildByName(a,b),void 0!==e))return e}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder);if(1!==this.scale.x||1!==this.scale.y||1!==this.scale.z)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,
 this.scale.z));this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(a){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||a)this.parent?this.matrixWorld.multiply(this.parent.matrixWorld,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,a=!0;for(var b=0,c=this.children.length;b<c;b++)this.children[b].updateMatrixWorld(a)}};THREE.Object3DCount=0;
-THREE.Projector=function(){function a(){var a=g[f]=g[f]||new THREE.RenderableObject;f++;return a}function b(){var a=j[l]=j[l]||new THREE.RenderableVertex;l++;return a}function c(a,b){return b.z-a.z}function d(a,b){var c=0,d=1,e=a.z+a.w,f=b.z+b.w,g=-a.z+a.w,h=-b.z+b.w;if(0<=e&&0<=f&&0<=g&&0<=h)return!0;if(0>e&&0>f||0>g&&0>h)return!1;0>e?c=Math.max(c,e/(e-f)):0>f&&(d=Math.min(d,e/(e-f)));0>g?c=Math.max(c,g/(g-h)):0>h&&(d=Math.min(d,g/(g-h)));if(d<c)return!1;a.lerpSelf(b,c);b.lerpSelf(a,1-d);return!0}
-var e,f,g=[],h,l,j=[],i,m,n=[],k,p=[],o,q,y=[],u,E,t=[],v={objects:[],sprites:[],lights:[],elements:[]},B=new THREE.Vector3,w=new THREE.Vector4,z=new THREE.Matrix4,G=new THREE.Matrix4,C=new THREE.Frustum,I=new THREE.Vector4,A=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);z.multiply(b.projectionMatrix,b.matrixWorldInverse);z.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);z.multiply(b.matrixWorld,
+THREE.Projector=function(){function a(){var a=g[f]=g[f]||new THREE.RenderableObject;f++;return a}function b(){var a=j[k]=j[k]||new THREE.RenderableVertex;k++;return a}function c(a,b){return b.z-a.z}function d(a,b){var c=0,d=1,e=a.z+a.w,f=b.z+b.w,g=-a.z+a.w,h=-b.z+b.w;if(0<=e&&0<=f&&0<=g&&0<=h)return!0;if(0>e&&0>f||0>g&&0>h)return!1;0>e?c=Math.max(c,e/(e-f)):0>f&&(d=Math.min(d,e/(e-f)));0>g?c=Math.max(c,g/(g-h)):0>h&&(d=Math.min(d,g/(g-h)));if(d<c)return!1;a.lerpSelf(b,c);b.lerpSelf(a,1-d);return!0}
+var e,f,g=[],h,k,j=[],i,m,n=[],l,p=[],o,q,y=[],u,E,t=[],v={objects:[],sprites:[],lights:[],elements:[]},B=new THREE.Vector3,w=new THREE.Vector4,z=new THREE.Matrix4,G=new THREE.Matrix4,C=new THREE.Frustum,I=new THREE.Vector4,A=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);z.multiply(b.projectionMatrix,b.matrixWorldInverse);z.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);z.multiply(b.matrixWorld,
 b.projectionMatrixInverse);z.multiplyVector3(a);return a};this.pickingRay=function(a,b){var c;a.z=-1;c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.subSelf(a).normalize();return new THREE.Ray(a,c)};this.projectGraph=function(b,d){f=0;v.objects.length=0;v.sprites.length=0;v.lights.length=0;var g=function(b){if(!1!==b.visible){(b instanceof THREE.Mesh||b instanceof THREE.Line)&&(!1===b.frustumCulled||C.contains(b))?(z.multiplyVector3(B.copy(b.position)),e=a(),e.object=
-b,e.z=B.z,v.objects.push(e)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(z.multiplyVector3(B.copy(b.position)),e=a(),e.object=b,e.z=B.z,v.sprites.push(e)):b instanceof THREE.Light&&v.lights.push(b);for(var c=0,d=b.children.length;c<d;c++)g(b.children[c])}};g(b);d&&v.objects.sort(c);return v};this.projectScene=function(a,e,f){var g=e.near,B=e.far,T,N,r,s,x,D,F,J,H,O,P,U,X,V,W,R;E=q=k=m=0;v.elements.length=0;void 0===e.parent&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),
-a.add(e));a.updateMatrixWorld();e.matrixWorldInverse.getInverse(e.matrixWorld);z.multiply(e.projectionMatrix,e.matrixWorldInverse);C.setFromMatrix(z);v=this.projectGraph(a,!1);for(a=0,T=v.objects.length;a<T;a++)if(H=v.objects[a].object,O=H.matrixWorld,U=H.material,l=0,H instanceof THREE.Mesh){P=H.geometry;X=H.geometry.materials;s=P.vertices;V=P.faces;W=P.faceVertexUvs;P=H.matrixRotationWorld.extractRotation(O);for(N=0,r=s.length;N<r;N++)h=b(),h.positionWorld.copy(s[N].position),O.multiplyVector3(h.positionWorld),
+b,e.z=B.z,v.objects.push(e)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(z.multiplyVector3(B.copy(b.position)),e=a(),e.object=b,e.z=B.z,v.sprites.push(e)):b instanceof THREE.Light&&v.lights.push(b);for(var c=0,d=b.children.length;c<d;c++)g(b.children[c])}};g(b);d&&v.objects.sort(c);return v};this.projectScene=function(a,e,f){var g=e.near,B=e.far,T,N,r,s,x,D,F,J,H,O,P,U,X,V,W,R;E=q=l=m=0;v.elements.length=0;void 0===e.parent&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),
+a.add(e));a.updateMatrixWorld();e.matrixWorldInverse.getInverse(e.matrixWorld);z.multiply(e.projectionMatrix,e.matrixWorldInverse);C.setFromMatrix(z);v=this.projectGraph(a,!1);for(a=0,T=v.objects.length;a<T;a++)if(H=v.objects[a].object,O=H.matrixWorld,U=H.material,k=0,H instanceof THREE.Mesh){P=H.geometry;X=H.geometry.materials;s=P.vertices;V=P.faces;W=P.faceVertexUvs;P=H.matrixRotationWorld.extractRotation(O);for(N=0,r=s.length;N<r;N++)h=b(),h.positionWorld.copy(s[N].position),O.multiplyVector3(h.positionWorld),
 h.positionScreen.copy(h.positionWorld),z.multiplyVector4(h.positionScreen),h.positionScreen.x/=h.positionScreen.w,h.positionScreen.y/=h.positionScreen.w,h.visible=h.positionScreen.z>g&&h.positionScreen.z<B;for(s=0,N=V.length;s<N;s++){r=V[s];if(r instanceof THREE.Face3)if(x=j[r.a],D=j[r.b],F=j[r.c],x.visible&&D.visible&&F.visible&&(H.doubleSided||H.flipSided!=0>(F.positionScreen.x-x.positionScreen.x)*(D.positionScreen.y-x.positionScreen.y)-(F.positionScreen.y-x.positionScreen.y)*(D.positionScreen.x-
 x.positionScreen.x)))J=n[m]=n[m]||new THREE.RenderableFace3,m++,i=J,i.v1.copy(x),i.v2.copy(D),i.v3.copy(F);else continue;else if(r instanceof THREE.Face4)if(x=j[r.a],D=j[r.b],F=j[r.c],J=j[r.d],x.visible&&D.visible&&F.visible&&J.visible&&(H.doubleSided||H.flipSided!=(0>(J.positionScreen.x-x.positionScreen.x)*(D.positionScreen.y-x.positionScreen.y)-(J.positionScreen.y-x.positionScreen.y)*(D.positionScreen.x-x.positionScreen.x)||0>(D.positionScreen.x-F.positionScreen.x)*(J.positionScreen.y-F.positionScreen.y)-
-(D.positionScreen.y-F.positionScreen.y)*(J.positionScreen.x-F.positionScreen.x))))R=p[k]=p[k]||new THREE.RenderableFace4,k++,i=R,i.v1.copy(x),i.v2.copy(D),i.v3.copy(F),i.v4.copy(J);else continue;i.normalWorld.copy(r.normal);P.multiplyVector3(i.normalWorld);i.centroidWorld.copy(r.centroid);O.multiplyVector3(i.centroidWorld);i.centroidScreen.copy(i.centroidWorld);z.multiplyVector3(i.centroidScreen);F=r.vertexNormals;for(x=0,D=F.length;x<D;x++)J=i.vertexNormalsWorld[x],J.copy(F[x]),P.multiplyVector3(J);
-for(x=0,D=W.length;x<D;x++)if(R=W[x][s])for(F=0,J=R.length;F<J;F++)i.uvs[x][F]=R[F];i.material=U;i.faceMaterial=null!==r.materialIndex?X[r.materialIndex]:null;i.z=i.centroidScreen.z;v.elements.push(i)}}else if(H instanceof THREE.Line){G.multiply(z,O);s=H.geometry.vertices;x=b();x.positionScreen.copy(s[0].position);G.multiplyVector4(x.positionScreen);for(N=1,r=s.length;N<r;N++)if(x=b(),x.positionScreen.copy(s[N].position),G.multiplyVector4(x.positionScreen),D=j[l-2],I.copy(x.positionScreen),A.copy(D.positionScreen),
+(D.positionScreen.y-F.positionScreen.y)*(J.positionScreen.x-F.positionScreen.x))))R=p[l]=p[l]||new THREE.RenderableFace4,l++,i=R,i.v1.copy(x),i.v2.copy(D),i.v3.copy(F),i.v4.copy(J);else continue;i.normalWorld.copy(r.normal);P.multiplyVector3(i.normalWorld);i.centroidWorld.copy(r.centroid);O.multiplyVector3(i.centroidWorld);i.centroidScreen.copy(i.centroidWorld);z.multiplyVector3(i.centroidScreen);F=r.vertexNormals;for(x=0,D=F.length;x<D;x++)J=i.vertexNormalsWorld[x],J.copy(F[x]),P.multiplyVector3(J);
+for(x=0,D=W.length;x<D;x++)if(R=W[x][s])for(F=0,J=R.length;F<J;F++)i.uvs[x][F]=R[F];i.material=U;i.faceMaterial=null!==r.materialIndex?X[r.materialIndex]:null;i.z=i.centroidScreen.z;v.elements.push(i)}}else if(H instanceof THREE.Line){G.multiply(z,O);s=H.geometry.vertices;x=b();x.positionScreen.copy(s[0].position);G.multiplyVector4(x.positionScreen);for(N=1,r=s.length;N<r;N++)if(x=b(),x.positionScreen.copy(s[N].position),G.multiplyVector4(x.positionScreen),D=j[k-2],I.copy(x.positionScreen),A.copy(D.positionScreen),
 d(I,A))I.multiplyScalar(1/I.w),A.multiplyScalar(1/A.w),H=y[q]=y[q]||new THREE.RenderableLine,q++,o=H,o.v1.positionScreen.copy(I),o.v2.positionScreen.copy(A),o.z=Math.max(I.z,A.z),o.material=U,v.elements.push(o)}for(a=0,T=v.sprites.length;a<T;a++)if(H=v.sprites[a].object,O=H.matrixWorld,H instanceof THREE.Particle&&(w.set(O.n14,O.n24,O.n34,1),z.multiplyVector4(w),w.z/=w.w,0<w.z&&1>w.z))g=t[E]=t[E]||new THREE.RenderableParticle,E++,u=g,u.x=w.x/w.w,u.y=w.y/w.w,u.z=w.z,u.rotation=H.rotation.z,u.scale.x=
 H.scale.x*Math.abs(u.x-(w.x+e.projectionMatrix.n11)/(w.w+e.projectionMatrix.n14)),u.scale.y=H.scale.y*Math.abs(u.y-(w.y+e.projectionMatrix.n22)/(w.w+e.projectionMatrix.n24)),u.material=H.material,v.elements.push(u);f&&v.elements.sort(c);return v}};THREE.Quaternion=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=void 0!==d?d:1};
 THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this},clone:function(){return new THREE.Quaternion(this.x,this.y,this.z,this.w)},setFromEuler:function(a){var b=Math.PI/360,c=a.x*b,d=a.y*b,e=a.z*b,a=Math.cos(d),d=Math.sin(d),b=Math.cos(-e),e=Math.sin(-e),f=Math.cos(c),c=Math.sin(c),g=a*b,h=d*e;this.w=g*f-h*c;this.x=g*c+h*f;this.y=d*b*f+a*e*c;this.z=a*e*
 f-d*b*c;return this},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRotationMatrix:function(a){var b=Math.pow(a.determinant(),1/3);this.w=Math.sqrt(Math.max(0,b+a.n11+a.n22+a.n33))/2;this.x=Math.sqrt(Math.max(0,b+a.n11-a.n22-a.n33))/2;this.y=Math.sqrt(Math.max(0,b-a.n11+a.n22-a.n33))/2;this.z=Math.sqrt(Math.max(0,b-a.n11-a.n22+a.n33))/2;this.x=0>a.n32-a.n23?-Math.abs(this.x):Math.abs(this.x);this.y=0>a.n13-a.n31?
 -Math.abs(this.y):Math.abs(this.y);this.z=0>a.n21-a.n12?-Math.abs(this.z):Math.abs(this.z);this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);0===a?this.w=this.z=
 this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},multiplySelf:function(a){var b=this.x,c=this.y,d=this.z,e=this.w,f=a.x,g=a.y,h=a.z,a=a.w;this.x=b*a+e*f+c*h-d*g;this.y=c*a+e*g+d*f-b*h;this.z=d*a+e*h+b*g-c*f;this.w=e*a-b*f-c*g-d*h;return this},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,f=this.x,g=this.y,h=this.z,l=this.w,j=l*c+g*e-h*d,i=l*d+h*c-f*e,m=l*e+f*d-g*c,c=-f*c-g*d-h*e;b.x=j*l+c*-f+i*-h-m*-g;b.y=i*l+c*-g+m*-f-j*-h;b.z=m*l+c*-h+j*-g-i*-f;return b}};
+a);var c=a.x,d=a.y,e=a.z,f=this.x,g=this.y,h=this.z,k=this.w,j=k*c+g*e-h*d,i=k*d+h*c-f*e,m=k*e+f*d-g*c,c=-f*c-g*d-h*e;b.x=j*k+c*-f+i*-h-m*-g;b.y=i*k+c*-g+m*-f-j*-h;b.z=m*k+c*-h+j*-g-i*-f;return b}};
 THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;0>e?(c.w=-b.w,c.x=-b.x,c.y=-b.y,c.z=-b.z,e=-e):c.copy(b);if(1<=Math.abs(e))return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var f=Math.acos(e),e=Math.sqrt(1-e*e);if(0.0010>Math.abs(e))return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;b=Math.sin((1-d)*f)/e;d=Math.sin(d*f)/e;c.w=a.w*b+c.w*d;c.x=a.x*b+c.x*d;c.y=a.y*b+c.y*d;c.z=a.z*b+c.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
 THREE.Face3=function(a,b,c,d,e,f){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materialIndex=f;this.centroid=new THREE.Vector3};
 THREE.Face4=function(a,b,c,d,e,f,g){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materialIndex=g;this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.u=a||0;this.v=b||0};
@@ -87,12 +87,14 @@ THREE.Geometry.prototype={constructor:THREE.Geometry,applyMatrix:function(a){var
 b;a++)c=this.faces[a],c.centroid.set(0,0,0),c instanceof THREE.Face3?(c.centroid.addSelf(this.vertices[c.a].position),c.centroid.addSelf(this.vertices[c.b].position),c.centroid.addSelf(this.vertices[c.c].position),c.centroid.divideScalar(3)):c instanceof THREE.Face4&&(c.centroid.addSelf(this.vertices[c.a].position),c.centroid.addSelf(this.vertices[c.b].position),c.centroid.addSelf(this.vertices[c.c].position),c.centroid.addSelf(this.vertices[c.d].position),c.centroid.divideScalar(4))},computeFaceNormals:function(){var a,
 b,c,d,e,f,g=new THREE.Vector3,h=new THREE.Vector3;for(a=0,b=this.faces.length;a<b;a++)c=this.faces[a],d=this.vertices[c.a],e=this.vertices[c.b],f=this.vertices[c.c],g.sub(f.position,e.position),h.sub(d.position,e.position),g.crossSelf(h),g.isZero()||g.normalize(),c.normal.copy(g)},computeVertexNormals:function(){var a,b,c,d;if(void 0===this.__tmpVertices){d=this.__tmpVertices=Array(this.vertices.length);for(a=0,b=this.vertices.length;a<b;a++)d[a]=new THREE.Vector3;for(a=0,b=this.faces.length;a<b;a++)if(c=
 this.faces[a],c instanceof THREE.Face3)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(c instanceof THREE.Face4)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{d=this.__tmpVertices;for(a=0,b=this.vertices.length;a<b;a++)d[a].set(0,0,0)}for(a=0,b=this.faces.length;a<b;a++)c=this.faces[a],c instanceof THREE.Face3?(d[c.a].addSelf(c.normal),d[c.b].addSelf(c.normal),d[c.c].addSelf(c.normal)):c instanceof THREE.Face4&&(d[c.a].addSelf(c.normal),
-d[c.b].addSelf(c.normal),d[c.c].addSelf(c.normal),d[c.d].addSelf(c.normal));for(a=0,b=this.vertices.length;a<b;a++)d[a].normalize();for(a=0,b=this.faces.length;a<b;a++)c=this.faces[a],c instanceof THREE.Face3?(c.vertexNormals[0].copy(d[c.a]),c.vertexNormals[1].copy(d[c.b]),c.vertexNormals[2].copy(d[c.c])):c instanceof THREE.Face4&&(c.vertexNormals[0].copy(d[c.a]),c.vertexNormals[1].copy(d[c.b]),c.vertexNormals[2].copy(d[c.c]),c.vertexNormals[3].copy(d[c.d]))},computeTangents:function(){function a(a,
-b,c,d,e,f,D){h=a.vertices[b].position;l=a.vertices[c].position;j=a.vertices[d].position;i=g[e];m=g[f];n=g[D];k=l.x-h.x;p=j.x-h.x;o=l.y-h.y;q=j.y-h.y;y=l.z-h.z;u=j.z-h.z;E=m.u-i.u;t=n.u-i.u;v=m.v-i.v;B=n.v-i.v;w=1/(E*B-t*v);I.set((B*k-v*p)*w,(B*o-v*q)*w,(B*y-v*u)*w);A.set((E*p-t*k)*w,(E*q-t*o)*w,(E*u-t*y)*w);G[b].addSelf(I);G[c].addSelf(I);G[d].addSelf(I);C[b].addSelf(A);C[c].addSelf(A);C[d].addSelf(A)}var b,c,d,e,f,g,h,l,j,i,m,n,k,p,o,q,y,u,E,t,v,B,w,z,G=[],C=[],I=new THREE.Vector3,A=new THREE.Vector3,
-K=new THREE.Vector3,M=new THREE.Vector3,L=new THREE.Vector3;for(b=0,c=this.vertices.length;b<c;b++)G[b]=new THREE.Vector3,C[b]=new THREE.Vector3;for(b=0,c=this.faces.length;b<c;b++)f=this.faces[b],g=this.faceVertexUvs[0][b],f instanceof THREE.Face3?a(this,f.a,f.b,f.c,0,1,2):f instanceof THREE.Face4&&(a(this,f.a,f.b,f.c,0,1,2),a(this,f.a,f.b,f.d,0,1,3));var Q=["a","b","c","d"];for(b=0,c=this.faces.length;b<c;b++){f=this.faces[b];for(d=0;d<f.vertexNormals.length;d++)L.copy(f.vertexNormals[d]),e=f[Q[d]],
-z=G[e],K.copy(z),K.subSelf(L.multiplyScalar(L.dot(z))).normalize(),M.cross(f.vertexNormals[d],z),e=M.dot(C[e]),e=0>e?-1:1,f.vertexTangents[d]=new THREE.Vector4(K.x,K.y,K.z,e)}this.hasTangents=!0},computeBoundingBox:function(){if(!this.boundingBox)this.boundingBox={min:new THREE.Vector3,max:new THREE.Vector3};if(0<this.vertices.length){var a;a=this.vertices[0].position;this.boundingBox.min.copy(a);this.boundingBox.max.copy(a);for(var b=this.boundingBox.min,c=this.boundingBox.max,d=1,e=this.vertices.length;d<
-e;d++){a=this.vertices[d].position;if(a.x<b.x)b.x=a.x;else if(a.x>c.x)c.x=a.x;if(a.y<b.y)b.y=a.y;else if(a.y>c.y)c.y=a.y;if(a.z<b.z)b.z=a.z;else if(a.z>c.z)c.z=a.z}}else this.boundingBox.min.set(0,0,0),this.boundingBox.max.set(0,0,0)},computeBoundingSphere:function(){if(!this.boundingSphere)this.boundingSphere={radius:0};for(var a,b=0,c=0,d=this.vertices.length;c<d;c++)a=this.vertices[c].position.length(),a>b&&(b=a);this.boundingSphere.radius=b},mergeVertices:function(){var a={},b=[],c=[],d,e=Math.pow(10,
-4),f,g;for(f=0,g=this.vertices.length;f<g;f++)d=this.vertices[f].position,d=[Math.round(d.x*e),Math.round(d.y*e),Math.round(d.z*e)].join("_"),void 0===a[d]?(a[d]=f,b.push(this.vertices[f]),c[f]=b.length-1):c[f]=c[a[d]];for(f=0,g=this.faces.length;f<g;f++)if(a=this.faces[f],a instanceof THREE.Face3)a.a=c[a.a],a.b=c[a.b],a.c=c[a.c];else if(a instanceof THREE.Face4)a.a=c[a.a],a.b=c[a.b],a.c=c[a.c],a.d=c[a.d];this.vertices=b}};THREE.GeometryCount=0;
+d[c.b].addSelf(c.normal),d[c.c].addSelf(c.normal),d[c.d].addSelf(c.normal));for(a=0,b=this.vertices.length;a<b;a++)d[a].normalize();for(a=0,b=this.faces.length;a<b;a++)c=this.faces[a],c instanceof THREE.Face3?(c.vertexNormals[0].copy(d[c.a]),c.vertexNormals[1].copy(d[c.b]),c.vertexNormals[2].copy(d[c.c])):c instanceof THREE.Face4&&(c.vertexNormals[0].copy(d[c.a]),c.vertexNormals[1].copy(d[c.b]),c.vertexNormals[2].copy(d[c.c]),c.vertexNormals[3].copy(d[c.d]))},computeMorphNormals:function(){var a,
+b,c,d,e;for(c=0,d=this.faces.length;c<d;c++){e=this.faces[c];e.__originalVertexNormals=[];for(a=0,b=e.vertexNormals.length;a<b;a++)e.__originalVertexNormals[a]=e.vertexNormals[a].clone()}var f=new THREE.Geometry;f.faces=this.faces;for(a=0,b=this.morphTargets.length;a<b;a++){var g=this.morphNormals[a];f.vertices=this.morphTargets[a].vertices;f.computeFaceNormals();f.computeVertexNormals();var h,k;for(c=0,d=this.faces.length;c<d;c++)e=this.faces[c],h=g.faceNormals[c],k=g.vertexNormals[c],h.copy(e.normal),
+e instanceof THREE.Face3?(k.a.copy(e.vertexNormals[0]),k.b.copy(e.vertexNormals[1]),k.c.copy(e.vertexNormals[2])):(k.a.copy(e.vertexNormals[0]),k.b.copy(e.vertexNormals[1]),k.c.copy(e.vertexNormals[2]),k.d.copy(e.vertexNormals[3]))}for(c=0,d=this.faces.length;c<d;c++)e=this.faces[c],e.vertexNormals=e.__originalVertexNormals},computeTangents:function(){function a(a,b,c,d,e,f,D){h=a.vertices[b].position;k=a.vertices[c].position;j=a.vertices[d].position;i=g[e];m=g[f];n=g[D];l=k.x-h.x;p=j.x-h.x;o=k.y-
+h.y;q=j.y-h.y;y=k.z-h.z;u=j.z-h.z;E=m.u-i.u;t=n.u-i.u;v=m.v-i.v;B=n.v-i.v;w=1/(E*B-t*v);I.set((B*l-v*p)*w,(B*o-v*q)*w,(B*y-v*u)*w);A.set((E*p-t*l)*w,(E*q-t*o)*w,(E*u-t*y)*w);G[b].addSelf(I);G[c].addSelf(I);G[d].addSelf(I);C[b].addSelf(A);C[c].addSelf(A);C[d].addSelf(A)}var b,c,d,e,f,g,h,k,j,i,m,n,l,p,o,q,y,u,E,t,v,B,w,z,G=[],C=[],I=new THREE.Vector3,A=new THREE.Vector3,K=new THREE.Vector3,M=new THREE.Vector3,L=new THREE.Vector3;for(b=0,c=this.vertices.length;b<c;b++)G[b]=new THREE.Vector3,C[b]=new THREE.Vector3;
+for(b=0,c=this.faces.length;b<c;b++)f=this.faces[b],g=this.faceVertexUvs[0][b],f instanceof THREE.Face3?a(this,f.a,f.b,f.c,0,1,2):f instanceof THREE.Face4&&(a(this,f.a,f.b,f.c,0,1,2),a(this,f.a,f.b,f.d,0,1,3));var Q=["a","b","c","d"];for(b=0,c=this.faces.length;b<c;b++){f=this.faces[b];for(d=0;d<f.vertexNormals.length;d++)L.copy(f.vertexNormals[d]),e=f[Q[d]],z=G[e],K.copy(z),K.subSelf(L.multiplyScalar(L.dot(z))).normalize(),M.cross(f.vertexNormals[d],z),e=M.dot(C[e]),e=0>e?-1:1,f.vertexTangents[d]=
+new THREE.Vector4(K.x,K.y,K.z,e)}this.hasTangents=!0},computeBoundingBox:function(){if(!this.boundingBox)this.boundingBox={min:new THREE.Vector3,max:new THREE.Vector3};if(0<this.vertices.length){var a;a=this.vertices[0].position;this.boundingBox.min.copy(a);this.boundingBox.max.copy(a);for(var b=this.boundingBox.min,c=this.boundingBox.max,d=1,e=this.vertices.length;d<e;d++){a=this.vertices[d].position;if(a.x<b.x)b.x=a.x;else if(a.x>c.x)c.x=a.x;if(a.y<b.y)b.y=a.y;else if(a.y>c.y)c.y=a.y;if(a.z<b.z)b.z=
+a.z;else if(a.z>c.z)c.z=a.z}}else this.boundingBox.min.set(0,0,0),this.boundingBox.max.set(0,0,0)},computeBoundingSphere:function(){if(!this.boundingSphere)this.boundingSphere={radius:0};for(var a,b=0,c=0,d=this.vertices.length;c<d;c++)a=this.vertices[c].position.length(),a>b&&(b=a);this.boundingSphere.radius=b},mergeVertices:function(){var a={},b=[],c=[],d,e=Math.pow(10,4),f,g;for(f=0,g=this.vertices.length;f<g;f++)d=this.vertices[f].position,d=[Math.round(d.x*e),Math.round(d.y*e),Math.round(d.z*
+e)].join("_"),void 0===a[d]?(a[d]=f,b.push(this.vertices[f]),c[f]=b.length-1):c[f]=c[a[d]];for(f=0,g=this.faces.length;f<g;f++)if(a=this.faces[f],a instanceof THREE.Face3)a.a=c[a.a],a.b=c[a.b],a.c=c[a.c];else if(a instanceof THREE.Face4)a.a=c[a.a],a.b=c[a.b],a.c=c[a.c],a.d=c[a.d];this.vertices=b}};THREE.GeometryCount=0;
 THREE.Camera=function(){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;this.projectionMatrixInverse=new THREE.Matrix4};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;
 THREE.Camera.prototype.lookAt=function(a){this.matrix.lookAt(this.position,a,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)};THREE.OrthographicCamera=function(a,b,c,d,e,f){THREE.Camera.call(this);this.left=a;this.right=b;this.top=c;this.bottom=d;this.near=void 0!==e?e:0.1;this.far=void 0!==f?f:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=new THREE.Camera;THREE.OrthographicCamera.prototype.constructor=THREE.OrthographicCamera;
 THREE.OrthographicCamera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makeOrtho(this.left,this.right,this.top,this.bottom,this.near,this.far)};THREE.PerspectiveCamera=function(a,b,c,d){THREE.Camera.call(this);this.fov=void 0!==a?a:50;this.aspect=void 0!==b?b:1;this.near=void 0!==c?c:0.1;this.far=void 0!==d?d:2E3;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype=new THREE.Camera;THREE.PerspectiveCamera.prototype.constructor=THREE.PerspectiveCamera;
@@ -134,22 +136,22 @@ THREE.Scene=function(){THREE.Object3D.call(this);this.overrideMaterial=this.fog=
 THREE.Scene.prototype.addObject=function(a){if(a instanceof THREE.Light)-1===this.lights.indexOf(a)&&this.lights.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&-1===this.objects.indexOf(a)){this.objects.push(a);this.__objectsAdded.push(a);var b=this.__objectsRemoved.indexOf(a);-1!==b&&this.__objectsRemoved.splice(b,1)}for(b=0;b<a.children.length;b++)this.addObject(a.children[b])};
 THREE.Scene.prototype.removeObject=function(a){if(a instanceof THREE.Light){var b=this.lights.indexOf(a);-1!==b&&this.lights.splice(b,1)}else a instanceof THREE.Camera||(b=this.objects.indexOf(a),-1!==b&&(this.objects.splice(b,1),this.__objectsRemoved.push(a),b=this.__objectsAdded.indexOf(a),-1!==b&&this.__objectsAdded.splice(b,1)));for(b=0;b<a.children.length;b++)this.removeObject(a.children[b])};
 THREE.SVGRenderer=function(){function a(a,b,c,d){var e,f,g,h,j,i;for(e=0,f=a.length;e<f;e++)g=a[e],h=g.color,g instanceof THREE.DirectionalLight?(j=g.matrixWorld.getPosition(),i=c.dot(j),0>=i||(i*=g.intensity,d.r+=h.r*i,d.g+=h.g*i,d.b+=h.b*i)):g instanceof THREE.PointLight&&(j=g.matrixWorld.getPosition(),i=c.dot(G.sub(j,b).normalize()),0>=i||(i*=0==g.distance?1:1-Math.min(b.distanceTo(j)/g.distance,1),0!=i&&(i*=g.intensity,d.r+=h.r*i,d.g+=h.g*i,d.b+=h.b*i)))}function b(a){null==C[a]&&(C[a]=document.createElementNS("http://www.w3.org/2000/svg",
-"path"),0==L&&C[a].setAttribute("shape-rendering","crispEdges"));return C[a]}function c(a){a=0.5*(a+1);return 0>a?0:1<a?1:a}var d=this,e,f,g,h=new THREE.Projector,l=document.createElementNS("http://www.w3.org/2000/svg","svg"),j,i,m,n,k,p,o,q,y=new THREE.Rectangle,u=new THREE.Rectangle,E=!1,t=new THREE.Color,v=new THREE.Color,B=new THREE.Color,w=new THREE.Color,z,G=new THREE.Vector3,C=[],I=[],A,K,M,L=1;this.domElement=l;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,
-faces:0}};this.setQuality=function(a){switch(a){case "high":L=1;break;case "low":L=0}};this.setSize=function(a,b){j=a;i=b;m=j/2;n=i/2;l.setAttribute("viewBox",-m+" "+-n+" "+j+" "+i);l.setAttribute("width",j);l.setAttribute("height",i);y.set(-m,-n,m,n)};this.clear=function(){for(;0<l.childNodes.length;)l.removeChild(l.childNodes[0])};this.render=function(i,j){var C,G,r,s;this.autoClear&&this.clear();d.info.render.vertices=0;d.info.render.faces=0;e=h.projectScene(i,j,this.sortElements);f=e.elements;
-g=e.lights;M=K=0;if(E=0<g.length){v.setRGB(0,0,0);B.setRGB(0,0,0);w.setRGB(0,0,0);for(C=0,G=g.length;C<G;C++)s=g[C],r=s.color,s instanceof THREE.AmbientLight?(v.r+=r.r,v.g+=r.g,v.b+=r.b):s instanceof THREE.DirectionalLight?(B.r+=r.r,B.g+=r.g,B.b+=r.b):s instanceof THREE.PointLight&&(w.r+=r.r,w.g+=r.g,w.b+=r.b)}for(C=0,G=f.length;C<G;C++)if(r=f[C],s=r.material,s=s instanceof THREE.MeshFaceMaterial?r.faceMaterial:s,!(null==s||0==s.opacity))if(u.empty(),r instanceof THREE.RenderableParticle)k=r,k.x*=
-m,k.y*=-n;else if(r instanceof THREE.RenderableLine){if(k=r.v1,p=r.v2,k.positionScreen.x*=m,k.positionScreen.y*=-n,p.positionScreen.x*=m,p.positionScreen.y*=-n,u.addPoint(k.positionScreen.x,k.positionScreen.y),u.addPoint(p.positionScreen.x,p.positionScreen.y),y.intersects(u)){r=k;var x=p,D=M++;null==I[D]&&(I[D]=document.createElementNS("http://www.w3.org/2000/svg","line"),0==L&&I[D].setAttribute("shape-rendering","crispEdges"));A=I[D];A.setAttribute("x1",r.positionScreen.x);A.setAttribute("y1",r.positionScreen.y);
-A.setAttribute("x2",x.positionScreen.x);A.setAttribute("y2",x.positionScreen.y);s instanceof THREE.LineBasicMaterial&&(A.setAttribute("style","fill: none; stroke: "+s.color.getContextStyle()+"; stroke-width: "+s.linewidth+"; stroke-opacity: "+s.opacity+"; stroke-linecap: "+s.linecap+"; stroke-linejoin: "+s.linejoin),l.appendChild(A))}}else if(r instanceof THREE.RenderableFace3){if(k=r.v1,p=r.v2,o=r.v3,k.positionScreen.x*=m,k.positionScreen.y*=-n,p.positionScreen.x*=m,p.positionScreen.y*=-n,o.positionScreen.x*=
-m,o.positionScreen.y*=-n,u.addPoint(k.positionScreen.x,k.positionScreen.y),u.addPoint(p.positionScreen.x,p.positionScreen.y),u.addPoint(o.positionScreen.x,o.positionScreen.y),y.intersects(u)){var x=k,D=p,F=o;d.info.render.vertices+=3;d.info.render.faces++;A=b(K++);A.setAttribute("d","M "+x.positionScreen.x+" "+x.positionScreen.y+" L "+D.positionScreen.x+" "+D.positionScreen.y+" L "+F.positionScreen.x+","+F.positionScreen.y+"z");s instanceof THREE.MeshBasicMaterial?t.copy(s.color):s instanceof THREE.MeshLambertMaterial?
+"path"),0==L&&C[a].setAttribute("shape-rendering","crispEdges"));return C[a]}function c(a){a=0.5*(a+1);return 0>a?0:1<a?1:a}var d=this,e,f,g,h=new THREE.Projector,k=document.createElementNS("http://www.w3.org/2000/svg","svg"),j,i,m,n,l,p,o,q,y=new THREE.Rectangle,u=new THREE.Rectangle,E=!1,t=new THREE.Color,v=new THREE.Color,B=new THREE.Color,w=new THREE.Color,z,G=new THREE.Vector3,C=[],I=[],A,K,M,L=1;this.domElement=k;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,
+faces:0}};this.setQuality=function(a){switch(a){case "high":L=1;break;case "low":L=0}};this.setSize=function(a,b){j=a;i=b;m=j/2;n=i/2;k.setAttribute("viewBox",-m+" "+-n+" "+j+" "+i);k.setAttribute("width",j);k.setAttribute("height",i);y.set(-m,-n,m,n)};this.clear=function(){for(;0<k.childNodes.length;)k.removeChild(k.childNodes[0])};this.render=function(i,j){var C,G,r,s;this.autoClear&&this.clear();d.info.render.vertices=0;d.info.render.faces=0;e=h.projectScene(i,j,this.sortElements);f=e.elements;
+g=e.lights;M=K=0;if(E=0<g.length){v.setRGB(0,0,0);B.setRGB(0,0,0);w.setRGB(0,0,0);for(C=0,G=g.length;C<G;C++)s=g[C],r=s.color,s instanceof THREE.AmbientLight?(v.r+=r.r,v.g+=r.g,v.b+=r.b):s instanceof THREE.DirectionalLight?(B.r+=r.r,B.g+=r.g,B.b+=r.b):s instanceof THREE.PointLight&&(w.r+=r.r,w.g+=r.g,w.b+=r.b)}for(C=0,G=f.length;C<G;C++)if(r=f[C],s=r.material,s=s instanceof THREE.MeshFaceMaterial?r.faceMaterial:s,!(null==s||0==s.opacity))if(u.empty(),r instanceof THREE.RenderableParticle)l=r,l.x*=
+m,l.y*=-n;else if(r instanceof THREE.RenderableLine){if(l=r.v1,p=r.v2,l.positionScreen.x*=m,l.positionScreen.y*=-n,p.positionScreen.x*=m,p.positionScreen.y*=-n,u.addPoint(l.positionScreen.x,l.positionScreen.y),u.addPoint(p.positionScreen.x,p.positionScreen.y),y.intersects(u)){r=l;var x=p,D=M++;null==I[D]&&(I[D]=document.createElementNS("http://www.w3.org/2000/svg","line"),0==L&&I[D].setAttribute("shape-rendering","crispEdges"));A=I[D];A.setAttribute("x1",r.positionScreen.x);A.setAttribute("y1",r.positionScreen.y);
+A.setAttribute("x2",x.positionScreen.x);A.setAttribute("y2",x.positionScreen.y);s instanceof THREE.LineBasicMaterial&&(A.setAttribute("style","fill: none; stroke: "+s.color.getContextStyle()+"; stroke-width: "+s.linewidth+"; stroke-opacity: "+s.opacity+"; stroke-linecap: "+s.linecap+"; stroke-linejoin: "+s.linejoin),k.appendChild(A))}}else if(r instanceof THREE.RenderableFace3){if(l=r.v1,p=r.v2,o=r.v3,l.positionScreen.x*=m,l.positionScreen.y*=-n,p.positionScreen.x*=m,p.positionScreen.y*=-n,o.positionScreen.x*=
+m,o.positionScreen.y*=-n,u.addPoint(l.positionScreen.x,l.positionScreen.y),u.addPoint(p.positionScreen.x,p.positionScreen.y),u.addPoint(o.positionScreen.x,o.positionScreen.y),y.intersects(u)){var x=l,D=p,F=o;d.info.render.vertices+=3;d.info.render.faces++;A=b(K++);A.setAttribute("d","M "+x.positionScreen.x+" "+x.positionScreen.y+" L "+D.positionScreen.x+" "+D.positionScreen.y+" L "+F.positionScreen.x+","+F.positionScreen.y+"z");s instanceof THREE.MeshBasicMaterial?t.copy(s.color):s instanceof THREE.MeshLambertMaterial?
 E?(t.r=v.r,t.g=v.g,t.b=v.b,a(g,r.centroidWorld,r.normalWorld,t),t.r=Math.max(0,Math.min(s.color.r*t.r,1)),t.g=Math.max(0,Math.min(s.color.g*t.g,1)),t.b=Math.max(0,Math.min(s.color.b*t.b,1))):t.copy(s.color):s instanceof THREE.MeshDepthMaterial?(z=1-s.__2near/(s.__farPlusNear-r.z*s.__farMinusNear),t.setRGB(z,z,z)):s instanceof THREE.MeshNormalMaterial&&t.setRGB(c(r.normalWorld.x),c(r.normalWorld.y),c(r.normalWorld.z));s.wireframe?A.setAttribute("style","fill: none; stroke: "+t.getContextStyle()+"; stroke-width: "+
-s.wireframeLinewidth+"; stroke-opacity: "+s.opacity+"; stroke-linecap: "+s.wireframeLinecap+"; stroke-linejoin: "+s.wireframeLinejoin):A.setAttribute("style","fill: "+t.getContextStyle()+"; fill-opacity: "+s.opacity);l.appendChild(A)}}else if(r instanceof THREE.RenderableFace4&&(k=r.v1,p=r.v2,o=r.v3,q=r.v4,k.positionScreen.x*=m,k.positionScreen.y*=-n,p.positionScreen.x*=m,p.positionScreen.y*=-n,o.positionScreen.x*=m,o.positionScreen.y*=-n,q.positionScreen.x*=m,q.positionScreen.y*=-n,u.addPoint(k.positionScreen.x,
-k.positionScreen.y),u.addPoint(p.positionScreen.x,p.positionScreen.y),u.addPoint(o.positionScreen.x,o.positionScreen.y),u.addPoint(q.positionScreen.x,q.positionScreen.y),y.intersects(u))){var x=k,D=p,F=o,J=q;d.info.render.vertices+=4;d.info.render.faces++;A=b(K++);A.setAttribute("d","M "+x.positionScreen.x+" "+x.positionScreen.y+" L "+D.positionScreen.x+" "+D.positionScreen.y+" L "+F.positionScreen.x+","+F.positionScreen.y+" L "+J.positionScreen.x+","+J.positionScreen.y+"z");s instanceof THREE.MeshBasicMaterial?
+s.wireframeLinewidth+"; stroke-opacity: "+s.opacity+"; stroke-linecap: "+s.wireframeLinecap+"; stroke-linejoin: "+s.wireframeLinejoin):A.setAttribute("style","fill: "+t.getContextStyle()+"; fill-opacity: "+s.opacity);k.appendChild(A)}}else if(r instanceof THREE.RenderableFace4&&(l=r.v1,p=r.v2,o=r.v3,q=r.v4,l.positionScreen.x*=m,l.positionScreen.y*=-n,p.positionScreen.x*=m,p.positionScreen.y*=-n,o.positionScreen.x*=m,o.positionScreen.y*=-n,q.positionScreen.x*=m,q.positionScreen.y*=-n,u.addPoint(l.positionScreen.x,
+l.positionScreen.y),u.addPoint(p.positionScreen.x,p.positionScreen.y),u.addPoint(o.positionScreen.x,o.positionScreen.y),u.addPoint(q.positionScreen.x,q.positionScreen.y),y.intersects(u))){var x=l,D=p,F=o,J=q;d.info.render.vertices+=4;d.info.render.faces++;A=b(K++);A.setAttribute("d","M "+x.positionScreen.x+" "+x.positionScreen.y+" L "+D.positionScreen.x+" "+D.positionScreen.y+" L "+F.positionScreen.x+","+F.positionScreen.y+" L "+J.positionScreen.x+","+J.positionScreen.y+"z");s instanceof THREE.MeshBasicMaterial?
 t.copy(s.color):s instanceof THREE.MeshLambertMaterial?E?(t.r=v.r,t.g=v.g,t.b=v.b,a(g,r.centroidWorld,r.normalWorld,t),t.r=Math.max(0,Math.min(s.color.r*t.r,1)),t.g=Math.max(0,Math.min(s.color.g*t.g,1)),t.b=Math.max(0,Math.min(s.color.b*t.b,1))):t.copy(s.color):s instanceof THREE.MeshDepthMaterial?(z=1-s.__2near/(s.__farPlusNear-r.z*s.__farMinusNear),t.setRGB(z,z,z)):s instanceof THREE.MeshNormalMaterial&&t.setRGB(c(r.normalWorld.x),c(r.normalWorld.y),c(r.normalWorld.z));s.wireframe?A.setAttribute("style",
-"fill: none; stroke: "+t.getContextStyle()+"; stroke-width: "+s.wireframeLinewidth+"; stroke-opacity: "+s.opacity+"; stroke-linecap: "+s.wireframeLinecap+"; stroke-linejoin: "+s.wireframeLinejoin):A.setAttribute("style","fill: "+t.getContextStyle()+"; fill-opacity: "+s.opacity);l.appendChild(A)}}};THREE.RenderableVertex=function(){this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.visible=!0};
+"fill: none; stroke: "+t.getContextStyle()+"; stroke-width: "+s.wireframeLinewidth+"; stroke-opacity: "+s.opacity+"; stroke-linecap: "+s.wireframeLinecap+"; stroke-linejoin: "+s.wireframeLinejoin):A.setAttribute("style","fill: "+t.getContextStyle()+"; fill-opacity: "+s.opacity);k.appendChild(A)}}};THREE.RenderableVertex=function(){this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.visible=!0};
 THREE.RenderableVertex.prototype.copy=function(a){this.positionWorld.copy(a.positionWorld);this.positionScreen.copy(a.positionScreen)};
 THREE.RenderableFace3=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterial=this.material=null;this.uvs=[[]];this.z=null};
 THREE.RenderableFace4=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.v4=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterial=this.material=null;this.uvs=[[]];this.z=null};THREE.RenderableObject=function(){this.z=this.object=null};
 THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.material=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.material=null};
 THREE.ImageUtils={crossOrigin:"anonymous",loadTexture:function(a,b,c){var d=new Image,e=new THREE.Texture(d,b);d.onload=function(){e.needsUpdate=!0;c&&c(this)};d.crossOrigin=this.crossOrigin;d.src=a;return e},loadTextureCube:function(a,b,c){var d,e=[],f=new THREE.Texture(e,b);e.loadCount=0;for(b=0,d=a.length;b<d;++b)e[b]=new Image,e[b].onload=function(){e.loadCount+=1;if(6===e.loadCount)f.needsUpdate=!0;c&&c(this)},e[b].crossOrigin=this.crossOrigin,e[b].src=a[b];return f},getNormalMap:function(a,
-b){var c=function(a){var b=Math.sqrt(a[0]*a[0]+a[1]*a[1]+a[2]*a[2]);return[a[0]/b,a[1]/b,a[2]/b]},b=b|1,d=a.width,e=a.height,f=document.createElement("canvas");f.width=d;f.height=e;var g=f.getContext("2d");g.drawImage(a,0,0);for(var h=g.getImageData(0,0,d,e).data,l=g.createImageData(d,e),j=l.data,i=0;i<d;i++)for(var m=1;m<e;m++){var n=0>m-1?e-1:m-1,k=(m+1)%e,p=0>i-1?d-1:i-1,o=(i+1)%d,q=[],y=[0,0,h[4*(m*d+i)]/255*b];q.push([-1,0,h[4*(m*d+p)]/255*b]);q.push([-1,-1,h[4*(n*d+p)]/255*b]);q.push([0,-1,
-h[4*(n*d+i)]/255*b]);q.push([1,-1,h[4*(n*d+o)]/255*b]);q.push([1,0,h[4*(m*d+o)]/255*b]);q.push([1,1,h[4*(k*d+o)]/255*b]);q.push([0,1,h[4*(k*d+i)]/255*b]);q.push([-1,1,h[4*(k*d+p)]/255*b]);n=[];p=q.length;for(k=0;k<p;k++){var o=q[k],u=q[(k+1)%p],o=[o[0]-y[0],o[1]-y[1],o[2]-y[2]],u=[u[0]-y[0],u[1]-y[1],u[2]-y[2]];n.push(c([o[1]*u[2]-o[2]*u[1],o[2]*u[0]-o[0]*u[2],o[0]*u[1]-o[1]*u[0]]))}q=[0,0,0];for(k=0;k<n.length;k++)q[0]+=n[k][0],q[1]+=n[k][1],q[2]+=n[k][2];q[0]/=n.length;q[1]/=n.length;q[2]/=n.length;
-y=4*(m*d+i);j[y]=255*((q[0]+1)/2)|0;j[y+1]=255*(q[1]+0.5)|0;j[y+2]=255*q[2]|0;j[y+3]=255}g.putImageData(l,0,0);return f}};
+b){var c=function(a){var b=Math.sqrt(a[0]*a[0]+a[1]*a[1]+a[2]*a[2]);return[a[0]/b,a[1]/b,a[2]/b]},b=b|1,d=a.width,e=a.height,f=document.createElement("canvas");f.width=d;f.height=e;var g=f.getContext("2d");g.drawImage(a,0,0);for(var h=g.getImageData(0,0,d,e).data,k=g.createImageData(d,e),j=k.data,i=0;i<d;i++)for(var m=1;m<e;m++){var n=0>m-1?e-1:m-1,l=(m+1)%e,p=0>i-1?d-1:i-1,o=(i+1)%d,q=[],y=[0,0,h[4*(m*d+i)]/255*b];q.push([-1,0,h[4*(m*d+p)]/255*b]);q.push([-1,-1,h[4*(n*d+p)]/255*b]);q.push([0,-1,
+h[4*(n*d+i)]/255*b]);q.push([1,-1,h[4*(n*d+o)]/255*b]);q.push([1,0,h[4*(m*d+o)]/255*b]);q.push([1,1,h[4*(l*d+o)]/255*b]);q.push([0,1,h[4*(l*d+i)]/255*b]);q.push([-1,1,h[4*(l*d+p)]/255*b]);n=[];p=q.length;for(l=0;l<p;l++){var o=q[l],u=q[(l+1)%p],o=[o[0]-y[0],o[1]-y[1],o[2]-y[2]],u=[u[0]-y[0],u[1]-y[1],u[2]-y[2]];n.push(c([o[1]*u[2]-o[2]*u[1],o[2]*u[0]-o[0]*u[2],o[0]*u[1]-o[1]*u[0]]))}q=[0,0,0];for(l=0;l<n.length;l++)q[0]+=n[l][0],q[1]+=n[l][1],q[2]+=n[l][2];q[0]/=n.length;q[1]/=n.length;q[2]/=n.length;
+y=4*(m*d+i);j[y]=255*((q[0]+1)/2)|0;j[y+1]=255*(q[1]+0.5)|0;j[y+2]=255*q[2]|0;j[y+3]=255}g.putImageData(k,0,0);return f}};

+ 69 - 67
build/custom/ThreeWebGL.js

@@ -19,65 +19,65 @@ normalize:function(){return this.divideScalar(this.length())},setLength:function
 THREE.Frustum.prototype.setFromMatrix=function(a){var b,c=this.planes;c[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);c[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);c[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+a.n23,a.n44+a.n24);c[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);c[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);c[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+a.n33,a.n44+a.n34);for(a=0;6>a;a++)b=c[a],b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))};
 THREE.Frustum.prototype.contains=function(a){for(var b=this.planes,c=a.matrixWorld,d=THREE.Frustum.__v1.set(c.getColumnX().length(),c.getColumnY().length(),c.getColumnZ().length()),d=-a.geometry.boundingSphere.radius*Math.max(d.x,Math.max(d.y,d.z)),e=0;6>e;e++)if(a=b[e].x*c.n14+b[e].y*c.n24+b[e].z*c.n34+b[e].w,a<=d)return!1;return!0};THREE.Frustum.__v1=new THREE.Vector3;
 THREE.Ray=function(a,b){function c(a,b,c){p.sub(c,a);r=p.dot(b);y=q.add(a,o.copy(b).multiplyScalar(r));return u=c.distanceTo(y)}function d(a,b,c,d){p.sub(d,b);q.sub(c,b);o.sub(a,b);L=p.dot(p);A=p.dot(q);v=p.dot(o);B=q.dot(q);C=q.dot(o);I=1/(L*B-A*A);M=(B*v-A*C)*I;N=(L*C-A*v)*I;return 0<=M&&0<=N&&1>M+N}this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3;this.intersectScene=function(a){return this.intersectObjects(a.children)};this.intersectObjects=function(a){var b,c,d=[];for(b=0,
-c=a.length;b<c;b++)Array.prototype.push.apply(d,this.intersectObject(a[b]));d.sort(function(a,b){return a.distance-b.distance});return d};var e=new THREE.Vector3,g=new THREE.Vector3,h=new THREE.Vector3,i=new THREE.Vector3,m=new THREE.Vector3,k=new THREE.Vector3,j=new THREE.Vector3,n=new THREE.Vector3,l=new THREE.Vector3;this.intersectObject=function(a){for(var b,q=[],p=0,o=a.children.length;p<o;p++)Array.prototype.push.apply(q,this.intersectObject(a.children[p]));if(a instanceof THREE.Particle){p=
+c=a.length;b<c;b++)Array.prototype.push.apply(d,this.intersectObject(a[b]));d.sort(function(a,b){return a.distance-b.distance});return d};var e=new THREE.Vector3,g=new THREE.Vector3,h=new THREE.Vector3,i=new THREE.Vector3,k=new THREE.Vector3,m=new THREE.Vector3,j=new THREE.Vector3,n=new THREE.Vector3,l=new THREE.Vector3;this.intersectObject=function(a){for(var b,q=[],p=0,o=a.children.length;p<o;p++)Array.prototype.push.apply(q,this.intersectObject(a.children[p]));if(a instanceof THREE.Particle){p=
 c(this.origin,this.direction,a.matrixWorld.getPosition());if(p>a.scale.x)return[];b={distance:p,point:a.position,face:null,object:a};q.push(b)}else if(a instanceof THREE.Mesh){p=c(this.origin,this.direction,a.matrixWorld.getPosition());o=THREE.Frustum.__v1.set(a.matrixWorld.getColumnX().length(),a.matrixWorld.getColumnY().length(),a.matrixWorld.getColumnZ().length());if(p>a.geometry.boundingSphere.radius*Math.max(o.x,Math.max(o.y,o.z)))return q;var r,y,f=a.geometry,u=f.vertices,v;a.matrixRotationWorld.extractRotation(a.matrixWorld);
-for(p=0,o=f.faces.length;p<o;p++)if(b=f.faces[p],m.copy(this.origin),k.copy(this.direction),v=a.matrixWorld,j=v.multiplyVector3(j.copy(b.centroid)).subSelf(m),n=a.matrixRotationWorld.multiplyVector3(n.copy(b.normal)),r=k.dot(n),!(1.0E-4>Math.abs(r))&&(y=n.dot(j)/r,!(0>y)&&(a.doubleSided||(a.flipSided?0<r:0>r))))if(l.add(m,k.multiplyScalar(y)),b instanceof THREE.Face3)e=v.multiplyVector3(e.copy(u[b.a].position)),g=v.multiplyVector3(g.copy(u[b.b].position)),h=v.multiplyVector3(h.copy(u[b.c].position)),
-d(l,e,g,h)&&(b={distance:m.distanceTo(l),point:l.clone(),face:b,object:a},q.push(b));else if(b instanceof THREE.Face4&&(e=v.multiplyVector3(e.copy(u[b.a].position)),g=v.multiplyVector3(g.copy(u[b.b].position)),h=v.multiplyVector3(h.copy(u[b.c].position)),i=v.multiplyVector3(i.copy(u[b.d].position)),d(l,e,g,i)||d(l,g,h,i)))b={distance:m.distanceTo(l),point:l.clone(),face:b,object:a},q.push(b)}return q};var p=new THREE.Vector3,q=new THREE.Vector3,o=new THREE.Vector3,r,y,u,L,A,v,B,C,I,M,N};
+for(p=0,o=f.faces.length;p<o;p++)if(b=f.faces[p],k.copy(this.origin),m.copy(this.direction),v=a.matrixWorld,j=v.multiplyVector3(j.copy(b.centroid)).subSelf(k),n=a.matrixRotationWorld.multiplyVector3(n.copy(b.normal)),r=m.dot(n),!(1.0E-4>Math.abs(r))&&(y=n.dot(j)/r,!(0>y)&&(a.doubleSided||(a.flipSided?0<r:0>r))))if(l.add(k,m.multiplyScalar(y)),b instanceof THREE.Face3)e=v.multiplyVector3(e.copy(u[b.a].position)),g=v.multiplyVector3(g.copy(u[b.b].position)),h=v.multiplyVector3(h.copy(u[b.c].position)),
+d(l,e,g,h)&&(b={distance:k.distanceTo(l),point:l.clone(),face:b,object:a},q.push(b));else if(b instanceof THREE.Face4&&(e=v.multiplyVector3(e.copy(u[b.a].position)),g=v.multiplyVector3(g.copy(u[b.b].position)),h=v.multiplyVector3(h.copy(u[b.c].position)),i=v.multiplyVector3(i.copy(u[b.d].position)),d(l,e,g,i)||d(l,g,h,i)))b={distance:k.distanceTo(l),point:l.clone(),face:b,object:a},q.push(b)}return q};var p=new THREE.Vector3,q=new THREE.Vector3,o=new THREE.Vector3,r,y,u,L,A,v,B,C,I,M,N};
 THREE.Rectangle=function(){function a(){g=d-b;h=e-c}var b,c,d,e,g,h,i=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return g};this.getHeight=function(){return h};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return e};this.set=function(g,h,j,n){i=!1;b=g;c=h;d=j;e=n;a()};this.addPoint=function(g,h){i?(i=!1,b=g,c=h,d=g,e=h):(b=b<g?b:g,c=c<h?c:h,d=d>g?d:g,e=e>h?e:h);a()};this.add3Points=
 function(g,h,j,n,l,p){i?(i=!1,b=g<j?g<l?g:l:j<l?j:l,c=h<n?h<p?h:p:n<p?n:p,d=g>j?g>l?g:l:j>l?j:l,e=h>n?h>p?h:p:n>p?n:p):(b=g<j?g<l?g<b?g:b:l<b?l:b:j<l?j<b?j:b:l<b?l:b,c=h<n?h<p?h<c?h:c:p<c?p:c:n<p?n<c?n:c:p<c?p:c,d=g>j?g>l?g>d?g:d:l>d?l:d:j>l?j>d?j:d:l>d?l:d,e=h>n?h>p?h>e?h:e:p>e?p:e:n>p?n>e?n:e:p>e?p:e);a()};this.addRectangle=function(g){i?(i=!1,b=g.getLeft(),c=g.getTop(),d=g.getRight(),e=g.getBottom()):(b=b<g.getLeft()?b:g.getLeft(),c=c<g.getTop()?c:g.getTop(),d=d>g.getRight()?d:g.getRight(),e=e>
 g.getBottom()?e:g.getBottom());a()};this.inflate=function(g){b-=g;c-=g;d+=g;e+=g;a()};this.minSelf=function(g){b=b>g.getLeft()?b:g.getLeft();c=c>g.getTop()?c:g.getTop();d=d<g.getRight()?d:g.getRight();e=e<g.getBottom()?e:g.getBottom();a()};this.intersects=function(a){return d<a.getLeft()||b>a.getRight()||e<a.getTop()||c>a.getBottom()?!1:!0};this.empty=function(){i=!0;e=d=c=b=0;a()};this.isEmpty=function(){return i}};
 THREE.Math={clamp:function(a,b,c){return a<b?b:a>c?c:a},clampBottom:function(a,b){return a<b?b:a},mapLinear:function(a,b,c,d,e){return d+(a-b)*(e-d)/(c-b)},random16:function(){return(65280*Math.random()+255*Math.random())/65535},randInt:function(a,b){return a+Math.floor(Math.random()*(b-a+1))},randFloat:function(a,b){return a+Math.random()*(b-a)},randFloatSpread:function(a){return a*(0.5-Math.random())}};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,d,e,g,h,i,m,k,j,n,l,p,q,o){this.set(void 0!==a?a:1,b||0,c||0,d||0,e||0,void 0!==g?g:1,h||0,i||0,m||0,k||0,void 0!==j?j:1,n||0,l||0,p||0,q||0,void 0!==o?o:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
-THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,e,g,h,i,m,k,j,n,l,p,q,o){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=e;this.n22=g;this.n23=h;this.n24=i;this.n31=m;this.n32=k;this.n33=j;this.n34=n;this.n41=l;this.n42=p;this.n43=q;this.n44=o;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,
-b,c){var d=THREE.Matrix4.__v1,e=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;g.sub(a,b).normalize();if(0===g.length())g.z=1;d.cross(c,g).normalize();0===d.length()&&(g.x+=1.0E-4,d.cross(c,g).normalize());e.cross(g,d).normalize();this.n11=d.x;this.n12=e.x;this.n13=g.x;this.n21=d.y;this.n22=e.y;this.n23=g.y;this.n31=d.z;this.n32=e.z;this.n33=g.z;return this},multiply:function(a,b){var c=a.n11,d=a.n12,e=a.n13,g=a.n14,h=a.n21,i=a.n22,m=a.n23,k=a.n24,j=a.n31,n=a.n32,l=a.n33,p=a.n34,q=a.n41,o=a.n42,r=a.n43,
-y=a.n44,u=b.n11,L=b.n12,A=b.n13,v=b.n14,B=b.n21,C=b.n22,I=b.n23,M=b.n24,N=b.n31,J=b.n32,T=b.n33,wa=b.n34,la=b.n41,aa=b.n42,$=b.n43,E=b.n44;this.n11=c*u+d*B+e*N+g*la;this.n12=c*L+d*C+e*J+g*aa;this.n13=c*A+d*I+e*T+g*$;this.n14=c*v+d*M+e*wa+g*E;this.n21=h*u+i*B+m*N+k*la;this.n22=h*L+i*C+m*J+k*aa;this.n23=h*A+i*I+m*T+k*$;this.n24=h*v+i*M+m*wa+k*E;this.n31=j*u+n*B+l*N+p*la;this.n32=j*L+n*C+l*J+p*aa;this.n33=j*A+n*I+l*T+p*$;this.n34=j*v+n*M+l*wa+p*E;this.n41=q*u+o*B+r*N+y*la;this.n42=q*L+o*C+r*J+y*aa;this.n43=
+THREE.Matrix4=function(a,b,c,d,e,g,h,i,k,m,j,n,l,p,q,o){this.set(void 0!==a?a:1,b||0,c||0,d||0,e||0,void 0!==g?g:1,h||0,i||0,k||0,m||0,void 0!==j?j:1,n||0,l||0,p||0,q||0,void 0!==o?o:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
+THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,e,g,h,i,k,m,j,n,l,p,q,o){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=e;this.n22=g;this.n23=h;this.n24=i;this.n31=k;this.n32=m;this.n33=j;this.n34=n;this.n41=l;this.n42=p;this.n43=q;this.n44=o;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,
+b,c){var d=THREE.Matrix4.__v1,e=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;g.sub(a,b).normalize();if(0===g.length())g.z=1;d.cross(c,g).normalize();0===d.length()&&(g.x+=1.0E-4,d.cross(c,g).normalize());e.cross(g,d).normalize();this.n11=d.x;this.n12=e.x;this.n13=g.x;this.n21=d.y;this.n22=e.y;this.n23=g.y;this.n31=d.z;this.n32=e.z;this.n33=g.z;return this},multiply:function(a,b){var c=a.n11,d=a.n12,e=a.n13,g=a.n14,h=a.n21,i=a.n22,k=a.n23,m=a.n24,j=a.n31,n=a.n32,l=a.n33,p=a.n34,q=a.n41,o=a.n42,r=a.n43,
+y=a.n44,u=b.n11,L=b.n12,A=b.n13,v=b.n14,B=b.n21,C=b.n22,I=b.n23,M=b.n24,N=b.n31,J=b.n32,T=b.n33,wa=b.n34,la=b.n41,aa=b.n42,$=b.n43,E=b.n44;this.n11=c*u+d*B+e*N+g*la;this.n12=c*L+d*C+e*J+g*aa;this.n13=c*A+d*I+e*T+g*$;this.n14=c*v+d*M+e*wa+g*E;this.n21=h*u+i*B+k*N+m*la;this.n22=h*L+i*C+k*J+m*aa;this.n23=h*A+i*I+k*T+m*$;this.n24=h*v+i*M+k*wa+m*E;this.n31=j*u+n*B+l*N+p*la;this.n32=j*L+n*C+l*J+p*aa;this.n33=j*A+n*I+l*T+p*$;this.n34=j*v+n*M+l*wa+p*E;this.n41=q*u+o*B+r*N+y*la;this.n42=q*L+o*C+r*J+y*aa;this.n43=
 q*A+o*I+r*T+y*$;this.n44=q*v+o*M+r*wa+y*E;return this},multiplySelf:function(a){return this.multiply(this,a)},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;c[3]=this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=
 a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},multiplyVector3:function(a){var b=a.x,c=a.y,d=a.z,e=1/(this.n41*b+this.n42*c+this.n43*d+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*d+this.n14)*e;a.y=(this.n21*b+this.n22*c+this.n23*d+this.n24)*e;a.z=(this.n31*b+this.n32*c+this.n33*d+this.n34)*e;return a},multiplyVector4:function(a){var b=a.x,c=a.y,d=a.z,e=a.w;a.x=this.n11*b+this.n12*c+this.n13*d+this.n14*e;a.y=
 this.n21*b+this.n22*c+this.n23*d+this.n24*e;a.z=this.n31*b+this.n32*c+this.n33*d+this.n34*e;a.w=this.n41*b+this.n42*c+this.n43*d+this.n44*e;return a},rotateAxis:function(a){var b=a.x,c=a.y,d=a.z;a.x=b*this.n11+c*this.n12+d*this.n13;a.y=b*this.n21+c*this.n22+d*this.n23;a.z=b*this.n31+c*this.n32+d*this.n33;a.normalize();return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*
-a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},determinant:function(){var a=this.n11,b=this.n12,c=this.n13,d=this.n14,e=this.n21,g=this.n22,h=this.n23,i=this.n24,m=this.n31,k=this.n32,j=this.n33,n=this.n34,l=this.n41,p=this.n42,q=this.n43,o=this.n44;return d*h*k*l-c*i*k*l-d*g*j*l+b*i*j*l+c*g*n*l-b*h*n*l-d*h*m*p+c*i*m*p+d*e*j*p-a*i*j*p-c*e*n*p+a*h*n*p+d*g*m*q-b*i*m*q-d*e*k*q+a*i*k*q+b*e*n*q-a*g*n*q-c*g*m*o+b*h*m*o+c*e*k*o-a*h*k*o-
+a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},determinant:function(){var a=this.n11,b=this.n12,c=this.n13,d=this.n14,e=this.n21,g=this.n22,h=this.n23,i=this.n24,k=this.n31,m=this.n32,j=this.n33,n=this.n34,l=this.n41,p=this.n42,q=this.n43,o=this.n44;return d*h*m*l-c*i*m*l-d*g*j*l+b*i*j*l+c*g*n*l-b*h*n*l-d*h*k*p+c*i*k*p+d*e*j*p-a*i*j*p-c*e*n*p+a*h*n*p+d*g*k*q-b*i*k*q-d*e*m*q+a*i*m*q+b*e*n*q-a*g*n*q-c*g*k*o+b*h*k*o+c*e*m*o-a*h*m*o-
 b*e*j*o+a*g*j*o},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n34=a;return this},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),d=Math.sin(b),e=1-c,g=a.x,h=a.y,i=a.z,m=e*g,k=e*h;this.set(m*g+c,m*h-d*i,m*i+d*h,0,m*h+d*i,k*h+c,k*i-d*g,0,m*i-d*h,k*i+d*g,e*i*i+c,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},getPosition:function(){return THREE.Matrix4.__v1.set(this.n14,this.n24,this.n34)},getColumnX:function(){return THREE.Matrix4.__v1.set(this.n11,this.n21,this.n31)},getColumnY:function(){return THREE.Matrix4.__v1.set(this.n12,
-this.n22,this.n32)},getColumnZ:function(){return THREE.Matrix4.__v1.set(this.n13,this.n23,this.n33)},getInverse:function(a){var b=a.n11,c=a.n12,d=a.n13,e=a.n14,g=a.n21,h=a.n22,i=a.n23,m=a.n24,k=a.n31,j=a.n32,n=a.n33,l=a.n34,p=a.n41,q=a.n42,o=a.n43,r=a.n44;this.n11=i*l*q-m*n*q+m*j*o-h*l*o-i*j*r+h*n*r;this.n12=e*n*q-d*l*q-e*j*o+c*l*o+d*j*r-c*n*r;this.n13=d*m*q-e*i*q+e*h*o-c*m*o-d*h*r+c*i*r;this.n14=e*i*j-d*m*j-e*h*n+c*m*n+d*h*l-c*i*l;this.n21=m*n*p-i*l*p-m*k*o+g*l*o+i*k*r-g*n*r;this.n22=d*l*p-e*n*p+
-e*k*o-b*l*o-d*k*r+b*n*r;this.n23=e*i*p-d*m*p-e*g*o+b*m*o+d*g*r-b*i*r;this.n24=d*m*k-e*i*k+e*g*n-b*m*n-d*g*l+b*i*l;this.n31=h*l*p-m*j*p+m*k*q-g*l*q-h*k*r+g*j*r;this.n32=e*j*p-c*l*p-e*k*q+b*l*q+c*k*r-b*j*r;this.n33=c*m*p-e*h*p+e*g*q-b*m*q-c*g*r+b*h*r;this.n34=e*h*k-c*m*k-e*g*j+b*m*j+c*g*l-b*h*l;this.n41=i*j*p-h*n*p-i*k*q+g*n*q+h*k*o-g*j*o;this.n42=c*n*p-d*j*p+d*k*q-b*n*q-c*k*o+b*j*o;this.n43=d*h*p-c*i*p-d*g*q+b*i*q+c*g*o-b*h*o;this.n44=c*i*k-d*h*k+d*g*j-b*i*j-c*g*n+b*h*n;this.multiplyScalar(1/a.determinant());
-return this},setRotationFromEuler:function(a,b){var c=a.x,d=a.y,e=a.z,g=Math.cos(c),c=Math.sin(c),h=Math.cos(d),d=Math.sin(d),i=Math.cos(e),e=Math.sin(e);switch(b){case "YXZ":var m=h*i,k=h*e,j=d*i,n=d*e;this.n11=m+n*c;this.n12=j*c-k;this.n13=g*d;this.n21=g*e;this.n22=g*i;this.n23=-c;this.n31=k*c-j;this.n32=n+m*c;this.n33=g*h;break;case "ZXY":m=h*i;k=h*e;j=d*i;n=d*e;this.n11=m-n*c;this.n12=-g*e;this.n13=j+k*c;this.n21=k+j*c;this.n22=g*i;this.n23=n-m*c;this.n31=-g*d;this.n32=c;this.n33=g*h;break;case "ZYX":m=
-g*i;k=g*e;j=c*i;n=c*e;this.n11=h*i;this.n12=j*d-k;this.n13=m*d+n;this.n21=h*e;this.n22=n*d+m;this.n23=k*d-j;this.n31=-d;this.n32=c*h;this.n33=g*h;break;case "YZX":m=g*h;k=g*d;j=c*h;n=c*d;this.n11=h*i;this.n12=n-m*e;this.n13=j*e+k;this.n21=e;this.n22=g*i;this.n23=-c*i;this.n31=-d*i;this.n32=k*e+j;this.n33=m-n*e;break;case "XZY":m=g*h;k=g*d;j=c*h;n=c*d;this.n11=h*i;this.n12=-e;this.n13=d*i;this.n21=m*e+n;this.n22=g*i;this.n23=k*e-j;this.n31=j*e-k;this.n32=c*i;this.n33=n*e+m;break;default:m=g*i,k=g*
-e,j=c*i,n=c*e,this.n11=h*i,this.n12=-h*e,this.n13=d,this.n21=k+j*d,this.n22=m-n*d,this.n23=-c*h,this.n31=n-m*d,this.n32=j+k*d,this.n33=g*h}return this},setRotationFromQuaternion:function(a){var b=a.x,c=a.y,d=a.z,e=a.w,g=b+b,h=c+c,i=d+d,a=b*g,m=b*h,b=b*i,k=c*h,c=c*i,d=d*i,g=e*g,h=e*h,e=e*i;this.n11=1-(k+d);this.n12=m-e;this.n13=b+h;this.n21=m+e;this.n22=1-(a+d);this.n23=c-g;this.n31=b-h;this.n32=c+g;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*=
+0,a,b,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),e=1-c,g=a.x,h=a.y,i=a.z,k=e*g,m=e*h;this.set(k*g+c,k*h-d*i,k*i+d*h,0,k*h+d*i,m*h+c,m*i-d*g,0,k*i-d*h,m*i+d*g,e*i*i+c,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},getPosition:function(){return THREE.Matrix4.__v1.set(this.n14,this.n24,this.n34)},getColumnX:function(){return THREE.Matrix4.__v1.set(this.n11,this.n21,this.n31)},getColumnY:function(){return THREE.Matrix4.__v1.set(this.n12,
+this.n22,this.n32)},getColumnZ:function(){return THREE.Matrix4.__v1.set(this.n13,this.n23,this.n33)},getInverse:function(a){var b=a.n11,c=a.n12,d=a.n13,e=a.n14,g=a.n21,h=a.n22,i=a.n23,k=a.n24,m=a.n31,j=a.n32,n=a.n33,l=a.n34,p=a.n41,q=a.n42,o=a.n43,r=a.n44;this.n11=i*l*q-k*n*q+k*j*o-h*l*o-i*j*r+h*n*r;this.n12=e*n*q-d*l*q-e*j*o+c*l*o+d*j*r-c*n*r;this.n13=d*k*q-e*i*q+e*h*o-c*k*o-d*h*r+c*i*r;this.n14=e*i*j-d*k*j-e*h*n+c*k*n+d*h*l-c*i*l;this.n21=k*n*p-i*l*p-k*m*o+g*l*o+i*m*r-g*n*r;this.n22=d*l*p-e*n*p+
+e*m*o-b*l*o-d*m*r+b*n*r;this.n23=e*i*p-d*k*p-e*g*o+b*k*o+d*g*r-b*i*r;this.n24=d*k*m-e*i*m+e*g*n-b*k*n-d*g*l+b*i*l;this.n31=h*l*p-k*j*p+k*m*q-g*l*q-h*m*r+g*j*r;this.n32=e*j*p-c*l*p-e*m*q+b*l*q+c*m*r-b*j*r;this.n33=c*k*p-e*h*p+e*g*q-b*k*q-c*g*r+b*h*r;this.n34=e*h*m-c*k*m-e*g*j+b*k*j+c*g*l-b*h*l;this.n41=i*j*p-h*n*p-i*m*q+g*n*q+h*m*o-g*j*o;this.n42=c*n*p-d*j*p+d*m*q-b*n*q-c*m*o+b*j*o;this.n43=d*h*p-c*i*p-d*g*q+b*i*q+c*g*o-b*h*o;this.n44=c*i*m-d*h*m+d*g*j-b*i*j-c*g*n+b*h*n;this.multiplyScalar(1/a.determinant());
+return this},setRotationFromEuler:function(a,b){var c=a.x,d=a.y,e=a.z,g=Math.cos(c),c=Math.sin(c),h=Math.cos(d),d=Math.sin(d),i=Math.cos(e),e=Math.sin(e);switch(b){case "YXZ":var k=h*i,m=h*e,j=d*i,n=d*e;this.n11=k+n*c;this.n12=j*c-m;this.n13=g*d;this.n21=g*e;this.n22=g*i;this.n23=-c;this.n31=m*c-j;this.n32=n+k*c;this.n33=g*h;break;case "ZXY":k=h*i;m=h*e;j=d*i;n=d*e;this.n11=k-n*c;this.n12=-g*e;this.n13=j+m*c;this.n21=m+j*c;this.n22=g*i;this.n23=n-k*c;this.n31=-g*d;this.n32=c;this.n33=g*h;break;case "ZYX":k=
+g*i;m=g*e;j=c*i;n=c*e;this.n11=h*i;this.n12=j*d-m;this.n13=k*d+n;this.n21=h*e;this.n22=n*d+k;this.n23=m*d-j;this.n31=-d;this.n32=c*h;this.n33=g*h;break;case "YZX":k=g*h;m=g*d;j=c*h;n=c*d;this.n11=h*i;this.n12=n-k*e;this.n13=j*e+m;this.n21=e;this.n22=g*i;this.n23=-c*i;this.n31=-d*i;this.n32=m*e+j;this.n33=k-n*e;break;case "XZY":k=g*h;m=g*d;j=c*h;n=c*d;this.n11=h*i;this.n12=-e;this.n13=d*i;this.n21=k*e+n;this.n22=g*i;this.n23=m*e-j;this.n31=j*e-m;this.n32=c*i;this.n33=n*e+k;break;default:k=g*i,m=g*
+e,j=c*i,n=c*e,this.n11=h*i,this.n12=-h*e,this.n13=d,this.n21=m+j*d,this.n22=k-n*d,this.n23=-c*h,this.n31=n-k*d,this.n32=j+m*d,this.n33=g*h}return this},setRotationFromQuaternion:function(a){var b=a.x,c=a.y,d=a.z,e=a.w,g=b+b,h=c+c,i=d+d,a=b*g,k=b*h,b=b*i,m=c*h,c=c*i,d=d*i,g=e*g,h=e*h,e=e*i;this.n11=1-(m+d);this.n12=k-e;this.n13=b+h;this.n21=k+e;this.n22=1-(a+d);this.n23=c-g;this.n31=b-h;this.n32=c+g;this.n33=1-(a+m);return this},scale:function(a){var b=a.x,c=a.y,a=a.z;this.n11*=b;this.n12*=c;this.n13*=
 a;this.n21*=b;this.n22*=c;this.n23*=a;this.n31*=b;this.n32*=c;this.n33*=a;this.n41*=b;this.n42*=c;this.n43*=a;return this},compose:function(a,b,c){var d=THREE.Matrix4.__m1,e=THREE.Matrix4.__m2;d.identity();d.setRotationFromQuaternion(b);e.setScale(c.x,c.y,c.z);this.multiply(d,e);this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},decompose:function(a,b,c){var d=THREE.Matrix4.__v1,e=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;d.set(this.n11,this.n21,this.n31);e.set(this.n12,this.n22,this.n32);g.set(this.n13,
 this.n23,this.n33);a=a instanceof THREE.Vector3?a:new THREE.Vector3;b=b instanceof THREE.Quaternion?b:new THREE.Quaternion;c=c instanceof THREE.Vector3?c:new THREE.Vector3;c.x=d.length();c.y=e.length();c.z=g.length();a.x=this.n14;a.y=this.n24;a.z=this.n34;d=THREE.Matrix4.__m1;d.copy(this);d.n11/=c.x;d.n21/=c.x;d.n31/=c.x;d.n12/=c.y;d.n22/=c.y;d.n32/=c.y;d.n13/=c.z;d.n23/=c.z;d.n33/=c.z;b.setFromRotationMatrix(d);return[a,b,c]},extractPosition:function(a){this.n14=a.n14;this.n24=a.n24;this.n34=a.n34;
 return this},extractRotation:function(a){var b=THREE.Matrix4.__v1,c=1/b.set(a.n11,a.n21,a.n31).length(),d=1/b.set(a.n12,a.n22,a.n32).length(),b=1/b.set(a.n13,a.n23,a.n33).length();this.n11=a.n11*c;this.n21=a.n21*c;this.n31=a.n31*c;this.n12=a.n12*d;this.n22=a.n22*d;this.n32=a.n32*d;this.n13=a.n13*b;this.n23=a.n23*b;this.n33=a.n33*b;return this},rotateByAxis:function(a,b){if(1===a.x&&0===a.y&&0===a.z)return this.rotateX(b);if(0===a.x&&1===a.y&&0===a.z)return this.rotateY(b);if(0===a.x&&0===a.y&&1===
-a.z)return this.rotateZ(b);var c=a.x,d=a.y,e=a.z,g=Math.sqrt(c*c+d*d+e*e),c=c/g,d=d/g,e=e/g,g=c*c,h=d*d,i=e*e,m=Math.cos(b),k=Math.sin(b),j=1-m,n=c*d*j,l=c*e*j,j=d*e*j,c=c*k,p=d*k,k=e*k,e=g+(1-g)*m,g=n+k,d=l-p,n=n-k,h=h+(1-h)*m,k=j+c,l=l+p,j=j-c,i=i+(1-i)*m,m=this.n11,c=this.n21,p=this.n31,q=this.n41,o=this.n12,r=this.n22,y=this.n32,u=this.n42,L=this.n13,A=this.n23,v=this.n33,B=this.n43;this.n11=e*m+g*o+d*L;this.n21=e*c+g*r+d*A;this.n31=e*p+g*y+d*v;this.n41=e*q+g*u+d*B;this.n12=n*m+h*o+k*L;this.n22=
-n*c+h*r+k*A;this.n32=n*p+h*y+k*v;this.n42=n*q+h*u+k*B;this.n13=l*m+j*o+i*L;this.n23=l*c+j*r+i*A;this.n33=l*p+j*y+i*v;this.n43=l*q+j*u+i*B;return this},rotateX:function(a){var b=this.n12,c=this.n22,d=this.n32,e=this.n42,g=this.n13,h=this.n23,i=this.n33,m=this.n43,k=Math.cos(a),a=Math.sin(a);this.n12=k*b+a*g;this.n22=k*c+a*h;this.n32=k*d+a*i;this.n42=k*e+a*m;this.n13=k*g-a*b;this.n23=k*h-a*c;this.n33=k*i-a*d;this.n43=k*m-a*e;return this},rotateY:function(a){var b=this.n11,c=this.n21,d=this.n31,e=this.n41,
-g=this.n13,h=this.n23,i=this.n33,m=this.n43,k=Math.cos(a),a=Math.sin(a);this.n11=k*b-a*g;this.n21=k*c-a*h;this.n31=k*d-a*i;this.n41=k*e-a*m;this.n13=k*g+a*b;this.n23=k*h+a*c;this.n33=k*i+a*d;this.n43=k*m+a*e;return this},rotateZ:function(a){var b=this.n11,c=this.n21,d=this.n31,e=this.n41,g=this.n12,h=this.n22,i=this.n32,m=this.n42,k=Math.cos(a),a=Math.sin(a);this.n11=k*b+a*g;this.n21=k*c+a*h;this.n31=k*d+a*i;this.n41=k*e+a*m;this.n12=k*g-a*b;this.n22=k*h-a*c;this.n32=k*i-a*d;this.n42=k*m-a*e;return this},
+a.z)return this.rotateZ(b);var c=a.x,d=a.y,e=a.z,g=Math.sqrt(c*c+d*d+e*e),c=c/g,d=d/g,e=e/g,g=c*c,h=d*d,i=e*e,k=Math.cos(b),m=Math.sin(b),j=1-k,n=c*d*j,l=c*e*j,j=d*e*j,c=c*m,p=d*m,m=e*m,e=g+(1-g)*k,g=n+m,d=l-p,n=n-m,h=h+(1-h)*k,m=j+c,l=l+p,j=j-c,i=i+(1-i)*k,k=this.n11,c=this.n21,p=this.n31,q=this.n41,o=this.n12,r=this.n22,y=this.n32,u=this.n42,L=this.n13,A=this.n23,v=this.n33,B=this.n43;this.n11=e*k+g*o+d*L;this.n21=e*c+g*r+d*A;this.n31=e*p+g*y+d*v;this.n41=e*q+g*u+d*B;this.n12=n*k+h*o+m*L;this.n22=
+n*c+h*r+m*A;this.n32=n*p+h*y+m*v;this.n42=n*q+h*u+m*B;this.n13=l*k+j*o+i*L;this.n23=l*c+j*r+i*A;this.n33=l*p+j*y+i*v;this.n43=l*q+j*u+i*B;return this},rotateX:function(a){var b=this.n12,c=this.n22,d=this.n32,e=this.n42,g=this.n13,h=this.n23,i=this.n33,k=this.n43,m=Math.cos(a),a=Math.sin(a);this.n12=m*b+a*g;this.n22=m*c+a*h;this.n32=m*d+a*i;this.n42=m*e+a*k;this.n13=m*g-a*b;this.n23=m*h-a*c;this.n33=m*i-a*d;this.n43=m*k-a*e;return this},rotateY:function(a){var b=this.n11,c=this.n21,d=this.n31,e=this.n41,
+g=this.n13,h=this.n23,i=this.n33,k=this.n43,m=Math.cos(a),a=Math.sin(a);this.n11=m*b-a*g;this.n21=m*c-a*h;this.n31=m*d-a*i;this.n41=m*e-a*k;this.n13=m*g+a*b;this.n23=m*h+a*c;this.n33=m*i+a*d;this.n43=m*k+a*e;return this},rotateZ:function(a){var b=this.n11,c=this.n21,d=this.n31,e=this.n41,g=this.n12,h=this.n22,i=this.n32,k=this.n42,m=Math.cos(a),a=Math.sin(a);this.n11=m*b+a*g;this.n21=m*c+a*h;this.n31=m*d+a*i;this.n41=m*e+a*k;this.n12=m*g-a*b;this.n22=m*h-a*c;this.n32=m*i-a*d;this.n42=m*k-a*e;return this},
 translate:function(a){var b=a.x,c=a.y,a=a.z;this.n14=this.n11*b+this.n12*c+this.n13*a+this.n14;this.n24=this.n21*b+this.n22*c+this.n23*a+this.n24;this.n34=this.n31*b+this.n32*c+this.n33*a+this.n34;this.n44=this.n41*b+this.n42*c+this.n43*a+this.n44;return this}};
-THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,d=a.n33*a.n22-a.n32*a.n23,e=-a.n33*a.n21+a.n31*a.n23,g=a.n32*a.n21-a.n31*a.n22,h=-a.n33*a.n12+a.n32*a.n13,i=a.n33*a.n11-a.n31*a.n13,m=-a.n32*a.n11+a.n31*a.n12,k=a.n23*a.n12-a.n22*a.n13,j=-a.n23*a.n11+a.n21*a.n13,n=a.n22*a.n11-a.n21*a.n12,a=a.n11*d+a.n21*h+a.n31*k;if(0===a)return null;a=1/a;c[0]=a*d;c[1]=a*e;c[2]=a*g;c[3]=a*h;c[4]=a*i;c[5]=a*m;c[6]=a*k;c[7]=a*j;c[8]=a*n;return b};
+THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,d=a.n33*a.n22-a.n32*a.n23,e=-a.n33*a.n21+a.n31*a.n23,g=a.n32*a.n21-a.n31*a.n22,h=-a.n33*a.n12+a.n32*a.n13,i=a.n33*a.n11-a.n31*a.n13,k=-a.n32*a.n11+a.n31*a.n12,m=a.n23*a.n12-a.n22*a.n13,j=-a.n23*a.n11+a.n21*a.n13,n=a.n22*a.n11-a.n21*a.n12,a=a.n11*d+a.n21*h+a.n31*m;if(0===a)return null;a=1/a;c[0]=a*d;c[1]=a*e;c[2]=a*g;c[3]=a*h;c[4]=a*i;c[5]=a*k;c[6]=a*m;c[7]=a*j;c[8]=a*n;return b};
 THREE.Matrix4.makeFrustum=function(a,b,c,d,e,g){var h;h=new THREE.Matrix4;h.n11=2*e/(b-a);h.n12=0;h.n13=(b+a)/(b-a);h.n14=0;h.n21=0;h.n22=2*e/(d-c);h.n23=(d+c)/(d-c);h.n24=0;h.n31=0;h.n32=0;h.n33=-(g+e)/(g-e);h.n34=-2*g*e/(g-e);h.n41=0;h.n42=0;h.n43=-1;h.n44=0;return h};THREE.Matrix4.makePerspective=function(a,b,c,d){var e,a=c*Math.tan(a*Math.PI/360);e=-a;return THREE.Matrix4.makeFrustum(e*b,a*b,e,a,c,d)};
-THREE.Matrix4.makeOrtho=function(a,b,c,d,e,g){var h,i,m,k;h=new THREE.Matrix4;i=b-a;m=c-d;k=g-e;h.n11=2/i;h.n12=0;h.n13=0;h.n14=-((b+a)/i);h.n21=0;h.n22=2/m;h.n23=0;h.n24=-((c+d)/m);h.n31=0;h.n32=0;h.n33=-2/k;h.n34=-((g+e)/k);h.n41=0;h.n42=0;h.n43=0;h.n44=1;return h};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.Matrix4.makeOrtho=function(a,b,c,d,e,g){var h,i,k,m;h=new THREE.Matrix4;i=b-a;k=c-d;m=g-e;h.n11=2/i;h.n12=0;h.n13=0;h.n14=-((b+a)/i);h.n21=0;h.n22=2/k;h.n23=0;h.n24=-((c+d)/k);h.n31=0;h.n32=0;h.n33=-2/m;h.n34=-((g+e)/m);h.n41=0;h.n42=0;h.n43=0;h.n44=1;return h};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
 THREE.Object3D=function(){this.id=THREE.Object3DCount++;this.name="";this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder="XYZ";this.scale=new THREE.Vector3(1,1,1);this.flipSided=this.doubleSided=!1;this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=
 !0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=!0;this.receiveShadow=this.castShadow=!1;this.frustumCulled=!0;this._vector=new THREE.Vector3};
 THREE.Object3D.prototype={constructor:THREE.Object3D,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(a===
 this)console.warn("THREE: Object3D.add(): An object can't be added as a child of itself.");else if(-1===this.children.indexOf(a)){void 0!==a.parent&&a.parent.remove(a);a.parent=this;this.children.push(a);for(var b=this;void 0!==b.parent;)b=b.parent;void 0!==b&&b instanceof THREE.Scene&&b.addObject(a)}},remove:function(a){var b=this.children.indexOf(a);if(-1!==b){a.parent=void 0;this.children.splice(b,1);for(b=this;void 0!==b.parent;)b=b.parent;void 0!==b&&b instanceof THREE.Scene&&b.removeObject(a)}},
 getChildByName:function(a,b){var c,d,e;for(c=0,d=this.children.length;c<d;c++){e=this.children[c];if(e.name===a||b&&(e=e.getChildByName(a,b),void 0!==e))return e}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder);if(1!==this.scale.x||1!==this.scale.y||1!==this.scale.z)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,
 this.scale.z));this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(a){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||a)this.parent?this.matrixWorld.multiply(this.parent.matrixWorld,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,a=!0;for(var b=0,c=this.children.length;b<c;b++)this.children[b].updateMatrixWorld(a)}};THREE.Object3DCount=0;
-THREE.Projector=function(){function a(){var a=h[g]=h[g]||new THREE.RenderableObject;g++;return a}function b(){var a=k[m]=k[m]||new THREE.RenderableVertex;m++;return a}function c(a,b){return b.z-a.z}function d(a,b){var c=0,d=1,e=a.z+a.w,f=b.z+b.w,g=-a.z+a.w,h=-b.z+b.w;if(0<=e&&0<=f&&0<=g&&0<=h)return!0;if(0>e&&0>f||0>g&&0>h)return!1;0>e?c=Math.max(c,e/(e-f)):0>f&&(d=Math.min(d,e/(e-f)));0>g?c=Math.max(c,g/(g-h)):0>h&&(d=Math.min(d,g/(g-h)));if(d<c)return!1;a.lerpSelf(b,c);b.lerpSelf(a,1-d);return!0}
-var e,g,h=[],i,m,k=[],j,n,l=[],p,q=[],o,r,y=[],u,L,A=[],v={objects:[],sprites:[],lights:[],elements:[]},B=new THREE.Vector3,C=new THREE.Vector4,I=new THREE.Matrix4,M=new THREE.Matrix4,N=new THREE.Frustum,J=new THREE.Vector4,T=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);I.multiply(b.projectionMatrix,b.matrixWorldInverse);I.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);I.multiply(b.matrixWorld,
+THREE.Projector=function(){function a(){var a=h[g]=h[g]||new THREE.RenderableObject;g++;return a}function b(){var a=m[k]=m[k]||new THREE.RenderableVertex;k++;return a}function c(a,b){return b.z-a.z}function d(a,b){var c=0,d=1,e=a.z+a.w,f=b.z+b.w,g=-a.z+a.w,h=-b.z+b.w;if(0<=e&&0<=f&&0<=g&&0<=h)return!0;if(0>e&&0>f||0>g&&0>h)return!1;0>e?c=Math.max(c,e/(e-f)):0>f&&(d=Math.min(d,e/(e-f)));0>g?c=Math.max(c,g/(g-h)):0>h&&(d=Math.min(d,g/(g-h)));if(d<c)return!1;a.lerpSelf(b,c);b.lerpSelf(a,1-d);return!0}
+var e,g,h=[],i,k,m=[],j,n,l=[],p,q=[],o,r,y=[],u,L,A=[],v={objects:[],sprites:[],lights:[],elements:[]},B=new THREE.Vector3,C=new THREE.Vector4,I=new THREE.Matrix4,M=new THREE.Matrix4,N=new THREE.Frustum,J=new THREE.Vector4,T=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);I.multiply(b.projectionMatrix,b.matrixWorldInverse);I.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);I.multiply(b.matrixWorld,
 b.projectionMatrixInverse);I.multiplyVector3(a);return a};this.pickingRay=function(a,b){var c;a.z=-1;c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.subSelf(a).normalize();return new THREE.Ray(a,c)};this.projectGraph=function(b,d){g=0;v.objects.length=0;v.sprites.length=0;v.lights.length=0;var h=function(b){if(!1!==b.visible){(b instanceof THREE.Mesh||b instanceof THREE.Line)&&(!1===b.frustumCulled||N.contains(b))?(I.multiplyVector3(B.copy(b.position)),e=a(),e.object=
 b,e.z=B.z,v.objects.push(e)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(I.multiplyVector3(B.copy(b.position)),e=a(),e.object=b,e.z=B.z,v.sprites.push(e)):b instanceof THREE.Light&&v.lights.push(b);for(var c=0,f=b.children.length;c<f;c++)h(b.children[c])}};h(b);d&&v.objects.sort(c);return v};this.projectScene=function(a,e,g){var h=e.near,E=e.far,f,B,ca,pa,R,K,X,Aa,da,Ha,Da,Oa,Pa,Qa,Ua,Va;L=r=p=n=0;v.elements.length=0;void 0===e.parent&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),
-a.add(e));a.updateMatrixWorld();e.matrixWorldInverse.getInverse(e.matrixWorld);I.multiply(e.projectionMatrix,e.matrixWorldInverse);N.setFromMatrix(I);v=this.projectGraph(a,!1);for(a=0,f=v.objects.length;a<f;a++)if(da=v.objects[a].object,Ha=da.matrixWorld,Oa=da.material,m=0,da instanceof THREE.Mesh){Da=da.geometry;Pa=da.geometry.materials;pa=Da.vertices;Qa=Da.faces;Ua=Da.faceVertexUvs;Da=da.matrixRotationWorld.extractRotation(Ha);for(B=0,ca=pa.length;B<ca;B++)i=b(),i.positionWorld.copy(pa[B].position),
-Ha.multiplyVector3(i.positionWorld),i.positionScreen.copy(i.positionWorld),I.multiplyVector4(i.positionScreen),i.positionScreen.x/=i.positionScreen.w,i.positionScreen.y/=i.positionScreen.w,i.visible=i.positionScreen.z>h&&i.positionScreen.z<E;for(pa=0,B=Qa.length;pa<B;pa++){ca=Qa[pa];if(ca instanceof THREE.Face3)if(R=k[ca.a],K=k[ca.b],X=k[ca.c],R.visible&&K.visible&&X.visible&&(da.doubleSided||da.flipSided!=0>(X.positionScreen.x-R.positionScreen.x)*(K.positionScreen.y-R.positionScreen.y)-(X.positionScreen.y-
-R.positionScreen.y)*(K.positionScreen.x-R.positionScreen.x)))Aa=l[n]=l[n]||new THREE.RenderableFace3,n++,j=Aa,j.v1.copy(R),j.v2.copy(K),j.v3.copy(X);else continue;else if(ca instanceof THREE.Face4)if(R=k[ca.a],K=k[ca.b],X=k[ca.c],Aa=k[ca.d],R.visible&&K.visible&&X.visible&&Aa.visible&&(da.doubleSided||da.flipSided!=(0>(Aa.positionScreen.x-R.positionScreen.x)*(K.positionScreen.y-R.positionScreen.y)-(Aa.positionScreen.y-R.positionScreen.y)*(K.positionScreen.x-R.positionScreen.x)||0>(K.positionScreen.x-
+a.add(e));a.updateMatrixWorld();e.matrixWorldInverse.getInverse(e.matrixWorld);I.multiply(e.projectionMatrix,e.matrixWorldInverse);N.setFromMatrix(I);v=this.projectGraph(a,!1);for(a=0,f=v.objects.length;a<f;a++)if(da=v.objects[a].object,Ha=da.matrixWorld,Oa=da.material,k=0,da instanceof THREE.Mesh){Da=da.geometry;Pa=da.geometry.materials;pa=Da.vertices;Qa=Da.faces;Ua=Da.faceVertexUvs;Da=da.matrixRotationWorld.extractRotation(Ha);for(B=0,ca=pa.length;B<ca;B++)i=b(),i.positionWorld.copy(pa[B].position),
+Ha.multiplyVector3(i.positionWorld),i.positionScreen.copy(i.positionWorld),I.multiplyVector4(i.positionScreen),i.positionScreen.x/=i.positionScreen.w,i.positionScreen.y/=i.positionScreen.w,i.visible=i.positionScreen.z>h&&i.positionScreen.z<E;for(pa=0,B=Qa.length;pa<B;pa++){ca=Qa[pa];if(ca instanceof THREE.Face3)if(R=m[ca.a],K=m[ca.b],X=m[ca.c],R.visible&&K.visible&&X.visible&&(da.doubleSided||da.flipSided!=0>(X.positionScreen.x-R.positionScreen.x)*(K.positionScreen.y-R.positionScreen.y)-(X.positionScreen.y-
+R.positionScreen.y)*(K.positionScreen.x-R.positionScreen.x)))Aa=l[n]=l[n]||new THREE.RenderableFace3,n++,j=Aa,j.v1.copy(R),j.v2.copy(K),j.v3.copy(X);else continue;else if(ca instanceof THREE.Face4)if(R=m[ca.a],K=m[ca.b],X=m[ca.c],Aa=m[ca.d],R.visible&&K.visible&&X.visible&&Aa.visible&&(da.doubleSided||da.flipSided!=(0>(Aa.positionScreen.x-R.positionScreen.x)*(K.positionScreen.y-R.positionScreen.y)-(Aa.positionScreen.y-R.positionScreen.y)*(K.positionScreen.x-R.positionScreen.x)||0>(K.positionScreen.x-
 X.positionScreen.x)*(Aa.positionScreen.y-X.positionScreen.y)-(K.positionScreen.y-X.positionScreen.y)*(Aa.positionScreen.x-X.positionScreen.x))))Va=q[p]=q[p]||new THREE.RenderableFace4,p++,j=Va,j.v1.copy(R),j.v2.copy(K),j.v3.copy(X),j.v4.copy(Aa);else continue;j.normalWorld.copy(ca.normal);Da.multiplyVector3(j.normalWorld);j.centroidWorld.copy(ca.centroid);Ha.multiplyVector3(j.centroidWorld);j.centroidScreen.copy(j.centroidWorld);I.multiplyVector3(j.centroidScreen);X=ca.vertexNormals;for(R=0,K=X.length;R<
 K;R++)Aa=j.vertexNormalsWorld[R],Aa.copy(X[R]),Da.multiplyVector3(Aa);for(R=0,K=Ua.length;R<K;R++)if(Va=Ua[R][pa])for(X=0,Aa=Va.length;X<Aa;X++)j.uvs[R][X]=Va[X];j.material=Oa;j.faceMaterial=null!==ca.materialIndex?Pa[ca.materialIndex]:null;j.z=j.centroidScreen.z;v.elements.push(j)}}else if(da instanceof THREE.Line){M.multiply(I,Ha);pa=da.geometry.vertices;R=b();R.positionScreen.copy(pa[0].position);M.multiplyVector4(R.positionScreen);for(B=1,ca=pa.length;B<ca;B++)if(R=b(),R.positionScreen.copy(pa[B].position),
-M.multiplyVector4(R.positionScreen),K=k[m-2],J.copy(R.positionScreen),T.copy(K.positionScreen),d(J,T))J.multiplyScalar(1/J.w),T.multiplyScalar(1/T.w),da=y[r]=y[r]||new THREE.RenderableLine,r++,o=da,o.v1.positionScreen.copy(J),o.v2.positionScreen.copy(T),o.z=Math.max(J.z,T.z),o.material=Oa,v.elements.push(o)}for(a=0,f=v.sprites.length;a<f;a++)if(da=v.sprites[a].object,Ha=da.matrixWorld,da instanceof THREE.Particle&&(C.set(Ha.n14,Ha.n24,Ha.n34,1),I.multiplyVector4(C),C.z/=C.w,0<C.z&&1>C.z))h=A[L]=A[L]||
+M.multiplyVector4(R.positionScreen),K=m[k-2],J.copy(R.positionScreen),T.copy(K.positionScreen),d(J,T))J.multiplyScalar(1/J.w),T.multiplyScalar(1/T.w),da=y[r]=y[r]||new THREE.RenderableLine,r++,o=da,o.v1.positionScreen.copy(J),o.v2.positionScreen.copy(T),o.z=Math.max(J.z,T.z),o.material=Oa,v.elements.push(o)}for(a=0,f=v.sprites.length;a<f;a++)if(da=v.sprites[a].object,Ha=da.matrixWorld,da instanceof THREE.Particle&&(C.set(Ha.n14,Ha.n24,Ha.n34,1),I.multiplyVector4(C),C.z/=C.w,0<C.z&&1>C.z))h=A[L]=A[L]||
 new THREE.RenderableParticle,L++,u=h,u.x=C.x/C.w,u.y=C.y/C.w,u.z=C.z,u.rotation=da.rotation.z,u.scale.x=da.scale.x*Math.abs(u.x-(C.x+e.projectionMatrix.n11)/(C.w+e.projectionMatrix.n14)),u.scale.y=da.scale.y*Math.abs(u.y-(C.y+e.projectionMatrix.n22)/(C.w+e.projectionMatrix.n24)),u.material=da.material,v.elements.push(u);g&&v.elements.sort(c);return v}};THREE.Quaternion=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=void 0!==d?d:1};
 THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this},clone:function(){return new THREE.Quaternion(this.x,this.y,this.z,this.w)},setFromEuler:function(a){var b=Math.PI/360,c=a.x*b,d=a.y*b,e=a.z*b,a=Math.cos(d),d=Math.sin(d),b=Math.cos(-e),e=Math.sin(-e),g=Math.cos(c),c=Math.sin(c),h=a*b,i=d*e;this.w=h*g-i*c;this.x=h*c+i*g;this.y=d*b*g+a*e*c;this.z=a*e*
 g-d*b*c;return this},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRotationMatrix:function(a){var b=Math.pow(a.determinant(),1/3);this.w=Math.sqrt(Math.max(0,b+a.n11+a.n22+a.n33))/2;this.x=Math.sqrt(Math.max(0,b+a.n11-a.n22-a.n33))/2;this.y=Math.sqrt(Math.max(0,b-a.n11+a.n22-a.n33))/2;this.z=Math.sqrt(Math.max(0,b-a.n11-a.n22+a.n33))/2;this.x=0>a.n32-a.n23?-Math.abs(this.x):Math.abs(this.x);this.y=0>a.n13-a.n31?
 -Math.abs(this.y):Math.abs(this.y);this.z=0>a.n21-a.n12?-Math.abs(this.z):Math.abs(this.z);this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);0===a?this.w=this.z=
 this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},multiplySelf:function(a){var b=this.x,c=this.y,d=this.z,e=this.w,g=a.x,h=a.y,i=a.z,a=a.w;this.x=b*a+e*g+c*i-d*h;this.y=c*a+e*h+d*g-b*i;this.z=d*a+e*i+b*h-c*g;this.w=e*a-b*g-c*h-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,e=a.z,g=this.x,h=this.y,i=this.z,m=this.w,k=m*c+h*e-i*d,j=m*d+i*c-g*e,n=m*e+g*d-h*c,c=-g*c-h*d-i*e;b.x=k*m+c*-g+j*-i-n*-h;b.y=j*m+c*-h+n*-g-k*-i;b.z=n*m+c*-i+k*-h-j*-g;return b}};
+a);var c=a.x,d=a.y,e=a.z,g=this.x,h=this.y,i=this.z,k=this.w,m=k*c+h*e-i*d,j=k*d+i*c-g*e,n=k*e+g*d-h*c,c=-g*c-h*d-i*e;b.x=m*k+c*-g+j*-i-n*-h;b.y=j*k+c*-h+n*-g-m*-i;b.z=n*k+c*-i+m*-h-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;0>e?(c.w=-b.w,c.x=-b.x,c.y=-b.y,c.z=-b.z,e=-e):c.copy(b);if(1<=Math.abs(e))return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var g=Math.acos(e),e=Math.sqrt(1-e*e);if(0.0010>Math.abs(e))return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;b=Math.sin((1-d)*g)/e;d=Math.sin(d*g)/e;c.w=a.w*b+c.w*d;c.x=a.x*b+c.x*d;c.y=a.y*b+c.y*d;c.z=a.z*b+c.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
 THREE.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,h){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=h;this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.u=a||0;this.v=b||0};
@@ -87,14 +87,16 @@ THREE.Geometry.prototype={constructor:THREE.Geometry,applyMatrix:function(a){var
 b;a++)c=this.faces[a],c.centroid.set(0,0,0),c instanceof THREE.Face3?(c.centroid.addSelf(this.vertices[c.a].position),c.centroid.addSelf(this.vertices[c.b].position),c.centroid.addSelf(this.vertices[c.c].position),c.centroid.divideScalar(3)):c instanceof THREE.Face4&&(c.centroid.addSelf(this.vertices[c.a].position),c.centroid.addSelf(this.vertices[c.b].position),c.centroid.addSelf(this.vertices[c.c].position),c.centroid.addSelf(this.vertices[c.d].position),c.centroid.divideScalar(4))},computeFaceNormals:function(){var a,
 b,c,d,e,g,h=new THREE.Vector3,i=new THREE.Vector3;for(a=0,b=this.faces.length;a<b;a++)c=this.faces[a],d=this.vertices[c.a],e=this.vertices[c.b],g=this.vertices[c.c],h.sub(g.position,e.position),i.sub(d.position,e.position),h.crossSelf(i),h.isZero()||h.normalize(),c.normal.copy(h)},computeVertexNormals:function(){var a,b,c,d;if(void 0===this.__tmpVertices){d=this.__tmpVertices=Array(this.vertices.length);for(a=0,b=this.vertices.length;a<b;a++)d[a]=new THREE.Vector3;for(a=0,b=this.faces.length;a<b;a++)if(c=
 this.faces[a],c instanceof THREE.Face3)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(c instanceof THREE.Face4)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{d=this.__tmpVertices;for(a=0,b=this.vertices.length;a<b;a++)d[a].set(0,0,0)}for(a=0,b=this.faces.length;a<b;a++)c=this.faces[a],c instanceof THREE.Face3?(d[c.a].addSelf(c.normal),d[c.b].addSelf(c.normal),d[c.c].addSelf(c.normal)):c instanceof THREE.Face4&&(d[c.a].addSelf(c.normal),
-d[c.b].addSelf(c.normal),d[c.c].addSelf(c.normal),d[c.d].addSelf(c.normal));for(a=0,b=this.vertices.length;a<b;a++)d[a].normalize();for(a=0,b=this.faces.length;a<b;a++)c=this.faces[a],c instanceof THREE.Face3?(c.vertexNormals[0].copy(d[c.a]),c.vertexNormals[1].copy(d[c.b]),c.vertexNormals[2].copy(d[c.c])):c instanceof THREE.Face4&&(c.vertexNormals[0].copy(d[c.a]),c.vertexNormals[1].copy(d[c.b]),c.vertexNormals[2].copy(d[c.c]),c.vertexNormals[3].copy(d[c.d]))},computeTangents:function(){function a(a,
-b,c,d,e,g,I){i=a.vertices[b].position;m=a.vertices[c].position;k=a.vertices[d].position;j=h[e];n=h[g];l=h[I];p=m.x-i.x;q=k.x-i.x;o=m.y-i.y;r=k.y-i.y;y=m.z-i.z;u=k.z-i.z;L=n.u-j.u;A=l.u-j.u;v=n.v-j.v;B=l.v-j.v;C=1/(L*B-A*v);J.set((B*p-v*q)*C,(B*o-v*r)*C,(B*y-v*u)*C);T.set((L*q-A*p)*C,(L*r-A*o)*C,(L*u-A*y)*C);M[b].addSelf(J);M[c].addSelf(J);M[d].addSelf(J);N[b].addSelf(T);N[c].addSelf(T);N[d].addSelf(T)}var b,c,d,e,g,h,i,m,k,j,n,l,p,q,o,r,y,u,L,A,v,B,C,I,M=[],N=[],J=new THREE.Vector3,T=new THREE.Vector3,
-wa=new THREE.Vector3,la=new THREE.Vector3,aa=new THREE.Vector3;for(b=0,c=this.vertices.length;b<c;b++)M[b]=new THREE.Vector3,N[b]=new THREE.Vector3;for(b=0,c=this.faces.length;b<c;b++)g=this.faces[b],h=this.faceVertexUvs[0][b],g instanceof THREE.Face3?a(this,g.a,g.b,g.c,0,1,2):g instanceof THREE.Face4&&(a(this,g.a,g.b,g.c,0,1,2),a(this,g.a,g.b,g.d,0,1,3));var $=["a","b","c","d"];for(b=0,c=this.faces.length;b<c;b++){g=this.faces[b];for(d=0;d<g.vertexNormals.length;d++)aa.copy(g.vertexNormals[d]),e=
-g[$[d]],I=M[e],wa.copy(I),wa.subSelf(aa.multiplyScalar(aa.dot(I))).normalize(),la.cross(g.vertexNormals[d],I),e=la.dot(N[e]),e=0>e?-1:1,g.vertexTangents[d]=new THREE.Vector4(wa.x,wa.y,wa.z,e)}this.hasTangents=!0},computeBoundingBox:function(){if(!this.boundingBox)this.boundingBox={min:new THREE.Vector3,max:new THREE.Vector3};if(0<this.vertices.length){var a;a=this.vertices[0].position;this.boundingBox.min.copy(a);this.boundingBox.max.copy(a);for(var b=this.boundingBox.min,c=this.boundingBox.max,d=
-1,e=this.vertices.length;d<e;d++){a=this.vertices[d].position;if(a.x<b.x)b.x=a.x;else if(a.x>c.x)c.x=a.x;if(a.y<b.y)b.y=a.y;else if(a.y>c.y)c.y=a.y;if(a.z<b.z)b.z=a.z;else if(a.z>c.z)c.z=a.z}}else this.boundingBox.min.set(0,0,0),this.boundingBox.max.set(0,0,0)},computeBoundingSphere:function(){if(!this.boundingSphere)this.boundingSphere={radius:0};for(var a,b=0,c=0,d=this.vertices.length;c<d;c++)a=this.vertices[c].position.length(),a>b&&(b=a);this.boundingSphere.radius=b},mergeVertices:function(){var a=
-{},b=[],c=[],d,e=Math.pow(10,4),g,h;for(g=0,h=this.vertices.length;g<h;g++)d=this.vertices[g].position,d=[Math.round(d.x*e),Math.round(d.y*e),Math.round(d.z*e)].join("_"),void 0===a[d]?(a[d]=g,b.push(this.vertices[g]),c[g]=b.length-1):c[g]=c[a[d]];for(g=0,h=this.faces.length;g<h;g++)if(a=this.faces[g],a instanceof THREE.Face3)a.a=c[a.a],a.b=c[a.b],a.c=c[a.c];else if(a instanceof THREE.Face4)a.a=c[a.a],a.b=c[a.b],a.c=c[a.c],a.d=c[a.d];this.vertices=b}};THREE.GeometryCount=0;
-THREE.Spline=function(a){function b(a,b,c,d,e,g,h){a=0.5*(c-a);d=0.5*(d-b);return(2*(b-c)+a+d)*h+(-3*(b-c)-2*a-d)*g+a*e+b}this.points=a;var c=[],d={x:0,y:0,z:0},e,g,h,i,m,k,j,n,l;this.initFromArray=function(a){this.points=[];for(var b=0;b<a.length;b++)this.points[b]={x:a[b][0],y:a[b][1],z:a[b][2]}};this.getPoint=function(a){e=(this.points.length-1)*a;g=Math.floor(e);h=e-g;c[0]=0===g?g:g-1;c[1]=g;c[2]=g>this.points.length-2?g:g+1;c[3]=g>this.points.length-3?g:g+2;k=this.points[c[0]];j=this.points[c[1]];
-n=this.points[c[2]];l=this.points[c[3]];i=h*h;m=h*i;d.x=b(k.x,j.x,n.x,l.x,h,i,m);d.y=b(k.y,j.y,n.y,l.y,h,i,m);d.z=b(k.z,j.z,n.z,l.z,h,i,m);return d};this.getControlPointsArray=function(){var a,b,c=this.points.length,d=[];for(a=0;a<c;a++)b=this.points[a],d[a]=[b.x,b.y,b.z];return d};this.getLength=function(a){var b,c,d,e=b=b=0,g=new THREE.Vector3,h=new THREE.Vector3,i=[],j=0;i[0]=0;a||(a=100);c=this.points.length*a;g.copy(this.points[0]);for(a=1;a<c;a++)b=a/c,d=this.getPoint(b),h.copy(d),j+=h.distanceTo(g),
+d[c.b].addSelf(c.normal),d[c.c].addSelf(c.normal),d[c.d].addSelf(c.normal));for(a=0,b=this.vertices.length;a<b;a++)d[a].normalize();for(a=0,b=this.faces.length;a<b;a++)c=this.faces[a],c instanceof THREE.Face3?(c.vertexNormals[0].copy(d[c.a]),c.vertexNormals[1].copy(d[c.b]),c.vertexNormals[2].copy(d[c.c])):c instanceof THREE.Face4&&(c.vertexNormals[0].copy(d[c.a]),c.vertexNormals[1].copy(d[c.b]),c.vertexNormals[2].copy(d[c.c]),c.vertexNormals[3].copy(d[c.d]))},computeMorphNormals:function(){var a,
+b,c,d,e;for(c=0,d=this.faces.length;c<d;c++){e=this.faces[c];e.__originalVertexNormals=[];for(a=0,b=e.vertexNormals.length;a<b;a++)e.__originalVertexNormals[a]=e.vertexNormals[a].clone()}var g=new THREE.Geometry;g.faces=this.faces;for(a=0,b=this.morphTargets.length;a<b;a++){var h=this.morphNormals[a];g.vertices=this.morphTargets[a].vertices;g.computeFaceNormals();g.computeVertexNormals();var i,k;for(c=0,d=this.faces.length;c<d;c++)e=this.faces[c],i=h.faceNormals[c],k=h.vertexNormals[c],i.copy(e.normal),
+e instanceof THREE.Face3?(k.a.copy(e.vertexNormals[0]),k.b.copy(e.vertexNormals[1]),k.c.copy(e.vertexNormals[2])):(k.a.copy(e.vertexNormals[0]),k.b.copy(e.vertexNormals[1]),k.c.copy(e.vertexNormals[2]),k.d.copy(e.vertexNormals[3]))}for(c=0,d=this.faces.length;c<d;c++)e=this.faces[c],e.vertexNormals=e.__originalVertexNormals},computeTangents:function(){function a(a,b,c,d,e,g,I){i=a.vertices[b].position;k=a.vertices[c].position;m=a.vertices[d].position;j=h[e];n=h[g];l=h[I];p=k.x-i.x;q=m.x-i.x;o=k.y-
+i.y;r=m.y-i.y;y=k.z-i.z;u=m.z-i.z;L=n.u-j.u;A=l.u-j.u;v=n.v-j.v;B=l.v-j.v;C=1/(L*B-A*v);J.set((B*p-v*q)*C,(B*o-v*r)*C,(B*y-v*u)*C);T.set((L*q-A*p)*C,(L*r-A*o)*C,(L*u-A*y)*C);M[b].addSelf(J);M[c].addSelf(J);M[d].addSelf(J);N[b].addSelf(T);N[c].addSelf(T);N[d].addSelf(T)}var b,c,d,e,g,h,i,k,m,j,n,l,p,q,o,r,y,u,L,A,v,B,C,I,M=[],N=[],J=new THREE.Vector3,T=new THREE.Vector3,wa=new THREE.Vector3,la=new THREE.Vector3,aa=new THREE.Vector3;for(b=0,c=this.vertices.length;b<c;b++)M[b]=new THREE.Vector3,N[b]=
+new THREE.Vector3;for(b=0,c=this.faces.length;b<c;b++)g=this.faces[b],h=this.faceVertexUvs[0][b],g instanceof THREE.Face3?a(this,g.a,g.b,g.c,0,1,2):g instanceof THREE.Face4&&(a(this,g.a,g.b,g.c,0,1,2),a(this,g.a,g.b,g.d,0,1,3));var $=["a","b","c","d"];for(b=0,c=this.faces.length;b<c;b++){g=this.faces[b];for(d=0;d<g.vertexNormals.length;d++)aa.copy(g.vertexNormals[d]),e=g[$[d]],I=M[e],wa.copy(I),wa.subSelf(aa.multiplyScalar(aa.dot(I))).normalize(),la.cross(g.vertexNormals[d],I),e=la.dot(N[e]),e=0>
+e?-1:1,g.vertexTangents[d]=new THREE.Vector4(wa.x,wa.y,wa.z,e)}this.hasTangents=!0},computeBoundingBox:function(){if(!this.boundingBox)this.boundingBox={min:new THREE.Vector3,max:new THREE.Vector3};if(0<this.vertices.length){var a;a=this.vertices[0].position;this.boundingBox.min.copy(a);this.boundingBox.max.copy(a);for(var b=this.boundingBox.min,c=this.boundingBox.max,d=1,e=this.vertices.length;d<e;d++){a=this.vertices[d].position;if(a.x<b.x)b.x=a.x;else if(a.x>c.x)c.x=a.x;if(a.y<b.y)b.y=a.y;else if(a.y>
+c.y)c.y=a.y;if(a.z<b.z)b.z=a.z;else if(a.z>c.z)c.z=a.z}}else this.boundingBox.min.set(0,0,0),this.boundingBox.max.set(0,0,0)},computeBoundingSphere:function(){if(!this.boundingSphere)this.boundingSphere={radius:0};for(var a,b=0,c=0,d=this.vertices.length;c<d;c++)a=this.vertices[c].position.length(),a>b&&(b=a);this.boundingSphere.radius=b},mergeVertices:function(){var a={},b=[],c=[],d,e=Math.pow(10,4),g,h;for(g=0,h=this.vertices.length;g<h;g++)d=this.vertices[g].position,d=[Math.round(d.x*e),Math.round(d.y*
+e),Math.round(d.z*e)].join("_"),void 0===a[d]?(a[d]=g,b.push(this.vertices[g]),c[g]=b.length-1):c[g]=c[a[d]];for(g=0,h=this.faces.length;g<h;g++)if(a=this.faces[g],a instanceof THREE.Face3)a.a=c[a.a],a.b=c[a.b],a.c=c[a.c];else if(a instanceof THREE.Face4)a.a=c[a.a],a.b=c[a.b],a.c=c[a.c],a.d=c[a.d];this.vertices=b}};THREE.GeometryCount=0;
+THREE.Spline=function(a){function b(a,b,c,d,e,g,h){a=0.5*(c-a);d=0.5*(d-b);return(2*(b-c)+a+d)*h+(-3*(b-c)-2*a-d)*g+a*e+b}this.points=a;var c=[],d={x:0,y:0,z:0},e,g,h,i,k,m,j,n,l;this.initFromArray=function(a){this.points=[];for(var b=0;b<a.length;b++)this.points[b]={x:a[b][0],y:a[b][1],z:a[b][2]}};this.getPoint=function(a){e=(this.points.length-1)*a;g=Math.floor(e);h=e-g;c[0]=0===g?g:g-1;c[1]=g;c[2]=g>this.points.length-2?g:g+1;c[3]=g>this.points.length-3?g:g+2;m=this.points[c[0]];j=this.points[c[1]];
+n=this.points[c[2]];l=this.points[c[3]];i=h*h;k=h*i;d.x=b(m.x,j.x,n.x,l.x,h,i,k);d.y=b(m.y,j.y,n.y,l.y,h,i,k);d.z=b(m.z,j.z,n.z,l.z,h,i,k);return d};this.getControlPointsArray=function(){var a,b,c=this.points.length,d=[];for(a=0;a<c;a++)b=this.points[a],d[a]=[b.x,b.y,b.z];return d};this.getLength=function(a){var b,c,d,e=b=b=0,g=new THREE.Vector3,h=new THREE.Vector3,i=[],j=0;i[0]=0;a||(a=100);c=this.points.length*a;g.copy(this.points[0]);for(a=1;a<c;a++)b=a/c,d=this.getPoint(b),h.copy(d),j+=h.distanceTo(g),
 g.copy(d),b*=this.points.length-1,b=Math.floor(b),b!=e&&(i[b]=j,e=b);i[i.length]=j;return{chunks:i,total:j}};this.reparametrizeByArcLength=function(a){var b,c,d,e,g,h,i=[],j=new THREE.Vector3,l=this.getLength();i.push(j.copy(this.points[0]).clone());for(b=1;b<this.points.length;b++){c=l.chunks[b]-l.chunks[b-1];h=Math.ceil(a*c/l.total);e=(b-1)/(this.points.length-1);g=b/(this.points.length-1);for(c=1;c<h-1;c++)d=e+c*(1/h)*(g-e),d=this.getPoint(d),i.push(j.copy(d).clone());i.push(j.copy(this.points[b]).clone())}this.points=
 i}};THREE.Edge=function(a,b,c,d){this.vertices=[a,b];this.vertexIndices=[c,d];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;this.projectionMatrixInverse=new THREE.Matrix4};
 THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.lookAt=function(a){this.matrix.lookAt(this.position,a,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)};THREE.OrthographicCamera=function(a,b,c,d,e,g){THREE.Camera.call(this);this.left=a;this.right=b;this.top=c;this.bottom=d;this.near=void 0!==e?e:0.1;this.far=void 0!==g?g:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=new THREE.Camera;
@@ -128,7 +130,7 @@ a.fog?a.fog:!1;this.lights=void 0!==a.lights?a.lights:!1;this.vertexColors=void
 THREE.Texture=function(a,b,c,d,e,g,h,i){this.id=THREE.TextureCount++;this.image=a;this.mapping=void 0!==b?b:new THREE.UVMapping;this.wrapS=void 0!==c?c:THREE.ClampToEdgeWrapping;this.wrapT=void 0!==d?d:THREE.ClampToEdgeWrapping;this.magFilter=void 0!==e?e:THREE.LinearFilter;this.minFilter=void 0!==g?g:THREE.LinearMipMapLinearFilter;this.format=void 0!==h?h:THREE.RGBAFormat;this.type=void 0!==i?i:THREE.UnsignedByteType;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.generateMipmaps=
 !0;this.needsUpdate=!1;this.onUpdate=null};THREE.Texture.prototype={constructor:THREE.Texture,clone:function(){var a=new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter,this.format,this.type);a.offset.copy(this.offset);a.repeat.copy(this.repeat);return a}};THREE.TextureCount=0;THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.LatitudeReflectionMapping=function(){};
 THREE.LatitudeRefractionMapping=function(){};THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=function(){};THREE.UVMapping=function(){};THREE.RepeatWrapping=0;THREE.ClampToEdgeWrapping=1;THREE.MirroredRepeatWrapping=2;THREE.NearestFilter=3;THREE.NearestMipMapNearestFilter=4;THREE.NearestMipMapLinearFilter=5;THREE.LinearFilter=6;THREE.LinearMipMapNearestFilter=7;THREE.LinearMipMapLinearFilter=8;THREE.ByteType=9;THREE.UnsignedByteType=10;THREE.ShortType=11;
-THREE.UnsignedShortType=12;THREE.IntType=13;THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;THREE.DataTexture=function(a,b,c,d,e,g,h,i,m,k){THREE.Texture.call(this,null,g,h,i,m,k,d,e);this.image={data:a,width:b,height:c}};THREE.DataTexture.prototype=new THREE.Texture;THREE.DataTexture.prototype.constructor=THREE.DataTexture;
+THREE.UnsignedShortType=12;THREE.IntType=13;THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;THREE.DataTexture=function(a,b,c,d,e,g,h,i,k,m){THREE.Texture.call(this,null,g,h,i,k,m,d,e);this.image={data:a,width:b,height:c}};THREE.DataTexture.prototype=new THREE.Texture;THREE.DataTexture.prototype.constructor=THREE.DataTexture;
 THREE.DataTexture.prototype.clone=function(){var a=new THREE.DataTexture(this.image.data,this.image.width,this.image.height,this.format,this.type,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter);a.offset.copy(this.offset);a.repeat.copy(this.repeat);return a};THREE.Particle=function(a){THREE.Object3D.call(this);this.material=a};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;
 THREE.ParticleSystem=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material=b;this.sortParticles=!1;if(this.geometry)this.geometry.boundingSphere||this.geometry.computeBoundingSphere(),this.boundRadius=a.boundingSphere.radius;this.frustumCulled=!1};THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem;
 THREE.Line=function(a,b,c){THREE.Object3D.call(this);this.geometry=a;this.material=b;this.type=void 0!==c?c:THREE.LineStrip;this.geometry&&(this.geometry.boundingSphere||this.geometry.computeBoundingSphere())};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;
@@ -191,8 +193,8 @@ var j=a.colors,l=j.length,k=a.__vertexArray,m=a.__colorArray,n=a.__sortArray,o=a
 void 0===i.boundTo||"vertices"===i.boundTo)if(g=0,e=i.value.length,1===i.size)for(d=0;d<e;d++)h=n[d][1],i.array[d]=i.value[h];else if(2===i.size)for(d=0;d<e;d++)h=n[d][1],h=i.value[h],i.array[g]=h.x,i.array[g+1]=h.y,g+=2;else if(3===i.size)if("c"===i.type)for(d=0;d<e;d++)h=n[d][1],h=i.value[h],i.array[g]=h.r,i.array[g+1]=h.g,i.array[g+2]=h.b,g+=3;else for(d=0;d<e;d++)h=n[d][1],h=i.value[h],i.array[g]=h.x,i.array[g+1]=h.y,i.array[g+2]=h.z,g+=3;else if(4===i.size)for(d=0;d<e;d++)h=n[d][1],h=i.value[h],
 i.array[g]=h.x,i.array[g+1]=h.y,i.array[g+2]=h.z,i.array[g+3]=h.w,g+=4}else{if(o)for(d=0;d<h;d++)e=i[d].position,g=3*d,k[g]=e.x,k[g+1]=e.y,k[g+2]=e.z;if(p)for(d=0;d<l;d++)e=j[d],g=3*d,m[g]=e.r,m[g+1]=e.g,m[g+2]=e.b;if(q)for(j=0,l=q.length;j<l;j++)if(i=q[j],i.needsUpdate&&(void 0===i.boundTo||"vertices"===i.boundTo))if(e=i.value.length,g=0,1===i.size)for(d=0;d<e;d++)i.array[d]=i.value[d];else if(2===i.size)for(d=0;d<e;d++)h=i.value[d],i.array[g]=h.x,i.array[g+1]=h.y,g+=2;else if(3===i.size)if("c"===
 i.type)for(d=0;d<e;d++)h=i.value[d],i.array[g]=h.r,i.array[g+1]=h.g,i.array[g+2]=h.b,g+=3;else for(d=0;d<e;d++)h=i.value[d],i.array[g]=h.x,i.array[g+1]=h.y,i.array[g+2]=h.z,g+=3;else if(4===i.size)for(d=0;d<e;d++)h=i.value[d],i.array[g]=h.x,i.array[g+1]=h.y,i.array[g+2]=h.z,i.array[g+3]=h.w,g+=4}if(o||c.sortParticles)f.bindBuffer(f.ARRAY_BUFFER,a.__webglVertexBuffer),f.bufferData(f.ARRAY_BUFFER,k,b);if(p||c.sortParticles)f.bindBuffer(f.ARRAY_BUFFER,a.__webglColorBuffer),f.bufferData(f.ARRAY_BUFFER,
-m,b);if(q)for(j=0,l=q.length;j<l;j++)if(i=q[j],i.needsUpdate||c.sortParticles)f.bindBuffer(f.ARRAY_BUFFER,i.buffer),f.bufferData(f.ARRAY_BUFFER,i.array,b)}function h(a,b){return b.z-a.z}function i(a,b,c){if(a.length)for(var d=0,f=a.length;d<f;d++)X=ca=null,R=K=Pa=Oa=Da=-1,a[d].render(b,c,kc,lc),X=ca=null,R=K=Pa=Oa=Da=-1}function m(a,b,c,d,f,e,g,h){var i,j,l,k;b?(j=a.length-1,k=b=-1):(j=0,b=a.length,k=1);for(var m=j;m!==b;m+=k)if(i=a[m],i.render){j=i.object;l=i.buffer;if(h)i=h;else{i=i[c];if(!i)continue;
-g&&E.setBlending(i.blending);E.setDepthTest(i.depthTest);E.setDepthWrite(i.depthWrite);y(i.polygonOffset,i.polygonOffsetFactor,i.polygonOffsetUnits)}E.setObjectFaces(j);l instanceof THREE.BufferGeometry?E.renderBufferDirect(d,f,e,i,l,j):E.renderBuffer(d,f,e,i,l,j)}}function k(a,b,c,d,f,e,g){for(var h,i,j=0,l=a.length;j<l;j++)if(h=a[j],i=h.object,i.visible){if(g)h=g;else{h=h[b];if(!h)continue;e&&E.setBlending(h.blending);E.setDepthTest(h.depthTest);E.setDepthWrite(h.depthWrite);y(h.polygonOffset,h.polygonOffsetFactor,
+m,b);if(q)for(j=0,l=q.length;j<l;j++)if(i=q[j],i.needsUpdate||c.sortParticles)f.bindBuffer(f.ARRAY_BUFFER,i.buffer),f.bufferData(f.ARRAY_BUFFER,i.array,b)}function h(a,b){return b.z-a.z}function i(a,b,c){if(a.length)for(var d=0,f=a.length;d<f;d++)X=ca=null,R=K=Pa=Oa=Da=-1,a[d].render(b,c,kc,lc),X=ca=null,R=K=Pa=Oa=Da=-1}function k(a,b,c,d,f,e,g,h){var i,j,l,k;b?(j=a.length-1,k=b=-1):(j=0,b=a.length,k=1);for(var m=j;m!==b;m+=k)if(i=a[m],i.render){j=i.object;l=i.buffer;if(h)i=h;else{i=i[c];if(!i)continue;
+g&&E.setBlending(i.blending);E.setDepthTest(i.depthTest);E.setDepthWrite(i.depthWrite);y(i.polygonOffset,i.polygonOffsetFactor,i.polygonOffsetUnits)}E.setObjectFaces(j);l instanceof THREE.BufferGeometry?E.renderBufferDirect(d,f,e,i,l,j):E.renderBuffer(d,f,e,i,l,j)}}function m(a,b,c,d,f,e,g){for(var h,i,j=0,l=a.length;j<l;j++)if(h=a[j],i=h.object,i.visible){if(g)h=g;else{h=h[b];if(!h)continue;e&&E.setBlending(h.blending);E.setDepthTest(h.depthTest);E.setDepthWrite(h.depthWrite);y(h.polygonOffset,h.polygonOffsetFactor,
 h.polygonOffsetUnits)}E.renderImmediateObject(c,d,f,h,i)}}function j(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})}function n(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function l(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function p(a,b){for(var c=a.length-1;0<=c;c--)a[c].object===b&&a.splice(c,1)}function q(a,b){for(var c=a.length-1;0<=c;c--)a[c]===b&&a.splice(c,1)}function o(a,b,c,d,e){d.program||E.initMaterial(d,b,c,e);if(d.morphTargets&&
 !e.__webglMorphTargetInfluences){e.__webglMorphTargetInfluences=new Float32Array(E.maxMorphTargets);for(var g=0,h=E.maxMorphTargets;g<h;g++)e.__webglMorphTargetInfluences[g]=0}var i=!1,g=d.program,h=g.uniforms,j=d.uniforms;g!==ca&&(f.useProgram(g),ca=g,i=!0);if(d.id!==R)R=d.id,i=!0;if(i||a!==X)f.uniformMatrix4fv(h.projectionMatrix,!1,a._projectionMatrixArray),a!==X&&(X=a);if(i){if(c&&d.fog)if(j.fogColor.value=c.color,c instanceof THREE.Fog)j.fogNear.value=c.near,j.fogFar.value=c.far;else if(c instanceof
 THREE.FogExp2)j.fogDensity.value=c.density;if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){var l,k=0,m=0,n=0,q,o,p,r=mc,u=r.directional.colors,y=r.directional.positions,v=r.point.colors,A=r.point.positions,I=r.point.distances,M=0,J=0,N=p=0;for(c=0,i=b.length;c<i;c++)if(l=b[c],!l.onlyShadow)if(q=l.color,o=l.intensity,p=l.distance,l instanceof THREE.AmbientLight)E.gammaInput?(k+=q.r*q.r,m+=q.g*q.g,n+=q.b*q.b):(k+=q.r,m+=q.g,n+=q.b);else if(l instanceof THREE.DirectionalLight)p=
@@ -240,7 +242,7 @@ function(a,b,c,d){var e,g,j,l,n=a.lights,q=a.fog;R=-1;this.autoUpdateObjects&&th
 if(!b._projectionMatrixArray)b._projectionMatrixArray=new Float32Array(16);b.projectionMatrix.flattenToArray(b._projectionMatrixArray);Wa.multiply(b.projectionMatrix,b.matrixWorldInverse);Xb.setFromMatrix(Wa);this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);l=a.__webglObjects;for(d=0,e=l.length;d<e;d++)if(g=l[d],j=g.object,g.render=!1,j.visible&&(!(j instanceof THREE.Mesh||j instanceof THREE.ParticleSystem)||!j.frustumCulled||Xb.contains(j))){j.matrixWorld.flattenToArray(j._objectMatrixArray);
 r(j,b);var o=g,p=o.object,u=o.buffer,v=void 0,v=v=void 0,v=p.material;if(v instanceof THREE.MeshFaceMaterial){if(v=u.materialIndex,0<=v)v=p.geometry.materials[v],v.transparent?(o.transparent=v,o.opaque=null):(o.opaque=v,o.transparent=null)}else if(v)v.transparent?(o.transparent=v,o.opaque=null):(o.opaque=v,o.transparent=null);g.render=!0;if(this.sortObjects)j.renderDepth?g.z=j.renderDepth:(Ja.copy(j.position),Wa.multiplyVector3(Ja),g.z=Ja.z)}this.sortObjects&&l.sort(h);l=a.__webglObjectsImmediate;
 for(d=0,e=l.length;d<e;d++)if(g=l[d],j=g.object,j.visible)j.matrixAutoUpdate&&j.matrixWorld.flattenToArray(j._objectMatrixArray),r(j,b),j=g.object.material,j.transparent?(g.transparent=j,g.opaque=null):(g.opaque=j,g.transparent=null);a.overrideMaterial?(this.setBlending(a.overrideMaterial.blending),this.setDepthTest(a.overrideMaterial.depthTest),this.setDepthWrite(a.overrideMaterial.depthWrite),y(a.overrideMaterial.polygonOffset,a.overrideMaterial.polygonOffsetFactor,a.overrideMaterial.polygonOffsetUnits),
-m(a.__webglObjects,!1,"",b,n,q,!0,a.overrideMaterial),k(a.__webglObjectsImmediate,"",b,n,q,!1,a.overrideMaterial)):(this.setBlending(THREE.NormalBlending),m(a.__webglObjects,!0,"opaque",b,n,q,!1),k(a.__webglObjectsImmediate,"opaque",b,n,q,!1),m(a.__webglObjects,!1,"transparent",b,n,q,!0),k(a.__webglObjectsImmediate,"transparent",b,n,q,!0));i(this.renderPluginsPost,a,b);c&&c.generateMipmaps&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&(c instanceof THREE.WebGLRenderTargetCube?
+k(a.__webglObjects,!1,"",b,n,q,!0,a.overrideMaterial),m(a.__webglObjectsImmediate,"",b,n,q,!1,a.overrideMaterial)):(this.setBlending(THREE.NormalBlending),k(a.__webglObjects,!0,"opaque",b,n,q,!1),m(a.__webglObjectsImmediate,"opaque",b,n,q,!1),k(a.__webglObjects,!1,"transparent",b,n,q,!0),m(a.__webglObjectsImmediate,"transparent",b,n,q,!0));i(this.renderPluginsPost,a,b);c&&c.generateMipmaps&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&(c instanceof THREE.WebGLRenderTargetCube?
 (f.bindTexture(f.TEXTURE_CUBE_MAP,c.__webglTexture),f.generateMipmap(f.TEXTURE_CUBE_MAP),f.bindTexture(f.TEXTURE_CUBE_MAP,null)):(f.bindTexture(f.TEXTURE_2D,c.__webglTexture),f.generateMipmap(f.TEXTURE_2D),f.bindTexture(f.TEXTURE_2D,null)));this.setDepthTest(!0);this.setDepthWrite(!0)};this.renderImmediateObject=function(a,b,c,d,e){var g=o(a,b,c,d,e);K=-1;E.setObjectFaces(e);e.immediateRenderCallback?e.immediateRenderCallback(g,f,Xb):e.render(function(a){E.renderBufferImmediate(a,g,d.shading)})};
 this.initWebGLObjects=function(a){if(!a.__webglObjects)a.__webglObjects=[],a.__webglObjectsImmediate=[],a.__webglSprites=[],a.__webglFlares=[];for(;a.__objectsAdded.length;){var h=a.__objectsAdded[0],i=a,m=void 0,k=void 0,o=void 0;if(!h.__webglInit)if(h.__webglInit=!0,h._modelViewMatrix=new THREE.Matrix4,h._normalMatrixArray=new Float32Array(9),h._modelViewMatrixArray=new Float32Array(16),h._objectMatrixArray=new Float32Array(16),h.matrixWorld.flattenToArray(h._objectMatrixArray),h instanceof THREE.Mesh){if(k=
 h.geometry,k instanceof THREE.Geometry){if(void 0===k.geometryGroups){var r=k,u=void 0,v=void 0,y=void 0,A=void 0,L=void 0,C=void 0,B=void 0,I={},M=r.morphTargets.length;r.geometryGroups={};for(u=0,v=r.faces.length;u<v;u++)y=r.faces[u],A=y.materialIndex,C=void 0!==A?A:-1,void 0===I[C]&&(I[C]={hash:C,counter:0}),B=I[C].hash+"_"+I[C].counter,void 0===r.geometryGroups[B]&&(r.geometryGroups[B]={faces3:[],faces4:[],materialIndex:A,vertices:0,numMorphTargets:M}),L=y instanceof THREE.Face3?3:4,65535<r.geometryGroups[B].vertices+
@@ -326,18 +328,18 @@ THREE.LensFlare=function(a,b,c,d,e){THREE.Object3D.call(this);this.lensFlares=[]
 THREE.LensFlare.prototype.add=function(a,b,c,d,e,g){void 0===b&&(b=-1);void 0===c&&(c=0);void 0===g&&(g=1);void 0===e&&(e=new THREE.Color(16777215));if(void 0===d)d=THREE.NormalBlending;c=Math.min(c,Math.max(0,c));this.lensFlares.push({texture:a,size:b,distance:c,x:0,y:0,z:0,scale:1,rotation:1,opacity:g,color:e,blending:d})};
 THREE.LensFlare.prototype.updateLensFlares=function(){var a,b=this.lensFlares.length,c,d=2*-this.positionScreen.x,e=2*-this.positionScreen.y;for(a=0;a<b;a++)c=this.lensFlares[a],c.x=this.positionScreen.x+d*c.distance,c.y=this.positionScreen.y+e*c.distance,c.wantedRotation=0.25*c.x*Math.PI,c.rotation+=0.25*(c.wantedRotation-c.rotation)};
 THREE.MarchingCubes=function(a,b){THREE.Object3D.call(this);this.material=b;this.init=function(a){this.resolution=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(3*this.size3);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(3*this.maxCount);this.normalArray=new Float32Array(3*this.maxCount)};this.lerp=function(a,b,e){return a+(b-a)*e};this.VIntX=function(a,b,e,g,h,i,m,k,j,n){h=(h-j)/(n-j);j=this.normal_cache;b[g]=i+h*this.delta;b[g+1]=m;b[g+2]=k;e[g]=this.lerp(j[a],j[a+3],h);e[g+1]=this.lerp(j[a+1],j[a+4],h);e[g+2]=this.lerp(j[a+2],j[a+5],h)};this.VIntY=function(a,b,e,g,h,i,m,k,j,n){h=(h-j)/(n-j);j=this.normal_cache;b[g]=i;b[g+1]=m+h*this.delta;b[g+2]=k;b=a+3*this.yd;
-e[g]=this.lerp(j[a],j[b],h);e[g+1]=this.lerp(j[a+1],j[b+1],h);e[g+2]=this.lerp(j[a+2],j[b+2],h)};this.VIntZ=function(a,b,e,g,h,i,m,k,j,n){h=(h-j)/(n-j);j=this.normal_cache;b[g]=i;b[g+1]=m;b[g+2]=k+h*this.delta;b=a+3*this.zd;e[g]=this.lerp(j[a],j[b],h);e[g+1]=this.lerp(j[a+1],j[b+1],h);e[g+2]=this.lerp(j[a+2],j[b+2],h)};this.compNorm=function(a){var b=3*a;0===this.normal_cache[b]&&(this.normal_cache[b]=this.field[a-1]-this.field[a+1],this.normal_cache[b+1]=this.field[a-this.yd]-this.field[a+this.yd],
-this.normal_cache[b+2]=this.field[a-this.zd]-this.field[a+this.zd])};this.polygonize=function(a,b,e,g,h,i){var m=g+1,k=g+this.yd,j=g+this.zd,n=m+this.yd,l=m+this.zd,p=g+this.yd+this.zd,q=m+this.yd+this.zd,o=0,r=this.field[g],y=this.field[m],u=this.field[k],L=this.field[n],A=this.field[j],v=this.field[l],B=this.field[p],C=this.field[q];r<h&&(o|=1);y<h&&(o|=2);u<h&&(o|=8);L<h&&(o|=4);A<h&&(o|=16);v<h&&(o|=32);B<h&&(o|=128);C<h&&(o|=64);var I=THREE.edgeTable[o];if(0===I)return 0;var M=this.delta,N=a+
-M,J=b+M,M=e+M;I&1&&(this.compNorm(g),this.compNorm(m),this.VIntX(3*g,this.vlist,this.nlist,0,h,a,b,e,r,y));I&2&&(this.compNorm(m),this.compNorm(n),this.VIntY(3*m,this.vlist,this.nlist,3,h,N,b,e,y,L));I&4&&(this.compNorm(k),this.compNorm(n),this.VIntX(3*k,this.vlist,this.nlist,6,h,a,J,e,u,L));I&8&&(this.compNorm(g),this.compNorm(k),this.VIntY(3*g,this.vlist,this.nlist,9,h,a,b,e,r,u));I&16&&(this.compNorm(j),this.compNorm(l),this.VIntX(3*j,this.vlist,this.nlist,12,h,a,b,M,A,v));I&32&&(this.compNorm(l),
-this.compNorm(q),this.VIntY(3*l,this.vlist,this.nlist,15,h,N,b,M,v,C));I&64&&(this.compNorm(p),this.compNorm(q),this.VIntX(3*p,this.vlist,this.nlist,18,h,a,J,M,B,C));I&128&&(this.compNorm(j),this.compNorm(p),this.VIntY(3*j,this.vlist,this.nlist,21,h,a,b,M,A,B));I&256&&(this.compNorm(g),this.compNorm(j),this.VIntZ(3*g,this.vlist,this.nlist,24,h,a,b,e,r,A));I&512&&(this.compNorm(m),this.compNorm(l),this.VIntZ(3*m,this.vlist,this.nlist,27,h,N,b,e,y,v));I&1024&&(this.compNorm(n),this.compNorm(q),this.VIntZ(3*
-n,this.vlist,this.nlist,30,h,N,J,e,L,C));I&2048&&(this.compNorm(k),this.compNorm(p),this.VIntZ(3*k,this.vlist,this.nlist,33,h,a,J,e,u,B));o<<=4;for(h=g=0;-1!=THREE.triTable[o+h];)a=o+h,b=a+1,e=a+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[a],3*THREE.triTable[b],3*THREE.triTable[e],i),h+=3,g++;return g};this.posnormtriv=function(a,b,e,g,h,i){var m=3*this.count;this.positionArray[m]=a[e];this.positionArray[m+1]=a[e+1];this.positionArray[m+2]=a[e+2];this.positionArray[m+3]=a[g];this.positionArray[m+
-4]=a[g+1];this.positionArray[m+5]=a[g+2];this.positionArray[m+6]=a[h];this.positionArray[m+7]=a[h+1];this.positionArray[m+8]=a[h+2];this.normalArray[m]=b[e];this.normalArray[m+1]=b[e+1];this.normalArray[m+2]=b[e+2];this.normalArray[m+3]=b[g];this.normalArray[m+4]=b[g+1];this.normalArray[m+5]=b[g+2];this.normalArray[m+6]=b[h];this.normalArray[m+7]=b[h+1];this.normalArray[m+8]=b[h+2];this.hasNormal=this.hasPos=!0;this.count+=3;this.count>=this.maxCount-3&&i(this)};this.begin=function(){this.count=0;
-this.hasNormal=this.hasPos=!1};this.end=function(a){if(0!==this.count){for(var b=3*this.count;b<this.positionArray.length;b++)this.positionArray[b]=0;a(this)}};this.addBall=function(a,b,e,g,h){var i=this.size*Math.sqrt(g/h),m=e*this.size,k=b*this.size,j=a*this.size,n=Math.floor(m-i);1>n&&(n=1);m=Math.floor(m+i);m>this.size-1&&(m=this.size-1);var l=Math.floor(k-i);1>l&&(l=1);k=Math.floor(k+i);k>this.size-1&&(k=this.size-1);var p=Math.floor(j-i);1>p&&(p=1);i=Math.floor(j+i);i>this.size-1&&(i=this.size-
-1);for(var q,o,r,y,u,L,A,j=n;j<m;j++){r=this.size2*j;u=j/this.size-e;L=u*u;for(n=l;n<k;n++){o=r+this.size*n;q=n/this.size-b;A=q*q;for(q=p;q<i;q++)y=q/this.size-a,y=g/(1.0E-6+y*y+A+L)-h,0<y&&(this.field[o+q]+=y)}}};this.addPlaneX=function(a,b){var e,g,h,i,m,k=this.size,j=this.yd,n=this.zd,l=this.field,p=k*Math.sqrt(a/b);p>k&&(p=k);for(e=0;e<p;e++)if(g=e/k,g*=g,i=a/(1.0E-4+g)-b,0<i)for(g=0;g<k;g++){m=e+g*j;for(h=0;h<k;h++)l[n*h+m]+=i}};this.addPlaneY=function(a,b){var e,g,h,i,m,k,j=this.size,n=this.yd,
-l=this.zd,p=this.field,q=j*Math.sqrt(a/b);q>j&&(q=j);for(g=0;g<q;g++)if(e=g/j,e*=e,i=a/(1.0E-4+e)-b,0<i){m=g*n;for(e=0;e<j;e++){k=m+e;for(h=0;h<j;h++)p[l*h+k]+=i}}};this.addPlaneZ=function(a,b){var e,g,h,i,m,k,j=this.size,n=this.yd,l=this.zd,p=this.field,q=j*Math.sqrt(a/b);q>j&&(q=j);for(h=0;h<q;h++)if(e=h/j,e*=e,i=a/(1.0E-4+e)-b,0<i){m=l*h;for(g=0;g<j;g++){k=m+g*n;for(e=0;e<j;e++)p[k+e]+=i}}};this.reset=function(){var a;for(a=0;a<this.size3;a++)this.normal_cache[3*a]=0,this.field[a]=0};this.render=
-function(a){this.begin();var b,e,g,h,i,m,k,j,n,l=this.size-2;for(h=1;h<l;h++){n=this.size2*h;k=(h-this.halfsize)/this.halfsize;for(g=1;g<l;g++){j=n+this.size*g;m=(g-this.halfsize)/this.halfsize;for(e=1;e<l;e++)i=(e-this.halfsize)/this.halfsize,b=j+e,this.polygonize(i,m,k,b,this.isolation,a)}}this.end(a)};this.generateGeometry=function(){var a=0,b=new THREE.Geometry,e=[];this.render(function(g){var h,i,m,k,j,n,l,p;for(h=0;h<g.count;h++)l=3*h,j=l+1,p=l+2,i=g.positionArray[l],m=g.positionArray[j],k=
-g.positionArray[p],n=new THREE.Vector3(i,m,k),i=g.normalArray[l],m=g.normalArray[j],k=g.normalArray[p],l=new THREE.Vector3(i,m,k),l.normalize(),j=new THREE.Vertex(n),b.vertices.push(j),e.push(l);n=g.count/3;for(h=0;h<n;h++)l=3*(a+h),j=l+1,p=l+2,i=e[l],m=e[j],k=e[p],l=new THREE.Face3(l,j,p,[i,m,k]),b.faces.push(l);a+=n;g.count=0});return b};this.init(a)};THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
+this.hasPos=!1;this.positionArray=new Float32Array(3*this.maxCount);this.normalArray=new Float32Array(3*this.maxCount)};this.lerp=function(a,b,e){return a+(b-a)*e};this.VIntX=function(a,b,e,g,h,i,k,m,j,n){h=(h-j)/(n-j);j=this.normal_cache;b[g]=i+h*this.delta;b[g+1]=k;b[g+2]=m;e[g]=this.lerp(j[a],j[a+3],h);e[g+1]=this.lerp(j[a+1],j[a+4],h);e[g+2]=this.lerp(j[a+2],j[a+5],h)};this.VIntY=function(a,b,e,g,h,i,k,m,j,n){h=(h-j)/(n-j);j=this.normal_cache;b[g]=i;b[g+1]=k+h*this.delta;b[g+2]=m;b=a+3*this.yd;
+e[g]=this.lerp(j[a],j[b],h);e[g+1]=this.lerp(j[a+1],j[b+1],h);e[g+2]=this.lerp(j[a+2],j[b+2],h)};this.VIntZ=function(a,b,e,g,h,i,k,m,j,n){h=(h-j)/(n-j);j=this.normal_cache;b[g]=i;b[g+1]=k;b[g+2]=m+h*this.delta;b=a+3*this.zd;e[g]=this.lerp(j[a],j[b],h);e[g+1]=this.lerp(j[a+1],j[b+1],h);e[g+2]=this.lerp(j[a+2],j[b+2],h)};this.compNorm=function(a){var b=3*a;0===this.normal_cache[b]&&(this.normal_cache[b]=this.field[a-1]-this.field[a+1],this.normal_cache[b+1]=this.field[a-this.yd]-this.field[a+this.yd],
+this.normal_cache[b+2]=this.field[a-this.zd]-this.field[a+this.zd])};this.polygonize=function(a,b,e,g,h,i){var k=g+1,m=g+this.yd,j=g+this.zd,n=k+this.yd,l=k+this.zd,p=g+this.yd+this.zd,q=k+this.yd+this.zd,o=0,r=this.field[g],y=this.field[k],u=this.field[m],L=this.field[n],A=this.field[j],v=this.field[l],B=this.field[p],C=this.field[q];r<h&&(o|=1);y<h&&(o|=2);u<h&&(o|=8);L<h&&(o|=4);A<h&&(o|=16);v<h&&(o|=32);B<h&&(o|=128);C<h&&(o|=64);var I=THREE.edgeTable[o];if(0===I)return 0;var M=this.delta,N=a+
+M,J=b+M,M=e+M;I&1&&(this.compNorm(g),this.compNorm(k),this.VIntX(3*g,this.vlist,this.nlist,0,h,a,b,e,r,y));I&2&&(this.compNorm(k),this.compNorm(n),this.VIntY(3*k,this.vlist,this.nlist,3,h,N,b,e,y,L));I&4&&(this.compNorm(m),this.compNorm(n),this.VIntX(3*m,this.vlist,this.nlist,6,h,a,J,e,u,L));I&8&&(this.compNorm(g),this.compNorm(m),this.VIntY(3*g,this.vlist,this.nlist,9,h,a,b,e,r,u));I&16&&(this.compNorm(j),this.compNorm(l),this.VIntX(3*j,this.vlist,this.nlist,12,h,a,b,M,A,v));I&32&&(this.compNorm(l),
+this.compNorm(q),this.VIntY(3*l,this.vlist,this.nlist,15,h,N,b,M,v,C));I&64&&(this.compNorm(p),this.compNorm(q),this.VIntX(3*p,this.vlist,this.nlist,18,h,a,J,M,B,C));I&128&&(this.compNorm(j),this.compNorm(p),this.VIntY(3*j,this.vlist,this.nlist,21,h,a,b,M,A,B));I&256&&(this.compNorm(g),this.compNorm(j),this.VIntZ(3*g,this.vlist,this.nlist,24,h,a,b,e,r,A));I&512&&(this.compNorm(k),this.compNorm(l),this.VIntZ(3*k,this.vlist,this.nlist,27,h,N,b,e,y,v));I&1024&&(this.compNorm(n),this.compNorm(q),this.VIntZ(3*
+n,this.vlist,this.nlist,30,h,N,J,e,L,C));I&2048&&(this.compNorm(m),this.compNorm(p),this.VIntZ(3*m,this.vlist,this.nlist,33,h,a,J,e,u,B));o<<=4;for(h=g=0;-1!=THREE.triTable[o+h];)a=o+h,b=a+1,e=a+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[a],3*THREE.triTable[b],3*THREE.triTable[e],i),h+=3,g++;return g};this.posnormtriv=function(a,b,e,g,h,i){var k=3*this.count;this.positionArray[k]=a[e];this.positionArray[k+1]=a[e+1];this.positionArray[k+2]=a[e+2];this.positionArray[k+3]=a[g];this.positionArray[k+
+4]=a[g+1];this.positionArray[k+5]=a[g+2];this.positionArray[k+6]=a[h];this.positionArray[k+7]=a[h+1];this.positionArray[k+8]=a[h+2];this.normalArray[k]=b[e];this.normalArray[k+1]=b[e+1];this.normalArray[k+2]=b[e+2];this.normalArray[k+3]=b[g];this.normalArray[k+4]=b[g+1];this.normalArray[k+5]=b[g+2];this.normalArray[k+6]=b[h];this.normalArray[k+7]=b[h+1];this.normalArray[k+8]=b[h+2];this.hasNormal=this.hasPos=!0;this.count+=3;this.count>=this.maxCount-3&&i(this)};this.begin=function(){this.count=0;
+this.hasNormal=this.hasPos=!1};this.end=function(a){if(0!==this.count){for(var b=3*this.count;b<this.positionArray.length;b++)this.positionArray[b]=0;a(this)}};this.addBall=function(a,b,e,g,h){var i=this.size*Math.sqrt(g/h),k=e*this.size,m=b*this.size,j=a*this.size,n=Math.floor(k-i);1>n&&(n=1);k=Math.floor(k+i);k>this.size-1&&(k=this.size-1);var l=Math.floor(m-i);1>l&&(l=1);m=Math.floor(m+i);m>this.size-1&&(m=this.size-1);var p=Math.floor(j-i);1>p&&(p=1);i=Math.floor(j+i);i>this.size-1&&(i=this.size-
+1);for(var q,o,r,y,u,L,A,j=n;j<k;j++){r=this.size2*j;u=j/this.size-e;L=u*u;for(n=l;n<m;n++){o=r+this.size*n;q=n/this.size-b;A=q*q;for(q=p;q<i;q++)y=q/this.size-a,y=g/(1.0E-6+y*y+A+L)-h,0<y&&(this.field[o+q]+=y)}}};this.addPlaneX=function(a,b){var e,g,h,i,k,m=this.size,j=this.yd,n=this.zd,l=this.field,p=m*Math.sqrt(a/b);p>m&&(p=m);for(e=0;e<p;e++)if(g=e/m,g*=g,i=a/(1.0E-4+g)-b,0<i)for(g=0;g<m;g++){k=e+g*j;for(h=0;h<m;h++)l[n*h+k]+=i}};this.addPlaneY=function(a,b){var e,g,h,i,k,m,j=this.size,n=this.yd,
+l=this.zd,p=this.field,q=j*Math.sqrt(a/b);q>j&&(q=j);for(g=0;g<q;g++)if(e=g/j,e*=e,i=a/(1.0E-4+e)-b,0<i){k=g*n;for(e=0;e<j;e++){m=k+e;for(h=0;h<j;h++)p[l*h+m]+=i}}};this.addPlaneZ=function(a,b){var e,g,h,i,k,m,j=this.size,n=this.yd,l=this.zd,p=this.field,q=j*Math.sqrt(a/b);q>j&&(q=j);for(h=0;h<q;h++)if(e=h/j,e*=e,i=a/(1.0E-4+e)-b,0<i){k=l*h;for(g=0;g<j;g++){m=k+g*n;for(e=0;e<j;e++)p[m+e]+=i}}};this.reset=function(){var a;for(a=0;a<this.size3;a++)this.normal_cache[3*a]=0,this.field[a]=0};this.render=
+function(a){this.begin();var b,e,g,h,i,k,m,j,n,l=this.size-2;for(h=1;h<l;h++){n=this.size2*h;m=(h-this.halfsize)/this.halfsize;for(g=1;g<l;g++){j=n+this.size*g;k=(g-this.halfsize)/this.halfsize;for(e=1;e<l;e++)i=(e-this.halfsize)/this.halfsize,b=j+e,this.polygonize(i,k,m,b,this.isolation,a)}}this.end(a)};this.generateGeometry=function(){var a=0,b=new THREE.Geometry,e=[];this.render(function(g){var h,i,k,m,j,n,l,p;for(h=0;h<g.count;h++)l=3*h,j=l+1,p=l+2,i=g.positionArray[l],k=g.positionArray[j],m=
+g.positionArray[p],n=new THREE.Vector3(i,k,m),i=g.normalArray[l],k=g.normalArray[j],m=g.normalArray[p],l=new THREE.Vector3(i,k,m),l.normalize(),j=new THREE.Vertex(n),b.vertices.push(j),e.push(l);n=g.count/3;for(h=0;h<n;h++)l=3*(a+h),j=l+1,p=l+2,i=e[l],k=e[j],m=e[p],l=new THREE.Face3(l,j,p,[i,k,m]),b.faces.push(l);a+=n;g.count=0});return b};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]);
@@ -362,31 +364,31 @@ THREE.triTable=new Int32Array([-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0
 4,1,4,0,7,4,11,-1,-1,-1,-1,3,1,4,3,4,8,1,10,4,7,4,11,10,11,4,-1,4,11,7,9,11,4,9,2,11,9,1,2,-1,-1,-1,-1,9,7,4,9,11,7,9,1,11,2,11,1,0,8,3,-1,11,7,4,11,4,2,2,4,0,-1,-1,-1,-1,-1,-1,-1,11,7,4,11,4,2,8,3,4,3,2,4,-1,-1,-1,-1,2,9,10,2,7,9,2,3,7,7,4,9,-1,-1,-1,-1,9,10,7,9,7,4,10,2,7,8,7,0,2,0,7,-1,3,7,10,3,10,2,7,4,10,1,10,0,4,0,10,-1,1,10,2,8,7,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,9,1,4,1,7,7,1,3,-1,-1,-1,-1,-1,-1,-1,4,9,1,4,1,7,0,8,1,8,7,1,-1,-1,-1,-1,4,0,3,7,4,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,8,7,-1,-1,-1,
 -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,10,8,10,11,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,0,9,3,9,11,11,9,10,-1,-1,-1,-1,-1,-1,-1,0,1,10,0,10,8,8,10,11,-1,-1,-1,-1,-1,-1,-1,3,1,10,11,3,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,2,11,1,11,9,9,11,8,-1,-1,-1,-1,-1,-1,-1,3,0,9,3,9,11,1,2,9,2,11,9,-1,-1,-1,-1,0,2,11,8,0,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,2,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,3,8,2,8,10,10,8,9,-1,-1,-1,-1,-1,-1,-1,9,10,2,0,9,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,3,8,2,8,10,0,1,8,1,10,8,-1,-1,-1,-1,1,10,
 2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,3,8,9,1,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,9,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,3,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1]);
-THREE.LensFlarePlugin=function(){function a(a){var c=b.createProgram(),d=b.createShader(b.FRAGMENT_SHADER),e=b.createShader(b.VERTEX_SHADER);b.shaderSource(d,a.fragmentShader);b.shaderSource(e,a.vertexShader);b.compileShader(d);b.compileShader(e);b.attachShader(c,d);b.attachShader(c,e);b.linkProgram(c);return c}var b,c,d,e,g,h,i,m,k,j,n,l,p;this.init=function(q){b=q.context;c=q;d=new Float32Array(16);e=new Uint16Array(6);q=0;d[q++]=-1;d[q++]=-1;d[q++]=0;d[q++]=0;d[q++]=1;d[q++]=-1;d[q++]=1;d[q++]=
-0;d[q++]=1;d[q++]=1;d[q++]=1;d[q++]=1;d[q++]=-1;d[q++]=1;d[q++]=0;d[q++]=1;q=0;e[q++]=0;e[q++]=1;e[q++]=2;e[q++]=0;e[q++]=2;e[q++]=3;g=b.createBuffer();h=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,g);b.bufferData(b.ARRAY_BUFFER,d,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,h);b.bufferData(b.ELEMENT_ARRAY_BUFFER,e,b.STATIC_DRAW);i=b.createTexture();m=b.createTexture();b.bindTexture(b.TEXTURE_2D,i);b.texImage2D(b.TEXTURE_2D,0,b.RGB,16,16,0,b.RGB,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,
-b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);b.bindTexture(b.TEXTURE_2D,m);b.texImage2D(b.TEXTURE_2D,0,b.RGBA,16,16,0,b.RGBA,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);
-b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);0>=b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)?(k=!1,j=a(THREE.ShaderFlares.lensFlare)):(k=!0,j=a(THREE.ShaderFlares.lensFlareVertexTexture));n={};l={};n.vertex=b.getAttribLocation(j,"position");n.uv=b.getAttribLocation(j,"uv");l.renderType=b.getUniformLocation(j,"renderType");l.map=b.getUniformLocation(j,"map");l.occlusionMap=b.getUniformLocation(j,"occlusionMap");l.opacity=b.getUniformLocation(j,"opacity");l.color=b.getUniformLocation(j,
+THREE.LensFlarePlugin=function(){function a(a){var c=b.createProgram(),d=b.createShader(b.FRAGMENT_SHADER),e=b.createShader(b.VERTEX_SHADER);b.shaderSource(d,a.fragmentShader);b.shaderSource(e,a.vertexShader);b.compileShader(d);b.compileShader(e);b.attachShader(c,d);b.attachShader(c,e);b.linkProgram(c);return c}var b,c,d,e,g,h,i,k,m,j,n,l,p;this.init=function(q){b=q.context;c=q;d=new Float32Array(16);e=new Uint16Array(6);q=0;d[q++]=-1;d[q++]=-1;d[q++]=0;d[q++]=0;d[q++]=1;d[q++]=-1;d[q++]=1;d[q++]=
+0;d[q++]=1;d[q++]=1;d[q++]=1;d[q++]=1;d[q++]=-1;d[q++]=1;d[q++]=0;d[q++]=1;q=0;e[q++]=0;e[q++]=1;e[q++]=2;e[q++]=0;e[q++]=2;e[q++]=3;g=b.createBuffer();h=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,g);b.bufferData(b.ARRAY_BUFFER,d,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,h);b.bufferData(b.ELEMENT_ARRAY_BUFFER,e,b.STATIC_DRAW);i=b.createTexture();k=b.createTexture();b.bindTexture(b.TEXTURE_2D,i);b.texImage2D(b.TEXTURE_2D,0,b.RGB,16,16,0,b.RGB,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,
+b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);b.bindTexture(b.TEXTURE_2D,k);b.texImage2D(b.TEXTURE_2D,0,b.RGBA,16,16,0,b.RGBA,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);
+b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);0>=b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)?(m=!1,j=a(THREE.ShaderFlares.lensFlare)):(m=!0,j=a(THREE.ShaderFlares.lensFlareVertexTexture));n={};l={};n.vertex=b.getAttribLocation(j,"position");n.uv=b.getAttribLocation(j,"uv");l.renderType=b.getUniformLocation(j,"renderType");l.map=b.getUniformLocation(j,"map");l.occlusionMap=b.getUniformLocation(j,"occlusionMap");l.opacity=b.getUniformLocation(j,"opacity");l.color=b.getUniformLocation(j,
 "color");l.scale=b.getUniformLocation(j,"scale");l.rotation=b.getUniformLocation(j,"rotation");l.screenPosition=b.getUniformLocation(j,"screenPosition");p=!1};this.render=function(a,d,e,y){var a=a.__webglFlares,u=a.length;if(u){var L=new THREE.Vector3,A=y/e,v=0.5*e,B=0.5*y,C=16/y,I=new THREE.Vector2(C*A,C),M=new THREE.Vector3(1,1,0),N=new THREE.Vector2(1,1),J=l,C=n;b.useProgram(j);p||(b.enableVertexAttribArray(n.vertex),b.enableVertexAttribArray(n.uv),p=!0);b.uniform1i(J.occlusionMap,0);b.uniform1i(J.map,
-1);b.bindBuffer(b.ARRAY_BUFFER,g);b.vertexAttribPointer(C.vertex,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(C.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,h);b.disable(b.CULL_FACE);b.depthMask(!1);var T,wa,la,aa,$;for(T=0;T<u;T++)if(C=16/y,I.set(C*A,C),aa=a[T],L.set(aa.matrixWorld.n14,aa.matrixWorld.n24,aa.matrixWorld.n34),d.matrixWorldInverse.multiplyVector3(L),d.projectionMatrix.multiplyVector3(L),M.copy(L),N.x=M.x*v+v,N.y=M.y*B+B,k||0<N.x&&N.x<e&&0<N.y&&N.y<y){b.activeTexture(b.TEXTURE1);
-b.bindTexture(b.TEXTURE_2D,i);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,N.x-8,N.y-8,16,16,0);b.uniform1i(J.renderType,0);b.uniform2f(J.scale,I.x,I.y);b.uniform3f(J.screenPosition,M.x,M.y,M.z);b.disable(b.BLEND);b.enable(b.DEPTH_TEST);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);b.activeTexture(b.TEXTURE0);b.bindTexture(b.TEXTURE_2D,m);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGBA,N.x-8,N.y-8,16,16,0);b.uniform1i(J.renderType,1);b.disable(b.DEPTH_TEST);b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,
+1);b.bindBuffer(b.ARRAY_BUFFER,g);b.vertexAttribPointer(C.vertex,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(C.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,h);b.disable(b.CULL_FACE);b.depthMask(!1);var T,wa,la,aa,$;for(T=0;T<u;T++)if(C=16/y,I.set(C*A,C),aa=a[T],L.set(aa.matrixWorld.n14,aa.matrixWorld.n24,aa.matrixWorld.n34),d.matrixWorldInverse.multiplyVector3(L),d.projectionMatrix.multiplyVector3(L),M.copy(L),N.x=M.x*v+v,N.y=M.y*B+B,m||0<N.x&&N.x<e&&0<N.y&&N.y<y){b.activeTexture(b.TEXTURE1);
+b.bindTexture(b.TEXTURE_2D,i);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,N.x-8,N.y-8,16,16,0);b.uniform1i(J.renderType,0);b.uniform2f(J.scale,I.x,I.y);b.uniform3f(J.screenPosition,M.x,M.y,M.z);b.disable(b.BLEND);b.enable(b.DEPTH_TEST);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);b.activeTexture(b.TEXTURE0);b.bindTexture(b.TEXTURE_2D,k);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGBA,N.x-8,N.y-8,16,16,0);b.uniform1i(J.renderType,1);b.disable(b.DEPTH_TEST);b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,
 i);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);aa.positionScreen.copy(M);aa.customUpdateCallback?aa.customUpdateCallback(aa):aa.updateLensFlares();b.uniform1i(J.renderType,2);b.enable(b.BLEND);for(wa=0,la=aa.lensFlares.length;wa<la;wa++)if($=aa.lensFlares[wa],0.0010<$.opacity&&0.0010<$.scale)M.x=$.x,M.y=$.y,M.z=$.z,C=$.size*$.scale/y,I.x=C*A,I.y=C,b.uniform3f(J.screenPosition,M.x,M.y,M.z),b.uniform2f(J.scale,I.x,I.y),b.uniform1f(J.rotation,$.rotation),b.uniform1f(J.opacity,$.opacity),b.uniform3f(J.color,
 $.color.r,$.color.g,$.color.b),c.setBlending($.blending),c.setTexture($.texture,1),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0)}b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(!0)}}};
 THREE.ShadowMapPlugin=function(){var a,b,c,d,e=new THREE.Frustum,g=new THREE.Matrix4,h=new THREE.Vector3,i=new THREE.Vector3;this.init=function(e){a=e.context;b=e;var e=THREE.ShaderLib.depthRGBA,g=THREE.UniformsUtils.clone(e.uniforms);c=new THREE.ShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:g});d=new THREE.ShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:g,morphTargets:!0});c._shadowPass=!0;d._shadowPass=!0};this.render=function(a,
-c){b.shadowMapEnabled&&b.shadowMapAutoUpdate&&this.update(a,c)};this.update=function(m,k){var j,n,l,p,q,o,r,y,u,L=[];p=0;a.clearColor(1,1,1,1);a.disable(a.BLEND);b.shadowMapCullFrontFaces&&a.cullFace(a.FRONT);b.setDepthTest(!0);for(j=0,n=m.lights.length;j<n;j++)if(l=m.lights[j],l.castShadow)if(l instanceof THREE.DirectionalLight&&l.shadowCascade)for(q=0;q<l.shadowCascadeCount;q++){var A;if(l.shadowCascadeArray[q])A=l.shadowCascadeArray[q];else{u=l;r=q;A=new THREE.DirectionalLight;A.isVirtual=!0;A.onlyShadow=
+c){b.shadowMapEnabled&&b.shadowMapAutoUpdate&&this.update(a,c)};this.update=function(k,m){var j,n,l,p,q,o,r,y,u,L=[];p=0;a.clearColor(1,1,1,1);a.disable(a.BLEND);b.shadowMapCullFrontFaces&&a.cullFace(a.FRONT);b.setDepthTest(!0);for(j=0,n=k.lights.length;j<n;j++)if(l=k.lights[j],l.castShadow)if(l instanceof THREE.DirectionalLight&&l.shadowCascade)for(q=0;q<l.shadowCascadeCount;q++){var A;if(l.shadowCascadeArray[q])A=l.shadowCascadeArray[q];else{u=l;r=q;A=new THREE.DirectionalLight;A.isVirtual=!0;A.onlyShadow=
 !0;A.castShadow=!0;A.shadowCameraNear=u.shadowCameraNear;A.shadowCameraFar=u.shadowCameraFar;A.shadowCameraLeft=u.shadowCameraLeft;A.shadowCameraRight=u.shadowCameraRight;A.shadowCameraBottom=u.shadowCameraBottom;A.shadowCameraTop=u.shadowCameraTop;A.shadowCameraVisible=u.shadowCameraVisible;A.shadowDarkness=u.shadowDarkness;A.shadowBias=u.shadowCascadeBias[r];A.shadowMapWidth=u.shadowCascadeWidth[r];A.shadowMapHeight=u.shadowCascadeHeight[r];A.pointsWorld=[];A.pointsFrustum=[];y=A.pointsWorld;o=
-A.pointsFrustum;for(var v=0;8>v;v++)y[v]=new THREE.Vector3,o[v]=new THREE.Vector3;y=u.shadowCascadeNearZ[r];u=u.shadowCascadeFarZ[r];o[0].set(-1,-1,y);o[1].set(1,-1,y);o[2].set(-1,1,y);o[3].set(1,1,y);o[4].set(-1,-1,u);o[5].set(1,-1,u);o[6].set(-1,1,u);o[7].set(1,1,u);A.originalCamera=k;o=new THREE.Gyroscope;o.position=l.shadowCascadeOffset;o.add(A);o.add(A.target);k.add(o);l.shadowCascadeArray[q]=A;console.log("Created virtualLight",A)}r=l;y=q;u=r.shadowCascadeArray[y];u.position.copy(r.position);
+A.pointsFrustum;for(var v=0;8>v;v++)y[v]=new THREE.Vector3,o[v]=new THREE.Vector3;y=u.shadowCascadeNearZ[r];u=u.shadowCascadeFarZ[r];o[0].set(-1,-1,y);o[1].set(1,-1,y);o[2].set(-1,1,y);o[3].set(1,1,y);o[4].set(-1,-1,u);o[5].set(1,-1,u);o[6].set(-1,1,u);o[7].set(1,1,u);A.originalCamera=m;o=new THREE.Gyroscope;o.position=l.shadowCascadeOffset;o.add(A);o.add(A.target);m.add(o);l.shadowCascadeArray[q]=A;console.log("Created virtualLight",A)}r=l;y=q;u=r.shadowCascadeArray[y];u.position.copy(r.position);
 u.target.position.copy(r.target.position);u.lookAt(u.target);u.shadowCameraVisible=r.shadowCameraVisible;u.shadowDarkness=r.shadowDarkness;u.shadowBias=r.shadowCascadeBias[y];o=r.shadowCascadeNearZ[y];r=r.shadowCascadeFarZ[y];u=u.pointsFrustum;u[0].z=o;u[1].z=o;u[2].z=o;u[3].z=o;u[4].z=r;u[5].z=r;u[6].z=r;u[7].z=r;L[p]=A;p++}else L[p]=l,p++;for(j=0,n=L.length;j<n;j++){l=L[j];if(!l.shadowMap)l.shadowMap=new THREE.WebGLRenderTarget(l.shadowMapWidth,l.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,
 format:THREE.RGBAFormat}),l.shadowMapSize=new THREE.Vector2(l.shadowMapWidth,l.shadowMapHeight),l.shadowMatrix=new THREE.Matrix4;if(!l.shadowCamera){if(l instanceof THREE.SpotLight)l.shadowCamera=new THREE.PerspectiveCamera(l.shadowCameraFov,l.shadowMapWidth/l.shadowMapHeight,l.shadowCameraNear,l.shadowCameraFar);else if(l instanceof THREE.DirectionalLight)l.shadowCamera=new THREE.OrthographicCamera(l.shadowCameraLeft,l.shadowCameraRight,l.shadowCameraTop,l.shadowCameraBottom,l.shadowCameraNear,l.shadowCameraFar);
-else{console.error("Unsupported light type for shadow");continue}m.add(l.shadowCamera);b.autoUpdateScene&&m.updateMatrixWorld()}if(l.shadowCameraVisible&&!l.cameraHelper)l.cameraHelper=new THREE.CameraHelper(l.shadowCamera),l.shadowCamera.add(l.cameraHelper);if(l.isVirtual&&A.originalCamera==k){q=k;p=l.shadowCamera;o=l.pointsFrustum;u=l.pointsWorld;h.set(Infinity,Infinity,Infinity);i.set(-Infinity,-Infinity,-Infinity);for(r=0;8>r;r++){y=u[r];y.copy(o[r]);THREE.ShadowMapPlugin.__projector.unprojectVector(y,
+else{console.error("Unsupported light type for shadow");continue}k.add(l.shadowCamera);b.autoUpdateScene&&k.updateMatrixWorld()}if(l.shadowCameraVisible&&!l.cameraHelper)l.cameraHelper=new THREE.CameraHelper(l.shadowCamera),l.shadowCamera.add(l.cameraHelper);if(l.isVirtual&&A.originalCamera==m){q=m;p=l.shadowCamera;o=l.pointsFrustum;u=l.pointsWorld;h.set(Infinity,Infinity,Infinity);i.set(-Infinity,-Infinity,-Infinity);for(r=0;8>r;r++){y=u[r];y.copy(o[r]);THREE.ShadowMapPlugin.__projector.unprojectVector(y,
 q);p.matrixWorldInverse.multiplyVector3(y);if(y.x<h.x)h.x=y.x;if(y.x>i.x)i.x=y.x;if(y.y<h.y)h.y=y.y;if(y.y>i.y)i.y=y.y;if(y.z<h.z)h.z=y.z;if(y.z>i.z)i.z=y.z}p.left=h.x;p.right=i.x;p.top=i.y;p.bottom=h.y;p.updateProjectionMatrix()}p=l.shadowMap;o=l.shadowMatrix;q=l.shadowCamera;q.position.copy(l.matrixWorld.getPosition());q.lookAt(l.target.matrixWorld.getPosition());q.updateMatrixWorld();q.matrixWorldInverse.getInverse(q.matrixWorld);if(l.cameraHelper)l.cameraHelper.lines.visible=l.shadowCameraVisible;
 l.shadowCameraVisible&&l.cameraHelper.update(l.shadowCamera);o.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);o.multiplySelf(q.projectionMatrix);o.multiplySelf(q.matrixWorldInverse);if(!q._viewMatrixArray)q._viewMatrixArray=new Float32Array(16);q.matrixWorldInverse.flattenToArray(q._viewMatrixArray);if(!q._projectionMatrixArray)q._projectionMatrixArray=new Float32Array(16);q.projectionMatrix.flattenToArray(q._projectionMatrixArray);g.multiply(q.projectionMatrix,q.matrixWorldInverse);e.setFromMatrix(g);
-b.setRenderTarget(p);b.clear();u=m.__webglObjects;for(l=0,p=u.length;l<p;l++)if(r=u[l],o=r.object,r.render=!1,o.visible&&o.castShadow&&(!(o instanceof THREE.Mesh)||!o.frustumCulled||e.contains(o)))o.matrixWorld.flattenToArray(o._objectMatrixArray),o._modelViewMatrix.multiplyToArray(q.matrixWorldInverse,o.matrixWorld,o._modelViewMatrixArray),r.render=!0;for(l=0,p=u.length;l<p;l++)if(r=u[l],r.render)o=r.object,r=r.buffer,b.setObjectFaces(o),y=o.customDepthMaterial?o.customDepthMaterial:o.geometry.morphTargets.length?
-d:c,r instanceof THREE.BufferGeometry?b.renderBufferDirect(q,m.lights,null,y,r,o):b.renderBuffer(q,m.lights,null,y,r,o);u=m.__webglObjectsImmediate;for(l=0,p=u.length;l<p;l++)r=u[l],o=r.object,o.visible&&o.castShadow&&(o.matrixAutoUpdate&&o.matrixWorld.flattenToArray(o._objectMatrixArray),o._modelViewMatrix.multiplyToArray(q.matrixWorldInverse,o.matrixWorld,o._modelViewMatrixArray),b.renderImmediateObject(q,m.lights,null,c,o))}j=b.getClearColor();n=b.getClearAlpha();a.clearColor(j.r,j.g,j.b,n);a.enable(a.BLEND);
+b.setRenderTarget(p);b.clear();u=k.__webglObjects;for(l=0,p=u.length;l<p;l++)if(r=u[l],o=r.object,r.render=!1,o.visible&&o.castShadow&&(!(o instanceof THREE.Mesh)||!o.frustumCulled||e.contains(o)))o.matrixWorld.flattenToArray(o._objectMatrixArray),o._modelViewMatrix.multiplyToArray(q.matrixWorldInverse,o.matrixWorld,o._modelViewMatrixArray),r.render=!0;for(l=0,p=u.length;l<p;l++)if(r=u[l],r.render)o=r.object,r=r.buffer,b.setObjectFaces(o),y=o.customDepthMaterial?o.customDepthMaterial:o.geometry.morphTargets.length?
+d:c,r instanceof THREE.BufferGeometry?b.renderBufferDirect(q,k.lights,null,y,r,o):b.renderBuffer(q,k.lights,null,y,r,o);u=k.__webglObjectsImmediate;for(l=0,p=u.length;l<p;l++)r=u[l],o=r.object,o.visible&&o.castShadow&&(o.matrixAutoUpdate&&o.matrixWorld.flattenToArray(o._objectMatrixArray),o._modelViewMatrix.multiplyToArray(q.matrixWorldInverse,o.matrixWorld,o._modelViewMatrixArray),b.renderImmediateObject(q,k.lights,null,c,o))}j=b.getClearColor();n=b.getClearAlpha();a.clearColor(j.r,j.g,j.b,n);a.enable(a.BLEND);
 b.shadowMapCullFrontFaces&&a.cullFace(a.BACK)}};THREE.ShadowMapPlugin.__projector=new THREE.Projector;
-THREE.SpritePlugin=function(){function a(a,b){return b.z-a.z}var b,c,d,e,g,h,i,m,k,j;this.init=function(a){b=a.context;c=a;d=new Float32Array(16);e=new Uint16Array(6);a=0;d[a++]=-1;d[a++]=-1;d[a++]=0;d[a++]=1;d[a++]=1;d[a++]=-1;d[a++]=1;d[a++]=1;d[a++]=1;d[a++]=1;d[a++]=1;d[a++]=0;d[a++]=-1;d[a++]=1;d[a++]=0;a=d[a++]=0;e[a++]=0;e[a++]=1;e[a++]=2;e[a++]=0;e[a++]=2;e[a++]=3;g=b.createBuffer();h=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,g);b.bufferData(b.ARRAY_BUFFER,d,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,
-h);b.bufferData(b.ELEMENT_ARRAY_BUFFER,e,b.STATIC_DRAW);var a=THREE.ShaderSprite.sprite,l=b.createProgram(),p=b.createShader(b.FRAGMENT_SHADER),q=b.createShader(b.VERTEX_SHADER);b.shaderSource(p,a.fragmentShader);b.shaderSource(q,a.vertexShader);b.compileShader(p);b.compileShader(q);b.attachShader(l,p);b.attachShader(l,q);b.linkProgram(l);i=l;m={};k={};m.position=b.getAttribLocation(i,"position");m.uv=b.getAttribLocation(i,"uv");k.uvOffset=b.getUniformLocation(i,"uvOffset");k.uvScale=b.getUniformLocation(i,
-"uvScale");k.rotation=b.getUniformLocation(i,"rotation");k.scale=b.getUniformLocation(i,"scale");k.alignment=b.getUniformLocation(i,"alignment");k.color=b.getUniformLocation(i,"color");k.map=b.getUniformLocation(i,"map");k.opacity=b.getUniformLocation(i,"opacity");k.useScreenCoordinates=b.getUniformLocation(i,"useScreenCoordinates");k.affectedByDistance=b.getUniformLocation(i,"affectedByDistance");k.screenPosition=b.getUniformLocation(i,"screenPosition");k.modelViewMatrix=b.getUniformLocation(i,"modelViewMatrix");
-k.projectionMatrix=b.getUniformLocation(i,"projectionMatrix");j=!1};this.render=function(d,e,p,q){var d=d.__webglSprites,o=d.length;if(o){var r=m,y=k,u=q/p,p=0.5*p,L=0.5*q,A=!0;b.useProgram(i);j||(b.enableVertexAttribArray(r.position),b.enableVertexAttribArray(r.uv),j=!0);b.disable(b.CULL_FACE);b.enable(b.BLEND);b.depthMask(!0);b.bindBuffer(b.ARRAY_BUFFER,g);b.vertexAttribPointer(r.position,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(r.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,h);b.uniformMatrix4fv(y.projectionMatrix,
+THREE.SpritePlugin=function(){function a(a,b){return b.z-a.z}var b,c,d,e,g,h,i,k,m,j;this.init=function(a){b=a.context;c=a;d=new Float32Array(16);e=new Uint16Array(6);a=0;d[a++]=-1;d[a++]=-1;d[a++]=0;d[a++]=1;d[a++]=1;d[a++]=-1;d[a++]=1;d[a++]=1;d[a++]=1;d[a++]=1;d[a++]=1;d[a++]=0;d[a++]=-1;d[a++]=1;d[a++]=0;a=d[a++]=0;e[a++]=0;e[a++]=1;e[a++]=2;e[a++]=0;e[a++]=2;e[a++]=3;g=b.createBuffer();h=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,g);b.bufferData(b.ARRAY_BUFFER,d,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,
+h);b.bufferData(b.ELEMENT_ARRAY_BUFFER,e,b.STATIC_DRAW);var a=THREE.ShaderSprite.sprite,l=b.createProgram(),p=b.createShader(b.FRAGMENT_SHADER),q=b.createShader(b.VERTEX_SHADER);b.shaderSource(p,a.fragmentShader);b.shaderSource(q,a.vertexShader);b.compileShader(p);b.compileShader(q);b.attachShader(l,p);b.attachShader(l,q);b.linkProgram(l);i=l;k={};m={};k.position=b.getAttribLocation(i,"position");k.uv=b.getAttribLocation(i,"uv");m.uvOffset=b.getUniformLocation(i,"uvOffset");m.uvScale=b.getUniformLocation(i,
+"uvScale");m.rotation=b.getUniformLocation(i,"rotation");m.scale=b.getUniformLocation(i,"scale");m.alignment=b.getUniformLocation(i,"alignment");m.color=b.getUniformLocation(i,"color");m.map=b.getUniformLocation(i,"map");m.opacity=b.getUniformLocation(i,"opacity");m.useScreenCoordinates=b.getUniformLocation(i,"useScreenCoordinates");m.affectedByDistance=b.getUniformLocation(i,"affectedByDistance");m.screenPosition=b.getUniformLocation(i,"screenPosition");m.modelViewMatrix=b.getUniformLocation(i,"modelViewMatrix");
+m.projectionMatrix=b.getUniformLocation(i,"projectionMatrix");j=!1};this.render=function(d,e,p,q){var d=d.__webglSprites,o=d.length;if(o){var r=k,y=m,u=q/p,p=0.5*p,L=0.5*q,A=!0;b.useProgram(i);j||(b.enableVertexAttribArray(r.position),b.enableVertexAttribArray(r.uv),j=!0);b.disable(b.CULL_FACE);b.enable(b.BLEND);b.depthMask(!0);b.bindBuffer(b.ARRAY_BUFFER,g);b.vertexAttribPointer(r.position,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(r.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,h);b.uniformMatrix4fv(y.projectionMatrix,
 !1,e._projectionMatrixArray);b.activeTexture(b.TEXTURE0);b.uniform1i(y.map,0);for(var v,B=[],r=0;r<o;r++)if(v=d[r],v.visible&&0!==v.opacity)v.useScreenCoordinates?v.z=-v.position.z:(v._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,v.matrixWorld,v._modelViewMatrixArray),v.z=-v._modelViewMatrix.n34);d.sort(a);for(r=0;r<o;r++)v=d[r],v.visible&&0!==v.opacity&&v.map&&v.map.image&&v.map.image.width&&(v.useScreenCoordinates?(b.uniform1i(y.useScreenCoordinates,1),b.uniform3f(y.screenPosition,(v.position.x-
 p)/p,(L-v.position.y)/L,Math.max(0,Math.min(1,v.position.z)))):(b.uniform1i(y.useScreenCoordinates,0),b.uniform1i(y.affectedByDistance,v.affectedByDistance?1:0),b.uniformMatrix4fv(y.modelViewMatrix,!1,v._modelViewMatrixArray)),e=v.map.image.width/(v.scaleByViewport?q:1),B[0]=e*u*v.scale.x,B[1]=e*v.scale.y,b.uniform2f(y.uvScale,v.uvScale.x,v.uvScale.y),b.uniform2f(y.uvOffset,v.uvOffset.x,v.uvOffset.y),b.uniform2f(y.alignment,v.alignment.x,v.alignment.y),b.uniform1f(y.opacity,v.opacity),b.uniform3f(y.color,
 v.color.r,v.color.g,v.color.b),b.uniform1f(y.rotation,v.rotation),b.uniform2fv(y.scale,B),v.mergeWith3D&&!A?(b.enable(b.DEPTH_TEST),A=!0):!v.mergeWith3D&&A&&(b.disable(b.DEPTH_TEST),A=!1),c.setBlending(v.blending),c.setTexture(v.map,0),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0));b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(!0)}}};
@@ -395,6 +397,6 @@ lensFlare:{vertexShader:"uniform vec3 screenPosition;\nuniform vec2 scale;\nunif
 THREE.ShaderSprite={sprite:{vertexShader:"uniform int useScreenCoordinates;\nuniform int affectedByDistance;\nuniform vec3 screenPosition;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform float rotation;\nuniform vec2 scale;\nuniform vec2 alignment;\nuniform vec2 uvOffset;\nuniform vec2 uvScale;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvoid main() {\nvUV = uvOffset + uv * uvScale;\nvec2 alignedPosition = position + alignment;\nvec2 rotatedPosition;\nrotatedPosition.x = ( cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y ) * scale.x;\nrotatedPosition.y = ( sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y ) * scale.y;\nvec4 finalPosition;\nif( useScreenCoordinates != 0 ) {\nfinalPosition = vec4( screenPosition.xy + rotatedPosition, screenPosition.z, 1.0 );\n} else {\nfinalPosition = projectionMatrix * modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\nfinalPosition.xy += rotatedPosition * ( affectedByDistance == 1 ? 1.0 : finalPosition.z );\n}\ngl_Position = finalPosition;\n}",
 fragmentShader:"precision mediump float;\nuniform vec3 color;\nuniform sampler2D map;\nuniform float opacity;\nvarying vec2 vUV;\nvoid main() {\nvec4 texture = texture2D( map, vUV );\ngl_FragColor = vec4( color * texture.xyz, texture.a * opacity );\n}"}};
 THREE.ImageUtils={crossOrigin:"anonymous",loadTexture:function(a,b,c){var d=new Image,e=new THREE.Texture(d,b);d.onload=function(){e.needsUpdate=!0;c&&c(this)};d.crossOrigin=this.crossOrigin;d.src=a;return e},loadTextureCube:function(a,b,c){var d,e=[],g=new THREE.Texture(e,b);e.loadCount=0;for(b=0,d=a.length;b<d;++b)e[b]=new Image,e[b].onload=function(){e.loadCount+=1;if(6===e.loadCount)g.needsUpdate=!0;c&&c(this)},e[b].crossOrigin=this.crossOrigin,e[b].src=a[b];return g},getNormalMap:function(a,
-b){var c=function(a){var b=Math.sqrt(a[0]*a[0]+a[1]*a[1]+a[2]*a[2]);return[a[0]/b,a[1]/b,a[2]/b]},b=b|1,d=a.width,e=a.height,g=document.createElement("canvas");g.width=d;g.height=e;var h=g.getContext("2d");h.drawImage(a,0,0);for(var i=h.getImageData(0,0,d,e).data,m=h.createImageData(d,e),k=m.data,j=0;j<d;j++)for(var n=1;n<e;n++){var l=0>n-1?e-1:n-1,p=(n+1)%e,q=0>j-1?d-1:j-1,o=(j+1)%d,r=[],y=[0,0,i[4*(n*d+j)]/255*b];r.push([-1,0,i[4*(n*d+q)]/255*b]);r.push([-1,-1,i[4*(l*d+q)]/255*b]);r.push([0,-1,
+b){var c=function(a){var b=Math.sqrt(a[0]*a[0]+a[1]*a[1]+a[2]*a[2]);return[a[0]/b,a[1]/b,a[2]/b]},b=b|1,d=a.width,e=a.height,g=document.createElement("canvas");g.width=d;g.height=e;var h=g.getContext("2d");h.drawImage(a,0,0);for(var i=h.getImageData(0,0,d,e).data,k=h.createImageData(d,e),m=k.data,j=0;j<d;j++)for(var n=1;n<e;n++){var l=0>n-1?e-1:n-1,p=(n+1)%e,q=0>j-1?d-1:j-1,o=(j+1)%d,r=[],y=[0,0,i[4*(n*d+j)]/255*b];r.push([-1,0,i[4*(n*d+q)]/255*b]);r.push([-1,-1,i[4*(l*d+q)]/255*b]);r.push([0,-1,
 i[4*(l*d+j)]/255*b]);r.push([1,-1,i[4*(l*d+o)]/255*b]);r.push([1,0,i[4*(n*d+o)]/255*b]);r.push([1,1,i[4*(p*d+o)]/255*b]);r.push([0,1,i[4*(p*d+j)]/255*b]);r.push([-1,1,i[4*(p*d+q)]/255*b]);l=[];q=r.length;for(p=0;p<q;p++){var o=r[p],u=r[(p+1)%q],o=[o[0]-y[0],o[1]-y[1],o[2]-y[2]],u=[u[0]-y[0],u[1]-y[1],u[2]-y[2]];l.push(c([o[1]*u[2]-o[2]*u[1],o[2]*u[0]-o[0]*u[2],o[0]*u[1]-o[1]*u[0]]))}r=[0,0,0];for(p=0;p<l.length;p++)r[0]+=l[p][0],r[1]+=l[p][1],r[2]+=l[p][2];r[0]/=l.length;r[1]/=l.length;r[2]/=l.length;
-y=4*(n*d+j);k[y]=255*((r[0]+1)/2)|0;k[y+1]=255*(r[1]+0.5)|0;k[y+2]=255*r[2]|0;k[y+3]=255}h.putImageData(m,0,0);return g}};
+y=4*(n*d+j);m[y]=255*((r[0]+1)/2)|0;m[y+1]=255*(r[1]+0.5)|0;m[y+2]=255*r[2]|0;m[y+3]=255}h.putImageData(k,0,0);return g}};

+ 80 - 0
src/core/Geometry.js

@@ -226,6 +226,86 @@ THREE.Geometry.prototype = {
 
 	},
 
+	computeMorphNormals: function () {
+
+		var i, il, f, fl, face;
+
+		// save original vertex normals
+
+		for ( f = 0, fl = this.faces.length; f < fl; f ++ ) {
+
+			face = this.faces[ f ];
+			face.__originalVertexNormals = [];
+
+			for ( i = 0, il = face.vertexNormals.length; i < il; i ++ ) {
+
+				face.__originalVertexNormals[ i ] = face.vertexNormals[ i ].clone();
+
+			}
+
+		}
+
+		// use temp geometry to compute face and vertex normals for each morph
+
+		var tmpGeo = new THREE.Geometry();
+		tmpGeo.faces = this.faces;
+
+		for ( i = 0, il = this.morphTargets.length; i < il; i ++ ) {
+
+			var morphNormals = this.morphNormals[ i ];
+
+			// set vertices to morph target
+
+			tmpGeo.vertices = this.morphTargets[ i ].vertices;
+
+			// compute morph normals
+
+			tmpGeo.computeFaceNormals();
+			tmpGeo.computeVertexNormals();
+
+			// store morph normals
+
+			var faceNormal, vertexNormals;
+
+			for ( f = 0, fl = this.faces.length; f < fl; f ++ ) {
+
+				face = this.faces[ f ];
+
+				faceNormal = morphNormals.faceNormals[ f ];
+				vertexNormals = morphNormals.vertexNormals[ f ];
+
+				faceNormal.copy( face.normal );
+
+				if ( face instanceof THREE.Face3 ) {
+
+					vertexNormals.a.copy( face.vertexNormals[ 0 ] );
+					vertexNormals.b.copy( face.vertexNormals[ 1 ] );
+					vertexNormals.c.copy( face.vertexNormals[ 2 ] );
+
+				} else {
+
+					vertexNormals.a.copy( face.vertexNormals[ 0 ] );
+					vertexNormals.b.copy( face.vertexNormals[ 1 ] );
+					vertexNormals.c.copy( face.vertexNormals[ 2 ] );
+					vertexNormals.d.copy( face.vertexNormals[ 3 ] );
+
+				}
+
+			}
+
+		}
+
+		// restore original vertex normals
+
+		for ( f = 0, fl = this.faces.length; f < fl; f ++ ) {
+
+			face = this.faces[ f ];
+			face.vertexNormals = face.__originalVertexNormals;
+
+		}
+
+	},
+
 	computeTangents: function () {
 
 		// based on http://www.terathon.com/code/tangent.html

+ 1 - 84
src/extras/loaders/JSONLoader.js

@@ -110,9 +110,7 @@ THREE.JSONLoader.prototype.createModel = function ( json, callback, texture_path
 	parseMorphing( scale );
 
 	geometry.computeCentroids();
-
-	computeMorphNormals();
-
+	geometry.computeMorphNormals();
 	geometry.computeFaceNormals();
 
 	if ( this.hasNormals( geometry ) ) geometry.computeTangents();
@@ -469,87 +467,6 @@ THREE.JSONLoader.prototype.createModel = function ( json, callback, texture_path
 
 	};
 
-	function computeMorphNormals() {
-
-		var i, il, f, fl, face;
-
-		// save original vertex normals
-
-		for ( f = 0, fl = geometry.faces.length; f < fl; f ++ ) {
-
-			face = geometry.faces[ f ];
-
-			face.__originalVertexNormals = [];
-
-			for ( i = 0, il = face.vertexNormals.length; i < il; i ++ ) {
-
-				face.__originalVertexNormals[ i ] = face.vertexNormals[ i ].clone();
-
-			}
-
-		}
-
-		// use temp geometry to compute face and vertex normals for each morph
-
-		var tmpGeo = new THREE.Geometry();
-		tmpGeo.faces = geometry.faces;
-
-		for ( i = 0, il = geometry.morphTargets.length; i < il; i ++ ) {
-
-			var morphNormals = geometry.morphNormals[ i ];
-
-			// set vertices to morph target
-
-			tmpGeo.vertices = geometry.morphTargets[ i ].vertices;
-
-			// compute morph normals
-
-			tmpGeo.computeFaceNormals();
-			tmpGeo.computeVertexNormals();
-
-			// store morph normals
-
-			var faceNormal, vertexNormals;
-
-			for ( f = 0, fl = geometry.faces.length; f < fl; f ++ ) {
-
-				face = geometry.faces[ f ];
-
-				faceNormal = morphNormals.faceNormals[ f ];
-				vertexNormals = morphNormals.vertexNormals[ f ];
-
-				faceNormal.copy( face.normal );
-
-				if ( face instanceof THREE.Face3 ) {
-
-					vertexNormals.a.copy( face.vertexNormals[ 0 ] );
-					vertexNormals.b.copy( face.vertexNormals[ 1 ] );
-					vertexNormals.c.copy( face.vertexNormals[ 2 ] );
-
-				} else {
-
-					vertexNormals.a.copy( face.vertexNormals[ 0 ] );
-					vertexNormals.b.copy( face.vertexNormals[ 1 ] );
-					vertexNormals.c.copy( face.vertexNormals[ 2 ] );
-					vertexNormals.d.copy( face.vertexNormals[ 3 ] );
-
-				}
-
-			}
-
-		}
-
-		// restore original vertex normals
-
-		for ( f = 0, fl = geometry.faces.length; f < fl; f ++ ) {
-
-			face = geometry.faces[ f ];
-			face.vertexNormals = face.__originalVertexNormals;
-
-		}
-
-	};
-
 	callback( geometry );
 
 };

Some files were not shown because too many files changed in this diff