瀏覽代碼

Merge remote-tracking branch 'alteredq/master'

Mr.doob 14 年之前
父節點
當前提交
39d662029d

文件差異過大導致無法顯示
+ 110 - 110
build/Three.js


+ 58 - 56
build/custom/ThreeExtras.js

@@ -1,8 +1,8 @@
 // ThreeExtras.js r41/ROME - http://github.com/mrdoob/three.js
 THREE.ColorUtils={adjustHSV:function(a,b,c,d){var e=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(a,e);e.h=THREE.ColorUtils.clamp(e.h+b,0,1);e.s=THREE.ColorUtils.clamp(e.s+c,0,1);e.v=THREE.ColorUtils.clamp(e.v+d,0,1);a.setHSV(e.h,e.s,e.v)},rgbToHsv:function(a,b){var c=a.r,d=a.g,e=a.b,f=Math.max(Math.max(c,d),e),g=Math.min(Math.min(c,d),e);if(g==f)g=c=0;else{var j=f-g,g=j/f,c=c==f?(d-e)/j:d==f?2+(e-c)/j:4+(c-d)/j;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=g;b.v=f;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,d=a.vertices.length,e=c?b.geometry:b,f=a.vertices,g=e.vertices,j=a.faces,h=e.faces,k=a.faceVertexUvs[0],e=e.faceVertexUvs[0];c&&b.matrixAutoUpdate&&b.updateMatrix();for(var l=0,m=g.length;l<m;l++){var n=new THREE.Vertex(g[l].position.clone());c&&b.matrix.multiplyVector3(n.position);f.push(n)}l=0;for(m=h.length;l<m;l++){var g=h[l],p,t,v=g.vertexNormals,n=g.vertexColors;g instanceof THREE.Face3?p=new THREE.Face3(g.a+d,g.b+d,g.c+d):
-g instanceof THREE.Face4&&(p=new THREE.Face4(g.a+d,g.b+d,g.c+d,g.d+d));p.normal.copy(g.normal);c=0;for(f=v.length;c<f;c++)t=v[c],p.vertexNormals.push(t.clone());p.color.copy(g.color);c=0;for(f=n.length;c<f;c++)t=n[c],p.vertexColors.push(t.clone());p.materials=g.materials.slice();p.centroid.copy(g.centroid);j.push(p)}l=0;for(m=e.length;l<m;l++){d=e[l];j=[];c=0;for(f=d.length;c<f;c++)j.push(new THREE.UV(d[c].u,d[c].v));k.push(j)}}};
+var GeometryUtils={merge:function(a,b){var c=b instanceof THREE.Mesh,d=a.vertices.length,e=c?b.geometry:b,f=a.vertices,g=e.vertices,j=a.faces,h=e.faces,k=a.faceVertexUvs[0],e=e.faceVertexUvs[0];c&&b.matrixAutoUpdate&&b.updateMatrix();for(var l=0,m=g.length;l<m;l++){var n=new THREE.Vertex(g[l].position.clone());c&&b.matrix.multiplyVector3(n.position);f.push(n)}l=0;for(m=h.length;l<m;l++){var g=h[l],o,t,v=g.vertexNormals,n=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);c=0;for(f=v.length;c<f;c++)t=v[c],o.vertexNormals.push(t.clone());o.color.copy(g.color);c=0;for(f=n.length;c<f;c++)t=n[c],o.vertexColors.push(t.clone());o.materials=g.materials.slice();o.centroid.copy(g.centroid);j.push(o)}l=0;for(m=e.length;l<m;l++){d=e[l];j=[];c=0;for(f=d.length;c<f;c++)j.push(new THREE.UV(d[c].u,d[c].v));k.push(j)}}};
 THREE.ImageUtils={loadTexture:function(a,b,c){var d=new Image,e=new THREE.Texture(d,b);d.onload=function(){e.needsUpdate=!0;c&&c(this)};d.src=a;return e},loadTextureCube:function(a,b,c){var d,e=[],f=new THREE.Texture(e,b),b=e.loadCount=0;for(d=a.length;b<d;++b)e[b]=new Image,e[b].onload=function(){e.loadCount+=1;if(e.loadCount==6)f.needsUpdate=!0;c&&c(this)},e[b].src=a[b];return f}};
 THREE.SceneUtils={addMesh:function(a,b,c,d,e,f,g,j,h,k){b=new THREE.Mesh(b,k);b.scale.x=b.scale.y=b.scale.z=c;b.position.x=d;b.position.y=e;b.position.z=f;b.rotation.x=g;b.rotation.y=j;b.rotation.z=h;a.addObject(b);return b},addPanoramaCubeWebGL:function(a,b,c){var d=THREE.ShaderUtils.lib.cube;d.uniforms.tCube.texture=c;c=new THREE.MeshShaderMaterial({fragmentShader:d.fragmentShader,vertexShader:d.vertexShader,uniforms:d.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 d=[];d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[0])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[1])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[2])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[3])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[4])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[5])}));b=new THREE.Mesh(new THREE.Cube(b,b,b,1,1,d,!0),
@@ -27,11 +27,11 @@ THREE.Animation.prototype.play=function(a,b){if(!this.isPlaying){this.isPlaying=
 THREE.Bone?e.skinMatrix:e.matrix;var f=e.animationCache.prevKey;e=e.animationCache.nextKey;f.pos=this.data.hierarchy[c].keys[0];f.rot=this.data.hierarchy[c].keys[0];f.scl=this.data.hierarchy[c].keys[0];e.pos=this.getNextKeyWith("pos",c,1);e.rot=this.getNextKeyWith("rot",c,1);e.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 b=["pos","rot","scl"],c,d,e,f,g,j,h,k,l=this.data.JIT.hierarchy,m,n;this.currentTime+=a*this.timeScale;n=this.currentTime;m=this.currentTime%=this.data.length;k=parseInt(Math.min(m*this.data.fps,this.data.length*this.data.fps),10);for(var p=0,t=this.hierarchy.length;p<t;p++)if(a=this.hierarchy[p],h=a.animationCache,this.JITCompile&&l[p][k]!==void 0)a instanceof THREE.Bone?(a.skinMatrix=l[p][k],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=
-!1):(a.matrix=l[p][k],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=!0);else{if(this.JITCompile)a instanceof THREE.Bone?a.skinMatrix=a.animationCache.originalMatrix:a.matrix=a.animationCache.originalMatrix;for(var v=0;v<3;v++){c=b[v];g=h.prevKey[c];j=h.nextKey[c];if(j.time<=n){if(m<n)if(this.loop){g=this.data.hierarchy[p].keys[0];for(j=this.getNextKeyWith(c,p,1);j.time<m;)g=j,j=this.getNextKeyWith(c,p,j.index+1)}else{this.stop();return}else{do g=j,j=this.getNextKeyWith(c,p,j.index+1);while(j.time<
-m)}h.prevKey[c]=g;h.nextKey[c]=j}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;d=(m-g.time)/(j.time-g.time);e=g[c];f=j[c];if(d<0||d>1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+d+" on bone "+p),d=d<0?0:1;if(c==="pos")if(c=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)c.x=e[0]+(f[0]-e[0])*d,c.y=e[1]+(f[1]-e[1])*d,c.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",p,g.index-1).pos,this.points[1]=e,this.points[2]=f,this.points[3]=this.getNextKeyWith("pos",p,j.index+1).pos,d=d*0.33+0.33,e=this.interpolateCatmullRom(this.points,d),c.x=e[0],c.y=e[1],c.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(c),this.target.y=0,this.target.normalize(),d=Math.atan2(this.target.x,this.target.z),a.rotation.set(0,d,0)}else if(c===
-"rot")THREE.Quaternion.slerp(e,f,a.quaternion,d);else if(c==="scl")c=a.scale,c.x=e[0]+(f[0]-e[0])*d,c.y=e[1]+(f[1]-e[1])*d,c.z=e[2]+(f[2]-e[2])*d}}if(this.JITCompile&&l[0][k]===void 0){this.hierarchy[0].update(void 0,!0);for(p=0;p<this.hierarchy.length;p++)l[p][k]=this.hierarchy[p]instanceof THREE.Bone?this.hierarchy[p].skinMatrix.clone():this.hierarchy[p].matrix.clone()}}};
+THREE.Animation.prototype.update=function(a){if(this.isPlaying){var b=["pos","rot","scl"],c,d,e,f,g,j,h,k,l=this.data.JIT.hierarchy,m,n;this.currentTime+=a*this.timeScale;n=this.currentTime;m=this.currentTime%=this.data.length;k=parseInt(Math.min(m*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&&l[o][k]!==void 0)a instanceof THREE.Bone?(a.skinMatrix=l[o][k],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=
+!1):(a.matrix=l[o][k],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=!0);else{if(this.JITCompile)a instanceof THREE.Bone?a.skinMatrix=a.animationCache.originalMatrix:a.matrix=a.animationCache.originalMatrix;for(var v=0;v<3;v++){c=b[v];g=h.prevKey[c];j=h.nextKey[c];if(j.time<=n){if(m<n)if(this.loop){g=this.data.hierarchy[o].keys[0];for(j=this.getNextKeyWith(c,o,1);j.time<m;)g=j,j=this.getNextKeyWith(c,o,j.index+1)}else{this.stop();return}else{do g=j,j=this.getNextKeyWith(c,o,j.index+1);while(j.time<
+m)}h.prevKey[c]=g;h.nextKey[c]=j}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;d=(m-g.time)/(j.time-g.time);e=g[c];f=j[c];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(c==="pos")if(c=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)c.x=e[0]+(f[0]-e[0])*d,c.y=e[1]+(f[1]-e[1])*d,c.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),c.x=e[0],c.y=e[1],c.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(c),this.target.y=0,this.target.normalize(),d=Math.atan2(this.target.x,this.target.z),a.rotation.set(0,d,0)}else if(c===
+"rot")THREE.Quaternion.slerp(e,f,a.quaternion,d);else if(c==="scl")c=a.scale,c.x=e[0]+(f[0]-e[0])*d,c.y=e[1]+(f[1]-e[1])*d,c.z=e[2]+(f[2]-e[2])*d}}if(this.JITCompile&&l[0][k]===void 0){this.hierarchy[0].update(void 0,!0);for(o=0;o<this.hierarchy.length;o++)l[o][k]=this.hierarchy[o]instanceof THREE.Bone?this.hierarchy[o].skinMatrix.clone():this.hierarchy[o].matrix.clone()}}};
 THREE.Animation.prototype.interpolateCatmullRom=function(a,b){var c=[],d=[],e,f,g,j,h,k;e=(a.length-1)*b;f=Math.floor(e);e-=f;c[0]=f==0?f:f-1;c[1]=f;c[2]=f>a.length-2?f:f+1;c[3]=f>a.length-3?f:f+2;f=a[c[0]];j=a[c[1]];h=a[c[2]];k=a[c[3]];c=e*e;g=e*c;d[0]=this.interpolate(f[0],j[0],h[0],k[0],e,c,g);d[1]=this.interpolate(f[1],j[1],h[1],k[1],e,c,g);d[2]=this.interpolate(f[2],j[2],h[2],k[2],e,c,g);return d};
 THREE.Animation.prototype.interpolate=function(a,b,c,d,e,f,g){a=(c-a)*0.5;d=(d-b)*0.5;return(2*(b-c)+a+d)*g+(-3*(b-c)-2*a-d)*f+a*e+b};THREE.Animation.prototype.getNextKeyWith=function(a,b,c){var d=this.data.hierarchy[b].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c=c<d.length-1?c:d.length-1:c%=d.length;c<d.length;c++)if(d[c][a]!==void 0)return d[c];return this.data.hierarchy[b].keys[0]};
 THREE.Animation.prototype.getPrevKeyWith=function(a,b,c){for(var d=this.data.hierarchy[b].keys,c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c>0?c:0:c>=0?c:c+d.length;c>=0;c--)if(d[c][a]!==void 0)return d[c];return this.data.hierarchy[b].keys[d.length-1]};
@@ -65,12 +65,12 @@ this.rollSpeed;this.translateX(this.moveVector.x*a);this.translateY(this.moveVec
 this.autoForward&&!this.moveState.back?1:0;this.moveVector.x=-this.moveState.left+this.moveState.right;this.moveVector.y=-this.moveState.down+this.moveState.up;this.moveVector.z=-a+this.moveState.back};this.updateRotationVector=function(){this.rotationVector.x=-this.moveState.pitchDown+this.moveState.pitchUp;this.rotationVector.y=-this.moveState.yawRight+this.moveState.yawLeft;this.rotationVector.z=-this.moveState.rollRight+this.moveState.rollLeft};this.getContainerDimensions=function(){return this.domElement!=
 document?{size:[this.domElement.offsetWidth,this.domElement.offsetHeight],offset:[this.domElement.offsetLeft,this.domElement.offsetTop]}:{size:[window.innerWidth,window.innerHeight],offset:[0,0]}};this.domElement.addEventListener("mousemove",b(this,this.mousemove),!1);this.domElement.addEventListener("mousedown",b(this,this.mousedown),!1);this.domElement.addEventListener("mouseup",b(this,this.mouseup),!1);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,b,c,d){THREE.Camera.call(this,a,b,c,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,k=1,l=0,m=0,n=0,p=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*p),this.rotateVertically(a*t));a=this.delta*this.movementSpeed;this.translateZ(a*(l>0||this.autoForward&&!(l<0)?1:l));this.translateX(a*m);this.translateY(a*n);h&&(this.roll+=this.rollSpeed*this.delta*k);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize();
