Browse Source

Applied manually fixes from @broady to 'dev' branch.

https://github.com/mrdoob/three.js/pull/689
alteredq 14 years ago
parent
commit
a9cc8bceb5

File diff suppressed because it is too large
+ 497 - 502
build/Three.js


+ 270 - 271
build/custom/ThreeExtras.js

@@ -1,19 +1,19 @@
 // ThreeExtras.js r46dev - http://github.com/mrdoob/three.js
-THREE.ColorUtils={adjustHSV:function(a,c,b,e){var g=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(a,g);g.h=THREE.Math.clamp(g.h+c,0,1);g.s=THREE.Math.clamp(g.s+b,0,1);g.v=THREE.Math.clamp(g.v+e,0,1);a.setHSV(g.h,g.s,g.v)},rgbToHsv:function(a,c){var b=a.r,e=a.g,g=a.b,h=Math.max(Math.max(b,e),g),f=Math.min(Math.min(b,e),g);if(f===h)f=b=0;else{var k=h-f,f=k/h,b=b===h?(e-g)/k:e===h?2+(g-b)/k:4+(b-e)/k;b/=6;b<0&&(b+=1);b>1&&(b-=1)}c===void 0&&(c={h:0,s:0,v:0});c.h=b;c.s=f;c.v=h;return c}};
+THREE.ColorUtils={adjustHSV:function(a,c,b,d){var f=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(a,f);f.h=THREE.Math.clamp(f.h+c,0,1);f.s=THREE.Math.clamp(f.s+b,0,1);f.v=THREE.Math.clamp(f.v+d,0,1);a.setHSV(f.h,f.s,f.v)},rgbToHsv:function(a,c){var b=a.r,d=a.g,f=a.b,g=Math.max(Math.max(b,d),f),e=Math.min(Math.min(b,d),f);if(e===g)e=b=0;else{var h=g-e,e=h/g,b=b===g?(d-f)/h:d===g?2+(f-b)/h:4+(b-d)/h;b/=6;b<0&&(b+=1);b>1&&(b-=1)}c===void 0&&(c={h:0,s:0,v:0});c.h=b;c.s=e;c.v=g;return c}};
 THREE.ColorUtils.__hsv={h:0,s:0,v:0};
-THREE.GeometryUtils={merge:function(a,c){for(var b,e,g=a.vertices.length,h=c instanceof THREE.Mesh?c.geometry:c,f=a.vertices,k=h.vertices,l=a.faces,m=h.faces,n=a.faceVertexUvs[0],o=h.faceVertexUvs[0],u={},p=0;p<a.materials.length;p++)u[a.materials[p].id]=p;if(c instanceof THREE.Mesh)c.matrixAutoUpdate&&c.updateMatrix(),b=c.matrix,e=new THREE.Matrix4,e.extractRotation(b,c.scale);for(var p=0,z=k.length;p<z;p++){var w=new THREE.Vertex(k[p].position.clone());b&&b.multiplyVector3(w.position);f.push(w)}p=
-0;for(z=m.length;p<z;p++){var f=m[p],x,v,y=f.vertexNormals,t=f.vertexColors;f instanceof THREE.Face3?x=new THREE.Face3(f.a+g,f.b+g,f.c+g):f instanceof THREE.Face4&&(x=new THREE.Face4(f.a+g,f.b+g,f.c+g,f.d+g));x.normal.copy(f.normal);e&&e.multiplyVector3(x.normal);k=0;for(w=y.length;k<w;k++)v=y[k].clone(),e&&e.multiplyVector3(v),x.vertexNormals.push(v);x.color.copy(f.color);k=0;for(w=t.length;k<w;k++)v=t[k],x.vertexColors.push(v.clone());if(f.materialIndex!==void 0){k=h.materials[f.materialIndex];
-w=u[k.id];if(w===void 0)w=a.materials.length,a.materials.push(k);x.materialIndex=w}x.centroid.copy(f.centroid);b&&b.multiplyVector3(x.centroid);l.push(x)}p=0;for(z=o.length;p<z;p++){b=o[p];e=[];k=0;for(w=b.length;k<w;k++)e.push(new THREE.UV(b[k].u,b[k].v));n.push(e)}},clone:function(a){var c=new THREE.Geometry,b,e=a.vertices,g=a.faces,h=a.faceVertexUvs[0];if(a.materials)c.materials=a.materials.slice();a=0;for(b=e.length;a<b;a++){var f=new THREE.Vertex(e[a].position.clone());c.vertices.push(f)}a=0;
-for(b=g.length;a<b;a++){var k=g[a],l,m,n=k.vertexNormals,o=k.vertexColors;k instanceof THREE.Face3?l=new THREE.Face3(k.a,k.b,k.c):k instanceof THREE.Face4&&(l=new THREE.Face4(k.a,k.b,k.c,k.d));l.normal.copy(k.normal);e=0;for(f=n.length;e<f;e++)m=n[e],l.vertexNormals.push(m.clone());l.color.copy(k.color);e=0;for(f=o.length;e<f;e++)m=o[e],l.vertexColors.push(m.clone());l.materialIndex=k.materialIndex;l.centroid.copy(k.centroid);c.faces.push(l)}a=0;for(b=h.length;a<b;a++){g=h[a];l=[];e=0;for(f=g.length;e<
-f;e++)l.push(new THREE.UV(g[e].u,g[e].v));c.faceVertexUvs[0].push(l)}return c},randomPointInTriangle:function(a,c,b){var e,g,h,f=new THREE.Vector3,k=THREE.GeometryUtils.__v1;e=THREE.GeometryUtils.random();g=THREE.GeometryUtils.random();e+g>1&&(e=1-e,g=1-g);h=1-e-g;f.copy(a);f.multiplyScalar(e);k.copy(c);k.multiplyScalar(g);f.addSelf(k);k.copy(b);k.multiplyScalar(h);f.addSelf(k);return f},randomPointInFace:function(a,c,b){var e,g,h;if(a instanceof THREE.Face3)return e=c.vertices[a.a].position,g=c.vertices[a.b].position,
-h=c.vertices[a.c].position,THREE.GeometryUtils.randomPointInTriangle(e,g,h);else if(a instanceof THREE.Face4){e=c.vertices[a.a].position;g=c.vertices[a.b].position;h=c.vertices[a.c].position;var c=c.vertices[a.d].position,f;b?a._area1&&a._area2?(b=a._area1,f=a._area2):(b=THREE.GeometryUtils.triangleArea(e,g,c),f=THREE.GeometryUtils.triangleArea(g,h,c),a._area1=b,a._area2=f):(b=THREE.GeometryUtils.triangleArea(e,g,c),f=THREE.GeometryUtils.triangleArea(g,h,c));return THREE.GeometryUtils.random()*(b+
-f)<b?THREE.GeometryUtils.randomPointInTriangle(e,g,c):THREE.GeometryUtils.randomPointInTriangle(g,h,c)}},randomPointsInGeometry:function(a,c){function b(a){function b(e,c){if(c<e)return e;var f=e+Math.floor((c-e)/2);return m[f]>a?b(e,f-1):m[f]<a?b(f+1,c):f}return b(0,m.length-1)}var e,g,h=a.faces,f=a.vertices,k=h.length,l=0,m=[],n,o,u,p;for(g=0;g<k;g++){e=h[g];if(e instanceof THREE.Face3)n=f[e.a].position,o=f[e.b].position,u=f[e.c].position,e._area=THREE.GeometryUtils.triangleArea(n,o,u);else if(e instanceof
-THREE.Face4)n=f[e.a].position,o=f[e.b].position,u=f[e.c].position,p=f[e.d].position,e._area1=THREE.GeometryUtils.triangleArea(n,o,p),e._area2=THREE.GeometryUtils.triangleArea(o,u,p),e._area=e._area1+e._area2;l+=e._area;m[g]=l}e=[];f={};for(g=0;g<c;g++)k=THREE.GeometryUtils.random()*l,k=b(k),e[g]=THREE.GeometryUtils.randomPointInFace(h[k],a,!0),f[k]?f[k]+=1:f[k]=1;return e},triangleArea:function(a,c,b){var e,g=THREE.GeometryUtils.__v1;g.sub(a,c);e=g.length();g.sub(a,b);a=g.length();g.sub(c,b);b=g.length();
-c=0.5*(e+a+b);return Math.sqrt(c*(c-e)*(c-a)*(c-b))},center:function(a){a.computeBoundingBox();var c=new THREE.Matrix4;c.setTranslation(-0.5*(a.boundingBox.x[1]+a.boundingBox.x[0]),-0.5*(a.boundingBox.y[1]+a.boundingBox.y[0]),-0.5*(a.boundingBox.z[1]+a.boundingBox.z[0]));a.applyMatrix(c);a.computeBoundingBox()}};THREE.GeometryUtils.random=THREE.Math.random16;THREE.GeometryUtils.__v1=new THREE.Vector3;
-THREE.ImageUtils={loadTexture:function(a,c,b){var e=new Image,g=new THREE.Texture(e,c);e.onload=function(){g.needsUpdate=!0;b&&b(this)};e.crossOrigin="";e.src=a;return g},loadTextureCube:function(a,c,b){var e,g=[],h=new THREE.Texture(g,c),c=g.loadCount=0;for(e=a.length;c<e;++c)g[c]=new Image,g[c].onload=function(){g.loadCount+=1;if(g.loadCount===6)h.needsUpdate=!0;b&&b(this)},g[c].crossOrigin="",g[c].src=a[c];return h},getNormalMap:function(a,c){var b=function(a){var b=Math.sqrt(a[0]*a[0]+a[1]*a[1]+
-a[2]*a[2]);return[a[0]/b,a[1]/b,a[2]/b]};c|=1;var e=a.width,g=a.height,h=document.createElement("canvas");h.width=e;h.height=g;var f=h.getContext("2d");f.drawImage(a,0,0);for(var k=f.getImageData(0,0,e,g).data,l=f.createImageData(e,g),m=l.data,n=0;n<e;n++)for(var o=1;o<g;o++){var u=o-1<0?g-1:o-1,p=(o+1)%g,z=n-1<0?e-1:n-1,w=(n+1)%e,x=[],v=[0,0,k[(o*e+n)*4]/255*c];x.push([-1,0,k[(o*e+z)*4]/255*c]);x.push([-1,-1,k[(u*e+z)*4]/255*c]);x.push([0,-1,k[(u*e+n)*4]/255*c]);x.push([1,-1,k[(u*e+w)*4]/255*c]);
-x.push([1,0,k[(o*e+w)*4]/255*c]);x.push([1,1,k[(p*e+w)*4]/255*c]);x.push([0,1,k[(p*e+n)*4]/255*c]);x.push([-1,1,k[(p*e+z)*4]/255*c]);u=[];z=x.length;for(p=0;p<z;p++){var w=x[p],y=x[(p+1)%z],w=[w[0]-v[0],w[1]-v[1],w[2]-v[2]],y=[y[0]-v[0],y[1]-v[1],y[2]-v[2]];u.push(b([w[1]*y[2]-w[2]*y[1],w[2]*y[0]-w[0]*y[2],w[0]*y[1]-w[1]*y[0]]))}x=[0,0,0];for(p=0;p<u.length;p++)x[0]+=u[p][0],x[1]+=u[p][1],x[2]+=u[p][2];x[0]/=u.length;x[1]/=u.length;x[2]/=u.length;v=(o*e+n)*4;m[v]=(x[0]+1)/2*255|0;m[v+1]=(x[1]+0.5)*
-255|0;m[v+2]=x[2]*255|0;m[v+3]=255}f.putImageData(l,0,0);return h}};THREE.SceneUtils={showHierarchy:function(a,c){THREE.SceneUtils.traverseHierarchy(a,function(a){a.visible=c})},traverseHierarchy:function(a,c){var b,e,g=a.children.length;for(e=0;e<g;e++)b=a.children[e],c(b),THREE.SceneUtils.traverseHierarchy(b,c)},createMultiMaterialObject:function(a,c){var b,e=c.length,g=new THREE.Object3D;for(b=0;b<e;b++){var h=new THREE.Mesh(a,c[b]);g.add(h)}return g}};
+THREE.GeometryUtils={merge:function(a,c){for(var b,d,f=a.vertices.length,g=c instanceof THREE.Mesh?c.geometry:c,e=a.vertices,h=g.vertices,i=a.faces,j=g.faces,k=a.faceVertexUvs[0],m=g.faceVertexUvs[0],o={},n=0;n<a.materials.length;n++)o[a.materials[n].id]=n;if(c instanceof THREE.Mesh)c.matrixAutoUpdate&&c.updateMatrix(),b=c.matrix,d=new THREE.Matrix4,d.extractRotation(b,c.scale);for(var n=0,t=h.length;n<t;n++){var q=new THREE.Vertex(h[n].position.clone());b&&b.multiplyVector3(q.position);e.push(q)}n=
+0;for(t=j.length;n<t;n++){var e=j[n],r,p,s=e.vertexNormals,l=e.vertexColors;e instanceof THREE.Face3?r=new THREE.Face3(e.a+f,e.b+f,e.c+f):e instanceof THREE.Face4&&(r=new THREE.Face4(e.a+f,e.b+f,e.c+f,e.d+f));r.normal.copy(e.normal);d&&d.multiplyVector3(r.normal);h=0;for(q=s.length;h<q;h++)p=s[h].clone(),d&&d.multiplyVector3(p),r.vertexNormals.push(p);r.color.copy(e.color);h=0;for(q=l.length;h<q;h++)p=l[h],r.vertexColors.push(p.clone());if(e.materialIndex!==void 0){h=g.materials[e.materialIndex];
+q=o[h.id];if(q===void 0)q=a.materials.length,a.materials.push(h);r.materialIndex=q}r.centroid.copy(e.centroid);b&&b.multiplyVector3(r.centroid);i.push(r)}n=0;for(t=m.length;n<t;n++){b=m[n];d=[];h=0;for(q=b.length;h<q;h++)d.push(new THREE.UV(b[h].u,b[h].v));k.push(d)}},clone:function(a){var c=new THREE.Geometry,b,d=a.vertices,f=a.faces,g=a.faceVertexUvs[0];if(a.materials)c.materials=a.materials.slice();a=0;for(b=d.length;a<b;a++){var e=new THREE.Vertex(d[a].position.clone());c.vertices.push(e)}a=0;
+for(b=f.length;a<b;a++){var h=f[a],i,j,k=h.vertexNormals,m=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=m.length;d<e;d++)j=m[d],i.vertexColors.push(j.clone());i.materialIndex=h.materialIndex;i.centroid.copy(h.centroid);c.faces.push(i)}a=0;for(b=g.length;a<b;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));c.faceVertexUvs[0].push(i)}return c},randomPointInTriangle:function(a,c,b){var d,f,g,e=new THREE.Vector3,h=THREE.GeometryUtils.__v1;d=THREE.GeometryUtils.random();f=THREE.GeometryUtils.random();d+f>1&&(d=1-d,f=1-f);g=1-d-f;e.copy(a);e.multiplyScalar(d);h.copy(c);h.multiplyScalar(f);e.addSelf(h);h.copy(b);h.multiplyScalar(g);e.addSelf(h);return e},randomPointInFace:function(a,c,b){var d,f,g;if(a instanceof THREE.Face3)return d=c.vertices[a.a].position,f=c.vertices[a.b].position,
+g=c.vertices[a.c].position,THREE.GeometryUtils.randomPointInTriangle(d,f,g);else if(a instanceof THREE.Face4){d=c.vertices[a.a].position;f=c.vertices[a.b].position;g=c.vertices[a.c].position;var c=c.vertices[a.d].position,e;b?a._area1&&a._area2?(b=a._area1,e=a._area2):(b=THREE.GeometryUtils.triangleArea(d,f,c),e=THREE.GeometryUtils.triangleArea(f,g,c),a._area1=b,a._area2=e):(b=THREE.GeometryUtils.triangleArea(d,f,c),e=THREE.GeometryUtils.triangleArea(f,g,c));return THREE.GeometryUtils.random()*(b+
+e)<b?THREE.GeometryUtils.randomPointInTriangle(d,f,c):THREE.GeometryUtils.randomPointInTriangle(f,g,c)}},randomPointsInGeometry:function(a,c){function b(a){function b(d,c){if(c<d)return d;var e=d+Math.floor((c-d)/2);return j[e]>a?b(d,e-1):j[e]<a?b(e+1,c):e}return b(0,j.length-1)}var d,f,g=a.faces,e=a.vertices,h=g.length,i=0,j=[],k,m,o,n;for(f=0;f<h;f++){d=g[f];if(d instanceof THREE.Face3)k=e[d.a].position,m=e[d.b].position,o=e[d.c].position,d._area=THREE.GeometryUtils.triangleArea(k,m,o);else if(d instanceof
+THREE.Face4)k=e[d.a].position,m=e[d.b].position,o=e[d.c].position,n=e[d.d].position,d._area1=THREE.GeometryUtils.triangleArea(k,m,n),d._area2=THREE.GeometryUtils.triangleArea(m,o,n),d._area=d._area1+d._area2;i+=d._area;j[f]=i}d=[];e={};for(f=0;f<c;f++)h=THREE.GeometryUtils.random()*i,h=b(h),d[f]=THREE.GeometryUtils.randomPointInFace(g[h],a,!0),e[h]?e[h]+=1:e[h]=1;return d},triangleArea:function(a,c,b){var d,f=THREE.GeometryUtils.__v1;f.sub(a,c);d=f.length();f.sub(a,b);a=f.length();f.sub(c,b);b=f.length();
+c=0.5*(d+a+b);return Math.sqrt(c*(c-d)*(c-a)*(c-b))},center:function(a){a.computeBoundingBox();var c=new THREE.Matrix4;c.setTranslation(-0.5*(a.boundingBox.x[1]+a.boundingBox.x[0]),-0.5*(a.boundingBox.y[1]+a.boundingBox.y[0]),-0.5*(a.boundingBox.z[1]+a.boundingBox.z[0]));a.applyMatrix(c);a.computeBoundingBox()}};THREE.GeometryUtils.random=THREE.Math.random16;THREE.GeometryUtils.__v1=new THREE.Vector3;
+THREE.ImageUtils={loadTexture:function(a,c,b){var d=new Image,f=new THREE.Texture(d,c);d.onload=function(){f.needsUpdate=!0;b&&b(this)};d.crossOrigin="";d.src=a;return f},loadTextureCube:function(a,c,b){var d,f=[],g=new THREE.Texture(f,c),c=f.loadCount=0;for(d=a.length;c<d;++c)f[c]=new Image,f[c].onload=function(){f.loadCount+=1;if(f.loadCount===6)g.needsUpdate=!0;b&&b(this)},f[c].crossOrigin="",f[c].src=a[c];return g},getNormalMap:function(a,c){var b=function(a){var b=Math.sqrt(a[0]*a[0]+a[1]*a[1]+
+a[2]*a[2]);return[a[0]/b,a[1]/b,a[2]/b]};c|=1;var 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 m=1;m<f;m++){var o=m-1<0?f-1:m-1,n=(m+1)%f,t=k-1<0?d-1:k-1,q=(k+1)%d,r=[],p=[0,0,h[(m*d+k)*4]/255*c];r.push([-1,0,h[(m*d+t)*4]/255*c]);r.push([-1,-1,h[(o*d+t)*4]/255*c]);r.push([0,-1,h[(o*d+k)*4]/255*c]);r.push([1,-1,h[(o*d+q)*4]/255*c]);
+r.push([1,0,h[(m*d+q)*4]/255*c]);r.push([1,1,h[(n*d+q)*4]/255*c]);r.push([0,1,h[(n*d+k)*4]/255*c]);r.push([-1,1,h[(n*d+t)*4]/255*c]);o=[];t=r.length;for(n=0;n<t;n++){var q=r[n],s=r[(n+1)%t],q=[q[0]-p[0],q[1]-p[1],q[2]-p[2]],s=[s[0]-p[0],s[1]-p[1],s[2]-p[2]];o.push(b([q[1]*s[2]-q[2]*s[1],q[2]*s[0]-q[0]*s[2],q[0]*s[1]-q[1]*s[0]]))}r=[0,0,0];for(n=0;n<o.length;n++)r[0]+=o[n][0],r[1]+=o[n][1],r[2]+=o[n][2];r[0]/=o.length;r[1]/=o.length;r[2]/=o.length;p=(m*d+k)*4;j[p]=(r[0]+1)/2*255|0;j[p+1]=(r[1]+0.5)*
+255|0;j[p+2]=r[2]*255|0;j[p+3]=255}e.putImageData(i,0,0);return g}};THREE.SceneUtils={showHierarchy:function(a,c){THREE.SceneUtils.traverseHierarchy(a,function(a){a.visible=c})},traverseHierarchy:function(a,c){var b,d,f=a.children.length;for(d=0;d<f;d++)b=a.children[d],c(b),THREE.SceneUtils.traverseHierarchy(b,c)},createMultiMaterialObject:function(a,c){var b,d=c.length,f=new THREE.Object3D;for(b=0;b<d;b++){var g=new THREE.Mesh(a,c[b]);f.add(g)}return f}};
 if(THREE.WebGLRenderer)THREE.ShaderUtils={lib:{fresnel:{uniforms:{mRefractionRatio:{type:"f",value:1.02},mFresnelBias:{type:"f",value:0.1},mFresnelPower:{type:"f",value:2},mFresnelScale:{type:"f",value:1},tCube:{type:"t",value:1,texture:null}},fragmentShader:"uniform samplerCube tCube;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 reflectedColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );\nvec4 refractedColor = vec4( 1.0, 1.0, 1.0, 1.0 );\nrefractedColor.r = textureCube( tCube, vec3( -vRefract[0].x, vRefract[0].yz ) ).r;\nrefractedColor.g = textureCube( tCube, vec3( -vRefract[1].x, vRefract[1].yz ) ).g;\nrefractedColor.b = textureCube( tCube, vec3( -vRefract[2].x, vRefract[2].yz ) ).b;\nrefractedColor.a = 1.0;\ngl_FragColor = mix( refractedColor, reflectedColor, clamp( vReflectionFactor, 0.0, 1.0 ) );\n}",
 vertexShader:"uniform float mRefractionRatio;\nuniform float mFresnelBias;\nuniform float mFresnelScale;\nuniform float mFresnelPower;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = normalize ( mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal );\nvec3 I = mPosition.xyz - cameraPosition;\nvReflect = reflect( I, nWorld );\nvRefract[0] = refract( normalize( I ), nWorld, mRefractionRatio );\nvRefract[1] = refract( normalize( I ), nWorld, mRefractionRatio * 0.99 );\nvRefract[2] = refract( normalize( I ), nWorld, mRefractionRatio * 0.98 );\nvReflectionFactor = mFresnelBias + mFresnelScale * pow( 1.0 + dot( normalize( I ), nWorld ), mFresnelPower );\ngl_Position = projectionMatrix * mvPosition;\n}"},
 normal:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.fog,THREE.UniformsLib.lights,THREE.UniformsLib.shadowmap,{enableAO:{type:"i",value:0},enableDiffuse:{type:"i",value:0},enableSpecular:{type:"i",value:0},enableReflection:{type:"i",value:0},tDiffuse:{type:"t",value:0,texture:null},tCube:{type:"t",value:1,texture:null},tNormal:{type:"t",value:2,texture:null},tSpecular:{type:"t",value:3,texture:null},tAO:{type:"t",value:4,texture:null},tDisplacement:{type:"t",value:5,texture:null},uNormalScale:{type:"f",
@@ -23,74 +23,74 @@ THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\
 THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvViewPosition = -mvPosition.xyz;\nvNormal = normalize( normalMatrix * normal );\nvTangent = normalize( normalMatrix * tangent.xyz );\nvBinormal = cross( vNormal, vTangent ) * tangent.w;\nvBinormal = normalize( vBinormal );\nvUv = uv * uRepeat + uOffset;\n#if MAX_POINT_LIGHTS > 0\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\nvec3 lVector = lPosition.xyz - mvPosition.xyz;\nfloat lDistance = 1.0;\nif ( pointLightDistance[ i ] > 0.0 )\nlDistance = 1.0 - min( ( length( lVector ) / pointLightDistance[ i ] ), 1.0 );\nlVector = normalize( lVector );\nvPointLight[ i ] = vec4( lVector, lDistance );\n}\n#endif\n#ifdef VERTEX_TEXTURES\nvec3 dv = texture2D( tDisplacement, uv ).xyz;\nfloat df = uDisplacementScale * dv.x + uDisplacementBias;\nvec4 displacedPosition = vec4( vNormal.xyz * df, 0.0 ) + mvPosition;\ngl_Position = projectionMatrix * displacedPosition;\n#else\ngl_Position = projectionMatrix * mvPosition;\n#endif",
 THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n")},cube:{uniforms:{tCube:{type:"t",value:1,texture:null},tFlip:{type:"f",value:-1}},vertexShader:"varying vec3 vViewPosition;\nvoid main() {\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvViewPosition = cameraPosition - mPosition.xyz;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform samplerCube tCube;\nuniform float tFlip;\nvarying vec3 vViewPosition;\nvoid main() {\nvec3 wPos = cameraPosition - vViewPosition;\ngl_FragColor = textureCube( tCube, vec3( tFlip * wPos.x, wPos.yz ) );\n}"}}};
 THREE.Curve=function(){};THREE.Curve.prototype.getPoint=function(){console.log("Warning, getPoint() not implemented!");return null};THREE.Curve.prototype.getPointAt=function(a){return this.getPoint(this.getUtoTmapping(a))};THREE.Curve.prototype.getPoints=function(a){a||(a=5);var c,b=[];for(c=0;c<=a;c++)b.push(this.getPoint(c/a));return b};THREE.Curve.prototype.getSpacedPoints=function(a){a||(a=5);var c,b=[];for(c=0;c<=a;c++)b.push(this.getPointAt(c/a));return b};
-THREE.Curve.prototype.getLength=function(){var a=this.getLengths();return a[a.length-1]};THREE.Curve.prototype.getLengths=function(a){a||(a=200);if(this.cacheArcLengths&&this.cacheArcLengths.length==a+1)return this.cacheArcLengths;var c=[],b,e=this.getPoint(0),g,h=0;c.push(0);for(g=1;g<=a;g++)b=this.getPoint(g/a),h+=b.distanceTo(e),c.push(h),e=b;return this.cacheArcLengths=c};
-THREE.Curve.prototype.getUtoTmapping=function(a,c){var b=this.getLengths(),e=0,g=b.length,h;h=c?c:a*b[g-1];time=Date.now();for(var f=0,k=g-1,l;f<=k;)if(e=Math.floor(f+(k-f)/2),l=b[e]-h,l<0)f=e+1;else if(l>0)k=e-1;else{k=e;break}e=k;if(b[e]==h)return e/(g-1);f=b[e];return b=(e+(h-f)/(b[e+1]-f))/(g-1)};THREE.Curve.prototype.getNormalVector=function(a){a=this.getTangent(a);return new THREE.Vector2(-a.y,a.x)};
-THREE.Curve.prototype.getTangent=function(a){var c=a-1.0E-4;a+=1.0E-4;c<0&&(c=0);a>1&&(a=1);var c=this.getPoint(c),a=this.getPoint(a),b=new THREE.Vector2;b.sub(a,c);return b.unit()};THREE.LineCurve=function(a,c){a instanceof THREE.Vector2?(this.v1=a,this.v2=c):THREE.LineCurve.oldConstructor.apply(this,arguments)};THREE.LineCurve.oldConstructor=function(a,c,b,e){this.constructor(new THREE.Vector2(a,c),new THREE.Vector2(b,e))};THREE.LineCurve.prototype=new THREE.Curve;
+THREE.Curve.prototype.getLength=function(){var a=this.getLengths();return a[a.length-1]};THREE.Curve.prototype.getLengths=function(a){a||(a=200);if(this.cacheArcLengths&&this.cacheArcLengths.length==a+1)return this.cacheArcLengths;var c=[],b,d=this.getPoint(0),f,g=0;c.push(0);for(f=1;f<=a;f++)b=this.getPoint(f/a),g+=b.distanceTo(d),c.push(g),d=b;return this.cacheArcLengths=c};
+THREE.Curve.prototype.getUtoTmapping=function(a,c){var b=this.getLengths(),d=0,f=b.length,g;g=c?c:a*b[f-1];Date.now();for(var e=0,h=f-1,i;e<=h;)if(d=Math.floor(e+(h-e)/2),i=b[d]-g,i<0)e=d+1;else if(i>0)h=d-1;else{h=d;break}d=h;if(b[d]==g)return d/(f-1);e=b[d];return b=(d+(g-e)/(b[d+1]-e))/(f-1)};THREE.Curve.prototype.getNormalVector=function(a){a=this.getTangent(a);return new THREE.Vector2(-a.y,a.x)};
+THREE.Curve.prototype.getTangent=function(a){var c=a-1.0E-4;a+=1.0E-4;c<0&&(c=0);a>1&&(a=1);var c=this.getPoint(c),a=this.getPoint(a),b=new THREE.Vector2;b.sub(a,c);return b.unit()};THREE.LineCurve=function(a,c){a instanceof THREE.Vector2?(this.v1=a,this.v2=c):THREE.LineCurve.oldConstructor.apply(this,arguments)};THREE.LineCurve.oldConstructor=function(a,c,b,d){this.constructor(new THREE.Vector2(a,c),new THREE.Vector2(b,d))};THREE.LineCurve.prototype=new THREE.Curve;
 THREE.LineCurve.prototype.constructor=THREE.LineCurve;THREE.LineCurve.prototype.getPoint=function(a){var c=new THREE.Vector2;c.sub(this.v2,this.v1);c.multiplyScalar(a).addSelf(this.v1);return c};THREE.LineCurve.prototype.getPointAt=function(a){return this.getPoint(a)};THREE.LineCurve.prototype.getTangent=function(){var a=new THREE.Vector2;a.sub(this.v2,this.v1);a.normalize();return a};
-THREE.QuadraticBezierCurve=function(a,c,b){if(!(c instanceof THREE.Vector2))var e=Array.prototype.slice.call(arguments),a=new THREE.Vector2(e[0],e[1]),c=new THREE.Vector2(e[2],e[3]),b=new THREE.Vector2(e[4],e[5]);this.v0=a;this.v1=c;this.v2=b};THREE.QuadraticBezierCurve.prototype=new THREE.Curve;THREE.QuadraticBezierCurve.prototype.constructor=THREE.QuadraticBezierCurve;
+THREE.QuadraticBezierCurve=function(a,c,b){if(!(c instanceof THREE.Vector2))var d=Array.prototype.slice.call(arguments),a=new THREE.Vector2(d[0],d[1]),c=new THREE.Vector2(d[2],d[3]),b=new THREE.Vector2(d[4],d[5]);this.v0=a;this.v1=c;this.v2=b};THREE.QuadraticBezierCurve.prototype=new THREE.Curve;THREE.QuadraticBezierCurve.prototype.constructor=THREE.QuadraticBezierCurve;
 THREE.QuadraticBezierCurve.prototype.getPoint=function(a){var c;c=THREE.Shape.Utils.b2(a,this.v0.x,this.v1.x,this.v2.x);a=THREE.Shape.Utils.b2(a,this.v0.y,this.v1.y,this.v2.y);return new THREE.Vector2(c,a)};THREE.QuadraticBezierCurve.prototype.getTangent=function(a){var c;c=THREE.Curve.Utils.tangentQuadraticBezier(a,this.v0.x,this.v1.x,this.v2.x);a=THREE.Curve.Utils.tangentQuadraticBezier(a,this.v0.y,this.v1.y,this.v2.y);c=new THREE.Vector2(c,a);c.normalize();return c};
-THREE.CubicBezierCurve=function(a,c,b,e){if(!(c instanceof THREE.Vector2))var g=Array.prototype.slice.call(arguments),a=new THREE.Vector2(g[0],g[1]),c=new THREE.Vector2(g[2],g[3]),b=new THREE.Vector2(g[4],g[5]),e=new THREE.Vector2(g[6],g[7]);this.v0=a;this.v1=c;this.v2=b;this.v3=e};THREE.CubicBezierCurve.prototype=new THREE.Curve;THREE.CubicBezierCurve.prototype.constructor=THREE.CubicBezierCurve;
+THREE.CubicBezierCurve=function(a,c,b,d){if(!(c instanceof THREE.Vector2))var f=Array.prototype.slice.call(arguments),a=new THREE.Vector2(f[0],f[1]),c=new THREE.Vector2(f[2],f[3]),b=new THREE.Vector2(f[4],f[5]),d=new THREE.Vector2(f[6],f[7]);this.v0=a;this.v1=c;this.v2=b;this.v3=d};THREE.CubicBezierCurve.prototype=new THREE.Curve;THREE.CubicBezierCurve.prototype.constructor=THREE.CubicBezierCurve;
 THREE.CubicBezierCurve.prototype.getPoint=function(a){var c;c=THREE.Shape.Utils.b3(a,this.v0.x,this.v1.x,this.v2.x,this.v3.x);a=THREE.Shape.Utils.b3(a,this.v0.y,this.v1.y,this.v2.y,this.v3.y);return new THREE.Vector2(c,a)};THREE.CubicBezierCurve.prototype.getTangent=function(a){var c;c=THREE.Curve.Utils.tangentCubicBezier(a,this.v0.x,this.v1.x,this.v2.x,this.v3.x);a=THREE.Curve.Utils.tangentCubicBezier(a,this.v0.y,this.v1.y,this.v2.y,this.v3.y);c=new THREE.Vector2(c,a);c.normalize();return c};
 THREE.SplineCurve=function(a){this.points=a};THREE.SplineCurve.prototype=new THREE.Curve;THREE.SplineCurve.prototype.constructor=THREE.SplineCurve;
-THREE.SplineCurve.prototype.getPoint=function(a){var c=new THREE.Vector2,b=[],e=this.points,g;g=(e.length-1)*a;a=Math.floor(g);g-=a;b[0]=a==0?a:a-1;b[1]=a;b[2]=a>e.length-2?a:a+1;b[3]=a>e.length-3?a:a+2;c.x=THREE.Curve.Utils.interpolate(e[b[0]].x,e[b[1]].x,e[b[2]].x,e[b[3]].x,g);c.y=THREE.Curve.Utils.interpolate(e[b[0]].y,e[b[1]].y,e[b[2]].y,e[b[3]].y,g);return c};THREE.ArcCurve=function(a,c,b,e,g,h){this.aX=a;this.aY=c;this.aRadius=b;this.aStartAngle=e;this.aEndAngle=g;this.aClockwise=h};
+THREE.SplineCurve.prototype.getPoint=function(a){var c=new THREE.Vector2,b=[],d=this.points,f;f=(d.length-1)*a;a=Math.floor(f);f-=a;b[0]=a==0?a:a-1;b[1]=a;b[2]=a>d.length-2?a:a+1;b[3]=a>d.length-3?a:a+2;c.x=THREE.Curve.Utils.interpolate(d[b[0]].x,d[b[1]].x,d[b[2]].x,d[b[3]].x,f);c.y=THREE.Curve.Utils.interpolate(d[b[0]].y,d[b[1]].y,d[b[2]].y,d[b[3]].y,f);return c};THREE.ArcCurve=function(a,c,b,d,f,g){this.aX=a;this.aY=c;this.aRadius=b;this.aStartAngle=d;this.aEndAngle=f;this.aClockwise=g};
 THREE.ArcCurve.prototype=new THREE.Curve;THREE.ArcCurve.prototype.constructor=THREE.ArcCurve;THREE.ArcCurve.prototype.getPoint=function(a){var c=this.aEndAngle-this.aStartAngle;this.aClockwise||(a=1-a);a=this.aStartAngle+a*c;return new THREE.Vector2(this.aX+this.aRadius*Math.cos(a),this.aY+this.aRadius*Math.sin(a))};
-THREE.Curve.Utils={tangentQuadraticBezier:function(a,c,b,e){return 2*(1-a)*(b-c)+2*a*(e-b)},tangentCubicBezier:function(a,c,b,e,g){return-3*c*(1-a)*(1-a)+3*b*(1-a)*(1-a)-6*a*b*(1-a)+6*a*e*(1-a)-3*a*a*e+3*a*a*g},tangentSpline:function(a){return 6*a*a-6*a+(3*a*a-4*a+1)+(-6*a*a+6*a)+(3*a*a-2*a)},interpolate:function(a,c,b,e,g){var a=(b-a)*0.5,e=(e-c)*0.5,h=g*g;return(2*c-2*b+a+e)*g*h+(-3*c+3*b-2*a-e)*h+a*g+c}};
-THREE.Curve.create=function(a,c){a.prototype=new THREE.Curve;a.prototype.constructor=a;a.prototype.getPoint=c;return a};THREE.LineCurve3=THREE.Curve.create(function(a,c){this.v1=a;this.v2=c},function(a){var c=new THREE.Vector3;c.sub(v2,v1);c.multiplyScalar(a);c.addSelf(this.v1);return c});
+THREE.Curve.Utils={tangentQuadraticBezier:function(a,c,b,d){return 2*(1-a)*(b-c)+2*a*(d-b)},tangentCubicBezier:function(a,c,b,d,f){return-3*c*(1-a)*(1-a)+3*b*(1-a)*(1-a)-6*a*b*(1-a)+6*a*d*(1-a)-3*a*a*d+3*a*a*f},tangentSpline:function(a){return 6*a*a-6*a+(3*a*a-4*a+1)+(-6*a*a+6*a)+(3*a*a-2*a)},interpolate:function(a,c,b,d,f){var a=(b-a)*0.5,d=(d-c)*0.5,g=f*f;return(2*c-2*b+a+d)*f*g+(-3*c+3*b-2*a-d)*g+a*f+c}};
+THREE.Curve.create=function(a,c){a.prototype=new THREE.Curve;a.prototype.constructor=a;a.prototype.getPoint=c;return a};THREE.LineCurve3=THREE.Curve.create(function(a,c){this.v1=a;this.v2=c},function(a){var c=new THREE.Vector3;c.sub(this.v2,this.v1);c.multiplyScalar(a);c.addSelf(this.v1);return c});
 THREE.QuadraticBezierCurve3=THREE.Curve.create(function(a,c,b){this.v0=a;this.v1=c;this.v2=b},function(a){var c,b;c=THREE.Shape.Utils.b2(a,this.v0.x,this.v1.x,this.v2.x);b=THREE.Shape.Utils.b2(a,this.v0.y,this.v1.y,this.v2.y);a=THREE.Shape.Utils.b2(a,this.v0.z,this.v1.z,this.v2.z);return new THREE.Vector3(c,b,a)});
-THREE.CubicBezierCurve3=THREE.Curve.create(function(a,c,b,e){this.v0=a;this.v1=c;this.v2=b;this.v3=e},function(a){var c,b;c=THREE.Shape.Utils.b3(a,this.v0.x,this.v1.x,this.v2.x,this.v3.x);b=THREE.Shape.Utils.b3(a,this.v0.y,this.v1.y,this.v2.y,this.v3.y);a=THREE.Shape.Utils.b3(a,this.v0.z,this.v1.z,this.v2.z,this.v3.z);return new THREE.Vector3(c,b,a)});
-THREE.SplineCurve3=THREE.Curve.create(function(a){this.points=a},function(a){var c=new THREE.Vector3,b=[],e=this.points,g;g=(e.length-1)*a;a=Math.floor(g);g-=a;b[0]=a==0?a:a-1;b[1]=a;b[2]=a>e.length-2?a:a+1;b[3]=a>e.length-3?a:a+2;c.x=THREE.Curve.Utils.interpolate(e[b[0]].x,e[b[1]].x,e[b[2]].x,e[b[3]].x,g);c.y=THREE.Curve.Utils.interpolate(e[b[0]].y,e[b[1]].y,e[b[2]].y,e[b[3]].y,g);c.z=THREE.Curve.Utils.interpolate(e[b[0]].z,e[b[1]].z,e[b[2]].z,e[b[3]].z,g);return c});
+THREE.CubicBezierCurve3=THREE.Curve.create(function(a,c,b,d){this.v0=a;this.v1=c;this.v2=b;this.v3=d},function(a){var c,b;c=THREE.Shape.Utils.b3(a,this.v0.x,this.v1.x,this.v2.x,this.v3.x);b=THREE.Shape.Utils.b3(a,this.v0.y,this.v1.y,this.v2.y,this.v3.y);a=THREE.Shape.Utils.b3(a,this.v0.z,this.v1.z,this.v2.z,this.v3.z);return new THREE.Vector3(c,b,a)});
+THREE.SplineCurve3=THREE.Curve.create(function(a){this.points=a},function(a){var c=new THREE.Vector3,b=[],d=this.points,f;f=(d.length-1)*a;a=Math.floor(f);f-=a;b[0]=a==0?a:a-1;b[1]=a;b[2]=a>d.length-2?a:a+1;b[3]=a>d.length-3?a:a+2;c.x=THREE.Curve.Utils.interpolate(d[b[0]].x,d[b[1]].x,d[b[2]].x,d[b[3]].x,f);c.y=THREE.Curve.Utils.interpolate(d[b[0]].y,d[b[1]].y,d[b[2]].y,d[b[3]].y,f);c.z=THREE.Curve.Utils.interpolate(d[b[0]].z,d[b[1]].z,d[b[2]].z,d[b[3]].z,f);return c});
 THREE.CurvePath=function(){this.curves=[];this.bends=[]};THREE.CurvePath.prototype=new THREE.Curve;THREE.CurvePath.prototype.constructor=THREE.CurvePath;THREE.CurvePath.prototype.add=function(a){this.curves.push(a)};THREE.CurvePath.prototype.checkConnection=function(){};THREE.CurvePath.prototype.closePath=function(){};
 THREE.CurvePath.prototype.getPoint=function(a){for(var c=a*this.getLength(),b=this.getCurveLengths(),a=0;a<b.length;){if(b[a]>=c)return c=b[a]-c,a=this.curves[a],c=1-c/a.getLength(),a.getPointAt(c);a++}return null};THREE.CurvePath.prototype.getLength=function(){var a=this.getCurveLengths();return a[a.length-1]};
-THREE.CurvePath.prototype.getCurveLengths=function(){if(this.cacheLengths&&this.cacheLengths.length==this.curves.length)return this.cacheLengths;var a=[],c=0,b,e=this.curves.length;for(b=0;b<e;b++)c+=this.curves[b].getLength(),a.push(c);return this.cacheLengths=a};
-THREE.CurvePath.prototype.getBoundingBox=function(){var a=this.getPoints(),c,b,e,g;c=b=Number.NEGATIVE_INFINITY;e=g=Number.POSITIVE_INFINITY;var h,f,k,l;l=new THREE.Vector2;f=0;for(k=a.length;f<k;f++){h=a[f];if(h.x>c)c=h.x;else if(h.x<e)e=h.x;if(h.y>b)b=h.y;else if(h.y<b)g=h.y;l.addSelf(h.x,h.y)}return{minX:e,minY:g,maxX:c,maxY:b,centroid:l.divideScalar(k)}};THREE.CurvePath.prototype.createPointsGeometry=function(a){return this.createGeometry(this.getPoints(a,!0))};
+THREE.CurvePath.prototype.getCurveLengths=function(){if(this.cacheLengths&&this.cacheLengths.length==this.curves.length)return this.cacheLengths;var a=[],c=0,b,d=this.curves.length;for(b=0;b<d;b++)c+=this.curves[b].getLength(),a.push(c);return this.cacheLengths=a};
+THREE.CurvePath.prototype.getBoundingBox=function(){var a=this.getPoints(),c,b,d,f;c=b=Number.NEGATIVE_INFINITY;d=f=Number.POSITIVE_INFINITY;var g,e,h,i;i=new THREE.Vector2;e=0;for(h=a.length;e<h;e++){g=a[e];if(g.x>c)c=g.x;else if(g.x<d)d=g.x;if(g.y>b)b=g.y;else if(g.y<b)f=g.y;i.addSelf(g.x,g.y)}return{minX:d,minY:f,maxX:c,maxY:b,centroid:i.divideScalar(h)}};THREE.CurvePath.prototype.createPointsGeometry=function(a){return this.createGeometry(this.getPoints(a,!0))};
 THREE.CurvePath.prototype.createSpacedPointsGeometry=function(a){return this.createGeometry(this.getSpacedPoints(a,!0))};THREE.CurvePath.prototype.createGeometry=function(a){for(var c=new THREE.Geometry,b=0;b<a.length;b++)c.vertices.push(new THREE.Vertex(new THREE.Vector3(a[b].x,a[b].y,0)));return c};THREE.CurvePath.prototype.addWrapPath=function(a){this.bends.push(a)};
-THREE.CurvePath.prototype.getTransformedPoints=function(a,c){var b=this.getPoints(a),e,g;if(!c)c=this.bends;e=0;for(g=c.length;e<g;e++)b=this.getWrapPoints(b,c[e]);return b};THREE.CurvePath.prototype.getTransformedSpacedPoints=function(a,c){var b=this.getSpacedPoints(a),e,g;if(!c)c=this.bends;e=0;for(g=c.length;e<g;e++)b=this.getWrapPoints(b,c[e]);return b};
-THREE.CurvePath.prototype.getWrapPoints=function(a,c){var b=this.getBoundingBox(),e,g,h,f,k,l;e=0;for(g=a.length;e<g;e++)h=a[e],f=h.x,k=h.y,l=f/b.maxX,l=c.getUtoTmapping(l,f),f=c.getPoint(l),k=c.getNormalVector(l).multiplyScalar(k),h.x=f.x+k.x,h.y=f.y+k.y;return a};THREE.Path=function(a){THREE.CurvePath.call(this);this.actions=[];a&&this.fromPoints(a)};THREE.Path.prototype=new THREE.CurvePath;THREE.Path.prototype.constructor=THREE.Path;
+THREE.CurvePath.prototype.getTransformedPoints=function(a,c){var b=this.getPoints(a),d,f;if(!c)c=this.bends;d=0;for(f=c.length;d<f;d++)b=this.getWrapPoints(b,c[d]);return b};THREE.CurvePath.prototype.getTransformedSpacedPoints=function(a,c){var b=this.getSpacedPoints(a),d,f;if(!c)c=this.bends;d=0;for(f=c.length;d<f;d++)b=this.getWrapPoints(b,c[d]);return b};
+THREE.CurvePath.prototype.getWrapPoints=function(a,c){var b=this.getBoundingBox(),d,f,g,e,h,i;d=0;for(f=a.length;d<f;d++)g=a[d],e=g.x,h=g.y,i=e/b.maxX,i=c.getUtoTmapping(i,e),e=c.getPoint(i),h=c.getNormalVector(i).multiplyScalar(h),g.x=e.x+h.x,g.y=e.y+h.y;return a};THREE.Path=function(a){THREE.CurvePath.call(this);this.actions=[];a&&this.fromPoints(a)};THREE.Path.prototype=new THREE.CurvePath;THREE.Path.prototype.constructor=THREE.Path;
 THREE.PathActions={MOVE_TO:"moveTo",LINE_TO:"lineTo",QUADRATIC_CURVE_TO:"quadraticCurveTo",BEZIER_CURVE_TO:"bezierCurveTo",CSPLINE_THRU:"splineThru",ARC:"arc"};THREE.Path.prototype.fromPoints=function(a){this.moveTo(a[0].x,a[0].y);var c,b=a.length;for(c=1;c<b;c++)this.lineTo(a[c].x,a[c].y)};THREE.Path.prototype.moveTo=function(){var a=Array.prototype.slice.call(arguments);this.actions.push({action:THREE.PathActions.MOVE_TO,args:a})};
-THREE.Path.prototype.lineTo=function(a,c){var b=Array.prototype.slice.call(arguments),e=this.actions[this.actions.length-1].args;this.curves.push(new THREE.LineCurve(new THREE.Vector2(e[e.length-2],e[e.length-1]),new THREE.Vector2(a,c)));this.actions.push({action:THREE.PathActions.LINE_TO,args:b})};
-THREE.Path.prototype.quadraticCurveTo=function(a,c,b,e){var g=Array.prototype.slice.call(arguments),h=this.actions[this.actions.length-1].args;this.curves.push(new THREE.QuadraticBezierCurve(new THREE.Vector2(h[h.length-2],h[h.length-1]),new THREE.Vector2(a,c),new THREE.Vector2(b,e)));this.actions.push({action:THREE.PathActions.QUADRATIC_CURVE_TO,args:g})};
-THREE.Path.prototype.bezierCurveTo=function(a,c,b,e,g,h){var f=Array.prototype.slice.call(arguments),k=this.actions[this.actions.length-1].args;this.curves.push(new THREE.CubicBezierCurve(new THREE.Vector2(k[k.length-2],k[k.length-1]),new THREE.Vector2(a,c),new THREE.Vector2(b,e),new THREE.Vector2(g,h)));this.actions.push({action:THREE.PathActions.BEZIER_CURVE_TO,args:f})};
+THREE.Path.prototype.lineTo=function(a,c){var b=Array.prototype.slice.call(arguments),d=this.actions[this.actions.length-1].args;this.curves.push(new THREE.LineCurve(new THREE.Vector2(d[d.length-2],d[d.length-1]),new THREE.Vector2(a,c)));this.actions.push({action:THREE.PathActions.LINE_TO,args:b})};
+THREE.Path.prototype.quadraticCurveTo=function(a,c,b,d){var f=Array.prototype.slice.call(arguments),g=this.actions[this.actions.length-1].args;this.curves.push(new THREE.QuadraticBezierCurve(new THREE.Vector2(g[g.length-2],g[g.length-1]),new THREE.Vector2(a,c),new THREE.Vector2(b,d)));this.actions.push({action:THREE.PathActions.QUADRATIC_CURVE_TO,args:f})};
+THREE.Path.prototype.bezierCurveTo=function(a,c,b,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,c),new THREE.Vector2(b,d),new THREE.Vector2(f,g)));this.actions.push({action:THREE.PathActions.BEZIER_CURVE_TO,args:e})};
 THREE.Path.prototype.splineThru=function(a){var c=Array.prototype.slice.call(arguments),b=this.actions[this.actions.length-1].args,b=[new THREE.Vector2(b[b.length-2],b[b.length-1])];Array.prototype.push.apply(b,a);this.curves.push(new THREE.SplineCurve(b));this.actions.push({action:THREE.PathActions.CSPLINE_THRU,args:c})};
-THREE.Path.prototype.arc=function(a,c,b,e,g,h){var f=Array.prototype.slice.call(arguments);this.curves.push(new THREE.ArcCurve(a,c,b,e,g,h));this.actions.push({action:THREE.PathActions.ARC,args:f})};THREE.Path.prototype.getSpacedPoints=function(a){a||(a=40);for(var c=[],b=0;b<a;b++)c.push(this.getPoint(b/a));return c};
-THREE.Path.prototype.getPoints=function(a,c){var a=a||12,b=[],e,g,h,f,k,l,m,n,o,u,p,z,w;e=0;for(g=this.actions.length;e<g;e++)switch(h=this.actions[e],f=h.action,h=h.args,f){case THREE.PathActions.LINE_TO:b.push(new THREE.Vector2(h[0],h[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:k=h[2];l=h[3];o=h[0];u=h[1];b.length>0?(f=b[b.length-1],p=f.x,z=f.y):(f=this.actions[e-1].args,p=f[f.length-2],z=f[f.length-1]);for(f=1;f<=a;f++)w=f/a,h=THREE.Shape.Utils.b2(w,p,o,k),w=THREE.Shape.Utils.b2(w,z,u,
-l),b.push(new THREE.Vector2(h,w));break;case THREE.PathActions.BEZIER_CURVE_TO:k=h[4];l=h[5];o=h[0];u=h[1];m=h[2];n=h[3];b.length>0?(f=b[b.length-1],p=f.x,z=f.y):(f=this.actions[e-1].args,p=f[f.length-2],z=f[f.length-1]);for(f=1;f<=a;f++)w=f/a,h=THREE.Shape.Utils.b3(w,p,o,m,k),w=THREE.Shape.Utils.b3(w,z,u,n,l),b.push(new THREE.Vector2(h,w));break;case THREE.PathActions.CSPLINE_THRU:f=this.actions[e-1].args;f=[new THREE.Vector2(f[f.length-2],f[f.length-1])];w=a*h[0].length;f=f.concat(h[0]);h=new THREE.SplineCurve(f);
-for(f=1;f<=w;f++)b.push(h.getPointAt(f/w));break;case THREE.PathActions.ARC:f=this.actions[e-1].args;k=h[0];l=h[1];m=h[2];o=h[3];w=h[4];u=!!h[5];n=f[f.length-2];p=f[f.length-1];f.length==0&&(n=p=0);z=w-o;var x=a*2;for(f=1;f<=x;f++)w=f/x,u||(w=1-w),w=o+w*z,h=n+k+m*Math.cos(w),w=p+l+m*Math.sin(w),b.push(new THREE.Vector2(h,w))}c&&b.push(b[0]);return b};THREE.Path.prototype.transform=function(a,c){this.getBoundingBox();return this.getWrapPoints(this.getPoints(c),a)};
-THREE.Path.prototype.nltransform=function(a,c,b,e,g,h){var f=this.getPoints(),k,l,m,n,o;k=0;for(l=f.length;k<l;k++)m=f[k],n=m.x,o=m.y,m.x=a*n+c*o+b,m.y=e*o+g*n+h;return f};
-THREE.Path.prototype.debug=function(a){var c=this.getBoundingBox();a||(a=document.createElement("canvas"),a.setAttribute("width",c.maxX+100),a.setAttribute("height",c.maxY+100),document.body.appendChild(a));c=a.getContext("2d");c.fillStyle="white";c.fillRect(0,0,a.width,a.height);c.strokeStyle="black";c.beginPath();var b,e,g,a=0;for(b=this.actions.length;a<b;a++)e=this.actions[a],g=e.args,e=e.action,e!=THREE.PathActions.CSPLINE_THRU&&c[e].apply(c,g);c.stroke();c.closePath();c.strokeStyle="red";e=
-this.getPoints();a=0;for(b=e.length;a<b;a++)g=e[a],c.beginPath(),c.arc(g.x,g.y,1.5,0,Math.PI*2,!1),c.stroke(),c.closePath()};
-THREE.Path.prototype.toShapes=function(){var a,c,b,e,g=[],h=new THREE.Path;a=0;for(c=this.actions.length;a<c;a++)b=this.actions[a],e=b.args,b=b.action,b==THREE.PathActions.MOVE_TO&&h.actions.length!=0&&(g.push(h),h=new THREE.Path),h[b].apply(h,e);h.actions.length!=0&&g.push(h);if(g.length==0)return[];var f,h=[];if(THREE.Shape.Utils.isClockWise(g[0].getPoints())){a=0;for(c=g.length;a<c;a++)e=g[a],THREE.Shape.Utils.isClockWise(e.getPoints())?(f&&h.push(f),f=new THREE.Shape,f.actions=e.actions,f.curves=
-e.curves):f.holes.push(e);h.push(f)}else{f=new THREE.Shape;a=0;for(c=g.length;a<c;a++)e=g[a],THREE.Shape.Utils.isClockWise(e.getPoints())?(f.actions=e.actions,f.curves=e.curves,h.push(f),f=new THREE.Shape):f.holes.push(e)}return h};THREE.Shape=function(){THREE.Path.apply(this,arguments);this.holes=[]};THREE.Shape.prototype=new THREE.Path;THREE.Shape.prototype.constructor=THREE.Path;THREE.Shape.prototype.extrude=function(a){return new THREE.ExtrudeGeometry(this,a)};
-THREE.Shape.prototype.getPointsHoles=function(a){var c,b=this.holes.length,e=[];for(c=0;c<b;c++)e[c]=this.holes[c].getTransformedPoints(a,this.bends);return e};THREE.Shape.prototype.getSpacedPointsHoles=function(a){var c,b=this.holes.length,e=[];for(c=0;c<b;c++)e[c]=this.holes[c].getTransformedSpacedPoints(a,this.bends);return e};THREE.Shape.prototype.extractAllPoints=function(a){return{shape:this.getTransformedPoints(a),holes:this.getPointsHoles(a)}};
+THREE.Path.prototype.arc=function(a,c,b,d,f,g){var e=Array.prototype.slice.call(arguments);this.curves.push(new THREE.ArcCurve(a,c,b,d,f,g));this.actions.push({action:THREE.PathActions.ARC,args:e})};THREE.Path.prototype.getSpacedPoints=function(a){a||(a=40);for(var c=[],b=0;b<a;b++)c.push(this.getPoint(b/a));return c};
+THREE.Path.prototype.getPoints=function(a,c){var a=a||12,b=[],d,f,g,e,h,i,j,k,m,o,n,t,q;d=0;for(f=this.actions.length;d<f;d++)switch(g=this.actions[d],e=g.action,g=g.args,e){case THREE.PathActions.LINE_TO:b.push(new THREE.Vector2(g[0],g[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:h=g[2];i=g[3];m=g[0];o=g[1];b.length>0?(e=b[b.length-1],n=e.x,t=e.y):(e=this.actions[d-1].args,n=e[e.length-2],t=e[e.length-1]);for(e=1;e<=a;e++)q=e/a,g=THREE.Shape.Utils.b2(q,n,m,h),q=THREE.Shape.Utils.b2(q,t,o,
+i),b.push(new THREE.Vector2(g,q));break;case THREE.PathActions.BEZIER_CURVE_TO:h=g[4];i=g[5];m=g[0];o=g[1];j=g[2];k=g[3];b.length>0?(e=b[b.length-1],n=e.x,t=e.y):(e=this.actions[d-1].args,n=e[e.length-2],t=e[e.length-1]);for(e=1;e<=a;e++)q=e/a,g=THREE.Shape.Utils.b3(q,n,m,j,h),q=THREE.Shape.Utils.b3(q,t,o,k,i),b.push(new THREE.Vector2(g,q));break;case THREE.PathActions.CSPLINE_THRU:e=this.actions[d-1].args;e=[new THREE.Vector2(e[e.length-2],e[e.length-1])];q=a*g[0].length;e=e.concat(g[0]);g=new THREE.SplineCurve(e);
+for(e=1;e<=q;e++)b.push(g.getPointAt(e/q));break;case THREE.PathActions.ARC:e=this.actions[d-1].args;h=g[0];i=g[1];j=g[2];m=g[3];q=g[4];o=!!g[5];k=e[e.length-2];n=e[e.length-1];e.length==0&&(k=n=0);t=q-m;var r=a*2;for(e=1;e<=r;e++)q=e/r,o||(q=1-q),q=m+q*t,g=k+h+j*Math.cos(q),q=n+i+j*Math.sin(q),b.push(new THREE.Vector2(g,q))}c&&b.push(b[0]);return b};THREE.Path.prototype.transform=function(a,c){this.getBoundingBox();return this.getWrapPoints(this.getPoints(c),a)};
+THREE.Path.prototype.nltransform=function(a,c,b,d,f,g){var e=this.getPoints(),h,i,j,k,m;h=0;for(i=e.length;h<i;h++)j=e[h],k=j.x,m=j.y,j.x=a*k+c*m+b,j.y=d*m+f*k+g;return e};
+THREE.Path.prototype.debug=function(a){var c=this.getBoundingBox();a||(a=document.createElement("canvas"),a.setAttribute("width",c.maxX+100),a.setAttribute("height",c.maxY+100),document.body.appendChild(a));c=a.getContext("2d");c.fillStyle="white";c.fillRect(0,0,a.width,a.height);c.strokeStyle="black";c.beginPath();var b,d,f,a=0;for(b=this.actions.length;a<b;a++)d=this.actions[a],f=d.args,d=d.action,d!=THREE.PathActions.CSPLINE_THRU&&c[d].apply(c,f);c.stroke();c.closePath();c.strokeStyle="red";d=
+this.getPoints();a=0;for(b=d.length;a<b;a++)f=d[a],c.beginPath(),c.arc(f.x,f.y,1.5,0,Math.PI*2,!1),c.stroke(),c.closePath()};
+THREE.Path.prototype.toShapes=function(){var a,c,b,d,f=[],g=new THREE.Path;a=0;for(c=this.actions.length;a<c;a++)b=this.actions[a],d=b.args,b=b.action,b==THREE.PathActions.MOVE_TO&&g.actions.length!=0&&(f.push(g),g=new THREE.Path),g[b].apply(g,d);g.actions.length!=0&&f.push(g);if(f.length==0)return[];var e,g=[];if(THREE.Shape.Utils.isClockWise(f[0].getPoints())){a=0;for(c=f.length;a<c;a++)d=f[a],THREE.Shape.Utils.isClockWise(d.getPoints())?(e&&g.push(e),e=new THREE.Shape,e.actions=d.actions,e.curves=
+d.curves):e.holes.push(d);g.push(e)}else{e=new THREE.Shape;a=0;for(c=f.length;a<c;a++)d=f[a],THREE.Shape.Utils.isClockWise(d.getPoints())?(e.actions=d.actions,e.curves=d.curves,g.push(e),e=new THREE.Shape):e.holes.push(d)}return g};THREE.Shape=function(){THREE.Path.apply(this,arguments);this.holes=[]};THREE.Shape.prototype=new THREE.Path;THREE.Shape.prototype.constructor=THREE.Path;THREE.Shape.prototype.extrude=function(a){return new THREE.ExtrudeGeometry(this,a)};
+THREE.Shape.prototype.getPointsHoles=function(a){var c,b=this.holes.length,d=[];for(c=0;c<b;c++)d[c]=this.holes[c].getTransformedPoints(a,this.bends);return d};THREE.Shape.prototype.getSpacedPointsHoles=function(a){var c,b=this.holes.length,d=[];for(c=0;c<b;c++)d[c]=this.holes[c].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,c){var b=a.concat(),e=b.concat(),g,h,f,k,l,m,n,o,u,p,z=[];for(l=0;l<c.length;l++){m=c[l];Array.prototype.push.apply(e,m);h=Number.POSITIVE_INFINITY;for(g=0;g<m.length;g++){u=m[g];p=[];for(o=0;o<b.length;o++)n=b[o],n=u.distanceToSquared(n),p.push(n),n<h&&(h=n,f=g,k=o)}g=k-1>=0?k-1:b.length-1;h=f-1>=0?f-1:m.length-1;var w=[m[f],b[k],b[g]];o=THREE.FontUtils.Triangulate.area(w);var x=[m[f],m[h],b[k]];u=THREE.FontUtils.Triangulate.area(x);p=k;n=f;k+=1;f+=-1;k<
-0&&(k+=b.length);k%=b.length;f<0&&(f+=m.length);f%=m.length;g=k-1>=0?k-1:b.length-1;h=f-1>=0?f-1:m.length-1;w=[m[f],b[k],b[g]];w=THREE.FontUtils.Triangulate.area(w);x=[m[f],m[h],b[k]];x=THREE.FontUtils.Triangulate.area(x);o+u>w+x&&(k=p,f=n,k<0&&(k+=b.length),k%=b.length,f<0&&(f+=m.length),f%=m.length,g=k-1>=0?k-1:b.length-1,h=f-1>=0?f-1:m.length-1);o=b.slice(0,k);u=b.slice(k);p=m.slice(f);n=m.slice(0,f);h=[m[f],m[h],b[k]];z.push([m[f],b[k],b[g]]);z.push(h);b=o.concat(p).concat(n).concat(u)}return{shape:b,
-isolatedPts:z,allpoints:e}},triangulateShape:function(a,c){var b=THREE.Shape.Utils.removeHoles(a,c),e=b.allpoints,g=b.isolatedPts,b=THREE.FontUtils.Triangulate(b.shape,!1),h,f,k,l,m={};h=0;for(f=e.length;h<f;h++)l=e[h].x+":"+e[h].y,m[l]!==void 0&&console.log("Duplicate point",l),m[l]=h;h=0;for(f=b.length;h<f;h++){k=b[h];for(e=0;e<3;e++)l=k[e].x+":"+k[e].y,l=m[l],l!==void 0&&(k[e]=l)}h=0;for(f=g.length;h<f;h++){k=g[h];for(e=0;e<3;e++)l=k[e].x+":"+k[e].y,l=m[l],l!==void 0&&(k[e]=l)}return b.concat(g)},
-isClockWise:function(a){return THREE.FontUtils.Triangulate.area(a)<0},b2p0:function(a,c){var b=1-a;return b*b*c},b2p1:function(a,c){return 2*(1-a)*a*c},b2p2:function(a,c){return a*a*c},b2:function(a,c,b,e){return this.b2p0(a,c)+this.b2p1(a,b)+this.b2p2(a,e)},b3p0:function(a,c){var b=1-a;return b*b*b*c},b3p1:function(a,c){var b=1-a;return 3*b*b*a*c},b3p2:function(a,c){return 3*(1-a)*a*a*c},b3p3:function(a,c){return a*a*a*c},b3:function(a,c,b,e,g){return this.b3p0(a,c)+this.b3p1(a,b)+this.b3p2(a,e)+
-this.b3p3(a,g)}};THREE.TextPath=function(a,c){THREE.Path.call(this);this.parameters=c||{};this.set(a)};THREE.TextPath.prototype.set=function(a,c){this.text=a;var c=c||this.parameters,b=c.curveSegments!==void 0?c.curveSegments:4,e=c.font!==void 0?c.font:"helvetiker",g=c.weight!==void 0?c.weight:"normal",h=c.style!==void 0?c.style:"normal";THREE.FontUtils.size=c.size!==void 0?c.size:100;THREE.FontUtils.divisions=b;THREE.FontUtils.face=e;THREE.FontUtils.weight=g;THREE.FontUtils.style=h};
-THREE.TextPath.prototype.toShapes=function(){for(var a=THREE.FontUtils.drawText(this.text).paths,c=[],b=0,e=a.length;b<e;b++)Array.prototype.push.apply(c,a[b].toShapes());return c};
-THREE.AnimationHandler=function(){var a=[],c={},b={update:function(b){for(var e=0;e<a.length;e++)a[e].update(b)},addToUpdate:function(b){a.indexOf(b)===-1&&a.push(b)},removeFromUpdate:function(b){b=a.indexOf(b);b!==-1&&a.splice(b,1)},add:function(a){c[a.name]!==void 0&&console.log("THREE.AnimationHandler.add: Warning! "+a.name+" already exists in library. Overwriting.");c[a.name]=a;if(a.initialized!==!0){for(var b=0;b<a.hierarchy.length;b++){for(var e=0;e<a.hierarchy[b].keys.length;e++){if(a.hierarchy[b].keys[e].time<
-0)a.hierarchy[b].keys[e].time=0;if(a.hierarchy[b].keys[e].rot!==void 0&&!(a.hierarchy[b].keys[e].rot instanceof THREE.Quaternion)){var k=a.hierarchy[b].keys[e].rot;a.hierarchy[b].keys[e].rot=new THREE.Quaternion(k[0],k[1],k[2],k[3])}}if(a.hierarchy[b].keys[0].morphTargets!==void 0){k={};for(e=0;e<a.hierarchy[b].keys.length;e++)for(var l=0;l<a.hierarchy[b].keys[e].morphTargets.length;l++){var m=a.hierarchy[b].keys[e].morphTargets[l];k[m]=-1}a.hierarchy[b].usedMorphTargets=k;for(e=0;e<a.hierarchy[b].keys.length;e++){var n=
-{};for(m in k){for(l=0;l<a.hierarchy[b].keys[e].morphTargets.length;l++)if(a.hierarchy[b].keys[e].morphTargets[l]===m){n[m]=a.hierarchy[b].keys[e].morphTargetsInfluences[l];break}l===a.hierarchy[b].keys[e].morphTargets.length&&(n[m]=0)}a.hierarchy[b].keys[e].morphTargetsInfluences=n}}for(e=1;e<a.hierarchy[b].keys.length;e++)a.hierarchy[b].keys[e].time===a.hierarchy[b].keys[e-1].time&&(a.hierarchy[b].keys.splice(e,1),e--);for(e=1;e<a.hierarchy[b].keys.length;e++)a.hierarchy[b].keys[e].index=e}e=parseInt(a.length*
-a.fps,10);a.JIT={};a.JIT.hierarchy=[];for(b=0;b<a.hierarchy.length;b++)a.JIT.hierarchy.push(Array(e));a.initialized=!0}},get:function(a){if(typeof a==="string")return c[a]?c[a]:(console.log("THREE.AnimationHandler.get: Couldn't find animation "+a),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 e(a,b);return b}},e=function(a,b){b.push(a);for(var c=0;c<a.children.length;c++)e(a.children[c],b)};b.LINEAR=0;b.CATMULLROM=1;b.CATMULLROM_FORWARD=
-2;return b}();THREE.Animation=function(a,c,b,e){this.root=a;this.data=THREE.AnimationHandler.get(c);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.loop=this.isPaused=!0;this.interpolationType=b!==void 0?b:THREE.AnimationHandler.LINEAR;this.JITCompile=e!==void 0?e:!0;this.points=[];this.target=new THREE.Vector3};
-THREE.Animation.prototype.play=function(a,c){if(!this.isPlaying){this.isPlaying=!0;this.loop=a!==void 0?a:!0;this.currentTime=c!==void 0?c:0;var b,e=this.hierarchy.length,g;for(b=0;b<e;b++){g=this.hierarchy[b];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)g.useQuaternion=!0;g.matrixAutoUpdate=!0;if(g.animationCache===void 0)g.animationCache={},g.animationCache.prevKey={pos:0,rot:0,scl:0},g.animationCache.nextKey={pos:0,rot:0,scl:0},g.animationCache.originalMatrix=g instanceof
-THREE.Bone?g.skinMatrix:g.matrix;var h=g.animationCache.prevKey;g=g.animationCache.nextKey;h.pos=this.data.hierarchy[b].keys[0];h.rot=this.data.hierarchy[b].keys[0];h.scl=this.data.hierarchy[b].keys[0];g.pos=this.getNextKeyWith("pos",b,1);g.rot=this.getNextKeyWith("rot",b,1);g.scl=this.getNextKeyWith("scl",b,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
+THREE.Shape.Utils={removeHoles:function(a,c){var b=a.concat(),d=b.concat(),f,g,e,h,i,j,k,m,o,n,t=[];for(i=0;i<c.length;i++){j=c[i];Array.prototype.push.apply(d,j);g=Number.POSITIVE_INFINITY;for(f=0;f<j.length;f++){o=j[f];n=[];for(m=0;m<b.length;m++)k=b[m],k=o.distanceToSquared(k),n.push(k),k<g&&(g=k,e=f,h=m)}f=h-1>=0?h-1:b.length-1;g=e-1>=0?e-1:j.length-1;var q=[j[e],b[h],b[f]];m=THREE.FontUtils.Triangulate.area(q);var r=[j[e],j[g],b[h]];o=THREE.FontUtils.Triangulate.area(r);n=h;k=e;h+=1;e+=-1;h<
+0&&(h+=b.length);h%=b.length;e<0&&(e+=j.length);e%=j.length;f=h-1>=0?h-1:b.length-1;g=e-1>=0?e-1:j.length-1;q=[j[e],b[h],b[f]];q=THREE.FontUtils.Triangulate.area(q);r=[j[e],j[g],b[h]];r=THREE.FontUtils.Triangulate.area(r);m+o>q+r&&(h=n,e=k,h<0&&(h+=b.length),h%=b.length,e<0&&(e+=j.length),e%=j.length,f=h-1>=0?h-1:b.length-1,g=e-1>=0?e-1:j.length-1);m=b.slice(0,h);o=b.slice(h);n=j.slice(e);k=j.slice(0,e);g=[j[e],j[g],b[h]];t.push([j[e],b[h],b[f]]);t.push(g);b=m.concat(n).concat(k).concat(o)}return{shape:b,
+isolatedPts:t,allpoints:d}},triangulateShape:function(a,c){var b=THREE.Shape.Utils.removeHoles(a,c),d=b.allpoints,f=b.isolatedPts,b=THREE.FontUtils.Triangulate(b.shape,!1),g,e,h,i,j={};g=0;for(e=d.length;g<e;g++)i=d[g].x+":"+d[g].y,j[i]!==void 0&&console.log("Duplicate point",i),j[i]=g;g=0;for(e=b.length;g<e;g++){h=b[g];for(d=0;d<3;d++)i=h[d].x+":"+h[d].y,i=j[i],i!==void 0&&(h[d]=i)}g=0;for(e=f.length;g<e;g++){h=f[g];for(d=0;d<3;d++)i=h[d].x+":"+h[d].y,i=j[i],i!==void 0&&(h[d]=i)}return b.concat(f)},
+isClockWise:function(a){return THREE.FontUtils.Triangulate.area(a)<0},b2p0:function(a,c){var b=1-a;return b*b*c},b2p1:function(a,c){return 2*(1-a)*a*c},b2p2:function(a,c){return a*a*c},b2:function(a,c,b,d){return this.b2p0(a,c)+this.b2p1(a,b)+this.b2p2(a,d)},b3p0:function(a,c){var b=1-a;return b*b*b*c},b3p1:function(a,c){var b=1-a;return 3*b*b*a*c},b3p2:function(a,c){return 3*(1-a)*a*a*c},b3p3:function(a,c){return a*a*a*c},b3:function(a,c,b,d,f){return this.b3p0(a,c)+this.b3p1(a,b)+this.b3p2(a,d)+
+this.b3p3(a,f)}};THREE.TextPath=function(a,c){THREE.Path.call(this);this.parameters=c||{};this.set(a)};THREE.TextPath.prototype.set=function(a,c){this.text=a;var c=c||this.parameters,b=c.curveSegments!==void 0?c.curveSegments:4,d=c.font!==void 0?c.font:"helvetiker",f=c.weight!==void 0?c.weight:"normal",g=c.style!==void 0?c.style:"normal";THREE.FontUtils.size=c.size!==void 0?c.size:100;THREE.FontUtils.divisions=b;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,c=[],b=0,d=a.length;b<d;b++)Array.prototype.push.apply(c,a[b].toShapes());return c};
+THREE.AnimationHandler=function(){var a=[],c={},b={update:function(b){for(var d=0;d<a.length;d++)a[d].update(b)},addToUpdate:function(b){a.indexOf(b)===-1&&a.push(b)},removeFromUpdate:function(b){b=a.indexOf(b);b!==-1&&a.splice(b,1)},add:function(a){c[a.name]!==void 0&&console.log("THREE.AnimationHandler.add: Warning! "+a.name+" already exists in library. Overwriting.");c[a.name]=a;if(a.initialized!==!0){for(var b=0;b<a.hierarchy.length;b++){for(var d=0;d<a.hierarchy[b].keys.length;d++){if(a.hierarchy[b].keys[d].time<
+0)a.hierarchy[b].keys[d].time=0;if(a.hierarchy[b].keys[d].rot!==void 0&&!(a.hierarchy[b].keys[d].rot instanceof THREE.Quaternion)){var h=a.hierarchy[b].keys[d].rot;a.hierarchy[b].keys[d].rot=new THREE.Quaternion(h[0],h[1],h[2],h[3])}}if(a.hierarchy[b].keys[0].morphTargets!==void 0){h={};for(d=0;d<a.hierarchy[b].keys.length;d++)for(var i=0;i<a.hierarchy[b].keys[d].morphTargets.length;i++){var j=a.hierarchy[b].keys[d].morphTargets[i];h[j]=-1}a.hierarchy[b].usedMorphTargets=h;for(d=0;d<a.hierarchy[b].keys.length;d++){var k=
+{};for(j in h){for(i=0;i<a.hierarchy[b].keys[d].morphTargets.length;i++)if(a.hierarchy[b].keys[d].morphTargets[i]===j){k[j]=a.hierarchy[b].keys[d].morphTargetsInfluences[i];break}i===a.hierarchy[b].keys[d].morphTargets.length&&(k[j]=0)}a.hierarchy[b].keys[d].morphTargetsInfluences=k}}for(d=1;d<a.hierarchy[b].keys.length;d++)a.hierarchy[b].keys[d].time===a.hierarchy[b].keys[d-1].time&&(a.hierarchy[b].keys.splice(d,1),d--);for(d=1;d<a.hierarchy[b].keys.length;d++)a.hierarchy[b].keys[d].index=d}d=parseInt(a.length*
+a.fps,10);a.JIT={};a.JIT.hierarchy=[];for(b=0;b<a.hierarchy.length;b++)a.JIT.hierarchy.push(Array(d));a.initialized=!0}},get:function(a){if(typeof a==="string")return c[a]?c[a]:(console.log("THREE.AnimationHandler.get: Couldn't find animation "+a),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)};b.LINEAR=0;b.CATMULLROM=1;b.CATMULLROM_FORWARD=
+2;return b}();THREE.Animation=function(a,c,b,d){this.root=a;this.data=THREE.AnimationHandler.get(c);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.loop=this.isPaused=!0;this.interpolationType=b!==void 0?b:THREE.AnimationHandler.LINEAR;this.JITCompile=d!==void 0?d:!0;this.points=[];this.target=new THREE.Vector3};
+THREE.Animation.prototype.play=function(a,c){if(!this.isPlaying){this.isPlaying=!0;this.loop=a!==void 0?a:!0;this.currentTime=c!==void 0?c:0;var b,d=this.hierarchy.length,f;for(b=0;b<d;b++){f=this.hierarchy[b];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)f.useQuaternion=!0;f.matrixAutoUpdate=!0;if(f.animationCache===void 0)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[b].keys[0];g.rot=this.data.hierarchy[b].keys[0];g.scl=this.data.hierarchy[b].keys[0];f.pos=this.getNextKeyWith("pos",b,1);f.rot=this.getNextKeyWith("rot",b,1);f.scl=this.getNextKeyWith("scl",b,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
 THREE.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
 THREE.Animation.prototype.stop=function(){this.isPaused=this.isPlaying=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.hierarchy.length;a++)if(this.hierarchy[a].animationCache!==void 0)this.hierarchy[a]instanceof THREE.Bone?this.hierarchy[a].skinMatrix=this.hierarchy[a].animationCache.originalMatrix:this.hierarchy[a].matrix=this.hierarchy[a].animationCache.originalMatrix,delete this.hierarchy[a].animationCache};
-THREE.Animation.prototype.update=function(a){if(this.isPlaying){var c=["pos","rot","scl"],b,e,g,h,f,k,l,m,n=this.data.JIT.hierarchy,o,u;this.currentTime+=a*this.timeScale;u=this.currentTime;o=this.currentTime%=this.data.length;m=parseInt(Math.min(o*this.data.fps,this.data.length*this.data.fps),10);for(var p=0,z=this.hierarchy.length;p<z;p++)if(a=this.hierarchy[p],l=a.animationCache,this.JITCompile&&n[p][m]!==void 0)a instanceof THREE.Bone?(a.skinMatrix=n[p][m],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=
-!1):(a.matrix=n[p][m],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=!0);else{if(this.JITCompile)a instanceof THREE.Bone?a.skinMatrix=a.animationCache.originalMatrix:a.matrix=a.animationCache.originalMatrix;for(var w=0;w<3;w++){b=c[w];f=l.prevKey[b];k=l.nextKey[b];if(k.time<=u){if(o<u)if(this.loop){f=this.data.hierarchy[p].keys[0];for(k=this.getNextKeyWith(b,p,1);k.time<o;)f=k,k=this.getNextKeyWith(b,p,k.index+1)}else{this.stop();return}else{do f=k,k=this.getNextKeyWith(b,p,k.index+1);while(k.time<
-o)}l.prevKey[b]=f;l.nextKey[b]=k}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;e=(o-f.time)/(k.time-f.time);g=f[b];h=k[b];if(e<0||e>1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+e+" on bone "+p),e=e<0?0:1;if(b==="pos")if(b=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)b.x=g[0]+(h[0]-g[0])*e,b.y=g[1]+(h[1]-g[1])*e,b.z=g[2]+(h[2]-g[2])*e;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
-this.getPrevKeyWith("pos",p,f.index-1).pos,this.points[1]=g,this.points[2]=h,this.points[3]=this.getNextKeyWith("pos",p,k.index+1).pos,e=e*0.33+0.33,g=this.interpolateCatmullRom(this.points,e),b.x=g[0],b.y=g[1],b.z=g[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)e=this.interpolateCatmullRom(this.points,e*1.01),this.target.set(e[0],e[1],e[2]),this.target.subSelf(b),this.target.y=0,this.target.normalize(),e=Math.atan2(this.target.x,this.target.z),a.rotation.set(0,e,0)}else if(b===
-"rot")THREE.Quaternion.slerp(g,h,a.quaternion,e);else if(b==="scl")b=a.scale,b.x=g[0]+(h[0]-g[0])*e,b.y=g[1]+(h[1]-g[1])*e,b.z=g[2]+(h[2]-g[2])*e}}if(this.JITCompile&&n[0][m]===void 0){this.hierarchy[0].update(null,!0);for(p=0;p<this.hierarchy.length;p++)n[p][m]=this.hierarchy[p]instanceof THREE.Bone?this.hierarchy[p].skinMatrix.clone():this.hierarchy[p].matrix.clone()}}};
-THREE.Animation.prototype.interpolateCatmullRom=function(a,c){var b=[],e=[],g,h,f,k,l,m;g=(a.length-1)*c;h=Math.floor(g);g-=h;b[0]=h===0?h:h-1;b[1]=h;b[2]=h>a.length-2?h:h+1;b[3]=h>a.length-3?h:h+2;h=a[b[0]];k=a[b[1]];l=a[b[2]];m=a[b[3]];b=g*g;f=g*b;e[0]=this.interpolate(h[0],k[0],l[0],m[0],g,b,f);e[1]=this.interpolate(h[1],k[1],l[1],m[1],g,b,f);e[2]=this.interpolate(h[2],k[2],l[2],m[2],g,b,f);return e};
-THREE.Animation.prototype.interpolate=function(a,c,b,e,g,h,f){a=(b-a)*0.5;e=(e-c)*0.5;return(2*(c-b)+a+e)*f+(-3*(c-b)-2*a-e)*h+a*g+c};THREE.Animation.prototype.getNextKeyWith=function(a,c,b){var e=this.data.hierarchy[c].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?b=b<e.length-1?b:e.length-1:b%=e.length;b<e.length;b++)if(e[b][a]!==void 0)return e[b];return this.data.hierarchy[c].keys[0]};
-THREE.Animation.prototype.getPrevKeyWith=function(a,c,b){for(var e=this.data.hierarchy[c].keys,b=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?b>0?b:0:b>=0?b:b+e.length;b>=0;b--)if(e[b][a]!==void 0)return e[b];return this.data.hierarchy[c].keys[e.length-1]};
-THREE.CubeCamera=function(a,c,b,e){this.heightOffset=b;this.position=new THREE.Vector3(0,b,0);this.cameraPX=new THREE.PerspectiveCamera(90,1,a,c);this.cameraNX=new THREE.PerspectiveCamera(90,1,a,c);this.cameraPY=new THREE.PerspectiveCamera(90,1,a,c);this.cameraNY=new THREE.PerspectiveCamera(90,1,a,c);this.cameraPZ=new THREE.PerspectiveCamera(90,1,a,c);this.cameraNZ=new THREE.PerspectiveCamera(90,1,a,c);this.cameraPX.position=this.position;this.cameraNX.position=this.position;this.cameraPY.position=
+THREE.Animation.prototype.update=function(a){if(this.isPlaying){var c=["pos","rot","scl"],b,d,f,g,e,h,i,j,k=this.data.JIT.hierarchy,m,o;this.currentTime+=a*this.timeScale;o=this.currentTime;m=this.currentTime%=this.data.length;j=parseInt(Math.min(m*this.data.fps,this.data.length*this.data.fps),10);for(var n=0,t=this.hierarchy.length;n<t;n++)if(a=this.hierarchy[n],i=a.animationCache,this.JITCompile&&k[n][j]!==void 0)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 q=0;q<3;q++){b=c[q];e=i.prevKey[b];h=i.nextKey[b];if(h.time<=o){if(m<o)if(this.loop){e=this.data.hierarchy[n].keys[0];for(h=this.getNextKeyWith(b,n,1);h.time<m;)e=h,h=this.getNextKeyWith(b,n,h.index+1)}else{this.stop();return}else{do e=h,h=this.getNextKeyWith(b,n,h.index+1);while(h.time<
+m)}i.prevKey[b]=e;i.nextKey[b]=h}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;d=(m-e.time)/(h.time-e.time);f=e[b];g=h[b];if(d<0||d>1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+d+" on bone "+n),d=d<0?0:1;if(b==="pos")if(b=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)b.x=f[0]+(g[0]-f[0])*d,b.y=f[1]+(g[1]-f[1])*d,b.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=d*0.33+0.33,f=this.interpolateCatmullRom(this.points,d),b.x=f[0],b.y=f[1],b.z=f[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)d=this.interpolateCatmullRom(this.points,d*1.01),this.target.set(d[0],d[1],d[2]),this.target.subSelf(b),this.target.y=0,this.target.normalize(),d=Math.atan2(this.target.x,this.target.z),a.rotation.set(0,d,0)}else if(b===
+"rot")THREE.Quaternion.slerp(f,g,a.quaternion,d);else if(b==="scl")b=a.scale,b.x=f[0]+(g[0]-f[0])*d,b.y=f[1]+(g[1]-f[1])*d,b.z=f[2]+(g[2]-f[2])*d}}if(this.JITCompile&&k[0][j]===void 0){this.hierarchy[0].update(null,!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,c){var b=[],d=[],f,g,e,h,i,j;f=(a.length-1)*c;g=Math.floor(f);f-=g;b[0]=g===0?g:g-1;b[1]=g;b[2]=g>a.length-2?g:g+1;b[3]=g>a.length-3?g:g+2;g=a[b[0]];h=a[b[1]];i=a[b[2]];j=a[b[3]];b=f*f;e=f*b;d[0]=this.interpolate(g[0],h[0],i[0],j[0],f,b,e);d[1]=this.interpolate(g[1],h[1],i[1],j[1],f,b,e);d[2]=this.interpolate(g[2],h[2],i[2],j[2],f,b,e);return d};
+THREE.Animation.prototype.interpolate=function(a,c,b,d,f,g,e){a=(b-a)*0.5;d=(d-c)*0.5;return(2*(c-b)+a+d)*e+(-3*(c-b)-2*a-d)*g+a*f+c};THREE.Animation.prototype.getNextKeyWith=function(a,c,b){var d=this.data.hierarchy[c].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?b=b<d.length-1?b:d.length-1:b%=d.length;b<d.length;b++)if(d[b][a]!==void 0)return d[b];return this.data.hierarchy[c].keys[0]};
+THREE.Animation.prototype.getPrevKeyWith=function(a,c,b){for(var d=this.data.hierarchy[c].keys,b=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?b>0?b:0:b>=0?b:b+d.length;b>=0;b--)if(d[b][a]!==void 0)return d[b];return this.data.hierarchy[c].keys[d.length-1]};
+THREE.CubeCamera=function(a,c,b,d){this.heightOffset=b;this.position=new THREE.Vector3(0,b,0);this.cameraPX=new THREE.PerspectiveCamera(90,1,a,c);this.cameraNX=new THREE.PerspectiveCamera(90,1,a,c);this.cameraPY=new THREE.PerspectiveCamera(90,1,a,c);this.cameraNY=new THREE.PerspectiveCamera(90,1,a,c);this.cameraPZ=new THREE.PerspectiveCamera(90,1,a,c);this.cameraNZ=new THREE.PerspectiveCamera(90,1,a,c);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=
-new THREE.Vector3(0,0,0);this.renderTarget=new THREE.WebGLRenderTargetCube(e,e,{format:THREE.RGBFormat,magFilter:THREE.LinearFilter,minFilter:THREE.LinearFilter});this.updatePosition=function(a){this.position.copy(a);this.position.y+=this.heightOffset;this.targetPX.copy(this.position);this.targetNX.copy(this.position);this.targetPY.copy(this.position);this.targetNY.copy(this.position);this.targetPZ.copy(this.position);this.targetNZ.copy(this.position);this.targetPX.x+=1;this.targetNX.x-=1;this.targetPY.y+=
-1;this.targetNY.y-=1;this.targetPZ.z+=1;this.targetNZ.z-=1;this.cameraPX.lookAt(this.targetPX);this.cameraNX.lookAt(this.targetNX);this.cameraPY.lookAt(this.targetPY);this.cameraNY.lookAt(this.targetNY);this.cameraPZ.lookAt(this.targetPZ);this.cameraNZ.lookAt(this.targetNZ)};this.updateCubeMap=function(a,b){var e=this.renderTarget;e.activeCubeFace=0;a.render(b,this.cameraPX,e);e.activeCubeFace=1;a.render(b,this.cameraNX,e);e.activeCubeFace=2;a.render(b,this.cameraPY,e);e.activeCubeFace=3;a.render(b,
-this.cameraNY,e);e.activeCubeFace=4;a.render(b,this.cameraPZ,e);e.activeCubeFace=5;a.render(b,this.cameraNZ,e)}};THREE.FirstPersonCamera=function(){console.warn("DEPRECATED: FirstPersonCamera() is FirstPersonControls().")};THREE.PathCamera=function(){console.warn("DEPRECATED: PathCamera() is PathControls().")};THREE.FlyCamera=function(){console.warn("DEPRECATED: FlyCamera() is FlyControls().")};THREE.RollCamera=function(){console.warn("DEPRECATED: RollCamera() is RollControls().")};
-THREE.TrackballCamera=function(){console.warn("DEPRECATED: TrackballCamera() is TrackballControls().")};THREE.CombinedCamera=function(a,c,b,e,g,h,f){THREE.Camera.call(this);this.fov=b;this.left=-a/2;this.right=a/2;this.top=c/2;this.bottom=-c/2;this.cameraO=new THREE.OrthographicCamera(a/-2,a/2,c/2,c/-2,h,f);this.cameraP=new THREE.PerspectiveCamera(b,a/c,e,g);this.zoom=1;this.toPerspective()};THREE.CombinedCamera.prototype=new THREE.Camera;THREE.CombinedCamera.prototype.constructor=THREE.CoolCamera;
+new THREE.Vector3(0,0,0);this.renderTarget=new THREE.WebGLRenderTargetCube(d,d,{format:THREE.RGBFormat,magFilter:THREE.LinearFilter,minFilter:THREE.LinearFilter});this.updatePosition=function(a){this.position.copy(a);this.position.y+=this.heightOffset;this.targetPX.copy(this.position);this.targetNX.copy(this.position);this.targetPY.copy(this.position);this.targetNY.copy(this.position);this.targetPZ.copy(this.position);this.targetNZ.copy(this.position);this.targetPX.x+=1;this.targetNX.x-=1;this.targetPY.y+=
+1;this.targetNY.y-=1;this.targetPZ.z+=1;this.targetNZ.z-=1;this.cameraPX.lookAt(this.targetPX);this.cameraNX.lookAt(this.targetNX);this.cameraPY.lookAt(this.targetPY);this.cameraNY.lookAt(this.targetNY);this.cameraPZ.lookAt(this.targetPZ);this.cameraNZ.lookAt(this.targetNZ)};this.updateCubeMap=function(a,b){var d=this.renderTarget;d.activeCubeFace=0;a.render(b,this.cameraPX,d);d.activeCubeFace=1;a.render(b,this.cameraNX,d);d.activeCubeFace=2;a.render(b,this.cameraPY,d);d.activeCubeFace=3;a.render(b,
+this.cameraNY,d);d.activeCubeFace=4;a.render(b,this.cameraPZ,d);d.activeCubeFace=5;a.render(b,this.cameraNZ,d)}};THREE.FirstPersonCamera=function(){console.warn("DEPRECATED: FirstPersonCamera() is FirstPersonControls().")};THREE.PathCamera=function(){console.warn("DEPRECATED: PathCamera() is PathControls().")};THREE.FlyCamera=function(){console.warn("DEPRECATED: FlyCamera() is FlyControls().")};THREE.RollCamera=function(){console.warn("DEPRECATED: RollCamera() is RollControls().")};
+THREE.TrackballCamera=function(){console.warn("DEPRECATED: TrackballCamera() is TrackballControls().")};THREE.CombinedCamera=function(a,c,b,d,f,g,e){THREE.Camera.call(this);this.fov=b;this.left=-a/2;this.right=a/2;this.top=c/2;this.bottom=-c/2;this.cameraO=new THREE.OrthographicCamera(a/-2,a/2,c/2,c/-2,g,e);this.cameraP=new THREE.PerspectiveCamera(b,a/c,d,f);this.zoom=1;this.toPerspective()};THREE.CombinedCamera.prototype=new THREE.Camera;THREE.CombinedCamera.prototype.constructor=THREE.CoolCamera;
 THREE.CombinedCamera.prototype.toPerspective=function(){this.near=this.cameraP.near;this.far=this.cameraP.far;this.cameraP.fov=this.fov/this.zoom;this.cameraP.updateProjectionMatrix();this.projectionMatrix=this.cameraP.projectionMatrix;this.inPersepectiveMode=!0;this.inOrthographicMode=!1};
 THREE.CombinedCamera.prototype.toOrthographic=function(){var a=Math.tan(this.fov/2)*((this.cameraP.near+this.cameraP.far)/2),c=2*a*this.cameraP.aspect/2;a/=this.zoom;c/=this.zoom;this.cameraO.left=-c;this.cameraO.right=c;this.cameraO.top=a;this.cameraO.bottom=-a;this.cameraO.updateProjectionMatrix();this.near=this.cameraO.near;this.far=this.cameraO.far;this.projectionMatrix=this.cameraO.projectionMatrix;this.inPersepectiveMode=!1;this.inOrthographicMode=!0};
 THREE.CombinedCamera.prototype.setFov=function(a){this.fov=a;this.inPersepectiveMode?this.toPerspective():this.toOrthographic()};THREE.CombinedCamera.prototype.setLens=function(a,c){c||(c=43.25);var b=2*Math.atan(c/(a*2));b*=180/Math.PI;this.setFov(b);return b};THREE.CombinedCamera.prototype.setZoom=function(a){this.zoom=a;this.inPersepectiveMode?this.toPerspective():this.toOrthographic()};
@@ -104,217 +104,216 @@ function(a){switch(a.keyCode){case 38:case 87:this.moveForward=!0;break;case 37:
 this.moveUp&&this.object.translateY(b);this.moveDown&&this.object.translateY(-b);b=a*this.lookSpeed;this.activeLook||(b=0);this.lon+=this.mouseX*b;this.lookVertical&&(this.lat-=this.mouseY*b);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;var a=this.target,c=this.object.position;a.x=c.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=c.y+100*Math.cos(this.phi);a.z=c.z+100*Math.sin(this.phi)*Math.sin(this.theta)}a=1;this.constrainVertical&&
 (a=Math.PI/(this.verticalMax-this.verticalMin));this.lon+=this.mouseX*b;this.lookVertical&&(this.lat-=this.mouseY*b*a);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;if(this.constrainVertical)this.phi=THREE.Math.mapLinear(this.phi,0,Math.PI,this.verticalMin,this.verticalMax);a=this.target;c=this.object.position;a.x=c.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=c.y+100*Math.cos(this.phi);a.z=c.z+100*Math.sin(this.phi)*Math.sin(this.theta);
 this.object.lookAt(a)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",b(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",b(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",b(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",b(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",b(this,this.onKeyUp),!1)};
-THREE.PathControls=function(a,c){function b(a){if((a*=2)<1)return 0.5*a*a;return-0.5*(--a*(a-2)-1)}function e(a,b){return function(){b.apply(a,arguments)}}function g(a,b,e,c){var f={name:e,fps:0.6,length:c,hierarchy:[]},h,g=b.getControlPointsArray(),k=b.getLength(),x=g.length,v=0;h=x-1;b={parent:-1,keys:[]};b.keys[0]={time:0,pos:g[0],rot:[0,0,0,1],scl:[1,1,1]};b.keys[h]={time:c,pos:g[h],rot:[0,0,0,1],scl:[1,1,1]};for(h=1;h<x-1;h++)v=c*k.chunks[h]/k.total,b.keys[h]={time:v,pos:g[h]};f.hierarchy[0]=
-b;THREE.AnimationHandler.add(f);return new THREE.Animation(a,e,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function h(a,b){var e,c,f=new THREE.Geometry;for(e=0;e<a.points.length*b;e++)c=e/(a.points.length*b),c=a.getPoint(c),f.vertices[e]=new THREE.Vertex(new THREE.Vector3(c.x,c.y,c.z));return f}this.object=a;this.domElement=c!==void 0?c:document;this.id="PathControls"+THREE.PathControlsIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=
+THREE.PathControls=function(a,c){function b(a){if((a*=2)<1)return 0.5*a*a;return-0.5*(--a*(a-2)-1)}function d(a,b){return function(){b.apply(a,arguments)}}function f(a,b,d,c){var e={name:d,fps:0.6,length:c,hierarchy:[]},g,f=b.getControlPointsArray(),h=b.getLength(),r=f.length,p=0;g=r-1;b={parent:-1,keys:[]};b.keys[0]={time:0,pos:f[0],rot:[0,0,0,1],scl:[1,1,1]};b.keys[g]={time:c,pos:f[g],rot:[0,0,0,1],scl:[1,1,1]};for(g=1;g<r-1;g++)p=c*h.chunks[g]/h.total,b.keys[g]={time:p,pos:f[g]};e.hierarchy[0]=
+b;THREE.AnimationHandler.add(e);return new THREE.Animation(a,d,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function g(a,b){var d,c,e=new THREE.Geometry;for(d=0;d<a.points.length*b;d++)c=d/(a.points.length*b),c=a.getPoint(c),e.vertices[d]=new THREE.Vertex(new THREE.Vector3(c.x,c.y,c.z));return e}this.object=a;this.domElement=c!==void 0?c:document;this.id="PathControls"+THREE.PathControlsIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=
 new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.0050;this.lookHorizontal=this.lookVertical=!0;this.verticalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.horizontalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.target=new THREE.Object3D;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=
-this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));var f=Math.PI*2,k=Math.PI/180;this.update=function(a){var e;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed*a);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed*a);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*k;this.theta=this.lon*k;a=this.phi%f;this.phi=a>=0?a:a+f;e=this.verticalAngleMap.srcRange;
-a=this.verticalAngleMap.dstRange;e=THREE.Math.mapLinear(this.phi,e[0],e[1],a[0],a[1]);var c=a[1]-a[0];this.phi=b((e-a[0])/c)*c+a[0];e=this.horizontalAngleMap.srcRange;a=this.horizontalAngleMap.dstRange;e=THREE.Math.mapLinear(this.theta,e[0],e[1],a[0],a[1]);c=a[1]-a[0];this.theta=b((e-a[0])/c)*c+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=
+this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));var e=Math.PI*2,h=Math.PI/180;this.update=function(a){var d;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=a>=0?a:a+e;d=this.verticalAngleMap.srcRange;
+a=this.verticalAngleMap.dstRange;d=THREE.Math.mapLinear(this.phi,d[0],d[1],a[0],a[1]);var c=a[1]-a[0];this.phi=b((d-a[0])/c)*c+a[0];d=this.horizontalAngleMap.srcRange;a=this.horizontalAngleMap.dstRange;d=THREE.Math.mapLinear(this.theta,d[0],d[1],a[0],a[1]);c=a[1]-a[0];this.theta=b((d-a[0])/c)*c+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===document?(this.mouseX=a.pageX-this.viewHalfX,this.mouseY=a.pageY-this.viewHalfY):(this.mouseX=a.pageX-this.domElement.offsetLeft-this.viewHalfX,this.mouseY=a.pageY-this.domElement.offsetTop-this.viewHalfY)};this.init=function(){this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){var a=new THREE.MeshLambertMaterial({color:30719}),b=new THREE.MeshLambertMaterial({color:65280}),
-c=new THREE.CubeGeometry(10,10,20),f=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(c,a);a=new THREE.Mesh(f,b);a.position.set(0,10,0);this.animation=g(this.animationParent,this.spline,this.id,this.duration);this.animationParent.add(this.object);this.animationParent.add(this.target);this.animationParent.add(a)}else this.animation=g(this.animationParent,this.spline,this.id,this.duration),this.animationParent.add(this.target),this.animationParent.add(this.object);if(this.createDebugPath){var a=
-this.debugPath,b=this.spline,c=h(b,10),f=h(b,10),k=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(c,k);particleObj=new THREE.ParticleSystem(f,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);a.add(lineObj);particleObj.scale.set(1,1,1);a.add(particleObj);f=new THREE.SphereGeometry(1,16,8);k=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<b.points.length;i++)c=new THREE.Mesh(f,k),c.position.copy(b.points[i]),a.add(c)}this.domElement.addEventListener("mousemove",
-e(this,this.onMouseMove),!1)}};THREE.PathControlsIdCounter=0;
+c=new THREE.CubeGeometry(10,10,20),e=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(c,a);a=new THREE.Mesh(e,b);a.position.set(0,10,0);this.animation=f(this.animationParent,this.spline,this.id,this.duration);this.animationParent.add(this.object);this.animationParent.add(this.target);this.animationParent.add(a)}else this.animation=f(this.animationParent,this.spline,this.id,this.duration),this.animationParent.add(this.target),this.animationParent.add(this.object);if(this.createDebugPath){var a=
+this.debugPath,b=this.spline,e=g(b,10),c=g(b,10),h=new THREE.LineBasicMaterial({color:16711680,linewidth:3}),e=new THREE.Line(e,h),c=new THREE.ParticleSystem(c,new THREE.ParticleBasicMaterial({color:16755200,size:3}));e.scale.set(1,1,1);a.add(e);c.scale.set(1,1,1);a.add(c);for(var e=new THREE.SphereGeometry(1,16,8),h=new THREE.MeshBasicMaterial({color:65280}),n=0;n<b.points.length;n++)c=new THREE.Mesh(e,h),c.position.copy(b.points[n]),a.add(c)}this.domElement.addEventListener("mousemove",d(this,this.onMouseMove),
+!1)}};THREE.PathControlsIdCounter=0;
 THREE.FlyControls=function(a,c){function b(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.domElement=c!==void 0?c:document;c&&this.domElement.setAttribute("tabindex",-1);this.movementSpeed=1;this.rollSpeed=0.0050;this.autoForward=this.dragToLook=!1;this.object.useQuaternion=!0;this.tmpQuaternion=new THREE.Quaternion;this.mouseStatus=0;this.moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0};this.moveVector=new THREE.Vector3(0,
 0,0);this.rotationVector=new THREE.Vector3(0,0,0);this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.keydown=function(a){if(!a.altKey){switch(a.keyCode){case 16:this.movementSpeedMultiplier=0.1;break;case 87:this.moveState.forward=1;break;case 83:this.moveState.back=1;break;case 65:this.moveState.left=1;break;case 68:this.moveState.right=1;break;case 82:this.moveState.up=1;break;case 70:this.moveState.down=1;break;case 38:this.moveState.pitchUp=1;break;case 40:this.moveState.pitchDown=
 1;break;case 37:this.moveState.yawLeft=1;break;case 39:this.moveState.yawRight=1;break;case 81:this.moveState.rollLeft=1;break;case 69:this.moveState.rollRight=1}this.updateMovementVector();this.updateRotationVector()}};this.keyup=function(a){switch(a.keyCode){case 16:this.movementSpeedMultiplier=1;break;case 87:this.moveState.forward=0;break;case 83:this.moveState.back=0;break;case 65:this.moveState.left=0;break;case 68:this.moveState.right=0;break;case 82:this.moveState.up=0;break;case 70:this.moveState.down=
 0;break;case 38:this.moveState.pitchUp=0;break;case 40:this.moveState.pitchDown=0;break;case 37:this.moveState.yawLeft=0;break;case 39:this.moveState.yawRight=0;break;case 81:this.moveState.rollLeft=0;break;case 69:this.moveState.rollRight=0}this.updateMovementVector();this.updateRotationVector()};this.mousedown=function(a){this.domElement!==document&&this.domElement.focus();a.preventDefault();a.stopPropagation();if(this.dragToLook)this.mouseStatus++;else switch(a.button){case 0:this.object.moveForward=
-!0;break;case 2:this.object.moveBackward=!0}};this.mousemove=function(a){if(!this.dragToLook||this.mouseStatus>0){var b=this.getContainerDimensions(),c=b.size[0]/2,f=b.size[1]/2;this.moveState.yawLeft=-(a.pageX-b.offset[0]-c)/c;this.moveState.pitchDown=(a.pageY-b.offset[1]-f)/f;this.updateRotationVector()}};this.mouseup=function(a){a.preventDefault();a.stopPropagation();if(this.dragToLook)this.mouseStatus--,this.moveState.yawLeft=this.moveState.pitchDown=0;else switch(a.button){case 0:this.moveForward=
+!0;break;case 2:this.object.moveBackward=!0}};this.mousemove=function(a){if(!this.dragToLook||this.mouseStatus>0){var b=this.getContainerDimensions(),c=b.size[0]/2,e=b.size[1]/2;this.moveState.yawLeft=-(a.pageX-b.offset[0]-c)/c;this.moveState.pitchDown=(a.pageY-b.offset[1]-e)/e;this.updateRotationVector()}};this.mouseup=function(a){a.preventDefault();a.stopPropagation();if(this.dragToLook)this.mouseStatus--,this.moveState.yawLeft=this.moveState.pitchDown=0;else switch(a.button){case 0:this.moveForward=
 !1;break;case 2:this.moveBackward=!1}this.updateRotationVector()};this.update=function(a){var b=a*this.movementSpeed;a*=this.rollSpeed;this.object.translateX(this.moveVector.x*b);this.object.translateY(this.moveVector.y*b);this.object.translateZ(this.moveVector.z*b);this.tmpQuaternion.set(this.rotationVector.x*a,this.rotationVector.y*a,this.rotationVector.z*a,1).normalize();this.object.quaternion.multiplySelf(this.tmpQuaternion);this.object.matrix.setPosition(this.object.position);this.object.matrix.setRotationFromQuaternion(this.object.quaternion);
 this.object.matrixWorldNeedsUpdate=!0};this.updateMovementVector=function(){var a=this.moveState.forward||this.autoForward&&!this.moveState.back?1:0;this.moveVector.x=-this.moveState.left+this.moveState.right;this.moveVector.y=-this.moveState.down+this.moveState.up;this.moveVector.z=-a+this.moveState.back};this.updateRotationVector=function(){this.rotationVector.x=-this.moveState.pitchDown+this.moveState.pitchUp;this.rotationVector.y=-this.moveState.yawRight+this.moveState.yawLeft;this.rotationVector.z=
 -this.moveState.rollRight+this.moveState.rollLeft};this.getContainerDimensions=function(){return this.domElement!=document?{size:[this.domElement.offsetWidth,this.domElement.offsetHeight],offset:[this.domElement.offsetLeft,this.domElement.offsetTop]}:{size:[window.innerWidth,window.innerHeight],offset:[0,0]}};this.domElement.addEventListener("mousemove",b(this,this.mousemove),!1);this.domElement.addEventListener("mousedown",b(this,this.mousedown),!1);this.domElement.addEventListener("mouseup",b(this,
 this.mouseup),!1);this.domElement.addEventListener("keydown",b(this,this.keydown),!1);this.domElement.addEventListener("keyup",b(this,this.keyup),!1);this.updateMovementVector();this.updateRotationVector()};
-THREE.RollControls=function(a,c){this.object=a;this.domElement=c!==void 0?c:document;this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.object.matrixAutoUpdate=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;var b=new THREE.Vector3,e=new THREE.Vector3,g=new THREE.Vector3,h=new THREE.Matrix4,f=!1,k=1,l=0,m=0,n=0,o=0,u=0,p=window.innerWidth/2,z=window.innerHeight/2;this.update=function(a){if(this.mouseLook){var c=a*this.lookSpeed;
-this.rotateHorizontally(c*o);this.rotateVertically(c*u)}c=a*this.movementSpeed;this.object.translateZ(-c*(l>0||this.autoForward&&!(l<0)?1:l));this.object.translateX(c*m);this.object.translateY(c*n);f&&(this.roll+=this.rollSpeed*a*k);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize();else if(this.forward.y<this.constrainVertical[0])this.forward.y=this.constrainVertical[0],this.forward.normalize();g.copy(this.forward);e.set(0,1,0);b.cross(e,
-g).normalize();e.cross(g,b).normalize();this.object.matrix.n11=b.x;this.object.matrix.n12=e.x;this.object.matrix.n13=g.x;this.object.matrix.n21=b.y;this.object.matrix.n22=e.y;this.object.matrix.n23=g.y;this.object.matrix.n31=b.z;this.object.matrix.n32=e.z;this.object.matrix.n33=g.z;h.identity();h.n11=Math.cos(this.roll);h.n12=-Math.sin(this.roll);h.n21=Math.sin(this.roll);h.n22=Math.cos(this.roll);this.object.matrix.multiplySelf(h);this.object.matrixWorldNeedsUpdate=!0;this.object.matrix.n14=this.object.position.x;
+THREE.RollControls=function(a,c){this.object=a;this.domElement=c!==void 0?c:document;this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.object.matrixAutoUpdate=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;var b=new THREE.Vector3,d=new THREE.Vector3,f=new THREE.Vector3,g=new THREE.Matrix4,e=!1,h=1,i=0,j=0,k=0,m=0,o=0,n=window.innerWidth/2,t=window.innerHeight/2;this.update=function(a){if(this.mouseLook){var c=a*this.lookSpeed;
+this.rotateHorizontally(c*m);this.rotateVertically(c*o)}c=a*this.movementSpeed;this.object.translateZ(-c*(i>0||this.autoForward&&!(i<0)?1:i));this.object.translateX(c*j);this.object.translateY(c*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);b.cross(d,
+f).normalize();d.cross(f,b).normalize();this.object.matrix.n11=b.x;this.object.matrix.n12=d.x;this.object.matrix.n13=f.x;this.object.matrix.n21=b.y;this.object.matrix.n22=d.y;this.object.matrix.n23=f.y;this.object.matrix.n31=b.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){b.set(this.object.matrix.n11,this.object.matrix.n21,this.object.matrix.n31);b.multiplyScalar(a);this.forward.subSelf(b);this.forward.normalize()};this.rotateVertically=function(a){e.set(this.object.matrix.n12,this.object.matrix.n22,this.object.matrix.n32);e.multiplyScalar(a);this.forward.addSelf(e);this.forward.normalize()};this.domElement.addEventListener("contextmenu",
-function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){o=(a.clientX-p)/window.innerWidth;u=(a.clientY-z)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:l=1;break;case 2:l=-1}},!1);this.domElement.addEventListener("mouseup",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:l=0;break;case 2:l=0}},!1);this.domElement.addEventListener("keydown",
-function(a){switch(a.keyCode){case 38:case 87:l=1;break;case 37:case 65:m=-1;break;case 40:case 83:l=-1;break;case 39:case 68:m=1;break;case 81:f=!0;k=1;break;case 69:f=!0;k=-1;break;case 82:n=1;break;case 70:n=-1}},!1);this.domElement.addEventListener("keyup",function(a){switch(a.keyCode){case 38:case 87:l=0;break;case 37:case 65:m=0;break;case 40:case 83:l=0;break;case 39:case 68:m=0;break;case 81:f=!1;break;case 69:f=!1;break;case 82:n=0;break;case 70:n=0}},!1)};
-THREE.TrackballControls=function(a,c){var b=this,e={NONE:-1,ROTATE:0,ZOOM:1,PAN:2};this.object=a;this.domElement=c!==void 0?c: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=!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 g=!1,h=e.NONE,f=new THREE.Vector3,k=new THREE.Vector3,l=new THREE.Vector3,m=new THREE.Vector2,n=new THREE.Vector2,o=new THREE.Vector2,u=new THREE.Vector2;this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.getMouseOnScreen=function(a,c){return new THREE.Vector2((a-b.screen.offsetLeft)/b.radius*0.5,(c-b.screen.offsetTop)/b.radius*0.5)};this.getMouseProjectionOnBall=function(a,c){var e=new THREE.Vector3((a-b.screen.width*0.5-b.screen.offsetLeft)/
-b.radius,(b.screen.height*0.5+b.screen.offsetTop-c)/b.radius,0),h=e.length();h>1?e.normalize():e.z=Math.sqrt(1-h*h);f.copy(b.object.position).subSelf(b.target);h=b.object.up.clone().setLength(e.y);h.addSelf(b.object.up.clone().crossSelf(f).setLength(e.x));h.addSelf(f.setLength(e.z));return h};this.rotateCamera=function(){var a=Math.acos(k.dot(l)/k.length()/l.length());if(a){var c=(new THREE.Vector3).cross(k,l).normalize(),e=new THREE.Quaternion;a*=b.rotateSpeed;e.setFromAxisAngle(c,-a);e.multiplyVector3(f);
-e.multiplyVector3(b.object.up);e.multiplyVector3(l);b.staticMoving?k=l:(e.setFromAxisAngle(c,a*(b.dynamicDampingFactor-1)),e.multiplyVector3(k))}};this.zoomCamera=function(){var a=1+(n.y-m.y)*b.zoomSpeed;a!==1&&a>0&&(f.multiplyScalar(a),b.staticMoving?m=n:m.y+=(n.y-m.y)*this.dynamicDampingFactor)};this.panCamera=function(){var a=u.clone().subSelf(o);if(a.lengthSq()){a.multiplyScalar(f.length()*b.panSpeed);var c=f.clone().crossSelf(b.object.up).setLength(a.x);c.addSelf(b.object.up.clone().setLength(a.y));
-b.object.position.addSelf(c);b.target.addSelf(c);b.staticMoving?o=u:o.addSelf(a.sub(u,o).multiplyScalar(b.dynamicDampingFactor))}};this.checkDistances=function(){if(!b.noZoom||!b.noPan)b.object.position.lengthSq()>b.maxDistance*b.maxDistance&&b.object.position.setLength(b.maxDistance),f.lengthSq()<b.minDistance*b.minDistance&&b.object.position.add(b.target,f.setLength(b.minDistance))};this.update=function(){f.copy(b.object.position).subSelf(this.target);b.rotateCamera();b.noZoom||b.zoomCamera();b.noPan||
-b.panCamera();b.object.position.add(b.target,f);b.checkDistances();b.object.lookAt(b.target)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){b.enabled&&(g&&(k=l=b.getMouseProjectionOnBall(a.clientX,a.clientY),m=n=b.getMouseOnScreen(a.clientX,a.clientY),o=u=b.getMouseOnScreen(a.clientX,a.clientY),g=!1),h!==e.NONE&&(h===e.ROTATE?l=b.getMouseProjectionOnBall(a.clientX,a.clientY):h===e.ZOOM&&!b.noZoom?n=b.getMouseOnScreen(a.clientX,
-a.clientY):h===e.PAN&&!b.noPan&&(u=b.getMouseOnScreen(a.clientX,a.clientY))))},!1);this.domElement.addEventListener("mousedown",function(a){if(b.enabled&&(a.preventDefault(),a.stopPropagation(),h===e.NONE))h=a.button,h===e.ROTATE?k=l=b.getMouseProjectionOnBall(a.clientX,a.clientY):h===e.ZOOM&&!b.noZoom?m=n=b.getMouseOnScreen(a.clientX,a.clientY):this.noPan||(o=u=b.getMouseOnScreen(a.clientX,a.clientY))},!1);this.domElement.addEventListener("mouseup",function(a){if(b.enabled)a.preventDefault(),a.stopPropagation(),
-h=e.NONE},!1);window.addEventListener("keydown",function(a){if(b.enabled&&h===e.NONE){if(a.keyCode===b.keys[e.ROTATE])h=e.ROTATE;else if(a.keyCode===b.keys[e.ZOOM]&&!b.noZoom)h=e.ZOOM;else if(a.keyCode===b.keys[e.PAN]&&!b.noPan)h=e.PAN;h!==e.NONE&&(g=!0)}},!1);window.addEventListener("keyup",function(){if(b.enabled&&h!==e.NONE)h=e.NONE},!1)};
-THREE.CubeGeometry=function(a,c,b,e,g,h,f,k){function l(a,b,c,f,k,l,n,p){var o,u,v=e||1,t=g||1,w=k/2,x=l/2,z=m.vertices.length;if(a==="x"&&b==="y"||a==="y"&&b==="x")o="z";else if(a==="x"&&b==="z"||a==="z"&&b==="x")o="y",t=h||1;else if(a==="z"&&b==="y"||a==="y"&&b==="z")o="x",v=h||1;var y=v+1,O=t+1;k/=v;var R=l/t;for(u=0;u<O;u++)for(l=0;l<y;l++){var U=new THREE.Vector3;U[a]=(l*k-w)*c;U[b]=(u*R-x)*f;U[o]=n;m.vertices.push(new THREE.Vertex(U))}for(u=0;u<t;u++)for(l=0;l<v;l++)m.faces.push(new THREE.Face4(l+
-y*u+z,l+y*(u+1)+z,l+1+y*(u+1)+z,l+1+y*u+z,null,null,p)),m.faceVertexUvs[0].push([new THREE.UV(l/v,u/t),new THREE.UV(l/v,(u+1)/t),new THREE.UV((l+1)/v,(u+1)/t),new THREE.UV((l+1)/v,u/t)])}THREE.Geometry.call(this);var m=this,n=a/2,o=c/2,u=b/2,p,z,w,x,v,y;if(f!==void 0){if(f instanceof Array)this.materials=f;else{this.materials=[];for(p=0;p<6;p++)this.materials.push(f)}p=0;x=1;z=2;v=3;w=4;y=5}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(k!=void 0)for(var t in k)this.sides[t]!=
-void 0&&(this.sides[t]=k[t]);this.sides.px&&l("z","y",-1,-1,b,c,n,p);this.sides.nx&&l("z","y",1,-1,b,c,-n,x);this.sides.py&&l("x","z",1,1,a,b,o,z);this.sides.ny&&l("x","z",1,-1,a,b,-o,v);this.sides.pz&&l("x","y",1,-1,a,c,u,w);this.sides.nz&&l("x","y",-1,-1,a,c,-u,y);this.mergeVertices();this.computeCentroids();this.computeFaceNormals()};THREE.CubeGeometry.prototype=new THREE.Geometry;THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
-THREE.CylinderGeometry=function(a,c,b,e,g,h){THREE.Geometry.call(this);var a=a!=null?a:20,c=c!=null?c:20,b=b||100,f=b/2,e=e||8,g=g||1,k,l,m=[],n=[];for(l=0;l<=g;l++){var o=[],u=[],p=l/g,z=p*(c-a)+a;for(k=0;k<=e;k++){var w=k/e;this.vertices.push(new THREE.Vertex(new THREE.Vector3(z*Math.sin(w*Math.PI*2),-p*b+f,z*Math.cos(w*Math.PI*2))));o.push(this.vertices.length-1);u.push(new THREE.UV(w,p))}m.push(o);n.push(u)}for(l=0;l<g;l++)for(k=0;k<e;k++){var b=m[l][k],o=m[l+1][k],u=m[l+1][k+1],p=m[l][k+1],z=
-this.vertices[b].position.clone().setY(0).normalize(),w=this.vertices[o].position.clone().setY(0).normalize(),x=this.vertices[u].position.clone().setY(0).normalize(),v=this.vertices[p].position.clone().setY(0).normalize(),y=n[l][k].clone(),t=n[l+1][k].clone(),A=n[l+1][k+1].clone(),D=n[l][k+1].clone();this.faces.push(new THREE.Face4(b,o,u,p,[z,w,x,v]));this.faceVertexUvs[0].push([y,t,A,D])}if(!h&&a>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,f,0)));for(k=0;k<e;k++)b=m[0][k],o=m[0][k+
-1],u=this.vertices.length-1,z=new THREE.Vector3(0,1,0),w=new THREE.Vector3(0,1,0),x=new THREE.Vector3(0,1,0),y=n[0][k].clone(),t=n[0][k+1].clone(),A=new THREE.UV(t.u,0),this.faces.push(new THREE.Face3(b,o,u,[z,w,x])),this.faceVertexUvs[0].push([y,t,A])}if(!h&&c>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-f,0)));for(k=0;k<e;k++)b=m[l][k+1],o=m[l][k],u=this.vertices.length-1,z=new THREE.Vector3(0,-1,0),w=new THREE.Vector3(0,-1,0),x=new THREE.Vector3(0,-1,0),y=n[l][k+1].clone(),t=n[l][k].clone(),
-A=new THREE.UV(t.u,1),this.faces.push(new THREE.Face3(b,o,u,[z,w,x])),this.faceVertexUvs[0].push([y,t,A])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
-THREE.ExtrudeGeometry=function(a,c){if(typeof a!=="undefined"){THREE.Geometry.call(this);var a=a instanceof Array?a:[a],b,e=a.length,g;this.shapebb=a[e-1].getBoundingBox();for(b=0;b<e;b++)g=a[b],this.addShape(g,c);this.computeCentroids();this.computeFaceNormals()}};THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;
-THREE.ExtrudeGeometry.prototype.addShape=function(a,c){function b(a,b,c){b||console.log("die");return b.clone().multiplyScalar(c).addSelf(a)}function e(a,b,c){var e=THREE.ExtrudeGeometry.__v1,f=THREE.ExtrudeGeometry.__v2,h=THREE.ExtrudeGeometry.__v3,g=THREE.ExtrudeGeometry.__v4,k=THREE.ExtrudeGeometry.__v5,l=THREE.ExtrudeGeometry.__v6;e.set(a.x-b.x,a.y-b.y);f.set(a.x-c.x,a.y-c.y);e=e.normalize();f=f.normalize();h.set(-e.y,e.x);g.set(f.y,-f.x);k.copy(a).addSelf(h);l.copy(a).addSelf(g);if(k.equals(l))return g.clone();
-k.copy(b).addSelf(h);l.copy(c).addSelf(g);h=e.dot(g);g=l.subSelf(k).dot(g);h===0&&(console.log("Either infinite or no solutions!"),g===0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));g/=h;if(g<0)return b=Math.atan2(b.y-a.y,b.x-a.x),a=Math.atan2(c.y-a.y,c.x-a.x),b>a&&(a+=Math.PI*2),anglec=(b+a)/2,new THREE.Vector2(-Math.cos(anglec),-Math.sin(anglec));return e.multiplyScalar(g).addSelf(k).subSelf(a).clone()}function g(a){for(B=a.length;--B>=0;){S=B;T=B-1;T<0&&(T=a.length-
-1);for(var b=0,c=p+n*2,b=0;b<c;b++){var e=P*b,f=P*(b+1),h=X+S+e,g=X+S+f,m=h,e=X+T+e,f=X+T+f,o=g;m+=K;e+=K;f+=K;o+=K;G.faces.push(new THREE.Face4(m,e,f,o,null,null,A));A&&(m=b/c,e=(b+1)/c,f=k+l*2,h=(G.vertices[h].position.z+l)/f,g=(G.vertices[g].position.z+l)/f,G.faceVertexUvs[0].push([new THREE.UV(h,m),new THREE.UV(g,m),new THREE.UV(g,e),new THREE.UV(h,e)]))}}}function h(a,b,c){G.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function f(a,b,c){a+=K;b+=K;c+=K;G.faces.push(new THREE.Face3(a,
-b,c,null,null,t));if(t){var e=D.maxY,f=D.maxX,h=G.vertices[b].position.x,b=G.vertices[b].position.y,g=G.vertices[c].position.x,c=G.vertices[c].position.y;G.faceVertexUvs[0].push([new THREE.UV(G.vertices[a].position.x/f,G.vertices[a].position.y/e),new THREE.UV(h/f,b/e),new THREE.UV(g/f,c/e)])}}var k=c.amount!==void 0?c.amount:100,l=c.bevelThickness!==void 0?c.bevelThickness:6,m=c.bevelSize!==void 0?c.bevelSize:l-2,n=c.bevelSegments!==void 0?c.bevelSegments:3,o=c.bevelEnabled!==void 0?c.bevelEnabled:
-!0,u=c.curveSegments!==void 0?c.curveSegments:12,p=c.steps!==void 0?c.steps:1,z=c.bendPath,w=c.extrudePath,x,v=!1,y=c.useSpacedPoints!==void 0?c.useSpacedPoints:!1,t=c.material,A=c.extrudeMaterial,D=this.shapebb;if(w)x=w.getPoints(u),p=x.length,v=!0,o=!1;o||(m=l=n=0);var C,E,I,G=this,K=this.vertices.length;z&&a.addWrapPath(z);u=y?a.extractAllSpacedPoints(u):a.extractAllPoints(u);z=u.shape;u=u.holes;if(w=!THREE.Shape.Utils.isClockWise(z)){z=z.reverse();E=0;for(I=u.length;E<I;E++)C=u[E],THREE.Shape.Utils.isClockWise(C)&&
-(u[E]=C.reverse());w=!1}w=THREE.Shape.Utils.triangulateShape(z,u);y=z;E=0;for(I=u.length;E<I;E++)C=u[E],z=z.concat(C);var B,F,J,M,N,L,P=z.length,H=w.length,Q=[];B=0;F=y.length;S=F-1;for(T=B+1;B<F;B++,S++,T++)S===F&&(S=0),T===F&&(T=0),Q[B]=e(y[B],y[S],y[T]);var O=[],R,U=Q.concat();E=0;for(I=u.length;E<I;E++){C=u[E];R=[];B=0;F=C.length;S=F-1;for(T=B+1;B<F;B++,S++,T++)S===F&&(S=0),T===F&&(T=0),R[B]=e(C[B],C[S],C[T]);O.push(R);U=U.concat(R)}for(J=0;J<n;J++){M=J/n;N=l*(1-M);M=m*Math.sin(M*Math.PI/2);B=
-0;for(F=y.length;B<F;B++)L=b(y[B],Q[B],M),h(L.x,L.y,-N);E=0;for(I=u.length;E<I;E++){C=u[E];R=O[E];B=0;for(F=C.length;B<F;B++)L=b(C[B],R[B],M),h(L.x,L.y,-N)}}M=m;for(B=0;B<P;B++)L=o?b(z[B],U[B],M):z[B],v?h(L.x,L.y+x[0].y,x[0].x):h(L.x,L.y,0);for(J=1;J<=p;J++)for(B=0;B<P;B++)L=o?b(z[B],U[B],M):z[B],v?h(L.x,L.y+x[J-1].y,x[J-1].x):h(L.x,L.y,k/p*J);for(J=n-1;J>=0;J--){M=J/n;N=l*(1-M);M=m*Math.sin(M*Math.PI/2);B=0;for(F=y.length;B<F;B++)L=b(y[B],Q[B],M),h(L.x,L.y,k+N);E=0;for(I=u.length;E<I;E++){C=u[E];
-R=O[E];B=0;for(F=C.length;B<F;B++)L=b(C[B],R[B],M),v?h(L.x,L.y+x[p-1].y,x[p-1].x+N):h(L.x,L.y,k+N)}}if(o){o=P*0;for(B=0;B<H;B++)m=w[B],f(m[2]+o,m[1]+o,m[0]+o);o=P*(p+n*2);for(B=0;B<H;B++)m=w[B],f(m[0]+o,m[1]+o,m[2]+o)}else{for(B=0;B<H;B++)m=w[B],f(m[2],m[1],m[0]);for(B=0;B<H;B++)m=w[B],f(m[0]+P*p,m[1]+P*p,m[2]+P*p)}var S,T,X=0;g(y);X+=y.length;E=0;for(I=u.length;E<I;E++)C=u[E],g(C),X+=C.length};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;THREE.ExtrudeGeometry.__v2=new THREE.Vector2;
+a;this.object.position.y-=this.object.matrix.n23*a;this.object.position.z-=this.object.matrix.n33*a};this.rotateHorizontally=function(a){b.set(this.object.matrix.n11,this.object.matrix.n21,this.object.matrix.n31);b.multiplyScalar(a);this.forward.subSelf(b);this.forward.normalize()};this.rotateVertically=function(a){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){m=(a.clientX-n)/window.innerWidth;o=(a.clientY-t)/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)};
+THREE.TrackballControls=function(a,c){var b=this,d={NONE:-1,ROTATE:0,ZOOM:1,PAN:2};this.object=a;this.domElement=c!==void 0?c: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=!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 f=!1,g=d.NONE,e=new THREE.Vector3,h=new THREE.Vector3,i=new THREE.Vector3,j=new THREE.Vector2,k=new THREE.Vector2,m=new THREE.Vector2,o=new THREE.Vector2;this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.getMouseOnScreen=function(a,c){return new THREE.Vector2((a-b.screen.offsetLeft)/b.radius*0.5,(c-b.screen.offsetTop)/b.radius*0.5)};this.getMouseProjectionOnBall=function(a,c){var d=new THREE.Vector3((a-b.screen.width*0.5-b.screen.offsetLeft)/
+b.radius,(b.screen.height*0.5+b.screen.offsetTop-c)/b.radius,0),g=d.length();g>1?d.normalize():d.z=Math.sqrt(1-g*g);e.copy(b.object.position).subSelf(b.target);g=b.object.up.clone().setLength(d.y);g.addSelf(b.object.up.clone().crossSelf(e).setLength(d.x));g.addSelf(e.setLength(d.z));return g};this.rotateCamera=function(){var a=Math.acos(h.dot(i)/h.length()/i.length());if(a){var c=(new THREE.Vector3).cross(h,i).normalize(),d=new THREE.Quaternion;a*=b.rotateSpeed;d.setFromAxisAngle(c,-a);d.multiplyVector3(e);
+d.multiplyVector3(b.object.up);d.multiplyVector3(i);b.staticMoving?h=i:(d.setFromAxisAngle(c,a*(b.dynamicDampingFactor-1)),d.multiplyVector3(h))}};this.zoomCamera=function(){var a=1+(k.y-j.y)*b.zoomSpeed;a!==1&&a>0&&(e.multiplyScalar(a),b.staticMoving?j=k:j.y+=(k.y-j.y)*this.dynamicDampingFactor)};this.panCamera=function(){var a=o.clone().subSelf(m);if(a.lengthSq()){a.multiplyScalar(e.length()*b.panSpeed);var c=e.clone().crossSelf(b.object.up).setLength(a.x);c.addSelf(b.object.up.clone().setLength(a.y));
+b.object.position.addSelf(c);b.target.addSelf(c);b.staticMoving?m=o:m.addSelf(a.sub(o,m).multiplyScalar(b.dynamicDampingFactor))}};this.checkDistances=function(){if(!b.noZoom||!b.noPan)b.object.position.lengthSq()>b.maxDistance*b.maxDistance&&b.object.position.setLength(b.maxDistance),e.lengthSq()<b.minDistance*b.minDistance&&b.object.position.add(b.target,e.setLength(b.minDistance))};this.update=function(){e.copy(b.object.position).subSelf(this.target);b.rotateCamera();b.noZoom||b.zoomCamera();b.noPan||
+b.panCamera();b.object.position.add(b.target,e);b.checkDistances();b.object.lookAt(b.target)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){b.enabled&&(f&&(h=i=b.getMouseProjectionOnBall(a.clientX,a.clientY),j=k=b.getMouseOnScreen(a.clientX,a.clientY),m=o=b.getMouseOnScreen(a.clientX,a.clientY),f=!1),g!==d.NONE&&(g===d.ROTATE?i=b.getMouseProjectionOnBall(a.clientX,a.clientY):g===d.ZOOM&&!b.noZoom?k=b.getMouseOnScreen(a.clientX,
+a.clientY):g===d.PAN&&!b.noPan&&(o=b.getMouseOnScreen(a.clientX,a.clientY))))},!1);this.domElement.addEventListener("mousedown",function(a){if(b.enabled&&(a.preventDefault(),a.stopPropagation(),g===d.NONE))g=a.button,g===d.ROTATE?h=i=b.getMouseProjectionOnBall(a.clientX,a.clientY):g===d.ZOOM&&!b.noZoom?j=k=b.getMouseOnScreen(a.clientX,a.clientY):this.noPan||(m=o=b.getMouseOnScreen(a.clientX,a.clientY))},!1);this.domElement.addEventListener("mouseup",function(a){if(b.enabled)a.preventDefault(),a.stopPropagation(),
+g=d.NONE},!1);window.addEventListener("keydown",function(a){if(b.enabled&&g===d.NONE){if(a.keyCode===b.keys[d.ROTATE])g=d.ROTATE;else if(a.keyCode===b.keys[d.ZOOM]&&!b.noZoom)g=d.ZOOM;else if(a.keyCode===b.keys[d.PAN]&&!b.noPan)g=d.PAN;g!==d.NONE&&(f=!0)}},!1);window.addEventListener("keyup",function(){if(b.enabled&&g!==d.NONE)g=d.NONE},!1)};
+THREE.CubeGeometry=function(a,c,b,d,f,g,e,h){function i(a,b,c,e,h,i,k,n){var m,o,l=d||1,p=f||1,r=h/2,q=i/2,t=j.vertices.length;if(a==="x"&&b==="y"||a==="y"&&b==="x")m="z";else if(a==="x"&&b==="z"||a==="z"&&b==="x")m="y",p=g||1;else if(a==="z"&&b==="y"||a==="y"&&b==="z")m="x",l=g||1;var s=l+1,O=p+1;h/=l;var z=i/p;for(o=0;o<O;o++)for(i=0;i<s;i++){var K=new THREE.Vector3;K[a]=(i*h-r)*c;K[b]=(o*z-q)*e;K[m]=k;j.vertices.push(new THREE.Vertex(K))}for(o=0;o<p;o++)for(i=0;i<l;i++)j.faces.push(new THREE.Face4(i+
+s*o+t,i+s*(o+1)+t,i+1+s*(o+1)+t,i+1+s*o+t,null,null,n)),j.faceVertexUvs[0].push([new THREE.UV(i/l,o/p),new THREE.UV(i/l,(o+1)/p),new THREE.UV((i+1)/l,(o+1)/p),new THREE.UV((i+1)/l,o/p)])}THREE.Geometry.call(this);var j=this,k=a/2,m=c/2,o=b/2,n,t,q,r,p,s;if(e!==void 0){if(e instanceof Array)this.materials=e;else{this.materials=[];for(n=0;n<6;n++)this.materials.push(e)}n=0;r=1;t=2;p=3;q=4;s=5}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(h!=void 0)for(var l in h)this.sides[l]!=
+void 0&&(this.sides[l]=h[l]);this.sides.px&&i("z","y",-1,-1,b,c,k,n);this.sides.nx&&i("z","y",1,-1,b,c,-k,r);this.sides.py&&i("x","z",1,1,a,b,m,t);this.sides.ny&&i("x","z",1,-1,a,b,-m,p);this.sides.pz&&i("x","y",1,-1,a,c,o,q);this.sides.nz&&i("x","y",-1,-1,a,c,-o,s);this.mergeVertices();this.computeCentroids();this.computeFaceNormals()};THREE.CubeGeometry.prototype=new THREE.Geometry;THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
+THREE.CylinderGeometry=function(a,c,b,d,f,g){THREE.Geometry.call(this);var a=a!=null?a:20,c=c!=null?c:20,b=b||100,e=b/2,d=d||8,f=f||1,h,i,j=[],k=[];for(i=0;i<=f;i++){var m=[],o=[],n=i/f,t=n*(c-a)+a;for(h=0;h<=d;h++){var q=h/d;this.vertices.push(new THREE.Vertex(new THREE.Vector3(t*Math.sin(q*Math.PI*2),-n*b+e,t*Math.cos(q*Math.PI*2))));m.push(this.vertices.length-1);o.push(new THREE.UV(q,n))}j.push(m);k.push(o)}for(i=0;i<f;i++)for(h=0;h<d;h++){var b=j[i][h],m=j[i+1][h],o=j[i+1][h+1],n=j[i][h+1],t=
+this.vertices[b].position.clone().setY(0).normalize(),q=this.vertices[m].position.clone().setY(0).normalize(),r=this.vertices[o].position.clone().setY(0).normalize(),p=this.vertices[n].position.clone().setY(0).normalize(),s=k[i][h].clone(),l=k[i+1][h].clone(),v=k[i+1][h+1].clone(),w=k[i][h+1].clone();this.faces.push(new THREE.Face4(b,m,o,n,[t,q,r,p]));this.faceVertexUvs[0].push([s,l,v,w])}if(!g&&a>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,e,0)));for(h=0;h<d;h++)b=j[0][h],m=j[0][h+
+1],o=this.vertices.length-1,t=new THREE.Vector3(0,1,0),q=new THREE.Vector3(0,1,0),r=new THREE.Vector3(0,1,0),s=k[0][h].clone(),l=k[0][h+1].clone(),v=new THREE.UV(l.u,0),this.faces.push(new THREE.Face3(b,m,o,[t,q,r])),this.faceVertexUvs[0].push([s,l,v])}if(!g&&c>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-e,0)));for(h=0;h<d;h++)b=j[i][h+1],m=j[i][h],o=this.vertices.length-1,t=new THREE.Vector3(0,-1,0),q=new THREE.Vector3(0,-1,0),r=new THREE.Vector3(0,-1,0),s=k[i][h+1].clone(),l=k[i][h].clone(),
+v=new THREE.UV(l.u,1),this.faces.push(new THREE.Face3(b,m,o,[t,q,r])),this.faceVertexUvs[0].push([s,l,v])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
+THREE.ExtrudeGeometry=function(a,c){if(typeof a!=="undefined"){THREE.Geometry.call(this);var a=a instanceof Array?a:[a],b,d=a.length,f;this.shapebb=a[d-1].getBoundingBox();for(b=0;b<d;b++)f=a[b],this.addShape(f,c);this.computeCentroids();this.computeFaceNormals()}};THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;
+THREE.ExtrudeGeometry.prototype.addShape=function(a,c){function b(a,b,c){b||console.log("die");return b.clone().multiplyScalar(c).addSelf(a)}function d(a,b,c){var d=THREE.ExtrudeGeometry.__v1,e=THREE.ExtrudeGeometry.__v2,g=THREE.ExtrudeGeometry.__v3,f=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();g.set(-d.y,d.x);f.set(e.y,-e.x);h.copy(a).addSelf(g);i.copy(a).addSelf(f);if(h.equals(i))return f.clone();
+h.copy(b).addSelf(g);i.copy(c).addSelf(f);g=d.dot(f);f=i.subSelf(h).dot(f);g===0&&(console.log("Either infinite or no solutions!"),f===0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));f/=g;if(f<0)return b=Math.atan2(b.y-a.y,b.x-a.x),a=Math.atan2(c.y-a.y,c.x-a.x),b>a&&(a+=Math.PI*2),a=(b+a)/2,new THREE.Vector2(-Math.cos(a),-Math.sin(a));return d.multiplyScalar(f).addSelf(h).subSelf(a).clone()}function f(a){for(u=a.length;--u>=0;){I=u;L=u-1;L<0&&(L=a.length-1);for(var b=
+0,c=n+k*2,b=0;b<c;b++){var d=J*b,e=J*(b+1),g=R+I+d,f=R+I+e,j=g,d=R+L+d,e=R+L+e,m=f;j+=E;d+=E;e+=E;m+=E;A.faces.push(new THREE.Face4(j,d,e,m,null,null,v));v&&(j=b/c,d=(b+1)/c,e=h+i*2,g=(A.vertices[g].position.z+i)/e,f=(A.vertices[f].position.z+i)/e,A.faceVertexUvs[0].push([new THREE.UV(g,j),new THREE.UV(f,j),new THREE.UV(f,d),new THREE.UV(g,d)]))}}}function g(a,b,c){A.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function e(a,b,c){a+=E;b+=E;c+=E;A.faces.push(new THREE.Face3(a,b,c,null,
+null,l));if(l){var d=w.maxY,e=w.maxX,g=A.vertices[b].position.x,b=A.vertices[b].position.y,f=A.vertices[c].position.x,c=A.vertices[c].position.y;A.faceVertexUvs[0].push([new THREE.UV(A.vertices[a].position.x/e,A.vertices[a].position.y/d),new THREE.UV(g/e,b/d),new THREE.UV(f/e,c/d)])}}var h=c.amount!==void 0?c.amount:100,i=c.bevelThickness!==void 0?c.bevelThickness:6,j=c.bevelSize!==void 0?c.bevelSize:i-2,k=c.bevelSegments!==void 0?c.bevelSegments:3,m=c.bevelEnabled!==void 0?c.bevelEnabled:!0,o=c.curveSegments!==
+void 0?c.curveSegments:12,n=c.steps!==void 0?c.steps:1,t=c.bendPath,q=c.extrudePath,r,p=!1,s=c.useSpacedPoints!==void 0?c.useSpacedPoints:!1,l=c.material,v=c.extrudeMaterial,w=this.shapebb;if(q)r=q.getPoints(o),n=r.length,p=!0,m=!1;m||(j=i=k=0);var x,y,C,A=this,E=this.vertices.length;t&&a.addWrapPath(t);o=s?a.extractAllSpacedPoints(o):a.extractAllPoints(o);t=o.shape;o=o.holes;if(q=!THREE.Shape.Utils.isClockWise(t)){t=t.reverse();y=0;for(C=o.length;y<C;y++)x=o[y],THREE.Shape.Utils.isClockWise(x)&&
+(o[y]=x.reverse());q=!1}q=THREE.Shape.Utils.triangulateShape(t,o);s=t;y=0;for(C=o.length;y<C;y++)x=o[y],t=t.concat(x);var u,G,D,H,B,F,J=t.length,N=q.length,M=[];u=0;G=s.length;I=G-1;for(L=u+1;u<G;u++,I++,L++)I===G&&(I=0),L===G&&(L=0),M[u]=d(s[u],s[I],s[L]);var O=[],z,K=M.concat();y=0;for(C=o.length;y<C;y++){x=o[y];z=[];u=0;G=x.length;I=G-1;for(L=u+1;u<G;u++,I++,L++)I===G&&(I=0),L===G&&(L=0),z[u]=d(x[u],x[I],x[L]);O.push(z);K=K.concat(z)}for(D=0;D<k;D++){H=D/k;B=i*(1-H);H=j*Math.sin(H*Math.PI/2);u=
+0;for(G=s.length;u<G;u++)F=b(s[u],M[u],H),g(F.x,F.y,-B);y=0;for(C=o.length;y<C;y++){x=o[y];z=O[y];u=0;for(G=x.length;u<G;u++)F=b(x[u],z[u],H),g(F.x,F.y,-B)}}H=j;for(u=0;u<J;u++)F=m?b(t[u],K[u],H):t[u],p?g(F.x,F.y+r[0].y,r[0].x):g(F.x,F.y,0);for(D=1;D<=n;D++)for(u=0;u<J;u++)F=m?b(t[u],K[u],H):t[u],p?g(F.x,F.y+r[D-1].y,r[D-1].x):g(F.x,F.y,h/n*D);for(D=k-1;D>=0;D--){H=D/k;B=i*(1-H);H=j*Math.sin(H*Math.PI/2);u=0;for(G=s.length;u<G;u++)F=b(s[u],M[u],H),g(F.x,F.y,h+B);y=0;for(C=o.length;y<C;y++){x=o[y];
+z=O[y];u=0;for(G=x.length;u<G;u++)F=b(x[u],z[u],H),p?g(F.x,F.y+r[n-1].y,r[n-1].x+B):g(F.x,F.y,h+B)}}if(m){m=J*0;for(u=0;u<N;u++)j=q[u],e(j[2]+m,j[1]+m,j[0]+m);m=J*(n+k*2);for(u=0;u<N;u++)j=q[u],e(j[0]+m,j[1]+m,j[2]+m)}else{for(u=0;u<N;u++)j=q[u],e(j[2],j[1],j[0]);for(u=0;u<N;u++)j=q[u],e(j[0]+J*n,j[1]+J*n,j[2]+J*n)}var I,L,R=0;f(s);R+=s.length;y=0;for(C=o.length;y<C;y++)x=o[y],f(x),R+=x.length};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;THREE.ExtrudeGeometry.__v2=new THREE.Vector2;
 THREE.ExtrudeGeometry.__v3=new THREE.Vector2;THREE.ExtrudeGeometry.__v4=new THREE.Vector2;THREE.ExtrudeGeometry.__v5=new THREE.Vector2;THREE.ExtrudeGeometry.__v6=new THREE.Vector2;
-THREE.IcosahedronGeometry=function(a){function c(a,b,c){var e=Math.sqrt(a*a+b*b+c*c);return g.vertices.push(new THREE.Vertex(new THREE.Vector3(a/e,b/e,c/e)))-1}function b(a,b,c,e){e.faces.push(new THREE.Face3(a,b,c))}function e(a,b){var e=g.vertices[a].position,f=g.vertices[b].position;return c((e.x+f.x)/2,(e.y+f.y)/2,(e.z+f.z)/2)}var g=this,h=new THREE.Geometry;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;c(-1,a,0);c(1,a,0);c(-1,-a,0);c(1,-a,0);c(0,-1,a);c(0,1,a);c(0,-1,
--a);c(0,1,-a);c(a,0,-1);c(a,0,1);c(-a,0,-1);c(-a,0,1);b(0,11,5,h);b(0,5,1,h);b(0,1,7,h);b(0,7,10,h);b(0,10,11,h);b(1,5,9,h);b(5,11,4,h);b(11,10,2,h);b(10,7,6,h);b(7,1,8,h);b(3,9,4,h);b(3,4,2,h);b(3,2,6,h);b(3,6,8,h);b(3,8,9,h);b(4,9,5,h);b(2,4,11,h);b(6,2,10,h);b(8,6,7,h);b(9,8,1,h);for(var f=0;f<this.subdivisions;f++){var a=new THREE.Geometry,k;for(k in h.faces){var l=e(h.faces[k].a,h.faces[k].b),m=e(h.faces[k].b,h.faces[k].c),n=e(h.faces[k].c,h.faces[k].a);b(h.faces[k].a,l,n,a);b(h.faces[k].b,m,
-l,a);b(h.faces[k].c,n,m,a);b(l,m,n,a)}h.faces=a.faces}g.faces=h.faces;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;
-THREE.LatheGeometry=function(a,c,b){THREE.Geometry.call(this);this.steps=c||12;this.angle=b||2*Math.PI;for(var c=this.angle/this.steps,b=[],e=[],g=[],h=[],f=(new THREE.Matrix4).setRotationZ(c),k=0;k<a.length;k++)this.vertices.push(new THREE.Vertex(a[k])),b[k]=a[k].clone(),e[k]=this.vertices.length-1;for(var l=0;l<=this.angle+0.0010;l+=c){for(k=0;k<b.length;k++)l<this.angle?(b[k]=f.multiplyVector3(b[k].clone()),this.vertices.push(new THREE.Vertex(b[k])),g[k]=this.vertices.length-1):g=h;l==0&&(h=e);
-for(k=0;k<e.length-1;k++)this.faces.push(new THREE.Face4(g[k],g[k+1],e[k+1],e[k])),this.faceVertexUvs[0].push([new THREE.UV(1-l/this.angle,k/a.length),new THREE.UV(1-l/this.angle,(k+1)/a.length),new THREE.UV(1-(l-c)/this.angle,(k+1)/a.length),new THREE.UV(1-(l-c)/this.angle,k/a.length)]);e=g;g=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=new THREE.Geometry;THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry;
-THREE.OctahedronGeometry=function(a,c){function b(b){var c=b.clone().normalize(),c=new THREE.Vertex(c.clone().multiplyScalar(a));c.index=f.vertices.push(c)-1;c.uv=new THREE.UV(Math.atan2(b.z,-b.x)/2/Math.PI+0.5,Math.atan2(-b.y,Math.sqrt(b.x*b.x+b.z*b.z))/Math.PI+0.5);return c}function e(a,b,c,k){k<1?(k=new THREE.Face3(a.index,b.index,c.index,[a.position,b.position,c.position]),k.centroid.addSelf(a.position).addSelf(b.position).addSelf(c.position).divideScalar(3),k.normal=k.centroid.clone().normalize(),
-f.faces.push(k),k=Math.atan2(k.centroid.z,-k.centroid.x),f.faceVertexUvs[0].push([h(a.uv,a.position,k),h(b.uv,b.position,k),h(c.uv,c.position,k)])):(k-=1,e(a,g(a,b),g(a,c),k),e(g(a,b),b,g(b,c),k),e(g(a,c),g(b,c),c,k),e(g(a,b),g(b,c),g(a,c),k))}function g(a,c){k[a.index]||(k[a.index]=[]);k[c.index]||(k[c.index]=[]);var e=k[a.index][c.index];e===void 0&&(k[a.index][c.index]=k[c.index][a.index]=e=b((new THREE.Vector3).add(a.position,c.position).divideScalar(2)));return e}function h(a,b,c){c<0&&a.u===
-1&&(a=new THREE.UV(a.u-1,a.v));b.x===0&&b.z===0&&(a=new THREE.UV(c/2/Math.PI+0.5,a.v));return a}THREE.Geometry.call(this);var c=c||0,f=this;b(new THREE.Vector3(1,0,0));b(new THREE.Vector3(-1,0,0));b(new THREE.Vector3(0,1,0));b(new THREE.Vector3(0,-1,0));b(new THREE.Vector3(0,0,1));b(new THREE.Vector3(0,0,-1));var k=[],l=this.vertices;e(l[0],l[2],l[4],c);e(l[0],l[4],l[3],c);e(l[0],l[3],l[5],c);e(l[0],l[5],l[2],c);e(l[1],l[2],l[5],c);e(l[1],l[5],l[3],c);e(l[1],l[3],l[4],c);e(l[1],l[4],l[2],c);this.boundingSphere=
+THREE.IcosahedronGeometry=function(a){function c(a,b,c){var d=Math.sqrt(a*a+b*b+c*c);return f.vertices.push(new THREE.Vertex(new THREE.Vector3(a/d,b/d,c/d)))-1}function b(a,b,c,d){d.faces.push(new THREE.Face3(a,b,c))}function d(a,b){var d=f.vertices[a].position,e=f.vertices[b].position;return c((d.x+e.x)/2,(d.y+e.y)/2,(d.z+e.z)/2)}var f=this,g=new THREE.Geometry;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;c(-1,a,0);c(1,a,0);c(-1,-a,0);c(1,-a,0);c(0,-1,a);c(0,1,a);c(0,-1,
+-a);c(0,1,-a);c(a,0,-1);c(a,0,1);c(-a,0,-1);c(-a,0,1);b(0,11,5,g);b(0,5,1,g);b(0,1,7,g);b(0,7,10,g);b(0,10,11,g);b(1,5,9,g);b(5,11,4,g);b(11,10,2,g);b(10,7,6,g);b(7,1,8,g);b(3,9,4,g);b(3,4,2,g);b(3,2,6,g);b(3,6,8,g);b(3,8,9,g);b(4,9,5,g);b(2,4,11,g);b(6,2,10,g);b(8,6,7,g);b(9,8,1,g);for(var e=0;e<this.subdivisions;e++){var a=new THREE.Geometry,h;for(h in g.faces){var i=d(g.faces[h].a,g.faces[h].b),j=d(g.faces[h].b,g.faces[h].c),k=d(g.faces[h].c,g.faces[h].a);b(g.faces[h].a,i,k,a);b(g.faces[h].b,j,
+i,a);b(g.faces[h].c,k,j,a);b(i,j,k,a)}g.faces=a.faces}f.faces=g.faces;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;
+THREE.LatheGeometry=function(a,c,b){THREE.Geometry.call(this);this.steps=c||12;this.angle=b||2*Math.PI;for(var c=this.angle/this.steps,b=[],d=[],f=[],g=[],e=(new THREE.Matrix4).setRotationZ(c),h=0;h<a.length;h++)this.vertices.push(new THREE.Vertex(a[h])),b[h]=a[h].clone(),d[h]=this.vertices.length-1;for(var i=0;i<=this.angle+0.0010;i+=c){for(h=0;h<b.length;h++)i<this.angle?(b[h]=e.multiplyVector3(b[h].clone()),this.vertices.push(new THREE.Vertex(b[h])),f[h]=this.vertices.length-1):f=g;i==0&&(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-c)/this.angle,(h+1)/a.length),new THREE.UV(1-(i-c)/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.OctahedronGeometry=function(a,c){function b(b){var c=b.clone().normalize(),c=new THREE.Vertex(c.clone().multiplyScalar(a));c.index=e.vertices.push(c)-1;c.uv=new THREE.UV(Math.atan2(b.z,-b.x)/2/Math.PI+0.5,Math.atan2(-b.y,Math.sqrt(b.x*b.x+b.z*b.z))/Math.PI+0.5);return c}function d(a,b,c,h){h<1?(h=new THREE.Face3(a.index,b.index,c.index,[a.position,b.position,c.position]),h.centroid.addSelf(a.position).addSelf(b.position).addSelf(c.position).divideScalar(3),h.normal=h.centroid.clone().normalize(),
+e.faces.push(h),h=Math.atan2(h.centroid.z,-h.centroid.x),e.faceVertexUvs[0].push([g(a.uv,a.position,h),g(b.uv,b.position,h),g(c.uv,c.position,h)])):(h-=1,d(a,f(a,b),f(a,c),h),d(f(a,b),b,f(b,c),h),d(f(a,c),f(b,c),c,h),d(f(a,b),f(b,c),f(a,c),h))}function f(a,c){h[a.index]||(h[a.index]=[]);h[c.index]||(h[c.index]=[]);var d=h[a.index][c.index];d===void 0&&(h[a.index][c.index]=h[c.index][a.index]=d=b((new THREE.Vector3).add(a.position,c.position).divideScalar(2)));return d}function g(a,b,c){c<0&&a.u===
+1&&(a=new THREE.UV(a.u-1,a.v));b.x===0&&b.z===0&&(a=new THREE.UV(c/2/Math.PI+0.5,a.v));return a}THREE.Geometry.call(this);var c=c||0,e=this;b(new THREE.Vector3(1,0,0));b(new THREE.Vector3(-1,0,0));b(new THREE.Vector3(0,1,0));b(new THREE.Vector3(0,-1,0));b(new THREE.Vector3(0,0,1));b(new THREE.Vector3(0,0,-1));var h=[],i=this.vertices;d(i[0],i[2],i[4],c);d(i[0],i[4],i[3],c);d(i[0],i[3],i[5],c);d(i[0],i[5],i[2],c);d(i[1],i[2],i[5],c);d(i[1],i[5],i[3],c);d(i[1],i[3],i[4],c);d(i[1],i[4],i[2],c);this.boundingSphere=
 {radius:a}};THREE.OctahedronGeometry.prototype=new THREE.Geometry;THREE.OctahedronGeometry.prototype.constructor=THREE.OctahedronGeometry;
-THREE.PlaneGeometry=function(a,c,b,e){THREE.Geometry.call(this);var g,h=a/2,f=c/2,b=b||1,e=e||1,k=b+1,l=e+1;a/=b;var m=c/e;for(g=0;g<l;g++)for(c=0;c<k;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*a-h,-(g*m-f),0)));for(g=0;g<e;g++)for(c=0;c<b;c++)this.faces.push(new THREE.Face4(c+k*g,c+k*(g+1),c+1+k*(g+1),c+1+k*g)),this.faceVertexUvs[0].push([new THREE.UV(c/b,g/e),new THREE.UV(c/b,(g+1)/e),new THREE.UV((c+1)/b,(g+1)/e),new THREE.UV((c+1)/b,g/e)]);this.computeCentroids();this.computeFaceNormals()};
+THREE.PlaneGeometry=function(a,c,b,d){THREE.Geometry.call(this);var f,g=a/2,e=c/2,b=b||1,d=d||1,h=b+1,i=d+1;a/=b;var j=c/d;for(f=0;f<i;f++)for(c=0;c<h;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*a-g,-(f*j-e),0)));for(f=0;f<d;f++)for(c=0;c<b;c++)this.faces.push(new THREE.Face4(c+h*f,c+h*(f+1),c+1+h*(f+1),c+1+h*f)),this.faceVertexUvs[0].push([new THREE.UV(c/b,f/d),new THREE.UV(c/b,(f+1)/d),new THREE.UV((c+1)/b,(f+1)/d),new THREE.UV((c+1)/b,f/d)]);this.computeCentroids();this.computeFaceNormals()};
 THREE.PlaneGeometry.prototype=new THREE.Geometry;THREE.PlaneGeometry.prototype.constructor=THREE.PlaneGeometry;
-THREE.SphereGeometry=function(a,c,b){THREE.Geometry.call(this);for(var a=a||50,e,g=Math.PI,h=Math.max(3,c||8),f=Math.max(2,b||6),c=[],b=0;b<f+1;b++){e=b/f;var k=a*Math.cos(e*g),l=a*Math.sin(e*g),m=[],n=0;for(e=0;e<h;e++){var o=2*e/h,u=l*Math.sin(o*g),o=l*Math.cos(o*g);(b==0||b==f)&&e>0||(n=this.vertices.push(new THREE.Vertex(new THREE.Vector3(o,k,u)))-1);m.push(n)}c.push(m)}for(var p,z,w,g=c.length,b=0;b<g;b++)if(h=c[b].length,b>0)for(e=0;e<h;e++){m=e==h-1;f=c[b][m?0:e+1];k=c[b][m?h-1:e];l=c[b-1][m?
-h-1:e];m=c[b-1][m?0:e+1];u=b/(g-1);p=(b-1)/(g-1);z=(e+1)/h;var o=e/h,n=new THREE.UV(1-z,u),u=new THREE.UV(1-o,u),o=new THREE.UV(1-o,p),x=new THREE.UV(1-z,p);b<c.length-1&&(p=this.vertices[f].position.clone(),z=this.vertices[k].position.clone(),w=this.vertices[l].position.clone(),p.normalize(),z.normalize(),w.normalize(),this.faces.push(new THREE.Face3(f,k,l,[new THREE.Vector3(p.x,p.y,p.z),new THREE.Vector3(z.x,z.y,z.z),new THREE.Vector3(w.x,w.y,w.z)])),this.faceVertexUvs[0].push([n,u,o]));b>1&&(p=
-this.vertices[f].position.clone(),z=this.vertices[l].position.clone(),w=this.vertices[m].position.clone(),p.normalize(),z.normalize(),w.normalize(),this.faces.push(new THREE.Face3(f,l,m,[new THREE.Vector3(p.x,p.y,p.z),new THREE.Vector3(z.x,z.y,z.z),new THREE.Vector3(w.x,w.y,w.z)])),this.faceVertexUvs[0].push([n,o,x]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};THREE.SphereGeometry.prototype=new THREE.Geometry;
+THREE.SphereGeometry=function(a,c,b){THREE.Geometry.call(this);for(var a=a||50,d,f=Math.PI,g=Math.max(3,c||8),e=Math.max(2,b||6),c=[],b=0;b<e+1;b++){d=b/e;var h=a*Math.cos(d*f),i=a*Math.sin(d*f),j=[],k=0;for(d=0;d<g;d++){var m=2*d/g,o=i*Math.sin(m*f),m=i*Math.cos(m*f);(b==0||b==e)&&d>0||(k=this.vertices.push(new THREE.Vertex(new THREE.Vector3(m,h,o)))-1);j.push(k)}c.push(j)}for(var n,t,q,f=c.length,b=0;b<f;b++)if(g=c[b].length,b>0)for(d=0;d<g;d++){j=d==g-1;e=c[b][j?0:d+1];h=c[b][j?g-1:d];i=c[b-1][j?
+g-1:d];j=c[b-1][j?0:d+1];o=b/(f-1);n=(b-1)/(f-1);t=(d+1)/g;var m=d/g,k=new THREE.UV(1-t,o),o=new THREE.UV(1-m,o),m=new THREE.UV(1-m,n),r=new THREE.UV(1-t,n);b<c.length-1&&(n=this.vertices[e].position.clone(),t=this.vertices[h].position.clone(),q=this.vertices[i].position.clone(),n.normalize(),t.normalize(),q.normalize(),this.faces.push(new THREE.Face3(e,h,i,[new THREE.Vector3(n.x,n.y,n.z),new THREE.Vector3(t.x,t.y,t.z),new THREE.Vector3(q.x,q.y,q.z)])),this.faceVertexUvs[0].push([k,o,m]));b>1&&(n=
+this.vertices[e].position.clone(),t=this.vertices[i].position.clone(),q=this.vertices[j].position.clone(),n.normalize(),t.normalize(),q.normalize(),this.faces.push(new THREE.Face3(e,i,j,[new THREE.Vector3(n.x,n.y,n.z),new THREE.Vector3(t.x,t.y,t.z),new THREE.Vector3(q.x,q.y,q.z)])),this.faceVertexUvs[0].push([k,m,r]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};THREE.SphereGeometry.prototype=new THREE.Geometry;
 THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry;
-THREE.TextGeometry=function(a,c){var b=(new THREE.TextPath(a,c)).toShapes();c.amount=c.height!==void 0?c.height:50;if(c.bevelThickness===void 0)c.bevelThickness=10;if(c.bevelSize===void 0)c.bevelSize=8;if(c.bevelEnabled===void 0)c.bevelEnabled=!1;if(c.bend){var e=b[b.length-1].getBoundingBox().maxX;c.bendPath=new THREE.QuadraticBezierCurve(new THREE.Vector2(0,0),new THREE.Vector2(e/2,120),new THREE.Vector2(e,0))}THREE.ExtrudeGeometry.call(this,b,c)};THREE.TextGeometry.prototype=new THREE.ExtrudeGeometry;
+THREE.TextGeometry=function(a,c){var b=(new THREE.TextPath(a,c)).toShapes();c.amount=c.height!==void 0?c.height:50;if(c.bevelThickness===void 0)c.bevelThickness=10;if(c.bevelSize===void 0)c.bevelSize=8;if(c.bevelEnabled===void 0)c.bevelEnabled=!1;if(c.bend){var d=b[b.length-1].getBoundingBox().maxX;c.bendPath=new THREE.QuadraticBezierCurve(new THREE.Vector2(0,0),new THREE.Vector2(d/2,120),new THREE.Vector2(d,0))}THREE.ExtrudeGeometry.call(this,b,c)};THREE.TextGeometry.prototype=new THREE.ExtrudeGeometry;
 THREE.TextGeometry.prototype.constructor=THREE.TextGeometry;
-THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function(){return this.faces[this.face][this.weight][this.style]},getTextShapes:function(a,c){return(new TextPath(a,c)).toShapes()},loadFace:function(a){var c=a.familyName.toLowerCase();this.faces[c]=this.faces[c]||{};this.faces[c][a.cssFontWeight]=this.faces[c][a.cssFontWeight]||{};this.faces[c][a.cssFontWeight][a.cssFontStyle]=a;return this.faces[c][a.cssFontWeight][a.cssFontStyle]=a},drawText:function(a){for(var c=
-this.getFace(),b=this.size/c.resolution,e=0,g=String(a).split(""),h=g.length,f=[],a=0;a<h;a++){var k=new THREE.Path,k=this.extractGlyphPoints(g[a],c,b,e,k);e+=k.offset;f.push(k.path)}return{paths:f,offset:e/2}},extractGlyphPoints:function(a,c,b,e,g){var h=[],f,k,l,m,n,o,u,p,z,w,x=c.glyphs[a]||c.glyphs[ctxt.options.fallbackCharacter];if(x){if(x.o){c=x._cachedOutline||(x._cachedOutline=x.o.split(" "));l=c.length;for(a=0;a<l;)switch(k=c[a++],k){case "m":k=c[a++]*b+e;m=c[a++]*b;h.push(new THREE.Vector2(k,
-m));g.moveTo(k,m);break;case "l":k=c[a++]*b+e;m=c[a++]*b;h.push(new THREE.Vector2(k,m));g.lineTo(k,m);break;case "q":k=c[a++]*b+e;m=c[a++]*b;u=c[a++]*b+e;p=c[a++]*b;g.quadraticCurveTo(u,p,k,m);if(f=h[h.length-1]){n=f.x;o=f.y;f=1;for(divisions=this.divisions;f<=divisions;f++){var v=f/divisions,y=THREE.Shape.Utils.b2(v,n,u,k),v=THREE.Shape.Utils.b2(v,o,p,m);h.push(new THREE.Vector2(y,v))}}break;case "b":if(k=c[a++]*b+e,m=c[a++]*b,u=c[a++]*b+e,p=c[a++]*-b,z=c[a++]*b+e,w=c[a++]*-b,g.bezierCurveTo(k,m,
-u,p,z,w),f=h[h.length-1]){n=f.x;o=f.y;f=1;for(divisions=this.divisions;f<=divisions;f++)v=f/divisions,y=THREE.Shape.Utils.b3(v,n,u,z,k),v=THREE.Shape.Utils.b3(v,o,p,w,m),h.push(new THREE.Vector2(y,v))}}}return{offset:x.ha*b,points:h,path:g}}}};
-(function(a){var c=function(a){for(var c=a.length,g=0,h=c-1,f=0;f<c;h=f++)g+=a[h].x*a[f].y-a[f].x*a[h].y;return g*0.5};a.Triangulate=function(a,e){var g=a.length;if(g<3)return null;var h=[],f=[],k=[],l,m,n;if(c(a)>0)for(m=0;m<g;m++)f[m]=m;else for(m=0;m<g;m++)f[m]=g-1-m;var o=2*g;for(m=g-1;g>2;){if(o--<=0){console.log("Warning, unable to triangulate polygon!");if(e)return k;return h}l=m;g<=l&&(l=0);m=l+1;g<=m&&(m=0);n=m+1;g<=n&&(n=0);var u;a:{u=a;var p=l,z=m,w=n,x=g,v=f,y=void 0,t=void 0,A=void 0,
-D=void 0,C=void 0,E=void 0,I=void 0,G=void 0,K=void 0,t=u[v[p]].x,A=u[v[p]].y,D=u[v[z]].x,C=u[v[z]].y,E=u[v[w]].x,I=u[v[w]].y;if(1.0E-10>(D-t)*(I-A)-(C-A)*(E-t))u=!1;else{for(y=0;y<x;y++)if(!(y==p||y==z||y==w)){var G=u[v[y]].x,K=u[v[y]].y,B=void 0,F=void 0,J=void 0,M=void 0,N=void 0,L=void 0,P=void 0,H=void 0,Q=void 0,O=void 0,R=void 0,U=void 0,B=J=N=void 0,B=E-D,F=I-C,J=t-E,M=A-I,N=D-t,L=C-A,P=G-t,H=K-A,Q=G-D,O=K-C,R=G-E,U=K-I,B=B*O-F*Q,N=N*H-L*P,J=J*U-M*R;if(B>=0&&J>=0&&N>=0){u=!1;break a}}u=!0}}if(u){h.push([a[f[l]],
-a[f[m]],a[f[n]]]);k.push([f[l],f[m],f[n]]);l=m;for(n=m+1;n<g;l++,n++)f[l]=f[n];g--;o=2*g}}if(e)return k;return h};a.Triangulate.area=c;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
-THREE.TorusGeometry=function(a,c,b,e,g){THREE.Geometry.call(this);this.radius=a||100;this.tube=c||40;this.segmentsR=b||8;this.segmentsT=e||6;this.arc=g||Math.PI*2;g=new THREE.Vector3;a=[];c=[];for(b=0;b<=this.segmentsR;b++)for(e=0;e<=this.segmentsT;e++){var h=e/this.segmentsT*this.arc,f=b/this.segmentsR*Math.PI*2;g.x=this.radius*Math.cos(h);g.y=this.radius*Math.sin(h);var k=new THREE.Vector3;k.x=(this.radius+this.tube*Math.cos(f))*Math.cos(h);k.y=(this.radius+this.tube*Math.cos(f))*Math.sin(h);k.z=
-this.tube*Math.sin(f);this.vertices.push(new THREE.Vertex(k));a.push(new THREE.UV(e/this.segmentsT,1-b/this.segmentsR));c.push(k.clone().subSelf(g).normalize())}for(b=1;b<=this.segmentsR;b++)for(e=1;e<=this.segmentsT;e++){var g=(this.segmentsT+1)*b+e-1,h=(this.segmentsT+1)*(b-1)+e-1,f=(this.segmentsT+1)*(b-1)+e,k=(this.segmentsT+1)*b+e,l=new THREE.Face4(g,h,f,k,[c[g],c[h],c[f],c[k]]);l.normal.addSelf(c[g]);l.normal.addSelf(c[h]);l.normal.addSelf(c[f]);l.normal.addSelf(c[k]);l.normal.normalize();this.faces.push(l);
-this.faceVertexUvs[0].push([a[g].clone(),a[h].clone(),a[f].clone(),a[k].clone()])}this.computeCentroids()};THREE.TorusGeometry.prototype=new THREE.Geometry;THREE.TorusGeometry.prototype.constructor=THREE.TorusGeometry;
-THREE.TorusKnotGeometry=function(a,c,b,e,g,h,f){function k(a,b,c,e,f,h){b=c/e*a;c=Math.cos(b);return new THREE.Vector3(f*(2+c)*0.5*Math.cos(a),f*(2+c)*Math.sin(a)*0.5,h*f*Math.sin(b)*0.5)}THREE.Geometry.call(this);this.radius=a||200;this.tube=c||40;this.segmentsR=b||64;this.segmentsT=e||8;this.p=g||2;this.q=h||3;this.heightScale=f||1;this.grid=Array(this.segmentsR);b=new THREE.Vector3;e=new THREE.Vector3;h=new THREE.Vector3;for(a=0;a<this.segmentsR;++a){this.grid[a]=Array(this.segmentsT);for(c=0;c<
-this.segmentsT;++c){var l=a/this.segmentsR*2*this.p*Math.PI,f=c/this.segmentsT*2*Math.PI,g=k(l,f,this.q,this.p,this.radius,this.heightScale),l=k(l+0.01,f,this.q,this.p,this.radius,this.heightScale);b.x=l.x-g.x;b.y=l.y-g.y;b.z=l.z-g.z;e.x=l.x+g.x;e.y=l.y+g.y;e.z=l.z+g.z;h.cross(b,e);e.cross(h,b);h.normalize();e.normalize();l=-this.tube*Math.cos(f);f=this.tube*Math.sin(f);g.x+=l*e.x+f*h.x;g.y+=l*e.y+f*h.y;g.z+=l*e.z+f*h.z;this.grid[a][c]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(g.x,g.y,
-g.z)))-1}}for(a=0;a<this.segmentsR;++a)for(c=0;c<this.segmentsT;++c){var e=(a+1)%this.segmentsR,h=(c+1)%this.segmentsT,g=this.grid[a][c],b=this.grid[e][c],e=this.grid[e][h],h=this.grid[a][h],f=new THREE.UV(a/this.segmentsR,c/this.segmentsT),l=new THREE.UV((a+1)/this.segmentsR,c/this.segmentsT),m=new THREE.UV((a+1)/this.segmentsR,(c+1)/this.segmentsT),n=new THREE.UV(a/this.segmentsR,(c+1)/this.segmentsT);this.faces.push(new THREE.Face4(g,b,e,h));this.faceVertexUvs[0].push([f,l,m,n])}this.computeCentroids();
+THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function(){return this.faces[this.face][this.weight][this.style]},getTextShapes:function(a,c){return(new THREE.TextPath(a,c)).toShapes()},loadFace:function(a){var c=a.familyName.toLowerCase();this.faces[c]=this.faces[c]||{};this.faces[c][a.cssFontWeight]=this.faces[c][a.cssFontWeight]||{};this.faces[c][a.cssFontWeight][a.cssFontStyle]=a;return this.faces[c][a.cssFontWeight][a.cssFontStyle]=a},
+drawText:function(a){for(var c=this.getFace(),b=this.size/c.resolution,d=0,f=String(a).split(""),g=f.length,e=[],a=0;a<g;a++){var h=new THREE.Path,h=this.extractGlyphPoints(f[a],c,b,d,h);d+=h.offset;e.push(h.path)}return{paths:e,offset:d/2}},extractGlyphPoints:function(a,c,b,d,f){var g=[],e,h,i,j,k,m,o,n,t,q,r,p=c.glyphs[a]||c.glyphs["?"];if(p){if(p.o){c=p._cachedOutline||(p._cachedOutline=p.o.split(" "));j=c.length;for(a=0;a<j;)switch(i=c[a++],i){case "m":i=c[a++]*b+d;k=c[a++]*b;g.push(new THREE.Vector2(i,
+k));f.moveTo(i,k);break;case "l":i=c[a++]*b+d;k=c[a++]*b;g.push(new THREE.Vector2(i,k));f.lineTo(i,k);break;case "q":i=c[a++]*b+d;k=c[a++]*b;n=c[a++]*b+d;t=c[a++]*b;f.quadraticCurveTo(n,t,i,k);if(e=g[g.length-1]){m=e.x;o=e.y;e=1;for(h=this.divisions;e<=h;e++){var s=e/h,l=THREE.Shape.Utils.b2(s,m,n,i),s=THREE.Shape.Utils.b2(s,o,t,k);g.push(new THREE.Vector2(l,s))}}break;case "b":if(i=c[a++]*b+d,k=c[a++]*b,n=c[a++]*b+d,t=c[a++]*-b,q=c[a++]*b+d,r=c[a++]*-b,f.bezierCurveTo(i,k,n,t,q,r),e=g[g.length-1]){m=
+e.x;o=e.y;e=1;for(h=this.divisions;e<=h;e++)s=e/h,l=THREE.Shape.Utils.b3(s,m,n,q,i),s=THREE.Shape.Utils.b3(s,o,t,r,k),g.push(new THREE.Vector2(l,s))}}}return{offset:p.ha*b,points:g,path:f}}}};
+(function(a){var c=function(a){for(var c=a.length,f=0,g=c-1,e=0;e<c;g=e++)f+=a[g].x*a[e].y-a[e].x*a[g].y;return f*0.5};a.Triangulate=function(a,d){var f=a.length;if(f<3)return null;var g=[],e=[],h=[],i,j,k;if(c(a)>0)for(j=0;j<f;j++)e[j]=j;else for(j=0;j<f;j++)e[j]=f-1-j;var m=2*f;for(j=f-1;f>2;){if(m--<=0){console.log("Warning, unable to triangulate polygon!");if(d)return h;return g}i=j;f<=i&&(i=0);j=i+1;f<=j&&(j=0);k=j+1;f<=k&&(k=0);var o;a:{o=a;var n=i,t=j,q=k,r=f,p=e,s=void 0,l=void 0,v=void 0,
+w=void 0,x=void 0,y=void 0,C=void 0,A=void 0,E=void 0,l=o[p[n]].x,v=o[p[n]].y,w=o[p[t]].x,x=o[p[t]].y,y=o[p[q]].x,C=o[p[q]].y;if(1.0E-10>(w-l)*(C-v)-(x-v)*(y-l))o=!1;else{for(s=0;s<r;s++)if(!(s==n||s==t||s==q)){var A=o[p[s]].x,E=o[p[s]].y,u=void 0,G=void 0,D=void 0,H=void 0,B=void 0,F=void 0,J=void 0,N=void 0,M=void 0,O=void 0,z=void 0,K=void 0,u=D=B=void 0,u=y-w,G=C-x,D=l-y,H=v-C,B=w-l,F=x-v,J=A-l,N=E-v,M=A-w,O=E-x,z=A-y,K=E-C,u=u*O-G*M,B=B*N-F*J,D=D*K-H*z;if(u>=0&&D>=0&&B>=0){o=!1;break a}}o=!0}}if(o){g.push([a[e[i]],
+a[e[j]],a[e[k]]]);h.push([e[i],e[j],e[k]]);i=j;for(k=j+1;k<f;i++,k++)e[i]=e[k];f--;m=2*f}}if(d)return h;return g};a.Triangulate.area=c;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
+THREE.TorusGeometry=function(a,c,b,d,f){THREE.Geometry.call(this);this.radius=a||100;this.tube=c||40;this.segmentsR=b||8;this.segmentsT=d||6;this.arc=f||Math.PI*2;f=new THREE.Vector3;a=[];c=[];for(b=0;b<=this.segmentsR;b++)for(d=0;d<=this.segmentsT;d++){var g=d/this.segmentsT*this.arc,e=b/this.segmentsR*Math.PI*2;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-b/this.segmentsR));c.push(h.clone().subSelf(f).normalize())}for(b=1;b<=this.segmentsR;b++)for(d=1;d<=this.segmentsT;d++){var f=(this.segmentsT+1)*b+d-1,g=(this.segmentsT+1)*(b-1)+d-1,e=(this.segmentsT+1)*(b-1)+d,h=(this.segmentsT+1)*b+d,i=new THREE.Face4(f,g,e,h,[c[f],c[g],c[e],c[h]]);i.normal.addSelf(c[f]);i.normal.addSelf(c[g]);i.normal.addSelf(c[e]);i.normal.addSelf(c[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,c,b,d,f,g,e){function h(a,b,c,d,e,g){b=c/d*a;c=Math.cos(b);return new THREE.Vector3(e*(2+c)*0.5*Math.cos(a),e*(2+c)*Math.sin(a)*0.5,g*e*Math.sin(b)*0.5)}THREE.Geometry.call(this);this.radius=a||200;this.tube=c||40;this.segmentsR=b||64;this.segmentsT=d||8;this.p=f||2;this.q=g||3;this.heightScale=e||1;this.grid=Array(this.segmentsR);b=new THREE.Vector3;d=new THREE.Vector3;g=new THREE.Vector3;for(a=0;a<this.segmentsR;++a){this.grid[a]=Array(this.segmentsT);for(c=0;c<
+this.segmentsT;++c){var i=a/this.segmentsR*2*this.p*Math.PI,e=c/this.segmentsT*2*Math.PI,f=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);b.x=i.x-f.x;b.y=i.y-f.y;b.z=i.z-f.z;d.x=i.x+f.x;d.y=i.y+f.y;d.z=i.z+f.z;g.cross(b,d);d.cross(g,b);g.normalize();d.normalize();i=-this.tube*Math.cos(e);e=this.tube*Math.sin(e);f.x+=i*d.x+e*g.x;f.y+=i*d.y+e*g.y;f.z+=i*d.z+e*g.z;this.grid[a][c]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(f.x,f.y,
+f.z)))-1}}for(a=0;a<this.segmentsR;++a)for(c=0;c<this.segmentsT;++c){var d=(a+1)%this.segmentsR,g=(c+1)%this.segmentsT,f=this.grid[a][c],b=this.grid[d][c],d=this.grid[d][g],g=this.grid[a][g],e=new THREE.UV(a/this.segmentsR,c/this.segmentsT),i=new THREE.UV((a+1)/this.segmentsR,c/this.segmentsT),j=new THREE.UV((a+1)/this.segmentsR,(c+1)/this.segmentsT),k=new THREE.UV(a/this.segmentsR,(c+1)/this.segmentsT);this.faces.push(new THREE.Face4(f,b,d,g));this.faceVertexUvs[0].push([e,i,j,k])}this.computeCentroids();
 this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusKnotGeometry.prototype=new THREE.Geometry;THREE.TorusKnotGeometry.prototype.constructor=THREE.TorusKnotGeometry;THREE.SubdivisionModifier=function(a){this.subdivisions=a===void 0?1:a;this.useOldVertexColors=!1;this.supportUVs=!0};THREE.SubdivisionModifier.prototype.constructor=THREE.SubdivisionModifier;THREE.SubdivisionModifier.prototype.modify=function(a){for(var c=this.subdivisions;c-- >0;)this.smooth(a)};
-THREE.SubdivisionModifier.prototype.smooth=function(a){function c(a,b,c,e,k,l){var m=new THREE.Face4(a,b,c,e,null,k.color,k.material);if(f.useOldVertexColors){m.vertexColors=[];for(var p,n,o,v=0;v<4;v++){o=l[v];p=new THREE.Color;p.setRGB(0,0,0);for(var t=0;t<o.length;t++)n=k.vertexColors[o[t]-1],p.r+=n.r,p.g+=n.g,p.b+=n.b;p.r/=o.length;p.g/=o.length;p.b/=o.length;m.vertexColors[v]=p}}g.push(m);(!f.supportUVs||u.length!=0)&&h.push([u[a],u[b],u[c],u[e]])}function b(a,b){return Math.min(a,b)+"_"+Math.max(a,
-b)}var e=[],g=[],h=[],f=this,k=a.vertices,e=a.faces,l=k.concat(),m=[],n={},o={},u=[],p,z,w,x,v,y=a.faceVertexUvs[0];p=0;for(z=y.length;p<z;p++){w=0;for(x=y[p].length;w<x;w++)v=e[p]["abcd".charAt(w)],u[v]||(u[v]=y[p][w])}var t;p=0;for(z=e.length;p<z;p++)if(v=e[p],m.push(v.centroid),l.push(new THREE.Vertex(v.centroid)),f.supportUVs&&u.length!=0){t=new THREE.UV;if(v instanceof THREE.Face3)t.u=u[v.a].u+u[v.b].u+u[v.c].u,t.v=u[v.a].v+u[v.b].v+u[v.c].v,t.u/=3,t.v/=3;else if(v instanceof THREE.Face4)t.u=
-u[v.a].u+u[v.b].u+u[v.c].u+u[v.d].u,t.v=u[v.a].v+u[v.b].v+u[v.c].v+u[v.d].v,t.u/=4,t.v/=4;u.push(t)}z=function(a){function c(a,b,e){a[b]===void 0&&(a[b]=[]);a[b].push(e)}var e,f,h,g,k={};e=0;for(f=a.faces.length;e<f;e++)h=a.faces[e],h instanceof THREE.Face3?(g=b(h.a,h.b),c(k,g,e),g=b(h.b,h.c),c(k,g,e),g=b(h.c,h.a),c(k,g,e)):h instanceof THREE.Face4&&(g=b(h.a,h.b),c(k,g,e),g=b(h.b,h.c),c(k,g,e),g=b(h.c,h.d),c(k,g,e),g=b(h.d,h.a),c(k,g,e));return k}(a);var A=0,y=k.length,D,C,E={},I={},G=function(a,
-b){E[a]===void 0&&(E[a]=[]);E[a].push(b)},K=function(a,b){I[a]===void 0&&(I[a]={});I[a][b]=null};for(p in z){t=z[p];D=p.split("_");C=D[0];D=D[1];G(C,[C,D]);G(D,[C,D]);w=0;for(x=t.length;w<x;w++)v=t[w],K(C,v,p),K(D,v,p);t.length<2&&(o[p]=!0)}for(p in z)if(t=z[p],v=t[0],t=t[1],D=p.split("_"),C=D[0],D=D[1],x=new THREE.Vector3,o[p]?(x.addSelf(k[C].position),x.addSelf(k[D].position),x.multiplyScalar(0.5)):(x.addSelf(m[v]),x.addSelf(m[t]),x.addSelf(k[C].position),x.addSelf(k[D].position),x.multiplyScalar(0.25)),
-n[p]=y+e.length+A,l.push(new THREE.Vertex(x)),A++,f.supportUVs&&u.length!=0)t=new THREE.UV,t.u=u[C].u+u[D].u,t.v=u[C].v+u[D].v,t.u/=2,t.v/=2,u.push(t);var B,F;D=["123","12","2","23"];x=["123","23","3","31"];var G=["123","31","1","12"],K=["1234","12","2","23"],J=["1234","23","3","34"],M=["1234","34","4","41"],N=["1234","41","1","12"];p=0;for(z=m.length;p<z;p++)v=e[p],t=y+p,v instanceof THREE.Face3?(A=b(v.a,v.b),C=b(v.b,v.c),B=b(v.c,v.a),c(t,n[A],v.b,n[C],v,D),c(t,n[C],v.c,n[B],v,x),c(t,n[B],v.a,n[A],
-v,G)):v instanceof THREE.Face4?(A=b(v.a,v.b),C=b(v.b,v.c),B=b(v.c,v.d),F=b(v.d,v.a),c(t,n[A],v.b,n[C],v,K),c(t,n[C],v.c,n[B],v,J),c(t,n[B],v.d,n[F],v,M),c(t,n[F],v.a,n[A],v,N)):console.log("face should be a face!",v);e=l;l=new THREE.Vector3;n=new THREE.Vector3;p=0;for(z=k.length;p<z;p++)if(E[p]!==void 0){l.set(0,0,0);n.set(0,0,0);v=new THREE.Vector3(0,0,0);t=0;for(w in I[p])l.addSelf(m[w]),t++;A=0;y=E[p].length;for(w=0;w<y;w++)o[b(E[p][w][0],E[p][w][1])]&&A++;if(A!=2){l.divideScalar(t);for(w=0;w<
-y;w++)t=E[p][w],t=k[t[0]].position.clone().addSelf(k[t[1]].position).divideScalar(2),n.addSelf(t);n.divideScalar(y);v.addSelf(k[p].position);v.multiplyScalar(y-3);v.addSelf(l);v.addSelf(n.multiplyScalar(2));v.divideScalar(y);e[p].position=v}}a.vertices=e;a.faces=g;a.faceVertexUvs[0]=h;delete a.__tmpVertices;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals()};
+THREE.SubdivisionModifier.prototype.smooth=function(a){function c(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,n,m,l=0;l<4;l++){m=i[l];k=new THREE.Color;k.setRGB(0,0,0);for(var p=0;p<m.length;p++)n=h.vertexColors[m[p]-1],k.r+=n.r,k.g+=n.g,k.b+=n.b;k.r/=m.length;k.g/=m.length;k.b/=m.length;j.vertexColors[l]=k}}f.push(j);(!e.supportUVs||o.length!=0)&&g.push([o[a],o[b],o[c],o[d]])}function b(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={},m={},o=[],n,t,q,r,p,s=a.faceVertexUvs[0];n=0;for(t=s.length;n<t;n++){q=0;for(r=s[n].length;q<r;q++)p=d[n]["abcd".charAt(q)],o[p]||(o[p]=s[n][q])}var l;n=0;for(t=d.length;n<t;n++)if(p=d[n],j.push(p.centroid),i.push(new THREE.Vertex(p.centroid)),e.supportUVs&&o.length!=0){l=new THREE.UV;if(p instanceof THREE.Face3)l.u=o[p.a].u+o[p.b].u+o[p.c].u,l.v=o[p.a].v+o[p.b].v+o[p.c].v,l.u/=3,l.v/=3;else if(p instanceof THREE.Face4)l.u=
+o[p.a].u+o[p.b].u+o[p.c].u+o[p.d].u,l.v=o[p.a].v+o[p.b].v+o[p.c].v+o[p.d].v,l.u/=4,l.v/=4;o.push(l)}t=function(a){function c(a,b,d){a[b]===void 0&&(a[b]=[]);a[b].push(d)}var d,e,g,f,h={};d=0;for(e=a.faces.length;d<e;d++)g=a.faces[d],g instanceof THREE.Face3?(f=b(g.a,g.b),c(h,f,d),f=b(g.b,g.c),c(h,f,d),f=b(g.c,g.a),c(h,f,d)):g instanceof THREE.Face4&&(f=b(g.a,g.b),c(h,f,d),f=b(g.b,g.c),c(h,f,d),f=b(g.c,g.d),c(h,f,d),f=b(g.d,g.a),c(h,f,d));return h}(a);var v=0,s=h.length,w,x,y={},C={},A=function(a,
+b){y[a]===void 0&&(y[a]=[]);y[a].push(b)},E=function(a,b){C[a]===void 0&&(C[a]={});C[a][b]=null};for(n in t){l=t[n];w=n.split("_");x=w[0];w=w[1];A(x,[x,w]);A(w,[x,w]);q=0;for(r=l.length;q<r;q++)p=l[q],E(x,p,n),E(w,p,n);l.length<2&&(m[n]=!0)}for(n in t)if(l=t[n],p=l[0],l=l[1],w=n.split("_"),x=w[0],w=w[1],r=new THREE.Vector3,m[n]?(r.addSelf(h[x].position),r.addSelf(h[w].position),r.multiplyScalar(0.5)):(r.addSelf(j[p]),r.addSelf(j[l]),r.addSelf(h[x].position),r.addSelf(h[w].position),r.multiplyScalar(0.25)),
+k[n]=s+d.length+v,i.push(new THREE.Vertex(r)),v++,e.supportUVs&&o.length!=0)l=new THREE.UV,l.u=o[x].u+o[w].u,l.v=o[x].v+o[w].v,l.u/=2,l.v/=2,o.push(l);var u,G;w=["123","12","2","23"];r=["123","23","3","31"];var A=["123","31","1","12"],E=["1234","12","2","23"],D=["1234","23","3","34"],H=["1234","34","4","41"],B=["1234","41","1","12"];n=0;for(t=j.length;n<t;n++)p=d[n],l=s+n,p instanceof THREE.Face3?(v=b(p.a,p.b),x=b(p.b,p.c),u=b(p.c,p.a),c(l,k[v],p.b,k[x],p,w),c(l,k[x],p.c,k[u],p,r),c(l,k[u],p.a,k[v],
+p,A)):p instanceof THREE.Face4?(v=b(p.a,p.b),x=b(p.b,p.c),u=b(p.c,p.d),G=b(p.d,p.a),c(l,k[v],p.b,k[x],p,E),c(l,k[x],p.c,k[u],p,D),c(l,k[u],p.d,k[G],p,H),c(l,k[G],p.a,k[v],p,B)):console.log("face should be a face!",p);d=i;i=new THREE.Vector3;k=new THREE.Vector3;n=0;for(t=h.length;n<t;n++)if(y[n]!==void 0){i.set(0,0,0);k.set(0,0,0);p=new THREE.Vector3(0,0,0);l=0;for(q in C[n])i.addSelf(j[q]),l++;v=0;s=y[n].length;for(q=0;q<s;q++)m[b(y[n][q][0],y[n][q][1])]&&v++;if(v!=2){i.divideScalar(l);for(q=0;q<
+s;q++)l=y[n][q],l=h[l[0]].position.clone().addSelf(h[l[1]].position).divideScalar(2),k.addSelf(l);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()};
 THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
 THREE.Loader.prototype={constructor:THREE.Loader,addStatusElement:function(){var a=document.createElement("div");a.style.position="absolute";a.style.right="0px";a.style.top="0px";a.style.fontSize="0.8em";a.style.textAlign="left";a.style.background="rgba(0,0,0,0.25)";a.style.color="#fff";a.style.width="120px";a.style.padding="0.5em 0.5em 0.5em 0.5em";a.style.zIndex=1E3;a.innerHTML="Loading ...";return a},updateProgress:function(a){var c="Loaded ";c+=a.total?(100*a.loaded/a.total).toFixed(0)+"%":(a.loaded/
-1E3).toFixed(2)+" KB";this.statusDomElement.innerHTML=c},extractUrlbase:function(a){a=a.split("/");a.pop();return a.length<1?"":a.join("/")+"/"},initMaterials:function(a,c,b){a.materials=[];for(var e=0;e<c.length;++e)a.materials[e]=THREE.Loader.prototype.createMaterial(c[e],b)},hasNormals:function(a){var c,b,e=a.materials.length;for(b=0;b<e;b++)if(c=a.materials[b],c instanceof THREE.ShaderMaterial)return!0;return!1},createMaterial:function(a,c){function b(a){a=Math.log(a)/Math.LN2;return Math.floor(a)==
-a}function e(a,c){var e=new Image;e.onload=function(){if(!b(this.width)||!b(this.height)){var c=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),e=Math.pow(2,Math.round(Math.log(this.height)/Math.LN2));a.image.width=c;a.image.height=e;a.image.getContext("2d").drawImage(this,0,0,c,e)}else a.image=this;a.needsUpdate=!0};e.src=c}function g(a,b,f,h,g,k){var l=document.createElement("canvas");a[b]=new THREE.Texture(l);a[b].sourceFile=f;if(h){a[b].repeat.set(h[0],h[1]);if(h[0]!=1)a[b].wrapS=THREE.RepeatWrapping;
-if(h[1]!=1)a[b].wrapT=THREE.RepeatWrapping}g&&a[b].offset.set(g[0],g[1]);if(k){h={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(h[k[0]]!==void 0)a[b].wrapS=h[k[0]];if(h[k[1]]!==void 0)a[b].wrapT=h[k[1]]}e(a[b],c+"/"+f)}function h(a){return(a[0]*255<<16)+(a[1]*255<<8)+a[2]*255}var f,k,l;k="MeshLambertMaterial";f={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:a.wireframe};a.shading&&(a.shading=="Phong"?k="MeshPhongMaterial":a.shading=="Basic"&&(k="MeshBasicMaterial"));
-if(a.blending)if(a.blending=="Additive")f.blending=THREE.AdditiveBlending;else if(a.blending=="Subtractive")f.blending=THREE.SubtractiveBlending;else if(a.blending=="Multiply")f.blending=THREE.MultiplyBlending;if(a.transparent!==void 0||a.opacity<1)f.transparent=a.transparent;if(a.depthTest!==void 0)f.depthTest=a.depthTest;if(a.vertexColors!==void 0)if(a.vertexColors=="face")f.vertexColors=THREE.FaceColors;else if(a.vertexColors)f.vertexColors=THREE.VertexColors;if(a.colorDiffuse)f.color=h(a.colorDiffuse);
-else if(a.DbgColor)f.color=a.DbgColor;if(a.colorSpecular)f.specular=h(a.colorSpecular);if(a.colorAmbient)f.ambient=h(a.colorAmbient);if(a.transparency)f.opacity=a.transparency;if(a.specularCoef)f.shininess=a.specularCoef;a.mapDiffuse&&c&&g(f,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap);a.mapLight&&c&&g(f,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap);a.mapNormal&&c&&g(f,"normalMap",a.mapNormal,a.mapNormalRepeat,a.mapNormalOffset,a.mapNormalWrap);
-a.mapSpecular&&c&&g(f,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){var m=THREE.ShaderUtils.lib.normal,n=THREE.UniformsUtils.clone(m.uniforms),o=f.color;k=f.specular;l=f.ambient;var u=f.shininess;n.tNormal.texture=f.normalMap;if(a.mapNormalFactor)n.uNormalScale.value=a.mapNormalFactor;if(f.map)n.tDiffuse.texture=f.map,n.enableDiffuse.value=!0;if(f.specularMap)n.tSpecular.texture=f.specularMap,n.enableSpecular.value=!0;if(f.lightMap)n.tAO.texture=
-f.lightMap,n.enableAO.value=!0;n.uDiffuseColor.value.setHex(o);n.uSpecularColor.value.setHex(k);n.uAmbientColor.value.setHex(l);n.uShininess.value=u;if(f.opacity)n.uOpacity.value=f.opacity;f=new THREE.ShaderMaterial({fragmentShader:m.fragmentShader,vertexShader:m.vertexShader,uniforms:n,lights:!0,fog:!0})}else f=new THREE[k](f);return f}};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;
+1E3).toFixed(2)+" KB";this.statusDomElement.innerHTML=c},extractUrlbase:function(a){a=a.split("/");a.pop();return a.length<1?"":a.join("/")+"/"},initMaterials:function(a,c,b){a.materials=[];for(var d=0;d<c.length;++d)a.materials[d]=THREE.Loader.prototype.createMaterial(c[d],b)},hasNormals:function(a){var c,b,d=a.materials.length;for(b=0;b<d;b++)if(c=a.materials[b],c instanceof THREE.ShaderMaterial)return!0;return!1},createMaterial:function(a,c){function b(a){a=Math.log(a)/Math.LN2;return Math.floor(a)==
+a}function d(a,c){var d=new Image;d.onload=function(){if(!b(this.width)||!b(this.height)){var c=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),d=Math.pow(2,Math.round(Math.log(this.height)/Math.LN2));a.image.width=c;a.image.height=d;a.image.getContext("2d").drawImage(this,0,0,c,d)}else a.image=this;a.needsUpdate=!0};d.src=c}function f(a,b,e,g,f,h){var i=document.createElement("canvas");a[b]=new THREE.Texture(i);a[b].sourceFile=e;if(g){a[b].repeat.set(g[0],g[1]);if(g[0]!=1)a[b].wrapS=THREE.RepeatWrapping;
+if(g[1]!=1)a[b].wrapT=THREE.RepeatWrapping}f&&a[b].offset.set(f[0],f[1]);if(h){g={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(g[h[0]]!==void 0)a[b].wrapS=g[h[0]];if(g[h[1]]!==void 0)a[b].wrapT=g[h[1]]}d(a[b],c+"/"+e)}function g(a){return(a[0]*255<<16)+(a[1]*255<<8)+a[2]*255}var e,h,i;h="MeshLambertMaterial";e={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:a.wireframe};a.shading&&(a.shading=="Phong"?h="MeshPhongMaterial":a.shading=="Basic"&&(h="MeshBasicMaterial"));
+if(a.blending)if(a.blending=="Additive")e.blending=THREE.AdditiveBlending;else if(a.blending=="Subtractive")e.blending=THREE.SubtractiveBlending;else if(a.blending=="Multiply")e.blending=THREE.MultiplyBlending;if(a.transparent!==void 0||a.opacity<1)e.transparent=a.transparent;if(a.depthTest!==void 0)e.depthTest=a.depthTest;if(a.vertexColors!==void 0)if(a.vertexColors=="face")e.vertexColors=THREE.FaceColors;else if(a.vertexColors)e.vertexColors=THREE.VertexColors;if(a.colorDiffuse)e.color=g(a.colorDiffuse);
+else if(a.DbgColor)e.color=a.DbgColor;if(a.colorSpecular)e.specular=g(a.colorSpecular);if(a.colorAmbient)e.ambient=g(a.colorAmbient);if(a.transparency)e.opacity=a.transparency;if(a.specularCoef)e.shininess=a.specularCoef;a.mapDiffuse&&c&&f(e,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap);a.mapLight&&c&&f(e,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap);a.mapNormal&&c&&f(e,"normalMap",a.mapNormal,a.mapNormalRepeat,a.mapNormalOffset,a.mapNormalWrap);
+a.mapSpecular&&c&&f(e,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){var j=THREE.ShaderUtils.lib.normal,k=THREE.UniformsUtils.clone(j.uniforms),m=e.color;h=e.specular;i=e.ambient;var o=e.shininess;k.tNormal.texture=e.normalMap;if(a.mapNormalFactor)k.uNormalScale.value=a.mapNormalFactor;if(e.map)k.tDiffuse.texture=e.map,k.enableDiffuse.value=!0;if(e.specularMap)k.tSpecular.texture=e.specularMap,k.enableSpecular.value=!0;if(e.lightMap)k.tAO.texture=
+e.lightMap,k.enableAO.value=!0;k.uDiffuseColor.value.setHex(m);k.uSpecularColor.value.setHex(h);k.uAmbientColor.value.setHex(i);k.uShininess.value=o;if(e.opacity)k.uOpacity.value=e.opacity;e=new THREE.ShaderMaterial({fragmentShader:j.fragmentShader,vertexShader:j.vertexShader,uniforms:k,lights:!0,fog:!0})}else e=new THREE[h](e);return e}};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;
 THREE.BinaryLoader.prototype.supr=THREE.Loader.prototype;
-THREE.BinaryLoader.prototype.load=function(a,c,b,e){if(a instanceof Object){console.warn("DEPRECATED: BinaryLoader( parameters ) is now BinaryLoader( url, callback, texturePath, binaryPath ).");var g=a,a=g.model,c=g.callback,b=g.texture_path,e=g.bin_path}var b=b?b:this.extractUrlbase(a),e=e?e:this.extractUrlbase(a),g=Date.now(),a=new Worker(a),h=this.showProgress?THREE.Loader.prototype.updateProgress:null;a.onmessage=function(a){THREE.BinaryLoader.prototype.loadAjaxBuffers(a.data.buffers,a.data.materials,
-c,e,b,h)};a.onerror=function(a){alert("worker.onerror: "+a.message+"\n"+a.data);a.preventDefault()};a.postMessage(g)};
-THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,c,b,e,g,h){var f=new XMLHttpRequest,k=e+"/"+a,l=0;f.onreadystatechange=function(){f.readyState==4?f.status==200||f.status==0?THREE.BinaryLoader.prototype.createBinModel(f.responseText,b,g,c):alert("Couldn't load ["+k+"] ["+f.status+"]"):f.readyState==3?h&&(l==0&&(l=f.getResponseHeader("Content-Length")),h({total:l,loaded:f.responseText.length})):f.readyState==2&&(l=f.getResponseHeader("Content-Length"))};f.open("GET",k,!0);f.overrideMimeType("text/plain; charset=x-user-defined");
-f.setRequestHeader("Content-Type","text/plain");f.send(null)};
-THREE.BinaryLoader.prototype.createBinModel=function(a,c,b,e){var g=function(b){function c(a,b){var e=n(a,b),f=n(a,b+1),h=n(a,b+2),g=n(a,b+3),k=(g<<1&255|h>>7)-127;e|=(h&127)<<16|f<<8;if(e==0&&k==-127)return 0;return(1-2*(g>>7))*(1+e*Math.pow(2,-23))*Math.pow(2,k)}function g(a,b){var c=n(a,b),e=n(a,b+1),f=n(a,b+2);return(n(a,b+3)<<24)+(f<<16)+(e<<8)+c}function l(a,b){var c=n(a,b);return(n(a,b+1)<<8)+c}function m(a,b){var c=n(a,b);return c>127?c-256:c}function n(a,b){return a.charCodeAt(b)&255}function o(b){var c,
-e,f;c=g(a,b);e=g(a,b+C);f=g(a,b+E);b=l(a,b+I);v.faces.push(new THREE.Face3(c,e,f,null,null,b))}function u(b){var c,e,f,h,m,n,o;c=g(a,b);e=g(a,b+C);f=g(a,b+E);h=l(a,b+I);m=g(a,b+G);n=g(a,b+K);o=g(a,b+B);var b=A[n*3],p=A[n*3+1];n=A[n*3+2];var u=A[o*3],t=A[o*3+1];o=A[o*3+2];v.faces.push(new THREE.Face3(c,e,f,[new THREE.Vector3(A[m*3],A[m*3+1],A[m*3+2]),new THREE.Vector3(b,p,n),new THREE.Vector3(u,t,o)],null,h))}function p(b){var c,e,f,h;c=g(a,b);e=g(a,b+F);f=g(a,b+J);h=g(a,b+M);b=l(a,b+N);v.faces.push(new THREE.Face4(c,
-e,f,h,null,null,b))}function z(b){var c,e,f,h,m,n,o,p,u;c=g(a,b);e=g(a,b+F);f=g(a,b+J);h=g(a,b+M);m=l(a,b+N);n=g(a,b+L);o=g(a,b+P);p=g(a,b+H);u=g(a,b+Q);var b=A[o*3],t=A[o*3+1];o=A[o*3+2];var la=A[p*3],ma=A[p*3+1];p=A[p*3+2];var na=A[u*3],w=A[u*3+1];u=A[u*3+2];v.faces.push(new THREE.Face4(c,e,f,h,[new THREE.Vector3(A[n*3],A[n*3+1],A[n*3+2]),new THREE.Vector3(b,t,o),new THREE.Vector3(la,ma,p),new THREE.Vector3(na,w,u)],null,m))}function w(b){var c,e,f,h;c=g(a,b);e=g(a,b+O);f=g(a,b+R);b=D[c*2];h=D[c*
-2+1];c=D[e*2];var l=v.faceVertexUvs[0];e=D[e*2+1];var m=D[f*2];f=D[f*2+1];var n=[];n.push(new THREE.UV(b,h));n.push(new THREE.UV(c,e));n.push(new THREE.UV(m,f));l.push(n)}function x(b){var c,e,f,h,l,m;c=g(a,b);e=g(a,b+U);f=g(a,b+S);h=g(a,b+T);b=D[c*2];l=D[c*2+1];c=D[e*2];m=D[e*2+1];e=D[f*2];var n=v.faceVertexUvs[0];f=D[f*2+1];var o=D[h*2];h=D[h*2+1];var p=[];p.push(new THREE.UV(b,l));p.push(new THREE.UV(c,m));p.push(new THREE.UV(e,f));p.push(new THREE.UV(o,h));n.push(p)}var v=this,y=0,t,A=[],D=[],
-C,E,I,G,K,B,F,J,M,N,L,P,H,Q,O,R,U,S,T,X,V,Z,Y,$,W;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(v,e,b);t={signature:a.substr(y,8),header_bytes:n(a,y+8),vertex_coordinate_bytes:n(a,y+9),normal_coordinate_bytes:n(a,y+10),uv_coordinate_bytes:n(a,y+11),vertex_index_bytes:n(a,y+12),normal_index_bytes:n(a,y+13),uv_index_bytes:n(a,y+14),material_index_bytes:n(a,y+15),nvertices:g(a,y+16),nnormals:g(a,y+16+4),nuvs:g(a,y+16+8),ntri_flat:g(a,y+16+12),ntri_smooth:g(a,y+16+16),ntri_flat_uv:g(a,
-y+16+20),ntri_smooth_uv:g(a,y+16+24),nquad_flat:g(a,y+16+28),nquad_smooth:g(a,y+16+32),nquad_flat_uv:g(a,y+16+36),nquad_smooth_uv:g(a,y+16+40)};y+=t.header_bytes;C=t.vertex_index_bytes;E=t.vertex_index_bytes*2;I=t.vertex_index_bytes*3;G=t.vertex_index_bytes*3+t.material_index_bytes;K=t.vertex_index_bytes*3+t.material_index_bytes+t.normal_index_bytes;B=t.vertex_index_bytes*3+t.material_index_bytes+t.normal_index_bytes*2;F=t.vertex_index_bytes;J=t.vertex_index_bytes*2;M=t.vertex_index_bytes*3;N=t.vertex_index_bytes*
-4;L=t.vertex_index_bytes*4+t.material_index_bytes;P=t.vertex_index_bytes*4+t.material_index_bytes+t.normal_index_bytes;H=t.vertex_index_bytes*4+t.material_index_bytes+t.normal_index_bytes*2;Q=t.vertex_index_bytes*4+t.material_index_bytes+t.normal_index_bytes*3;O=t.uv_index_bytes;R=t.uv_index_bytes*2;U=t.uv_index_bytes;S=t.uv_index_bytes*2;T=t.uv_index_bytes*3;b=t.vertex_index_bytes*3+t.material_index_bytes;W=t.vertex_index_bytes*4+t.material_index_bytes;X=t.ntri_flat*b;V=t.ntri_smooth*(b+t.normal_index_bytes*
-3);Z=t.ntri_flat_uv*(b+t.uv_index_bytes*3);Y=t.ntri_smooth_uv*(b+t.normal_index_bytes*3+t.uv_index_bytes*3);$=t.nquad_flat*W;b=t.nquad_smooth*(W+t.normal_index_bytes*4);W=t.nquad_flat_uv*(W+t.uv_index_bytes*4);y+=function(b){for(var e,h,g,k=t.vertex_coordinate_bytes*3,l=b+t.nvertices*k;b<l;b+=k)e=c(a,b),h=c(a,b+t.vertex_coordinate_bytes),g=c(a,b+t.vertex_coordinate_bytes*2),v.vertices.push(new THREE.Vertex(new THREE.Vector3(e,h,g)));return t.nvertices*k}(y);y+=function(b){for(var c,e,f,h=t.normal_coordinate_bytes*
-3,g=b+t.nnormals*h;b<g;b+=h)c=m(a,b),e=m(a,b+t.normal_coordinate_bytes),f=m(a,b+t.normal_coordinate_bytes*2),A.push(c/127,e/127,f/127);return t.nnormals*h}(y);y+=function(b){for(var e,h,g=t.uv_coordinate_bytes*2,k=b+t.nuvs*g;b<k;b+=g)e=c(a,b),h=c(a,b+t.uv_coordinate_bytes),D.push(e,h);return t.nuvs*g}(y);X=y+X;V=X+V;Z=V+Z;Y=Z+Y;$=Y+$;b=$+b;W=b+W;(function(a){var b,c=t.vertex_index_bytes*3+t.material_index_bytes,e=c+t.uv_index_bytes*3,f=a+t.ntri_flat_uv*e;for(b=a;b<f;b+=e)o(b),w(b+c);return f-a})(V);
-(function(a){var b,c=t.vertex_index_bytes*3+t.material_index_bytes+t.normal_index_bytes*3,e=c+t.uv_index_bytes*3,f=a+t.ntri_smooth_uv*e;for(b=a;b<f;b+=e)u(b),w(b+c);return f-a})(Z);(function(a){var b,c=t.vertex_index_bytes*4+t.material_index_bytes,e=c+t.uv_index_bytes*4,f=a+t.nquad_flat_uv*e;for(b=a;b<f;b+=e)p(b),x(b+c);return f-a})(b);(function(a){var b,c=t.vertex_index_bytes*4+t.material_index_bytes+t.normal_index_bytes*4,e=c+t.uv_index_bytes*4,f=a+t.nquad_smooth_uv*e;for(b=a;b<f;b+=e)z(b),x(b+
-c);return f-a})(W);(function(a){var b,c=t.vertex_index_bytes*3+t.material_index_bytes,e=a+t.ntri_flat*c;for(b=a;b<e;b+=c)o(b);return e-a})(y);(function(a){var b,c=t.vertex_index_bytes*3+t.material_index_bytes+t.normal_index_bytes*3,e=a+t.ntri_smooth*c;for(b=a;b<e;b+=c)u(b);return e-a})(X);(function(a){var b,c=t.vertex_index_bytes*4+t.material_index_bytes,e=a+t.nquad_flat*c;for(b=a;b<e;b+=c)p(b);return e-a})(Y);(function(a){var b,c=t.vertex_index_bytes*4+t.material_index_bytes+t.normal_index_bytes*
-4,e=a+t.nquad_smooth*c;for(b=a;b<e;b+=c)z(b);return e-a})($);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};g.prototype=new THREE.Geometry;g.prototype.constructor=g;c(new g(b))};
-THREE.ColladaLoader=function(){function a(a,e,g){V=a;e=e||$;g!==void 0&&(a=g.split("/"),a.pop(),ja=a.length<1?"":a.join("/")+"/");fa=c("//dae:library_images/dae:image",f,"image");ga=c("//dae:library_materials/dae:material",I,"material");ha=c("//dae:library_effects/dae:effect",J,"effect");ba=c("//dae:library_geometries/dae:geometry",x,"geometry");aa=c("//dae:library_controllers/dae:controller",k,"controller");ca=c("//dae:library_animations/dae:animation",N,"animation");ia=c(".//dae:library_visual_scenes/dae:visual_scene",
-n,"visual_scene");da=[];ea=[];(a=V.evaluate(".//dae:scene/dae:instance_visual_scene",V,Q,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(a=a.getAttribute("url").replace(/^#/,""),Y=ia[a]):Y=null;Z=new THREE.Object3D;for(a=0;a<Y.nodes.length;a++)Z.add(h(Y.nodes[a]));b();for(var l in ca);l={scene:Z,morphs:da,skins:ea,dae:{images:fa,materials:ga,effects:ha,geometries:ba,controllers:aa,animations:ca,visualScenes:ia,scene:Y}};e&&e(l);return l}function c(a,b,c){for(var a=V.evaluate(a,V,Q,XPathResult.ORDERED_NODE_ITERATOR_TYPE,
-null),e={},f=a.iterateNext(),h=0;f;){f=(new b).parse(f);if(f.id.length==0)f.id=c+h++;e[f.id]=f;f=a.iterateNext()}return e}function b(){var a=1E6,b=-a,c=0,e;for(e in ca)for(var f=ca[e],h=0;h<f.sampler.length;h++){var g=f.sampler[h];g.create();a=Math.min(a,g.startTime);b=Math.max(b,g.endTime);c=Math.max(c,g.input.length)}return{start:a,end:b,frames:c}}function e(a,b,c,f){a.world=a.world||new THREE.Matrix4;a.world.copy(a.matrix);if(a.channels&&a.channels.length){var h=a.channels[0].sampler.output[c];
-h instanceof THREE.Matrix4&&a.world.copy(h)}f&&a.world.multiply(f,a.world);b.push(a);for(f=0;f<a.nodes.length;f++)e(a.nodes[f],b,c,a.world)}function g(a,c,f){var h=aa[c.url];if(!h||!h.skin)console.log("ColladaLoader: Could not find skin controller.");else if(!c.skeleton||!c.skeleton.length)console.log("ColladaLoader: Could not find the skeleton for the skin. ");else{var g=b(),c=Y.getChildById(c.skeleton[0],!0)||Y.getChildBySid(c.skeleton[0],!0),k,l,m,n,o=new THREE.Vector3,p;for(k=0;k<a.vertices.length;k++)h.skin.bindShapeMatrix.multiplyVector3(a.vertices[k].position);
-for(f=0;f<g.frames;f++){var u=[],v=[];for(k=0;k<a.vertices.length;k++)v.push(new THREE.Vertex(new THREE.Vector3));e(c,u,f);k=u;l=h.skin;for(n=0;n<k.length;n++)if(m=k[n],p=-1,m.type=="JOINT"){for(var t=0;t<l.joints.length;t++)if(m.sid==l.joints[t]){p=t;break}if(p>=0){t=l.invBindMatrices[p];m.invBindMatrix=t;m.skinningMatrix=new THREE.Matrix4;m.skinningMatrix.multiply(m.world,t);m.weights=[];for(t=0;t<l.weights.length;t++)for(var w=0;w<l.weights[t].length;w++){var x=l.weights[t][w];x.joint==p&&m.weights.push(x)}}else throw"ColladaLoader: Could not find joint '"+
-m.sid+"'.";}for(k=0;k<u.length;k++)if(u[k].type=="JOINT")for(l=0;l<u[k].weights.length;l++)m=u[k].weights[l],n=m.index,m=m.weight,p=a.vertices[n],n=v[n],o.x=p.position.x,o.y=p.position.y,o.z=p.position.z,u[k].skinningMatrix.multiplyVector3(o),n.position.x+=o.x*m,n.position.y+=o.y*m,n.position.z+=o.z*m;a.morphTargets.push({name:"target_"+f,vertices:v})}}}function h(a){var b=new THREE.Object3D,c,e,f;for(f=0;f<a.controllers.length;f++){var k=aa[a.controllers[f].url];switch(k.type){case "skin":if(ba[k.skin.source]){var l=
-new w;l.url=k.skin.source;l.instance_material=a.controllers[f].instance_material;a.geometries.push(l);c=a.controllers[f]}else if(aa[k.skin.source]&&(e=k=aa[k.skin.source],k.morph&&ba[k.morph.source]))l=new w,l.url=k.morph.source,l.instance_material=a.controllers[f].instance_material,a.geometries.push(l);break;case "morph":if(ba[k.morph.source])l=new w,l.url=k.morph.source,l.instance_material=a.controllers[f].instance_material,a.geometries.push(l),e=a.controllers[f];console.log("ColladaLoader: Morph-controller partially supported.")}}for(f=
-0;f<a.geometries.length;f++){var k=a.geometries[f],l=k.instance_material,k=ba[k.url],m={},n=0,o;if(k&&k.mesh&&k.mesh.primitives){if(b.name.length==0)b.name=k.id;if(l)for(j=0;j<l.length;j++){o=l[j];var u=ha[ga[o.target].instance_effect.url].shader;u.material.opacity=!u.material.opacity?1:u.material.opacity;o=m[o.symbol]=u.material;n++}l=o||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});k=k.mesh.geometry3js;if(n>1){l=new THREE.MeshFaceMaterial;for(j=0;j<k.faces.length;j++)n=
-k.faces[j],n.materials=[m[n.daeMaterial]]}if(c!==void 0)g(k,c),l.morphTargets=!0,l=new THREE.SkinnedMesh(k,l),l.skeleton=c.skeleton,l.skinController=aa[c.url],l.skinInstanceController=c,l.name="skin_"+ea.length,ea.push(l);else if(e!==void 0){m=k;n=e instanceof p?aa[e.url]:e;if(!n||!n.morph)console.log("could not find morph controller!");else{n=n.morph;for(u=0;u<n.targets.length;u++){var t=ba[n.targets[u]];if(t.mesh&&t.mesh.primitives&&t.mesh.primitives.length)t=t.mesh.primitives[0].geometry,t.vertices.length===
-m.vertices.length&&m.morphTargets.push({name:"target_1",vertices:t.vertices})}m.morphTargets.push({name:"target_Z",vertices:m.vertices})}l.morphTargets=!0;l=new THREE.Mesh(k,l);l.name="morph_"+da.length;da.push(l)}else l=new THREE.Mesh(k,l);a.geometries.length>1?b.add(l):b=l}}b.name=a.id||"";a.matrix.decompose(b.position,b.rotation,b.scale);for(f=0;f<a.nodes.length;f++)b.add(h(a.nodes[f],a));return b}function f(){this.init_from=this.id=""}function k(){this.type=this.name=this.id="";this.morph=this.skin=
-null}function l(){this.weights=this.targets=this.source=this.method=null}function m(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function n(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function o(){this.sid=this.name=this.id="";this.nodes=[];this.controllers=[];this.transforms=[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function u(){this.type=this.sid="";this.data=[];this.matrix=new THREE.Matrix4}function p(){this.url=
-"";this.skeleton=[];this.instance_material=[]}function z(){this.target=this.symbol=""}function w(){this.url="";this.instance_material=[]}function x(){this.id="";this.mesh=null}function v(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function y(){}function t(){this.material="";this.count=0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function A(){this.source="";this.stride=this.count=0;this.params=[]}function D(){this.input={}}function C(){this.semantic=
-"";this.offset=0;this.source="";this.set=0}function E(a){this.id=a;this.type=null}function I(){this.name=this.id="";this.instance_effect=null}function G(){this.color=new THREE.Color(0);this.color.setRGB(Math.random(),Math.random(),Math.random());this.color.a=1;this.texcoord=this.texture=null}function K(a,b){this.type=a;this.effect=b;this.material=null}function B(a){this.effect=a;this.format=this.init_from=null}function F(a){this.effect=a;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=
-this.source=null}function J(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function M(){this.url=""}function N(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function L(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=this.dotSyntax=this.sid=null}function P(a){this.id="";this.animation=a;this.inputs=[];this.endTime=this.startTime=this.interpolation=this.output=this.input=null;this.duration=0}function H(a){var b=a.getAttribute("id");
-if(W[b]!=void 0)return W[b];W[b]=(new E(b)).parse(a);return W[b]}function Q(a){if(a=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function O(a){for(var a=U(a).split(/\s+/),b=[],c=0;c<a.length;c++)b.push(parseFloat(a[c]));return b}function R(a){for(var a=U(a).split(/\s+/),b=[],c=0;c<a.length;c++)b.push(parseInt(a[c],10));return b}function U(a){return a.replace(/^\s+/,"").replace(/\s+$/,"")}function S(a,b,c){return a.hasAttribute(b)?parseInt(a.getAttribute(b),10):c}function T(a,
-b){if(a===void 0){for(var c="0.";c.length<b+2;)c+="0";return c}b=b||2;c=a.toString().split(".");for(c[1]=c.length>1?c[1].substr(0,b):"0";c[1].length<b;)c[1]+="0";return c.join(".")}function X(a,b){var c="";c+=T(a.x,b)+",";c+=T(a.y,b)+",";c+=T(a.z,b);return c}var V=null,Z=null,Y,$=null,W={},fa={},ca={},aa={},ba={},ga={},ha={},ia,ja,da,ea,ka=THREE.SmoothShading;f.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName=="init_from")this.init_from=
-c.textContent}return this};k.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.type="none";for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "skin":this.skin=(new m).parse(c);this.type=c.nodeName;break;case "morph":this.morph=(new l).parse(c),this.type=c.nodeName}}return this};l.prototype.parse=function(a){var b={},c=[],e;this.method=a.getAttribute("method");this.source=a.getAttribute("source").replace(/^#/,"");for(e=
-0;e<a.childNodes.length;e++){var f=a.childNodes[e];if(f.nodeType==1)switch(f.nodeName){case "source":f=(new E).parse(f);b[f.id]=f;break;case "targets":c=this.parseInputs(f);break;default:console.log(f.nodeName)}}for(e=0;e<c.length;e++)switch(a=c[e],f=b[a.source],a.semantic){case "MORPH_TARGET":this.targets=f.read();break;case "MORPH_WEIGHT":this.weights=f.read()}return this};l.prototype.parseInputs=function(a){for(var b=[],c=0;c<a.childNodes.length;c++){var e=a.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "input":b.push((new C).parse(e))}}return b};
-m.prototype.parse=function(a){var b={},c,e;this.source=a.getAttribute("source").replace(/^#/,"");this.invBindMatrices=[];this.joints=[];this.weights=[];for(var f=0;f<a.childNodes.length;f++){var h=a.childNodes[f];if(h.nodeType==1)switch(h.nodeName){case "bind_shape_matrix":h=O(h.textContent);this.bindShapeMatrix=new THREE.Matrix4;this.bindShapeMatrix.set(h[0],h[1],h[2],h[3],h[4],h[5],h[6],h[7],h[8],h[9],h[10],h[11],h[12],h[13],h[14],h[15]);break;case "source":h=(new E).parse(h);b[h.id]=h;break;case "joints":c=
-h;break;case "vertex_weights":e=h;break;default:console.log(h.nodeName)}}this.parseJoints(c,b);this.parseWeights(e,b);return this};m.prototype.parseJoints=function(a,b){for(var c=0;c<a.childNodes.length;c++){var e=a.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "input":var e=(new C).parse(e),f=b[e.source];if(e.semantic=="JOINT")this.joints=f.read();else if(e.semantic=="INV_BIND_MATRIX")this.invBindMatrices=f.read()}}};m.prototype.parseWeights=function(a,b){for(var c,e,f=[],h=0;h<a.childNodes.length;h++){var g=
-a.childNodes[h];if(g.nodeType==1)switch(g.nodeName){case "input":f.push((new C).parse(g));break;case "v":c=R(g.textContent);break;case "vcount":e=R(g.textContent)}}for(h=g=0;h<e.length;h++){for(var k=e[h],l=[],m=0;m<k;m++){for(var n={},o=0;o<f.length;o++){var p=f[o],u=c[g+p.offset];switch(p.semantic){case "JOINT":n.joint=u;break;case "WEIGHT":n.weight=b[p.source].data[u]}}l.push(n);g+=f.length}for(m=0;m<l.length;m++)l[m].index=h;this.weights.push(l)}};n.prototype.getChildById=function(a,b){for(var c=
-0;c<this.nodes.length;c++){var e=this.nodes[c].getChildById(a,b);if(e)return e}return null};n.prototype.getChildBySid=function(a,b){for(var c=0;c<this.nodes.length;c++){var e=this.nodes[c].getChildBySid(a,b);if(e)return e}return null};n.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.nodes=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "node":this.nodes.push((new o).parse(c))}}return this};o.prototype.getChannelForTransform=
-function(a){for(var b=0;b<this.channels.length;b++){var c=this.channels[b],e=c.target.split("/");e.shift();var f=e.shift(),h=f.indexOf(".")>=0,g=f.indexOf("(")>=0,k;if(h)e=f.split("."),f=e.shift(),e.shift();else if(g){k=f.split("(");f=k.shift();for(e=0;e<k.length;e++)k[e]=parseInt(k[e].replace(/\)/,""))}if(f==a)return c.info={sid:f,dotSyntax:h,arrSyntax:g,arrIndices:k},c}return null};o.prototype.getChildById=function(a,b){if(this.id==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var e=this.nodes[c].getChildById(a,
-b);if(e)return e}return null};o.prototype.getChildBySid=function(a,b){if(this.sid==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var e=this.nodes[c].getChildBySid(a,b);if(e)return e}return null};o.prototype.getTransformBySid=function(a){for(var b=0;b<this.transforms.length;b++)if(this.transforms[b].sid==a)return this.transforms[b];return null};o.prototype.parse=function(a){var b;this.id=a.getAttribute("id");this.sid=a.getAttribute("sid");this.name=a.getAttribute("name");this.type=a.getAttribute("type");
-this.type=this.type=="JOINT"?this.type:"NODE";this.nodes=[];this.transforms=[];this.geometries=[];this.controllers=[];this.matrix=new THREE.Matrix4;for(var c=0;c<a.childNodes.length;c++)if(b=a.childNodes[c],b.nodeType==1)switch(b.nodeName){case "node":this.nodes.push((new o).parse(b));break;case "instance_camera":break;case "instance_controller":this.controllers.push((new p).parse(b));break;case "instance_geometry":this.geometries.push((new w).parse(b));break;case "instance_light":break;case "instance_node":b=
-b.getAttribute("url").replace(/^#/,"");(b=V.evaluate(".//dae:library_nodes//dae:node[@id='"+b+"']",V,Q,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new o).parse(b));break;case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new u).parse(b));break;case "extra":break;default:console.log(b.nodeName)}a=[];c=1E6;b=-1E6;for(var e in ca)for(var f=ca[e],h=0;h<f.channel.length;h++){var g=f.channel[h],k=f.sampler[h];e=g.target.split("/")[0];
-if(e==this.id)k.create(),g.sampler=k,c=Math.min(c,k.startTime),b=Math.max(b,k.endTime),a.push(g)}if(a.length)this.startTime=c,this.endTime=b;if((this.channels=a)&&this.channels.length){e=1E7;for(i=0;i<this.channels.length;i++){a=this.channels[i].sampler;for(c=0;c<a.input.length-1;c++)e=Math.min(e,a.input[c+1]-a.input[c])}c=[];for(a=this.startTime;a<this.endTime;a+=e){b=a;for(var f={},l=h=void 0,h=0;h<this.channels.length;h++)l=this.channels[h],f[l.sid]=l;g=new THREE.Matrix4;for(h=0;h<this.transforms.length;h++)if(k=
-this.transforms[h],l=f[k.sid],l!==void 0){for(var m=l.sampler,n,l=0;l<m.input.length-1;l++)if(m.input[l+1]>b){n=m.output[l];break}g=n!==void 0?n instanceof THREE.Matrix4?g.multiply(g,n):g.multiply(g,k.matrix):g.multiply(g,k.matrix)}else g=g.multiply(g,k.matrix);b=g;c.push({time:a,pos:[b.n14,b.n24,b.n34],rotq:[0,0,0,1],scl:[1,1,1]})}this.keys=c}this.updateMatrix();return this};o.prototype.updateMatrix=function(){this.matrix.identity();for(var a=0;a<this.transforms.length;a++)this.matrix.multiply(this.matrix,
-this.transforms[a].matrix)};u.prototype.parse=function(a){this.sid=a.getAttribute("sid");this.type=a.nodeName;this.data=O(a.textContent);this.updateMatrix();return this};u.prototype.updateMatrix=function(){var a=0;this.matrix.identity();switch(this.type){case "matrix":this.matrix.set(this.data[0],this.data[1],this.data[2],this.data[3],this.data[4],this.data[5],this.data[6],this.data[7],this.data[8],this.data[9],this.data[10],this.data[11],this.data[12],this.data[13],this.data[14],this.data[15]);break;
-case "translate":this.matrix.setTranslation(this.data[0],this.data[1],this.data[2]);break;case "rotate":a=this.data[3]*(Math.PI/180);this.matrix.setRotationAxis(new THREE.Vector3(this.data[0],this.data[1],this.data[2]),a);break;case "scale":this.matrix.setScale(this.data[0],this.data[1],this.data[2])}return this.matrix};p.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.skeleton=[];this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];
-if(c.nodeType==1)switch(c.nodeName){case "skeleton":this.skeleton.push(c.textContent.replace(/^#/,""));break;case "bind_material":if(c=V.evaluate(".//dae:instance_material",c,Q,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(var e=c.iterateNext();e;)this.instance_material.push((new z).parse(e)),e=c.iterateNext()}}return this};z.prototype.parse=function(a){this.symbol=a.getAttribute("symbol");this.target=a.getAttribute("target").replace(/^#/,"");return this};w.prototype.parse=function(a){this.url=
-a.getAttribute("url").replace(/^#/,"");this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1&&c.nodeName=="bind_material"){if(a=V.evaluate(".//dae:instance_material",c,Q,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(b=a.iterateNext();b;)this.instance_material.push((new z).parse(b)),b=a.iterateNext();break}}return this};x.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "mesh":this.mesh=
-(new v(this)).parse(c)}}return this};v.prototype.parse=function(a){function b(a,c){var e=X(a.position);f[e]===void 0&&(f[e]={v:a,index:c});return f[e]}this.primitives=[];var c;for(c=0;c<a.childNodes.length;c++){var e=a.childNodes[c];switch(e.nodeName){case "source":H(e);break;case "vertices":this.vertices=(new D).parse(e);break;case "triangles":this.primitives.push((new t).parse(e));break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new y).parse(e))}}var f=
-{};this.geometry3js=new THREE.Geometry;e=W[this.vertices.input.POSITION.source].data;for(a=c=0;c<e.length;c+=3,a++){var h=new THREE.Vertex(new THREE.Vector3(e[c],e[c+1],e[c+2]));b(h,a);this.geometry3js.vertices.push(h)}for(c=0;c<this.primitives.length;c++)primitive=this.primitives[c],primitive.setVertices(this.vertices),this.handlePrimitive(primitive,this.geometry3js,f);this.geometry3js.computeCentroids();this.geometry3js.computeFaceNormals();this.geometry3js.computeVertexNormals();this.geometry3js.computeBoundingBox();
-return this};v.prototype.handlePrimitive=function(a,b,c){var e=0,f,h,g=a.p,k=a.inputs,l,m,n,o=0,p=3,u=[];for(f=0;f<k.length;f++)switch(l=k[f],l.semantic){case "TEXCOORD":u.push(l.set)}for(;e<g.length;){var t=[],v=[],w={},x=[];a.vcount&&(p=a.vcount[o++]);for(f=0;f<p;f++)for(h=0;h<k.length;h++)switch(l=k[h],source=W[l.source],m=g[e+f*k.length+l.offset],numParams=source.accessor.params.length,n=m*numParams,l.semantic){case "VERTEX":l=X(b.vertices[m].position);t.push(c[l].index);break;case "NORMAL":v.push(new THREE.Vector3(source.data[n],
-source.data[n+1],source.data[n+2]));break;case "TEXCOORD":w[l.set]===void 0&&(w[l.set]=[]);w[l.set].push(new THREE.UV(source.data[n],source.data[n+1]));break;case "COLOR":x.push((new THREE.Color).setRGB(source.data[n],source.data[n+1],source.data[n+2]))}var z;p==3?z=new THREE.Face3(t[0],t[1],t[2],[v[0],v[1],v[2]],x.length?x:new THREE.Color):p==4&&(z=new THREE.Face4(t[0],t[1],t[2],t[3],[v[0],v[1],v[2],v[3]],x.length?x:new THREE.Color));z.daeMaterial=a.material;b.faces.push(z);for(h=0;h<u.length;h++)f=
-w[u[h]],b.faceVertexUvs[h].push([f[0],f[1],f[2]]);e+=k.length*p}};y.prototype=new t;y.prototype.constructor=y;t.prototype.setVertices=function(a){for(var b=0;b<this.inputs.length;b++)if(this.inputs[b].source==a.id)this.inputs[b].source=a.input.POSITION.source};t.prototype.parse=function(a){this.inputs=[];this.material=a.getAttribute("material");this.count=S(a,"count",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "input":this.inputs.push((new C).parse(a.childNodes[b]));
-break;case "vcount":this.vcount=R(c.textContent);break;case "p":this.p=R(c.textContent)}}return this};A.prototype.parse=function(a){this.params=[];this.source=a.getAttribute("source");this.count=S(a,"count",0);this.stride=S(a,"stride",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName=="param"){var e={};e.name=c.getAttribute("name");e.type=c.getAttribute("type");this.params.push(e)}}return this};D.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++)a.childNodes[b].nodeName==
-"input"&&(input=(new C).parse(a.childNodes[b]),this.input[input.semantic]=input);return this};C.prototype.parse=function(a){this.semantic=a.getAttribute("semantic");this.source=a.getAttribute("source").replace(/^#/,"");this.set=S(a,"set",-1);this.offset=S(a,"offset",0);if(this.semantic=="TEXCOORD"&&this.set<0)this.set=0;return this};E.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "bool_array":for(var e=
-U(c.textContent).split(/\s+/),f=[],h=0;h<e.length;h++)f.push(e[h]=="true"||e[h]=="1"?!0:!1);this.data=f;this.type=c.nodeName;break;case "float_array":this.data=O(c.textContent);this.type=c.nodeName;break;case "int_array":this.data=R(c.textContent);this.type=c.nodeName;break;case "IDREF_array":case "Name_array":this.data=U(c.textContent).split(/\s+/);this.type=c.nodeName;break;case "technique_common":for(e=0;e<c.childNodes.length;e++)if(c.childNodes[e].nodeName=="accessor"){this.accessor=(new A).parse(c.childNodes[e]);
-break}}}return this};E.prototype.read=function(){var a=[],b=this.accessor.params[0];switch(b.type){case "IDREF":case "Name":case "name":case "float":return this.data;case "float4x4":for(b=0;b<this.data.length;b+=16){var c=this.data.slice(b,b+16),e=new THREE.Matrix4;e.set(c[0],c[1],c[2],c[3],c[4],c[5],c[6],c[7],c[8],c[9],c[10],c[11],c[12],c[13],c[14],c[15]);a.push(e)}break;default:console.log("ColladaLoader: Source: Read dont know how to read "+b.type+".")}return a};I.prototype.parse=function(a){this.id=
-a.getAttribute("id");this.name=a.getAttribute("name");for(var b=0;b<a.childNodes.length;b++)if(a.childNodes[b].nodeName=="instance_effect"){this.instance_effect=(new M).parse(a.childNodes[b]);break}return this};G.prototype.isColor=function(){return this.texture==null};G.prototype.isTexture=function(){return this.texture!=null};G.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "color":c=O(c.textContent);this.color=new THREE.Color(0);
-this.color.setRGB(c[0],c[1],c[2]);this.color.a=c[3];break;case "texture":this.texture=c.getAttribute("texture"),this.texcoord=c.getAttribute("texcoord")}}return this};K.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[c.nodeName]=(new G).parse(c);break;case "shininess":case "reflectivity":case "transparency":var e;e=V.evaluate(".//dae:float",
-c,Q,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);for(var f=e.iterateNext(),h=[];f;)h.push(f),f=e.iterateNext();e=h;e.length>0&&(this[c.nodeName]=parseFloat(e[0].textContent))}}this.create();return this};K.prototype.create=function(){var a={},b=this.transparency!==void 0&&this.transparency<1,c;for(c in this)switch(c){case "ambient":case "emission":case "diffuse":case "specular":var e=this[c];if(e instanceof G)if(e.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==
-this.effect.surface.sid&&(e=fa[this.effect.surface.init_from]))a.map=THREE.ImageUtils.loadTexture(ja+e.init_from),a.map.wrapS=THREE.RepeatWrapping,a.map.wrapT=THREE.RepeatWrapping,a.map.repeat.x=1,a.map.repeat.y=-1}else c=="diffuse"?a.color=e.color.getHex():b||(a[c]=e.color.getHex());break;case "shininess":case "reflectivity":a[c]=this[c];break;case "transparency":if(b)a.transparent=!0,a.opacity=this[c],b=!0}a.shading=ka;return this.material=new THREE.MeshLambertMaterial(a)};B.prototype.parse=function(a){for(var b=
-0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "init_from":this.init_from=c.textContent;break;case "format":this.format=c.textContent;break;default:console.log("unhandled Surface prop: "+c.nodeName)}}return this};F.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "source":this.source=c.textContent;break;case "minfilter":this.minfilter=c.textContent;break;case "magfilter":this.magfilter=
-c.textContent;break;case "mipfilter":this.mipfilter=c.textContent;break;case "wrap_s":this.wrap_s=c.textContent;break;case "wrap_t":this.wrap_t=c.textContent;break;default:console.log("unhandled Sampler2D prop: "+c.nodeName)}}return this};J.prototype.create=function(){if(this.shader==null)return null};J.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.shader=null;for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "profile_COMMON":this.parseTechnique(this.parseProfileCOMMON(c))}}return this};
-J.prototype.parseNewparam=function(a){for(var b=a.getAttribute("sid"),c=0;c<a.childNodes.length;c++){var e=a.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "surface":this.surface=(new B(this)).parse(e);this.surface.sid=b;break;case "sampler2D":this.sampler=(new F(this)).parse(e);this.sampler.sid=b;break;case "extra":break;default:console.log(e.nodeName)}}};J.prototype.parseProfileCOMMON=function(a){for(var b,c=0;c<a.childNodes.length;c++){var e=a.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "profile_COMMON":this.parseProfileCOMMON(e);
-break;case "technique":b=e;break;case "newparam":this.parseNewparam(e);break;case "extra":break;default:console.log(e.nodeName)}}return b};J.prototype.parseTechnique=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "lambert":case "blinn":case "phong":this.shader=(new K(c.nodeName,this)).parse(c)}}};M.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");return this};N.prototype.parse=function(a){this.id=a.getAttribute("id");
-this.name=a.getAttribute("name");this.source={};for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "source":c=(new E).parse(c);this.source[c.id]=c;break;case "sampler":this.sampler.push((new P(this)).parse(c));break;case "channel":this.channel.push((new L(this)).parse(c))}}return this};L.prototype.parse=function(a){this.source=a.getAttribute("source").replace(/^#/,"");this.target=a.getAttribute("target");var b=this.target.split("/");b.shift();var a=
-b.shift(),c=a.indexOf(".")>=0,e=a.indexOf("(")>=0,f,h;if(c)b=a.split("."),a=b.shift(),h=b.shift();else if(e){f=a.split("(");a=f.shift();for(b=0;b<f.length;b++)f[b]=parseInt(f[b].replace(/\)/,""))}this.sid=a;this.dotSyntax=c;this.arrSyntax=e;this.arrIndices=f;this.member=h;return this};P.prototype.parse=function(a){this.id=a.getAttribute("id");this.inputs=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "input":this.inputs.push((new C).parse(c))}}return this};
-P.prototype.create=function(){for(var a=0;a<this.inputs.length;a++){var b=this.inputs[a],c=this.animation.source[b.source];switch(b.semantic){case "INPUT":this.input=c.read();break;case "OUTPUT":this.output=c.read();break;case "INTERPOLATION":this.interpolation=c.read();break;case "IN_TANGENT":break;case "OUT_TANGENT":break;default:console.log(b.semantic)}}this.duration=this.endTime=this.startTime=0;if(this.input.length){this.startTime=1E8;this.endTime=-1E8;for(a=0;a<this.input.length;a++)this.startTime=
-Math.min(this.startTime,this.input[a]),this.endTime=Math.max(this.endTime,this.input[a]);this.duration=this.endTime-this.startTime}};return{load:function(b,c){if(document.implementation&&document.implementation.createDocument){document.implementation.createDocument("http://www.collada.org/2005/11/COLLADASchema","COLLADA",null);b+="?rnd="+Math.random();var e=new XMLHttpRequest;e.overrideMimeType&&e.overrideMimeType("text/xml");e.onreadystatechange=function(){if(e.readyState==4&&(e.status==0||e.status==
-200))$=c,a(e.responseXML,void 0,b)};e.open("GET",b,!0);e.send(null)}else alert("Don't know how to parse XML!")},parse:a,setPreferredShading:function(a){ka=a},applySkin:g,geometries:ba}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;
-THREE.JSONLoader.prototype.load=function(a,c,b){var e,g=this;if(a instanceof Object)console.warn("DEPRECATED: JSONLoader( parameters ) is now JSONLoader( url, callback, texturePath )."),e=a,a=e.model,c=e.callback,b=e.texture_path;e=new Worker(a);b=b?b:this.extractUrlbase(a);e.onmessage=function(a){g.createModel(a.data,c,b);g.onLoadComplete()};this.onLoadStart();e.postMessage(Date.now())};
-THREE.JSONLoader.prototype.createModel=function(a,c,b){var e=new THREE.Geometry,g=a.scale!==void 0?1/a.scale:1;this.initMaterials(e,a.materials,b);(function(b){if(a.version===void 0||a.version!=2)console.error("Deprecated file format.");else{var c,g,l,m,n,o,u,p,z,w,x,v,y,t,A=a.faces;o=a.vertices;var D=a.normals,C=a.colors,E=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&E++;for(c=0;c<E;c++)e.faceUvs[c]=[],e.faceVertexUvs[c]=[];m=0;for(n=o.length;m<n;)u=new THREE.Vertex,u.position.x=o[m++]*b,u.position.y=
-o[m++]*b,u.position.z=o[m++]*b,e.vertices.push(u);m=0;for(n=A.length;m<n;){b=A[m++];o=b&1;l=b&2;c=b&4;g=b&8;p=b&16;u=b&32;w=b&64;b&=128;o?(x=new THREE.Face4,x.a=A[m++],x.b=A[m++],x.c=A[m++],x.d=A[m++],o=4):(x=new THREE.Face3,x.a=A[m++],x.b=A[m++],x.c=A[m++],o=3);if(l)l=A[m++],x.materialIndex=l;l=e.faces.length;if(c)for(c=0;c<E;c++)v=a.uvs[c],z=A[m++],t=v[z*2],z=v[z*2+1],e.faceUvs[c][l]=new THREE.UV(t,z);if(g)for(c=0;c<E;c++){v=a.uvs[c];y=[];for(g=0;g<o;g++)z=A[m++],t=v[z*2],z=v[z*2+1],y[g]=new THREE.UV(t,
-z);e.faceVertexUvs[c][l]=y}if(p)p=A[m++]*3,g=new THREE.Vector3,g.x=D[p++],g.y=D[p++],g.z=D[p],x.normal=g;if(u)for(c=0;c<o;c++)p=A[m++]*3,g=new THREE.Vector3,g.x=D[p++],g.y=D[p++],g.z=D[p],x.vertexNormals.push(g);if(w)u=A[m++],u=new THREE.Color(C[u]),x.color=u;if(b)for(c=0;c<o;c++)u=A[m++],u=new THREE.Color(C[u]),x.vertexColors.push(u);e.faces.push(x)}}})(g);(function(){var b,c,g,l;if(a.skinWeights){b=0;for(c=a.skinWeights.length;b<c;b+=2)g=a.skinWeights[b],l=a.skinWeights[b+1],e.skinWeights.push(new THREE.Vector4(g,
-l,0,0))}if(a.skinIndices){b=0;for(c=a.skinIndices.length;b<c;b+=2)g=a.skinIndices[b],l=a.skinIndices[b+1],e.skinIndices.push(new THREE.Vector4(g,l,0,0))}e.bones=a.bones;e.animation=a.animation})();(function(b){if(a.morphTargets!==void 0){var c,g,l,m,n,o,u,p,z;c=0;for(g=a.morphTargets.length;c<g;c++){e.morphTargets[c]={};e.morphTargets[c].name=a.morphTargets[c].name;e.morphTargets[c].vertices=[];p=e.morphTargets[c].vertices;z=a.morphTargets[c].vertices;l=0;for(m=z.length;l<m;l+=3)n=z[l]*b,o=z[l+1]*
-b,u=z[l+2]*b,p.push(new THREE.Vertex(new THREE.Vector3(n,o,u)))}}if(a.morphColors!==void 0){c=0;for(g=a.morphColors.length;c<g;c++){e.morphColors[c]={};e.morphColors[c].name=a.morphColors[c].name;e.morphColors[c].colors=[];m=e.morphColors[c].colors;n=a.morphColors[c].colors;b=0;for(l=n.length;b<l;b+=3)o=new THREE.Color(16755200),o.setRGB(n[b],n[b+1],n[b+2]),m.push(o)}}})(g);e.computeCentroids();e.computeFaceNormals();this.hasNormals(e)&&e.computeTangents();c(e)};
+THREE.BinaryLoader.prototype.load=function(a,c,b,d){if(a instanceof Object){console.warn("DEPRECATED: BinaryLoader( parameters ) is now BinaryLoader( url, callback, texturePath, binaryPath ).");var f=a,a=f.model,c=f.callback,b=f.texture_path,d=f.bin_path}var b=b?b:this.extractUrlbase(a),d=d?d:this.extractUrlbase(a),f=Date.now(),a=new Worker(a),g=this.showProgress?THREE.Loader.prototype.updateProgress:null;a.onmessage=function(a){THREE.BinaryLoader.prototype.loadAjaxBuffers(a.data.buffers,a.data.materials,
+c,d,b,g)};a.onerror=function(a){alert("worker.onerror: "+a.message+"\n"+a.data);a.preventDefault()};a.postMessage(f)};
+THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,c,b,d,f,g){var e=new XMLHttpRequest,h=d+"/"+a,i=0;e.onreadystatechange=function(){e.readyState==4?e.status==200||e.status==0?THREE.BinaryLoader.prototype.createBinModel(e.responseText,b,f,c):alert("Couldn't load ["+h+"] ["+e.status+"]"):e.readyState==3?g&&(i==0&&(i=e.getResponseHeader("Content-Length")),g({total:i,loaded:e.responseText.length})):e.readyState==2&&(i=e.getResponseHeader("Content-Length"))};e.open("GET",h,!0);e.overrideMimeType("text/plain; charset=x-user-defined");
+e.setRequestHeader("Content-Type","text/plain");e.send(null)};
+THREE.BinaryLoader.prototype.createBinModel=function(a,c,b,d){var f=function(b){function c(a,b){var d=k(a,b),e=k(a,b+1),g=k(a,b+2),f=k(a,b+3),h=(f<<1&255|g>>7)-127;d|=(g&127)<<16|e<<8;if(d==0&&h==-127)return 0;return(1-2*(f>>7))*(1+d*Math.pow(2,-23))*Math.pow(2,h)}function f(a,b){var c=k(a,b),d=k(a,b+1),e=k(a,b+2);return(k(a,b+3)<<24)+(e<<16)+(d<<8)+c}function i(a,b){var c=k(a,b);return(k(a,b+1)<<8)+c}function j(a,b){var c=k(a,b);return c>127?c-256:c}function k(a,b){return a.charCodeAt(b)&255}function m(b){var c,
+d,e;c=f(a,b);d=f(a,b+x);e=f(a,b+y);b=i(a,b+C);p.faces.push(new THREE.Face3(c,d,e,null,null,b))}function o(b){var c,d,e,g,j,k,m;c=f(a,b);d=f(a,b+x);e=f(a,b+y);g=i(a,b+C);j=f(a,b+A);k=f(a,b+E);m=f(a,b+u);var b=v[k*3],l=v[k*3+1];k=v[k*3+2];var n=v[m*3],o=v[m*3+1];m=v[m*3+2];p.faces.push(new THREE.Face3(c,d,e,[new THREE.Vector3(v[j*3],v[j*3+1],v[j*3+2]),new THREE.Vector3(b,l,k),new THREE.Vector3(n,o,m)],null,g))}function n(b){var c,d,e,g;c=f(a,b);d=f(a,b+G);e=f(a,b+D);g=f(a,b+H);b=i(a,b+B);p.faces.push(new THREE.Face4(c,
+d,e,g,null,null,b))}function t(b){var c,d,e,g,j,k,m,l,n;c=f(a,b);d=f(a,b+G);e=f(a,b+D);g=f(a,b+H);j=i(a,b+B);k=f(a,b+F);m=f(a,b+J);l=f(a,b+N);n=f(a,b+M);var b=v[m*3],o=v[m*3+1];m=v[m*3+2];var fa=v[l*3],ga=v[l*3+1];l=v[l*3+2];var ha=v[n*3],q=v[n*3+1];n=v[n*3+2];p.faces.push(new THREE.Face4(c,d,e,g,[new THREE.Vector3(v[k*3],v[k*3+1],v[k*3+2]),new THREE.Vector3(b,o,m),new THREE.Vector3(fa,ga,l),new THREE.Vector3(ha,q,n)],null,j))}function q(b){var c,d,e,g;c=f(a,b);d=f(a,b+O);e=f(a,b+z);b=w[c*2];g=w[c*
+2+1];c=w[d*2];var i=p.faceVertexUvs[0];d=w[d*2+1];var j=w[e*2];e=w[e*2+1];var k=[];k.push(new THREE.UV(b,g));k.push(new THREE.UV(c,d));k.push(new THREE.UV(j,e));i.push(k)}function r(b){var c,d,e,g,i,j;c=f(a,b);d=f(a,b+K);e=f(a,b+I);g=f(a,b+L);b=w[c*2];i=w[c*2+1];c=w[d*2];j=w[d*2+1];d=w[e*2];var k=p.faceVertexUvs[0];e=w[e*2+1];var m=w[g*2];g=w[g*2+1];var l=[];l.push(new THREE.UV(b,i));l.push(new THREE.UV(c,j));l.push(new THREE.UV(d,e));l.push(new THREE.UV(m,g));k.push(l)}var p=this,s=0,l,v=[],w=[],
+x,y,C,A,E,u,G,D,H,B,F,J,N,M,O,z,K,I,L,R,P,T,S,U,Q;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(p,d,b);l={signature:a.substr(s,8),header_bytes:k(a,s+8),vertex_coordinate_bytes:k(a,s+9),normal_coordinate_bytes:k(a,s+10),uv_coordinate_bytes:k(a,s+11),vertex_index_bytes:k(a,s+12),normal_index_bytes:k(a,s+13),uv_index_bytes:k(a,s+14),material_index_bytes:k(a,s+15),nvertices:f(a,s+16),nnormals:f(a,s+16+4),nuvs:f(a,s+16+8),ntri_flat:f(a,s+16+12),ntri_smooth:f(a,s+16+16),ntri_flat_uv:f(a,
+s+16+20),ntri_smooth_uv:f(a,s+16+24),nquad_flat:f(a,s+16+28),nquad_smooth:f(a,s+16+32),nquad_flat_uv:f(a,s+16+36),nquad_smooth_uv:f(a,s+16+40)};s+=l.header_bytes;x=l.vertex_index_bytes;y=l.vertex_index_bytes*2;C=l.vertex_index_bytes*3;A=l.vertex_index_bytes*3+l.material_index_bytes;E=l.vertex_index_bytes*3+l.material_index_bytes+l.normal_index_bytes;u=l.vertex_index_bytes*3+l.material_index_bytes+l.normal_index_bytes*2;G=l.vertex_index_bytes;D=l.vertex_index_bytes*2;H=l.vertex_index_bytes*3;B=l.vertex_index_bytes*
+4;F=l.vertex_index_bytes*4+l.material_index_bytes;J=l.vertex_index_bytes*4+l.material_index_bytes+l.normal_index_bytes;N=l.vertex_index_bytes*4+l.material_index_bytes+l.normal_index_bytes*2;M=l.vertex_index_bytes*4+l.material_index_bytes+l.normal_index_bytes*3;O=l.uv_index_bytes;z=l.uv_index_bytes*2;K=l.uv_index_bytes;I=l.uv_index_bytes*2;L=l.uv_index_bytes*3;b=l.vertex_index_bytes*3+l.material_index_bytes;Q=l.vertex_index_bytes*4+l.material_index_bytes;R=l.ntri_flat*b;P=l.ntri_smooth*(b+l.normal_index_bytes*
+3);T=l.ntri_flat_uv*(b+l.uv_index_bytes*3);S=l.ntri_smooth_uv*(b+l.normal_index_bytes*3+l.uv_index_bytes*3);U=l.nquad_flat*Q;b=l.nquad_smooth*(Q+l.normal_index_bytes*4);Q=l.nquad_flat_uv*(Q+l.uv_index_bytes*4);s+=function(b){for(var d,g,f,h=l.vertex_coordinate_bytes*3,i=b+l.nvertices*h;b<i;b+=h)d=c(a,b),g=c(a,b+l.vertex_coordinate_bytes),f=c(a,b+l.vertex_coordinate_bytes*2),p.vertices.push(new THREE.Vertex(new THREE.Vector3(d,g,f)));return l.nvertices*h}(s);s+=function(b){for(var c,d,e,g=l.normal_coordinate_bytes*
+3,f=b+l.nnormals*g;b<f;b+=g)c=j(a,b),d=j(a,b+l.normal_coordinate_bytes),e=j(a,b+l.normal_coordinate_bytes*2),v.push(c/127,d/127,e/127);return l.nnormals*g}(s);s+=function(b){for(var d,g,f=l.uv_coordinate_bytes*2,h=b+l.nuvs*f;b<h;b+=f)d=c(a,b),g=c(a,b+l.uv_coordinate_bytes),w.push(d,g);return l.nuvs*f}(s);R=s+R;P=R+P;T=P+T;S=T+S;U=S+U;b=U+b;Q=b+Q;(function(a){var b,c=l.vertex_index_bytes*3+l.material_index_bytes,d=c+l.uv_index_bytes*3,e=a+l.ntri_flat_uv*d;for(b=a;b<e;b+=d)m(b),q(b+c);return e-a})(P);
+(function(a){var b,c=l.vertex_index_bytes*3+l.material_index_bytes+l.normal_index_bytes*3,d=c+l.uv_index_bytes*3,e=a+l.ntri_smooth_uv*d;for(b=a;b<e;b+=d)o(b),q(b+c);return e-a})(T);(function(a){var b,c=l.vertex_index_bytes*4+l.material_index_bytes,d=c+l.uv_index_bytes*4,e=a+l.nquad_flat_uv*d;for(b=a;b<e;b+=d)n(b),r(b+c);return e-a})(b);(function(a){var b,c=l.vertex_index_bytes*4+l.material_index_bytes+l.normal_index_bytes*4,d=c+l.uv_index_bytes*4,e=a+l.nquad_smooth_uv*d;for(b=a;b<e;b+=d)t(b),r(b+
+c);return e-a})(Q);(function(a){var b,c=l.vertex_index_bytes*3+l.material_index_bytes,d=a+l.ntri_flat*c;for(b=a;b<d;b+=c)m(b);return d-a})(s);(function(a){var b,c=l.vertex_index_bytes*3+l.material_index_bytes+l.normal_index_bytes*3,d=a+l.ntri_smooth*c;for(b=a;b<d;b+=c)o(b);return d-a})(R);(function(a){var b,c=l.vertex_index_bytes*4+l.material_index_bytes,d=a+l.nquad_flat*c;for(b=a;b<d;b+=c)n(b);return d-a})(S);(function(a){var b,c=l.vertex_index_bytes*4+l.material_index_bytes+l.normal_index_bytes*
+4,d=a+l.nquad_smooth*c;for(b=a;b<d;b+=c)t(b);return d-a})(U);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};f.prototype=new THREE.Geometry;f.prototype.constructor=f;c(new f(b))};
+THREE.ColladaLoader=function(){function a(a,d,f){P=a;d=d||U;f!==void 0&&(a=f.split("/"),a.pop(),da=a.length<1?"":a.join("/")+"/");$=c("//dae:library_images/dae:image",e,"image");aa=c("//dae:library_materials/dae:material",C,"material");ba=c("//dae:library_effects/dae:effect",D,"effect");W=c("//dae:library_geometries/dae:geometry",r,"geometry");V=c("//dae:library_controllers/dae:controller",h,"controller");X=c("//dae:library_animations/dae:animation",B,"animation");ca=c(".//dae:library_visual_scenes/dae:visual_scene",
+k,"visual_scene");Y=[];Z=[];(a=P.evaluate(".//dae:scene/dae:instance_visual_scene",P,M,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(a=a.getAttribute("url").replace(/^#/,""),S=ca[a]):S=null;T=new THREE.Object3D;for(a=0;a<S.nodes.length;a++)T.add(g(S.nodes[a]));b();for(var i in X);i={scene:T,morphs:Y,skins:Z,dae:{images:$,materials:aa,effects:ba,geometries:W,controllers:V,animations:X,visualScenes:ca,scene:S}};d&&d(i);return i}function c(a,b,c){for(var a=P.evaluate(a,P,M,XPathResult.ORDERED_NODE_ITERATOR_TYPE,
+null),d={},e=a.iterateNext(),g=0;e;){e=(new b).parse(e);if(e.id.length==0)e.id=c+g++;d[e.id]=e;e=a.iterateNext()}return d}function b(){var a=1E6,b=-a,c=0,d;for(d in X)for(var e=X[d],g=0;g<e.sampler.length;g++){var f=e.sampler[g];f.create();a=Math.min(a,f.startTime);b=Math.max(b,f.endTime);c=Math.max(c,f.input.length)}return{start:a,end:b,frames:c}}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 g=a.channels[0].sampler.output[c];g instanceof
+THREE.Matrix4&&a.world.copy(g)}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,c,e){var g=V[c.url];if(!g||!g.skin)console.log("ColladaLoader: Could not find skin controller.");else if(!c.skeleton||!c.skeleton.length)console.log("ColladaLoader: Could not find the skeleton for the skin. ");else{var f=b(),c=S.getChildById(c.skeleton[0],!0)||S.getChildBySid(c.skeleton[0],!0),h,i,j,k,m=new THREE.Vector3,l;for(h=0;h<a.vertices.length;h++)g.skin.bindShapeMatrix.multiplyVector3(a.vertices[h].position);
+for(e=0;e<f.frames;e++){var n=[],o=[];for(h=0;h<a.vertices.length;h++)o.push(new THREE.Vertex(new THREE.Vector3));d(c,n,e);h=n;i=g.skin;for(k=0;k<h.length;k++)if(j=h[k],l=-1,j.type=="JOINT"){for(var p=0;p<i.joints.length;p++)if(j.sid==i.joints[p]){l=p;break}if(l>=0){p=i.invBindMatrices[l];j.invBindMatrix=p;j.skinningMatrix=new THREE.Matrix4;j.skinningMatrix.multiply(j.world,p);j.weights=[];for(p=0;p<i.weights.length;p++)for(var q=0;q<i.weights[p].length;q++){var r=i.weights[p][q];r.joint==l&&j.weights.push(r)}}else throw"ColladaLoader: Could not find joint '"+
+j.sid+"'.";}for(h=0;h<n.length;h++)if(n[h].type=="JOINT")for(i=0;i<n[h].weights.length;i++)j=n[h].weights[i],k=j.index,j=j.weight,l=a.vertices[k],k=o[k],m.x=l.position.x,m.y=l.position.y,m.z=l.position.z,n[h].skinningMatrix.multiplyVector3(m),k.position.x+=m.x*j,k.position.y+=m.y*j,k.position.z+=m.z*j;a.morphTargets.push({name:"target_"+e,vertices:o})}}}function g(a){var b=new THREE.Object3D,c,d,e,h;for(e=0;e<a.controllers.length;e++){var i=V[a.controllers[e].url];switch(i.type){case "skin":if(W[i.skin.source]){var j=
+new q;j.url=i.skin.source;j.instance_material=a.controllers[e].instance_material;a.geometries.push(j);c=a.controllers[e]}else if(V[i.skin.source]&&(d=i=V[i.skin.source],i.morph&&W[i.morph.source]))j=new q,j.url=i.morph.source,j.instance_material=a.controllers[e].instance_material,a.geometries.push(j);break;case "morph":if(W[i.morph.source])j=new q,j.url=i.morph.source,j.instance_material=a.controllers[e].instance_material,a.geometries.push(j),d=a.controllers[e];console.log("ColladaLoader: Morph-controller partially supported.")}}for(e=
+0;e<a.geometries.length;e++){var i=a.geometries[e],j=i.instance_material,i=W[i.url],k={},m=0,l;if(i&&i.mesh&&i.mesh.primitives){if(b.name.length==0)b.name=i.id;if(j)for(h=0;h<j.length;h++){l=j[h];var o=ba[aa[l.target].instance_effect.url].shader;o.material.opacity=!o.material.opacity?1:o.material.opacity;l=k[l.symbol]=o.material;m++}j=l||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});i=i.mesh.geometry3js;if(m>1){j=new THREE.MeshFaceMaterial;for(h=0;h<i.faces.length;h++)m=
+i.faces[h],m.materials=[k[m.daeMaterial]]}if(c!==void 0)f(i,c),j.morphTargets=!0,j=new THREE.SkinnedMesh(i,j),j.skeleton=c.skeleton,j.skinController=V[c.url],j.skinInstanceController=c,j.name="skin_"+Z.length,Z.push(j);else if(d!==void 0){h=i;k=d instanceof n?V[d.url]:d;if(!k||!k.morph)console.log("could not find morph controller!");else{k=k.morph;for(m=0;m<k.targets.length;m++)if(o=W[k.targets[m]],o.mesh&&o.mesh.primitives&&o.mesh.primitives.length)o=o.mesh.primitives[0].geometry,o.vertices.length===
+h.vertices.length&&h.morphTargets.push({name:"target_1",vertices:o.vertices});h.morphTargets.push({name:"target_Z",vertices:h.vertices})}j.morphTargets=!0;j=new THREE.Mesh(i,j);j.name="morph_"+Y.length;Y.push(j)}else j=new THREE.Mesh(i,j);a.geometries.length>1?b.add(j):b=j}}b.name=a.id||"";a.matrix.decompose(b.position,b.rotation,b.scale);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 m(){this.sid=this.name=this.id="";this.nodes=[];this.controllers=[];this.transforms=[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function o(){this.type=this.sid="";this.data=[];this.matrix=new THREE.Matrix4}function n(){this.url=
+"";this.skeleton=[];this.instance_material=[]}function t(){this.target=this.symbol=""}function q(){this.url="";this.instance_material=[]}function r(){this.id="";this.mesh=null}function p(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function s(){}function l(){this.material="";this.count=0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function v(){this.source="";this.stride=this.count=0;this.params=[]}function w(){this.input={}}function x(){this.semantic=
+"";this.offset=0;this.source="";this.set=0}function y(a){this.id=a;this.type=null}function C(){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.texcoord=this.texture=null}function E(a,b){this.type=a;this.effect=b;this.material=null}function u(a){this.effect=a;this.format=this.init_from=null}function G(a){this.effect=a;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=
+this.source=null}function D(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function H(){this.url=""}function B(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function F(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=this.dotSyntax=this.sid=null}function J(a){this.id="";this.animation=a;this.inputs=[];this.endTime=this.startTime=this.interpolation=this.output=this.input=null;this.duration=0}function N(a){var b=a.getAttribute("id");
+if(Q[b]!=void 0)return Q[b];Q[b]=(new y(b)).parse(a);return Q[b]}function M(a){if(a=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function O(a){for(var a=K(a).split(/\s+/),b=[],c=0;c<a.length;c++)b.push(parseFloat(a[c]));return b}function z(a){for(var a=K(a).split(/\s+/),b=[],c=0;c<a.length;c++)b.push(parseInt(a[c],10));return b}function K(a){return a.replace(/^\s+/,"").replace(/\s+$/,"")}function I(a,b,c){return a.hasAttribute(b)?parseInt(a.getAttribute(b),10):c}function L(a,
+b){if(a===void 0){for(var c="0.";c.length<b+2;)c+="0";return c}b=b||2;c=a.toString().split(".");for(c[1]=c.length>1?c[1].substr(0,b):"0";c[1].length<b;)c[1]+="0";return c.join(".")}function R(a,b){var c="";c+=L(a.x,b)+",";c+=L(a.y,b)+",";c+=L(a.z,b);return c}var P=null,T=null,S,U=null,Q={},$={},X={},V={},W={},aa={},ba={},ca,da,Y,Z,ea=THREE.SmoothShading;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(c.nodeName=="init_from")this.init_from=
+c.textContent}return this};h.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.type="none";for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "skin":this.skin=(new j).parse(c);this.type=c.nodeName;break;case "morph":this.morph=(new i).parse(c),this.type=c.nodeName}}return this};i.prototype.parse=function(a){var b={},c=[],d;this.method=a.getAttribute("method");this.source=a.getAttribute("source").replace(/^#/,"");for(d=
+0;d<a.childNodes.length;d++){var e=a.childNodes[d];if(e.nodeType==1)switch(e.nodeName){case "source":e=(new y).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(d.nodeType==1)switch(d.nodeName){case "input":b.push((new x).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 g=a.childNodes[e];if(g.nodeType==1)switch(g.nodeName){case "bind_shape_matrix":g=O(g.textContent);this.bindShapeMatrix=new THREE.Matrix4;this.bindShapeMatrix.set(g[0],g[1],g[2],g[3],g[4],g[5],g[6],g[7],g[8],g[9],g[10],g[11],g[12],g[13],g[14],g[15]);break;case "source":g=(new y).parse(g);b[g.id]=g;break;case "joints":c=
+g;break;case "vertex_weights":d=g;break;default:console.log(g.nodeName)}}this.parseJoints(c,b);this.parseWeights(d,b);return this};j.prototype.parseJoints=function(a,b){for(var c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "input":var d=(new x).parse(d),e=b[d.source];if(d.semantic=="JOINT")this.joints=e.read();else if(d.semantic=="INV_BIND_MATRIX")this.invBindMatrices=e.read()}}};j.prototype.parseWeights=function(a,b){for(var c,d,e=[],g=0;g<a.childNodes.length;g++){var f=
+a.childNodes[g];if(f.nodeType==1)switch(f.nodeName){case "input":e.push((new x).parse(f));break;case "v":c=z(f.textContent);break;case "vcount":d=z(f.textContent)}}for(g=f=0;g<d.length;g++){for(var h=d[g],i=[],j=0;j<h;j++){for(var k={},m=0;m<e.length;m++){var l=e[m],n=c[f+l.offset];switch(l.semantic){case "JOINT":k.joint=n;break;case "WEIGHT":k.weight=b[l.source].data[n]}}i.push(k);f+=e.length}for(j=0;j<i.length;j++)i[j].index=g;this.weights.push(i)}};k.prototype.getChildById=function(a,b){for(var c=
+0;c<this.nodes.length;c++){var d=this.nodes[c].getChildById(a,b);if(d)return d}return null};k.prototype.getChildBySid=function(a,b){for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildBySid(a,b);if(d)return d}return null};k.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.nodes=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "node":this.nodes.push((new m).parse(c))}}return this};m.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(),g=e.indexOf(".")>=0,f=e.indexOf("(")>=0,h;if(g)d=e.split("."),e=d.shift(),d.shift();else if(f){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:g,arrSyntax:f,arrIndices:h},c}return null};m.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};m.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};m.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};m.prototype.parse=function(a){var b;this.id=a.getAttribute("id");this.sid=a.getAttribute("sid");this.name=a.getAttribute("name");this.type=a.getAttribute("type");
+this.type=this.type=="JOINT"?this.type:"NODE";this.nodes=[];this.transforms=[];this.geometries=[];this.controllers=[];this.matrix=new THREE.Matrix4;for(var c=0;c<a.childNodes.length;c++)if(b=a.childNodes[c],b.nodeType==1)switch(b.nodeName){case "node":this.nodes.push((new m).parse(b));break;case "instance_camera":break;case "instance_controller":this.controllers.push((new n).parse(b));break;case "instance_geometry":this.geometries.push((new q).parse(b));break;case "instance_light":break;case "instance_node":b=
+b.getAttribute("url").replace(/^#/,"");(b=P.evaluate(".//dae:library_nodes//dae:node[@id='"+b+"']",P,M,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new m).parse(b));break;case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new o).parse(b));break;case "extra":break;default:console.log(b.nodeName)}a=[];c=1E6;b=-1E6;for(var d in X)for(var e=X[d],g=0;g<e.channel.length;g++){var f=e.channel[g],h=e.sampler[g];d=f.target.split("/")[0];
+if(d==this.id)h.create(),f.sampler=h,c=Math.min(c,h.startTime),b=Math.max(b,h.endTime),a.push(f)}if(a.length)this.startTime=c,this.endTime=b;if((this.channels=a)&&this.channels.length){d=1E7;for(a=0;a<this.channels.length;a++){c=this.channels[a].sampler;for(b=0;b<c.input.length-1;b++)d=Math.min(d,c.input[b+1]-c.input[b])}c=[];for(a=this.startTime;a<this.endTime;a+=d){b=a;for(var e={},i=g=void 0,g=0;g<this.channels.length;g++)i=this.channels[g],e[i.sid]=i;f=new THREE.Matrix4;for(g=0;g<this.transforms.length;g++)if(h=
+this.transforms[g],i=e[h.sid],i!==void 0){for(var j=i.sampler,k,i=0;i<j.input.length-1;i++)if(j.input[i+1]>b){k=j.output[i];break}f=k!==void 0?k instanceof THREE.Matrix4?f.multiply(f,k):f.multiply(f,h.matrix):f.multiply(f,h.matrix)}else f=f.multiply(f,h.matrix);b=f;c.push({time:a,pos:[b.n14,b.n24,b.n34],rotq:[0,0,0,1],scl:[1,1,1]})}this.keys=c}this.updateMatrix();return this};m.prototype.updateMatrix=function(){this.matrix.identity();for(var a=0;a<this.transforms.length;a++)this.matrix.multiply(this.matrix,
+this.transforms[a].matrix)};o.prototype.parse=function(a){this.sid=a.getAttribute("sid");this.type=a.nodeName;this.data=O(a.textContent);this.updateMatrix();return this};o.prototype.updateMatrix=function(){var a=0;this.matrix.identity();switch(this.type){case "matrix":this.matrix.set(this.data[0],this.data[1],this.data[2],this.data[3],this.data[4],this.data[5],this.data[6],this.data[7],this.data[8],this.data[9],this.data[10],this.data[11],this.data[12],this.data[13],this.data[14],this.data[15]);break;
+case "translate":this.matrix.setTranslation(this.data[0],this.data[1],this.data[2]);break;case "rotate":a=this.data[3]*(Math.PI/180);this.matrix.setRotationAxis(new THREE.Vector3(this.data[0],this.data[1],this.data[2]),a);break;case "scale":this.matrix.setScale(this.data[0],this.data[1],this.data[2])}return this.matrix};n.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.skeleton=[];this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];
+if(c.nodeType==1)switch(c.nodeName){case "skeleton":this.skeleton.push(c.textContent.replace(/^#/,""));break;case "bind_material":if(c=P.evaluate(".//dae:instance_material",c,M,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(var d=c.iterateNext();d;)this.instance_material.push((new t).parse(d)),d=c.iterateNext()}}return this};t.prototype.parse=function(a){this.symbol=a.getAttribute("symbol");this.target=a.getAttribute("target").replace(/^#/,"");return this};q.prototype.parse=function(a){this.url=
+a.getAttribute("url").replace(/^#/,"");this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1&&c.nodeName=="bind_material"){if(a=P.evaluate(".//dae:instance_material",c,M,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(b=a.iterateNext();b;)this.instance_material.push((new t).parse(b)),b=a.iterateNext();break}}return this};r.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "mesh":this.mesh=
+(new p(this)).parse(c)}}return this};p.prototype.parse=function(a){function b(a,c){var d=R(a.position);e[d]===void 0&&(e[d]={v:a,index:c});return e[d]}this.primitives=[];var c;for(c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];switch(d.nodeName){case "source":N(d);break;case "vertices":this.vertices=(new w).parse(d);break;case "triangles":this.primitives.push((new l).parse(d));break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new s).parse(d))}}var e=
+{};this.geometry3js=new THREE.Geometry;d=Q[this.vertices.input.POSITION.source].data;for(a=c=0;c<d.length;c+=3,a++){var g=new THREE.Vertex(new THREE.Vector3(d[c],d[c+1],d[c+2]));b(g,a);this.geometry3js.vertices.push(g)}for(c=0;c<this.primitives.length;c++)a=this.primitives[c],a.setVertices(this.vertices),this.handlePrimitive(a,this.geometry3js,e);this.geometry3js.computeCentroids();this.geometry3js.computeFaceNormals();this.geometry3js.computeVertexNormals();this.geometry3js.computeBoundingBox();
+return this};p.prototype.handlePrimitive=function(a,b,c){var d=0,e,g,f=a.p,h=a.inputs,i,j,k,m,l=0,n=3,o=[];for(e=0;e<h.length;e++)switch(i=h[e],i.semantic){case "TEXCOORD":o.push(i.set)}for(;d<f.length;){var p=[],q=[],r={},t=[];a.vcount&&(n=a.vcount[l++]);for(e=0;e<n;e++)for(g=0;g<h.length;g++)switch(i=h[g],m=Q[i.source],j=f[d+e*h.length+i.offset],k=m.accessor.params.length,k*=j,i.semantic){case "VERTEX":i=R(b.vertices[j].position);p.push(c[i].index);break;case "NORMAL":q.push(new THREE.Vector3(m.data[k],
+m.data[k+1],m.data[k+2]));break;case "TEXCOORD":r[i.set]===void 0&&(r[i.set]=[]);r[i.set].push(new THREE.UV(m.data[k],m.data[k+1]));break;case "COLOR":t.push((new THREE.Color).setRGB(m.data[k],m.data[k+1],m.data[k+2]))}var s;n==3?s=new THREE.Face3(p[0],p[1],p[2],[q[0],q[1],q[2]],t.length?t:new THREE.Color):n==4&&(s=new THREE.Face4(p[0],p[1],p[2],p[3],[q[0],q[1],q[2],q[3]],t.length?t:new THREE.Color));s.daeMaterial=a.material;b.faces.push(s);for(g=0;g<o.length;g++)e=r[o[g]],b.faceVertexUvs[g].push([e[0],
+e[1],e[2]]);d+=h.length*n}};s.prototype=new l;s.prototype.constructor=s;l.prototype.setVertices=function(a){for(var b=0;b<this.inputs.length;b++)if(this.inputs[b].source==a.id)this.inputs[b].source=a.input.POSITION.source};l.prototype.parse=function(a){this.inputs=[];this.material=a.getAttribute("material");this.count=I(a,"count",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "input":this.inputs.push((new x).parse(a.childNodes[b]));break;case "vcount":this.vcount=
+z(c.textContent);break;case "p":this.p=z(c.textContent)}}return this};v.prototype.parse=function(a){this.params=[];this.source=a.getAttribute("source");this.count=I(a,"count",0);this.stride=I(a,"stride",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName=="param"){var d={};d.name=c.getAttribute("name");d.type=c.getAttribute("type");this.params.push(d)}}return this};w.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++)if(a.childNodes[b].nodeName==
+"input"){var c=(new x).parse(a.childNodes[b]);this.input[c.semantic]=c}return this};x.prototype.parse=function(a){this.semantic=a.getAttribute("semantic");this.source=a.getAttribute("source").replace(/^#/,"");this.set=I(a,"set",-1);this.offset=I(a,"offset",0);if(this.semantic=="TEXCOORD"&&this.set<0)this.set=0;return this};y.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "bool_array":for(var d=K(c.textContent).split(/\s+/),
+e=[],g=0;g<d.length;g++)e.push(d[g]=="true"||d[g]=="1"?!0:!1);this.data=e;this.type=c.nodeName;break;case "float_array":this.data=O(c.textContent);this.type=c.nodeName;break;case "int_array":this.data=z(c.textContent);this.type=c.nodeName;break;case "IDREF_array":case "Name_array":this.data=K(c.textContent).split(/\s+/);this.type=c.nodeName;break;case "technique_common":for(d=0;d<c.childNodes.length;d++)if(c.childNodes[d].nodeName=="accessor"){this.accessor=(new v).parse(c.childNodes[d]);break}}}return this};
+y.prototype.read=function(){var a=[],b=this.accessor.params[0];switch(b.type){case "IDREF":case "Name":case "name":case "float":return this.data;case "float4x4":for(b=0;b<this.data.length;b+=16){var c=this.data.slice(b,b+16),d=new THREE.Matrix4;d.set(c[0],c[1],c[2],c[3],c[4],c[5],c[6],c[7],c[8],c[9],c[10],c[11],c[12],c[13],c[14],c[15]);a.push(d)}break;default:console.log("ColladaLoader: Source: Read dont know how to read "+b.type+".")}return a};C.prototype.parse=function(a){this.id=a.getAttribute("id");
+this.name=a.getAttribute("name");for(var b=0;b<a.childNodes.length;b++)if(a.childNodes[b].nodeName=="instance_effect"){this.instance_effect=(new H).parse(a.childNodes[b]);break}return this};A.prototype.isColor=function(){return this.texture==null};A.prototype.isTexture=function(){return this.texture!=null};A.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "color":c=O(c.textContent);this.color=new THREE.Color(0);this.color.setRGB(c[0],
+c[1],c[2]);this.color.a=c[3];break;case "texture":this.texture=c.getAttribute("texture"),this.texcoord=c.getAttribute("texcoord")}}return this};E.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[c.nodeName]=(new A).parse(c);break;case "shininess":case "reflectivity":case "transparency":var d;d=P.evaluate(".//dae:float",c,M,XPathResult.ORDERED_NODE_ITERATOR_TYPE,
+null);for(var e=d.iterateNext(),g=[];e;)g.push(e),e=d.iterateNext();d=g;d.length>0&&(this[c.nodeName]=parseFloat(d[0].textContent))}}this.create();return this};E.prototype.create=function(){var a={},b=this.transparency!==void 0&&this.transparency<1,c;for(c in this)switch(c){case "ambient":case "emission":case "diffuse":case "specular":var d=this[c];if(d instanceof A)if(d.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid&&(d=$[this.effect.surface.init_from]))a.map=
+THREE.ImageUtils.loadTexture(da+d.init_from),a.map.wrapS=THREE.RepeatWrapping,a.map.wrapT=THREE.RepeatWrapping,a.map.repeat.x=1,a.map.repeat.y=-1}else c=="diffuse"?a.color=d.color.getHex():b||(a[c]=d.color.getHex());break;case "shininess":case "reflectivity":a[c]=this[c];break;case "transparency":if(b)a.transparent=!0,a.opacity=this[c],b=!0}a.shading=ea;return this.material=new THREE.MeshLambertMaterial(a)};u.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];
+if(c.nodeType==1)switch(c.nodeName){case "init_from":this.init_from=c.textContent;break;case "format":this.format=c.textContent;break;default:console.log("unhandled Surface prop: "+c.nodeName)}}return this};G.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "source":this.source=c.textContent;break;case "minfilter":this.minfilter=c.textContent;break;case "magfilter":this.magfilter=c.textContent;break;case "mipfilter":this.mipfilter=
+c.textContent;break;case "wrap_s":this.wrap_s=c.textContent;break;case "wrap_t":this.wrap_t=c.textContent;break;default:console.log("unhandled Sampler2D prop: "+c.nodeName)}}return this};D.prototype.create=function(){if(this.shader==null)return null};D.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.shader=null;for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "profile_COMMON":this.parseTechnique(this.parseProfileCOMMON(c))}}return this};
+D.prototype.parseNewparam=function(a){for(var b=a.getAttribute("sid"),c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "surface":this.surface=(new u(this)).parse(d);this.surface.sid=b;break;case "sampler2D":this.sampler=(new G(this)).parse(d);this.sampler.sid=b;break;case "extra":break;default:console.log(d.nodeName)}}};D.prototype.parseProfileCOMMON=function(a){for(var b,c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "profile_COMMON":this.parseProfileCOMMON(d);
+break;case "technique":b=d;break;case "newparam":this.parseNewparam(d);break;case "extra":break;default:console.log(d.nodeName)}}return b};D.prototype.parseTechnique=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "lambert":case "blinn":case "phong":this.shader=(new E(c.nodeName,this)).parse(c)}}};H.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");return this};B.prototype.parse=function(a){this.id=a.getAttribute("id");
+this.name=a.getAttribute("name");this.source={};for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "source":c=(new y).parse(c);this.source[c.id]=c;break;case "sampler":this.sampler.push((new J(this)).parse(c));break;case "channel":this.channel.push((new F(this)).parse(c))}}return this};F.prototype.parse=function(a){this.source=a.getAttribute("source").replace(/^#/,"");this.target=a.getAttribute("target");var b=this.target.split("/");b.shift();var a=
+b.shift(),c=a.indexOf(".")>=0,d=a.indexOf("(")>=0,e,g;if(c)b=a.split("."),a=b.shift(),g=b.shift();else if(d){e=a.split("(");a=e.shift();for(b=0;b<e.length;b++)e[b]=parseInt(e[b].replace(/\)/,""))}this.sid=a;this.dotSyntax=c;this.arrSyntax=d;this.arrIndices=e;this.member=g;return this};J.prototype.parse=function(a){this.id=a.getAttribute("id");this.inputs=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "input":this.inputs.push((new x).parse(c))}}return this};
+J.prototype.create=function(){for(var a=0;a<this.inputs.length;a++){var b=this.inputs[a],c=this.animation.source[b.source];switch(b.semantic){case "INPUT":this.input=c.read();break;case "OUTPUT":this.output=c.read();break;case "INTERPOLATION":this.interpolation=c.read();break;case "IN_TANGENT":break;case "OUT_TANGENT":break;default:console.log(b.semantic)}}this.duration=this.endTime=this.startTime=0;if(this.input.length){this.startTime=1E8;this.endTime=-1E8;for(a=0;a<this.input.length;a++)this.startTime=
+Math.min(this.startTime,this.input[a]),this.endTime=Math.max(this.endTime,this.input[a]);this.duration=this.endTime-this.startTime}};return{load:function(b,c){if(document.implementation&&document.implementation.createDocument){document.implementation.createDocument("http://www.collada.org/2005/11/COLLADASchema","COLLADA",null);b+="?rnd="+Math.random();var d=new XMLHttpRequest;d.overrideMimeType&&d.overrideMimeType("text/xml");d.onreadystatechange=function(){if(d.readyState==4&&(d.status==0||d.status==
+200))U=c,a(d.responseXML,void 0,b)};d.open("GET",b,!0);d.send(null)}else alert("Don't know how to parse XML!")},parse:a,setPreferredShading:function(a){ea=a},applySkin:f,geometries:W}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;
+THREE.JSONLoader.prototype.load=function(a,c,b){var d,f=this;if(a instanceof Object)console.warn("DEPRECATED: JSONLoader( parameters ) is now JSONLoader( url, callback, texturePath )."),d=a,a=d.model,c=d.callback,b=d.texture_path;d=new Worker(a);b=b?b:this.extractUrlbase(a);d.onmessage=function(a){f.createModel(a.data,c,b);f.onLoadComplete()};this.onLoadStart();d.postMessage(Date.now())};
+THREE.JSONLoader.prototype.createModel=function(a,c,b){var d=new THREE.Geometry,f=a.scale!==void 0?1/a.scale:1;this.initMaterials(d,a.materials,b);(function(b){if(a.version===void 0||a.version!=2)console.error("Deprecated file format.");else{var c,f,i,j,k,m,o,n,t,q,r,p,s,l,v=a.faces;m=a.vertices;var w=a.normals,x=a.colors,y=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&y++;for(c=0;c<y;c++)d.faceUvs[c]=[],d.faceVertexUvs[c]=[];j=0;for(k=m.length;j<k;)o=new THREE.Vertex,o.position.x=m[j++]*b,o.position.y=
+m[j++]*b,o.position.z=m[j++]*b,d.vertices.push(o);j=0;for(k=v.length;j<k;){b=v[j++];m=b&1;i=b&2;c=b&4;f=b&8;n=b&16;o=b&32;q=b&64;b&=128;m?(r=new THREE.Face4,r.a=v[j++],r.b=v[j++],r.c=v[j++],r.d=v[j++],m=4):(r=new THREE.Face3,r.a=v[j++],r.b=v[j++],r.c=v[j++],m=3);if(i)i=v[j++],r.materialIndex=i;i=d.faces.length;if(c)for(c=0;c<y;c++)p=a.uvs[c],t=v[j++],l=p[t*2],t=p[t*2+1],d.faceUvs[c][i]=new THREE.UV(l,t);if(f)for(c=0;c<y;c++){p=a.uvs[c];s=[];for(f=0;f<m;f++)t=v[j++],l=p[t*2],t=p[t*2+1],s[f]=new THREE.UV(l,
+t);d.faceVertexUvs[c][i]=s}if(n)n=v[j++]*3,f=new THREE.Vector3,f.x=w[n++],f.y=w[n++],f.z=w[n],r.normal=f;if(o)for(c=0;c<m;c++)n=v[j++]*3,f=new THREE.Vector3,f.x=w[n++],f.y=w[n++],f.z=w[n],r.vertexNormals.push(f);if(q)o=v[j++],o=new THREE.Color(x[o]),r.color=o;if(b)for(c=0;c<m;c++)o=v[j++],o=new THREE.Color(x[o]),r.vertexColors.push(o);d.faces.push(r)}}})(f);(function(){var b,c,f,i;if(a.skinWeights){b=0;for(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){b=0;for(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(a.morphTargets!==void 0){var c,f,i,j,k,m,o,n,t;c=0;for(f=a.morphTargets.length;c<f;c++){d.morphTargets[c]={};d.morphTargets[c].name=a.morphTargets[c].name;d.morphTargets[c].vertices=[];n=d.morphTargets[c].vertices;t=a.morphTargets[c].vertices;i=0;for(j=t.length;i<j;i+=3)k=t[i]*b,m=t[i+1]*
+b,o=t[i+2]*b,n.push(new THREE.Vertex(new THREE.Vector3(k,m,o)))}}if(a.morphColors!==void 0){c=0;for(f=a.morphColors.length;c<f;c++){d.morphColors[c]={};d.morphColors[c].name=a.morphColors[c].name;d.morphColors[c].colors=[];j=d.morphColors[c].colors;k=a.morphColors[c].colors;b=0;for(i=k.length;b<i;b+=3)m=new THREE.Color(16755200),m.setRGB(k[b],k[b+1],k[b+2]),j.push(m)}}})(f);d.computeCentroids();d.computeFaceNormals();this.hasNormals(d)&&d.computeTangents();c(d)};
 THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};
-THREE.SceneLoader.prototype={load:function(a,c){var b=this,e=new Worker(a);e.postMessage(0);var g=THREE.Loader.prototype.extractUrlbase(a);e.onmessage=function(a){function e(a,b){return b=="relativeToHTML"?a:g+"/"+a}function k(){for(p in F.objects)if(!H.objects[p])if(y=F.objects[p],y.geometry!==void 0){if(C=H.geometries[y.geometry]){var a=!1;for(O=0;O<y.materials.length;O++)K=H.materials[y.materials[O]],a=K instanceof THREE.ShaderMaterial;a&&C.computeTangents();t=y.position;r=y.rotation;q=y.quaternion;
-s=y.scale;q=0;K.length==0&&(K=new THREE.MeshFaceMaterial);K.length>1&&(K=new THREE.MeshFaceMaterial);object=new THREE.Mesh(C,K);object.name=p;object.position.set(t[0],t[1],t[2]);q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=y.visible;H.scene.add(object);H.objects[p]=object;y.meshCollider&&(a=THREE.CollisionUtils.MeshColliderWBox(object),H.scene.collisions.colliders.push(a));if(y.castsShadow)a=
-new THREE.ShadowVolume(C),H.scene.add(a),a.position=object.position,a.rotation=object.rotation,a.scale=object.scale;y.trigger&&y.trigger.toLowerCase()!="none"&&(a={type:y.trigger,object:y},H.triggers[object.name]=a)}}else t=y.position,r=y.rotation,q=y.quaternion,s=y.scale,q=0,object=new THREE.Object3D,object.name=p,object.position.set(t[0],t[1],t[2]),q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]),object.scale.set(s[0],s[1],s[2]),object.visible=
-y.visible!==void 0?y.visible:!1,H.scene.add(object),H.objects[p]=object,H.empties[p]=object,y.trigger&&y.trigger.toLowerCase()!="none"&&(a={type:y.trigger,object:y},H.triggers[object.name]=a)}function l(a){return function(c){H.geometries[a]=c;k();M-=1;b.onLoadComplete();n()}}function m(a){return function(b){H.geometries[a]=b}}function n(){b.callbackProgress({totalModels:L,totalTextures:P,loadedModels:L-M,loadedTextures:P-N},H);b.onLoadProgress();M==0&&N==0&&c(H)}var o,u,p,z,w,x,v,y,t,A,D,C,E,I,G,
-K,B,F,J,M,N,L,P,H;F=a.data;G=new THREE.BinaryLoader;J=new THREE.JSONLoader;N=M=0;H={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};a=!1;for(p in F.objects)if(y=F.objects[p],y.meshCollider){a=!0;break}if(a)H.scene.collisions=new THREE.CollisionSystem;if(F.transform){a=F.transform.position;A=F.transform.rotation;var Q=F.transform.scale;a&&H.scene.position.set(a[0],a[1],a[2]);A&&H.scene.rotation.set(A[0],A[1],A[2]);Q&&H.scene.scale.set(Q[0],
-Q[1],Q[2]);(a||A||Q)&&H.scene.updateMatrix()}a=function(){N-=1;n();b.onLoadComplete()};for(w in F.cameras)A=F.cameras[w],A.type=="perspective"?E=new THREE.PerspectiveCamera(A.fov,A.aspect,A.near,A.far):A.type=="ortho"&&(E=new THREE.OrthographicCamera(A.left,A.right,A.top,A.bottom,A.near,A.far)),t=A.position,A=A.target,E.position.set(t[0],t[1],t[2]),E.target=new THREE.Vector3(A[0],A[1],A[2]),H.cameras[w]=E;for(z in F.lights)w=F.lights[z],E=w.color!==void 0?w.color:16777215,A=w.intensity!==void 0?w.intensity:
-1,w.type=="directional"?(t=w.direction,B=new THREE.DirectionalLight(E,A),B.position.set(t[0],t[1],t[2]),B.position.normalize()):w.type=="point"?(t=w.position,d=w.distance,B=new THREE.PointLight(E,A,d),B.position.set(t[0],t[1],t[2])):w.type=="ambient"&&(B=new THREE.AmbientLight(E)),H.scene.add(B),H.lights[z]=B;for(x in F.fogs)z=F.fogs[x],z.type=="linear"?I=new THREE.Fog(0,z.near,z.far):z.type=="exp2"&&(I=new THREE.FogExp2(0,z.density)),A=z.color,I.color.setRGB(A[0],A[1],A[2]),H.fogs[x]=I;if(H.cameras&&
-F.defaults.camera)H.currentCamera=H.cameras[F.defaults.camera];if(H.fogs&&F.defaults.fog)H.scene.fog=H.fogs[F.defaults.fog];A=F.defaults.bgcolor;H.bgColor=new THREE.Color;H.bgColor.setRGB(A[0],A[1],A[2]);H.bgColorAlpha=F.defaults.bgalpha;for(o in F.geometries)if(x=F.geometries[o],x.type=="bin_mesh"||x.type=="ascii_mesh")M+=1,b.onLoadStart();L=M;for(o in F.geometries)x=F.geometries[o],x.type=="cube"?(C=new THREE.CubeGeometry(x.width,x.height,x.depth,x.segmentsWidth,x.segmentsHeight,x.segmentsDepth,
-null,x.flipped,x.sides),H.geometries[o]=C):x.type=="plane"?(C=new THREE.PlaneGeometry(x.width,x.height,x.segmentsWidth,x.segmentsHeight),H.geometries[o]=C):x.type=="sphere"?(C=new THREE.SphereGeometry(x.radius,x.segmentsWidth,x.segmentsHeight),H.geometries[o]=C):x.type=="cylinder"?(C=new THREE.CylinderGeometry(x.topRad,x.botRad,x.height,x.radSegs,x.heightSegs),H.geometries[o]=C):x.type=="torus"?(C=new THREE.TorusGeometry(x.radius,x.tube,x.segmentsR,x.segmentsT),H.geometries[o]=C):x.type=="icosahedron"?
-(C=new THREE.IcosahedronGeometry(x.subdivisions),H.geometries[o]=C):x.type=="bin_mesh"?G.load(e(x.url,F.urlBaseType),l(o)):x.type=="ascii_mesh"?J.load(e(x.url,F.urlBaseType),l(o)):x.type=="embedded_mesh"&&(x=F.embeds[x.id])&&J.createModel(x,m(o),"");for(v in F.textures)if(o=F.textures[v],o.url instanceof Array){N+=o.url.length;for(G=0;G<o.url.length;G++)b.onLoadStart()}else N+=1,b.onLoadStart();P=N;for(v in F.textures){o=F.textures[v];if(o.mapping!=void 0&&THREE[o.mapping]!=void 0)o.mapping=new THREE[o.mapping];
-if(o.url instanceof Array){G=[];for(var O=0;O<o.url.length;O++)G[O]=e(o.url[O],F.urlBaseType);G=THREE.ImageUtils.loadTextureCube(G,o.mapping,a)}else{G=THREE.ImageUtils.loadTexture(e(o.url,F.urlBaseType),o.mapping,a);if(THREE[o.minFilter]!=void 0)G.minFilter=THREE[o.minFilter];if(THREE[o.magFilter]!=void 0)G.magFilter=THREE[o.magFilter];if(o.repeat){G.repeat.set(o.repeat[0],o.repeat[1]);if(o.repeat[0]!=1)G.wrapS=THREE.RepeatWrapping;if(o.repeat[1]!=1)G.wrapT=THREE.RepeatWrapping}o.offset&&G.offset.set(o.offset[0],
-o.offset[1]);if(o.wrap){J={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(J[o.wrap[0]]!==void 0)G.wrapS=J[o.wrap[0]];if(J[o.wrap[1]]!==void 0)G.wrapT=J[o.wrap[1]]}}H.textures[v]=G}for(u in F.materials){v=F.materials[u];for(D in v.parameters)if(D=="envMap"||D=="map"||D=="lightMap")v.parameters[D]=H.textures[v.parameters[D]];else if(D=="shading")v.parameters[D]=v.parameters[D]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(D=="blending")v.parameters[D]=THREE[v.parameters[D]]?
-THREE[v.parameters[D]]:THREE.NormalBlending;else if(D=="combine")v.parameters[D]=v.parameters[D]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(D=="vertexColors")if(v.parameters[D]=="face")v.parameters[D]=THREE.FaceColors;else if(v.parameters[D])v.parameters[D]=THREE.VertexColors;if(v.parameters.opacity!==void 0&&v.parameters.opacity<1)v.parameters.transparent=!0;if(v.parameters.normalMap){o=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(o.uniforms);G=v.parameters.color;
-J=v.parameters.specular;x=v.parameters.ambient;I=v.parameters.shininess;a.tNormal.texture=H.textures[v.parameters.normalMap];if(v.parameters.normalMapFactor)a.uNormalScale.value=v.parameters.normalMapFactor;if(v.parameters.map)a.tDiffuse.texture=v.parameters.map,a.enableDiffuse.value=!0;if(v.parameters.lightMap)a.tAO.texture=v.parameters.lightMap,a.enableAO.value=!0;if(v.parameters.specularMap)a.tSpecular.texture=H.textures[v.parameters.specularMap],a.enableSpecular.value=!0;a.uDiffuseColor.value.setHex(G);
-a.uSpecularColor.value.setHex(J);a.uAmbientColor.value.setHex(x);a.uShininess.value=I;if(v.parameters.opacity)a.uOpacity.value=v.parameters.opacity;v=new THREE.ShaderMaterial({fragmentShader:o.fragmentShader,vertexShader:o.vertexShader,uniforms:a,lights:!0,fog:!0})}else v=new THREE[v.type](v.parameters);H.materials[u]=v}k();b.callbackSync(H);n()}},constructor:THREE.SceneLoader};THREE.UTF8Loader=function(){};THREE.UTF8Loader.prototype=new THREE.UTF8Loader;THREE.UTF8Loader.prototype.constructor=THREE.UTF8Loader;
-THREE.UTF8Loader.prototype.load=function(a,c,b){if(a instanceof Object)console.warn("DEPRECATED: UTF8Loader( parameters ) is now UTF8Loader( url, callback, metaData )."),b=a,a=b.model,c=b.callback,b={scale:b.scale,offsetX:b.offsetX,offsetY:b.offsetY,offsetZ:b.offsetZ};var e=new XMLHttpRequest,g=b.scale!==void 0?b.scale:1,h=b.offsetX!==void 0?b.offsetX:0,f=b.offsetY!==void 0?b.offsetY:0,k=b.offsetZ!==void 0?b.offsetZ:0;e.onreadystatechange=function(){e.readyState==4?e.status==200||e.status==0?THREE.UTF8Loader.prototype.createModel(e.responseText,
-c,g,h,f,k):alert("Couldn't load ["+a+"] ["+e.status+"]"):e.readyState!=3&&e.readyState==2&&e.getResponseHeader("Content-Length")};e.open("GET",a,!0);e.send(null)};THREE.UTF8Loader.prototype.decompressMesh=function(a){var c=a.charCodeAt(0);c>=57344&&(c-=2048);c++;for(var b=new Float32Array(8*c),e=1,g=0;g<8;g++){for(var h=0,f=0;f<c;++f){var k=a.charCodeAt(f+e);h+=k>>1^-(k&1);b[8*f+g]=h}e+=c}c=a.length-e;h=new Uint16Array(c);for(g=f=0;g<c;g++)k=a.charCodeAt(g+e),h[g]=f-k,k==0&&f++;return[b,h]};
-THREE.UTF8Loader.prototype.createModel=function(a,c,b,e,g,h){var f=function(){var c=this;c.materials=[];THREE.Geometry.call(this);var f=THREE.UTF8Loader.prototype.decompressMesh(a),m=[],n=[];(function(a,f,l){for(var m,n,x,v=a.length;l<v;l+=f)m=a[l],n=a[l+1],x=a[l+2],m=m/16383*b,n=n/16383*b,x=x/16383*b,m+=e,n+=g,x+=h,c.vertices.push(new THREE.Vertex(new THREE.Vector3(m,n,x)))})(f[0],8,0);(function(a,b,c){for(var e,f,g=a.length;c<g;c+=b)e=a[c],f=a[c+1],e/=1023,f/=1023,n.push(e,1-f)})(f[0],8,3);(function(a,
-b,c){for(var e,f,g,h=a.length;c<h;c+=b)e=a[c],f=a[c+1],g=a[c+2],e=(e-512)/511,f=(f-512)/511,g=(g-512)/511,m.push(e,f,g)})(f[0],8,5);(function(a){var b,e,f,g,h,l,y,t,A,D=a.length;for(b=0;b<D;b+=3){e=a[b];f=a[b+1];g=a[b+2];h=c;t=e;A=f;l=g;y=e;var C=f,E=g,I=h.materials[0],G=m[C*3],K=m[C*3+1],C=m[C*3+2],B=m[E*3],F=m[E*3+1],E=m[E*3+2];y=new THREE.Vector3(m[y*3],m[y*3+1],m[y*3+2]);C=new THREE.Vector3(G,K,C);E=new THREE.Vector3(B,F,E);h.faces.push(new THREE.Face3(t,A,l,[y,C,E],null,I));h=n[e*2];e=n[e*2+
-1];l=n[f*2];y=n[f*2+1];t=n[g*2];A=n[g*2+1];g=c.faceVertexUvs[0];f=l;l=y;y=[];y.push(new THREE.UV(h,e));y.push(new THREE.UV(f,l));y.push(new THREE.UV(t,A));g.push(y)}})(f[1]);this.computeCentroids();this.computeFaceNormals()};f.prototype=new THREE.Geometry;f.prototype.constructor=f;c(new f)};
+THREE.SceneLoader.prototype={load:function(a,c){var b=this,d=new Worker(a);d.postMessage(0);var f=THREE.Loader.prototype.extractUrlbase(a);d.onmessage=function(a){function d(a,b){return b=="relativeToHTML"?a:f+"/"+a}function h(){var a;for(n in B.objects)if(!z.objects[n])if(s=B.objects[n],s.geometry!==void 0){if(E=z.geometries[s.geometry]){a=!1;for(I=0;I<s.materials.length;I++)H=z.materials[s.materials[I]],a=H instanceof THREE.ShaderMaterial;a&&E.computeTangents();w=s.position;x=s.rotation;y=s.quaternion;
+C=s.scale;y=0;H.length==0&&(H=new THREE.MeshFaceMaterial);H.length>1&&(H=new THREE.MeshFaceMaterial);a=new THREE.Mesh(E,H);a.name=n;a.position.set(w[0],w[1],w[2]);y?(a.quaternion.set(y[0],y[1],y[2],y[3]),a.useQuaternion=!0):a.rotation.set(x[0],x[1],x[2]);a.scale.set(C[0],C[1],C[2]);a.visible=s.visible;z.scene.add(a);z.objects[n]=a;if(s.meshCollider){var b=THREE.CollisionUtils.MeshColliderWBox(a);z.scene.collisions.colliders.push(b)}if(s.castsShadow)b=new THREE.ShadowVolume(E),z.scene.add(b),b.position=
+a.position,b.rotation=a.rotation,b.scale=a.scale;s.trigger&&s.trigger.toLowerCase()!="none"&&(b={type:s.trigger,object:s},z.triggers[a.name]=b)}}else w=s.position,x=s.rotation,y=s.quaternion,C=s.scale,y=0,a=new THREE.Object3D,a.name=n,a.position.set(w[0],w[1],w[2]),y?(a.quaternion.set(y[0],y[1],y[2],y[3]),a.useQuaternion=!0):a.rotation.set(x[0],x[1],x[2]),a.scale.set(C[0],C[1],C[2]),a.visible=s.visible!==void 0?s.visible:!1,z.scene.add(a),z.objects[n]=a,z.empties[n]=a,s.trigger&&s.trigger.toLowerCase()!=
+"none"&&(b={type:s.trigger,object:s},z.triggers[a.name]=b)}function i(a){return function(c){z.geometries[a]=c;h();J-=1;b.onLoadComplete();k()}}function j(a){return function(b){z.geometries[a]=b}}function k(){b.callbackProgress({totalModels:M,totalTextures:O,loadedModels:M-J,loadedTextures:O-N},z);b.onLoadProgress();J==0&&N==0&&c(z)}var m,o,n,t,q,r,p,s,l,v,w,x,y,C,A,E,u,G,D,H,B,F,J,N,M,O,z;B=a.data;D=new THREE.BinaryLoader;F=new THREE.JSONLoader;N=J=0;z={scene:new THREE.Scene,geometries:{},materials:{},
+textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};a=!1;for(n in B.objects)if(s=B.objects[n],s.meshCollider){a=!0;break}if(a)z.scene.collisions=new THREE.CollisionSystem;if(B.transform){a=B.transform.position;l=B.transform.rotation;var K=B.transform.scale;a&&z.scene.position.set(a[0],a[1],a[2]);l&&z.scene.rotation.set(l[0],l[1],l[2]);K&&z.scene.scale.set(K[0],K[1],K[2]);(a||l||K)&&z.scene.updateMatrix()}a=function(){N-=1;k();b.onLoadComplete()};for(q in B.cameras)l=B.cameras[q],
+l.type=="perspective"?u=new THREE.PerspectiveCamera(l.fov,l.aspect,l.near,l.far):l.type=="ortho"&&(u=new THREE.OrthographicCamera(l.left,l.right,l.top,l.bottom,l.near,l.far)),w=l.position,l=l.target,u.position.set(w[0],w[1],w[2]),u.target=new THREE.Vector3(l[0],l[1],l[2]),z.cameras[q]=u;for(t in B.lights)l=B.lights[t],q=l.color!==void 0?l.color:16777215,u=l.intensity!==void 0?l.intensity:1,l.type=="directional"?(w=l.direction,v=new THREE.DirectionalLight(q,u),v.position.set(w[0],w[1],w[2]),v.position.normalize()):
+l.type=="point"?(w=l.position,v=l.distance,v=new THREE.PointLight(q,u,v),v.position.set(w[0],w[1],w[2])):l.type=="ambient"&&(v=new THREE.AmbientLight(q)),z.scene.add(v),z.lights[t]=v;for(r in B.fogs)t=B.fogs[r],t.type=="linear"?G=new THREE.Fog(0,t.near,t.far):t.type=="exp2"&&(G=new THREE.FogExp2(0,t.density)),l=t.color,G.color.setRGB(l[0],l[1],l[2]),z.fogs[r]=G;if(z.cameras&&B.defaults.camera)z.currentCamera=z.cameras[B.defaults.camera];if(z.fogs&&B.defaults.fog)z.scene.fog=z.fogs[B.defaults.fog];
+l=B.defaults.bgcolor;z.bgColor=new THREE.Color;z.bgColor.setRGB(l[0],l[1],l[2]);z.bgColorAlpha=B.defaults.bgalpha;for(m in B.geometries)if(r=B.geometries[m],r.type=="bin_mesh"||r.type=="ascii_mesh")J+=1,b.onLoadStart();M=J;for(m in B.geometries)r=B.geometries[m],r.type=="cube"?(E=new THREE.CubeGeometry(r.width,r.height,r.depth,r.segmentsWidth,r.segmentsHeight,r.segmentsDepth,null,r.flipped,r.sides),z.geometries[m]=E):r.type=="plane"?(E=new THREE.PlaneGeometry(r.width,r.height,r.segmentsWidth,r.segmentsHeight),
+z.geometries[m]=E):r.type=="sphere"?(E=new THREE.SphereGeometry(r.radius,r.segmentsWidth,r.segmentsHeight),z.geometries[m]=E):r.type=="cylinder"?(E=new THREE.CylinderGeometry(r.topRad,r.botRad,r.height,r.radSegs,r.heightSegs),z.geometries[m]=E):r.type=="torus"?(E=new THREE.TorusGeometry(r.radius,r.tube,r.segmentsR,r.segmentsT),z.geometries[m]=E):r.type=="icosahedron"?(E=new THREE.IcosahedronGeometry(r.subdivisions),z.geometries[m]=E):r.type=="bin_mesh"?D.load(d(r.url,B.urlBaseType),i(m)):r.type==
+"ascii_mesh"?F.load(d(r.url,B.urlBaseType),i(m)):r.type=="embedded_mesh"&&(r=B.embeds[r.id])&&F.createModel(r,j(m),"");for(p in B.textures)if(m=B.textures[p],m.url instanceof Array){N+=m.url.length;for(D=0;D<m.url.length;D++)b.onLoadStart()}else N+=1,b.onLoadStart();O=N;for(p in B.textures){m=B.textures[p];if(m.mapping!=void 0&&THREE[m.mapping]!=void 0)m.mapping=new THREE[m.mapping];if(m.url instanceof Array){D=[];for(var I=0;I<m.url.length;I++)D[I]=d(m.url[I],B.urlBaseType);D=THREE.ImageUtils.loadTextureCube(D,
+m.mapping,a)}else{D=THREE.ImageUtils.loadTexture(d(m.url,B.urlBaseType),m.mapping,a);if(THREE[m.minFilter]!=void 0)D.minFilter=THREE[m.minFilter];if(THREE[m.magFilter]!=void 0)D.magFilter=THREE[m.magFilter];if(m.repeat){D.repeat.set(m.repeat[0],m.repeat[1]);if(m.repeat[0]!=1)D.wrapS=THREE.RepeatWrapping;if(m.repeat[1]!=1)D.wrapT=THREE.RepeatWrapping}m.offset&&D.offset.set(m.offset[0],m.offset[1]);if(m.wrap){F={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(F[m.wrap[0]]!==void 0)D.wrapS=
+F[m.wrap[0]];if(F[m.wrap[1]]!==void 0)D.wrapT=F[m.wrap[1]]}}z.textures[p]=D}for(o in B.materials){p=B.materials[o];for(A in p.parameters)if(A=="envMap"||A=="map"||A=="lightMap")p.parameters[A]=z.textures[p.parameters[A]];else if(A=="shading")p.parameters[A]=p.parameters[A]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(A=="blending")p.parameters[A]=THREE[p.parameters[A]]?THREE[p.parameters[A]]:THREE.NormalBlending;else if(A=="combine")p.parameters[A]=p.parameters[A]=="MixOperation"?THREE.MixOperation:
+THREE.MultiplyOperation;else if(A=="vertexColors")if(p.parameters[A]=="face")p.parameters[A]=THREE.FaceColors;else if(p.parameters[A])p.parameters[A]=THREE.VertexColors;if(p.parameters.opacity!==void 0&&p.parameters.opacity<1)p.parameters.transparent=!0;if(p.parameters.normalMap){m=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(m.uniforms);D=p.parameters.color;F=p.parameters.specular;r=p.parameters.ambient;G=p.parameters.shininess;a.tNormal.texture=z.textures[p.parameters.normalMap];if(p.parameters.normalMapFactor)a.uNormalScale.value=
+p.parameters.normalMapFactor;if(p.parameters.map)a.tDiffuse.texture=p.parameters.map,a.enableDiffuse.value=!0;if(p.parameters.lightMap)a.tAO.texture=p.parameters.lightMap,a.enableAO.value=!0;if(p.parameters.specularMap)a.tSpecular.texture=z.textures[p.parameters.specularMap],a.enableSpecular.value=!0;a.uDiffuseColor.value.setHex(D);a.uSpecularColor.value.setHex(F);a.uAmbientColor.value.setHex(r);a.uShininess.value=G;if(p.parameters.opacity)a.uOpacity.value=p.parameters.opacity;p=new THREE.ShaderMaterial({fragmentShader:m.fragmentShader,
+vertexShader:m.vertexShader,uniforms:a,lights:!0,fog:!0})}else p=new THREE[p.type](p.parameters);z.materials[o]=p}h();b.callbackSync(z);k()}},constructor:THREE.SceneLoader};THREE.UTF8Loader=function(){};THREE.UTF8Loader.prototype=new THREE.UTF8Loader;THREE.UTF8Loader.prototype.constructor=THREE.UTF8Loader;
+THREE.UTF8Loader.prototype.load=function(a,c,b){if(a instanceof Object)console.warn("DEPRECATED: UTF8Loader( parameters ) is now UTF8Loader( url, callback, metaData )."),b=a,a=b.model,c=b.callback,b={scale:b.scale,offsetX:b.offsetX,offsetY:b.offsetY,offsetZ:b.offsetZ};var d=new XMLHttpRequest,f=b.scale!==void 0?b.scale:1,g=b.offsetX!==void 0?b.offsetX:0,e=b.offsetY!==void 0?b.offsetY:0,h=b.offsetZ!==void 0?b.offsetZ:0;d.onreadystatechange=function(){d.readyState==4?d.status==200||d.status==0?THREE.UTF8Loader.prototype.createModel(d.responseText,
+c,f,g,e,h):alert("Couldn't load ["+a+"] ["+d.status+"]"):d.readyState!=3&&d.readyState==2&&d.getResponseHeader("Content-Length")};d.open("GET",a,!0);d.send(null)};THREE.UTF8Loader.prototype.decompressMesh=function(a){var c=a.charCodeAt(0);c>=57344&&(c-=2048);c++;for(var b=new Float32Array(8*c),d=1,f=0;f<8;f++){for(var g=0,e=0;e<c;++e){var h=a.charCodeAt(e+d);g+=h>>1^-(h&1);b[8*e+f]=g}d+=c}c=a.length-d;g=new Uint16Array(c);for(f=e=0;f<c;f++)h=a.charCodeAt(f+d),g[f]=e-h,h==0&&e++;return[b,g]};
+THREE.UTF8Loader.prototype.createModel=function(a,c,b,d,f,g){var e=function(){var c=this;c.materials=[];THREE.Geometry.call(this);var e=THREE.UTF8Loader.prototype.decompressMesh(a),j=[],k=[];(function(a,e,i){for(var j,k,r,p=a.length;i<p;i+=e)j=a[i],k=a[i+1],r=a[i+2],j=j/16383*b,k=k/16383*b,r=r/16383*b,j+=d,k+=f,r+=g,c.vertices.push(new THREE.Vertex(new THREE.Vector3(j,k,r)))})(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 b,d,e,f,g,i,s,l,v,w=a.length;for(b=0;b<w;b+=3){d=a[b];e=a[b+1];f=a[b+2];g=c;l=d;v=e;i=f;s=d;var x=e,y=f,C=g.materials[0],A=j[x*3],E=j[x*3+1],x=j[x*3+2],u=j[y*3],G=j[y*3+1],y=j[y*3+2];s=new THREE.Vector3(j[s*3],j[s*3+1],j[s*3+2]);x=new THREE.Vector3(A,E,x);y=new THREE.Vector3(u,G,y);g.faces.push(new THREE.Face3(l,v,i,[s,x,y],null,C));g=k[d*2];d=k[d*2+
+1];i=k[e*2];s=k[e*2+1];l=k[f*2];v=k[f*2+1];f=c.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(l,v));f.push(s)}})(e[1]);this.computeCentroids();this.computeFaceNormals()};e.prototype=new THREE.Geometry;e.prototype.constructor=e;c(new e)};
 THREE.Axes=function(){THREE.Object3D.call(this);var a=new THREE.Geometry;a.vertices.push(new THREE.Vertex);a.vertices.push(new THREE.Vertex(new THREE.Vector3(0,100,0)));var c=new THREE.CylinderGeometry(0,5,25,5,1),b=new THREE.Line(a,new THREE.LineBasicMaterial({color:16711680}));b.rotation.z=-Math.PI/2;this.add(b);b=new THREE.Mesh(c,new THREE.MeshBasicMaterial({color:16711680}));b.position.x=100;b.rotation.z=-Math.PI/2;this.add(b);b=new THREE.Line(a,new THREE.LineBasicMaterial({color:65280}));this.add(b);
 b=new THREE.Mesh(c,new THREE.MeshBasicMaterial({color:65280}));b.position.y=100;this.add(b);b=new THREE.Line(a,new THREE.LineBasicMaterial({color:255}));b.rotation.x=Math.PI/2;this.add(b);b=new THREE.Mesh(c,new THREE.MeshBasicMaterial({color:255}));b.position.z=100;b.rotation.x=Math.PI/2;this.add(b)};THREE.Axes.prototype=new THREE.Object3D;THREE.Axes.prototype.constructor=THREE.Axes;
 THREE.MarchingCubes=function(a,c){THREE.Object3D.call(this);this.materials=c instanceof Array?c:[c];this.init=function(a){this.isolation=80;this.size=a;this.size2=this.size*this.size;this.size3=this.size2*this.size;this.halfsize=this.size/2;this.delta=2/this.size;this.yd=this.size;this.zd=this.size2;this.field=new Float32Array(this.size3);this.normal_cache=new Float32Array(this.size3*3);this.vlist=new Float32Array(36);this.nlist=new Float32Array(36);this.firstDraw=!0;this.maxCount=4096;this.count=
-0;this.hasNormal=this.hasPos=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(a,c,g){return a+(c-a)*g};this.VIntX=function(a,c,g,h,f,k,l,m,n,o){f=(f-n)/(o-n);n=this.normal_cache;c[h]=k+f*this.delta;c[h+1]=l;c[h+2]=m;g[h]=this.lerp(n[a],n[a+3],f);g[h+1]=this.lerp(n[a+1],n[a+4],f);g[h+2]=this.lerp(n[a+2],n[a+5],f)};this.VIntY=function(a,c,g,h,f,k,l,m,n,o){f=(f-n)/(o-n);n=this.normal_cache;c[h]=k;c[h+1]=l+f*this.delta;c[h+
-2]=m;c=a+this.yd*3;g[h]=this.lerp(n[a],n[c],f);g[h+1]=this.lerp(n[a+1],n[c+1],f);g[h+2]=this.lerp(n[a+2],n[c+2],f)};this.VIntZ=function(a,c,g,h,f,k,l,m,n,o){f=(f-n)/(o-n);n=this.normal_cache;c[h]=k;c[h+1]=l;c[h+2]=m+f*this.delta;c=a+this.zd*3;g[h]=this.lerp(n[a],n[c],f);g[h+1]=this.lerp(n[a+1],n[c+1],f);g[h+2]=this.lerp(n[a+2],n[c+2],f)};this.compNorm=function(a){var c=a*3;this.normal_cache[c]===0&&(this.normal_cache[c]=this.field[a-1]-this.field[a+1],this.normal_cache[c+1]=this.field[a-this.yd]-
-this.field[a+this.yd],this.normal_cache[c+2]=this.field[a-this.zd]-this.field[a+this.zd])};this.polygonize=function(a,c,g,h,f,k){var l=h+1,m=h+this.yd,n=h+this.zd,o=l+this.yd,u=l+this.zd,p=h+this.yd+this.zd,z=l+this.yd+this.zd,w=0,x=this.field[h],v=this.field[l],y=this.field[m],t=this.field[o],A=this.field[n],D=this.field[u],C=this.field[p],E=this.field[z];x<f&&(w|=1);v<f&&(w|=2);y<f&&(w|=8);t<f&&(w|=4);A<f&&(w|=16);D<f&&(w|=32);C<f&&(w|=128);E<f&&(w|=64);var I=THREE.edgeTable[w];if(I===0)return 0;
-var G=this.delta,K=a+G,B=c+G,G=g+G;I&1&&(this.compNorm(h),this.compNorm(l),this.VIntX(h*3,this.vlist,this.nlist,0,f,a,c,g,x,v));I&2&&(this.compNorm(l),this.compNorm(o),this.VIntY(l*3,this.vlist,this.nlist,3,f,K,c,g,v,t));I&4&&(this.compNorm(m),this.compNorm(o),this.VIntX(m*3,this.vlist,this.nlist,6,f,a,B,g,y,t));I&8&&(this.compNorm(h),this.compNorm(m),this.VIntY(h*3,this.vlist,this.nlist,9,f,a,c,g,x,y));I&16&&(this.compNorm(n),this.compNorm(u),this.VIntX(n*3,this.vlist,this.nlist,12,f,a,c,G,A,D));
-I&32&&(this.compNorm(u),this.compNorm(z),this.VIntY(u*3,this.vlist,this.nlist,15,f,K,c,G,D,E));I&64&&(this.compNorm(p),this.compNorm(z),this.VIntX(p*3,this.vlist,this.nlist,18,f,a,B,G,C,E));I&128&&(this.compNorm(n),this.compNorm(p),this.VIntY(n*3,this.vlist,this.nlist,21,f,a,c,G,A,C));I&256&&(this.compNorm(h),this.compNorm(n),this.VIntZ(h*3,this.vlist,this.nlist,24,f,a,c,g,x,A));I&512&&(this.compNorm(l),this.compNorm(u),this.VIntZ(l*3,this.vlist,this.nlist,27,f,K,c,g,v,D));I&1024&&(this.compNorm(o),
-this.compNorm(z),this.VIntZ(o*3,this.vlist,this.nlist,30,f,K,B,g,t,E));I&2048&&(this.compNorm(m),this.compNorm(p),this.VIntZ(m*3,this.vlist,this.nlist,33,f,a,B,g,y,C));w<<=4;for(f=h=0;THREE.triTable[w+f]!=-1;)a=w+f,c=a+1,g=a+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[a],3*THREE.triTable[c],3*THREE.triTable[g],k),f+=3,h++;return h};this.posnormtriv=function(a,c,g,h,f,k){var l=this.count*3;this.positionArray[l]=a[g];this.positionArray[l+1]=a[g+1];this.positionArray[l+2]=a[g+2];this.positionArray[l+
-3]=a[h];this.positionArray[l+4]=a[h+1];this.positionArray[l+5]=a[h+2];this.positionArray[l+6]=a[f];this.positionArray[l+7]=a[f+1];this.positionArray[l+8]=a[f+2];this.normalArray[l]=c[g];this.normalArray[l+1]=c[g+1];this.normalArray[l+2]=c[g+2];this.normalArray[l+3]=c[h];this.normalArray[l+4]=c[h+1];this.normalArray[l+5]=c[h+2];this.normalArray[l+6]=c[f];this.normalArray[l+7]=c[f+1];this.normalArray[l+8]=c[f+2];this.hasNormal=this.hasPos=!0;this.count+=3;this.count>=this.maxCount-3&&k(this)};this.begin=
-function(){this.count=0;this.hasNormal=this.hasPos=!1};this.end=function(a){if(this.count!==0){for(var c=this.count*3;c<this.positionArray.length;c++)this.positionArray[c]=0;a(this)}};this.addBall=function(a,c,g,h,f){var k=this.size*Math.sqrt(h/f),l=g*this.size,m=c*this.size,n=a*this.size,o=Math.floor(l-k);o<1&&(o=1);l=Math.floor(l+k);l>this.size-1&&(l=this.size-1);var u=Math.floor(m-k);u<1&&(u=1);m=Math.floor(m+k);m>this.size-1&&(m=this.size-1);var p=Math.floor(n-k);p<1&&(p=1);k=Math.floor(n+k);
-k>this.size-1&&(k=this.size-1);for(var z,w,x,v,y,t;o<l;o++){n=this.size2*o;w=o/this.size-g;y=w*w;for(w=u;w<m;w++){x=n+this.size*w;z=w/this.size-c;t=z*z;for(z=p;z<k;z++)v=z/this.size-a,v=h/(1.0E-6+v*v+t+y)-f,v>0&&(this.field[x+z]+=v)}}};this.addPlaneX=function(a,c){var g,h,f,k,l,m=this.size,n=this.yd,o=this.zd,u=this.field,p=m*Math.sqrt(a/c);p>m&&(p=m);for(g=0;g<p;g++)if(h=g/m,h*=h,k=a/(1.0E-4+h)-c,k>0)for(h=0;h<m;h++){l=g+h*n;for(f=0;f<m;f++)u[o*f+l]+=k}};this.addPlaneY=function(a,c){var g,h,f,k,
-l,m,n=this.size,o=this.yd,u=this.zd,p=this.field,z=n*Math.sqrt(a/c);z>n&&(z=n);for(h=0;h<z;h++)if(g=h/n,g*=g,k=a/(1.0E-4+g)-c,k>0){l=h*o;for(g=0;g<n;g++){m=l+g;for(f=0;f<n;f++)p[u*f+m]+=k}}};this.addPlaneZ=function(a,c){var g,h,f,k,l,m;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(a/c);dist>size&&(dist=size);for(f=0;f<dist;f++)if(g=f/size,g*=g,k=a/(1.0E-4+g)-c,k>0){l=zd*f;for(h=0;h<size;h++){m=l+h*yd;for(g=0;g<size;g++)field[m+g]+=k}}};this.reset=function(){var a;for(a=
-0;a<this.size3;a++)this.normal_cache[a*3]=0,this.field[a]=0};this.render=function(a){this.begin();var c,g,h,f,k,l,m,n,o,u=this.size-2;for(f=1;f<u;f++){o=this.size2*f;m=(f-this.halfsize)/this.halfsize;for(h=1;h<u;h++){n=o+this.size*h;l=(h-this.halfsize)/this.halfsize;for(g=1;g<u;g++)k=(g-this.halfsize)/this.halfsize,c=n+g,this.polygonize(k,l,m,c,this.isolation,a)}}this.end(a)};this.generateGeometry=function(){var a=0,c=new THREE.Geometry,g=[];this.render(function(h){var f,k,l,m,n,o,u,p;for(f=0;f<h.count;f++)u=
-f*3,n=u+1,p=u+2,k=h.positionArray[u],l=h.positionArray[n],m=h.positionArray[p],o=new THREE.Vector3(k,l,m),k=h.normalArray[u],l=h.normalArray[n],m=h.normalArray[p],u=new THREE.Vector3(k,l,m),u.normalize(),n=new THREE.Vertex(o),c.vertices.push(n),g.push(u);nfaces=h.count/3;for(f=0;f<nfaces;f++)u=(a+f)*3,n=u+1,p=u+2,o=g[u],k=g[n],l=g[p],u=new THREE.Face3(u,n,p,[o,k,l]),c.faces.push(u);a+=nfaces;h.count=0});return c};this.init(a)};THREE.MarchingCubes.prototype=new THREE.Object3D;
-THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
+0;this.hasNormal=this.hasPos=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(a,c,f){return a+(c-a)*f};this.VIntX=function(a,c,f,g,e,h,i,j,k,m){e=(e-k)/(m-k);k=this.normal_cache;c[g]=h+e*this.delta;c[g+1]=i;c[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,c,f,g,e,h,i,j,k,m){e=(e-k)/(m-k);k=this.normal_cache;c[g]=h;c[g+1]=i+e*this.delta;c[g+
+2]=j;c=a+this.yd*3;f[g]=this.lerp(k[a],k[c],e);f[g+1]=this.lerp(k[a+1],k[c+1],e);f[g+2]=this.lerp(k[a+2],k[c+2],e)};this.VIntZ=function(a,c,f,g,e,h,i,j,k,m){e=(e-k)/(m-k);k=this.normal_cache;c[g]=h;c[g+1]=i;c[g+2]=j+e*this.delta;c=a+this.zd*3;f[g]=this.lerp(k[a],k[c],e);f[g+1]=this.lerp(k[a+1],k[c+1],e);f[g+2]=this.lerp(k[a+2],k[c+2],e)};this.compNorm=function(a){var c=a*3;this.normal_cache[c]===0&&(this.normal_cache[c]=this.field[a-1]-this.field[a+1],this.normal_cache[c+1]=this.field[a-this.yd]-
+this.field[a+this.yd],this.normal_cache[c+2]=this.field[a-this.zd]-this.field[a+this.zd])};this.polygonize=function(a,c,f,g,e,h){var i=g+1,j=g+this.yd,k=g+this.zd,m=i+this.yd,o=i+this.zd,n=g+this.yd+this.zd,t=i+this.yd+this.zd,q=0,r=this.field[g],p=this.field[i],s=this.field[j],l=this.field[m],v=this.field[k],w=this.field[o],x=this.field[n],y=this.field[t];r<e&&(q|=1);p<e&&(q|=2);s<e&&(q|=8);l<e&&(q|=4);v<e&&(q|=16);w<e&&(q|=32);x<e&&(q|=128);y<e&&(q|=64);var C=THREE.edgeTable[q];if(C===0)return 0;
+var A=this.delta,E=a+A,u=c+A,A=f+A;C&1&&(this.compNorm(g),this.compNorm(i),this.VIntX(g*3,this.vlist,this.nlist,0,e,a,c,f,r,p));C&2&&(this.compNorm(i),this.compNorm(m),this.VIntY(i*3,this.vlist,this.nlist,3,e,E,c,f,p,l));C&4&&(this.compNorm(j),this.compNorm(m),this.VIntX(j*3,this.vlist,this.nlist,6,e,a,u,f,s,l));C&8&&(this.compNorm(g),this.compNorm(j),this.VIntY(g*3,this.vlist,this.nlist,9,e,a,c,f,r,s));C&16&&(this.compNorm(k),this.compNorm(o),this.VIntX(k*3,this.vlist,this.nlist,12,e,a,c,A,v,w));
+C&32&&(this.compNorm(o),this.compNorm(t),this.VIntY(o*3,this.vlist,this.nlist,15,e,E,c,A,w,y));C&64&&(this.compNorm(n),this.compNorm(t),this.VIntX(n*3,this.vlist,this.nlist,18,e,a,u,A,x,y));C&128&&(this.compNorm(k),this.compNorm(n),this.VIntY(k*3,this.vlist,this.nlist,21,e,a,c,A,v,x));C&256&&(this.compNorm(g),this.compNorm(k),this.VIntZ(g*3,this.vlist,this.nlist,24,e,a,c,f,r,v));C&512&&(this.compNorm(i),this.compNorm(o),this.VIntZ(i*3,this.vlist,this.nlist,27,e,E,c,f,p,w));C&1024&&(this.compNorm(m),
+this.compNorm(t),this.VIntZ(m*3,this.vlist,this.nlist,30,e,E,u,f,l,y));C&2048&&(this.compNorm(j),this.compNorm(n),this.VIntZ(j*3,this.vlist,this.nlist,33,e,a,u,f,s,x));q<<=4;for(e=g=0;THREE.triTable[q+e]!=-1;)a=q+e,c=a+1,f=a+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[a],3*THREE.triTable[c],3*THREE.triTable[f],h),e+=3,g++;return g};this.posnormtriv=function(a,c,f,g,e,h){var i=this.count*3;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]=c[f];this.normalArray[i+1]=c[f+1];this.normalArray[i+2]=c[f+2];this.normalArray[i+3]=c[g];this.normalArray[i+4]=c[g+1];this.normalArray[i+5]=c[g+2];this.normalArray[i+6]=c[e];this.normalArray[i+7]=c[e+1];this.normalArray[i+8]=c[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(this.count!==0){for(var c=this.count*3;c<this.positionArray.length;c++)this.positionArray[c]=0;a(this)}};this.addBall=function(a,c,f,g,e){var h=this.size*Math.sqrt(g/e),i=f*this.size,j=c*this.size,k=a*this.size,m=Math.floor(i-h);m<1&&(m=1);i=Math.floor(i+h);i>this.size-1&&(i=this.size-1);var o=Math.floor(j-h);o<1&&(o=1);j=Math.floor(j+h);j>this.size-1&&(j=this.size-1);var n=Math.floor(k-h);n<1&&(n=1);h=Math.floor(k+h);
+h>this.size-1&&(h=this.size-1);for(var t,q,r,p,s,l;m<i;m++){k=this.size2*m;q=m/this.size-f;s=q*q;for(q=o;q<j;q++){r=k+this.size*q;t=q/this.size-c;l=t*t;for(t=n;t<h;t++)p=t/this.size-a,p=g/(1.0E-6+p*p+l+s)-e,p>0&&(this.field[r+t]+=p)}}};this.addPlaneX=function(a,c){var f,g,e,h,i,j=this.size,k=this.yd,m=this.zd,o=this.field,n=j*Math.sqrt(a/c);n>j&&(n=j);for(f=0;f<n;f++)if(g=f/j,g*=g,h=a/(1.0E-4+g)-c,h>0)for(g=0;g<j;g++){i=f+g*k;for(e=0;e<j;e++)o[m*e+i]+=h}};this.addPlaneY=function(a,c){var f,g,e,h,
+i,j,k=this.size,m=this.yd,o=this.zd,n=this.field,t=k*Math.sqrt(a/c);t>k&&(t=k);for(g=0;g<t;g++)if(f=g/k,f*=f,h=a/(1.0E-4+f)-c,h>0){i=g*m;for(f=0;f<k;f++){j=i+f;for(e=0;e<k;e++)n[o*e+j]+=h}}};this.addPlaneZ=function(a,c){var f,g,e,h,i,j,k=this.size,m=this.yd,o=this.zd,n=this.field,t=k*Math.sqrt(a/c);t>k&&(t=k);for(e=0;e<t;e++)if(f=e/k,f*=f,h=a/(1.0E-4+f)-c,h>0){i=o*e;for(g=0;g<k;g++){j=i+g*m;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[a*3]=0,
+this.field[a]=0};this.render=function(a){this.begin();var c,f,g,e,h,i,j,k,m,o=this.size-2;for(e=1;e<o;e++){m=this.size2*e;j=(e-this.halfsize)/this.halfsize;for(g=1;g<o;g++){k=m+this.size*g;i=(g-this.halfsize)/this.halfsize;for(f=1;f<o;f++)h=(f-this.halfsize)/this.halfsize,c=k+f,this.polygonize(h,i,j,c,this.isolation,a)}}this.end(a)};this.generateGeometry=function(){var a=0,c=new THREE.Geometry,f=[];this.render(function(g){var e,h,i,j,k,m,o,n;for(e=0;e<g.count;e++)o=e*3,k=o+1,n=o+2,h=g.positionArray[o],
+i=g.positionArray[k],j=g.positionArray[n],m=new THREE.Vector3(h,i,j),h=g.normalArray[o],i=g.normalArray[k],j=g.normalArray[n],o=new THREE.Vector3(h,i,j),o.normalize(),k=new THREE.Vertex(m),c.vertices.push(k),f.push(o);m=g.count/3;for(e=0;e<m;e++)o=(a+e)*3,k=o+1,n=o+2,h=f[o],i=f[k],j=f[n],o=new THREE.Face3(o,k,n,[h,i,j]),c.faces.push(o);a+=m;g.count=0});return c};this.init(a)};THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
 THREE.edgeTable=new Int32Array([0,265,515,778,1030,1295,1541,1804,2060,2309,2575,2822,3082,3331,3593,3840,400,153,915,666,1430,1183,1941,1692,2460,2197,2975,2710,3482,3219,3993,3728,560,825,51,314,1590,1855,1077,1340,2620,2869,2111,2358,3642,3891,3129,3376,928,681,419,170,1958,1711,1445,1196,2988,2725,2479,2214,4010,3747,3497,3232,1120,1385,1635,1898,102,367,613,876,3180,3429,3695,3942,2154,2403,2665,2912,1520,1273,2035,1786,502,255,1013,764,3580,3317,4095,3830,2554,2291,3065,2800,1616,1881,1107,
 1370,598,863,85,348,3676,3925,3167,3414,2650,2899,2137,2384,1984,1737,1475,1226,966,719,453,204,4044,3781,3535,3270,3018,2755,2505,2240,2240,2505,2755,3018,3270,3535,3781,4044,204,453,719,966,1226,1475,1737,1984,2384,2137,2899,2650,3414,3167,3925,3676,348,85,863,598,1370,1107,1881,1616,2800,3065,2291,2554,3830,4095,3317,3580,764,1013,255,502,1786,2035,1273,1520,2912,2665,2403,2154,3942,3695,3429,3180,876,613,367,102,1898,1635,1385,1120,3232,3497,3747,4010,2214,2479,2725,2988,1196,1445,1711,1958,170,
 419,681,928,3376,3129,3891,3642,2358,2111,2869,2620,1340,1077,1855,1590,314,51,825,560,3728,3993,3219,3482,2710,2975,2197,2460,1692,1941,1183,1430,666,915,153,400,3840,3593,3331,3082,2822,2575,2309,2060,1804,1541,1295,1030,778,515,265,0]);
@@ -340,23 +339,23 @@ THREE.triTable=new Int32Array([-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0
 -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.PlaneCollider=function(a,c){this.point=a;this.normal=c};THREE.SphereCollider=function(a,c){this.center=a;this.radius=c;this.radiusSq=c*c};THREE.BoxCollider=function(a,c){this.min=a;this.max=c;this.dynamic=!0;this.normal=new THREE.Vector3};
 THREE.MeshCollider=function(a,c){this.mesh=a;this.box=c;this.numFaces=this.mesh.geometry.faces.length;this.normal=new THREE.Vector3};THREE.CollisionSystem=function(){this.collisionNormal=new THREE.Vector3;this.colliders=[];this.hits=[]};THREE.Collisions=new THREE.CollisionSystem;THREE.CollisionSystem.prototype.merge=function(a){Array.prototype.push.apply(this.colliders,a.colliders);Array.prototype.push.apply(this.hits,a.hits)};
-THREE.CollisionSystem.prototype.rayCastAll=function(a){a.direction.normalize();this.hits.length=0;var c,b,e,g,h=0;c=0;for(b=this.colliders.length;c<b;c++)if(g=this.colliders[c],e=this.rayCast(a,g),e<Number.MAX_VALUE)g.distance=e,e>h?this.hits.push(g):this.hits.unshift(g),h=e;return this.hits};
-THREE.CollisionSystem.prototype.rayCastNearest=function(a){var c=this.rayCastAll(a);if(c.length==0)return null;for(var b=0;c[b]instanceof THREE.MeshCollider;){var e=this.rayMesh(a,c[b]);if(e.dist<Number.MAX_VALUE){c[b].distance=e.dist;c[b].faceIndex=e.faceIndex;break}b++}if(b>c.length)return null;return c[b]};
+THREE.CollisionSystem.prototype.rayCastAll=function(a){a.direction.normalize();this.hits.length=0;var c,b,d,f,g=0;c=0;for(b=this.colliders.length;c<b;c++)if(f=this.colliders[c],d=this.rayCast(a,f),d<Number.MAX_VALUE)f.distance=d,d>g?this.hits.push(f):this.hits.unshift(f),g=d;return this.hits};
+THREE.CollisionSystem.prototype.rayCastNearest=function(a){var c=this.rayCastAll(a);if(c.length==0)return null;for(var b=0;c[b]instanceof THREE.MeshCollider;){var d=this.rayMesh(a,c[b]);if(d.dist<Number.MAX_VALUE){c[b].distance=d.dist;c[b].faceIndex=d.faceIndex;break}b++}if(b>c.length)return null;return c[b]};
 THREE.CollisionSystem.prototype.rayCast=function(a,c){if(c instanceof THREE.PlaneCollider)return this.rayPlane(a,c);else if(c instanceof THREE.SphereCollider)return this.raySphere(a,c);else if(c instanceof THREE.BoxCollider)return this.rayBox(a,c);else if(c instanceof THREE.MeshCollider&&c.box)return this.rayBox(a,c.box)};
-THREE.CollisionSystem.prototype.rayMesh=function(a,c){for(var b=this.makeRayLocal(a,c.mesh),e=Number.MAX_VALUE,g,h=0;h<c.numFaces;h++){var f=c.mesh.geometry.faces[h],k=c.mesh.geometry.vertices[f.a].position,l=c.mesh.geometry.vertices[f.b].position,m=c.mesh.geometry.vertices[f.c].position,n=f instanceof THREE.Face4?c.mesh.geometry.vertices[f.d].position:null;f instanceof THREE.Face3?(f=this.rayTriangle(b,k,l,m,e,this.collisionNormal,c.mesh),f<e&&(e=f,g=h,c.normal.copy(this.collisionNormal),c.normal.normalize())):
-f instanceof THREE.Face4&&(f=this.rayTriangle(b,k,l,n,e,this.collisionNormal,c.mesh),f<e&&(e=f,g=h,c.normal.copy(this.collisionNormal),c.normal.normalize()),f=this.rayTriangle(b,l,m,n,e,this.collisionNormal,c.mesh),f<e&&(e=f,g=h,c.normal.copy(this.collisionNormal),c.normal.normalize()))}return{dist:e,faceIndex:g}};
-THREE.CollisionSystem.prototype.rayTriangle=function(a,c,b,e,g,h,f){var k=THREE.CollisionSystem.__v1,l=THREE.CollisionSystem.__v2;h.set(0,0,0);k.sub(b,c);l.sub(e,b);h.cross(k,l);k=h.dot(a.direction);if(!(k<0))if(f.doubleSided||f.flipSided)h.multiplyScalar(-1),k*=-1;else return Number.MAX_VALUE;f=h.dot(c)-h.dot(a.origin);if(!(f<=0))return Number.MAX_VALUE;if(!(f>=k*g))return Number.MAX_VALUE;f/=k;k=THREE.CollisionSystem.__v3;k.copy(a.direction);k.multiplyScalar(f);k.addSelf(a.origin);Math.abs(h.x)>
-Math.abs(h.y)?Math.abs(h.x)>Math.abs(h.z)?(a=k.y-c.y,h=b.y-c.y,g=e.y-c.y,k=k.z-c.z,b=b.z-c.z,e=e.z-c.z):(a=k.x-c.x,h=b.x-c.x,g=e.x-c.x,k=k.y-c.y,b=b.y-c.y,e=e.y-c.y):Math.abs(h.y)>Math.abs(h.z)?(a=k.x-c.x,h=b.x-c.x,g=e.x-c.x,k=k.z-c.z,b=b.z-c.z,e=e.z-c.z):(a=k.x-c.x,h=b.x-c.x,g=e.x-c.x,k=k.y-c.y,b=b.y-c.y,e=e.y-c.y);c=h*e-b*g;if(c==0)return Number.MAX_VALUE;c=1/c;e=(a*e-k*g)*c;if(!(e>=0))return Number.MAX_VALUE;c*=h*k-b*a;if(!(c>=0))return Number.MAX_VALUE;if(!(1-e-c>=0))return Number.MAX_VALUE;return f};
-THREE.CollisionSystem.prototype.makeRayLocal=function(a,c){var b=THREE.CollisionSystem.__m;b.getInverse(c.matrixWorld);var e=THREE.CollisionSystem.__r;e.origin.copy(a.origin);e.direction.copy(a.direction);b.multiplyVector3(e.origin);b.rotateAxis(e.direction);e.direction.normalize();return e};
-THREE.CollisionSystem.prototype.rayBox=function(a,c){var b;c.dynamic&&c.mesh&&c.mesh.matrixWorld?b=this.makeRayLocal(a,c.mesh):(b=THREE.CollisionSystem.__r,b.origin.copy(a.origin),b.direction.copy(a.direction));var e=0,g=0,h=0,f=0,k=0,l=0,m=!0;b.origin.x<c.min.x?(e=c.min.x-b.origin.x,e/=b.direction.x,m=!1,f=-1):b.origin.x>c.max.x&&(e=c.max.x-b.origin.x,e/=b.direction.x,m=!1,f=1);b.origin.y<c.min.y?(g=c.min.y-b.origin.y,g/=b.direction.y,m=!1,k=-1):b.origin.y>c.max.y&&(g=c.max.y-b.origin.y,g/=b.direction.y,
-m=!1,k=1);b.origin.z<c.min.z?(h=c.min.z-b.origin.z,h/=b.direction.z,m=!1,l=-1):b.origin.z>c.max.z&&(h=c.max.z-b.origin.z,h/=b.direction.z,m=!1,l=1);if(m)return-1;m=0;g>e&&(m=1,e=g);h>e&&(m=2,e=h);switch(m){case 0:k=b.origin.y+b.direction.y*e;if(k<c.min.y||k>c.max.y)return Number.MAX_VALUE;b=b.origin.z+b.direction.z*e;if(b<c.min.z||b>c.max.z)return Number.MAX_VALUE;c.normal.set(f,0,0);break;case 1:f=b.origin.x+b.direction.x*e;if(f<c.min.x||f>c.max.x)return Number.MAX_VALUE;b=b.origin.z+b.direction.z*
-e;if(b<c.min.z||b>c.max.z)return Number.MAX_VALUE;c.normal.set(0,k,0);break;case 2:f=b.origin.x+b.direction.x*e;if(f<c.min.x||f>c.max.x)return Number.MAX_VALUE;k=b.origin.y+b.direction.y*e;if(k<c.min.y||k>c.max.y)return Number.MAX_VALUE;c.normal.set(0,0,l)}return e};THREE.CollisionSystem.prototype.rayPlane=function(a,c){var b=a.direction.dot(c.normal),e=c.point.dot(c.normal);if(b<0)b=(e-a.origin.dot(c.normal))/b;else return Number.MAX_VALUE;return b>0?b:Number.MAX_VALUE};
-THREE.CollisionSystem.prototype.raySphere=function(a,c){var b=c.center.clone().subSelf(a.origin);if(b.lengthSq<c.radiusSq)return-1;var e=b.dot(a.direction.clone());if(e<=0)return Number.MAX_VALUE;b=c.radiusSq-(b.lengthSq()-e*e);if(b>=0)return Math.abs(e)-Math.sqrt(b);return Number.MAX_VALUE};THREE.CollisionSystem.__v1=new THREE.Vector3;THREE.CollisionSystem.__v2=new THREE.Vector3;THREE.CollisionSystem.__v3=new THREE.Vector3;THREE.CollisionSystem.__nr=new THREE.Vector3;THREE.CollisionSystem.__m=new THREE.Matrix4;
+THREE.CollisionSystem.prototype.rayMesh=function(a,c){for(var b=this.makeRayLocal(a,c.mesh),d=Number.MAX_VALUE,f,g=0;g<c.numFaces;g++){var e=c.mesh.geometry.faces[g],h=c.mesh.geometry.vertices[e.a].position,i=c.mesh.geometry.vertices[e.b].position,j=c.mesh.geometry.vertices[e.c].position,k=e instanceof THREE.Face4?c.mesh.geometry.vertices[e.d].position:null;e instanceof THREE.Face3?(e=this.rayTriangle(b,h,i,j,d,this.collisionNormal,c.mesh),e<d&&(d=e,f=g,c.normal.copy(this.collisionNormal),c.normal.normalize())):
+e instanceof THREE.Face4&&(e=this.rayTriangle(b,h,i,k,d,this.collisionNormal,c.mesh),e<d&&(d=e,f=g,c.normal.copy(this.collisionNormal),c.normal.normalize()),e=this.rayTriangle(b,i,j,k,d,this.collisionNormal,c.mesh),e<d&&(d=e,f=g,c.normal.copy(this.collisionNormal),c.normal.normalize()))}return{dist:d,faceIndex:f}};
+THREE.CollisionSystem.prototype.rayTriangle=function(a,c,b,d,f,g,e){var h=THREE.CollisionSystem.__v1,i=THREE.CollisionSystem.__v2;g.set(0,0,0);h.sub(b,c);i.sub(d,b);g.cross(h,i);h=g.dot(a.direction);if(!(h<0))if(e.doubleSided||e.flipSided)g.multiplyScalar(-1),h*=-1;else return Number.MAX_VALUE;e=g.dot(c)-g.dot(a.origin);if(!(e<=0))return Number.MAX_VALUE;if(!(e>=h*f))return Number.MAX_VALUE;e/=h;h=THREE.CollisionSystem.__v3;h.copy(a.direction);h.multiplyScalar(e);h.addSelf(a.origin);Math.abs(g.x)>
+Math.abs(g.y)?Math.abs(g.x)>Math.abs(g.z)?(a=h.y-c.y,g=b.y-c.y,f=d.y-c.y,h=h.z-c.z,b=b.z-c.z,d=d.z-c.z):(a=h.x-c.x,g=b.x-c.x,f=d.x-c.x,h=h.y-c.y,b=b.y-c.y,d=d.y-c.y):Math.abs(g.y)>Math.abs(g.z)?(a=h.x-c.x,g=b.x-c.x,f=d.x-c.x,h=h.z-c.z,b=b.z-c.z,d=d.z-c.z):(a=h.x-c.x,g=b.x-c.x,f=d.x-c.x,h=h.y-c.y,b=b.y-c.y,d=d.y-c.y);c=g*d-b*f;if(c==0)return Number.MAX_VALUE;c=1/c;d=(a*d-h*f)*c;if(!(d>=0))return Number.MAX_VALUE;c*=g*h-b*a;if(!(c>=0))return Number.MAX_VALUE;if(!(1-d-c>=0))return Number.MAX_VALUE;return e};
+THREE.CollisionSystem.prototype.makeRayLocal=function(a,c){var b=THREE.CollisionSystem.__m;b.getInverse(c.matrixWorld);var d=THREE.CollisionSystem.__r;d.origin.copy(a.origin);d.direction.copy(a.direction);b.multiplyVector3(d.origin);b.rotateAxis(d.direction);d.direction.normalize();return d};
+THREE.CollisionSystem.prototype.rayBox=function(a,c){var b;c.dynamic&&c.mesh&&c.mesh.matrixWorld?b=this.makeRayLocal(a,c.mesh):(b=THREE.CollisionSystem.__r,b.origin.copy(a.origin),b.direction.copy(a.direction));var d=0,f=0,g=0,e=0,h=0,i=0,j=!0;b.origin.x<c.min.x?(d=c.min.x-b.origin.x,d/=b.direction.x,j=!1,e=-1):b.origin.x>c.max.x&&(d=c.max.x-b.origin.x,d/=b.direction.x,j=!1,e=1);b.origin.y<c.min.y?(f=c.min.y-b.origin.y,f/=b.direction.y,j=!1,h=-1):b.origin.y>c.max.y&&(f=c.max.y-b.origin.y,f/=b.direction.y,
+j=!1,h=1);b.origin.z<c.min.z?(g=c.min.z-b.origin.z,g/=b.direction.z,j=!1,i=-1):b.origin.z>c.max.z&&(g=c.max.z-b.origin.z,g/=b.direction.z,j=!1,i=1);if(j)return-1;j=0;f>d&&(j=1,d=f);g>d&&(j=2,d=g);switch(j){case 0:h=b.origin.y+b.direction.y*d;if(h<c.min.y||h>c.max.y)return Number.MAX_VALUE;b=b.origin.z+b.direction.z*d;if(b<c.min.z||b>c.max.z)return Number.MAX_VALUE;c.normal.set(e,0,0);break;case 1:e=b.origin.x+b.direction.x*d;if(e<c.min.x||e>c.max.x)return Number.MAX_VALUE;b=b.origin.z+b.direction.z*
+d;if(b<c.min.z||b>c.max.z)return Number.MAX_VALUE;c.normal.set(0,h,0);break;case 2:e=b.origin.x+b.direction.x*d;if(e<c.min.x||e>c.max.x)return Number.MAX_VALUE;h=b.origin.y+b.direction.y*d;if(h<c.min.y||h>c.max.y)return Number.MAX_VALUE;c.normal.set(0,0,i)}return d};THREE.CollisionSystem.prototype.rayPlane=function(a,c){var b=a.direction.dot(c.normal),d=c.point.dot(c.normal);if(b<0)b=(d-a.origin.dot(c.normal))/b;else return Number.MAX_VALUE;return b>0?b:Number.MAX_VALUE};
+THREE.CollisionSystem.prototype.raySphere=function(a,c){var b=c.center.clone().subSelf(a.origin);if(b.lengthSq<c.radiusSq)return-1;var d=b.dot(a.direction.clone());if(d<=0)return Number.MAX_VALUE;b=c.radiusSq-(b.lengthSq()-d*d);if(b>=0)return Math.abs(d)-Math.sqrt(b);return Number.MAX_VALUE};THREE.CollisionSystem.__v1=new THREE.Vector3;THREE.CollisionSystem.__v2=new THREE.Vector3;THREE.CollisionSystem.__v3=new THREE.Vector3;THREE.CollisionSystem.__nr=new THREE.Vector3;THREE.CollisionSystem.__m=new THREE.Matrix4;
 THREE.CollisionSystem.__r=new THREE.Ray;THREE.CollisionUtils={};THREE.CollisionUtils.MeshOBB=function(a){a.geometry.computeBoundingBox();var c=a.geometry.boundingBox,b=new THREE.Vector3(c.x[0],c.y[0],c.z[0]),c=new THREE.Vector3(c.x[1],c.y[1],c.z[1]),b=new THREE.BoxCollider(b,c);b.mesh=a;return b};THREE.CollisionUtils.MeshAABB=function(a){var c=THREE.CollisionUtils.MeshOBB(a);c.min.addSelf(a.position);c.max.addSelf(a.position);c.dynamic=!1;return c};
 THREE.CollisionUtils.MeshColliderWBox=function(a){return new THREE.MeshCollider(a,THREE.CollisionUtils.MeshOBB(a))};
-if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoUpdateScene=!1;var c=this,b=this.setSize,e=this.render,g=new THREE.PerspectiveCamera,h=new THREE.PerspectiveCamera,f=new THREE.Matrix4,k=new THREE.Matrix4,l,m,n,o;g.matrixAutoUpdate=h.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},u=new THREE.WebGLRenderTarget(512,512,a),p=new THREE.WebGLRenderTarget(512,512,a),z=new THREE.PerspectiveCamera(53,
-1,1,1E4);z.position.z=2;_material=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:u},mapRight:{type:"t",value:1,texture:p}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D mapLeft;\nuniform sampler2D mapRight;\nvarying vec2 vUv;\nvoid main() {\nvec4 colorL, colorR;\nvec2 uv = vUv;\ncolorL = texture2D( mapLeft, uv );\ncolorR = texture2D( mapRight, uv );\ngl_FragColor = vec4( colorL.g * 0.7 + colorL.b * 0.3, colorR.g, colorR.b, colorL.a + colorR.a ) * 1.1;\n}"});
-var w=new THREE.Scene;w.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));w.add(z);this.setSize=function(a,e){b.call(c,a,e);u.width=a;u.height=e;p.width=a;p.height=e};this.render=function(a,b){a.updateMatrixWorld();if(l!==b.aspect||m!==b.near||n!==b.far||o!==b.fov){l=b.aspect;m=b.near;n=b.far;o=b.fov;var y=b.projectionMatrix.clone(),t=125/30*0.5,A=t*m/125,D=m*Math.tan(o*Math.PI/360),C;f.n14=t;k.n14=-t;t=-D*l+A;C=D*l+A;y.n11=2*m/(C-t);y.n13=(C+t)/(C-t);g.projectionMatrix.copy(y);t=-D*l-A;
-C=D*l-A;y.n11=2*m/(C-t);y.n13=(C+t)/(C-t);h.projectionMatrix.copy(y)}g.matrixWorld.copy(b.matrixWorld).multiplySelf(k);g.position.copy(b.position);g.near=b.near;g.far=b.far;e.call(c,a,g,u,!0);h.matrixWorld.copy(b.matrixWorld).multiplySelf(f);h.position.copy(b.position);h.near=b.near;h.far=b.far;e.call(c,a,h,p,!0);w.updateMatrixWorld();e.call(c,w,z)}};
-if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoClear=!1;var c=this,b=this.setSize,e=this.render,g,h,f=new THREE.PerspectiveCamera;f.target=new THREE.Vector3(0,0,0);var k=new THREE.PerspectiveCamera;k.target=new THREE.Vector3(0,0,0);c.separation=10;if(a&&a.separation!==void 0)c.separation=a.separation;this.setSize=function(a,e){b.call(c,a,e);g=a/2;h=e};this.render=function(a,b){this.clear();f.fov=b.fov;f.aspect=0.5*b.aspect;f.near=b.near;f.far=
-b.far;f.updateProjectionMatrix();f.position.copy(b.position);f.target.copy(b.target);f.translateX(c.separation);f.lookAt(f.target);k.projectionMatrix=f.projectionMatrix;k.position.copy(b.position);k.target.copy(b.target);k.translateX(-c.separation);k.lookAt(k.target);this.setViewport(0,0,g,h);e.call(c,a,f);this.setViewport(g,0,g,h);e.call(c,a,k,!1)}};
+if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoUpdateScene=!1;var c=this,b=this.setSize,d=this.render,f=new THREE.PerspectiveCamera,g=new THREE.PerspectiveCamera,e=new THREE.Matrix4,h=new THREE.Matrix4,i,j,k,m;f.matrixAutoUpdate=g.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},o=new THREE.WebGLRenderTarget(512,512,a),n=new THREE.WebGLRenderTarget(512,512,a),t=new THREE.PerspectiveCamera(53,
+1,1,1E4);t.position.z=2;var a=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:o},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}"}),
+q=new THREE.Scene;q.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),a));q.add(t);this.setSize=function(a,d){b.call(c,a,d);o.width=a;o.height=d;n.width=a;n.height=d};this.render=function(a,b){a.updateMatrixWorld();if(i!==b.aspect||j!==b.near||k!==b.far||m!==b.fov){i=b.aspect;j=b.near;k=b.far;m=b.fov;var s=b.projectionMatrix.clone(),l=125/30*0.5,v=l*j/125,w=j*Math.tan(m*Math.PI/360),x;e.n14=l;h.n14=-l;l=-w*i+v;x=w*i+v;s.n11=2*j/(x-l);s.n13=(x+l)/(x-l);f.projectionMatrix.copy(s);l=-w*i-v;x=w*i-v;s.n11=
+2*j/(x-l);s.n13=(x+l)/(x-l);g.projectionMatrix.copy(s)}f.matrixWorld.copy(b.matrixWorld).multiplySelf(h);f.position.copy(b.position);f.near=b.near;f.far=b.far;d.call(c,a,f,o,!0);g.matrixWorld.copy(b.matrixWorld).multiplySelf(e);g.position.copy(b.position);g.near=b.near;g.far=b.far;d.call(c,a,g,n,!0);q.updateMatrixWorld();d.call(c,q,t)}};
+if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoClear=!1;var c=this,b=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);c.separation=10;if(a&&a.separation!==void 0)c.separation=a.separation;this.setSize=function(a,d){b.call(c,a,d);f=a/2;g=d};this.render=function(a,b){this.clear();e.fov=b.fov;e.aspect=0.5*b.aspect;e.near=b.near;e.far=
+b.far;e.updateProjectionMatrix();e.position.copy(b.position);e.target.copy(b.target);e.translateX(c.separation);e.lookAt(e.target);h.projectionMatrix=e.projectionMatrix;h.position.copy(b.position);h.target.copy(b.target);h.translateX(-c.separation);h.lookAt(h.target);this.setViewport(0,0,f,g);d.call(c,a,e);this.setViewport(f,0,f,g);d.call(c,a,h,!1)}};

+ 160 - 161
build/custom/ThreeWebGL.js

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

+ 2 - 2
src/core/Spline.js

@@ -73,7 +73,7 @@ THREE.Spline = function ( points ) {
 
 	this.getLength = function ( nSubDivisions ) {
 
-		var i, index, nSamples,
+		var i, index, nSamples, position,
 			point = 0, intPoint = 0, oldIntPoint = 0,
 			oldPosition = new THREE.Vector3(),
 			tmpVec = new THREE.Vector3(),
@@ -126,7 +126,7 @@ THREE.Spline = function ( points ) {
 		var i, j,
 			index, indexCurrent, indexNext,
 			linearDistance, realDistance,
-			sampling,
+			sampling, position,
 			newpoints = [],
 			tmpVec = new THREE.Vector3(),
 			sl = this.getLength();

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

@@ -233,8 +233,8 @@ THREE.PathControls = function ( object, domElement ) {
 
 		var lineGeo = createSplineGeometry( spline, 10 ),
 			particleGeo = createSplineGeometry( spline, 10 ),
-			lineMat = new THREE.LineBasicMaterial( { color: 0xff0000, linewidth: 3 } );
-			lineObj = new THREE.Line( lineGeo, lineMat );
+			lineMat = new THREE.LineBasicMaterial( { color: 0xff0000, linewidth: 3 } ),
+			lineObj = new THREE.Line( lineGeo, lineMat ),
 			particleObj = new THREE.ParticleSystem( particleGeo, new THREE.ParticleBasicMaterial( { color: 0xffaa00, size: 3 } ) );
 
 		lineObj.scale.set( 1, 1, 1 );
@@ -247,7 +247,7 @@ THREE.PathControls = function ( object, domElement ) {
 			geo = new THREE.SphereGeometry( 1, 16, 8 ),
 			mat = new THREE.MeshBasicMaterial( { color: 0x00ff00 } );
 
-		for ( i = 0; i < spline.points.length; i++ ) {
+		for ( var i = 0; i < spline.points.length; i ++ ) {
 
 			waypoint = new THREE.Mesh( geo, mat );
 			waypoint.position.copy( spline.points[ i ] );

+ 4 - 4
src/extras/core/Curve.js

@@ -11,7 +11,7 @@
  * THREE.CubicBezierCurve
  * THREE.SplineCurve
  * THREE.ArcCurve
- * 
+ *
  * -- 3d classes --
  * THREE.LineCurve3
  * THREE.QuadraticBezierCurve3
@@ -160,7 +160,7 @@ THREE.Curve.prototype.getUtoTmapping = function ( u, distance ) {
 	// i--;
 	// console.log('o' , i, Date.now()- time);
 
-	time = Date.now();
+	var time = Date.now();
 
 	// binary search for the index with largest value smaller than target u distance
 
@@ -629,7 +629,7 @@ THREE.LineCurve3 = THREE.Curve.create(
 		var r = new THREE.Vector3();
 
 
-		r.sub( v2, v1 ); // diff
+		r.sub( this.v2, this.v1 ); // diff
 		r.multiplyScalar( t );
 		r.addSelf( this.v1 );
 
@@ -711,7 +711,7 @@ THREE.SplineCurve3 = THREE.Curve.create(
 	function ( points /* array of Vector3 */) {
 
 		this.points = points;
-		
+
 	},
 
 	function ( t ) {

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

@@ -245,7 +245,7 @@ THREE.ExtrudeGeometry.prototype.addShape = function( shape, options ) {
 
 		}
 
-		anglec = ( anglea + angleb ) / 2;
+		var anglec = ( anglea + angleb ) / 2;
 
 
 		//console.log('angle1', anglea * RAD_TO_DEGREES,'angle2', angleb * RAD_TO_DEGREES, 'anglec', anglec *RAD_TO_DEGREES);
@@ -684,7 +684,7 @@ THREE.ExtrudeGeometry.prototype.addShape = function( shape, options ) {
 
 				new THREE.UV( ax / ux, ay / uy ),
 				new THREE.UV( bx / ux, by / uy ),
-				new THREE.UV( cx / ux, cy / uy ),
+				new THREE.UV( cx / ux, cy / uy )
 
 			] );
 		}
@@ -710,4 +710,4 @@ 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.ExtrudeGeometry.__v6 = new THREE.Vector2();

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

@@ -126,7 +126,7 @@ THREE.TextGeometry.prototype.constructor = THREE.TextGeometry;
 
 	// Complete manner
 
-	var textPath = new TextPath( text, options );
+	var textPath = new THREE.TextPath( text, options );
 	var textShapes = textPath.toShapes();
 	var text3d = new ExtrudeGeometry( textShapes, options );
 
@@ -158,7 +158,7 @@ THREE.FontUtils = {
 
 	getTextShapes: function( text, options ) {
 
-		var textPath = new TextPath( text, options );
+		var textPath = new THREE.TextPath( text, options );
 		var textShapes = textPath.toShapes();
 		return textShapes;
 
@@ -235,12 +235,12 @@ THREE.FontUtils = {
 
 		var pts = [];
 
-		var i, i2,
+		var i, i2, divisions,
 			outline, action, length,
 			scaleX, scaleY,
 			x, y, cpx, cpy, cpx0, cpy0, cpx1, cpy1, cpx2, cpy2,
 			laste,
-			glyph = face.glyphs[ c ] || face.glyphs[ ctxt.options.fallbackCharacter ];
+			glyph = face.glyphs[ c ] || face.glyphs[ '?' ];
 
 		if ( !glyph ) return;
 
@@ -300,7 +300,7 @@ THREE.FontUtils = {
 						cpx0 = laste.x;
 						cpy0 = laste.y;
 
-						for ( i2 = 1, divisions = this.divisions; i2 <= divisions; i2++ ) {
+						for ( i2 = 1, divisions = this.divisions; i2 <= divisions; i2 ++ ) {
 
 							var t = i2 / divisions;
 							var tx = THREE.Shape.Utils.b2( t, cpx0, cpx1, cpx );
@@ -333,7 +333,7 @@ THREE.FontUtils = {
 						cpx0 = laste.x;
 						cpy0 = laste.y;
 
-						for ( i2 = 1, divisions = this.divisions; i2 <= divisions; i2++ ) {
+						for ( i2 = 1, divisions = this.divisions; i2 <= divisions; i2 ++ ) {
 
 							var t = i2 / divisions;
 							var tx = THREE.Shape.Utils.b3( t, cpx0, cpx1, cpx2, cpx );

+ 12 - 11
src/extras/loaders/ColladaLoader.js

@@ -301,8 +301,8 @@ THREE.ColladaLoader = function () {
 		geometry.skinWeights = [];
 		geometry.skinIndices = [];
 
-		createBones( geometry.bones, skin, hierarchy, skeleton, null, -1 );
-		createWeights( skin, geometry.bones, geometry.skinIndices, geometry.skinWeights );
+		//createBones( geometry.bones, skin, hierarchy, skeleton, null, -1 );
+		//createWeights( skin, geometry.bones, geometry.skinIndices, geometry.skinWeights );
 
 		/*
 		geometry.animation = {
@@ -515,7 +515,7 @@ THREE.ColladaLoader = function () {
 		var skinned = false;
 		var skinController;
 		var morphController;
-		var i;
+		var i, j;
 
 		// FIXME: controllers
 
@@ -764,15 +764,15 @@ THREE.ColladaLoader = function () {
 
 		var minT = 10000000;
 
-		for ( i = 0; i < node.channels.length; i ++ ) {
+		for ( var i = 0; i < node.channels.length; i ++ ) {
 
 			var sampler = node.channels[i].sampler;
 
 			for (var j = 0; j < sampler.input.length - 1; j ++ ) {
 
-				var t0 = sampler.input[j];
-				var t1 = sampler.input[j+1];
-				minT = Math.min(minT, t1 - t0);
+				var t0 = sampler.input[ j ];
+				var t1 = sampler.input[ j + 1 ];
+				minT = Math.min( minT, t1 - t0 );
 
 			}
 		}
@@ -1845,7 +1845,7 @@ THREE.ColladaLoader = function () {
 
 		for ( i = 0; i < this.primitives.length; i ++ ) {
 
-			primitive = this.primitives[ i ];
+			var primitive = this.primitives[ i ];
 			primitive.setVertices( this.vertices );
 			this.handlePrimitive( primitive, this.geometry3js, vertex_store );
 
@@ -1864,6 +1864,7 @@ THREE.ColladaLoader = function () {
 
 		var i = 0, j, k, p = primitive.p, inputs = primitive.inputs;
 		var input, index, idx32;
+		var source, numParams;
 		var vcIndex = 0, vcount = 3;
 		var texture_sets = [];
 
@@ -1954,7 +1955,7 @@ THREE.ColladaLoader = function () {
 				face = new THREE.Face4( vs[0], vs[1], vs[2], vs[3], [ ns[0], ns[1], ns[2], ns[3] ], cs.length ? cs : new THREE.Color() );
 
 			}
-			
+
 			face.daeMaterial = primitive.material;
 			geom.faces.push( face );
 
@@ -2090,8 +2091,8 @@ THREE.ColladaLoader = function () {
 
 			if ( element.childNodes[i].nodeName == 'input' ) {
 
-				input = (new Input()).parse(element.childNodes[i]);
-				this.input[input.semantic] = input;
+				var input = ( new Input() ).parse( element.childNodes[ i ] );
+				this.input[ input.semantic ] = input;
 
 			}
 

+ 3 - 1
src/extras/loaders/SceneLoader.js

@@ -27,7 +27,7 @@ THREE.SceneLoader.prototype = {
 		worker.onmessage = function( event ) {
 
 			var dg, dm, dd, dl, dc, df, dt,
-				g, o, m, l, p, c, t, f, tt, pp,
+				g, o, m, l, d, p, r, q, s, c, t, f, tt, pp,
 				geometry, material, camera, fog,
 				texture, images,
 				materials, light,
@@ -118,6 +118,8 @@ THREE.SceneLoader.prototype = {
 
 			function handle_objects() {
 
+				var object;
+
 				for( dd in data.objects ) {
 
 					if ( !result.objects[ dd ] ) {

+ 2 - 2
src/extras/objects/MarchingCubes.js

@@ -505,7 +505,7 @@ THREE.MarchingCubes = function ( resolution, materials ) {
 
 	this.addPlaneZ = function( strength, subtract ) {
 
-		var x, y, z, zz, val, zdiv, cz, cyz;
+		var x, y, z, zz, val, zdiv, cz, cyz,
 
 			// cache attribute lookups
 			size = this.size,
@@ -603,7 +603,7 @@ THREE.MarchingCubes = function ( resolution, materials ) {
 		var geo_callback = function( object ) {
 
 			var i, x, y, z, vertex, position, normal,
-				face, a, b, c, na, nb, nc;
+				face, a, b, c, na, nb, nc, nfaces;
 
 
 			for ( i = 0; i < object.count; i++ ) {

+ 1 - 1
src/extras/renderers/AnaglyphWebGLRenderer.js

@@ -32,7 +32,7 @@ if ( THREE.WebGLRenderer ) {
 		var _camera = new THREE.PerspectiveCamera( 53, 1, 1, 10000 );
 		_camera.position.z = 2;
 
-		_material = new THREE.ShaderMaterial( {
+		var _material = new THREE.ShaderMaterial( {
 
 			uniforms: {
 

+ 1 - 1
src/extras/renderers/ParallaxBarrierWebGLRenderer.js

@@ -32,7 +32,7 @@ if ( THREE.WebGLRenderer ) {
 		var _camera = new THREE.PerspectiveCamera( 53, 1, 1, 10000 );
 		_camera.position.z = 2;
 
-		_material = new THREE.ShaderMaterial( {
+		var _material = new THREE.ShaderMaterial( {
 
 			uniforms: {
 

+ 2 - 2
src/objects/SkinnedMesh.js

@@ -131,8 +131,8 @@ THREE.SkinnedMesh.prototype.updateMatrixWorld = function ( force ) {
 
 	// flatten bone matrices to array
 
-	var b, bl = this.bones.length;
-		ba = this.bones;
+	var b, bl = this.bones.length,
+		ba = this.bones,
 		bm = this.boneMatrices;
 
 	for ( b = 0; b < bl; b ++ ) {

+ 8 - 3
src/renderers/WebGLRenderer.js

@@ -2436,7 +2436,8 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 	function setLineBuffers ( geometry, hint ) {
 
-		var v, c, vertex, offset,
+		var v, c, vertex, offset, color,
+
 		vertices = geometry.vertices,
 		colors = geometry.colors,
 		vl = vertices.length,
@@ -2449,6 +2450,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 		dirtyColors = geometry.__dirtyColors,
 
 		customAttributes = geometry.__webglCustomAttributesList,
+
 		i, il,
 		a, ca, cal, value,
 		customAttribute;
@@ -2588,7 +2590,8 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 	function setRibbonBuffers ( geometry, hint ) {
 
-		var v, c, vertex, offset,
+		var v, c, vertex, offset, color,
+
 		vertices = geometry.vertices,
 		colors = geometry.colors,
 		vl = vertices.length,
@@ -2642,7 +2645,8 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 	function setParticleBuffers ( geometry, hint, object ) {
 
-		var v, c, vertex, offset,
+		var v, c, vertex, offset, index, color,
+
 		vertices = geometry.vertices,
 		vl = vertices.length,
 
@@ -4022,6 +4026,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 			shadowMap, shadowMatrix,
 			oil,
 			material,
+			program, buffer,
 			o, ol, webglObject, object,
 			lights = scene.lights,
 			fog = null;

+ 1 - 1
src/renderers/WebGLShaders.js

@@ -546,7 +546,7 @@ THREE.ShaderChunk = {
 
 			"gl_FragColor.xyz = gl_FragColor.xyz * ( totalDiffuse + ambientLightColor * ambient ) + totalSpecular;",
 
-		"#endif",
+		"#endif"
 
 	].join("\n"),
 

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