浏览代码

Merged zz85's 3d text pull request, cleaned up THREE.Text code.

alteredq 14 年之前
父节点
当前提交
d2cbf83dd3

文件差异内容过多而无法显示
+ 139 - 138
build/Three.js


+ 2 - 1
build/custom/ThreeCanvas.js

@@ -3,7 +3,8 @@ var THREE=THREE||{};if(!window.Int32Array)window.Int32Array=Array,window.Float32
 THREE.Color.prototype={copy:function(a){this.r=a.r;this.g=a.g;this.b=a.b;this.hex=a.hex},setHex:function(a){this.hex=~~a&16777215;this.updateRGB()},setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;this.updateHex()},setHSV:function(a,b,c){var d,e,g,f,h,j;if(c==0)d=e=g=0;else switch(f=Math.floor(a*6),h=a*6-f,a=c*(1-b),j=c*(1-b*h),b=c*(1-b*(1-h)),f){case 1:d=j;e=c;g=a;break;case 2:d=a;e=c;g=b;break;case 3:d=a;e=j;g=c;break;case 4:d=b;e=a;g=c;break;case 5:d=c;e=a;g=j;break;case 6:case 0:d=c,e=b,g=a}this.setRGB(d,
 e,g)},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGB:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},clone:function(){return new THREE.Color(this.hex)}};THREE.Vector2=function(a,b){this.set(a||0,b||0)};
 THREE.Vector2.prototype={set:function(a,b){this.x=a;this.y=b;return this},copy:function(a){this.x=a.x;this.y=a.y;return this},clone:function(){return new THREE.Vector2(this.x,this.y)},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;return this},divideScalar:function(a){a?
-(this.x/=a,this.y/=a):this.set(0,0);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.lengthSq())},normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)},unit:function(){return this.normalize()}};THREE.Vector3=function(a,b,c){this.set(a||0,b||0,c||0)};
+(this.x/=a,this.y/=a):this.set(0,0);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.lengthSq())},normalize:function(){return this.divideScalar(this.length())},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var b=this.x-a.x,a=this.y-a.y;return b*b+a*a},setLength:function(a){return this.normalize().multiplyScalar(a)},
+unit:function(){return this.normalize()},equals:function(a){return a.x==this.x&&a.y==this.y}};THREE.Vector3=function(a,b,c){this.set(a||0,b||0,c||0)};
 THREE.Vector3.prototype={set:function(a,b,c){this.x=a;this.y=b;this.z=c;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;return this},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;return this},addScalar:function(a){this.x+=a;this.y+=a;this.z+=a;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;return this},subSelf:function(a){this.x-=
 a.x;this.y-=a.y;this.z-=a.z;return this},multiply:function(a,b){this.x=a.x*b.x;this.y=a.y*b.y;this.z=a.z*b.z;return this},multiplySelf:function(a){this.x*=a.x;this.y*=a.y;this.z*=a.y;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;return this},divideSelf:function(a){return this.divide(this,a)},divideScalar:function(a){a?(this.x/=a,this.y/=a,this.z/=a):this.set(0,0,0);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*
 a.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.lengthSq())},lengthManhattan:function(){return this.x+this.y+this.z},normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)},cross:function(a,b){this.x=a.y*b.z-a.z*b.y;this.y=a.z*b.x-a.x*b.z;this.z=a.x*b.y-a.y*b.x;return this},crossSelf:function(a){return this.set(this.y*a.z-this.z*a.y,this.z*a.x-this.x*a.z,this.x*

+ 2 - 1
build/custom/ThreeDOM.js

@@ -3,7 +3,8 @@ var THREE=THREE||{};if(!window.Int32Array)window.Int32Array=Array,window.Float32
 THREE.Color.prototype={copy:function(a){this.r=a.r;this.g=a.g;this.b=a.b;this.hex=a.hex},setHex:function(a){this.hex=~~a&16777215;this.updateRGB()},setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;this.updateHex()},setHSV:function(a,b,c){var d,e,g,f,h,i;if(c==0)d=e=g=0;else switch(f=Math.floor(a*6),h=a*6-f,a=c*(1-b),i=c*(1-b*h),b=c*(1-b*(1-h)),f){case 1:d=i;e=c;g=a;break;case 2:d=a;e=c;g=b;break;case 3:d=a;e=i;g=c;break;case 4:d=b;e=a;g=c;break;case 5:d=c;e=a;g=i;break;case 6:case 0:d=c,e=b,g=a}this.setRGB(d,
 e,g)},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGB:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},clone:function(){return new THREE.Color(this.hex)}};THREE.Vector2=function(a,b){this.set(a||0,b||0)};
 THREE.Vector2.prototype={set:function(a,b){this.x=a;this.y=b;return this},copy:function(a){this.x=a.x;this.y=a.y;return this},clone:function(){return new THREE.Vector2(this.x,this.y)},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;return this},divideScalar:function(a){a?
-(this.x/=a,this.y/=a):this.set(0,0);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.lengthSq())},normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)},unit:function(){return this.normalize()}};THREE.Vector3=function(a,b,c){this.set(a||0,b||0,c||0)};
+(this.x/=a,this.y/=a):this.set(0,0);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.lengthSq())},normalize:function(){return this.divideScalar(this.length())},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var b=this.x-a.x,a=this.y-a.y;return b*b+a*a},setLength:function(a){return this.normalize().multiplyScalar(a)},
+unit:function(){return this.normalize()},equals:function(a){return a.x==this.x&&a.y==this.y}};THREE.Vector3=function(a,b,c){this.set(a||0,b||0,c||0)};
 THREE.Vector3.prototype={set:function(a,b,c){this.x=a;this.y=b;this.z=c;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;return this},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;return this},addScalar:function(a){this.x+=a;this.y+=a;this.z+=a;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;return this},subSelf:function(a){this.x-=
 a.x;this.y-=a.y;this.z-=a.z;return this},multiply:function(a,b){this.x=a.x*b.x;this.y=a.y*b.y;this.z=a.z*b.z;return this},multiplySelf:function(a){this.x*=a.x;this.y*=a.y;this.z*=a.y;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;return this},divideSelf:function(a){return this.divide(this,a)},divideScalar:function(a){a?(this.x/=a,this.y/=a,this.z/=a):this.set(0,0,0);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*
 a.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.lengthSq())},lengthManhattan:function(){return this.x+this.y+this.z},normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)},cross:function(a,b){this.x=a.y*b.z-a.z*b.y;this.y=a.z*b.x-a.x*b.z;this.z=a.x*b.y-a.y*b.x;return this},crossSelf:function(a){return this.set(this.y*a.z-this.z*a.y,this.z*a.x-this.x*a.z,this.x*

+ 168 - 155
build/custom/ThreeExtras.js

@@ -1,13 +1,13 @@
 // ThreeExtras.js r41/ROME - http://github.com/mrdoob/three.js
-THREE.ColorUtils={adjustHSV:function(a,c,b,d){var e=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(a,e);e.h=THREE.ColorUtils.clamp(e.h+c,0,1);e.s=THREE.ColorUtils.clamp(e.s+b,0,1);e.v=THREE.ColorUtils.clamp(e.v+d,0,1);a.setHSV(e.h,e.s,e.v)},rgbToHsv:function(a,c){var b=a.r,d=a.g,e=a.b,f=Math.max(Math.max(b,d),e),g=Math.min(Math.min(b,d),e);if(g==f)g=b=0;else{var j=f-g,g=j/f,b=b==f?(d-e)/j:d==f?2+(e-b)/j:4+(b-d)/j;b/=6;b<0&&(b+=1);b>1&&(b-=1)}c===void 0&&(c={h:0,s:0,v:0});c.h=b;c.s=g;c.v=f;return c},
-clamp:function(a,c,b){return a<c?c:a>b?b:a}};THREE.ColorUtils.__hsv={h:0,s:0,v:0};
-var GeometryUtils={merge:function(a,c){var b=c instanceof THREE.Mesh,d=a.vertices.length,e=b?c.geometry:c,f=a.vertices,g=e.vertices,j=a.faces,h=e.faces,l=a.faceVertexUvs[0],e=e.faceVertexUvs[0];b&&c.matrixAutoUpdate&&c.updateMatrix();for(var k=0,n=g.length;k<n;k++){var p=new THREE.Vertex(g[k].position.clone());b&&c.matrix.multiplyVector3(p.position);f.push(p)}k=0;for(n=h.length;k<n;k++){var g=h[k],o,t,v=g.vertexNormals,p=g.vertexColors;g instanceof THREE.Face3?o=new THREE.Face3(g.a+d,g.b+d,g.c+d):
-g instanceof THREE.Face4&&(o=new THREE.Face4(g.a+d,g.b+d,g.c+d,g.d+d));o.normal.copy(g.normal);b=0;for(f=v.length;b<f;b++)t=v[b],o.vertexNormals.push(t.clone());o.color.copy(g.color);b=0;for(f=p.length;b<f;b++)t=p[b],o.vertexColors.push(t.clone());o.materials=g.materials.slice();o.centroid.copy(g.centroid);j.push(o)}k=0;for(n=e.length;k<n;k++){d=e[k];j=[];b=0;for(f=d.length;b<f;b++)j.push(new THREE.UV(d[b].u,d[b].v));l.push(j)}}};
-THREE.ImageUtils={loadTexture:function(a,c,b){var d=new Image,e=new THREE.Texture(d,c);d.onload=function(){e.needsUpdate=!0;b&&b(this)};d.src=a;return e},loadTextureCube:function(a,c,b){var d,e=[],f=new THREE.Texture(e,c),c=e.loadCount=0;for(d=a.length;c<d;++c)e[c]=new Image,e[c].onload=function(){e.loadCount+=1;if(e.loadCount==6)f.needsUpdate=!0;b&&b(this)},e[c].src=a[c];return f}};
-THREE.SceneUtils={addMesh:function(a,c,b,d,e,f,g,j,h,l){c=new THREE.Mesh(c,l);c.scale.x=c.scale.y=c.scale.z=b;c.position.x=d;c.position.y=e;c.position.z=f;c.rotation.x=g;c.rotation.y=j;c.rotation.z=h;a.addObject(c);return c},addPanoramaCubeWebGL:function(a,c,b){var d=THREE.ShaderUtils.lib.cube;d.uniforms.tCube.texture=b;b=new THREE.MeshShaderMaterial({fragmentShader:d.fragmentShader,vertexShader:d.vertexShader,uniforms:d.uniforms});c=new THREE.Mesh(new THREE.Cube(c,c,c,1,1,1,null,!0),b);a.addObject(c);
-return c},addPanoramaCube:function(a,c,b){var d=[];d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[0])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[1])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[2])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[3])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[4])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[5])}));c=new THREE.Mesh(new THREE.Cube(c,c,c,1,1,d,!0),
-new THREE.MeshFaceMaterial);a.addObject(c);return c},addPanoramaCubePlanes:function(a,c,b){var d=c/2,c=new THREE.Plane(c,c),e=Math.PI,f=Math.PI/2;THREE.SceneUtils.addMesh(a,c,1,0,0,-d,0,0,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[5])}));THREE.SceneUtils.addMesh(a,c,1,-d,0,0,0,f,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[0])}));THREE.SceneUtils.addMesh(a,c,1,d,0,0,0,-f,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[1])}));THREE.SceneUtils.addMesh(a,c,1,0,d,0,f,0,e,
-new THREE.MeshBasicMaterial({map:new THREE.Texture(b[2])}));THREE.SceneUtils.addMesh(a,c,1,0,-d,0,-f,0,e,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[3])}))},showHierarchy:function(a,c){THREE.SceneUtils.traverseHierarchy(a,function(a){a.visible=c})},traverseHierarchy:function(a,c){var b,d,e=a.children.length;for(d=0;d<e;d++)b=a.children[d],c(b),THREE.SceneUtils.traverseHierarchy(b,c)}};
+THREE.ColorUtils={adjustHSV:function(a,b,c,e){var f=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(a,f);f.h=THREE.ColorUtils.clamp(f.h+b,0,1);f.s=THREE.ColorUtils.clamp(f.s+c,0,1);f.v=THREE.ColorUtils.clamp(f.v+e,0,1);a.setHSV(f.h,f.s,f.v)},rgbToHsv:function(a,b){var c=a.r,e=a.g,f=a.b,g=Math.max(Math.max(c,e),f),h=Math.min(Math.min(c,e),f);if(h==g)h=c=0;else{var k=g-h,h=k/g,c=c==g?(e-f)/k:e==g?2+(f-c)/k:4+(c-e)/k;c/=6;c<0&&(c+=1);c>1&&(c-=1)}b===void 0&&(b={h:0,s:0,v:0});b.h=c;b.s=h;b.v=g;return b},
+clamp:function(a,b,c){return a<b?b:a>c?c:a}};THREE.ColorUtils.__hsv={h:0,s:0,v:0};
+var GeometryUtils={merge:function(a,b){var c=b instanceof THREE.Mesh,e=a.vertices.length,f=c?b.geometry:b,g=a.vertices,h=f.vertices,k=a.faces,j=f.faces,l=a.faceVertexUvs[0],f=f.faceVertexUvs[0];c&&b.matrixAutoUpdate&&b.updateMatrix();for(var m=0,n=h.length;m<n;m++){var t=new THREE.Vertex(h[m].position.clone());c&&b.matrix.multiplyVector3(t.position);g.push(t)}m=0;for(n=j.length;m<n;m++){var h=j[m],p,u,v=h.vertexNormals,t=h.vertexColors;h instanceof THREE.Face3?p=new THREE.Face3(h.a+e,h.b+e,h.c+e):
+h instanceof THREE.Face4&&(p=new THREE.Face4(h.a+e,h.b+e,h.c+e,h.d+e));p.normal.copy(h.normal);c=0;for(g=v.length;c<g;c++)u=v[c],p.vertexNormals.push(u.clone());p.color.copy(h.color);c=0;for(g=t.length;c<g;c++)u=t[c],p.vertexColors.push(u.clone());p.materials=h.materials.slice();p.centroid.copy(h.centroid);k.push(p)}m=0;for(n=f.length;m<n;m++){e=f[m];k=[];c=0;for(g=e.length;c<g;c++)k.push(new THREE.UV(e[c].u,e[c].v));l.push(k)}}};
+THREE.ImageUtils={loadTexture:function(a,b,c){var e=new Image,f=new THREE.Texture(e,b);e.onload=function(){f.needsUpdate=!0;c&&c(this)};e.src=a;return f},loadTextureCube:function(a,b,c){var e,f=[],g=new THREE.Texture(f,b),b=f.loadCount=0;for(e=a.length;b<e;++b)f[b]=new Image,f[b].onload=function(){f.loadCount+=1;if(f.loadCount==6)g.needsUpdate=!0;c&&c(this)},f[b].src=a[b];return g}};
+THREE.SceneUtils={addMesh:function(a,b,c,e,f,g,h,k,j,l){b=new THREE.Mesh(b,l);b.scale.x=b.scale.y=b.scale.z=c;b.position.x=e;b.position.y=f;b.position.z=g;b.rotation.x=h;b.rotation.y=k;b.rotation.z=j;a.addObject(b);return b},addPanoramaCubeWebGL:function(a,b,c){var e=THREE.ShaderUtils.lib.cube;e.uniforms.tCube.texture=c;c=new THREE.MeshShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:e.uniforms});b=new THREE.Mesh(new THREE.Cube(b,b,b,1,1,1,null,!0),c);a.addObject(b);
+return b},addPanoramaCube:function(a,b,c){var e=[];e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[0])}));e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[1])}));e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[2])}));e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[3])}));e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[4])}));e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[5])}));b=new THREE.Mesh(new THREE.Cube(b,b,b,1,1,e,!0),
+new THREE.MeshFaceMaterial);a.addObject(b);return b},addPanoramaCubePlanes:function(a,b,c){var e=b/2,b=new THREE.Plane(b,b),f=Math.PI,g=Math.PI/2;THREE.SceneUtils.addMesh(a,b,1,0,0,-e,0,0,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(c[5])}));THREE.SceneUtils.addMesh(a,b,1,-e,0,0,0,g,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(c[0])}));THREE.SceneUtils.addMesh(a,b,1,e,0,0,0,-g,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(c[1])}));THREE.SceneUtils.addMesh(a,b,1,0,e,0,g,0,f,
+new THREE.MeshBasicMaterial({map:new THREE.Texture(c[2])}));THREE.SceneUtils.addMesh(a,b,1,0,-e,0,-g,0,f,new THREE.MeshBasicMaterial({map:new THREE.Texture(c[3])}))},showHierarchy:function(a,b){THREE.SceneUtils.traverseHierarchy(a,function(a){a.visible=b})},traverseHierarchy:function(a,b){var c,e,f=a.children.length;for(e=0;e<f;e++)c=a.children[e],b(c),THREE.SceneUtils.traverseHierarchy(c,b)}};
 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:{enableAO:{type:"i",value:0},enableDiffuse:{type:"i",value:0},enableSpecular:{type:"i",value:0},tDiffuse:{type:"t",value:0,texture:null},tNormal:{type:"t",value:2,texture:null},tSpecular:{type:"t",value:3,texture:null},tAO:{type:"t",value:4,texture:null},uNormalScale:{type:"f",value:1},tDisplacement:{type:"t",value:5,texture:null},uDisplacementBias:{type:"f",value:-0.5},uDisplacementScale:{type:"f",value:2.5},uPointLightPos:{type:"v3",value:new THREE.Vector3},uPointLightColor:{type:"c",
@@ -17,148 +17,161 @@ cube:{uniforms:{tCube:{type:"t",value:1,texture:null}},vertexShader:"varying vec
 value:0,texture:null},uImageIncrement:{type:"v2",value:new THREE.Vector2(0.001953125,0)},cKernel:{type:"fv1",value:[]}},vertexShader:"varying vec2 vUv;\nuniform vec2 uImageIncrement;\nvoid main(void) {\nvUv = uv - ((KERNEL_SIZE - 1.0) / 2.0) * uImageIncrement;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform vec2 uImageIncrement;\nuniform float cKernel[KERNEL_SIZE];\nvoid main(void) {\nvec2 imageCoord = vUv;\nvec4 sum = vec4( 0.0, 0.0, 0.0, 0.0 );\nfor( int i=0; i<KERNEL_SIZE; ++i ) {\nsum += texture2D( tDiffuse, imageCoord ) * cKernel[i];\nimageCoord += uImageIncrement;\n}\ngl_FragColor = sum;\n}"},
 film:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},time:{type:"f",value:0},nIntensity:{type:"f",value:0.5},sIntensity:{type:"f",value:0.05},sCount:{type:"f",value:4096},grayscale:{type:"i",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float time;\nuniform bool grayscale;\nuniform float nIntensity;\nuniform float sIntensity;\nuniform float sCount;\nvoid main() {\nvec4 cTextureScreen = texture2D( tDiffuse, vUv );\nfloat x = vUv.x * vUv.y * time *  1000.0;\nx = mod( x, 13.0 ) * mod( x, 123.0 );\nfloat dx = mod( x, 0.01 );\nvec3 cResult = cTextureScreen.rgb + cTextureScreen.rgb * clamp( 0.1 + dx * 100.0, 0.0, 1.0 );\nvec2 sc = vec2( sin( vUv.y * sCount ), cos( vUv.y * sCount ) );\ncResult += cTextureScreen.rgb * vec3( sc.x, sc.y, sc.x ) * sIntensity;\ncResult = cTextureScreen.rgb + clamp( nIntensity, 0.0,1.0 ) * ( cResult - cTextureScreen.rgb );\nif( grayscale ) {\ncResult = vec3( cResult.r * 0.3 + cResult.g * 0.59 + cResult.b * 0.11 );\n}\ngl_FragColor =  vec4( cResult, cTextureScreen.a );\n}"},
 screen:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},opacity:{type:"f",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float opacity;\nvoid main() {\nvec4 texel = texture2D( tDiffuse, vUv );\ngl_FragColor = opacity * texel;\n}"},basic:{uniforms:{},vertexShader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",
-fragmentShader:"void main() {\ngl_FragColor = vec4( 1.0, 0.0, 0.0, 0.5 );\n}"}},buildKernel:function(a){var c,b,d,e,f=2*Math.ceil(a*3)+1;f>25&&(f=25);e=(f-1)*0.5;b=Array(f);for(c=d=0;c<f;++c)b[c]=Math.exp(-((c-e)*(c-e))/(2*a*a)),d+=b[c];for(c=0;c<f;++c)b[c]/=d;return b}};
-THREE.AnimationHandler=function(){var a=[],c={},b={update:function(b){for(var c=0;c<a.length;c++)a[c].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 j=a.hierarchy[b].keys[d].rot;a.hierarchy[b].keys[d].rot=new THREE.Quaternion(j[0],j[1],j[2],j[3])}}if(a.hierarchy[b].keys[0].morphTargets!==void 0){j={};for(d=0;d<a.hierarchy[b].keys.length;d++)for(var h=0;h<a.hierarchy[b].keys[d].morphTargets.length;h++){var l=a.hierarchy[b].keys[d].morphTargets[h];j[l]=-1}a.hierarchy[b].usedMorphTargets=j;for(d=0;d<a.hierarchy[b].keys.length;d++){var k=
-{};for(l in j){for(h=0;h<a.hierarchy[b].keys[d].morphTargets.length;h++)if(a.hierarchy[b].keys[d].morphTargets[h]===l){k[l]=a.hierarchy[b].keys[d].morphTargetsInfluences[h];break}h===a.hierarchy[b].keys[d].morphTargets.length&&(k[l]=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,e;for(b=0;b<d;b++){e=this.hierarchy[b];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)e.useQuaternion=!0;e.matrixAutoUpdate=!0;if(e.animationCache===void 0)e.animationCache={},e.animationCache.prevKey={pos:0,rot:0,scl:0},e.animationCache.nextKey={pos:0,rot:0,scl:0},e.animationCache.originalMatrix=e instanceof
-THREE.Bone?e.skinMatrix:e.matrix;var f=e.animationCache.prevKey;e=e.animationCache.nextKey;f.pos=this.data.hierarchy[b].keys[0];f.rot=this.data.hierarchy[b].keys[0];f.scl=this.data.hierarchy[b].keys[0];e.pos=this.getNextKeyWith("pos",b,1);e.rot=this.getNextKeyWith("rot",b,1);e.scl=this.getNextKeyWith("scl",b,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
+fragmentShader:"void main() {\ngl_FragColor = vec4( 1.0, 0.0, 0.0, 0.5 );\n}"}},buildKernel:function(a){var b,c,e,f,g=2*Math.ceil(a*3)+1;g>25&&(g=25);f=(g-1)*0.5;c=Array(g);for(b=e=0;b<g;++b)c[b]=Math.exp(-((b-f)*(b-f))/(2*a*a)),e+=c[b];for(b=0;b<g;++b)c[b]/=e;return c}};
+THREE.AnimationHandler=function(){var a=[],b={},c={update:function(c){for(var b=0;b<a.length;b++)a[b].update(c)},addToUpdate:function(c){a.indexOf(c)===-1&&a.push(c)},removeFromUpdate:function(c){c=a.indexOf(c);c!==-1&&a.splice(c,1)},add:function(a){b[a.name]!==void 0&&console.log("THREE.AnimationHandler.add: Warning! "+a.name+" already exists in library. Overwriting.");b[a.name]=a;if(a.initialized!==!0){for(var c=0;c<a.hierarchy.length;c++){for(var e=0;e<a.hierarchy[c].keys.length;e++){if(a.hierarchy[c].keys[e].time<
+0)a.hierarchy[c].keys[e].time=0;if(a.hierarchy[c].keys[e].rot!==void 0&&!(a.hierarchy[c].keys[e].rot instanceof THREE.Quaternion)){var k=a.hierarchy[c].keys[e].rot;a.hierarchy[c].keys[e].rot=new THREE.Quaternion(k[0],k[1],k[2],k[3])}}if(a.hierarchy[c].keys[0].morphTargets!==void 0){k={};for(e=0;e<a.hierarchy[c].keys.length;e++)for(var j=0;j<a.hierarchy[c].keys[e].morphTargets.length;j++){var l=a.hierarchy[c].keys[e].morphTargets[j];k[l]=-1}a.hierarchy[c].usedMorphTargets=k;for(e=0;e<a.hierarchy[c].keys.length;e++){var m=
+{};for(l in k){for(j=0;j<a.hierarchy[c].keys[e].morphTargets.length;j++)if(a.hierarchy[c].keys[e].morphTargets[j]===l){m[l]=a.hierarchy[c].keys[e].morphTargetsInfluences[j];break}j===a.hierarchy[c].keys[e].morphTargets.length&&(m[l]=0)}a.hierarchy[c].keys[e].morphTargetsInfluences=m}}for(e=1;e<a.hierarchy[c].keys.length;e++)a.hierarchy[c].keys[e].time===a.hierarchy[c].keys[e-1].time&&(a.hierarchy[c].keys.splice(e,1),e--);for(e=1;e<a.hierarchy[c].keys.length;e++)a.hierarchy[c].keys[e].index=e}e=parseInt(a.length*
+a.fps,10);a.JIT={};a.JIT.hierarchy=[];for(c=0;c<a.hierarchy.length;c++)a.JIT.hierarchy.push(Array(e));a.initialized=!0}},get:function(a){if(typeof a==="string")return b[a]?b[a]:(console.log("THREE.AnimationHandler.get: Couldn't find animation "+a),null)},parse:function(a){var c=[];if(a instanceof THREE.SkinnedMesh)for(var b=0;b<a.bones.length;b++)c.push(a.bones[b]);else e(a,c);return c}},e=function(a,c){c.push(a);for(var b=0;b<a.children.length;b++)e(a.children[b],c)};c.LINEAR=0;c.CATMULLROM=1;c.CATMULLROM_FORWARD=
+2;return c}();THREE.Animation=function(a,b,c,e){this.root=a;this.data=THREE.AnimationHandler.get(b);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.loop=this.isPaused=!0;this.interpolationType=c!==void 0?c:THREE.AnimationHandler.LINEAR;this.JITCompile=e!==void 0?e:!0;this.points=[];this.target=new THREE.Vector3};
+THREE.Animation.prototype.play=function(a,b){if(!this.isPlaying){this.isPlaying=!0;this.loop=a!==void 0?a:!0;this.currentTime=b!==void 0?b:0;var c,e=this.hierarchy.length,f;for(c=0;c<e;c++){f=this.hierarchy[c];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[c].keys[0];g.rot=this.data.hierarchy[c].keys[0];g.scl=this.data.hierarchy[c].keys[0];f.pos=this.getNextKeyWith("pos",c,1);f.rot=this.getNextKeyWith("rot",c,1);f.scl=this.getNextKeyWith("scl",c,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
 THREE.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
 THREE.Animation.prototype.stop=function(){this.isPaused=this.isPlaying=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.hierarchy.length;a++)if(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,d,e,f,g,j,h,l,k=this.data.JIT.hierarchy,n,p;this.currentTime+=a*this.timeScale;p=this.currentTime;n=this.currentTime%=this.data.length;l=parseInt(Math.min(n*this.data.fps,this.data.length*this.data.fps),10);for(var o=0,t=this.hierarchy.length;o<t;o++)if(a=this.hierarchy[o],h=a.animationCache,this.JITCompile&&k[o][l]!==void 0)a instanceof THREE.Bone?(a.skinMatrix=k[o][l],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=
-!1):(a.matrix=k[o][l],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=!0);else{if(this.JITCompile)a instanceof THREE.Bone?a.skinMatrix=a.animationCache.originalMatrix:a.matrix=a.animationCache.originalMatrix;for(var v=0;v<3;v++){b=c[v];g=h.prevKey[b];j=h.nextKey[b];if(j.time<=p){if(n<p)if(this.loop){g=this.data.hierarchy[o].keys[0];for(j=this.getNextKeyWith(b,o,1);j.time<n;)g=j,j=this.getNextKeyWith(b,o,j.index+1)}else{this.stop();return}else{do g=j,j=this.getNextKeyWith(b,o,j.index+1);while(j.time<
-n)}h.prevKey[b]=g;h.nextKey[b]=j}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;d=(n-g.time)/(j.time-g.time);e=g[b];f=j[b];if(d<0||d>1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+d+" on bone "+o),d=d<0?0:1;if(b==="pos")if(b=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)b.x=e[0]+(f[0]-e[0])*d,b.y=e[1]+(f[1]-e[1])*d,b.z=e[2]+(f[2]-e[2])*d;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
-this.getPrevKeyWith("pos",o,g.index-1).pos,this.points[1]=e,this.points[2]=f,this.points[3]=this.getNextKeyWith("pos",o,j.index+1).pos,d=d*0.33+0.33,e=this.interpolateCatmullRom(this.points,d),b.x=e[0],b.y=e[1],b.z=e[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(e,f,a.quaternion,d);else if(b==="scl")b=a.scale,b.x=e[0]+(f[0]-e[0])*d,b.y=e[1]+(f[1]-e[1])*d,b.z=e[2]+(f[2]-e[2])*d}}if(this.JITCompile&&k[0][l]===void 0){this.hierarchy[0].update(void 0,!0);for(o=0;o<this.hierarchy.length;o++)k[o][l]=this.hierarchy[o]instanceof THREE.Bone?this.hierarchy[o].skinMatrix.clone():this.hierarchy[o].matrix.clone()}}};
-THREE.Animation.prototype.interpolateCatmullRom=function(a,c){var b=[],d=[],e,f,g,j,h,l;e=(a.length-1)*c;f=Math.floor(e);e-=f;b[0]=f==0?f:f-1;b[1]=f;b[2]=f>a.length-2?f:f+1;b[3]=f>a.length-3?f:f+2;f=a[b[0]];j=a[b[1]];h=a[b[2]];l=a[b[3]];b=e*e;g=e*b;d[0]=this.interpolate(f[0],j[0],h[0],l[0],e,b,g);d[1]=this.interpolate(f[1],j[1],h[1],l[1],e,b,g);d[2]=this.interpolate(f[2],j[2],h[2],l[2],e,b,g);return d};
-THREE.Animation.prototype.interpolate=function(a,c,b,d,e,f,g){a=(b-a)*0.5;d=(d-c)*0.5;return(2*(c-b)+a+d)*g+(-3*(c-b)-2*a-d)*f+a*e+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.QuakeCamera=function(a){function c(a,d){return function(){d.apply(a,arguments)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.movementSpeed=1;this.lookSpeed=0.0050;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=3.14;this.domElement=document;this.lastUpdate=(new Date).getTime();this.tdiff=0;if(a){if(a.movementSpeed!==void 0)this.movementSpeed=
+THREE.Animation.prototype.update=function(a){if(this.isPlaying){var b=["pos","rot","scl"],c,e,f,g,h,k,j,l,m=this.data.JIT.hierarchy,n,t;this.currentTime+=a*this.timeScale;t=this.currentTime;n=this.currentTime%=this.data.length;l=parseInt(Math.min(n*this.data.fps,this.data.length*this.data.fps),10);for(var p=0,u=this.hierarchy.length;p<u;p++)if(a=this.hierarchy[p],j=a.animationCache,this.JITCompile&&m[p][l]!==void 0)a instanceof THREE.Bone?(a.skinMatrix=m[p][l],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=
+!1):(a.matrix=m[p][l],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=!0);else{if(this.JITCompile)a instanceof THREE.Bone?a.skinMatrix=a.animationCache.originalMatrix:a.matrix=a.animationCache.originalMatrix;for(var v=0;v<3;v++){c=b[v];h=j.prevKey[c];k=j.nextKey[c];if(k.time<=t){if(n<t)if(this.loop){h=this.data.hierarchy[p].keys[0];for(k=this.getNextKeyWith(c,p,1);k.time<n;)h=k,k=this.getNextKeyWith(c,p,k.index+1)}else{this.stop();return}else{do h=k,k=this.getNextKeyWith(c,p,k.index+1);while(k.time<
+n)}j.prevKey[c]=h;j.nextKey[c]=k}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;e=(n-h.time)/(k.time-h.time);f=h[c];g=k[c];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(c==="pos")if(c=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)c.x=f[0]+(g[0]-f[0])*e,c.y=f[1]+(g[1]-f[1])*e,c.z=f[2]+(g[2]-f[2])*e;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
+this.getPrevKeyWith("pos",p,h.index-1).pos,this.points[1]=f,this.points[2]=g,this.points[3]=this.getNextKeyWith("pos",p,k.index+1).pos,e=e*0.33+0.33,f=this.interpolateCatmullRom(this.points,e),c.x=f[0],c.y=f[1],c.z=f[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)e=this.interpolateCatmullRom(this.points,e*1.01),this.target.set(e[0],e[1],e[2]),this.target.subSelf(c),this.target.y=0,this.target.normalize(),e=Math.atan2(this.target.x,this.target.z),a.rotation.set(0,e,0)}else if(c===
+"rot")THREE.Quaternion.slerp(f,g,a.quaternion,e);else if(c==="scl")c=a.scale,c.x=f[0]+(g[0]-f[0])*e,c.y=f[1]+(g[1]-f[1])*e,c.z=f[2]+(g[2]-f[2])*e}}if(this.JITCompile&&m[0][l]===void 0){this.hierarchy[0].update(void 0,!0);for(p=0;p<this.hierarchy.length;p++)m[p][l]=this.hierarchy[p]instanceof THREE.Bone?this.hierarchy[p].skinMatrix.clone():this.hierarchy[p].matrix.clone()}}};
+THREE.Animation.prototype.interpolateCatmullRom=function(a,b){var c=[],e=[],f,g,h,k,j,l;f=(a.length-1)*b;g=Math.floor(f);f-=g;c[0]=g==0?g:g-1;c[1]=g;c[2]=g>a.length-2?g:g+1;c[3]=g>a.length-3?g:g+2;g=a[c[0]];k=a[c[1]];j=a[c[2]];l=a[c[3]];c=f*f;h=f*c;e[0]=this.interpolate(g[0],k[0],j[0],l[0],f,c,h);e[1]=this.interpolate(g[1],k[1],j[1],l[1],f,c,h);e[2]=this.interpolate(g[2],k[2],j[2],l[2],f,c,h);return e};
+THREE.Animation.prototype.interpolate=function(a,b,c,e,f,g,h){a=(c-a)*0.5;e=(e-b)*0.5;return(2*(b-c)+a+e)*h+(-3*(b-c)-2*a-e)*g+a*f+b};THREE.Animation.prototype.getNextKeyWith=function(a,b,c){var e=this.data.hierarchy[b].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c=c<e.length-1?c:e.length-1:c%=e.length;c<e.length;c++)if(e[c][a]!==void 0)return e[c];return this.data.hierarchy[b].keys[0]};
+THREE.Animation.prototype.getPrevKeyWith=function(a,b,c){for(var e=this.data.hierarchy[b].keys,c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c>0?c:0:c>=0?c:c+e.length;c>=0;c--)if(e[c][a]!==void 0)return e[c];return this.data.hierarchy[b].keys[e.length-1]};
+THREE.QuakeCamera=function(a){function b(a,b){return function(){b.apply(a,arguments)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.movementSpeed=1;this.lookSpeed=0.0050;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=3.14;this.domElement=document;this.lastUpdate=(new Date).getTime();this.tdiff=0;if(a){if(a.movementSpeed!==void 0)this.movementSpeed=
 a.movementSpeed;if(a.lookSpeed!==void 0)this.lookSpeed=a.lookSpeed;if(a.noFly!==void 0)this.noFly=a.noFly;if(a.lookVertical!==void 0)this.lookVertical=a.lookVertical;if(a.autoForward!==void 0)this.autoForward=a.autoForward;if(a.activeLook!==void 0)this.activeLook=a.activeLook;if(a.heightSpeed!==void 0)this.heightSpeed=a.heightSpeed;if(a.heightCoef!==void 0)this.heightCoef=a.heightCoef;if(a.heightMin!==void 0)this.heightMin=a.heightMin;if(a.heightMax!==void 0)this.heightMax=a.heightMax;if(a.constrainVertical!==
 void 0)this.constrainVertical=a.constrainVertical;if(a.verticalMin!==void 0)this.verticalMin=a.verticalMin;if(a.verticalMax!==void 0)this.verticalMax=a.verticalMax;if(a.domElement!==void 0)this.domElement=a.domElement}this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=this.autoSpeedFactor=0;this.mouseDragOn=this.freeze=this.moveRight=this.moveLeft=this.moveBackward=this.moveForward=!1;this.windowHalfX=window.innerWidth/2;this.windowHalfY=window.innerHeight/2;this.onMouseDown=function(a){a.preventDefault();
 a.stopPropagation();if(this.activeLook)switch(a.button){case 0:this.moveForward=!0;break;case 2:this.moveBackward=!0}this.mouseDragOn=!0};this.onMouseUp=function(a){a.preventDefault();a.stopPropagation();if(this.activeLook)switch(a.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=!1}this.mouseDragOn=!1};this.onMouseMove=function(a){this.mouseX=a.clientX-this.windowHalfX;this.mouseY=a.clientY-this.windowHalfY};this.onKeyDown=function(a){switch(a.keyCode){case 38:case 87:this.moveForward=
 !0;break;case 37:case 65:this.moveLeft=!0;break;case 40:case 83:this.moveBackward=!0;break;case 39:case 68:this.moveRight=!0;break;case 81:this.freeze=!this.freeze}};this.onKeyUp=function(a){switch(a.keyCode){case 38:case 87:this.moveForward=!1;break;case 37:case 65:this.moveLeft=!1;break;case 40:case 83:this.moveBackward=!1;break;case 39:case 68:this.moveRight=!1}};this.update=function(){var a=(new Date).getTime();this.tdiff=(a-this.lastUpdate)/1E3;this.lastUpdate=a;if(!this.freeze){this.autoSpeedFactor=
-this.heightSpeed?this.tdiff*((this.position.y<this.heightMin?this.heightMin:this.position.y>this.heightMax?this.heightMax:this.position.y)-this.heightMin)*this.heightCoef:0;var d=this.tdiff*this.movementSpeed;(this.moveForward||this.autoForward&&!this.moveBackward)&&this.translateZ(-(d+this.autoSpeedFactor));this.moveBackward&&this.translateZ(d);this.moveLeft&&this.translateX(-d);this.moveRight&&this.translateX(d);d=this.tdiff*this.lookSpeed;this.activeLook||(d=0);this.lon+=this.mouseX*d;this.lookVertical&&
-(this.lat-=this.mouseY*d);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;var a=this.target.position,c=this.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.lon+=this.mouseX*d;this.lookVertical&&(this.lat-=this.mouseY*d);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;if(this.constrainVertical)this.phi=
-(this.phi-0)*(this.verticalMax-this.verticalMin)/3.14+this.verticalMin;a=this.target.position;c=this.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.supr.update.call(this)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",c(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",c(this,this.onMouseDown),
-!1);this.domElement.addEventListener("mouseup",c(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",c(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",c(this,this.onKeyUp),!1)};THREE.QuakeCamera.prototype=new THREE.Camera;THREE.QuakeCamera.prototype.constructor=THREE.QuakeCamera;THREE.QuakeCamera.prototype.supr=THREE.Camera.prototype;
-THREE.QuakeCamera.prototype.translate=function(a,c){this.matrix.rotateAxis(c);if(this.noFly)c.y=0;this.position.addSelf(c.multiplyScalar(a));this.target.position.addSelf(c.multiplyScalar(a))};
-THREE.PathCamera=function(a){function c(a,b,d,c){var f={name:d,fps:0.6,length:c,hierarchy:[]},g,e=b.getControlPointsArray(),j=b.getLength(),h=e.length,w=0;g=h-1;b={parent:-1,keys:[]};b.keys[0]={time:0,pos:e[0],rot:[0,0,0,1],scl:[1,1,1]};b.keys[g]={time:c,pos:e[g],rot:[0,0,0,1],scl:[1,1,1]};for(g=1;g<h-1;g++)w=c*j.chunks[g]/j.total,b.keys[g]={time:w,pos:e[g]};f.hierarchy[0]=b;THREE.AnimationHandler.add(f);return new THREE.Animation(a,d,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function b(a,b){var c,
-d,f=new THREE.Geometry;for(c=0;c<a.points.length*b;c++)d=c/(a.points.length*b),d=a.getPoint(d),f.vertices[c]=new THREE.Vertex(new THREE.Vector3(d.x,d.y,d.z));return f}function d(a,d){var c=b(d,10),f=b(d,10),g=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(c,g);particleObj=new THREE.ParticleSystem(f,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);a.addChild(lineObj);particleObj.scale.set(1,1,1);a.addChild(particleObj);f=new THREE.Sphere(1,
-16,8);g=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<d.points.length;i++)c=new THREE.Mesh(f,g),c.position.copy(d.points[i]),c.updateMatrix(),a.addChild(c)}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.id="PathCamera"+THREE.PathCameraIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.0050;this.lookHorizontal=
+this.heightSpeed?this.tdiff*((this.position.y<this.heightMin?this.heightMin:this.position.y>this.heightMax?this.heightMax:this.position.y)-this.heightMin)*this.heightCoef:0;var b=this.tdiff*this.movementSpeed;(this.moveForward||this.autoForward&&!this.moveBackward)&&this.translateZ(-(b+this.autoSpeedFactor));this.moveBackward&&this.translateZ(b);this.moveLeft&&this.translateX(-b);this.moveRight&&this.translateX(b);b=this.tdiff*this.lookSpeed;this.activeLook||(b=0);this.lon+=this.mouseX*b;this.lookVertical&&
+(this.lat-=this.mouseY*b);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;var a=this.target.position,f=this.position;a.x=f.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=f.y+100*Math.cos(this.phi);a.z=f.z+100*Math.sin(this.phi)*Math.sin(this.theta)}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;if(this.constrainVertical)this.phi=
+(this.phi-0)*(this.verticalMax-this.verticalMin)/3.14+this.verticalMin;a=this.target.position;f=this.position;a.x=f.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=f.y+100*Math.cos(this.phi);a.z=f.z+100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",b(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",b(this,this.onMouseDown),
+!1);this.domElement.addEventListener("mouseup",b(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",b(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",b(this,this.onKeyUp),!1)};THREE.QuakeCamera.prototype=new THREE.Camera;THREE.QuakeCamera.prototype.constructor=THREE.QuakeCamera;THREE.QuakeCamera.prototype.supr=THREE.Camera.prototype;
+THREE.QuakeCamera.prototype.translate=function(a,b){this.matrix.rotateAxis(b);if(this.noFly)b.y=0;this.position.addSelf(b.multiplyScalar(a));this.target.position.addSelf(b.multiplyScalar(a))};
+THREE.PathCamera=function(a){function b(a,c,b,e){var g={name:b,fps:0.6,length:e,hierarchy:[]},f,h=c.getControlPointsArray(),k=c.getLength(),j=h.length,z=0;f=j-1;c={parent:-1,keys:[]};c.keys[0]={time:0,pos:h[0],rot:[0,0,0,1],scl:[1,1,1]};c.keys[f]={time:e,pos:h[f],rot:[0,0,0,1],scl:[1,1,1]};for(f=1;f<j-1;f++)z=e*k.chunks[f]/k.total,c.keys[f]={time:z,pos:h[f]};g.hierarchy[0]=c;THREE.AnimationHandler.add(g);return new THREE.Animation(a,b,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function c(a,c){var b,
+e,g=new THREE.Geometry;for(b=0;b<a.points.length*c;b++)e=b/(a.points.length*c),e=a.getPoint(e),g.vertices[b]=new THREE.Vertex(new THREE.Vector3(e.x,e.y,e.z));return g}function e(a,b){var e=c(b,10),g=c(b,10),f=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(e,f);particleObj=new THREE.ParticleSystem(g,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);a.addChild(lineObj);particleObj.scale.set(1,1,1);a.addChild(particleObj);g=new THREE.Sphere(1,
+16,8);f=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<b.points.length;i++)e=new THREE.Mesh(g,f),e.position.copy(b.points[i]),e.updateMatrix(),a.addChild(e)}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.id="PathCamera"+THREE.PathCameraIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.0050;this.lookHorizontal=
 this.lookVertical=!0;this.verticalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.horizontalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.domElement=document;if(a){if(a.duration!==void 0)this.duration=a.duration*1E3;if(a.waypoints!==void 0)this.waypoints=a.waypoints;if(a.useConstantSpeed!==void 0)this.useConstantSpeed=a.useConstantSpeed;if(a.resamplingCoef!==void 0)this.resamplingCoef=a.resamplingCoef;if(a.createDebugPath!==void 0)this.createDebugPath=a.createDebugPath;if(a.createDebugDummy!==
 void 0)this.createDebugDummy=a.createDebugDummy;if(a.lookSpeed!==void 0)this.lookSpeed=a.lookSpeed;if(a.lookVertical!==void 0)this.lookVertical=a.lookVertical;if(a.lookHorizontal!==void 0)this.lookHorizontal=a.lookHorizontal;if(a.verticalAngleMap!==void 0)this.verticalAngleMap=a.verticalAngleMap;if(a.horizontalAngleMap!==void 0)this.horizontalAngleMap=a.horizontalAngleMap;if(a.domElement!==void 0)this.domElement=a.domElement}this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;this.windowHalfX=
-window.innerWidth/2;this.windowHalfY=window.innerHeight/2;var e=Math.PI*2,f=Math.PI/180;this.update=function(a,b,c){var d,g;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*f;this.theta=this.lon*f;d=this.phi%e;this.phi=d>=0?d:d+e;d=this.verticalAngleMap.srcRange;g=this.verticalAngleMap.dstRange;var j=g[1]-g[0];this.phi=
-TWEEN.Easing.Quadratic.EaseInOut(((this.phi-d[0])*(g[1]-g[0])/(d[1]-d[0])+g[0]-g[0])/j)*j+g[0];d=this.horizontalAngleMap.srcRange;g=this.horizontalAngleMap.dstRange;j=g[1]-g[0];this.theta=TWEEN.Easing.Quadratic.EaseInOut(((this.theta-d[0])*(g[1]-g[0])/(d[1]-d[0])+g[0]-g[0])/j)*j+g[0];d=this.target.position;d.x=100*Math.sin(this.phi)*Math.cos(this.theta);d.y=100*Math.cos(this.phi);d.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this,a,b,c)};this.onMouseMove=function(a){this.mouseX=
-a.clientX-this.windowHalfX;this.mouseY=a.clientY-this.windowHalfY};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}),g=new THREE.MeshLambertMaterial({color:65280}),j=new THREE.Cube(10,10,20),h=new THREE.Cube(2,2,10);this.animationParent=new THREE.Mesh(j,a);a=new THREE.Mesh(h,g);a.position.set(0,10,0);this.animation=c(this.animationParent,
-this.spline,this.id,this.duration);this.animationParent.addChild(this);this.animationParent.addChild(this.target);this.animationParent.addChild(a)}else this.animation=c(this.animationParent,this.spline,this.id,this.duration),this.animationParent.addChild(this.target),this.animationParent.addChild(this);this.createDebugPath&&d(this.debugPath,this.spline);this.domElement.addEventListener("mousemove",function(a,b){return function(){b.apply(a,arguments)}}(this,this.onMouseMove),!1)};
+window.innerWidth/2;this.windowHalfY=window.innerHeight/2;var f=Math.PI*2,g=Math.PI/180;this.update=function(a,c,b){var e,h;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*g;this.theta=this.lon*g;e=this.phi%f;this.phi=e>=0?e:e+f;e=this.verticalAngleMap.srcRange;h=this.verticalAngleMap.dstRange;var k=h[1]-h[0];this.phi=
+TWEEN.Easing.Quadratic.EaseInOut(((this.phi-e[0])*(h[1]-h[0])/(e[1]-e[0])+h[0]-h[0])/k)*k+h[0];e=this.horizontalAngleMap.srcRange;h=this.horizontalAngleMap.dstRange;k=h[1]-h[0];this.theta=TWEEN.Easing.Quadratic.EaseInOut(((this.theta-e[0])*(h[1]-h[0])/(e[1]-e[0])+h[0]-h[0])/k)*k+h[0];e=this.target.position;e.x=100*Math.sin(this.phi)*Math.cos(this.theta);e.y=100*Math.cos(this.phi);e.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this,a,c,b)};this.onMouseMove=function(a){this.mouseX=
+a.clientX-this.windowHalfX;this.mouseY=a.clientY-this.windowHalfY};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}),h=new THREE.MeshLambertMaterial({color:65280}),k=new THREE.Cube(10,10,20),j=new THREE.Cube(2,2,10);this.animationParent=new THREE.Mesh(k,a);a=new THREE.Mesh(j,h);a.position.set(0,10,0);this.animation=b(this.animationParent,
+this.spline,this.id,this.duration);this.animationParent.addChild(this);this.animationParent.addChild(this.target);this.animationParent.addChild(a)}else this.animation=b(this.animationParent,this.spline,this.id,this.duration),this.animationParent.addChild(this.target),this.animationParent.addChild(this);this.createDebugPath&&e(this.debugPath,this.spline);this.domElement.addEventListener("mousemove",function(a,c){return function(){c.apply(a,arguments)}}(this,this.onMouseMove),!1)};
 THREE.PathCamera.prototype=new THREE.Camera;THREE.PathCamera.prototype.constructor=THREE.PathCamera;THREE.PathCamera.prototype.supr=THREE.Camera.prototype;THREE.PathCameraIdCounter=0;
-THREE.FlyCamera=function(a){function c(a,d){return function(){d.apply(a,arguments)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.tmpQuaternion=new THREE.Quaternion;this.movementSpeed=1;this.rollSpeed=0.0050;this.autoForward=this.dragToLook=!1;this.domElement=document;if(a){if(a.movementSpeed!==void 0)this.movementSpeed=a.movementSpeed;if(a.rollSpeed!==void 0)this.rollSpeed=a.rollSpeed;if(a.dragToLook!==void 0)this.dragToLook=a.dragToLook;if(a.autoForward!==void 0)this.autoForward=
+THREE.FlyCamera=function(a){function b(a,b){return function(){b.apply(a,arguments)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.tmpQuaternion=new THREE.Quaternion;this.movementSpeed=1;this.rollSpeed=0.0050;this.autoForward=this.dragToLook=!1;this.domElement=document;if(a){if(a.movementSpeed!==void 0)this.movementSpeed=a.movementSpeed;if(a.rollSpeed!==void 0)this.rollSpeed=a.rollSpeed;if(a.dragToLook!==void 0)this.dragToLook=a.dragToLook;if(a.autoForward!==void 0)this.autoForward=
 a.autoForward;if(a.domElement!==void 0)this.domElement=a.domElement}this.useTarget=!1;this.useQuaternion=!0;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.lastUpdate=-1;this.tdiff=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){a.preventDefault();a.stopPropagation();if(this.dragToLook)this.mouseStatus++;else switch(a.button){case 0:this.moveForward=!0;break;case 2:this.moveBackward=!0}};this.mousemove=function(a){if(!this.dragToLook||this.mouseStatus>0){var d=this.getContainerDimensions(),c=d.size[0]/2,f=d.size[1]/2;this.moveState.yawLeft=-(a.clientX-d.offset[0]-c)/c;this.moveState.pitchDown=(a.clientY-
-d.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=!1;break;case 2:this.moveBackward=!1}this.updateRotationVector()};this.update=function(){var a=(new Date).getTime();if(this.lastUpdate==-1)this.lastUpdate=a;this.tdiff=(a-this.lastUpdate)/1E3;this.lastUpdate=a;var a=this.tdiff*this.movementSpeed,d=this.tdiff*
-this.rollSpeed;this.translateX(this.moveVector.x*a);this.translateY(this.moveVector.y*a);this.translateZ(this.moveVector.z*a);this.tmpQuaternion.set(this.rotationVector.x*d,this.rotationVector.y*d,this.rotationVector.z*d,1).normalize();this.quaternion.multiplySelf(this.tmpQuaternion);this.matrix.setPosition(this.position);this.matrix.setRotationFromQuaternion(this.quaternion);this.matrixWorldNeedsUpdate=!0;this.supr.update.call(this)};this.updateMovementVector=function(){var a=this.moveState.forward||
+case 69:this.moveState.rollRight=0}this.updateMovementVector();this.updateRotationVector()};this.mousedown=function(a){a.preventDefault();a.stopPropagation();if(this.dragToLook)this.mouseStatus++;else switch(a.button){case 0:this.moveForward=!0;break;case 2:this.moveBackward=!0}};this.mousemove=function(a){if(!this.dragToLook||this.mouseStatus>0){var b=this.getContainerDimensions(),f=b.size[0]/2,g=b.size[1]/2;this.moveState.yawLeft=-(a.clientX-b.offset[0]-f)/f;this.moveState.pitchDown=(a.clientY-
+b.offset[1]-g)/g;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(){var a=(new Date).getTime();if(this.lastUpdate==-1)this.lastUpdate=a;this.tdiff=(a-this.lastUpdate)/1E3;this.lastUpdate=a;var a=this.tdiff*this.movementSpeed,b=this.tdiff*
+this.rollSpeed;this.translateX(this.moveVector.x*a);this.translateY(this.moveVector.y*a);this.translateZ(this.moveVector.z*a);this.tmpQuaternion.set(this.rotationVector.x*b,this.rotationVector.y*b,this.rotationVector.z*b,1).normalize();this.quaternion.multiplySelf(this.tmpQuaternion);this.matrix.setPosition(this.position);this.matrix.setRotationFromQuaternion(this.quaternion);this.matrixWorldNeedsUpdate=!0;this.supr.update.call(this)};this.updateMovementVector=function(){var a=this.moveState.forward||
 this.autoForward&&!this.moveState.back?1:0;this.moveVector.x=-this.moveState.left+this.moveState.right;this.moveVector.y=-this.moveState.down+this.moveState.up;this.moveVector.z=-a+this.moveState.back};this.updateRotationVector=function(){this.rotationVector.x=-this.moveState.pitchDown+this.moveState.pitchUp;this.rotationVector.y=-this.moveState.yawRight+this.moveState.yawLeft;this.rotationVector.z=-this.moveState.rollRight+this.moveState.rollLeft};this.getContainerDimensions=function(){return this.domElement!=
-document?{size:[this.domElement.offsetWidth,this.domElement.offsetHeight],offset:[this.domElement.offsetLeft,this.domElement.offsetTop]}:{size:[window.innerWidth,window.innerHeight],offset:[0,0]}};this.domElement.addEventListener("mousemove",c(this,this.mousemove),!1);this.domElement.addEventListener("mousedown",c(this,this.mousedown),!1);this.domElement.addEventListener("mouseup",c(this,this.mouseup),!1);window.addEventListener("keydown",c(this,this.keydown),!1);window.addEventListener("keyup",c(this,
+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);window.addEventListener("keydown",b(this,this.keydown),!1);window.addEventListener("keyup",b(this,
 this.keyup),!1);this.updateMovementVector();this.updateRotationVector()};THREE.FlyCamera.prototype=new THREE.Camera;THREE.FlyCamera.prototype.constructor=THREE.FlyCamera;THREE.FlyCamera.prototype.supr=THREE.Camera.prototype;
-THREE.RollCamera=function(a,c,b,d){THREE.Camera.call(this,a,c,b,d);this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.domElement=document;this.matrixAutoUpdate=this.useTarget=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;this.lastUpdate=-1;this.delta=0;var e=new THREE.Vector3,f=new THREE.Vector3,g=new THREE.Vector3,j=new THREE.Matrix4,h=!1,l=1,k=0,n=0,p=0,o=0,t=0,v=window.innerWidth/2,u=window.innerHeight/2;this.update=
-function(){var a=(new Date).getTime();if(this.lastUpdate==-1)this.lastUpdate=a;this.delta=(a-this.lastUpdate)/1E3;this.lastUpdate=a;this.mouseLook&&(a=this.delta*this.lookSpeed,this.rotateHorizontally(a*o),this.rotateVertically(a*t));a=this.delta*this.movementSpeed;this.translateZ(a*(k>0||this.autoForward&&!(k<0)?1:k));this.translateX(a*n);this.translateY(a*p);h&&(this.roll+=this.rollSpeed*this.delta*l);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);f.set(0,1,0);e.cross(f,g).normalize();f.cross(g,e).normalize();this.matrix.n11=e.x;this.matrix.n12=f.x;this.matrix.n13=g.x;this.matrix.n21=e.y;this.matrix.n22=f.y;this.matrix.n23=g.y;this.matrix.n31=e.z;this.matrix.n32=f.z;this.matrix.n33=g.z;j.identity();j.n11=Math.cos(this.roll);j.n12=-Math.sin(this.roll);j.n21=Math.sin(this.roll);j.n22=Math.cos(this.roll);this.matrix.multiplySelf(j);
+THREE.RollCamera=function(a,b,c,e){THREE.Camera.call(this,a,b,c,e);this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.domElement=document;this.matrixAutoUpdate=this.useTarget=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;this.lastUpdate=-1;this.delta=0;var f=new THREE.Vector3,g=new THREE.Vector3,h=new THREE.Vector3,k=new THREE.Matrix4,j=!1,l=1,m=0,n=0,t=0,p=0,u=0,v=window.innerWidth/2,w=window.innerHeight/2;this.update=
+function(){var a=(new Date).getTime();if(this.lastUpdate==-1)this.lastUpdate=a;this.delta=(a-this.lastUpdate)/1E3;this.lastUpdate=a;this.mouseLook&&(a=this.delta*this.lookSpeed,this.rotateHorizontally(a*p),this.rotateVertically(a*u));a=this.delta*this.movementSpeed;this.translateZ(a*(m>0||this.autoForward&&!(m<0)?1:m));this.translateX(a*n);this.translateY(a*t);j&&(this.roll+=this.rollSpeed*this.delta*l);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();h.copy(this.forward);g.set(0,1,0);f.cross(g,h).normalize();g.cross(h,f).normalize();this.matrix.n11=f.x;this.matrix.n12=g.x;this.matrix.n13=h.x;this.matrix.n21=f.y;this.matrix.n22=g.y;this.matrix.n23=h.y;this.matrix.n31=f.z;this.matrix.n32=g.z;this.matrix.n33=h.z;k.identity();k.n11=Math.cos(this.roll);k.n12=-Math.sin(this.roll);k.n21=Math.sin(this.roll);k.n22=Math.cos(this.roll);this.matrix.multiplySelf(k);
 this.matrixWorldNeedsUpdate=!0;this.matrix.n14=this.position.x;this.matrix.n24=this.position.y;this.matrix.n34=this.position.z;this.supr.update.call(this)};this.translateX=function(a){this.position.x+=this.matrix.n11*a;this.position.y+=this.matrix.n21*a;this.position.z+=this.matrix.n31*a};this.translateY=function(a){this.position.x+=this.matrix.n12*a;this.position.y+=this.matrix.n22*a;this.position.z+=this.matrix.n32*a};this.translateZ=function(a){this.position.x-=this.matrix.n13*a;this.position.y-=
-this.matrix.n23*a;this.position.z-=this.matrix.n33*a};this.rotateHorizontally=function(a){e.set(this.matrix.n11,this.matrix.n21,this.matrix.n31);e.multiplyScalar(a);this.forward.subSelf(e);this.forward.normalize()};this.rotateVertically=function(a){f.set(this.matrix.n12,this.matrix.n22,this.matrix.n32);f.multiplyScalar(a);this.forward.addSelf(f);this.forward.normalize()};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",
-function(a){o=(a.clientX-v)/window.innerWidth;t=(a.clientY-u)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:k=1;break;case 2:k=-1}},!1);this.domElement.addEventListener("mouseup",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:k=0;break;case 2:k=0}},!1);this.domElement.addEventListener("keydown",function(a){switch(a.keyCode){case 38:case 87:k=1;break;case 37:case 65:n=-1;break;
-case 40:case 83:k=-1;break;case 39:case 68:n=1;break;case 81:h=!0;l=1;break;case 69:h=!0;l=-1;break;case 82:p=1;break;case 70:p=-1}},!1);this.domElement.addEventListener("keyup",function(a){switch(a.keyCode){case 38:case 87:k=0;break;case 37:case 65:n=0;break;case 40:case 83:k=0;break;case 39:case 68:n=0;break;case 81:h=!1;break;case 69:h=!1;break;case 82:p=0;break;case 70:p=0}},!1)};THREE.RollCamera.prototype=new THREE.Camera;THREE.RollCamera.prototype.constructor=THREE.RollCamera;
+this.matrix.n23*a;this.position.z-=this.matrix.n33*a};this.rotateHorizontally=function(a){f.set(this.matrix.n11,this.matrix.n21,this.matrix.n31);f.multiplyScalar(a);this.forward.subSelf(f);this.forward.normalize()};this.rotateVertically=function(a){g.set(this.matrix.n12,this.matrix.n22,this.matrix.n32);g.multiplyScalar(a);this.forward.addSelf(g);this.forward.normalize()};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",
+function(a){p=(a.clientX-v)/window.innerWidth;u=(a.clientY-w)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:m=1;break;case 2:m=-1}},!1);this.domElement.addEventListener("mouseup",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:m=0;break;case 2:m=0}},!1);this.domElement.addEventListener("keydown",function(a){switch(a.keyCode){case 38:case 87:m=1;break;case 37:case 65:n=-1;break;
+case 40:case 83:m=-1;break;case 39:case 68:n=1;break;case 81:j=!0;l=1;break;case 69:j=!0;l=-1;break;case 82:t=1;break;case 70:t=-1}},!1);this.domElement.addEventListener("keyup",function(a){switch(a.keyCode){case 38:case 87:m=0;break;case 37:case 65:n=0;break;case 40:case 83:m=0;break;case 39:case 68:n=0;break;case 81:j=!1;break;case 69:j=!1;break;case 82:t=0;break;case 70:t=0}},!1)};THREE.RollCamera.prototype=new THREE.Camera;THREE.RollCamera.prototype.constructor=THREE.RollCamera;
 THREE.RollCamera.prototype.supr=THREE.Camera.prototype;
-THREE.TrackballCamera=function(a){function c(a,b){return function(){b.apply(a,arguments)}}a=a||{};THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.domElement=a.domElement||document;this.screen=a.screen||{width:window.innerWidth,height:window.innerHeight,offsetLeft:0,offsetTop:0};this.radius=a.radius||(this.screen.width+this.screen.height)/4;this.rotateSpeed=a.rotateSpeed||1;this.zoomSpeed=a.zoomSpeed||1.2;this.panSpeed=a.panSpeed||0.3;this.noZoom=a.noZoom||!1;this.noPan=a.noPan||
-!1;this.staticMoving=a.staticMoving||!1;this.dynamicDampingFactor=a.dynamicDampingFactor||0.2;this.minDistance=a.minDistance||0;this.maxDistance=a.maxDistance||Infinity;this.keys=a.keys||[65,83,68];this.useTarget=!0;var b=!1,d=this.STATE.NONE,e=new THREE.Vector3,f=new THREE.Vector3,g=new THREE.Vector3,j=new THREE.Vector2,h=new THREE.Vector2,l=new THREE.Vector2,k=new THREE.Vector2;this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.getMouseOnScreen=function(a,b){return new THREE.Vector2((a-
-this.screen.offsetLeft)/this.radius*0.5,(b-this.screen.offsetTop)/this.radius*0.5)};this.getMouseProjectionOnBall=function(a,b){var d=new THREE.Vector3((a-this.screen.width*0.5-this.screen.offsetLeft)/this.radius,(this.screen.height*0.5+this.screen.offsetTop-b)/this.radius,0),c=d.length();c>1?d.normalize():d.z=Math.sqrt(1-c*c);e=this.position.clone().subSelf(this.target.position);c=this.up.clone().setLength(d.y);c.addSelf(this.up.clone().crossSelf(e).setLength(d.x));c.addSelf(e.setLength(d.z));return c};
-this.rotateCamera=function(){var a=Math.acos(f.dot(g)/f.length()/g.length());if(a){var b=(new THREE.Vector3).cross(f,g).normalize(),d=new THREE.Quaternion;a*=this.rotateSpeed;d.setFromAxisAngle(b,-a);d.multiplyVector3(e);d.multiplyVector3(this.up);d.multiplyVector3(g);this.staticMoving?f=g:(d.setFromAxisAngle(b,a*(this.dynamicDampingFactor-1)),d.multiplyVector3(f))}};this.zoomCamera=function(){var a=1+(h.y-j.y)*this.zoomSpeed;a!==1&&a>0&&(e.multiplyScalar(a),this.staticMoving?j=h:j.y+=(h.y-j.y)*this.dynamicDampingFactor)};
-this.panCamera=function(){var a=k.clone().subSelf(l);if(a.lengthSq()){a.multiplyScalar(e.length()*this.panSpeed);var b=e.clone().crossSelf(this.up).setLength(a.x);b.addSelf(this.up.clone().setLength(a.y));this.position.addSelf(b);this.target.position.addSelf(b);this.staticMoving?l=k:l.addSelf(a.sub(k,l).multiplyScalar(this.dynamicDampingFactor))}};this.checkDistances=function(){if(!this.noZoom||!this.noPan)this.position.lengthSq()>this.maxDistance*this.maxDistance&&this.position.setLength(this.maxDistance),
-e.lengthSq()<this.minDistance*this.minDistance&&this.position.add(this.target.position,e.setLength(this.minDistance))};this.update=function(a,b,d){e=this.position.clone().subSelf(this.target.position);this.rotateCamera();this.noZoom||this.zoomCamera();this.noPan||this.panCamera();this.position.add(this.target.position,e);this.checkDistances();this.supr.update.call(this,a,b,d)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",
-c(this,function(a){b&&(f=g=this.getMouseProjectionOnBall(a.clientX,a.clientY),j=h=this.getMouseOnScreen(a.clientX,a.clientY),l=k=this.getMouseOnScreen(a.clientX,a.clientY),b=!1);d!==this.STATE.NONE&&(d===this.STATE.ROTATE?g=this.getMouseProjectionOnBall(a.clientX,a.clientY):d===this.STATE.ZOOM&&!this.noZoom?h=this.getMouseOnScreen(a.clientX,a.clientY):d===this.STATE.PAN&&!this.noPan&&(k=this.getMouseOnScreen(a.clientX,a.clientY)))}),!1);this.domElement.addEventListener("mousedown",c(this,function(a){a.preventDefault();
-a.stopPropagation();if(d===this.STATE.NONE)d=a.button,d===this.STATE.ROTATE?f=g=this.getMouseProjectionOnBall(a.clientX,a.clientY):d===this.STATE.ZOOM&&!this.noZoom?j=h=this.getMouseOnScreen(a.clientX,a.clientY):this.noPan||(l=k=this.getMouseOnScreen(a.clientX,a.clientY))}),!1);this.domElement.addEventListener("mouseup",c(this,function(a){a.preventDefault();a.stopPropagation();d=this.STATE.NONE}),!1);window.addEventListener("keydown",c(this,function(a){if(d===this.STATE.NONE){if(a.keyCode===this.keys[this.STATE.ROTATE])d=
-this.STATE.ROTATE;else if(a.keyCode===this.keys[this.STATE.ZOOM]&&!this.noZoom)d=this.STATE.ZOOM;else if(a.keyCode===this.keys[this.STATE.PAN]&&!this.noPan)d=this.STATE.PAN;d!==this.STATE.NONE&&(b=!0)}}),!1);window.addEventListener("keyup",c(this,function(){if(d!==this.STATE.NONE)d=this.STATE.NONE}),!1)};THREE.TrackballCamera.prototype=new THREE.Camera;THREE.TrackballCamera.prototype.constructor=THREE.TrackballCamera;THREE.TrackballCamera.prototype.supr=THREE.Camera.prototype;
+THREE.TrackballCamera=function(a){function b(a,c){return function(){c.apply(a,arguments)}}a=a||{};THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.domElement=a.domElement||document;this.screen=a.screen||{width:window.innerWidth,height:window.innerHeight,offsetLeft:0,offsetTop:0};this.radius=a.radius||(this.screen.width+this.screen.height)/4;this.rotateSpeed=a.rotateSpeed||1;this.zoomSpeed=a.zoomSpeed||1.2;this.panSpeed=a.panSpeed||0.3;this.noZoom=a.noZoom||!1;this.noPan=a.noPan||
+!1;this.staticMoving=a.staticMoving||!1;this.dynamicDampingFactor=a.dynamicDampingFactor||0.2;this.minDistance=a.minDistance||0;this.maxDistance=a.maxDistance||Infinity;this.keys=a.keys||[65,83,68];this.useTarget=!0;var c=!1,e=this.STATE.NONE,f=new THREE.Vector3,g=new THREE.Vector3,h=new THREE.Vector3,k=new THREE.Vector2,j=new THREE.Vector2,l=new THREE.Vector2,m=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-
+this.screen.offsetLeft)/this.radius*0.5,(c-this.screen.offsetTop)/this.radius*0.5)};this.getMouseProjectionOnBall=function(a,c){var b=new THREE.Vector3((a-this.screen.width*0.5-this.screen.offsetLeft)/this.radius,(this.screen.height*0.5+this.screen.offsetTop-c)/this.radius,0),e=b.length();e>1?b.normalize():b.z=Math.sqrt(1-e*e);f=this.position.clone().subSelf(this.target.position);e=this.up.clone().setLength(b.y);e.addSelf(this.up.clone().crossSelf(f).setLength(b.x));e.addSelf(f.setLength(b.z));return e};
+this.rotateCamera=function(){var a=Math.acos(g.dot(h)/g.length()/h.length());if(a){var c=(new THREE.Vector3).cross(g,h).normalize(),b=new THREE.Quaternion;a*=this.rotateSpeed;b.setFromAxisAngle(c,-a);b.multiplyVector3(f);b.multiplyVector3(this.up);b.multiplyVector3(h);this.staticMoving?g=h:(b.setFromAxisAngle(c,a*(this.dynamicDampingFactor-1)),b.multiplyVector3(g))}};this.zoomCamera=function(){var a=1+(j.y-k.y)*this.zoomSpeed;a!==1&&a>0&&(f.multiplyScalar(a),this.staticMoving?k=j:k.y+=(j.y-k.y)*this.dynamicDampingFactor)};
+this.panCamera=function(){var a=m.clone().subSelf(l);if(a.lengthSq()){a.multiplyScalar(f.length()*this.panSpeed);var c=f.clone().crossSelf(this.up).setLength(a.x);c.addSelf(this.up.clone().setLength(a.y));this.position.addSelf(c);this.target.position.addSelf(c);this.staticMoving?l=m:l.addSelf(a.sub(m,l).multiplyScalar(this.dynamicDampingFactor))}};this.checkDistances=function(){if(!this.noZoom||!this.noPan)this.position.lengthSq()>this.maxDistance*this.maxDistance&&this.position.setLength(this.maxDistance),
+f.lengthSq()<this.minDistance*this.minDistance&&this.position.add(this.target.position,f.setLength(this.minDistance))};this.update=function(a,c,b){f=this.position.clone().subSelf(this.target.position);this.rotateCamera();this.noZoom||this.zoomCamera();this.noPan||this.panCamera();this.position.add(this.target.position,f);this.checkDistances();this.supr.update.call(this,a,c,b)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",
+b(this,function(a){c&&(g=h=this.getMouseProjectionOnBall(a.clientX,a.clientY),k=j=this.getMouseOnScreen(a.clientX,a.clientY),l=m=this.getMouseOnScreen(a.clientX,a.clientY),c=!1);e!==this.STATE.NONE&&(e===this.STATE.ROTATE?h=this.getMouseProjectionOnBall(a.clientX,a.clientY):e===this.STATE.ZOOM&&!this.noZoom?j=this.getMouseOnScreen(a.clientX,a.clientY):e===this.STATE.PAN&&!this.noPan&&(m=this.getMouseOnScreen(a.clientX,a.clientY)))}),!1);this.domElement.addEventListener("mousedown",b(this,function(a){a.preventDefault();
+a.stopPropagation();if(e===this.STATE.NONE)e=a.button,e===this.STATE.ROTATE?g=h=this.getMouseProjectionOnBall(a.clientX,a.clientY):e===this.STATE.ZOOM&&!this.noZoom?k=j=this.getMouseOnScreen(a.clientX,a.clientY):this.noPan||(l=m=this.getMouseOnScreen(a.clientX,a.clientY))}),!1);this.domElement.addEventListener("mouseup",b(this,function(a){a.preventDefault();a.stopPropagation();e=this.STATE.NONE}),!1);window.addEventListener("keydown",b(this,function(a){if(e===this.STATE.NONE){if(a.keyCode===this.keys[this.STATE.ROTATE])e=
+this.STATE.ROTATE;else if(a.keyCode===this.keys[this.STATE.ZOOM]&&!this.noZoom)e=this.STATE.ZOOM;else if(a.keyCode===this.keys[this.STATE.PAN]&&!this.noPan)e=this.STATE.PAN;e!==this.STATE.NONE&&(c=!0)}}),!1);window.addEventListener("keyup",b(this,function(){if(e!==this.STATE.NONE)e=this.STATE.NONE}),!1)};THREE.TrackballCamera.prototype=new THREE.Camera;THREE.TrackballCamera.prototype.constructor=THREE.TrackballCamera;THREE.TrackballCamera.prototype.supr=THREE.Camera.prototype;
 THREE.TrackballCamera.prototype.STATE={NONE:-1,ROTATE:0,ZOOM:1,PAN:2};
-THREE.Cube=function(a,c,b,d,e,f,g,j,h){function l(a,b,c,g,j,h,l,n){var o,p,t=d||1,v=e||1,K=j/2,H=h/2,L=k.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",v=f||1;else if(a=="z"&&b=="y"||a=="y"&&b=="z")o="x",t=f||1;var I=t+1,z=v+1;j/=t;var G=h/v;for(p=0;p<z;p++)for(h=0;h<I;h++){var J=new THREE.Vector3;J[a]=(h*j-K)*c;J[b]=(p*G-H)*g;J[o]=l;k.vertices.push(new THREE.Vertex(J))}for(p=0;p<v;p++)for(h=0;h<t;h++)k.faces.push(new THREE.Face4(h+I*p+L,h+I*(p+
-1)+L,h+1+I*(p+1)+L,h+1+I*p+L,null,null,n)),k.faceVertexUvs[0].push([new THREE.UV(h/t,p/v),new THREE.UV(h/t,(p+1)/v),new THREE.UV((h+1)/t,(p+1)/v),new THREE.UV((h+1)/t,p/v)])}THREE.Geometry.call(this);var k=this,n=a/2,p=c/2,o=b/2,j=j?-1:1;if(g!==void 0)if(g instanceof Array)this.materials=g;else{this.materials=[];for(var t=0;t<6;t++)this.materials.push([g])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(h!=void 0)for(var v in h)this.sides[v]!=void 0&&(this.sides[v]=h[v]);
-this.sides.px&&l("z","y",1*j,-1,b,c,-n,this.materials[0]);this.sides.nx&&l("z","y",-1*j,-1,b,c,n,this.materials[1]);this.sides.py&&l("x","z",1*j,1,a,b,p,this.materials[2]);this.sides.ny&&l("x","z",1*j,-1,a,b,-p,this.materials[3]);this.sides.pz&&l("x","y",1*j,-1,a,c,o,this.materials[4]);this.sides.nz&&l("x","y",-1*j,-1,a,c,-o,this.materials[5]);(function(){for(var a=[],b=[],d=0,c=k.vertices.length;d<c;d++){for(var f=k.vertices[d],g=!1,e=0,j=a.length;e<j;e++){var h=a[e];if(f.position.x==h.position.x&&
-f.position.y==h.position.y&&f.position.z==h.position.z){b[d]=e;g=!0;break}}if(!g)b[d]=a.length,a.push(new THREE.Vertex(f.position.clone()))}d=0;for(c=k.faces.length;d<c;d++)f=k.faces[d],f.a=b[f.a],f.b=b[f.b],f.c=b[f.c],f.d=b[f.d];k.vertices=a})();this.computeCentroids();this.computeFaceNormals()};THREE.Cube.prototype=new THREE.Geometry;THREE.Cube.prototype.constructor=THREE.Cube;
-THREE.Cylinder=function(a,c,b,d,e,f){function g(a,b,d){j.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,d)))}THREE.Geometry.call(this);var j=this,h,l=Math.PI*2,k=d/2;for(h=0;h<a;h++)g(Math.sin(l*h/a)*c,Math.cos(l*h/a)*c,-k);for(h=0;h<a;h++)g(Math.sin(l*h/a)*b,Math.cos(l*h/a)*b,k);for(h=0;h<a;h++)j.faces.push(new THREE.Face4(h,h+a,a+(h+1)%a,(h+1)%a));if(b>0){g(0,0,-k-(f||0));for(h=a;h<a+a/2;h++)j.faces.push(new THREE.Face4(2*a,(2*h-2*a)%a,(2*h-2*a+1)%a,(2*h-2*a+2)%a))}if(c>0){g(0,0,k+(e||0));
-for(h=a+a/2;h<2*a;h++)j.faces.push(new THREE.Face4(2*a+1,(2*h-2*a+2)%a+a,(2*h-2*a+1)%a+a,(2*h-2*a)%a+a))}h=0;for(a=this.faces.length;h<a;h++){var c=[],b=this.faces[h],e=this.vertices[b.a],f=this.vertices[b.b],k=this.vertices[b.c],n=this.vertices[b.d];c.push(new THREE.UV(0.5+Math.atan2(e.position.x,e.position.y)/l,0.5+e.position.z/d));c.push(new THREE.UV(0.5+Math.atan2(f.position.x,f.position.y)/l,0.5+f.position.z/d));c.push(new THREE.UV(0.5+Math.atan2(k.position.x,k.position.y)/l,0.5+k.position.z/
-d));b instanceof THREE.Face4&&c.push(new THREE.UV(0.5+Math.atan2(n.position.x,n.position.y)/l,0.5+n.position.z/d));this.faceVertexUvs[0].push(c)}this.computeCentroids();this.computeFaceNormals()};THREE.Cylinder.prototype=new THREE.Geometry;THREE.Cylinder.prototype.constructor=THREE.Cylinder;
-THREE.Icosahedron=function(a){function c(a,b,d){var c=Math.sqrt(a*a+b*b+d*d);return e.vertices.push(new THREE.Vertex(new THREE.Vector3(a/c,b/c,d/c)))-1}function b(a,b,d,c){c.faces.push(new THREE.Face3(a,b,d))}function d(a,b){var d=e.vertices[a].position,f=e.vertices[b].position;return c((d.x+f.x)/2,(d.y+f.y)/2,(d.z+f.z)/2)}var e=this,f=new THREE.Geometry,g;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,f);b(0,5,1,f);b(0,1,7,f);b(0,7,10,f);b(0,10,11,f);b(1,5,9,f);b(5,11,4,f);b(11,10,2,f);b(10,7,6,f);b(7,1,8,f);b(3,9,4,f);b(3,4,2,f);b(3,2,6,f);b(3,6,8,f);b(3,8,9,f);b(4,9,5,f);b(2,4,11,f);b(6,2,10,f);b(8,6,7,f);b(9,8,1,f);for(a=0;a<this.subdivisions;a++){g=new THREE.Geometry;for(var j in f.faces){var h=d(f.faces[j].a,f.faces[j].b),l=d(f.faces[j].b,f.faces[j].c),k=d(f.faces[j].c,f.faces[j].a);b(f.faces[j].a,h,k,g);b(f.faces[j].b,l,h,g);b(f.faces[j].c,
-k,l,g);b(h,l,k,g)}f.faces=g.faces}e.faces=f.faces;delete f;delete g;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.Icosahedron.prototype=new THREE.Geometry;THREE.Icosahedron.prototype.constructor=THREE.Icosahedron;
-THREE.Lathe=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=[],e=[],f=[],g=(new THREE.Matrix4).setRotationZ(c),j=0;j<a.length;j++)this.vertices.push(new THREE.Vertex(a[j])),b[j]=a[j].clone(),d[j]=this.vertices.length-1;for(var h=0;h<=this.angle+0.0010;h+=c){for(j=0;j<b.length;j++)h<this.angle?(b[j]=g.multiplyVector3(b[j].clone()),this.vertices.push(new THREE.Vertex(b[j])),e[j]=this.vertices.length-1):e=f;h==0&&(f=d);for(j=0;j<
-d.length-1;j++)this.faces.push(new THREE.Face4(e[j],e[j+1],d[j+1],d[j])),this.faceVertexUvs[0].push([new THREE.UV(1-h/this.angle,j/a.length),new THREE.UV(1-h/this.angle,(j+1)/a.length),new THREE.UV(1-(h-c)/this.angle,(j+1)/a.length),new THREE.UV(1-(h-c)/this.angle,j/a.length)]);d=e;e=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.Lathe.prototype=new THREE.Geometry;THREE.Lathe.prototype.constructor=THREE.Lathe;
-THREE.Plane=function(a,c,b,d){THREE.Geometry.call(this);var e,f=a/2,g=c/2,b=b||1,d=d||1,j=b+1,h=d+1;a/=b;var l=c/d;for(e=0;e<h;e++)for(c=0;c<j;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*a-f,-(e*l-g),0)));for(e=0;e<d;e++)for(c=0;c<b;c++)this.faces.push(new THREE.Face4(c+j*e,c+j*(e+1),c+1+j*(e+1),c+1+j*e)),this.faceVertexUvs[0].push([new THREE.UV(c/b,e/d),new THREE.UV(c/b,(e+1)/d),new THREE.UV((c+1)/b,(e+1)/d),new THREE.UV((c+1)/b,e/d)]);this.computeCentroids();this.computeFaceNormals()};
+THREE.Cube=function(a,b,c,e,f,g,h,k,j){function l(a,c,b,h,k,j,l,n){var p,t,u=e||1,v=f||1,K=k/2,N=j/2,L=m.vertices.length;if(a=="x"&&c=="y"||a=="y"&&c=="x")p="z";else if(a=="x"&&c=="z"||a=="z"&&c=="x")p="y",v=g||1;else if(a=="z"&&c=="y"||a=="y"&&c=="z")p="x",u=g||1;var O=u+1,D=v+1;k/=u;var J=j/v;for(t=0;t<D;t++)for(j=0;j<O;j++){var P=new THREE.Vector3;P[a]=(j*k-K)*b;P[c]=(t*J-N)*h;P[p]=l;m.vertices.push(new THREE.Vertex(P))}for(t=0;t<v;t++)for(j=0;j<u;j++)m.faces.push(new THREE.Face4(j+O*t+L,j+O*(t+
+1)+L,j+1+O*(t+1)+L,j+1+O*t+L,null,null,n)),m.faceVertexUvs[0].push([new THREE.UV(j/u,t/v),new THREE.UV(j/u,(t+1)/v),new THREE.UV((j+1)/u,(t+1)/v),new THREE.UV((j+1)/u,t/v)])}THREE.Geometry.call(this);var m=this,n=a/2,t=b/2,p=c/2,k=k?-1:1;if(h!==void 0)if(h instanceof Array)this.materials=h;else{this.materials=[];for(var u=0;u<6;u++)this.materials.push([h])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(j!=void 0)for(var v in j)this.sides[v]!=void 0&&(this.sides[v]=j[v]);
+this.sides.px&&l("z","y",1*k,-1,c,b,-n,this.materials[0]);this.sides.nx&&l("z","y",-1*k,-1,c,b,n,this.materials[1]);this.sides.py&&l("x","z",1*k,1,a,c,t,this.materials[2]);this.sides.ny&&l("x","z",1*k,-1,a,c,-t,this.materials[3]);this.sides.pz&&l("x","y",1*k,-1,a,b,p,this.materials[4]);this.sides.nz&&l("x","y",-1*k,-1,a,b,-p,this.materials[5]);(function(){for(var a=[],c=[],b=0,e=m.vertices.length;b<e;b++){for(var g=m.vertices[b],h=!1,f=0,k=a.length;f<k;f++){var j=a[f];if(g.position.x==j.position.x&&
+g.position.y==j.position.y&&g.position.z==j.position.z){c[b]=f;h=!0;break}}if(!h)c[b]=a.length,a.push(new THREE.Vertex(g.position.clone()))}b=0;for(e=m.faces.length;b<e;b++)g=m.faces[b],g.a=c[g.a],g.b=c[g.b],g.c=c[g.c],g.d=c[g.d];m.vertices=a})();this.computeCentroids();this.computeFaceNormals()};THREE.Cube.prototype=new THREE.Geometry;THREE.Cube.prototype.constructor=THREE.Cube;
+THREE.Cylinder=function(a,b,c,e,f,g){function h(a,c,b){k.vertices.push(new THREE.Vertex(new THREE.Vector3(a,c,b)))}THREE.Geometry.call(this);var k=this,j,l=Math.PI*2,m=e/2;for(j=0;j<a;j++)h(Math.sin(l*j/a)*b,Math.cos(l*j/a)*b,-m);for(j=0;j<a;j++)h(Math.sin(l*j/a)*c,Math.cos(l*j/a)*c,m);for(j=0;j<a;j++)k.faces.push(new THREE.Face4(j,j+a,a+(j+1)%a,(j+1)%a));if(c>0){h(0,0,-m-(g||0));for(j=a;j<a+a/2;j++)k.faces.push(new THREE.Face4(2*a,(2*j-2*a)%a,(2*j-2*a+1)%a,(2*j-2*a+2)%a))}if(b>0){h(0,0,m+(f||0));
+for(j=a+a/2;j<2*a;j++)k.faces.push(new THREE.Face4(2*a+1,(2*j-2*a+2)%a+a,(2*j-2*a+1)%a+a,(2*j-2*a)%a+a))}j=0;for(a=this.faces.length;j<a;j++){var b=[],c=this.faces[j],f=this.vertices[c.a],g=this.vertices[c.b],m=this.vertices[c.c],n=this.vertices[c.d];b.push(new THREE.UV(0.5+Math.atan2(f.position.x,f.position.y)/l,0.5+f.position.z/e));b.push(new THREE.UV(0.5+Math.atan2(g.position.x,g.position.y)/l,0.5+g.position.z/e));b.push(new THREE.UV(0.5+Math.atan2(m.position.x,m.position.y)/l,0.5+m.position.z/
+e));c instanceof THREE.Face4&&b.push(new THREE.UV(0.5+Math.atan2(n.position.x,n.position.y)/l,0.5+n.position.z/e));this.faceVertexUvs[0].push(b)}this.computeCentroids();this.computeFaceNormals()};THREE.Cylinder.prototype=new THREE.Geometry;THREE.Cylinder.prototype.constructor=THREE.Cylinder;
+THREE.Icosahedron=function(a){function b(a,c,b){var e=Math.sqrt(a*a+c*c+b*b);return f.vertices.push(new THREE.Vertex(new THREE.Vector3(a/e,c/e,b/e)))-1}function c(a,c,b,e){e.faces.push(new THREE.Face3(a,c,b))}function e(a,c){var e=f.vertices[a].position,g=f.vertices[c].position;return b((e.x+g.x)/2,(e.y+g.y)/2,(e.z+g.z)/2)}var f=this,g=new THREE.Geometry,h;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;b(-1,a,0);b(1,a,0);b(-1,-a,0);b(1,-a,0);b(0,-1,a);b(0,1,a);b(0,-1,-a);b(0,
+1,-a);b(a,0,-1);b(a,0,1);b(-a,0,-1);b(-a,0,1);c(0,11,5,g);c(0,5,1,g);c(0,1,7,g);c(0,7,10,g);c(0,10,11,g);c(1,5,9,g);c(5,11,4,g);c(11,10,2,g);c(10,7,6,g);c(7,1,8,g);c(3,9,4,g);c(3,4,2,g);c(3,2,6,g);c(3,6,8,g);c(3,8,9,g);c(4,9,5,g);c(2,4,11,g);c(6,2,10,g);c(8,6,7,g);c(9,8,1,g);for(a=0;a<this.subdivisions;a++){h=new THREE.Geometry;for(var k in g.faces){var j=e(g.faces[k].a,g.faces[k].b),l=e(g.faces[k].b,g.faces[k].c),m=e(g.faces[k].c,g.faces[k].a);c(g.faces[k].a,j,m,h);c(g.faces[k].b,l,j,h);c(g.faces[k].c,
+m,l,h);c(j,l,m,h)}g.faces=h.faces}f.faces=g.faces;delete g;delete h;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.Icosahedron.prototype=new THREE.Geometry;THREE.Icosahedron.prototype.constructor=THREE.Icosahedron;
+THREE.Lathe=function(a,b,c){THREE.Geometry.call(this);this.steps=b||12;this.angle=c||2*Math.PI;for(var b=this.angle/this.steps,c=[],e=[],f=[],g=[],h=(new THREE.Matrix4).setRotationZ(b),k=0;k<a.length;k++)this.vertices.push(new THREE.Vertex(a[k])),c[k]=a[k].clone(),e[k]=this.vertices.length-1;for(var j=0;j<=this.angle+0.0010;j+=b){for(k=0;k<c.length;k++)j<this.angle?(c[k]=h.multiplyVector3(c[k].clone()),this.vertices.push(new THREE.Vertex(c[k])),f[k]=this.vertices.length-1):f=g;j==0&&(g=e);for(k=0;k<
+e.length-1;k++)this.faces.push(new THREE.Face4(f[k],f[k+1],e[k+1],e[k])),this.faceVertexUvs[0].push([new THREE.UV(1-j/this.angle,k/a.length),new THREE.UV(1-j/this.angle,(k+1)/a.length),new THREE.UV(1-(j-b)/this.angle,(k+1)/a.length),new THREE.UV(1-(j-b)/this.angle,k/a.length)]);e=f;f=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.Lathe.prototype=new THREE.Geometry;THREE.Lathe.prototype.constructor=THREE.Lathe;
+THREE.Plane=function(a,b,c,e){THREE.Geometry.call(this);var f,g=a/2,h=b/2,c=c||1,e=e||1,k=c+1,j=e+1;a/=c;var l=b/e;for(f=0;f<j;f++)for(b=0;b<k;b++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(b*a-g,-(f*l-h),0)));for(f=0;f<e;f++)for(b=0;b<c;b++)this.faces.push(new THREE.Face4(b+k*f,b+k*(f+1),b+1+k*(f+1),b+1+k*f)),this.faceVertexUvs[0].push([new THREE.UV(b/c,f/e),new THREE.UV(b/c,(f+1)/e),new THREE.UV((b+1)/c,(f+1)/e),new THREE.UV((b+1)/c,f/e)]);this.computeCentroids();this.computeFaceNormals()};
 THREE.Plane.prototype=new THREE.Geometry;THREE.Plane.prototype.constructor=THREE.Plane;
-THREE.Sphere=function(a,c,b){THREE.Geometry.call(this);for(var d,e=Math.PI,f=Math.max(3,c||8),g=Math.max(2,b||6),c=[],b=0;b<g+1;b++){d=b/g;var j=a*Math.cos(d*e),h=a*Math.sin(d*e),l=[],k=0;for(d=0;d<f;d++){var n=2*d/f,p=h*Math.sin(n*e),n=h*Math.cos(n*e);(b==0||b==g)&&d>0||(k=this.vertices.push(new THREE.Vertex(new THREE.Vector3(n,j,p)))-1);l.push(k)}c.push(l)}for(var o,t,v,e=c.length,b=0;b<e;b++)if(f=c[b].length,b>0)for(d=0;d<f;d++){l=d==f-1;g=c[b][l?0:d+1];j=c[b][l?f-1:d];h=c[b-1][l?f-1:d];l=c[b-
-1][l?0:d+1];p=b/(e-1);o=(b-1)/(e-1);t=(d+1)/f;var n=d/f,k=new THREE.UV(1-t,p),p=new THREE.UV(1-n,p),n=new THREE.UV(1-n,o),u=new THREE.UV(1-t,o);b<c.length-1&&(o=this.vertices[g].position.clone(),t=this.vertices[j].position.clone(),v=this.vertices[h].position.clone(),o.normalize(),t.normalize(),v.normalize(),this.faces.push(new THREE.Face3(g,j,h,[new THREE.Vector3(o.x,o.y,o.z),new THREE.Vector3(t.x,t.y,t.z),new THREE.Vector3(v.x,v.y,v.z)])),this.faceVertexUvs[0].push([k,p,n]));b>1&&(o=this.vertices[g].position.clone(),
-t=this.vertices[h].position.clone(),v=this.vertices[l].position.clone(),o.normalize(),t.normalize(),v.normalize(),this.faces.push(new THREE.Face3(g,h,l,[new THREE.Vector3(o.x,o.y,o.z),new THREE.Vector3(t.x,t.y,t.z),new THREE.Vector3(v.x,v.y,v.z)])),this.faceVertexUvs[0].push([k,n,u]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};THREE.Sphere.prototype=new THREE.Geometry;THREE.Sphere.prototype.constructor=THREE.Sphere;
-THREE.Torus=function(a,c,b,d){THREE.Geometry.call(this);this.radius=a||100;this.tube=c||40;this.segmentsR=b||8;this.segmentsT=d||6;a=[];for(c=0;c<=this.segmentsR;++c)for(b=0;b<=this.segmentsT;++b){var d=b/this.segmentsT*2*Math.PI,e=c/this.segmentsR*2*Math.PI;this.vertices.push(new THREE.Vertex(new THREE.Vector3((this.radius+this.tube*Math.cos(e))*Math.cos(d),(this.radius+this.tube*Math.cos(e))*Math.sin(d),this.tube*Math.sin(e))));a.push([b/this.segmentsT,1-c/this.segmentsR])}for(c=1;c<=this.segmentsR;++c)for(b=
-1;b<=this.segmentsT;++b){var d=(this.segmentsT+1)*c+b,e=(this.segmentsT+1)*c+b-1,f=(this.segmentsT+1)*(c-1)+b-1,g=(this.segmentsT+1)*(c-1)+b;this.faces.push(new THREE.Face4(d,e,f,g));this.faceVertexUvs[0].push([new THREE.UV(a[d][0],a[d][1]),new THREE.UV(a[e][0],a[e][1]),new THREE.UV(a[f][0],a[f][1]),new THREE.UV(a[g][0],a[g][1])])}delete a;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.Torus.prototype=new THREE.Geometry;THREE.Torus.prototype.constructor=THREE.Torus;
-THREE.TorusKnot=function(a,c,b,d,e,f,g){function j(a,b,d,c,f,g){b=d/c*a;d=Math.cos(b);return new THREE.Vector3(f*(2+d)*0.5*Math.cos(a),f*(2+d)*Math.sin(a)*0.5,g*f*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=e||2;this.q=f||3;this.heightScale=g||1;this.grid=Array(this.segmentsR);b=new THREE.Vector3;d=new THREE.Vector3;f=new THREE.Vector3;for(a=0;a<this.segmentsR;++a){this.grid[a]=Array(this.segmentsT);for(c=0;c<this.segmentsT;++c){var h=
-a/this.segmentsR*2*this.p*Math.PI,g=c/this.segmentsT*2*Math.PI,e=j(h,g,this.q,this.p,this.radius,this.heightScale),h=j(h+0.01,g,this.q,this.p,this.radius,this.heightScale);b.x=h.x-e.x;b.y=h.y-e.y;b.z=h.z-e.z;d.x=h.x+e.x;d.y=h.y+e.y;d.z=h.z+e.z;f.cross(b,d);d.cross(f,b);f.normalize();d.normalize();h=-this.tube*Math.cos(g);g=this.tube*Math.sin(g);e.x+=h*d.x+g*f.x;e.y+=h*d.y+g*f.y;e.z+=h*d.z+g*f.z;this.grid[a][c]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(e.x,e.y,e.z)))-1}}for(a=0;a<this.segmentsR;++a)for(c=
-0;c<this.segmentsT;++c){var d=(a+1)%this.segmentsR,f=(c+1)%this.segmentsT,e=this.grid[a][c],b=this.grid[d][c],d=this.grid[d][f],f=this.grid[a][f],g=new THREE.UV(a/this.segmentsR,c/this.segmentsT),h=new THREE.UV((a+1)/this.segmentsR,c/this.segmentsT),l=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(e,b,d,f));this.faceVertexUvs[0].push([g,h,l,k])}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};
-THREE.TorusKnot.prototype=new THREE.Geometry;THREE.TorusKnot.prototype.constructor=THREE.TorusKnot;THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
-THREE.Loader.prototype={addStatusElement:function(){var a=document.createElement("div");a.style.position="absolute";a.style.right="0px";a.style.top="0px";a.style.fontSize="0.8em";a.style.textAlign="left";a.style.background="rgba(0,0,0,0.25)";a.style.color="#fff";a.style.width="120px";a.style.padding="0.5em 0.5em 0.5em 0.5em";a.style.zIndex=1E3;a.innerHTML="Loading ...";return a},updateProgress:function(a){var 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.join("/")},init_materials:function(a,c,b){a.materials=[];for(var d=0;d<c.length;++d)a.materials[d]=[THREE.Loader.prototype.createMaterial(c[d],b)]},createMaterial:function(a,c){function b(a){a=Math.log(a)/Math.LN2;return Math.floor(a)==a}function d(a,d){var c=new Image;c.onload=function(){if(!b(this.width)||!b(this.height)){var d=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),c=Math.pow(2,Math.round(Math.log(this.height)/
-Math.LN2));a.image.width=d;a.image.height=c;a.image.getContext("2d").drawImage(this,0,0,d,c)}else a.image=this;a.needsUpdate=!0};c.src=d}var e,f,g;e="MeshLambertMaterial";f={color:15658734,opacity:1,map:null,lightMap:null,wireframe:a.wireframe};a.shading&&(a.shading=="Phong"?e="MeshPhongMaterial":a.shading=="Basic"&&(e="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.mapDiffuse&&c)g=document.createElement("canvas"),f.map=new THREE.Texture(g),f.map.sourceFile=a.mapDiffuse,d(f.map,c+"/"+a.mapDiffuse);else if(a.colorDiffuse)g=(a.colorDiffuse[0]*255<<16)+(a.colorDiffuse[1]*
-255<<8)+a.colorDiffuse[2]*255,f.color=g,f.opacity=a.transparency;else if(a.DbgColor)f.color=a.DbgColor;if(a.mapLightmap&&c)g=document.createElement("canvas"),f.lightMap=new THREE.Texture(g),f.lightMap.sourceFile=a.mapLightmap,d(f.lightMap,c+"/"+a.mapLightmap);return new THREE[e](f)}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;
-THREE.JSONLoader.prototype.load=function(a){var c=this,b=a.model,d=a.callback,e=a.texture_path?a.texture_path:this.extractUrlbase(b),a=new Worker(b);a.onmessage=function(a){c.createModel(a.data,d,e);c.onLoadComplete()};this.onLoadStart();a.postMessage((new Date).getTime())};
-THREE.JSONLoader.prototype.createModel=function(a,c,b){var d=new THREE.Geometry,e=a.scale!==void 0?1/a.scale:1;this.init_materials(d,a.materials,b);(function(b){if(a.version===void 0||a.version!=2)console.error("Deprecated file format.");else{var c,e,h,l,k,n,p,o,t,v,u,y,w,m,x=a.faces;n=a.vertices;var A=a.normals,C=a.colors,D=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&D++;for(c=0;c<D;c++)d.faceUvs[c]=[],d.faceVertexUvs[c]=[];l=0;for(k=n.length;l<k;)p=new THREE.Vertex,p.position.x=n[l++]*b,p.position.y=
-n[l++]*b,p.position.z=n[l++]*b,d.vertices.push(p);l=0;for(k=x.length;l<k;){b=x[l++];n=b&1;h=b&2;c=b&4;e=b&8;o=b&16;p=b&32;v=b&64;b&=128;n?(u=new THREE.Face4,u.a=x[l++],u.b=x[l++],u.c=x[l++],u.d=x[l++],n=4):(u=new THREE.Face3,u.a=x[l++],u.b=x[l++],u.c=x[l++],n=3);if(h)h=x[l++],u.materials=d.materials[h];h=d.faces.length;if(c)for(c=0;c<D;c++)y=a.uvs[c],t=x[l++],m=y[t*2],t=y[t*2+1],d.faceUvs[c][h]=new THREE.UV(m,t);if(e)for(c=0;c<D;c++){y=a.uvs[c];w=[];for(e=0;e<n;e++)t=x[l++],m=y[t*2],t=y[t*2+1],w[e]=
-new THREE.UV(m,t);d.faceVertexUvs[c][h]=w}if(o)o=x[l++]*3,e=new THREE.Vector3,e.x=A[o++],e.y=A[o++],e.z=A[o],u.normal=e;if(p)for(c=0;c<n;c++)o=x[l++]*3,e=new THREE.Vector3,e.x=A[o++],e.y=A[o++],e.z=A[o],u.vertexNormals.push(e);if(v)p=x[l++],p=new THREE.Color(C[p]),u.color=p;if(b)for(c=0;c<n;c++)p=x[l++],p=new THREE.Color(C[p]),u.vertexColors.push(p);d.faces.push(u)}}})(e);(function(){var b,c,e,h;if(a.skinWeights){b=0;for(c=a.skinWeights.length;b<c;b+=2)e=a.skinWeights[b],h=a.skinWeights[b+1],d.skinWeights.push(new THREE.Vector4(e,
-h,0,0))}if(a.skinIndices){b=0;for(c=a.skinIndices.length;b<c;b+=2)e=a.skinIndices[b],h=a.skinIndices[b+1],d.skinIndices.push(new THREE.Vector4(e,h,0,0))}d.bones=a.bones;d.animation=a.animation})();(function(b){if(a.morphTargets!==void 0){var c,e,h,l,k,n,p,o,t;c=0;for(e=a.morphTargets.length;c<e;c++){d.morphTargets[c]={};d.morphTargets[c].name=a.morphTargets[c].name;d.morphTargets[c].vertices=[];o=d.morphTargets[c].vertices;t=a.morphTargets[c].vertices;h=0;for(l=t.length;h<l;h+=3)k=t[h]*b,n=t[h+1]*
-b,p=t[h+2]*b,o.push(new THREE.Vertex(new THREE.Vector3(k,n,p)))}}if(a.morphColors!==void 0){c=0;for(e=a.morphColors.length;c<e;c++){d.morphColors[c]={};d.morphColors[c].name=a.morphColors[c].name;d.morphColors[c].colors=[];l=d.morphColors[c].colors;k=a.morphColors[c].colors;b=0;for(h=k.length;b<h;b+=3)n=new THREE.Color(16755200),n.setRGB(k[b],k[b+1],k[b+2]),l.push(n)}}})(e);(function(){if(a.edges!==void 0){var b,c,e;for(b=0;b<a.edges.length;b+=2)c=a.edges[b],e=a.edges[b+1],d.edges.push(new THREE.Edge(d.vertices[c],
-d.vertices[e],c,e))}})();d.computeCentroids();d.computeFaceNormals();c(d)};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;THREE.BinaryLoader.prototype.supr=THREE.Loader.prototype;
-THREE.BinaryLoader.prototype={load:function(a){var c=a.model,b=a.callback,d=a.texture_path?a.texture_path:THREE.Loader.prototype.extractUrlbase(c),e=a.bin_path?a.bin_path:THREE.Loader.prototype.extractUrlbase(c),a=(new Date).getTime(),c=new Worker(c),f=this.showProgress?THREE.Loader.prototype.updateProgress:null;c.onmessage=function(a){THREE.BinaryLoader.prototype.loadAjaxBuffers(a.data.buffers,a.data.materials,b,e,d,f)};c.onerror=function(a){alert("worker.onerror: "+a.message+"\n"+a.data);a.preventDefault()};
-c.postMessage(a)},loadAjaxBuffers:function(a,c,b,d,e,f){var g=new XMLHttpRequest,j=d+"/"+a,h=0;g.onreadystatechange=function(){g.readyState==4?g.status==200||g.status==0?THREE.BinaryLoader.prototype.createBinModel(g.responseText,b,e,c):alert("Couldn't load ["+j+"] ["+g.status+"]"):g.readyState==3?f&&(h==0&&(h=g.getResponseHeader("Content-Length")),f({total:h,loaded:g.responseText.length})):g.readyState==2&&(h=g.getResponseHeader("Content-Length"))};g.open("GET",j,!0);g.overrideMimeType("text/plain; charset=x-user-defined");
-g.setRequestHeader("Content-Type","text/plain");g.send(null)},createBinModel:function(a,c,b,d){var e=function(b){function c(a,b){var d=k(a,b),e=k(a,b+1),f=k(a,b+2),g=k(a,b+3),h=(g<<1&255|f>>7)-127;d|=(f&127)<<16|e<<8;if(d==0&&h==-127)return 0;return(1-2*(g>>7))*(1+d*Math.pow(2,-23))*Math.pow(2,h)}function e(a,b){var c=k(a,b),d=k(a,b+1),f=k(a,b+2);return(k(a,b+3)<<24)+(f<<16)+(d<<8)+c}function h(a,b){var c=k(a,b);return(k(a,b+1)<<8)+c}function l(a,b){var c=k(a,b);return c>127?c-256:c}function k(a,
-b){return a.charCodeAt(b)&255}function n(b){var c,d,f;c=e(a,b);d=e(a,b+C);f=e(a,b+D);b=h(a,b+E);THREE.BinaryLoader.prototype.f3(y,c,d,f,b)}function p(b){var c,d,f,g,l,k;c=e(a,b);d=e(a,b+C);f=e(a,b+D);g=h(a,b+E);l=e(a,b+F);k=e(a,b+B);b=e(a,b+N);THREE.BinaryLoader.prototype.f3n(y,x,c,d,f,g,l,k,b)}function o(b){var c,d,f,g;c=e(a,b);d=e(a,b+K);f=e(a,b+H);g=e(a,b+L);b=h(a,b+I);THREE.BinaryLoader.prototype.f4(y,c,d,f,g,b)}function t(b){var c,d,f,g,l,k,n,m;c=e(a,b);d=e(a,b+K);f=e(a,b+H);g=e(a,b+L);l=h(a,
-b+I);k=e(a,b+z);n=e(a,b+G);m=e(a,b+J);b=e(a,b+M);THREE.BinaryLoader.prototype.f4n(y,x,c,d,f,g,l,k,n,m,b)}function v(b){var c,d;c=e(a,b);d=e(a,b+U);b=e(a,b+V);THREE.BinaryLoader.prototype.uv3(y.faceVertexUvs[0],A[c*2],A[c*2+1],A[d*2],A[d*2+1],A[b*2],A[b*2+1])}function u(b){var c,d,f;c=e(a,b);d=e(a,b+W);f=e(a,b+X);b=e(a,b+Y);THREE.BinaryLoader.prototype.uv4(y.faceVertexUvs[0],A[c*2],A[c*2+1],A[d*2],A[d*2+1],A[f*2],A[f*2+1],A[b*2],A[b*2+1])}var y=this,w=0,m,x=[],A=[],C,D,E,F,B,N,K,H,L,I,z,G,J,M,U,V,
-W,X,Y,P,Q,R,S,T,O;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(y,d,b);m={signature:a.substr(w,8),header_bytes:k(a,w+8),vertex_coordinate_bytes:k(a,w+9),normal_coordinate_bytes:k(a,w+10),uv_coordinate_bytes:k(a,w+11),vertex_index_bytes:k(a,w+12),normal_index_bytes:k(a,w+13),uv_index_bytes:k(a,w+14),material_index_bytes:k(a,w+15),nvertices:e(a,w+16),nnormals:e(a,w+16+4),nuvs:e(a,w+16+8),ntri_flat:e(a,w+16+12),ntri_smooth:e(a,w+16+16),ntri_flat_uv:e(a,w+16+20),ntri_smooth_uv:e(a,w+
-16+24),nquad_flat:e(a,w+16+28),nquad_smooth:e(a,w+16+32),nquad_flat_uv:e(a,w+16+36),nquad_smooth_uv:e(a,w+16+40)};w+=m.header_bytes;C=m.vertex_index_bytes;D=m.vertex_index_bytes*2;E=m.vertex_index_bytes*3;F=m.vertex_index_bytes*3+m.material_index_bytes;B=m.vertex_index_bytes*3+m.material_index_bytes+m.normal_index_bytes;N=m.vertex_index_bytes*3+m.material_index_bytes+m.normal_index_bytes*2;K=m.vertex_index_bytes;H=m.vertex_index_bytes*2;L=m.vertex_index_bytes*3;I=m.vertex_index_bytes*4;z=m.vertex_index_bytes*
-4+m.material_index_bytes;G=m.vertex_index_bytes*4+m.material_index_bytes+m.normal_index_bytes;J=m.vertex_index_bytes*4+m.material_index_bytes+m.normal_index_bytes*2;M=m.vertex_index_bytes*4+m.material_index_bytes+m.normal_index_bytes*3;U=m.uv_index_bytes;V=m.uv_index_bytes*2;W=m.uv_index_bytes;X=m.uv_index_bytes*2;Y=m.uv_index_bytes*3;b=m.vertex_index_bytes*3+m.material_index_bytes;O=m.vertex_index_bytes*4+m.material_index_bytes;P=m.ntri_flat*b;Q=m.ntri_smooth*(b+m.normal_index_bytes*3);R=m.ntri_flat_uv*
-(b+m.uv_index_bytes*3);S=m.ntri_smooth_uv*(b+m.normal_index_bytes*3+m.uv_index_bytes*3);T=m.nquad_flat*O;b=m.nquad_smooth*(O+m.normal_index_bytes*4);O=m.nquad_flat_uv*(O+m.uv_index_bytes*4);w+=function(b){for(var d,e,f,h=m.vertex_coordinate_bytes*3,j=b+m.nvertices*h;b<j;b+=h)d=c(a,b),e=c(a,b+m.vertex_coordinate_bytes),f=c(a,b+m.vertex_coordinate_bytes*2),THREE.BinaryLoader.prototype.v(y,d,e,f);return m.nvertices*h}(w);w+=function(b){for(var c,d,e,f=m.normal_coordinate_bytes*3,g=b+m.nnormals*f;b<g;b+=
-f)c=l(a,b),d=l(a,b+m.normal_coordinate_bytes),e=l(a,b+m.normal_coordinate_bytes*2),x.push(c/127,d/127,e/127);return m.nnormals*f}(w);w+=function(b){for(var d,e,f=m.uv_coordinate_bytes*2,h=b+m.nuvs*f;b<h;b+=f)d=c(a,b),e=c(a,b+m.uv_coordinate_bytes),A.push(d,e);return m.nuvs*f}(w);P=w+P;Q=P+Q;R=Q+R;S=R+S;T=S+T;b=T+b;O=b+O;(function(a){var b,c=m.vertex_index_bytes*3+m.material_index_bytes,d=c+m.uv_index_bytes*3,e=a+m.ntri_flat_uv*d;for(b=a;b<e;b+=d)n(b),v(b+c);return e-a})(Q);(function(a){var b,c=m.vertex_index_bytes*
-3+m.material_index_bytes+m.normal_index_bytes*3,d=c+m.uv_index_bytes*3,e=a+m.ntri_smooth_uv*d;for(b=a;b<e;b+=d)p(b),v(b+c);return e-a})(R);(function(a){var b,c=m.vertex_index_bytes*4+m.material_index_bytes,d=c+m.uv_index_bytes*4,e=a+m.nquad_flat_uv*d;for(b=a;b<e;b+=d)o(b),u(b+c);return e-a})(b);(function(a){var b,c=m.vertex_index_bytes*4+m.material_index_bytes+m.normal_index_bytes*4,d=c+m.uv_index_bytes*4,e=a+m.nquad_smooth_uv*d;for(b=a;b<e;b+=d)t(b),u(b+c);return e-a})(O);(function(a){var b,c=m.vertex_index_bytes*
-3+m.material_index_bytes,d=a+m.ntri_flat*c;for(b=a;b<d;b+=c)n(b);return d-a})(w);(function(a){var b,c=m.vertex_index_bytes*3+m.material_index_bytes+m.normal_index_bytes*3,d=a+m.ntri_smooth*c;for(b=a;b<d;b+=c)p(b);return d-a})(P);(function(a){var b,c=m.vertex_index_bytes*4+m.material_index_bytes,d=a+m.nquad_flat*c;for(b=a;b<d;b+=c)o(b);return d-a})(S);(function(a){var b,c=m.vertex_index_bytes*4+m.material_index_bytes+m.normal_index_bytes*4,d=a+m.nquad_smooth*c;for(b=a;b<d;b+=c)t(b);return d-a})(T);
-this.computeCentroids();this.computeFaceNormals()};e.prototype=new THREE.Geometry;e.prototype.constructor=e;c(new e(b))},v:function(a,c,b,d){a.vertices.push(new THREE.Vertex(new THREE.Vector3(c,b,d)))},f3:function(a,c,b,d,e){a.faces.push(new THREE.Face3(c,b,d,null,null,a.materials[e]))},f4:function(a,c,b,d,e,f){a.faces.push(new THREE.Face4(c,b,d,e,null,null,a.materials[f]))},f3n:function(a,c,b,d,e,f,g,j,h){var f=a.materials[f],l=c[j*3],k=c[j*3+1],j=c[j*3+2],n=c[h*3],p=c[h*3+1],h=c[h*3+2];a.faces.push(new THREE.Face3(b,
-d,e,[new THREE.Vector3(c[g*3],c[g*3+1],c[g*3+2]),new THREE.Vector3(l,k,j),new THREE.Vector3(n,p,h)],null,f))},f4n:function(a,c,b,d,e,f,g,j,h,l,k){var g=a.materials[g],n=c[h*3],p=c[h*3+1],h=c[h*3+2],o=c[l*3],t=c[l*3+1],l=c[l*3+2],v=c[k*3],u=c[k*3+1],k=c[k*3+2];a.faces.push(new THREE.Face4(b,d,e,f,[new THREE.Vector3(c[j*3],c[j*3+1],c[j*3+2]),new THREE.Vector3(n,p,h),new THREE.Vector3(o,t,l),new THREE.Vector3(v,u,k)],null,g))},uv3:function(a,c,b,d,e,f,g){var j=[];j.push(new THREE.UV(c,b));j.push(new THREE.UV(d,
-e));j.push(new THREE.UV(f,g));a.push(j)},uv4:function(a,c,b,d,e,f,g,j,h){var l=[];l.push(new THREE.UV(c,b));l.push(new THREE.UV(d,e));l.push(new THREE.UV(f,g));l.push(new THREE.UV(j,h));a.push(l)}};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,d=new Worker(a);d.postMessage(0);var e=THREE.Loader.prototype.extractUrlbase(a);d.onmessage=function(a){function d(a,b){return b=="relativeToHTML"?a:e+"/"+a}function j(){for(o in B.objects)if(!z.objects[o])if(w=B.objects[o],w.geometry!==void 0){if(C=z.geometries[w.geometry]){F=[];for(M=0;M<w.materials.length;M++)F[M]=z.materials[w.materials[M]];m=w.position;r=w.rotation;q=w.quaternion;s=w.scale;q=0;F.length==0&&(F[0]=new THREE.MeshFaceMaterial);
-F.length>1&&(F=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(C,F);object.name=o;object.position.set(m[0],m[1],m[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=w.visible;z.scene.addObject(object);z.objects[o]=object;if(w.meshCollider){var a=THREE.CollisionUtils.MeshColliderWBox(object);z.scene.collisions.colliders.push(a)}if(w.castsShadow)a=new THREE.ShadowVolume(C),z.scene.addChild(a),
-a.position=object.position,a.rotation=object.rotation,a.scale=object.scale;w.trigger&&w.trigger.toLowerCase()!="none"&&(a={type:w.trigger,object:w},z.triggers[object.name]=a)}}else m=w.position,r=w.rotation,q=w.quaternion,s=w.scale,q=0,object=new THREE.Object3D,object.name=o,object.position.set(m[0],m[1],m[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=w.visible!==void 0?w.visible:!1,z.scene.addObject(object),
-z.objects[o]=object,z.empties[o]=object,w.trigger&&w.trigger.toLowerCase()!="none"&&(a={type:w.trigger,object:w},z.triggers[object.name]=a)}function h(a){return function(c){z.geometries[a]=c;j();K-=1;b.onLoadComplete();k()}}function l(a){return function(b){z.geometries[a]=b}}function k(){b.callbackProgress({totalModels:L,totalTextures:I,loadedModels:L-K,loadedTextures:I-H},z);b.onLoadProgress();K==0&&H==0&&c(z)}var n,p,o,t,v,u,y,w,m,x,A,C,D,E,F,B,N,K,H,L,I,z;B=a.data;a=new THREE.BinaryLoader;N=new THREE.JSONLoader;
-H=K=0;z={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};var G=!1;for(o in B.objects)if(w=B.objects[o],w.meshCollider){G=!0;break}if(G)z.scene.collisions=new THREE.CollisionSystem;if(B.transform){G=B.transform.position;x=B.transform.rotation;var J=B.transform.scale;G&&z.scene.position.set(G[0],G[1],G[2]);x&&z.scene.rotation.set(x[0],x[1],x[2]);J&&z.scene.scale.set(J[0],J[1],J[2]);(G||x||J)&&z.scene.updateMatrix()}G=function(){H-=
-1;k();b.onLoadComplete()};for(v in B.cameras){x=B.cameras[v];if(x.type=="perspective")D=new THREE.Camera(x.fov,x.aspect,x.near,x.far);else if(x.type=="ortho")D=new THREE.Camera,D.projectionMatrix=THREE.Matrix4.makeOrtho(x.left,x.right,x.top,x.bottom,x.near,x.far);m=x.position;x=x.target;D.position.set(m[0],m[1],m[2]);D.target.position.set(x[0],x[1],x[2]);z.cameras[v]=D}for(t in B.lights){v=B.lights[t];D=v.color!==void 0?v.color:16777215;x=v.intensity!==void 0?v.intensity:1;if(v.type=="directional")m=
-v.direction,light=new THREE.DirectionalLight(D,x),light.position.set(m[0],m[1],m[2]),light.position.normalize();else if(v.type=="point")m=v.position,light=new THREE.PointLight(D,x),light.position.set(m[0],m[1],m[2]);z.scene.addLight(light);z.lights[t]=light}for(u in B.fogs)t=B.fogs[u],t.type=="linear"?E=new THREE.Fog(0,t.near,t.far):t.type=="exp2"&&(E=new THREE.FogExp2(0,t.density)),x=t.color,E.color.setRGB(x[0],x[1],x[2]),z.fogs[u]=E;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];x=B.defaults.bgcolor;z.bgColor=new THREE.Color;z.bgColor.setRGB(x[0],x[1],x[2]);z.bgColorAlpha=B.defaults.bgalpha;for(n in B.geometries)if(u=B.geometries[n],u.type=="bin_mesh"||u.type=="ascii_mesh")K+=1,b.onLoadStart();L=K;for(n in B.geometries)u=B.geometries[n],u.type=="cube"?(C=new THREE.Cube(u.width,u.height,u.depth,u.segmentsWidth,u.segmentsHeight,u.segmentsDepth,null,u.flipped,u.sides),z.geometries[n]=C):u.type=="plane"?(C=new THREE.Plane(u.width,
-u.height,u.segmentsWidth,u.segmentsHeight),z.geometries[n]=C):u.type=="sphere"?(C=new THREE.Sphere(u.radius,u.segmentsWidth,u.segmentsHeight),z.geometries[n]=C):u.type=="cylinder"?(C=new THREE.Cylinder(u.numSegs,u.topRad,u.botRad,u.height,u.topOffset,u.botOffset),z.geometries[n]=C):u.type=="torus"?(C=new THREE.Torus(u.radius,u.tube,u.segmentsR,u.segmentsT),z.geometries[n]=C):u.type=="icosahedron"?(C=new THREE.Icosahedron(u.subdivisions),z.geometries[n]=C):u.type=="bin_mesh"?a.load({model:d(u.url,
-B.urlBaseType),callback:h(n)}):u.type=="ascii_mesh"?N.load({model:d(u.url,B.urlBaseType),callback:h(n)}):u.type=="embedded_mesh"&&(u=B.embeds[u.id])&&N.createModel(u,l(n),"");for(y in B.textures)if(n=B.textures[y],n.url instanceof Array){H+=n.url.length;for(a=0;a<n.url.length;a++)b.onLoadStart()}else H+=1,b.onLoadStart();I=H;for(y in B.textures){n=B.textures[y];if(n.mapping!=void 0&&THREE[n.mapping]!=void 0)n.mapping=new THREE[n.mapping];if(n.url instanceof Array){for(var a=[],M=0;M<n.url.length;M++)a[M]=
-d(n.url[M],B.urlBaseType);a=THREE.ImageUtils.loadTextureCube(a,n.mapping,G)}else{a=THREE.ImageUtils.loadTexture(d(n.url,B.urlBaseType),n.mapping,G);if(THREE[n.minFilter]!=void 0)a.minFilter=THREE[n.minFilter];if(THREE[n.magFilter]!=void 0)a.magFilter=THREE[n.magFilter]}z.textures[y]=a}for(p in B.materials){y=B.materials[p];for(A in y.parameters)if(A=="envMap"||A=="map"||A=="lightMap")y.parameters[A]=z.textures[y.parameters[A]];else if(A=="shading")y.parameters[A]=y.parameters[A]=="flat"?THREE.FlatShading:
-THREE.SmoothShading;else if(A=="blending")y.parameters[A]=THREE[y.parameters[A]]?THREE[y.parameters[A]]:THREE.NormalBlending;else if(A=="combine")y.parameters[A]=y.parameters[A]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(A=="vertexColors")if(y.parameters[A]=="face")y.parameters[A]=THREE.FaceColors;else if(y.parameters[A])y.parameters[A]=THREE.VertexColors;if(y.parameters.opacity!==void 0&&y.parameters.opacity<1)y.parameters.transparent=!0;y=new THREE[y.type](y.parameters);
-z.materials[p]=y}j();b.callbackSync(z)}}};
-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,e){return a+(c-a)*e};this.VIntX=function(a,c,e,f,g,j,h,l,k,n){g=(g-k)/(n-k);k=this.normal_cache;c[f]=j+g*this.delta;c[f+1]=h;c[f+2]=l;e[f]=this.lerp(k[a],k[a+3],g);e[f+1]=this.lerp(k[a+1],k[a+4],g);e[f+2]=this.lerp(k[a+2],k[a+5],g)};this.VIntY=function(a,c,e,f,g,j,h,l,k,n){g=(g-k)/(n-k);k=this.normal_cache;c[f]=j;c[f+1]=h+g*this.delta;c[f+
-2]=l;c=a+this.yd*3;e[f]=this.lerp(k[a],k[c],g);e[f+1]=this.lerp(k[a+1],k[c+1],g);e[f+2]=this.lerp(k[a+2],k[c+2],g)};this.VIntZ=function(a,c,e,f,g,j,h,l,k,n){g=(g-k)/(n-k);k=this.normal_cache;c[f]=j;c[f+1]=h;c[f+2]=l+g*this.delta;c=a+this.zd*3;e[f]=this.lerp(k[a],k[c],g);e[f+1]=this.lerp(k[a+1],k[c+1],g);e[f+2]=this.lerp(k[a+2],k[c+2],g)};this.compNorm=function(a){var c=a*3;this.normal_cache[c]==0&&(this.normal_cache[c]=this.field[a-1]-this.field[a+1],this.normal_cache[c+1]=this.field[a-this.yd]-this.field[a+
-this.yd],this.normal_cache[c+2]=this.field[a-this.zd]-this.field[a+this.zd])};this.polygonize=function(a,c,e,f,g,j){var h=f+1,l=f+this.yd,k=f+this.zd,n=h+this.yd,p=h+this.zd,o=f+this.yd+this.zd,t=h+this.yd+this.zd,v=0,u=this.field[f],y=this.field[h],w=this.field[l],m=this.field[n],x=this.field[k],A=this.field[p],C=this.field[o],D=this.field[t];u<g&&(v|=1);y<g&&(v|=2);w<g&&(v|=8);m<g&&(v|=4);x<g&&(v|=16);A<g&&(v|=32);C<g&&(v|=128);D<g&&(v|=64);var E=THREE.edgeTable[v];if(E==0)return 0;var F=this.delta,
-B=a+F,N=c+F,F=e+F;E&1&&(this.compNorm(f),this.compNorm(h),this.VIntX(f*3,this.vlist,this.nlist,0,g,a,c,e,u,y));E&2&&(this.compNorm(h),this.compNorm(n),this.VIntY(h*3,this.vlist,this.nlist,3,g,B,c,e,y,m));E&4&&(this.compNorm(l),this.compNorm(n),this.VIntX(l*3,this.vlist,this.nlist,6,g,a,N,e,w,m));E&8&&(this.compNorm(f),this.compNorm(l),this.VIntY(f*3,this.vlist,this.nlist,9,g,a,c,e,u,w));E&16&&(this.compNorm(k),this.compNorm(p),this.VIntX(k*3,this.vlist,this.nlist,12,g,a,c,F,x,A));E&32&&(this.compNorm(p),
-this.compNorm(t),this.VIntY(p*3,this.vlist,this.nlist,15,g,B,c,F,A,D));E&64&&(this.compNorm(o),this.compNorm(t),this.VIntX(o*3,this.vlist,this.nlist,18,g,a,N,F,C,D));E&128&&(this.compNorm(k),this.compNorm(o),this.VIntY(k*3,this.vlist,this.nlist,21,g,a,c,F,x,C));E&256&&(this.compNorm(f),this.compNorm(k),this.VIntZ(f*3,this.vlist,this.nlist,24,g,a,c,e,u,x));E&512&&(this.compNorm(h),this.compNorm(p),this.VIntZ(h*3,this.vlist,this.nlist,27,g,B,c,e,y,A));E&1024&&(this.compNorm(n),this.compNorm(t),this.VIntZ(n*
-3,this.vlist,this.nlist,30,g,B,N,e,m,D));E&2048&&(this.compNorm(l),this.compNorm(o),this.VIntZ(l*3,this.vlist,this.nlist,33,g,a,N,e,w,C));v<<=4;for(g=f=0;THREE.triTable[v+g]!=-1;)a=v+g,c=a+1,e=a+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[a],3*THREE.triTable[c],3*THREE.triTable[e],j),g+=3,f++;return f};this.posnormtriv=function(a,c,e,f,g,j){var h=this.count*3;this.positionArray[h]=a[e];this.positionArray[h+1]=a[e+1];this.positionArray[h+2]=a[e+2];this.positionArray[h+3]=a[f];this.positionArray[h+
-4]=a[f+1];this.positionArray[h+5]=a[f+2];this.positionArray[h+6]=a[g];this.positionArray[h+7]=a[g+1];this.positionArray[h+8]=a[g+2];this.normalArray[h]=c[e];this.normalArray[h+1]=c[e+1];this.normalArray[h+2]=c[e+2];this.normalArray[h+3]=c[f];this.normalArray[h+4]=c[f+1];this.normalArray[h+5]=c[f+2];this.normalArray[h+6]=c[g];this.normalArray[h+7]=c[g+1];this.normalArray[h+8]=c[g+2];this.hasNormal=this.hasPos=!0;this.count+=3;this.count>=this.maxCount-3&&j(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,e,f,g){var j=this.size*Math.sqrt(f/g),h=e*this.size,l=c*this.size,k=a*this.size,n=Math.floor(h-j);n<1&&(n=1);h=Math.floor(h+j);h>this.size-1&&(h=this.size-1);var p=Math.floor(l-j);p<1&&(p=1);l=Math.floor(l+j);l>this.size-1&&(l=this.size-1);var o=Math.floor(k-j);o<1&&(o=1);j=Math.floor(k+j);j>this.size-1&&(j=this.size-
-1);for(var t,v,u,y,w,m;n<h;n++){k=this.size2*n;v=n/this.size-e;w=v*v;for(v=p;v<l;v++){u=k+this.size*v;t=v/this.size-c;m=t*t;for(t=o;t<j;t++)y=t/this.size-a,y=f/(1.0E-6+y*y+m+w)-g,y>0&&(this.field[u+t]+=y)}}};this.addPlaneX=function(a,c){var e,f,g,j,h,l=this.size,k=this.yd,n=this.zd,p=this.field,o=l*Math.sqrt(a/c);o>l&&(o=l);for(e=0;e<o;e++)if(f=e/l,f*=f,j=a/(1.0E-4+f)-c,j>0)for(f=0;f<l;f++){h=e+f*k;for(g=0;g<l;g++)p[n*g+h]+=j}};this.addPlaneY=function(a,c){var e,f,g,j,h,l,k=this.size,n=this.yd,p=
-this.zd,o=this.field,t=k*Math.sqrt(a/c);t>k&&(t=k);for(f=0;f<t;f++)if(e=f/k,e*=e,j=a/(1.0E-4+e)-c,j>0){h=f*n;for(e=0;e<k;e++){l=h+e;for(g=0;g<k;g++)o[p*g+l]+=j}}};this.addPlaneZ=function(a,c){var e,f,g,j,h,l;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(a/c);dist>size&&(dist=size);for(g=0;g<dist;g++)if(e=g/size,e*=e,j=a/(1.0E-4+e)-c,j>0){h=zd*g;for(f=0;f<size;f++){l=h+f*yd;for(e=0;e<size;e++)field[l+e]+=j}}};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,e,f,g,j,h,l,k,n,p=this.size-2;for(g=1;g<p;g++){n=this.size2*g;l=(g-this.halfsize)/this.halfsize;for(f=1;f<p;f++){k=n+this.size*f;h=(f-this.halfsize)/this.halfsize;for(e=1;e<p;e++)j=(e-this.halfsize)/this.halfsize,c=k+e,this.polygonize(j,h,l,c,this.isolation,a)}}this.end(a)};this.generateGeometry=function(){var a=0,c=new THREE.Geometry,e=[];this.render(function(f){var g,j,h,l,k,n,p,o;for(g=0;g<f.count;g++)p=g*3,k=p+1,o=p+2,j=f.positionArray[p],
-h=f.positionArray[k],l=f.positionArray[o],n=new THREE.Vector3(j,h,l),j=f.normalArray[p],h=f.normalArray[k],l=f.normalArray[o],p=new THREE.Vector3(j,h,l),p.normalize(),k=new THREE.Vertex(n),c.vertices.push(k),e.push(p);nfaces=f.count/3;for(g=0;g<nfaces;g++)p=(a+g)*3,k=p+1,o=p+2,n=e[p],j=e[k],h=e[o],p=new THREE.Face3(p,k,o,[n,j,h]),c.faces.push(p);a+=nfaces;f.count=0});return c};this.init(a)};THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
+THREE.Sphere=function(a,b,c){THREE.Geometry.call(this);for(var e,f=Math.PI,g=Math.max(3,b||8),h=Math.max(2,c||6),b=[],c=0;c<h+1;c++){e=c/h;var k=a*Math.cos(e*f),j=a*Math.sin(e*f),l=[],m=0;for(e=0;e<g;e++){var n=2*e/g,t=j*Math.sin(n*f),n=j*Math.cos(n*f);(c==0||c==h)&&e>0||(m=this.vertices.push(new THREE.Vertex(new THREE.Vector3(n,k,t)))-1);l.push(m)}b.push(l)}for(var p,u,v,f=b.length,c=0;c<f;c++)if(g=b[c].length,c>0)for(e=0;e<g;e++){l=e==g-1;h=b[c][l?0:e+1];k=b[c][l?g-1:e];j=b[c-1][l?g-1:e];l=b[c-
+1][l?0:e+1];t=c/(f-1);p=(c-1)/(f-1);u=(e+1)/g;var n=e/g,m=new THREE.UV(1-u,t),t=new THREE.UV(1-n,t),n=new THREE.UV(1-n,p),w=new THREE.UV(1-u,p);c<b.length-1&&(p=this.vertices[h].position.clone(),u=this.vertices[k].position.clone(),v=this.vertices[j].position.clone(),p.normalize(),u.normalize(),v.normalize(),this.faces.push(new THREE.Face3(h,k,j,[new THREE.Vector3(p.x,p.y,p.z),new THREE.Vector3(u.x,u.y,u.z),new THREE.Vector3(v.x,v.y,v.z)])),this.faceVertexUvs[0].push([m,t,n]));c>1&&(p=this.vertices[h].position.clone(),
+u=this.vertices[j].position.clone(),v=this.vertices[l].position.clone(),p.normalize(),u.normalize(),v.normalize(),this.faces.push(new THREE.Face3(h,j,l,[new THREE.Vector3(p.x,p.y,p.z),new THREE.Vector3(u.x,u.y,u.z),new THREE.Vector3(v.x,v.y,v.z)])),this.faceVertexUvs[0].push([m,n,w]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};THREE.Sphere.prototype=new THREE.Geometry;THREE.Sphere.prototype.constructor=THREE.Sphere;
+THREE.Torus=function(a,b,c,e){THREE.Geometry.call(this);this.radius=a||100;this.tube=b||40;this.segmentsR=c||8;this.segmentsT=e||6;a=[];for(b=0;b<=this.segmentsR;++b)for(c=0;c<=this.segmentsT;++c){var e=c/this.segmentsT*2*Math.PI,f=b/this.segmentsR*2*Math.PI;this.vertices.push(new THREE.Vertex(new THREE.Vector3((this.radius+this.tube*Math.cos(f))*Math.cos(e),(this.radius+this.tube*Math.cos(f))*Math.sin(e),this.tube*Math.sin(f))));a.push([c/this.segmentsT,1-b/this.segmentsR])}for(b=1;b<=this.segmentsR;++b)for(c=
+1;c<=this.segmentsT;++c){var e=(this.segmentsT+1)*b+c,f=(this.segmentsT+1)*b+c-1,g=(this.segmentsT+1)*(b-1)+c-1,h=(this.segmentsT+1)*(b-1)+c;this.faces.push(new THREE.Face4(e,f,g,h));this.faceVertexUvs[0].push([new THREE.UV(a[e][0],a[e][1]),new THREE.UV(a[f][0],a[f][1]),new THREE.UV(a[g][0],a[g][1]),new THREE.UV(a[h][0],a[h][1])])}delete a;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.Torus.prototype=new THREE.Geometry;THREE.Torus.prototype.constructor=THREE.Torus;
+THREE.TorusKnot=function(a,b,c,e,f,g,h){function k(a,c,b,e,g,f){c=b/e*a;b=Math.cos(c);return new THREE.Vector3(g*(2+b)*0.5*Math.cos(a),g*(2+b)*Math.sin(a)*0.5,f*g*Math.sin(c)*0.5)}THREE.Geometry.call(this);this.radius=a||200;this.tube=b||40;this.segmentsR=c||64;this.segmentsT=e||8;this.p=f||2;this.q=g||3;this.heightScale=h||1;this.grid=Array(this.segmentsR);c=new THREE.Vector3;e=new THREE.Vector3;g=new THREE.Vector3;for(a=0;a<this.segmentsR;++a){this.grid[a]=Array(this.segmentsT);for(b=0;b<this.segmentsT;++b){var j=
+a/this.segmentsR*2*this.p*Math.PI,h=b/this.segmentsT*2*Math.PI,f=k(j,h,this.q,this.p,this.radius,this.heightScale),j=k(j+0.01,h,this.q,this.p,this.radius,this.heightScale);c.x=j.x-f.x;c.y=j.y-f.y;c.z=j.z-f.z;e.x=j.x+f.x;e.y=j.y+f.y;e.z=j.z+f.z;g.cross(c,e);e.cross(g,c);g.normalize();e.normalize();j=-this.tube*Math.cos(h);h=this.tube*Math.sin(h);f.x+=j*e.x+h*g.x;f.y+=j*e.y+h*g.y;f.z+=j*e.z+h*g.z;this.grid[a][b]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(f.x,f.y,f.z)))-1}}for(a=0;a<this.segmentsR;++a)for(b=
+0;b<this.segmentsT;++b){var e=(a+1)%this.segmentsR,g=(b+1)%this.segmentsT,f=this.grid[a][b],c=this.grid[e][b],e=this.grid[e][g],g=this.grid[a][g],h=new THREE.UV(a/this.segmentsR,b/this.segmentsT),j=new THREE.UV((a+1)/this.segmentsR,b/this.segmentsT),l=new THREE.UV((a+1)/this.segmentsR,(b+1)/this.segmentsT),m=new THREE.UV(a/this.segmentsR,(b+1)/this.segmentsT);this.faces.push(new THREE.Face4(f,c,e,g));this.faceVertexUvs[0].push([h,j,l,m])}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};
+THREE.TorusKnot.prototype=new THREE.Geometry;THREE.TorusKnot.prototype.constructor=THREE.TorusKnot;
+THREE.Text=function(a,b){THREE.Geometry.call(this);var b=b||{},c=b.height!==void 0?b.height:50,e=b.curveSegments!==void 0?b.curveSegments:4;THREE.FontUtils.size=b.size!==void 0?b.size:100;THREE.FontUtils.divisions=e;e=THREE.FontUtils.drawText(a);vertices=e.points;faces=e.faces;contour=e.contour;var f,g,e=0;for(f in vertices)g=vertices[f],this.vertices.push(new THREE.Vertex(new THREE.Vector3(g.x,g.y,0))),e++;for(f in vertices)g=vertices[f],this.vertices.push(new THREE.Vertex(new THREE.Vector3(g.x,
+g.y,c)));for(f in faces)c=faces[f],this.faces.push(new THREE.Face3(c[2],c[1],c[0]));for(f in faces)c=faces[f],this.faces.push(new THREE.Face3(c[0]+e,c[1]+e,c[2]+e));f=contour.length;for(var h;--f>0;){if(h){if(h.equals(contour[f])){h=null;continue}}else h=contour[f];for(c=0;c<vertices.length;c++)if(vertices[c].equals(contour[f]))break;for(g=0;g<vertices.length;g++)if(vertices[g].equals(contour[f-1]))break;this.faces.push(new THREE.Face4(c,g,g+e,c+e))}this.computeCentroids();this.computeFaceNormals()};
+THREE.Text.prototype=new THREE.Geometry;THREE.Text.prototype.constructor=THREE.Text;
+THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function(){return this.faces[this.face][this.weight][this.style]},loadFace:function(a){var b=a.familyName.toLowerCase();this.faces[b]=this.faces[b]||{};this.faces[b][a.cssFontWeight]=this.faces[b][a.cssFontWeight]||{};this.faces[b][a.cssFontWeight][a.cssFontStyle]=a;return this.faces[b][a.cssFontWeight][a.cssFontStyle]=a},extractPoints:function(a){if(a.length<3)console.log("not valid polygon");
+else{var b=[],c,e,f=[],g;for(g in a)c=a[g],b.push(c.x+","+c.y);c=b[0];c=b.slice(1).indexOf(c);c<b.length&&(c++,e=a.slice(0,c));for(holes=[];c<b.length;){firstIndex=c+1;c=b[firstIndex];c=b.slice(firstIndex+1).indexOf(c)+firstIndex;if(c<=firstIndex)break;var h=a.slice(firstIndex,c+1);this.Triangulate.area(h)<0?(f.push({shape:e,holes:holes}),e=h,holes=[]):holes.push(h);c++}f.push({shape:e,holes:holes});var b=[],k;for(k in f){c=f[k];e=c.shape;holes=c.holes;for(var j in holes){var a=holes[j],h=Number.POSITIVE_INFINITY,
+l,m,n;for(n in a){var t=a[n];for(g in e)d=t.distanceTo(e[g]),d<h&&(h=d,l=n,m=g)}prevShapeVert=m-1>=0?m-1:e.length-1;nextShapeVert=m+1<e.length?m+1:0;prevHoleVert=l-1>=0?l-1:a.length-1;nextHoleVert=l+1<a.length?l+1:0;var h=e.slice(0,m),t=e.slice(m),p=a.slice(l),u=a.slice(0,l);b.push(a[l]);b.push(e[m]);b.push(e[prevShapeVert]);b.push(a[l]);b.push(a[prevHoleVert]);b.push(e[m]);c.shape=h.concat(p).concat(u).concat(t)}}a=[];g=[];l=0;for(k in f){c=f[k];e=c.shape;a=a.concat(e);m=THREE.FontUtils.Triangulate(e,
+!0);for(var v in m)j=m[v],j[0]+=l,j[1]+=l,j[2]+=l;g=g.concat(m);l+=e.length}for(v=0;v<b.length/3;v++){j=[];for(f=0;f<3;f++)for(e=0;e<a.length;e++)if(a[e].equals(b[v*3+f])){j.push(e);break}g.push(j)}return{points:a,faces:g}}},drawText:function(a){for(var b=[],c=this.getFace(),e=this.size/c.resolution,f=0,g=String(a).split(""),h=g.length,a=0;a<h;a++)f+=this.extractGlyphPoints(b,g[a],c,e,f);var c=f/2,k;for(k in b)b[k].x-=c;k=this.extractPoints(b);k.contour=b;return k},b2p0:function(a,b){return(1-a)*
+(1-a)*b},b2p1:function(a,b){return 2*(1-a)*a*b},b2p2:function(a,b){return a*a*b},b2:function(a,b,c,e){return this.b2p0(a,b)+this.b2p1(a,c)+this.b2p2(a,e)},b3p0:function(a,b){var c=1-a;return c*c*c*b},b3p1:function(a,b){var c=1-a;return 3*c*c*a*b},b3p2:function(a,b){return 3*(1-a)*a*a*b},b3p3:function(a,b){return a*a*a*b},b3:function(a,b,c,e,f){return this.b3p0(a,b)+this.b3p1(a,c)+this.b3p2(a,e)+this.b3p3(a,f)},extractGlyphPoints:function(a,b,c,e,f){var g,h,k,j=c.glyphs[b]||c.glyphs[ctxt.options.fallbackCharacter];
+if(j){if(j.o){c=j._cachedOutline||(j._cachedOutline=j.o.split(" "));k=c.length;for(b=0;b<k;)switch(g=c[b++],g){case "m":x=c[b++]*e+f;y=c[b++]*e;a.push(new THREE.Vector2(x,y));break;case "l":x=c[b++]*e+f;y=c[b++]*e;a.push(new THREE.Vector2(x,y));break;case "q":g=c[b++]*e+f;h=c[b++]*e;cpx1=c[b++]*e+f;cpy1=c[b++]*e;var l=a[a.length-1];if(l){cpx0=l.x;cpy0=l.y;for(var l=1,m=this.divisions;l<=m;l++){var n=l/m,t=THREE.FontUtils.b2(n,cpx0,cpx1,g),n=THREE.FontUtils.b2(n,cpy0,cpy1,h);a.push(new THREE.Vector2(t,
+n))}}break;case "b":if(g=c[b++]*e+f,h=c[b++]*e,cpx1=c[b++]*e+f,cpy1=c[b++]*-e,cpx2=c[b++]*e+f,cpy2=c[b++]*-e,l=a[a.length-1]){cpx0=l.x;cpy0=l.y;l=1;for(m=this.divisions;l<=m;l++)n=l/m,t=THREE.FontUtils.b3(n,cpx0,cpx1,cpx2,g),n=THREE.FontUtils.b3(n,cpy0,cpy1,cpy2,h),a.push(new THREE.Vector2(t,n))}}}return j.ha*e}}};
+(function(a){var b=function(a){for(var b=a.length,f=0,g=b-1,h=0;h<b;g=h++)f+=a[g].x*a[h].y-a[h].x*a[g].y;return f*0.5};a.Triangulate=function(a,e){var f=[],g=a.length;if(g<3)return null;var h=[],k=[],j;if(0<b(a))for(j=0;j<g;j++)h[j]=j;else for(j=0;j<g;j++)h[j]=g-1-j;var l=2*g,m;m=0;for(j=g-1;g>2;){if(0>=l--)return console.log("Warning, unable to triangulate polygon!"),null;var n=j;g<=n&&(n=0);j=n+1;g<=j&&(j=0);var t=j+1;g<=t&&(t=0);var p;a:{p=a;var u=n,v=j,w=t,B=g,z=h,o=void 0,A=void 0,C=void 0,F=
+void 0,G=void 0,H=void 0,I=void 0,E=void 0,M=void 0,A=p[z[u]].x,C=p[z[u]].y,F=p[z[v]].x,G=p[z[v]].y,H=p[z[w]].x,I=p[z[w]].y;if(1.0E-10>(F-A)*(I-C)-(G-C)*(H-A))p=!1;else{for(o=0;o<B;o++)if(!(o==u||o==v||o==w)){var E=p[z[o]].x,M=p[z[o]].y,K=void 0,N=void 0,L=void 0,O=void 0,D=void 0,J=void 0,P=void 0,Q=void 0,S=void 0,T=void 0,U=void 0,V=void 0,K=L=D=void 0,K=H-F,N=I-G,L=A-H,O=C-I,D=F-A,J=G-C,P=E-A,Q=M-C,S=E-F,T=M-G,U=E-H,V=M-I,K=K*T-N*S,D=D*Q-J*P,L=L*V-O*U;if(K>=0&&L>=0&&D>=0){p=!1;break a}}p=!0}}if(p){l=
+h[n];p=h[j];u=h[t];f.push(a[l]);f.push(a[p]);f.push(a[u]);k.push([h[n],h[j],h[t]]);m++;n=j;for(t=j+1;t<g;n++,t++)h[n]=h[t];g--;l=2*g}}if(e)return k;return f};a.Triangulate.area=b;return a})(THREE.FontUtils);window._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
+THREE.Loader.prototype={addStatusElement:function(){var a=document.createElement("div");a.style.position="absolute";a.style.right="0px";a.style.top="0px";a.style.fontSize="0.8em";a.style.textAlign="left";a.style.background="rgba(0,0,0,0.25)";a.style.color="#fff";a.style.width="120px";a.style.padding="0.5em 0.5em 0.5em 0.5em";a.style.zIndex=1E3;a.innerHTML="Loading ...";return a},updateProgress:function(a){var b="Loaded ";b+=a.total?(100*a.loaded/a.total).toFixed(0)+"%":(a.loaded/1E3).toFixed(2)+" KB";
+this.statusDomElement.innerHTML=b},extractUrlbase:function(a){a=a.split("/");a.pop();return a.join("/")},init_materials:function(a,b,c){a.materials=[];for(var e=0;e<b.length;++e)a.materials[e]=[THREE.Loader.prototype.createMaterial(b[e],c)]},createMaterial:function(a,b){function c(a){a=Math.log(a)/Math.LN2;return Math.floor(a)==a}function e(a,b){var e=new Image;e.onload=function(){if(!c(this.width)||!c(this.height)){var b=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),e=Math.pow(2,Math.round(Math.log(this.height)/
+Math.LN2));a.image.width=b;a.image.height=e;a.image.getContext("2d").drawImage(this,0,0,b,e)}else a.image=this;a.needsUpdate=!0};e.src=b}var f,g,h;f="MeshLambertMaterial";g={color:15658734,opacity:1,map:null,lightMap:null,wireframe:a.wireframe};a.shading&&(a.shading=="Phong"?f="MeshPhongMaterial":a.shading=="Basic"&&(f="MeshBasicMaterial"));if(a.blending)if(a.blending=="Additive")g.blending=THREE.AdditiveBlending;else if(a.blending=="Subtractive")g.blending=THREE.SubtractiveBlending;else if(a.blending==
+"Multiply")g.blending=THREE.MultiplyBlending;if(a.transparent!==void 0||a.opacity<1)g.transparent=a.transparent;if(a.depthTest!==void 0)g.depthTest=a.depthTest;if(a.vertexColors!==void 0)if(a.vertexColors=="face")g.vertexColors=THREE.FaceColors;else if(a.vertexColors)g.vertexColors=THREE.VertexColors;if(a.mapDiffuse&&b)h=document.createElement("canvas"),g.map=new THREE.Texture(h),g.map.sourceFile=a.mapDiffuse,e(g.map,b+"/"+a.mapDiffuse);else if(a.colorDiffuse)h=(a.colorDiffuse[0]*255<<16)+(a.colorDiffuse[1]*
+255<<8)+a.colorDiffuse[2]*255,g.color=h,g.opacity=a.transparency;else if(a.DbgColor)g.color=a.DbgColor;if(a.mapLightmap&&b)h=document.createElement("canvas"),g.lightMap=new THREE.Texture(h),g.lightMap.sourceFile=a.mapLightmap,e(g.lightMap,b+"/"+a.mapLightmap);return new THREE[f](g)}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;
+THREE.JSONLoader.prototype.load=function(a){var b=this,c=a.model,e=a.callback,f=a.texture_path?a.texture_path:this.extractUrlbase(c),a=new Worker(c);a.onmessage=function(a){b.createModel(a.data,e,f);b.onLoadComplete()};this.onLoadStart();a.postMessage((new Date).getTime())};
+THREE.JSONLoader.prototype.createModel=function(a,b,c){var e=new THREE.Geometry,f=a.scale!==void 0?1/a.scale:1;this.init_materials(e,a.materials,c);(function(c){if(a.version===void 0||a.version!=2)console.error("Deprecated file format.");else{var b,f,j,l,m,n,t,p,u,v,w,B,z,o,A=a.faces;n=a.vertices;var C=a.normals,F=a.colors,G=0;for(b=0;b<a.uvs.length;b++)a.uvs[b].length&&G++;for(b=0;b<G;b++)e.faceUvs[b]=[],e.faceVertexUvs[b]=[];l=0;for(m=n.length;l<m;)t=new THREE.Vertex,t.position.x=n[l++]*c,t.position.y=
+n[l++]*c,t.position.z=n[l++]*c,e.vertices.push(t);l=0;for(m=A.length;l<m;){c=A[l++];n=c&1;j=c&2;b=c&4;f=c&8;p=c&16;t=c&32;v=c&64;c&=128;n?(w=new THREE.Face4,w.a=A[l++],w.b=A[l++],w.c=A[l++],w.d=A[l++],n=4):(w=new THREE.Face3,w.a=A[l++],w.b=A[l++],w.c=A[l++],n=3);if(j)j=A[l++],w.materials=e.materials[j];j=e.faces.length;if(b)for(b=0;b<G;b++)B=a.uvs[b],u=A[l++],o=B[u*2],u=B[u*2+1],e.faceUvs[b][j]=new THREE.UV(o,u);if(f)for(b=0;b<G;b++){B=a.uvs[b];z=[];for(f=0;f<n;f++)u=A[l++],o=B[u*2],u=B[u*2+1],z[f]=
+new THREE.UV(o,u);e.faceVertexUvs[b][j]=z}if(p)p=A[l++]*3,f=new THREE.Vector3,f.x=C[p++],f.y=C[p++],f.z=C[p],w.normal=f;if(t)for(b=0;b<n;b++)p=A[l++]*3,f=new THREE.Vector3,f.x=C[p++],f.y=C[p++],f.z=C[p],w.vertexNormals.push(f);if(v)t=A[l++],t=new THREE.Color(F[t]),w.color=t;if(c)for(b=0;b<n;b++)t=A[l++],t=new THREE.Color(F[t]),w.vertexColors.push(t);e.faces.push(w)}}})(f);(function(){var c,b,f,j;if(a.skinWeights){c=0;for(b=a.skinWeights.length;c<b;c+=2)f=a.skinWeights[c],j=a.skinWeights[c+1],e.skinWeights.push(new THREE.Vector4(f,
+j,0,0))}if(a.skinIndices){c=0;for(b=a.skinIndices.length;c<b;c+=2)f=a.skinIndices[c],j=a.skinIndices[c+1],e.skinIndices.push(new THREE.Vector4(f,j,0,0))}e.bones=a.bones;e.animation=a.animation})();(function(c){if(a.morphTargets!==void 0){var b,f,j,l,m,n,t,p,u;b=0;for(f=a.morphTargets.length;b<f;b++){e.morphTargets[b]={};e.morphTargets[b].name=a.morphTargets[b].name;e.morphTargets[b].vertices=[];p=e.morphTargets[b].vertices;u=a.morphTargets[b].vertices;j=0;for(l=u.length;j<l;j+=3)m=u[j]*c,n=u[j+1]*
+c,t=u[j+2]*c,p.push(new THREE.Vertex(new THREE.Vector3(m,n,t)))}}if(a.morphColors!==void 0){b=0;for(f=a.morphColors.length;b<f;b++){e.morphColors[b]={};e.morphColors[b].name=a.morphColors[b].name;e.morphColors[b].colors=[];l=e.morphColors[b].colors;m=a.morphColors[b].colors;c=0;for(j=m.length;c<j;c+=3)n=new THREE.Color(16755200),n.setRGB(m[c],m[c+1],m[c+2]),l.push(n)}}})(f);(function(){if(a.edges!==void 0){var c,b,f;for(c=0;c<a.edges.length;c+=2)b=a.edges[c],f=a.edges[c+1],e.edges.push(new THREE.Edge(e.vertices[b],
+e.vertices[f],b,f))}})();e.computeCentroids();e.computeFaceNormals();b(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){var b=a.model,c=a.callback,e=a.texture_path?a.texture_path:THREE.Loader.prototype.extractUrlbase(b),f=a.bin_path?a.bin_path:THREE.Loader.prototype.extractUrlbase(b),a=(new Date).getTime(),b=new Worker(b),g=this.showProgress?THREE.Loader.prototype.updateProgress:null;b.onmessage=function(a){THREE.BinaryLoader.prototype.loadAjaxBuffers(a.data.buffers,a.data.materials,c,f,e,g)};b.onerror=function(a){alert("worker.onerror: "+a.message+"\n"+a.data);a.preventDefault()};
+b.postMessage(a)},loadAjaxBuffers:function(a,b,c,e,f,g){var h=new XMLHttpRequest,k=e+"/"+a,j=0;h.onreadystatechange=function(){h.readyState==4?h.status==200||h.status==0?THREE.BinaryLoader.prototype.createBinModel(h.responseText,c,f,b):alert("Couldn't load ["+k+"] ["+h.status+"]"):h.readyState==3?g&&(j==0&&(j=h.getResponseHeader("Content-Length")),g({total:j,loaded:h.responseText.length})):h.readyState==2&&(j=h.getResponseHeader("Content-Length"))};h.open("GET",k,!0);h.overrideMimeType("text/plain; charset=x-user-defined");
+h.setRequestHeader("Content-Type","text/plain");h.send(null)},createBinModel:function(a,b,c,e){var f=function(c){function b(a,c){var e=m(a,c),f=m(a,c+1),g=m(a,c+2),h=m(a,c+3),j=(h<<1&255|g>>7)-127;e|=(g&127)<<16|f<<8;if(e==0&&j==-127)return 0;return(1-2*(h>>7))*(1+e*Math.pow(2,-23))*Math.pow(2,j)}function f(a,c){var b=m(a,c),e=m(a,c+1),g=m(a,c+2);return(m(a,c+3)<<24)+(g<<16)+(e<<8)+b}function j(a,c){var b=m(a,c);return(m(a,c+1)<<8)+b}function l(a,c){var b=m(a,c);return b>127?b-256:b}function m(a,
+c){return a.charCodeAt(c)&255}function n(c){var b,e,g;b=f(a,c);e=f(a,c+F);g=f(a,c+G);c=j(a,c+H);THREE.BinaryLoader.prototype.f3(B,b,e,g,c)}function t(c){var b,e,g,h,l,m;b=f(a,c);e=f(a,c+F);g=f(a,c+G);h=j(a,c+H);l=f(a,c+I);m=f(a,c+E);c=f(a,c+M);THREE.BinaryLoader.prototype.f3n(B,A,b,e,g,h,l,m,c)}function p(c){var b,e,g,h;b=f(a,c);e=f(a,c+K);g=f(a,c+N);h=f(a,c+L);c=j(a,c+O);THREE.BinaryLoader.prototype.f4(B,b,e,g,h,c)}function u(c){var b,e,g,h,l,m,n,o;b=f(a,c);e=f(a,c+K);g=f(a,c+N);h=f(a,c+L);l=j(a,
+c+O);m=f(a,c+D);n=f(a,c+J);o=f(a,c+P);c=f(a,c+Q);THREE.BinaryLoader.prototype.f4n(B,A,b,e,g,h,l,m,n,o,c)}function v(c){var b,e;b=f(a,c);e=f(a,c+S);c=f(a,c+T);THREE.BinaryLoader.prototype.uv3(B.faceVertexUvs[0],C[b*2],C[b*2+1],C[e*2],C[e*2+1],C[c*2],C[c*2+1])}function w(c){var b,e,g;b=f(a,c);e=f(a,c+U);g=f(a,c+V);c=f(a,c+aa);THREE.BinaryLoader.prototype.uv4(B.faceVertexUvs[0],C[b*2],C[b*2+1],C[e*2],C[e*2+1],C[g*2],C[g*2+1],C[c*2],C[c*2+1])}var B=this,z=0,o,A=[],C=[],F,G,H,I,E,M,K,N,L,O,D,J,P,Q,S,T,
+U,V,aa,W,X,Y,Z,$,R;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(B,e,c);o={signature:a.substr(z,8),header_bytes:m(a,z+8),vertex_coordinate_bytes:m(a,z+9),normal_coordinate_bytes:m(a,z+10),uv_coordinate_bytes:m(a,z+11),vertex_index_bytes:m(a,z+12),normal_index_bytes:m(a,z+13),uv_index_bytes:m(a,z+14),material_index_bytes:m(a,z+15),nvertices:f(a,z+16),nnormals:f(a,z+16+4),nuvs:f(a,z+16+8),ntri_flat:f(a,z+16+12),ntri_smooth:f(a,z+16+16),ntri_flat_uv:f(a,z+16+20),ntri_smooth_uv:f(a,
+z+16+24),nquad_flat:f(a,z+16+28),nquad_smooth:f(a,z+16+32),nquad_flat_uv:f(a,z+16+36),nquad_smooth_uv:f(a,z+16+40)};z+=o.header_bytes;F=o.vertex_index_bytes;G=o.vertex_index_bytes*2;H=o.vertex_index_bytes*3;I=o.vertex_index_bytes*3+o.material_index_bytes;E=o.vertex_index_bytes*3+o.material_index_bytes+o.normal_index_bytes;M=o.vertex_index_bytes*3+o.material_index_bytes+o.normal_index_bytes*2;K=o.vertex_index_bytes;N=o.vertex_index_bytes*2;L=o.vertex_index_bytes*3;O=o.vertex_index_bytes*4;D=o.vertex_index_bytes*
+4+o.material_index_bytes;J=o.vertex_index_bytes*4+o.material_index_bytes+o.normal_index_bytes;P=o.vertex_index_bytes*4+o.material_index_bytes+o.normal_index_bytes*2;Q=o.vertex_index_bytes*4+o.material_index_bytes+o.normal_index_bytes*3;S=o.uv_index_bytes;T=o.uv_index_bytes*2;U=o.uv_index_bytes;V=o.uv_index_bytes*2;aa=o.uv_index_bytes*3;c=o.vertex_index_bytes*3+o.material_index_bytes;R=o.vertex_index_bytes*4+o.material_index_bytes;W=o.ntri_flat*c;X=o.ntri_smooth*(c+o.normal_index_bytes*3);Y=o.ntri_flat_uv*
+(c+o.uv_index_bytes*3);Z=o.ntri_smooth_uv*(c+o.normal_index_bytes*3+o.uv_index_bytes*3);$=o.nquad_flat*R;c=o.nquad_smooth*(R+o.normal_index_bytes*4);R=o.nquad_flat_uv*(R+o.uv_index_bytes*4);z+=function(c){for(var e,f,g,j=o.vertex_coordinate_bytes*3,k=c+o.nvertices*j;c<k;c+=j)e=b(a,c),f=b(a,c+o.vertex_coordinate_bytes),g=b(a,c+o.vertex_coordinate_bytes*2),THREE.BinaryLoader.prototype.v(B,e,f,g);return o.nvertices*j}(z);z+=function(c){for(var b,e,f,g=o.normal_coordinate_bytes*3,h=c+o.nnormals*g;c<h;c+=
+g)b=l(a,c),e=l(a,c+o.normal_coordinate_bytes),f=l(a,c+o.normal_coordinate_bytes*2),A.push(b/127,e/127,f/127);return o.nnormals*g}(z);z+=function(c){for(var e,f,g=o.uv_coordinate_bytes*2,j=c+o.nuvs*g;c<j;c+=g)e=b(a,c),f=b(a,c+o.uv_coordinate_bytes),C.push(e,f);return o.nuvs*g}(z);W=z+W;X=W+X;Y=X+Y;Z=Y+Z;$=Z+$;c=$+c;R=c+R;(function(a){var c,b=o.vertex_index_bytes*3+o.material_index_bytes,e=b+o.uv_index_bytes*3,f=a+o.ntri_flat_uv*e;for(c=a;c<f;c+=e)n(c),v(c+b);return f-a})(X);(function(a){var c,b=o.vertex_index_bytes*
+3+o.material_index_bytes+o.normal_index_bytes*3,e=b+o.uv_index_bytes*3,f=a+o.ntri_smooth_uv*e;for(c=a;c<f;c+=e)t(c),v(c+b);return f-a})(Y);(function(a){var c,b=o.vertex_index_bytes*4+o.material_index_bytes,e=b+o.uv_index_bytes*4,f=a+o.nquad_flat_uv*e;for(c=a;c<f;c+=e)p(c),w(c+b);return f-a})(c);(function(a){var c,b=o.vertex_index_bytes*4+o.material_index_bytes+o.normal_index_bytes*4,e=b+o.uv_index_bytes*4,f=a+o.nquad_smooth_uv*e;for(c=a;c<f;c+=e)u(c),w(c+b);return f-a})(R);(function(a){var c,b=o.vertex_index_bytes*
+3+o.material_index_bytes,e=a+o.ntri_flat*b;for(c=a;c<e;c+=b)n(c);return e-a})(z);(function(a){var c,b=o.vertex_index_bytes*3+o.material_index_bytes+o.normal_index_bytes*3,e=a+o.ntri_smooth*b;for(c=a;c<e;c+=b)t(c);return e-a})(W);(function(a){var c,b=o.vertex_index_bytes*4+o.material_index_bytes,e=a+o.nquad_flat*b;for(c=a;c<e;c+=b)p(c);return e-a})(Z);(function(a){var c,b=o.vertex_index_bytes*4+o.material_index_bytes+o.normal_index_bytes*4,e=a+o.nquad_smooth*b;for(c=a;c<e;c+=b)u(c);return e-a})($);
+this.computeCentroids();this.computeFaceNormals()};f.prototype=new THREE.Geometry;f.prototype.constructor=f;b(new f(c))},v:function(a,b,c,e){a.vertices.push(new THREE.Vertex(new THREE.Vector3(b,c,e)))},f3:function(a,b,c,e,f){a.faces.push(new THREE.Face3(b,c,e,null,null,a.materials[f]))},f4:function(a,b,c,e,f,g){a.faces.push(new THREE.Face4(b,c,e,f,null,null,a.materials[g]))},f3n:function(a,b,c,e,f,g,h,k,j){var g=a.materials[g],l=b[k*3],m=b[k*3+1],k=b[k*3+2],n=b[j*3],t=b[j*3+1],j=b[j*3+2];a.faces.push(new THREE.Face3(c,
+e,f,[new THREE.Vector3(b[h*3],b[h*3+1],b[h*3+2]),new THREE.Vector3(l,m,k),new THREE.Vector3(n,t,j)],null,g))},f4n:function(a,b,c,e,f,g,h,k,j,l,m){var h=a.materials[h],n=b[j*3],t=b[j*3+1],j=b[j*3+2],p=b[l*3],u=b[l*3+1],l=b[l*3+2],v=b[m*3],w=b[m*3+1],m=b[m*3+2];a.faces.push(new THREE.Face4(c,e,f,g,[new THREE.Vector3(b[k*3],b[k*3+1],b[k*3+2]),new THREE.Vector3(n,t,j),new THREE.Vector3(p,u,l),new THREE.Vector3(v,w,m)],null,h))},uv3:function(a,b,c,e,f,g,h){var k=[];k.push(new THREE.UV(b,c));k.push(new THREE.UV(e,
+f));k.push(new THREE.UV(g,h));a.push(k)},uv4:function(a,b,c,e,f,g,h,k,j){var l=[];l.push(new THREE.UV(b,c));l.push(new THREE.UV(e,f));l.push(new THREE.UV(g,h));l.push(new THREE.UV(k,j));a.push(l)}};THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};
+THREE.SceneLoader.prototype={load:function(a,b){var c=this,e=new Worker(a);e.postMessage(0);var f=THREE.Loader.prototype.extractUrlbase(a);e.onmessage=function(a){function e(a,c){return c=="relativeToHTML"?a:f+"/"+a}function k(){for(p in E.objects)if(!D.objects[p])if(z=E.objects[p],z.geometry!==void 0){if(F=D.geometries[z.geometry]){I=[];for(Q=0;Q<z.materials.length;Q++)I[Q]=D.materials[z.materials[Q]];o=z.position;r=z.rotation;q=z.quaternion;s=z.scale;q=0;I.length==0&&(I[0]=new THREE.MeshFaceMaterial);
+I.length>1&&(I=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(F,I);object.name=p;object.position.set(o[0],o[1],o[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=z.visible;D.scene.addObject(object);D.objects[p]=object;if(z.meshCollider){var a=THREE.CollisionUtils.MeshColliderWBox(object);D.scene.collisions.colliders.push(a)}if(z.castsShadow)a=new THREE.ShadowVolume(F),D.scene.addChild(a),
+a.position=object.position,a.rotation=object.rotation,a.scale=object.scale;z.trigger&&z.trigger.toLowerCase()!="none"&&(a={type:z.trigger,object:z},D.triggers[object.name]=a)}}else o=z.position,r=z.rotation,q=z.quaternion,s=z.scale,q=0,object=new THREE.Object3D,object.name=p,object.position.set(o[0],o[1],o[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=z.visible!==void 0?z.visible:!1,D.scene.addObject(object),
+D.objects[p]=object,D.empties[p]=object,z.trigger&&z.trigger.toLowerCase()!="none"&&(a={type:z.trigger,object:z},D.triggers[object.name]=a)}function j(a){return function(b){D.geometries[a]=b;k();K-=1;c.onLoadComplete();m()}}function l(a){return function(c){D.geometries[a]=c}}function m(){c.callbackProgress({totalModels:L,totalTextures:O,loadedModels:L-K,loadedTextures:O-N},D);c.onLoadProgress();K==0&&N==0&&b(D)}var n,t,p,u,v,w,B,z,o,A,C,F,G,H,I,E,M,K,N,L,O,D;E=a.data;a=new THREE.BinaryLoader;M=new THREE.JSONLoader;
+N=K=0;D={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};var J=!1;for(p in E.objects)if(z=E.objects[p],z.meshCollider){J=!0;break}if(J)D.scene.collisions=new THREE.CollisionSystem;if(E.transform){J=E.transform.position;A=E.transform.rotation;var P=E.transform.scale;J&&D.scene.position.set(J[0],J[1],J[2]);A&&D.scene.rotation.set(A[0],A[1],A[2]);P&&D.scene.scale.set(P[0],P[1],P[2]);(J||A||P)&&D.scene.updateMatrix()}J=function(){N-=
+1;m();c.onLoadComplete()};for(v in E.cameras){A=E.cameras[v];if(A.type=="perspective")G=new THREE.Camera(A.fov,A.aspect,A.near,A.far);else if(A.type=="ortho")G=new THREE.Camera,G.projectionMatrix=THREE.Matrix4.makeOrtho(A.left,A.right,A.top,A.bottom,A.near,A.far);o=A.position;A=A.target;G.position.set(o[0],o[1],o[2]);G.target.position.set(A[0],A[1],A[2]);D.cameras[v]=G}for(u in E.lights){v=E.lights[u];G=v.color!==void 0?v.color:16777215;A=v.intensity!==void 0?v.intensity:1;if(v.type=="directional")o=
+v.direction,light=new THREE.DirectionalLight(G,A),light.position.set(o[0],o[1],o[2]),light.position.normalize();else if(v.type=="point")o=v.position,light=new THREE.PointLight(G,A),light.position.set(o[0],o[1],o[2]);D.scene.addLight(light);D.lights[u]=light}for(w in E.fogs)u=E.fogs[w],u.type=="linear"?H=new THREE.Fog(0,u.near,u.far):u.type=="exp2"&&(H=new THREE.FogExp2(0,u.density)),A=u.color,H.color.setRGB(A[0],A[1],A[2]),D.fogs[w]=H;if(D.cameras&&E.defaults.camera)D.currentCamera=D.cameras[E.defaults.camera];
+if(D.fogs&&E.defaults.fog)D.scene.fog=D.fogs[E.defaults.fog];A=E.defaults.bgcolor;D.bgColor=new THREE.Color;D.bgColor.setRGB(A[0],A[1],A[2]);D.bgColorAlpha=E.defaults.bgalpha;for(n in E.geometries)if(w=E.geometries[n],w.type=="bin_mesh"||w.type=="ascii_mesh")K+=1,c.onLoadStart();L=K;for(n in E.geometries)w=E.geometries[n],w.type=="cube"?(F=new THREE.Cube(w.width,w.height,w.depth,w.segmentsWidth,w.segmentsHeight,w.segmentsDepth,null,w.flipped,w.sides),D.geometries[n]=F):w.type=="plane"?(F=new THREE.Plane(w.width,
+w.height,w.segmentsWidth,w.segmentsHeight),D.geometries[n]=F):w.type=="sphere"?(F=new THREE.Sphere(w.radius,w.segmentsWidth,w.segmentsHeight),D.geometries[n]=F):w.type=="cylinder"?(F=new THREE.Cylinder(w.numSegs,w.topRad,w.botRad,w.height,w.topOffset,w.botOffset),D.geometries[n]=F):w.type=="torus"?(F=new THREE.Torus(w.radius,w.tube,w.segmentsR,w.segmentsT),D.geometries[n]=F):w.type=="icosahedron"?(F=new THREE.Icosahedron(w.subdivisions),D.geometries[n]=F):w.type=="bin_mesh"?a.load({model:e(w.url,
+E.urlBaseType),callback:j(n)}):w.type=="ascii_mesh"?M.load({model:e(w.url,E.urlBaseType),callback:j(n)}):w.type=="embedded_mesh"&&(w=E.embeds[w.id])&&M.createModel(w,l(n),"");for(B in E.textures)if(n=E.textures[B],n.url instanceof Array){N+=n.url.length;for(a=0;a<n.url.length;a++)c.onLoadStart()}else N+=1,c.onLoadStart();O=N;for(B in E.textures){n=E.textures[B];if(n.mapping!=void 0&&THREE[n.mapping]!=void 0)n.mapping=new THREE[n.mapping];if(n.url instanceof Array){for(var a=[],Q=0;Q<n.url.length;Q++)a[Q]=
+e(n.url[Q],E.urlBaseType);a=THREE.ImageUtils.loadTextureCube(a,n.mapping,J)}else{a=THREE.ImageUtils.loadTexture(e(n.url,E.urlBaseType),n.mapping,J);if(THREE[n.minFilter]!=void 0)a.minFilter=THREE[n.minFilter];if(THREE[n.magFilter]!=void 0)a.magFilter=THREE[n.magFilter]}D.textures[B]=a}for(t in E.materials){B=E.materials[t];for(C in B.parameters)if(C=="envMap"||C=="map"||C=="lightMap")B.parameters[C]=D.textures[B.parameters[C]];else if(C=="shading")B.parameters[C]=B.parameters[C]=="flat"?THREE.FlatShading:
+THREE.SmoothShading;else if(C=="blending")B.parameters[C]=THREE[B.parameters[C]]?THREE[B.parameters[C]]:THREE.NormalBlending;else if(C=="combine")B.parameters[C]=B.parameters[C]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(C=="vertexColors")if(B.parameters[C]=="face")B.parameters[C]=THREE.FaceColors;else if(B.parameters[C])B.parameters[C]=THREE.VertexColors;if(B.parameters.opacity!==void 0&&B.parameters.opacity<1)B.parameters.transparent=!0;B=new THREE[B.type](B.parameters);
+D.materials[t]=B}k();c.callbackSync(D)}}};
+THREE.MarchingCubes=function(a,b){THREE.Object3D.call(this);this.materials=b instanceof Array?b:[b];this.init=function(a){this.isolation=80;this.size=a;this.size2=this.size*this.size;this.size3=this.size2*this.size;this.halfsize=this.size/2;this.delta=2/this.size;this.yd=this.size;this.zd=this.size2;this.field=new Float32Array(this.size3);this.normal_cache=new Float32Array(this.size3*3);this.vlist=new Float32Array(36);this.nlist=new Float32Array(36);this.firstDraw=!0;this.maxCount=4096;this.count=
+0;this.hasNormal=this.hasPos=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(a,b,f){return a+(b-a)*f};this.VIntX=function(a,b,f,g,h,k,j,l,m,n){h=(h-m)/(n-m);m=this.normal_cache;b[g]=k+h*this.delta;b[g+1]=j;b[g+2]=l;f[g]=this.lerp(m[a],m[a+3],h);f[g+1]=this.lerp(m[a+1],m[a+4],h);f[g+2]=this.lerp(m[a+2],m[a+5],h)};this.VIntY=function(a,b,f,g,h,k,j,l,m,n){h=(h-m)/(n-m);m=this.normal_cache;b[g]=k;b[g+1]=j+h*this.delta;b[g+
+2]=l;b=a+this.yd*3;f[g]=this.lerp(m[a],m[b],h);f[g+1]=this.lerp(m[a+1],m[b+1],h);f[g+2]=this.lerp(m[a+2],m[b+2],h)};this.VIntZ=function(a,b,f,g,h,k,j,l,m,n){h=(h-m)/(n-m);m=this.normal_cache;b[g]=k;b[g+1]=j;b[g+2]=l+h*this.delta;b=a+this.zd*3;f[g]=this.lerp(m[a],m[b],h);f[g+1]=this.lerp(m[a+1],m[b+1],h);f[g+2]=this.lerp(m[a+2],m[b+2],h)};this.compNorm=function(a){var b=a*3;this.normal_cache[b]==0&&(this.normal_cache[b]=this.field[a-1]-this.field[a+1],this.normal_cache[b+1]=this.field[a-this.yd]-this.field[a+
+this.yd],this.normal_cache[b+2]=this.field[a-this.zd]-this.field[a+this.zd])};this.polygonize=function(a,b,f,g,h,k){var j=g+1,l=g+this.yd,m=g+this.zd,n=j+this.yd,t=j+this.zd,p=g+this.yd+this.zd,u=j+this.yd+this.zd,v=0,w=this.field[g],B=this.field[j],z=this.field[l],o=this.field[n],A=this.field[m],C=this.field[t],F=this.field[p],G=this.field[u];w<h&&(v|=1);B<h&&(v|=2);z<h&&(v|=8);o<h&&(v|=4);A<h&&(v|=16);C<h&&(v|=32);F<h&&(v|=128);G<h&&(v|=64);var H=THREE.edgeTable[v];if(H==0)return 0;var I=this.delta,
+E=a+I,M=b+I,I=f+I;H&1&&(this.compNorm(g),this.compNorm(j),this.VIntX(g*3,this.vlist,this.nlist,0,h,a,b,f,w,B));H&2&&(this.compNorm(j),this.compNorm(n),this.VIntY(j*3,this.vlist,this.nlist,3,h,E,b,f,B,o));H&4&&(this.compNorm(l),this.compNorm(n),this.VIntX(l*3,this.vlist,this.nlist,6,h,a,M,f,z,o));H&8&&(this.compNorm(g),this.compNorm(l),this.VIntY(g*3,this.vlist,this.nlist,9,h,a,b,f,w,z));H&16&&(this.compNorm(m),this.compNorm(t),this.VIntX(m*3,this.vlist,this.nlist,12,h,a,b,I,A,C));H&32&&(this.compNorm(t),
+this.compNorm(u),this.VIntY(t*3,this.vlist,this.nlist,15,h,E,b,I,C,G));H&64&&(this.compNorm(p),this.compNorm(u),this.VIntX(p*3,this.vlist,this.nlist,18,h,a,M,I,F,G));H&128&&(this.compNorm(m),this.compNorm(p),this.VIntY(m*3,this.vlist,this.nlist,21,h,a,b,I,A,F));H&256&&(this.compNorm(g),this.compNorm(m),this.VIntZ(g*3,this.vlist,this.nlist,24,h,a,b,f,w,A));H&512&&(this.compNorm(j),this.compNorm(t),this.VIntZ(j*3,this.vlist,this.nlist,27,h,E,b,f,B,C));H&1024&&(this.compNorm(n),this.compNorm(u),this.VIntZ(n*
+3,this.vlist,this.nlist,30,h,E,M,f,o,G));H&2048&&(this.compNorm(l),this.compNorm(p),this.VIntZ(l*3,this.vlist,this.nlist,33,h,a,M,f,z,F));v<<=4;for(h=g=0;THREE.triTable[v+h]!=-1;)a=v+h,b=a+1,f=a+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[a],3*THREE.triTable[b],3*THREE.triTable[f],k),h+=3,g++;return g};this.posnormtriv=function(a,b,f,g,h,k){var j=this.count*3;this.positionArray[j]=a[f];this.positionArray[j+1]=a[f+1];this.positionArray[j+2]=a[f+2];this.positionArray[j+3]=a[g];this.positionArray[j+
+4]=a[g+1];this.positionArray[j+5]=a[g+2];this.positionArray[j+6]=a[h];this.positionArray[j+7]=a[h+1];this.positionArray[j+8]=a[h+2];this.normalArray[j]=b[f];this.normalArray[j+1]=b[f+1];this.normalArray[j+2]=b[f+2];this.normalArray[j+3]=b[g];this.normalArray[j+4]=b[g+1];this.normalArray[j+5]=b[g+2];this.normalArray[j+6]=b[h];this.normalArray[j+7]=b[h+1];this.normalArray[j+8]=b[h+2];this.hasNormal=this.hasPos=!0;this.count+=3;this.count>=this.maxCount-3&&k(this)};this.begin=function(){this.count=0;
+this.hasNormal=this.hasPos=!1};this.end=function(a){if(this.count!=0){for(var b=this.count*3;b<this.positionArray.length;b++)this.positionArray[b]=0;a(this)}};this.addBall=function(a,b,f,g,h){var k=this.size*Math.sqrt(g/h),j=f*this.size,l=b*this.size,m=a*this.size,n=Math.floor(j-k);n<1&&(n=1);j=Math.floor(j+k);j>this.size-1&&(j=this.size-1);var t=Math.floor(l-k);t<1&&(t=1);l=Math.floor(l+k);l>this.size-1&&(l=this.size-1);var p=Math.floor(m-k);p<1&&(p=1);k=Math.floor(m+k);k>this.size-1&&(k=this.size-
+1);for(var u,v,w,B,z,o;n<j;n++){m=this.size2*n;v=n/this.size-f;z=v*v;for(v=t;v<l;v++){w=m+this.size*v;u=v/this.size-b;o=u*u;for(u=p;u<k;u++)B=u/this.size-a,B=g/(1.0E-6+B*B+o+z)-h,B>0&&(this.field[w+u]+=B)}}};this.addPlaneX=function(a,b){var f,g,h,k,j,l=this.size,m=this.yd,n=this.zd,t=this.field,p=l*Math.sqrt(a/b);p>l&&(p=l);for(f=0;f<p;f++)if(g=f/l,g*=g,k=a/(1.0E-4+g)-b,k>0)for(g=0;g<l;g++){j=f+g*m;for(h=0;h<l;h++)t[n*h+j]+=k}};this.addPlaneY=function(a,b){var f,g,h,k,j,l,m=this.size,n=this.yd,t=
+this.zd,p=this.field,u=m*Math.sqrt(a/b);u>m&&(u=m);for(g=0;g<u;g++)if(f=g/m,f*=f,k=a/(1.0E-4+f)-b,k>0){j=g*n;for(f=0;f<m;f++){l=j+f;for(h=0;h<m;h++)p[t*h+l]+=k}}};this.addPlaneZ=function(a,b){var f,g,h,k,j,l;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(a/b);dist>size&&(dist=size);for(h=0;h<dist;h++)if(f=h/size,f*=f,k=a/(1.0E-4+f)-b,k>0){j=zd*h;for(g=0;g<size;g++){l=j+g*yd;for(f=0;f<size;f++)field[l+f]+=k}}};this.reset=function(){var a;for(a=0;a<this.size3;a++)this.normal_cache[a*
+3]=0,this.field[a]=0};this.render=function(a){this.begin();var b,f,g,h,k,j,l,m,n,t=this.size-2;for(h=1;h<t;h++){n=this.size2*h;l=(h-this.halfsize)/this.halfsize;for(g=1;g<t;g++){m=n+this.size*g;j=(g-this.halfsize)/this.halfsize;for(f=1;f<t;f++)k=(f-this.halfsize)/this.halfsize,b=m+f,this.polygonize(k,j,l,b,this.isolation,a)}}this.end(a)};this.generateGeometry=function(){var a=0,b=new THREE.Geometry,f=[];this.render(function(g){var h,k,j,l,m,n,t,p;for(h=0;h<g.count;h++)t=h*3,m=t+1,p=t+2,k=g.positionArray[t],
+j=g.positionArray[m],l=g.positionArray[p],n=new THREE.Vector3(k,j,l),k=g.normalArray[t],j=g.normalArray[m],l=g.normalArray[p],t=new THREE.Vector3(k,j,l),t.normalize(),m=new THREE.Vertex(n),b.vertices.push(m),f.push(t);nfaces=g.count/3;for(h=0;h<nfaces;h++)t=(a+h)*3,m=t+1,p=t+2,n=f[t],k=f[m],j=f[p],t=new THREE.Face3(t,m,p,[n,k,j]),b.faces.push(t);a+=nfaces;g.count=0});return b};this.init(a)};THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
 THREE.edgeTable=new Int32Array([0,265,515,778,1030,1295,1541,1804,2060,2309,2575,2822,3082,3331,3593,3840,400,153,915,666,1430,1183,1941,1692,2460,2197,2975,2710,3482,3219,3993,3728,560,825,51,314,1590,1855,1077,1340,2620,2869,2111,2358,3642,3891,3129,3376,928,681,419,170,1958,1711,1445,1196,2988,2725,2479,2214,4010,3747,3497,3232,1120,1385,1635,1898,102,367,613,876,3180,3429,3695,3942,2154,2403,2665,2912,1520,1273,2035,1786,502,255,1013,764,3580,3317,4095,3830,2554,2291,3065,2800,1616,1881,1107,
 1370,598,863,85,348,3676,3925,3167,3414,2650,2899,2137,2384,1984,1737,1475,1226,966,719,453,204,4044,3781,3535,3270,3018,2755,2505,2240,2240,2505,2755,3018,3270,3535,3781,4044,204,453,719,966,1226,1475,1737,1984,2384,2137,2899,2650,3414,3167,3925,3676,348,85,863,598,1370,1107,1881,1616,2800,3065,2291,2554,3830,4095,3317,3580,764,1013,255,502,1786,2035,1273,1520,2912,2665,2403,2154,3942,3695,3429,3180,876,613,367,102,1898,1635,1385,1120,3232,3497,3747,4010,2214,2479,2725,2988,1196,1445,1711,1958,170,
 419,681,928,3376,3129,3891,3642,2358,2111,2869,2620,1340,1077,1855,1590,314,51,825,560,3728,3993,3219,3482,2710,2975,2197,2460,1692,1941,1183,1430,666,915,153,400,3840,3593,3331,3082,2822,2575,2309,2060,1804,1541,1295,1030,778,515,265,0]);
@@ -183,26 +196,26 @@ THREE.triTable=new Int32Array([-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0
 4,1,4,0,7,4,11,-1,-1,-1,-1,3,1,4,3,4,8,1,10,4,7,4,11,10,11,4,-1,4,11,7,9,11,4,9,2,11,9,1,2,-1,-1,-1,-1,9,7,4,9,11,7,9,1,11,2,11,1,0,8,3,-1,11,7,4,11,4,2,2,4,0,-1,-1,-1,-1,-1,-1,-1,11,7,4,11,4,2,8,3,4,3,2,4,-1,-1,-1,-1,2,9,10,2,7,9,2,3,7,7,4,9,-1,-1,-1,-1,9,10,7,9,7,4,10,2,7,8,7,0,2,0,7,-1,3,7,10,3,10,2,7,4,10,1,10,0,4,0,10,-1,1,10,2,8,7,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,9,1,4,1,7,7,1,3,-1,-1,-1,-1,-1,-1,-1,4,9,1,4,1,7,0,8,1,8,7,1,-1,-1,-1,-1,4,0,3,7,4,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,8,7,-1,-1,-1,
 -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,10,8,10,11,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,0,9,3,9,11,11,9,10,-1,-1,-1,-1,-1,-1,-1,0,1,10,0,10,8,8,10,11,-1,-1,-1,-1,-1,-1,-1,3,1,10,11,3,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,2,11,1,11,9,9,11,8,-1,-1,-1,-1,-1,-1,-1,3,0,9,3,9,11,1,2,9,2,11,9,-1,-1,-1,-1,0,2,11,8,0,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,2,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,3,8,2,8,10,10,8,9,-1,-1,-1,-1,-1,-1,-1,9,10,2,0,9,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,3,8,2,8,10,0,1,8,1,10,8,-1,-1,-1,-1,1,10,
 2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,3,8,9,1,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,9,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,3,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1]);
-THREE.Trident=function(a){function c(c){return new THREE.Mesh(new THREE.Cylinder(30,0.1,a.length/20,a.length/5),new THREE.MeshBasicMaterial({color:c}))}function b(a,c){var b=new THREE.Geometry;b.vertices=[new THREE.Vertex,new THREE.Vertex(a)];return new THREE.Line(b,new THREE.LineBasicMaterial({color:c}))}THREE.Object3D.call(this);var d=Math.PI/2,e,a=a||THREE.Trident.defaultParams;if(a!==THREE.Trident.defaultParams)for(e in THREE.Trident.defaultParams)a.hasOwnProperty(e)||(a[e]=THREE.Trident.defaultParams[e]);
-this.scale=new THREE.Vector3(a.scale,a.scale,a.scale);this.addChild(b(new THREE.Vector3(a.length,0,0),a.xAxisColor));this.addChild(b(new THREE.Vector3(0,a.length,0),a.yAxisColor));this.addChild(b(new THREE.Vector3(0,0,a.length),a.zAxisColor));if(a.showArrows)e=c(a.xAxisColor),e.rotation.y=-d,e.position.x=a.length,this.addChild(e),e=c(a.yAxisColor),e.rotation.x=d,e.position.y=a.length,this.addChild(e),e=c(a.zAxisColor),e.rotation.y=Math.PI,e.position.z=a.length,this.addChild(e)};
-THREE.Trident.prototype=new THREE.Object3D;THREE.Trident.prototype.constructor=THREE.Trident;THREE.Trident.defaultParams={xAxisColor:16711680,yAxisColor:65280,zAxisColor:255,showArrows:!0,length:100,scale: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){this.colliders=this.colliders.concat(a.colliders);this.hits=this.hits.concat(a.hits)};
-THREE.CollisionSystem.prototype.rayCastAll=function(a){a.direction.normalize();this.hits.length=0;var c,b,d,e,f=0;c=0;for(b=this.colliders.length;c<b;c++)if(e=this.colliders[c],d=this.rayCast(a,e),d<Number.MAX_VALUE)e.distance=d,d>f?this.hits.push(e):this.hits.unshift(e),f=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),d=Number.MAX_VALUE,e,f=0;f<c.numFaces;f++){var g=c.mesh.geometry.faces[f],j=c.mesh.geometry.vertices[g.a].position,h=c.mesh.geometry.vertices[g.b].position,l=c.mesh.geometry.vertices[g.c].position,k=g instanceof THREE.Face4?c.mesh.geometry.vertices[g.d].position:null;g instanceof THREE.Face3?(g=this.rayTriangle(b,j,h,l,d,this.collisionNormal),g<d&&(d=g,e=f,c.normal.copy(this.collisionNormal),c.normal.normalize())):
-g instanceof THREE.Face4&&(g=this.rayTriangle(b,j,h,k,d,this.collisionNormal),g<d&&(d=g,e=f,c.normal.copy(this.collisionNormal),c.normal.normalize()),g=this.rayTriangle(b,h,l,k,d,this.collisionNormal),g<d&&(d=g,e=f,c.normal.copy(this.collisionNormal),c.normal.normalize()))}return{dist:d,faceIndex:e}};
-THREE.CollisionSystem.prototype.rayTriangle=function(a,c,b,d,e,f){var g=THREE.CollisionSystem.__v1,j=THREE.CollisionSystem.__v2;f.set(0,0,0);g.sub(b,c);j.sub(d,b);f.cross(g,j);j=f.dot(a.direction);if(!(j<0))return Number.MAX_VALUE;g=f.dot(c)-f.dot(a.origin);if(!(g<=0))return Number.MAX_VALUE;if(!(g>=j*e))return Number.MAX_VALUE;g/=j;j=THREE.CollisionSystem.__v3;j.copy(a.direction);j.multiplyScalar(g);j.addSelf(a.origin);Math.abs(f.x)>Math.abs(f.y)?Math.abs(f.x)>Math.abs(f.z)?(a=j.y-c.y,f=b.y-c.y,
-e=d.y-c.y,j=j.z-c.z,b=b.z-c.z,d=d.z-c.z):(a=j.x-c.x,f=b.x-c.x,e=d.x-c.x,j=j.y-c.y,b=b.y-c.y,d=d.y-c.y):Math.abs(f.y)>Math.abs(f.z)?(a=j.x-c.x,f=b.x-c.x,e=d.x-c.x,j=j.z-c.z,b=b.z-c.z,d=d.z-c.z):(a=j.x-c.x,f=b.x-c.x,e=d.x-c.x,j=j.y-c.y,b=b.y-c.y,d=d.y-c.y);c=f*d-b*e;if(c==0)return Number.MAX_VALUE;c=1/c;d=(a*d-j*e)*c;if(!(d>=0))return Number.MAX_VALUE;c*=f*j-b*a;if(!(c>=0))return Number.MAX_VALUE;if(!(1-d-c>=0))return Number.MAX_VALUE;return g};
-THREE.CollisionSystem.prototype.makeRayLocal=function(a,c){var b=THREE.CollisionSystem.__m;THREE.Matrix4.makeInvert(c.matrixWorld,b);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,e=0,f=0,g=0,j=0,h=0,l=!0;b.origin.x<c.min.x?(d=c.min.x-b.origin.x,d/=b.direction.x,l=!1,g=-1):b.origin.x>c.max.x&&(d=c.max.x-b.origin.x,d/=b.direction.x,l=!1,g=1);b.origin.y<c.min.y?(e=c.min.y-b.origin.y,e/=b.direction.y,l=!1,j=-1):b.origin.y>c.max.y&&(e=c.max.y-b.origin.y,e/=b.direction.y,
-l=!1,j=1);b.origin.z<c.min.z?(f=c.min.z-b.origin.z,f/=b.direction.z,l=!1,h=-1):b.origin.z>c.max.z&&(f=c.max.z-b.origin.z,f/=b.direction.z,l=!1,h=1);if(l)return-1;l=0;e>d&&(l=1,d=e);f>d&&(l=2,d=f);switch(l){case 0:j=b.origin.y+b.direction.y*d;if(j<c.min.y||j>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(g,0,0);break;case 1:g=b.origin.x+b.direction.x*d;if(g<c.min.x||g>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,j,0);break;case 2:g=b.origin.x+b.direction.x*d;if(g<c.min.x||g>c.max.x)return Number.MAX_VALUE;j=b.origin.y+b.direction.y*d;if(j<c.min.y||j>c.max.y)return Number.MAX_VALUE;c.normal.set(0,0,h)}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.Trident=function(a){function b(b){return new THREE.Mesh(new THREE.Cylinder(30,0.1,a.length/20,a.length/5),new THREE.MeshBasicMaterial({color:b}))}function c(a,b){var c=new THREE.Geometry;c.vertices=[new THREE.Vertex,new THREE.Vertex(a)];return new THREE.Line(c,new THREE.LineBasicMaterial({color:b}))}THREE.Object3D.call(this);var e=Math.PI/2,f,a=a||THREE.Trident.defaultParams;if(a!==THREE.Trident.defaultParams)for(f in THREE.Trident.defaultParams)a.hasOwnProperty(f)||(a[f]=THREE.Trident.defaultParams[f]);
+this.scale=new THREE.Vector3(a.scale,a.scale,a.scale);this.addChild(c(new THREE.Vector3(a.length,0,0),a.xAxisColor));this.addChild(c(new THREE.Vector3(0,a.length,0),a.yAxisColor));this.addChild(c(new THREE.Vector3(0,0,a.length),a.zAxisColor));if(a.showArrows)f=b(a.xAxisColor),f.rotation.y=-e,f.position.x=a.length,this.addChild(f),f=b(a.yAxisColor),f.rotation.x=e,f.position.y=a.length,this.addChild(f),f=b(a.zAxisColor),f.rotation.y=Math.PI,f.position.z=a.length,this.addChild(f)};
+THREE.Trident.prototype=new THREE.Object3D;THREE.Trident.prototype.constructor=THREE.Trident;THREE.Trident.defaultParams={xAxisColor:16711680,yAxisColor:65280,zAxisColor:255,showArrows:!0,length:100,scale:1};THREE.PlaneCollider=function(a,b){this.point=a;this.normal=b};THREE.SphereCollider=function(a,b){this.center=a;this.radius=b;this.radiusSq=b*b};THREE.BoxCollider=function(a,b){this.min=a;this.max=b;this.dynamic=!0;this.normal=new THREE.Vector3};
+THREE.MeshCollider=function(a,b){this.mesh=a;this.box=b;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){this.colliders=this.colliders.concat(a.colliders);this.hits=this.hits.concat(a.hits)};
+THREE.CollisionSystem.prototype.rayCastAll=function(a){a.direction.normalize();this.hits.length=0;var b,c,e,f,g=0;b=0;for(c=this.colliders.length;b<c;b++)if(f=this.colliders[b],e=this.rayCast(a,f),e<Number.MAX_VALUE)f.distance=e,e>g?this.hits.push(f):this.hits.unshift(f),g=e;return this.hits};
+THREE.CollisionSystem.prototype.rayCastNearest=function(a){var b=this.rayCastAll(a);if(b.length==0)return null;for(var c=0;b[c]instanceof THREE.MeshCollider;){var e=this.rayMesh(a,b[c]);if(e.dist<Number.MAX_VALUE){b[c].distance=e.dist;b[c].faceIndex=e.faceIndex;break}c++}if(c>b.length)return null;return b[c]};
+THREE.CollisionSystem.prototype.rayCast=function(a,b){if(b instanceof THREE.PlaneCollider)return this.rayPlane(a,b);else if(b instanceof THREE.SphereCollider)return this.raySphere(a,b);else if(b instanceof THREE.BoxCollider)return this.rayBox(a,b);else if(b instanceof THREE.MeshCollider&&b.box)return this.rayBox(a,b.box)};
+THREE.CollisionSystem.prototype.rayMesh=function(a,b){for(var c=this.makeRayLocal(a,b.mesh),e=Number.MAX_VALUE,f,g=0;g<b.numFaces;g++){var h=b.mesh.geometry.faces[g],k=b.mesh.geometry.vertices[h.a].position,j=b.mesh.geometry.vertices[h.b].position,l=b.mesh.geometry.vertices[h.c].position,m=h instanceof THREE.Face4?b.mesh.geometry.vertices[h.d].position:null;h instanceof THREE.Face3?(h=this.rayTriangle(c,k,j,l,e,this.collisionNormal),h<e&&(e=h,f=g,b.normal.copy(this.collisionNormal),b.normal.normalize())):
+h instanceof THREE.Face4&&(h=this.rayTriangle(c,k,j,m,e,this.collisionNormal),h<e&&(e=h,f=g,b.normal.copy(this.collisionNormal),b.normal.normalize()),h=this.rayTriangle(c,j,l,m,e,this.collisionNormal),h<e&&(e=h,f=g,b.normal.copy(this.collisionNormal),b.normal.normalize()))}return{dist:e,faceIndex:f}};
+THREE.CollisionSystem.prototype.rayTriangle=function(a,b,c,e,f,g){var h=THREE.CollisionSystem.__v1,k=THREE.CollisionSystem.__v2;g.set(0,0,0);h.sub(c,b);k.sub(e,c);g.cross(h,k);k=g.dot(a.direction);if(!(k<0))return Number.MAX_VALUE;h=g.dot(b)-g.dot(a.origin);if(!(h<=0))return Number.MAX_VALUE;if(!(h>=k*f))return Number.MAX_VALUE;h/=k;k=THREE.CollisionSystem.__v3;k.copy(a.direction);k.multiplyScalar(h);k.addSelf(a.origin);Math.abs(g.x)>Math.abs(g.y)?Math.abs(g.x)>Math.abs(g.z)?(a=k.y-b.y,g=c.y-b.y,
+f=e.y-b.y,k=k.z-b.z,c=c.z-b.z,e=e.z-b.z):(a=k.x-b.x,g=c.x-b.x,f=e.x-b.x,k=k.y-b.y,c=c.y-b.y,e=e.y-b.y):Math.abs(g.y)>Math.abs(g.z)?(a=k.x-b.x,g=c.x-b.x,f=e.x-b.x,k=k.z-b.z,c=c.z-b.z,e=e.z-b.z):(a=k.x-b.x,g=c.x-b.x,f=e.x-b.x,k=k.y-b.y,c=c.y-b.y,e=e.y-b.y);b=g*e-c*f;if(b==0)return Number.MAX_VALUE;b=1/b;e=(a*e-k*f)*b;if(!(e>=0))return Number.MAX_VALUE;b*=g*k-c*a;if(!(b>=0))return Number.MAX_VALUE;if(!(1-e-b>=0))return Number.MAX_VALUE;return h};
+THREE.CollisionSystem.prototype.makeRayLocal=function(a,b){var c=THREE.CollisionSystem.__m;THREE.Matrix4.makeInvert(b.matrixWorld,c);var e=THREE.CollisionSystem.__r;e.origin.copy(a.origin);e.direction.copy(a.direction);c.multiplyVector3(e.origin);c.rotateAxis(e.direction);e.direction.normalize();return e};
+THREE.CollisionSystem.prototype.rayBox=function(a,b){var c;b.dynamic&&b.mesh&&b.mesh.matrixWorld?c=this.makeRayLocal(a,b.mesh):(c=THREE.CollisionSystem.__r,c.origin.copy(a.origin),c.direction.copy(a.direction));var e=0,f=0,g=0,h=0,k=0,j=0,l=!0;c.origin.x<b.min.x?(e=b.min.x-c.origin.x,e/=c.direction.x,l=!1,h=-1):c.origin.x>b.max.x&&(e=b.max.x-c.origin.x,e/=c.direction.x,l=!1,h=1);c.origin.y<b.min.y?(f=b.min.y-c.origin.y,f/=c.direction.y,l=!1,k=-1):c.origin.y>b.max.y&&(f=b.max.y-c.origin.y,f/=c.direction.y,
+l=!1,k=1);c.origin.z<b.min.z?(g=b.min.z-c.origin.z,g/=c.direction.z,l=!1,j=-1):c.origin.z>b.max.z&&(g=b.max.z-c.origin.z,g/=c.direction.z,l=!1,j=1);if(l)return-1;l=0;f>e&&(l=1,e=f);g>e&&(l=2,e=g);switch(l){case 0:k=c.origin.y+c.direction.y*e;if(k<b.min.y||k>b.max.y)return Number.MAX_VALUE;c=c.origin.z+c.direction.z*e;if(c<b.min.z||c>b.max.z)return Number.MAX_VALUE;b.normal.set(h,0,0);break;case 1:h=c.origin.x+c.direction.x*e;if(h<b.min.x||h>b.max.x)return Number.MAX_VALUE;c=c.origin.z+c.direction.z*
+e;if(c<b.min.z||c>b.max.z)return Number.MAX_VALUE;b.normal.set(0,k,0);break;case 2:h=c.origin.x+c.direction.x*e;if(h<b.min.x||h>b.max.x)return Number.MAX_VALUE;k=c.origin.y+c.direction.y*e;if(k<b.min.y||k>b.max.y)return Number.MAX_VALUE;b.normal.set(0,0,j)}return e};THREE.CollisionSystem.prototype.rayPlane=function(a,b){var c=a.direction.dot(b.normal),e=b.point.dot(b.normal);if(c<0)c=(e-a.origin.dot(b.normal))/c;else return Number.MAX_VALUE;return c>0?c:Number.MAX_VALUE};
+THREE.CollisionSystem.prototype.raySphere=function(a,b){var c=b.center.clone().subSelf(a.origin);if(c.lengthSq<b.radiusSq)return-1;var e=c.dot(a.direction.clone());if(e<=0)return Number.MAX_VALUE;c=b.radiusSq-(c.lengthSq()-e*e);if(c>=0)return Math.abs(e)-Math.sqrt(c);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 b=a.geometry.boundingBox,c=new THREE.Vector3(b.x[0],b.y[0],b.z[0]),b=new THREE.Vector3(b.x[1],b.y[1],b.z[1]),c=new THREE.BoxCollider(c,b);c.mesh=a;return c};THREE.CollisionUtils.MeshAABB=function(a){var b=THREE.CollisionUtils.MeshOBB(a);b.min.addSelf(a.position);b.max.addSelf(a.position);b.dynamic=!1;return b};
 THREE.CollisionUtils.MeshColliderWBox=function(a){return new THREE.MeshCollider(a,THREE.CollisionUtils.MeshOBB(a))};
-THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);var c=this,b=this.setSize,d=this.render,e=new THREE.Camera,f=new THREE.Camera,a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},g=new THREE.WebGLRenderTarget(512,512,a),j=new THREE.WebGLRenderTarget(512,512,a),h=new THREE.Camera(53,1,1,1E4);h.position.z=2;_material=new THREE.MeshShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:g},mapRight:{type:"t",value:1,texture:j}},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 l=new THREE.Scene;l.addObject(new THREE.Mesh(new THREE.Plane(2,2),_material));this.setSize=function(a,d){b.call(c,a,d);g.width=a;g.height=d;j.width=a;j.height=d};this.render=
-function(a,b){e.projectionMatrix=b.projectionMatrix;e.position.copy(b.position);e.target.position.copy(b.target.position);e.translateX(-10);f.projectionMatrix=b.projectionMatrix;f.position.copy(b.position);f.target.position.copy(b.target.position);f.translateX(10);d.call(c,a,e,g,!0);d.call(c,a,f,j,!0);d.call(c,l,h)}};THREE.AnaglyphWebGLRenderer.prototype=new THREE.WebGLRenderer;THREE.AnaglyphWebGLRenderer.prototype.constructor=THREE.AnaglyphWebGLRenderer;
-THREE.CrosseyedWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoClear=!1;var c=this,b=this.setSize,d=this.render,e,f,g=new THREE.Camera,j=new THREE.Camera;c.separation=10;if(a&&a.separation!==void 0)c.separation=a.separation;(new THREE.Camera(53,window.innerWidth/2/window.innerHeight,1,1E4)).position.z=-10;this.setSize=function(a,d){b.call(c,a,d);e=a/2;f=d};this.render=function(a,b){this.clear();g.fov=b.fov;g.aspect=0.5*b.aspect;g.near=b.near;g.far=b.far;g.updateProjectionMatrix();
-g.position.copy(b.position);g.target.position.copy(b.target.position);g.translateX(c.separation);j.projectionMatrix=g.projectionMatrix;j.position.copy(b.position);j.target.position.copy(b.target.position);j.translateX(-c.separation);this.setViewport(0,0,e,f);d.call(c,a,g);this.setViewport(e,0,e,f);d.call(c,a,j,!1)}};THREE.CrosseyedWebGLRenderer.prototype=new THREE.WebGLRenderer;THREE.CrosseyedWebGLRenderer.prototype.constructor=THREE.CrosseyedWebGLRenderer;
+THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);var b=this,c=this.setSize,e=this.render,f=new THREE.Camera,g=new THREE.Camera,a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},h=new THREE.WebGLRenderTarget(512,512,a),k=new THREE.WebGLRenderTarget(512,512,a),j=new THREE.Camera(53,1,1,1E4);j.position.z=2;_material=new THREE.MeshShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:h},mapRight:{type:"t",value:1,texture:k}},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 l=new THREE.Scene;l.addObject(new THREE.Mesh(new THREE.Plane(2,2),_material));this.setSize=function(a,e){c.call(b,a,e);h.width=a;h.height=e;k.width=a;k.height=e};this.render=
+function(a,c){f.projectionMatrix=c.projectionMatrix;f.position.copy(c.position);f.target.position.copy(c.target.position);f.translateX(-10);g.projectionMatrix=c.projectionMatrix;g.position.copy(c.position);g.target.position.copy(c.target.position);g.translateX(10);e.call(b,a,f,h,!0);e.call(b,a,g,k,!0);e.call(b,l,j)}};THREE.AnaglyphWebGLRenderer.prototype=new THREE.WebGLRenderer;THREE.AnaglyphWebGLRenderer.prototype.constructor=THREE.AnaglyphWebGLRenderer;
+THREE.CrosseyedWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoClear=!1;var b=this,c=this.setSize,e=this.render,f,g,h=new THREE.Camera,k=new THREE.Camera;b.separation=10;if(a&&a.separation!==void 0)b.separation=a.separation;(new THREE.Camera(53,window.innerWidth/2/window.innerHeight,1,1E4)).position.z=-10;this.setSize=function(a,e){c.call(b,a,e);f=a/2;g=e};this.render=function(a,c){this.clear();h.fov=c.fov;h.aspect=0.5*c.aspect;h.near=c.near;h.far=c.far;h.updateProjectionMatrix();
+h.position.copy(c.position);h.target.position.copy(c.target.position);h.translateX(b.separation);k.projectionMatrix=h.projectionMatrix;k.position.copy(c.position);k.target.position.copy(c.target.position);k.translateX(-b.separation);this.setViewport(0,0,f,g);e.call(b,a,h);this.setViewport(f,0,f,g);e.call(b,a,k,!1)}};THREE.CrosseyedWebGLRenderer.prototype=new THREE.WebGLRenderer;THREE.CrosseyedWebGLRenderer.prototype.constructor=THREE.CrosseyedWebGLRenderer;