+THREE.RollCamera=function(a,b,c,d){THREE.Camera.call(this,a,b,c,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,k=1,l=0,m=0,n=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*(l>0||this.autoForward&&!(l<0)?1:l));this.translateX(a*m);this.translateY(a*n);h&&(this.roll+=this.rollSpeed*this.delta*k);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize();
 else if(this.forward.y<this.constrainVertical[0])this.forward.y=this.constrainVertical[0],this.forward.normalize();g.copy(this.forward);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);
 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){p=(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:l=1;break;case 2:l=-1}},!1);this.domElement.addEventListener("mouseup",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:l=0;break;case 2:l=0}},!1);this.domElement.addEventListener("keydown",function(a){switch(a.keyCode){case 38:case 87:l=1;break;case 37:case 65:m=-1;break;
+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:l=1;break;case 2:l=-1}},!1);this.domElement.addEventListener("mouseup",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:l=0;break;case 2:l=0}},!1);this.domElement.addEventListener("keydown",function(a){switch(a.keyCode){case 38:case 87:l=1;break;case 37:case 65:m=-1;break;
 case 40:case 83:l=-1;break;case 39:case 68:m=1;break;case 81:h=!0;k=1;break;case 69:h=!0;k=-1;break;case 82:n=1;break;case 70:n=-1}},!1);this.domElement.addEventListener("keyup",function(a){switch(a.keyCode){case 38:case 87:l=0;break;case 37:case 65:m=0;break;case 40:case 83:l=0;break;case 39:case 68:m=0;break;case 81:h=!1;break;case 69:h=!1;break;case 82:n=0;break;case 70:n=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 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||
@@ -83,9 +83,9 @@ b(this,function(a){c&&(f=g=this.getMouseProjectionOnBall(a.clientX,a.clientY),j=
 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||(k=l=this.getMouseOnScreen(a.clientX,a.clientY))}),!1);this.domElement.addEventListener("mouseup",b(this,function(a){a.preventDefault();a.stopPropagation();d=this.STATE.NONE}),!1);window.addEventListener("keydown",b(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&&(c=!0)}}),!1);window.addEventListener("keyup",b(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.prototype.STATE={NONE:-1,ROTATE:0,ZOOM:1,PAN:2};
-THREE.Cube=function(a,b,c,d,e,f,g,j,h){function k(a,c,b,g,j,h,k,m){var p,n,t=d||1,v=e||1,L=j/2,G=h/2,M=l.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=f||1;else if(a=="z"&&c=="y"||a=="y"&&c=="z")p="x",t=f||1;var H=t+1,A=v+1;j/=t;var I=h/v;for(n=0;n<A;n++)for(h=0;h<H;h++){var K=new THREE.Vector3;K[a]=(h*j-L)*b;K[c]=(n*I-G)*g;K[p]=k;l.vertices.push(new THREE.Vertex(K))}for(n=0;n<v;n++)for(h=0;h<t;h++)l.faces.push(new THREE.Face4(h+H*n+M,h+H*(n+
-1)+M,h+1+H*(n+1)+M,h+1+H*n+M,null,null,m)),l.faceVertexUvs[0].push([new THREE.UV(h/t,n/v),new THREE.UV(h/t,(n+1)/v),new THREE.UV((h+1)/t,(n+1)/v),new THREE.UV((h+1)/t,n/v)])}THREE.Geometry.call(this);var l=this,m=a/2,n=b/2,p=c/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&&k("z","y",1*j,-1,c,b,-m,this.materials[0]);this.sides.nx&&k("z","y",-1*j,-1,c,b,m,this.materials[1]);this.sides.py&&k("x","z",1*j,1,a,c,n,this.materials[2]);this.sides.ny&&k("x","z",1*j,-1,a,c,-n,this.materials[3]);this.sides.pz&&k("x","y",1*j,-1,a,b,p,this.materials[4]);this.sides.nz&&k("x","y",-1*j,-1,a,b,-p,this.materials[5]);(function(){for(var a=[],c=[],b=0,d=l.vertices.length;b<d;b++){for(var f=l.vertices[b],e=!1,g=0,j=a.length;g<j;g++){var h=a[g];if(f.position.x==h.position.x&&
+THREE.Cube=function(a,b,c,d,e,f,g,j,h){function k(a,c,b,g,j,h,k,m){var o,n,t=d||1,v=e||1,L=j/2,G=h/2,M=l.vertices.length;if(a=="x"&&c=="y"||a=="y"&&c=="x")o="z";else if(a=="x"&&c=="z"||a=="z"&&c=="x")o="y",v=f||1;else if(a=="z"&&c=="y"||a=="y"&&c=="z")o="x",t=f||1;var H=t+1,A=v+1;j/=t;var I=h/v;for(n=0;n<A;n++)for(h=0;h<H;h++){var K=new THREE.Vector3;K[a]=(h*j-L)*b;K[c]=(n*I-G)*g;K[o]=k;l.vertices.push(new THREE.Vertex(K))}for(n=0;n<v;n++)for(h=0;h<t;h++)l.faces.push(new THREE.Face4(h+H*n+M,h+H*(n+
+1)+M,h+1+H*(n+1)+M,h+1+H*n+M,null,null,m)),l.faceVertexUvs[0].push([new THREE.UV(h/t,n/v),new THREE.UV(h/t,(n+1)/v),new THREE.UV((h+1)/t,(n+1)/v),new THREE.UV((h+1)/t,n/v)])}THREE.Geometry.call(this);var l=this,m=a/2,n=b/2,o=c/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&&k("z","y",1*j,-1,c,b,-m,this.materials[0]);this.sides.nx&&k("z","y",-1*j,-1,c,b,m,this.materials[1]);this.sides.py&&k("x","z",1*j,1,a,c,n,this.materials[2]);this.sides.ny&&k("x","z",1*j,-1,a,c,-n,this.materials[3]);this.sides.pz&&k("x","y",1*j,-1,a,b,o,this.materials[4]);this.sides.nz&&k("x","y",-1*j,-1,a,b,-o,this.materials[5]);(function(){for(var a=[],c=[],b=0,d=l.vertices.length;b<d;b++){for(var f=l.vertices[b],e=!1,g=0,j=a.length;g<j;g++){var h=a[g];if(f.position.x==h.position.x&&
 f.position.y==h.position.y&&f.position.z==h.position.z){c[b]=g;e=!0;break}}if(!e)c[b]=a.length,a.push(new THREE.Vertex(f.position.clone()))}b=0;for(d=l.faces.length;b<d;b++)f=l.faces[b],f.a=c[f.a],f.b=c[f.b],f.c=c[f.c],f.d=c[f.d];l.vertices=a})();this.computeCentroids();this.computeFaceNormals()};THREE.Cube.prototype=new THREE.Geometry;THREE.Cube.prototype.constructor=THREE.Cube;
 THREE.Cylinder=function(a,b,c,d,e,f){function g(a,c,b){j.vertices.push(new THREE.Vertex(new THREE.Vector3(a,c,b)))}THREE.Geometry.call(this);var j=this,h,k=Math.PI*2,l=d/2;for(h=0;h<a;h++)g(Math.sin(k*h/a)*b,Math.cos(k*h/a)*b,-l);for(h=0;h<a;h++)g(Math.sin(k*h/a)*c,Math.cos(k*h/a)*c,l);for(h=0;h<a;h++)j.faces.push(new THREE.Face4(h,h+a,a+(h+1)%a,(h+1)%a));if(c>0){g(0,0,-l-(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(b>0){g(0,0,l+(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 b=[],c=this.faces[h],e=this.vertices[c.a],f=this.vertices[c.b],l=this.vertices[c.c],m=this.vertices[c.d];b.push(new THREE.UV(0.5+Math.atan2(e.position.x,e.position.y)/k,0.5+e.position.z/d));b.push(new THREE.UV(0.5+Math.atan2(f.position.x,f.position.y)/k,0.5+f.position.z/d));b.push(new THREE.UV(0.5+Math.atan2(l.position.x,l.position.y)/k,0.5+l.position.z/
@@ -97,9 +97,9 @@ THREE.Lathe=function(a,b,c){THREE.Geometry.call(this);this.steps=b||12;this.angl
 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-b)/this.angle,(j+1)/a.length),new THREE.UV(1-(h-b)/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,b,c,d){THREE.Geometry.call(this);var e,f=a/2,g=b/2,c=c||1,d=d||1,j=c+1,h=d+1;a/=c;var k=b/d;for(e=0;e<h;e++)for(b=0;b<j;b++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(b*a-f,-(e*k-g),0)));for(e=0;e<d;e++)for(b=0;b<c;b++)this.faces.push(new THREE.Face4(b+j*e,b+j*(e+1),b+1+j*(e+1),b+1+j*e)),this.faceVertexUvs[0].push([new THREE.UV(b/c,e/d),new THREE.UV(b/c,(e+1)/d),new THREE.UV((b+1)/c,(e+1)/d),new THREE.UV((b+1)/c,e/d)]);this.computeCentroids();this.computeFaceNormals()};
 THREE.Plane.prototype=new THREE.Geometry;THREE.Plane.prototype.constructor=THREE.Plane;
-THREE.Sphere=function(a,b,c){THREE.Geometry.call(this);for(var d,e=Math.PI,f=Math.max(3,b||8),g=Math.max(2,c||6),b=[],c=0;c<g+1;c++){d=c/g;var j=a*Math.cos(d*e),h=a*Math.sin(d*e),k=[],l=0;for(d=0;d<f;d++){var m=2*d/f,n=h*Math.sin(m*e),m=h*Math.cos(m*e);(c==0||c==g)&&d>0||(l=this.vertices.push(new THREE.Vertex(new THREE.Vector3(m,j,n)))-1);k.push(l)}b.push(k)}for(var p,t,v,e=b.length,c=0;c<e;c++)if(f=b[c].length,c>0)for(d=0;d<f;d++){k=d==f-1;g=b[c][k?0:d+1];j=b[c][k?f-1:d];h=b[c-1][k?f-1:d];k=b[c-
-1][k?0:d+1];n=c/(e-1);p=(c-1)/(e-1);t=(d+1)/f;var m=d/f,l=new THREE.UV(1-t,n),n=new THREE.UV(1-m,n),m=new THREE.UV(1-m,p),u=new THREE.UV(1-t,p);c<b.length-1&&(p=this.vertices[g].position.clone(),t=this.vertices[j].position.clone(),v=this.vertices[h].position.clone(),p.normalize(),t.normalize(),v.normalize(),this.faces.push(new THREE.Face3(g,j,h,[new THREE.Vector3(p.x,p.y,p.z),new THREE.Vector3(t.x,t.y,t.z),new THREE.Vector3(v.x,v.y,v.z)])),this.faceVertexUvs[0].push([l,n,m]));c>1&&(p=this.vertices[g].position.clone(),
-t=this.vertices[h].position.clone(),v=this.vertices[k].position.clone(),p.normalize(),t.normalize(),v.normalize(),this.faces.push(new THREE.Face3(g,h,k,[new THREE.Vector3(p.x,p.y,p.z),new THREE.Vector3(t.x,t.y,t.z),new THREE.Vector3(v.x,v.y,v.z)])),this.faceVertexUvs[0].push([l,m,u]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};THREE.Sphere.prototype=new THREE.Geometry;THREE.Sphere.prototype.constructor=THREE.Sphere;
+THREE.Sphere=function(a,b,c){THREE.Geometry.call(this);for(var d,e=Math.PI,f=Math.max(3,b||8),g=Math.max(2,c||6),b=[],c=0;c<g+1;c++){d=c/g;var j=a*Math.cos(d*e),h=a*Math.sin(d*e),k=[],l=0;for(d=0;d<f;d++){var m=2*d/f,n=h*Math.sin(m*e),m=h*Math.cos(m*e);(c==0||c==g)&&d>0||(l=this.vertices.push(new THREE.Vertex(new THREE.Vector3(m,j,n)))-1);k.push(l)}b.push(k)}for(var o,t,v,e=b.length,c=0;c<e;c++)if(f=b[c].length,c>0)for(d=0;d<f;d++){k=d==f-1;g=b[c][k?0:d+1];j=b[c][k?f-1:d];h=b[c-1][k?f-1:d];k=b[c-
+1][k?0:d+1];n=c/(e-1);o=(c-1)/(e-1);t=(d+1)/f;var m=d/f,l=new THREE.UV(1-t,n),n=new THREE.UV(1-m,n),m=new THREE.UV(1-m,o),u=new THREE.UV(1-t,o);c<b.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([l,n,m]));c>1&&(o=this.vertices[g].position.clone(),
+t=this.vertices[h].position.clone(),v=this.vertices[k].position.clone(),o.normalize(),t.normalize(),v.normalize(),this.faces.push(new THREE.Face3(g,h,k,[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([l,m,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,b,c,d){THREE.Geometry.call(this);this.radius=a||100;this.tube=b||40;this.segmentsR=c||8;this.segmentsT=d||6;a=[];for(b=0;b<=this.segmentsR;++b)for(c=0;c<=this.segmentsT;++c){var d=c/this.segmentsT*2*Math.PI,e=b/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([c/this.segmentsT,1-b/this.segmentsR])}for(b=1;b<=this.segmentsR;++b)for(c=
 1;c<=this.segmentsT;++c){var d=(this.segmentsT+1)*b+c,e=(this.segmentsT+1)*b+c-1,f=(this.segmentsT+1)*(b-1)+c-1,g=(this.segmentsT+1)*(b-1)+c;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,b,c,d,e,f,g){function j(a,c,b,d,f,e){c=b/d*a;b=Math.cos(c);return new THREE.Vector3(f*(2+b)*0.5*Math.cos(a),f*(2+b)*Math.sin(a)*0.5,e*f*Math.sin(c)*0.5)}THREE.Geometry.call(this);this.radius=a||200;this.tube=b||40;this.segmentsR=c||64;this.segmentsT=d||8;this.p=e||2;this.q=f||3;this.heightScale=g||1;this.grid=Array(this.segmentsR);c=new THREE.Vector3;d=new THREE.Vector3;f=new THREE.Vector3;for(a=0;a<this.segmentsR;++a){this.grid[a]=Array(this.segmentsT);for(b=0;b<this.segmentsT;++b){var h=
@@ -110,49 +110,51 @@ THREE.Text.prototype.set=function(a,b){this.text=a;var b=b||this.parameters,c=b.
 [];for(var h,g=d.length,k=j.length,f=0;f<g;f++)h=d[f],this.vertices.push(new THREE.Vertex(new THREE.Vector3(h.x,h.y,0)));for(f=0;f<g;f++)h=d[f],this.vertices.push(new THREE.Vertex(new THREE.Vector3(h.x,h.y,c)));for(f=0;f<k;f++)c=j[f],this.faces.push(new THREE.Face3(c[2],c[1],c[0]));for(f=0;f<k;f++)c=j[f],this.faces.push(new THREE.Face3(c[0]+g,c[1]+g,c[2]+g));for(var f=e.length,l;--f>0;){if(l){if(l.equals(e[f])){l=null;continue}}else l=e[f];for(c=0;c<g;c++)if(d[c].equals(e[f]))break;for(j=0;j<g;j++)if(d[j].equals(e[f-
 1]))break;this.faces.push(new THREE.Face4(c,j,j+g,c+g))}this.computeCentroids();this.computeFaceNormals()};
 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,b){if(a.length<3)return console.log("not valid polygon"),
-{points:a,faces:[]};var c,d,e,f,g=[],j;for(j in b){a=b[j];f=[];for(c in a)d=a[c],f.push(d.x+","+d.y);var h,k;k=f.slice(1).indexOf(f[0]);var l=this.Triangulate.area(a.slice(0,k+1))<0;d=[];for(k=-1;k<f.length;){h=k+1;k=f[h];k=f.slice(h+1).indexOf(k)+h;if(k<=h)break;var m=a.slice(h,k+1);l?this.Triangulate.area(m)<0?(h>0&&g.push({shape:e,holes:d}),e=m,d=[]):d.push(m):this.Triangulate.area(m)<0?(g.push({shape:m,holes:d}),d=[]):d.push(m);k++}l&&g.push({shape:e,holes:d})}var n,p,t,v,u,x;f=[];for(j=0;j<g.length;j++){h=
-g[j];e=h.shape;d=h.holes;for(l=0;l<d.length;l++){k=d[l];t=Number.POSITIVE_INFINITY;for(m=0;m<k.length;m++){u=k[m];for(c=0;c<e.length;c++)v=e[c],v=u.distanceTo(v),v<t&&(t=v,n=m,p=c)}c=p-1>=0?p-1:e.length-1;m=n-1>=0?n-1:k.length-1;t=e.slice(0,p);u=e.slice(p);v=k.slice(n);x=k.slice(0,n);f.push(k[n]);f.push(e[p]);f.push(e[c]);f.push(k[n]);f.push(k[m]);f.push(e[p]);e=t.concat(v).concat(x).concat(u)}h.shape=e}a=[];n=[];for(j=c=0;j<g.length;j++){h=g[j];e=h.shape;a=a.concat(e);h=THREE.FontUtils.Triangulate(e,
-!0);for(p=0;p<h.length;p++)d=h[p],d[0]+=c,d[1]+=c,d[2]+=c;n=n.concat(h);c+=e.length}var w;for(p=0;p<f.length/3;p++){d=[];for(g=0;g<3;g++){j=!1;for(e=0;e<a.length&&!j;e++)w=p*3+g,a[e].equals(f[w])&&(d.push(e),j=!0);j||(a.push(f[w]),d.push(a.length-1),console.log("not found"))}n.push(d)}return{points:a,faces:n}},drawText:function(a){var b=[],c=[],d;d=this.getFace();for(var e=this.size/d.resolution,f=0,g=String(a).split(""),j=g.length,a=0;a<j;a++){var h=this.extractGlyphPoints(g[a],d,e,f);f+=h.offset;
-b.push(h.points);c=c.concat(h.points)}e=f/2;for(d=0;d<c.length;d++)c[d].x-=e;b=this.extractPoints(c,b);b.contour=c;return b},b2p0:function(a,b){var c=1-a;return c*c*b},b2p1:function(a,b){return 2*(1-a)*a*b},b2p2:function(a,b){return a*a*b},b2:function(a,b,c,d){return this.b2p0(a,b)+this.b2p1(a,c)+this.b2p2(a,d)},b3p0:function(a,b){var c=1-a;return c*c*c*b},b3p1:function(a,b){var c=1-a;return 3*c*c*a*b},b3p2:function(a,b){return 3*(1-a)*a*a*b},b3p3:function(a,b){return a*a*a*b},b3:function(a,b,c,d,
-e){return this.b3p0(a,b)+this.b3p1(a,c)+this.b3p2(a,d)+this.b3p3(a,e)},extractGlyphPoints:function(a,b,c,d){var e=[],f,g,j,h,k,l,m,n,p,t,v=b.glyphs[a]||b.glyphs[ctxt.options.fallbackCharacter];if(v){if(v.o){b=v._cachedOutline||(v._cachedOutline=v.o.split(" "));j=b.length;for(a=0;a<j;)switch(g=b[a++],g){case "m":g=b[a++]*c+d;h=b[a++]*c;e.push(new THREE.Vector2(g,h));break;case "l":g=b[a++]*c+d;h=b[a++]*c;e.push(new THREE.Vector2(g,h));break;case "q":g=b[a++]*c+d;h=b[a++]*c;m=b[a++]*c+d;n=b[a++]*c;
-if(f=e[e.length-1]){k=f.x;l=f.y;f=1;for(divisions=this.divisions;f<=divisions;f++){var u=f/divisions,x=THREE.FontUtils.b2(u,k,m,g),u=THREE.FontUtils.b2(u,l,n,h);e.push(new THREE.Vector2(x,u))}}break;case "b":if(g=b[a++]*c+d,h=b[a++]*c,m=b[a++]*c+d,n=b[a++]*-c,p=b[a++]*c+d,t=b[a++]*-c,f=e[e.length-1]){k=f.x;l=f.y;f=1;for(divisions=this.divisions;f<=divisions;f++)u=f/divisions,x=THREE.FontUtils.b3(u,k,m,p,g),u=THREE.FontUtils.b3(u,l,n,t,h),e.push(new THREE.Vector2(x,u))}}}return{offset:v.ha*c,points:e}}}};
-(function(a){var b=function(a){for(var b=a.length,e=0,f=b-1,g=0;g<b;f=g++)e+=a[f].x*a[g].y-a[g].x*a[f].y;return e*0.5};a.Triangulate=function(a,d){var e=a.length;if(e<3)return null;var f=[],g=[],j=[],h,k,l;if(b(a)>0)for(k=0;k<e;k++)g[k]=k;else for(k=0;k<e;k++)g[k]=e-1-k;var m=2*e;for(k=e-1;e>2;){if(m--<=0){console.log("Warning, unable to triangulate polygon!");if(d)return j;return f}h=k;e<=h&&(h=0);k=h+1;e<=k&&(k=0);l=k+1;e<=l&&(l=0);var n;a:{n=a;var p=h,t=k,v=l,u=e,x=g,w=void 0,o=void 0,y=void 0,
-z=void 0,C=void 0,D=void 0,E=void 0,F=void 0,B=void 0,o=n[x[p]].x,y=n[x[p]].y,z=n[x[t]].x,C=n[x[t]].y,D=n[x[v]].x,E=n[x[v]].y;if(1.0E-10>(z-o)*(E-y)-(C-y)*(D-o))n=!1;else{for(w=0;w<u;w++)if(!(w==p||w==t||w==v)){var F=n[x[w]].x,B=n[x[w]].y,J=void 0,L=void 0,G=void 0,M=void 0,H=void 0,A=void 0,I=void 0,K=void 0,N=void 0,P=void 0,Q=void 0,R=void 0,J=G=H=void 0,J=D-z,L=E-C,G=o-D,M=y-E,H=z-o,A=C-y,I=F-o,K=B-y,N=F-z,P=B-C,Q=F-D,R=B-E,J=J*P-L*N,H=H*K-A*I,G=G*R-M*Q;if(J>=0&&G>=0&&H>=0){n=!1;break a}}n=!0}}if(n){m=
-g[h];n=g[k];p=g[l];f.push(a[m]);f.push(a[n]);f.push(a[p]);j.push([g[h],g[k],g[l]]);h=k;for(l=k+1;l<e;h++,l++)g[h]=g[l];e--;m=2*e}}if(d)return j;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(){}};
+{points:a,faces:[]};var c,d,e,f,g=[],j;for(j in b){a=b[j];f=[];for(c in a)d=a[c],f.push(d.x+","+d.y);var h,k;k=f.slice(1).indexOf(f[0]);var l=this.Triangulate.area(a.slice(0,k+1))<0;d=[];for(k=-1;k<f.length;){h=k+1;k=f[h];k=f.slice(h+1).indexOf(k)+h;if(k<=h)break;var m=a.slice(h,k+1);l?this.Triangulate.area(m)<0?(h>0&&g.push({shape:e,holes:d}),e=m,d=[]):d.push(m):this.Triangulate.area(m)<0?(g.push({shape:m,holes:d}),d=[]):d.push(m);k++}l&&g.push({shape:e,holes:d})}var n,o,t,v,u,x;f=[];for(j=0;j<g.length;j++){h=
+g[j];e=h.shape;d=h.holes;for(l=0;l<d.length;l++){k=d[l];t=Number.POSITIVE_INFINITY;for(m=0;m<k.length;m++){u=k[m];for(c=0;c<e.length;c++)v=e[c],v=u.distanceTo(v),v<t&&(t=v,n=m,o=c)}c=o-1>=0?o-1:e.length-1;var m=n-1>=0?n-1:k.length-1,w=[];w.push(k[n]);w.push(e[o]);w.push(e[c]);t=this.Triangulate.area(w);var p=[];p.push(k[n]);p.push(k[m]);p.push(e[o]);u=this.Triangulate.area(p);v=o;x=n;o+=1;n+=-1;o<0&&(o+=e.length);o%=e.length;n<0&&(n+=k.length);n%=e.length;c=o-1>=0?o-1:e.length-1;m=n-1>=0?n-1:k.length-
+1;w=[];w.push(k[n]);w.push(e[o]);w.push(e[c]);w=this.Triangulate.area(w);p=[];p.push(k[n]);p.push(k[m]);p.push(e[o]);p=this.Triangulate.area(p);t+u>w+p&&(o=v,n=x,o<0&&(o+=e.length),o%=e.length,n<0&&(n+=k.length),n%=e.length,c=o-1>=0?o-1:e.length-1,m=n-1>=0?n-1:k.length-1);t=e.slice(0,o);u=e.slice(o);v=k.slice(n);x=k.slice(0,n);f.push(k[n]);f.push(e[o]);f.push(e[c]);f.push(k[n]);f.push(k[m]);f.push(e[o]);e=t.concat(v).concat(x).concat(u)}h.shape=e}a=[];n=[];for(j=l=0;j<g.length;j++){h=g[j];e=h.shape;
+a=a.concat(e);h=THREE.FontUtils.Triangulate(e,!0);for(o=0;o<h.length;o++)d=h[o],d[0]+=l,d[1]+=l,d[2]+=l;n=n.concat(h);l+=e.length}var y;for(o=0;o<f.length/3;o++){d=[];for(g=0;g<3;g++){j=!1;for(e=0;e<a.length&&!j;e++)y=o*3+g,a[e].equals(f[y])&&(d.push(e),j=!0);j||(a.push(f[y]),d.push(a.length-1),console.log("not found"))}n.push(d)}return{points:a,faces:n}},drawText:function(a){var b=[],c=[],d;d=this.getFace();for(var e=this.size/d.resolution,f=0,g=String(a).split(""),j=g.length,a=0;a<j;a++){var h=
+this.extractGlyphPoints(g[a],d,e,f);f+=h.offset;b.push(h.points);c=c.concat(h.points)}e=f/2;for(d=0;d<c.length;d++)c[d].x-=e;b=this.extractPoints(c,b);b.contour=c;return b},b2p0:function(a,b){var c=1-a;return c*c*b},b2p1:function(a,b){return 2*(1-a)*a*b},b2p2:function(a,b){return a*a*b},b2:function(a,b,c,d){return this.b2p0(a,b)+this.b2p1(a,c)+this.b2p2(a,d)},b3p0:function(a,b){var c=1-a;return c*c*c*b},b3p1:function(a,b){var c=1-a;return 3*c*c*a*b},b3p2:function(a,b){return 3*(1-a)*a*a*b},b3p3:function(a,
+b){return a*a*a*b},b3:function(a,b,c,d,e){return this.b3p0(a,b)+this.b3p1(a,c)+this.b3p2(a,d)+this.b3p3(a,e)},extractGlyphPoints:function(a,b,c,d){var e=[],f,g,j,h,k,l,m,n,o,t,v=b.glyphs[a]||b.glyphs[ctxt.options.fallbackCharacter];if(v){if(v.o){b=v._cachedOutline||(v._cachedOutline=v.o.split(" "));j=b.length;for(a=0;a<j;)switch(g=b[a++],g){case "m":g=b[a++]*c+d;h=b[a++]*c;e.push(new THREE.Vector2(g,h));break;case "l":g=b[a++]*c+d;h=b[a++]*c;e.push(new THREE.Vector2(g,h));break;case "q":g=b[a++]*
+c+d;h=b[a++]*c;m=b[a++]*c+d;n=b[a++]*c;if(f=e[e.length-1]){k=f.x;l=f.y;f=1;for(divisions=this.divisions;f<=divisions;f++){var u=f/divisions,x=THREE.FontUtils.b2(u,k,m,g),u=THREE.FontUtils.b2(u,l,n,h);e.push(new THREE.Vector2(x,u))}}break;case "b":if(g=b[a++]*c+d,h=b[a++]*c,m=b[a++]*c+d,n=b[a++]*-c,o=b[a++]*c+d,t=b[a++]*-c,f=e[e.length-1]){k=f.x;l=f.y;f=1;for(divisions=this.divisions;f<=divisions;f++)u=f/divisions,x=THREE.FontUtils.b3(u,k,m,o,g),u=THREE.FontUtils.b3(u,l,n,t,h),e.push(new THREE.Vector2(x,
+u))}}}return{offset:v.ha*c,points:e}}}};
+(function(a){var b=function(a){for(var b=a.length,e=0,f=b-1,g=0;g<b;f=g++)e+=a[f].x*a[g].y-a[g].x*a[f].y;return e*0.5};a.Triangulate=function(a,d){var e=a.length;if(e<3)return null;var f=[],g=[],j=[],h,k,l;if(b(a)>0)for(k=0;k<e;k++)g[k]=k;else for(k=0;k<e;k++)g[k]=e-1-k;var m=2*e;for(k=e-1;e>2;){if(m--<=0){console.log("Warning, unable to triangulate polygon!");if(d)return j;return f}h=k;e<=h&&(h=0);k=h+1;e<=k&&(k=0);l=k+1;e<=l&&(l=0);var n;a:{n=a;var o=h,t=k,v=l,u=e,x=g,w=void 0,p=void 0,y=void 0,
+z=void 0,C=void 0,D=void 0,E=void 0,F=void 0,B=void 0,p=n[x[o]].x,y=n[x[o]].y,z=n[x[t]].x,C=n[x[t]].y,D=n[x[v]].x,E=n[x[v]].y;if(1.0E-10>(z-p)*(E-y)-(C-y)*(D-p))n=!1;else{for(w=0;w<u;w++)if(!(w==o||w==t||w==v)){var F=n[x[w]].x,B=n[x[w]].y,J=void 0,L=void 0,G=void 0,M=void 0,H=void 0,A=void 0,I=void 0,K=void 0,N=void 0,P=void 0,Q=void 0,R=void 0,J=G=H=void 0,J=D-z,L=E-C,G=p-D,M=y-E,H=z-p,A=C-y,I=F-p,K=B-y,N=F-z,P=B-C,Q=F-D,R=B-E,J=J*P-L*N,H=H*K-A*I,G=G*R-M*Q;if(J>=0&&G>=0&&H>=0){n=!1;break a}}n=!0}}if(n){m=
+g[h];n=g[k];o=g[l];f.push(a[m]);f.push(a[n]);f.push(a[o]);j.push([g[h],g[k],g[l]]);h=k;for(l=k+1;l<e;h++,l++)g[h]=g[l];e--;m=2*e}}if(d)return j;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 d=0;d<b.length;++d)a.materials[d]=[THREE.Loader.prototype.createMaterial(b[d],c)]},createMaterial:function(a,b){function c(a){a=Math.log(a)/Math.LN2;return Math.floor(a)==a}function d(a,b){var d=new Image;d.onload=function(){if(!c(this.width)||!c(this.height)){var b=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),d=Math.pow(2,Math.round(Math.log(this.height)/
 Math.LN2));a.image.width=b;a.image.height=d;a.image.getContext("2d").drawImage(this,0,0,b,d)}else a.image=this;a.needsUpdate=!0};d.src=b}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&&b)g=document.createElement("canvas"),f.map=new THREE.Texture(g),f.map.sourceFile=a.mapDiffuse,d(f.map,b+"/"+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&&b)g=document.createElement("canvas"),f.lightMap=new THREE.Texture(g),f.lightMap.sourceFile=a.mapLightmap,d(f.lightMap,b+"/"+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 b=this,c=a.model,d=a.callback,e=a.texture_path?a.texture_path:this.extractUrlbase(c),a=new Worker(c);a.onmessage=function(a){b.createModel(a.data,d,e);b.onLoadComplete()};this.onLoadStart();a.postMessage((new Date).getTime())};
-THREE.JSONLoader.prototype.createModel=function(a,b,c){var d=new THREE.Geometry,e=a.scale!==void 0?1/a.scale:1;this.init_materials(d,a.materials,c);(function(c){if(a.version===void 0||a.version!=2)console.error("Deprecated file format.");else{var b,e,h,k,l,m,n,p,t,v,u,x,w,o,y=a.faces;m=a.vertices;var z=a.normals,C=a.colors,D=0;for(b=0;b<a.uvs.length;b++)a.uvs[b].length&&D++;for(b=0;b<D;b++)d.faceUvs[b]=[],d.faceVertexUvs[b]=[];k=0;for(l=m.length;k<l;)n=new THREE.Vertex,n.position.x=m[k++]*c,n.position.y=
-m[k++]*c,n.position.z=m[k++]*c,d.vertices.push(n);k=0;for(l=y.length;k<l;){c=y[k++];m=c&1;h=c&2;b=c&4;e=c&8;p=c&16;n=c&32;v=c&64;c&=128;m?(u=new THREE.Face4,u.a=y[k++],u.b=y[k++],u.c=y[k++],u.d=y[k++],m=4):(u=new THREE.Face3,u.a=y[k++],u.b=y[k++],u.c=y[k++],m=3);if(h)h=y[k++],u.materials=d.materials[h];h=d.faces.length;if(b)for(b=0;b<D;b++)x=a.uvs[b],t=y[k++],o=x[t*2],t=x[t*2+1],d.faceUvs[b][h]=new THREE.UV(o,t);if(e)for(b=0;b<D;b++){x=a.uvs[b];w=[];for(e=0;e<m;e++)t=y[k++],o=x[t*2],t=x[t*2+1],w[e]=
-new THREE.UV(o,t);d.faceVertexUvs[b][h]=w}if(p)p=y[k++]*3,e=new THREE.Vector3,e.x=z[p++],e.y=z[p++],e.z=z[p],u.normal=e;if(n)for(b=0;b<m;b++)p=y[k++]*3,e=new THREE.Vector3,e.x=z[p++],e.y=z[p++],e.z=z[p],u.vertexNormals.push(e);if(v)n=y[k++],n=new THREE.Color(C[n]),u.color=n;if(c)for(b=0;b<m;b++)n=y[k++],n=new THREE.Color(C[n]),u.vertexColors.push(n);d.faces.push(u)}}})(e);(function(){var c,b,e,h;if(a.skinWeights){c=0;for(b=a.skinWeights.length;c<b;c+=2)e=a.skinWeights[c],h=a.skinWeights[c+1],d.skinWeights.push(new THREE.Vector4(e,
-h,0,0))}if(a.skinIndices){c=0;for(b=a.skinIndices.length;c<b;c+=2)e=a.skinIndices[c],h=a.skinIndices[c+1],d.skinIndices.push(new THREE.Vector4(e,h,0,0))}d.bones=a.bones;d.animation=a.animation})();(function(c){if(a.morphTargets!==void 0){var b,e,h,k,l,m,n,p,t;b=0;for(e=a.morphTargets.length;b<e;b++){d.morphTargets[b]={};d.morphTargets[b].name=a.morphTargets[b].name;d.morphTargets[b].vertices=[];p=d.morphTargets[b].vertices;t=a.morphTargets[b].vertices;h=0;for(k=t.length;h<k;h+=3)l=t[h]*c,m=t[h+1]*
-c,n=t[h+2]*c,p.push(new THREE.Vertex(new THREE.Vector3(l,m,n)))}}if(a.morphColors!==void 0){b=0;for(e=a.morphColors.length;b<e;b++){d.morphColors[b]={};d.morphColors[b].name=a.morphColors[b].name;d.morphColors[b].colors=[];k=d.morphColors[b].colors;l=a.morphColors[b].colors;c=0;for(h=l.length;c<h;c+=3)m=new THREE.Color(16755200),m.setRGB(l[c],l[c+1],l[c+2]),k.push(m)}}})(e);(function(){if(a.edges!==void 0){var c,b,e;for(c=0;c<a.edges.length;c+=2)b=a.edges[c],e=a.edges[c+1],d.edges.push(new THREE.Edge(d.vertices[b],
+THREE.JSONLoader.prototype.createModel=function(a,b,c){var d=new THREE.Geometry,e=a.scale!==void 0?1/a.scale:1;this.init_materials(d,a.materials,c);(function(c){if(a.version===void 0||a.version!=2)console.error("Deprecated file format.");else{var b,e,h,k,l,m,n,o,t,v,u,x,w,p,y=a.faces;m=a.vertices;var z=a.normals,C=a.colors,D=0;for(b=0;b<a.uvs.length;b++)a.uvs[b].length&&D++;for(b=0;b<D;b++)d.faceUvs[b]=[],d.faceVertexUvs[b]=[];k=0;for(l=m.length;k<l;)n=new THREE.Vertex,n.position.x=m[k++]*c,n.position.y=
+m[k++]*c,n.position.z=m[k++]*c,d.vertices.push(n);k=0;for(l=y.length;k<l;){c=y[k++];m=c&1;h=c&2;b=c&4;e=c&8;o=c&16;n=c&32;v=c&64;c&=128;m?(u=new THREE.Face4,u.a=y[k++],u.b=y[k++],u.c=y[k++],u.d=y[k++],m=4):(u=new THREE.Face3,u.a=y[k++],u.b=y[k++],u.c=y[k++],m=3);if(h)h=y[k++],u.materials=d.materials[h];h=d.faces.length;if(b)for(b=0;b<D;b++)x=a.uvs[b],t=y[k++],p=x[t*2],t=x[t*2+1],d.faceUvs[b][h]=new THREE.UV(p,t);if(e)for(b=0;b<D;b++){x=a.uvs[b];w=[];for(e=0;e<m;e++)t=y[k++],p=x[t*2],t=x[t*2+1],w[e]=
+new THREE.UV(p,t);d.faceVertexUvs[b][h]=w}if(o)o=y[k++]*3,e=new THREE.Vector3,e.x=z[o++],e.y=z[o++],e.z=z[o],u.normal=e;if(n)for(b=0;b<m;b++)o=y[k++]*3,e=new THREE.Vector3,e.x=z[o++],e.y=z[o++],e.z=z[o],u.vertexNormals.push(e);if(v)n=y[k++],n=new THREE.Color(C[n]),u.color=n;if(c)for(b=0;b<m;b++)n=y[k++],n=new THREE.Color(C[n]),u.vertexColors.push(n);d.faces.push(u)}}})(e);(function(){var c,b,e,h;if(a.skinWeights){c=0;for(b=a.skinWeights.length;c<b;c+=2)e=a.skinWeights[c],h=a.skinWeights[c+1],d.skinWeights.push(new THREE.Vector4(e,
+h,0,0))}if(a.skinIndices){c=0;for(b=a.skinIndices.length;c<b;c+=2)e=a.skinIndices[c],h=a.skinIndices[c+1],d.skinIndices.push(new THREE.Vector4(e,h,0,0))}d.bones=a.bones;d.animation=a.animation})();(function(c){if(a.morphTargets!==void 0){var b,e,h,k,l,m,n,o,t;b=0;for(e=a.morphTargets.length;b<e;b++){d.morphTargets[b]={};d.morphTargets[b].name=a.morphTargets[b].name;d.morphTargets[b].vertices=[];o=d.morphTargets[b].vertices;t=a.morphTargets[b].vertices;h=0;for(k=t.length;h<k;h+=3)l=t[h]*c,m=t[h+1]*
+c,n=t[h+2]*c,o.push(new THREE.Vertex(new THREE.Vector3(l,m,n)))}}if(a.morphColors!==void 0){b=0;for(e=a.morphColors.length;b<e;b++){d.morphColors[b]={};d.morphColors[b].name=a.morphColors[b].name;d.morphColors[b].colors=[];k=d.morphColors[b].colors;l=a.morphColors[b].colors;c=0;for(h=l.length;c<h;c+=3)m=new THREE.Color(16755200),m.setRGB(l[c],l[c+1],l[c+2]),k.push(m)}}})(e);(function(){if(a.edges!==void 0){var c,b,e;for(c=0;c<a.edges.length;c+=2)b=a.edges[c],e=a.edges[c+1],d.edges.push(new THREE.Edge(d.vertices[b],
 d.vertices[e],b,e))}})();d.computeCentroids();d.computeFaceNormals();b(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 b=a.model,c=a.callback,d=a.texture_path?a.texture_path:THREE.Loader.prototype.extractUrlbase(b),e=a.bin_path?a.bin_path:THREE.Loader.prototype.extractUrlbase(b),a=(new Date).getTime(),b=new Worker(b),f=this.showProgress?THREE.Loader.prototype.updateProgress:null;b.onmessage=function(a){THREE.BinaryLoader.prototype.loadAjaxBuffers(a.data.buffers,a.data.materials,c,e,d,f)};b.onerror=function(a){alert("worker.onerror: "+a.message+"\n"+a.data);a.preventDefault()};
 b.postMessage(a)},loadAjaxBuffers:function(a,b,c,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,c,e,b):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,b,c,d){var e=function(c){function b(a,c){var d=l(a,c),e=l(a,c+1),f=l(a,c+2),g=l(a,c+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,c){var b=l(a,c),d=l(a,c+1),f=l(a,c+2);return(l(a,c+3)<<24)+(f<<16)+(d<<8)+b}function h(a,c){var b=l(a,c);return(l(a,c+1)<<8)+b}function k(a,c){var b=l(a,c);return b>127?b-256:b}function l(a,
-c){return a.charCodeAt(c)&255}function m(c){var b,d,f;b=e(a,c);d=e(a,c+C);f=e(a,c+D);c=h(a,c+E);THREE.BinaryLoader.prototype.f3(x,b,d,f,c)}function n(c){var b,d,f,g,k,l;b=e(a,c);d=e(a,c+C);f=e(a,c+D);g=h(a,c+E);k=e(a,c+F);l=e(a,c+B);c=e(a,c+J);THREE.BinaryLoader.prototype.f3n(x,y,b,d,f,g,k,l,c)}function p(c){var b,d,f,g;b=e(a,c);d=e(a,c+L);f=e(a,c+G);g=e(a,c+M);c=h(a,c+H);THREE.BinaryLoader.prototype.f4(x,b,d,f,g,c)}function t(c){var b,d,f,g,k,l,m,n;b=e(a,c);d=e(a,c+L);f=e(a,c+G);g=e(a,c+M);k=h(a,
-c+H);l=e(a,c+A);m=e(a,c+I);n=e(a,c+K);c=e(a,c+N);THREE.BinaryLoader.prototype.f4n(x,y,b,d,f,g,k,l,m,n,c)}function v(c){var b,d;b=e(a,c);d=e(a,c+P);c=e(a,c+Q);THREE.BinaryLoader.prototype.uv3(x.faceVertexUvs[0],z[b*2],z[b*2+1],z[d*2],z[d*2+1],z[c*2],z[c*2+1])}function u(c){var b,d,f;b=e(a,c);d=e(a,c+R);f=e(a,c+X);c=e(a,c+Y);THREE.BinaryLoader.prototype.uv4(x.faceVertexUvs[0],z[b*2],z[b*2+1],z[d*2],z[d*2+1],z[f*2],z[f*2+1],z[c*2],z[c*2+1])}var x=this,w=0,o,y=[],z=[],C,D,E,F,B,J,L,G,M,H,A,I,K,N,P,Q,
-R,X,Y,S,T,U,V,W,O;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(x,d,c);o={signature:a.substr(w,8),header_bytes:l(a,w+8),vertex_coordinate_bytes:l(a,w+9),normal_coordinate_bytes:l(a,w+10),uv_coordinate_bytes:l(a,w+11),vertex_index_bytes:l(a,w+12),normal_index_bytes:l(a,w+13),uv_index_bytes:l(a,w+14),material_index_bytes:l(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+=o.header_bytes;C=o.vertex_index_bytes;D=o.vertex_index_bytes*2;E=o.vertex_index_bytes*3;F=o.vertex_index_bytes*3+o.material_index_bytes;B=o.vertex_index_bytes*3+o.material_index_bytes+o.normal_index_bytes;J=o.vertex_index_bytes*3+o.material_index_bytes+o.normal_index_bytes*2;L=o.vertex_index_bytes;G=o.vertex_index_bytes*2;M=o.vertex_index_bytes*3;H=o.vertex_index_bytes*4;A=o.vertex_index_bytes*
-4+o.material_index_bytes;I=o.vertex_index_bytes*4+o.material_index_bytes+o.normal_index_bytes;K=o.vertex_index_bytes*4+o.material_index_bytes+o.normal_index_bytes*2;N=o.vertex_index_bytes*4+o.material_index_bytes+o.normal_index_bytes*3;P=o.uv_index_bytes;Q=o.uv_index_bytes*2;R=o.uv_index_bytes;X=o.uv_index_bytes*2;Y=o.uv_index_bytes*3;c=o.vertex_index_bytes*3+o.material_index_bytes;O=o.vertex_index_bytes*4+o.material_index_bytes;S=o.ntri_flat*c;T=o.ntri_smooth*(c+o.normal_index_bytes*3);U=o.ntri_flat_uv*
-(c+o.uv_index_bytes*3);V=o.ntri_smooth_uv*(c+o.normal_index_bytes*3+o.uv_index_bytes*3);W=o.nquad_flat*O;c=o.nquad_smooth*(O+o.normal_index_bytes*4);O=o.nquad_flat_uv*(O+o.uv_index_bytes*4);w+=function(c){for(var d,e,f,h=o.vertex_coordinate_bytes*3,j=c+o.nvertices*h;c<j;c+=h)d=b(a,c),e=b(a,c+o.vertex_coordinate_bytes),f=b(a,c+o.vertex_coordinate_bytes*2),THREE.BinaryLoader.prototype.v(x,d,e,f);return o.nvertices*h}(w);w+=function(c){for(var b,d,e,f=o.normal_coordinate_bytes*3,g=c+o.nnormals*f;c<g;c+=
-f)b=k(a,c),d=k(a,c+o.normal_coordinate_bytes),e=k(a,c+o.normal_coordinate_bytes*2),y.push(b/127,d/127,e/127);return o.nnormals*f}(w);w+=function(c){for(var d,e,f=o.uv_coordinate_bytes*2,h=c+o.nuvs*f;c<h;c+=f)d=b(a,c),e=b(a,c+o.uv_coordinate_bytes),z.push(d,e);return o.nuvs*f}(w);S=w+S;T=S+T;U=T+U;V=U+V;W=V+W;c=W+c;O=c+O;(function(a){var c,b=o.vertex_index_bytes*3+o.material_index_bytes,d=b+o.uv_index_bytes*3,e=a+o.ntri_flat_uv*d;for(c=a;c<e;c+=d)m(c),v(c+b);return e-a})(T);(function(a){var c,b=o.vertex_index_bytes*
-3+o.material_index_bytes+o.normal_index_bytes*3,d=b+o.uv_index_bytes*3,e=a+o.ntri_smooth_uv*d;for(c=a;c<e;c+=d)n(c),v(c+b);return e-a})(U);(function(a){var c,b=o.vertex_index_bytes*4+o.material_index_bytes,d=b+o.uv_index_bytes*4,e=a+o.nquad_flat_uv*d;for(c=a;c<e;c+=d)p(c),u(c+b);return e-a})(c);(function(a){var c,b=o.vertex_index_bytes*4+o.material_index_bytes+o.normal_index_bytes*4,d=b+o.uv_index_bytes*4,e=a+o.nquad_smooth_uv*d;for(c=a;c<e;c+=d)t(c),u(c+b);return e-a})(O);(function(a){var c,b=o.vertex_index_bytes*
-3+o.material_index_bytes,d=a+o.ntri_flat*b;for(c=a;c<d;c+=b)m(c);return d-a})(w);(function(a){var c,b=o.vertex_index_bytes*3+o.material_index_bytes+o.normal_index_bytes*3,d=a+o.ntri_smooth*b;for(c=a;c<d;c+=b)n(c);return d-a})(S);(function(a){var c,b=o.vertex_index_bytes*4+o.material_index_bytes,d=a+o.nquad_flat*b;for(c=a;c<d;c+=b)p(c);return d-a})(V);(function(a){var c,b=o.vertex_index_bytes*4+o.material_index_bytes+o.normal_index_bytes*4,d=a+o.nquad_smooth*b;for(c=a;c<d;c+=b)t(c);return d-a})(W);
+c){return a.charCodeAt(c)&255}function m(c){var b,d,f;b=e(a,c);d=e(a,c+C);f=e(a,c+D);c=h(a,c+E);THREE.BinaryLoader.prototype.f3(x,b,d,f,c)}function n(c){var b,d,f,g,k,l;b=e(a,c);d=e(a,c+C);f=e(a,c+D);g=h(a,c+E);k=e(a,c+F);l=e(a,c+B);c=e(a,c+J);THREE.BinaryLoader.prototype.f3n(x,y,b,d,f,g,k,l,c)}function o(c){var b,d,f,g;b=e(a,c);d=e(a,c+L);f=e(a,c+G);g=e(a,c+M);c=h(a,c+H);THREE.BinaryLoader.prototype.f4(x,b,d,f,g,c)}function t(c){var b,d,f,g,k,l,m,n;b=e(a,c);d=e(a,c+L);f=e(a,c+G);g=e(a,c+M);k=h(a,
+c+H);l=e(a,c+A);m=e(a,c+I);n=e(a,c+K);c=e(a,c+N);THREE.BinaryLoader.prototype.f4n(x,y,b,d,f,g,k,l,m,n,c)}function v(c){var b,d;b=e(a,c);d=e(a,c+P);c=e(a,c+Q);THREE.BinaryLoader.prototype.uv3(x.faceVertexUvs[0],z[b*2],z[b*2+1],z[d*2],z[d*2+1],z[c*2],z[c*2+1])}function u(c){var b,d,f;b=e(a,c);d=e(a,c+R);f=e(a,c+X);c=e(a,c+Y);THREE.BinaryLoader.prototype.uv4(x.faceVertexUvs[0],z[b*2],z[b*2+1],z[d*2],z[d*2+1],z[f*2],z[f*2+1],z[c*2],z[c*2+1])}var x=this,w=0,p,y=[],z=[],C,D,E,F,B,J,L,G,M,H,A,I,K,N,P,Q,
+R,X,Y,S,T,U,V,W,O;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(x,d,c);p={signature:a.substr(w,8),header_bytes:l(a,w+8),vertex_coordinate_bytes:l(a,w+9),normal_coordinate_bytes:l(a,w+10),uv_coordinate_bytes:l(a,w+11),vertex_index_bytes:l(a,w+12),normal_index_bytes:l(a,w+13),uv_index_bytes:l(a,w+14),material_index_bytes:l(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+=p.header_bytes;C=p.vertex_index_bytes;D=p.vertex_index_bytes*2;E=p.vertex_index_bytes*3;F=p.vertex_index_bytes*3+p.material_index_bytes;B=p.vertex_index_bytes*3+p.material_index_bytes+p.normal_index_bytes;J=p.vertex_index_bytes*3+p.material_index_bytes+p.normal_index_bytes*2;L=p.vertex_index_bytes;G=p.vertex_index_bytes*2;M=p.vertex_index_bytes*3;H=p.vertex_index_bytes*4;A=p.vertex_index_bytes*
+4+p.material_index_bytes;I=p.vertex_index_bytes*4+p.material_index_bytes+p.normal_index_bytes;K=p.vertex_index_bytes*4+p.material_index_bytes+p.normal_index_bytes*2;N=p.vertex_index_bytes*4+p.material_index_bytes+p.normal_index_bytes*3;P=p.uv_index_bytes;Q=p.uv_index_bytes*2;R=p.uv_index_bytes;X=p.uv_index_bytes*2;Y=p.uv_index_bytes*3;c=p.vertex_index_bytes*3+p.material_index_bytes;O=p.vertex_index_bytes*4+p.material_index_bytes;S=p.ntri_flat*c;T=p.ntri_smooth*(c+p.normal_index_bytes*3);U=p.ntri_flat_uv*
+(c+p.uv_index_bytes*3);V=p.ntri_smooth_uv*(c+p.normal_index_bytes*3+p.uv_index_bytes*3);W=p.nquad_flat*O;c=p.nquad_smooth*(O+p.normal_index_bytes*4);O=p.nquad_flat_uv*(O+p.uv_index_bytes*4);w+=function(c){for(var d,e,f,h=p.vertex_coordinate_bytes*3,j=c+p.nvertices*h;c<j;c+=h)d=b(a,c),e=b(a,c+p.vertex_coordinate_bytes),f=b(a,c+p.vertex_coordinate_bytes*2),THREE.BinaryLoader.prototype.v(x,d,e,f);return p.nvertices*h}(w);w+=function(c){for(var b,d,e,f=p.normal_coordinate_bytes*3,g=c+p.nnormals*f;c<g;c+=
+f)b=k(a,c),d=k(a,c+p.normal_coordinate_bytes),e=k(a,c+p.normal_coordinate_bytes*2),y.push(b/127,d/127,e/127);return p.nnormals*f}(w);w+=function(c){for(var d,e,f=p.uv_coordinate_bytes*2,h=c+p.nuvs*f;c<h;c+=f)d=b(a,c),e=b(a,c+p.uv_coordinate_bytes),z.push(d,e);return p.nuvs*f}(w);S=w+S;T=S+T;U=T+U;V=U+V;W=V+W;c=W+c;O=c+O;(function(a){var c,b=p.vertex_index_bytes*3+p.material_index_bytes,d=b+p.uv_index_bytes*3,e=a+p.ntri_flat_uv*d;for(c=a;c<e;c+=d)m(c),v(c+b);return e-a})(T);(function(a){var c,b=p.vertex_index_bytes*
+3+p.material_index_bytes+p.normal_index_bytes*3,d=b+p.uv_index_bytes*3,e=a+p.ntri_smooth_uv*d;for(c=a;c<e;c+=d)n(c),v(c+b);return e-a})(U);(function(a){var c,b=p.vertex_index_bytes*4+p.material_index_bytes,d=b+p.uv_index_bytes*4,e=a+p.nquad_flat_uv*d;for(c=a;c<e;c+=d)o(c),u(c+b);return e-a})(c);(function(a){var c,b=p.vertex_index_bytes*4+p.material_index_bytes+p.normal_index_bytes*4,d=b+p.uv_index_bytes*4,e=a+p.nquad_smooth_uv*d;for(c=a;c<e;c+=d)t(c),u(c+b);return e-a})(O);(function(a){var c,b=p.vertex_index_bytes*
+3+p.material_index_bytes,d=a+p.ntri_flat*b;for(c=a;c<d;c+=b)m(c);return d-a})(w);(function(a){var c,b=p.vertex_index_bytes*3+p.material_index_bytes+p.normal_index_bytes*3,d=a+p.ntri_smooth*b;for(c=a;c<d;c+=b)n(c);return d-a})(S);(function(a){var c,b=p.vertex_index_bytes*4+p.material_index_bytes,d=a+p.nquad_flat*b;for(c=a;c<d;c+=b)o(c);return d-a})(V);(function(a){var c,b=p.vertex_index_bytes*4+p.material_index_bytes+p.normal_index_bytes*4,d=a+p.nquad_smooth*b;for(c=a;c<d;c+=b)t(c);return d-a})(W);
 this.computeCentroids();this.computeFaceNormals()};e.prototype=new THREE.Geometry;e.prototype.constructor=e;b(new e(c))},v:function(a,b,c,d){a.vertices.push(new THREE.Vertex(new THREE.Vector3(b,c,d)))},f3:function(a,b,c,d,e){a.faces.push(new THREE.Face3(b,c,d,null,null,a.materials[e]))},f4:function(a,b,c,d,e,f){a.faces.push(new THREE.Face4(b,c,d,e,null,null,a.materials[f]))},f3n:function(a,b,c,d,e,f,g,j,h){var f=a.materials[f],k=b[j*3],l=b[j*3+1],j=b[j*3+2],m=b[h*3],n=b[h*3+1],h=b[h*3+2];a.faces.push(new THREE.Face3(c,
-d,e,[new THREE.Vector3(b[g*3],b[g*3+1],b[g*3+2]),new THREE.Vector3(k,l,j),new THREE.Vector3(m,n,h)],null,f))},f4n:function(a,b,c,d,e,f,g,j,h,k,l){var g=a.materials[g],m=b[h*3],n=b[h*3+1],h=b[h*3+2],p=b[k*3],t=b[k*3+1],k=b[k*3+2],v=b[l*3],u=b[l*3+1],l=b[l*3+2];a.faces.push(new THREE.Face4(c,d,e,f,[new THREE.Vector3(b[j*3],b[j*3+1],b[j*3+2]),new THREE.Vector3(m,n,h),new THREE.Vector3(p,t,k),new THREE.Vector3(v,u,l)],null,g))},uv3:function(a,b,c,d,e,f,g){var j=[];j.push(new THREE.UV(b,c));j.push(new THREE.UV(d,
+d,e,[new THREE.Vector3(b[g*3],b[g*3+1],b[g*3+2]),new THREE.Vector3(k,l,j),new THREE.Vector3(m,n,h)],null,f))},f4n:function(a,b,c,d,e,f,g,j,h,k,l){var g=a.materials[g],m=b[h*3],n=b[h*3+1],h=b[h*3+2],o=b[k*3],t=b[k*3+1],k=b[k*3+2],v=b[l*3],u=b[l*3+1],l=b[l*3+2];a.faces.push(new THREE.Face4(c,d,e,f,[new THREE.Vector3(b[j*3],b[j*3+1],b[j*3+2]),new THREE.Vector3(m,n,h),new THREE.Vector3(o,t,k),new THREE.Vector3(v,u,l)],null,g))},uv3:function(a,b,c,d,e,f,g){var j=[];j.push(new THREE.UV(b,c));j.push(new THREE.UV(d,
 e));j.push(new THREE.UV(f,g));a.push(j)},uv4:function(a,b,c,d,e,f,g,j,h){var k=[];k.push(new THREE.UV(b,c));k.push(new THREE.UV(d,e));k.push(new THREE.UV(f,g));k.push(new THREE.UV(j,h));a.push(k)}};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,d=new Worker(a);d.postMessage(0);var e=THREE.Loader.prototype.extractUrlbase(a);d.onmessage=function(a){function d(a,c){return c=="relativeToHTML"?a:e+"/"+a}function j(){for(p in B.objects)if(!A.objects[p])if(w=B.objects[p],w.geometry!==void 0){if(C=A.geometries[w.geometry]){F=[];for(N=0;N<w.materials.length;N++)F[N]=A.materials[w.materials[N]];o=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=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=w.visible;A.scene.addObject(object);A.objects[p]=object;if(w.meshCollider){var a=THREE.CollisionUtils.MeshColliderWBox(object);A.scene.collisions.colliders.push(a)}if(w.castsShadow)a=new THREE.ShadowVolume(C),A.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},A.triggers[object.name]=a)}}else o=w.position,r=w.rotation,q=w.quaternion,s=w.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=w.visible!==void 0?w.visible:!1,A.scene.addObject(object),
-A.objects[p]=object,A.empties[p]=object,w.trigger&&w.trigger.toLowerCase()!="none"&&(a={type:w.trigger,object:w},A.triggers[object.name]=a)}function h(a){return function(b){A.geometries[a]=b;j();L-=1;c.onLoadComplete();l()}}function k(a){return function(c){A.geometries[a]=c}}function l(){c.callbackProgress({totalModels:M,totalTextures:H,loadedModels:M-L,loadedTextures:H-G},A);c.onLoadProgress();L==0&&G==0&&b(A)}var m,n,p,t,v,u,x,w,o,y,z,C,D,E,F,B,J,L,G,M,H,A;B=a.data;a=new THREE.BinaryLoader;J=new THREE.JSONLoader;
-G=L=0;A={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};var I=!1;for(p in B.objects)if(w=B.objects[p],w.meshCollider){I=!0;break}if(I)A.scene.collisions=new THREE.CollisionSystem;if(B.transform){I=B.transform.position;y=B.transform.rotation;var K=B.transform.scale;I&&A.scene.position.set(I[0],I[1],I[2]);y&&A.scene.rotation.set(y[0],y[1],y[2]);K&&A.scene.scale.set(K[0],K[1],K[2]);(I||y||K)&&A.scene.updateMatrix()}I=function(){G-=
-1;l();c.onLoadComplete()};for(v in B.cameras){y=B.cameras[v];if(y.type=="perspective")D=new THREE.Camera(y.fov,y.aspect,y.near,y.far);else if(y.type=="ortho")D=new THREE.Camera,D.projectionMatrix=THREE.Matrix4.makeOrtho(y.left,y.right,y.top,y.bottom,y.near,y.far);o=y.position;y=y.target;D.position.set(o[0],o[1],o[2]);D.target.position.set(y[0],y[1],y[2]);A.cameras[v]=D}for(t in B.lights){v=B.lights[t];D=v.color!==void 0?v.color:16777215;y=v.intensity!==void 0?v.intensity:1;if(v.type=="directional")o=
-v.direction,light=new THREE.DirectionalLight(D,y),light.position.set(o[0],o[1],o[2]),light.position.normalize();else if(v.type=="point")o=v.position,light=new THREE.PointLight(D,y),light.position.set(o[0],o[1],o[2]);A.scene.addLight(light);A.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)),y=t.color,E.color.setRGB(y[0],y[1],y[2]),A.fogs[u]=E;if(A.cameras&&B.defaults.camera)A.currentCamera=A.cameras[B.defaults.camera];
+THREE.SceneLoader.prototype={load:function(a,b){var c=this,d=new Worker(a);d.postMessage(0);var e=THREE.Loader.prototype.extractUrlbase(a);d.onmessage=function(a){function d(a,c){return c=="relativeToHTML"?a:e+"/"+a}function j(){for(o in B.objects)if(!A.objects[o])if(w=B.objects[o],w.geometry!==void 0){if(C=A.geometries[w.geometry]){F=[];for(N=0;N<w.materials.length;N++)F[N]=A.materials[w.materials[N]];p=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(p[0],p[1],p[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;A.scene.addObject(object);A.objects[o]=object;if(w.meshCollider){var a=THREE.CollisionUtils.MeshColliderWBox(object);A.scene.collisions.colliders.push(a)}if(w.castsShadow)a=new THREE.ShadowVolume(C),A.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},A.triggers[object.name]=a)}}else p=w.position,r=w.rotation,q=w.quaternion,s=w.scale,q=0,object=new THREE.Object3D,object.name=o,object.position.set(p[0],p[1],p[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,A.scene.addObject(object),
+A.objects[o]=object,A.empties[o]=object,w.trigger&&w.trigger.toLowerCase()!="none"&&(a={type:w.trigger,object:w},A.triggers[object.name]=a)}function h(a){return function(b){A.geometries[a]=b;j();L-=1;c.onLoadComplete();l()}}function k(a){return function(c){A.geometries[a]=c}}function l(){c.callbackProgress({totalModels:M,totalTextures:H,loadedModels:M-L,loadedTextures:H-G},A);c.onLoadProgress();L==0&&G==0&&b(A)}var m,n,o,t,v,u,x,w,p,y,z,C,D,E,F,B,J,L,G,M,H,A;B=a.data;a=new THREE.BinaryLoader;J=new THREE.JSONLoader;
+G=L=0;A={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};var I=!1;for(o in B.objects)if(w=B.objects[o],w.meshCollider){I=!0;break}if(I)A.scene.collisions=new THREE.CollisionSystem;if(B.transform){I=B.transform.position;y=B.transform.rotation;var K=B.transform.scale;I&&A.scene.position.set(I[0],I[1],I[2]);y&&A.scene.rotation.set(y[0],y[1],y[2]);K&&A.scene.scale.set(K[0],K[1],K[2]);(I||y||K)&&A.scene.updateMatrix()}I=function(){G-=
+1;l();c.onLoadComplete()};for(v in B.cameras){y=B.cameras[v];if(y.type=="perspective")D=new THREE.Camera(y.fov,y.aspect,y.near,y.far);else if(y.type=="ortho")D=new THREE.Camera,D.projectionMatrix=THREE.Matrix4.makeOrtho(y.left,y.right,y.top,y.bottom,y.near,y.far);p=y.position;y=y.target;D.position.set(p[0],p[1],p[2]);D.target.position.set(y[0],y[1],y[2]);A.cameras[v]=D}for(t in B.lights){v=B.lights[t];D=v.color!==void 0?v.color:16777215;y=v.intensity!==void 0?v.intensity:1;if(v.type=="directional")p=
+v.direction,light=new THREE.DirectionalLight(D,y),light.position.set(p[0],p[1],p[2]),light.position.normalize();else if(v.type=="point")p=v.position,light=new THREE.PointLight(D,y),light.position.set(p[0],p[1],p[2]);A.scene.addLight(light);A.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)),y=t.color,E.color.setRGB(y[0],y[1],y[2]),A.fogs[u]=E;if(A.cameras&&B.defaults.camera)A.currentCamera=A.cameras[B.defaults.camera];
 if(A.fogs&&B.defaults.fog)A.scene.fog=A.fogs[B.defaults.fog];y=B.defaults.bgcolor;A.bgColor=new THREE.Color;A.bgColor.setRGB(y[0],y[1],y[2]);A.bgColorAlpha=B.defaults.bgalpha;for(m in B.geometries)if(u=B.geometries[m],u.type=="bin_mesh"||u.type=="ascii_mesh")L+=1,c.onLoadStart();M=L;for(m in B.geometries)u=B.geometries[m],u.type=="cube"?(C=new THREE.Cube(u.width,u.height,u.depth,u.segmentsWidth,u.segmentsHeight,u.segmentsDepth,null,u.flipped,u.sides),A.geometries[m]=C):u.type=="plane"?(C=new THREE.Plane(u.width,
 u.height,u.segmentsWidth,u.segmentsHeight),A.geometries[m]=C):u.type=="sphere"?(C=new THREE.Sphere(u.radius,u.segmentsWidth,u.segmentsHeight),A.geometries[m]=C):u.type=="cylinder"?(C=new THREE.Cylinder(u.numSegs,u.topRad,u.botRad,u.height,u.topOffset,u.botOffset),A.geometries[m]=C):u.type=="torus"?(C=new THREE.Torus(u.radius,u.tube,u.segmentsR,u.segmentsT),A.geometries[m]=C):u.type=="icosahedron"?(C=new THREE.Icosahedron(u.subdivisions),A.geometries[m]=C):u.type=="bin_mesh"?a.load({model:d(u.url,
 B.urlBaseType),callback:h(m)}):u.type=="ascii_mesh"?J.load({model:d(u.url,B.urlBaseType),callback:h(m)}):u.type=="embedded_mesh"&&(u=B.embeds[u.id])&&J.createModel(u,k(m),"");for(x in B.textures)if(m=B.textures[x],m.url instanceof Array){G+=m.url.length;for(a=0;a<m.url.length;a++)c.onLoadStart()}else G+=1,c.onLoadStart();H=G;for(x in B.textures){m=B.textures[x];if(m.mapping!=void 0&&THREE[m.mapping]!=void 0)m.mapping=new THREE[m.mapping];if(m.url instanceof Array){for(var a=[],N=0;N<m.url.length;N++)a[N]=
@@ -162,16 +164,16 @@ A.materials[n]=x}j();c.callbackSync(A)}}};
 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,e){return a+(b-a)*e};this.VIntX=function(a,b,e,f,g,j,h,k,l,m){g=(g-l)/(m-l);l=this.normal_cache;b[f]=j+g*this.delta;b[f+1]=h;b[f+2]=k;e[f]=this.lerp(l[a],l[a+3],g);e[f+1]=this.lerp(l[a+1],l[a+4],g);e[f+2]=this.lerp(l[a+2],l[a+5],g)};this.VIntY=function(a,b,e,f,g,j,h,k,l,m){g=(g-l)/(m-l);l=this.normal_cache;b[f]=j;b[f+1]=h+g*this.delta;b[f+
 2]=k;b=a+this.yd*3;e[f]=this.lerp(l[a],l[b],g);e[f+1]=this.lerp(l[a+1],l[b+1],g);e[f+2]=this.lerp(l[a+2],l[b+2],g)};this.VIntZ=function(a,b,e,f,g,j,h,k,l,m){g=(g-l)/(m-l);l=this.normal_cache;b[f]=j;b[f+1]=h;b[f+2]=k+g*this.delta;b=a+this.zd*3;e[f]=this.lerp(l[a],l[b],g);e[f+1]=this.lerp(l[a+1],l[b+1],g);e[f+2]=this.lerp(l[a+2],l[b+2],g)};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,e,f,g,j){var h=f+1,k=f+this.yd,l=f+this.zd,m=h+this.yd,n=h+this.zd,p=f+this.yd+this.zd,t=h+this.yd+this.zd,v=0,u=this.field[f],x=this.field[h],w=this.field[k],o=this.field[m],y=this.field[l],z=this.field[n],C=this.field[p],D=this.field[t];u<g&&(v|=1);x<g&&(v|=2);w<g&&(v|=8);o<g&&(v|=4);y<g&&(v|=16);z<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,J=b+F,F=e+F;E&1&&(this.compNorm(f),this.compNorm(h),this.VIntX(f*3,this.vlist,this.nlist,0,g,a,b,e,u,x));E&2&&(this.compNorm(h),this.compNorm(m),this.VIntY(h*3,this.vlist,this.nlist,3,g,B,b,e,x,o));E&4&&(this.compNorm(k),this.compNorm(m),this.VIntX(k*3,this.vlist,this.nlist,6,g,a,J,e,w,o));E&8&&(this.compNorm(f),this.compNorm(k),this.VIntY(f*3,this.vlist,this.nlist,9,g,a,b,e,u,w));E&16&&(this.compNorm(l),this.compNorm(n),this.VIntX(l*3,this.vlist,this.nlist,12,g,a,b,F,y,z));E&32&&(this.compNorm(n),
-this.compNorm(t),this.VIntY(n*3,this.vlist,this.nlist,15,g,B,b,F,z,D));E&64&&(this.compNorm(p),this.compNorm(t),this.VIntX(p*3,this.vlist,this.nlist,18,g,a,J,F,C,D));E&128&&(this.compNorm(l),this.compNorm(p),this.VIntY(l*3,this.vlist,this.nlist,21,g,a,b,F,y,C));E&256&&(this.compNorm(f),this.compNorm(l),this.VIntZ(f*3,this.vlist,this.nlist,24,g,a,b,e,u,y));E&512&&(this.compNorm(h),this.compNorm(n),this.VIntZ(h*3,this.vlist,this.nlist,27,g,B,b,e,x,z));E&1024&&(this.compNorm(m),this.compNorm(t),this.VIntZ(m*
-3,this.vlist,this.nlist,30,g,B,J,e,o,D));E&2048&&(this.compNorm(k),this.compNorm(p),this.VIntZ(k*3,this.vlist,this.nlist,33,g,a,J,e,w,C));v<<=4;for(g=f=0;THREE.triTable[v+g]!=-1;)a=v+g,b=a+1,e=a+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[a],3*THREE.triTable[b],3*THREE.triTable[e],j),g+=3,f++;return f};this.posnormtriv=function(a,b,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+
+this.yd],this.normal_cache[b+2]=this.field[a-this.zd]-this.field[a+this.zd])};this.polygonize=function(a,b,e,f,g,j){var h=f+1,k=f+this.yd,l=f+this.zd,m=h+this.yd,n=h+this.zd,o=f+this.yd+this.zd,t=h+this.yd+this.zd,v=0,u=this.field[f],x=this.field[h],w=this.field[k],p=this.field[m],y=this.field[l],z=this.field[n],C=this.field[o],D=this.field[t];u<g&&(v|=1);x<g&&(v|=2);w<g&&(v|=8);p<g&&(v|=4);y<g&&(v|=16);z<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,J=b+F,F=e+F;E&1&&(this.compNorm(f),this.compNorm(h),this.VIntX(f*3,this.vlist,this.nlist,0,g,a,b,e,u,x));E&2&&(this.compNorm(h),this.compNorm(m),this.VIntY(h*3,this.vlist,this.nlist,3,g,B,b,e,x,p));E&4&&(this.compNorm(k),this.compNorm(m),this.VIntX(k*3,this.vlist,this.nlist,6,g,a,J,e,w,p));E&8&&(this.compNorm(f),this.compNorm(k),this.VIntY(f*3,this.vlist,this.nlist,9,g,a,b,e,u,w));E&16&&(this.compNorm(l),this.compNorm(n),this.VIntX(l*3,this.vlist,this.nlist,12,g,a,b,F,y,z));E&32&&(this.compNorm(n),
+this.compNorm(t),this.VIntY(n*3,this.vlist,this.nlist,15,g,B,b,F,z,D));E&64&&(this.compNorm(o),this.compNorm(t),this.VIntX(o*3,this.vlist,this.nlist,18,g,a,J,F,C,D));E&128&&(this.compNorm(l),this.compNorm(o),this.VIntY(l*3,this.vlist,this.nlist,21,g,a,b,F,y,C));E&256&&(this.compNorm(f),this.compNorm(l),this.VIntZ(f*3,this.vlist,this.nlist,24,g,a,b,e,u,y));E&512&&(this.compNorm(h),this.compNorm(n),this.VIntZ(h*3,this.vlist,this.nlist,27,g,B,b,e,x,z));E&1024&&(this.compNorm(m),this.compNorm(t),this.VIntZ(m*
+3,this.vlist,this.nlist,30,g,B,J,e,p,D));E&2048&&(this.compNorm(k),this.compNorm(o),this.VIntZ(k*3,this.vlist,this.nlist,33,g,a,J,e,w,C));v<<=4;for(g=f=0;THREE.triTable[v+g]!=-1;)a=v+g,b=a+1,e=a+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[a],3*THREE.triTable[b],3*THREE.triTable[e],j),g+=3,f++;return f};this.posnormtriv=function(a,b,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]=b[e];this.normalArray[h+1]=b[e+1];this.normalArray[h+2]=b[e+2];this.normalArray[h+3]=b[f];this.normalArray[h+4]=b[f+1];this.normalArray[h+5]=b[f+2];this.normalArray[h+6]=b[g];this.normalArray[h+7]=b[g+1];this.normalArray[h+8]=b[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 b=this.count*3;b<this.positionArray.length;b++)this.positionArray[b]=0;a(this)}};this.addBall=function(a,b,e,f,g){var j=this.size*Math.sqrt(f/g),h=e*this.size,k=b*this.size,l=a*this.size,m=Math.floor(h-j);m<1&&(m=1);h=Math.floor(h+j);h>this.size-1&&(h=this.size-1);var n=Math.floor(k-j);n<1&&(n=1);k=Math.floor(k+j);k>this.size-1&&(k=this.size-1);var p=Math.floor(l-j);p<1&&(p=1);j=Math.floor(l+j);j>this.size-1&&(j=this.size-
-1);for(var t,v,u,x,w,o;m<h;m++){l=this.size2*m;v=m/this.size-e;w=v*v;for(v=n;v<k;v++){u=l+this.size*v;t=v/this.size-b;o=t*t;for(t=p;t<j;t++)x=t/this.size-a,x=f/(1.0E-6+x*x+o+w)-g,x>0&&(this.field[u+t]+=x)}}};this.addPlaneX=function(a,b){var e,f,g,j,h,k=this.size,l=this.yd,m=this.zd,n=this.field,p=k*Math.sqrt(a/b);p>k&&(p=k);for(e=0;e<p;e++)if(f=e/k,f*=f,j=a/(1.0E-4+f)-b,j>0)for(f=0;f<k;f++){h=e+f*l;for(g=0;g<k;g++)n[m*g+h]+=j}};this.addPlaneY=function(a,b){var e,f,g,j,h,k,l=this.size,m=this.yd,n=
-this.zd,p=this.field,t=l*Math.sqrt(a/b);t>l&&(t=l);for(f=0;f<t;f++)if(e=f/l,e*=e,j=a/(1.0E-4+e)-b,j>0){h=f*m;for(e=0;e<l;e++){k=h+e;for(g=0;g<l;g++)p[n*g+k]+=j}}};this.addPlaneZ=function(a,b){var e,f,g,j,h,k;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(a/b);dist>size&&(dist=size);for(g=0;g<dist;g++)if(e=g/size,e*=e,j=a/(1.0E-4+e)-b,j>0){h=zd*g;for(f=0;f<size;f++){k=h+f*yd;for(e=0;e<size;e++)field[k+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 b,e,f,g,j,h,k,l,m,n=this.size-2;for(g=1;g<n;g++){m=this.size2*g;k=(g-this.halfsize)/this.halfsize;for(f=1;f<n;f++){l=m+this.size*f;h=(f-this.halfsize)/this.halfsize;for(e=1;e<n;e++)j=(e-this.halfsize)/this.halfsize,b=l+e,this.polygonize(j,h,k,b,this.isolation,a)}}this.end(a)};this.generateGeometry=function(){var a=0,b=new THREE.Geometry,e=[];this.render(function(f){var g,j,h,k,l,m,n,p;for(g=0;g<f.count;g++)n=g*3,l=n+1,p=n+2,j=f.positionArray[n],
-h=f.positionArray[l],k=f.positionArray[p],m=new THREE.Vector3(j,h,k),j=f.normalArray[n],h=f.normalArray[l],k=f.normalArray[p],n=new THREE.Vector3(j,h,k),n.normalize(),l=new THREE.Vertex(m),b.vertices.push(l),e.push(n);nfaces=f.count/3;for(g=0;g<nfaces;g++)n=(a+g)*3,l=n+1,p=n+2,m=e[n],j=e[l],h=e[p],n=new THREE.Face3(n,l,p,[m,j,h]),b.faces.push(n);a+=nfaces;f.count=0});return b};this.init(a)};THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
+this.hasNormal=this.hasPos=!1};this.end=function(a){if(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,e,f,g){var j=this.size*Math.sqrt(f/g),h=e*this.size,k=b*this.size,l=a*this.size,m=Math.floor(h-j);m<1&&(m=1);h=Math.floor(h+j);h>this.size-1&&(h=this.size-1);var n=Math.floor(k-j);n<1&&(n=1);k=Math.floor(k+j);k>this.size-1&&(k=this.size-1);var o=Math.floor(l-j);o<1&&(o=1);j=Math.floor(l+j);j>this.size-1&&(j=this.size-
+1);for(var t,v,u,x,w,p;m<h;m++){l=this.size2*m;v=m/this.size-e;w=v*v;for(v=n;v<k;v++){u=l+this.size*v;t=v/this.size-b;p=t*t;for(t=o;t<j;t++)x=t/this.size-a,x=f/(1.0E-6+x*x+p+w)-g,x>0&&(this.field[u+t]+=x)}}};this.addPlaneX=function(a,b){var e,f,g,j,h,k=this.size,l=this.yd,m=this.zd,n=this.field,o=k*Math.sqrt(a/b);o>k&&(o=k);for(e=0;e<o;e++)if(f=e/k,f*=f,j=a/(1.0E-4+f)-b,j>0)for(f=0;f<k;f++){h=e+f*l;for(g=0;g<k;g++)n[m*g+h]+=j}};this.addPlaneY=function(a,b){var e,f,g,j,h,k,l=this.size,m=this.yd,n=
+this.zd,o=this.field,t=l*Math.sqrt(a/b);t>l&&(t=l);for(f=0;f<t;f++)if(e=f/l,e*=e,j=a/(1.0E-4+e)-b,j>0){h=f*m;for(e=0;e<l;e++){k=h+e;for(g=0;g<l;g++)o[n*g+k]+=j}}};this.addPlaneZ=function(a,b){var e,f,g,j,h,k;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(a/b);dist>size&&(dist=size);for(g=0;g<dist;g++)if(e=g/size,e*=e,j=a/(1.0E-4+e)-b,j>0){h=zd*g;for(f=0;f<size;f++){k=h+f*yd;for(e=0;e<size;e++)field[k+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 b,e,f,g,j,h,k,l,m,n=this.size-2;for(g=1;g<n;g++){m=this.size2*g;k=(g-this.halfsize)/this.halfsize;for(f=1;f<n;f++){l=m+this.size*f;h=(f-this.halfsize)/this.halfsize;for(e=1;e<n;e++)j=(e-this.halfsize)/this.halfsize,b=l+e,this.polygonize(j,h,k,b,this.isolation,a)}}this.end(a)};this.generateGeometry=function(){var a=0,b=new THREE.Geometry,e=[];this.render(function(f){var g,j,h,k,l,m,n,o;for(g=0;g<f.count;g++)n=g*3,l=n+1,o=n+2,j=f.positionArray[n],
+h=f.positionArray[l],k=f.positionArray[o],m=new THREE.Vector3(j,h,k),j=f.normalArray[n],h=f.normalArray[l],k=f.normalArray[o],n=new THREE.Vector3(j,h,k),n.normalize(),l=new THREE.Vertex(m),b.vertices.push(l),e.push(n);nfaces=f.count/3;for(g=0;g<nfaces;g++)n=(a+g)*3,l=n+1,o=n+2,m=e[n],j=e[l],h=e[o],n=new THREE.Face3(n,l,o,[m,j,h]),b.faces.push(n);a+=nfaces;f.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]);

+ 190 - 0
examples/fonts/droid/NOTICE

@@ -0,0 +1,190 @@
+
+   Copyright (c) 2005-2008, The Android Open Source Project
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+

+ 18 - 0
examples/fonts/droid/README.txt

@@ -0,0 +1,18 @@
+Copyright (C) 2008 The Android Open Source Project
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+  
+     http://www.apache.org/licenses/LICENSE-2.0
+  
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+##########
+
+This directory contains the fonts for the platform. They are licensed
+under the Apache 2 license.

文件差異過大導致無法顯示
+ 0 - 0
examples/fonts/droid/droid_sans_bold.typeface.js


文件差異過大導致無法顯示
+ 0 - 0
examples/fonts/droid/droid_sans_mono_regular.typeface.js


文件差異過大導致無法顯示
+ 0 - 0
examples/fonts/droid/droid_sans_regular.typeface.js


文件差異過大導致無法顯示
+ 0 - 0
examples/fonts/droid/droid_serif_bold.typeface.js


文件差異過大導致無法顯示
+ 0 - 0
examples/fonts/droid/droid_serif_regular.typeface.js


+ 21 - 5
examples/webgl_text.html

@@ -26,7 +26,8 @@
 	<body>
 
 		<div id="info">
-		<a href="http://github.com/mrdoob/three.js" target="_blank">three.js</a> - procedural 3D text by <a href="http://www.lab4games.net/zz85/blog" target="_blank">zz85</a> &amp; alteredq (fonts from <a href="http://typeface.neocracy.org/">typeface.js</a>)
+		<a href="http://github.com/mrdoob/three.js" target="_blank">three.js</a> - procedural 3D text by <a href="http://www.lab4games.net/zz85/blog" target="_blank">zz85</a> &amp; alteredq 
+		(fonts from <a href="http://typeface.neocracy.org/">typeface.js</a> and <a href="http://en.wikipedia.org/wiki/Droid_%28font%29">Droid</a>)
 		<br/>type to enter new text, drag to spin the text
 		<br/><span class="button" id="color">change color</span>, 
 			<span class="button" id="font">change font</span>, 
@@ -54,6 +55,11 @@
 		<script type="text/javascript" src="fonts/optimer_regular.typeface.js"></script>
 		<script type="text/javascript" src="fonts/helvetiker_bold.typeface.js"></script>
 		<script type="text/javascript" src="fonts/helvetiker_regular.typeface.js"></script>
+		<script type="text/javascript" src="fonts/droid/droid_sans_regular.typeface.js"></script>
+		<script type="text/javascript" src="fonts/droid/droid_sans_bold.typeface.js"></script>
+		<script type="text/javascript" src="fonts/droid/droid_serif_regular.typeface.js"></script>
+		<script type="text/javascript" src="fonts/droid/droid_serif_bold.typeface.js"></script>
+		
 
 		<script type="text/javascript">
 
@@ -72,16 +78,18 @@
 				size = 80,
 				hover = 30,
 				curveSegments = 6,
-				font = "optimer", 		// helvetiker optimer gentilis
+				font = "optimer", 		// helvetiker, optimer, gentilis, droid sans, droid serif
 				weight = "bold",		// normal bold
 				style = "normal";		// normal italic
 
 			var mirror = true;
 			
 			var fontMap = {
-			"helvetiker" : 0,
-			"optimer"  	 : 1,
-			"gentilis" 	 : 2
+			"helvetiker"  : 0,
+			"optimer"  	  : 1,
+			"gentilis" 	  : 2,
+			"droid sans"  : 3,
+			"droid serif" : 4
 			
 			};
 			
@@ -273,6 +281,14 @@
 						
 						font = "gentilis";
 						
+					} else if ( font == "gentilis" ) {
+						
+						font = "droid sans";
+						
+					} else if ( font == "droid sans" ) {
+						
+						font = "droid serif";
+
 					} else {
 					
 						font = "helvetiker";

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

@@ -363,24 +363,94 @@ THREE.FontUtils = {
                 
 	            }
                 
+
+				
 	            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;
-            
+	            prevHoleVert = ( holeIndex - 1 ) >= 0 ? holeIndex - 1 : hole.length - 1; 
+	            nextHoleVert = ( holeIndex + 1 ) < hole.length ? holeIndex + 1 : 0 ;
+	
+	
+				var areaapts = [];
+				areaapts.push( hole[ holeIndex ] );
+	            areaapts.push( shape[ shapeIndex ] );
+	            areaapts.push( shape[ prevShapeVert ] );
+				
+				var areaa = this.Triangulate.area(areaapts);
+				
+            	var areabpts = [];
+	            areabpts.push( hole[ holeIndex ] );
+	            areabpts.push( hole[ prevHoleVert ] );
+	            areabpts.push( shape[ shapeIndex ] );
+				
+				var areab = this.Triangulate.area(areabpts);
+	
+				
+				var shapeOffset =1;
+				var holeOffset = -1;
+				
+				var oldShapeIndex = shapeIndex, oldHoleIndex = holeIndex;
+				shapeIndex += shapeOffset;
+				holeIndex += holeOffset;
+				
+				if (shapeIndex<0) { shapeIndex += shape.length;  }
+				shapeIndex %= shape.length;
+				if (holeIndex<0) { holeIndex += hole.length;  }
+				holeIndex %= shape.length;
+				
+				 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 ;
+
+
+				areaapts = [];
+				areaapts.push( hole[ holeIndex ] );
+	            areaapts.push( shape[ shapeIndex ] );
+	            areaapts.push( shape[ prevShapeVert ] );
+
+				var areaa2 = this.Triangulate.area(areaapts);
+
+            	areabpts = [];
+	            areabpts.push( hole[ holeIndex ] );
+	            areabpts.push( hole[ prevHoleVert ] );
+	            areabpts.push( shape[ shapeIndex ] );
+
+				var areab2 = this.Triangulate.area(areabpts);
+				
+				if ( (areaa+areab) > (areaa2+areab2) ) {
+					shapeIndex = oldShapeIndex;
+					holeIndex = oldHoleIndex ;
+					
+					
+					if (shapeIndex<0) { shapeIndex += shape.length;  }
+					shapeIndex %= shape.length;
+					if (holeIndex<0) { holeIndex += hole.length;  }
+					holeIndex %= shape.length;
+					
+					
+					 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 ;
+				}
+				
 	            tmpShape1 = shape.slice( 0, shapeIndex );
 	            tmpShape2 = shape.slice( shapeIndex );
 				tmpHole1 = hole.slice( holeIndex );
 				tmpHole2 = hole.slice( 0, holeIndex );
-        
+        		
 	            verts.push( hole[ holeIndex ] );
 	            verts.push( shape[ shapeIndex ] );
 	            verts.push( shape[ prevShapeVert ] );
-            
-	            verts.push( hole[ holeIndex ] );
+				
+			    verts.push( hole[ holeIndex ] );
 	            verts.push( hole[ prevHoleVert ] );
 	            verts.push( shape[ shapeIndex ] );
+			
 
 	            shape = tmpShape1.concat( tmpHole1 ).concat( tmpHole2 ).concat( tmpShape2 );
 

部分文件因文件數量過多而無法顯示