Browse Source

Started to remove workers from the asset pipeline.

Work-in-progress => do not merge yet.

OBJ converter, JSONLoader, BinaryLoader and some examples are done. Still need to do Blender exporter, SceneLoader and more examples.

Advantages:

- faster parse times
- bypass array initializer size limit in Firefox
- no more crashes in Chrome 15 (caused by too many concurrently active workers)

Disadvantages:

- more browser UI freezing
- multiple models tend to appear all at once with the last one (instead of popping up progressively)
alteredq 13 years ago
parent
commit
d2cad69664

+ 14 - 12
build/Three.js

@@ -549,11 +549,11 @@ if(a.blending)if(a.blending=="Additive")f.blending=THREE.AdditiveBlending;else i
 else if(a.DbgColor)f.color=a.DbgColor;if(a.colorSpecular)f.specular=e(a.colorSpecular);if(a.colorAmbient)f.ambient=e(a.colorAmbient);if(a.transparency)f.opacity=a.transparency;if(a.specularCoef)f.shininess=a.specularCoef;a.mapDiffuse&&c&&g(f,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap);a.mapLight&&c&&g(f,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap);a.mapNormal&&c&&g(f,"normalMap",a.mapNormal,a.mapNormalRepeat,a.mapNormalOffset,a.mapNormalWrap);
 a.mapSpecular&&c&&g(f,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){var l=THREE.ShaderUtils.lib.normal,k=THREE.UniformsUtils.clone(l.uniforms),m=f.color;h=f.specular;i=f.ambient;var o=f.shininess;k.tNormal.texture=f.normalMap;if(a.mapNormalFactor)k.uNormalScale.value=a.mapNormalFactor;if(f.map)k.tDiffuse.texture=f.map,k.enableDiffuse.value=!0;if(f.specularMap)k.tSpecular.texture=f.specularMap,k.enableSpecular.value=!0;if(f.lightMap)k.tAO.texture=
 f.lightMap,k.enableAO.value=!0;k.uDiffuseColor.value.setHex(m);k.uSpecularColor.value.setHex(h);k.uAmbientColor.value.setHex(i);k.uShininess.value=o;if(f.opacity)k.uOpacity.value=f.opacity;f=new THREE.ShaderMaterial({fragmentShader:l.fragmentShader,vertexShader:l.vertexShader,uniforms:k,lights:!0,fog:!0})}else f=new THREE[h](f);return f}};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;
-THREE.BinaryLoader.prototype.supr=THREE.Loader.prototype;
-THREE.BinaryLoader.prototype.load=function(a,c,b,d){if(a instanceof Object){console.warn("DEPRECATED: BinaryLoader( parameters ) is now BinaryLoader( url, callback, texturePath, binaryPath ).");var g=a,a=g.model,c=g.callback,b=g.texture_path,d=g.bin_path}var b=b?b:this.extractUrlbase(a),d=d?d:this.extractUrlbase(a),g=Date.now(),a=new Worker(a),e=this.showProgress?THREE.Loader.prototype.updateProgress:null;a.onmessage=function(a){THREE.BinaryLoader.prototype.loadAjaxBuffers(a.data.buffers,a.data.materials,
-c,d,b,e)};a.onerror=function(a){alert("worker.onerror: "+a.message+"\n"+a.data);a.preventDefault()};a.postMessage(g)};
-THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,c,b,d,g,e){var f=new XMLHttpRequest,h=d+"/"+a,i=0;f.onreadystatechange=function(){f.readyState==4?f.status==200||f.status==0?THREE.BinaryLoader.prototype.createBinModel(f.responseText,b,g,c):alert("Couldn't load ["+h+"] ["+f.status+"]"):f.readyState==3?e&&(i==0&&(i=f.getResponseHeader("Content-Length")),e({total:i,loaded:f.responseText.length})):f.readyState==2&&(i=f.getResponseHeader("Content-Length"))};f.open("GET",h,!0);f.overrideMimeType("text/plain; charset=x-user-defined");
-f.setRequestHeader("Content-Type","text/plain");f.send(null)};
+THREE.BinaryLoader.prototype.supr=THREE.Loader.prototype;THREE.BinaryLoader.prototype.load=function(a,c,b,d){if(a instanceof Object)console.warn("DEPRECATED: BinaryLoader( parameters ) is now BinaryLoader( url, callback, texturePath, binaryPath )."),d=a,a=d.model,c=d.callback,b=d.texture_path,d=d.bin_path;var b=b?b:this.extractUrlbase(a),d=d?d:this.extractUrlbase(a),g=this.showProgress?THREE.Loader.prototype.updateProgress:null;this.onLoadStart();this.loadAjaxJSON(this,a,c,b,d,g)};
+THREE.BinaryLoader.prototype.loadAjaxJSON=function(a,c,b,d,g,e){var f=new XMLHttpRequest;f.onreadystatechange=function(){if(f.readyState==4)if(f.status==200||f.status==0)try{var h=JSON.parse(f.responseText);h.metadata===void 0||h.metadata.formatVersion===void 0||h.metadata.formatVersion!==3?console.error("Deprecated file format."):a.loadAjaxBuffers(h,b,g,d,e)}catch(i){console.error(i),console.warn("DEPRECATED: ["+c+"] seems to be using old model format")}else console.error("Couldn't load ["+c+"] ["+
+f.status+"]")};f.open("GET",c,!0);f.overrideMimeType("text/plain; charset=x-user-defined");f.setRequestHeader("Content-Type","text/plain");f.send(null)};
+THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,c,b,d,g){var e=new XMLHttpRequest,f=b+"/"+a.buffers,h=0;e.onreadystatechange=function(){e.readyState==4?e.status==200||e.status==0?THREE.BinaryLoader.prototype.createBinModel(e.responseText,c,d,a.materials):console.error("Couldn't load ["+f+"] ["+e.status+"]"):e.readyState==3?g&&(h==0&&(h=e.getResponseHeader("Content-Length")),g({total:h,loaded:e.responseText.length})):e.readyState==2&&(h=e.getResponseHeader("Content-Length"))};e.open("GET",
+f,!0);e.overrideMimeType("text/plain; charset=x-user-defined");e.setRequestHeader("Content-Type","text/plain");e.send(null)};
 THREE.BinaryLoader.prototype.createBinModel=function(a,c,b,d){var g=function(b){function c(a,b){var d=k(a,b),e=k(a,b+1),f=k(a,b+2),g=k(a,b+3),h=(g<<1&255|f>>7)-127;d|=(f&127)<<16|e<<8;if(d==0&&h==-127)return 0;return(1-2*(g>>7))*(1+d*Math.pow(2,-23))*Math.pow(2,h)}function g(a,b){var c=k(a,b),d=k(a,b+1),e=k(a,b+2);return(k(a,b+3)<<24)+(e<<16)+(d<<8)+c}function i(a,b){var c=k(a,b);return(k(a,b+1)<<8)+c}function l(a,b){var c=k(a,b);return c>127?c-256:c}function k(a,b){return a.charCodeAt(b)&255}function m(b){var c,
 d,e;c=g(a,b);d=g(a,b+y);e=g(a,b+G);b=i(a,b+K);t.faces.push(new THREE.Face3(c,d,e,null,null,b))}function o(b){var c,d,e,f,j,k,l;c=g(a,b);d=g(a,b+y);e=g(a,b+G);f=i(a,b+K);j=g(a,b+F);k=g(a,b+z);l=g(a,b+D);var b=s[k*3],m=s[k*3+1];k=s[k*3+2];var n=s[l*3],o=s[l*3+1];l=s[l*3+2];t.faces.push(new THREE.Face3(c,d,e,[new THREE.Vector3(s[j*3],s[j*3+1],s[j*3+2]),new THREE.Vector3(b,m,k),new THREE.Vector3(n,o,l)],null,f))}function n(b){var c,d,e,f;c=g(a,b);d=g(a,b+P);e=g(a,b+J);f=g(a,b+$);b=i(a,b+L);t.faces.push(new THREE.Face4(c,
 d,e,f,null,null,b))}function u(b){var c,d,e,f,j,k,l,m,n;c=g(a,b);d=g(a,b+P);e=g(a,b+J);f=g(a,b+$);j=i(a,b+L);k=g(a,b+Q);l=g(a,b+da);m=g(a,b+ia);n=g(a,b+S);var b=s[l*3],o=s[l*3+1];l=s[l*3+2];var T=s[m*3],w=s[m*3+1];m=s[m*3+2];var H=s[n*3],p=s[n*3+1];n=s[n*3+2];t.faces.push(new THREE.Face4(c,d,e,f,[new THREE.Vector3(s[k*3],s[k*3+1],s[k*3+2]),new THREE.Vector3(b,o,l),new THREE.Vector3(T,w,m),new THREE.Vector3(H,p,n)],null,j))}function p(b){var c,d,e,f;c=g(a,b);d=g(a,b+A);e=g(a,b+C);b=v[c*2];f=v[c*2+
@@ -620,13 +620,15 @@ b.shift(),c=a.indexOf(".")>=0,d=a.indexOf("(")>=0,e,f;if(c)b=a.split("."),a=b.sh
 da.prototype.create=function(){for(var a=0;a<this.inputs.length;a++){var b=this.inputs[a],c=this.animation.source[b.source];switch(b.semantic){case "INPUT":this.input=c.read();break;case "OUTPUT":this.output=c.read();break;case "INTERPOLATION":this.interpolation=c.read();break;case "IN_TANGENT":break;case "OUT_TANGENT":break;default:console.log(b.semantic)}}this.duration=this.endTime=this.startTime=0;if(this.input.length){this.startTime=1E8;this.endTime=-1E8;for(a=0;a<this.input.length;a++)this.startTime=
 Math.min(this.startTime,this.input[a]),this.endTime=Math.max(this.endTime,this.input[a]);this.duration=this.endTime-this.startTime}};return{load:function(b,c){if(document.implementation&&document.implementation.createDocument){document.implementation.createDocument("http://www.collada.org/2005/11/COLLADASchema","COLLADA",null);b+="?rnd="+Math.random();var d=new XMLHttpRequest;d.overrideMimeType&&d.overrideMimeType("text/xml");d.onreadystatechange=function(){if(d.readyState==4&&(d.status==0||d.status==
 200))ea=c,a(d.responseXML,void 0,b)};d.open("GET",b,!0);d.send(null)}else alert("Don't know how to parse XML!")},parse:a,setPreferredShading:function(a){wa=a},applySkin:g,geometries:ka}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;
-THREE.JSONLoader.prototype.load=function(a,c,b){var d,g=this;if(a instanceof Object)console.warn("DEPRECATED: JSONLoader( parameters ) is now JSONLoader( url, callback, texturePath )."),d=a,a=d.model,c=d.callback,b=d.texture_path;d=new Worker(a);b=b?b:this.extractUrlbase(a);d.onmessage=function(a){g.createModel(a.data,c,b);g.onLoadComplete()};this.onLoadStart();d.postMessage(Date.now())};
-THREE.JSONLoader.prototype.createModel=function(a,c,b){var d=new THREE.Geometry,g=a.scale!==void 0?1/a.scale:1;this.initMaterials(d,a.materials,b);(function(b){if(a.version===void 0||a.version!=2)console.error("Deprecated file format.");else{var c,g,i,l,k,m,o,n,u,p,r,t,x,q,s=a.faces;m=a.vertices;var v=a.normals,y=a.colors,G=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&G++;for(c=0;c<G;c++)d.faceUvs[c]=[],d.faceVertexUvs[c]=[];l=0;for(k=m.length;l<k;)o=new THREE.Vertex,o.position.x=m[l++]*b,o.position.y=
-m[l++]*b,o.position.z=m[l++]*b,d.vertices.push(o);l=0;for(k=s.length;l<k;){b=s[l++];m=b&1;i=b&2;c=b&4;g=b&8;n=b&16;o=b&32;p=b&64;b&=128;m?(r=new THREE.Face4,r.a=s[l++],r.b=s[l++],r.c=s[l++],r.d=s[l++],m=4):(r=new THREE.Face3,r.a=s[l++],r.b=s[l++],r.c=s[l++],m=3);if(i)i=s[l++],r.materialIndex=i;i=d.faces.length;if(c)for(c=0;c<G;c++)t=a.uvs[c],u=s[l++],q=t[u*2],u=t[u*2+1],d.faceUvs[c][i]=new THREE.UV(q,u);if(g)for(c=0;c<G;c++){t=a.uvs[c];x=[];for(g=0;g<m;g++)u=s[l++],q=t[u*2],u=t[u*2+1],x[g]=new THREE.UV(q,
-u);d.faceVertexUvs[c][i]=x}if(n)n=s[l++]*3,g=new THREE.Vector3,g.x=v[n++],g.y=v[n++],g.z=v[n],r.normal=g;if(o)for(c=0;c<m;c++)n=s[l++]*3,g=new THREE.Vector3,g.x=v[n++],g.y=v[n++],g.z=v[n],r.vertexNormals.push(g);if(p)o=s[l++],o=new THREE.Color(y[o]),r.color=o;if(b)for(c=0;c<m;c++)o=s[l++],o=new THREE.Color(y[o]),r.vertexColors.push(o);d.faces.push(r)}}})(g);(function(){var b,c,g,i;if(a.skinWeights){b=0;for(c=a.skinWeights.length;b<c;b+=2)g=a.skinWeights[b],i=a.skinWeights[b+1],d.skinWeights.push(new THREE.Vector4(g,
-i,0,0))}if(a.skinIndices){b=0;for(c=a.skinIndices.length;b<c;b+=2)g=a.skinIndices[b],i=a.skinIndices[b+1],d.skinIndices.push(new THREE.Vector4(g,i,0,0))}d.bones=a.bones;d.animation=a.animation})();(function(b){if(a.morphTargets!==void 0){var c,g,i,l,k,m,o,n,u;c=0;for(g=a.morphTargets.length;c<g;c++){d.morphTargets[c]={};d.morphTargets[c].name=a.morphTargets[c].name;d.morphTargets[c].vertices=[];n=d.morphTargets[c].vertices;u=a.morphTargets[c].vertices;i=0;for(l=u.length;i<l;i+=3)k=u[i]*b,m=u[i+1]*
-b,o=u[i+2]*b,n.push(new THREE.Vertex(new THREE.Vector3(k,m,o)))}}if(a.morphColors!==void 0){c=0;for(g=a.morphColors.length;c<g;c++){d.morphColors[c]={};d.morphColors[c].name=a.morphColors[c].name;d.morphColors[c].colors=[];l=d.morphColors[c].colors;k=a.morphColors[c].colors;b=0;for(i=k.length;b<i;b+=3)m=new THREE.Color(16755200),m.setRGB(k[b],k[b+1],k[b+2]),l.push(m)}}})(g);d.computeCentroids();d.computeFaceNormals();this.hasNormals(d)&&d.computeTangents();c(d)};
-THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};
+THREE.JSONLoader.prototype.load=function(a,c,b){if(a instanceof Object)console.warn("DEPRECATED: JSONLoader( parameters ) is now JSONLoader( url, callback, texturePath )."),b=a,a=b.model,c=b.callback,b=b.texture_path;b=b?b:this.extractUrlbase(a);this.onLoadStart();this.loadAjaxJSON(this,a,c,b)};
+THREE.JSONLoader.prototype.loadAjaxJSON=function(a,c,b,d,g){var e=new XMLHttpRequest,f=0;e.onreadystatechange=function(){if(e.readyState==4)if(e.status==200||e.status==0)try{var h=JSON.parse(e.responseText);a.createModel(h,b,d);a.onLoadComplete()}catch(i){console.error(i),console.warn("DEPRECATED: ["+c+"] seems to be using old model format")}else console.error("Couldn't load ["+c+"] ["+e.status+"]");else e.readyState==3?g&&(f==0&&(f=e.getResponseHeader("Content-Length")),g({total:f,loaded:e.responseText.length})):
+e.readyState==2&&(f=e.getResponseHeader("Content-Length"))};e.open("GET",c,!0);e.overrideMimeType("text/plain; charset=x-user-defined");e.setRequestHeader("Content-Type","text/plain");e.send(null)};
+THREE.JSONLoader.prototype.createModel=function(a,c,b){var d=new THREE.Geometry,g=a.scale!==void 0?1/a.scale:1;this.initMaterials(d,a.materials,b);(function(b){if(a.metadata===void 0||a.metadata.formatVersion===void 0||a.metadata.formatVersion!==3)console.error("Deprecated file format.");else{var c,g,i,l,k,m,o,n,u,p,r,t,x,q,s=a.faces;m=a.vertices;var v=a.normals,y=a.colors,G=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&G++;for(c=0;c<G;c++)d.faceUvs[c]=[],d.faceVertexUvs[c]=[];l=0;for(k=m.length;l<
+k;)o=new THREE.Vertex,o.position.x=m[l++]*b,o.position.y=m[l++]*b,o.position.z=m[l++]*b,d.vertices.push(o);l=0;for(k=s.length;l<k;){b=s[l++];m=b&1;i=b&2;c=b&4;g=b&8;n=b&16;o=b&32;p=b&64;b&=128;m?(r=new THREE.Face4,r.a=s[l++],r.b=s[l++],r.c=s[l++],r.d=s[l++],m=4):(r=new THREE.Face3,r.a=s[l++],r.b=s[l++],r.c=s[l++],m=3);if(i)i=s[l++],r.materialIndex=i;i=d.faces.length;if(c)for(c=0;c<G;c++)t=a.uvs[c],u=s[l++],q=t[u*2],u=t[u*2+1],d.faceUvs[c][i]=new THREE.UV(q,u);if(g)for(c=0;c<G;c++){t=a.uvs[c];x=[];
+for(g=0;g<m;g++)u=s[l++],q=t[u*2],u=t[u*2+1],x[g]=new THREE.UV(q,u);d.faceVertexUvs[c][i]=x}if(n)n=s[l++]*3,g=new THREE.Vector3,g.x=v[n++],g.y=v[n++],g.z=v[n],r.normal=g;if(o)for(c=0;c<m;c++)n=s[l++]*3,g=new THREE.Vector3,g.x=v[n++],g.y=v[n++],g.z=v[n],r.vertexNormals.push(g);if(p)o=s[l++],o=new THREE.Color(y[o]),r.color=o;if(b)for(c=0;c<m;c++)o=s[l++],o=new THREE.Color(y[o]),r.vertexColors.push(o);d.faces.push(r)}}})(g);(function(){var b,c,g,i;if(a.skinWeights){b=0;for(c=a.skinWeights.length;b<c;b+=
+2)g=a.skinWeights[b],i=a.skinWeights[b+1],d.skinWeights.push(new THREE.Vector4(g,i,0,0))}if(a.skinIndices){b=0;for(c=a.skinIndices.length;b<c;b+=2)g=a.skinIndices[b],i=a.skinIndices[b+1],d.skinIndices.push(new THREE.Vector4(g,i,0,0))}d.bones=a.bones;d.animation=a.animation})();(function(b){if(a.morphTargets!==void 0){var c,g,i,l,k,m,o,n,u;c=0;for(g=a.morphTargets.length;c<g;c++){d.morphTargets[c]={};d.morphTargets[c].name=a.morphTargets[c].name;d.morphTargets[c].vertices=[];n=d.morphTargets[c].vertices;
+u=a.morphTargets[c].vertices;i=0;for(l=u.length;i<l;i+=3)k=u[i]*b,m=u[i+1]*b,o=u[i+2]*b,n.push(new THREE.Vertex(new THREE.Vector3(k,m,o)))}}if(a.morphColors!==void 0){c=0;for(g=a.morphColors.length;c<g;c++){d.morphColors[c]={};d.morphColors[c].name=a.morphColors[c].name;d.morphColors[c].colors=[];l=d.morphColors[c].colors;k=a.morphColors[c].colors;b=0;for(i=k.length;b<i;b+=3)m=new THREE.Color(16755200),m.setRGB(k[b],k[b+1],k[b+2]),l.push(m)}}})(g);d.computeCentroids();d.computeFaceNormals();this.hasNormals(d)&&
+d.computeTangents();c(d)};THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};
 THREE.SceneLoader.prototype={load:function(a,c){var b=this,d=new Worker(a);d.postMessage(0);var g=THREE.Loader.prototype.extractUrlbase(a);d.onmessage=function(a){function d(a,b){return b=="relativeToHTML"?a:g+"/"+a}function h(){var a;for(n in L.objects)if(!C.objects[n])if(x=L.objects[n],x.geometry!==void 0){if(z=C.geometries[x.geometry]){a=!1;for(j=0;j<x.materials.length;j++)$=C.materials[x.materials[j]],a=$ instanceof THREE.ShaderMaterial;a&&z.computeTangents();v=x.position;y=x.rotation;G=x.quaternion;
 K=x.scale;G=0;$.length==0&&($=new THREE.MeshFaceMaterial);$.length>1&&($=new THREE.MeshFaceMaterial);a=new THREE.Mesh(z,$);a.name=n;a.position.set(v[0],v[1],v[2]);G?(a.quaternion.set(G[0],G[1],G[2],G[3]),a.useQuaternion=!0):a.rotation.set(y[0],y[1],y[2]);a.scale.set(K[0],K[1],K[2]);a.visible=x.visible;C.scene.add(a);C.objects[n]=a;if(x.meshCollider){var b=THREE.CollisionUtils.MeshColliderWBox(a);C.scene.collisions.colliders.push(b)}if(x.castsShadow)b=new THREE.ShadowVolume(z),C.scene.add(b),b.position=
 a.position,b.rotation=a.rotation,b.scale=a.scale;x.trigger&&x.trigger.toLowerCase()!="none"&&(b={type:x.trigger,object:x},C.triggers[a.name]=b)}}else v=x.position,y=x.rotation,G=x.quaternion,K=x.scale,G=0,a=new THREE.Object3D,a.name=n,a.position.set(v[0],v[1],v[2]),G?(a.quaternion.set(G[0],G[1],G[2],G[3]),a.useQuaternion=!0):a.rotation.set(y[0],y[1],y[2]),a.scale.set(K[0],K[1],K[2]),a.visible=x.visible!==void 0?x.visible:!1,C.scene.add(a),C.objects[n]=a,C.empties[n]=a,x.trigger&&x.trigger.toLowerCase()!=

+ 211 - 209
build/custom/ThreeExtras.js

@@ -1,19 +1,19 @@
 // ThreeExtras.js r46dev - http://github.com/mrdoob/three.js
-THREE.ColorUtils={adjustHSV:function(a,c,b,d){var f=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(a,f);f.h=THREE.Math.clamp(f.h+c,0,1);f.s=THREE.Math.clamp(f.s+b,0,1);f.v=THREE.Math.clamp(f.v+d,0,1);a.setHSV(f.h,f.s,f.v)},rgbToHsv:function(a,c){var b=a.r,d=a.g,f=a.b,g=Math.max(Math.max(b,d),f),e=Math.min(Math.min(b,d),f);if(e===g)e=b=0;else{var h=g-e,e=h/g,b=b===g?(d-f)/h:d===g?2+(f-b)/h:4+(b-d)/h;b/=6;b<0&&(b+=1);b>1&&(b-=1)}c===void 0&&(c={h:0,s:0,v:0});c.h=b;c.s=e;c.v=g;return c}};
+THREE.ColorUtils={adjustHSV:function(a,c,b,d){var g=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(a,g);g.h=THREE.Math.clamp(g.h+c,0,1);g.s=THREE.Math.clamp(g.s+b,0,1);g.v=THREE.Math.clamp(g.v+d,0,1);a.setHSV(g.h,g.s,g.v)},rgbToHsv:function(a,c){var b=a.r,d=a.g,g=a.b,f=Math.max(Math.max(b,d),g),e=Math.min(Math.min(b,d),g);if(e===f)e=b=0;else{var h=f-e,e=h/f,b=b===f?(d-g)/h:d===f?2+(g-b)/h:4+(b-d)/h;b/=6;b<0&&(b+=1);b>1&&(b-=1)}c===void 0&&(c={h:0,s:0,v:0});c.h=b;c.s=e;c.v=f;return c}};
 THREE.ColorUtils.__hsv={h:0,s:0,v:0};
-THREE.GeometryUtils={merge:function(a,c){for(var b,d,f=a.vertices.length,g=c instanceof THREE.Mesh?c.geometry:c,e=a.vertices,h=g.vertices,i=a.faces,j=g.faces,k=a.faceVertexUvs[0],m=g.faceVertexUvs[0],o={},n=0;n<a.materials.length;n++)o[a.materials[n].id]=n;if(c instanceof THREE.Mesh)c.matrixAutoUpdate&&c.updateMatrix(),b=c.matrix,d=new THREE.Matrix4,d.extractRotation(b,c.scale);for(var n=0,t=h.length;n<t;n++){var q=new THREE.Vertex(h[n].position.clone());b&&b.multiplyVector3(q.position);e.push(q)}n=
-0;for(t=j.length;n<t;n++){var e=j[n],r,p,s=e.vertexNormals,l=e.vertexColors;e instanceof THREE.Face3?r=new THREE.Face3(e.a+f,e.b+f,e.c+f):e instanceof THREE.Face4&&(r=new THREE.Face4(e.a+f,e.b+f,e.c+f,e.d+f));r.normal.copy(e.normal);d&&d.multiplyVector3(r.normal);h=0;for(q=s.length;h<q;h++)p=s[h].clone(),d&&d.multiplyVector3(p),r.vertexNormals.push(p);r.color.copy(e.color);h=0;for(q=l.length;h<q;h++)p=l[h],r.vertexColors.push(p.clone());if(e.materialIndex!==void 0){h=g.materials[e.materialIndex];
-q=o[h.id];if(q===void 0)q=a.materials.length,a.materials.push(h);r.materialIndex=q}r.centroid.copy(e.centroid);b&&b.multiplyVector3(r.centroid);i.push(r)}n=0;for(t=m.length;n<t;n++){b=m[n];d=[];h=0;for(q=b.length;h<q;h++)d.push(new THREE.UV(b[h].u,b[h].v));k.push(d)}},clone:function(a){var c=new THREE.Geometry,b,d=a.vertices,f=a.faces,g=a.faceVertexUvs[0];if(a.materials)c.materials=a.materials.slice();a=0;for(b=d.length;a<b;a++){var e=new THREE.Vertex(d[a].position.clone());c.vertices.push(e)}a=0;
-for(b=f.length;a<b;a++){var h=f[a],i,j,k=h.vertexNormals,m=h.vertexColors;h instanceof THREE.Face3?i=new THREE.Face3(h.a,h.b,h.c):h instanceof THREE.Face4&&(i=new THREE.Face4(h.a,h.b,h.c,h.d));i.normal.copy(h.normal);d=0;for(e=k.length;d<e;d++)j=k[d],i.vertexNormals.push(j.clone());i.color.copy(h.color);d=0;for(e=m.length;d<e;d++)j=m[d],i.vertexColors.push(j.clone());i.materialIndex=h.materialIndex;i.centroid.copy(h.centroid);c.faces.push(i)}a=0;for(b=g.length;a<b;a++){f=g[a];i=[];d=0;for(e=f.length;d<
-e;d++)i.push(new THREE.UV(f[d].u,f[d].v));c.faceVertexUvs[0].push(i)}return c},randomPointInTriangle:function(a,c,b){var d,f,g,e=new THREE.Vector3,h=THREE.GeometryUtils.__v1;d=THREE.GeometryUtils.random();f=THREE.GeometryUtils.random();d+f>1&&(d=1-d,f=1-f);g=1-d-f;e.copy(a);e.multiplyScalar(d);h.copy(c);h.multiplyScalar(f);e.addSelf(h);h.copy(b);h.multiplyScalar(g);e.addSelf(h);return e},randomPointInFace:function(a,c,b){var d,f,g;if(a instanceof THREE.Face3)return d=c.vertices[a.a].position,f=c.vertices[a.b].position,
-g=c.vertices[a.c].position,THREE.GeometryUtils.randomPointInTriangle(d,f,g);else if(a instanceof THREE.Face4){d=c.vertices[a.a].position;f=c.vertices[a.b].position;g=c.vertices[a.c].position;var c=c.vertices[a.d].position,e;b?a._area1&&a._area2?(b=a._area1,e=a._area2):(b=THREE.GeometryUtils.triangleArea(d,f,c),e=THREE.GeometryUtils.triangleArea(f,g,c),a._area1=b,a._area2=e):(b=THREE.GeometryUtils.triangleArea(d,f,c),e=THREE.GeometryUtils.triangleArea(f,g,c));return THREE.GeometryUtils.random()*(b+
-e)<b?THREE.GeometryUtils.randomPointInTriangle(d,f,c):THREE.GeometryUtils.randomPointInTriangle(f,g,c)}},randomPointsInGeometry:function(a,c){function b(a){function b(d,c){if(c<d)return d;var e=d+Math.floor((c-d)/2);return j[e]>a?b(d,e-1):j[e]<a?b(e+1,c):e}return b(0,j.length-1)}var d,f,g=a.faces,e=a.vertices,h=g.length,i=0,j=[],k,m,o,n;for(f=0;f<h;f++){d=g[f];if(d instanceof THREE.Face3)k=e[d.a].position,m=e[d.b].position,o=e[d.c].position,d._area=THREE.GeometryUtils.triangleArea(k,m,o);else if(d instanceof
-THREE.Face4)k=e[d.a].position,m=e[d.b].position,o=e[d.c].position,n=e[d.d].position,d._area1=THREE.GeometryUtils.triangleArea(k,m,n),d._area2=THREE.GeometryUtils.triangleArea(m,o,n),d._area=d._area1+d._area2;i+=d._area;j[f]=i}d=[];e={};for(f=0;f<c;f++)h=THREE.GeometryUtils.random()*i,h=b(h),d[f]=THREE.GeometryUtils.randomPointInFace(g[h],a,!0),e[h]?e[h]+=1:e[h]=1;return d},triangleArea:function(a,c,b){var d,f=THREE.GeometryUtils.__v1;f.sub(a,c);d=f.length();f.sub(a,b);a=f.length();f.sub(c,b);b=f.length();
+THREE.GeometryUtils={merge:function(a,c){for(var b,d,g=a.vertices.length,f=c instanceof THREE.Mesh?c.geometry:c,e=a.vertices,h=f.vertices,i=a.faces,j=f.faces,k=a.faceVertexUvs[0],l=f.faceVertexUvs[0],o={},n=0;n<a.materials.length;n++)o[a.materials[n].id]=n;if(c instanceof THREE.Mesh)c.matrixAutoUpdate&&c.updateMatrix(),b=c.matrix,d=new THREE.Matrix4,d.extractRotation(b,c.scale);for(var n=0,t=h.length;n<t;n++){var q=new THREE.Vertex(h[n].position.clone());b&&b.multiplyVector3(q.position);e.push(q)}n=
+0;for(t=j.length;n<t;n++){var e=j[n],r,p,s=e.vertexNormals,m=e.vertexColors;e instanceof THREE.Face3?r=new THREE.Face3(e.a+g,e.b+g,e.c+g):e instanceof THREE.Face4&&(r=new THREE.Face4(e.a+g,e.b+g,e.c+g,e.d+g));r.normal.copy(e.normal);d&&d.multiplyVector3(r.normal);h=0;for(q=s.length;h<q;h++)p=s[h].clone(),d&&d.multiplyVector3(p),r.vertexNormals.push(p);r.color.copy(e.color);h=0;for(q=m.length;h<q;h++)p=m[h],r.vertexColors.push(p.clone());if(e.materialIndex!==void 0){h=f.materials[e.materialIndex];
+q=o[h.id];if(q===void 0)q=a.materials.length,a.materials.push(h);r.materialIndex=q}r.centroid.copy(e.centroid);b&&b.multiplyVector3(r.centroid);i.push(r)}n=0;for(t=l.length;n<t;n++){b=l[n];d=[];h=0;for(q=b.length;h<q;h++)d.push(new THREE.UV(b[h].u,b[h].v));k.push(d)}},clone:function(a){var c=new THREE.Geometry,b,d=a.vertices,g=a.faces,f=a.faceVertexUvs[0];if(a.materials)c.materials=a.materials.slice();a=0;for(b=d.length;a<b;a++){var e=new THREE.Vertex(d[a].position.clone());c.vertices.push(e)}a=0;
+for(b=g.length;a<b;a++){var h=g[a],i,j,k=h.vertexNormals,l=h.vertexColors;h instanceof THREE.Face3?i=new THREE.Face3(h.a,h.b,h.c):h instanceof THREE.Face4&&(i=new THREE.Face4(h.a,h.b,h.c,h.d));i.normal.copy(h.normal);d=0;for(e=k.length;d<e;d++)j=k[d],i.vertexNormals.push(j.clone());i.color.copy(h.color);d=0;for(e=l.length;d<e;d++)j=l[d],i.vertexColors.push(j.clone());i.materialIndex=h.materialIndex;i.centroid.copy(h.centroid);c.faces.push(i)}a=0;for(b=f.length;a<b;a++){g=f[a];i=[];d=0;for(e=g.length;d<
+e;d++)i.push(new THREE.UV(g[d].u,g[d].v));c.faceVertexUvs[0].push(i)}return c},randomPointInTriangle:function(a,c,b){var d,g,f,e=new THREE.Vector3,h=THREE.GeometryUtils.__v1;d=THREE.GeometryUtils.random();g=THREE.GeometryUtils.random();d+g>1&&(d=1-d,g=1-g);f=1-d-g;e.copy(a);e.multiplyScalar(d);h.copy(c);h.multiplyScalar(g);e.addSelf(h);h.copy(b);h.multiplyScalar(f);e.addSelf(h);return e},randomPointInFace:function(a,c,b){var d,g,f;if(a instanceof THREE.Face3)return d=c.vertices[a.a].position,g=c.vertices[a.b].position,
+f=c.vertices[a.c].position,THREE.GeometryUtils.randomPointInTriangle(d,g,f);else if(a instanceof THREE.Face4){d=c.vertices[a.a].position;g=c.vertices[a.b].position;f=c.vertices[a.c].position;var c=c.vertices[a.d].position,e;b?a._area1&&a._area2?(b=a._area1,e=a._area2):(b=THREE.GeometryUtils.triangleArea(d,g,c),e=THREE.GeometryUtils.triangleArea(g,f,c),a._area1=b,a._area2=e):(b=THREE.GeometryUtils.triangleArea(d,g,c),e=THREE.GeometryUtils.triangleArea(g,f,c));return THREE.GeometryUtils.random()*(b+
+e)<b?THREE.GeometryUtils.randomPointInTriangle(d,g,c):THREE.GeometryUtils.randomPointInTriangle(g,f,c)}},randomPointsInGeometry:function(a,c){function b(a){function b(d,c){if(c<d)return d;var e=d+Math.floor((c-d)/2);return j[e]>a?b(d,e-1):j[e]<a?b(e+1,c):e}return b(0,j.length-1)}var d,g,f=a.faces,e=a.vertices,h=f.length,i=0,j=[],k,l,o,n;for(g=0;g<h;g++){d=f[g];if(d instanceof THREE.Face3)k=e[d.a].position,l=e[d.b].position,o=e[d.c].position,d._area=THREE.GeometryUtils.triangleArea(k,l,o);else if(d instanceof
+THREE.Face4)k=e[d.a].position,l=e[d.b].position,o=e[d.c].position,n=e[d.d].position,d._area1=THREE.GeometryUtils.triangleArea(k,l,n),d._area2=THREE.GeometryUtils.triangleArea(l,o,n),d._area=d._area1+d._area2;i+=d._area;j[g]=i}d=[];e={};for(g=0;g<c;g++)h=THREE.GeometryUtils.random()*i,h=b(h),d[g]=THREE.GeometryUtils.randomPointInFace(f[h],a,!0),e[h]?e[h]+=1:e[h]=1;return d},triangleArea:function(a,c,b){var d,g=THREE.GeometryUtils.__v1;g.sub(a,c);d=g.length();g.sub(a,b);a=g.length();g.sub(c,b);b=g.length();
 c=0.5*(d+a+b);return Math.sqrt(c*(c-d)*(c-a)*(c-b))},center:function(a){a.computeBoundingBox();var c=new THREE.Matrix4;c.setTranslation(-0.5*(a.boundingBox.x[1]+a.boundingBox.x[0]),-0.5*(a.boundingBox.y[1]+a.boundingBox.y[0]),-0.5*(a.boundingBox.z[1]+a.boundingBox.z[0]));a.applyMatrix(c);a.computeBoundingBox()}};THREE.GeometryUtils.random=THREE.Math.random16;THREE.GeometryUtils.__v1=new THREE.Vector3;
-THREE.ImageUtils={loadTexture:function(a,c,b){var d=new Image,f=new THREE.Texture(d,c);d.onload=function(){f.needsUpdate=!0;b&&b(this)};d.crossOrigin="";d.src=a;return f},loadTextureCube:function(a,c,b){var d,f=[],g=new THREE.Texture(f,c),c=f.loadCount=0;for(d=a.length;c<d;++c)f[c]=new Image,f[c].onload=function(){f.loadCount+=1;if(f.loadCount===6)g.needsUpdate=!0;b&&b(this)},f[c].crossOrigin="",f[c].src=a[c];return g},getNormalMap:function(a,c){var b=function(a){var b=Math.sqrt(a[0]*a[0]+a[1]*a[1]+
-a[2]*a[2]);return[a[0]/b,a[1]/b,a[2]/b]};c|=1;var d=a.width,f=a.height,g=document.createElement("canvas");g.width=d;g.height=f;var e=g.getContext("2d");e.drawImage(a,0,0);for(var h=e.getImageData(0,0,d,f).data,i=e.createImageData(d,f),j=i.data,k=0;k<d;k++)for(var m=1;m<f;m++){var o=m-1<0?f-1:m-1,n=(m+1)%f,t=k-1<0?d-1:k-1,q=(k+1)%d,r=[],p=[0,0,h[(m*d+k)*4]/255*c];r.push([-1,0,h[(m*d+t)*4]/255*c]);r.push([-1,-1,h[(o*d+t)*4]/255*c]);r.push([0,-1,h[(o*d+k)*4]/255*c]);r.push([1,-1,h[(o*d+q)*4]/255*c]);
-r.push([1,0,h[(m*d+q)*4]/255*c]);r.push([1,1,h[(n*d+q)*4]/255*c]);r.push([0,1,h[(n*d+k)*4]/255*c]);r.push([-1,1,h[(n*d+t)*4]/255*c]);o=[];t=r.length;for(n=0;n<t;n++){var q=r[n],s=r[(n+1)%t],q=[q[0]-p[0],q[1]-p[1],q[2]-p[2]],s=[s[0]-p[0],s[1]-p[1],s[2]-p[2]];o.push(b([q[1]*s[2]-q[2]*s[1],q[2]*s[0]-q[0]*s[2],q[0]*s[1]-q[1]*s[0]]))}r=[0,0,0];for(n=0;n<o.length;n++)r[0]+=o[n][0],r[1]+=o[n][1],r[2]+=o[n][2];r[0]/=o.length;r[1]/=o.length;r[2]/=o.length;p=(m*d+k)*4;j[p]=(r[0]+1)/2*255|0;j[p+1]=(r[1]+0.5)*
-255|0;j[p+2]=r[2]*255|0;j[p+3]=255}e.putImageData(i,0,0);return g}};THREE.SceneUtils={showHierarchy:function(a,c){THREE.SceneUtils.traverseHierarchy(a,function(a){a.visible=c})},traverseHierarchy:function(a,c){var b,d,f=a.children.length;for(d=0;d<f;d++)b=a.children[d],c(b),THREE.SceneUtils.traverseHierarchy(b,c)},createMultiMaterialObject:function(a,c){var b,d=c.length,f=new THREE.Object3D;for(b=0;b<d;b++){var g=new THREE.Mesh(a,c[b]);f.add(g)}return f}};
+THREE.ImageUtils={loadTexture:function(a,c,b){var d=new Image,g=new THREE.Texture(d,c);d.onload=function(){g.needsUpdate=!0;b&&b(this)};d.crossOrigin="";d.src=a;return g},loadTextureCube:function(a,c,b){var d,g=[],f=new THREE.Texture(g,c),c=g.loadCount=0;for(d=a.length;c<d;++c)g[c]=new Image,g[c].onload=function(){g.loadCount+=1;if(g.loadCount===6)f.needsUpdate=!0;b&&b(this)},g[c].crossOrigin="",g[c].src=a[c];return f},getNormalMap:function(a,c){var b=function(a){var b=Math.sqrt(a[0]*a[0]+a[1]*a[1]+
+a[2]*a[2]);return[a[0]/b,a[1]/b,a[2]/b]};c|=1;var d=a.width,g=a.height,f=document.createElement("canvas");f.width=d;f.height=g;var e=f.getContext("2d");e.drawImage(a,0,0);for(var h=e.getImageData(0,0,d,g).data,i=e.createImageData(d,g),j=i.data,k=0;k<d;k++)for(var l=1;l<g;l++){var o=l-1<0?g-1:l-1,n=(l+1)%g,t=k-1<0?d-1:k-1,q=(k+1)%d,r=[],p=[0,0,h[(l*d+k)*4]/255*c];r.push([-1,0,h[(l*d+t)*4]/255*c]);r.push([-1,-1,h[(o*d+t)*4]/255*c]);r.push([0,-1,h[(o*d+k)*4]/255*c]);r.push([1,-1,h[(o*d+q)*4]/255*c]);
+r.push([1,0,h[(l*d+q)*4]/255*c]);r.push([1,1,h[(n*d+q)*4]/255*c]);r.push([0,1,h[(n*d+k)*4]/255*c]);r.push([-1,1,h[(n*d+t)*4]/255*c]);o=[];t=r.length;for(n=0;n<t;n++){var q=r[n],s=r[(n+1)%t],q=[q[0]-p[0],q[1]-p[1],q[2]-p[2]],s=[s[0]-p[0],s[1]-p[1],s[2]-p[2]];o.push(b([q[1]*s[2]-q[2]*s[1],q[2]*s[0]-q[0]*s[2],q[0]*s[1]-q[1]*s[0]]))}r=[0,0,0];for(n=0;n<o.length;n++)r[0]+=o[n][0],r[1]+=o[n][1],r[2]+=o[n][2];r[0]/=o.length;r[1]/=o.length;r[2]/=o.length;p=(l*d+k)*4;j[p]=(r[0]+1)/2*255|0;j[p+1]=(r[1]+0.5)*
+255|0;j[p+2]=r[2]*255|0;j[p+3]=255}e.putImageData(i,0,0);return f}};THREE.SceneUtils={showHierarchy:function(a,c){THREE.SceneUtils.traverseHierarchy(a,function(a){a.visible=c})},traverseHierarchy:function(a,c){var b,d,g=a.children.length;for(d=0;d<g;d++)b=a.children[d],c(b),THREE.SceneUtils.traverseHierarchy(b,c)},createMultiMaterialObject:function(a,c){var b,d=c.length,g=new THREE.Object3D;for(b=0;b<d;b++){var f=new THREE.Mesh(a,c[b]);g.add(f)}return g}};
 if(THREE.WebGLRenderer)THREE.ShaderUtils={lib:{fresnel:{uniforms:{mRefractionRatio:{type:"f",value:1.02},mFresnelBias:{type:"f",value:0.1},mFresnelPower:{type:"f",value:2},mFresnelScale:{type:"f",value:1},tCube:{type:"t",value:1,texture:null}},fragmentShader:"uniform samplerCube tCube;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 reflectedColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );\nvec4 refractedColor = vec4( 1.0, 1.0, 1.0, 1.0 );\nrefractedColor.r = textureCube( tCube, vec3( -vRefract[0].x, vRefract[0].yz ) ).r;\nrefractedColor.g = textureCube( tCube, vec3( -vRefract[1].x, vRefract[1].yz ) ).g;\nrefractedColor.b = textureCube( tCube, vec3( -vRefract[2].x, vRefract[2].yz ) ).b;\nrefractedColor.a = 1.0;\ngl_FragColor = mix( refractedColor, reflectedColor, clamp( vReflectionFactor, 0.0, 1.0 ) );\n}",
 vertexShader:"uniform float mRefractionRatio;\nuniform float mFresnelBias;\nuniform float mFresnelScale;\nuniform float mFresnelPower;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = normalize ( mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal );\nvec3 I = mPosition.xyz - cameraPosition;\nvReflect = reflect( I, nWorld );\nvRefract[0] = refract( normalize( I ), nWorld, mRefractionRatio );\nvRefract[1] = refract( normalize( I ), nWorld, mRefractionRatio * 0.99 );\nvRefract[2] = refract( normalize( I ), nWorld, mRefractionRatio * 0.98 );\nvReflectionFactor = mFresnelBias + mFresnelScale * pow( 1.0 + dot( normalize( I ), nWorld ), mFresnelPower );\ngl_Position = projectionMatrix * mvPosition;\n}"},
 normal:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.fog,THREE.UniformsLib.lights,THREE.UniformsLib.shadowmap,{enableAO:{type:"i",value:0},enableDiffuse:{type:"i",value:0},enableSpecular:{type:"i",value:0},enableReflection:{type:"i",value:0},tDiffuse:{type:"t",value:0,texture:null},tCube:{type:"t",value:1,texture:null},tNormal:{type:"t",value:2,texture:null},tSpecular:{type:"t",value:3,texture:null},tAO:{type:"t",value:4,texture:null},tDisplacement:{type:"t",value:5,texture:null},uNormalScale:{type:"f",
@@ -23,74 +23,74 @@ THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\
 THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvViewPosition = -mvPosition.xyz;\nvNormal = normalize( normalMatrix * normal );\nvTangent = normalize( normalMatrix * tangent.xyz );\nvBinormal = cross( vNormal, vTangent ) * tangent.w;\nvBinormal = normalize( vBinormal );\nvUv = uv * uRepeat + uOffset;\n#if MAX_POINT_LIGHTS > 0\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\nvec3 lVector = lPosition.xyz - mvPosition.xyz;\nfloat lDistance = 1.0;\nif ( pointLightDistance[ i ] > 0.0 )\nlDistance = 1.0 - min( ( length( lVector ) / pointLightDistance[ i ] ), 1.0 );\nlVector = normalize( lVector );\nvPointLight[ i ] = vec4( lVector, lDistance );\n}\n#endif\n#ifdef VERTEX_TEXTURES\nvec3 dv = texture2D( tDisplacement, uv ).xyz;\nfloat df = uDisplacementScale * dv.x + uDisplacementBias;\nvec4 displacedPosition = vec4( vNormal.xyz * df, 0.0 ) + mvPosition;\ngl_Position = projectionMatrix * displacedPosition;\n#else\ngl_Position = projectionMatrix * mvPosition;\n#endif",
 THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n")},cube:{uniforms:{tCube:{type:"t",value:1,texture:null},tFlip:{type:"f",value:-1}},vertexShader:"varying vec3 vViewPosition;\nvoid main() {\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvViewPosition = cameraPosition - mPosition.xyz;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform samplerCube tCube;\nuniform float tFlip;\nvarying vec3 vViewPosition;\nvoid main() {\nvec3 wPos = cameraPosition - vViewPosition;\ngl_FragColor = textureCube( tCube, vec3( tFlip * wPos.x, wPos.yz ) );\n}"}}};
 THREE.Curve=function(){};THREE.Curve.prototype.getPoint=function(){console.log("Warning, getPoint() not implemented!");return null};THREE.Curve.prototype.getPointAt=function(a){return this.getPoint(this.getUtoTmapping(a))};THREE.Curve.prototype.getPoints=function(a){a||(a=5);var c,b=[];for(c=0;c<=a;c++)b.push(this.getPoint(c/a));return b};THREE.Curve.prototype.getSpacedPoints=function(a){a||(a=5);var c,b=[];for(c=0;c<=a;c++)b.push(this.getPointAt(c/a));return b};
-THREE.Curve.prototype.getLength=function(){var a=this.getLengths();return a[a.length-1]};THREE.Curve.prototype.getLengths=function(a){a||(a=200);if(this.cacheArcLengths&&this.cacheArcLengths.length==a+1)return this.cacheArcLengths;var c=[],b,d=this.getPoint(0),f,g=0;c.push(0);for(f=1;f<=a;f++)b=this.getPoint(f/a),g+=b.distanceTo(d),c.push(g),d=b;return this.cacheArcLengths=c};
-THREE.Curve.prototype.getUtoTmapping=function(a,c){var b=this.getLengths(),d=0,f=b.length,g;g=c?c:a*b[f-1];Date.now();for(var e=0,h=f-1,i;e<=h;)if(d=Math.floor(e+(h-e)/2),i=b[d]-g,i<0)e=d+1;else if(i>0)h=d-1;else{h=d;break}d=h;if(b[d]==g)return d/(f-1);e=b[d];return b=(d+(g-e)/(b[d+1]-e))/(f-1)};THREE.Curve.prototype.getNormalVector=function(a){a=this.getTangent(a);return new THREE.Vector2(-a.y,a.x)};
+THREE.Curve.prototype.getLength=function(){var a=this.getLengths();return a[a.length-1]};THREE.Curve.prototype.getLengths=function(a){a||(a=200);if(this.cacheArcLengths&&this.cacheArcLengths.length==a+1)return this.cacheArcLengths;var c=[],b,d=this.getPoint(0),g,f=0;c.push(0);for(g=1;g<=a;g++)b=this.getPoint(g/a),f+=b.distanceTo(d),c.push(f),d=b;return this.cacheArcLengths=c};
+THREE.Curve.prototype.getUtoTmapping=function(a,c){var b=this.getLengths(),d=0,g=b.length,f;f=c?c:a*b[g-1];Date.now();for(var e=0,h=g-1,i;e<=h;)if(d=Math.floor(e+(h-e)/2),i=b[d]-f,i<0)e=d+1;else if(i>0)h=d-1;else{h=d;break}d=h;if(b[d]==f)return d/(g-1);e=b[d];return b=(d+(f-e)/(b[d+1]-e))/(g-1)};THREE.Curve.prototype.getNormalVector=function(a){a=this.getTangent(a);return new THREE.Vector2(-a.y,a.x)};
 THREE.Curve.prototype.getTangent=function(a){var c=a-1.0E-4;a+=1.0E-4;c<0&&(c=0);a>1&&(a=1);var c=this.getPoint(c),a=this.getPoint(a),b=new THREE.Vector2;b.sub(a,c);return b.unit()};THREE.LineCurve=function(a,c){a instanceof THREE.Vector2?(this.v1=a,this.v2=c):THREE.LineCurve.oldConstructor.apply(this,arguments)};THREE.LineCurve.oldConstructor=function(a,c,b,d){this.constructor(new THREE.Vector2(a,c),new THREE.Vector2(b,d))};THREE.LineCurve.prototype=new THREE.Curve;
 THREE.LineCurve.prototype.constructor=THREE.LineCurve;THREE.LineCurve.prototype.getPoint=function(a){var c=new THREE.Vector2;c.sub(this.v2,this.v1);c.multiplyScalar(a).addSelf(this.v1);return c};THREE.LineCurve.prototype.getPointAt=function(a){return this.getPoint(a)};THREE.LineCurve.prototype.getTangent=function(){var a=new THREE.Vector2;a.sub(this.v2,this.v1);a.normalize();return a};
 THREE.QuadraticBezierCurve=function(a,c,b){if(!(c instanceof THREE.Vector2))var d=Array.prototype.slice.call(arguments),a=new THREE.Vector2(d[0],d[1]),c=new THREE.Vector2(d[2],d[3]),b=new THREE.Vector2(d[4],d[5]);this.v0=a;this.v1=c;this.v2=b};THREE.QuadraticBezierCurve.prototype=new THREE.Curve;THREE.QuadraticBezierCurve.prototype.constructor=THREE.QuadraticBezierCurve;
 THREE.QuadraticBezierCurve.prototype.getPoint=function(a){var c;c=THREE.Shape.Utils.b2(a,this.v0.x,this.v1.x,this.v2.x);a=THREE.Shape.Utils.b2(a,this.v0.y,this.v1.y,this.v2.y);return new THREE.Vector2(c,a)};THREE.QuadraticBezierCurve.prototype.getTangent=function(a){var c;c=THREE.Curve.Utils.tangentQuadraticBezier(a,this.v0.x,this.v1.x,this.v2.x);a=THREE.Curve.Utils.tangentQuadraticBezier(a,this.v0.y,this.v1.y,this.v2.y);c=new THREE.Vector2(c,a);c.normalize();return c};
-THREE.CubicBezierCurve=function(a,c,b,d){if(!(c instanceof THREE.Vector2))var f=Array.prototype.slice.call(arguments),a=new THREE.Vector2(f[0],f[1]),c=new THREE.Vector2(f[2],f[3]),b=new THREE.Vector2(f[4],f[5]),d=new THREE.Vector2(f[6],f[7]);this.v0=a;this.v1=c;this.v2=b;this.v3=d};THREE.CubicBezierCurve.prototype=new THREE.Curve;THREE.CubicBezierCurve.prototype.constructor=THREE.CubicBezierCurve;
+THREE.CubicBezierCurve=function(a,c,b,d){if(!(c instanceof THREE.Vector2))var g=Array.prototype.slice.call(arguments),a=new THREE.Vector2(g[0],g[1]),c=new THREE.Vector2(g[2],g[3]),b=new THREE.Vector2(g[4],g[5]),d=new THREE.Vector2(g[6],g[7]);this.v0=a;this.v1=c;this.v2=b;this.v3=d};THREE.CubicBezierCurve.prototype=new THREE.Curve;THREE.CubicBezierCurve.prototype.constructor=THREE.CubicBezierCurve;
 THREE.CubicBezierCurve.prototype.getPoint=function(a){var c;c=THREE.Shape.Utils.b3(a,this.v0.x,this.v1.x,this.v2.x,this.v3.x);a=THREE.Shape.Utils.b3(a,this.v0.y,this.v1.y,this.v2.y,this.v3.y);return new THREE.Vector2(c,a)};THREE.CubicBezierCurve.prototype.getTangent=function(a){var c;c=THREE.Curve.Utils.tangentCubicBezier(a,this.v0.x,this.v1.x,this.v2.x,this.v3.x);a=THREE.Curve.Utils.tangentCubicBezier(a,this.v0.y,this.v1.y,this.v2.y,this.v3.y);c=new THREE.Vector2(c,a);c.normalize();return c};
 THREE.SplineCurve=function(a){this.points=a};THREE.SplineCurve.prototype=new THREE.Curve;THREE.SplineCurve.prototype.constructor=THREE.SplineCurve;
-THREE.SplineCurve.prototype.getPoint=function(a){var c=new THREE.Vector2,b=[],d=this.points,f;f=(d.length-1)*a;a=Math.floor(f);f-=a;b[0]=a==0?a:a-1;b[1]=a;b[2]=a>d.length-2?a:a+1;b[3]=a>d.length-3?a:a+2;c.x=THREE.Curve.Utils.interpolate(d[b[0]].x,d[b[1]].x,d[b[2]].x,d[b[3]].x,f);c.y=THREE.Curve.Utils.interpolate(d[b[0]].y,d[b[1]].y,d[b[2]].y,d[b[3]].y,f);return c};THREE.ArcCurve=function(a,c,b,d,f,g){this.aX=a;this.aY=c;this.aRadius=b;this.aStartAngle=d;this.aEndAngle=f;this.aClockwise=g};
+THREE.SplineCurve.prototype.getPoint=function(a){var c=new THREE.Vector2,b=[],d=this.points,g;g=(d.length-1)*a;a=Math.floor(g);g-=a;b[0]=a==0?a:a-1;b[1]=a;b[2]=a>d.length-2?a:a+1;b[3]=a>d.length-3?a:a+2;c.x=THREE.Curve.Utils.interpolate(d[b[0]].x,d[b[1]].x,d[b[2]].x,d[b[3]].x,g);c.y=THREE.Curve.Utils.interpolate(d[b[0]].y,d[b[1]].y,d[b[2]].y,d[b[3]].y,g);return c};THREE.ArcCurve=function(a,c,b,d,g,f){this.aX=a;this.aY=c;this.aRadius=b;this.aStartAngle=d;this.aEndAngle=g;this.aClockwise=f};
 THREE.ArcCurve.prototype=new THREE.Curve;THREE.ArcCurve.prototype.constructor=THREE.ArcCurve;THREE.ArcCurve.prototype.getPoint=function(a){var c=this.aEndAngle-this.aStartAngle;this.aClockwise||(a=1-a);a=this.aStartAngle+a*c;return new THREE.Vector2(this.aX+this.aRadius*Math.cos(a),this.aY+this.aRadius*Math.sin(a))};
-THREE.Curve.Utils={tangentQuadraticBezier:function(a,c,b,d){return 2*(1-a)*(b-c)+2*a*(d-b)},tangentCubicBezier:function(a,c,b,d,f){return-3*c*(1-a)*(1-a)+3*b*(1-a)*(1-a)-6*a*b*(1-a)+6*a*d*(1-a)-3*a*a*d+3*a*a*f},tangentSpline:function(a){return 6*a*a-6*a+(3*a*a-4*a+1)+(-6*a*a+6*a)+(3*a*a-2*a)},interpolate:function(a,c,b,d,f){var a=(b-a)*0.5,d=(d-c)*0.5,g=f*f;return(2*c-2*b+a+d)*f*g+(-3*c+3*b-2*a-d)*g+a*f+c}};
+THREE.Curve.Utils={tangentQuadraticBezier:function(a,c,b,d){return 2*(1-a)*(b-c)+2*a*(d-b)},tangentCubicBezier:function(a,c,b,d,g){return-3*c*(1-a)*(1-a)+3*b*(1-a)*(1-a)-6*a*b*(1-a)+6*a*d*(1-a)-3*a*a*d+3*a*a*g},tangentSpline:function(a){return 6*a*a-6*a+(3*a*a-4*a+1)+(-6*a*a+6*a)+(3*a*a-2*a)},interpolate:function(a,c,b,d,g){var a=(b-a)*0.5,d=(d-c)*0.5,f=g*g;return(2*c-2*b+a+d)*g*f+(-3*c+3*b-2*a-d)*f+a*g+c}};
 THREE.Curve.create=function(a,c){a.prototype=new THREE.Curve;a.prototype.constructor=a;a.prototype.getPoint=c;return a};THREE.LineCurve3=THREE.Curve.create(function(a,c){this.v1=a;this.v2=c},function(a){var c=new THREE.Vector3;c.sub(this.v2,this.v1);c.multiplyScalar(a);c.addSelf(this.v1);return c});
 THREE.QuadraticBezierCurve3=THREE.Curve.create(function(a,c,b){this.v0=a;this.v1=c;this.v2=b},function(a){var c,b;c=THREE.Shape.Utils.b2(a,this.v0.x,this.v1.x,this.v2.x);b=THREE.Shape.Utils.b2(a,this.v0.y,this.v1.y,this.v2.y);a=THREE.Shape.Utils.b2(a,this.v0.z,this.v1.z,this.v2.z);return new THREE.Vector3(c,b,a)});
 THREE.CubicBezierCurve3=THREE.Curve.create(function(a,c,b,d){this.v0=a;this.v1=c;this.v2=b;this.v3=d},function(a){var c,b;c=THREE.Shape.Utils.b3(a,this.v0.x,this.v1.x,this.v2.x,this.v3.x);b=THREE.Shape.Utils.b3(a,this.v0.y,this.v1.y,this.v2.y,this.v3.y);a=THREE.Shape.Utils.b3(a,this.v0.z,this.v1.z,this.v2.z,this.v3.z);return new THREE.Vector3(c,b,a)});
-THREE.SplineCurve3=THREE.Curve.create(function(a){this.points=a},function(a){var c=new THREE.Vector3,b=[],d=this.points,f;f=(d.length-1)*a;a=Math.floor(f);f-=a;b[0]=a==0?a:a-1;b[1]=a;b[2]=a>d.length-2?a:a+1;b[3]=a>d.length-3?a:a+2;c.x=THREE.Curve.Utils.interpolate(d[b[0]].x,d[b[1]].x,d[b[2]].x,d[b[3]].x,f);c.y=THREE.Curve.Utils.interpolate(d[b[0]].y,d[b[1]].y,d[b[2]].y,d[b[3]].y,f);c.z=THREE.Curve.Utils.interpolate(d[b[0]].z,d[b[1]].z,d[b[2]].z,d[b[3]].z,f);return c});
+THREE.SplineCurve3=THREE.Curve.create(function(a){this.points=a},function(a){var c=new THREE.Vector3,b=[],d=this.points,g;g=(d.length-1)*a;a=Math.floor(g);g-=a;b[0]=a==0?a:a-1;b[1]=a;b[2]=a>d.length-2?a:a+1;b[3]=a>d.length-3?a:a+2;c.x=THREE.Curve.Utils.interpolate(d[b[0]].x,d[b[1]].x,d[b[2]].x,d[b[3]].x,g);c.y=THREE.Curve.Utils.interpolate(d[b[0]].y,d[b[1]].y,d[b[2]].y,d[b[3]].y,g);c.z=THREE.Curve.Utils.interpolate(d[b[0]].z,d[b[1]].z,d[b[2]].z,d[b[3]].z,g);return c});
 THREE.CurvePath=function(){this.curves=[];this.bends=[]};THREE.CurvePath.prototype=new THREE.Curve;THREE.CurvePath.prototype.constructor=THREE.CurvePath;THREE.CurvePath.prototype.add=function(a){this.curves.push(a)};THREE.CurvePath.prototype.checkConnection=function(){};THREE.CurvePath.prototype.closePath=function(){};
 THREE.CurvePath.prototype.getPoint=function(a){for(var c=a*this.getLength(),b=this.getCurveLengths(),a=0;a<b.length;){if(b[a]>=c)return c=b[a]-c,a=this.curves[a],c=1-c/a.getLength(),a.getPointAt(c);a++}return null};THREE.CurvePath.prototype.getLength=function(){var a=this.getCurveLengths();return a[a.length-1]};
 THREE.CurvePath.prototype.getCurveLengths=function(){if(this.cacheLengths&&this.cacheLengths.length==this.curves.length)return this.cacheLengths;var a=[],c=0,b,d=this.curves.length;for(b=0;b<d;b++)c+=this.curves[b].getLength(),a.push(c);return this.cacheLengths=a};
-THREE.CurvePath.prototype.getBoundingBox=function(){var a=this.getPoints(),c,b,d,f;c=b=Number.NEGATIVE_INFINITY;d=f=Number.POSITIVE_INFINITY;var g,e,h,i;i=new THREE.Vector2;e=0;for(h=a.length;e<h;e++){g=a[e];if(g.x>c)c=g.x;else if(g.x<d)d=g.x;if(g.y>b)b=g.y;else if(g.y<b)f=g.y;i.addSelf(g.x,g.y)}return{minX:d,minY:f,maxX:c,maxY:b,centroid:i.divideScalar(h)}};THREE.CurvePath.prototype.createPointsGeometry=function(a){return this.createGeometry(this.getPoints(a,!0))};
+THREE.CurvePath.prototype.getBoundingBox=function(){var a=this.getPoints(),c,b,d,g;c=b=Number.NEGATIVE_INFINITY;d=g=Number.POSITIVE_INFINITY;var f,e,h,i;i=new THREE.Vector2;e=0;for(h=a.length;e<h;e++){f=a[e];if(f.x>c)c=f.x;else if(f.x<d)d=f.x;if(f.y>b)b=f.y;else if(f.y<b)g=f.y;i.addSelf(f.x,f.y)}return{minX:d,minY:g,maxX:c,maxY:b,centroid:i.divideScalar(h)}};THREE.CurvePath.prototype.createPointsGeometry=function(a){return this.createGeometry(this.getPoints(a,!0))};
 THREE.CurvePath.prototype.createSpacedPointsGeometry=function(a){return this.createGeometry(this.getSpacedPoints(a,!0))};THREE.CurvePath.prototype.createGeometry=function(a){for(var c=new THREE.Geometry,b=0;b<a.length;b++)c.vertices.push(new THREE.Vertex(new THREE.Vector3(a[b].x,a[b].y,0)));return c};THREE.CurvePath.prototype.addWrapPath=function(a){this.bends.push(a)};
-THREE.CurvePath.prototype.getTransformedPoints=function(a,c){var b=this.getPoints(a),d,f;if(!c)c=this.bends;d=0;for(f=c.length;d<f;d++)b=this.getWrapPoints(b,c[d]);return b};THREE.CurvePath.prototype.getTransformedSpacedPoints=function(a,c){var b=this.getSpacedPoints(a),d,f;if(!c)c=this.bends;d=0;for(f=c.length;d<f;d++)b=this.getWrapPoints(b,c[d]);return b};
-THREE.CurvePath.prototype.getWrapPoints=function(a,c){var b=this.getBoundingBox(),d,f,g,e,h,i;d=0;for(f=a.length;d<f;d++)g=a[d],e=g.x,h=g.y,i=e/b.maxX,i=c.getUtoTmapping(i,e),e=c.getPoint(i),h=c.getNormalVector(i).multiplyScalar(h),g.x=e.x+h.x,g.y=e.y+h.y;return a};THREE.Path=function(a){THREE.CurvePath.call(this);this.actions=[];a&&this.fromPoints(a)};THREE.Path.prototype=new THREE.CurvePath;THREE.Path.prototype.constructor=THREE.Path;
+THREE.CurvePath.prototype.getTransformedPoints=function(a,c){var b=this.getPoints(a),d,g;if(!c)c=this.bends;d=0;for(g=c.length;d<g;d++)b=this.getWrapPoints(b,c[d]);return b};THREE.CurvePath.prototype.getTransformedSpacedPoints=function(a,c){var b=this.getSpacedPoints(a),d,g;if(!c)c=this.bends;d=0;for(g=c.length;d<g;d++)b=this.getWrapPoints(b,c[d]);return b};
+THREE.CurvePath.prototype.getWrapPoints=function(a,c){var b=this.getBoundingBox(),d,g,f,e,h,i;d=0;for(g=a.length;d<g;d++)f=a[d],e=f.x,h=f.y,i=e/b.maxX,i=c.getUtoTmapping(i,e),e=c.getPoint(i),h=c.getNormalVector(i).multiplyScalar(h),f.x=e.x+h.x,f.y=e.y+h.y;return a};THREE.Path=function(a){THREE.CurvePath.call(this);this.actions=[];a&&this.fromPoints(a)};THREE.Path.prototype=new THREE.CurvePath;THREE.Path.prototype.constructor=THREE.Path;
 THREE.PathActions={MOVE_TO:"moveTo",LINE_TO:"lineTo",QUADRATIC_CURVE_TO:"quadraticCurveTo",BEZIER_CURVE_TO:"bezierCurveTo",CSPLINE_THRU:"splineThru",ARC:"arc"};THREE.Path.prototype.fromPoints=function(a){this.moveTo(a[0].x,a[0].y);var c,b=a.length;for(c=1;c<b;c++)this.lineTo(a[c].x,a[c].y)};THREE.Path.prototype.moveTo=function(){var a=Array.prototype.slice.call(arguments);this.actions.push({action:THREE.PathActions.MOVE_TO,args:a})};
 THREE.Path.prototype.lineTo=function(a,c){var b=Array.prototype.slice.call(arguments),d=this.actions[this.actions.length-1].args;this.curves.push(new THREE.LineCurve(new THREE.Vector2(d[d.length-2],d[d.length-1]),new THREE.Vector2(a,c)));this.actions.push({action:THREE.PathActions.LINE_TO,args:b})};
-THREE.Path.prototype.quadraticCurveTo=function(a,c,b,d){var f=Array.prototype.slice.call(arguments),g=this.actions[this.actions.length-1].args;this.curves.push(new THREE.QuadraticBezierCurve(new THREE.Vector2(g[g.length-2],g[g.length-1]),new THREE.Vector2(a,c),new THREE.Vector2(b,d)));this.actions.push({action:THREE.PathActions.QUADRATIC_CURVE_TO,args:f})};
-THREE.Path.prototype.bezierCurveTo=function(a,c,b,d,f,g){var e=Array.prototype.slice.call(arguments),h=this.actions[this.actions.length-1].args;this.curves.push(new THREE.CubicBezierCurve(new THREE.Vector2(h[h.length-2],h[h.length-1]),new THREE.Vector2(a,c),new THREE.Vector2(b,d),new THREE.Vector2(f,g)));this.actions.push({action:THREE.PathActions.BEZIER_CURVE_TO,args:e})};
+THREE.Path.prototype.quadraticCurveTo=function(a,c,b,d){var g=Array.prototype.slice.call(arguments),f=this.actions[this.actions.length-1].args;this.curves.push(new THREE.QuadraticBezierCurve(new THREE.Vector2(f[f.length-2],f[f.length-1]),new THREE.Vector2(a,c),new THREE.Vector2(b,d)));this.actions.push({action:THREE.PathActions.QUADRATIC_CURVE_TO,args:g})};
+THREE.Path.prototype.bezierCurveTo=function(a,c,b,d,g,f){var e=Array.prototype.slice.call(arguments),h=this.actions[this.actions.length-1].args;this.curves.push(new THREE.CubicBezierCurve(new THREE.Vector2(h[h.length-2],h[h.length-1]),new THREE.Vector2(a,c),new THREE.Vector2(b,d),new THREE.Vector2(g,f)));this.actions.push({action:THREE.PathActions.BEZIER_CURVE_TO,args:e})};
 THREE.Path.prototype.splineThru=function(a){var c=Array.prototype.slice.call(arguments),b=this.actions[this.actions.length-1].args,b=[new THREE.Vector2(b[b.length-2],b[b.length-1])];Array.prototype.push.apply(b,a);this.curves.push(new THREE.SplineCurve(b));this.actions.push({action:THREE.PathActions.CSPLINE_THRU,args:c})};
-THREE.Path.prototype.arc=function(a,c,b,d,f,g){var e=Array.prototype.slice.call(arguments);this.curves.push(new THREE.ArcCurve(a,c,b,d,f,g));this.actions.push({action:THREE.PathActions.ARC,args:e})};THREE.Path.prototype.getSpacedPoints=function(a){a||(a=40);for(var c=[],b=0;b<a;b++)c.push(this.getPoint(b/a));return c};
-THREE.Path.prototype.getPoints=function(a,c){var a=a||12,b=[],d,f,g,e,h,i,j,k,m,o,n,t,q;d=0;for(f=this.actions.length;d<f;d++)switch(g=this.actions[d],e=g.action,g=g.args,e){case THREE.PathActions.LINE_TO:b.push(new THREE.Vector2(g[0],g[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:h=g[2];i=g[3];m=g[0];o=g[1];b.length>0?(e=b[b.length-1],n=e.x,t=e.y):(e=this.actions[d-1].args,n=e[e.length-2],t=e[e.length-1]);for(e=1;e<=a;e++)q=e/a,g=THREE.Shape.Utils.b2(q,n,m,h),q=THREE.Shape.Utils.b2(q,t,o,
-i),b.push(new THREE.Vector2(g,q));break;case THREE.PathActions.BEZIER_CURVE_TO:h=g[4];i=g[5];m=g[0];o=g[1];j=g[2];k=g[3];b.length>0?(e=b[b.length-1],n=e.x,t=e.y):(e=this.actions[d-1].args,n=e[e.length-2],t=e[e.length-1]);for(e=1;e<=a;e++)q=e/a,g=THREE.Shape.Utils.b3(q,n,m,j,h),q=THREE.Shape.Utils.b3(q,t,o,k,i),b.push(new THREE.Vector2(g,q));break;case THREE.PathActions.CSPLINE_THRU:e=this.actions[d-1].args;e=[new THREE.Vector2(e[e.length-2],e[e.length-1])];q=a*g[0].length;e=e.concat(g[0]);g=new THREE.SplineCurve(e);
-for(e=1;e<=q;e++)b.push(g.getPointAt(e/q));break;case THREE.PathActions.ARC:e=this.actions[d-1].args;h=g[0];i=g[1];j=g[2];m=g[3];q=g[4];o=!!g[5];k=e[e.length-2];n=e[e.length-1];e.length==0&&(k=n=0);t=q-m;var r=a*2;for(e=1;e<=r;e++)q=e/r,o||(q=1-q),q=m+q*t,g=k+h+j*Math.cos(q),q=n+i+j*Math.sin(q),b.push(new THREE.Vector2(g,q))}c&&b.push(b[0]);return b};THREE.Path.prototype.transform=function(a,c){this.getBoundingBox();return this.getWrapPoints(this.getPoints(c),a)};
-THREE.Path.prototype.nltransform=function(a,c,b,d,f,g){var e=this.getPoints(),h,i,j,k,m;h=0;for(i=e.length;h<i;h++)j=e[h],k=j.x,m=j.y,j.x=a*k+c*m+b,j.y=d*m+f*k+g;return e};
-THREE.Path.prototype.debug=function(a){var c=this.getBoundingBox();a||(a=document.createElement("canvas"),a.setAttribute("width",c.maxX+100),a.setAttribute("height",c.maxY+100),document.body.appendChild(a));c=a.getContext("2d");c.fillStyle="white";c.fillRect(0,0,a.width,a.height);c.strokeStyle="black";c.beginPath();var b,d,f,a=0;for(b=this.actions.length;a<b;a++)d=this.actions[a],f=d.args,d=d.action,d!=THREE.PathActions.CSPLINE_THRU&&c[d].apply(c,f);c.stroke();c.closePath();c.strokeStyle="red";d=
-this.getPoints();a=0;for(b=d.length;a<b;a++)f=d[a],c.beginPath(),c.arc(f.x,f.y,1.5,0,Math.PI*2,!1),c.stroke(),c.closePath()};
-THREE.Path.prototype.toShapes=function(){var a,c,b,d,f=[],g=new THREE.Path;a=0;for(c=this.actions.length;a<c;a++)b=this.actions[a],d=b.args,b=b.action,b==THREE.PathActions.MOVE_TO&&g.actions.length!=0&&(f.push(g),g=new THREE.Path),g[b].apply(g,d);g.actions.length!=0&&f.push(g);if(f.length==0)return[];var e,g=[];if(THREE.Shape.Utils.isClockWise(f[0].getPoints())){a=0;for(c=f.length;a<c;a++)d=f[a],THREE.Shape.Utils.isClockWise(d.getPoints())?(e&&g.push(e),e=new THREE.Shape,e.actions=d.actions,e.curves=
-d.curves):e.holes.push(d);g.push(e)}else{e=new THREE.Shape;a=0;for(c=f.length;a<c;a++)d=f[a],THREE.Shape.Utils.isClockWise(d.getPoints())?(e.actions=d.actions,e.curves=d.curves,g.push(e),e=new THREE.Shape):e.holes.push(d)}return g};THREE.Shape=function(){THREE.Path.apply(this,arguments);this.holes=[]};THREE.Shape.prototype=new THREE.Path;THREE.Shape.prototype.constructor=THREE.Path;THREE.Shape.prototype.extrude=function(a){return new THREE.ExtrudeGeometry(this,a)};
+THREE.Path.prototype.arc=function(a,c,b,d,g,f){var e=Array.prototype.slice.call(arguments);this.curves.push(new THREE.ArcCurve(a,c,b,d,g,f));this.actions.push({action:THREE.PathActions.ARC,args:e})};THREE.Path.prototype.getSpacedPoints=function(a){a||(a=40);for(var c=[],b=0;b<a;b++)c.push(this.getPoint(b/a));return c};
+THREE.Path.prototype.getPoints=function(a,c){var a=a||12,b=[],d,g,f,e,h,i,j,k,l,o,n,t,q;d=0;for(g=this.actions.length;d<g;d++)switch(f=this.actions[d],e=f.action,f=f.args,e){case THREE.PathActions.LINE_TO:b.push(new THREE.Vector2(f[0],f[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:h=f[2];i=f[3];l=f[0];o=f[1];b.length>0?(e=b[b.length-1],n=e.x,t=e.y):(e=this.actions[d-1].args,n=e[e.length-2],t=e[e.length-1]);for(e=1;e<=a;e++)q=e/a,f=THREE.Shape.Utils.b2(q,n,l,h),q=THREE.Shape.Utils.b2(q,t,o,
+i),b.push(new THREE.Vector2(f,q));break;case THREE.PathActions.BEZIER_CURVE_TO:h=f[4];i=f[5];l=f[0];o=f[1];j=f[2];k=f[3];b.length>0?(e=b[b.length-1],n=e.x,t=e.y):(e=this.actions[d-1].args,n=e[e.length-2],t=e[e.length-1]);for(e=1;e<=a;e++)q=e/a,f=THREE.Shape.Utils.b3(q,n,l,j,h),q=THREE.Shape.Utils.b3(q,t,o,k,i),b.push(new THREE.Vector2(f,q));break;case THREE.PathActions.CSPLINE_THRU:e=this.actions[d-1].args;e=[new THREE.Vector2(e[e.length-2],e[e.length-1])];q=a*f[0].length;e=e.concat(f[0]);f=new THREE.SplineCurve(e);
+for(e=1;e<=q;e++)b.push(f.getPointAt(e/q));break;case THREE.PathActions.ARC:e=this.actions[d-1].args;h=f[0];i=f[1];j=f[2];l=f[3];q=f[4];o=!!f[5];k=e[e.length-2];n=e[e.length-1];e.length==0&&(k=n=0);t=q-l;var r=a*2;for(e=1;e<=r;e++)q=e/r,o||(q=1-q),q=l+q*t,f=k+h+j*Math.cos(q),q=n+i+j*Math.sin(q),b.push(new THREE.Vector2(f,q))}c&&b.push(b[0]);return b};THREE.Path.prototype.transform=function(a,c){this.getBoundingBox();return this.getWrapPoints(this.getPoints(c),a)};
+THREE.Path.prototype.nltransform=function(a,c,b,d,g,f){var e=this.getPoints(),h,i,j,k,l;h=0;for(i=e.length;h<i;h++)j=e[h],k=j.x,l=j.y,j.x=a*k+c*l+b,j.y=d*l+g*k+f;return e};
+THREE.Path.prototype.debug=function(a){var c=this.getBoundingBox();a||(a=document.createElement("canvas"),a.setAttribute("width",c.maxX+100),a.setAttribute("height",c.maxY+100),document.body.appendChild(a));c=a.getContext("2d");c.fillStyle="white";c.fillRect(0,0,a.width,a.height);c.strokeStyle="black";c.beginPath();var b,d,g,a=0;for(b=this.actions.length;a<b;a++)d=this.actions[a],g=d.args,d=d.action,d!=THREE.PathActions.CSPLINE_THRU&&c[d].apply(c,g);c.stroke();c.closePath();c.strokeStyle="red";d=
+this.getPoints();a=0;for(b=d.length;a<b;a++)g=d[a],c.beginPath(),c.arc(g.x,g.y,1.5,0,Math.PI*2,!1),c.stroke(),c.closePath()};
+THREE.Path.prototype.toShapes=function(){var a,c,b,d,g=[],f=new THREE.Path;a=0;for(c=this.actions.length;a<c;a++)b=this.actions[a],d=b.args,b=b.action,b==THREE.PathActions.MOVE_TO&&f.actions.length!=0&&(g.push(f),f=new THREE.Path),f[b].apply(f,d);f.actions.length!=0&&g.push(f);if(g.length==0)return[];var e,f=[];if(THREE.Shape.Utils.isClockWise(g[0].getPoints())){a=0;for(c=g.length;a<c;a++)d=g[a],THREE.Shape.Utils.isClockWise(d.getPoints())?(e&&f.push(e),e=new THREE.Shape,e.actions=d.actions,e.curves=
+d.curves):e.holes.push(d);f.push(e)}else{e=new THREE.Shape;a=0;for(c=g.length;a<c;a++)d=g[a],THREE.Shape.Utils.isClockWise(d.getPoints())?(e.actions=d.actions,e.curves=d.curves,f.push(e),e=new THREE.Shape):e.holes.push(d)}return f};THREE.Shape=function(){THREE.Path.apply(this,arguments);this.holes=[]};THREE.Shape.prototype=new THREE.Path;THREE.Shape.prototype.constructor=THREE.Path;THREE.Shape.prototype.extrude=function(a){return new THREE.ExtrudeGeometry(this,a)};
 THREE.Shape.prototype.getPointsHoles=function(a){var c,b=this.holes.length,d=[];for(c=0;c<b;c++)d[c]=this.holes[c].getTransformedPoints(a,this.bends);return d};THREE.Shape.prototype.getSpacedPointsHoles=function(a){var c,b=this.holes.length,d=[];for(c=0;c<b;c++)d[c]=this.holes[c].getTransformedSpacedPoints(a,this.bends);return d};THREE.Shape.prototype.extractAllPoints=function(a){return{shape:this.getTransformedPoints(a),holes:this.getPointsHoles(a)}};
 THREE.Shape.prototype.extractAllSpacedPoints=function(a){return{shape:this.getTransformedSpacedPoints(a),holes:this.getSpacedPointsHoles(a)}};
-THREE.Shape.Utils={removeHoles:function(a,c){var b=a.concat(),d=b.concat(),f,g,e,h,i,j,k,m,o,n,t=[];for(i=0;i<c.length;i++){j=c[i];Array.prototype.push.apply(d,j);g=Number.POSITIVE_INFINITY;for(f=0;f<j.length;f++){o=j[f];n=[];for(m=0;m<b.length;m++)k=b[m],k=o.distanceToSquared(k),n.push(k),k<g&&(g=k,e=f,h=m)}f=h-1>=0?h-1:b.length-1;g=e-1>=0?e-1:j.length-1;var q=[j[e],b[h],b[f]];m=THREE.FontUtils.Triangulate.area(q);var r=[j[e],j[g],b[h]];o=THREE.FontUtils.Triangulate.area(r);n=h;k=e;h+=1;e+=-1;h<
-0&&(h+=b.length);h%=b.length;e<0&&(e+=j.length);e%=j.length;f=h-1>=0?h-1:b.length-1;g=e-1>=0?e-1:j.length-1;q=[j[e],b[h],b[f]];q=THREE.FontUtils.Triangulate.area(q);r=[j[e],j[g],b[h]];r=THREE.FontUtils.Triangulate.area(r);m+o>q+r&&(h=n,e=k,h<0&&(h+=b.length),h%=b.length,e<0&&(e+=j.length),e%=j.length,f=h-1>=0?h-1:b.length-1,g=e-1>=0?e-1:j.length-1);m=b.slice(0,h);o=b.slice(h);n=j.slice(e);k=j.slice(0,e);g=[j[e],j[g],b[h]];t.push([j[e],b[h],b[f]]);t.push(g);b=m.concat(n).concat(k).concat(o)}return{shape:b,
-isolatedPts:t,allpoints:d}},triangulateShape:function(a,c){var b=THREE.Shape.Utils.removeHoles(a,c),d=b.allpoints,f=b.isolatedPts,b=THREE.FontUtils.Triangulate(b.shape,!1),g,e,h,i,j={};g=0;for(e=d.length;g<e;g++)i=d[g].x+":"+d[g].y,j[i]!==void 0&&console.log("Duplicate point",i),j[i]=g;g=0;for(e=b.length;g<e;g++){h=b[g];for(d=0;d<3;d++)i=h[d].x+":"+h[d].y,i=j[i],i!==void 0&&(h[d]=i)}g=0;for(e=f.length;g<e;g++){h=f[g];for(d=0;d<3;d++)i=h[d].x+":"+h[d].y,i=j[i],i!==void 0&&(h[d]=i)}return b.concat(f)},
-isClockWise:function(a){return THREE.FontUtils.Triangulate.area(a)<0},b2p0:function(a,c){var b=1-a;return b*b*c},b2p1:function(a,c){return 2*(1-a)*a*c},b2p2:function(a,c){return a*a*c},b2:function(a,c,b,d){return this.b2p0(a,c)+this.b2p1(a,b)+this.b2p2(a,d)},b3p0:function(a,c){var b=1-a;return b*b*b*c},b3p1:function(a,c){var b=1-a;return 3*b*b*a*c},b3p2:function(a,c){return 3*(1-a)*a*a*c},b3p3:function(a,c){return a*a*a*c},b3:function(a,c,b,d,f){return this.b3p0(a,c)+this.b3p1(a,b)+this.b3p2(a,d)+
-this.b3p3(a,f)}};THREE.TextPath=function(a,c){THREE.Path.call(this);this.parameters=c||{};this.set(a)};THREE.TextPath.prototype.set=function(a,c){this.text=a;var c=c||this.parameters,b=c.curveSegments!==void 0?c.curveSegments:4,d=c.font!==void 0?c.font:"helvetiker",f=c.weight!==void 0?c.weight:"normal",g=c.style!==void 0?c.style:"normal";THREE.FontUtils.size=c.size!==void 0?c.size:100;THREE.FontUtils.divisions=b;THREE.FontUtils.face=d;THREE.FontUtils.weight=f;THREE.FontUtils.style=g};
+THREE.Shape.Utils={removeHoles:function(a,c){var b=a.concat(),d=b.concat(),g,f,e,h,i,j,k,l,o,n,t=[];for(i=0;i<c.length;i++){j=c[i];Array.prototype.push.apply(d,j);f=Number.POSITIVE_INFINITY;for(g=0;g<j.length;g++){o=j[g];n=[];for(l=0;l<b.length;l++)k=b[l],k=o.distanceToSquared(k),n.push(k),k<f&&(f=k,e=g,h=l)}g=h-1>=0?h-1:b.length-1;f=e-1>=0?e-1:j.length-1;var q=[j[e],b[h],b[g]];l=THREE.FontUtils.Triangulate.area(q);var r=[j[e],j[f],b[h]];o=THREE.FontUtils.Triangulate.area(r);n=h;k=e;h+=1;e+=-1;h<
+0&&(h+=b.length);h%=b.length;e<0&&(e+=j.length);e%=j.length;g=h-1>=0?h-1:b.length-1;f=e-1>=0?e-1:j.length-1;q=[j[e],b[h],b[g]];q=THREE.FontUtils.Triangulate.area(q);r=[j[e],j[f],b[h]];r=THREE.FontUtils.Triangulate.area(r);l+o>q+r&&(h=n,e=k,h<0&&(h+=b.length),h%=b.length,e<0&&(e+=j.length),e%=j.length,g=h-1>=0?h-1:b.length-1,f=e-1>=0?e-1:j.length-1);l=b.slice(0,h);o=b.slice(h);n=j.slice(e);k=j.slice(0,e);f=[j[e],j[f],b[h]];t.push([j[e],b[h],b[g]]);t.push(f);b=l.concat(n).concat(k).concat(o)}return{shape:b,
+isolatedPts:t,allpoints:d}},triangulateShape:function(a,c){var b=THREE.Shape.Utils.removeHoles(a,c),d=b.allpoints,g=b.isolatedPts,b=THREE.FontUtils.Triangulate(b.shape,!1),f,e,h,i,j={};f=0;for(e=d.length;f<e;f++)i=d[f].x+":"+d[f].y,j[i]!==void 0&&console.log("Duplicate point",i),j[i]=f;f=0;for(e=b.length;f<e;f++){h=b[f];for(d=0;d<3;d++)i=h[d].x+":"+h[d].y,i=j[i],i!==void 0&&(h[d]=i)}f=0;for(e=g.length;f<e;f++){h=g[f];for(d=0;d<3;d++)i=h[d].x+":"+h[d].y,i=j[i],i!==void 0&&(h[d]=i)}return b.concat(g)},
+isClockWise:function(a){return THREE.FontUtils.Triangulate.area(a)<0},b2p0:function(a,c){var b=1-a;return b*b*c},b2p1:function(a,c){return 2*(1-a)*a*c},b2p2:function(a,c){return a*a*c},b2:function(a,c,b,d){return this.b2p0(a,c)+this.b2p1(a,b)+this.b2p2(a,d)},b3p0:function(a,c){var b=1-a;return b*b*b*c},b3p1:function(a,c){var b=1-a;return 3*b*b*a*c},b3p2:function(a,c){return 3*(1-a)*a*a*c},b3p3:function(a,c){return a*a*a*c},b3:function(a,c,b,d,g){return this.b3p0(a,c)+this.b3p1(a,b)+this.b3p2(a,d)+
+this.b3p3(a,g)}};THREE.TextPath=function(a,c){THREE.Path.call(this);this.parameters=c||{};this.set(a)};THREE.TextPath.prototype.set=function(a,c){this.text=a;var c=c||this.parameters,b=c.curveSegments!==void 0?c.curveSegments:4,d=c.font!==void 0?c.font:"helvetiker",g=c.weight!==void 0?c.weight:"normal",f=c.style!==void 0?c.style:"normal";THREE.FontUtils.size=c.size!==void 0?c.size:100;THREE.FontUtils.divisions=b;THREE.FontUtils.face=d;THREE.FontUtils.weight=g;THREE.FontUtils.style=f};
 THREE.TextPath.prototype.toShapes=function(){for(var a=THREE.FontUtils.drawText(this.text).paths,c=[],b=0,d=a.length;b<d;b++)Array.prototype.push.apply(c,a[b].toShapes());return c};
 THREE.AnimationHandler=function(){var a=[],c={},b={update:function(b){for(var d=0;d<a.length;d++)a[d].update(b)},addToUpdate:function(b){a.indexOf(b)===-1&&a.push(b)},removeFromUpdate:function(b){b=a.indexOf(b);b!==-1&&a.splice(b,1)},add:function(a){c[a.name]!==void 0&&console.log("THREE.AnimationHandler.add: Warning! "+a.name+" already exists in library. Overwriting.");c[a.name]=a;if(a.initialized!==!0){for(var b=0;b<a.hierarchy.length;b++){for(var d=0;d<a.hierarchy[b].keys.length;d++){if(a.hierarchy[b].keys[d].time<
 0)a.hierarchy[b].keys[d].time=0;if(a.hierarchy[b].keys[d].rot!==void 0&&!(a.hierarchy[b].keys[d].rot instanceof THREE.Quaternion)){var h=a.hierarchy[b].keys[d].rot;a.hierarchy[b].keys[d].rot=new THREE.Quaternion(h[0],h[1],h[2],h[3])}}if(a.hierarchy[b].keys[0].morphTargets!==void 0){h={};for(d=0;d<a.hierarchy[b].keys.length;d++)for(var i=0;i<a.hierarchy[b].keys[d].morphTargets.length;i++){var j=a.hierarchy[b].keys[d].morphTargets[i];h[j]=-1}a.hierarchy[b].usedMorphTargets=h;for(d=0;d<a.hierarchy[b].keys.length;d++){var k=
 {};for(j in h){for(i=0;i<a.hierarchy[b].keys[d].morphTargets.length;i++)if(a.hierarchy[b].keys[d].morphTargets[i]===j){k[j]=a.hierarchy[b].keys[d].morphTargetsInfluences[i];break}i===a.hierarchy[b].keys[d].morphTargets.length&&(k[j]=0)}a.hierarchy[b].keys[d].morphTargetsInfluences=k}}for(d=1;d<a.hierarchy[b].keys.length;d++)a.hierarchy[b].keys[d].time===a.hierarchy[b].keys[d-1].time&&(a.hierarchy[b].keys.splice(d,1),d--);for(d=1;d<a.hierarchy[b].keys.length;d++)a.hierarchy[b].keys[d].index=d}d=parseInt(a.length*
 a.fps,10);a.JIT={};a.JIT.hierarchy=[];for(b=0;b<a.hierarchy.length;b++)a.JIT.hierarchy.push(Array(d));a.initialized=!0}},get:function(a){if(typeof a==="string")return c[a]?c[a]:(console.log("THREE.AnimationHandler.get: Couldn't find animation "+a),null)},parse:function(a){var b=[];if(a instanceof THREE.SkinnedMesh)for(var c=0;c<a.bones.length;c++)b.push(a.bones[c]);else d(a,b);return b}},d=function(a,b){b.push(a);for(var c=0;c<a.children.length;c++)d(a.children[c],b)};b.LINEAR=0;b.CATMULLROM=1;b.CATMULLROM_FORWARD=
 2;return b}();THREE.Animation=function(a,c,b,d){this.root=a;this.data=THREE.AnimationHandler.get(c);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.loop=this.isPaused=!0;this.interpolationType=b!==void 0?b:THREE.AnimationHandler.LINEAR;this.JITCompile=d!==void 0?d:!0;this.points=[];this.target=new THREE.Vector3};
-THREE.Animation.prototype.play=function(a,c){if(!this.isPlaying){this.isPlaying=!0;this.loop=a!==void 0?a:!0;this.currentTime=c!==void 0?c:0;var b,d=this.hierarchy.length,f;for(b=0;b<d;b++){f=this.hierarchy[b];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)f.useQuaternion=!0;f.matrixAutoUpdate=!0;if(f.animationCache===void 0)f.animationCache={},f.animationCache.prevKey={pos:0,rot:0,scl:0},f.animationCache.nextKey={pos:0,rot:0,scl:0},f.animationCache.originalMatrix=f instanceof
-THREE.Bone?f.skinMatrix:f.matrix;var g=f.animationCache.prevKey;f=f.animationCache.nextKey;g.pos=this.data.hierarchy[b].keys[0];g.rot=this.data.hierarchy[b].keys[0];g.scl=this.data.hierarchy[b].keys[0];f.pos=this.getNextKeyWith("pos",b,1);f.rot=this.getNextKeyWith("rot",b,1);f.scl=this.getNextKeyWith("scl",b,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
+THREE.Animation.prototype.play=function(a,c){if(!this.isPlaying){this.isPlaying=!0;this.loop=a!==void 0?a:!0;this.currentTime=c!==void 0?c:0;var b,d=this.hierarchy.length,g;for(b=0;b<d;b++){g=this.hierarchy[b];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)g.useQuaternion=!0;g.matrixAutoUpdate=!0;if(g.animationCache===void 0)g.animationCache={},g.animationCache.prevKey={pos:0,rot:0,scl:0},g.animationCache.nextKey={pos:0,rot:0,scl:0},g.animationCache.originalMatrix=g instanceof
+THREE.Bone?g.skinMatrix:g.matrix;var f=g.animationCache.prevKey;g=g.animationCache.nextKey;f.pos=this.data.hierarchy[b].keys[0];f.rot=this.data.hierarchy[b].keys[0];f.scl=this.data.hierarchy[b].keys[0];g.pos=this.getNextKeyWith("pos",b,1);g.rot=this.getNextKeyWith("rot",b,1);g.scl=this.getNextKeyWith("scl",b,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
 THREE.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
 THREE.Animation.prototype.stop=function(){this.isPaused=this.isPlaying=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.hierarchy.length;a++)if(this.hierarchy[a].animationCache!==void 0)this.hierarchy[a]instanceof THREE.Bone?this.hierarchy[a].skinMatrix=this.hierarchy[a].animationCache.originalMatrix:this.hierarchy[a].matrix=this.hierarchy[a].animationCache.originalMatrix,delete this.hierarchy[a].animationCache};
-THREE.Animation.prototype.update=function(a){if(this.isPlaying){var c=["pos","rot","scl"],b,d,f,g,e,h,i,j,k=this.data.JIT.hierarchy,m,o;this.currentTime+=a*this.timeScale;o=this.currentTime;m=this.currentTime%=this.data.length;j=parseInt(Math.min(m*this.data.fps,this.data.length*this.data.fps),10);for(var n=0,t=this.hierarchy.length;n<t;n++)if(a=this.hierarchy[n],i=a.animationCache,this.JITCompile&&k[n][j]!==void 0)a instanceof THREE.Bone?(a.skinMatrix=k[n][j],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=
-!1):(a.matrix=k[n][j],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=!0);else{if(this.JITCompile)a instanceof THREE.Bone?a.skinMatrix=a.animationCache.originalMatrix:a.matrix=a.animationCache.originalMatrix;for(var q=0;q<3;q++){b=c[q];e=i.prevKey[b];h=i.nextKey[b];if(h.time<=o){if(m<o)if(this.loop){e=this.data.hierarchy[n].keys[0];for(h=this.getNextKeyWith(b,n,1);h.time<m;)e=h,h=this.getNextKeyWith(b,n,h.index+1)}else{this.stop();return}else{do e=h,h=this.getNextKeyWith(b,n,h.index+1);while(h.time<
-m)}i.prevKey[b]=e;i.nextKey[b]=h}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;d=(m-e.time)/(h.time-e.time);f=e[b];g=h[b];if(d<0||d>1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+d+" on bone "+n),d=d<0?0:1;if(b==="pos")if(b=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)b.x=f[0]+(g[0]-f[0])*d,b.y=f[1]+(g[1]-f[1])*d,b.z=f[2]+(g[2]-f[2])*d;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
-this.getPrevKeyWith("pos",n,e.index-1).pos,this.points[1]=f,this.points[2]=g,this.points[3]=this.getNextKeyWith("pos",n,h.index+1).pos,d=d*0.33+0.33,f=this.interpolateCatmullRom(this.points,d),b.x=f[0],b.y=f[1],b.z=f[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)d=this.interpolateCatmullRom(this.points,d*1.01),this.target.set(d[0],d[1],d[2]),this.target.subSelf(b),this.target.y=0,this.target.normalize(),d=Math.atan2(this.target.x,this.target.z),a.rotation.set(0,d,0)}else if(b===
-"rot")THREE.Quaternion.slerp(f,g,a.quaternion,d);else if(b==="scl")b=a.scale,b.x=f[0]+(g[0]-f[0])*d,b.y=f[1]+(g[1]-f[1])*d,b.z=f[2]+(g[2]-f[2])*d}}if(this.JITCompile&&k[0][j]===void 0){this.hierarchy[0].update(null,!0);for(n=0;n<this.hierarchy.length;n++)k[n][j]=this.hierarchy[n]instanceof THREE.Bone?this.hierarchy[n].skinMatrix.clone():this.hierarchy[n].matrix.clone()}}};
-THREE.Animation.prototype.interpolateCatmullRom=function(a,c){var b=[],d=[],f,g,e,h,i,j;f=(a.length-1)*c;g=Math.floor(f);f-=g;b[0]=g===0?g:g-1;b[1]=g;b[2]=g>a.length-2?g:g+1;b[3]=g>a.length-3?g:g+2;g=a[b[0]];h=a[b[1]];i=a[b[2]];j=a[b[3]];b=f*f;e=f*b;d[0]=this.interpolate(g[0],h[0],i[0],j[0],f,b,e);d[1]=this.interpolate(g[1],h[1],i[1],j[1],f,b,e);d[2]=this.interpolate(g[2],h[2],i[2],j[2],f,b,e);return d};
-THREE.Animation.prototype.interpolate=function(a,c,b,d,f,g,e){a=(b-a)*0.5;d=(d-c)*0.5;return(2*(c-b)+a+d)*e+(-3*(c-b)-2*a-d)*g+a*f+c};THREE.Animation.prototype.getNextKeyWith=function(a,c,b){var d=this.data.hierarchy[c].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?b=b<d.length-1?b:d.length-1:b%=d.length;b<d.length;b++)if(d[b][a]!==void 0)return d[b];return this.data.hierarchy[c].keys[0]};
+THREE.Animation.prototype.update=function(a){if(this.isPlaying){var c=["pos","rot","scl"],b,d,g,f,e,h,i,j,k=this.data.JIT.hierarchy,l,o;this.currentTime+=a*this.timeScale;o=this.currentTime;l=this.currentTime%=this.data.length;j=parseInt(Math.min(l*this.data.fps,this.data.length*this.data.fps),10);for(var n=0,t=this.hierarchy.length;n<t;n++)if(a=this.hierarchy[n],i=a.animationCache,this.JITCompile&&k[n][j]!==void 0)a instanceof THREE.Bone?(a.skinMatrix=k[n][j],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=
+!1):(a.matrix=k[n][j],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=!0);else{if(this.JITCompile)a instanceof THREE.Bone?a.skinMatrix=a.animationCache.originalMatrix:a.matrix=a.animationCache.originalMatrix;for(var q=0;q<3;q++){b=c[q];e=i.prevKey[b];h=i.nextKey[b];if(h.time<=o){if(l<o)if(this.loop){e=this.data.hierarchy[n].keys[0];for(h=this.getNextKeyWith(b,n,1);h.time<l;)e=h,h=this.getNextKeyWith(b,n,h.index+1)}else{this.stop();return}else{do e=h,h=this.getNextKeyWith(b,n,h.index+1);while(h.time<
+l)}i.prevKey[b]=e;i.nextKey[b]=h}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;d=(l-e.time)/(h.time-e.time);g=e[b];f=h[b];if(d<0||d>1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+d+" on bone "+n),d=d<0?0:1;if(b==="pos")if(b=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)b.x=g[0]+(f[0]-g[0])*d,b.y=g[1]+(f[1]-g[1])*d,b.z=g[2]+(f[2]-g[2])*d;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
+this.getPrevKeyWith("pos",n,e.index-1).pos,this.points[1]=g,this.points[2]=f,this.points[3]=this.getNextKeyWith("pos",n,h.index+1).pos,d=d*0.33+0.33,g=this.interpolateCatmullRom(this.points,d),b.x=g[0],b.y=g[1],b.z=g[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)d=this.interpolateCatmullRom(this.points,d*1.01),this.target.set(d[0],d[1],d[2]),this.target.subSelf(b),this.target.y=0,this.target.normalize(),d=Math.atan2(this.target.x,this.target.z),a.rotation.set(0,d,0)}else if(b===
+"rot")THREE.Quaternion.slerp(g,f,a.quaternion,d);else if(b==="scl")b=a.scale,b.x=g[0]+(f[0]-g[0])*d,b.y=g[1]+(f[1]-g[1])*d,b.z=g[2]+(f[2]-g[2])*d}}if(this.JITCompile&&k[0][j]===void 0){this.hierarchy[0].update(null,!0);for(n=0;n<this.hierarchy.length;n++)k[n][j]=this.hierarchy[n]instanceof THREE.Bone?this.hierarchy[n].skinMatrix.clone():this.hierarchy[n].matrix.clone()}}};
+THREE.Animation.prototype.interpolateCatmullRom=function(a,c){var b=[],d=[],g,f,e,h,i,j;g=(a.length-1)*c;f=Math.floor(g);g-=f;b[0]=f===0?f:f-1;b[1]=f;b[2]=f>a.length-2?f:f+1;b[3]=f>a.length-3?f:f+2;f=a[b[0]];h=a[b[1]];i=a[b[2]];j=a[b[3]];b=g*g;e=g*b;d[0]=this.interpolate(f[0],h[0],i[0],j[0],g,b,e);d[1]=this.interpolate(f[1],h[1],i[1],j[1],g,b,e);d[2]=this.interpolate(f[2],h[2],i[2],j[2],g,b,e);return d};
+THREE.Animation.prototype.interpolate=function(a,c,b,d,g,f,e){a=(b-a)*0.5;d=(d-c)*0.5;return(2*(c-b)+a+d)*e+(-3*(c-b)-2*a-d)*f+a*g+c};THREE.Animation.prototype.getNextKeyWith=function(a,c,b){var d=this.data.hierarchy[c].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?b=b<d.length-1?b:d.length-1:b%=d.length;b<d.length;b++)if(d[b][a]!==void 0)return d[b];return this.data.hierarchy[c].keys[0]};
 THREE.Animation.prototype.getPrevKeyWith=function(a,c,b){for(var d=this.data.hierarchy[c].keys,b=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?b>0?b:0:b>=0?b:b+d.length;b>=0;b--)if(d[b][a]!==void 0)return d[b];return this.data.hierarchy[c].keys[d.length-1]};
 THREE.CubeCamera=function(a,c,b,d){this.heightOffset=b;this.position=new THREE.Vector3(0,b,0);this.cameraPX=new THREE.PerspectiveCamera(90,1,a,c);this.cameraNX=new THREE.PerspectiveCamera(90,1,a,c);this.cameraPY=new THREE.PerspectiveCamera(90,1,a,c);this.cameraNY=new THREE.PerspectiveCamera(90,1,a,c);this.cameraPZ=new THREE.PerspectiveCamera(90,1,a,c);this.cameraNZ=new THREE.PerspectiveCamera(90,1,a,c);this.cameraPX.position=this.position;this.cameraNX.position=this.position;this.cameraPY.position=
 this.position;this.cameraNY.position=this.position;this.cameraPZ.position=this.position;this.cameraNZ.position=this.position;this.cameraPX.up.set(0,-1,0);this.cameraNX.up.set(0,-1,0);this.cameraPY.up.set(0,0,1);this.cameraNY.up.set(0,0,-1);this.cameraPZ.up.set(0,-1,0);this.cameraNZ.up.set(0,-1,0);this.targetPX=new THREE.Vector3(0,0,0);this.targetNX=new THREE.Vector3(0,0,0);this.targetPY=new THREE.Vector3(0,0,0);this.targetNY=new THREE.Vector3(0,0,0);this.targetPZ=new THREE.Vector3(0,0,0);this.targetNZ=
 new THREE.Vector3(0,0,0);this.renderTarget=new THREE.WebGLRenderTargetCube(d,d,{format:THREE.RGBFormat,magFilter:THREE.LinearFilter,minFilter:THREE.LinearFilter});this.updatePosition=function(a){this.position.copy(a);this.position.y+=this.heightOffset;this.targetPX.copy(this.position);this.targetNX.copy(this.position);this.targetPY.copy(this.position);this.targetNY.copy(this.position);this.targetPZ.copy(this.position);this.targetNZ.copy(this.position);this.targetPX.x+=1;this.targetNX.x-=1;this.targetPY.y+=
 1;this.targetNY.y-=1;this.targetPZ.z+=1;this.targetNZ.z-=1;this.cameraPX.lookAt(this.targetPX);this.cameraNX.lookAt(this.targetNX);this.cameraPY.lookAt(this.targetPY);this.cameraNY.lookAt(this.targetNY);this.cameraPZ.lookAt(this.targetPZ);this.cameraNZ.lookAt(this.targetNZ)};this.updateCubeMap=function(a,b){var d=this.renderTarget;d.activeCubeFace=0;a.render(b,this.cameraPX,d);d.activeCubeFace=1;a.render(b,this.cameraNX,d);d.activeCubeFace=2;a.render(b,this.cameraPY,d);d.activeCubeFace=3;a.render(b,
 this.cameraNY,d);d.activeCubeFace=4;a.render(b,this.cameraPZ,d);d.activeCubeFace=5;a.render(b,this.cameraNZ,d)}};THREE.FirstPersonCamera=function(){console.warn("DEPRECATED: FirstPersonCamera() is FirstPersonControls().")};THREE.PathCamera=function(){console.warn("DEPRECATED: PathCamera() is PathControls().")};THREE.FlyCamera=function(){console.warn("DEPRECATED: FlyCamera() is FlyControls().")};THREE.RollCamera=function(){console.warn("DEPRECATED: RollCamera() is RollControls().")};
-THREE.TrackballCamera=function(){console.warn("DEPRECATED: TrackballCamera() is TrackballControls().")};THREE.CombinedCamera=function(a,c,b,d,f,g,e){THREE.Camera.call(this);this.fov=b;this.left=-a/2;this.right=a/2;this.top=c/2;this.bottom=-c/2;this.cameraO=new THREE.OrthographicCamera(a/-2,a/2,c/2,c/-2,g,e);this.cameraP=new THREE.PerspectiveCamera(b,a/c,d,f);this.zoom=1;this.toPerspective()};THREE.CombinedCamera.prototype=new THREE.Camera;THREE.CombinedCamera.prototype.constructor=THREE.CoolCamera;
+THREE.TrackballCamera=function(){console.warn("DEPRECATED: TrackballCamera() is TrackballControls().")};THREE.CombinedCamera=function(a,c,b,d,g,f,e){THREE.Camera.call(this);this.fov=b;this.left=-a/2;this.right=a/2;this.top=c/2;this.bottom=-c/2;this.cameraO=new THREE.OrthographicCamera(a/-2,a/2,c/2,c/-2,f,e);this.cameraP=new THREE.PerspectiveCamera(b,a/c,d,g);this.zoom=1;this.toPerspective()};THREE.CombinedCamera.prototype=new THREE.Camera;THREE.CombinedCamera.prototype.constructor=THREE.CoolCamera;
 THREE.CombinedCamera.prototype.toPerspective=function(){this.near=this.cameraP.near;this.far=this.cameraP.far;this.cameraP.fov=this.fov/this.zoom;this.cameraP.updateProjectionMatrix();this.projectionMatrix=this.cameraP.projectionMatrix;this.inPersepectiveMode=!0;this.inOrthographicMode=!1};
 THREE.CombinedCamera.prototype.toOrthographic=function(){var a=Math.tan(this.fov/2)*((this.cameraP.near+this.cameraP.far)/2),c=2*a*this.cameraP.aspect/2;a/=this.zoom;c/=this.zoom;this.cameraO.left=-c;this.cameraO.right=c;this.cameraO.top=a;this.cameraO.bottom=-a;this.cameraO.updateProjectionMatrix();this.near=this.cameraO.near;this.far=this.cameraO.far;this.projectionMatrix=this.cameraO.projectionMatrix;this.inPersepectiveMode=!1;this.inOrthographicMode=!0};
 THREE.CombinedCamera.prototype.setFov=function(a){this.fov=a;this.inPersepectiveMode?this.toPerspective():this.toOrthographic()};THREE.CombinedCamera.prototype.setLens=function(a,c){c||(c=43.25);var b=2*Math.atan(c/(a*2));b*=180/Math.PI;this.setFov(b);return b};THREE.CombinedCamera.prototype.setZoom=function(a){this.zoom=a;this.inPersepectiveMode?this.toPerspective():this.toOrthographic()};
@@ -104,14 +104,14 @@ function(a){switch(a.keyCode){case 38:case 87:this.moveForward=!0;break;case 37:
 this.moveUp&&this.object.translateY(b);this.moveDown&&this.object.translateY(-b);b=a*this.lookSpeed;this.activeLook||(b=0);this.lon+=this.mouseX*b;this.lookVertical&&(this.lat-=this.mouseY*b);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;var a=this.target,c=this.object.position;a.x=c.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=c.y+100*Math.cos(this.phi);a.z=c.z+100*Math.sin(this.phi)*Math.sin(this.theta)}a=1;this.constrainVertical&&
 (a=Math.PI/(this.verticalMax-this.verticalMin));this.lon+=this.mouseX*b;this.lookVertical&&(this.lat-=this.mouseY*b*a);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;if(this.constrainVertical)this.phi=THREE.Math.mapLinear(this.phi,0,Math.PI,this.verticalMin,this.verticalMax);a=this.target;c=this.object.position;a.x=c.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=c.y+100*Math.cos(this.phi);a.z=c.z+100*Math.sin(this.phi)*Math.sin(this.theta);
 this.object.lookAt(a)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",b(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",b(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",b(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",b(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",b(this,this.onKeyUp),!1)};
-THREE.PathControls=function(a,c){function b(a){if((a*=2)<1)return 0.5*a*a;return-0.5*(--a*(a-2)-1)}function d(a,b){return function(){b.apply(a,arguments)}}function f(a,b,d,c){var e={name:d,fps:0.6,length:c,hierarchy:[]},g,f=b.getControlPointsArray(),h=b.getLength(),r=f.length,p=0;g=r-1;b={parent:-1,keys:[]};b.keys[0]={time:0,pos:f[0],rot:[0,0,0,1],scl:[1,1,1]};b.keys[g]={time:c,pos:f[g],rot:[0,0,0,1],scl:[1,1,1]};for(g=1;g<r-1;g++)p=c*h.chunks[g]/h.total,b.keys[g]={time:p,pos:f[g]};e.hierarchy[0]=
-b;THREE.AnimationHandler.add(e);return new THREE.Animation(a,d,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function g(a,b){var d,c,e=new THREE.Geometry;for(d=0;d<a.points.length*b;d++)c=d/(a.points.length*b),c=a.getPoint(c),e.vertices[d]=new THREE.Vertex(new THREE.Vector3(c.x,c.y,c.z));return e}this.object=a;this.domElement=c!==void 0?c:document;this.id="PathControls"+THREE.PathControlsIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=
+THREE.PathControls=function(a,c){function b(a){if((a*=2)<1)return 0.5*a*a;return-0.5*(--a*(a-2)-1)}function d(a,b){return function(){b.apply(a,arguments)}}function g(a,b,d,c){var e={name:d,fps:0.6,length:c,hierarchy:[]},f,g=b.getControlPointsArray(),h=b.getLength(),r=g.length,p=0;f=r-1;b={parent:-1,keys:[]};b.keys[0]={time:0,pos:g[0],rot:[0,0,0,1],scl:[1,1,1]};b.keys[f]={time:c,pos:g[f],rot:[0,0,0,1],scl:[1,1,1]};for(f=1;f<r-1;f++)p=c*h.chunks[f]/h.total,b.keys[f]={time:p,pos:g[f]};e.hierarchy[0]=
+b;THREE.AnimationHandler.add(e);return new THREE.Animation(a,d,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function f(a,b){var d,c,e=new THREE.Geometry;for(d=0;d<a.points.length*b;d++)c=d/(a.points.length*b),c=a.getPoint(c),e.vertices[d]=new THREE.Vertex(new THREE.Vector3(c.x,c.y,c.z));return e}this.object=a;this.domElement=c!==void 0?c:document;this.id="PathControls"+THREE.PathControlsIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=
 new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.0050;this.lookHorizontal=this.lookVertical=!0;this.verticalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.horizontalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.target=new THREE.Object3D;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=
 this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));var e=Math.PI*2,h=Math.PI/180;this.update=function(a){var d;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed*a);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed*a);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*h;this.theta=this.lon*h;a=this.phi%e;this.phi=a>=0?a:a+e;d=this.verticalAngleMap.srcRange;
 a=this.verticalAngleMap.dstRange;d=THREE.Math.mapLinear(this.phi,d[0],d[1],a[0],a[1]);var c=a[1]-a[0];this.phi=b((d-a[0])/c)*c+a[0];d=this.horizontalAngleMap.srcRange;a=this.horizontalAngleMap.dstRange;d=THREE.Math.mapLinear(this.theta,d[0],d[1],a[0],a[1]);c=a[1]-a[0];this.theta=b((d-a[0])/c)*c+a[0];a=this.target.position;a.x=100*Math.sin(this.phi)*Math.cos(this.theta);a.y=100*Math.cos(this.phi);a.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.object.lookAt(this.target.position)};this.onMouseMove=
 function(a){this.domElement===document?(this.mouseX=a.pageX-this.viewHalfX,this.mouseY=a.pageY-this.viewHalfY):(this.mouseX=a.pageX-this.domElement.offsetLeft-this.viewHalfX,this.mouseY=a.pageY-this.domElement.offsetTop-this.viewHalfY)};this.init=function(){this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){var a=new THREE.MeshLambertMaterial({color:30719}),b=new THREE.MeshLambertMaterial({color:65280}),
-c=new THREE.CubeGeometry(10,10,20),e=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(c,a);a=new THREE.Mesh(e,b);a.position.set(0,10,0);this.animation=f(this.animationParent,this.spline,this.id,this.duration);this.animationParent.add(this.object);this.animationParent.add(this.target);this.animationParent.add(a)}else this.animation=f(this.animationParent,this.spline,this.id,this.duration),this.animationParent.add(this.target),this.animationParent.add(this.object);if(this.createDebugPath){var a=
-this.debugPath,b=this.spline,e=g(b,10),c=g(b,10),h=new THREE.LineBasicMaterial({color:16711680,linewidth:3}),e=new THREE.Line(e,h),c=new THREE.ParticleSystem(c,new THREE.ParticleBasicMaterial({color:16755200,size:3}));e.scale.set(1,1,1);a.add(e);c.scale.set(1,1,1);a.add(c);for(var e=new THREE.SphereGeometry(1,16,8),h=new THREE.MeshBasicMaterial({color:65280}),n=0;n<b.points.length;n++)c=new THREE.Mesh(e,h),c.position.copy(b.points[n]),a.add(c)}this.domElement.addEventListener("mousemove",d(this,this.onMouseMove),
+c=new THREE.CubeGeometry(10,10,20),e=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(c,a);a=new THREE.Mesh(e,b);a.position.set(0,10,0);this.animation=g(this.animationParent,this.spline,this.id,this.duration);this.animationParent.add(this.object);this.animationParent.add(this.target);this.animationParent.add(a)}else this.animation=g(this.animationParent,this.spline,this.id,this.duration),this.animationParent.add(this.target),this.animationParent.add(this.object);if(this.createDebugPath){var a=
+this.debugPath,b=this.spline,e=f(b,10),c=f(b,10),h=new THREE.LineBasicMaterial({color:16711680,linewidth:3}),e=new THREE.Line(e,h),c=new THREE.ParticleSystem(c,new THREE.ParticleBasicMaterial({color:16755200,size:3}));e.scale.set(1,1,1);a.add(e);c.scale.set(1,1,1);a.add(c);for(var e=new THREE.SphereGeometry(1,16,8),h=new THREE.MeshBasicMaterial({color:65280}),n=0;n<b.points.length;n++)c=new THREE.Mesh(e,h),c.position.copy(b.points[n]),a.add(c)}this.domElement.addEventListener("mousemove",d(this,this.onMouseMove),
 !1)}};THREE.PathControlsIdCounter=0;
 THREE.FlyControls=function(a,c){function b(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.domElement=c!==void 0?c:document;c&&this.domElement.setAttribute("tabindex",-1);this.movementSpeed=1;this.rollSpeed=0.0050;this.autoForward=this.dragToLook=!1;this.object.useQuaternion=!0;this.tmpQuaternion=new THREE.Quaternion;this.mouseStatus=0;this.moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0};this.moveVector=new THREE.Vector3(0,
 0,0);this.rotationVector=new THREE.Vector3(0,0,0);this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.keydown=function(a){if(!a.altKey){switch(a.keyCode){case 16:this.movementSpeedMultiplier=0.1;break;case 87:this.moveState.forward=1;break;case 83:this.moveState.back=1;break;case 65:this.moveState.left=1;break;case 68:this.moveState.right=1;break;case 82:this.moveState.up=1;break;case 70:this.moveState.down=1;break;case 38:this.moveState.pitchUp=1;break;case 40:this.moveState.pitchDown=
@@ -122,198 +122,200 @@ THREE.FlyControls=function(a,c){function b(a,b){return function(){b.apply(a,argu
 this.object.matrixWorldNeedsUpdate=!0};this.updateMovementVector=function(){var a=this.moveState.forward||this.autoForward&&!this.moveState.back?1:0;this.moveVector.x=-this.moveState.left+this.moveState.right;this.moveVector.y=-this.moveState.down+this.moveState.up;this.moveVector.z=-a+this.moveState.back};this.updateRotationVector=function(){this.rotationVector.x=-this.moveState.pitchDown+this.moveState.pitchUp;this.rotationVector.y=-this.moveState.yawRight+this.moveState.yawLeft;this.rotationVector.z=
 -this.moveState.rollRight+this.moveState.rollLeft};this.getContainerDimensions=function(){return this.domElement!=document?{size:[this.domElement.offsetWidth,this.domElement.offsetHeight],offset:[this.domElement.offsetLeft,this.domElement.offsetTop]}:{size:[window.innerWidth,window.innerHeight],offset:[0,0]}};this.domElement.addEventListener("mousemove",b(this,this.mousemove),!1);this.domElement.addEventListener("mousedown",b(this,this.mousedown),!1);this.domElement.addEventListener("mouseup",b(this,
 this.mouseup),!1);this.domElement.addEventListener("keydown",b(this,this.keydown),!1);this.domElement.addEventListener("keyup",b(this,this.keyup),!1);this.updateMovementVector();this.updateRotationVector()};
-THREE.RollControls=function(a,c){this.object=a;this.domElement=c!==void 0?c:document;this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.object.matrixAutoUpdate=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;var b=new THREE.Vector3,d=new THREE.Vector3,f=new THREE.Vector3,g=new THREE.Matrix4,e=!1,h=1,i=0,j=0,k=0,m=0,o=0,n=window.innerWidth/2,t=window.innerHeight/2;this.update=function(a){if(this.mouseLook){var c=a*this.lookSpeed;
-this.rotateHorizontally(c*m);this.rotateVertically(c*o)}c=a*this.movementSpeed;this.object.translateZ(-c*(i>0||this.autoForward&&!(i<0)?1:i));this.object.translateX(c*j);this.object.translateY(c*k);e&&(this.roll+=this.rollSpeed*a*h);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize();else if(this.forward.y<this.constrainVertical[0])this.forward.y=this.constrainVertical[0],this.forward.normalize();f.copy(this.forward);d.set(0,1,0);b.cross(d,
-f).normalize();d.cross(f,b).normalize();this.object.matrix.n11=b.x;this.object.matrix.n12=d.x;this.object.matrix.n13=f.x;this.object.matrix.n21=b.y;this.object.matrix.n22=d.y;this.object.matrix.n23=f.y;this.object.matrix.n31=b.z;this.object.matrix.n32=d.z;this.object.matrix.n33=f.z;g.identity();g.n11=Math.cos(this.roll);g.n12=-Math.sin(this.roll);g.n21=Math.sin(this.roll);g.n22=Math.cos(this.roll);this.object.matrix.multiplySelf(g);this.object.matrixWorldNeedsUpdate=!0;this.object.matrix.n14=this.object.position.x;
+THREE.RollControls=function(a,c){this.object=a;this.domElement=c!==void 0?c:document;this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.object.matrixAutoUpdate=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;var b=new THREE.Vector3,d=new THREE.Vector3,g=new THREE.Vector3,f=new THREE.Matrix4,e=!1,h=1,i=0,j=0,k=0,l=0,o=0,n=window.innerWidth/2,t=window.innerHeight/2;this.update=function(a){if(this.mouseLook){var c=a*this.lookSpeed;
+this.rotateHorizontally(c*l);this.rotateVertically(c*o)}c=a*this.movementSpeed;this.object.translateZ(-c*(i>0||this.autoForward&&!(i<0)?1:i));this.object.translateX(c*j);this.object.translateY(c*k);e&&(this.roll+=this.rollSpeed*a*h);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize();else if(this.forward.y<this.constrainVertical[0])this.forward.y=this.constrainVertical[0],this.forward.normalize();g.copy(this.forward);d.set(0,1,0);b.cross(d,
+g).normalize();d.cross(g,b).normalize();this.object.matrix.n11=b.x;this.object.matrix.n12=d.x;this.object.matrix.n13=g.x;this.object.matrix.n21=b.y;this.object.matrix.n22=d.y;this.object.matrix.n23=g.y;this.object.matrix.n31=b.z;this.object.matrix.n32=d.z;this.object.matrix.n33=g.z;f.identity();f.n11=Math.cos(this.roll);f.n12=-Math.sin(this.roll);f.n21=Math.sin(this.roll);f.n22=Math.cos(this.roll);this.object.matrix.multiplySelf(f);this.object.matrixWorldNeedsUpdate=!0;this.object.matrix.n14=this.object.position.x;
 this.object.matrix.n24=this.object.position.y;this.object.matrix.n34=this.object.position.z};this.translateX=function(a){this.object.position.x+=this.object.matrix.n11*a;this.object.position.y+=this.object.matrix.n21*a;this.object.position.z+=this.object.matrix.n31*a};this.translateY=function(a){this.object.position.x+=this.object.matrix.n12*a;this.object.position.y+=this.object.matrix.n22*a;this.object.position.z+=this.object.matrix.n32*a};this.translateZ=function(a){this.object.position.x-=this.object.matrix.n13*
 a;this.object.position.y-=this.object.matrix.n23*a;this.object.position.z-=this.object.matrix.n33*a};this.rotateHorizontally=function(a){b.set(this.object.matrix.n11,this.object.matrix.n21,this.object.matrix.n31);b.multiplyScalar(a);this.forward.subSelf(b);this.forward.normalize()};this.rotateVertically=function(a){d.set(this.object.matrix.n12,this.object.matrix.n22,this.object.matrix.n32);d.multiplyScalar(a);this.forward.addSelf(d);this.forward.normalize()};this.domElement.addEventListener("contextmenu",
-function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){m=(a.clientX-n)/window.innerWidth;o=(a.clientY-t)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:i=1;break;case 2:i=-1}},!1);this.domElement.addEventListener("mouseup",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:i=0;break;case 2:i=0}},!1);this.domElement.addEventListener("keydown",
+function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){l=(a.clientX-n)/window.innerWidth;o=(a.clientY-t)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:i=1;break;case 2:i=-1}},!1);this.domElement.addEventListener("mouseup",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:i=0;break;case 2:i=0}},!1);this.domElement.addEventListener("keydown",
 function(a){switch(a.keyCode){case 38:case 87:i=1;break;case 37:case 65:j=-1;break;case 40:case 83:i=-1;break;case 39:case 68:j=1;break;case 81:e=!0;h=1;break;case 69:e=!0;h=-1;break;case 82:k=1;break;case 70:k=-1}},!1);this.domElement.addEventListener("keyup",function(a){switch(a.keyCode){case 38:case 87:i=0;break;case 37:case 65:j=0;break;case 40:case 83:i=0;break;case 39:case 68:j=0;break;case 81:e=!1;break;case 69:e=!1;break;case 82:k=0;break;case 70:k=0}},!1)};
 THREE.TrackballControls=function(a,c){var b=this,d={NONE:-1,ROTATE:0,ZOOM:1,PAN:2};this.object=a;this.domElement=c!==void 0?c:document;this.enabled=!0;this.screen={width:window.innerWidth,height:window.innerHeight,offsetLeft:0,offsetTop:0};this.radius=(this.screen.width+this.screen.height)/4;this.rotateSpeed=1;this.zoomSpeed=1.2;this.panSpeed=0.3;this.staticMoving=this.noPan=this.noZoom=!1;this.dynamicDampingFactor=0.2;this.minDistance=0;this.maxDistance=Infinity;this.keys=[65,83,68];this.target=
-new THREE.Vector3(0,0,0);var f=!1,g=d.NONE,e=new THREE.Vector3,h=new THREE.Vector3,i=new THREE.Vector3,j=new THREE.Vector2,k=new THREE.Vector2,m=new THREE.Vector2,o=new THREE.Vector2;this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.getMouseOnScreen=function(a,c){return new THREE.Vector2((a-b.screen.offsetLeft)/b.radius*0.5,(c-b.screen.offsetTop)/b.radius*0.5)};this.getMouseProjectionOnBall=function(a,c){var d=new THREE.Vector3((a-b.screen.width*0.5-b.screen.offsetLeft)/
-b.radius,(b.screen.height*0.5+b.screen.offsetTop-c)/b.radius,0),g=d.length();g>1?d.normalize():d.z=Math.sqrt(1-g*g);e.copy(b.object.position).subSelf(b.target);g=b.object.up.clone().setLength(d.y);g.addSelf(b.object.up.clone().crossSelf(e).setLength(d.x));g.addSelf(e.setLength(d.z));return g};this.rotateCamera=function(){var a=Math.acos(h.dot(i)/h.length()/i.length());if(a){var c=(new THREE.Vector3).cross(h,i).normalize(),d=new THREE.Quaternion;a*=b.rotateSpeed;d.setFromAxisAngle(c,-a);d.multiplyVector3(e);
-d.multiplyVector3(b.object.up);d.multiplyVector3(i);b.staticMoving?h=i:(d.setFromAxisAngle(c,a*(b.dynamicDampingFactor-1)),d.multiplyVector3(h))}};this.zoomCamera=function(){var a=1+(k.y-j.y)*b.zoomSpeed;a!==1&&a>0&&(e.multiplyScalar(a),b.staticMoving?j=k:j.y+=(k.y-j.y)*this.dynamicDampingFactor)};this.panCamera=function(){var a=o.clone().subSelf(m);if(a.lengthSq()){a.multiplyScalar(e.length()*b.panSpeed);var c=e.clone().crossSelf(b.object.up).setLength(a.x);c.addSelf(b.object.up.clone().setLength(a.y));
-b.object.position.addSelf(c);b.target.addSelf(c);b.staticMoving?m=o:m.addSelf(a.sub(o,m).multiplyScalar(b.dynamicDampingFactor))}};this.checkDistances=function(){if(!b.noZoom||!b.noPan)b.object.position.lengthSq()>b.maxDistance*b.maxDistance&&b.object.position.setLength(b.maxDistance),e.lengthSq()<b.minDistance*b.minDistance&&b.object.position.add(b.target,e.setLength(b.minDistance))};this.update=function(){e.copy(b.object.position).subSelf(this.target);b.rotateCamera();b.noZoom||b.zoomCamera();b.noPan||
-b.panCamera();b.object.position.add(b.target,e);b.checkDistances();b.object.lookAt(b.target)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){b.enabled&&(f&&(h=i=b.getMouseProjectionOnBall(a.clientX,a.clientY),j=k=b.getMouseOnScreen(a.clientX,a.clientY),m=o=b.getMouseOnScreen(a.clientX,a.clientY),f=!1),g!==d.NONE&&(g===d.ROTATE?i=b.getMouseProjectionOnBall(a.clientX,a.clientY):g===d.ZOOM&&!b.noZoom?k=b.getMouseOnScreen(a.clientX,
-a.clientY):g===d.PAN&&!b.noPan&&(o=b.getMouseOnScreen(a.clientX,a.clientY))))},!1);this.domElement.addEventListener("mousedown",function(a){if(b.enabled&&(a.preventDefault(),a.stopPropagation(),g===d.NONE))g=a.button,g===d.ROTATE?h=i=b.getMouseProjectionOnBall(a.clientX,a.clientY):g===d.ZOOM&&!b.noZoom?j=k=b.getMouseOnScreen(a.clientX,a.clientY):this.noPan||(m=o=b.getMouseOnScreen(a.clientX,a.clientY))},!1);this.domElement.addEventListener("mouseup",function(a){if(b.enabled)a.preventDefault(),a.stopPropagation(),
-g=d.NONE},!1);window.addEventListener("keydown",function(a){if(b.enabled&&g===d.NONE){if(a.keyCode===b.keys[d.ROTATE])g=d.ROTATE;else if(a.keyCode===b.keys[d.ZOOM]&&!b.noZoom)g=d.ZOOM;else if(a.keyCode===b.keys[d.PAN]&&!b.noPan)g=d.PAN;g!==d.NONE&&(f=!0)}},!1);window.addEventListener("keyup",function(){if(b.enabled&&g!==d.NONE)g=d.NONE},!1)};
-THREE.CubeGeometry=function(a,c,b,d,f,g,e,h){function i(a,b,c,e,h,i,k,n){var m,o,l=d||1,p=f||1,r=h/2,q=i/2,t=j.vertices.length;if(a==="x"&&b==="y"||a==="y"&&b==="x")m="z";else if(a==="x"&&b==="z"||a==="z"&&b==="x")m="y",p=g||1;else if(a==="z"&&b==="y"||a==="y"&&b==="z")m="x",l=g||1;var s=l+1,O=p+1;h/=l;var z=i/p;for(o=0;o<O;o++)for(i=0;i<s;i++){var K=new THREE.Vector3;K[a]=(i*h-r)*c;K[b]=(o*z-q)*e;K[m]=k;j.vertices.push(new THREE.Vertex(K))}for(o=0;o<p;o++)for(i=0;i<l;i++)j.faces.push(new THREE.Face4(i+
-s*o+t,i+s*(o+1)+t,i+1+s*(o+1)+t,i+1+s*o+t,null,null,n)),j.faceVertexUvs[0].push([new THREE.UV(i/l,o/p),new THREE.UV(i/l,(o+1)/p),new THREE.UV((i+1)/l,(o+1)/p),new THREE.UV((i+1)/l,o/p)])}THREE.Geometry.call(this);var j=this,k=a/2,m=c/2,o=b/2,n,t,q,r,p,s;if(e!==void 0){if(e instanceof Array)this.materials=e;else{this.materials=[];for(n=0;n<6;n++)this.materials.push(e)}n=0;r=1;t=2;p=3;q=4;s=5}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(h!=void 0)for(var l in h)this.sides[l]!=
-void 0&&(this.sides[l]=h[l]);this.sides.px&&i("z","y",-1,-1,b,c,k,n);this.sides.nx&&i("z","y",1,-1,b,c,-k,r);this.sides.py&&i("x","z",1,1,a,b,m,t);this.sides.ny&&i("x","z",1,-1,a,b,-m,p);this.sides.pz&&i("x","y",1,-1,a,c,o,q);this.sides.nz&&i("x","y",-1,-1,a,c,-o,s);this.mergeVertices();this.computeCentroids();this.computeFaceNormals()};THREE.CubeGeometry.prototype=new THREE.Geometry;THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
-THREE.CylinderGeometry=function(a,c,b,d,f,g){THREE.Geometry.call(this);var a=a!=null?a:20,c=c!=null?c:20,b=b||100,e=b/2,d=d||8,f=f||1,h,i,j=[],k=[];for(i=0;i<=f;i++){var m=[],o=[],n=i/f,t=n*(c-a)+a;for(h=0;h<=d;h++){var q=h/d;this.vertices.push(new THREE.Vertex(new THREE.Vector3(t*Math.sin(q*Math.PI*2),-n*b+e,t*Math.cos(q*Math.PI*2))));m.push(this.vertices.length-1);o.push(new THREE.UV(q,n))}j.push(m);k.push(o)}for(i=0;i<f;i++)for(h=0;h<d;h++){var b=j[i][h],m=j[i+1][h],o=j[i+1][h+1],n=j[i][h+1],t=
-this.vertices[b].position.clone().setY(0).normalize(),q=this.vertices[m].position.clone().setY(0).normalize(),r=this.vertices[o].position.clone().setY(0).normalize(),p=this.vertices[n].position.clone().setY(0).normalize(),s=k[i][h].clone(),l=k[i+1][h].clone(),v=k[i+1][h+1].clone(),w=k[i][h+1].clone();this.faces.push(new THREE.Face4(b,m,o,n,[t,q,r,p]));this.faceVertexUvs[0].push([s,l,v,w])}if(!g&&a>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,e,0)));for(h=0;h<d;h++)b=j[0][h],m=j[0][h+
-1],o=this.vertices.length-1,t=new THREE.Vector3(0,1,0),q=new THREE.Vector3(0,1,0),r=new THREE.Vector3(0,1,0),s=k[0][h].clone(),l=k[0][h+1].clone(),v=new THREE.UV(l.u,0),this.faces.push(new THREE.Face3(b,m,o,[t,q,r])),this.faceVertexUvs[0].push([s,l,v])}if(!g&&c>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-e,0)));for(h=0;h<d;h++)b=j[i][h+1],m=j[i][h],o=this.vertices.length-1,t=new THREE.Vector3(0,-1,0),q=new THREE.Vector3(0,-1,0),r=new THREE.Vector3(0,-1,0),s=k[i][h+1].clone(),l=k[i][h].clone(),
-v=new THREE.UV(l.u,1),this.faces.push(new THREE.Face3(b,m,o,[t,q,r])),this.faceVertexUvs[0].push([s,l,v])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
-THREE.ExtrudeGeometry=function(a,c){if(typeof a!=="undefined"){THREE.Geometry.call(this);var a=a instanceof Array?a:[a],b,d=a.length,f;this.shapebb=a[d-1].getBoundingBox();for(b=0;b<d;b++)f=a[b],this.addShape(f,c);this.computeCentroids();this.computeFaceNormals()}};THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;
-THREE.ExtrudeGeometry.prototype.addShape=function(a,c){function b(a,b,c){b||console.log("die");return b.clone().multiplyScalar(c).addSelf(a)}function d(a,b,c){var d=THREE.ExtrudeGeometry.__v1,e=THREE.ExtrudeGeometry.__v2,g=THREE.ExtrudeGeometry.__v3,f=THREE.ExtrudeGeometry.__v4,h=THREE.ExtrudeGeometry.__v5,i=THREE.ExtrudeGeometry.__v6;d.set(a.x-b.x,a.y-b.y);e.set(a.x-c.x,a.y-c.y);d=d.normalize();e=e.normalize();g.set(-d.y,d.x);f.set(e.y,-e.x);h.copy(a).addSelf(g);i.copy(a).addSelf(f);if(h.equals(i))return f.clone();
-h.copy(b).addSelf(g);i.copy(c).addSelf(f);g=d.dot(f);f=i.subSelf(h).dot(f);g===0&&(console.log("Either infinite or no solutions!"),f===0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));f/=g;if(f<0)return b=Math.atan2(b.y-a.y,b.x-a.x),a=Math.atan2(c.y-a.y,c.x-a.x),b>a&&(a+=Math.PI*2),a=(b+a)/2,new THREE.Vector2(-Math.cos(a),-Math.sin(a));return d.multiplyScalar(f).addSelf(h).subSelf(a).clone()}function f(a){for(u=a.length;--u>=0;){I=u;L=u-1;L<0&&(L=a.length-1);for(var b=
-0,c=n+k*2,b=0;b<c;b++){var d=J*b,e=J*(b+1),g=R+I+d,f=R+I+e,j=g,d=R+L+d,e=R+L+e,m=f;j+=E;d+=E;e+=E;m+=E;A.faces.push(new THREE.Face4(j,d,e,m,null,null,v));v&&(j=b/c,d=(b+1)/c,e=h+i*2,g=(A.vertices[g].position.z+i)/e,f=(A.vertices[f].position.z+i)/e,A.faceVertexUvs[0].push([new THREE.UV(g,j),new THREE.UV(f,j),new THREE.UV(f,d),new THREE.UV(g,d)]))}}}function g(a,b,c){A.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function e(a,b,c){a+=E;b+=E;c+=E;A.faces.push(new THREE.Face3(a,b,c,null,
-null,l));if(l){var d=w.maxY,e=w.maxX,g=A.vertices[b].position.x,b=A.vertices[b].position.y,f=A.vertices[c].position.x,c=A.vertices[c].position.y;A.faceVertexUvs[0].push([new THREE.UV(A.vertices[a].position.x/e,A.vertices[a].position.y/d),new THREE.UV(g/e,b/d),new THREE.UV(f/e,c/d)])}}var h=c.amount!==void 0?c.amount:100,i=c.bevelThickness!==void 0?c.bevelThickness:6,j=c.bevelSize!==void 0?c.bevelSize:i-2,k=c.bevelSegments!==void 0?c.bevelSegments:3,m=c.bevelEnabled!==void 0?c.bevelEnabled:!0,o=c.curveSegments!==
-void 0?c.curveSegments:12,n=c.steps!==void 0?c.steps:1,t=c.bendPath,q=c.extrudePath,r,p=!1,s=c.useSpacedPoints!==void 0?c.useSpacedPoints:!1,l=c.material,v=c.extrudeMaterial,w=this.shapebb;if(q)r=q.getPoints(o),n=r.length,p=!0,m=!1;m||(j=i=k=0);var x,y,C,A=this,E=this.vertices.length;t&&a.addWrapPath(t);o=s?a.extractAllSpacedPoints(o):a.extractAllPoints(o);t=o.shape;o=o.holes;if(q=!THREE.Shape.Utils.isClockWise(t)){t=t.reverse();y=0;for(C=o.length;y<C;y++)x=o[y],THREE.Shape.Utils.isClockWise(x)&&
+new THREE.Vector3(0,0,0);var g=!1,f=d.NONE,e=new THREE.Vector3,h=new THREE.Vector3,i=new THREE.Vector3,j=new THREE.Vector2,k=new THREE.Vector2,l=new THREE.Vector2,o=new THREE.Vector2;this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.getMouseOnScreen=function(a,c){return new THREE.Vector2((a-b.screen.offsetLeft)/b.radius*0.5,(c-b.screen.offsetTop)/b.radius*0.5)};this.getMouseProjectionOnBall=function(a,c){var d=new THREE.Vector3((a-b.screen.width*0.5-b.screen.offsetLeft)/
+b.radius,(b.screen.height*0.5+b.screen.offsetTop-c)/b.radius,0),f=d.length();f>1?d.normalize():d.z=Math.sqrt(1-f*f);e.copy(b.object.position).subSelf(b.target);f=b.object.up.clone().setLength(d.y);f.addSelf(b.object.up.clone().crossSelf(e).setLength(d.x));f.addSelf(e.setLength(d.z));return f};this.rotateCamera=function(){var a=Math.acos(h.dot(i)/h.length()/i.length());if(a){var c=(new THREE.Vector3).cross(h,i).normalize(),d=new THREE.Quaternion;a*=b.rotateSpeed;d.setFromAxisAngle(c,-a);d.multiplyVector3(e);
+d.multiplyVector3(b.object.up);d.multiplyVector3(i);b.staticMoving?h=i:(d.setFromAxisAngle(c,a*(b.dynamicDampingFactor-1)),d.multiplyVector3(h))}};this.zoomCamera=function(){var a=1+(k.y-j.y)*b.zoomSpeed;a!==1&&a>0&&(e.multiplyScalar(a),b.staticMoving?j=k:j.y+=(k.y-j.y)*this.dynamicDampingFactor)};this.panCamera=function(){var a=o.clone().subSelf(l);if(a.lengthSq()){a.multiplyScalar(e.length()*b.panSpeed);var c=e.clone().crossSelf(b.object.up).setLength(a.x);c.addSelf(b.object.up.clone().setLength(a.y));
+b.object.position.addSelf(c);b.target.addSelf(c);b.staticMoving?l=o:l.addSelf(a.sub(o,l).multiplyScalar(b.dynamicDampingFactor))}};this.checkDistances=function(){if(!b.noZoom||!b.noPan)b.object.position.lengthSq()>b.maxDistance*b.maxDistance&&b.object.position.setLength(b.maxDistance),e.lengthSq()<b.minDistance*b.minDistance&&b.object.position.add(b.target,e.setLength(b.minDistance))};this.update=function(){e.copy(b.object.position).subSelf(this.target);b.rotateCamera();b.noZoom||b.zoomCamera();b.noPan||
+b.panCamera();b.object.position.add(b.target,e);b.checkDistances();b.object.lookAt(b.target)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){b.enabled&&(g&&(h=i=b.getMouseProjectionOnBall(a.clientX,a.clientY),j=k=b.getMouseOnScreen(a.clientX,a.clientY),l=o=b.getMouseOnScreen(a.clientX,a.clientY),g=!1),f!==d.NONE&&(f===d.ROTATE?i=b.getMouseProjectionOnBall(a.clientX,a.clientY):f===d.ZOOM&&!b.noZoom?k=b.getMouseOnScreen(a.clientX,
+a.clientY):f===d.PAN&&!b.noPan&&(o=b.getMouseOnScreen(a.clientX,a.clientY))))},!1);this.domElement.addEventListener("mousedown",function(a){if(b.enabled&&(a.preventDefault(),a.stopPropagation(),f===d.NONE))f=a.button,f===d.ROTATE?h=i=b.getMouseProjectionOnBall(a.clientX,a.clientY):f===d.ZOOM&&!b.noZoom?j=k=b.getMouseOnScreen(a.clientX,a.clientY):this.noPan||(l=o=b.getMouseOnScreen(a.clientX,a.clientY))},!1);this.domElement.addEventListener("mouseup",function(a){if(b.enabled)a.preventDefault(),a.stopPropagation(),
+f=d.NONE},!1);window.addEventListener("keydown",function(a){if(b.enabled&&f===d.NONE){if(a.keyCode===b.keys[d.ROTATE])f=d.ROTATE;else if(a.keyCode===b.keys[d.ZOOM]&&!b.noZoom)f=d.ZOOM;else if(a.keyCode===b.keys[d.PAN]&&!b.noPan)f=d.PAN;f!==d.NONE&&(g=!0)}},!1);window.addEventListener("keyup",function(){if(b.enabled&&f!==d.NONE)f=d.NONE},!1)};
+THREE.CubeGeometry=function(a,c,b,d,g,f,e,h){function i(a,b,c,e,h,i,k,n){var l,o,m=d||1,p=g||1,r=h/2,q=i/2,t=j.vertices.length;if(a==="x"&&b==="y"||a==="y"&&b==="x")l="z";else if(a==="x"&&b==="z"||a==="z"&&b==="x")l="y",p=f||1;else if(a==="z"&&b==="y"||a==="y"&&b==="z")l="x",m=f||1;var s=m+1,O=p+1;h/=m;var z=i/p;for(o=0;o<O;o++)for(i=0;i<s;i++){var K=new THREE.Vector3;K[a]=(i*h-r)*c;K[b]=(o*z-q)*e;K[l]=k;j.vertices.push(new THREE.Vertex(K))}for(o=0;o<p;o++)for(i=0;i<m;i++)j.faces.push(new THREE.Face4(i+
+s*o+t,i+s*(o+1)+t,i+1+s*(o+1)+t,i+1+s*o+t,null,null,n)),j.faceVertexUvs[0].push([new THREE.UV(i/m,o/p),new THREE.UV(i/m,(o+1)/p),new THREE.UV((i+1)/m,(o+1)/p),new THREE.UV((i+1)/m,o/p)])}THREE.Geometry.call(this);var j=this,k=a/2,l=c/2,o=b/2,n,t,q,r,p,s;if(e!==void 0){if(e instanceof Array)this.materials=e;else{this.materials=[];for(n=0;n<6;n++)this.materials.push(e)}n=0;r=1;t=2;p=3;q=4;s=5}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(h!=void 0)for(var m in h)this.sides[m]!=
+void 0&&(this.sides[m]=h[m]);this.sides.px&&i("z","y",-1,-1,b,c,k,n);this.sides.nx&&i("z","y",1,-1,b,c,-k,r);this.sides.py&&i("x","z",1,1,a,b,l,t);this.sides.ny&&i("x","z",1,-1,a,b,-l,p);this.sides.pz&&i("x","y",1,-1,a,c,o,q);this.sides.nz&&i("x","y",-1,-1,a,c,-o,s);this.mergeVertices();this.computeCentroids();this.computeFaceNormals()};THREE.CubeGeometry.prototype=new THREE.Geometry;THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
+THREE.CylinderGeometry=function(a,c,b,d,g,f){THREE.Geometry.call(this);var a=a!=null?a:20,c=c!=null?c:20,b=b||100,e=b/2,d=d||8,g=g||1,h,i,j=[],k=[];for(i=0;i<=g;i++){var l=[],o=[],n=i/g,t=n*(c-a)+a;for(h=0;h<=d;h++){var q=h/d;this.vertices.push(new THREE.Vertex(new THREE.Vector3(t*Math.sin(q*Math.PI*2),-n*b+e,t*Math.cos(q*Math.PI*2))));l.push(this.vertices.length-1);o.push(new THREE.UV(q,n))}j.push(l);k.push(o)}for(i=0;i<g;i++)for(h=0;h<d;h++){var b=j[i][h],l=j[i+1][h],o=j[i+1][h+1],n=j[i][h+1],t=
+this.vertices[b].position.clone().setY(0).normalize(),q=this.vertices[l].position.clone().setY(0).normalize(),r=this.vertices[o].position.clone().setY(0).normalize(),p=this.vertices[n].position.clone().setY(0).normalize(),s=k[i][h].clone(),m=k[i+1][h].clone(),v=k[i+1][h+1].clone(),w=k[i][h+1].clone();this.faces.push(new THREE.Face4(b,l,o,n,[t,q,r,p]));this.faceVertexUvs[0].push([s,m,v,w])}if(!f&&a>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,e,0)));for(h=0;h<d;h++)b=j[0][h],l=j[0][h+
+1],o=this.vertices.length-1,t=new THREE.Vector3(0,1,0),q=new THREE.Vector3(0,1,0),r=new THREE.Vector3(0,1,0),s=k[0][h].clone(),m=k[0][h+1].clone(),v=new THREE.UV(m.u,0),this.faces.push(new THREE.Face3(b,l,o,[t,q,r])),this.faceVertexUvs[0].push([s,m,v])}if(!f&&c>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-e,0)));for(h=0;h<d;h++)b=j[i][h+1],l=j[i][h],o=this.vertices.length-1,t=new THREE.Vector3(0,-1,0),q=new THREE.Vector3(0,-1,0),r=new THREE.Vector3(0,-1,0),s=k[i][h+1].clone(),m=k[i][h].clone(),
+v=new THREE.UV(m.u,1),this.faces.push(new THREE.Face3(b,l,o,[t,q,r])),this.faceVertexUvs[0].push([s,m,v])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
+THREE.ExtrudeGeometry=function(a,c){if(typeof a!=="undefined"){THREE.Geometry.call(this);var a=a instanceof Array?a:[a],b,d=a.length,g;this.shapebb=a[d-1].getBoundingBox();for(b=0;b<d;b++)g=a[b],this.addShape(g,c);this.computeCentroids();this.computeFaceNormals()}};THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;
+THREE.ExtrudeGeometry.prototype.addShape=function(a,c){function b(a,b,c){b||console.log("die");return b.clone().multiplyScalar(c).addSelf(a)}function d(a,b,c){var d=THREE.ExtrudeGeometry.__v1,e=THREE.ExtrudeGeometry.__v2,f=THREE.ExtrudeGeometry.__v3,g=THREE.ExtrudeGeometry.__v4,h=THREE.ExtrudeGeometry.__v5,i=THREE.ExtrudeGeometry.__v6;d.set(a.x-b.x,a.y-b.y);e.set(a.x-c.x,a.y-c.y);d=d.normalize();e=e.normalize();f.set(-d.y,d.x);g.set(e.y,-e.x);h.copy(a).addSelf(f);i.copy(a).addSelf(g);if(h.equals(i))return g.clone();
+h.copy(b).addSelf(f);i.copy(c).addSelf(g);f=d.dot(g);g=i.subSelf(h).dot(g);f===0&&(console.log("Either infinite or no solutions!"),g===0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));g/=f;if(g<0)return b=Math.atan2(b.y-a.y,b.x-a.x),a=Math.atan2(c.y-a.y,c.x-a.x),b>a&&(a+=Math.PI*2),a=(b+a)/2,new THREE.Vector2(-Math.cos(a),-Math.sin(a));return d.multiplyScalar(g).addSelf(h).subSelf(a).clone()}function g(a){for(u=a.length;--u>=0;){I=u;L=u-1;L<0&&(L=a.length-1);for(var b=
+0,c=n+k*2,b=0;b<c;b++){var d=J*b,e=J*(b+1),f=R+I+d,g=R+I+e,j=f,d=R+L+d,e=R+L+e,l=g;j+=E;d+=E;e+=E;l+=E;A.faces.push(new THREE.Face4(j,d,e,l,null,null,v));v&&(j=b/c,d=(b+1)/c,e=h+i*2,f=(A.vertices[f].position.z+i)/e,g=(A.vertices[g].position.z+i)/e,A.faceVertexUvs[0].push([new THREE.UV(f,j),new THREE.UV(g,j),new THREE.UV(g,d),new THREE.UV(f,d)]))}}}function f(a,b,c){A.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function e(a,b,c){a+=E;b+=E;c+=E;A.faces.push(new THREE.Face3(a,b,c,null,
+null,m));if(m){var d=w.maxY,e=w.maxX,f=A.vertices[b].position.x,b=A.vertices[b].position.y,g=A.vertices[c].position.x,c=A.vertices[c].position.y;A.faceVertexUvs[0].push([new THREE.UV(A.vertices[a].position.x/e,A.vertices[a].position.y/d),new THREE.UV(f/e,b/d),new THREE.UV(g/e,c/d)])}}var h=c.amount!==void 0?c.amount:100,i=c.bevelThickness!==void 0?c.bevelThickness:6,j=c.bevelSize!==void 0?c.bevelSize:i-2,k=c.bevelSegments!==void 0?c.bevelSegments:3,l=c.bevelEnabled!==void 0?c.bevelEnabled:!0,o=c.curveSegments!==
+void 0?c.curveSegments:12,n=c.steps!==void 0?c.steps:1,t=c.bendPath,q=c.extrudePath,r,p=!1,s=c.useSpacedPoints!==void 0?c.useSpacedPoints:!1,m=c.material,v=c.extrudeMaterial,w=this.shapebb;if(q)r=q.getPoints(o),n=r.length,p=!0,l=!1;l||(j=i=k=0);var x,y,C,A=this,E=this.vertices.length;t&&a.addWrapPath(t);o=s?a.extractAllSpacedPoints(o):a.extractAllPoints(o);t=o.shape;o=o.holes;if(q=!THREE.Shape.Utils.isClockWise(t)){t=t.reverse();y=0;for(C=o.length;y<C;y++)x=o[y],THREE.Shape.Utils.isClockWise(x)&&
 (o[y]=x.reverse());q=!1}q=THREE.Shape.Utils.triangulateShape(t,o);s=t;y=0;for(C=o.length;y<C;y++)x=o[y],t=t.concat(x);var u,G,D,H,B,F,J=t.length,N=q.length,M=[];u=0;G=s.length;I=G-1;for(L=u+1;u<G;u++,I++,L++)I===G&&(I=0),L===G&&(L=0),M[u]=d(s[u],s[I],s[L]);var O=[],z,K=M.concat();y=0;for(C=o.length;y<C;y++){x=o[y];z=[];u=0;G=x.length;I=G-1;for(L=u+1;u<G;u++,I++,L++)I===G&&(I=0),L===G&&(L=0),z[u]=d(x[u],x[I],x[L]);O.push(z);K=K.concat(z)}for(D=0;D<k;D++){H=D/k;B=i*(1-H);H=j*Math.sin(H*Math.PI/2);u=
-0;for(G=s.length;u<G;u++)F=b(s[u],M[u],H),g(F.x,F.y,-B);y=0;for(C=o.length;y<C;y++){x=o[y];z=O[y];u=0;for(G=x.length;u<G;u++)F=b(x[u],z[u],H),g(F.x,F.y,-B)}}H=j;for(u=0;u<J;u++)F=m?b(t[u],K[u],H):t[u],p?g(F.x,F.y+r[0].y,r[0].x):g(F.x,F.y,0);for(D=1;D<=n;D++)for(u=0;u<J;u++)F=m?b(t[u],K[u],H):t[u],p?g(F.x,F.y+r[D-1].y,r[D-1].x):g(F.x,F.y,h/n*D);for(D=k-1;D>=0;D--){H=D/k;B=i*(1-H);H=j*Math.sin(H*Math.PI/2);u=0;for(G=s.length;u<G;u++)F=b(s[u],M[u],H),g(F.x,F.y,h+B);y=0;for(C=o.length;y<C;y++){x=o[y];
-z=O[y];u=0;for(G=x.length;u<G;u++)F=b(x[u],z[u],H),p?g(F.x,F.y+r[n-1].y,r[n-1].x+B):g(F.x,F.y,h+B)}}if(m){m=J*0;for(u=0;u<N;u++)j=q[u],e(j[2]+m,j[1]+m,j[0]+m);m=J*(n+k*2);for(u=0;u<N;u++)j=q[u],e(j[0]+m,j[1]+m,j[2]+m)}else{for(u=0;u<N;u++)j=q[u],e(j[2],j[1],j[0]);for(u=0;u<N;u++)j=q[u],e(j[0]+J*n,j[1]+J*n,j[2]+J*n)}var I,L,R=0;f(s);R+=s.length;y=0;for(C=o.length;y<C;y++)x=o[y],f(x),R+=x.length};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;THREE.ExtrudeGeometry.__v2=new THREE.Vector2;
+0;for(G=s.length;u<G;u++)F=b(s[u],M[u],H),f(F.x,F.y,-B);y=0;for(C=o.length;y<C;y++){x=o[y];z=O[y];u=0;for(G=x.length;u<G;u++)F=b(x[u],z[u],H),f(F.x,F.y,-B)}}H=j;for(u=0;u<J;u++)F=l?b(t[u],K[u],H):t[u],p?f(F.x,F.y+r[0].y,r[0].x):f(F.x,F.y,0);for(D=1;D<=n;D++)for(u=0;u<J;u++)F=l?b(t[u],K[u],H):t[u],p?f(F.x,F.y+r[D-1].y,r[D-1].x):f(F.x,F.y,h/n*D);for(D=k-1;D>=0;D--){H=D/k;B=i*(1-H);H=j*Math.sin(H*Math.PI/2);u=0;for(G=s.length;u<G;u++)F=b(s[u],M[u],H),f(F.x,F.y,h+B);y=0;for(C=o.length;y<C;y++){x=o[y];
+z=O[y];u=0;for(G=x.length;u<G;u++)F=b(x[u],z[u],H),p?f(F.x,F.y+r[n-1].y,r[n-1].x+B):f(F.x,F.y,h+B)}}if(l){l=J*0;for(u=0;u<N;u++)j=q[u],e(j[2]+l,j[1]+l,j[0]+l);l=J*(n+k*2);for(u=0;u<N;u++)j=q[u],e(j[0]+l,j[1]+l,j[2]+l)}else{for(u=0;u<N;u++)j=q[u],e(j[2],j[1],j[0]);for(u=0;u<N;u++)j=q[u],e(j[0]+J*n,j[1]+J*n,j[2]+J*n)}var I,L,R=0;g(s);R+=s.length;y=0;for(C=o.length;y<C;y++)x=o[y],g(x),R+=x.length};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;THREE.ExtrudeGeometry.__v2=new THREE.Vector2;
 THREE.ExtrudeGeometry.__v3=new THREE.Vector2;THREE.ExtrudeGeometry.__v4=new THREE.Vector2;THREE.ExtrudeGeometry.__v5=new THREE.Vector2;THREE.ExtrudeGeometry.__v6=new THREE.Vector2;
-THREE.IcosahedronGeometry=function(a){function c(a,b,c){var d=Math.sqrt(a*a+b*b+c*c);return f.vertices.push(new THREE.Vertex(new THREE.Vector3(a/d,b/d,c/d)))-1}function b(a,b,c,d){d.faces.push(new THREE.Face3(a,b,c))}function d(a,b){var d=f.vertices[a].position,e=f.vertices[b].position;return c((d.x+e.x)/2,(d.y+e.y)/2,(d.z+e.z)/2)}var f=this,g=new THREE.Geometry;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;c(-1,a,0);c(1,a,0);c(-1,-a,0);c(1,-a,0);c(0,-1,a);c(0,1,a);c(0,-1,
--a);c(0,1,-a);c(a,0,-1);c(a,0,1);c(-a,0,-1);c(-a,0,1);b(0,11,5,g);b(0,5,1,g);b(0,1,7,g);b(0,7,10,g);b(0,10,11,g);b(1,5,9,g);b(5,11,4,g);b(11,10,2,g);b(10,7,6,g);b(7,1,8,g);b(3,9,4,g);b(3,4,2,g);b(3,2,6,g);b(3,6,8,g);b(3,8,9,g);b(4,9,5,g);b(2,4,11,g);b(6,2,10,g);b(8,6,7,g);b(9,8,1,g);for(var e=0;e<this.subdivisions;e++){var a=new THREE.Geometry,h;for(h in g.faces){var i=d(g.faces[h].a,g.faces[h].b),j=d(g.faces[h].b,g.faces[h].c),k=d(g.faces[h].c,g.faces[h].a);b(g.faces[h].a,i,k,a);b(g.faces[h].b,j,
-i,a);b(g.faces[h].c,k,j,a);b(i,j,k,a)}g.faces=a.faces}f.faces=g.faces;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;
-THREE.LatheGeometry=function(a,c,b){THREE.Geometry.call(this);this.steps=c||12;this.angle=b||2*Math.PI;for(var c=this.angle/this.steps,b=[],d=[],f=[],g=[],e=(new THREE.Matrix4).setRotationZ(c),h=0;h<a.length;h++)this.vertices.push(new THREE.Vertex(a[h])),b[h]=a[h].clone(),d[h]=this.vertices.length-1;for(var i=0;i<=this.angle+0.0010;i+=c){for(h=0;h<b.length;h++)i<this.angle?(b[h]=e.multiplyVector3(b[h].clone()),this.vertices.push(new THREE.Vertex(b[h])),f[h]=this.vertices.length-1):f=g;i==0&&(g=d);
-for(h=0;h<d.length-1;h++)this.faces.push(new THREE.Face4(f[h],f[h+1],d[h+1],d[h])),this.faceVertexUvs[0].push([new THREE.UV(1-i/this.angle,h/a.length),new THREE.UV(1-i/this.angle,(h+1)/a.length),new THREE.UV(1-(i-c)/this.angle,(h+1)/a.length),new THREE.UV(1-(i-c)/this.angle,h/a.length)]);d=f;f=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=new THREE.Geometry;THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry;
+THREE.IcosahedronGeometry=function(a){function c(a,b,c){var d=Math.sqrt(a*a+b*b+c*c);return g.vertices.push(new THREE.Vertex(new THREE.Vector3(a/d,b/d,c/d)))-1}function b(a,b,c,d){d.faces.push(new THREE.Face3(a,b,c))}function d(a,b){var d=g.vertices[a].position,e=g.vertices[b].position;return c((d.x+e.x)/2,(d.y+e.y)/2,(d.z+e.z)/2)}var g=this,f=new THREE.Geometry;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;c(-1,a,0);c(1,a,0);c(-1,-a,0);c(1,-a,0);c(0,-1,a);c(0,1,a);c(0,-1,
+-a);c(0,1,-a);c(a,0,-1);c(a,0,1);c(-a,0,-1);c(-a,0,1);b(0,11,5,f);b(0,5,1,f);b(0,1,7,f);b(0,7,10,f);b(0,10,11,f);b(1,5,9,f);b(5,11,4,f);b(11,10,2,f);b(10,7,6,f);b(7,1,8,f);b(3,9,4,f);b(3,4,2,f);b(3,2,6,f);b(3,6,8,f);b(3,8,9,f);b(4,9,5,f);b(2,4,11,f);b(6,2,10,f);b(8,6,7,f);b(9,8,1,f);for(var e=0;e<this.subdivisions;e++){var a=new THREE.Geometry,h;for(h in f.faces){var i=d(f.faces[h].a,f.faces[h].b),j=d(f.faces[h].b,f.faces[h].c),k=d(f.faces[h].c,f.faces[h].a);b(f.faces[h].a,i,k,a);b(f.faces[h].b,j,
+i,a);b(f.faces[h].c,k,j,a);b(i,j,k,a)}f.faces=a.faces}g.faces=f.faces;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;
+THREE.LatheGeometry=function(a,c,b){THREE.Geometry.call(this);this.steps=c||12;this.angle=b||2*Math.PI;for(var c=this.angle/this.steps,b=[],d=[],g=[],f=[],e=(new THREE.Matrix4).setRotationZ(c),h=0;h<a.length;h++)this.vertices.push(new THREE.Vertex(a[h])),b[h]=a[h].clone(),d[h]=this.vertices.length-1;for(var i=0;i<=this.angle+0.0010;i+=c){for(h=0;h<b.length;h++)i<this.angle?(b[h]=e.multiplyVector3(b[h].clone()),this.vertices.push(new THREE.Vertex(b[h])),g[h]=this.vertices.length-1):g=f;i==0&&(f=d);
+for(h=0;h<d.length-1;h++)this.faces.push(new THREE.Face4(g[h],g[h+1],d[h+1],d[h])),this.faceVertexUvs[0].push([new THREE.UV(1-i/this.angle,h/a.length),new THREE.UV(1-i/this.angle,(h+1)/a.length),new THREE.UV(1-(i-c)/this.angle,(h+1)/a.length),new THREE.UV(1-(i-c)/this.angle,h/a.length)]);d=g;g=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=new THREE.Geometry;THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry;
 THREE.OctahedronGeometry=function(a,c){function b(b){var c=b.clone().normalize(),c=new THREE.Vertex(c.clone().multiplyScalar(a));c.index=e.vertices.push(c)-1;c.uv=new THREE.UV(Math.atan2(b.z,-b.x)/2/Math.PI+0.5,Math.atan2(-b.y,Math.sqrt(b.x*b.x+b.z*b.z))/Math.PI+0.5);return c}function d(a,b,c,h){h<1?(h=new THREE.Face3(a.index,b.index,c.index,[a.position,b.position,c.position]),h.centroid.addSelf(a.position).addSelf(b.position).addSelf(c.position).divideScalar(3),h.normal=h.centroid.clone().normalize(),
-e.faces.push(h),h=Math.atan2(h.centroid.z,-h.centroid.x),e.faceVertexUvs[0].push([g(a.uv,a.position,h),g(b.uv,b.position,h),g(c.uv,c.position,h)])):(h-=1,d(a,f(a,b),f(a,c),h),d(f(a,b),b,f(b,c),h),d(f(a,c),f(b,c),c,h),d(f(a,b),f(b,c),f(a,c),h))}function f(a,c){h[a.index]||(h[a.index]=[]);h[c.index]||(h[c.index]=[]);var d=h[a.index][c.index];d===void 0&&(h[a.index][c.index]=h[c.index][a.index]=d=b((new THREE.Vector3).add(a.position,c.position).divideScalar(2)));return d}function g(a,b,c){c<0&&a.u===
+e.faces.push(h),h=Math.atan2(h.centroid.z,-h.centroid.x),e.faceVertexUvs[0].push([f(a.uv,a.position,h),f(b.uv,b.position,h),f(c.uv,c.position,h)])):(h-=1,d(a,g(a,b),g(a,c),h),d(g(a,b),b,g(b,c),h),d(g(a,c),g(b,c),c,h),d(g(a,b),g(b,c),g(a,c),h))}function g(a,c){h[a.index]||(h[a.index]=[]);h[c.index]||(h[c.index]=[]);var d=h[a.index][c.index];d===void 0&&(h[a.index][c.index]=h[c.index][a.index]=d=b((new THREE.Vector3).add(a.position,c.position).divideScalar(2)));return d}function f(a,b,c){c<0&&a.u===
 1&&(a=new THREE.UV(a.u-1,a.v));b.x===0&&b.z===0&&(a=new THREE.UV(c/2/Math.PI+0.5,a.v));return a}THREE.Geometry.call(this);var c=c||0,e=this;b(new THREE.Vector3(1,0,0));b(new THREE.Vector3(-1,0,0));b(new THREE.Vector3(0,1,0));b(new THREE.Vector3(0,-1,0));b(new THREE.Vector3(0,0,1));b(new THREE.Vector3(0,0,-1));var h=[],i=this.vertices;d(i[0],i[2],i[4],c);d(i[0],i[4],i[3],c);d(i[0],i[3],i[5],c);d(i[0],i[5],i[2],c);d(i[1],i[2],i[5],c);d(i[1],i[5],i[3],c);d(i[1],i[3],i[4],c);d(i[1],i[4],i[2],c);this.boundingSphere=
 {radius:a}};THREE.OctahedronGeometry.prototype=new THREE.Geometry;THREE.OctahedronGeometry.prototype.constructor=THREE.OctahedronGeometry;
-THREE.PlaneGeometry=function(a,c,b,d){THREE.Geometry.call(this);var f,g=a/2,e=c/2,b=b||1,d=d||1,h=b+1,i=d+1;a/=b;var j=c/d;for(f=0;f<i;f++)for(c=0;c<h;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*a-g,-(f*j-e),0)));for(f=0;f<d;f++)for(c=0;c<b;c++)this.faces.push(new THREE.Face4(c+h*f,c+h*(f+1),c+1+h*(f+1),c+1+h*f)),this.faceVertexUvs[0].push([new THREE.UV(c/b,f/d),new THREE.UV(c/b,(f+1)/d),new THREE.UV((c+1)/b,(f+1)/d),new THREE.UV((c+1)/b,f/d)]);this.computeCentroids();this.computeFaceNormals()};
+THREE.PlaneGeometry=function(a,c,b,d){THREE.Geometry.call(this);var g,f=a/2,e=c/2,b=b||1,d=d||1,h=b+1,i=d+1;a/=b;var j=c/d;for(g=0;g<i;g++)for(c=0;c<h;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*a-f,-(g*j-e),0)));for(g=0;g<d;g++)for(c=0;c<b;c++)this.faces.push(new THREE.Face4(c+h*g,c+h*(g+1),c+1+h*(g+1),c+1+h*g)),this.faceVertexUvs[0].push([new THREE.UV(c/b,g/d),new THREE.UV(c/b,(g+1)/d),new THREE.UV((c+1)/b,(g+1)/d),new THREE.UV((c+1)/b,g/d)]);this.computeCentroids();this.computeFaceNormals()};
 THREE.PlaneGeometry.prototype=new THREE.Geometry;THREE.PlaneGeometry.prototype.constructor=THREE.PlaneGeometry;
-THREE.SphereGeometry=function(a,c,b){THREE.Geometry.call(this);for(var a=a||50,d,f=Math.PI,g=Math.max(3,c||8),e=Math.max(2,b||6),c=[],b=0;b<e+1;b++){d=b/e;var h=a*Math.cos(d*f),i=a*Math.sin(d*f),j=[],k=0;for(d=0;d<g;d++){var m=2*d/g,o=i*Math.sin(m*f),m=i*Math.cos(m*f);(b==0||b==e)&&d>0||(k=this.vertices.push(new THREE.Vertex(new THREE.Vector3(m,h,o)))-1);j.push(k)}c.push(j)}for(var n,t,q,f=c.length,b=0;b<f;b++)if(g=c[b].length,b>0)for(d=0;d<g;d++){j=d==g-1;e=c[b][j?0:d+1];h=c[b][j?g-1:d];i=c[b-1][j?
-g-1:d];j=c[b-1][j?0:d+1];o=b/(f-1);n=(b-1)/(f-1);t=(d+1)/g;var m=d/g,k=new THREE.UV(1-t,o),o=new THREE.UV(1-m,o),m=new THREE.UV(1-m,n),r=new THREE.UV(1-t,n);b<c.length-1&&(n=this.vertices[e].position.clone(),t=this.vertices[h].position.clone(),q=this.vertices[i].position.clone(),n.normalize(),t.normalize(),q.normalize(),this.faces.push(new THREE.Face3(e,h,i,[new THREE.Vector3(n.x,n.y,n.z),new THREE.Vector3(t.x,t.y,t.z),new THREE.Vector3(q.x,q.y,q.z)])),this.faceVertexUvs[0].push([k,o,m]));b>1&&(n=
-this.vertices[e].position.clone(),t=this.vertices[i].position.clone(),q=this.vertices[j].position.clone(),n.normalize(),t.normalize(),q.normalize(),this.faces.push(new THREE.Face3(e,i,j,[new THREE.Vector3(n.x,n.y,n.z),new THREE.Vector3(t.x,t.y,t.z),new THREE.Vector3(q.x,q.y,q.z)])),this.faceVertexUvs[0].push([k,m,r]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};THREE.SphereGeometry.prototype=new THREE.Geometry;
+THREE.SphereGeometry=function(a,c,b){THREE.Geometry.call(this);for(var a=a||50,d,g=Math.PI,f=Math.max(3,c||8),e=Math.max(2,b||6),c=[],b=0;b<e+1;b++){d=b/e;var h=a*Math.cos(d*g),i=a*Math.sin(d*g),j=[],k=0;for(d=0;d<f;d++){var l=2*d/f,o=i*Math.sin(l*g),l=i*Math.cos(l*g);(b==0||b==e)&&d>0||(k=this.vertices.push(new THREE.Vertex(new THREE.Vector3(l,h,o)))-1);j.push(k)}c.push(j)}for(var n,t,q,g=c.length,b=0;b<g;b++)if(f=c[b].length,b>0)for(d=0;d<f;d++){j=d==f-1;e=c[b][j?0:d+1];h=c[b][j?f-1:d];i=c[b-1][j?
+f-1:d];j=c[b-1][j?0:d+1];o=b/(g-1);n=(b-1)/(g-1);t=(d+1)/f;var l=d/f,k=new THREE.UV(1-t,o),o=new THREE.UV(1-l,o),l=new THREE.UV(1-l,n),r=new THREE.UV(1-t,n);b<c.length-1&&(n=this.vertices[e].position.clone(),t=this.vertices[h].position.clone(),q=this.vertices[i].position.clone(),n.normalize(),t.normalize(),q.normalize(),this.faces.push(new THREE.Face3(e,h,i,[new THREE.Vector3(n.x,n.y,n.z),new THREE.Vector3(t.x,t.y,t.z),new THREE.Vector3(q.x,q.y,q.z)])),this.faceVertexUvs[0].push([k,o,l]));b>1&&(n=
+this.vertices[e].position.clone(),t=this.vertices[i].position.clone(),q=this.vertices[j].position.clone(),n.normalize(),t.normalize(),q.normalize(),this.faces.push(new THREE.Face3(e,i,j,[new THREE.Vector3(n.x,n.y,n.z),new THREE.Vector3(t.x,t.y,t.z),new THREE.Vector3(q.x,q.y,q.z)])),this.faceVertexUvs[0].push([k,l,r]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};THREE.SphereGeometry.prototype=new THREE.Geometry;
 THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry;
 THREE.TextGeometry=function(a,c){var b=(new THREE.TextPath(a,c)).toShapes();c.amount=c.height!==void 0?c.height:50;if(c.bevelThickness===void 0)c.bevelThickness=10;if(c.bevelSize===void 0)c.bevelSize=8;if(c.bevelEnabled===void 0)c.bevelEnabled=!1;if(c.bend){var d=b[b.length-1].getBoundingBox().maxX;c.bendPath=new THREE.QuadraticBezierCurve(new THREE.Vector2(0,0),new THREE.Vector2(d/2,120),new THREE.Vector2(d,0))}THREE.ExtrudeGeometry.call(this,b,c)};THREE.TextGeometry.prototype=new THREE.ExtrudeGeometry;
 THREE.TextGeometry.prototype.constructor=THREE.TextGeometry;
 THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function(){return this.faces[this.face][this.weight][this.style]},loadFace:function(a){var c=a.familyName.toLowerCase();this.faces[c]=this.faces[c]||{};this.faces[c][a.cssFontWeight]=this.faces[c][a.cssFontWeight]||{};this.faces[c][a.cssFontWeight][a.cssFontStyle]=a;return this.faces[c][a.cssFontWeight][a.cssFontStyle]=a},drawText:function(a){for(var c=this.getFace(),b=this.size/c.resolution,d=
-0,f=String(a).split(""),g=f.length,e=[],a=0;a<g;a++){var h=new THREE.Path,h=this.extractGlyphPoints(f[a],c,b,d,h);d+=h.offset;e.push(h.path)}return{paths:e,offset:d/2}},extractGlyphPoints:function(a,c,b,d,f){var g=[],e,h,i,j,k,m,o,n,t,q,r,p=c.glyphs[a]||c.glyphs["?"];if(p){if(p.o){c=p._cachedOutline||(p._cachedOutline=p.o.split(" "));j=c.length;for(a=0;a<j;)switch(i=c[a++],i){case "m":i=c[a++]*b+d;k=c[a++]*b;g.push(new THREE.Vector2(i,k));f.moveTo(i,k);break;case "l":i=c[a++]*b+d;k=c[a++]*b;g.push(new THREE.Vector2(i,
-k));f.lineTo(i,k);break;case "q":i=c[a++]*b+d;k=c[a++]*b;n=c[a++]*b+d;t=c[a++]*b;f.quadraticCurveTo(n,t,i,k);if(e=g[g.length-1]){m=e.x;o=e.y;e=1;for(h=this.divisions;e<=h;e++){var s=e/h,l=THREE.Shape.Utils.b2(s,m,n,i),s=THREE.Shape.Utils.b2(s,o,t,k);g.push(new THREE.Vector2(l,s))}}break;case "b":if(i=c[a++]*b+d,k=c[a++]*b,n=c[a++]*b+d,t=c[a++]*-b,q=c[a++]*b+d,r=c[a++]*-b,f.bezierCurveTo(i,k,n,t,q,r),e=g[g.length-1]){m=e.x;o=e.y;e=1;for(h=this.divisions;e<=h;e++)s=e/h,l=THREE.Shape.Utils.b3(s,m,n,
-q,i),s=THREE.Shape.Utils.b3(s,o,t,r,k),g.push(new THREE.Vector2(l,s))}}}return{offset:p.ha*b,points:g,path:f}}}};
-(function(a){var c=function(a){for(var c=a.length,f=0,g=c-1,e=0;e<c;g=e++)f+=a[g].x*a[e].y-a[e].x*a[g].y;return f*0.5};a.Triangulate=function(a,d){var f=a.length;if(f<3)return null;var g=[],e=[],h=[],i,j,k;if(c(a)>0)for(j=0;j<f;j++)e[j]=j;else for(j=0;j<f;j++)e[j]=f-1-j;var m=2*f;for(j=f-1;f>2;){if(m--<=0){console.log("Warning, unable to triangulate polygon!");if(d)return h;return g}i=j;f<=i&&(i=0);j=i+1;f<=j&&(j=0);k=j+1;f<=k&&(k=0);var o;a:{o=a;var n=i,t=j,q=k,r=f,p=e,s=void 0,l=void 0,v=void 0,
-w=void 0,x=void 0,y=void 0,C=void 0,A=void 0,E=void 0,l=o[p[n]].x,v=o[p[n]].y,w=o[p[t]].x,x=o[p[t]].y,y=o[p[q]].x,C=o[p[q]].y;if(1.0E-10>(w-l)*(C-v)-(x-v)*(y-l))o=!1;else{for(s=0;s<r;s++)if(!(s==n||s==t||s==q)){var A=o[p[s]].x,E=o[p[s]].y,u=void 0,G=void 0,D=void 0,H=void 0,B=void 0,F=void 0,J=void 0,N=void 0,M=void 0,O=void 0,z=void 0,K=void 0,u=D=B=void 0,u=y-w,G=C-x,D=l-y,H=v-C,B=w-l,F=x-v,J=A-l,N=E-v,M=A-w,O=E-x,z=A-y,K=E-C,u=u*O-G*M,B=B*N-F*J,D=D*K-H*z;if(u>=0&&D>=0&&B>=0){o=!1;break a}}o=!0}}if(o){g.push([a[e[i]],
-a[e[j]],a[e[k]]]);h.push([e[i],e[j],e[k]]);i=j;for(k=j+1;k<f;i++,k++)e[i]=e[k];f--;m=2*f}}if(d)return h;return g};a.Triangulate.area=c;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
-THREE.TorusGeometry=function(a,c,b,d,f){THREE.Geometry.call(this);this.radius=a||100;this.tube=c||40;this.segmentsR=b||8;this.segmentsT=d||6;this.arc=f||Math.PI*2;f=new THREE.Vector3;a=[];c=[];for(b=0;b<=this.segmentsR;b++)for(d=0;d<=this.segmentsT;d++){var g=d/this.segmentsT*this.arc,e=b/this.segmentsR*Math.PI*2;f.x=this.radius*Math.cos(g);f.y=this.radius*Math.sin(g);var h=new THREE.Vector3;h.x=(this.radius+this.tube*Math.cos(e))*Math.cos(g);h.y=(this.radius+this.tube*Math.cos(e))*Math.sin(g);h.z=
-this.tube*Math.sin(e);this.vertices.push(new THREE.Vertex(h));a.push(new THREE.UV(d/this.segmentsT,1-b/this.segmentsR));c.push(h.clone().subSelf(f).normalize())}for(b=1;b<=this.segmentsR;b++)for(d=1;d<=this.segmentsT;d++){var f=(this.segmentsT+1)*b+d-1,g=(this.segmentsT+1)*(b-1)+d-1,e=(this.segmentsT+1)*(b-1)+d,h=(this.segmentsT+1)*b+d,i=new THREE.Face4(f,g,e,h,[c[f],c[g],c[e],c[h]]);i.normal.addSelf(c[f]);i.normal.addSelf(c[g]);i.normal.addSelf(c[e]);i.normal.addSelf(c[h]);i.normal.normalize();this.faces.push(i);
-this.faceVertexUvs[0].push([a[f].clone(),a[g].clone(),a[e].clone(),a[h].clone()])}this.computeCentroids()};THREE.TorusGeometry.prototype=new THREE.Geometry;THREE.TorusGeometry.prototype.constructor=THREE.TorusGeometry;
-THREE.TorusKnotGeometry=function(a,c,b,d,f,g,e){function h(a,b,c,d,e,g){b=c/d*a;c=Math.cos(b);return new THREE.Vector3(e*(2+c)*0.5*Math.cos(a),e*(2+c)*Math.sin(a)*0.5,g*e*Math.sin(b)*0.5)}THREE.Geometry.call(this);this.radius=a||200;this.tube=c||40;this.segmentsR=b||64;this.segmentsT=d||8;this.p=f||2;this.q=g||3;this.heightScale=e||1;this.grid=Array(this.segmentsR);b=new THREE.Vector3;d=new THREE.Vector3;g=new THREE.Vector3;for(a=0;a<this.segmentsR;++a){this.grid[a]=Array(this.segmentsT);for(c=0;c<
-this.segmentsT;++c){var i=a/this.segmentsR*2*this.p*Math.PI,e=c/this.segmentsT*2*Math.PI,f=h(i,e,this.q,this.p,this.radius,this.heightScale),i=h(i+0.01,e,this.q,this.p,this.radius,this.heightScale);b.x=i.x-f.x;b.y=i.y-f.y;b.z=i.z-f.z;d.x=i.x+f.x;d.y=i.y+f.y;d.z=i.z+f.z;g.cross(b,d);d.cross(g,b);g.normalize();d.normalize();i=-this.tube*Math.cos(e);e=this.tube*Math.sin(e);f.x+=i*d.x+e*g.x;f.y+=i*d.y+e*g.y;f.z+=i*d.z+e*g.z;this.grid[a][c]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(f.x,f.y,
-f.z)))-1}}for(a=0;a<this.segmentsR;++a)for(c=0;c<this.segmentsT;++c){var d=(a+1)%this.segmentsR,g=(c+1)%this.segmentsT,f=this.grid[a][c],b=this.grid[d][c],d=this.grid[d][g],g=this.grid[a][g],e=new THREE.UV(a/this.segmentsR,c/this.segmentsT),i=new THREE.UV((a+1)/this.segmentsR,c/this.segmentsT),j=new THREE.UV((a+1)/this.segmentsR,(c+1)/this.segmentsT),k=new THREE.UV(a/this.segmentsR,(c+1)/this.segmentsT);this.faces.push(new THREE.Face4(f,b,d,g));this.faceVertexUvs[0].push([e,i,j,k])}this.computeCentroids();
+0,g=String(a).split(""),f=g.length,e=[],a=0;a<f;a++){var h=new THREE.Path,h=this.extractGlyphPoints(g[a],c,b,d,h);d+=h.offset;e.push(h.path)}return{paths:e,offset:d/2}},extractGlyphPoints:function(a,c,b,d,g){var f=[],e,h,i,j,k,l,o,n,t,q,r,p=c.glyphs[a]||c.glyphs["?"];if(p){if(p.o){c=p._cachedOutline||(p._cachedOutline=p.o.split(" "));j=c.length;for(a=0;a<j;)switch(i=c[a++],i){case "m":i=c[a++]*b+d;k=c[a++]*b;f.push(new THREE.Vector2(i,k));g.moveTo(i,k);break;case "l":i=c[a++]*b+d;k=c[a++]*b;f.push(new THREE.Vector2(i,
+k));g.lineTo(i,k);break;case "q":i=c[a++]*b+d;k=c[a++]*b;n=c[a++]*b+d;t=c[a++]*b;g.quadraticCurveTo(n,t,i,k);if(e=f[f.length-1]){l=e.x;o=e.y;e=1;for(h=this.divisions;e<=h;e++){var s=e/h,m=THREE.Shape.Utils.b2(s,l,n,i),s=THREE.Shape.Utils.b2(s,o,t,k);f.push(new THREE.Vector2(m,s))}}break;case "b":if(i=c[a++]*b+d,k=c[a++]*b,n=c[a++]*b+d,t=c[a++]*-b,q=c[a++]*b+d,r=c[a++]*-b,g.bezierCurveTo(i,k,n,t,q,r),e=f[f.length-1]){l=e.x;o=e.y;e=1;for(h=this.divisions;e<=h;e++)s=e/h,m=THREE.Shape.Utils.b3(s,l,n,
+q,i),s=THREE.Shape.Utils.b3(s,o,t,r,k),f.push(new THREE.Vector2(m,s))}}}return{offset:p.ha*b,points:f,path:g}}}};
+(function(a){var c=function(a){for(var c=a.length,g=0,f=c-1,e=0;e<c;f=e++)g+=a[f].x*a[e].y-a[e].x*a[f].y;return g*0.5};a.Triangulate=function(a,d){var g=a.length;if(g<3)return null;var f=[],e=[],h=[],i,j,k;if(c(a)>0)for(j=0;j<g;j++)e[j]=j;else for(j=0;j<g;j++)e[j]=g-1-j;var l=2*g;for(j=g-1;g>2;){if(l--<=0){console.log("Warning, unable to triangulate polygon!");if(d)return h;return f}i=j;g<=i&&(i=0);j=i+1;g<=j&&(j=0);k=j+1;g<=k&&(k=0);var o;a:{o=a;var n=i,t=j,q=k,r=g,p=e,s=void 0,m=void 0,v=void 0,
+w=void 0,x=void 0,y=void 0,C=void 0,A=void 0,E=void 0,m=o[p[n]].x,v=o[p[n]].y,w=o[p[t]].x,x=o[p[t]].y,y=o[p[q]].x,C=o[p[q]].y;if(1.0E-10>(w-m)*(C-v)-(x-v)*(y-m))o=!1;else{for(s=0;s<r;s++)if(!(s==n||s==t||s==q)){var A=o[p[s]].x,E=o[p[s]].y,u=void 0,G=void 0,D=void 0,H=void 0,B=void 0,F=void 0,J=void 0,N=void 0,M=void 0,O=void 0,z=void 0,K=void 0,u=D=B=void 0,u=y-w,G=C-x,D=m-y,H=v-C,B=w-m,F=x-v,J=A-m,N=E-v,M=A-w,O=E-x,z=A-y,K=E-C,u=u*O-G*M,B=B*N-F*J,D=D*K-H*z;if(u>=0&&D>=0&&B>=0){o=!1;break a}}o=!0}}if(o){f.push([a[e[i]],
+a[e[j]],a[e[k]]]);h.push([e[i],e[j],e[k]]);i=j;for(k=j+1;k<g;i++,k++)e[i]=e[k];g--;l=2*g}}if(d)return h;return f};a.Triangulate.area=c;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
+THREE.TorusGeometry=function(a,c,b,d,g){THREE.Geometry.call(this);this.radius=a||100;this.tube=c||40;this.segmentsR=b||8;this.segmentsT=d||6;this.arc=g||Math.PI*2;g=new THREE.Vector3;a=[];c=[];for(b=0;b<=this.segmentsR;b++)for(d=0;d<=this.segmentsT;d++){var f=d/this.segmentsT*this.arc,e=b/this.segmentsR*Math.PI*2;g.x=this.radius*Math.cos(f);g.y=this.radius*Math.sin(f);var h=new THREE.Vector3;h.x=(this.radius+this.tube*Math.cos(e))*Math.cos(f);h.y=(this.radius+this.tube*Math.cos(e))*Math.sin(f);h.z=
+this.tube*Math.sin(e);this.vertices.push(new THREE.Vertex(h));a.push(new THREE.UV(d/this.segmentsT,1-b/this.segmentsR));c.push(h.clone().subSelf(g).normalize())}for(b=1;b<=this.segmentsR;b++)for(d=1;d<=this.segmentsT;d++){var g=(this.segmentsT+1)*b+d-1,f=(this.segmentsT+1)*(b-1)+d-1,e=(this.segmentsT+1)*(b-1)+d,h=(this.segmentsT+1)*b+d,i=new THREE.Face4(g,f,e,h,[c[g],c[f],c[e],c[h]]);i.normal.addSelf(c[g]);i.normal.addSelf(c[f]);i.normal.addSelf(c[e]);i.normal.addSelf(c[h]);i.normal.normalize();this.faces.push(i);
+this.faceVertexUvs[0].push([a[g].clone(),a[f].clone(),a[e].clone(),a[h].clone()])}this.computeCentroids()};THREE.TorusGeometry.prototype=new THREE.Geometry;THREE.TorusGeometry.prototype.constructor=THREE.TorusGeometry;
+THREE.TorusKnotGeometry=function(a,c,b,d,g,f,e){function h(a,b,c,d,e,f){b=c/d*a;c=Math.cos(b);return new THREE.Vector3(e*(2+c)*0.5*Math.cos(a),e*(2+c)*Math.sin(a)*0.5,f*e*Math.sin(b)*0.5)}THREE.Geometry.call(this);this.radius=a||200;this.tube=c||40;this.segmentsR=b||64;this.segmentsT=d||8;this.p=g||2;this.q=f||3;this.heightScale=e||1;this.grid=Array(this.segmentsR);b=new THREE.Vector3;d=new THREE.Vector3;f=new THREE.Vector3;for(a=0;a<this.segmentsR;++a){this.grid[a]=Array(this.segmentsT);for(c=0;c<
+this.segmentsT;++c){var i=a/this.segmentsR*2*this.p*Math.PI,e=c/this.segmentsT*2*Math.PI,g=h(i,e,this.q,this.p,this.radius,this.heightScale),i=h(i+0.01,e,this.q,this.p,this.radius,this.heightScale);b.x=i.x-g.x;b.y=i.y-g.y;b.z=i.z-g.z;d.x=i.x+g.x;d.y=i.y+g.y;d.z=i.z+g.z;f.cross(b,d);d.cross(f,b);f.normalize();d.normalize();i=-this.tube*Math.cos(e);e=this.tube*Math.sin(e);g.x+=i*d.x+e*f.x;g.y+=i*d.y+e*f.y;g.z+=i*d.z+e*f.z;this.grid[a][c]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(g.x,g.y,
+g.z)))-1}}for(a=0;a<this.segmentsR;++a)for(c=0;c<this.segmentsT;++c){var d=(a+1)%this.segmentsR,f=(c+1)%this.segmentsT,g=this.grid[a][c],b=this.grid[d][c],d=this.grid[d][f],f=this.grid[a][f],e=new THREE.UV(a/this.segmentsR,c/this.segmentsT),i=new THREE.UV((a+1)/this.segmentsR,c/this.segmentsT),j=new THREE.UV((a+1)/this.segmentsR,(c+1)/this.segmentsT),k=new THREE.UV(a/this.segmentsR,(c+1)/this.segmentsT);this.faces.push(new THREE.Face4(g,b,d,f));this.faceVertexUvs[0].push([e,i,j,k])}this.computeCentroids();
 this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusKnotGeometry.prototype=new THREE.Geometry;THREE.TorusKnotGeometry.prototype.constructor=THREE.TorusKnotGeometry;THREE.SubdivisionModifier=function(a){this.subdivisions=a===void 0?1:a;this.useOldVertexColors=!1;this.supportUVs=!0};THREE.SubdivisionModifier.prototype.constructor=THREE.SubdivisionModifier;THREE.SubdivisionModifier.prototype.modify=function(a){for(var c=this.subdivisions;c-- >0;)this.smooth(a)};
-THREE.SubdivisionModifier.prototype.smooth=function(a){function c(a,b,c,d,h,i){var j=new THREE.Face4(a,b,c,d,null,h.color,h.material);if(e.useOldVertexColors){j.vertexColors=[];for(var k,n,m,l=0;l<4;l++){m=i[l];k=new THREE.Color;k.setRGB(0,0,0);for(var p=0;p<m.length;p++)n=h.vertexColors[m[p]-1],k.r+=n.r,k.g+=n.g,k.b+=n.b;k.r/=m.length;k.g/=m.length;k.b/=m.length;j.vertexColors[l]=k}}f.push(j);(!e.supportUVs||o.length!=0)&&g.push([o[a],o[b],o[c],o[d]])}function b(a,b){return Math.min(a,b)+"_"+Math.max(a,
-b)}var d=[],f=[],g=[],e=this,h=a.vertices,d=a.faces,i=h.concat(),j=[],k={},m={},o=[],n,t,q,r,p,s=a.faceVertexUvs[0];n=0;for(t=s.length;n<t;n++){q=0;for(r=s[n].length;q<r;q++)p=d[n]["abcd".charAt(q)],o[p]||(o[p]=s[n][q])}var l;n=0;for(t=d.length;n<t;n++)if(p=d[n],j.push(p.centroid),i.push(new THREE.Vertex(p.centroid)),e.supportUVs&&o.length!=0){l=new THREE.UV;if(p instanceof THREE.Face3)l.u=o[p.a].u+o[p.b].u+o[p.c].u,l.v=o[p.a].v+o[p.b].v+o[p.c].v,l.u/=3,l.v/=3;else if(p instanceof THREE.Face4)l.u=
-o[p.a].u+o[p.b].u+o[p.c].u+o[p.d].u,l.v=o[p.a].v+o[p.b].v+o[p.c].v+o[p.d].v,l.u/=4,l.v/=4;o.push(l)}t=function(a){function c(a,b,d){a[b]===void 0&&(a[b]=[]);a[b].push(d)}var d,e,g,f,h={};d=0;for(e=a.faces.length;d<e;d++)g=a.faces[d],g instanceof THREE.Face3?(f=b(g.a,g.b),c(h,f,d),f=b(g.b,g.c),c(h,f,d),f=b(g.c,g.a),c(h,f,d)):g instanceof THREE.Face4&&(f=b(g.a,g.b),c(h,f,d),f=b(g.b,g.c),c(h,f,d),f=b(g.c,g.d),c(h,f,d),f=b(g.d,g.a),c(h,f,d));return h}(a);var v=0,s=h.length,w,x,y={},C={},A=function(a,
-b){y[a]===void 0&&(y[a]=[]);y[a].push(b)},E=function(a,b){C[a]===void 0&&(C[a]={});C[a][b]=null};for(n in t){l=t[n];w=n.split("_");x=w[0];w=w[1];A(x,[x,w]);A(w,[x,w]);q=0;for(r=l.length;q<r;q++)p=l[q],E(x,p,n),E(w,p,n);l.length<2&&(m[n]=!0)}for(n in t)if(l=t[n],p=l[0],l=l[1],w=n.split("_"),x=w[0],w=w[1],r=new THREE.Vector3,m[n]?(r.addSelf(h[x].position),r.addSelf(h[w].position),r.multiplyScalar(0.5)):(r.addSelf(j[p]),r.addSelf(j[l]),r.addSelf(h[x].position),r.addSelf(h[w].position),r.multiplyScalar(0.25)),
-k[n]=s+d.length+v,i.push(new THREE.Vertex(r)),v++,e.supportUVs&&o.length!=0)l=new THREE.UV,l.u=o[x].u+o[w].u,l.v=o[x].v+o[w].v,l.u/=2,l.v/=2,o.push(l);var u,G;w=["123","12","2","23"];r=["123","23","3","31"];var A=["123","31","1","12"],E=["1234","12","2","23"],D=["1234","23","3","34"],H=["1234","34","4","41"],B=["1234","41","1","12"];n=0;for(t=j.length;n<t;n++)p=d[n],l=s+n,p instanceof THREE.Face3?(v=b(p.a,p.b),x=b(p.b,p.c),u=b(p.c,p.a),c(l,k[v],p.b,k[x],p,w),c(l,k[x],p.c,k[u],p,r),c(l,k[u],p.a,k[v],
-p,A)):p instanceof THREE.Face4?(v=b(p.a,p.b),x=b(p.b,p.c),u=b(p.c,p.d),G=b(p.d,p.a),c(l,k[v],p.b,k[x],p,E),c(l,k[x],p.c,k[u],p,D),c(l,k[u],p.d,k[G],p,H),c(l,k[G],p.a,k[v],p,B)):console.log("face should be a face!",p);d=i;i=new THREE.Vector3;k=new THREE.Vector3;n=0;for(t=h.length;n<t;n++)if(y[n]!==void 0){i.set(0,0,0);k.set(0,0,0);p=new THREE.Vector3(0,0,0);l=0;for(q in C[n])i.addSelf(j[q]),l++;v=0;s=y[n].length;for(q=0;q<s;q++)m[b(y[n][q][0],y[n][q][1])]&&v++;if(v!=2){i.divideScalar(l);for(q=0;q<
-s;q++)l=y[n][q],l=h[l[0]].position.clone().addSelf(h[l[1]].position).divideScalar(2),k.addSelf(l);k.divideScalar(s);p.addSelf(h[n].position);p.multiplyScalar(s-3);p.addSelf(i);p.addSelf(k.multiplyScalar(2));p.divideScalar(s);d[n].position=p}}a.vertices=d;a.faces=f;a.faceVertexUvs[0]=g;delete a.__tmpVertices;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals()};
+THREE.SubdivisionModifier.prototype.smooth=function(a){function c(a,b,c,d,h,i){var j=new THREE.Face4(a,b,c,d,null,h.color,h.material);if(e.useOldVertexColors){j.vertexColors=[];for(var k,n,l,m=0;m<4;m++){l=i[m];k=new THREE.Color;k.setRGB(0,0,0);for(var p=0;p<l.length;p++)n=h.vertexColors[l[p]-1],k.r+=n.r,k.g+=n.g,k.b+=n.b;k.r/=l.length;k.g/=l.length;k.b/=l.length;j.vertexColors[m]=k}}g.push(j);(!e.supportUVs||o.length!=0)&&f.push([o[a],o[b],o[c],o[d]])}function b(a,b){return Math.min(a,b)+"_"+Math.max(a,
+b)}var d=[],g=[],f=[],e=this,h=a.vertices,d=a.faces,i=h.concat(),j=[],k={},l={},o=[],n,t,q,r,p,s=a.faceVertexUvs[0];n=0;for(t=s.length;n<t;n++){q=0;for(r=s[n].length;q<r;q++)p=d[n]["abcd".charAt(q)],o[p]||(o[p]=s[n][q])}var m;n=0;for(t=d.length;n<t;n++)if(p=d[n],j.push(p.centroid),i.push(new THREE.Vertex(p.centroid)),e.supportUVs&&o.length!=0){m=new THREE.UV;if(p instanceof THREE.Face3)m.u=o[p.a].u+o[p.b].u+o[p.c].u,m.v=o[p.a].v+o[p.b].v+o[p.c].v,m.u/=3,m.v/=3;else if(p instanceof THREE.Face4)m.u=
+o[p.a].u+o[p.b].u+o[p.c].u+o[p.d].u,m.v=o[p.a].v+o[p.b].v+o[p.c].v+o[p.d].v,m.u/=4,m.v/=4;o.push(m)}t=function(a){function c(a,b,d){a[b]===void 0&&(a[b]=[]);a[b].push(d)}var d,e,f,h,g={};d=0;for(e=a.faces.length;d<e;d++)f=a.faces[d],f instanceof THREE.Face3?(h=b(f.a,f.b),c(g,h,d),h=b(f.b,f.c),c(g,h,d),h=b(f.c,f.a),c(g,h,d)):f instanceof THREE.Face4&&(h=b(f.a,f.b),c(g,h,d),h=b(f.b,f.c),c(g,h,d),h=b(f.c,f.d),c(g,h,d),h=b(f.d,f.a),c(g,h,d));return g}(a);var v=0,s=h.length,w,x,y={},C={},A=function(a,
+b){y[a]===void 0&&(y[a]=[]);y[a].push(b)},E=function(a,b){C[a]===void 0&&(C[a]={});C[a][b]=null};for(n in t){m=t[n];w=n.split("_");x=w[0];w=w[1];A(x,[x,w]);A(w,[x,w]);q=0;for(r=m.length;q<r;q++)p=m[q],E(x,p,n),E(w,p,n);m.length<2&&(l[n]=!0)}for(n in t)if(m=t[n],p=m[0],m=m[1],w=n.split("_"),x=w[0],w=w[1],r=new THREE.Vector3,l[n]?(r.addSelf(h[x].position),r.addSelf(h[w].position),r.multiplyScalar(0.5)):(r.addSelf(j[p]),r.addSelf(j[m]),r.addSelf(h[x].position),r.addSelf(h[w].position),r.multiplyScalar(0.25)),
+k[n]=s+d.length+v,i.push(new THREE.Vertex(r)),v++,e.supportUVs&&o.length!=0)m=new THREE.UV,m.u=o[x].u+o[w].u,m.v=o[x].v+o[w].v,m.u/=2,m.v/=2,o.push(m);var u,G;w=["123","12","2","23"];r=["123","23","3","31"];var A=["123","31","1","12"],E=["1234","12","2","23"],D=["1234","23","3","34"],H=["1234","34","4","41"],B=["1234","41","1","12"];n=0;for(t=j.length;n<t;n++)p=d[n],m=s+n,p instanceof THREE.Face3?(v=b(p.a,p.b),x=b(p.b,p.c),u=b(p.c,p.a),c(m,k[v],p.b,k[x],p,w),c(m,k[x],p.c,k[u],p,r),c(m,k[u],p.a,k[v],
+p,A)):p instanceof THREE.Face4?(v=b(p.a,p.b),x=b(p.b,p.c),u=b(p.c,p.d),G=b(p.d,p.a),c(m,k[v],p.b,k[x],p,E),c(m,k[x],p.c,k[u],p,D),c(m,k[u],p.d,k[G],p,H),c(m,k[G],p.a,k[v],p,B)):console.log("face should be a face!",p);d=i;i=new THREE.Vector3;k=new THREE.Vector3;n=0;for(t=h.length;n<t;n++)if(y[n]!==void 0){i.set(0,0,0);k.set(0,0,0);p=new THREE.Vector3(0,0,0);m=0;for(q in C[n])i.addSelf(j[q]),m++;v=0;s=y[n].length;for(q=0;q<s;q++)l[b(y[n][q][0],y[n][q][1])]&&v++;if(v!=2){i.divideScalar(m);for(q=0;q<
+s;q++)m=y[n][q],m=h[m[0]].position.clone().addSelf(h[m[1]].position).divideScalar(2),k.addSelf(m);k.divideScalar(s);p.addSelf(h[n].position);p.multiplyScalar(s-3);p.addSelf(i);p.addSelf(k.multiplyScalar(2));p.divideScalar(s);d[n].position=p}}a.vertices=d;a.faces=g;a.faceVertexUvs[0]=f;delete a.__tmpVertices;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals()};
 THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
 THREE.Loader.prototype={constructor:THREE.Loader,addStatusElement:function(){var a=document.createElement("div");a.style.position="absolute";a.style.right="0px";a.style.top="0px";a.style.fontSize="0.8em";a.style.textAlign="left";a.style.background="rgba(0,0,0,0.25)";a.style.color="#fff";a.style.width="120px";a.style.padding="0.5em 0.5em 0.5em 0.5em";a.style.zIndex=1E3;a.innerHTML="Loading ...";return a},updateProgress:function(a){var c="Loaded ";c+=a.total?(100*a.loaded/a.total).toFixed(0)+"%":(a.loaded/
 1E3).toFixed(2)+" KB";this.statusDomElement.innerHTML=c},extractUrlbase:function(a){a=a.split("/");a.pop();return a.length<1?"":a.join("/")+"/"},initMaterials:function(a,c,b){a.materials=[];for(var d=0;d<c.length;++d)a.materials[d]=THREE.Loader.prototype.createMaterial(c[d],b)},hasNormals:function(a){var c,b,d=a.materials.length;for(b=0;b<d;b++)if(c=a.materials[b],c instanceof THREE.ShaderMaterial)return!0;return!1},createMaterial:function(a,c){function b(a){a=Math.log(a)/Math.LN2;return Math.floor(a)==
-a}function d(a,c){var d=new Image;d.onload=function(){if(!b(this.width)||!b(this.height)){var c=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),d=Math.pow(2,Math.round(Math.log(this.height)/Math.LN2));a.image.width=c;a.image.height=d;a.image.getContext("2d").drawImage(this,0,0,c,d)}else a.image=this;a.needsUpdate=!0};d.src=c}function f(a,b,e,g,f,h){var i=document.createElement("canvas");a[b]=new THREE.Texture(i);a[b].sourceFile=e;if(g){a[b].repeat.set(g[0],g[1]);if(g[0]!=1)a[b].wrapS=THREE.RepeatWrapping;
-if(g[1]!=1)a[b].wrapT=THREE.RepeatWrapping}f&&a[b].offset.set(f[0],f[1]);if(h){g={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(g[h[0]]!==void 0)a[b].wrapS=g[h[0]];if(g[h[1]]!==void 0)a[b].wrapT=g[h[1]]}d(a[b],c+"/"+e)}function g(a){return(a[0]*255<<16)+(a[1]*255<<8)+a[2]*255}var e,h,i;h="MeshLambertMaterial";e={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:a.wireframe};a.shading&&(a.shading=="Phong"?h="MeshPhongMaterial":a.shading=="Basic"&&(h="MeshBasicMaterial"));
-if(a.blending)if(a.blending=="Additive")e.blending=THREE.AdditiveBlending;else if(a.blending=="Subtractive")e.blending=THREE.SubtractiveBlending;else if(a.blending=="Multiply")e.blending=THREE.MultiplyBlending;if(a.transparent!==void 0||a.opacity<1)e.transparent=a.transparent;if(a.depthTest!==void 0)e.depthTest=a.depthTest;if(a.vertexColors!==void 0)if(a.vertexColors=="face")e.vertexColors=THREE.FaceColors;else if(a.vertexColors)e.vertexColors=THREE.VertexColors;if(a.colorDiffuse)e.color=g(a.colorDiffuse);
-else if(a.DbgColor)e.color=a.DbgColor;if(a.colorSpecular)e.specular=g(a.colorSpecular);if(a.colorAmbient)e.ambient=g(a.colorAmbient);if(a.transparency)e.opacity=a.transparency;if(a.specularCoef)e.shininess=a.specularCoef;a.mapDiffuse&&c&&f(e,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap);a.mapLight&&c&&f(e,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap);a.mapNormal&&c&&f(e,"normalMap",a.mapNormal,a.mapNormalRepeat,a.mapNormalOffset,a.mapNormalWrap);
-a.mapSpecular&&c&&f(e,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){var j=THREE.ShaderUtils.lib.normal,k=THREE.UniformsUtils.clone(j.uniforms),m=e.color;h=e.specular;i=e.ambient;var o=e.shininess;k.tNormal.texture=e.normalMap;if(a.mapNormalFactor)k.uNormalScale.value=a.mapNormalFactor;if(e.map)k.tDiffuse.texture=e.map,k.enableDiffuse.value=!0;if(e.specularMap)k.tSpecular.texture=e.specularMap,k.enableSpecular.value=!0;if(e.lightMap)k.tAO.texture=
-e.lightMap,k.enableAO.value=!0;k.uDiffuseColor.value.setHex(m);k.uSpecularColor.value.setHex(h);k.uAmbientColor.value.setHex(i);k.uShininess.value=o;if(e.opacity)k.uOpacity.value=e.opacity;e=new THREE.ShaderMaterial({fragmentShader:j.fragmentShader,vertexShader:j.vertexShader,uniforms:k,lights:!0,fog:!0})}else e=new THREE[h](e);return e}};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;
-THREE.BinaryLoader.prototype.supr=THREE.Loader.prototype;
-THREE.BinaryLoader.prototype.load=function(a,c,b,d){if(a instanceof Object){console.warn("DEPRECATED: BinaryLoader( parameters ) is now BinaryLoader( url, callback, texturePath, binaryPath ).");var f=a,a=f.model,c=f.callback,b=f.texture_path,d=f.bin_path}var b=b?b:this.extractUrlbase(a),d=d?d:this.extractUrlbase(a),f=Date.now(),a=new Worker(a),g=this.showProgress?THREE.Loader.prototype.updateProgress:null;a.onmessage=function(a){THREE.BinaryLoader.prototype.loadAjaxBuffers(a.data.buffers,a.data.materials,
-c,d,b,g)};a.onerror=function(a){alert("worker.onerror: "+a.message+"\n"+a.data);a.preventDefault()};a.postMessage(f)};
-THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,c,b,d,f,g){var e=new XMLHttpRequest,h=d+"/"+a,i=0;e.onreadystatechange=function(){e.readyState==4?e.status==200||e.status==0?THREE.BinaryLoader.prototype.createBinModel(e.responseText,b,f,c):alert("Couldn't load ["+h+"] ["+e.status+"]"):e.readyState==3?g&&(i==0&&(i=e.getResponseHeader("Content-Length")),g({total:i,loaded:e.responseText.length})):e.readyState==2&&(i=e.getResponseHeader("Content-Length"))};e.open("GET",h,!0);e.overrideMimeType("text/plain; charset=x-user-defined");
-e.setRequestHeader("Content-Type","text/plain");e.send(null)};
-THREE.BinaryLoader.prototype.createBinModel=function(a,c,b,d){var f=function(b){function c(a,b){var d=k(a,b),e=k(a,b+1),g=k(a,b+2),f=k(a,b+3),h=(f<<1&255|g>>7)-127;d|=(g&127)<<16|e<<8;if(d==0&&h==-127)return 0;return(1-2*(f>>7))*(1+d*Math.pow(2,-23))*Math.pow(2,h)}function f(a,b){var c=k(a,b),d=k(a,b+1),e=k(a,b+2);return(k(a,b+3)<<24)+(e<<16)+(d<<8)+c}function i(a,b){var c=k(a,b);return(k(a,b+1)<<8)+c}function j(a,b){var c=k(a,b);return c>127?c-256:c}function k(a,b){return a.charCodeAt(b)&255}function m(b){var c,
-d,e;c=f(a,b);d=f(a,b+x);e=f(a,b+y);b=i(a,b+C);p.faces.push(new THREE.Face3(c,d,e,null,null,b))}function o(b){var c,d,e,g,j,k,m;c=f(a,b);d=f(a,b+x);e=f(a,b+y);g=i(a,b+C);j=f(a,b+A);k=f(a,b+E);m=f(a,b+u);var b=v[k*3],l=v[k*3+1];k=v[k*3+2];var n=v[m*3],o=v[m*3+1];m=v[m*3+2];p.faces.push(new THREE.Face3(c,d,e,[new THREE.Vector3(v[j*3],v[j*3+1],v[j*3+2]),new THREE.Vector3(b,l,k),new THREE.Vector3(n,o,m)],null,g))}function n(b){var c,d,e,g;c=f(a,b);d=f(a,b+G);e=f(a,b+D);g=f(a,b+H);b=i(a,b+B);p.faces.push(new THREE.Face4(c,
-d,e,g,null,null,b))}function t(b){var c,d,e,g,j,k,m,l,n;c=f(a,b);d=f(a,b+G);e=f(a,b+D);g=f(a,b+H);j=i(a,b+B);k=f(a,b+F);m=f(a,b+J);l=f(a,b+N);n=f(a,b+M);var b=v[m*3],o=v[m*3+1];m=v[m*3+2];var fa=v[l*3],ga=v[l*3+1];l=v[l*3+2];var ha=v[n*3],q=v[n*3+1];n=v[n*3+2];p.faces.push(new THREE.Face4(c,d,e,g,[new THREE.Vector3(v[k*3],v[k*3+1],v[k*3+2]),new THREE.Vector3(b,o,m),new THREE.Vector3(fa,ga,l),new THREE.Vector3(ha,q,n)],null,j))}function q(b){var c,d,e,g;c=f(a,b);d=f(a,b+O);e=f(a,b+z);b=w[c*2];g=w[c*
-2+1];c=w[d*2];var i=p.faceVertexUvs[0];d=w[d*2+1];var j=w[e*2];e=w[e*2+1];var k=[];k.push(new THREE.UV(b,g));k.push(new THREE.UV(c,d));k.push(new THREE.UV(j,e));i.push(k)}function r(b){var c,d,e,g,i,j;c=f(a,b);d=f(a,b+K);e=f(a,b+I);g=f(a,b+L);b=w[c*2];i=w[c*2+1];c=w[d*2];j=w[d*2+1];d=w[e*2];var k=p.faceVertexUvs[0];e=w[e*2+1];var m=w[g*2];g=w[g*2+1];var l=[];l.push(new THREE.UV(b,i));l.push(new THREE.UV(c,j));l.push(new THREE.UV(d,e));l.push(new THREE.UV(m,g));k.push(l)}var p=this,s=0,l,v=[],w=[],
-x,y,C,A,E,u,G,D,H,B,F,J,N,M,O,z,K,I,L,R,P,T,S,U,Q;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(p,d,b);l={signature:a.substr(s,8),header_bytes:k(a,s+8),vertex_coordinate_bytes:k(a,s+9),normal_coordinate_bytes:k(a,s+10),uv_coordinate_bytes:k(a,s+11),vertex_index_bytes:k(a,s+12),normal_index_bytes:k(a,s+13),uv_index_bytes:k(a,s+14),material_index_bytes:k(a,s+15),nvertices:f(a,s+16),nnormals:f(a,s+16+4),nuvs:f(a,s+16+8),ntri_flat:f(a,s+16+12),ntri_smooth:f(a,s+16+16),ntri_flat_uv:f(a,
-s+16+20),ntri_smooth_uv:f(a,s+16+24),nquad_flat:f(a,s+16+28),nquad_smooth:f(a,s+16+32),nquad_flat_uv:f(a,s+16+36),nquad_smooth_uv:f(a,s+16+40)};s+=l.header_bytes;x=l.vertex_index_bytes;y=l.vertex_index_bytes*2;C=l.vertex_index_bytes*3;A=l.vertex_index_bytes*3+l.material_index_bytes;E=l.vertex_index_bytes*3+l.material_index_bytes+l.normal_index_bytes;u=l.vertex_index_bytes*3+l.material_index_bytes+l.normal_index_bytes*2;G=l.vertex_index_bytes;D=l.vertex_index_bytes*2;H=l.vertex_index_bytes*3;B=l.vertex_index_bytes*
-4;F=l.vertex_index_bytes*4+l.material_index_bytes;J=l.vertex_index_bytes*4+l.material_index_bytes+l.normal_index_bytes;N=l.vertex_index_bytes*4+l.material_index_bytes+l.normal_index_bytes*2;M=l.vertex_index_bytes*4+l.material_index_bytes+l.normal_index_bytes*3;O=l.uv_index_bytes;z=l.uv_index_bytes*2;K=l.uv_index_bytes;I=l.uv_index_bytes*2;L=l.uv_index_bytes*3;b=l.vertex_index_bytes*3+l.material_index_bytes;Q=l.vertex_index_bytes*4+l.material_index_bytes;R=l.ntri_flat*b;P=l.ntri_smooth*(b+l.normal_index_bytes*
-3);T=l.ntri_flat_uv*(b+l.uv_index_bytes*3);S=l.ntri_smooth_uv*(b+l.normal_index_bytes*3+l.uv_index_bytes*3);U=l.nquad_flat*Q;b=l.nquad_smooth*(Q+l.normal_index_bytes*4);Q=l.nquad_flat_uv*(Q+l.uv_index_bytes*4);s+=function(b){for(var d,g,f,h=l.vertex_coordinate_bytes*3,i=b+l.nvertices*h;b<i;b+=h)d=c(a,b),g=c(a,b+l.vertex_coordinate_bytes),f=c(a,b+l.vertex_coordinate_bytes*2),p.vertices.push(new THREE.Vertex(new THREE.Vector3(d,g,f)));return l.nvertices*h}(s);s+=function(b){for(var c,d,e,g=l.normal_coordinate_bytes*
-3,f=b+l.nnormals*g;b<f;b+=g)c=j(a,b),d=j(a,b+l.normal_coordinate_bytes),e=j(a,b+l.normal_coordinate_bytes*2),v.push(c/127,d/127,e/127);return l.nnormals*g}(s);s+=function(b){for(var d,g,f=l.uv_coordinate_bytes*2,h=b+l.nuvs*f;b<h;b+=f)d=c(a,b),g=c(a,b+l.uv_coordinate_bytes),w.push(d,g);return l.nuvs*f}(s);R=s+R;P=R+P;T=P+T;S=T+S;U=S+U;b=U+b;Q=b+Q;(function(a){var b,c=l.vertex_index_bytes*3+l.material_index_bytes,d=c+l.uv_index_bytes*3,e=a+l.ntri_flat_uv*d;for(b=a;b<e;b+=d)m(b),q(b+c);return e-a})(P);
-(function(a){var b,c=l.vertex_index_bytes*3+l.material_index_bytes+l.normal_index_bytes*3,d=c+l.uv_index_bytes*3,e=a+l.ntri_smooth_uv*d;for(b=a;b<e;b+=d)o(b),q(b+c);return e-a})(T);(function(a){var b,c=l.vertex_index_bytes*4+l.material_index_bytes,d=c+l.uv_index_bytes*4,e=a+l.nquad_flat_uv*d;for(b=a;b<e;b+=d)n(b),r(b+c);return e-a})(b);(function(a){var b,c=l.vertex_index_bytes*4+l.material_index_bytes+l.normal_index_bytes*4,d=c+l.uv_index_bytes*4,e=a+l.nquad_smooth_uv*d;for(b=a;b<e;b+=d)t(b),r(b+
-c);return e-a})(Q);(function(a){var b,c=l.vertex_index_bytes*3+l.material_index_bytes,d=a+l.ntri_flat*c;for(b=a;b<d;b+=c)m(b);return d-a})(s);(function(a){var b,c=l.vertex_index_bytes*3+l.material_index_bytes+l.normal_index_bytes*3,d=a+l.ntri_smooth*c;for(b=a;b<d;b+=c)o(b);return d-a})(R);(function(a){var b,c=l.vertex_index_bytes*4+l.material_index_bytes,d=a+l.nquad_flat*c;for(b=a;b<d;b+=c)n(b);return d-a})(S);(function(a){var b,c=l.vertex_index_bytes*4+l.material_index_bytes+l.normal_index_bytes*
-4,d=a+l.nquad_smooth*c;for(b=a;b<d;b+=c)t(b);return d-a})(U);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};f.prototype=new THREE.Geometry;f.prototype.constructor=f;c(new f(b))};
-THREE.ColladaLoader=function(){function a(a,d,f){P=a;d=d||U;f!==void 0&&(a=f.split("/"),a.pop(),da=a.length<1?"":a.join("/")+"/");$=c("//dae:library_images/dae:image",e,"image");aa=c("//dae:library_materials/dae:material",C,"material");ba=c("//dae:library_effects/dae:effect",D,"effect");W=c("//dae:library_geometries/dae:geometry",r,"geometry");V=c("//dae:library_controllers/dae:controller",h,"controller");X=c("//dae:library_animations/dae:animation",B,"animation");ca=c(".//dae:library_visual_scenes/dae:visual_scene",
-k,"visual_scene");Y=[];Z=[];(a=P.evaluate(".//dae:scene/dae:instance_visual_scene",P,M,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(a=a.getAttribute("url").replace(/^#/,""),S=ca[a]):S=null;T=new THREE.Object3D;for(a=0;a<S.nodes.length;a++)T.add(g(S.nodes[a]));b();for(var i in X);i={scene:T,morphs:Y,skins:Z,dae:{images:$,materials:aa,effects:ba,geometries:W,controllers:V,animations:X,visualScenes:ca,scene:S}};d&&d(i);return i}function c(a,b,c){for(var a=P.evaluate(a,P,M,XPathResult.ORDERED_NODE_ITERATOR_TYPE,
-null),d={},e=a.iterateNext(),g=0;e;){e=(new b).parse(e);if(e.id.length==0)e.id=c+g++;d[e.id]=e;e=a.iterateNext()}return d}function b(){var a=1E6,b=-a,c=0,d;for(d in X)for(var e=X[d],g=0;g<e.sampler.length;g++){var f=e.sampler[g];f.create();a=Math.min(a,f.startTime);b=Math.max(b,f.endTime);c=Math.max(c,f.input.length)}return{start:a,end:b,frames:c}}function d(a,b,c,e){a.world=a.world||new THREE.Matrix4;a.world.copy(a.matrix);if(a.channels&&a.channels.length){var g=a.channels[0].sampler.output[c];g instanceof
-THREE.Matrix4&&a.world.copy(g)}e&&a.world.multiply(e,a.world);b.push(a);for(e=0;e<a.nodes.length;e++)d(a.nodes[e],b,c,a.world)}function f(a,c,e){var g=V[c.url];if(!g||!g.skin)console.log("ColladaLoader: Could not find skin controller.");else if(!c.skeleton||!c.skeleton.length)console.log("ColladaLoader: Could not find the skeleton for the skin. ");else{var f=b(),c=S.getChildById(c.skeleton[0],!0)||S.getChildBySid(c.skeleton[0],!0),h,i,j,k,m=new THREE.Vector3,l;for(h=0;h<a.vertices.length;h++)g.skin.bindShapeMatrix.multiplyVector3(a.vertices[h].position);
-for(e=0;e<f.frames;e++){var n=[],o=[];for(h=0;h<a.vertices.length;h++)o.push(new THREE.Vertex(new THREE.Vector3));d(c,n,e);h=n;i=g.skin;for(k=0;k<h.length;k++)if(j=h[k],l=-1,j.type=="JOINT"){for(var p=0;p<i.joints.length;p++)if(j.sid==i.joints[p]){l=p;break}if(l>=0){p=i.invBindMatrices[l];j.invBindMatrix=p;j.skinningMatrix=new THREE.Matrix4;j.skinningMatrix.multiply(j.world,p);j.weights=[];for(p=0;p<i.weights.length;p++)for(var q=0;q<i.weights[p].length;q++){var r=i.weights[p][q];r.joint==l&&j.weights.push(r)}}else throw"ColladaLoader: Could not find joint '"+
-j.sid+"'.";}for(h=0;h<n.length;h++)if(n[h].type=="JOINT")for(i=0;i<n[h].weights.length;i++)j=n[h].weights[i],k=j.index,j=j.weight,l=a.vertices[k],k=o[k],m.x=l.position.x,m.y=l.position.y,m.z=l.position.z,n[h].skinningMatrix.multiplyVector3(m),k.position.x+=m.x*j,k.position.y+=m.y*j,k.position.z+=m.z*j;a.morphTargets.push({name:"target_"+e,vertices:o})}}}function g(a){var b=new THREE.Object3D,c,d,e,h;for(e=0;e<a.controllers.length;e++){var i=V[a.controllers[e].url];switch(i.type){case "skin":if(W[i.skin.source]){var j=
+a}function d(a,c){var d=new Image;d.onload=function(){if(!b(this.width)||!b(this.height)){var c=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),d=Math.pow(2,Math.round(Math.log(this.height)/Math.LN2));a.image.width=c;a.image.height=d;a.image.getContext("2d").drawImage(this,0,0,c,d)}else a.image=this;a.needsUpdate=!0};d.src=c}function g(a,b,e,f,h,g){var i=document.createElement("canvas");a[b]=new THREE.Texture(i);a[b].sourceFile=e;if(f){a[b].repeat.set(f[0],f[1]);if(f[0]!=1)a[b].wrapS=THREE.RepeatWrapping;
+if(f[1]!=1)a[b].wrapT=THREE.RepeatWrapping}h&&a[b].offset.set(h[0],h[1]);if(g){f={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(f[g[0]]!==void 0)a[b].wrapS=f[g[0]];if(f[g[1]]!==void 0)a[b].wrapT=f[g[1]]}d(a[b],c+"/"+e)}function f(a){return(a[0]*255<<16)+(a[1]*255<<8)+a[2]*255}var e,h,i;h="MeshLambertMaterial";e={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:a.wireframe};a.shading&&(a.shading=="Phong"?h="MeshPhongMaterial":a.shading=="Basic"&&(h="MeshBasicMaterial"));
+if(a.blending)if(a.blending=="Additive")e.blending=THREE.AdditiveBlending;else if(a.blending=="Subtractive")e.blending=THREE.SubtractiveBlending;else if(a.blending=="Multiply")e.blending=THREE.MultiplyBlending;if(a.transparent!==void 0||a.opacity<1)e.transparent=a.transparent;if(a.depthTest!==void 0)e.depthTest=a.depthTest;if(a.vertexColors!==void 0)if(a.vertexColors=="face")e.vertexColors=THREE.FaceColors;else if(a.vertexColors)e.vertexColors=THREE.VertexColors;if(a.colorDiffuse)e.color=f(a.colorDiffuse);
+else if(a.DbgColor)e.color=a.DbgColor;if(a.colorSpecular)e.specular=f(a.colorSpecular);if(a.colorAmbient)e.ambient=f(a.colorAmbient);if(a.transparency)e.opacity=a.transparency;if(a.specularCoef)e.shininess=a.specularCoef;a.mapDiffuse&&c&&g(e,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap);a.mapLight&&c&&g(e,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap);a.mapNormal&&c&&g(e,"normalMap",a.mapNormal,a.mapNormalRepeat,a.mapNormalOffset,a.mapNormalWrap);
+a.mapSpecular&&c&&g(e,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){var j=THREE.ShaderUtils.lib.normal,k=THREE.UniformsUtils.clone(j.uniforms),l=e.color;h=e.specular;i=e.ambient;var o=e.shininess;k.tNormal.texture=e.normalMap;if(a.mapNormalFactor)k.uNormalScale.value=a.mapNormalFactor;if(e.map)k.tDiffuse.texture=e.map,k.enableDiffuse.value=!0;if(e.specularMap)k.tSpecular.texture=e.specularMap,k.enableSpecular.value=!0;if(e.lightMap)k.tAO.texture=
+e.lightMap,k.enableAO.value=!0;k.uDiffuseColor.value.setHex(l);k.uSpecularColor.value.setHex(h);k.uAmbientColor.value.setHex(i);k.uShininess.value=o;if(e.opacity)k.uOpacity.value=e.opacity;e=new THREE.ShaderMaterial({fragmentShader:j.fragmentShader,vertexShader:j.vertexShader,uniforms:k,lights:!0,fog:!0})}else e=new THREE[h](e);return e}};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;
+THREE.BinaryLoader.prototype.supr=THREE.Loader.prototype;THREE.BinaryLoader.prototype.load=function(a,c,b,d){if(a instanceof Object)console.warn("DEPRECATED: BinaryLoader( parameters ) is now BinaryLoader( url, callback, texturePath, binaryPath )."),d=a,a=d.model,c=d.callback,b=d.texture_path,d=d.bin_path;var b=b?b:this.extractUrlbase(a),d=d?d:this.extractUrlbase(a),g=this.showProgress?THREE.Loader.prototype.updateProgress:null;this.onLoadStart();this.loadAjaxJSON(this,a,c,b,d,g)};
+THREE.BinaryLoader.prototype.loadAjaxJSON=function(a,c,b,d,g,f){var e=new XMLHttpRequest;e.onreadystatechange=function(){if(e.readyState==4)if(e.status==200||e.status==0)try{var h=JSON.parse(e.responseText);h.metadata===void 0||h.metadata.formatVersion===void 0||h.metadata.formatVersion!==3?console.error("Deprecated file format."):a.loadAjaxBuffers(h,b,g,d,f)}catch(i){console.error(i),console.warn("DEPRECATED: ["+c+"] seems to be using old model format")}else console.error("Couldn't load ["+c+"] ["+
+e.status+"]")};e.open("GET",c,!0);e.overrideMimeType("text/plain; charset=x-user-defined");e.setRequestHeader("Content-Type","text/plain");e.send(null)};
+THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,c,b,d,g){var f=new XMLHttpRequest,e=b+"/"+a.buffers,h=0;f.onreadystatechange=function(){f.readyState==4?f.status==200||f.status==0?THREE.BinaryLoader.prototype.createBinModel(f.responseText,c,d,a.materials):console.error("Couldn't load ["+e+"] ["+f.status+"]"):f.readyState==3?g&&(h==0&&(h=f.getResponseHeader("Content-Length")),g({total:h,loaded:f.responseText.length})):f.readyState==2&&(h=f.getResponseHeader("Content-Length"))};f.open("GET",
+e,!0);f.overrideMimeType("text/plain; charset=x-user-defined");f.setRequestHeader("Content-Type","text/plain");f.send(null)};
+THREE.BinaryLoader.prototype.createBinModel=function(a,c,b,d){var g=function(b){function c(a,b){var d=k(a,b),e=k(a,b+1),f=k(a,b+2),g=k(a,b+3),h=(g<<1&255|f>>7)-127;d|=(f&127)<<16|e<<8;if(d==0&&h==-127)return 0;return(1-2*(g>>7))*(1+d*Math.pow(2,-23))*Math.pow(2,h)}function h(a,b){var c=k(a,b),d=k(a,b+1),e=k(a,b+2);return(k(a,b+3)<<24)+(e<<16)+(d<<8)+c}function g(a,b){var c=k(a,b);return(k(a,b+1)<<8)+c}function j(a,b){var c=k(a,b);return c>127?c-256:c}function k(a,b){return a.charCodeAt(b)&255}function l(b){var c,
+d,e;c=h(a,b);d=h(a,b+x);e=h(a,b+y);b=g(a,b+C);p.faces.push(new THREE.Face3(c,d,e,null,null,b))}function o(b){var c,d,e,f,j,k,l;c=h(a,b);d=h(a,b+x);e=h(a,b+y);f=g(a,b+C);j=h(a,b+A);k=h(a,b+E);l=h(a,b+u);var b=v[k*3],m=v[k*3+1];k=v[k*3+2];var n=v[l*3],o=v[l*3+1];l=v[l*3+2];p.faces.push(new THREE.Face3(c,d,e,[new THREE.Vector3(v[j*3],v[j*3+1],v[j*3+2]),new THREE.Vector3(b,m,k),new THREE.Vector3(n,o,l)],null,f))}function n(b){var c,d,e,f;c=h(a,b);d=h(a,b+G);e=h(a,b+D);f=h(a,b+H);b=g(a,b+B);p.faces.push(new THREE.Face4(c,
+d,e,f,null,null,b))}function t(b){var c,d,e,f,j,k,l,m,n;c=h(a,b);d=h(a,b+G);e=h(a,b+D);f=h(a,b+H);j=g(a,b+B);k=h(a,b+F);l=h(a,b+J);m=h(a,b+N);n=h(a,b+M);var b=v[l*3],o=v[l*3+1];l=v[l*3+2];var fa=v[m*3],ga=v[m*3+1];m=v[m*3+2];var ha=v[n*3],q=v[n*3+1];n=v[n*3+2];p.faces.push(new THREE.Face4(c,d,e,f,[new THREE.Vector3(v[k*3],v[k*3+1],v[k*3+2]),new THREE.Vector3(b,o,l),new THREE.Vector3(fa,ga,m),new THREE.Vector3(ha,q,n)],null,j))}function q(b){var c,d,e,f;c=h(a,b);d=h(a,b+O);e=h(a,b+z);b=w[c*2];f=w[c*
+2+1];c=w[d*2];var g=p.faceVertexUvs[0];d=w[d*2+1];var i=w[e*2];e=w[e*2+1];var j=[];j.push(new THREE.UV(b,f));j.push(new THREE.UV(c,d));j.push(new THREE.UV(i,e));g.push(j)}function r(b){var c,d,e,f,g,i;c=h(a,b);d=h(a,b+K);e=h(a,b+I);f=h(a,b+L);b=w[c*2];g=w[c*2+1];c=w[d*2];i=w[d*2+1];d=w[e*2];var j=p.faceVertexUvs[0];e=w[e*2+1];var k=w[f*2];f=w[f*2+1];var l=[];l.push(new THREE.UV(b,g));l.push(new THREE.UV(c,i));l.push(new THREE.UV(d,e));l.push(new THREE.UV(k,f));j.push(l)}var p=this,s=0,m,v=[],w=[],
+x,y,C,A,E,u,G,D,H,B,F,J,N,M,O,z,K,I,L,R,P,T,S,U,Q;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(p,d,b);m={signature:a.substr(s,8),header_bytes:k(a,s+8),vertex_coordinate_bytes:k(a,s+9),normal_coordinate_bytes:k(a,s+10),uv_coordinate_bytes:k(a,s+11),vertex_index_bytes:k(a,s+12),normal_index_bytes:k(a,s+13),uv_index_bytes:k(a,s+14),material_index_bytes:k(a,s+15),nvertices:h(a,s+16),nnormals:h(a,s+16+4),nuvs:h(a,s+16+8),ntri_flat:h(a,s+16+12),ntri_smooth:h(a,s+16+16),ntri_flat_uv:h(a,
+s+16+20),ntri_smooth_uv:h(a,s+16+24),nquad_flat:h(a,s+16+28),nquad_smooth:h(a,s+16+32),nquad_flat_uv:h(a,s+16+36),nquad_smooth_uv:h(a,s+16+40)};s+=m.header_bytes;x=m.vertex_index_bytes;y=m.vertex_index_bytes*2;C=m.vertex_index_bytes*3;A=m.vertex_index_bytes*3+m.material_index_bytes;E=m.vertex_index_bytes*3+m.material_index_bytes+m.normal_index_bytes;u=m.vertex_index_bytes*3+m.material_index_bytes+m.normal_index_bytes*2;G=m.vertex_index_bytes;D=m.vertex_index_bytes*2;H=m.vertex_index_bytes*3;B=m.vertex_index_bytes*
+4;F=m.vertex_index_bytes*4+m.material_index_bytes;J=m.vertex_index_bytes*4+m.material_index_bytes+m.normal_index_bytes;N=m.vertex_index_bytes*4+m.material_index_bytes+m.normal_index_bytes*2;M=m.vertex_index_bytes*4+m.material_index_bytes+m.normal_index_bytes*3;O=m.uv_index_bytes;z=m.uv_index_bytes*2;K=m.uv_index_bytes;I=m.uv_index_bytes*2;L=m.uv_index_bytes*3;b=m.vertex_index_bytes*3+m.material_index_bytes;Q=m.vertex_index_bytes*4+m.material_index_bytes;R=m.ntri_flat*b;P=m.ntri_smooth*(b+m.normal_index_bytes*
+3);T=m.ntri_flat_uv*(b+m.uv_index_bytes*3);S=m.ntri_smooth_uv*(b+m.normal_index_bytes*3+m.uv_index_bytes*3);U=m.nquad_flat*Q;b=m.nquad_smooth*(Q+m.normal_index_bytes*4);Q=m.nquad_flat_uv*(Q+m.uv_index_bytes*4);s+=function(b){for(var d,f,g,h=m.vertex_coordinate_bytes*3,i=b+m.nvertices*h;b<i;b+=h)d=c(a,b),f=c(a,b+m.vertex_coordinate_bytes),g=c(a,b+m.vertex_coordinate_bytes*2),p.vertices.push(new THREE.Vertex(new THREE.Vector3(d,f,g)));return m.nvertices*h}(s);s+=function(b){for(var c,d,e,f=m.normal_coordinate_bytes*
+3,g=b+m.nnormals*f;b<g;b+=f)c=j(a,b),d=j(a,b+m.normal_coordinate_bytes),e=j(a,b+m.normal_coordinate_bytes*2),v.push(c/127,d/127,e/127);return m.nnormals*f}(s);s+=function(b){for(var d,f,g=m.uv_coordinate_bytes*2,h=b+m.nuvs*g;b<h;b+=g)d=c(a,b),f=c(a,b+m.uv_coordinate_bytes),w.push(d,f);return m.nuvs*g}(s);R=s+R;P=R+P;T=P+T;S=T+S;U=S+U;b=U+b;Q=b+Q;(function(a){var b,c=m.vertex_index_bytes*3+m.material_index_bytes,d=c+m.uv_index_bytes*3,e=a+m.ntri_flat_uv*d;for(b=a;b<e;b+=d)l(b),q(b+c);return e-a})(P);
+(function(a){var b,c=m.vertex_index_bytes*3+m.material_index_bytes+m.normal_index_bytes*3,d=c+m.uv_index_bytes*3,e=a+m.ntri_smooth_uv*d;for(b=a;b<e;b+=d)o(b),q(b+c);return e-a})(T);(function(a){var b,c=m.vertex_index_bytes*4+m.material_index_bytes,d=c+m.uv_index_bytes*4,e=a+m.nquad_flat_uv*d;for(b=a;b<e;b+=d)n(b),r(b+c);return e-a})(b);(function(a){var b,c=m.vertex_index_bytes*4+m.material_index_bytes+m.normal_index_bytes*4,d=c+m.uv_index_bytes*4,e=a+m.nquad_smooth_uv*d;for(b=a;b<e;b+=d)t(b),r(b+
+c);return e-a})(Q);(function(a){var b,c=m.vertex_index_bytes*3+m.material_index_bytes,d=a+m.ntri_flat*c;for(b=a;b<d;b+=c)l(b);return d-a})(s);(function(a){var b,c=m.vertex_index_bytes*3+m.material_index_bytes+m.normal_index_bytes*3,d=a+m.ntri_smooth*c;for(b=a;b<d;b+=c)o(b);return d-a})(R);(function(a){var b,c=m.vertex_index_bytes*4+m.material_index_bytes,d=a+m.nquad_flat*c;for(b=a;b<d;b+=c)n(b);return d-a})(S);(function(a){var b,c=m.vertex_index_bytes*4+m.material_index_bytes+m.normal_index_bytes*
+4,d=a+m.nquad_smooth*c;for(b=a;b<d;b+=c)t(b);return d-a})(U);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};g.prototype=new THREE.Geometry;g.prototype.constructor=g;c(new g(b))};
+THREE.ColladaLoader=function(){function a(a,d,g){P=a;d=d||U;g!==void 0&&(a=g.split("/"),a.pop(),da=a.length<1?"":a.join("/")+"/");$=c("//dae:library_images/dae:image",e,"image");aa=c("//dae:library_materials/dae:material",C,"material");ba=c("//dae:library_effects/dae:effect",D,"effect");W=c("//dae:library_geometries/dae:geometry",r,"geometry");V=c("//dae:library_controllers/dae:controller",h,"controller");X=c("//dae:library_animations/dae:animation",B,"animation");ca=c(".//dae:library_visual_scenes/dae:visual_scene",
+k,"visual_scene");Y=[];Z=[];(a=P.evaluate(".//dae:scene/dae:instance_visual_scene",P,M,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(a=a.getAttribute("url").replace(/^#/,""),S=ca[a]):S=null;T=new THREE.Object3D;for(a=0;a<S.nodes.length;a++)T.add(f(S.nodes[a]));b();for(var i in X);i={scene:T,morphs:Y,skins:Z,dae:{images:$,materials:aa,effects:ba,geometries:W,controllers:V,animations:X,visualScenes:ca,scene:S}};d&&d(i);return i}function c(a,b,c){for(var a=P.evaluate(a,P,M,XPathResult.ORDERED_NODE_ITERATOR_TYPE,
+null),d={},e=a.iterateNext(),f=0;e;){e=(new b).parse(e);if(e.id.length==0)e.id=c+f++;d[e.id]=e;e=a.iterateNext()}return d}function b(){var a=1E6,b=-a,c=0,d;for(d in X)for(var e=X[d],f=0;f<e.sampler.length;f++){var g=e.sampler[f];g.create();a=Math.min(a,g.startTime);b=Math.max(b,g.endTime);c=Math.max(c,g.input.length)}return{start:a,end:b,frames:c}}function d(a,b,c,e){a.world=a.world||new THREE.Matrix4;a.world.copy(a.matrix);if(a.channels&&a.channels.length){var f=a.channels[0].sampler.output[c];f instanceof
+THREE.Matrix4&&a.world.copy(f)}e&&a.world.multiply(e,a.world);b.push(a);for(e=0;e<a.nodes.length;e++)d(a.nodes[e],b,c,a.world)}function g(a,c,e){var f=V[c.url];if(!f||!f.skin)console.log("ColladaLoader: Could not find skin controller.");else if(!c.skeleton||!c.skeleton.length)console.log("ColladaLoader: Could not find the skeleton for the skin. ");else{var g=b(),c=S.getChildById(c.skeleton[0],!0)||S.getChildBySid(c.skeleton[0],!0),h,i,j,k,l=new THREE.Vector3,m;for(h=0;h<a.vertices.length;h++)f.skin.bindShapeMatrix.multiplyVector3(a.vertices[h].position);
+for(e=0;e<g.frames;e++){var n=[],o=[];for(h=0;h<a.vertices.length;h++)o.push(new THREE.Vertex(new THREE.Vector3));d(c,n,e);h=n;i=f.skin;for(k=0;k<h.length;k++)if(j=h[k],m=-1,j.type=="JOINT"){for(var p=0;p<i.joints.length;p++)if(j.sid==i.joints[p]){m=p;break}if(m>=0){p=i.invBindMatrices[m];j.invBindMatrix=p;j.skinningMatrix=new THREE.Matrix4;j.skinningMatrix.multiply(j.world,p);j.weights=[];for(p=0;p<i.weights.length;p++)for(var q=0;q<i.weights[p].length;q++){var r=i.weights[p][q];r.joint==m&&j.weights.push(r)}}else throw"ColladaLoader: Could not find joint '"+
+j.sid+"'.";}for(h=0;h<n.length;h++)if(n[h].type=="JOINT")for(i=0;i<n[h].weights.length;i++)j=n[h].weights[i],k=j.index,j=j.weight,m=a.vertices[k],k=o[k],l.x=m.position.x,l.y=m.position.y,l.z=m.position.z,n[h].skinningMatrix.multiplyVector3(l),k.position.x+=l.x*j,k.position.y+=l.y*j,k.position.z+=l.z*j;a.morphTargets.push({name:"target_"+e,vertices:o})}}}function f(a){var b=new THREE.Object3D,c,d,e,h;for(e=0;e<a.controllers.length;e++){var i=V[a.controllers[e].url];switch(i.type){case "skin":if(W[i.skin.source]){var j=
 new q;j.url=i.skin.source;j.instance_material=a.controllers[e].instance_material;a.geometries.push(j);c=a.controllers[e]}else if(V[i.skin.source]&&(d=i=V[i.skin.source],i.morph&&W[i.morph.source]))j=new q,j.url=i.morph.source,j.instance_material=a.controllers[e].instance_material,a.geometries.push(j);break;case "morph":if(W[i.morph.source])j=new q,j.url=i.morph.source,j.instance_material=a.controllers[e].instance_material,a.geometries.push(j),d=a.controllers[e];console.log("ColladaLoader: Morph-controller partially supported.")}}for(e=
-0;e<a.geometries.length;e++){var i=a.geometries[e],j=i.instance_material,i=W[i.url],k={},m=0,l;if(i&&i.mesh&&i.mesh.primitives){if(b.name.length==0)b.name=i.id;if(j)for(h=0;h<j.length;h++){l=j[h];var o=ba[aa[l.target].instance_effect.url].shader;o.material.opacity=!o.material.opacity?1:o.material.opacity;l=k[l.symbol]=o.material;m++}j=l||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});i=i.mesh.geometry3js;if(m>1){j=new THREE.MeshFaceMaterial;for(h=0;h<i.faces.length;h++)m=
-i.faces[h],m.materials=[k[m.daeMaterial]]}if(c!==void 0)f(i,c),j.morphTargets=!0,j=new THREE.SkinnedMesh(i,j),j.skeleton=c.skeleton,j.skinController=V[c.url],j.skinInstanceController=c,j.name="skin_"+Z.length,Z.push(j);else if(d!==void 0){h=i;k=d instanceof n?V[d.url]:d;if(!k||!k.morph)console.log("could not find morph controller!");else{k=k.morph;for(m=0;m<k.targets.length;m++)if(o=W[k.targets[m]],o.mesh&&o.mesh.primitives&&o.mesh.primitives.length)o=o.mesh.primitives[0].geometry,o.vertices.length===
-h.vertices.length&&h.morphTargets.push({name:"target_1",vertices:o.vertices});h.morphTargets.push({name:"target_Z",vertices:h.vertices})}j.morphTargets=!0;j=new THREE.Mesh(i,j);j.name="morph_"+Y.length;Y.push(j)}else j=new THREE.Mesh(i,j);a.geometries.length>1?b.add(j):b=j}}b.name=a.id||"";a.matrix.decompose(b.position,b.rotation,b.scale);for(e=0;e<a.nodes.length;e++)b.add(g(a.nodes[e],a));return b}function e(){this.init_from=this.id=""}function h(){this.type=this.name=this.id="";this.morph=this.skin=
-null}function i(){this.weights=this.targets=this.source=this.method=null}function j(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function k(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function m(){this.sid=this.name=this.id="";this.nodes=[];this.controllers=[];this.transforms=[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function o(){this.type=this.sid="";this.data=[];this.matrix=new THREE.Matrix4}function n(){this.url=
-"";this.skeleton=[];this.instance_material=[]}function t(){this.target=this.symbol=""}function q(){this.url="";this.instance_material=[]}function r(){this.id="";this.mesh=null}function p(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function s(){}function l(){this.material="";this.count=0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function v(){this.source="";this.stride=this.count=0;this.params=[]}function w(){this.input={}}function x(){this.semantic=
+0;e<a.geometries.length;e++){var i=a.geometries[e],j=i.instance_material,i=W[i.url],k={},l=0,m;if(i&&i.mesh&&i.mesh.primitives){if(b.name.length==0)b.name=i.id;if(j)for(h=0;h<j.length;h++){m=j[h];var o=ba[aa[m.target].instance_effect.url].shader;o.material.opacity=!o.material.opacity?1:o.material.opacity;m=k[m.symbol]=o.material;l++}j=m||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});i=i.mesh.geometry3js;if(l>1){j=new THREE.MeshFaceMaterial;for(h=0;h<i.faces.length;h++)l=
+i.faces[h],l.materials=[k[l.daeMaterial]]}if(c!==void 0)g(i,c),j.morphTargets=!0,j=new THREE.SkinnedMesh(i,j),j.skeleton=c.skeleton,j.skinController=V[c.url],j.skinInstanceController=c,j.name="skin_"+Z.length,Z.push(j);else if(d!==void 0){h=i;k=d instanceof n?V[d.url]:d;if(!k||!k.morph)console.log("could not find morph controller!");else{k=k.morph;for(l=0;l<k.targets.length;l++)if(o=W[k.targets[l]],o.mesh&&o.mesh.primitives&&o.mesh.primitives.length)o=o.mesh.primitives[0].geometry,o.vertices.length===
+h.vertices.length&&h.morphTargets.push({name:"target_1",vertices:o.vertices});h.morphTargets.push({name:"target_Z",vertices:h.vertices})}j.morphTargets=!0;j=new THREE.Mesh(i,j);j.name="morph_"+Y.length;Y.push(j)}else j=new THREE.Mesh(i,j);a.geometries.length>1?b.add(j):b=j}}b.name=a.id||"";a.matrix.decompose(b.position,b.rotation,b.scale);for(e=0;e<a.nodes.length;e++)b.add(f(a.nodes[e],a));return b}function e(){this.init_from=this.id=""}function h(){this.type=this.name=this.id="";this.morph=this.skin=
+null}function i(){this.weights=this.targets=this.source=this.method=null}function j(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function k(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function l(){this.sid=this.name=this.id="";this.nodes=[];this.controllers=[];this.transforms=[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function o(){this.type=this.sid="";this.data=[];this.matrix=new THREE.Matrix4}function n(){this.url=
+"";this.skeleton=[];this.instance_material=[]}function t(){this.target=this.symbol=""}function q(){this.url="";this.instance_material=[]}function r(){this.id="";this.mesh=null}function p(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function s(){}function m(){this.material="";this.count=0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function v(){this.source="";this.stride=this.count=0;this.params=[]}function w(){this.input={}}function x(){this.semantic=
 "";this.offset=0;this.source="";this.set=0}function y(a){this.id=a;this.type=null}function C(){this.name=this.id="";this.instance_effect=null}function A(){this.color=new THREE.Color(0);this.color.setRGB(Math.random(),Math.random(),Math.random());this.color.a=1;this.texcoord=this.texture=null}function E(a,b){this.type=a;this.effect=b;this.material=null}function u(a){this.effect=a;this.format=this.init_from=null}function G(a){this.effect=a;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=
 this.source=null}function D(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function H(){this.url=""}function B(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function F(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=this.dotSyntax=this.sid=null}function J(a){this.id="";this.animation=a;this.inputs=[];this.endTime=this.startTime=this.interpolation=this.output=this.input=null;this.duration=0}function N(a){var b=a.getAttribute("id");
 if(Q[b]!=void 0)return Q[b];Q[b]=(new y(b)).parse(a);return Q[b]}function M(a){if(a=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function O(a){for(var a=K(a).split(/\s+/),b=[],c=0;c<a.length;c++)b.push(parseFloat(a[c]));return b}function z(a){for(var a=K(a).split(/\s+/),b=[],c=0;c<a.length;c++)b.push(parseInt(a[c],10));return b}function K(a){return a.replace(/^\s+/,"").replace(/\s+$/,"")}function I(a,b,c){return a.hasAttribute(b)?parseInt(a.getAttribute(b),10):c}function L(a,
 b){if(a===void 0){for(var c="0.";c.length<b+2;)c+="0";return c}b=b||2;c=a.toString().split(".");for(c[1]=c.length>1?c[1].substr(0,b):"0";c[1].length<b;)c[1]+="0";return c.join(".")}function R(a,b){var c="";c+=L(a.x,b)+",";c+=L(a.y,b)+",";c+=L(a.z,b);return c}var P=null,T=null,S,U=null,Q={},$={},X={},V={},W={},aa={},ba={},ca,da,Y,Z,ea=THREE.SmoothShading;e.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName=="init_from")this.init_from=
 c.textContent}return this};h.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.type="none";for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "skin":this.skin=(new j).parse(c);this.type=c.nodeName;break;case "morph":this.morph=(new i).parse(c),this.type=c.nodeName}}return this};i.prototype.parse=function(a){var b={},c=[],d;this.method=a.getAttribute("method");this.source=a.getAttribute("source").replace(/^#/,"");for(d=
 0;d<a.childNodes.length;d++){var e=a.childNodes[d];if(e.nodeType==1)switch(e.nodeName){case "source":e=(new y).parse(e);b[e.id]=e;break;case "targets":c=this.parseInputs(e);break;default:console.log(e.nodeName)}}for(d=0;d<c.length;d++)switch(a=c[d],e=b[a.source],a.semantic){case "MORPH_TARGET":this.targets=e.read();break;case "MORPH_WEIGHT":this.weights=e.read()}return this};i.prototype.parseInputs=function(a){for(var b=[],c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "input":b.push((new x).parse(d))}}return b};
-j.prototype.parse=function(a){var b={},c,d;this.source=a.getAttribute("source").replace(/^#/,"");this.invBindMatrices=[];this.joints=[];this.weights=[];for(var e=0;e<a.childNodes.length;e++){var g=a.childNodes[e];if(g.nodeType==1)switch(g.nodeName){case "bind_shape_matrix":g=O(g.textContent);this.bindShapeMatrix=new THREE.Matrix4;this.bindShapeMatrix.set(g[0],g[1],g[2],g[3],g[4],g[5],g[6],g[7],g[8],g[9],g[10],g[11],g[12],g[13],g[14],g[15]);break;case "source":g=(new y).parse(g);b[g.id]=g;break;case "joints":c=
-g;break;case "vertex_weights":d=g;break;default:console.log(g.nodeName)}}this.parseJoints(c,b);this.parseWeights(d,b);return this};j.prototype.parseJoints=function(a,b){for(var c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "input":var d=(new x).parse(d),e=b[d.source];if(d.semantic=="JOINT")this.joints=e.read();else if(d.semantic=="INV_BIND_MATRIX")this.invBindMatrices=e.read()}}};j.prototype.parseWeights=function(a,b){for(var c,d,e=[],g=0;g<a.childNodes.length;g++){var f=
-a.childNodes[g];if(f.nodeType==1)switch(f.nodeName){case "input":e.push((new x).parse(f));break;case "v":c=z(f.textContent);break;case "vcount":d=z(f.textContent)}}for(g=f=0;g<d.length;g++){for(var h=d[g],i=[],j=0;j<h;j++){for(var k={},m=0;m<e.length;m++){var l=e[m],n=c[f+l.offset];switch(l.semantic){case "JOINT":k.joint=n;break;case "WEIGHT":k.weight=b[l.source].data[n]}}i.push(k);f+=e.length}for(j=0;j<i.length;j++)i[j].index=g;this.weights.push(i)}};k.prototype.getChildById=function(a,b){for(var c=
-0;c<this.nodes.length;c++){var d=this.nodes[c].getChildById(a,b);if(d)return d}return null};k.prototype.getChildBySid=function(a,b){for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildBySid(a,b);if(d)return d}return null};k.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.nodes=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "node":this.nodes.push((new m).parse(c))}}return this};m.prototype.getChannelForTransform=
-function(a){for(var b=0;b<this.channels.length;b++){var c=this.channels[b],d=c.target.split("/");d.shift();var e=d.shift(),g=e.indexOf(".")>=0,f=e.indexOf("(")>=0,h;if(g)d=e.split("."),e=d.shift(),d.shift();else if(f){h=e.split("(");e=h.shift();for(d=0;d<h.length;d++)h[d]=parseInt(h[d].replace(/\)/,""))}if(e==a)return c.info={sid:e,dotSyntax:g,arrSyntax:f,arrIndices:h},c}return null};m.prototype.getChildById=function(a,b){if(this.id==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildById(a,
-b);if(d)return d}return null};m.prototype.getChildBySid=function(a,b){if(this.sid==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildBySid(a,b);if(d)return d}return null};m.prototype.getTransformBySid=function(a){for(var b=0;b<this.transforms.length;b++)if(this.transforms[b].sid==a)return this.transforms[b];return null};m.prototype.parse=function(a){var b;this.id=a.getAttribute("id");this.sid=a.getAttribute("sid");this.name=a.getAttribute("name");this.type=a.getAttribute("type");
-this.type=this.type=="JOINT"?this.type:"NODE";this.nodes=[];this.transforms=[];this.geometries=[];this.controllers=[];this.matrix=new THREE.Matrix4;for(var c=0;c<a.childNodes.length;c++)if(b=a.childNodes[c],b.nodeType==1)switch(b.nodeName){case "node":this.nodes.push((new m).parse(b));break;case "instance_camera":break;case "instance_controller":this.controllers.push((new n).parse(b));break;case "instance_geometry":this.geometries.push((new q).parse(b));break;case "instance_light":break;case "instance_node":b=
-b.getAttribute("url").replace(/^#/,"");(b=P.evaluate(".//dae:library_nodes//dae:node[@id='"+b+"']",P,M,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new m).parse(b));break;case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new o).parse(b));break;case "extra":break;default:console.log(b.nodeName)}a=[];c=1E6;b=-1E6;for(var d in X)for(var e=X[d],g=0;g<e.channel.length;g++){var f=e.channel[g],h=e.sampler[g];d=f.target.split("/")[0];
-if(d==this.id)h.create(),f.sampler=h,c=Math.min(c,h.startTime),b=Math.max(b,h.endTime),a.push(f)}if(a.length)this.startTime=c,this.endTime=b;if((this.channels=a)&&this.channels.length){d=1E7;for(a=0;a<this.channels.length;a++){c=this.channels[a].sampler;for(b=0;b<c.input.length-1;b++)d=Math.min(d,c.input[b+1]-c.input[b])}c=[];for(a=this.startTime;a<this.endTime;a+=d){b=a;for(var e={},i=g=void 0,g=0;g<this.channels.length;g++)i=this.channels[g],e[i.sid]=i;f=new THREE.Matrix4;for(g=0;g<this.transforms.length;g++)if(h=
-this.transforms[g],i=e[h.sid],i!==void 0){for(var j=i.sampler,k,i=0;i<j.input.length-1;i++)if(j.input[i+1]>b){k=j.output[i];break}f=k!==void 0?k instanceof THREE.Matrix4?f.multiply(f,k):f.multiply(f,h.matrix):f.multiply(f,h.matrix)}else f=f.multiply(f,h.matrix);b=f;c.push({time:a,pos:[b.n14,b.n24,b.n34],rotq:[0,0,0,1],scl:[1,1,1]})}this.keys=c}this.updateMatrix();return this};m.prototype.updateMatrix=function(){this.matrix.identity();for(var a=0;a<this.transforms.length;a++)this.matrix.multiply(this.matrix,
+j.prototype.parse=function(a){var b={},c,d;this.source=a.getAttribute("source").replace(/^#/,"");this.invBindMatrices=[];this.joints=[];this.weights=[];for(var e=0;e<a.childNodes.length;e++){var f=a.childNodes[e];if(f.nodeType==1)switch(f.nodeName){case "bind_shape_matrix":f=O(f.textContent);this.bindShapeMatrix=new THREE.Matrix4;this.bindShapeMatrix.set(f[0],f[1],f[2],f[3],f[4],f[5],f[6],f[7],f[8],f[9],f[10],f[11],f[12],f[13],f[14],f[15]);break;case "source":f=(new y).parse(f);b[f.id]=f;break;case "joints":c=
+f;break;case "vertex_weights":d=f;break;default:console.log(f.nodeName)}}this.parseJoints(c,b);this.parseWeights(d,b);return this};j.prototype.parseJoints=function(a,b){for(var c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "input":var d=(new x).parse(d),e=b[d.source];if(d.semantic=="JOINT")this.joints=e.read();else if(d.semantic=="INV_BIND_MATRIX")this.invBindMatrices=e.read()}}};j.prototype.parseWeights=function(a,b){for(var c,d,e=[],f=0;f<a.childNodes.length;f++){var h=
+a.childNodes[f];if(h.nodeType==1)switch(h.nodeName){case "input":e.push((new x).parse(h));break;case "v":c=z(h.textContent);break;case "vcount":d=z(h.textContent)}}for(f=h=0;f<d.length;f++){for(var g=d[f],i=[],j=0;j<g;j++){for(var k={},l=0;l<e.length;l++){var m=e[l],n=c[h+m.offset];switch(m.semantic){case "JOINT":k.joint=n;break;case "WEIGHT":k.weight=b[m.source].data[n]}}i.push(k);h+=e.length}for(j=0;j<i.length;j++)i[j].index=f;this.weights.push(i)}};k.prototype.getChildById=function(a,b){for(var c=
+0;c<this.nodes.length;c++){var d=this.nodes[c].getChildById(a,b);if(d)return d}return null};k.prototype.getChildBySid=function(a,b){for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildBySid(a,b);if(d)return d}return null};k.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.nodes=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "node":this.nodes.push((new l).parse(c))}}return this};l.prototype.getChannelForTransform=
+function(a){for(var b=0;b<this.channels.length;b++){var c=this.channels[b],d=c.target.split("/");d.shift();var e=d.shift(),f=e.indexOf(".")>=0,h=e.indexOf("(")>=0,g;if(f)d=e.split("."),e=d.shift(),d.shift();else if(h){g=e.split("(");e=g.shift();for(d=0;d<g.length;d++)g[d]=parseInt(g[d].replace(/\)/,""))}if(e==a)return c.info={sid:e,dotSyntax:f,arrSyntax:h,arrIndices:g},c}return null};l.prototype.getChildById=function(a,b){if(this.id==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildById(a,
+b);if(d)return d}return null};l.prototype.getChildBySid=function(a,b){if(this.sid==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildBySid(a,b);if(d)return d}return null};l.prototype.getTransformBySid=function(a){for(var b=0;b<this.transforms.length;b++)if(this.transforms[b].sid==a)return this.transforms[b];return null};l.prototype.parse=function(a){var b;this.id=a.getAttribute("id");this.sid=a.getAttribute("sid");this.name=a.getAttribute("name");this.type=a.getAttribute("type");
+this.type=this.type=="JOINT"?this.type:"NODE";this.nodes=[];this.transforms=[];this.geometries=[];this.controllers=[];this.matrix=new THREE.Matrix4;for(var c=0;c<a.childNodes.length;c++)if(b=a.childNodes[c],b.nodeType==1)switch(b.nodeName){case "node":this.nodes.push((new l).parse(b));break;case "instance_camera":break;case "instance_controller":this.controllers.push((new n).parse(b));break;case "instance_geometry":this.geometries.push((new q).parse(b));break;case "instance_light":break;case "instance_node":b=
+b.getAttribute("url").replace(/^#/,"");(b=P.evaluate(".//dae:library_nodes//dae:node[@id='"+b+"']",P,M,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new l).parse(b));break;case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new o).parse(b));break;case "extra":break;default:console.log(b.nodeName)}a=[];c=1E6;b=-1E6;for(var d in X)for(var e=X[d],f=0;f<e.channel.length;f++){var h=e.channel[f],g=e.sampler[f];d=h.target.split("/")[0];
+if(d==this.id)g.create(),h.sampler=g,c=Math.min(c,g.startTime),b=Math.max(b,g.endTime),a.push(h)}if(a.length)this.startTime=c,this.endTime=b;if((this.channels=a)&&this.channels.length){d=1E7;for(a=0;a<this.channels.length;a++){c=this.channels[a].sampler;for(b=0;b<c.input.length-1;b++)d=Math.min(d,c.input[b+1]-c.input[b])}c=[];for(a=this.startTime;a<this.endTime;a+=d){b=a;for(var e={},i=f=void 0,f=0;f<this.channels.length;f++)i=this.channels[f],e[i.sid]=i;h=new THREE.Matrix4;for(f=0;f<this.transforms.length;f++)if(g=
+this.transforms[f],i=e[g.sid],i!==void 0){for(var j=i.sampler,k,i=0;i<j.input.length-1;i++)if(j.input[i+1]>b){k=j.output[i];break}h=k!==void 0?k instanceof THREE.Matrix4?h.multiply(h,k):h.multiply(h,g.matrix):h.multiply(h,g.matrix)}else h=h.multiply(h,g.matrix);b=h;c.push({time:a,pos:[b.n14,b.n24,b.n34],rotq:[0,0,0,1],scl:[1,1,1]})}this.keys=c}this.updateMatrix();return this};l.prototype.updateMatrix=function(){this.matrix.identity();for(var a=0;a<this.transforms.length;a++)this.matrix.multiply(this.matrix,
 this.transforms[a].matrix)};o.prototype.parse=function(a){this.sid=a.getAttribute("sid");this.type=a.nodeName;this.data=O(a.textContent);this.updateMatrix();return this};o.prototype.updateMatrix=function(){var a=0;this.matrix.identity();switch(this.type){case "matrix":this.matrix.set(this.data[0],this.data[1],this.data[2],this.data[3],this.data[4],this.data[5],this.data[6],this.data[7],this.data[8],this.data[9],this.data[10],this.data[11],this.data[12],this.data[13],this.data[14],this.data[15]);break;
 case "translate":this.matrix.setTranslation(this.data[0],this.data[1],this.data[2]);break;case "rotate":a=this.data[3]*(Math.PI/180);this.matrix.setRotationAxis(new THREE.Vector3(this.data[0],this.data[1],this.data[2]),a);break;case "scale":this.matrix.setScale(this.data[0],this.data[1],this.data[2])}return this.matrix};n.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.skeleton=[];this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];
 if(c.nodeType==1)switch(c.nodeName){case "skeleton":this.skeleton.push(c.textContent.replace(/^#/,""));break;case "bind_material":if(c=P.evaluate(".//dae:instance_material",c,M,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(var d=c.iterateNext();d;)this.instance_material.push((new t).parse(d)),d=c.iterateNext()}}return this};t.prototype.parse=function(a){this.symbol=a.getAttribute("symbol");this.target=a.getAttribute("target").replace(/^#/,"");return this};q.prototype.parse=function(a){this.url=
 a.getAttribute("url").replace(/^#/,"");this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1&&c.nodeName=="bind_material"){if(a=P.evaluate(".//dae:instance_material",c,M,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(b=a.iterateNext();b;)this.instance_material.push((new t).parse(b)),b=a.iterateNext();break}}return this};r.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "mesh":this.mesh=
-(new p(this)).parse(c)}}return this};p.prototype.parse=function(a){function b(a,c){var d=R(a.position);e[d]===void 0&&(e[d]={v:a,index:c});return e[d]}this.primitives=[];var c;for(c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];switch(d.nodeName){case "source":N(d);break;case "vertices":this.vertices=(new w).parse(d);break;case "triangles":this.primitives.push((new l).parse(d));break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new s).parse(d))}}var e=
-{};this.geometry3js=new THREE.Geometry;d=Q[this.vertices.input.POSITION.source].data;for(a=c=0;c<d.length;c+=3,a++){var g=new THREE.Vertex(new THREE.Vector3(d[c],d[c+1],d[c+2]));b(g,a);this.geometry3js.vertices.push(g)}for(c=0;c<this.primitives.length;c++)a=this.primitives[c],a.setVertices(this.vertices),this.handlePrimitive(a,this.geometry3js,e);this.geometry3js.computeCentroids();this.geometry3js.computeFaceNormals();this.geometry3js.computeVertexNormals();this.geometry3js.computeBoundingBox();
-return this};p.prototype.handlePrimitive=function(a,b,c){var d=0,e,g,f=a.p,h=a.inputs,i,j,k,m,l=0,n=3,o=[];for(e=0;e<h.length;e++)switch(i=h[e],i.semantic){case "TEXCOORD":o.push(i.set)}for(;d<f.length;){var p=[],q=[],r={},t=[];a.vcount&&(n=a.vcount[l++]);for(e=0;e<n;e++)for(g=0;g<h.length;g++)switch(i=h[g],m=Q[i.source],j=f[d+e*h.length+i.offset],k=m.accessor.params.length,k*=j,i.semantic){case "VERTEX":i=R(b.vertices[j].position);p.push(c[i].index);break;case "NORMAL":q.push(new THREE.Vector3(m.data[k],
-m.data[k+1],m.data[k+2]));break;case "TEXCOORD":r[i.set]===void 0&&(r[i.set]=[]);r[i.set].push(new THREE.UV(m.data[k],m.data[k+1]));break;case "COLOR":t.push((new THREE.Color).setRGB(m.data[k],m.data[k+1],m.data[k+2]))}var s;n==3?s=new THREE.Face3(p[0],p[1],p[2],[q[0],q[1],q[2]],t.length?t:new THREE.Color):n==4&&(s=new THREE.Face4(p[0],p[1],p[2],p[3],[q[0],q[1],q[2],q[3]],t.length?t:new THREE.Color));s.daeMaterial=a.material;b.faces.push(s);for(g=0;g<o.length;g++)e=r[o[g]],b.faceVertexUvs[g].push([e[0],
-e[1],e[2]]);d+=h.length*n}};s.prototype=new l;s.prototype.constructor=s;l.prototype.setVertices=function(a){for(var b=0;b<this.inputs.length;b++)if(this.inputs[b].source==a.id)this.inputs[b].source=a.input.POSITION.source};l.prototype.parse=function(a){this.inputs=[];this.material=a.getAttribute("material");this.count=I(a,"count",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "input":this.inputs.push((new x).parse(a.childNodes[b]));break;case "vcount":this.vcount=
+(new p(this)).parse(c)}}return this};p.prototype.parse=function(a){function b(a,c){var d=R(a.position);e[d]===void 0&&(e[d]={v:a,index:c});return e[d]}this.primitives=[];var c;for(c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];switch(d.nodeName){case "source":N(d);break;case "vertices":this.vertices=(new w).parse(d);break;case "triangles":this.primitives.push((new m).parse(d));break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new s).parse(d))}}var e=
+{};this.geometry3js=new THREE.Geometry;d=Q[this.vertices.input.POSITION.source].data;for(a=c=0;c<d.length;c+=3,a++){var f=new THREE.Vertex(new THREE.Vector3(d[c],d[c+1],d[c+2]));b(f,a);this.geometry3js.vertices.push(f)}for(c=0;c<this.primitives.length;c++)a=this.primitives[c],a.setVertices(this.vertices),this.handlePrimitive(a,this.geometry3js,e);this.geometry3js.computeCentroids();this.geometry3js.computeFaceNormals();this.geometry3js.computeVertexNormals();this.geometry3js.computeBoundingBox();
+return this};p.prototype.handlePrimitive=function(a,b,c){var d=0,e,f,h=a.p,g=a.inputs,i,j,k,l,m=0,n=3,o=[];for(e=0;e<g.length;e++)switch(i=g[e],i.semantic){case "TEXCOORD":o.push(i.set)}for(;d<h.length;){var p=[],q=[],r={},t=[];a.vcount&&(n=a.vcount[m++]);for(e=0;e<n;e++)for(f=0;f<g.length;f++)switch(i=g[f],l=Q[i.source],j=h[d+e*g.length+i.offset],k=l.accessor.params.length,k*=j,i.semantic){case "VERTEX":i=R(b.vertices[j].position);p.push(c[i].index);break;case "NORMAL":q.push(new THREE.Vector3(l.data[k],
+l.data[k+1],l.data[k+2]));break;case "TEXCOORD":r[i.set]===void 0&&(r[i.set]=[]);r[i.set].push(new THREE.UV(l.data[k],l.data[k+1]));break;case "COLOR":t.push((new THREE.Color).setRGB(l.data[k],l.data[k+1],l.data[k+2]))}var s;n==3?s=new THREE.Face3(p[0],p[1],p[2],[q[0],q[1],q[2]],t.length?t:new THREE.Color):n==4&&(s=new THREE.Face4(p[0],p[1],p[2],p[3],[q[0],q[1],q[2],q[3]],t.length?t:new THREE.Color));s.daeMaterial=a.material;b.faces.push(s);for(f=0;f<o.length;f++)e=r[o[f]],b.faceVertexUvs[f].push([e[0],
+e[1],e[2]]);d+=g.length*n}};s.prototype=new m;s.prototype.constructor=s;m.prototype.setVertices=function(a){for(var b=0;b<this.inputs.length;b++)if(this.inputs[b].source==a.id)this.inputs[b].source=a.input.POSITION.source};m.prototype.parse=function(a){this.inputs=[];this.material=a.getAttribute("material");this.count=I(a,"count",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "input":this.inputs.push((new x).parse(a.childNodes[b]));break;case "vcount":this.vcount=
 z(c.textContent);break;case "p":this.p=z(c.textContent)}}return this};v.prototype.parse=function(a){this.params=[];this.source=a.getAttribute("source");this.count=I(a,"count",0);this.stride=I(a,"stride",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName=="param"){var d={};d.name=c.getAttribute("name");d.type=c.getAttribute("type");this.params.push(d)}}return this};w.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++)if(a.childNodes[b].nodeName==
 "input"){var c=(new x).parse(a.childNodes[b]);this.input[c.semantic]=c}return this};x.prototype.parse=function(a){this.semantic=a.getAttribute("semantic");this.source=a.getAttribute("source").replace(/^#/,"");this.set=I(a,"set",-1);this.offset=I(a,"offset",0);if(this.semantic=="TEXCOORD"&&this.set<0)this.set=0;return this};y.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "bool_array":for(var d=K(c.textContent).split(/\s+/),
-e=[],g=0;g<d.length;g++)e.push(d[g]=="true"||d[g]=="1"?!0:!1);this.data=e;this.type=c.nodeName;break;case "float_array":this.data=O(c.textContent);this.type=c.nodeName;break;case "int_array":this.data=z(c.textContent);this.type=c.nodeName;break;case "IDREF_array":case "Name_array":this.data=K(c.textContent).split(/\s+/);this.type=c.nodeName;break;case "technique_common":for(d=0;d<c.childNodes.length;d++)if(c.childNodes[d].nodeName=="accessor"){this.accessor=(new v).parse(c.childNodes[d]);break}}}return this};
+e=[],f=0;f<d.length;f++)e.push(d[f]=="true"||d[f]=="1"?!0:!1);this.data=e;this.type=c.nodeName;break;case "float_array":this.data=O(c.textContent);this.type=c.nodeName;break;case "int_array":this.data=z(c.textContent);this.type=c.nodeName;break;case "IDREF_array":case "Name_array":this.data=K(c.textContent).split(/\s+/);this.type=c.nodeName;break;case "technique_common":for(d=0;d<c.childNodes.length;d++)if(c.childNodes[d].nodeName=="accessor"){this.accessor=(new v).parse(c.childNodes[d]);break}}}return this};
 y.prototype.read=function(){var a=[],b=this.accessor.params[0];switch(b.type){case "IDREF":case "Name":case "name":case "float":return this.data;case "float4x4":for(b=0;b<this.data.length;b+=16){var c=this.data.slice(b,b+16),d=new THREE.Matrix4;d.set(c[0],c[1],c[2],c[3],c[4],c[5],c[6],c[7],c[8],c[9],c[10],c[11],c[12],c[13],c[14],c[15]);a.push(d)}break;default:console.log("ColladaLoader: Source: Read dont know how to read "+b.type+".")}return a};C.prototype.parse=function(a){this.id=a.getAttribute("id");
 this.name=a.getAttribute("name");for(var b=0;b<a.childNodes.length;b++)if(a.childNodes[b].nodeName=="instance_effect"){this.instance_effect=(new H).parse(a.childNodes[b]);break}return this};A.prototype.isColor=function(){return this.texture==null};A.prototype.isTexture=function(){return this.texture!=null};A.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "color":c=O(c.textContent);this.color=new THREE.Color(0);this.color.setRGB(c[0],
 c[1],c[2]);this.color.a=c[3];break;case "texture":this.texture=c.getAttribute("texture"),this.texcoord=c.getAttribute("texcoord")}}return this};E.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[c.nodeName]=(new A).parse(c);break;case "shininess":case "reflectivity":case "transparency":var d;d=P.evaluate(".//dae:float",c,M,XPathResult.ORDERED_NODE_ITERATOR_TYPE,
-null);for(var e=d.iterateNext(),g=[];e;)g.push(e),e=d.iterateNext();d=g;d.length>0&&(this[c.nodeName]=parseFloat(d[0].textContent))}}this.create();return this};E.prototype.create=function(){var a={},b=this.transparency!==void 0&&this.transparency<1,c;for(c in this)switch(c){case "ambient":case "emission":case "diffuse":case "specular":var d=this[c];if(d instanceof A)if(d.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid&&(d=$[this.effect.surface.init_from]))a.map=
+null);for(var e=d.iterateNext(),f=[];e;)f.push(e),e=d.iterateNext();d=f;d.length>0&&(this[c.nodeName]=parseFloat(d[0].textContent))}}this.create();return this};E.prototype.create=function(){var a={},b=this.transparency!==void 0&&this.transparency<1,c;for(c in this)switch(c){case "ambient":case "emission":case "diffuse":case "specular":var d=this[c];if(d instanceof A)if(d.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid&&(d=$[this.effect.surface.init_from]))a.map=
 THREE.ImageUtils.loadTexture(da+d.init_from),a.map.wrapS=THREE.RepeatWrapping,a.map.wrapT=THREE.RepeatWrapping,a.map.repeat.x=1,a.map.repeat.y=-1}else c=="diffuse"?a.color=d.color.getHex():b||(a[c]=d.color.getHex());break;case "shininess":case "reflectivity":a[c]=this[c];break;case "transparency":if(b)a.transparent=!0,a.opacity=this[c],b=!0}a.shading=ea;return this.material=new THREE.MeshLambertMaterial(a)};u.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];
 if(c.nodeType==1)switch(c.nodeName){case "init_from":this.init_from=c.textContent;break;case "format":this.format=c.textContent;break;default:console.log("unhandled Surface prop: "+c.nodeName)}}return this};G.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "source":this.source=c.textContent;break;case "minfilter":this.minfilter=c.textContent;break;case "magfilter":this.magfilter=c.textContent;break;case "mipfilter":this.mipfilter=
 c.textContent;break;case "wrap_s":this.wrap_s=c.textContent;break;case "wrap_t":this.wrap_t=c.textContent;break;default:console.log("unhandled Sampler2D prop: "+c.nodeName)}}return this};D.prototype.create=function(){if(this.shader==null)return null};D.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.shader=null;for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "profile_COMMON":this.parseTechnique(this.parseProfileCOMMON(c))}}return this};
 D.prototype.parseNewparam=function(a){for(var b=a.getAttribute("sid"),c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "surface":this.surface=(new u(this)).parse(d);this.surface.sid=b;break;case "sampler2D":this.sampler=(new G(this)).parse(d);this.sampler.sid=b;break;case "extra":break;default:console.log(d.nodeName)}}};D.prototype.parseProfileCOMMON=function(a){for(var b,c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "profile_COMMON":this.parseProfileCOMMON(d);
 break;case "technique":b=d;break;case "newparam":this.parseNewparam(d);break;case "extra":break;default:console.log(d.nodeName)}}return b};D.prototype.parseTechnique=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "lambert":case "blinn":case "phong":this.shader=(new E(c.nodeName,this)).parse(c)}}};H.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");return this};B.prototype.parse=function(a){this.id=a.getAttribute("id");
 this.name=a.getAttribute("name");this.source={};for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "source":c=(new y).parse(c);this.source[c.id]=c;break;case "sampler":this.sampler.push((new J(this)).parse(c));break;case "channel":this.channel.push((new F(this)).parse(c))}}return this};F.prototype.parse=function(a){this.source=a.getAttribute("source").replace(/^#/,"");this.target=a.getAttribute("target");var b=this.target.split("/");b.shift();var a=
-b.shift(),c=a.indexOf(".")>=0,d=a.indexOf("(")>=0,e,g;if(c)b=a.split("."),a=b.shift(),g=b.shift();else if(d){e=a.split("(");a=e.shift();for(b=0;b<e.length;b++)e[b]=parseInt(e[b].replace(/\)/,""))}this.sid=a;this.dotSyntax=c;this.arrSyntax=d;this.arrIndices=e;this.member=g;return this};J.prototype.parse=function(a){this.id=a.getAttribute("id");this.inputs=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "input":this.inputs.push((new x).parse(c))}}return this};
+b.shift(),c=a.indexOf(".")>=0,d=a.indexOf("(")>=0,e,f;if(c)b=a.split("."),a=b.shift(),f=b.shift();else if(d){e=a.split("(");a=e.shift();for(b=0;b<e.length;b++)e[b]=parseInt(e[b].replace(/\)/,""))}this.sid=a;this.dotSyntax=c;this.arrSyntax=d;this.arrIndices=e;this.member=f;return this};J.prototype.parse=function(a){this.id=a.getAttribute("id");this.inputs=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "input":this.inputs.push((new x).parse(c))}}return this};
 J.prototype.create=function(){for(var a=0;a<this.inputs.length;a++){var b=this.inputs[a],c=this.animation.source[b.source];switch(b.semantic){case "INPUT":this.input=c.read();break;case "OUTPUT":this.output=c.read();break;case "INTERPOLATION":this.interpolation=c.read();break;case "IN_TANGENT":break;case "OUT_TANGENT":break;default:console.log(b.semantic)}}this.duration=this.endTime=this.startTime=0;if(this.input.length){this.startTime=1E8;this.endTime=-1E8;for(a=0;a<this.input.length;a++)this.startTime=
 Math.min(this.startTime,this.input[a]),this.endTime=Math.max(this.endTime,this.input[a]);this.duration=this.endTime-this.startTime}};return{load:function(b,c){if(document.implementation&&document.implementation.createDocument){document.implementation.createDocument("http://www.collada.org/2005/11/COLLADASchema","COLLADA",null);b+="?rnd="+Math.random();var d=new XMLHttpRequest;d.overrideMimeType&&d.overrideMimeType("text/xml");d.onreadystatechange=function(){if(d.readyState==4&&(d.status==0||d.status==
-200))U=c,a(d.responseXML,void 0,b)};d.open("GET",b,!0);d.send(null)}else alert("Don't know how to parse XML!")},parse:a,setPreferredShading:function(a){ea=a},applySkin:f,geometries:W}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;
-THREE.JSONLoader.prototype.load=function(a,c,b){var d,f=this;if(a instanceof Object)console.warn("DEPRECATED: JSONLoader( parameters ) is now JSONLoader( url, callback, texturePath )."),d=a,a=d.model,c=d.callback,b=d.texture_path;d=new Worker(a);b=b?b:this.extractUrlbase(a);d.onmessage=function(a){f.createModel(a.data,c,b);f.onLoadComplete()};this.onLoadStart();d.postMessage(Date.now())};
-THREE.JSONLoader.prototype.createModel=function(a,c,b){var d=new THREE.Geometry,f=a.scale!==void 0?1/a.scale:1;this.initMaterials(d,a.materials,b);(function(b){if(a.version===void 0||a.version!=2)console.error("Deprecated file format.");else{var c,f,i,j,k,m,o,n,t,q,r,p,s,l,v=a.faces;m=a.vertices;var w=a.normals,x=a.colors,y=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&y++;for(c=0;c<y;c++)d.faceUvs[c]=[],d.faceVertexUvs[c]=[];j=0;for(k=m.length;j<k;)o=new THREE.Vertex,o.position.x=m[j++]*b,o.position.y=
-m[j++]*b,o.position.z=m[j++]*b,d.vertices.push(o);j=0;for(k=v.length;j<k;){b=v[j++];m=b&1;i=b&2;c=b&4;f=b&8;n=b&16;o=b&32;q=b&64;b&=128;m?(r=new THREE.Face4,r.a=v[j++],r.b=v[j++],r.c=v[j++],r.d=v[j++],m=4):(r=new THREE.Face3,r.a=v[j++],r.b=v[j++],r.c=v[j++],m=3);if(i)i=v[j++],r.materialIndex=i;i=d.faces.length;if(c)for(c=0;c<y;c++)p=a.uvs[c],t=v[j++],l=p[t*2],t=p[t*2+1],d.faceUvs[c][i]=new THREE.UV(l,t);if(f)for(c=0;c<y;c++){p=a.uvs[c];s=[];for(f=0;f<m;f++)t=v[j++],l=p[t*2],t=p[t*2+1],s[f]=new THREE.UV(l,
-t);d.faceVertexUvs[c][i]=s}if(n)n=v[j++]*3,f=new THREE.Vector3,f.x=w[n++],f.y=w[n++],f.z=w[n],r.normal=f;if(o)for(c=0;c<m;c++)n=v[j++]*3,f=new THREE.Vector3,f.x=w[n++],f.y=w[n++],f.z=w[n],r.vertexNormals.push(f);if(q)o=v[j++],o=new THREE.Color(x[o]),r.color=o;if(b)for(c=0;c<m;c++)o=v[j++],o=new THREE.Color(x[o]),r.vertexColors.push(o);d.faces.push(r)}}})(f);(function(){var b,c,f,i;if(a.skinWeights){b=0;for(c=a.skinWeights.length;b<c;b+=2)f=a.skinWeights[b],i=a.skinWeights[b+1],d.skinWeights.push(new THREE.Vector4(f,
-i,0,0))}if(a.skinIndices){b=0;for(c=a.skinIndices.length;b<c;b+=2)f=a.skinIndices[b],i=a.skinIndices[b+1],d.skinIndices.push(new THREE.Vector4(f,i,0,0))}d.bones=a.bones;d.animation=a.animation})();(function(b){if(a.morphTargets!==void 0){var c,f,i,j,k,m,o,n,t;c=0;for(f=a.morphTargets.length;c<f;c++){d.morphTargets[c]={};d.morphTargets[c].name=a.morphTargets[c].name;d.morphTargets[c].vertices=[];n=d.morphTargets[c].vertices;t=a.morphTargets[c].vertices;i=0;for(j=t.length;i<j;i+=3)k=t[i]*b,m=t[i+1]*
-b,o=t[i+2]*b,n.push(new THREE.Vertex(new THREE.Vector3(k,m,o)))}}if(a.morphColors!==void 0){c=0;for(f=a.morphColors.length;c<f;c++){d.morphColors[c]={};d.morphColors[c].name=a.morphColors[c].name;d.morphColors[c].colors=[];j=d.morphColors[c].colors;k=a.morphColors[c].colors;b=0;for(i=k.length;b<i;b+=3)m=new THREE.Color(16755200),m.setRGB(k[b],k[b+1],k[b+2]),j.push(m)}}})(f);d.computeCentroids();d.computeFaceNormals();this.hasNormals(d)&&d.computeTangents();c(d)};
-THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};
-THREE.SceneLoader.prototype={load:function(a,c){var b=this,d=new Worker(a);d.postMessage(0);var f=THREE.Loader.prototype.extractUrlbase(a);d.onmessage=function(a){function d(a,b){return b=="relativeToHTML"?a:f+"/"+a}function h(){var a;for(n in B.objects)if(!z.objects[n])if(s=B.objects[n],s.geometry!==void 0){if(E=z.geometries[s.geometry]){a=!1;for(I=0;I<s.materials.length;I++)H=z.materials[s.materials[I]],a=H instanceof THREE.ShaderMaterial;a&&E.computeTangents();w=s.position;x=s.rotation;y=s.quaternion;
+200))U=c,a(d.responseXML,void 0,b)};d.open("GET",b,!0);d.send(null)}else alert("Don't know how to parse XML!")},parse:a,setPreferredShading:function(a){ea=a},applySkin:g,geometries:W}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;
+THREE.JSONLoader.prototype.load=function(a,c,b){if(a instanceof Object)console.warn("DEPRECATED: JSONLoader( parameters ) is now JSONLoader( url, callback, texturePath )."),b=a,a=b.model,c=b.callback,b=b.texture_path;b=b?b:this.extractUrlbase(a);this.onLoadStart();this.loadAjaxJSON(this,a,c,b)};
+THREE.JSONLoader.prototype.loadAjaxJSON=function(a,c,b,d,g){var f=new XMLHttpRequest,e=0;f.onreadystatechange=function(){if(f.readyState==4)if(f.status==200||f.status==0)try{var h=JSON.parse(f.responseText);a.createModel(h,b,d);a.onLoadComplete()}catch(i){console.error(i),console.warn("DEPRECATED: ["+c+"] seems to be using old model format")}else console.error("Couldn't load ["+c+"] ["+f.status+"]");else f.readyState==3?g&&(e==0&&(e=f.getResponseHeader("Content-Length")),g({total:e,loaded:f.responseText.length})):
+f.readyState==2&&(e=f.getResponseHeader("Content-Length"))};f.open("GET",c,!0);f.overrideMimeType("text/plain; charset=x-user-defined");f.setRequestHeader("Content-Type","text/plain");f.send(null)};
+THREE.JSONLoader.prototype.createModel=function(a,c,b){var d=new THREE.Geometry,g=a.scale!==void 0?1/a.scale:1;this.initMaterials(d,a.materials,b);(function(b){if(a.metadata===void 0||a.metadata.formatVersion===void 0||a.metadata.formatVersion!==3)console.error("Deprecated file format.");else{var c,h,g,j,k,l,o,n,t,q,r,p,s,m,v=a.faces;l=a.vertices;var w=a.normals,x=a.colors,y=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&y++;for(c=0;c<y;c++)d.faceUvs[c]=[],d.faceVertexUvs[c]=[];j=0;for(k=l.length;j<
+k;)o=new THREE.Vertex,o.position.x=l[j++]*b,o.position.y=l[j++]*b,o.position.z=l[j++]*b,d.vertices.push(o);j=0;for(k=v.length;j<k;){b=v[j++];l=b&1;g=b&2;c=b&4;h=b&8;n=b&16;o=b&32;q=b&64;b&=128;l?(r=new THREE.Face4,r.a=v[j++],r.b=v[j++],r.c=v[j++],r.d=v[j++],l=4):(r=new THREE.Face3,r.a=v[j++],r.b=v[j++],r.c=v[j++],l=3);if(g)g=v[j++],r.materialIndex=g;g=d.faces.length;if(c)for(c=0;c<y;c++)p=a.uvs[c],t=v[j++],m=p[t*2],t=p[t*2+1],d.faceUvs[c][g]=new THREE.UV(m,t);if(h)for(c=0;c<y;c++){p=a.uvs[c];s=[];
+for(h=0;h<l;h++)t=v[j++],m=p[t*2],t=p[t*2+1],s[h]=new THREE.UV(m,t);d.faceVertexUvs[c][g]=s}if(n)n=v[j++]*3,h=new THREE.Vector3,h.x=w[n++],h.y=w[n++],h.z=w[n],r.normal=h;if(o)for(c=0;c<l;c++)n=v[j++]*3,h=new THREE.Vector3,h.x=w[n++],h.y=w[n++],h.z=w[n],r.vertexNormals.push(h);if(q)o=v[j++],o=new THREE.Color(x[o]),r.color=o;if(b)for(c=0;c<l;c++)o=v[j++],o=new THREE.Color(x[o]),r.vertexColors.push(o);d.faces.push(r)}}})(g);(function(){var b,c,h,g;if(a.skinWeights){b=0;for(c=a.skinWeights.length;b<c;b+=
+2)h=a.skinWeights[b],g=a.skinWeights[b+1],d.skinWeights.push(new THREE.Vector4(h,g,0,0))}if(a.skinIndices){b=0;for(c=a.skinIndices.length;b<c;b+=2)h=a.skinIndices[b],g=a.skinIndices[b+1],d.skinIndices.push(new THREE.Vector4(h,g,0,0))}d.bones=a.bones;d.animation=a.animation})();(function(b){if(a.morphTargets!==void 0){var c,h,g,j,k,l,o,n,t;c=0;for(h=a.morphTargets.length;c<h;c++){d.morphTargets[c]={};d.morphTargets[c].name=a.morphTargets[c].name;d.morphTargets[c].vertices=[];n=d.morphTargets[c].vertices;
+t=a.morphTargets[c].vertices;g=0;for(j=t.length;g<j;g+=3)k=t[g]*b,l=t[g+1]*b,o=t[g+2]*b,n.push(new THREE.Vertex(new THREE.Vector3(k,l,o)))}}if(a.morphColors!==void 0){c=0;for(h=a.morphColors.length;c<h;c++){d.morphColors[c]={};d.morphColors[c].name=a.morphColors[c].name;d.morphColors[c].colors=[];j=d.morphColors[c].colors;k=a.morphColors[c].colors;b=0;for(g=k.length;b<g;b+=3)l=new THREE.Color(16755200),l.setRGB(k[b],k[b+1],k[b+2]),j.push(l)}}})(g);d.computeCentroids();d.computeFaceNormals();this.hasNormals(d)&&
+d.computeTangents();c(d)};THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};
+THREE.SceneLoader.prototype={load:function(a,c){var b=this,d=new Worker(a);d.postMessage(0);var g=THREE.Loader.prototype.extractUrlbase(a);d.onmessage=function(a){function d(a,b){return b=="relativeToHTML"?a:g+"/"+a}function h(){var a;for(n in B.objects)if(!z.objects[n])if(s=B.objects[n],s.geometry!==void 0){if(E=z.geometries[s.geometry]){a=!1;for(I=0;I<s.materials.length;I++)H=z.materials[s.materials[I]],a=H instanceof THREE.ShaderMaterial;a&&E.computeTangents();w=s.position;x=s.rotation;y=s.quaternion;
 C=s.scale;y=0;H.length==0&&(H=new THREE.MeshFaceMaterial);H.length>1&&(H=new THREE.MeshFaceMaterial);a=new THREE.Mesh(E,H);a.name=n;a.position.set(w[0],w[1],w[2]);y?(a.quaternion.set(y[0],y[1],y[2],y[3]),a.useQuaternion=!0):a.rotation.set(x[0],x[1],x[2]);a.scale.set(C[0],C[1],C[2]);a.visible=s.visible;z.scene.add(a);z.objects[n]=a;if(s.meshCollider){var b=THREE.CollisionUtils.MeshColliderWBox(a);z.scene.collisions.colliders.push(b)}if(s.castsShadow)b=new THREE.ShadowVolume(E),z.scene.add(b),b.position=
 a.position,b.rotation=a.rotation,b.scale=a.scale;s.trigger&&s.trigger.toLowerCase()!="none"&&(b={type:s.trigger,object:s},z.triggers[a.name]=b)}}else w=s.position,x=s.rotation,y=s.quaternion,C=s.scale,y=0,a=new THREE.Object3D,a.name=n,a.position.set(w[0],w[1],w[2]),y?(a.quaternion.set(y[0],y[1],y[2],y[3]),a.useQuaternion=!0):a.rotation.set(x[0],x[1],x[2]),a.scale.set(C[0],C[1],C[2]),a.visible=s.visible!==void 0?s.visible:!1,z.scene.add(a),z.objects[n]=a,z.empties[n]=a,s.trigger&&s.trigger.toLowerCase()!=
-"none"&&(b={type:s.trigger,object:s},z.triggers[a.name]=b)}function i(a){return function(c){z.geometries[a]=c;h();J-=1;b.onLoadComplete();k()}}function j(a){return function(b){z.geometries[a]=b}}function k(){b.callbackProgress({totalModels:M,totalTextures:O,loadedModels:M-J,loadedTextures:O-N},z);b.onLoadProgress();J==0&&N==0&&c(z)}var m,o,n,t,q,r,p,s,l,v,w,x,y,C,A,E,u,G,D,H,B,F,J,N,M,O,z;B=a.data;D=new THREE.BinaryLoader;F=new THREE.JSONLoader;N=J=0;z={scene:new THREE.Scene,geometries:{},materials:{},
-textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};a=!1;for(n in B.objects)if(s=B.objects[n],s.meshCollider){a=!0;break}if(a)z.scene.collisions=new THREE.CollisionSystem;if(B.transform){a=B.transform.position;l=B.transform.rotation;var K=B.transform.scale;a&&z.scene.position.set(a[0],a[1],a[2]);l&&z.scene.rotation.set(l[0],l[1],l[2]);K&&z.scene.scale.set(K[0],K[1],K[2]);(a||l||K)&&z.scene.updateMatrix()}a=function(){N-=1;k();b.onLoadComplete()};for(q in B.cameras)l=B.cameras[q],
-l.type=="perspective"?u=new THREE.PerspectiveCamera(l.fov,l.aspect,l.near,l.far):l.type=="ortho"&&(u=new THREE.OrthographicCamera(l.left,l.right,l.top,l.bottom,l.near,l.far)),w=l.position,l=l.target,u.position.set(w[0],w[1],w[2]),u.target=new THREE.Vector3(l[0],l[1],l[2]),z.cameras[q]=u;for(t in B.lights)l=B.lights[t],q=l.color!==void 0?l.color:16777215,u=l.intensity!==void 0?l.intensity:1,l.type=="directional"?(w=l.direction,v=new THREE.DirectionalLight(q,u),v.position.set(w[0],w[1],w[2]),v.position.normalize()):
-l.type=="point"?(w=l.position,v=l.distance,v=new THREE.PointLight(q,u,v),v.position.set(w[0],w[1],w[2])):l.type=="ambient"&&(v=new THREE.AmbientLight(q)),z.scene.add(v),z.lights[t]=v;for(r in B.fogs)t=B.fogs[r],t.type=="linear"?G=new THREE.Fog(0,t.near,t.far):t.type=="exp2"&&(G=new THREE.FogExp2(0,t.density)),l=t.color,G.color.setRGB(l[0],l[1],l[2]),z.fogs[r]=G;if(z.cameras&&B.defaults.camera)z.currentCamera=z.cameras[B.defaults.camera];if(z.fogs&&B.defaults.fog)z.scene.fog=z.fogs[B.defaults.fog];
-l=B.defaults.bgcolor;z.bgColor=new THREE.Color;z.bgColor.setRGB(l[0],l[1],l[2]);z.bgColorAlpha=B.defaults.bgalpha;for(m in B.geometries)if(r=B.geometries[m],r.type=="bin_mesh"||r.type=="ascii_mesh")J+=1,b.onLoadStart();M=J;for(m in B.geometries)r=B.geometries[m],r.type=="cube"?(E=new THREE.CubeGeometry(r.width,r.height,r.depth,r.segmentsWidth,r.segmentsHeight,r.segmentsDepth,null,r.flipped,r.sides),z.geometries[m]=E):r.type=="plane"?(E=new THREE.PlaneGeometry(r.width,r.height,r.segmentsWidth,r.segmentsHeight),
-z.geometries[m]=E):r.type=="sphere"?(E=new THREE.SphereGeometry(r.radius,r.segmentsWidth,r.segmentsHeight),z.geometries[m]=E):r.type=="cylinder"?(E=new THREE.CylinderGeometry(r.topRad,r.botRad,r.height,r.radSegs,r.heightSegs),z.geometries[m]=E):r.type=="torus"?(E=new THREE.TorusGeometry(r.radius,r.tube,r.segmentsR,r.segmentsT),z.geometries[m]=E):r.type=="icosahedron"?(E=new THREE.IcosahedronGeometry(r.subdivisions),z.geometries[m]=E):r.type=="bin_mesh"?D.load(d(r.url,B.urlBaseType),i(m)):r.type==
-"ascii_mesh"?F.load(d(r.url,B.urlBaseType),i(m)):r.type=="embedded_mesh"&&(r=B.embeds[r.id])&&F.createModel(r,j(m),"");for(p in B.textures)if(m=B.textures[p],m.url instanceof Array){N+=m.url.length;for(D=0;D<m.url.length;D++)b.onLoadStart()}else N+=1,b.onLoadStart();O=N;for(p in B.textures){m=B.textures[p];if(m.mapping!=void 0&&THREE[m.mapping]!=void 0)m.mapping=new THREE[m.mapping];if(m.url instanceof Array){D=[];for(var I=0;I<m.url.length;I++)D[I]=d(m.url[I],B.urlBaseType);D=THREE.ImageUtils.loadTextureCube(D,
-m.mapping,a)}else{D=THREE.ImageUtils.loadTexture(d(m.url,B.urlBaseType),m.mapping,a);if(THREE[m.minFilter]!=void 0)D.minFilter=THREE[m.minFilter];if(THREE[m.magFilter]!=void 0)D.magFilter=THREE[m.magFilter];if(m.repeat){D.repeat.set(m.repeat[0],m.repeat[1]);if(m.repeat[0]!=1)D.wrapS=THREE.RepeatWrapping;if(m.repeat[1]!=1)D.wrapT=THREE.RepeatWrapping}m.offset&&D.offset.set(m.offset[0],m.offset[1]);if(m.wrap){F={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(F[m.wrap[0]]!==void 0)D.wrapS=
-F[m.wrap[0]];if(F[m.wrap[1]]!==void 0)D.wrapT=F[m.wrap[1]]}}z.textures[p]=D}for(o in B.materials){p=B.materials[o];for(A in p.parameters)if(A=="envMap"||A=="map"||A=="lightMap")p.parameters[A]=z.textures[p.parameters[A]];else if(A=="shading")p.parameters[A]=p.parameters[A]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(A=="blending")p.parameters[A]=THREE[p.parameters[A]]?THREE[p.parameters[A]]:THREE.NormalBlending;else if(A=="combine")p.parameters[A]=p.parameters[A]=="MixOperation"?THREE.MixOperation:
-THREE.MultiplyOperation;else if(A=="vertexColors")if(p.parameters[A]=="face")p.parameters[A]=THREE.FaceColors;else if(p.parameters[A])p.parameters[A]=THREE.VertexColors;if(p.parameters.opacity!==void 0&&p.parameters.opacity<1)p.parameters.transparent=!0;if(p.parameters.normalMap){m=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(m.uniforms);D=p.parameters.color;F=p.parameters.specular;r=p.parameters.ambient;G=p.parameters.shininess;a.tNormal.texture=z.textures[p.parameters.normalMap];if(p.parameters.normalMapFactor)a.uNormalScale.value=
-p.parameters.normalMapFactor;if(p.parameters.map)a.tDiffuse.texture=p.parameters.map,a.enableDiffuse.value=!0;if(p.parameters.lightMap)a.tAO.texture=p.parameters.lightMap,a.enableAO.value=!0;if(p.parameters.specularMap)a.tSpecular.texture=z.textures[p.parameters.specularMap],a.enableSpecular.value=!0;a.uDiffuseColor.value.setHex(D);a.uSpecularColor.value.setHex(F);a.uAmbientColor.value.setHex(r);a.uShininess.value=G;if(p.parameters.opacity)a.uOpacity.value=p.parameters.opacity;p=new THREE.ShaderMaterial({fragmentShader:m.fragmentShader,
-vertexShader:m.vertexShader,uniforms:a,lights:!0,fog:!0})}else p=new THREE[p.type](p.parameters);z.materials[o]=p}h();b.callbackSync(z);k()}},constructor:THREE.SceneLoader};THREE.UTF8Loader=function(){};THREE.UTF8Loader.prototype=new THREE.UTF8Loader;THREE.UTF8Loader.prototype.constructor=THREE.UTF8Loader;
-THREE.UTF8Loader.prototype.load=function(a,c,b){if(a instanceof Object)console.warn("DEPRECATED: UTF8Loader( parameters ) is now UTF8Loader( url, callback, metaData )."),b=a,a=b.model,c=b.callback,b={scale:b.scale,offsetX:b.offsetX,offsetY:b.offsetY,offsetZ:b.offsetZ};var d=new XMLHttpRequest,f=b.scale!==void 0?b.scale:1,g=b.offsetX!==void 0?b.offsetX:0,e=b.offsetY!==void 0?b.offsetY:0,h=b.offsetZ!==void 0?b.offsetZ:0;d.onreadystatechange=function(){d.readyState==4?d.status==200||d.status==0?THREE.UTF8Loader.prototype.createModel(d.responseText,
-c,f,g,e,h):alert("Couldn't load ["+a+"] ["+d.status+"]"):d.readyState!=3&&d.readyState==2&&d.getResponseHeader("Content-Length")};d.open("GET",a,!0);d.send(null)};THREE.UTF8Loader.prototype.decompressMesh=function(a){var c=a.charCodeAt(0);c>=57344&&(c-=2048);c++;for(var b=new Float32Array(8*c),d=1,f=0;f<8;f++){for(var g=0,e=0;e<c;++e){var h=a.charCodeAt(e+d);g+=h>>1^-(h&1);b[8*e+f]=g}d+=c}c=a.length-d;g=new Uint16Array(c);for(f=e=0;f<c;f++)h=a.charCodeAt(f+d),g[f]=e-h,h==0&&e++;return[b,g]};
-THREE.UTF8Loader.prototype.createModel=function(a,c,b,d,f,g){var e=function(){var c=this;c.materials=[];THREE.Geometry.call(this);var e=THREE.UTF8Loader.prototype.decompressMesh(a),j=[],k=[];(function(a,e,i){for(var j,k,r,p=a.length;i<p;i+=e)j=a[i],k=a[i+1],r=a[i+2],j=j/16383*b,k=k/16383*b,r=r/16383*b,j+=d,k+=f,r+=g,c.vertices.push(new THREE.Vertex(new THREE.Vector3(j,k,r)))})(e[0],8,0);(function(a,b,c){for(var d,e,f=a.length;c<f;c+=b)d=a[c],e=a[c+1],d/=1023,e/=1023,k.push(d,1-e)})(e[0],8,3);(function(a,
-b,c){for(var d,e,f,g=a.length;c<g;c+=b)d=a[c],e=a[c+1],f=a[c+2],d=(d-512)/511,e=(e-512)/511,f=(f-512)/511,j.push(d,e,f)})(e[0],8,5);(function(a){var b,d,e,f,g,i,s,l,v,w=a.length;for(b=0;b<w;b+=3){d=a[b];e=a[b+1];f=a[b+2];g=c;l=d;v=e;i=f;s=d;var x=e,y=f,C=g.materials[0],A=j[x*3],E=j[x*3+1],x=j[x*3+2],u=j[y*3],G=j[y*3+1],y=j[y*3+2];s=new THREE.Vector3(j[s*3],j[s*3+1],j[s*3+2]);x=new THREE.Vector3(A,E,x);y=new THREE.Vector3(u,G,y);g.faces.push(new THREE.Face3(l,v,i,[s,x,y],null,C));g=k[d*2];d=k[d*2+
-1];i=k[e*2];s=k[e*2+1];l=k[f*2];v=k[f*2+1];f=c.faceVertexUvs[0];e=i;i=s;s=[];s.push(new THREE.UV(g,d));s.push(new THREE.UV(e,i));s.push(new THREE.UV(l,v));f.push(s)}})(e[1]);this.computeCentroids();this.computeFaceNormals()};e.prototype=new THREE.Geometry;e.prototype.constructor=e;c(new e)};
+"none"&&(b={type:s.trigger,object:s},z.triggers[a.name]=b)}function i(a){return function(c){z.geometries[a]=c;h();J-=1;b.onLoadComplete();k()}}function j(a){return function(b){z.geometries[a]=b}}function k(){b.callbackProgress({totalModels:M,totalTextures:O,loadedModels:M-J,loadedTextures:O-N},z);b.onLoadProgress();J==0&&N==0&&c(z)}var l,o,n,t,q,r,p,s,m,v,w,x,y,C,A,E,u,G,D,H,B,F,J,N,M,O,z;B=a.data;D=new THREE.BinaryLoader;F=new THREE.JSONLoader;N=J=0;z={scene:new THREE.Scene,geometries:{},materials:{},
+textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};a=!1;for(n in B.objects)if(s=B.objects[n],s.meshCollider){a=!0;break}if(a)z.scene.collisions=new THREE.CollisionSystem;if(B.transform){a=B.transform.position;m=B.transform.rotation;var K=B.transform.scale;a&&z.scene.position.set(a[0],a[1],a[2]);m&&z.scene.rotation.set(m[0],m[1],m[2]);K&&z.scene.scale.set(K[0],K[1],K[2]);(a||m||K)&&z.scene.updateMatrix()}a=function(){N-=1;k();b.onLoadComplete()};for(q in B.cameras)m=B.cameras[q],
+m.type=="perspective"?u=new THREE.PerspectiveCamera(m.fov,m.aspect,m.near,m.far):m.type=="ortho"&&(u=new THREE.OrthographicCamera(m.left,m.right,m.top,m.bottom,m.near,m.far)),w=m.position,m=m.target,u.position.set(w[0],w[1],w[2]),u.target=new THREE.Vector3(m[0],m[1],m[2]),z.cameras[q]=u;for(t in B.lights)m=B.lights[t],q=m.color!==void 0?m.color:16777215,u=m.intensity!==void 0?m.intensity:1,m.type=="directional"?(w=m.direction,v=new THREE.DirectionalLight(q,u),v.position.set(w[0],w[1],w[2]),v.position.normalize()):
+m.type=="point"?(w=m.position,v=m.distance,v=new THREE.PointLight(q,u,v),v.position.set(w[0],w[1],w[2])):m.type=="ambient"&&(v=new THREE.AmbientLight(q)),z.scene.add(v),z.lights[t]=v;for(r in B.fogs)t=B.fogs[r],t.type=="linear"?G=new THREE.Fog(0,t.near,t.far):t.type=="exp2"&&(G=new THREE.FogExp2(0,t.density)),m=t.color,G.color.setRGB(m[0],m[1],m[2]),z.fogs[r]=G;if(z.cameras&&B.defaults.camera)z.currentCamera=z.cameras[B.defaults.camera];if(z.fogs&&B.defaults.fog)z.scene.fog=z.fogs[B.defaults.fog];
+m=B.defaults.bgcolor;z.bgColor=new THREE.Color;z.bgColor.setRGB(m[0],m[1],m[2]);z.bgColorAlpha=B.defaults.bgalpha;for(l in B.geometries)if(r=B.geometries[l],r.type=="bin_mesh"||r.type=="ascii_mesh")J+=1,b.onLoadStart();M=J;for(l in B.geometries)r=B.geometries[l],r.type=="cube"?(E=new THREE.CubeGeometry(r.width,r.height,r.depth,r.segmentsWidth,r.segmentsHeight,r.segmentsDepth,null,r.flipped,r.sides),z.geometries[l]=E):r.type=="plane"?(E=new THREE.PlaneGeometry(r.width,r.height,r.segmentsWidth,r.segmentsHeight),
+z.geometries[l]=E):r.type=="sphere"?(E=new THREE.SphereGeometry(r.radius,r.segmentsWidth,r.segmentsHeight),z.geometries[l]=E):r.type=="cylinder"?(E=new THREE.CylinderGeometry(r.topRad,r.botRad,r.height,r.radSegs,r.heightSegs),z.geometries[l]=E):r.type=="torus"?(E=new THREE.TorusGeometry(r.radius,r.tube,r.segmentsR,r.segmentsT),z.geometries[l]=E):r.type=="icosahedron"?(E=new THREE.IcosahedronGeometry(r.subdivisions),z.geometries[l]=E):r.type=="bin_mesh"?D.load(d(r.url,B.urlBaseType),i(l)):r.type==
+"ascii_mesh"?F.load(d(r.url,B.urlBaseType),i(l)):r.type=="embedded_mesh"&&(r=B.embeds[r.id])&&F.createModel(r,j(l),"");for(p in B.textures)if(l=B.textures[p],l.url instanceof Array){N+=l.url.length;for(D=0;D<l.url.length;D++)b.onLoadStart()}else N+=1,b.onLoadStart();O=N;for(p in B.textures){l=B.textures[p];if(l.mapping!=void 0&&THREE[l.mapping]!=void 0)l.mapping=new THREE[l.mapping];if(l.url instanceof Array){D=[];for(var I=0;I<l.url.length;I++)D[I]=d(l.url[I],B.urlBaseType);D=THREE.ImageUtils.loadTextureCube(D,
+l.mapping,a)}else{D=THREE.ImageUtils.loadTexture(d(l.url,B.urlBaseType),l.mapping,a);if(THREE[l.minFilter]!=void 0)D.minFilter=THREE[l.minFilter];if(THREE[l.magFilter]!=void 0)D.magFilter=THREE[l.magFilter];if(l.repeat){D.repeat.set(l.repeat[0],l.repeat[1]);if(l.repeat[0]!=1)D.wrapS=THREE.RepeatWrapping;if(l.repeat[1]!=1)D.wrapT=THREE.RepeatWrapping}l.offset&&D.offset.set(l.offset[0],l.offset[1]);if(l.wrap){F={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(F[l.wrap[0]]!==void 0)D.wrapS=
+F[l.wrap[0]];if(F[l.wrap[1]]!==void 0)D.wrapT=F[l.wrap[1]]}}z.textures[p]=D}for(o in B.materials){p=B.materials[o];for(A in p.parameters)if(A=="envMap"||A=="map"||A=="lightMap")p.parameters[A]=z.textures[p.parameters[A]];else if(A=="shading")p.parameters[A]=p.parameters[A]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(A=="blending")p.parameters[A]=THREE[p.parameters[A]]?THREE[p.parameters[A]]:THREE.NormalBlending;else if(A=="combine")p.parameters[A]=p.parameters[A]=="MixOperation"?THREE.MixOperation:
+THREE.MultiplyOperation;else if(A=="vertexColors")if(p.parameters[A]=="face")p.parameters[A]=THREE.FaceColors;else if(p.parameters[A])p.parameters[A]=THREE.VertexColors;if(p.parameters.opacity!==void 0&&p.parameters.opacity<1)p.parameters.transparent=!0;if(p.parameters.normalMap){l=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(l.uniforms);D=p.parameters.color;F=p.parameters.specular;r=p.parameters.ambient;G=p.parameters.shininess;a.tNormal.texture=z.textures[p.parameters.normalMap];if(p.parameters.normalMapFactor)a.uNormalScale.value=
+p.parameters.normalMapFactor;if(p.parameters.map)a.tDiffuse.texture=p.parameters.map,a.enableDiffuse.value=!0;if(p.parameters.lightMap)a.tAO.texture=p.parameters.lightMap,a.enableAO.value=!0;if(p.parameters.specularMap)a.tSpecular.texture=z.textures[p.parameters.specularMap],a.enableSpecular.value=!0;a.uDiffuseColor.value.setHex(D);a.uSpecularColor.value.setHex(F);a.uAmbientColor.value.setHex(r);a.uShininess.value=G;if(p.parameters.opacity)a.uOpacity.value=p.parameters.opacity;p=new THREE.ShaderMaterial({fragmentShader:l.fragmentShader,
+vertexShader:l.vertexShader,uniforms:a,lights:!0,fog:!0})}else p=new THREE[p.type](p.parameters);z.materials[o]=p}h();b.callbackSync(z);k()}},constructor:THREE.SceneLoader};THREE.UTF8Loader=function(){};THREE.UTF8Loader.prototype=new THREE.UTF8Loader;THREE.UTF8Loader.prototype.constructor=THREE.UTF8Loader;
+THREE.UTF8Loader.prototype.load=function(a,c,b){if(a instanceof Object)console.warn("DEPRECATED: UTF8Loader( parameters ) is now UTF8Loader( url, callback, metaData )."),b=a,a=b.model,c=b.callback,b={scale:b.scale,offsetX:b.offsetX,offsetY:b.offsetY,offsetZ:b.offsetZ};var d=new XMLHttpRequest,g=b.scale!==void 0?b.scale:1,f=b.offsetX!==void 0?b.offsetX:0,e=b.offsetY!==void 0?b.offsetY:0,h=b.offsetZ!==void 0?b.offsetZ:0;d.onreadystatechange=function(){d.readyState==4?d.status==200||d.status==0?THREE.UTF8Loader.prototype.createModel(d.responseText,
+c,g,f,e,h):alert("Couldn't load ["+a+"] ["+d.status+"]"):d.readyState!=3&&d.readyState==2&&d.getResponseHeader("Content-Length")};d.open("GET",a,!0);d.send(null)};THREE.UTF8Loader.prototype.decompressMesh=function(a){var c=a.charCodeAt(0);c>=57344&&(c-=2048);c++;for(var b=new Float32Array(8*c),d=1,g=0;g<8;g++){for(var f=0,e=0;e<c;++e){var h=a.charCodeAt(e+d);f+=h>>1^-(h&1);b[8*e+g]=f}d+=c}c=a.length-d;f=new Uint16Array(c);for(g=e=0;g<c;g++)h=a.charCodeAt(g+d),f[g]=e-h,h==0&&e++;return[b,f]};
+THREE.UTF8Loader.prototype.createModel=function(a,c,b,d,g,f){var e=function(){var c=this;c.materials=[];THREE.Geometry.call(this);var e=THREE.UTF8Loader.prototype.decompressMesh(a),j=[],k=[];(function(a,e,i){for(var j,k,r,p=a.length;i<p;i+=e)j=a[i],k=a[i+1],r=a[i+2],j=j/16383*b,k=k/16383*b,r=r/16383*b,j+=d,k+=g,r+=f,c.vertices.push(new THREE.Vertex(new THREE.Vector3(j,k,r)))})(e[0],8,0);(function(a,b,c){for(var d,e,f=a.length;c<f;c+=b)d=a[c],e=a[c+1],d/=1023,e/=1023,k.push(d,1-e)})(e[0],8,3);(function(a,
+b,c){for(var d,e,f,g=a.length;c<g;c+=b)d=a[c],e=a[c+1],f=a[c+2],d=(d-512)/511,e=(e-512)/511,f=(f-512)/511,j.push(d,e,f)})(e[0],8,5);(function(a){var b,d,e,f,g,i,s,m,v,w=a.length;for(b=0;b<w;b+=3){d=a[b];e=a[b+1];f=a[b+2];g=c;m=d;v=e;i=f;s=d;var x=e,y=f,C=g.materials[0],A=j[x*3],E=j[x*3+1],x=j[x*3+2],u=j[y*3],G=j[y*3+1],y=j[y*3+2];s=new THREE.Vector3(j[s*3],j[s*3+1],j[s*3+2]);x=new THREE.Vector3(A,E,x);y=new THREE.Vector3(u,G,y);g.faces.push(new THREE.Face3(m,v,i,[s,x,y],null,C));g=k[d*2];d=k[d*2+
+1];i=k[e*2];s=k[e*2+1];m=k[f*2];v=k[f*2+1];f=c.faceVertexUvs[0];e=i;i=s;s=[];s.push(new THREE.UV(g,d));s.push(new THREE.UV(e,i));s.push(new THREE.UV(m,v));f.push(s)}})(e[1]);this.computeCentroids();this.computeFaceNormals()};e.prototype=new THREE.Geometry;e.prototype.constructor=e;c(new e)};
 THREE.Axes=function(){THREE.Object3D.call(this);var a=new THREE.Geometry;a.vertices.push(new THREE.Vertex);a.vertices.push(new THREE.Vertex(new THREE.Vector3(0,100,0)));var c=new THREE.CylinderGeometry(0,5,25,5,1),b=new THREE.Line(a,new THREE.LineBasicMaterial({color:16711680}));b.rotation.z=-Math.PI/2;this.add(b);b=new THREE.Mesh(c,new THREE.MeshBasicMaterial({color:16711680}));b.position.x=100;b.rotation.z=-Math.PI/2;this.add(b);b=new THREE.Line(a,new THREE.LineBasicMaterial({color:65280}));this.add(b);
 b=new THREE.Mesh(c,new THREE.MeshBasicMaterial({color:65280}));b.position.y=100;this.add(b);b=new THREE.Line(a,new THREE.LineBasicMaterial({color:255}));b.rotation.x=Math.PI/2;this.add(b);b=new THREE.Mesh(c,new THREE.MeshBasicMaterial({color:255}));b.position.z=100;b.rotation.x=Math.PI/2;this.add(b)};THREE.Axes.prototype=new THREE.Object3D;THREE.Axes.prototype.constructor=THREE.Axes;
 THREE.MarchingCubes=function(a,c){THREE.Object3D.call(this);this.materials=c instanceof Array?c:[c];this.init=function(a){this.isolation=80;this.size=a;this.size2=this.size*this.size;this.size3=this.size2*this.size;this.halfsize=this.size/2;this.delta=2/this.size;this.yd=this.size;this.zd=this.size2;this.field=new Float32Array(this.size3);this.normal_cache=new Float32Array(this.size3*3);this.vlist=new Float32Array(36);this.nlist=new Float32Array(36);this.firstDraw=!0;this.maxCount=4096;this.count=
-0;this.hasNormal=this.hasPos=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(a,c,f){return a+(c-a)*f};this.VIntX=function(a,c,f,g,e,h,i,j,k,m){e=(e-k)/(m-k);k=this.normal_cache;c[g]=h+e*this.delta;c[g+1]=i;c[g+2]=j;f[g]=this.lerp(k[a],k[a+3],e);f[g+1]=this.lerp(k[a+1],k[a+4],e);f[g+2]=this.lerp(k[a+2],k[a+5],e)};this.VIntY=function(a,c,f,g,e,h,i,j,k,m){e=(e-k)/(m-k);k=this.normal_cache;c[g]=h;c[g+1]=i+e*this.delta;c[g+
-2]=j;c=a+this.yd*3;f[g]=this.lerp(k[a],k[c],e);f[g+1]=this.lerp(k[a+1],k[c+1],e);f[g+2]=this.lerp(k[a+2],k[c+2],e)};this.VIntZ=function(a,c,f,g,e,h,i,j,k,m){e=(e-k)/(m-k);k=this.normal_cache;c[g]=h;c[g+1]=i;c[g+2]=j+e*this.delta;c=a+this.zd*3;f[g]=this.lerp(k[a],k[c],e);f[g+1]=this.lerp(k[a+1],k[c+1],e);f[g+2]=this.lerp(k[a+2],k[c+2],e)};this.compNorm=function(a){var c=a*3;this.normal_cache[c]===0&&(this.normal_cache[c]=this.field[a-1]-this.field[a+1],this.normal_cache[c+1]=this.field[a-this.yd]-
-this.field[a+this.yd],this.normal_cache[c+2]=this.field[a-this.zd]-this.field[a+this.zd])};this.polygonize=function(a,c,f,g,e,h){var i=g+1,j=g+this.yd,k=g+this.zd,m=i+this.yd,o=i+this.zd,n=g+this.yd+this.zd,t=i+this.yd+this.zd,q=0,r=this.field[g],p=this.field[i],s=this.field[j],l=this.field[m],v=this.field[k],w=this.field[o],x=this.field[n],y=this.field[t];r<e&&(q|=1);p<e&&(q|=2);s<e&&(q|=8);l<e&&(q|=4);v<e&&(q|=16);w<e&&(q|=32);x<e&&(q|=128);y<e&&(q|=64);var C=THREE.edgeTable[q];if(C===0)return 0;
-var A=this.delta,E=a+A,u=c+A,A=f+A;C&1&&(this.compNorm(g),this.compNorm(i),this.VIntX(g*3,this.vlist,this.nlist,0,e,a,c,f,r,p));C&2&&(this.compNorm(i),this.compNorm(m),this.VIntY(i*3,this.vlist,this.nlist,3,e,E,c,f,p,l));C&4&&(this.compNorm(j),this.compNorm(m),this.VIntX(j*3,this.vlist,this.nlist,6,e,a,u,f,s,l));C&8&&(this.compNorm(g),this.compNorm(j),this.VIntY(g*3,this.vlist,this.nlist,9,e,a,c,f,r,s));C&16&&(this.compNorm(k),this.compNorm(o),this.VIntX(k*3,this.vlist,this.nlist,12,e,a,c,A,v,w));
-C&32&&(this.compNorm(o),this.compNorm(t),this.VIntY(o*3,this.vlist,this.nlist,15,e,E,c,A,w,y));C&64&&(this.compNorm(n),this.compNorm(t),this.VIntX(n*3,this.vlist,this.nlist,18,e,a,u,A,x,y));C&128&&(this.compNorm(k),this.compNorm(n),this.VIntY(k*3,this.vlist,this.nlist,21,e,a,c,A,v,x));C&256&&(this.compNorm(g),this.compNorm(k),this.VIntZ(g*3,this.vlist,this.nlist,24,e,a,c,f,r,v));C&512&&(this.compNorm(i),this.compNorm(o),this.VIntZ(i*3,this.vlist,this.nlist,27,e,E,c,f,p,w));C&1024&&(this.compNorm(m),
-this.compNorm(t),this.VIntZ(m*3,this.vlist,this.nlist,30,e,E,u,f,l,y));C&2048&&(this.compNorm(j),this.compNorm(n),this.VIntZ(j*3,this.vlist,this.nlist,33,e,a,u,f,s,x));q<<=4;for(e=g=0;THREE.triTable[q+e]!=-1;)a=q+e,c=a+1,f=a+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[a],3*THREE.triTable[c],3*THREE.triTable[f],h),e+=3,g++;return g};this.posnormtriv=function(a,c,f,g,e,h){var i=this.count*3;this.positionArray[i]=a[f];this.positionArray[i+1]=a[f+1];this.positionArray[i+2]=a[f+2];this.positionArray[i+
-3]=a[g];this.positionArray[i+4]=a[g+1];this.positionArray[i+5]=a[g+2];this.positionArray[i+6]=a[e];this.positionArray[i+7]=a[e+1];this.positionArray[i+8]=a[e+2];this.normalArray[i]=c[f];this.normalArray[i+1]=c[f+1];this.normalArray[i+2]=c[f+2];this.normalArray[i+3]=c[g];this.normalArray[i+4]=c[g+1];this.normalArray[i+5]=c[g+2];this.normalArray[i+6]=c[e];this.normalArray[i+7]=c[e+1];this.normalArray[i+8]=c[e+2];this.hasNormal=this.hasPos=!0;this.count+=3;this.count>=this.maxCount-3&&h(this)};this.begin=
-function(){this.count=0;this.hasNormal=this.hasPos=!1};this.end=function(a){if(this.count!==0){for(var c=this.count*3;c<this.positionArray.length;c++)this.positionArray[c]=0;a(this)}};this.addBall=function(a,c,f,g,e){var h=this.size*Math.sqrt(g/e),i=f*this.size,j=c*this.size,k=a*this.size,m=Math.floor(i-h);m<1&&(m=1);i=Math.floor(i+h);i>this.size-1&&(i=this.size-1);var o=Math.floor(j-h);o<1&&(o=1);j=Math.floor(j+h);j>this.size-1&&(j=this.size-1);var n=Math.floor(k-h);n<1&&(n=1);h=Math.floor(k+h);
-h>this.size-1&&(h=this.size-1);for(var t,q,r,p,s,l;m<i;m++){k=this.size2*m;q=m/this.size-f;s=q*q;for(q=o;q<j;q++){r=k+this.size*q;t=q/this.size-c;l=t*t;for(t=n;t<h;t++)p=t/this.size-a,p=g/(1.0E-6+p*p+l+s)-e,p>0&&(this.field[r+t]+=p)}}};this.addPlaneX=function(a,c){var f,g,e,h,i,j=this.size,k=this.yd,m=this.zd,o=this.field,n=j*Math.sqrt(a/c);n>j&&(n=j);for(f=0;f<n;f++)if(g=f/j,g*=g,h=a/(1.0E-4+g)-c,h>0)for(g=0;g<j;g++){i=f+g*k;for(e=0;e<j;e++)o[m*e+i]+=h}};this.addPlaneY=function(a,c){var f,g,e,h,
-i,j,k=this.size,m=this.yd,o=this.zd,n=this.field,t=k*Math.sqrt(a/c);t>k&&(t=k);for(g=0;g<t;g++)if(f=g/k,f*=f,h=a/(1.0E-4+f)-c,h>0){i=g*m;for(f=0;f<k;f++){j=i+f;for(e=0;e<k;e++)n[o*e+j]+=h}}};this.addPlaneZ=function(a,c){var f,g,e,h,i,j,k=this.size,m=this.yd,o=this.zd,n=this.field,t=k*Math.sqrt(a/c);t>k&&(t=k);for(e=0;e<t;e++)if(f=e/k,f*=f,h=a/(1.0E-4+f)-c,h>0){i=o*e;for(g=0;g<k;g++){j=i+g*m;for(f=0;f<k;f++)n[j+f]+=h}}};this.reset=function(){var a;for(a=0;a<this.size3;a++)this.normal_cache[a*3]=0,
-this.field[a]=0};this.render=function(a){this.begin();var c,f,g,e,h,i,j,k,m,o=this.size-2;for(e=1;e<o;e++){m=this.size2*e;j=(e-this.halfsize)/this.halfsize;for(g=1;g<o;g++){k=m+this.size*g;i=(g-this.halfsize)/this.halfsize;for(f=1;f<o;f++)h=(f-this.halfsize)/this.halfsize,c=k+f,this.polygonize(h,i,j,c,this.isolation,a)}}this.end(a)};this.generateGeometry=function(){var a=0,c=new THREE.Geometry,f=[];this.render(function(g){var e,h,i,j,k,m,o,n;for(e=0;e<g.count;e++)o=e*3,k=o+1,n=o+2,h=g.positionArray[o],
-i=g.positionArray[k],j=g.positionArray[n],m=new THREE.Vector3(h,i,j),h=g.normalArray[o],i=g.normalArray[k],j=g.normalArray[n],o=new THREE.Vector3(h,i,j),o.normalize(),k=new THREE.Vertex(m),c.vertices.push(k),f.push(o);m=g.count/3;for(e=0;e<m;e++)o=(a+e)*3,k=o+1,n=o+2,h=f[o],i=f[k],j=f[n],o=new THREE.Face3(o,k,n,[h,i,j]),c.faces.push(o);a+=m;g.count=0});return c};this.init(a)};THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
+0;this.hasNormal=this.hasPos=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(a,c,g){return a+(c-a)*g};this.VIntX=function(a,c,g,f,e,h,i,j,k,l){e=(e-k)/(l-k);k=this.normal_cache;c[f]=h+e*this.delta;c[f+1]=i;c[f+2]=j;g[f]=this.lerp(k[a],k[a+3],e);g[f+1]=this.lerp(k[a+1],k[a+4],e);g[f+2]=this.lerp(k[a+2],k[a+5],e)};this.VIntY=function(a,c,g,f,e,h,i,j,k,l){e=(e-k)/(l-k);k=this.normal_cache;c[f]=h;c[f+1]=i+e*this.delta;c[f+
+2]=j;c=a+this.yd*3;g[f]=this.lerp(k[a],k[c],e);g[f+1]=this.lerp(k[a+1],k[c+1],e);g[f+2]=this.lerp(k[a+2],k[c+2],e)};this.VIntZ=function(a,c,g,f,e,h,i,j,k,l){e=(e-k)/(l-k);k=this.normal_cache;c[f]=h;c[f+1]=i;c[f+2]=j+e*this.delta;c=a+this.zd*3;g[f]=this.lerp(k[a],k[c],e);g[f+1]=this.lerp(k[a+1],k[c+1],e);g[f+2]=this.lerp(k[a+2],k[c+2],e)};this.compNorm=function(a){var c=a*3;this.normal_cache[c]===0&&(this.normal_cache[c]=this.field[a-1]-this.field[a+1],this.normal_cache[c+1]=this.field[a-this.yd]-
+this.field[a+this.yd],this.normal_cache[c+2]=this.field[a-this.zd]-this.field[a+this.zd])};this.polygonize=function(a,c,g,f,e,h){var i=f+1,j=f+this.yd,k=f+this.zd,l=i+this.yd,o=i+this.zd,n=f+this.yd+this.zd,t=i+this.yd+this.zd,q=0,r=this.field[f],p=this.field[i],s=this.field[j],m=this.field[l],v=this.field[k],w=this.field[o],x=this.field[n],y=this.field[t];r<e&&(q|=1);p<e&&(q|=2);s<e&&(q|=8);m<e&&(q|=4);v<e&&(q|=16);w<e&&(q|=32);x<e&&(q|=128);y<e&&(q|=64);var C=THREE.edgeTable[q];if(C===0)return 0;
+var A=this.delta,E=a+A,u=c+A,A=g+A;C&1&&(this.compNorm(f),this.compNorm(i),this.VIntX(f*3,this.vlist,this.nlist,0,e,a,c,g,r,p));C&2&&(this.compNorm(i),this.compNorm(l),this.VIntY(i*3,this.vlist,this.nlist,3,e,E,c,g,p,m));C&4&&(this.compNorm(j),this.compNorm(l),this.VIntX(j*3,this.vlist,this.nlist,6,e,a,u,g,s,m));C&8&&(this.compNorm(f),this.compNorm(j),this.VIntY(f*3,this.vlist,this.nlist,9,e,a,c,g,r,s));C&16&&(this.compNorm(k),this.compNorm(o),this.VIntX(k*3,this.vlist,this.nlist,12,e,a,c,A,v,w));
+C&32&&(this.compNorm(o),this.compNorm(t),this.VIntY(o*3,this.vlist,this.nlist,15,e,E,c,A,w,y));C&64&&(this.compNorm(n),this.compNorm(t),this.VIntX(n*3,this.vlist,this.nlist,18,e,a,u,A,x,y));C&128&&(this.compNorm(k),this.compNorm(n),this.VIntY(k*3,this.vlist,this.nlist,21,e,a,c,A,v,x));C&256&&(this.compNorm(f),this.compNorm(k),this.VIntZ(f*3,this.vlist,this.nlist,24,e,a,c,g,r,v));C&512&&(this.compNorm(i),this.compNorm(o),this.VIntZ(i*3,this.vlist,this.nlist,27,e,E,c,g,p,w));C&1024&&(this.compNorm(l),
+this.compNorm(t),this.VIntZ(l*3,this.vlist,this.nlist,30,e,E,u,g,m,y));C&2048&&(this.compNorm(j),this.compNorm(n),this.VIntZ(j*3,this.vlist,this.nlist,33,e,a,u,g,s,x));q<<=4;for(e=f=0;THREE.triTable[q+e]!=-1;)a=q+e,c=a+1,g=a+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[a],3*THREE.triTable[c],3*THREE.triTable[g],h),e+=3,f++;return f};this.posnormtriv=function(a,c,g,f,e,h){var i=this.count*3;this.positionArray[i]=a[g];this.positionArray[i+1]=a[g+1];this.positionArray[i+2]=a[g+2];this.positionArray[i+
+3]=a[f];this.positionArray[i+4]=a[f+1];this.positionArray[i+5]=a[f+2];this.positionArray[i+6]=a[e];this.positionArray[i+7]=a[e+1];this.positionArray[i+8]=a[e+2];this.normalArray[i]=c[g];this.normalArray[i+1]=c[g+1];this.normalArray[i+2]=c[g+2];this.normalArray[i+3]=c[f];this.normalArray[i+4]=c[f+1];this.normalArray[i+5]=c[f+2];this.normalArray[i+6]=c[e];this.normalArray[i+7]=c[e+1];this.normalArray[i+8]=c[e+2];this.hasNormal=this.hasPos=!0;this.count+=3;this.count>=this.maxCount-3&&h(this)};this.begin=
+function(){this.count=0;this.hasNormal=this.hasPos=!1};this.end=function(a){if(this.count!==0){for(var c=this.count*3;c<this.positionArray.length;c++)this.positionArray[c]=0;a(this)}};this.addBall=function(a,c,g,f,e){var h=this.size*Math.sqrt(f/e),i=g*this.size,j=c*this.size,k=a*this.size,l=Math.floor(i-h);l<1&&(l=1);i=Math.floor(i+h);i>this.size-1&&(i=this.size-1);var o=Math.floor(j-h);o<1&&(o=1);j=Math.floor(j+h);j>this.size-1&&(j=this.size-1);var n=Math.floor(k-h);n<1&&(n=1);h=Math.floor(k+h);
+h>this.size-1&&(h=this.size-1);for(var t,q,r,p,s,m;l<i;l++){k=this.size2*l;q=l/this.size-g;s=q*q;for(q=o;q<j;q++){r=k+this.size*q;t=q/this.size-c;m=t*t;for(t=n;t<h;t++)p=t/this.size-a,p=f/(1.0E-6+p*p+m+s)-e,p>0&&(this.field[r+t]+=p)}}};this.addPlaneX=function(a,c){var g,f,e,h,i,j=this.size,k=this.yd,l=this.zd,o=this.field,n=j*Math.sqrt(a/c);n>j&&(n=j);for(g=0;g<n;g++)if(f=g/j,f*=f,h=a/(1.0E-4+f)-c,h>0)for(f=0;f<j;f++){i=g+f*k;for(e=0;e<j;e++)o[l*e+i]+=h}};this.addPlaneY=function(a,c){var g,f,e,h,
+i,j,k=this.size,l=this.yd,o=this.zd,n=this.field,t=k*Math.sqrt(a/c);t>k&&(t=k);for(f=0;f<t;f++)if(g=f/k,g*=g,h=a/(1.0E-4+g)-c,h>0){i=f*l;for(g=0;g<k;g++){j=i+g;for(e=0;e<k;e++)n[o*e+j]+=h}}};this.addPlaneZ=function(a,c){var g,f,e,h,i,j,k=this.size,l=this.yd,o=this.zd,n=this.field,t=k*Math.sqrt(a/c);t>k&&(t=k);for(e=0;e<t;e++)if(g=e/k,g*=g,h=a/(1.0E-4+g)-c,h>0){i=o*e;for(f=0;f<k;f++){j=i+f*l;for(g=0;g<k;g++)n[j+g]+=h}}};this.reset=function(){var a;for(a=0;a<this.size3;a++)this.normal_cache[a*3]=0,
+this.field[a]=0};this.render=function(a){this.begin();var c,g,f,e,h,i,j,k,l,o=this.size-2;for(e=1;e<o;e++){l=this.size2*e;j=(e-this.halfsize)/this.halfsize;for(f=1;f<o;f++){k=l+this.size*f;i=(f-this.halfsize)/this.halfsize;for(g=1;g<o;g++)h=(g-this.halfsize)/this.halfsize,c=k+g,this.polygonize(h,i,j,c,this.isolation,a)}}this.end(a)};this.generateGeometry=function(){var a=0,c=new THREE.Geometry,g=[];this.render(function(f){var e,h,i,j,k,l,o,n;for(e=0;e<f.count;e++)o=e*3,k=o+1,n=o+2,h=f.positionArray[o],
+i=f.positionArray[k],j=f.positionArray[n],l=new THREE.Vector3(h,i,j),h=f.normalArray[o],i=f.normalArray[k],j=f.normalArray[n],o=new THREE.Vector3(h,i,j),o.normalize(),k=new THREE.Vertex(l),c.vertices.push(k),g.push(o);l=f.count/3;for(e=0;e<l;e++)o=(a+e)*3,k=o+1,n=o+2,h=g[o],i=g[k],j=g[n],o=new THREE.Face3(o,k,n,[h,i,j]),c.faces.push(o);a+=l;f.count=0});return c};this.init(a)};THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
 THREE.edgeTable=new Int32Array([0,265,515,778,1030,1295,1541,1804,2060,2309,2575,2822,3082,3331,3593,3840,400,153,915,666,1430,1183,1941,1692,2460,2197,2975,2710,3482,3219,3993,3728,560,825,51,314,1590,1855,1077,1340,2620,2869,2111,2358,3642,3891,3129,3376,928,681,419,170,1958,1711,1445,1196,2988,2725,2479,2214,4010,3747,3497,3232,1120,1385,1635,1898,102,367,613,876,3180,3429,3695,3942,2154,2403,2665,2912,1520,1273,2035,1786,502,255,1013,764,3580,3317,4095,3830,2554,2291,3065,2800,1616,1881,1107,
 1370,598,863,85,348,3676,3925,3167,3414,2650,2899,2137,2384,1984,1737,1475,1226,966,719,453,204,4044,3781,3535,3270,3018,2755,2505,2240,2240,2505,2755,3018,3270,3535,3781,4044,204,453,719,966,1226,1475,1737,1984,2384,2137,2899,2650,3414,3167,3925,3676,348,85,863,598,1370,1107,1881,1616,2800,3065,2291,2554,3830,4095,3317,3580,764,1013,255,502,1786,2035,1273,1520,2912,2665,2403,2154,3942,3695,3429,3180,876,613,367,102,1898,1635,1385,1120,3232,3497,3747,4010,2214,2479,2725,2988,1196,1445,1711,1958,170,
 419,681,928,3376,3129,3891,3642,2358,2111,2869,2620,1340,1077,1855,1590,314,51,825,560,3728,3993,3219,3482,2710,2975,2197,2460,1692,1941,1183,1430,666,915,153,400,3840,3593,3331,3082,2822,2575,2309,2060,1804,1541,1295,1030,778,515,265,0]);
@@ -339,23 +341,23 @@ THREE.triTable=new Int32Array([-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0
 -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,10,8,10,11,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,0,9,3,9,11,11,9,10,-1,-1,-1,-1,-1,-1,-1,0,1,10,0,10,8,8,10,11,-1,-1,-1,-1,-1,-1,-1,3,1,10,11,3,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,2,11,1,11,9,9,11,8,-1,-1,-1,-1,-1,-1,-1,3,0,9,3,9,11,1,2,9,2,11,9,-1,-1,-1,-1,0,2,11,8,0,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,2,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,3,8,2,8,10,10,8,9,-1,-1,-1,-1,-1,-1,-1,9,10,2,0,9,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,3,8,2,8,10,0,1,8,1,10,8,-1,-1,-1,-1,1,10,
 2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,3,8,9,1,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,9,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,3,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1]);THREE.PlaneCollider=function(a,c){this.point=a;this.normal=c};THREE.SphereCollider=function(a,c){this.center=a;this.radius=c;this.radiusSq=c*c};THREE.BoxCollider=function(a,c){this.min=a;this.max=c;this.dynamic=!0;this.normal=new THREE.Vector3};
 THREE.MeshCollider=function(a,c){this.mesh=a;this.box=c;this.numFaces=this.mesh.geometry.faces.length;this.normal=new THREE.Vector3};THREE.CollisionSystem=function(){this.collisionNormal=new THREE.Vector3;this.colliders=[];this.hits=[]};THREE.Collisions=new THREE.CollisionSystem;THREE.CollisionSystem.prototype.merge=function(a){Array.prototype.push.apply(this.colliders,a.colliders);Array.prototype.push.apply(this.hits,a.hits)};
-THREE.CollisionSystem.prototype.rayCastAll=function(a){a.direction.normalize();this.hits.length=0;var c,b,d,f,g=0;c=0;for(b=this.colliders.length;c<b;c++)if(f=this.colliders[c],d=this.rayCast(a,f),d<Number.MAX_VALUE)f.distance=d,d>g?this.hits.push(f):this.hits.unshift(f),g=d;return this.hits};
+THREE.CollisionSystem.prototype.rayCastAll=function(a){a.direction.normalize();this.hits.length=0;var c,b,d,g,f=0;c=0;for(b=this.colliders.length;c<b;c++)if(g=this.colliders[c],d=this.rayCast(a,g),d<Number.MAX_VALUE)g.distance=d,d>f?this.hits.push(g):this.hits.unshift(g),f=d;return this.hits};
 THREE.CollisionSystem.prototype.rayCastNearest=function(a){var c=this.rayCastAll(a);if(c.length==0)return null;for(var b=0;c[b]instanceof THREE.MeshCollider;){var d=this.rayMesh(a,c[b]);if(d.dist<Number.MAX_VALUE){c[b].distance=d.dist;c[b].faceIndex=d.faceIndex;break}b++}if(b>c.length)return null;return c[b]};
 THREE.CollisionSystem.prototype.rayCast=function(a,c){if(c instanceof THREE.PlaneCollider)return this.rayPlane(a,c);else if(c instanceof THREE.SphereCollider)return this.raySphere(a,c);else if(c instanceof THREE.BoxCollider)return this.rayBox(a,c);else if(c instanceof THREE.MeshCollider&&c.box)return this.rayBox(a,c.box)};
-THREE.CollisionSystem.prototype.rayMesh=function(a,c){for(var b=this.makeRayLocal(a,c.mesh),d=Number.MAX_VALUE,f,g=0;g<c.numFaces;g++){var e=c.mesh.geometry.faces[g],h=c.mesh.geometry.vertices[e.a].position,i=c.mesh.geometry.vertices[e.b].position,j=c.mesh.geometry.vertices[e.c].position,k=e instanceof THREE.Face4?c.mesh.geometry.vertices[e.d].position:null;e instanceof THREE.Face3?(e=this.rayTriangle(b,h,i,j,d,this.collisionNormal,c.mesh),e<d&&(d=e,f=g,c.normal.copy(this.collisionNormal),c.normal.normalize())):
-e instanceof THREE.Face4&&(e=this.rayTriangle(b,h,i,k,d,this.collisionNormal,c.mesh),e<d&&(d=e,f=g,c.normal.copy(this.collisionNormal),c.normal.normalize()),e=this.rayTriangle(b,i,j,k,d,this.collisionNormal,c.mesh),e<d&&(d=e,f=g,c.normal.copy(this.collisionNormal),c.normal.normalize()))}return{dist:d,faceIndex:f}};
-THREE.CollisionSystem.prototype.rayTriangle=function(a,c,b,d,f,g,e){var h=THREE.CollisionSystem.__v1,i=THREE.CollisionSystem.__v2;g.set(0,0,0);h.sub(b,c);i.sub(d,b);g.cross(h,i);h=g.dot(a.direction);if(!(h<0))if(e.doubleSided||e.flipSided)g.multiplyScalar(-1),h*=-1;else return Number.MAX_VALUE;e=g.dot(c)-g.dot(a.origin);if(!(e<=0))return Number.MAX_VALUE;if(!(e>=h*f))return Number.MAX_VALUE;e/=h;h=THREE.CollisionSystem.__v3;h.copy(a.direction);h.multiplyScalar(e);h.addSelf(a.origin);Math.abs(g.x)>
-Math.abs(g.y)?Math.abs(g.x)>Math.abs(g.z)?(a=h.y-c.y,g=b.y-c.y,f=d.y-c.y,h=h.z-c.z,b=b.z-c.z,d=d.z-c.z):(a=h.x-c.x,g=b.x-c.x,f=d.x-c.x,h=h.y-c.y,b=b.y-c.y,d=d.y-c.y):Math.abs(g.y)>Math.abs(g.z)?(a=h.x-c.x,g=b.x-c.x,f=d.x-c.x,h=h.z-c.z,b=b.z-c.z,d=d.z-c.z):(a=h.x-c.x,g=b.x-c.x,f=d.x-c.x,h=h.y-c.y,b=b.y-c.y,d=d.y-c.y);c=g*d-b*f;if(c==0)return Number.MAX_VALUE;c=1/c;d=(a*d-h*f)*c;if(!(d>=0))return Number.MAX_VALUE;c*=g*h-b*a;if(!(c>=0))return Number.MAX_VALUE;if(!(1-d-c>=0))return Number.MAX_VALUE;return e};
+THREE.CollisionSystem.prototype.rayMesh=function(a,c){for(var b=this.makeRayLocal(a,c.mesh),d=Number.MAX_VALUE,g,f=0;f<c.numFaces;f++){var e=c.mesh.geometry.faces[f],h=c.mesh.geometry.vertices[e.a].position,i=c.mesh.geometry.vertices[e.b].position,j=c.mesh.geometry.vertices[e.c].position,k=e instanceof THREE.Face4?c.mesh.geometry.vertices[e.d].position:null;e instanceof THREE.Face3?(e=this.rayTriangle(b,h,i,j,d,this.collisionNormal,c.mesh),e<d&&(d=e,g=f,c.normal.copy(this.collisionNormal),c.normal.normalize())):
+e instanceof THREE.Face4&&(e=this.rayTriangle(b,h,i,k,d,this.collisionNormal,c.mesh),e<d&&(d=e,g=f,c.normal.copy(this.collisionNormal),c.normal.normalize()),e=this.rayTriangle(b,i,j,k,d,this.collisionNormal,c.mesh),e<d&&(d=e,g=f,c.normal.copy(this.collisionNormal),c.normal.normalize()))}return{dist:d,faceIndex:g}};
+THREE.CollisionSystem.prototype.rayTriangle=function(a,c,b,d,g,f,e){var h=THREE.CollisionSystem.__v1,i=THREE.CollisionSystem.__v2;f.set(0,0,0);h.sub(b,c);i.sub(d,b);f.cross(h,i);h=f.dot(a.direction);if(!(h<0))if(e.doubleSided||e.flipSided)f.multiplyScalar(-1),h*=-1;else return Number.MAX_VALUE;e=f.dot(c)-f.dot(a.origin);if(!(e<=0))return Number.MAX_VALUE;if(!(e>=h*g))return Number.MAX_VALUE;e/=h;h=THREE.CollisionSystem.__v3;h.copy(a.direction);h.multiplyScalar(e);h.addSelf(a.origin);Math.abs(f.x)>
+Math.abs(f.y)?Math.abs(f.x)>Math.abs(f.z)?(a=h.y-c.y,f=b.y-c.y,g=d.y-c.y,h=h.z-c.z,b=b.z-c.z,d=d.z-c.z):(a=h.x-c.x,f=b.x-c.x,g=d.x-c.x,h=h.y-c.y,b=b.y-c.y,d=d.y-c.y):Math.abs(f.y)>Math.abs(f.z)?(a=h.x-c.x,f=b.x-c.x,g=d.x-c.x,h=h.z-c.z,b=b.z-c.z,d=d.z-c.z):(a=h.x-c.x,f=b.x-c.x,g=d.x-c.x,h=h.y-c.y,b=b.y-c.y,d=d.y-c.y);c=f*d-b*g;if(c==0)return Number.MAX_VALUE;c=1/c;d=(a*d-h*g)*c;if(!(d>=0))return Number.MAX_VALUE;c*=f*h-b*a;if(!(c>=0))return Number.MAX_VALUE;if(!(1-d-c>=0))return Number.MAX_VALUE;return e};
 THREE.CollisionSystem.prototype.makeRayLocal=function(a,c){var b=THREE.CollisionSystem.__m;b.getInverse(c.matrixWorld);var d=THREE.CollisionSystem.__r;d.origin.copy(a.origin);d.direction.copy(a.direction);b.multiplyVector3(d.origin);b.rotateAxis(d.direction);d.direction.normalize();return d};
-THREE.CollisionSystem.prototype.rayBox=function(a,c){var b;c.dynamic&&c.mesh&&c.mesh.matrixWorld?b=this.makeRayLocal(a,c.mesh):(b=THREE.CollisionSystem.__r,b.origin.copy(a.origin),b.direction.copy(a.direction));var d=0,f=0,g=0,e=0,h=0,i=0,j=!0;b.origin.x<c.min.x?(d=c.min.x-b.origin.x,d/=b.direction.x,j=!1,e=-1):b.origin.x>c.max.x&&(d=c.max.x-b.origin.x,d/=b.direction.x,j=!1,e=1);b.origin.y<c.min.y?(f=c.min.y-b.origin.y,f/=b.direction.y,j=!1,h=-1):b.origin.y>c.max.y&&(f=c.max.y-b.origin.y,f/=b.direction.y,
-j=!1,h=1);b.origin.z<c.min.z?(g=c.min.z-b.origin.z,g/=b.direction.z,j=!1,i=-1):b.origin.z>c.max.z&&(g=c.max.z-b.origin.z,g/=b.direction.z,j=!1,i=1);if(j)return-1;j=0;f>d&&(j=1,d=f);g>d&&(j=2,d=g);switch(j){case 0:h=b.origin.y+b.direction.y*d;if(h<c.min.y||h>c.max.y)return Number.MAX_VALUE;b=b.origin.z+b.direction.z*d;if(b<c.min.z||b>c.max.z)return Number.MAX_VALUE;c.normal.set(e,0,0);break;case 1:e=b.origin.x+b.direction.x*d;if(e<c.min.x||e>c.max.x)return Number.MAX_VALUE;b=b.origin.z+b.direction.z*
+THREE.CollisionSystem.prototype.rayBox=function(a,c){var b;c.dynamic&&c.mesh&&c.mesh.matrixWorld?b=this.makeRayLocal(a,c.mesh):(b=THREE.CollisionSystem.__r,b.origin.copy(a.origin),b.direction.copy(a.direction));var d=0,g=0,f=0,e=0,h=0,i=0,j=!0;b.origin.x<c.min.x?(d=c.min.x-b.origin.x,d/=b.direction.x,j=!1,e=-1):b.origin.x>c.max.x&&(d=c.max.x-b.origin.x,d/=b.direction.x,j=!1,e=1);b.origin.y<c.min.y?(g=c.min.y-b.origin.y,g/=b.direction.y,j=!1,h=-1):b.origin.y>c.max.y&&(g=c.max.y-b.origin.y,g/=b.direction.y,
+j=!1,h=1);b.origin.z<c.min.z?(f=c.min.z-b.origin.z,f/=b.direction.z,j=!1,i=-1):b.origin.z>c.max.z&&(f=c.max.z-b.origin.z,f/=b.direction.z,j=!1,i=1);if(j)return-1;j=0;g>d&&(j=1,d=g);f>d&&(j=2,d=f);switch(j){case 0:h=b.origin.y+b.direction.y*d;if(h<c.min.y||h>c.max.y)return Number.MAX_VALUE;b=b.origin.z+b.direction.z*d;if(b<c.min.z||b>c.max.z)return Number.MAX_VALUE;c.normal.set(e,0,0);break;case 1:e=b.origin.x+b.direction.x*d;if(e<c.min.x||e>c.max.x)return Number.MAX_VALUE;b=b.origin.z+b.direction.z*
 d;if(b<c.min.z||b>c.max.z)return Number.MAX_VALUE;c.normal.set(0,h,0);break;case 2:e=b.origin.x+b.direction.x*d;if(e<c.min.x||e>c.max.x)return Number.MAX_VALUE;h=b.origin.y+b.direction.y*d;if(h<c.min.y||h>c.max.y)return Number.MAX_VALUE;c.normal.set(0,0,i)}return d};THREE.CollisionSystem.prototype.rayPlane=function(a,c){var b=a.direction.dot(c.normal),d=c.point.dot(c.normal);if(b<0)b=(d-a.origin.dot(c.normal))/b;else return Number.MAX_VALUE;return b>0?b:Number.MAX_VALUE};
 THREE.CollisionSystem.prototype.raySphere=function(a,c){var b=c.center.clone().subSelf(a.origin);if(b.lengthSq<c.radiusSq)return-1;var d=b.dot(a.direction.clone());if(d<=0)return Number.MAX_VALUE;b=c.radiusSq-(b.lengthSq()-d*d);if(b>=0)return Math.abs(d)-Math.sqrt(b);return Number.MAX_VALUE};THREE.CollisionSystem.__v1=new THREE.Vector3;THREE.CollisionSystem.__v2=new THREE.Vector3;THREE.CollisionSystem.__v3=new THREE.Vector3;THREE.CollisionSystem.__nr=new THREE.Vector3;THREE.CollisionSystem.__m=new THREE.Matrix4;
 THREE.CollisionSystem.__r=new THREE.Ray;THREE.CollisionUtils={};THREE.CollisionUtils.MeshOBB=function(a){a.geometry.computeBoundingBox();var c=a.geometry.boundingBox,b=new THREE.Vector3(c.x[0],c.y[0],c.z[0]),c=new THREE.Vector3(c.x[1],c.y[1],c.z[1]),b=new THREE.BoxCollider(b,c);b.mesh=a;return b};THREE.CollisionUtils.MeshAABB=function(a){var c=THREE.CollisionUtils.MeshOBB(a);c.min.addSelf(a.position);c.max.addSelf(a.position);c.dynamic=!1;return c};
 THREE.CollisionUtils.MeshColliderWBox=function(a){return new THREE.MeshCollider(a,THREE.CollisionUtils.MeshOBB(a))};
-if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoUpdateScene=!1;var c=this,b=this.setSize,d=this.render,f=new THREE.PerspectiveCamera,g=new THREE.PerspectiveCamera,e=new THREE.Matrix4,h=new THREE.Matrix4,i,j,k,m;f.matrixAutoUpdate=g.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},o=new THREE.WebGLRenderTarget(512,512,a),n=new THREE.WebGLRenderTarget(512,512,a),t=new THREE.PerspectiveCamera(53,
+if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoUpdateScene=!1;var c=this,b=this.setSize,d=this.render,g=new THREE.PerspectiveCamera,f=new THREE.PerspectiveCamera,e=new THREE.Matrix4,h=new THREE.Matrix4,i,j,k,l;g.matrixAutoUpdate=f.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},o=new THREE.WebGLRenderTarget(512,512,a),n=new THREE.WebGLRenderTarget(512,512,a),t=new THREE.PerspectiveCamera(53,
 1,1,1E4);t.position.z=2;var a=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:o},mapRight:{type:"t",value:1,texture:n}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D mapLeft;\nuniform sampler2D mapRight;\nvarying vec2 vUv;\nvoid main() {\nvec4 colorL, colorR;\nvec2 uv = vUv;\ncolorL = texture2D( mapLeft, uv );\ncolorR = texture2D( mapRight, uv );\ngl_FragColor = vec4( colorL.g * 0.7 + colorL.b * 0.3, colorR.g, colorR.b, colorL.a + colorR.a ) * 1.1;\n}"}),
-q=new THREE.Scene;q.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),a));q.add(t);this.setSize=function(a,d){b.call(c,a,d);o.width=a;o.height=d;n.width=a;n.height=d};this.render=function(a,b){a.updateMatrixWorld();if(i!==b.aspect||j!==b.near||k!==b.far||m!==b.fov){i=b.aspect;j=b.near;k=b.far;m=b.fov;var s=b.projectionMatrix.clone(),l=125/30*0.5,v=l*j/125,w=j*Math.tan(m*Math.PI/360),x;e.n14=l;h.n14=-l;l=-w*i+v;x=w*i+v;s.n11=2*j/(x-l);s.n13=(x+l)/(x-l);f.projectionMatrix.copy(s);l=-w*i-v;x=w*i-v;s.n11=
-2*j/(x-l);s.n13=(x+l)/(x-l);g.projectionMatrix.copy(s)}f.matrixWorld.copy(b.matrixWorld).multiplySelf(h);f.position.copy(b.position);f.near=b.near;f.far=b.far;d.call(c,a,f,o,!0);g.matrixWorld.copy(b.matrixWorld).multiplySelf(e);g.position.copy(b.position);g.near=b.near;g.far=b.far;d.call(c,a,g,n,!0);q.updateMatrixWorld();d.call(c,q,t)}};
-if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoClear=!1;var c=this,b=this.setSize,d=this.render,f,g,e=new THREE.PerspectiveCamera;e.target=new THREE.Vector3(0,0,0);var h=new THREE.PerspectiveCamera;h.target=new THREE.Vector3(0,0,0);c.separation=10;if(a&&a.separation!==void 0)c.separation=a.separation;this.setSize=function(a,d){b.call(c,a,d);f=a/2;g=d};this.render=function(a,b){this.clear();e.fov=b.fov;e.aspect=0.5*b.aspect;e.near=b.near;e.far=
-b.far;e.updateProjectionMatrix();e.position.copy(b.position);e.target.copy(b.target);e.translateX(c.separation);e.lookAt(e.target);h.projectionMatrix=e.projectionMatrix;h.position.copy(b.position);h.target.copy(b.target);h.translateX(-c.separation);h.lookAt(h.target);this.setViewport(0,0,f,g);d.call(c,a,e);this.setViewport(f,0,f,g);d.call(c,a,h,!1)}};
+q=new THREE.Scene;q.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),a));q.add(t);this.setSize=function(a,d){b.call(c,a,d);o.width=a;o.height=d;n.width=a;n.height=d};this.render=function(a,b){a.updateMatrixWorld();if(i!==b.aspect||j!==b.near||k!==b.far||l!==b.fov){i=b.aspect;j=b.near;k=b.far;l=b.fov;var s=b.projectionMatrix.clone(),m=125/30*0.5,v=m*j/125,w=j*Math.tan(l*Math.PI/360),x;e.n14=m;h.n14=-m;m=-w*i+v;x=w*i+v;s.n11=2*j/(x-m);s.n13=(x+m)/(x-m);g.projectionMatrix.copy(s);m=-w*i-v;x=w*i-v;s.n11=
+2*j/(x-m);s.n13=(x+m)/(x-m);f.projectionMatrix.copy(s)}g.matrixWorld.copy(b.matrixWorld).multiplySelf(h);g.position.copy(b.position);g.near=b.near;g.far=b.far;d.call(c,a,g,o,!0);f.matrixWorld.copy(b.matrixWorld).multiplySelf(e);f.position.copy(b.position);f.near=b.near;f.far=b.far;d.call(c,a,f,n,!0);q.updateMatrixWorld();d.call(c,q,t)}};
+if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoClear=!1;var c=this,b=this.setSize,d=this.render,g,f,e=new THREE.PerspectiveCamera;e.target=new THREE.Vector3(0,0,0);var h=new THREE.PerspectiveCamera;h.target=new THREE.Vector3(0,0,0);c.separation=10;if(a&&a.separation!==void 0)c.separation=a.separation;this.setSize=function(a,d){b.call(c,a,d);g=a/2;f=d};this.render=function(a,b){this.clear();e.fov=b.fov;e.aspect=0.5*b.aspect;e.near=b.near;e.far=
+b.far;e.updateProjectionMatrix();e.position.copy(b.position);e.target.copy(b.target);e.translateX(c.separation);e.lookAt(e.target);h.projectionMatrix=e.projectionMatrix;h.position.copy(b.position);h.target.copy(b.target);h.translateX(-c.separation);h.lookAt(h.target);this.setViewport(0,0,g,f);d.call(c,a,e);this.setViewport(g,0,g,f);d.call(c,a,h,!1)}};

File diff suppressed because it is too large
+ 5 - 18
examples/models/animated/horse.js


File diff suppressed because it is too large
+ 6 - 19
examples/obj/Suzanne.js


+ 22 - 24
examples/obj/camaro/CamaroNoUv_bin.js

@@ -1,22 +1,23 @@
-// Converted from: ../../examples/obj/camaro/CamaroNoUv.obj
-//  vertices: 53139
-//  faces: 93251
-//  materials: 9
-//
-//  Generated with OBJ -> Three.js converter
-//  http://github.com/alteredq/three.js/blob/master/utils/exporters/convert_obj_three.py
+{
 
-
-var model = {
-
-    "version" : 1,
+    "metadata" :
+    {
+        "formatVersion" : 3,
+        "sourceFile"    : "CamaroNoUv.obj",
+        "generatedBy"   : "OBJConverter",
+        "vertices"      : 53139,
+        "faces"         : 93251,
+        "normals"       : 46141,
+        "uvs"           : 0,
+        "materials"     : 9
+    },
 
     "materials": [	{
 	"DbgColor" : 15658734,
 	"DbgIndex" : 0,
 	"DbgName" : "Body",
 	"colorAmbient" : [0.0, 0.0, 0.0],
-	"colorDiffuse" : [0.22700000000000001, 0.40799999999999997, 0.46300000000000002],
+	"colorDiffuse" : [0.227, 0.408, 0.463],
 	"colorSpecular" : [2.0, 2.0, 2.0],
 	"illumination" : 2,
 	"opticalDensity" : 1.0,
@@ -29,7 +30,7 @@ var model = {
 	"DbgIndex" : 1,
 	"DbgName" : "mirror",
 	"colorAmbient" : [0.0, 0.0, 0.0],
-	"colorDiffuse" : [0.29999999999999999, 0.29999999999999999, 0.29999999999999999],
+	"colorDiffuse" : [0.3, 0.3, 0.3],
 	"colorSpecular" : [2.0, 2.0, 2.0],
 	"illumination" : 2,
 	"opticalDensity" : 1.0,
@@ -42,8 +43,8 @@ var model = {
 	"DbgIndex" : 2,
 	"DbgName" : "black",
 	"colorAmbient" : [0.0, 0.0, 0.0],
-	"colorDiffuse" : [0.10199999999999999, 0.10199999999999999, 0.10199999999999999],
-	"colorSpecular" : [0.20000000000000001, 0.20000000000000001, 0.20000000000000001],
+	"colorDiffuse" : [0.102, 0.102, 0.102],
+	"colorSpecular" : [0.2, 0.2, 0.2],
 	"illumination" : 2,
 	"opticalDensity" : 1.0,
 	"specularCoef" : 7.843137,
@@ -68,7 +69,7 @@ var model = {
 	"DbgIndex" : 4,
 	"DbgName" : "glass",
 	"colorAmbient" : [0.0, 0.0, 0.0],
-	"colorDiffuse" : [0.20000000000000001, 0.31, 0.30599999999999999],
+	"colorDiffuse" : [0.2, 0.31, 0.306],
 	"colorSpecular" : [2.0, 2.0, 2.0],
 	"illumination" : 2,
 	"opticalDensity" : 1.0,
@@ -81,7 +82,7 @@ var model = {
 	"DbgIndex" : 5,
 	"DbgName" : "Interieur",
 	"colorAmbient" : [0.0, 0.0, 0.0],
-	"colorDiffuse" : [0.10199999999999999, 0.10199999999999999, 0.10199999999999999],
+	"colorDiffuse" : [0.102, 0.102, 0.102],
 	"colorSpecular" : [0.44, 0.44, 0.44],
 	"illumination" : 2,
 	"opticalDensity" : 1.0,
@@ -94,8 +95,8 @@ var model = {
 	"DbgIndex" : 6,
 	"DbgName" : "tire",
 	"colorAmbient" : [0.0, 0.0, 0.0],
-	"colorDiffuse" : [0.27100000000000002, 0.27100000000000002, 0.26300000000000001],
-	"colorSpecular" : [0.10000000000000001, 0.10000000000000001, 0.10000000000000001],
+	"colorDiffuse" : [0.271, 0.271, 0.263],
+	"colorSpecular" : [0.1, 0.1, 0.1],
 	"illumination" : 2,
 	"opticalDensity" : 1.0,
 	"specularCoef" : 17.647059,
@@ -108,7 +109,7 @@ var model = {
 	"DbgName" : "tireling",
 	"colorAmbient" : [0.0, 0.0, 0.0],
 	"colorDiffuse" : [0.5, 0.5, 0.5],
-	"colorSpecular" : [0.20000000000000001, 0.20000000000000001, 0.20000000000000001],
+	"colorSpecular" : [0.2, 0.2, 0.2],
 	"illumination" : 2,
 	"opticalDensity" : 1.0,
 	"specularCoef" : 17.647059,
@@ -130,7 +131,4 @@ var model = {
 
     "buffers": "CamaroNoUv_bin.bin"
 
-};
-    
-postMessage( model );
-close();
+}

+ 88 - 90
examples/obj/f50/F50NoUv_bin.js

@@ -1,27 +1,28 @@
-// Converted from: ../../examples/obj/f50/F50NoUv.obj
-//  vertices: 67006
-//  faces: 97474
-//  materials: 25
-//
-//  Generated with OBJ -> Three.js converter
-//  http://github.com/alteredq/three.js/blob/master/utils/exporters/convert_obj_three.py
+{
 
-
-var model = {
-
-    "version" : 1,
+    "metadata" :
+    {
+        "formatVersion" : 3,
+        "sourceFile"    : "F50NoUv.obj",
+        "generatedBy"   : "OBJConverter",
+        "vertices"      : 67006,
+        "faces"         : 97474,
+        "normals"       : 53988,
+        "uvs"           : 0,
+        "materials"     : 25
+    },
 
     "materials": [	{
 	"DbgColor" : 15658734,
 	"DbgIndex" : 0,
 	"DbgName" : "F50NEGRO",
 	"colorAmbient" : [0.0, 0.0, 0.0],
-	"colorDiffuse" : [0.15376000000000001, 0.10983999999999999, 0.037679999999999998],
-	"colorSpecular" : [0.025000000000000001, 0.025000000000000001, 0.025000000000000001],
+	"colorDiffuse" : [0.15376, 0.10984, 0.03768],
+	"colorSpecular" : [0.025, 0.025, 0.025],
 	"illumination" : 2,
 	"opticalDensity" : 1.0,
 	"specularCoef" : 98.039216,
-	"transparency" : 1.0
+	"transparency" : 0.0
 	},
 
 	{
@@ -29,12 +30,12 @@ var model = {
 	"DbgIndex" : 1,
 	"DbgName" : "F50CROMO",
 	"colorAmbient" : [0.0, 0.0, 0.0],
-	"colorDiffuse" : [0.1004, 0.10352, 0.062719999999999998],
-	"colorSpecular" : [0.025000000000000001, 0.025000000000000001, 0.025000000000000001],
+	"colorDiffuse" : [0.1004, 0.10352, 0.06272],
+	"colorSpecular" : [0.025, 0.025, 0.025],
 	"illumination" : 2,
 	"opticalDensity" : 1.0,
 	"specularCoef" : 17.647059,
-	"transparency" : 1.0
+	"transparency" : 0.0
 	},
 
 	{
@@ -42,12 +43,12 @@ var model = {
 	"DbgIndex" : 2,
 	"DbgName" : "F50CRIST",
 	"colorAmbient" : [0.0, 0.0, 0.0],
-	"colorDiffuse" : [0.040800000000000003, 0.15687999999999999, 0.0031199999999999999],
-	"colorSpecular" : [0.025000000000000001, 0.025000000000000001, 0.025000000000000001],
+	"colorDiffuse" : [0.0408, 0.15688, 0.00312],
+	"colorSpecular" : [0.025, 0.025, 0.025],
 	"illumination" : 2,
 	"opticalDensity" : 1.0,
 	"specularCoef" : 98.039216,
-	"transparency" : 0.4
+	"transparency" : 0.6
 	},
 
 	{
@@ -55,12 +56,12 @@ var model = {
 	"DbgIndex" : 3,
 	"DbgName" : "F50ROJO",
 	"colorAmbient" : [0.0, 0.0, 0.0],
-	"colorDiffuse" : [0.56159999999999999, 0.043920000000000001, 0.069040000000000004],
-	"colorSpecular" : [0.025000000000000001, 0.025000000000000001, 0.025000000000000001],
+	"colorDiffuse" : [0.5616, 0.04392, 0.06904],
+	"colorSpecular" : [0.025, 0.025, 0.025],
 	"illumination" : 2,
 	"opticalDensity" : 1.0,
 	"specularCoef" : 98.039216,
-	"transparency" : 1.0
+	"transparency" : 0.0
 	},
 
 	{
@@ -68,12 +69,12 @@ var model = {
 	"DbgIndex" : 4,
 	"DbgName" : "F50NEGRO1",
 	"colorAmbient" : [0.0, 0.0, 0.0],
-	"colorDiffuse" : [0.15376000000000001, 0.10983999999999999, 0.037679999999999998],
-	"colorSpecular" : [0.025000000000000001, 0.025000000000000001, 0.025000000000000001],
+	"colorDiffuse" : [0.15376, 0.10984, 0.03768],
+	"colorSpecular" : [0.025, 0.025, 0.025],
 	"illumination" : 2,
 	"opticalDensity" : 1.0,
 	"specularCoef" : 98.039216,
-	"transparency" : 1.0
+	"transparency" : 0.0
 	},
 
 	{
@@ -81,12 +82,12 @@ var model = {
 	"DbgIndex" : 5,
 	"DbgName" : "F50ALFO",
 	"colorAmbient" : [0.0, 0.0, 0.0],
-	"colorDiffuse" : [0.15376000000000001, 0.10983999999999999, 0.037679999999999998],
-	"colorSpecular" : [0.025000000000000001, 0.025000000000000001, 0.025000000000000001],
+	"colorDiffuse" : [0.15376, 0.10984, 0.03768],
+	"colorSpecular" : [0.025, 0.025, 0.025],
 	"illumination" : 2,
 	"opticalDensity" : 1.0,
 	"specularCoef" : 98.039216,
-	"transparency" : 1.0
+	"transparency" : 0.0
 	},
 
 	{
@@ -94,12 +95,12 @@ var model = {
 	"DbgIndex" : 6,
 	"DbgName" : "F50REJIL",
 	"colorAmbient" : [0.0, 0.0, 0.0],
-	"colorDiffuse" : [0.15376000000000001, 0.10983999999999999, 0.037679999999999998],
-	"colorSpecular" : [0.025000000000000001, 0.025000000000000001, 0.025000000000000001],
+	"colorDiffuse" : [0.15376, 0.10984, 0.03768],
+	"colorSpecular" : [0.025, 0.025, 0.025],
 	"illumination" : 2,
 	"opticalDensity" : 1.0,
 	"specularCoef" : 98.039216,
-	"transparency" : 1.0
+	"transparency" : 0.0
 	},
 
 	{
@@ -107,12 +108,12 @@ var model = {
 	"DbgIndex" : 7,
 	"DbgName" : "F50RIGHT",
 	"colorAmbient" : [0.0, 0.0, 0.0],
-	"colorDiffuse" : [0.56159999999999999, 0.043920000000000001, 0.069040000000000004],
-	"colorSpecular" : [0.025000000000000001, 0.025000000000000001, 0.025000000000000001],
+	"colorDiffuse" : [0.5616, 0.04392, 0.06904],
+	"colorSpecular" : [0.025, 0.025, 0.025],
 	"illumination" : 2,
 	"opticalDensity" : 1.0,
 	"specularCoef" : 98.039216,
-	"transparency" : 1.0
+	"transparency" : 0.0
 	},
 
 	{
@@ -120,12 +121,12 @@ var model = {
 	"DbgIndex" : 8,
 	"DbgName" : "F50CAPO1",
 	"colorAmbient" : [0.0, 0.0, 0.0],
-	"colorDiffuse" : [0.56159999999999999, 0.043920000000000001, 0.069040000000000004],
-	"colorSpecular" : [0.025000000000000001, 0.025000000000000001, 0.025000000000000001],
+	"colorDiffuse" : [0.5616, 0.04392, 0.06904],
+	"colorSpecular" : [0.025, 0.025, 0.025],
 	"illumination" : 2,
 	"opticalDensity" : 1.0,
 	"specularCoef" : 98.039216,
-	"transparency" : 1.0
+	"transparency" : 0.0
 	},
 
 	{
@@ -133,12 +134,12 @@ var model = {
 	"DbgIndex" : 9,
 	"DbgName" : "F50CAPO",
 	"colorAmbient" : [0.0, 0.0, 0.0],
-	"colorDiffuse" : [0.56159999999999999, 0.043920000000000001, 0.069040000000000004],
-	"colorSpecular" : [0.025000000000000001, 0.025000000000000001, 0.025000000000000001],
+	"colorDiffuse" : [0.5616, 0.04392, 0.06904],
+	"colorSpecular" : [0.025, 0.025, 0.025],
 	"illumination" : 2,
 	"opticalDensity" : 1.0,
 	"specularCoef" : 98.039216,
-	"transparency" : 1.0
+	"transparency" : 0.0
 	},
 
 	{
@@ -146,12 +147,12 @@ var model = {
 	"DbgIndex" : 10,
 	"DbgName" : "F50LEFT",
 	"colorAmbient" : [0.0, 0.0, 0.0],
-	"colorDiffuse" : [0.56159999999999999, 0.043920000000000001, 0.069040000000000004],
-	"colorSpecular" : [0.025000000000000001, 0.025000000000000001, 0.025000000000000001],
+	"colorDiffuse" : [0.5616, 0.04392, 0.06904],
+	"colorSpecular" : [0.025, 0.025, 0.025],
 	"illumination" : 2,
 	"opticalDensity" : 1.0,
 	"specularCoef" : 98.039216,
-	"transparency" : 1.0
+	"transparency" : 0.0
 	},
 
 	{
@@ -159,12 +160,12 @@ var model = {
 	"DbgIndex" : 11,
 	"DbgName" : "F50MOTOR",
 	"colorAmbient" : [0.0, 0.0, 0.0],
-	"colorDiffuse" : [0.1004, 0.10352, 0.062719999999999998],
-	"colorSpecular" : [0.025000000000000001, 0.025000000000000001, 0.025000000000000001],
+	"colorDiffuse" : [0.1004, 0.10352, 0.06272],
+	"colorSpecular" : [0.025, 0.025, 0.025],
 	"illumination" : 2,
 	"opticalDensity" : 1.0,
 	"specularCoef" : 17.647059,
-	"transparency" : 1.0
+	"transparency" : 0.0
 	},
 
 	{
@@ -172,12 +173,12 @@ var model = {
 	"DbgIndex" : 12,
 	"DbgName" : "F50GOOD",
 	"colorAmbient" : [0.0, 0.0, 0.0],
-	"colorDiffuse" : [0.15376000000000001, 0.10983999999999999, 0.037679999999999998],
-	"colorSpecular" : [0.025000000000000001, 0.025000000000000001, 0.025000000000000001],
+	"colorDiffuse" : [0.15376, 0.10984, 0.03768],
+	"colorSpecular" : [0.025, 0.025, 0.025],
 	"illumination" : 2,
 	"opticalDensity" : 1.0,
 	"specularCoef" : 17.647059,
-	"transparency" : 1.0
+	"transparency" : 0.0
 	},
 
 	{
@@ -185,12 +186,12 @@ var model = {
 	"DbgIndex" : 13,
 	"DbgName" : "F50RUEDA",
 	"colorAmbient" : [0.0, 0.0, 0.0],
-	"colorDiffuse" : [0.15376000000000001, 0.10983999999999999, 0.037679999999999998],
-	"colorSpecular" : [0.025000000000000001, 0.025000000000000001, 0.025000000000000001],
+	"colorDiffuse" : [0.15376, 0.10984, 0.03768],
+	"colorSpecular" : [0.025, 0.025, 0.025],
 	"illumination" : 2,
 	"opticalDensity" : 1.0,
 	"specularCoef" : 17.647059,
-	"transparency" : 1.0
+	"transparency" : 0.0
 	},
 
 	{
@@ -198,12 +199,12 @@ var model = {
 	"DbgIndex" : 14,
 	"DbgName" : "F50SUELO",
 	"colorAmbient" : [0.0, 0.0, 0.0],
-	"colorDiffuse" : [0.15376000000000001, 0.10983999999999999, 0.037679999999999998],
-	"colorSpecular" : [0.025000000000000001, 0.025000000000000001, 0.025000000000000001],
+	"colorDiffuse" : [0.15376, 0.10984, 0.03768],
+	"colorSpecular" : [0.025, 0.025, 0.025],
 	"illumination" : 2,
 	"opticalDensity" : 1.0,
 	"specularCoef" : 98.039216,
-	"transparency" : 1.0
+	"transparency" : 0.0
 	},
 
 	{
@@ -211,12 +212,12 @@ var model = {
 	"DbgIndex" : 15,
 	"DbgName" : "F50DISCO",
 	"colorAmbient" : [0.0, 0.0, 0.0],
-	"colorDiffuse" : [0.41095999999999999, 0.36080000000000001, 0.25728000000000001],
-	"colorSpecular" : [0.025000000000000001, 0.025000000000000001, 0.025000000000000001],
+	"colorDiffuse" : [0.41096, 0.3608, 0.25728],
+	"colorSpecular" : [0.025, 0.025, 0.025],
 	"illumination" : 2,
 	"opticalDensity" : 1.0,
 	"specularCoef" : 17.647059,
-	"transparency" : 1.0
+	"transparency" : 0.0
 	},
 
 	{
@@ -224,12 +225,12 @@ var model = {
 	"DbgIndex" : 16,
 	"DbgName" : "F50FARYE",
 	"colorAmbient" : [0.0, 0.0, 0.0],
-	"colorDiffuse" : [0.79056000000000004, 0.41095999999999999, 0.0062399999999999999],
-	"colorSpecular" : [0.025000000000000001, 0.025000000000000001, 0.025000000000000001],
+	"colorDiffuse" : [0.79056, 0.41096, 0.00624],
+	"colorSpecular" : [0.025, 0.025, 0.025],
 	"illumination" : 2,
 	"opticalDensity" : 1.0,
 	"specularCoef" : 98.039216,
-	"transparency" : 0.6
+	"transparency" : 0.4
 	},
 
 	{
@@ -237,12 +238,12 @@ var model = {
 	"DbgIndex" : 17,
 	"DbgName" : "F5OLOGO",
 	"colorAmbient" : [0.0, 0.0, 0.0],
-	"colorDiffuse" : [0.41095999999999999, 0.36080000000000001, 0.25728000000000001],
-	"colorSpecular" : [0.025000000000000001, 0.025000000000000001, 0.025000000000000001],
+	"colorDiffuse" : [0.41096, 0.3608, 0.25728],
+	"colorSpecular" : [0.025, 0.025, 0.025],
 	"illumination" : 2,
 	"opticalDensity" : 1.0,
 	"specularCoef" : 17.647059,
-	"transparency" : 1.0
+	"transparency" : 0.0
 	},
 
 	{
@@ -250,12 +251,12 @@ var model = {
 	"DbgIndex" : 18,
 	"DbgName" : "F50FARED",
 	"colorAmbient" : [0.0, 0.0, 0.0],
-	"colorDiffuse" : [0.63056000000000001, 0.07528, 0.050160000000000003],
-	"colorSpecular" : [0.025000000000000001, 0.025000000000000001, 0.025000000000000001],
+	"colorDiffuse" : [0.63056, 0.07528, 0.05016],
+	"colorSpecular" : [0.025, 0.025, 0.025],
 	"illumination" : 2,
 	"opticalDensity" : 1.0,
 	"specularCoef" : 98.039216,
-	"transparency" : 0.7
+	"transparency" : 0.3
 	},
 
 	{
@@ -263,12 +264,12 @@ var model = {
 	"DbgIndex" : 19,
 	"DbgName" : "F50FARWD",
 	"colorAmbient" : [0.0, 0.0, 0.0],
-	"colorDiffuse" : [0.40472000000000002, 0.40472000000000002, 0.40472000000000002],
-	"colorSpecular" : [0.025000000000000001, 0.025000000000000001, 0.025000000000000001],
+	"colorDiffuse" : [0.40472, 0.40472, 0.40472],
+	"colorSpecular" : [0.025, 0.025, 0.025],
 	"illumination" : 2,
 	"opticalDensity" : 1.0,
 	"specularCoef" : 98.039216,
-	"transparency" : 0.7
+	"transparency" : 0.3
 	},
 
 	{
@@ -276,12 +277,12 @@ var model = {
 	"DbgIndex" : 20,
 	"DbgName" : "F50ASIEN",
 	"colorAmbient" : [0.0, 0.0, 0.0],
-	"colorDiffuse" : [0.56159999999999999, 0.043920000000000001, 0.069040000000000004],
-	"colorSpecular" : [0.025000000000000001, 0.025000000000000001, 0.025000000000000001],
+	"colorDiffuse" : [0.5616, 0.04392, 0.06904],
+	"colorSpecular" : [0.025, 0.025, 0.025],
 	"illumination" : 2,
 	"opticalDensity" : 1.0,
 	"specularCoef" : 98.039216,
-	"transparency" : 1.0
+	"transparency" : 0.0
 	},
 
 	{
@@ -289,12 +290,12 @@ var model = {
 	"DbgIndex" : 21,
 	"DbgName" : "F50MATR",
 	"colorAmbient" : [0.0, 0.0, 0.0],
-	"colorDiffuse" : [0.59919999999999995, 0.58984000000000003, 0.56472],
-	"colorSpecular" : [0.025000000000000001, 0.025000000000000001, 0.025000000000000001],
+	"colorDiffuse" : [0.5992, 0.58984, 0.56472],
+	"colorSpecular" : [0.025, 0.025, 0.025],
 	"illumination" : 2,
 	"opticalDensity" : 1.0,
 	"specularCoef" : 98.039216,
-	"transparency" : 1.0
+	"transparency" : 0.0
 	},
 
 	{
@@ -302,12 +303,12 @@ var model = {
 	"DbgIndex" : 22,
 	"DbgName" : "F50AIRE",
 	"colorAmbient" : [0.0, 0.0, 0.0],
-	"colorDiffuse" : [0.15376000000000001, 0.10983999999999999, 0.037679999999999998],
-	"colorSpecular" : [0.025000000000000001, 0.025000000000000001, 0.025000000000000001],
+	"colorDiffuse" : [0.15376, 0.10984, 0.03768],
+	"colorSpecular" : [0.025, 0.025, 0.025],
 	"illumination" : 2,
 	"opticalDensity" : 1.0,
 	"specularCoef" : 98.039216,
-	"transparency" : 1.0
+	"transparency" : 0.0
 	},
 
 	{
@@ -315,12 +316,12 @@ var model = {
 	"DbgIndex" : 23,
 	"DbgName" : "F50TOPAL",
 	"colorAmbient" : [0.0, 0.0, 0.0],
-	"colorDiffuse" : [0.56159999999999999, 0.043920000000000001, 0.069040000000000004],
-	"colorSpecular" : [0.025000000000000001, 0.025000000000000001, 0.025000000000000001],
+	"colorDiffuse" : [0.5616, 0.04392, 0.06904],
+	"colorSpecular" : [0.025, 0.025, 0.025],
 	"illumination" : 2,
 	"opticalDensity" : 1.0,
 	"specularCoef" : 98.039216,
-	"transparency" : 1.0
+	"transparency" : 0.0
 	},
 
 	{
@@ -328,17 +329,14 @@ var model = {
 	"DbgIndex" : 24,
 	"DbgName" : "F50TOPAL1",
 	"colorAmbient" : [0.0, 0.0, 0.0],
-	"colorDiffuse" : [0.56159999999999999, 0.043920000000000001, 0.069040000000000004],
-	"colorSpecular" : [0.025000000000000001, 0.025000000000000001, 0.025000000000000001],
+	"colorDiffuse" : [0.5616, 0.04392, 0.06904],
+	"colorSpecular" : [0.025, 0.025, 0.025],
 	"illumination" : 2,
 	"opticalDensity" : 1.0,
 	"specularCoef" : 98.039216,
-	"transparency" : 1.0
+	"transparency" : 0.0
 	}],
 
     "buffers": "F50NoUv_bin.bin"
 
-};
-    
-postMessage( model );
-close();
+}

BIN
examples/obj/female02/Female02_bin.bin


+ 25 - 27
examples/obj/female02/Female02_bin.js

@@ -1,23 +1,24 @@
-// Converted from: ../../examples/obj/female02/female02.obj
-//  vertices: 3274
-//  faces: 6233
-//  materials: 6
-//
-//  Generated with OBJ -> Three.js converter
-//  http://github.com/alteredq/three.js/blob/master/utils/exporters/convert_obj_three.py
+{
 
-
-var model = {
-
-    "version" : 1,
+    "metadata" :
+    {
+        "formatVersion" : 3,
+        "sourceFile"    : "female02.obj",
+        "generatedBy"   : "OBJConverter",
+        "vertices"      : 3274,
+        "faces"         : 6233,
+        "normals"       : 3292,
+        "uvs"           : 4935,
+        "materials"     : 6
+    },
 
     "materials": [	{
 	"DbgColor" : 15658734,
 	"DbgIndex" : 0,
 	"DbgName" : "_03_-_Default1noCulli__03_-_Default1noCulli",
 	"colorAmbient" : [0.0, 0.0, 0.0],
-	"colorDiffuse" : [0.64000000000000001, 0.64000000000000001, 0.64000000000000001],
-	"colorSpecular" : [0.16500000000000001, 0.16500000000000001, 0.16500000000000001],
+	"colorDiffuse" : [0.64, 0.64, 0.64],
+	"colorSpecular" : [0.165, 0.165, 0.165],
 	"illumination" : 2,
 	"mapDiffuse" : "03_-_Default1noCulling.JPG",
 	"opticalDensity" : 1.0,
@@ -30,8 +31,8 @@ var model = {
 	"DbgIndex" : 1,
 	"DbgName" : "_02_-_Default1noCulli__02_-_Default1noCulli",
 	"colorAmbient" : [0.0, 0.0, 0.0],
-	"colorDiffuse" : [0.64000000000000001, 0.64000000000000001, 0.64000000000000001],
-	"colorSpecular" : [0.16500000000000001, 0.16500000000000001, 0.16500000000000001],
+	"colorDiffuse" : [0.64, 0.64, 0.64],
+	"colorSpecular" : [0.165, 0.165, 0.165],
 	"illumination" : 2,
 	"mapDiffuse" : "02_-_Default1noCulling.JPG",
 	"opticalDensity" : 1.0,
@@ -44,8 +45,8 @@ var model = {
 	"DbgIndex" : 2,
 	"DbgName" : "FrontColorNoCullingID__02_-_Default1noCulli",
 	"colorAmbient" : [0.0, 0.0, 0.0],
-	"colorDiffuse" : [0.80000000000000004, 0.80000000000000004, 0.80000000000000004],
-	"colorSpecular" : [0.16500000000000001, 0.16500000000000001, 0.16500000000000001],
+	"colorDiffuse" : [0.8, 0.8, 0.8],
+	"colorSpecular" : [0.165, 0.165, 0.165],
 	"illumination" : 2,
 	"mapDiffuse" : "02_-_Default1noCulling.JPG",
 	"opticalDensity" : 1.0,
@@ -58,8 +59,8 @@ var model = {
 	"DbgIndex" : 3,
 	"DbgName" : "FrontColorNoCullingID__03_-_Default1noCulli",
 	"colorAmbient" : [0.0, 0.0, 0.0],
-	"colorDiffuse" : [0.80000000000000004, 0.80000000000000004, 0.80000000000000004],
-	"colorSpecular" : [0.16500000000000001, 0.16500000000000001, 0.16500000000000001],
+	"colorDiffuse" : [0.8, 0.8, 0.8],
+	"colorSpecular" : [0.165, 0.165, 0.165],
 	"illumination" : 2,
 	"mapDiffuse" : "03_-_Default1noCulling.JPG",
 	"opticalDensity" : 1.0,
@@ -72,8 +73,8 @@ var model = {
 	"DbgIndex" : 4,
 	"DbgName" : "_01_-_Default1noCulli__01_-_Default1noCulli",
 	"colorAmbient" : [0.0, 0.0, 0.0],
-	"colorDiffuse" : [0.64000000000000001, 0.64000000000000001, 0.64000000000000001],
-	"colorSpecular" : [0.16500000000000001, 0.16500000000000001, 0.16500000000000001],
+	"colorDiffuse" : [0.64, 0.64, 0.64],
+	"colorSpecular" : [0.165, 0.165, 0.165],
 	"illumination" : 2,
 	"mapDiffuse" : "01_-_Default1noCulling.JPG",
 	"opticalDensity" : 1.0,
@@ -86,8 +87,8 @@ var model = {
 	"DbgIndex" : 5,
 	"DbgName" : "FrontColorNoCullingID__01_-_Default1noCulli",
 	"colorAmbient" : [0.0, 0.0, 0.0],
-	"colorDiffuse" : [0.80000000000000004, 0.80000000000000004, 0.80000000000000004],
-	"colorSpecular" : [0.16500000000000001, 0.16500000000000001, 0.16500000000000001],
+	"colorDiffuse" : [0.8, 0.8, 0.8],
+	"colorSpecular" : [0.165, 0.165, 0.165],
 	"illumination" : 2,
 	"mapDiffuse" : "01_-_Default1noCulling.JPG",
 	"opticalDensity" : 1.0,
@@ -97,7 +98,4 @@ var model = {
 
     "buffers": "Female02_bin.bin"
 
-};
-    
-postMessage( model );
-close();
+}

File diff suppressed because it is too large
+ 14 - 15
examples/obj/female02/Female02_slim.js


+ 32 - 34
examples/obj/gallardo/GallardoNoUv_bin.js

@@ -1,27 +1,28 @@
-// Converted from: ../../examples/obj/gallardo/GallardoNoUv.obj
-//  vertices: 77815
-//  faces: 75573
-//  materials: 7
-//
-//  Generated with OBJ -> Three.js converter
-//  http://github.com/alteredq/three.js/blob/master/utils/exporters/convert_obj_three.py
+{
 
-
-var model = {
-
-    "version" : 1,
+    "metadata" :
+    {
+        "formatVersion" : 3,
+        "sourceFile"    : "GallardoNoUv.obj",
+        "generatedBy"   : "OBJConverter",
+        "vertices"      : 77815,
+        "faces"         : 75573,
+        "normals"       : 55191,
+        "uvs"           : 0,
+        "materials"     : 7
+    },
 
     "materials": [	{
 	"DbgColor" : 15658734,
 	"DbgIndex" : 0,
 	"DbgName" : "wire_255255255",
 	"colorAmbient" : [0.0, 0.0, 0.0],
-	"colorDiffuse" : [0.80000000000000004, 0.80000000000000004, 0.80000000000000004],
-	"colorSpecular" : [0.17499999999999999, 0.17499999999999999, 0.17499999999999999],
+	"colorDiffuse" : [0.8, 0.8, 0.8],
+	"colorSpecular" : [0.175, 0.175, 0.175],
 	"illumination" : 2,
 	"opticalDensity" : 1.0,
 	"specularCoef" : 29.411765,
-	"transparency" : 1.0
+	"transparency" : 0.0
 	},
 
 	{
@@ -29,12 +30,12 @@ var model = {
 	"DbgIndex" : 1,
 	"DbgName" : "wire_115115115",
 	"colorAmbient" : [0.0, 0.0, 0.0],
-	"colorDiffuse" : [0.36080000000000001, 0.36080000000000001, 0.36080000000000001],
-	"colorSpecular" : [0.17499999999999999, 0.17499999999999999, 0.17499999999999999],
+	"colorDiffuse" : [0.3608, 0.3608, 0.3608],
+	"colorSpecular" : [0.175, 0.175, 0.175],
 	"illumination" : 2,
 	"opticalDensity" : 1.0,
 	"specularCoef" : 29.411765,
-	"transparency" : 1.0
+	"transparency" : 0.0
 	},
 
 	{
@@ -42,12 +43,12 @@ var model = {
 	"DbgIndex" : 2,
 	"DbgName" : "03___Default",
 	"colorAmbient" : [0.0, 0.0, 0.0],
-	"colorDiffuse" : [0.13175999999999999, 0.13175999999999999, 0.13175999999999999],
+	"colorDiffuse" : [0.13176, 0.13176, 0.13176],
 	"colorSpecular" : [0.0, 0.0, 0.0],
 	"illumination" : 2,
 	"opticalDensity" : 1.0,
 	"specularCoef" : 7.843137,
-	"transparency" : 1.0
+	"transparency" : 0.0
 	},
 
 	{
@@ -55,12 +56,12 @@ var model = {
 	"DbgIndex" : 3,
 	"DbgName" : "02___Default",
 	"colorAmbient" : [0.0, 0.0, 0.0],
-	"colorDiffuse" : [0.80000000000000004, 0.0, 0.0],
-	"colorSpecular" : [0.65249999999999997, 0.65249999999999997, 0.65249999999999997],
+	"colorDiffuse" : [0.8, 0.0, 0.0],
+	"colorSpecular" : [0.6525, 0.6525, 0.6525],
 	"illumination" : 2,
 	"opticalDensity" : 1.0,
 	"specularCoef" : 25.490196,
-	"transparency" : 1.0
+	"transparency" : 0.0
 	},
 
 	{
@@ -68,12 +69,12 @@ var model = {
 	"DbgIndex" : 4,
 	"DbgName" : "wire_255000000",
 	"colorAmbient" : [0.0, 0.0, 0.0],
-	"colorDiffuse" : [0.80000000000000004, 0.0, 0.0],
-	"colorSpecular" : [0.17499999999999999, 0.17499999999999999, 0.17499999999999999],
+	"colorDiffuse" : [0.8, 0.0, 0.0],
+	"colorSpecular" : [0.175, 0.175, 0.175],
 	"illumination" : 2,
 	"opticalDensity" : 1.0,
 	"specularCoef" : 29.411765,
-	"transparency" : 1.0
+	"transparency" : 0.0
 	},
 
 	{
@@ -81,12 +82,12 @@ var model = {
 	"DbgIndex" : 5,
 	"DbgName" : "wire_252252000",
 	"colorAmbient" : [0.0, 0.0, 0.0],
-	"colorDiffuse" : [0.79056000000000004, 0.79056000000000004, 0.0],
-	"colorSpecular" : [0.17499999999999999, 0.17499999999999999, 0.17499999999999999],
+	"colorDiffuse" : [0.79056, 0.79056, 0.0],
+	"colorSpecular" : [0.175, 0.175, 0.175],
 	"illumination" : 2,
 	"opticalDensity" : 1.0,
 	"specularCoef" : 29.411765,
-	"transparency" : 1.0
+	"transparency" : 0.0
 	},
 
 	{
@@ -95,16 +96,13 @@ var model = {
 	"DbgName" : "wire_132132132",
 	"colorAmbient" : [0.0, 0.0, 0.0],
 	"colorDiffuse" : [0.41408, 0.41408, 0.41408],
-	"colorSpecular" : [0.17499999999999999, 0.17499999999999999, 0.17499999999999999],
+	"colorSpecular" : [0.175, 0.175, 0.175],
 	"illumination" : 2,
 	"opticalDensity" : 1.0,
 	"specularCoef" : 29.411765,
-	"transparency" : 1.0
+	"transparency" : 0.0
 	}],
 
     "buffers": "GallardoNoUv_bin.bin"
 
-};
-    
-postMessage( model );
-close();
+}

+ 13 - 15
examples/obj/gallardo/parts/gallardo_body_bin.js

@@ -1,15 +1,16 @@
-// Converted from: gallardo_body.obj
-//  vertices: 59791
-//  faces: 57252
-//  materials: 7
-//
-//  Generated with OBJ -> Three.js converter
-//  http://github.com/alteredq/three.js/blob/master/utils/exporters/convert_obj_three.py
+{
 
-
-var model = {
-
-    "version" : 1,
+    "metadata" :
+    {
+        "formatVersion" : 3,
+        "sourceFile"    : "gallardo_body.obj",
+        "generatedBy"   : "OBJConverter",
+        "vertices"      : 59791,
+        "faces"         : 57252,
+        "normals"       : 51045,
+        "uvs"           : 0,
+        "materials"     : 7
+    },
 
     "materials": [	{
 	"DbgColor" : 15658734,
@@ -104,7 +105,4 @@ var model = {
 
     "buffers": "gallardo_body_bin.bin"
 
-};
-
-postMessage( model );
-close();
+}

+ 14 - 16
examples/obj/gallardo/parts/gallardo_wheel_bin.js

@@ -1,15 +1,16 @@
-// Converted from: gallardo_wheel.obj
-//  vertices: 4434
-//  faces: 4394
-//  materials: 2
-//
-//  Generated with OBJ -> Three.js converter
-//  http://github.com/alteredq/three.js/blob/master/utils/exporters/convert_obj_three.py
-
-
-var model = {
-
-    "version" : 1,
+{
+
+    "metadata" :
+    {
+        "formatVersion" : 3,
+        "sourceFile"    : "gallardo_wheel.obj",
+        "generatedBy"   : "OBJConverter",
+        "vertices"      : 4434,
+        "faces"         : 4394,
+        "normals"       : 2654,
+        "uvs"           : 0,
+        "materials"     : 2
+    },
 
     "materials": [	{
 	"DbgColor" : 15658734,
@@ -39,7 +40,4 @@ var model = {
 
     "buffers": "gallardo_wheel_bin.bin"
 
-};
-
-postMessage( model );
-close();
+}

File diff suppressed because it is too large
+ 4 - 17
examples/obj/leeperrysmith/LeePerrySmith.js


+ 13 - 15
examples/obj/lucy/Lucy100k_bin.js

@@ -1,15 +1,16 @@
-// Converted from: ../../examples/obj/lucy/lucy100k.obj
-//  vertices: 50002
-//  faces: 100000
-//  materials: 0
-//
-//  Generated with OBJ -> Three.js converter
-//  http://github.com/alteredq/three.js/blob/master/utils/exporters/convert_obj_three.py
+{
 
-
-var model = {
-
-    "version" : 1,
+    "metadata" :
+    {
+        "formatVersion" : 3,
+        "sourceFile"    : "lucy100k.obj",
+        "generatedBy"   : "OBJConverter",
+        "vertices"      : 50002,
+        "faces"         : 100000,
+        "normals"       : 0,
+        "uvs"           : 0,
+        "materials"     : 0
+    },
 
     "materials": [	{
 	"DbgColor" : 15658734,
@@ -19,7 +20,4 @@ var model = {
 
     "buffers": "Lucy100k_bin.bin"
 
-};
-    
-postMessage( model );
-close();
+}

File diff suppressed because it is too large
+ 14 - 15
examples/obj/lucy/Lucy100k_slim.js


BIN
examples/obj/male02/Male02_bin.bin


+ 23 - 25
examples/obj/male02/Male02_bin.js

@@ -1,23 +1,24 @@
-// Converted from: ../../examples/obj/male02/male02.obj
-//  vertices: 2746
-//  faces: 5004
-//  materials: 5
-//
-//  Generated with OBJ -> Three.js converter
-//  http://github.com/alteredq/three.js/blob/master/utils/exporters/convert_obj_three.py
+{
 
-
-var model = {
-
-    "version" : 1,
+    "metadata" :
+    {
+        "formatVersion" : 3,
+        "sourceFile"    : "male02.obj",
+        "generatedBy"   : "OBJConverter",
+        "vertices"      : 2746,
+        "faces"         : 5004,
+        "normals"       : 2769,
+        "uvs"           : 3275,
+        "materials"     : 5
+    },
 
     "materials": [	{
 	"DbgColor" : 15658734,
 	"DbgIndex" : 0,
 	"DbgName" : "male-02-1noCullingID_male-02-1noCulling.JP",
 	"colorAmbient" : [0.0, 0.0, 0.0],
-	"colorDiffuse" : [0.64000000000000001, 0.64000000000000001, 0.64000000000000001],
-	"colorSpecular" : [0.16500000000000001, 0.16500000000000001, 0.16500000000000001],
+	"colorDiffuse" : [0.64, 0.64, 0.64],
+	"colorSpecular" : [0.165, 0.165, 0.165],
 	"illumination" : 2,
 	"mapDiffuse" : "male-02-1noCulling.JPG",
 	"opticalDensity" : 1.0,
@@ -30,8 +31,8 @@ var model = {
 	"DbgIndex" : 1,
 	"DbgName" : "orig_02_-_Defaul1noCu_orig_02_-_Defaul1noCu",
 	"colorAmbient" : [0.0, 0.0, 0.0],
-	"colorDiffuse" : [0.64000000000000001, 0.64000000000000001, 0.64000000000000001],
-	"colorSpecular" : [0.16500000000000001, 0.16500000000000001, 0.16500000000000001],
+	"colorDiffuse" : [0.64, 0.64, 0.64],
+	"colorSpecular" : [0.165, 0.165, 0.165],
 	"illumination" : 2,
 	"mapDiffuse" : "orig_02_-_Defaul1noCulling.JPG",
 	"opticalDensity" : 1.0,
@@ -44,8 +45,8 @@ var model = {
 	"DbgIndex" : 2,
 	"DbgName" : "FrontColorNoCullingID_orig_02_-_Defaul1noCu",
 	"colorAmbient" : [0.0, 0.0, 0.0],
-	"colorDiffuse" : [0.80000000000000004, 0.80000000000000004, 0.80000000000000004],
-	"colorSpecular" : [0.16500000000000001, 0.16500000000000001, 0.16500000000000001],
+	"colorDiffuse" : [0.8, 0.8, 0.8],
+	"colorSpecular" : [0.165, 0.165, 0.165],
 	"illumination" : 2,
 	"mapDiffuse" : "orig_02_-_Defaul1noCulling.JPG",
 	"opticalDensity" : 1.0,
@@ -58,8 +59,8 @@ var model = {
 	"DbgIndex" : 3,
 	"DbgName" : "_01_-_Default1noCulli__01_-_Default1noCulli",
 	"colorAmbient" : [0.0, 0.0, 0.0],
-	"colorDiffuse" : [0.64000000000000001, 0.64000000000000001, 0.64000000000000001],
-	"colorSpecular" : [0.16500000000000001, 0.16500000000000001, 0.16500000000000001],
+	"colorDiffuse" : [0.64, 0.64, 0.64],
+	"colorSpecular" : [0.165, 0.165, 0.165],
 	"illumination" : 2,
 	"mapDiffuse" : "01_-_Default1noCulling.JPG",
 	"opticalDensity" : 1.0,
@@ -72,8 +73,8 @@ var model = {
 	"DbgIndex" : 4,
 	"DbgName" : "FrontColorNoCullingID_male-02-1noCulling.JP",
 	"colorAmbient" : [0.0, 0.0, 0.0],
-	"colorDiffuse" : [0.80000000000000004, 0.80000000000000004, 0.80000000000000004],
-	"colorSpecular" : [0.16500000000000001, 0.16500000000000001, 0.16500000000000001],
+	"colorDiffuse" : [0.8, 0.8, 0.8],
+	"colorSpecular" : [0.165, 0.165, 0.165],
 	"illumination" : 2,
 	"mapDiffuse" : "male-02-1noCulling.JPG",
 	"opticalDensity" : 1.0,
@@ -83,7 +84,4 @@ var model = {
 
     "buffers": "Male02_bin.bin"
 
-};
-    
-postMessage( model );
-close();
+}

File diff suppressed because it is too large
+ 14 - 15
examples/obj/male02/Male02_slim.js


File diff suppressed because it is too large
+ 3 - 17
examples/obj/terrain.js


+ 29 - 31
examples/obj/veyron/VeyronNoUv_bin.js

@@ -1,27 +1,28 @@
-// Converted from: ../../examples/obj/veyron/VeyronNoUv.obj
-//  vertices: 36210
-//  faces: 33034
-//  materials: 8
-//
-//  Generated with OBJ -> Three.js converter
-//  http://github.com/alteredq/three.js/blob/master/utils/exporters/convert_obj_three.py
+{
 
-
-var model = {
-
-    "version" : 1,
+    "metadata" :
+    {
+        "formatVersion" : 3,
+        "sourceFile"    : "VeyronNoUv.obj",
+        "generatedBy"   : "OBJConverter",
+        "vertices"      : 36210,
+        "faces"         : 33034,
+        "normals"       : 31827,
+        "uvs"           : 0,
+        "materials"     : 8
+    },
 
     "materials": [	{
 	"DbgColor" : 15658734,
 	"DbgIndex" : 0,
 	"DbgName" : "08___Default",
 	"colorAmbient" : [0.0, 0.0, 0.0],
-	"colorDiffuse" : [0.18823999999999999, 0.18823999999999999, 0.18823999999999999],
-	"colorSpecular" : [0.14824999999999999, 0.14824999999999999, 0.14824999999999999],
+	"colorDiffuse" : [0.18824, 0.18824, 0.18824],
+	"colorSpecular" : [0.14825, 0.14825, 0.14825],
 	"illumination" : 2,
 	"opticalDensity" : 1.0,
 	"specularCoef" : 17.647059,
-	"transparency" : 1.0
+	"transparency" : 0.0
 	},
 
 	{
@@ -29,12 +30,12 @@ var model = {
 	"DbgIndex" : 1,
 	"DbgName" : "03___Default",
 	"colorAmbient" : [0.0, 0.0, 0.0],
-	"colorDiffuse" : [0.52703999999999995, 0.52703999999999995, 0.52703999999999995],
-	"colorSpecular" : [0.59999999999999998, 0.59999999999999998, 0.59999999999999998],
+	"colorDiffuse" : [0.52704, 0.52704, 0.52704],
+	"colorSpecular" : [0.6, 0.6, 0.6],
 	"illumination" : 2,
 	"opticalDensity" : 1.0,
 	"specularCoef" : 37.254902,
-	"transparency" : 1.0
+	"transparency" : 0.0
 	},
 
 	{
@@ -42,12 +43,12 @@ var model = {
 	"DbgIndex" : 2,
 	"DbgName" : "ColorBlack",
 	"colorAmbient" : [0.0, 0.0, 0.0],
-	"colorDiffuse" : [0.21648000000000001, 0.21648000000000001, 0.21648000000000001],
+	"colorDiffuse" : [0.21648, 0.21648, 0.21648],
 	"colorSpecular" : [0.75, 0.75, 0.75],
 	"illumination" : 2,
 	"opticalDensity" : 1.0,
 	"specularCoef" : 56.862745,
-	"transparency" : 1.0
+	"transparency" : 0.0
 	},
 
 	{
@@ -55,7 +56,7 @@ var model = {
 	"DbgIndex" : 3,
 	"DbgName" : "04___Default",
 	"colorAmbient" : [0.0, 0.0, 0.0],
-	"colorDiffuse" : [0.54271999999999998, 0.57408000000000003, 0.58984000000000003],
+	"colorDiffuse" : [0.54272, 0.57408, 0.58984],
 	"colorSpecular" : [0.75, 0.75, 0.75],
 	"illumination" : 2,
 	"opticalDensity" : 1.0,
@@ -68,12 +69,12 @@ var model = {
 	"DbgIndex" : 4,
 	"DbgName" : "02___Default",
 	"colorAmbient" : [0.0, 0.0, 0.0],
-	"colorDiffuse" : [0.48311999999999999, 0.0, 0.0],
+	"colorDiffuse" : [0.48312, 0.0, 0.0],
 	"colorSpecular" : [0.75, 0.75, 0.75],
 	"illumination" : 2,
 	"opticalDensity" : 1.0,
 	"specularCoef" : 56.862745,
-	"transparency" : 1.0
+	"transparency" : 0.0
 	},
 
 	{
@@ -81,12 +82,12 @@ var model = {
 	"DbgIndex" : 5,
 	"DbgName" : "Aluminium",
 	"colorAmbient" : [0.0, 0.0, 0.0],
-	"colorDiffuse" : [0.47055999999999998, 0.47055999999999998, 0.47055999999999998],
-	"colorSpecular" : [0.40000000000000002, 0.40000000000000002, 0.40000000000000002],
+	"colorDiffuse" : [0.47056, 0.47056, 0.47056],
+	"colorSpecular" : [0.4, 0.4, 0.4],
 	"illumination" : 2,
 	"opticalDensity" : 1.0,
 	"specularCoef" : 17.647059,
-	"transparency" : 1.0
+	"transparency" : 0.0
 	},
 
 	{
@@ -94,7 +95,7 @@ var model = {
 	"DbgIndex" : 6,
 	"DbgName" : "glassRed",
 	"colorAmbient" : [0.0, 0.0, 0.0],
-	"colorDiffuse" : [0.57408000000000003, 0.0, 0.0],
+	"colorDiffuse" : [0.57408, 0.0, 0.0],
 	"colorSpecular" : [0.75, 0.75, 0.75],
 	"illumination" : 2,
 	"opticalDensity" : 1.0,
@@ -107,7 +108,7 @@ var model = {
 	"DbgIndex" : 7,
 	"DbgName" : "glassOranje",
 	"colorAmbient" : [0.0, 0.0, 0.0],
-	"colorDiffuse" : [0.80000000000000004, 0.49568000000000001, 0.1004],
+	"colorDiffuse" : [0.8, 0.49568, 0.1004],
 	"colorSpecular" : [0.75, 0.75, 0.75],
 	"illumination" : 2,
 	"opticalDensity" : 1.0,
@@ -117,7 +118,4 @@ var model = {
 
     "buffers": "VeyronNoUv_bin.bin"
 
-};
-    
-postMessage( model );
-close();
+}

+ 13 - 15
examples/obj/veyron/parts/veyron_body_bin.js

@@ -1,15 +1,16 @@
-// Converted from: veyron_body.obj
-//  vertices: 23013
-//  faces: 21390
-//  materials: 8
-//
-//  Generated with OBJ -> Three.js converter
-//  http://github.com/alteredq/three.js/blob/master/utils/exporters/convert_obj_three.py
+{
 
-
-var model = {
-
-    "version" : 1,
+    "metadata" :
+    {
+        "formatVersion" : 3,
+        "sourceFile"    : "veyron_body.obj",
+        "generatedBy"   : "OBJConverter",
+        "vertices"      : 23013,
+        "faces"         : 21390,
+        "normals"       : 21175,
+        "uvs"           : 0,
+        "materials"     : 8
+    },
 
     "materials": [	{
 	"DbgColor" : 15658734,
@@ -117,7 +118,4 @@ var model = {
 
     "buffers": "veyron_body_bin.bin"
 
-};
-
-postMessage( model );
-close();
+}

+ 14 - 16
examples/obj/veyron/parts/veyron_wheel_bin.js

@@ -1,15 +1,16 @@
-// Converted from: veyron_wheels.obj
-//  vertices: 3300
-//  faces: 2907
-//  materials: 2
-//
-//  Generated with OBJ -> Three.js converter
-//  http://github.com/alteredq/three.js/blob/master/utils/exporters/convert_obj_three.py
-
-
-var model = {
-
-    "version" : 1,
+{
+
+    "metadata" :
+    {
+        "formatVersion" : 3,
+        "sourceFile"    : "veyron_wheel.obj",
+        "generatedBy"   : "OBJConverter",
+        "vertices"      : 3300,
+        "faces"         : 2907,
+        "normals"       : 3163,
+        "uvs"           : 0,
+        "materials"     : 2
+    },
 
     "materials": [	{
 	"DbgColor" : 15658734,
@@ -39,7 +40,4 @@ var model = {
 
     "buffers": "veyron_wheel_bin.bin"
 
-};
-
-postMessage( model );
-close();
+}

+ 14 - 16
examples/obj/walt/WaltHead_bin.js

@@ -1,22 +1,23 @@
-// Converted from: ../../examples/obj/walt/WaltHead.obj
-//  vertices: 8146
-//  faces: 16160
-//  materials: 1
-//
-//  Generated with OBJ -> Three.js converter
-//  http://github.com/alteredq/three.js/blob/master/utils/exporters/convert_obj_three.py
+{
 
-
-var model = {
-
-    "version" : 1,
+    "metadata" :
+    {
+        "formatVersion" : 3,
+        "sourceFile"    : "WaltHead.obj",
+        "generatedBy"   : "OBJConverter",
+        "vertices"      : 8146,
+        "faces"         : 16160,
+        "normals"       : 8146,
+        "uvs"           : 0,
+        "materials"     : 1
+    },
 
     "materials": [	{
 	"DbgColor" : 15658734,
 	"DbgIndex" : 0,
 	"DbgName" : "lambert2SG.001",
 	"colorAmbient" : [0.0, 0.0, 0.0],
-	"colorDiffuse" : [0.64000000000000001, 0.64000000000000001, 0.64000000000000001],
+	"colorDiffuse" : [0.64, 0.64, 0.64],
 	"colorSpecular" : [0.25, 0.25, 0.25],
 	"illumination" : 2,
 	"opticalDensity" : 1.0,
@@ -26,7 +27,4 @@ var model = {
 
     "buffers": "WaltHead_bin.bin"
 
-};
-    
-postMessage( model );
-close();
+}

File diff suppressed because it is too large
+ 14 - 15
examples/obj/walt/WaltHead_slim.js


+ 1 - 1
examples/webgl_materials_texture_filters.html

@@ -199,7 +199,7 @@
 				texturePainting.minFilter = texturePainting.magFilter = THREE.LinearFilter;
 
 
-				renderer = new THREE.WebGLRenderer();
+				renderer = new THREE.WebGLRenderer( { antialias: true } );
 				renderer.setSize( SCREEN_WIDTH, SCREEN_HEIGHT );
 				renderer.setClearColor( scene.fog.color, 1 );
 				renderer.autoClear = false;

+ 59 - 42
src/extras/loaders/BinaryLoader.js

@@ -36,56 +36,72 @@ THREE.BinaryLoader.prototype.load = function( url, callback, texturePath, binary
 
 	}
 
+	texturePath = texturePath ? texturePath : this.extractUrlbase( url );
+	binaryPath = binaryPath ? binaryPath : this.extractUrlbase( url );
+
+	var callbackProgress = this.showProgress ? THREE.Loader.prototype.updateProgress : null;
+
+	this.onLoadStart();
+
 	// #1 load JS part via web worker
 
-	//  This isn't really necessary, JS part is tiny,
-	//  could be done by more ordinary means.
+	this.loadAjaxJSON( this, url, callback, texturePath, binaryPath, callbackProgress );
 
-	texturePath = texturePath ? texturePath : this.extractUrlbase( url );
-	binaryPath = binaryPath ? binaryPath : this.extractUrlbase( url );
+};
 
-	var s = Date.now(),
-		worker = new Worker( url ),
-		callbackProgress = this.showProgress ? THREE.Loader.prototype.updateProgress : null;
+THREE.BinaryLoader.prototype.loadAjaxJSON = function( context, url, callback, texturePath, binaryPath, callbackProgress ) {
 
-	worker.onmessage = function( event ) {
+	var xhr = new XMLHttpRequest();
 
-		var materials = event.data.materials,
-			buffers = event.data.buffers;
+	xhr.onreadystatechange = function() {
+
+		if ( xhr.readyState == 4 ) {
 
-		// #2 load BIN part via Ajax
+			if ( xhr.status == 200 || xhr.status == 0 ) {
 
-		//  For some reason it is faster doing loading from here than from within the worker.
-		//  Maybe passing of ginormous string as message between threads is costly?
-		//  Also, worker loading huge data by Ajax still freezes browser. Go figure,
-		//  worker with baked ascii JSON data keeps browser more responsive.
+				try {
 
-		THREE.BinaryLoader.prototype.loadAjaxBuffers( buffers, materials, callback, binaryPath, texturePath, callbackProgress );
+					var json = JSON.parse( xhr.responseText );
 
-	};
+					if ( json.metadata === undefined || json.metadata.formatVersion === undefined || json.metadata.formatVersion !== 3 ) {
 
-	worker.onerror = function ( event ) {
+						console.error( 'Deprecated file format.' );
+						return;
 
-		alert( "worker.onerror: " + event.message + "\n" + event.data );
-		event.preventDefault();
+					}
 
-	};
+					// #2 load BIN part via Ajax
 
-	worker.postMessage( s );
+					context.loadAjaxBuffers( json, callback, binaryPath, texturePath, callbackProgress );
 
-};
+				} catch ( error ) {
 
-// Binary AJAX parser based on Magi binary loader
-// https://github.com/kig/magi
+					console.error( error );
+					console.warn( "DEPRECATED: [" + url + "] seems to be using old model format" );
 
-// Should look more into HTML5 File API
-// See also other suggestions by Gregg Tavares
-// https://groups.google.com/group/o3d-discuss/browse_thread/thread/a8967bc9ce1e0978
+				}
 
-THREE.BinaryLoader.prototype.loadAjaxBuffers = function( buffers, materials, callback, binaryPath, texturePath, callbackProgress ) {
+			} else {
+
+				console.error( "Couldn't load [" + url + "] [" + xhr.status + "]" );
+
+			}
+
+		}
+
+	};
+
+	xhr.open( "GET", url, true );
+	xhr.overrideMimeType( "text/plain; charset=x-user-defined" );
+	xhr.setRequestHeader( "Content-Type", "text/plain" );
+	xhr.send( null );
+
+};
+
+THREE.BinaryLoader.prototype.loadAjaxBuffers = function( json, callback, binaryPath, texturePath, callbackProgress ) {
 
 	var xhr = new XMLHttpRequest(),
-		url = binaryPath + "/" + buffers;
+		url = binaryPath + "/" + json.buffers;
 
 	var length = 0;
 
@@ -95,11 +111,11 @@ THREE.BinaryLoader.prototype.loadAjaxBuffers = function( buffers, materials, cal
 
 			if ( xhr.status == 200 || xhr.status == 0 ) {
 
-				THREE.BinaryLoader.prototype.createBinModel( xhr.responseText, callback, texturePath, materials );
+				THREE.BinaryLoader.prototype.createBinModel( xhr.responseText, callback, texturePath, json.materials );
 
 			} else {
 
-				alert( "Couldn't load [" + url + "] [" + xhr.status + "]" );
+				console.error( "Couldn't load [" + url + "] [" + xhr.status + "]" );
 
 			}
 
@@ -125,19 +141,24 @@ THREE.BinaryLoader.prototype.loadAjaxBuffers = function( buffers, materials, cal
 
 	};
 
-	xhr.open("GET", url, true);
-	xhr.overrideMimeType("text/plain; charset=x-user-defined");
-	xhr.setRequestHeader("Content-Type", "text/plain");
-	xhr.send(null);
+	xhr.open( "GET", url, true );
+	xhr.overrideMimeType( "text/plain; charset=x-user-defined" );
+	xhr.setRequestHeader( "Content-Type", "text/plain" );
+	xhr.send( null );
 
 };
 
+// Binary AJAX parser based on Magi binary loader
+// https://github.com/kig/magi
+
+// Should look more into HTML5 File API
+// See also other suggestions by Gregg Tavares
+// https://groups.google.com/group/o3d-discuss/browse_thread/thread/a8967bc9ce1e0978
+
 THREE.BinaryLoader.prototype.createBinModel = function ( data, callback, texturePath, materials ) {
 
 	var Model = function ( texturePath ) {
 
-		//var s = (new Date).getTime();
-
 		var scope = this,
 			currentOffset = 0,
 			md,
@@ -238,10 +259,6 @@ THREE.BinaryLoader.prototype.createBinModel = function ( data, callback, texture
 
 		if ( THREE.Loader.prototype.hasNormals( this ) ) this.computeTangents();
 
-		//var e = (new Date).getTime();
-
-		//log( "binary data parse time: " + (e-s) + " ms" );
-
 		function parseMetaData( data, offset ) {
 
 			var metaData = {

+ 60 - 7
src/extras/loaders/JSONLoader.js

@@ -29,18 +29,71 @@ THREE.JSONLoader.prototype.load = function ( url, callback, texturePath ) {
 
 	}
 
-	worker = new Worker( url );
 	texturePath = texturePath ? texturePath : this.extractUrlbase( url ),
 
-	worker.onmessage = function ( event ) {
+	this.onLoadStart();
+	this.loadAjaxJSON( this, url, callback, texturePath );
+
+};
+
+THREE.JSONLoader.prototype.loadAjaxJSON = function( context, url, callback, texturePath, callbackProgress ) {
+
+	var xhr = new XMLHttpRequest();
+
+	var length = 0;
+
+	xhr.onreadystatechange = function() {
+
+		if ( xhr.readyState == 4 ) {
+
+			if ( xhr.status == 200 || xhr.status == 0 ) {
+
+				try {
+
+					var jsonObject = JSON.parse( xhr.responseText );
+
+					context.createModel( jsonObject, callback, texturePath );
+					context.onLoadComplete();
+
+				} catch ( error ) {
+
+					console.error( error );
+					console.warn( "DEPRECATED: [" + url + "] seems to be using old model format" );
+
+				}
+
+			} else {
+
+				console.error( "Couldn't load [" + url + "] [" + xhr.status + "]" );
+
+			}
+
+		} else if ( xhr.readyState == 3 ) {
 
-		scope.createModel( event.data, callback, texturePath );
-		scope.onLoadComplete();
+			if ( callbackProgress ) {
+
+				if ( length == 0 ) {
+
+					length = xhr.getResponseHeader( "Content-Length" );
+
+				}
+
+				callbackProgress( { total: length, loaded: xhr.responseText.length } );
+
+			}
+
+		} else if ( xhr.readyState == 2 ) {
+
+			length = xhr.getResponseHeader( "Content-Length" );
+
+		}
 
 	};
 
-	this.onLoadStart();
-	worker.postMessage( Date.now() );
+	xhr.open( "GET", url, true );
+	xhr.overrideMimeType( "text/plain; charset=x-user-defined" );
+	xhr.setRequestHeader( "Content-Type", "text/plain" );
+	xhr.send( null );
 
 };
 
@@ -65,7 +118,7 @@ THREE.JSONLoader.prototype.createModel = function ( json, callback, texture_path
 
 	function parseModel( scale ) {
 
-		if ( json.version === undefined || json.version != 2 ) {
+		if ( json.metadata === undefined || json.metadata.formatVersion === undefined || json.metadata.formatVersion !== 3 ) {
 
 			console.error( 'Deprecated file format.' );
 			return;

+ 41 - 50
utils/exporters/convert_obj_three.py

@@ -1,4 +1,4 @@
-"""Convert Wavefront OBJ / MTL files into Three.js (JSON model version, to be used with web worker based ascii / binary loader)
+"""Convert Wavefront OBJ / MTL files into Three.js (JSON model version, to be used with ascii / binary loader)
 
 -------------------------
 How to use this converter
@@ -92,7 +92,7 @@ How to get proper OBJ + MTL files with Blender
 
     2. Select all meshes (Select -> Select All by Type -> Mesh)
 
-    3. Export to OBJ (File -> Export -> Wavefront .obj) [*]
+    3. Export to OBJ (File -> Export -> Wavefront .obj)
         - enable following options in exporter
             Material Groups
             Rotate X90
@@ -115,11 +115,6 @@ How to get proper OBJ + MTL files with Blender
 
         - for WebGL, textures must be power of 2 sized
 
-    [*] If OBJ export fails (Blender 2.54 beta), patch your Blender installation
-        following instructions here:
-
-            http://www.blendernation.com/2010/09/12/blender-2-54-beta-released/
-
 ------
 Author
 ------
@@ -160,21 +155,20 @@ COLORS = [0xeeeeee, 0xee0000, 0x00ee00, 0x0000ee, 0xeeee00, 0x00eeee, 0xee00ee]
 # Templates
 # #####################################################
 TEMPLATE_FILE_ASCII = u"""\
-// Converted from: %(fname)s
-//  vertices: %(nvertex)d
-//  faces: %(nface)d
-//  normals: %(nnormal)d
-//  colors: %(ncolor)d
-//  uvs: %(nuv)d
-//  materials: %(nmaterial)d
-//
-//  Generated with OBJ -> Three.js converter
-//  http://github.com/alteredq/three.js/blob/master/utils/exporters/convert_obj_three.py
-
-
-var model = {
-
-    "version" : 2,
+{
+
+    "metadata" :
+    {
+        "formatVersion" : 3,
+        "sourceFile"    : "%(fname)s",
+        "generatedBy"   : "OBJConverter",
+        "vertices"      : %(nvertex)d,
+        "faces"         : %(nface)d,
+        "normals"       : %(nnormal)d,
+        "colors"        : %(ncolor)d,
+        "uvs"           : %(nuv)d,
+        "materials"     : %(nmaterial)d
+    },
 
     "scale" : %(scale)f,
 
@@ -194,34 +188,29 @@ var model = {
 
     "faces": [%(faces)s]
 
-};
-
-postMessage( model );
-close();
+}
 """
 
 TEMPLATE_FILE_BIN = u"""\
-// Converted from: %(fname)s
-//  vertices: %(nvertex)d
-//  faces: %(nface)d
-//  materials: %(nmaterial)d
-//
-//  Generated with OBJ -> Three.js converter
-//  http://github.com/alteredq/three.js/blob/master/utils/exporters/convert_obj_three.py
-
-
-var model = {
-
-    "version" : 1,
+{
+
+    "metadata" :
+    {
+        "formatVersion" : 3,
+        "sourceFile"    : "%(fname)s",
+        "generatedBy"   : "OBJConverter",
+        "vertices"      : %(nvertex)d,
+        "faces"         : %(nface)d,
+        "normals"       : %(nnormal)d,
+        "uvs"           : %(nuv)d,
+        "materials"     : %(nmaterial)d
+    },
 
     "materials": [%(materials)s],
 
     "buffers": "%(buffers)s"
 
-};
-
-postMessage( model );
-close();
+}
 """
 
 TEMPLATE_VERTEX = "%f,%f,%f"
@@ -1076,7 +1065,7 @@ def convert_ascii(infile, morphfiles, colorfiles, outfile):
 
     text = TEMPLATE_FILE_ASCII % {
     "name"      : get_name(outfile),
-    "fname"     : infile,
+    "fname"     : os.path.basename(infile),
     "nvertex"   : len(vertices),
     "nface"     : len(faces),
     "nuv"       : len(uvs),
@@ -1132,6 +1121,11 @@ def convert_binary(infile, outfile):
 
     sfaces = sort_faces(faces)
 
+    if SHADING == "smooth":
+        nnormals = len(normals)
+    else:
+        nnormals = 0
+
     # ###################
     # generate JS file
     # ###################
@@ -1142,10 +1136,12 @@ def convert_binary(infile, outfile):
     "materials" : generate_materials_string(materials, mtllib, infile),
     "buffers"   : binfile,
 
-    "fname"     : infile,
+    "fname"     : os.path.basename(infile),
     "nvertex"   : len(vertices),
     "nface"     : len(faces),
-    "nmaterial" : len(materials)
+    "nmaterial" : len(materials),
+    "nnormal"   : nnormals,
+    "nuv"       : len(uvs)
     }
 
     out = open(outfile, "w")
@@ -1156,11 +1152,6 @@ def convert_binary(infile, outfile):
     # generate BIN file
     # ###################
 
-    if SHADING == "smooth":
-        nnormals = len(normals)
-    else:
-        nnormals = 0
-
     buffer = []
 
     # header

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