+ 2 - 1
build/custom/ThreeSVG.js

@@ -3,7 +3,8 @@ var THREE=THREE||{};if(!window.Int32Array)window.Int32Array=Array,window.Float32
 THREE.Color.prototype={copy:function(a){this.r=a.r;this.g=a.g;this.b=a.b;this.hex=a.hex},setHex:function(a){this.hex=~~a&16777215;this.updateRGB()},setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;this.updateHex()},setHSV:function(a,b,c){var d,e,g,f,h,i;if(c==0)d=e=g=0;else switch(f=Math.floor(a*6),h=a*6-f,a=c*(1-b),i=c*(1-b*h),b=c*(1-b*(1-h)),f){case 1:d=i;e=c;g=a;break;case 2:d=a;e=c;g=b;break;case 3:d=a;e=i;g=c;break;case 4:d=b;e=a;g=c;break;case 5:d=c;e=a;g=i;break;case 6:case 0:d=c,e=b,g=a}this.setRGB(d,
 e,g)},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGB:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},clone:function(){return new THREE.Color(this.hex)}};THREE.Vector2=function(a,b){this.set(a||0,b||0)};
 THREE.Vector2.prototype={set:function(a,b){this.x=a;this.y=b;return this},copy:function(a){this.x=a.x;this.y=a.y;return this},clone:function(){return new THREE.Vector2(this.x,this.y)},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;return this},divideScalar:function(a){a?
-(this.x/=a,this.y/=a):this.set(0,0);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.lengthSq())},normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)},unit:function(){return this.normalize()}};THREE.Vector3=function(a,b,c){this.set(a||0,b||0,c||0)};
+(this.x/=a,this.y/=a):this.set(0,0);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.lengthSq())},normalize:function(){return this.divideScalar(this.length())},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var b=this.x-a.x,a=this.y-a.y;return b*b+a*a},setLength:function(a){return this.normalize().multiplyScalar(a)},
+unit:function(){return this.normalize()},equals:function(a){return a.x==this.x&&a.y==this.y}};THREE.Vector3=function(a,b,c){this.set(a||0,b||0,c||0)};
 THREE.Vector3.prototype={set:function(a,b,c){this.x=a;this.y=b;this.z=c;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;return this},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;return this},addScalar:function(a){this.x+=a;this.y+=a;this.z+=a;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;return this},subSelf:function(a){this.x-=
 a.x;this.y-=a.y;this.z-=a.z;return this},multiply:function(a,b){this.x=a.x*b.x;this.y=a.y*b.y;this.z=a.z*b.z;return this},multiplySelf:function(a){this.x*=a.x;this.y*=a.y;this.z*=a.y;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;return this},divideSelf:function(a){return this.divide(this,a)},divideScalar:function(a){a?(this.x/=a,this.y/=a,this.z/=a):this.set(0,0,0);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*
 a.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.lengthSq())},lengthManhattan:function(){return this.x+this.y+this.z},normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)},cross:function(a,b){this.x=a.y*b.z-a.z*b.y;this.y=a.z*b.x-a.x*b.z;this.z=a.x*b.y-a.y*b.x;return this},crossSelf:function(a){return this.set(this.y*a.z-this.z*a.y,this.z*a.x-this.x*a.z,this.x*

+ 17 - 16
build/custom/ThreeWebGL.js

@@ -3,7 +3,8 @@ var THREE=THREE||{};if(!window.Int32Array)window.Int32Array=Array,window.Float32
 THREE.Color.prototype={copy:function(b){this.r=b.r;this.g=b.g;this.b=b.b;this.hex=b.hex},setHex:function(b){this.hex=~~b&16777215;this.updateRGB()},setRGB:function(b,d,e){this.r=b;this.g=d;this.b=e;this.updateHex()},setHSV:function(b,d,e){var f,h,i,g,j,p;if(e==0)f=h=i=0;else switch(g=Math.floor(b*6),j=b*6-g,b=e*(1-d),p=e*(1-d*j),d=e*(1-d*(1-j)),g){case 1:f=p;h=e;i=b;break;case 2:f=b;h=e;i=d;break;case 3:f=b;h=p;i=e;break;case 4:f=d;h=b;i=e;break;case 5:f=e;h=b;i=p;break;case 6:case 0:f=e,h=d,i=b}this.setRGB(f,
 h,i)},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGB:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},clone:function(){return new THREE.Color(this.hex)}};THREE.Vector2=function(b,d){this.set(b||0,d||0)};
 THREE.Vector2.prototype={set:function(b,d){this.x=b;this.y=d;return this},copy:function(b){this.x=b.x;this.y=b.y;return this},clone:function(){return new THREE.Vector2(this.x,this.y)},add:function(b,d){this.x=b.x+d.x;this.y=b.y+d.y;return this},addSelf:function(b){this.x+=b.x;this.y+=b.y;return this},sub:function(b,d){this.x=b.x-d.x;this.y=b.y-d.y;return this},subSelf:function(b){this.x-=b.x;this.y-=b.y;return this},multiplyScalar:function(b){this.x*=b;this.y*=b;return this},divideScalar:function(b){b?
-(this.x/=b,this.y/=b):this.set(0,0);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(b){return this.x*b.x+this.y*b.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.lengthSq())},normalize:function(){return this.divideScalar(this.length())},setLength:function(b){return this.normalize().multiplyScalar(b)},unit:function(){return this.normalize()}};THREE.Vector3=function(b,d,e){this.set(b||0,d||0,e||0)};
+(this.x/=b,this.y/=b):this.set(0,0);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(b){return this.x*b.x+this.y*b.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.lengthSq())},normalize:function(){return this.divideScalar(this.length())},distanceTo:function(b){return Math.sqrt(this.distanceToSquared(b))},distanceToSquared:function(b){var d=this.x-b.x,b=this.y-b.y;return d*d+b*b},setLength:function(b){return this.normalize().multiplyScalar(b)},
+unit:function(){return this.normalize()},equals:function(b){return b.x==this.x&&b.y==this.y}};THREE.Vector3=function(b,d,e){this.set(b||0,d||0,e||0)};
 THREE.Vector3.prototype={set:function(b,d,e){this.x=b;this.y=d;this.z=e;return this},copy:function(b){this.x=b.x;this.y=b.y;this.z=b.z;return this},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)},add:function(b,d){this.x=b.x+d.x;this.y=b.y+d.y;this.z=b.z+d.z;return this},addSelf:function(b){this.x+=b.x;this.y+=b.y;this.z+=b.z;return this},addScalar:function(b){this.x+=b;this.y+=b;this.z+=b;return this},sub:function(b,d){this.x=b.x-d.x;this.y=b.y-d.y;this.z=b.z-d.z;return this},subSelf:function(b){this.x-=
 b.x;this.y-=b.y;this.z-=b.z;return this},multiply:function(b,d){this.x=b.x*d.x;this.y=b.y*d.y;this.z=b.z*d.z;return this},multiplySelf:function(b){this.x*=b.x;this.y*=b.y;this.z*=b.y;return this},multiplyScalar:function(b){this.x*=b;this.y*=b;this.z*=b;return this},divideSelf:function(b){return this.divide(this,b)},divideScalar:function(b){b?(this.x/=b,this.y/=b,this.z/=b):this.set(0,0,0);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(b){return this.x*b.x+this.y*b.y+this.z*
 b.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.lengthSq())},lengthManhattan:function(){return this.x+this.y+this.z},normalize:function(){return this.divideScalar(this.length())},setLength:function(b){return this.normalize().multiplyScalar(b)},cross:function(b,d){this.x=b.y*d.z-b.z*d.y;this.y=b.z*d.x-b.x*d.z;this.z=b.x*d.y-b.y*d.x;return this},crossSelf:function(b){return this.set(this.y*b.z-this.z*b.y,this.z*b.x-this.x*b.z,this.x*
@@ -239,15 +240,15 @@ $,j));ia&&(c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,g.__webglFaceBuffer),c.bufferData
 g.__webglSkinWeightsBuffer),c.bufferData(c.ARRAY_BUFFER,Y,j));i.dynamic||(delete g.__inittedArrays,delete g.__colorArray,delete g.__normalArray,delete g.__tangentArray,delete g.__uvArray,delete g.__uv2Array,delete g.__faceArray,delete g.__vertexArray,delete g.__lineArray,delete g.__skinVertexAArray,delete g.__skinVertexBArray,delete g.__skinIndexArray,delete g.__skinWeightArray)}}}f.__dirtyVertices=!1;f.__dirtyMorphTargets=!1;f.__dirtyElements=!1;f.__dirtyUvs=!1;f.__dirtyNormals=!1;f.__dirtyTangents=
 !1;f.__dirtyColors=!1}else if(b instanceof THREE.Ribbon){f=b.geometry;if(f.__dirtyVertices||f.__dirtyColors){b=f;e=c.DYNAMIC_DRAW;t=b.vertices;g=b.colors;z=t.length;i=g.length;y=b.__vertexArray;j=b.__colorArray;x=b.__dirtyColors;if(b.__dirtyVertices){for(k=0;k<z;k++)p=t[k].position,h=k*3,y[h]=p.x,y[h+1]=p.y,y[h+2]=p.z;c.bindBuffer(c.ARRAY_BUFFER,b.__webglVertexBuffer);c.bufferData(c.ARRAY_BUFFER,y,e)}if(x){for(k=0;k<i;k++)color=g[k],h=k*3,j[h]=color.r,j[h+1]=color.g,j[h+2]=color.b;c.bindBuffer(c.ARRAY_BUFFER,
 b.__webglColorBuffer);c.bufferData(c.ARRAY_BUFFER,j,e)}}f.__dirtyVertices=!1;f.__dirtyColors=!1}else if(b instanceof THREE.Line){f=b.geometry;if(f.__dirtyVertices||f.__dirtyColors){b=f;e=c.DYNAMIC_DRAW;t=b.vertices;g=b.colors;z=t.length;i=g.length;y=b.__vertexArray;j=b.__colorArray;x=b.__dirtyColors;if(b.__dirtyVertices){for(k=0;k<z;k++)p=t[k].position,h=k*3,y[h]=p.x,y[h+1]=p.y,y[h+2]=p.z;c.bindBuffer(c.ARRAY_BUFFER,b.__webglVertexBuffer);c.bufferData(c.ARRAY_BUFFER,y,e)}if(x){for(k=0;k<i;k++)color=
-g[k],h=k*3,j[h]=color.r,j[h+1]=color.g,j[h+2]=color.b;c.bindBuffer(c.ARRAY_BUFFER,b.__webglColorBuffer);c.bufferData(c.ARRAY_BUFFER,j,e)}}f.__dirtyVertices=!1;f.__dirtyColors=!1}else if(b instanceof THREE.ParticleSystem)f=b.geometry,(f.__dirtyVertices||f.__dirtyColors||b.sortParticles)&&d(f,c.DYNAMIC_DRAW,b),f.__dirtyVertices=!1,f.__dirtyColors=!1}function S(b){function c(b){var f=[];e=0;for(d=b.length;e<d;e++)b[e]==void 0?f.push("undefined"):f.push(b[e].id);return f.join("_")}var e,d,f,g,h,i,j,k,
+g[k],h=k*3,j[h]=color.r,j[h+1]=color.g,j[h+2]=color.b;c.bindBuffer(c.ARRAY_BUFFER,b.__webglColorBuffer);c.bufferData(c.ARRAY_BUFFER,j,e)}}f.__dirtyVertices=!1;f.__dirtyColors=!1}else if(b instanceof THREE.ParticleSystem)f=b.geometry,(f.__dirtyVertices||f.__dirtyColors||b.sortParticles)&&d(f,c.DYNAMIC_DRAW,b),f.__dirtyVertices=!1,f.__dirtyColors=!1}function S(b){function c(b){var f=[];d=0;for(e=b.length;d<e;d++)b[d]==void 0?f.push("undefined"):f.push(b[d].id);return f.join("_")}var d,e,f,g,h,i,j,k,
 o={},p=b.morphTargets!==void 0?b.morphTargets.length:0;b.geometryGroups={};f=0;for(g=b.faces.length;f<g;f++)h=b.faces[f],i=h.materials,j=c(i),o[j]==void 0&&(o[j]={hash:j,counter:0}),k=o[j].hash+"_"+o[j].counter,b.geometryGroups[k]==void 0&&(b.geometryGroups[k]={faces:[],materials:i,vertices:0,numMorphTargets:p}),h=h instanceof THREE.Face3?3:4,b.geometryGroups[k].vertices+h>65535&&(o[j].counter+=1,k=o[j].hash+"_"+o[j].counter,b.geometryGroups[k]==void 0&&(b.geometryGroups[k]={faces:[],materials:i,
-vertices:0,numMorphTargets:p})),b.geometryGroups[k].faces.push(f),b.geometryGroups[k].vertices+=h}function Q(b,c,e){b.push({buffer:c,object:e,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function L(b){if(b!=M){switch(b){case THREE.AdditiveBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.SRC_ALPHA,c.ONE);break;case THREE.SubtractiveBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ZERO,c.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ZERO,
-c.SRC_COLOR);break;default:c.blendEquationSeparate(c.FUNC_ADD,c.FUNC_ADD),c.blendFuncSeparate(c.SRC_ALPHA,c.ONE_MINUS_SRC_ALPHA,c.ONE,c.ONE_MINUS_SRC_ALPHA)}M=b}}function B(b,e,d){(d.width&d.width-1)==0&&(d.height&d.height-1)==0?(c.texParameteri(b,c.TEXTURE_WRAP_S,E(e.wrapS)),c.texParameteri(b,c.TEXTURE_WRAP_T,E(e.wrapT)),c.texParameteri(b,c.TEXTURE_MAG_FILTER,E(e.magFilter)),c.texParameteri(b,c.TEXTURE_MIN_FILTER,E(e.minFilter)),c.generateMipmap(b)):(c.texParameteri(b,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE),
-c.texParameteri(b,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE),c.texParameteri(b,c.TEXTURE_MAG_FILTER,aa(e.magFilter)),c.texParameteri(b,c.TEXTURE_MIN_FILTER,aa(e.minFilter)))}function x(b,e){if(b.needsUpdate){if(b.__webglTexture)b.__webglTexture=c.deleteTexture(b.__webglTexture);b.__webglTexture=c.createTexture();c.bindTexture(c.TEXTURE_2D,b.__webglTexture);c.texImage2D(c.TEXTURE_2D,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,b.image);B(c.TEXTURE_2D,b,b.image);c.bindTexture(c.TEXTURE_2D,null);b.needsUpdate=!1}c.activeTexture(c.TEXTURE0+
-e);c.bindTexture(c.TEXTURE_2D,b.__webglTexture)}function R(b){if(b&&!b.__webglFramebuffer){if(b.depthBuffer===void 0)b.depthBuffer=!0;if(b.stencilBuffer===void 0)b.stencilBuffer=!0;b.__webglFramebuffer=c.createFramebuffer();b.__webglRenderbuffer=c.createRenderbuffer();b.__webglTexture=c.createTexture();c.bindTexture(c.TEXTURE_2D,b.__webglTexture);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,E(b.wrapS));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,E(b.wrapT));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,
+vertices:0,numMorphTargets:p})),b.geometryGroups[k].faces.push(f),b.geometryGroups[k].vertices+=h}function Q(b,c,d){b.push({buffer:c,object:d,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function L(b){if(b!=M){switch(b){case THREE.AdditiveBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.SRC_ALPHA,c.ONE);break;case THREE.SubtractiveBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ZERO,c.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ZERO,
+c.SRC_COLOR);break;default:c.blendEquationSeparate(c.FUNC_ADD,c.FUNC_ADD),c.blendFuncSeparate(c.SRC_ALPHA,c.ONE_MINUS_SRC_ALPHA,c.ONE,c.ONE_MINUS_SRC_ALPHA)}M=b}}function B(b,d,e){(e.width&e.width-1)==0&&(e.height&e.height-1)==0?(c.texParameteri(b,c.TEXTURE_WRAP_S,E(d.wrapS)),c.texParameteri(b,c.TEXTURE_WRAP_T,E(d.wrapT)),c.texParameteri(b,c.TEXTURE_MAG_FILTER,E(d.magFilter)),c.texParameteri(b,c.TEXTURE_MIN_FILTER,E(d.minFilter)),c.generateMipmap(b)):(c.texParameteri(b,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE),
+c.texParameteri(b,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE),c.texParameteri(b,c.TEXTURE_MAG_FILTER,aa(d.magFilter)),c.texParameteri(b,c.TEXTURE_MIN_FILTER,aa(d.minFilter)))}function x(b,d){if(b.needsUpdate){if(b.__webglTexture)b.__webglTexture=c.deleteTexture(b.__webglTexture);b.__webglTexture=c.createTexture();c.bindTexture(c.TEXTURE_2D,b.__webglTexture);c.texImage2D(c.TEXTURE_2D,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,b.image);B(c.TEXTURE_2D,b,b.image);c.bindTexture(c.TEXTURE_2D,null);b.needsUpdate=!1}c.activeTexture(c.TEXTURE0+
+d);c.bindTexture(c.TEXTURE_2D,b.__webglTexture)}function R(b){if(b&&!b.__webglFramebuffer){if(b.depthBuffer===void 0)b.depthBuffer=!0;if(b.stencilBuffer===void 0)b.stencilBuffer=!0;b.__webglFramebuffer=c.createFramebuffer();b.__webglRenderbuffer=c.createRenderbuffer();b.__webglTexture=c.createTexture();c.bindTexture(c.TEXTURE_2D,b.__webglTexture);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,E(b.wrapS));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,E(b.wrapT));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,
 E(b.magFilter));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,E(b.minFilter));c.texImage2D(c.TEXTURE_2D,0,E(b.format),b.width,b.height,0,E(b.format),E(b.type),null);c.bindRenderbuffer(c.RENDERBUFFER,b.__webglRenderbuffer);c.bindFramebuffer(c.FRAMEBUFFER,b.__webglFramebuffer);c.framebufferTexture2D(c.FRAMEBUFFER,c.COLOR_ATTACHMENT0,c.TEXTURE_2D,b.__webglTexture,0);b.depthBuffer&&!b.stencilBuffer?(c.renderbufferStorage(c.RENDERBUFFER,c.DEPTH_COMPONENT16,b.width,b.height),c.framebufferRenderbuffer(c.FRAMEBUFFER,
-c.DEPTH_ATTACHMENT,c.RENDERBUFFER,b.__webglRenderbuffer)):b.depthBuffer&&b.stencilBuffer?(c.renderbufferStorage(c.RENDERBUFFER,c.DEPTH_STENCIL,b.width,b.height),c.framebufferRenderbuffer(c.FRAMEBUFFER,c.DEPTH_STENCIL_ATTACHMENT,c.RENDERBUFFER,b.__webglRenderbuffer)):c.renderbufferStorage(c.RENDERBUFFER,c.RGBA4,b.width,b.height);c.bindTexture(c.TEXTURE_2D,null);c.bindRenderbuffer(c.RENDERBUFFER,null);c.bindFramebuffer(c.FRAMEBUFFER,null)}var e,d;b?(e=b.__webglFramebuffer,d=b.width,b=b.height):(e=null,
-d=O,b=H);e!=Aa&&(c.bindFramebuffer(c.FRAMEBUFFER,e),c.viewport(F,Z,d,b),Aa=e)}function J(b,e){var d;b=="fragment"?d=c.createShader(c.FRAGMENT_SHADER):b=="vertex"&&(d=c.createShader(c.VERTEX_SHADER));c.shaderSource(d,e);c.compileShader(d);if(!c.getShaderParameter(d,c.COMPILE_STATUS))return console.error(c.getShaderInfoLog(d)),console.error(e),null;return d}function aa(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return c.NEAREST;default:return c.LINEAR}}
+c.DEPTH_ATTACHMENT,c.RENDERBUFFER,b.__webglRenderbuffer)):b.depthBuffer&&b.stencilBuffer?(c.renderbufferStorage(c.RENDERBUFFER,c.DEPTH_STENCIL,b.width,b.height),c.framebufferRenderbuffer(c.FRAMEBUFFER,c.DEPTH_STENCIL_ATTACHMENT,c.RENDERBUFFER,b.__webglRenderbuffer)):c.renderbufferStorage(c.RENDERBUFFER,c.RGBA4,b.width,b.height);c.bindTexture(c.TEXTURE_2D,null);c.bindRenderbuffer(c.RENDERBUFFER,null);c.bindFramebuffer(c.FRAMEBUFFER,null)}var d,e;b?(d=b.__webglFramebuffer,e=b.width,b=b.height):(d=null,
+e=O,b=H);d!=Aa&&(c.bindFramebuffer(c.FRAMEBUFFER,d),c.viewport(F,Z,e,b),Aa=d)}function J(b,d){var e;b=="fragment"?e=c.createShader(c.FRAGMENT_SHADER):b=="vertex"&&(e=c.createShader(c.VERTEX_SHADER));c.shaderSource(e,d);c.compileShader(e);if(!c.getShaderParameter(e,c.COMPILE_STATUS))return console.error(c.getShaderInfoLog(e)),console.error(d),null;return e}function aa(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return c.NEAREST;default:return c.LINEAR}}
 function E(b){switch(b){case THREE.RepeatWrapping:return c.REPEAT;case THREE.ClampToEdgeWrapping:return c.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return c.MIRRORED_REPEAT;case THREE.NearestFilter:return c.NEAREST;case THREE.NearestMipMapNearestFilter:return c.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return c.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return c.LINEAR;case THREE.LinearMipMapNearestFilter:return c.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return c.LINEAR_MIPMAP_LINEAR;
 case THREE.ByteType:return c.BYTE;case THREE.UnsignedByteType:return c.UNSIGNED_BYTE;case THREE.ShortType:return c.SHORT;case THREE.UnsignedShortType:return c.UNSIGNED_SHORT;case THREE.IntType:return c.INT;case THREE.UnsignedShortType:return c.UNSIGNED_INT;case THREE.FloatType:return c.FLOAT;case THREE.AlphaFormat:return c.ALPHA;case THREE.RGBFormat:return c.RGB;case THREE.RGBAFormat:return c.RGBA;case THREE.LuminanceFormat:return c.LUMINANCE;case THREE.LuminanceAlphaFormat:return c.LUMINANCE_ALPHA}return 0}
 var $=this,c,ja=[],oa=null,Aa=null,ra=!0,pa=null,ka=null,M=null,ha=null,F=0,Z=0,O=0,H=0,N=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],P=new THREE.Matrix4,fa=new Float32Array(16),la=new Float32Array(16),qa=new THREE.Vector4,Ba={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},ia=b.canvas!==void 0?b.canvas:document.createElement("canvas"),sa=b.stencil!==void 0?
@@ -264,15 +265,15 @@ c.getUniformLocation(t.program,"screenPosition");var Ea=!1;_sprite={};_sprite.ve
 0;_sprite.vertices[b++]=1;b=0;_sprite.faces[b++]=0;_sprite.faces[b++]=1;_sprite.faces[b++]=2;_sprite.faces[b++]=0;_sprite.faces[b++]=2;_sprite.faces[b++]=3;_sprite.vertexBuffer=c.createBuffer();_sprite.elementBuffer=c.createBuffer();c.bindBuffer(c.ARRAY_BUFFER,_sprite.vertexBuffer);c.bufferData(c.ARRAY_BUFFER,_sprite.vertices,c.STATIC_DRAW);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,_sprite.elementBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,_sprite.faces,c.STATIC_DRAW);_sprite.program=c.createProgram();
 c.attachShader(_sprite.program,J("fragment",THREE.ShaderLib.sprite.fragmentShader));c.attachShader(_sprite.program,J("vertex",THREE.ShaderLib.sprite.vertexShader));c.linkProgram(_sprite.program);_sprite.attributes={};_sprite.uniforms={};_sprite.attributes.position=c.getAttribLocation(_sprite.program,"position");_sprite.attributes.uv=c.getAttribLocation(_sprite.program,"uv");_sprite.uniforms.uvOffset=c.getUniformLocation(_sprite.program,"uvOffset");_sprite.uniforms.uvScale=c.getUniformLocation(_sprite.program,
 "uvScale");_sprite.uniforms.rotation=c.getUniformLocation(_sprite.program,"rotation");_sprite.uniforms.scale=c.getUniformLocation(_sprite.program,"scale");_sprite.uniforms.alignment=c.getUniformLocation(_sprite.program,"alignment");_sprite.uniforms.map=c.getUniformLocation(_sprite.program,"map");_sprite.uniforms.opacity=c.getUniformLocation(_sprite.program,"opacity");_sprite.uniforms.useScreenCoordinates=c.getUniformLocation(_sprite.program,"useScreenCoordinates");_sprite.uniforms.affectedByDistance=
-c.getUniformLocation(_sprite.program,"affectedByDistance");_sprite.uniforms.screenPosition=c.getUniformLocation(_sprite.program,"screenPosition");_sprite.uniforms.modelViewMatrix=c.getUniformLocation(_sprite.program,"modelViewMatrix");_sprite.uniforms.projectionMatrix=c.getUniformLocation(_sprite.program,"projectionMatrix");var Da=!1;this.setSize=function(b,c){ia.width=b;ia.height=c;this.setViewport(0,0,ia.width,ia.height)};this.setViewport=function(b,e,d,f){F=b;Z=e;O=d;H=f;c.viewport(F,Z,O,H)};this.setScissor=
-function(b,e,d,f){c.scissor(b,e,d,f)};this.enableScissorTest=function(b){b?c.enable(c.SCISSOR_TEST):c.disable(c.SCISSOR_TEST)};this.enableDepthBufferWrite=function(b){ra=b;c.depthMask(b)};this.setClearColorHex=function(b,e){na.setHex(b);Ca=e;c.clearColor(na.r,na.g,na.b,Ca)};this.setClearColor=function(b,e){na.copy(b);Ca=e;c.clearColor(na.r,na.g,na.b,Ca)};this.clear=function(){c.clear(c.COLOR_BUFFER_BIT|c.DEPTH_BUFFER_BIT|c.STENCIL_BUFFER_BIT)};this.setStencilShadowDarkness=function(b){u.darkness=
-b};this.getContext=function(){return c};this.initMaterial=function(b,e,d,f){var g,h,i;b instanceof THREE.MeshDepthMaterial?i="depth":b instanceof THREE.ShadowVolumeDynamicMaterial?i="shadowVolumeDynamic":b instanceof THREE.MeshNormalMaterial?i="normal":b instanceof THREE.MeshBasicMaterial?i="basic":b instanceof THREE.MeshLambertMaterial?i="lambert":b instanceof THREE.MeshPhongMaterial?i="phong":b instanceof THREE.LineBasicMaterial?i="basic":b instanceof THREE.ParticleBasicMaterial&&(i="particle_basic");
-if(i){var j=THREE.ShaderLib[i];b.uniforms=THREE.UniformsUtils.clone(j.uniforms);b.vertexShader=j.vertexShader;b.fragmentShader=j.fragmentShader}var k,p,o;k=o=j=0;for(p=e.length;k<p;k++)h=e[k],h instanceof THREE.DirectionalLight&&o++,h instanceof THREE.PointLight&&j++;j+o<=4?e=o:(e=Math.ceil(4*o/(j+o)),j=4-e);h={directional:e,point:j};o=50;if(f!==void 0&&f instanceof THREE.SkinnedMesh)o=f.bones.length;var n;a:{k=b.fragmentShader;p=b.vertexShader;var j=b.uniforms,e=b.attributes,d={map:!!b.map,envMap:!!b.envMap,
-lightMap:!!b.lightMap,vertexColors:b.vertexColors,fog:d,sizeAttenuation:b.sizeAttenuation,skinning:b.skinning,morphTargets:b.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:h.directional,maxPointLights:h.point,maxBones:o},q;h=[];i?h.push(i):(h.push(k),h.push(p));for(q in d)h.push(q),h.push(d[q]);i=h.join();q=0;for(h=ja.length;q<h;q++)if(ja[q].code==i){n=ja[q].program;break a}q=c.createProgram();prefix_fragment=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+
-d.maxDirLights,"#define MAX_POINT_LIGHTS "+d.maxPointLights,d.fog?"#define USE_FOG":"",d.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",d.map?"#define USE_MAP":"",d.envMap?"#define USE_ENVMAP":"",d.lightMap?"#define USE_LIGHTMAP":"",d.vertexColors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");prefix_vertex=[Fa?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+d.maxDirLights,"#define MAX_POINT_LIGHTS "+d.maxPointLights,"#define MAX_BONES "+d.maxBones,
-d.map?"#define USE_MAP":"",d.envMap?"#define USE_ENVMAP":"",d.lightMap?"#define USE_LIGHTMAP":"",d.vertexColors?"#define USE_COLOR":"",d.skinning?"#define USE_SKINNING":"",d.morphTargets?"#define USE_MORPHTARGETS":"",d.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");
+c.getUniformLocation(_sprite.program,"affectedByDistance");_sprite.uniforms.screenPosition=c.getUniformLocation(_sprite.program,"screenPosition");_sprite.uniforms.modelViewMatrix=c.getUniformLocation(_sprite.program,"modelViewMatrix");_sprite.uniforms.projectionMatrix=c.getUniformLocation(_sprite.program,"projectionMatrix");var Da=!1;this.setSize=function(b,c){ia.width=b;ia.height=c;this.setViewport(0,0,ia.width,ia.height)};this.setViewport=function(b,d,e,f){F=b;Z=d;O=e;H=f;c.viewport(F,Z,O,H)};this.setScissor=
+function(b,d,e,f){c.scissor(b,d,e,f)};this.enableScissorTest=function(b){b?c.enable(c.SCISSOR_TEST):c.disable(c.SCISSOR_TEST)};this.enableDepthBufferWrite=function(b){ra=b;c.depthMask(b)};this.setClearColorHex=function(b,d){na.setHex(b);Ca=d;c.clearColor(na.r,na.g,na.b,Ca)};this.setClearColor=function(b,d){na.copy(b);Ca=d;c.clearColor(na.r,na.g,na.b,Ca)};this.clear=function(){c.clear(c.COLOR_BUFFER_BIT|c.DEPTH_BUFFER_BIT|c.STENCIL_BUFFER_BIT)};this.setStencilShadowDarkness=function(b){u.darkness=
+b};this.getContext=function(){return c};this.initMaterial=function(b,d,e,f){var g,h,i;b instanceof THREE.MeshDepthMaterial?i="depth":b instanceof THREE.ShadowVolumeDynamicMaterial?i="shadowVolumeDynamic":b instanceof THREE.MeshNormalMaterial?i="normal":b instanceof THREE.MeshBasicMaterial?i="basic":b instanceof THREE.MeshLambertMaterial?i="lambert":b instanceof THREE.MeshPhongMaterial?i="phong":b instanceof THREE.LineBasicMaterial?i="basic":b instanceof THREE.ParticleBasicMaterial&&(i="particle_basic");
+if(i){var j=THREE.ShaderLib[i];b.uniforms=THREE.UniformsUtils.clone(j.uniforms);b.vertexShader=j.vertexShader;b.fragmentShader=j.fragmentShader}var k,p,o;k=o=j=0;for(p=d.length;k<p;k++)h=d[k],h instanceof THREE.DirectionalLight&&o++,h instanceof THREE.PointLight&&j++;j+o<=4?d=o:(d=Math.ceil(4*o/(j+o)),j=4-d);h={directional:d,point:j};o=50;if(f!==void 0&&f instanceof THREE.SkinnedMesh)o=f.bones.length;var n;a:{k=b.fragmentShader;p=b.vertexShader;var j=b.uniforms,d=b.attributes,e={map:!!b.map,envMap:!!b.envMap,
+lightMap:!!b.lightMap,vertexColors:b.vertexColors,fog:e,sizeAttenuation:b.sizeAttenuation,skinning:b.skinning,morphTargets:b.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:h.directional,maxPointLights:h.point,maxBones:o},q;h=[];i?h.push(i):(h.push(k),h.push(p));for(q in e)h.push(q),h.push(e[q]);i=h.join();q=0;for(h=ja.length;q<h;q++)if(ja[q].code==i){n=ja[q].program;break a}q=c.createProgram();prefix_fragment=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+
+e.maxDirLights,"#define MAX_POINT_LIGHTS "+e.maxPointLights,e.fog?"#define USE_FOG":"",e.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",e.map?"#define USE_MAP":"",e.envMap?"#define USE_ENVMAP":"",e.lightMap?"#define USE_LIGHTMAP":"",e.vertexColors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");prefix_vertex=[Fa?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+e.maxDirLights,"#define MAX_POINT_LIGHTS "+e.maxPointLights,"#define MAX_BONES "+e.maxBones,
+e.map?"#define USE_MAP":"",e.envMap?"#define USE_ENVMAP":"",e.lightMap?"#define USE_LIGHTMAP":"",e.vertexColors?"#define USE_COLOR":"",e.skinning?"#define USE_SKINNING":"",e.morphTargets?"#define USE_MORPHTARGETS":"",e.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");
 c.attachShader(q,J("fragment",prefix_fragment+k));c.attachShader(q,J("vertex",prefix_vertex+p));c.linkProgram(q);c.getProgramParameter(q,c.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+c.getProgramParameter(q,c.VALIDATE_STATUS)+", gl error ["+c.getError()+"]");q.uniforms={};q.attributes={};var r;k=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(r in j)k.push(r);
-r=k;j=0;for(k=r.length;j<k;j++)p=r[j],q.uniforms[p]=c.getUniformLocation(q,p);k=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(r=0;r<d.maxMorphTargets;r++)k.push("morphTarget"+r);for(n in e)k.push(n);n=k;r=0;for(e=n.length;r<e;r++)d=n[r],q.attributes[d]=c.getAttribLocation(q,d);ja.push({program:q,code:i});n=q}b.program=n;n=b.program.attributes;n.position>=0&&c.enableVertexAttribArray(n.position);n.color>=0&&c.enableVertexAttribArray(n.color);
+r=k;j=0;for(k=r.length;j<k;j++)p=r[j],q.uniforms[p]=c.getUniformLocation(q,p);k=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(r=0;r<e.maxMorphTargets;r++)k.push("morphTarget"+r);for(n in d)k.push(n);n=k;r=0;for(d=n.length;r<d;r++)e=n[r],q.attributes[e]=c.getAttribLocation(q,e);ja.push({program:q,code:i});n=q}b.program=n;n=b.program.attributes;n.position>=0&&c.enableVertexAttribArray(n.position);n.color>=0&&c.enableVertexAttribArray(n.color);
 n.normal>=0&&c.enableVertexAttribArray(n.normal);n.tangent>=0&&c.enableVertexAttribArray(n.tangent);b.skinning&&n.skinVertexA>=0&&n.skinVertexB>=0&&n.skinIndex>=0&&n.skinWeight>=0&&(c.enableVertexAttribArray(n.skinVertexA),c.enableVertexAttribArray(n.skinVertexB),c.enableVertexAttribArray(n.skinIndex),c.enableVertexAttribArray(n.skinWeight));if(b.attributes)for(g in b.attributes)n[g]!==void 0&&n[g]>=0&&c.enableVertexAttribArray(n[g]);if(b.morphTargets){b.numSupportedMorphTargets=0;n.morphTarget0>=
 0&&(c.enableVertexAttribArray(n.morphTarget0),b.numSupportedMorphTargets++);n.morphTarget1>=0&&(c.enableVertexAttribArray(n.morphTarget1),b.numSupportedMorphTargets++);n.morphTarget2>=0&&(c.enableVertexAttribArray(n.morphTarget2),b.numSupportedMorphTargets++);n.morphTarget3>=0&&(c.enableVertexAttribArray(n.morphTarget3),b.numSupportedMorphTargets++);n.morphTarget4>=0&&(c.enableVertexAttribArray(n.morphTarget4),b.numSupportedMorphTargets++);n.morphTarget5>=0&&(c.enableVertexAttribArray(n.morphTarget5),
 b.numSupportedMorphTargets++);n.morphTarget6>=0&&(c.enableVertexAttribArray(n.morphTarget6),b.numSupportedMorphTargets++);n.morphTarget7>=0&&(c.enableVertexAttribArray(n.morphTarget7),b.numSupportedMorphTargets++);f.__webglMorphTargetInfluences=new Float32Array(this.maxMorphTargets);b=0;for(g=this.maxMorphTargets;b<g;b++)f.__webglMorphTargetInfluences[b]=0}};this.render=function(b,d,k,u){var t,y,x,B,E,F,o,G,H=b.lights,J=b.fog;$.data.vertices=0;$.data.faces=0;$.data.drawCalls=0;d.matrixAutoUpdate&&

+ 216 - 0
examples/canvas_geometry_text.html

@@ -0,0 +1,216 @@
+<!DOCTYPE HTML>
+<html lang="en">
+	<head>
+		<title>three.js canvas/webgl - geometry - text</title>
+		<meta charset="utf-8">
+		<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;"/>
+		<style type="text/css">
+			body {
+				font-family: Monospace;
+				background-color: #f0f0f0;
+				margin: 0px;
+				overflow: hidden;
+			}
+		</style>
+	</head>
+	<body>
+
+
+		<script type="text/javascript" src="../build/Three.js"></script>
+
+		<script type="text/javascript" src="js/RequestAnimationFrame.js"></script>
+		<script type="text/javascript" src="js/Stats.js"></script>
+		      
+		<!-- load the font file from canvas-text -->
+
+		<script type="text/javascript" src="js/helvetiker-normal-normal.js"></script>
+        
+
+		<script type="text/javascript">
+
+			var container, stats;
+
+			var camera, scene, renderer;
+
+			var text, plane;
+
+			var targetRotation = 0;
+			var targetRotationOnMouseDown = 0;
+
+			var mouseX = 0;
+			var mouseXOnMouseDown = 0;
+
+			var windowHalfX = window.innerWidth / 2;
+			var windowHalfY = window.innerHeight / 2;
+
+			init();
+			animate();
+
+			function init() {
+
+				container = document.createElement( 'div' );
+				document.body.appendChild( container );
+
+				var info = document.createElement( 'div' );
+				info.style.position = 'absolute';
+				info.style.top = '10px';
+				info.style.width = '100%';
+				info.style.textAlign = 'center';
+				info.innerHTML = 'Simple Dynamic 3D Text Example by <a href="http://www.lab4games.net/zz85/blog">zz85</a><br/>Drag to spin the text';
+				container.appendChild( info );
+
+				camera = new THREE.Camera( 50, window.innerWidth / window.innerHeight, 1, 1000 );
+				camera.position.y = 150;
+				camera.position.z = 500;
+				camera.target.position.y = 150;
+
+				scene = new THREE.Scene();
+
+				// Get text from hash
+
+				var theText = "Hello three.js! :)";
+				
+				var hash = document.location.hash.substr( 1 );
+				
+				if ( hash.length !== 0 ) {
+                   
+					theText = hash;
+
+				}
+                
+                var text3d = new THREE.Text( theText, {
+
+					size: 80, 
+					height: 20,
+					curveSegments: 2,
+					font: "helvetiker"
+
+				});
+
+                var textMaterial = new THREE.MeshBasicMaterial( { color: Math.random() * 0xffffff, wireframe:false } );
+                text = new THREE.Mesh( text3d, textMaterial );
+
+                text.doubleSided = false;
+
+                text.position.y = 0;
+                text.position.y = 100;
+                text.position.z = 0;
+
+                text.rotation.x = 0;
+                text.rotation.y = Math.PI*2;
+				text.overdraw = true;
+
+                scene.addObject( text );
+
+				// Plane
+
+				plane = new THREE.Mesh( new THREE.Plane( 800, 800 ), new THREE.MeshBasicMaterial( { color: 0xe0e0e0, wireframe:true }) );
+				plane.rotation.x = - 90 * ( Math.PI / 180 );
+                plane.position.x = 0;
+				plane.overdraw = true;
+
+				//scene.addObject( plane );
+
+				renderer = new THREE.CanvasRenderer();
+                renderer.setSize( window.innerWidth, window.innerHeight );
+
+				container.appendChild( renderer.domElement );
+
+				stats = new Stats();
+				stats.domElement.style.position = 'absolute';
+				stats.domElement.style.top = '0px';
+				container.appendChild( stats.domElement );
+
+				document.addEventListener( 'mousedown', onDocumentMouseDown, false );
+				document.addEventListener( 'touchstart', onDocumentTouchStart, false );
+				document.addEventListener( 'touchmove', onDocumentTouchMove, false );
+
+			}
+
+			//
+
+			function onDocumentMouseDown( event ) {
+
+				event.preventDefault();
+
+				document.addEventListener( 'mousemove', onDocumentMouseMove, false );
+				document.addEventListener( 'mouseup', onDocumentMouseUp, false );
+				document.addEventListener( 'mouseout', onDocumentMouseOut, false );
+
+				mouseXOnMouseDown = event.clientX - windowHalfX;
+				targetRotationOnMouseDown = targetRotation;
+
+			}
+
+			function onDocumentMouseMove( event ) {
+
+				mouseX = event.clientX - windowHalfX;
+
+				targetRotation = targetRotationOnMouseDown + ( mouseX - mouseXOnMouseDown ) * 0.02;
+
+			}
+
+			function onDocumentMouseUp( event ) {
+
+				document.removeEventListener( 'mousemove', onDocumentMouseMove, false );
+				document.removeEventListener( 'mouseup', onDocumentMouseUp, false );
+				document.removeEventListener( 'mouseout', onDocumentMouseOut, false );
+
+			}
+
+			function onDocumentMouseOut( event ) {
+
+				document.removeEventListener( 'mousemove', onDocumentMouseMove, false );
+				document.removeEventListener( 'mouseup', onDocumentMouseUp, false );
+				document.removeEventListener( 'mouseout', onDocumentMouseOut, false );
+
+			}
+
+			function onDocumentTouchStart( event ) {
+
+				if ( event.touches.length == 1 ) {
+
+					event.preventDefault();
+
+					mouseXOnMouseDown = event.touches[ 0 ].pageX - windowHalfX;
+					targetRotationOnMouseDown = targetRotation;
+
+				}
+
+			}
+
+			function onDocumentTouchMove( event ) {
+
+				if ( event.touches.length == 1 ) {
+
+					event.preventDefault();
+
+					mouseX = event.touches[ 0 ].pageX - windowHalfX;
+					targetRotation = targetRotationOnMouseDown + ( mouseX - mouseXOnMouseDown ) * 0.05;
+
+				}
+
+			}
+
+			//
+
+			function animate() {
+
+				requestAnimationFrame( animate );
+
+				render();
+				stats.update();
+
+			}
+
+			function render() {
+
+				plane.rotation.z = text.rotation.y += ( targetRotation - text.rotation.y ) * 0.05;
+				renderer.render( scene, camera );
+
+			}
+
+		</script>
+
+	</body>
+</html>

文件差异内容过多而无法显示
+ 0 - 0
examples/js/helvetiker-normal-normal.js


+ 19 - 0
src/core/Vector2.js

@@ -2,6 +2,7 @@
  * @author mr.doob / http://mrdoob.com/
  * @author philogb / http://blog.thejit.org/
  * @author egraether / http://egraether.com/
+ * @author zz85 / http://www.lab4games.net/zz85/blog
  */
 
 THREE.Vector2 = function ( x, y ) {
@@ -134,6 +135,20 @@ THREE.Vector2.prototype = {
 		return this.divideScalar( this.length() );
 
 	},
+	
+	distanceTo : function ( v ) {
+
+		return Math.sqrt( this.distanceToSquared( v ) );
+
+	},
+
+	distanceToSquared : function ( v ) {
+
+		var dx = this.x - v.x, dy = this.y - v.y;
+		return dx * dx + dy * dy;
+
+	},
+
 
 	setLength : function ( l ) {
 
@@ -149,6 +164,10 @@ THREE.Vector2.prototype = {
 		// this.multiplyScalar( 1 / this.length() );
 		// return this;
 
+	},
+	
+	equals : function(v) {
+		return ( (v.x == this.x) && (v.y == this.y) );
 	}
 
 };

+ 804 - 0
src/extras/geometries/Text.js

@@ -0,0 +1,804 @@
+/**
+ * @author zz85 / http://www.lab4games.net/zz85/blog
+ *
+ * For creating 3D text geometry in three.js
+ * 
+ * It utilizes techniques used in
+ * 
+ * 	typeface.js and canvastext
+ * 		For converting fonts and rendering with javascript 
+ *		http://typeface.neocracy.org
+ * 
+ *	Triangulation ported from AS3
+ *		Simple Polygon Triangulation
+ *		http://actionsnippet.com/?p=1462
+ *
+ * 	A Method to triangulate shapes with holes 
+ *		http://www.sakri.net/blog/2009/06/12/an-approach-to-triangulating-polygons-with-holes/
+ *
+ */
+
+
+THREE.Text = function ( text, parameters ) {
+
+	THREE.Geometry.call( this );
+
+	parameters = parameters || {};
+
+	var size = parameters.size !== undefined ? parameters.size : 100;
+	var height = parameters.height !== undefined ? parameters.height : 50;
+	var curveSegments = parameters.curveSegments !== undefined ? parameters.curveSegments: 4;
+	var font = parameters.font !== undefined ? parameters.font : "helvetiker";
+
+	THREE.FontUtils.size = size;
+	THREE.FontUtils.divisions = curveSegments;
+
+	// Get a Font data json object
+
+	var data = THREE.FontUtils.drawText( text );
+	//console.log( "data", data );
+
+	vertices = data.points;
+	faces = data.faces;
+	contour = data.contour;
+
+	var scope = this;
+
+	var i, face, vert, vlen = 0;
+
+	for ( i in vertices ) {
+
+		vert = vertices[ i ];
+		v( vert.x, vert.y, 0 );
+		vlen++;
+
+	}
+
+	for ( i in vertices ) {
+
+		vert = vertices[ i ];
+		v( vert.x, vert.y, height );
+
+	}
+
+	// Bottom faces
+
+	for ( i in faces ) {
+
+		face = faces[ i ];
+		f3( face[ 2 ], face[ 1 ], face[ 0 ] );
+
+	}
+
+	// Top faces
+
+	for ( i in faces ) {
+
+		face = faces[ i ];
+		f3( face[ 0 ] + vlen, face[ 1 ] + vlen, face[ 2 ] + vlen );
+
+	}
+
+	i = contour.length;
+
+	var j, k, lastV;
+
+	while ( --i > 0 ) {
+
+		if ( ! lastV ) {
+
+			lastV = contour[ i ];
+
+		} else if ( lastV.equals( contour[ i ] ) ) {
+
+			lastV  = null;
+			continue;
+
+		}
+
+		for ( j = 0; j < vertices.length; j++ ) {
+
+			if ( vertices[ j ].equals( contour[ i ] ) ) break;
+
+		}
+
+		for ( k = 0; k < vertices.length; k++ ) {
+
+			if ( vertices[ k ].equals( contour[ i - 1 ] ) ) break;
+
+		}
+
+		f4( j, k, k + vlen, j + vlen );
+
+	}
+
+
+	// UVs to be added
+
+	this.computeCentroids();
+	this.computeFaceNormals();
+	//this.computeVertexNormals();
+
+	function v( x, y, z ) {
+
+		scope.vertices.push( new THREE.Vertex( new THREE.Vector3( x, y, z ) ) );
+
+	}
+
+	function f3( a, b, c) {
+
+		scope.faces.push( new THREE.Face3( a, b, c) );
+
+	}
+
+	function f4( a, b, c, d) {
+
+		scope.faces.push( new THREE.Face4( a, b, c, d) );
+
+	}
+
+};
+
+THREE.Text.prototype = new THREE.Geometry();
+THREE.Text.prototype.constructor = THREE.Text;
+
+
+THREE.FontUtils = {
+
+	faces : {},
+
+	// Just for now. face[weight][style]
+
+	face : "helvetiker",
+	weight: "normal",
+	style : "normal",
+	size : 150,
+	divisions : 10,
+
+	getFace : function() {
+
+		return this.faces[ this.face ][ this.weight ][ this.style ];
+
+	},
+
+	loadFace : function( data ) {
+
+		var family = data.familyName.toLowerCase();
+
+		var ThreeFont = this;
+		ThreeFont.faces[ family ] = ThreeFont.faces[ family ] || {};
+
+		ThreeFont.faces[ family ][ data.cssFontWeight ] = ThreeFont.faces[ family ][ data.cssFontWeight ] || {};
+		ThreeFont.faces[ family ][ data.cssFontWeight ][ data.cssFontStyle ] = data;
+
+		var face = ThreeFont.faces[ family ][ data.cssFontWeight ][ data.cssFontStyle ] = data;
+
+		return data;
+
+	},
+
+
+	extractPoints : function( points ) {
+
+		// Quick Exit
+
+		if ( points.length < 3 ) {
+
+			console.log( "not valid polygon" );
+			return;
+
+		}
+
+		// Try to split shapes and holes.
+
+		var all = [], point, shape;
+
+		var isolatedShapes = [];
+	
+		// Use a quick hashmap for locating duplicates
+
+		for ( var p in points ) {
+
+			point = points[ p ];
+
+			all.push( point.x + "," + point.y );
+
+		}
+
+		var firstPt = all[ 0 ];
+		var endPt = all.slice( 1 ).indexOf( firstPt );
+
+		if ( endPt < all.length ) {
+
+			endPt ++;
+			shape = points.slice( 0, endPt );
+
+		}
+
+		holes = [];
+
+		while ( endPt < all.length ) {
+
+			firstIndex = endPt + 1;
+			firstPt = all[ firstIndex ];
+			endPt = all.slice( firstIndex + 1 ).indexOf( firstPt ) + firstIndex;
+			if ( endPt <= firstIndex ) break; 
+
+			var contours = points.slice( firstIndex, endPt + 1 );
+
+			if ( this.Triangulate.area( contours ) < 0 ) {
+
+				isolatedShapes.push( { shape: shape, holes: holes } );
+
+				// Save the old shapes, then work on new additional separated shape
+
+				shape = contours;
+				holes = [];
+
+			} else {
+
+				holes.push( contours );
+
+			}
+
+			endPt++;
+
+		}
+
+		isolatedShapes.push( { shape: shape, holes: holes } );
+
+		//console.log("isolatedShapes", isolatedShapes);
+
+		// For each isolated shape, find the closest points and break to the hole to allow triangulation
+
+		// Find closest points between holes
+
+		// we could optimize with
+		// http://en.wikipedia.org/wiki/Proximity_problems
+		// http://en.wikipedia.org/wiki/Closest_pair_of_points
+		// http://stackoverflow.com/questions/1602164/shortest-distance-between-points-algorithm
+
+		var verts = [];
+
+		for ( var shapeId in isolatedShapes ) {
+
+			var shapeGroup = isolatedShapes[ shapeId ];
+			shape = shapeGroup.shape;
+			holes = shapeGroup.holes;
+
+			for ( var h in holes ) {
+
+				// we slice to each hole when neccessary
+
+				var hole = holes[ h ];
+				var shortest = Number.POSITIVE_INFINITY;
+				var holeIndex, shapeIndex;
+
+				for ( var h2 in hole ) {
+
+					var pts1 = hole[ h2 ];
+
+					for ( var p in shape ) {
+
+						var pts2 = shape[ p ];
+						d = pts1.distanceTo( pts2 );
+					
+						if ( d<shortest ) {
+
+							shortest = d;
+							holeIndex = h2;
+							shapeIndex = p;
+
+						}
+
+					}
+
+				}
+
+				prevShapeVert = ( shapeIndex - 1 ) >= 0 ? shapeIndex - 1 : shape.length - 1;
+				nextShapeVert = ( shapeIndex + 1 ) < shape.length ? shapeIndex + 1 : 0;
+
+				prevHoleVert = ( holeIndex - 1 ) >= 0 ? holeIndex - 1 : hole.length - 1;
+				nextHoleVert = ( holeIndex + 1 ) < hole.length ? holeIndex + 1 : 0 ;
+
+				var tmpShape1 = shape.slice( 0, shapeIndex );
+				var tmpShape2 = shape.slice( shapeIndex );
+				var tmpHole1 = hole.slice( holeIndex );
+				var tmpHole2 = hole.slice( 0, holeIndex );
+
+				verts.push( hole[ holeIndex ] );
+				verts.push( shape[ shapeIndex ] );
+				verts.push( shape[ prevShapeVert ] );
+
+				verts.push( hole[ holeIndex ] );
+				verts.push( hole[ prevHoleVert ] );
+				verts.push( shape[ shapeIndex ] );
+
+				shapeGroup.shape = tmpShape1.concat( tmpHole1 ).concat( tmpHole2 ).concat( tmpShape2 );
+
+			}
+
+		}
+	
+		points = [];
+		var triangulatedVertices = [];
+		var lastTriangles = 0;
+
+		for ( var shapeId in isolatedShapes ) {
+
+			var shapeGroup = isolatedShapes[ shapeId ];
+
+			shape = shapeGroup.shape;
+			points = points.concat( shape );
+
+			var triangles = THREE.FontUtils.Triangulate( shape, true );
+
+			// We need to offset vertex indices for faces
+
+			for ( var v in triangles ) {
+
+				var face = triangles[ v ];
+
+				face[ 0 ] += lastTriangles;
+				face[ 1 ] += lastTriangles;
+				face[ 2 ] += lastTriangles;
+
+			}
+
+			triangulatedVertices = triangulatedVertices.concat( triangles );
+			lastTriangles += shape.length;
+
+		}
+
+		// Now we push the "cutted" vertices back to the triangulated indices.
+		//console.log("we have verts.length",verts.length);
+
+		var j;
+		for ( var v = 0; v < verts.length / 3; v++ ) {
+
+			var face = [];
+
+			for ( var k = 0; k < 3; k++ ) {
+
+				for ( j = 0; j < points.length; j++ ) {
+
+					var l = v * 3 + k;
+
+					if ( points[ j ].equals( verts[ l ] ) ) {
+
+						face.push( j );
+						break;
+
+					}
+
+				}
+
+			}
+
+			triangulatedVertices.push( face );
+
+	   }
+
+
+		//console.log("triangles", triangulatedVertices.length, "points", points);
+
+		return {
+
+			points: points,
+			faces: triangulatedVertices
+
+		};
+
+	},
+
+	drawText : function( text ) {
+
+		var pts = [];
+
+		// RenderText
+
+		var face = this.getFace(),
+			scale = ( this.size / face.resolution ),
+			offset = 0, i, 
+			chars = String( text ).split( '' ),
+			length = chars.length;
+
+		for ( i = 0; i < length; i++ ) {
+
+			offset += this.extractGlyphPoints( pts, chars[ i ], face, scale, offset );
+
+		}
+
+		// get the width
+
+		var width = offset / 2;
+		for ( var p in pts ) {
+
+			pts[ p ].x -= width;
+
+		}
+
+		var extract = this.extractPoints( pts );
+
+		extract.contour = pts;
+		return extract;
+
+	},
+
+
+	// Bezier Curves formuals obtained from
+	// http://en.wikipedia.org/wiki/B%C3%A9zier_curve
+
+	// Quad Bezier Functions
+
+	b2p0: function ( t, p ) {
+
+		return ( 1 - t ) * ( 1 - t ) * p;
+
+	},
+
+	b2p1: function ( t, p ) {
+
+		return 2 * ( 1 - t ) * t * p;
+
+	},
+
+	b2p2: function ( t, p ) {
+
+		return t * t * p;
+
+	},
+
+	b2: function ( t, p0, p1, p2 ) {
+
+		return this.b2p0( t, p0 ) + this.b2p1( t, p1 ) + this.b2p2( t, p2 );
+
+	},
+
+	// Cubic Bezier Functions
+
+	b3p0: function ( t, p ) {
+
+		var k = 1 - t;
+		return k * k * k * p;
+
+	},
+
+	b3p1: function ( t, p ) {
+
+		var k = 1 - t;
+		return 3 * k * k * t * p;
+
+	},
+
+	b3p2: function ( t, p ) {
+
+		var k = 1 - t;
+		return 3 * k * t * t * p;
+
+	},
+
+	b3p3: function ( t, p ) {
+
+		return t * t * t * p;
+
+	},
+
+	b3: function ( t, p0, p1, p2, p3 ) {
+
+		return this.b3p0( t, p0 ) + this.b3p1( t, p1 ) + this.b3p2( t, p2 ) +  this.b3p3( t, p3 );
+
+	},
+
+
+	extractGlyphPoints : function( pts, c, face, scale, offset ) {
+
+		var i, cpx, cpy, outline, action, length,
+			glyph = face.glyphs[ c ] || face.glyphs[ ctxt.options.fallbackCharacter ];
+	
+		if ( !glyph ) return;
+
+		if ( glyph.o ) {
+
+			outline = glyph._cachedOutline || ( glyph._cachedOutline = glyph.o.split( ' ' ) );
+			length = outline.length;
+
+			var scaleX = scale;
+			var scaleY = scale;
+
+			for ( i = 0; i < length; ) {
+
+				action = outline[i++];
+  
+				switch( action ) {
+
+				case 'm':
+
+					// Move To
+
+					x = outline[ i++ ] * scaleX + offset;
+					y = outline[ i++ ] * scaleY;
+					pts.push( new THREE.Vector2( x, y ) );
+					break;
+
+				case 'l':
+
+					// Line To
+
+					x = outline[ i++ ] * scaleX + offset;
+					y = outline[ i++ ] * scaleY;
+					pts.push( new THREE.Vector2( x, y ) );
+					break;
+
+				case 'q':
+
+					// quadraticCurveTo
+
+					cpx  = outline[ i++ ] * scaleX + offset;
+					cpy  = outline[ i++ ] * scaleY;
+					cpx1 = outline[ i++ ] * scaleX + offset;
+					cpy1 = outline[ i++ ] * scaleY;
+			  
+					var laste = pts[ pts.length - 1 ];
+			  
+					if ( laste ) {
+
+						cpx0 = laste.x;
+						cpy0 = laste.y;
+				
+						for ( var i2 = 1, divisions = this.divisions; i2 <= divisions; i2++ ) {
+
+							var t = i2 / divisions;
+							var tx = THREE.FontUtils.b2( t, cpx0, cpx1, cpx );
+							var ty = THREE.FontUtils.b2( t, cpy0, cpy1, cpy );
+							pts.push( new THREE.Vector2( tx, ty ) );
+
+						}
+					}
+
+					break;
+
+				case 'b':
+
+					// Cubic Bezier Curve
+
+					cpx = outline[ i++ ] * scaleX + offset;
+					cpy = outline[ i++ ] * scaleY;
+
+					cpx1 = outline[ i++ ] * scale + offset;
+					cpy1 = outline[ i++ ] * -scale;
+					cpx2 = outline[ i++ ] * scale + offset;
+					cpy2 = outline[ i++ ] * -scale;
+
+					var laste = pts[ pts.length - 1 ];
+
+					if ( laste ) {
+
+						cpx0 = laste.x;
+						cpy0 = laste.y;
+
+						for ( var i2 = 1, divisions = this.divisions; i2 <= divisions; i2++ ) {
+
+							var t = i2 / divisions;
+							var tx = THREE.FontUtils.b3( t, cpx0, cpx1, cpx2, cpx );
+							var ty = THREE.FontUtils.b3( t, cpy0, cpy1, cpy2, cpy );
+							pts.push( new THREE.Vector2( tx, ty ) );
+
+						}
+
+					}
+
+					break;
+
+				}
+
+			}
+
+		}
+
+		return glyph.ha * scale;
+
+	}
+
+};
+
+
+
+/**
+ *	This code is a quick port of code written in C++ which was submitted to 
+ *	flipcode.com by John W. Ratcliff  // July 22, 2000 
+ *	See original code and more information here:
+ *	http://www.flipcode.com/archives/Efficient_Polygon_Triangulation.shtml
+ *
+ *	ported to actionscript by Zevan Rosser
+ *	www.actionsnippet.com
+ *
+ *	ported to javascript by Joshua Koo
+ *	http://www.lab4games.net/zz85/blog
+ *
+*/
+
+
+( function( namespace ) {
+
+	var EPSILON = 0.0000000001;
+
+	// takes in an contour array and returns
+
+	var process = function( contour, indices ) {
+
+		var result = [];
+		var n = contour.length;
+		if ( n < 3 ) return null
+
+		var verts = [], vertIndices = [];
+
+		/* we want a counter-clockwise polygon in verts */
+
+		var v;
+
+		if ( 0.0 < area( contour ) ) {
+
+			for ( v = 0; v < n; v++ ) verts[ v ] = v;
+
+		} else {
+
+			for ( v=0; v < n; v++ ) verts[ v ] = ( n - 1 ) - v;
+
+		}
+
+		var nv = n;
+
+		/*  remove nv-2 vertices, creating 1 triangle every time */
+
+		var count = 2 * nv;   /* error detection */
+
+		var m;
+
+		for( m = 0, v = nv - 1; nv > 2; ) {
+
+			/* if we loop, it is probably a non-simple polygon */
+
+			if ( 0 >= ( count-- ) ){
+
+				//** Triangulate: ERROR - probable bad polygon!
+
+				console.log( "Warning, unable to triangulate polygon!" );
+				return null;
+
+			}
+
+			/* three consecutive vertices in current polygon, <u,v,w> */
+
+			var u = v; if ( nv <= u ) u = 0;     		/* previous */
+			v = u + 1; if ( nv <= v ) v = 0;     		/* new v    */
+			var w = v + 1; if ( nv <= w ) w = 0;     	/* next     */
+
+			if ( snip( contour, u, v, w, nv, verts ) ) {
+
+				var a, b, c, s, t;
+
+				/* true names of the vertices */
+
+				a = verts[ u ]; 
+				b = verts[ v ]; 
+				c = verts[ w ];
+
+				/* output Triangle */
+
+				result.push( contour[ a ] );
+				result.push( contour[ b ] );
+				result.push( contour[ c ] );
+				vertIndices.push( [ verts[ u ], verts[ v ], verts[ w ] ] );
+				//vertIndices.push( THREE.Face3( verts[ u ], verts[ v ], verts[ w ] ) );
+
+				m++;
+
+				/* remove v from remaining polygon */
+
+				for( s = v, t = v + 1; t < nv; s++, t++ ) {
+
+					verts[ s ] = verts[ t ]; 
+
+				}
+
+				nv--;
+
+				/* resest error detection counter */
+				count = 2 * nv;
+
+			}
+
+		}
+
+		if ( indices ) return vertIndices;
+		return result;
+
+	};
+
+	// calculate area of the contour polygon
+
+	var area = function ( contour ){
+
+		var n = contour.length;
+		var a  = 0.0;
+
+		for( var p = n - 1, q = 0; q < n; p = q++ ){
+
+			a += contour[ p ].x * contour[ q ].y - contour[ q ].x * contour[ p ].y;
+
+		}
+
+		return a * 0.5;
+
+	};
+
+	// see if p is inside triangle abc
+
+	var insideTriangle = function(ax, ay, bx, by, cx, cy, px, py) {
+
+		var aX, aY, bX, bY;
+		var cX, cY, apx, apy;
+		var bpx, bpy, cpx, cpy;
+		var cCROSSap, bCROSScp, aCROSSbp;
+
+		aX = cx - bx;  aY = cy - by;
+		bX = ax - cx;  bY = ay - cy;
+		cX = bx - ax;  cY = by - ay;
+		apx= px  -ax;  apy= py - ay;
+		bpx= px - bx;  bpy= py - by;
+		cpx= px - cx;  cpy= py - cy;
+
+		aCROSSbp = aX*bpy - aY*bpx;
+		cCROSSap = cX*apy - cY*apx;
+		bCROSScp = bX*cpy - bY*cpx;
+
+		return ( ( aCROSSbp >= 0.0 ) && ( bCROSScp >= 0.0 ) && ( cCROSSap >= 0.0 ) );
+
+	};
+
+
+	var snip =  function ( contour, u, v, w, n, verts ) {
+
+	var p;
+	var ax, ay, bx, by;
+	var cx, cy, px, py;
+
+	ax = contour[ verts[ u ] ].x;
+	ay = contour[ verts[ u ] ].y;
+
+	bx = contour[ verts[ v ] ].x;
+	by = contour[ verts[ v ] ].y;
+
+	cx = contour[ verts[ w ] ].x;
+	cy = contour[ verts[ w ] ].y;
+
+	if ( EPSILON > ( ( ( bx - ax ) * ( cy - ay ) ) - ( ( by - ay ) * ( cx - ax ) ) ) ) return false;
+
+		for ( p = 0; p < n; p++ ) {
+
+			if( ( p == u ) || ( p == v ) || ( p == w ) ) continue;
+
+			px = contour[ verts[ p ] ].x
+			py = contour[ verts[ p ] ].y
+
+			if ( insideTriangle( ax, ay, bx, by, cx, cy, px, py ) ) return false;
+
+		}
+
+		return true;
+
+	};
+
+
+	namespace.Triangulate = process;
+	namespace.Triangulate.area = area;
+
+	return namespace;
+
+})( THREE.FontUtils );
+
+// To use the typeface.js face files, hook up the API
+
+window._typeface_js = { faces: THREE.FontUtils.faces, loadFace: THREE.FontUtils.loadFace };
+

+ 1 - 0
utils/build.py

@@ -102,6 +102,7 @@ EXTRAS_FILES = [
 'extras/geometries/Sphere.js',
 'extras/geometries/Torus.js',
 'extras/geometries/TorusKnot.js',
+'extras/geometries/Text.js',
 'extras/io/Loader.js',
 'extras/io/JSONLoader.js',
 'extras/io/BinaryLoader.js',

部分文件因为文件数量过多而无法显示