Browse Source

Added basic Collada file drop support to the GUI.
Unfortunately "File" doesn't have path information, so textures won't load :/
Tried to also drop .js files, but the Workers part ruined the party too :/ :/

Mr.doob 14 years ago
parent
commit
4e5dff61c8
4 changed files with 251 additions and 201 deletions
  1. 85 86
      build/Three.js
  2. 114 115
      build/custom/ThreeExtras.js
  3. 51 0
      gui/index.html
  4. 1 0
      src/extras/loaders/ColladaLoader.js

File diff suppressed because it is too large
+ 85 - 86
build/Three.js


+ 114 - 115
build/custom/ThreeExtras.js

@@ -12,7 +12,7 @@ m[g]=l}e=[];f={};for(g=0;g<b;g++)k=THREE.GeometryUtils.random()*l,k=c(k),e[g]=TH
 (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(b);a.computeBoundingBox()}};THREE.GeometryUtils.random=THREE.GeometryUtils.random16;THREE.GeometryUtils.__v1=new THREE.Vector3;
 THREE.ImageUtils={loadTexture:function(a,b,c){var e=new Image,g=new THREE.Texture(e,b);e.onload=function(){g.needsUpdate=!0;c&&c(this)};e.crossOrigin="";e.src=a;return g},loadTextureCube:function(a,b,c){var e,g=[],h=new THREE.Texture(g,b),b=g.loadCount=0;for(e=a.length;b<e;++b)g[b]=new Image,g[b].onload=function(){g.loadCount+=1;if(g.loadCount==6)h.needsUpdate=!0;c&&c(this)},g[b].crossOrigin="",g[b].src=a[b];return h},getNormalMap:function(a,b){var c=function(a){var c=Math.sqrt(a[0]*a[0]+a[1]*a[1]+
 a[2]*a[2]);return[a[0]/c,a[1]/c,a[2]/c]};b|=1;var e=a.width,g=a.height,h=document.createElement("canvas");h.width=e;h.height=g;var f=h.getContext("2d");f.drawImage(a,0,0);for(var k=f.getImageData(0,0,e,g).data,l=f.createImageData(e,g),m=l.data,n=0;n<e;n++)for(var o=1;o<g;o++){var t=o-1<0?g-1:o-1,u=(o+1)%g,v=n-1<0?e-1:n-1,y=(n+1)%e,p=[],z=[0,0,k[(o*e+n)*4]/255*b];p.push([-1,0,k[(o*e+v)*4]/255*b]);p.push([-1,-1,k[(t*e+v)*4]/255*b]);p.push([0,-1,k[(t*e+n)*4]/255*b]);p.push([1,-1,k[(t*e+y)*4]/255*b]);
-p.push([1,0,k[(o*e+y)*4]/255*b]);p.push([1,1,k[(u*e+y)*4]/255*b]);p.push([0,1,k[(u*e+n)*4]/255*b]);p.push([-1,1,k[(u*e+v)*4]/255*b]);t=[];v=p.length;for(u=0;u<v;u++){var y=p[u],w=p[(u+1)%v],y=[y[0]-z[0],y[1]-z[1],y[2]-z[2]],w=[w[0]-z[0],w[1]-z[1],w[2]-z[2]];t.push(c([y[1]*w[2]-y[2]*w[1],y[2]*w[0]-y[0]*w[2],y[0]*w[1]-y[1]*w[0]]))}p=[0,0,0];for(u=0;u<t.length;u++)p[0]+=t[u][0],p[1]+=t[u][1],p[2]+=t[u][2];p[0]/=t.length;p[1]/=t.length;p[2]/=t.length;z=(o*e+n)*4;m[z]=(p[0]+1)/2*255|0;m[z+1]=(p[1]+0.5)*
+p.push([1,0,k[(o*e+y)*4]/255*b]);p.push([1,1,k[(u*e+y)*4]/255*b]);p.push([0,1,k[(u*e+n)*4]/255*b]);p.push([-1,1,k[(u*e+v)*4]/255*b]);t=[];v=p.length;for(u=0;u<v;u++){var y=p[u],x=p[(u+1)%v],y=[y[0]-z[0],y[1]-z[1],y[2]-z[2]],x=[x[0]-z[0],x[1]-z[1],x[2]-z[2]];t.push(c([y[1]*x[2]-y[2]*x[1],y[2]*x[0]-y[0]*x[2],y[0]*x[1]-y[1]*x[0]]))}p=[0,0,0];for(u=0;u<t.length;u++)p[0]+=t[u][0],p[1]+=t[u][1],p[2]+=t[u][2];p[0]/=t.length;p[1]/=t.length;p[2]/=t.length;z=(o*e+n)*4;m[z]=(p[0]+1)/2*255|0;m[z+1]=(p[1]+0.5)*
 255|0;m[z+2]=p[2]*255|0;m[z+3]=255}f.putImageData(l,0,0);return h}};THREE.SceneUtils={showHierarchy:function(a,b){THREE.SceneUtils.traverseHierarchy(a,function(a){a.visible=b})},traverseHierarchy:function(a,b){var c,e,g=a.children.length;for(e=0;e<g;e++)c=a.children[e],b(c),THREE.SceneUtils.traverseHierarchy(c,b)}};
 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}"},
@@ -137,22 +137,22 @@ this.rotateCamera();this.noZoom||this.zoomCamera();this.noPan||this.panCamera();
 (g===this.STATE.ROTATE?k=this.getMouseProjectionOnBall(a.clientX,a.clientY):g===this.STATE.ZOOM&&!this.noZoom?m=this.getMouseOnScreen(a.clientX,a.clientY):g===this.STATE.PAN&&!this.noPan&&(o=this.getMouseOnScreen(a.clientX,a.clientY)))}),!1);this.domElement.addEventListener("mousedown",c(this,function(a){a.preventDefault();a.stopPropagation();if(g===this.STATE.NONE)g=a.button,g===this.STATE.ROTATE?f=k=this.getMouseProjectionOnBall(a.clientX,a.clientY):g===this.STATE.ZOOM&&!this.noZoom?l=m=this.getMouseOnScreen(a.clientX,
 a.clientY):this.noPan||(n=o=this.getMouseOnScreen(a.clientX,a.clientY))}),!1);this.domElement.addEventListener("mouseup",c(this,function(a){a.preventDefault();a.stopPropagation();g=this.STATE.NONE}),!1);window.addEventListener("keydown",c(this,function(a){if(g===this.STATE.NONE){if(a.keyCode===this.keys[this.STATE.ROTATE])g=this.STATE.ROTATE;else if(a.keyCode===this.keys[this.STATE.ZOOM]&&!this.noZoom)g=this.STATE.ZOOM;else if(a.keyCode===this.keys[this.STATE.PAN]&&!this.noPan)g=this.STATE.PAN;g!==
 this.STATE.NONE&&(e=!0)}}),!1);window.addEventListener("keyup",c(this,function(){if(g!==this.STATE.NONE)g=this.STATE.NONE}),!1)};THREE.TrackballControls.prototype.STATE={NONE:-1,ROTATE:0,ZOOM:1,PAN:2};
-THREE.CubeGeometry=function(a,b,c,e,g,h,f,k){function l(a,c,b,f,k,l,o,n){var u,t,v=e||1,J=g||1,C=k/2,F=l/2,K=m.vertices.length;if(a=="x"&&c=="y"||a=="y"&&c=="x")u="z";else if(a=="x"&&c=="z"||a=="z"&&c=="x")u="y",J=h||1;else if(a=="z"&&c=="y"||a=="y"&&c=="z")u="x",v=h||1;var M=v+1,N=J+1;k/=v;var L=l/J;for(t=0;t<N;t++)for(l=0;l<M;l++){var O=new THREE.Vector3;O[a]=(l*k-C)*b;O[c]=(t*L-F)*f;O[u]=o;m.vertices.push(new THREE.Vertex(O))}for(t=0;t<J;t++)for(l=0;l<v;l++)m.faces.push(new THREE.Face4(l+M*t+K,
-l+M*(t+1)+K,l+1+M*(t+1)+K,l+1+M*t+K,null,null,n)),m.faceVertexUvs[0].push([new THREE.UV(l/v,t/J),new THREE.UV(l/v,(t+1)/J),new THREE.UV((l+1)/v,(t+1)/J),new THREE.UV((l+1)/v,t/J)])}THREE.Geometry.call(this);var m=this,n=a/2,o=b/2,t=c/2;if(f!==void 0)if(f instanceof Array)this.materials=f;else{this.materials=[];for(var u=0;u<6;u++)this.materials.push([f])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(k!=void 0)for(var v in k)this.sides[v]!=void 0&&(this.sides[v]=k[v]);
+THREE.CubeGeometry=function(a,b,c,e,g,h,f,k){function l(a,c,b,f,k,l,o,n){var u,t,v=e||1,K=g||1,C=k/2,F=l/2,J=m.vertices.length;if(a=="x"&&c=="y"||a=="y"&&c=="x")u="z";else if(a=="x"&&c=="z"||a=="z"&&c=="x")u="y",K=h||1;else if(a=="z"&&c=="y"||a=="y"&&c=="z")u="x",v=h||1;var M=v+1,N=K+1;k/=v;var L=l/K;for(t=0;t<N;t++)for(l=0;l<M;l++){var O=new THREE.Vector3;O[a]=(l*k-C)*b;O[c]=(t*L-F)*f;O[u]=o;m.vertices.push(new THREE.Vertex(O))}for(t=0;t<K;t++)for(l=0;l<v;l++)m.faces.push(new THREE.Face4(l+M*t+J,
+l+M*(t+1)+J,l+1+M*(t+1)+J,l+1+M*t+J,null,null,n)),m.faceVertexUvs[0].push([new THREE.UV(l/v,t/K),new THREE.UV(l/v,(t+1)/K),new THREE.UV((l+1)/v,(t+1)/K),new THREE.UV((l+1)/v,t/K)])}THREE.Geometry.call(this);var m=this,n=a/2,o=b/2,t=c/2;if(f!==void 0)if(f instanceof Array)this.materials=f;else{this.materials=[];for(var u=0;u<6;u++)this.materials.push([f])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(k!=void 0)for(var v in k)this.sides[v]!=void 0&&(this.sides[v]=k[v]);
 this.sides.px&&l("z","y",-1,-1,c,b,n,this.materials[0]);this.sides.nx&&l("z","y",1,-1,c,b,-n,this.materials[1]);this.sides.py&&l("x","z",1,1,a,c,o,this.materials[2]);this.sides.ny&&l("x","z",1,-1,a,c,-o,this.materials[3]);this.sides.pz&&l("x","y",1,-1,a,b,t,this.materials[4]);this.sides.nz&&l("x","y",-1,-1,a,b,-t,this.materials[5]);this.mergeVertices();this.computeCentroids();this.computeFaceNormals()};THREE.CubeGeometry.prototype=new THREE.Geometry;THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
 THREE.CylinderGeometry=function(a,b,c,e,g,h){THREE.Geometry.call(this);var a=a!=null?a:20,b=b!=null?b:20,c=c||100,f=c/2,e=e||8,g=g||1,k,l,m=[],n=[];for(l=0;l<=g;l++){var o=[],t=[],u=l/g,v=u*(b-a)+a;for(k=0;k<=e;k++){var y=k/e;this.vertices.push(new THREE.Vertex(new THREE.Vector3(v*Math.sin(y*Math.PI*2),-u*c+f,v*Math.cos(y*Math.PI*2))));o.push(this.vertices.length-1);t.push(new THREE.UV(y,u))}m.push(o);n.push(t)}for(l=0;l<g;l++)for(k=0;k<e;k++){var c=m[l][k],o=m[l+1][k],t=m[l+1][k+1],u=m[l][k+1],v=
-this.vertices[c].position.clone().setY(0).normalize(),y=this.vertices[o].position.clone().setY(0).normalize(),p=this.vertices[t].position.clone().setY(0).normalize(),z=this.vertices[u].position.clone().setY(0).normalize(),w=n[l][k].clone(),x=n[l+1][k].clone(),A=n[l+1][k+1].clone(),D=n[l][k+1].clone();this.faces.push(new THREE.Face4(c,o,t,u,[v,y,p,z]));this.faceVertexUvs[0].push([w,x,A,D])}if(!h&&a>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,f,0)));for(k=0;k<e;k++)c=m[0][k],o=m[0][k+
-1],t=this.vertices.length-1,v=new THREE.Vector3(0,1,0),y=new THREE.Vector3(0,1,0),p=new THREE.Vector3(0,1,0),w=n[0][k].clone(),x=n[0][k+1].clone(),A=new THREE.UV(x.u,0),this.faces.push(new THREE.Face3(c,o,t,[v,y,p])),this.faceVertexUvs[0].push([w,x,A])}if(!h&&b>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-f,0)));for(k=0;k<e;k++)c=m[l][k+1],o=m[l][k],t=this.vertices.length-1,v=new THREE.Vector3(0,-1,0),y=new THREE.Vector3(0,-1,0),p=new THREE.Vector3(0,-1,0),w=n[l][k+1].clone(),x=n[l][k].clone(),
-A=new THREE.UV(x.u,1),this.faces.push(new THREE.Face3(c,o,t,[v,y,p])),this.faceVertexUvs[0].push([w,x,A])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
+this.vertices[c].position.clone().setY(0).normalize(),y=this.vertices[o].position.clone().setY(0).normalize(),p=this.vertices[t].position.clone().setY(0).normalize(),z=this.vertices[u].position.clone().setY(0).normalize(),x=n[l][k].clone(),w=n[l+1][k].clone(),A=n[l+1][k+1].clone(),D=n[l][k+1].clone();this.faces.push(new THREE.Face4(c,o,t,u,[v,y,p,z]));this.faceVertexUvs[0].push([x,w,A,D])}if(!h&&a>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,f,0)));for(k=0;k<e;k++)c=m[0][k],o=m[0][k+
+1],t=this.vertices.length-1,v=new THREE.Vector3(0,1,0),y=new THREE.Vector3(0,1,0),p=new THREE.Vector3(0,1,0),x=n[0][k].clone(),w=n[0][k+1].clone(),A=new THREE.UV(w.u,0),this.faces.push(new THREE.Face3(c,o,t,[v,y,p])),this.faceVertexUvs[0].push([x,w,A])}if(!h&&b>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-f,0)));for(k=0;k<e;k++)c=m[l][k+1],o=m[l][k],t=this.vertices.length-1,v=new THREE.Vector3(0,-1,0),y=new THREE.Vector3(0,-1,0),p=new THREE.Vector3(0,-1,0),x=n[l][k+1].clone(),w=n[l][k].clone(),
+A=new THREE.UV(w.u,1),this.faces.push(new THREE.Face3(c,o,t,[v,y,p])),this.faceVertexUvs[0].push([x,w,A])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
 THREE.ExtrudeGeometry=function(a,b){if(typeof a!="undefined"){THREE.Geometry.call(this);var a=a instanceof Array?a:[a],c,e=a.length,g;this.shapebb=a[e-1].getBoundingBox();for(c=0;c<e;c++)g=a[c],this.addShape(g,b);this.computeCentroids();this.computeFaceNormals()}};THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;
 THREE.ExtrudeGeometry.prototype.addShape=function(a,b){function c(a,c,b){c||console.log("die");return c.clone().multiplyScalar(b).addSelf(a)}function e(a,c,b){var e=THREE.ExtrudeGeometry.__v1,f=THREE.ExtrudeGeometry.__v2,h=THREE.ExtrudeGeometry.__v3,g=THREE.ExtrudeGeometry.__v4,k=THREE.ExtrudeGeometry.__v5,l=THREE.ExtrudeGeometry.__v6;e.set(a.x-c.x,a.y-c.y);f.set(a.x-b.x,a.y-b.y);e=e.normalize();f=f.normalize();h.set(-e.y,e.x);g.set(f.y,-f.x);k.copy(a).addSelf(h);l.copy(a).addSelf(g);if(k.equals(l))return g.clone();
-k.copy(c).addSelf(h);l.copy(b).addSelf(g);h=e.dot(g);g=l.subSelf(k).dot(g);h==0&&(console.log("Either infinite or no solutions!"),g==0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));g/=h;if(g<0)return c=Math.atan2(c.y-a.y,c.x-a.x),a=Math.atan2(b.y-a.y,b.x-a.x),c>a&&(a+=Math.PI*2),anglec=(c+a)/2,new THREE.Vector2(-Math.cos(anglec),-Math.sin(anglec));return e.multiplyScalar(g).addSelf(k).subSelf(a).clone()}function g(a){for(C=a.length;--C>=0;){T=C;R=C-1;R<0&&(R=a.length-
-1);for(var c=0,b=u+n*2,c=0;c<b;c++){var e=O*c,f=O*(c+1),h=Q+T+e,g=Q+T+f,m=h,e=Q+R+e,f=Q+R+f,o=g;m+=J;e+=J;f+=J;o+=J;H.faces.push(new THREE.Face4(m,e,f,o,null,null,A));A&&(m=c/b,e=(c+1)/b,f=k+l*2,h=(H.vertices[h].position.z+l)/f,g=(H.vertices[g].position.z+l)/f,H.faceVertexUvs[0].push([new THREE.UV(h,m),new THREE.UV(g,m),new THREE.UV(g,e),new THREE.UV(h,e)]))}}}function h(a,c,b){H.vertices.push(new THREE.Vertex(new THREE.Vector3(a,c,b)))}function f(a,c,b){a+=J;c+=J;b+=J;H.faces.push(new THREE.Face3(a,
-c,b,null,null,x));if(x){var e=D.maxY,f=D.maxX,h=H.vertices[c].position.x,c=H.vertices[c].position.y,g=H.vertices[b].position.x,b=H.vertices[b].position.y;H.faceVertexUvs[0].push([new THREE.UV(H.vertices[a].position.x/f,H.vertices[a].position.y/e),new THREE.UV(h/f,c/e),new THREE.UV(g/f,b/e)])}}var k=b.amount!==void 0?b.amount:100,l=b.bevelThickness!==void 0?b.bevelThickness:6,m=b.bevelSize!==void 0?b.bevelSize:l-2,n=b.bevelSegments!==void 0?b.bevelSegments:3,o=b.bevelEnabled!==void 0?b.bevelEnabled:
-!0,t=b.curveSegments!==void 0?b.curveSegments:12,u=b.steps!==void 0?b.steps:1,v=b.bendPath,y=b.extrudePath,p,z=!1,w=b.useSpacedPoints!==void 0?b.useSpacedPoints:!1,x=b.material,A=b.extrudeMaterial,D=this.shapebb;if(y)p=y.getPoints(t),u=p.length,z=!0,o=!1;o||(m=l=n=0);var B,E,I,H=this,J=this.vertices.length;v&&a.addWrapPath(v);t=w?a.extractAllSpacedPoints(t):a.extractAllPoints(t);v=t.shape;t=t.holes;if(y=!THREE.Shape.Utils.isClockWise(v)){v=v.reverse();E=0;for(I=t.length;E<I;E++)B=t[E],THREE.Shape.Utils.isClockWise(B)&&
-(t[E]=B.reverse());y=!1}y=THREE.Shape.Utils.triangulateShape(v,t);w=v;E=0;for(I=t.length;E<I;E++)B=t[E],v=v.concat(B);var C,F,K,M,N,L,O=v.length,G=y.length,S=[];C=0;F=w.length;T=F-1;for(R=C+1;C<F;C++,T++,R++)T==F&&(T=0),R==F&&(R=0),S[C]=e(w[C],w[T],w[R]);var P=[],U,V=S.concat();E=0;for(I=t.length;E<I;E++){B=t[E];U=[];C=0;F=B.length;T=F-1;for(R=C+1;C<F;C++,T++,R++)T==F&&(T=0),R==F&&(R=0),U[C]=e(B[C],B[T],B[R]);P.push(U);V=V.concat(U)}for(K=0;K<n;K++){M=K/n;N=l*(1-M);M=m*Math.sin(M*Math.PI/2);C=0;for(F=
-w.length;C<F;C++)L=c(w[C],S[C],M),h(L.x,L.y,-N);E=0;for(I=t.length;E<I;E++){B=t[E];U=P[E];C=0;for(F=B.length;C<F;C++)L=c(B[C],U[C],M),h(L.x,L.y,-N)}}M=m;for(C=0;C<O;C++)L=o?c(v[C],V[C],M):v[C],z?h(L.x,L.y+p[0].y,p[0].x):h(L.x,L.y,0);for(K=1;K<=u;K++)for(C=0;C<O;C++)L=o?c(v[C],V[C],M):v[C],z?h(L.x,L.y+p[K-1].y,p[K-1].x):h(L.x,L.y,k/u*K);for(K=n-1;K>=0;K--){M=K/n;N=l*(1-M);M=m*Math.sin(M*Math.PI/2);C=0;for(F=w.length;C<F;C++)L=c(w[C],S[C],M),h(L.x,L.y,k+N);E=0;for(I=t.length;E<I;E++){B=t[E];U=P[E];
-C=0;for(F=B.length;C<F;C++)L=c(B[C],U[C],M),z?h(L.x,L.y+p[u-1].y,p[u-1].x+N):h(L.x,L.y,k+N)}}if(o){o=O*0;for(C=0;C<G;C++)m=y[C],f(m[2]+o,m[1]+o,m[0]+o);o=O*(u+n*2);for(C=0;C<G;C++)m=y[C],f(m[0]+o,m[1]+o,m[2]+o)}else{for(C=0;C<G;C++)m=y[C],f(m[2],m[1],m[0]);for(C=0;C<G;C++)m=y[C],f(m[0]+O*u,m[1]+O*u,m[2]+O*u)}var T,R,Q=0;g(w);Q+=w.length;E=0;for(I=t.length;E<I;E++)B=t[E],g(B),Q+=B.length};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;THREE.ExtrudeGeometry.__v2=new THREE.Vector2;
+k.copy(c).addSelf(h);l.copy(b).addSelf(g);h=e.dot(g);g=l.subSelf(k).dot(g);h==0&&(console.log("Either infinite or no solutions!"),g==0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));g/=h;if(g<0)return c=Math.atan2(c.y-a.y,c.x-a.x),a=Math.atan2(b.y-a.y,b.x-a.x),c>a&&(a+=Math.PI*2),anglec=(c+a)/2,new THREE.Vector2(-Math.cos(anglec),-Math.sin(anglec));return e.multiplyScalar(g).addSelf(k).subSelf(a).clone()}function g(a){for(C=a.length;--C>=0;){R=C;S=C-1;S<0&&(S=a.length-
+1);for(var c=0,b=u+n*2,c=0;c<b;c++){var e=O*c,f=O*(c+1),h=W+R+e,g=W+R+f,m=h,e=W+S+e,f=W+S+f,o=g;m+=K;e+=K;f+=K;o+=K;G.faces.push(new THREE.Face4(m,e,f,o,null,null,A));A&&(m=c/b,e=(c+1)/b,f=k+l*2,h=(G.vertices[h].position.z+l)/f,g=(G.vertices[g].position.z+l)/f,G.faceVertexUvs[0].push([new THREE.UV(h,m),new THREE.UV(g,m),new THREE.UV(g,e),new THREE.UV(h,e)]))}}}function h(a,c,b){G.vertices.push(new THREE.Vertex(new THREE.Vector3(a,c,b)))}function f(a,c,b){a+=K;c+=K;b+=K;G.faces.push(new THREE.Face3(a,
+c,b,null,null,w));if(w){var e=D.maxY,f=D.maxX,h=G.vertices[c].position.x,c=G.vertices[c].position.y,g=G.vertices[b].position.x,b=G.vertices[b].position.y;G.faceVertexUvs[0].push([new THREE.UV(G.vertices[a].position.x/f,G.vertices[a].position.y/e),new THREE.UV(h/f,c/e),new THREE.UV(g/f,b/e)])}}var k=b.amount!==void 0?b.amount:100,l=b.bevelThickness!==void 0?b.bevelThickness:6,m=b.bevelSize!==void 0?b.bevelSize:l-2,n=b.bevelSegments!==void 0?b.bevelSegments:3,o=b.bevelEnabled!==void 0?b.bevelEnabled:
+!0,t=b.curveSegments!==void 0?b.curveSegments:12,u=b.steps!==void 0?b.steps:1,v=b.bendPath,y=b.extrudePath,p,z=!1,x=b.useSpacedPoints!==void 0?b.useSpacedPoints:!1,w=b.material,A=b.extrudeMaterial,D=this.shapebb;if(y)p=y.getPoints(t),u=p.length,z=!0,o=!1;o||(m=l=n=0);var B,E,I,G=this,K=this.vertices.length;v&&a.addWrapPath(v);t=x?a.extractAllSpacedPoints(t):a.extractAllPoints(t);v=t.shape;t=t.holes;if(y=!THREE.Shape.Utils.isClockWise(v)){v=v.reverse();E=0;for(I=t.length;E<I;E++)B=t[E],THREE.Shape.Utils.isClockWise(B)&&
+(t[E]=B.reverse());y=!1}y=THREE.Shape.Utils.triangulateShape(v,t);x=v;E=0;for(I=t.length;E<I;E++)B=t[E],v=v.concat(B);var C,F,J,M,N,L,O=v.length,H=y.length,Q=[];C=0;F=x.length;R=F-1;for(S=C+1;C<F;C++,R++,S++)R==F&&(R=0),S==F&&(S=0),Q[C]=e(x[C],x[R],x[S]);var P=[],T,X=Q.concat();E=0;for(I=t.length;E<I;E++){B=t[E];T=[];C=0;F=B.length;R=F-1;for(S=C+1;C<F;C++,R++,S++)R==F&&(R=0),S==F&&(S=0),T[C]=e(B[C],B[R],B[S]);P.push(T);X=X.concat(T)}for(J=0;J<n;J++){M=J/n;N=l*(1-M);M=m*Math.sin(M*Math.PI/2);C=0;for(F=
+x.length;C<F;C++)L=c(x[C],Q[C],M),h(L.x,L.y,-N);E=0;for(I=t.length;E<I;E++){B=t[E];T=P[E];C=0;for(F=B.length;C<F;C++)L=c(B[C],T[C],M),h(L.x,L.y,-N)}}M=m;for(C=0;C<O;C++)L=o?c(v[C],X[C],M):v[C],z?h(L.x,L.y+p[0].y,p[0].x):h(L.x,L.y,0);for(J=1;J<=u;J++)for(C=0;C<O;C++)L=o?c(v[C],X[C],M):v[C],z?h(L.x,L.y+p[J-1].y,p[J-1].x):h(L.x,L.y,k/u*J);for(J=n-1;J>=0;J--){M=J/n;N=l*(1-M);M=m*Math.sin(M*Math.PI/2);C=0;for(F=x.length;C<F;C++)L=c(x[C],Q[C],M),h(L.x,L.y,k+N);E=0;for(I=t.length;E<I;E++){B=t[E];T=P[E];
+C=0;for(F=B.length;C<F;C++)L=c(B[C],T[C],M),z?h(L.x,L.y+p[u-1].y,p[u-1].x+N):h(L.x,L.y,k+N)}}if(o){o=O*0;for(C=0;C<H;C++)m=y[C],f(m[2]+o,m[1]+o,m[0]+o);o=O*(u+n*2);for(C=0;C<H;C++)m=y[C],f(m[0]+o,m[1]+o,m[2]+o)}else{for(C=0;C<H;C++)m=y[C],f(m[2],m[1],m[0]);for(C=0;C<H;C++)m=y[C],f(m[0]+O*u,m[1]+O*u,m[2]+O*u)}var R,S,W=0;g(x);W+=x.length;E=0;for(I=t.length;E<I;E++)B=t[E],g(B),W+=B.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 b(a,c,b){var e=Math.sqrt(a*a+c*c+b*b);return g.vertices.push(new THREE.Vertex(new THREE.Vector3(a/e,c/e,b/e)))-1}function c(a,c,b,e){e.faces.push(new THREE.Face3(a,c,b))}function e(a,c){var e=g.vertices[a].position,f=g.vertices[c].position;return b((e.x+f.x)/2,(e.y+f.y)/2,(e.z+f.z)/2)}var g=this,h=new THREE.Geometry;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;b(-1,a,0);b(1,a,0);b(-1,-a,0);b(1,-a,0);b(0,-1,a);b(0,1,a);b(0,-1,
 -a);b(0,1,-a);b(a,0,-1);b(a,0,1);b(-a,0,-1);b(-a,0,1);c(0,11,5,h);c(0,5,1,h);c(0,1,7,h);c(0,7,10,h);c(0,10,11,h);c(1,5,9,h);c(5,11,4,h);c(11,10,2,h);c(10,7,6,h);c(7,1,8,h);c(3,9,4,h);c(3,4,2,h);c(3,2,6,h);c(3,6,8,h);c(3,8,9,h);c(4,9,5,h);c(2,4,11,h);c(6,2,10,h);c(8,6,7,h);c(9,8,1,h);for(var f=0;f<this.subdivisions;f++){var a=new THREE.Geometry,k;for(k in h.faces){var l=e(h.faces[k].a,h.faces[k].b),m=e(h.faces[k].b,h.faces[k].c),n=e(h.faces[k].c,h.faces[k].a);c(h.faces[k].a,l,n,a);c(h.faces[k].b,m,
@@ -173,10 +173,10 @@ THREE.TextGeometry=function(a,b){var c=(new THREE.TextPath(a,b)).toShapes();b.am
 THREE.TextGeometry.prototype.constructor=THREE.TextGeometry;
 THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function(){return this.faces[this.face][this.weight][this.style]},getTextShapes:function(a,b){return(new TextPath(a,b)).toShapes()},loadFace:function(a){var b=a.familyName.toLowerCase();this.faces[b]=this.faces[b]||{};this.faces[b][a.cssFontWeight]=this.faces[b][a.cssFontWeight]||{};this.faces[b][a.cssFontWeight][a.cssFontStyle]=a;return this.faces[b][a.cssFontWeight][a.cssFontStyle]=a},drawText:function(a){for(var b=
 this.getFace(),c=this.size/b.resolution,e=0,g=String(a).split(""),h=g.length,f=[],a=0;a<h;a++){var k=new THREE.Path,k=this.extractGlyphPoints(g[a],b,c,e,k);e+=k.offset;f.push(k.path)}return{paths:f,offset:e/2}},extractGlyphPoints:function(a,b,c,e,g){var h=[],f,k,l,m,n,o,t,u,v,y,p=b.glyphs[a]||b.glyphs[ctxt.options.fallbackCharacter];if(p){if(p.o){b=p._cachedOutline||(p._cachedOutline=p.o.split(" "));l=b.length;for(a=0;a<l;)switch(k=b[a++],k){case "m":k=b[a++]*c+e;m=b[a++]*c;h.push(new THREE.Vector2(k,
-m));g.moveTo(k,m);break;case "l":k=b[a++]*c+e;m=b[a++]*c;h.push(new THREE.Vector2(k,m));g.lineTo(k,m);break;case "q":k=b[a++]*c+e;m=b[a++]*c;t=b[a++]*c+e;u=b[a++]*c;g.quadraticCurveTo(t,u,k,m);if(f=h[h.length-1]){n=f.x;o=f.y;f=1;for(divisions=this.divisions;f<=divisions;f++){var z=f/divisions,w=THREE.Shape.Utils.b2(z,n,t,k),z=THREE.Shape.Utils.b2(z,o,u,m);h.push(new THREE.Vector2(w,z))}}break;case "b":if(k=b[a++]*c+e,m=b[a++]*c,t=b[a++]*c+e,u=b[a++]*-c,v=b[a++]*c+e,y=b[a++]*-c,g.bezierCurveTo(k,m,
-t,u,v,y),f=h[h.length-1]){n=f.x;o=f.y;f=1;for(divisions=this.divisions;f<=divisions;f++)z=f/divisions,w=THREE.Shape.Utils.b3(z,n,t,v,k),z=THREE.Shape.Utils.b3(z,o,u,y,m),h.push(new THREE.Vector2(w,z))}}}return{offset:p.ha*c,points:h,path:g}}}};
-(function(a){var b=function(a){for(var b=a.length,g=0,h=b-1,f=0;f<b;h=f++)g+=a[h].x*a[f].y-a[f].x*a[h].y;return g*0.5};a.Triangulate=function(a,e){var g=a.length;if(g<3)return null;var h=[],f=[],k=[],l,m,n;if(b(a)>0)for(m=0;m<g;m++)f[m]=m;else for(m=0;m<g;m++)f[m]=g-1-m;var o=2*g;for(m=g-1;g>2;){if(o--<=0){console.log("Warning, unable to triangulate polygon!");if(e)return k;return h}l=m;g<=l&&(l=0);m=l+1;g<=m&&(m=0);n=m+1;g<=n&&(n=0);var t;a:{t=a;var u=l,v=m,y=n,p=g,z=f,w=void 0,x=void 0,A=void 0,
-D=void 0,B=void 0,E=void 0,I=void 0,H=void 0,J=void 0,x=t[z[u]].x,A=t[z[u]].y,D=t[z[v]].x,B=t[z[v]].y,E=t[z[y]].x,I=t[z[y]].y;if(1.0E-10>(D-x)*(I-A)-(B-A)*(E-x))t=!1;else{for(w=0;w<p;w++)if(!(w==u||w==v||w==y)){var H=t[z[w]].x,J=t[z[w]].y,C=void 0,F=void 0,K=void 0,M=void 0,N=void 0,L=void 0,O=void 0,G=void 0,S=void 0,P=void 0,U=void 0,V=void 0,C=K=N=void 0,C=E-D,F=I-B,K=x-E,M=A-I,N=D-x,L=B-A,O=H-x,G=J-A,S=H-D,P=J-B,U=H-E,V=J-I,C=C*P-F*S,N=N*G-L*O,K=K*V-M*U;if(C>=0&&K>=0&&N>=0){t=!1;break a}}t=!0}}if(t){h.push([a[f[l]],
+m));g.moveTo(k,m);break;case "l":k=b[a++]*c+e;m=b[a++]*c;h.push(new THREE.Vector2(k,m));g.lineTo(k,m);break;case "q":k=b[a++]*c+e;m=b[a++]*c;t=b[a++]*c+e;u=b[a++]*c;g.quadraticCurveTo(t,u,k,m);if(f=h[h.length-1]){n=f.x;o=f.y;f=1;for(divisions=this.divisions;f<=divisions;f++){var z=f/divisions,x=THREE.Shape.Utils.b2(z,n,t,k),z=THREE.Shape.Utils.b2(z,o,u,m);h.push(new THREE.Vector2(x,z))}}break;case "b":if(k=b[a++]*c+e,m=b[a++]*c,t=b[a++]*c+e,u=b[a++]*-c,v=b[a++]*c+e,y=b[a++]*-c,g.bezierCurveTo(k,m,
+t,u,v,y),f=h[h.length-1]){n=f.x;o=f.y;f=1;for(divisions=this.divisions;f<=divisions;f++)z=f/divisions,x=THREE.Shape.Utils.b3(z,n,t,v,k),z=THREE.Shape.Utils.b3(z,o,u,y,m),h.push(new THREE.Vector2(x,z))}}}return{offset:p.ha*c,points:h,path:g}}}};
+(function(a){var b=function(a){for(var b=a.length,g=0,h=b-1,f=0;f<b;h=f++)g+=a[h].x*a[f].y-a[f].x*a[h].y;return g*0.5};a.Triangulate=function(a,e){var g=a.length;if(g<3)return null;var h=[],f=[],k=[],l,m,n;if(b(a)>0)for(m=0;m<g;m++)f[m]=m;else for(m=0;m<g;m++)f[m]=g-1-m;var o=2*g;for(m=g-1;g>2;){if(o--<=0){console.log("Warning, unable to triangulate polygon!");if(e)return k;return h}l=m;g<=l&&(l=0);m=l+1;g<=m&&(m=0);n=m+1;g<=n&&(n=0);var t;a:{t=a;var u=l,v=m,y=n,p=g,z=f,x=void 0,w=void 0,A=void 0,
+D=void 0,B=void 0,E=void 0,I=void 0,G=void 0,K=void 0,w=t[z[u]].x,A=t[z[u]].y,D=t[z[v]].x,B=t[z[v]].y,E=t[z[y]].x,I=t[z[y]].y;if(1.0E-10>(D-w)*(I-A)-(B-A)*(E-w))t=!1;else{for(x=0;x<p;x++)if(!(x==u||x==v||x==y)){var G=t[z[x]].x,K=t[z[x]].y,C=void 0,F=void 0,J=void 0,M=void 0,N=void 0,L=void 0,O=void 0,H=void 0,Q=void 0,P=void 0,T=void 0,X=void 0,C=J=N=void 0,C=E-D,F=I-B,J=w-E,M=A-I,N=D-w,L=B-A,O=G-w,H=K-A,Q=G-D,P=K-B,T=G-E,X=K-I,C=C*P-F*Q,N=N*H-L*O,J=J*X-M*T;if(C>=0&&J>=0&&N>=0){t=!1;break a}}t=!0}}if(t){h.push([a[f[l]],
 a[f[m]],a[f[n]]]);k.push([f[l],f[m],f[n]]);l=m;for(n=m+1;n<g;l++,n++)f[l]=f[n];g--;o=2*g}}if(e)return k;return h};a.Triangulate.area=b;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
 THREE.TorusGeometry=function(a,b,c,e,g){THREE.Geometry.call(this);this.radius=a||100;this.tube=b||40;this.segmentsR=c||8;this.segmentsT=e||6;this.arc=g||Math.PI*2;g=new THREE.Vector3;a=[];b=[];for(c=0;c<=this.segmentsR;c++)for(e=0;e<=this.segmentsT;e++){var h=e/this.segmentsT*this.arc,f=c/this.segmentsR*Math.PI*2;g.x=this.radius*Math.cos(h);g.y=this.radius*Math.sin(h);var k=new THREE.Vector3;k.x=(this.radius+this.tube*Math.cos(f))*Math.cos(h);k.y=(this.radius+this.tube*Math.cos(f))*Math.sin(h);k.z=
 this.tube*Math.sin(f);this.vertices.push(new THREE.Vertex(k));a.push(new THREE.UV(e/this.segmentsT,1-c/this.segmentsR));b.push(k.clone().subSelf(g).normalize())}for(c=1;c<=this.segmentsR;c++)for(e=1;e<=this.segmentsT;e++){var g=(this.segmentsT+1)*c+e-1,h=(this.segmentsT+1)*(c-1)+e-1,f=(this.segmentsT+1)*(c-1)+e,k=(this.segmentsT+1)*c+e,l=new THREE.Face4(g,h,f,k,[b[g],b[h],b[f],b[k]]);l.normal.addSelf(b[g]);l.normal.addSelf(b[h]);l.normal.addSelf(b[f]);l.normal.addSelf(b[k]);l.normal.normalize();this.faces.push(l);
@@ -186,11 +186,11 @@ this.segmentsT;++b){var l=a/this.segmentsR*2*this.p*Math.PI,f=b/this.segmentsT*2
 g.z)))-1}}for(a=0;a<this.segmentsR;++a)for(b=0;b<this.segmentsT;++b){var e=(a+1)%this.segmentsR,h=(b+1)%this.segmentsT,g=this.grid[a][b],c=this.grid[e][b],e=this.grid[e][h],h=this.grid[a][h],f=new THREE.UV(a/this.segmentsR,b/this.segmentsT),l=new THREE.UV((a+1)/this.segmentsR,b/this.segmentsT),m=new THREE.UV((a+1)/this.segmentsR,(b+1)/this.segmentsT),n=new THREE.UV(a/this.segmentsR,(b+1)/this.segmentsT);this.faces.push(new THREE.Face4(g,c,e,h));this.faceVertexUvs[0].push([f,l,m,n])}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 b=this.subdivisions;b-- >0;)this.smooth(a)};
 THREE.SubdivisionModifier.prototype.smooth=function(a){function b(a,c,b,e,k,l){var m=new THREE.Face4(a,c,b,e,null,k.color,k.material);if(f.useOldVertexColors){m.vertexColors=[];for(var n,p,u,t=0;t<4;t++){u=l[t];n=new THREE.Color;n.setRGB(0,0,0);for(var v=0;v<u.length;v++)p=k.vertexColors[u[v]-1],n.r+=p.r,n.g+=p.g,n.b+=p.b;n.r/=u.length;n.g/=u.length;n.b/=u.length;m.vertexColors[t]=n}}g.push(m);(!f.supportUVs||o.length!=0)&&h.push([o[a],o[c],o[b],o[e]])}function c(a,c){return Math.min(a,c)+"_"+Math.max(a,
-c)}var e=[],g=[],h=[],f=this,k=a.vertices,e=a.faces,l=k.concat(),m=[],n={},o=[],t,u,v,y,p,z=a.faceVertexUvs[0];t=0;for(u=z.length;t<u;t++){v=0;for(y=z[t].length;v<y;v++)p=e[t]["abcd".charAt(v)],o[p]||(o[p]=z[t][v])}var w;t=0;for(u=e.length;t<u;t++)if(p=e[t],m.push(p.centroid),l.push(new THREE.Vertex(p.centroid)),f.supportUVs&&o.length!=0){w=new THREE.UV;if(p instanceof THREE.Face3)w.u=o[p.a].u+o[p.b].u+o[p.c].u,w.v=o[p.a].v+o[p.b].v+o[p.c].v,w.u/=3,w.v/=3;else if(p instanceof THREE.Face4)w.u=o[p.a].u+
-o[p.b].u+o[p.c].u+o[p.d].u,w.v=o[p.a].v+o[p.b].v+o[p.c].v+o[p.d].v,w.u/=4,w.v/=4;o.push(w)}y=function(a){function b(a,c,e){a[c]===void 0&&(a[c]=[]);a[c].push(e)}var e,f,h,g,k={};e=0;for(f=a.faces.length;e<f;e++)h=a.faces[e],h instanceof THREE.Face3?(g=c(h.a,h.b),b(k,g,e),g=c(h.b,h.c),b(k,g,e),g=c(h.c,h.a),b(k,g,e)):h instanceof THREE.Face4&&(g=c(h.a,h.b),b(k,g,e),g=c(h.b,h.c),b(k,g,e),g=c(h.c,h.d),b(k,g,e),g=c(h.d,h.a),b(k,g,e));return k}(a);var x,A,D=0,z=k.length,B;for(t in y)if(p=y[t],w=p[0],x=
-p[1],B=t.split("_"),u=B[0],B=B[1],A=new THREE.Vector3,p.length!=2?(A.addSelf(k[u].position),A.addSelf(k[B].position),A.multiplyScalar(0.5)):(A.addSelf(m[w]),A.addSelf(m[x]),A.addSelf(k[u].position),A.addSelf(k[B].position),A.multiplyScalar(0.25)),n[t]=z+e.length+D,l.push(new THREE.Vertex(A)),D++,f.supportUVs&&o.length!=0)w=new THREE.UV,w.u=o[u].u+o[B].u,w.v=o[u].v+o[B].v,w.u/=2,w.v/=2,o.push(w);t=0;for(u=m.length;t<u;t++)p=e[t],w=z+t,p instanceof THREE.Face3?(x=c(p.a,p.b),B=c(p.b,p.c),D=c(p.c,p.a),
-b(w,n[x],p.b,n[B],p,["123","12","2","23"]),b(w,n[B],p.c,n[D],p,["123","23","3","31"]),b(w,n[D],p.a,n[x],p,["123","31","1","12"])):p instanceof THREE.Face4?(x=c(p.a,p.b),B=c(p.b,p.c),D=c(p.c,p.d),A=c(p.d,p.a),b(w,n[x],p.b,n[B],p,["1234","12","2","23"]),b(w,n[B],p.c,n[D],p,["1234","23","3","34"]),b(w,n[D],p.d,n[A],p,["1234","34","4","41"]),b(w,n[A],p.a,n[x],p,["1234","41","1","12"])):console.log("face should be a face!",p);var e=l,E={},I={},l=function(a,c){E[a]===void 0&&(E[a]=[]);E[a].push(c)},n=function(a,
-c){I[a]===void 0&&(I[a]={});I[a][c]=null};for(t in y)p=y[t],B=t.split("_"),u=B[0],B=B[1],l(u,[u,B]),l(B,[u,B]),w=p[0],x=p[1],n(u,w),x?n(u,x):n(u,w),n(B,w),x?n(B,x):n(B,w);l=new THREE.Vector3;n=new THREE.Vector3;t=0;for(u=k.length;t<u;t++)if(E[t]!==void 0){l.set(0,0,0);n.set(0,0,0);y=new THREE.Vector3(0,0,0);z=0;for(v in I[t])l.addSelf(m[v]),z++;l.divideScalar(z);z=E[t].length;for(v=0;v<z;v++)p=E[t][v],p=k[p[0]].position.clone().addSelf(k[p[1]].position).divideScalar(2),n.addSelf(p);n.divideScalar(z);
+c)}var e=[],g=[],h=[],f=this,k=a.vertices,e=a.faces,l=k.concat(),m=[],n={},o=[],t,u,v,y,p,z=a.faceVertexUvs[0];t=0;for(u=z.length;t<u;t++){v=0;for(y=z[t].length;v<y;v++)p=e[t]["abcd".charAt(v)],o[p]||(o[p]=z[t][v])}var x;t=0;for(u=e.length;t<u;t++)if(p=e[t],m.push(p.centroid),l.push(new THREE.Vertex(p.centroid)),f.supportUVs&&o.length!=0){x=new THREE.UV;if(p instanceof THREE.Face3)x.u=o[p.a].u+o[p.b].u+o[p.c].u,x.v=o[p.a].v+o[p.b].v+o[p.c].v,x.u/=3,x.v/=3;else if(p instanceof THREE.Face4)x.u=o[p.a].u+
+o[p.b].u+o[p.c].u+o[p.d].u,x.v=o[p.a].v+o[p.b].v+o[p.c].v+o[p.d].v,x.u/=4,x.v/=4;o.push(x)}y=function(a){function b(a,c,e){a[c]===void 0&&(a[c]=[]);a[c].push(e)}var e,f,h,g,k={};e=0;for(f=a.faces.length;e<f;e++)h=a.faces[e],h instanceof THREE.Face3?(g=c(h.a,h.b),b(k,g,e),g=c(h.b,h.c),b(k,g,e),g=c(h.c,h.a),b(k,g,e)):h instanceof THREE.Face4&&(g=c(h.a,h.b),b(k,g,e),g=c(h.b,h.c),b(k,g,e),g=c(h.c,h.d),b(k,g,e),g=c(h.d,h.a),b(k,g,e));return k}(a);var w,A,D=0,z=k.length,B;for(t in y)if(p=y[t],x=p[0],w=
+p[1],B=t.split("_"),u=B[0],B=B[1],A=new THREE.Vector3,p.length!=2?(A.addSelf(k[u].position),A.addSelf(k[B].position),A.multiplyScalar(0.5)):(A.addSelf(m[x]),A.addSelf(m[w]),A.addSelf(k[u].position),A.addSelf(k[B].position),A.multiplyScalar(0.25)),n[t]=z+e.length+D,l.push(new THREE.Vertex(A)),D++,f.supportUVs&&o.length!=0)x=new THREE.UV,x.u=o[u].u+o[B].u,x.v=o[u].v+o[B].v,x.u/=2,x.v/=2,o.push(x);t=0;for(u=m.length;t<u;t++)p=e[t],x=z+t,p instanceof THREE.Face3?(w=c(p.a,p.b),B=c(p.b,p.c),D=c(p.c,p.a),
+b(x,n[w],p.b,n[B],p,["123","12","2","23"]),b(x,n[B],p.c,n[D],p,["123","23","3","31"]),b(x,n[D],p.a,n[w],p,["123","31","1","12"])):p instanceof THREE.Face4?(w=c(p.a,p.b),B=c(p.b,p.c),D=c(p.c,p.d),A=c(p.d,p.a),b(x,n[w],p.b,n[B],p,["1234","12","2","23"]),b(x,n[B],p.c,n[D],p,["1234","23","3","34"]),b(x,n[D],p.d,n[A],p,["1234","34","4","41"]),b(x,n[A],p.a,n[w],p,["1234","41","1","12"])):console.log("face should be a face!",p);var e=l,E={},I={},l=function(a,c){E[a]===void 0&&(E[a]=[]);E[a].push(c)},n=function(a,
+c){I[a]===void 0&&(I[a]={});I[a][c]=null};for(t in y)p=y[t],B=t.split("_"),u=B[0],B=B[1],l(u,[u,B]),l(B,[u,B]),x=p[0],w=p[1],n(u,x),w?n(u,w):n(u,x),n(B,x),w?n(B,w):n(B,x);l=new THREE.Vector3;n=new THREE.Vector3;t=0;for(u=k.length;t<u;t++)if(E[t]!==void 0){l.set(0,0,0);n.set(0,0,0);y=new THREE.Vector3(0,0,0);z=0;for(v in I[t])l.addSelf(m[v]),z++;l.divideScalar(z);z=E[t].length;for(v=0;v<z;v++)p=E[t][v],p=k[p[0]].position.clone().addSelf(k[p[1]].position).divideScalar(2),n.addSelf(p);n.divideScalar(z);
 y.addSelf(k[t].position);y.multiplyScalar(z-3);y.addSelf(l);y.addSelf(n.multiplyScalar(2));y.divideScalar(z);e[t].position=y}a.vertices=e;a.faces=g;a.faceVertexUvs[0]=h;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 b="Loaded ";b+=a.total?(100*a.loaded/a.total).toFixed(0)+"%":(a.loaded/
 1E3).toFixed(2)+" KB";this.statusDomElement.innerHTML=b},extractUrlbase:function(a){a=a.split("/");a.pop();return a.length<1?"":a.join("/")+"/"},init_materials:function(a,b,c){a.materials=[];for(var e=0;e<b.length;++e)a.materials[e]=[THREE.Loader.prototype.createMaterial(b[e],c)]},hasNormals:function(a){var b,c,e=a.materials.length;for(c=0;c<e;c++)if(b=a.materials[c][0],b instanceof THREE.ShaderMaterial)return!0;return!1},createMaterial:function(a,b){function c(a){a=Math.log(a)/Math.LN2;return Math.floor(a)==
@@ -206,112 +206,111 @@ b.postMessage(a)};
 THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,b,c,e,g,h){var f=new XMLHttpRequest,k=e+"/"+a,l=0;f.onreadystatechange=function(){f.readyState==4?f.status==200||f.status==0?THREE.BinaryLoader.prototype.createBinModel(f.responseText,c,g,b):alert("Couldn't load ["+k+"] ["+f.status+"]"):f.readyState==3?h&&(l==0&&(l=f.getResponseHeader("Content-Length")),h({total:l,loaded:f.responseText.length})):f.readyState==2&&(l=f.getResponseHeader("Content-Length"))};f.open("GET",k,!0);f.overrideMimeType("text/plain; charset=x-user-defined");
 f.setRequestHeader("Content-Type","text/plain");f.send(null)};
 THREE.BinaryLoader.prototype.createBinModel=function(a,b,c,e){var g=function(c){function b(a,c){var e=n(a,c),f=n(a,c+1),g=n(a,c+2),h=n(a,c+3),k=(h<<1&255|g>>7)-127;e|=(g&127)<<16|f<<8;if(e==0&&k==-127)return 0;return(1-2*(h>>7))*(1+e*Math.pow(2,-23))*Math.pow(2,k)}function g(a,c){var b=n(a,c),e=n(a,c+1),f=n(a,c+2);return(n(a,c+3)<<24)+(f<<16)+(e<<8)+b}function l(a,c){var b=n(a,c);return(n(a,c+1)<<8)+b}function m(a,c){var b=n(a,c);return b>127?b-256:b}function n(a,c){return a.charCodeAt(c)&255}function o(c){var b,
-e,f;b=g(a,c);e=g(a,c+B);f=g(a,c+E);c=l(a,c+I);z.faces.push(new THREE.Face3(b,e,f,null,null,z.materials[c]))}function t(c){var b,e,f,h,m,n;b=g(a,c);e=g(a,c+B);f=g(a,c+E);h=l(a,c+I);m=g(a,c+H);n=g(a,c+J);c=g(a,c+C);h=z.materials[h];var o=A[n*3],p=A[n*3+1];n=A[n*3+2];var t=A[c*3],ia=A[c*3+1],c=A[c*3+2];z.faces.push(new THREE.Face3(b,e,f,[new THREE.Vector3(A[m*3],A[m*3+1],A[m*3+2]),new THREE.Vector3(o,p,n),new THREE.Vector3(t,ia,c)],null,h))}function u(c){var b,e,f,h;b=g(a,c);e=g(a,c+F);f=g(a,c+K);h=
-g(a,c+M);c=l(a,c+N);z.faces.push(new THREE.Face4(b,e,f,h,null,null,z.materials[c]))}function v(c){var b,e,f,h,m,n,o,p;b=g(a,c);e=g(a,c+F);f=g(a,c+K);h=g(a,c+M);m=l(a,c+N);n=g(a,c+L);o=g(a,c+O);p=g(a,c+G);c=g(a,c+S);m=z.materials[m];var t=A[o*3],ia=A[o*3+1];o=A[o*3+2];var la=A[p*3],ma=A[p*3+1];p=A[p*3+2];var u=A[c*3],v=A[c*3+1],c=A[c*3+2];z.faces.push(new THREE.Face4(b,e,f,h,[new THREE.Vector3(A[n*3],A[n*3+1],A[n*3+2]),new THREE.Vector3(t,ia,o),new THREE.Vector3(la,ma,p),new THREE.Vector3(u,v,c)],
-null,m))}function y(c){var b,e,f,h;b=g(a,c);e=g(a,c+P);f=g(a,c+U);c=D[b*2];h=D[b*2+1];b=D[e*2];var l=z.faceVertexUvs[0];e=D[e*2+1];var m=D[f*2];f=D[f*2+1];var n=[];n.push(new THREE.UV(c,h));n.push(new THREE.UV(b,e));n.push(new THREE.UV(m,f));l.push(n)}function p(c){var b,e,f,h,l,m;b=g(a,c);e=g(a,c+V);f=g(a,c+T);h=g(a,c+R);c=D[b*2];l=D[b*2+1];b=D[e*2];m=D[e*2+1];e=D[f*2];var n=z.faceVertexUvs[0];f=D[f*2+1];var o=D[h*2];h=D[h*2+1];var p=[];p.push(new THREE.UV(c,l));p.push(new THREE.UV(b,m));p.push(new THREE.UV(e,
-f));p.push(new THREE.UV(o,h));n.push(p)}var z=this,w=0,x,A=[],D=[],B,E,I,H,J,C,F,K,M,N,L,O,G,S,P,U,V,T,R,Q,Z,W,$,X,Y;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(z,e,c);x={signature:a.substr(w,8),header_bytes:n(a,w+8),vertex_coordinate_bytes:n(a,w+9),normal_coordinate_bytes:n(a,w+10),uv_coordinate_bytes:n(a,w+11),vertex_index_bytes:n(a,w+12),normal_index_bytes:n(a,w+13),uv_index_bytes:n(a,w+14),material_index_bytes:n(a,w+15),nvertices:g(a,w+16),nnormals:g(a,w+16+4),nuvs:g(a,w+16+
-8),ntri_flat:g(a,w+16+12),ntri_smooth:g(a,w+16+16),ntri_flat_uv:g(a,w+16+20),ntri_smooth_uv:g(a,w+16+24),nquad_flat:g(a,w+16+28),nquad_smooth:g(a,w+16+32),nquad_flat_uv:g(a,w+16+36),nquad_smooth_uv:g(a,w+16+40)};w+=x.header_bytes;B=x.vertex_index_bytes;E=x.vertex_index_bytes*2;I=x.vertex_index_bytes*3;H=x.vertex_index_bytes*3+x.material_index_bytes;J=x.vertex_index_bytes*3+x.material_index_bytes+x.normal_index_bytes;C=x.vertex_index_bytes*3+x.material_index_bytes+x.normal_index_bytes*2;F=x.vertex_index_bytes;
-K=x.vertex_index_bytes*2;M=x.vertex_index_bytes*3;N=x.vertex_index_bytes*4;L=x.vertex_index_bytes*4+x.material_index_bytes;O=x.vertex_index_bytes*4+x.material_index_bytes+x.normal_index_bytes;G=x.vertex_index_bytes*4+x.material_index_bytes+x.normal_index_bytes*2;S=x.vertex_index_bytes*4+x.material_index_bytes+x.normal_index_bytes*3;P=x.uv_index_bytes;U=x.uv_index_bytes*2;V=x.uv_index_bytes;T=x.uv_index_bytes*2;R=x.uv_index_bytes*3;c=x.vertex_index_bytes*3+x.material_index_bytes;Y=x.vertex_index_bytes*
-4+x.material_index_bytes;Q=x.ntri_flat*c;Z=x.ntri_smooth*(c+x.normal_index_bytes*3);W=x.ntri_flat_uv*(c+x.uv_index_bytes*3);$=x.ntri_smooth_uv*(c+x.normal_index_bytes*3+x.uv_index_bytes*3);X=x.nquad_flat*Y;c=x.nquad_smooth*(Y+x.normal_index_bytes*4);Y=x.nquad_flat_uv*(Y+x.uv_index_bytes*4);w+=function(c){for(var e,h,g,k=x.vertex_coordinate_bytes*3,l=c+x.nvertices*k;c<l;c+=k)e=b(a,c),h=b(a,c+x.vertex_coordinate_bytes),g=b(a,c+x.vertex_coordinate_bytes*2),z.vertices.push(new THREE.Vertex(new THREE.Vector3(e,
-h,g)));return x.nvertices*k}(w);w+=function(c){for(var b,e,f,h=x.normal_coordinate_bytes*3,g=c+x.nnormals*h;c<g;c+=h)b=m(a,c),e=m(a,c+x.normal_coordinate_bytes),f=m(a,c+x.normal_coordinate_bytes*2),A.push(b/127,e/127,f/127);return x.nnormals*h}(w);w+=function(c){for(var e,h,g=x.uv_coordinate_bytes*2,k=c+x.nuvs*g;c<k;c+=g)e=b(a,c),h=b(a,c+x.uv_coordinate_bytes),D.push(e,h);return x.nuvs*g}(w);Q=w+Q;Z=Q+Z;W=Z+W;$=W+$;X=$+X;c=X+c;Y=c+Y;(function(a){var c,b=x.vertex_index_bytes*3+x.material_index_bytes,
-e=b+x.uv_index_bytes*3,f=a+x.ntri_flat_uv*e;for(c=a;c<f;c+=e)o(c),y(c+b);return f-a})(Z);(function(a){var c,b=x.vertex_index_bytes*3+x.material_index_bytes+x.normal_index_bytes*3,e=b+x.uv_index_bytes*3,f=a+x.ntri_smooth_uv*e;for(c=a;c<f;c+=e)t(c),y(c+b);return f-a})(W);(function(a){var c,b=x.vertex_index_bytes*4+x.material_index_bytes,e=b+x.uv_index_bytes*4,f=a+x.nquad_flat_uv*e;for(c=a;c<f;c+=e)u(c),p(c+b);return f-a})(c);(function(a){var c,b=x.vertex_index_bytes*4+x.material_index_bytes+x.normal_index_bytes*
-4,e=b+x.uv_index_bytes*4,f=a+x.nquad_smooth_uv*e;for(c=a;c<f;c+=e)v(c),p(c+b);return f-a})(Y);(function(a){var c,b=x.vertex_index_bytes*3+x.material_index_bytes,e=a+x.ntri_flat*b;for(c=a;c<e;c+=b)o(c);return e-a})(w);(function(a){var c,b=x.vertex_index_bytes*3+x.material_index_bytes+x.normal_index_bytes*3,e=a+x.ntri_smooth*b;for(c=a;c<e;c+=b)t(c);return e-a})(Q);(function(a){var c,b=x.vertex_index_bytes*4+x.material_index_bytes,e=a+x.nquad_flat*b;for(c=a;c<e;c+=b)u(c);return e-a})($);(function(a){var c,
-b=x.vertex_index_bytes*4+x.material_index_bytes+x.normal_index_bytes*4,e=a+x.nquad_smooth*b;for(c=a;c<e;c+=b)v(c);return e-a})(X);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};g.prototype=new THREE.Geometry;g.prototype.constructor=g;b(new g(c))};
-THREE.ColladaLoader=function(){function a(a,c,b){for(var a=Q.evaluate(a,Q,G,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null),e={},f=a.iterateNext(),h=0;f;){f=(new c).parse(f);if(f.id.length==0)f.id=b+h++;e[f.id]=f;f=a.iterateNext()}return e}function b(){var a=1E6,c=-a,b=0,e;for(e in ca)for(var f=ca[e],h=0;h<f.sampler.length;h++){var g=f.sampler[h];g.create();a=Math.min(a,g.startTime);c=Math.max(c,g.endTime);b=Math.max(b,g.input.length)}return{start:a,end:c,frames:b}}function c(a,b,e,f){a.world=a.world||
-new THREE.Matrix4;a.world.copy(a.matrix);if(a.channels&&a.channels.length){var h=a.channels[0].sampler.output[e];h instanceof THREE.Matrix4&&a.world.copy(h)}f&&a.world.multiply(f,a.world);b.push(a);for(f=0;f<a.nodes.length;f++)c(a.nodes[f],b,e,a.world)}function e(a,e,f){var h=aa[e.url];if(!h||!h.skin)console.log("ColladaLoader: Could not find skin controller.");else if(!e.skeleton||!e.skeleton.length)console.log("ColladaLoader: Could not find the skeleton for the skin. ");else{var g=b(),e=W.getChildById(e.skeleton[0],
-!0)||W.getChildBySid(e.skeleton[0],!0),k,l,m,n,o=new THREE.Vector3,p;for(k=0;k<a.vertices.length;k++)h.skin.bindShapeMatrix.multiplyVector3(a.vertices[k].position);for(f=0;f<g.frames;f++){var t=[],u=[];for(k=0;k<a.vertices.length;k++)u.push(new THREE.Vertex(new THREE.Vector3));c(e,t,f);k=t;l=h.skin;for(n=0;n<k.length;n++)if(m=k[n],p=-1,m.type=="JOINT"){for(var v=0;v<l.joints.length;v++)if(m.sid==l.joints[v]){p=v;break}if(p>=0){v=l.invBindMatrices[p];m.invBindMatrix=v;m.skinningMatrix=new THREE.Matrix4;
-m.skinningMatrix.multiply(m.world,v);m.weights=[];for(v=0;v<l.weights.length;v++)for(var y=0;y<l.weights[v].length;y++){var w=l.weights[v][y];w.joint==p&&m.weights.push(w)}}else throw"ColladaLoader: Could not find joint '"+m.sid+"'.";}for(k=0;k<t.length;k++)if(t[k].type=="JOINT")for(l=0;l<t[k].weights.length;l++)m=t[k].weights[l],n=m.index,m=m.weight,p=a.vertices[n],n=u[n],o.x=p.position.x,o.y=p.position.y,o.z=p.position.z,t[k].skinningMatrix.multiplyVector3(o),n.position.x+=o.x*m,n.position.y+=o.y*
-m,n.position.z+=o.z*m;a.morphTargets.push({name:"target_"+f,vertices:u})}}}function g(a){var c=new THREE.Object3D,b,f,h;c.name=a.id||"";c.matrixAutoUpdate=!1;c.matrix=a.matrix;for(h=0;h<a.controllers.length;h++){var k=aa[a.controllers[h].url];switch(k.type){case "skin":if(ba[k.skin.source]){var l=new v;l.url=k.skin.source;l.instance_material=a.controllers[h].instance_material;a.geometries.push(l);b=a.controllers[h]}else if(aa[k.skin.source]&&(f=k=aa[k.skin.source],k.morph&&ba[k.morph.source]))l=new v,
-l.url=k.morph.source,l.instance_material=a.controllers[h].instance_material,a.geometries.push(l);break;case "morph":if(ba[k.morph.source])l=new v,l.url=k.morph.source,l.instance_material=a.controllers[h].instance_material,a.geometries.push(l),f=a.controllers[h];console.log("ColladaLoader: Morph-controller partially supported.")}}for(h=0;h<a.geometries.length;h++){var k=a.geometries[h],l=k.instance_material,k=ba[k.url],m={},n=0,o;if(k&&k.mesh&&k.mesh.primitives){if(c.name.length==0)c.name=k.id;if(l)for(j=
-0;j<l.length;j++){o=l[j];var p=ga[fa[o.target].instance_effect.url].shader;p.material.opacity=!p.material.opacity?1:p.material.opacity;o=m[o.symbol]=p.material;n++}l=o||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});k=k.mesh.geometry3js;if(n>1){l=new THREE.MeshFaceMaterial;for(j=0;j<k.faces.length;j++)n=k.faces[j],n.materials=[m[n.daeMaterial]]}if(b!==void 0)e(k,b),l.morphTargets=!0,l=new THREE.SkinnedMesh(k,l),l.skeleton=b.skeleton,l.skinController=aa[b.url],l.skinInstanceController=
-b,l.name="skin_"+ea.length,ea.push(l);else if(f!==void 0){m=k;n=f instanceof t?aa[f.url]:f;if(!n||!n.morph)console.log("could not find morph controller!");else{n=n.morph;for(p=0;p<n.targets.length;p++){var u=ba[n.targets[p]];if(u.mesh&&u.mesh.primitives&&u.mesh.primitives.length)u=u.mesh.primitives[0].geometry,u.vertices.length===m.vertices.length&&m.morphTargets.push({name:"target_1",vertices:u.vertices})}m.morphTargets.push({name:"target_Z",vertices:m.vertices})}l.morphTargets=!0;l=new THREE.Mesh(k,
-l);l.name="morph_"+da.length;da.push(l)}else l=new THREE.Mesh(k,l);c.add(l)}}for(h=0;h<a.nodes.length;h++)c.add(g(a.nodes[h],a));return c}function h(){this.init_from=this.id=""}function f(){this.type=this.name=this.id="";this.morph=this.skin=null}function k(){this.weights=this.targets=this.source=this.method=null}function l(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function m(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}
-function n(){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 t(){this.url="";this.skeleton=[];this.instance_material=[]}function u(){this.target=this.symbol=""}function v(){this.url="";this.instance_material=[]}function y(){this.id="";this.mesh=null}function p(a){this.geometry=a.id;this.primitives=[];this.geometry3js=
-this.vertices=null}function z(){}function w(){this.material="";this.count=0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function x(){this.source="";this.stride=this.count=0;this.params=[]}function A(){this.input={}}function D(){this.semantic="";this.offset=0;this.source="";this.set=0}function B(a){this.id=a;this.type=null}function E(){this.name=this.id="";this.instance_effect=null}function I(){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 H(a,c){this.type=a;this.effect=c;this.material=null}function J(a){this.effect=a;this.format=this.init_from=null}function C(a){this.effect=a;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=this.source=null}function F(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function K(){this.url=""}function M(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function N(a){this.animation=
-a;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=this.dotSyntax=this.sid=null}function L(a){this.id="";this.animation=a;this.inputs=[];this.endTime=this.startTime=this.interpolation=this.output=this.input=null;this.duration=0}function O(a){var c=a.getAttribute("id");if(X[c]!=void 0)return X[c];X[c]=(new B(c)).parse(a);return X[c]}function G(a){if(a=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function S(a){for(var a=U(a).split(/\s+/),c=[],b=0;b<a.length;b++)c.push(parseFloat(a[b]));
-return c}function P(a){for(var a=U(a).split(/\s+/),c=[],b=0;b<a.length;b++)c.push(parseInt(a[b],10));return c}function U(a){return a.replace(/^\s+/,"").replace(/\s+$/,"")}function V(a,c,b){return a.hasAttribute(c)?parseInt(a.getAttribute(c),10):b}function T(a,c){if(a===void 0){for(var b="0.";b.length<c+2;)b+="0";return b}c=c||2;b=a.toString().split(".");for(b[1]=b.length>1?b[1].substr(0,c):"0";b[1].length<c;)b[1]+="0";return b.join(".")}function R(a,c){var b="";b+=T(a.x,c)+",";b+=T(a.y,c)+",";b+=
-T(a.z,c);return b}var Q=null,Z=null,W,$=null,X={},Y={},ca={},aa={},ba={},fa={},ga={},ha,ja,da,ea,ka=THREE.SmoothShading;h.prototype.parse=function(a){this.id=a.getAttribute("id");for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeName=="init_from")this.init_from=b.textContent}return this};f.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.type="none";for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];switch(b.nodeName){case "skin":this.skin=
-(new l).parse(b);this.type=b.nodeName;break;case "morph":this.morph=(new k).parse(b),this.type=b.nodeName}}return this};k.prototype.parse=function(a){var c={},b=[],e;this.method=a.getAttribute("method");this.source=a.getAttribute("source").replace(/^#/,"");for(e=0;e<a.childNodes.length;e++){var f=a.childNodes[e];if(f.nodeType==1)switch(f.nodeName){case "source":f=(new B).parse(f);c[f.id]=f;break;case "targets":b=this.parseInputs(f);break;default:console.log(f.nodeName)}}for(e=0;e<b.length;e++)switch(a=
-b[e],f=c[a.source],a.semantic){case "MORPH_TARGET":this.targets=f.read();break;case "MORPH_WEIGHT":this.weights=f.read()}return this};k.prototype.parseInputs=function(a){for(var c=[],b=0;b<a.childNodes.length;b++){var e=a.childNodes[b];if(e.nodeType==1)switch(e.nodeName){case "input":c.push((new D).parse(e))}}return c};l.prototype.parse=function(a){var c={},b,e;this.source=a.getAttribute("source").replace(/^#/,"");this.invBindMatrices=[];this.joints=[];this.weights=[];for(var f=0;f<a.childNodes.length;f++){var h=
-a.childNodes[f];if(h.nodeType==1)switch(h.nodeName){case "bind_shape_matrix":h=S(h.textContent);this.bindShapeMatrix=new THREE.Matrix4;this.bindShapeMatrix.set(h[0],h[1],h[2],h[3],h[4],h[5],h[6],h[7],h[8],h[9],h[10],h[11],h[12],h[13],h[14],h[15]);break;case "source":h=(new B).parse(h);c[h.id]=h;break;case "joints":b=h;break;case "vertex_weights":e=h;break;default:console.log(h.nodeName)}}this.parseJoints(b,c);this.parseWeights(e,c);return this};l.prototype.parseJoints=function(a,c){for(var b=0;b<
-a.childNodes.length;b++){var e=a.childNodes[b];if(e.nodeType==1)switch(e.nodeName){case "input":var e=(new D).parse(e),f=c[e.source];if(e.semantic=="JOINT")this.joints=f.read();else if(e.semantic=="INV_BIND_MATRIX")this.invBindMatrices=f.read()}}};l.prototype.parseWeights=function(a,c){for(var b,e,f=[],h=0;h<a.childNodes.length;h++){var g=a.childNodes[h];if(g.nodeType==1)switch(g.nodeName){case "input":f.push((new D).parse(g));break;case "v":b=P(g.textContent);break;case "vcount":e=P(g.textContent)}}for(h=
-g=0;h<e.length;h++){for(var k=e[h],l=[],m=0;m<k;m++){for(var n={},o=0;o<f.length;o++){var p=f[o],t=b[g+p.offset];switch(p.semantic){case "JOINT":n.joint=t;break;case "WEIGHT":n.weight=c[p.source].data[t]}}l.push(n);g+=f.length}for(m=0;m<l.length;m++)l[m].index=h;this.weights.push(l)}};m.prototype.getChildById=function(a,c){for(var b=0;b<this.nodes.length;b++){var e=this.nodes[b].getChildById(a,c);if(e)return e}return null};m.prototype.getChildBySid=function(a,c){for(var b=0;b<this.nodes.length;b++){var e=
-this.nodes[b].getChildBySid(a,c);if(e)return e}return null};m.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.nodes=[];for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeType==1)switch(b.nodeName){case "node":this.nodes.push((new n).parse(b))}}return this};n.prototype.getChannelForTransform=function(a){for(var c=0;c<this.channels.length;c++){var b=this.channels[c],e=b.target.split("/");e.shift();var f=e.shift(),h=f.indexOf(".")>=0,
-g=f.indexOf("(")>=0,k;if(h)e=f.split("."),f=e.shift(),e.shift();else if(g){k=f.split("(");f=k.shift();for(e=0;e<k.length;e++)k[e]=parseInt(k[e].replace(/\)/,""))}if(f==a)return b.info={sid:f,dotSyntax:h,arrSyntax:g,arrIndices:k},b}return null};n.prototype.getChildById=function(a,c){if(this.id==a)return this;if(c)for(var b=0;b<this.nodes.length;b++){var e=this.nodes[b].getChildById(a,c);if(e)return e}return null};n.prototype.getChildBySid=function(a,c){if(this.sid==a)return this;if(c)for(var b=0;b<
-this.nodes.length;b++){var e=this.nodes[b].getChildBySid(a,c);if(e)return e}return null};n.prototype.getTransformBySid=function(a){for(var c=0;c<this.transforms.length;c++)if(this.transforms[c].sid==a)return this.transforms[c];return null};n.prototype.parse=function(a){var c;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 b=0;b<a.childNodes.length;b++)if(c=a.childNodes[b],c.nodeType==1)switch(c.nodeName){case "node":this.nodes.push((new n).parse(c));break;case "instance_camera":break;case "instance_controller":this.controllers.push((new t).parse(c));break;case "instance_geometry":this.geometries.push((new v).parse(c));break;case "instance_light":break;case "instance_node":c=c.getAttribute("url").replace(/^#/,"");(c=Q.evaluate(".//dae:library_nodes//dae:node[@id='"+c+"']",Q,
-G,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new n).parse(c));break;case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new o).parse(c));break;case "extra":break;default:console.log(c.nodeName)}a=[];b=1E6;c=-1E6;for(var e in ca)for(var f=ca[e],h=0;h<f.channel.length;h++){var g=f.channel[h],k=f.sampler[h];e=g.target.split("/")[0];if(e==this.id)k.create(),g.sampler=k,b=Math.min(b,k.startTime),c=Math.max(c,k.endTime),
-a.push(g)}if(a.length)this.startTime=b,this.endTime=c;if((this.channels=a)&&this.channels.length){e=1E7;for(i=0;i<this.channels.length;i++){a=this.channels[i].sampler;for(b=0;b<a.input.length-1;b++)e=Math.min(e,a.input[b+1]-a.input[b])}b=[];for(a=this.startTime;a<this.endTime;a+=e){c=a;for(var f={},l=h=void 0,h=0;h<this.channels.length;h++)l=this.channels[h],f[l.sid]=l;g=new THREE.Matrix4;for(h=0;h<this.transforms.length;h++)if(k=this.transforms[h],l=f[k.sid],l!==void 0){for(var m=l.sampler,p,l=0;l<
-m.input.length-1;l++)if(m.input[l+1]>c){p=m.output[l];break}g=p!==void 0?p instanceof THREE.Matrix4?g.multiply(g,p):g.multiply(g,k.matrix):g.multiply(g,k.matrix)}else g=g.multiply(g,k.matrix);c=g;b.push({time:a,pos:[c.n14,c.n24,c.n34],rotq:[0,0,0,1],scl:[1,1,1]})}this.keys=b}this.updateMatrix();return this};n.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=S(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};t.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.skeleton=[];this.instance_material=[];for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeType==1)switch(b.nodeName){case "skeleton":this.skeleton.push(b.textContent.replace(/^#/,
-""));break;case "bind_material":if(b=Q.evaluate(".//dae:instance_material",b,G,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(var e=b.iterateNext();e;)this.instance_material.push((new u).parse(e)),e=b.iterateNext()}}return this};u.prototype.parse=function(a){this.symbol=a.getAttribute("symbol");this.target=a.getAttribute("target").replace(/^#/,"");return this};v.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.instance_material=[];for(var c=0;c<a.childNodes.length;c++){var b=
-a.childNodes[c];if(b.nodeType==1&&b.nodeName=="bind_material"){if(a=Q.evaluate(".//dae:instance_material",b,G,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(c=a.iterateNext();c;)this.instance_material.push((new u).parse(c)),c=a.iterateNext();break}}return this};y.prototype.parse=function(a){this.id=a.getAttribute("id");for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];switch(b.nodeName){case "mesh":this.mesh=(new p(this)).parse(b)}}return this};p.prototype.parse=function(a){function c(a,
-b){var e=R(a.position);f[e]===void 0&&(f[e]={v:a,index:b});return f[e]}this.primitives=[];var b;for(b=0;b<a.childNodes.length;b++){var e=a.childNodes[b];switch(e.nodeName){case "source":O(e);break;case "vertices":this.vertices=(new A).parse(e);break;case "triangles":this.primitives.push((new w).parse(e));break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new z).parse(e))}}var f={};this.geometry3js=new THREE.Geometry;e=X[this.vertices.input.POSITION.source].data;
-for(a=b=0;b<e.length;b+=3,a++){var h=new THREE.Vertex(new THREE.Vector3(e[b],e[b+1],e[b+2]));c(h,a);this.geometry3js.vertices.push(h)}for(b=0;b<this.primitives.length;b++)primitive=this.primitives[b],primitive.setVertices(this.vertices),this.handlePrimitive(primitive,this.geometry3js,f);this.geometry3js.computeCentroids();this.geometry3js.computeFaceNormals();this.geometry3js.computeVertexNormals();this.geometry3js.computeBoundingBox();return this};p.prototype.handlePrimitive=function(a,c,b){var e=
-0,f,h,g=a.p,k=a.inputs,l,m,n,o=0,p=3,t=[];for(f=0;f<k.length;f++)switch(l=k[f],l.semantic){case "TEXCOORD":t.push(l.set)}for(;e<g.length;){var u=[],v=[],y={},w=[];a.vcount&&(p=a.vcount[o++]);for(f=0;f<p;f++)for(h=0;h<k.length;h++)switch(l=k[h],source=X[l.source],m=g[e+f*k.length+l.offset],numParams=source.accessor.params.length,n=m*numParams,l.semantic){case "VERTEX":l=R(c.vertices[m].position);u.push(b[l].index);break;case "NORMAL":v.push(new THREE.Vector3(source.data[n],source.data[n+1],source.data[n+
-2]));break;case "TEXCOORD":y[l.set]===void 0&&(y[l.set]=[]);y[l.set].push(new THREE.UV(source.data[n],source.data[n+1]));break;case "COLOR":w.push((new THREE.Color).setRGB(source.data[n],source.data[n+1],source.data[n+2]))}var x;p==3?x=new THREE.Face3(u[0],u[1],u[2],[v[0],v[1],v[2]],w.length?w:new THREE.Color):p==4&&(x=new THREE.Face4(u[0],u[1],u[2],u[3],[v[0],v[1],v[2],v[3]],w.length?w:new THREE.Color));x.daeMaterial=a.material;c.faces.push(x);for(h=0;h<t.length;h++)f=y[t[h]],c.faceVertexUvs[h].push([f[0],
-f[1],f[2]]);e+=k.length*p}};z.prototype=new w;z.prototype.constructor=z;w.prototype.setVertices=function(a){for(var c=0;c<this.inputs.length;c++)if(this.inputs[c].source==a.id)this.inputs[c].source=a.input.POSITION.source};w.prototype.parse=function(a){this.inputs=[];this.material=a.getAttribute("material");this.count=V(a,"count",0);for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];switch(b.nodeName){case "input":this.inputs.push((new D).parse(a.childNodes[c]));break;case "vcount":this.vcount=
-P(b.textContent);break;case "p":this.p=P(b.textContent)}}return this};x.prototype.parse=function(a){this.params=[];this.source=a.getAttribute("source");this.count=V(a,"count",0);this.stride=V(a,"stride",0);for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeName=="param"){var e={};e.name=b.getAttribute("name");e.type=b.getAttribute("type");this.params.push(e)}}return this};A.prototype.parse=function(a){this.id=a.getAttribute("id");for(var c=0;c<a.childNodes.length;c++)a.childNodes[c].nodeName==
-"input"&&(input=(new D).parse(a.childNodes[c]),this.input[input.semantic]=input);return this};D.prototype.parse=function(a){this.semantic=a.getAttribute("semantic");this.source=a.getAttribute("source").replace(/^#/,"");this.set=V(a,"set",-1);this.offset=V(a,"offset",0);if(this.semantic=="TEXCOORD"&&this.set<0)this.set=0;return this};B.prototype.parse=function(a){this.id=a.getAttribute("id");for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];switch(b.nodeName){case "bool_array":for(var e=
-U(b.textContent).split(/\s+/),f=[],h=0;h<e.length;h++)f.push(e[h]=="true"||e[h]=="1"?!0:!1);this.data=f;this.type=b.nodeName;break;case "float_array":this.data=S(b.textContent);this.type=b.nodeName;break;case "int_array":this.data=P(b.textContent);this.type=b.nodeName;break;case "IDREF_array":case "Name_array":this.data=U(b.textContent).split(/\s+/);this.type=b.nodeName;break;case "technique_common":for(e=0;e<b.childNodes.length;e++)if(b.childNodes[e].nodeName=="accessor"){this.accessor=(new x).parse(b.childNodes[e]);
-break}}}return this};B.prototype.read=function(){var a=[],c=this.accessor.params[0];switch(c.type){case "IDREF":case "Name":case "name":case "float":return this.data;case "float4x4":for(c=0;c<this.data.length;c+=16){var b=this.data.slice(c,c+16),e=new THREE.Matrix4;e.set(b[0],b[1],b[2],b[3],b[4],b[5],b[6],b[7],b[8],b[9],b[10],b[11],b[12],b[13],b[14],b[15]);a.push(e)}break;default:console.log("ColladaLoader: Source: Read dont know how to read "+c.type+".")}return a};E.prototype.parse=function(a){this.id=
-a.getAttribute("id");this.name=a.getAttribute("name");for(var c=0;c<a.childNodes.length;c++)if(a.childNodes[c].nodeName=="instance_effect"){this.instance_effect=(new K).parse(a.childNodes[c]);break}return this};I.prototype.isColor=function(){return this.texture==null};I.prototype.isTexture=function(){return this.texture!=null};I.prototype.parse=function(a){for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeType==1)switch(b.nodeName){case "color":b=S(b.textContent);this.color=new THREE.Color(0);
-this.color.setRGB(b[0],b[1],b[2]);this.color.a=b[3];break;case "texture":this.texture=b.getAttribute("texture"),this.texcoord=b.getAttribute("texcoord")}}return this};H.prototype.parse=function(a){for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeType==1)switch(b.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[b.nodeName]=(new I).parse(b);break;case "shininess":case "reflectivity":case "transparency":var e;e=Q.evaluate(".//dae:float",
-b,G,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);for(var f=e.iterateNext(),h=[];f;)h.push(f),f=e.iterateNext();e=h;e.length>0&&(this[b.nodeName]=parseFloat(e[0].textContent))}}this.create();return this};H.prototype.create=function(){var a={},c=this.transparency!==void 0&&this.transparency<1,b;for(b in this)switch(b){case "ambient":case "emission":case "diffuse":case "specular":var e=this[b];if(e instanceof I)if(e.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==
-this.effect.surface.sid&&(e=Y[this.effect.surface.init_from]))a.map=THREE.ImageUtils.loadTexture(ja+e.init_from),a.map.wrapS=THREE.RepeatWrapping,a.map.wrapT=THREE.RepeatWrapping,a.map.repeat.x=1,a.map.repeat.y=-1}else b=="diffuse"?a.color=e.color.getHex():c||(a[b]=e.color.getHex());break;case "shininess":case "reflectivity":a[b]=this[b];break;case "transparency":if(c)a.transparent=!0,a.opacity=this[b],c=!0}a.shading=ka;return this.material=new THREE.MeshLambertMaterial(a)};J.prototype.parse=function(a){for(var c=
-0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeType==1)switch(b.nodeName){case "init_from":this.init_from=b.textContent;break;case "format":this.format=b.textContent;break;default:console.log("unhandled Surface prop: "+b.nodeName)}}return this};C.prototype.parse=function(a){for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeType==1)switch(b.nodeName){case "source":this.source=b.textContent;break;case "minfilter":this.minfilter=b.textContent;break;case "magfilter":this.magfilter=
-b.textContent;break;case "mipfilter":this.mipfilter=b.textContent;break;case "wrap_s":this.wrap_s=b.textContent;break;case "wrap_t":this.wrap_t=b.textContent;break;default:console.log("unhandled Sampler2D prop: "+b.nodeName)}}return this};F.prototype.create=function(){if(this.shader==null)return null};F.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.shader=null;for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeType==1)switch(b.nodeName){case "profile_COMMON":this.parseTechnique(this.parseProfileCOMMON(b))}}return this};
-F.prototype.parseNewparam=function(a){for(var c=a.getAttribute("sid"),b=0;b<a.childNodes.length;b++){var e=a.childNodes[b];if(e.nodeType==1)switch(e.nodeName){case "surface":this.surface=(new J(this)).parse(e);this.surface.sid=c;break;case "sampler2D":this.sampler=(new C(this)).parse(e);this.sampler.sid=c;break;case "extra":break;default:console.log(e.nodeName)}}};F.prototype.parseProfileCOMMON=function(a){for(var c,b=0;b<a.childNodes.length;b++){var e=a.childNodes[b];if(e.nodeType==1)switch(e.nodeName){case "profile_COMMON":this.parseProfileCOMMON(e);
-break;case "technique":c=e;break;case "newparam":this.parseNewparam(e);break;case "extra":break;default:console.log(e.nodeName)}}return c};F.prototype.parseTechnique=function(a){for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeType==1)switch(b.nodeName){case "lambert":case "blinn":case "phong":this.shader=(new H(b.nodeName,this)).parse(b)}}};K.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");return this};M.prototype.parse=function(a){this.id=a.getAttribute("id");
-this.name=a.getAttribute("name");this.source={};for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeType==1)switch(b.nodeName){case "source":b=(new B).parse(b);this.source[b.id]=b;break;case "sampler":this.sampler.push((new L(this)).parse(b));break;case "channel":this.channel.push((new N(this)).parse(b))}}return this};N.prototype.parse=function(a){this.source=a.getAttribute("source").replace(/^#/,"");this.target=a.getAttribute("target");var c=this.target.split("/");c.shift();var a=
-c.shift(),b=a.indexOf(".")>=0,e=a.indexOf("(")>=0,f,h;if(b)c=a.split("."),a=c.shift(),h=c.shift();else if(e){f=a.split("(");a=f.shift();for(c=0;c<f.length;c++)f[c]=parseInt(f[c].replace(/\)/,""))}this.sid=a;this.dotSyntax=b;this.arrSyntax=e;this.arrIndices=f;this.member=h;return this};L.prototype.parse=function(a){this.id=a.getAttribute("id");this.inputs=[];for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeType==1)switch(b.nodeName){case "input":this.inputs.push((new D).parse(b))}}return this};
-L.prototype.create=function(){for(var a=0;a<this.inputs.length;a++){var c=this.inputs[a],b=this.animation.source[c.source];switch(c.semantic){case "INPUT":this.input=b.read();break;case "OUTPUT":this.output=b.read();break;case "INTERPOLATION":this.interpolation=b.read();break;case "IN_TANGENT":break;case "OUT_TANGENT":break;default:console.log(c.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(c,e){if(document.implementation&&document.implementation.createDocument){document.implementation.createDocument("http://www.collada.org/2005/11/COLLADASchema","COLLADA",null);c+="?rnd="+Math.random();var k=new XMLHttpRequest;k.overrideMimeType&&k.overrideMimeType("text/xml");k.onreadystatechange=function(){if(k.readyState==4&&(k.status==0||k.status==
-200)){$=e;var l,n=c;Q=k.responseXML;l=$;n!==void 0&&(n=n.split("/"),n.pop(),ja=n.length<1?"":n.join("/")+"/");Y=a("//dae:library_images/dae:image",h,"image");fa=a("//dae:library_materials/dae:material",E,"material");ga=a("//dae:library_effects/dae:effect",F,"effect");ba=a("//dae:library_geometries/dae:geometry",y,"geometry");aa=a("//dae:library_controllers/dae:controller",f,"controller");ca=a("//dae:library_animations/dae:animation",M,"animation");ha=a(".//dae:library_visual_scenes/dae:visual_scene",
-m,"visual_scene");da=[];ea=[];(n=Q.evaluate(".//dae:scene/dae:instance_visual_scene",Q,G,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(n=n.getAttribute("url").replace(/^#/,""),W=ha[n]):W=null;Z=new THREE.Object3D;for(n=0;n<W.nodes.length;n++)Z.add(g(W.nodes[n]));b();for(var o in ca);o={scene:Z,morphs:da,skins:ea,dae:{images:Y,materials:fa,effects:ga,geometries:ba,controllers:aa,animations:ca,visualScenes:ha,scene:W}};l&&l(o)}};k.open("GET",c,!0);k.send(null)}else alert("Don't know how to parse XML!")},
-setPreferredShading:function(a){ka=a},applySkin:e,geometries:ba}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;
-THREE.JSONLoader.prototype.load=function(a){var b=this,c=a.model,e=a.callback,g=a.texture_path?a.texture_path:this.extractUrlbase(c),a=new Worker(c);a.onmessage=function(a){b.createModel(a.data,e,g);b.onLoadComplete()};this.onLoadStart();a.postMessage((new Date).getTime())};
-THREE.JSONLoader.prototype.createModel=function(a,b,c){var e=new THREE.Geometry,g=a.scale!==void 0?1/a.scale:1;this.init_materials(e,a.materials,c);(function(c){if(a.version===void 0||a.version!=2)console.error("Deprecated file format.");else{var b,g,l,m,n,o,t,u,v,y,p,z,w,x,A=a.faces;o=a.vertices;var D=a.normals,B=a.colors,E=0;for(b=0;b<a.uvs.length;b++)a.uvs[b].length&&E++;for(b=0;b<E;b++)e.faceUvs[b]=[],e.faceVertexUvs[b]=[];m=0;for(n=o.length;m<n;)t=new THREE.Vertex,t.position.x=o[m++]*c,t.position.y=
-o[m++]*c,t.position.z=o[m++]*c,e.vertices.push(t);m=0;for(n=A.length;m<n;){c=A[m++];o=c&1;l=c&2;b=c&4;g=c&8;u=c&16;t=c&32;y=c&64;c&=128;o?(p=new THREE.Face4,p.a=A[m++],p.b=A[m++],p.c=A[m++],p.d=A[m++],o=4):(p=new THREE.Face3,p.a=A[m++],p.b=A[m++],p.c=A[m++],o=3);if(l)l=A[m++],p.materials=e.materials[l];l=e.faces.length;if(b)for(b=0;b<E;b++)z=a.uvs[b],v=A[m++],x=z[v*2],v=z[v*2+1],e.faceUvs[b][l]=new THREE.UV(x,v);if(g)for(b=0;b<E;b++){z=a.uvs[b];w=[];for(g=0;g<o;g++)v=A[m++],x=z[v*2],v=z[v*2+1],w[g]=
-new THREE.UV(x,v);e.faceVertexUvs[b][l]=w}if(u)u=A[m++]*3,g=new THREE.Vector3,g.x=D[u++],g.y=D[u++],g.z=D[u],p.normal=g;if(t)for(b=0;b<o;b++)u=A[m++]*3,g=new THREE.Vector3,g.x=D[u++],g.y=D[u++],g.z=D[u],p.vertexNormals.push(g);if(y)t=A[m++],t=new THREE.Color(B[t]),p.color=t;if(c)for(b=0;b<o;b++)t=A[m++],t=new THREE.Color(B[t]),p.vertexColors.push(t);e.faces.push(p)}}})(g);(function(){var c,b,g,l;if(a.skinWeights){c=0;for(b=a.skinWeights.length;c<b;c+=2)g=a.skinWeights[c],l=a.skinWeights[c+1],e.skinWeights.push(new THREE.Vector4(g,
+e,f;b=g(a,c);e=g(a,c+B);f=g(a,c+E);c=l(a,c+I);z.faces.push(new THREE.Face3(b,e,f,null,null,z.materials[c]))}function t(c){var b,e,f,h,m,o;b=g(a,c);e=g(a,c+B);f=g(a,c+E);h=l(a,c+I);m=g(a,c+G);o=g(a,c+K);c=g(a,c+C);h=z.materials[h];var n=A[o*3],p=A[o*3+1];o=A[o*3+2];var t=A[c*3],u=A[c*3+1],c=A[c*3+2];z.faces.push(new THREE.Face3(b,e,f,[new THREE.Vector3(A[m*3],A[m*3+1],A[m*3+2]),new THREE.Vector3(n,p,o),new THREE.Vector3(t,u,c)],null,h))}function u(c){var b,e,f,h;b=g(a,c);e=g(a,c+F);f=g(a,c+J);h=g(a,
+c+M);c=l(a,c+N);z.faces.push(new THREE.Face4(b,e,f,h,null,null,z.materials[c]))}function v(c){var b,e,f,h,m,o,n,p;b=g(a,c);e=g(a,c+F);f=g(a,c+J);h=g(a,c+M);m=l(a,c+N);o=g(a,c+L);n=g(a,c+O);p=g(a,c+H);c=g(a,c+Q);m=z.materials[m];var t=A[n*3],u=A[n*3+1];n=A[n*3+2];var la=A[p*3],ma=A[p*3+1];p=A[p*3+2];var na=A[c*3],v=A[c*3+1],c=A[c*3+2];z.faces.push(new THREE.Face4(b,e,f,h,[new THREE.Vector3(A[o*3],A[o*3+1],A[o*3+2]),new THREE.Vector3(t,u,n),new THREE.Vector3(la,ma,p),new THREE.Vector3(na,v,c)],null,
+m))}function y(c){var b,e,f,h;b=g(a,c);e=g(a,c+P);f=g(a,c+T);c=D[b*2];h=D[b*2+1];b=D[e*2];var l=z.faceVertexUvs[0];e=D[e*2+1];var m=D[f*2];f=D[f*2+1];var o=[];o.push(new THREE.UV(c,h));o.push(new THREE.UV(b,e));o.push(new THREE.UV(m,f));l.push(o)}function p(c){var b,e,f,h,l,m;b=g(a,c);e=g(a,c+X);f=g(a,c+R);h=g(a,c+S);c=D[b*2];l=D[b*2+1];b=D[e*2];m=D[e*2+1];e=D[f*2];var o=z.faceVertexUvs[0];f=D[f*2+1];var n=D[h*2];h=D[h*2+1];var p=[];p.push(new THREE.UV(c,l));p.push(new THREE.UV(b,m));p.push(new THREE.UV(e,
+f));p.push(new THREE.UV(n,h));o.push(p)}var z=this,x=0,w,A=[],D=[],B,E,I,G,K,C,F,J,M,N,L,O,H,Q,P,T,X,R,S,W,U,Z,Y,$,V;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(z,e,c);w={signature:a.substr(x,8),header_bytes:n(a,x+8),vertex_coordinate_bytes:n(a,x+9),normal_coordinate_bytes:n(a,x+10),uv_coordinate_bytes:n(a,x+11),vertex_index_bytes:n(a,x+12),normal_index_bytes:n(a,x+13),uv_index_bytes:n(a,x+14),material_index_bytes:n(a,x+15),nvertices:g(a,x+16),nnormals:g(a,x+16+4),nuvs:g(a,x+16+
+8),ntri_flat:g(a,x+16+12),ntri_smooth:g(a,x+16+16),ntri_flat_uv:g(a,x+16+20),ntri_smooth_uv:g(a,x+16+24),nquad_flat:g(a,x+16+28),nquad_smooth:g(a,x+16+32),nquad_flat_uv:g(a,x+16+36),nquad_smooth_uv:g(a,x+16+40)};x+=w.header_bytes;B=w.vertex_index_bytes;E=w.vertex_index_bytes*2;I=w.vertex_index_bytes*3;G=w.vertex_index_bytes*3+w.material_index_bytes;K=w.vertex_index_bytes*3+w.material_index_bytes+w.normal_index_bytes;C=w.vertex_index_bytes*3+w.material_index_bytes+w.normal_index_bytes*2;F=w.vertex_index_bytes;
+J=w.vertex_index_bytes*2;M=w.vertex_index_bytes*3;N=w.vertex_index_bytes*4;L=w.vertex_index_bytes*4+w.material_index_bytes;O=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes;H=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes*2;Q=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes*3;P=w.uv_index_bytes;T=w.uv_index_bytes*2;X=w.uv_index_bytes;R=w.uv_index_bytes*2;S=w.uv_index_bytes*3;c=w.vertex_index_bytes*3+w.material_index_bytes;V=w.vertex_index_bytes*
+4+w.material_index_bytes;W=w.ntri_flat*c;U=w.ntri_smooth*(c+w.normal_index_bytes*3);Z=w.ntri_flat_uv*(c+w.uv_index_bytes*3);Y=w.ntri_smooth_uv*(c+w.normal_index_bytes*3+w.uv_index_bytes*3);$=w.nquad_flat*V;c=w.nquad_smooth*(V+w.normal_index_bytes*4);V=w.nquad_flat_uv*(V+w.uv_index_bytes*4);x+=function(c){for(var e,h,g,k=w.vertex_coordinate_bytes*3,l=c+w.nvertices*k;c<l;c+=k)e=b(a,c),h=b(a,c+w.vertex_coordinate_bytes),g=b(a,c+w.vertex_coordinate_bytes*2),z.vertices.push(new THREE.Vertex(new THREE.Vector3(e,
+h,g)));return w.nvertices*k}(x);x+=function(c){for(var b,e,f,h=w.normal_coordinate_bytes*3,g=c+w.nnormals*h;c<g;c+=h)b=m(a,c),e=m(a,c+w.normal_coordinate_bytes),f=m(a,c+w.normal_coordinate_bytes*2),A.push(b/127,e/127,f/127);return w.nnormals*h}(x);x+=function(c){for(var e,h,g=w.uv_coordinate_bytes*2,k=c+w.nuvs*g;c<k;c+=g)e=b(a,c),h=b(a,c+w.uv_coordinate_bytes),D.push(e,h);return w.nuvs*g}(x);W=x+W;U=W+U;Z=U+Z;Y=Z+Y;$=Y+$;c=$+c;V=c+V;(function(a){var c,b=w.vertex_index_bytes*3+w.material_index_bytes,
+e=b+w.uv_index_bytes*3,f=a+w.ntri_flat_uv*e;for(c=a;c<f;c+=e)o(c),y(c+b);return f-a})(U);(function(a){var c,b=w.vertex_index_bytes*3+w.material_index_bytes+w.normal_index_bytes*3,e=b+w.uv_index_bytes*3,f=a+w.ntri_smooth_uv*e;for(c=a;c<f;c+=e)t(c),y(c+b);return f-a})(Z);(function(a){var c,b=w.vertex_index_bytes*4+w.material_index_bytes,e=b+w.uv_index_bytes*4,f=a+w.nquad_flat_uv*e;for(c=a;c<f;c+=e)u(c),p(c+b);return f-a})(c);(function(a){var c,b=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes*
+4,e=b+w.uv_index_bytes*4,f=a+w.nquad_smooth_uv*e;for(c=a;c<f;c+=e)v(c),p(c+b);return f-a})(V);(function(a){var c,b=w.vertex_index_bytes*3+w.material_index_bytes,e=a+w.ntri_flat*b;for(c=a;c<e;c+=b)o(c);return e-a})(x);(function(a){var c,b=w.vertex_index_bytes*3+w.material_index_bytes+w.normal_index_bytes*3,e=a+w.ntri_smooth*b;for(c=a;c<e;c+=b)t(c);return e-a})(W);(function(a){var c,b=w.vertex_index_bytes*4+w.material_index_bytes,e=a+w.nquad_flat*b;for(c=a;c<e;c+=b)u(c);return e-a})(Y);(function(a){var c,
+b=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes*4,e=a+w.nquad_smooth*b;for(c=a;c<e;c+=b)v(c);return e-a})($);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};g.prototype=new THREE.Geometry;g.prototype.constructor=g;b(new g(c))};
+THREE.ColladaLoader=function(){function a(a,e,g){U=a;e=e||$;g!==void 0&&(a=g.split("/"),a.pop(),ja=a.length<1?"":a.join("/")+"/");fa=b("//dae:library_images/dae:image",f,"image");ga=b("//dae:library_materials/dae:material",I,"material");ha=b("//dae:library_effects/dae:effect",J,"effect");ba=b("//dae:library_geometries/dae:geometry",p,"geometry");aa=b("//dae:library_controllers/dae:controller",k,"controller");ca=b("//dae:library_animations/dae:animation",N,"animation");ia=b(".//dae:library_visual_scenes/dae:visual_scene",
+n,"visual_scene");da=[];ea=[];(a=U.evaluate(".//dae:scene/dae:instance_visual_scene",U,Q,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(a=a.getAttribute("url").replace(/^#/,""),Y=ia[a]):Y=null;Z=new THREE.Object3D;for(a=0;a<Y.nodes.length;a++)Z.add(h(Y.nodes[a]));c();for(var l in ca);l={scene:Z,morphs:da,skins:ea,dae:{images:fa,materials:ga,effects:ha,geometries:ba,controllers:aa,animations:ca,visualScenes:ia,scene:Y}};e&&e(l);return l}function b(a,c,b){for(var a=U.evaluate(a,U,Q,XPathResult.ORDERED_NODE_ITERATOR_TYPE,
+null),e={},f=a.iterateNext(),h=0;f;){f=(new c).parse(f);if(f.id.length==0)f.id=b+h++;e[f.id]=f;f=a.iterateNext()}return e}function c(){var a=1E6,c=-a,b=0,e;for(e in ca)for(var f=ca[e],h=0;h<f.sampler.length;h++){var g=f.sampler[h];g.create();a=Math.min(a,g.startTime);c=Math.max(c,g.endTime);b=Math.max(b,g.input.length)}return{start:a,end:c,frames:b}}function e(a,c,b,f){a.world=a.world||new THREE.Matrix4;a.world.copy(a.matrix);if(a.channels&&a.channels.length){var h=a.channels[0].sampler.output[b];
+h instanceof THREE.Matrix4&&a.world.copy(h)}f&&a.world.multiply(f,a.world);c.push(a);for(f=0;f<a.nodes.length;f++)e(a.nodes[f],c,b,a.world)}function g(a,b,f){var h=aa[b.url];if(!h||!h.skin)console.log("ColladaLoader: Could not find skin controller.");else if(!b.skeleton||!b.skeleton.length)console.log("ColladaLoader: Could not find the skeleton for the skin. ");else{var g=c(),b=Y.getChildById(b.skeleton[0],!0)||Y.getChildBySid(b.skeleton[0],!0),k,l,m,o,n=new THREE.Vector3,p;for(k=0;k<a.vertices.length;k++)h.skin.bindShapeMatrix.multiplyVector3(a.vertices[k].position);
+for(f=0;f<g.frames;f++){var t=[],u=[];for(k=0;k<a.vertices.length;k++)u.push(new THREE.Vertex(new THREE.Vector3));e(b,t,f);k=t;l=h.skin;for(o=0;o<k.length;o++)if(m=k[o],p=-1,m.type=="JOINT"){for(var v=0;v<l.joints.length;v++)if(m.sid==l.joints[v]){p=v;break}if(p>=0){v=l.invBindMatrices[p];m.invBindMatrix=v;m.skinningMatrix=new THREE.Matrix4;m.skinningMatrix.multiply(m.world,v);m.weights=[];for(v=0;v<l.weights.length;v++)for(var y=0;y<l.weights[v].length;y++){var w=l.weights[v][y];w.joint==p&&m.weights.push(w)}}else throw"ColladaLoader: Could not find joint '"+
+m.sid+"'.";}for(k=0;k<t.length;k++)if(t[k].type=="JOINT")for(l=0;l<t[k].weights.length;l++)m=t[k].weights[l],o=m.index,m=m.weight,p=a.vertices[o],o=u[o],n.x=p.position.x,n.y=p.position.y,n.z=p.position.z,t[k].skinningMatrix.multiplyVector3(n),o.position.x+=n.x*m,o.position.y+=n.y*m,o.position.z+=n.z*m;a.morphTargets.push({name:"target_"+f,vertices:u})}}}function h(a){var c=new THREE.Object3D,b,e,f;c.name=a.id||"";c.matrixAutoUpdate=!1;c.matrix=a.matrix;for(f=0;f<a.controllers.length;f++){var k=aa[a.controllers[f].url];
+switch(k.type){case "skin":if(ba[k.skin.source]){var l=new y;l.url=k.skin.source;l.instance_material=a.controllers[f].instance_material;a.geometries.push(l);b=a.controllers[f]}else if(aa[k.skin.source]&&(e=k=aa[k.skin.source],k.morph&&ba[k.morph.source]))l=new y,l.url=k.morph.source,l.instance_material=a.controllers[f].instance_material,a.geometries.push(l);break;case "morph":if(ba[k.morph.source])l=new y,l.url=k.morph.source,l.instance_material=a.controllers[f].instance_material,a.geometries.push(l),
+e=a.controllers[f];console.log("ColladaLoader: Morph-controller partially supported.")}}for(f=0;f<a.geometries.length;f++){var k=a.geometries[f],l=k.instance_material,k=ba[k.url],m={},o=0,n;if(k&&k.mesh&&k.mesh.primitives){if(c.name.length==0)c.name=k.id;if(l)for(j=0;j<l.length;j++){n=l[j];var p=ha[ga[n.target].instance_effect.url].shader;p.material.opacity=!p.material.opacity?1:p.material.opacity;n=m[n.symbol]=p.material;o++}l=n||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});
+k=k.mesh.geometry3js;if(o>1){l=new THREE.MeshFaceMaterial;for(j=0;j<k.faces.length;j++)o=k.faces[j],o.materials=[m[o.daeMaterial]]}if(b!==void 0)g(k,b),l.morphTargets=!0,l=new THREE.SkinnedMesh(k,l),l.skeleton=b.skeleton,l.skinController=aa[b.url],l.skinInstanceController=b,l.name="skin_"+ea.length,ea.push(l);else if(e!==void 0){m=k;o=e instanceof u?aa[e.url]:e;if(!o||!o.morph)console.log("could not find morph controller!");else{o=o.morph;for(p=0;p<o.targets.length;p++){var t=ba[o.targets[p]];if(t.mesh&&
+t.mesh.primitives&&t.mesh.primitives.length)t=t.mesh.primitives[0].geometry,t.vertices.length===m.vertices.length&&m.morphTargets.push({name:"target_1",vertices:t.vertices})}m.morphTargets.push({name:"target_Z",vertices:m.vertices})}l.morphTargets=!0;l=new THREE.Mesh(k,l);l.name="morph_"+da.length;da.push(l)}else l=new THREE.Mesh(k,l);c.add(l)}}for(f=0;f<a.nodes.length;f++)c.add(h(a.nodes[f],a));return c}function f(){this.init_from=this.id=""}function k(){this.type=this.name=this.id="";this.morph=
+this.skin=null}function l(){this.weights=this.targets=this.source=this.method=null}function m(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function n(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function o(){this.sid=this.name=this.id="";this.nodes=[];this.controllers=[];this.transforms=[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function t(){this.type=this.sid="";this.data=[];this.matrix=new THREE.Matrix4}
+function u(){this.url="";this.skeleton=[];this.instance_material=[]}function v(){this.target=this.symbol=""}function y(){this.url="";this.instance_material=[]}function p(){this.id="";this.mesh=null}function z(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function x(){}function w(){this.material="";this.count=0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function A(){this.source="";this.stride=this.count=0;this.params=[]}function D(){this.input=
+{}}function B(){this.semantic="";this.offset=0;this.source="";this.set=0}function E(a){this.id=a;this.type=null}function I(){this.name=this.id="";this.instance_effect=null}function G(){this.color=new THREE.Color(0);this.color.setRGB(Math.random(),Math.random(),Math.random());this.color.a=1;this.texcoord=this.texture=null}function K(a,c){this.type=a;this.effect=c;this.material=null}function C(a){this.effect=a;this.format=this.init_from=null}function F(a){this.effect=a;this.mipfilter=this.magfilter=
+this.minfilter=this.wrap_t=this.wrap_s=this.source=null}function J(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function M(){this.url=""}function N(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function L(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=this.dotSyntax=this.sid=null}function O(a){this.id="";this.animation=a;this.inputs=[];this.endTime=this.startTime=this.interpolation=this.output=this.input=null;
+this.duration=0}function H(a){var c=a.getAttribute("id");if(V[c]!=void 0)return V[c];V[c]=(new E(c)).parse(a);return V[c]}function Q(a){if(a=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function P(a){for(var a=X(a).split(/\s+/),c=[],b=0;b<a.length;b++)c.push(parseFloat(a[b]));return c}function T(a){for(var a=X(a).split(/\s+/),c=[],b=0;b<a.length;b++)c.push(parseInt(a[b],10));return c}function X(a){return a.replace(/^\s+/,"").replace(/\s+$/,"")}function R(a,c,b){return a.hasAttribute(c)?
+parseInt(a.getAttribute(c),10):b}function S(a,c){if(a===void 0){for(var b="0.";b.length<c+2;)b+="0";return b}c=c||2;b=a.toString().split(".");for(b[1]=b.length>1?b[1].substr(0,c):"0";b[1].length<c;)b[1]+="0";return b.join(".")}function W(a,c){var b="";b+=S(a.x,c)+",";b+=S(a.y,c)+",";b+=S(a.z,c);return b}var U=null,Z=null,Y,$=null,V={},fa={},ca={},aa={},ba={},ga={},ha={},ia,ja,da,ea,ka=THREE.SmoothShading;f.prototype.parse=function(a){this.id=a.getAttribute("id");for(var c=0;c<a.childNodes.length;c++){var b=
+a.childNodes[c];if(b.nodeName=="init_from")this.init_from=b.textContent}return this};k.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.type="none";for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];switch(b.nodeName){case "skin":this.skin=(new m).parse(b);this.type=b.nodeName;break;case "morph":this.morph=(new l).parse(b),this.type=b.nodeName}}return this};l.prototype.parse=function(a){var c={},b=[],e;this.method=a.getAttribute("method");this.source=
+a.getAttribute("source").replace(/^#/,"");for(e=0;e<a.childNodes.length;e++){var f=a.childNodes[e];if(f.nodeType==1)switch(f.nodeName){case "source":f=(new E).parse(f);c[f.id]=f;break;case "targets":b=this.parseInputs(f);break;default:console.log(f.nodeName)}}for(e=0;e<b.length;e++)switch(a=b[e],f=c[a.source],a.semantic){case "MORPH_TARGET":this.targets=f.read();break;case "MORPH_WEIGHT":this.weights=f.read()}return this};l.prototype.parseInputs=function(a){for(var c=[],b=0;b<a.childNodes.length;b++){var e=
+a.childNodes[b];if(e.nodeType==1)switch(e.nodeName){case "input":c.push((new B).parse(e))}}return c};m.prototype.parse=function(a){var c={},b,e;this.source=a.getAttribute("source").replace(/^#/,"");this.invBindMatrices=[];this.joints=[];this.weights=[];for(var f=0;f<a.childNodes.length;f++){var h=a.childNodes[f];if(h.nodeType==1)switch(h.nodeName){case "bind_shape_matrix":h=P(h.textContent);this.bindShapeMatrix=new THREE.Matrix4;this.bindShapeMatrix.set(h[0],h[1],h[2],h[3],h[4],h[5],h[6],h[7],h[8],
+h[9],h[10],h[11],h[12],h[13],h[14],h[15]);break;case "source":h=(new E).parse(h);c[h.id]=h;break;case "joints":b=h;break;case "vertex_weights":e=h;break;default:console.log(h.nodeName)}}this.parseJoints(b,c);this.parseWeights(e,c);return this};m.prototype.parseJoints=function(a,c){for(var b=0;b<a.childNodes.length;b++){var e=a.childNodes[b];if(e.nodeType==1)switch(e.nodeName){case "input":var e=(new B).parse(e),f=c[e.source];if(e.semantic=="JOINT")this.joints=f.read();else if(e.semantic=="INV_BIND_MATRIX")this.invBindMatrices=
+f.read()}}};m.prototype.parseWeights=function(a,c){for(var b,e,f=[],h=0;h<a.childNodes.length;h++){var g=a.childNodes[h];if(g.nodeType==1)switch(g.nodeName){case "input":f.push((new B).parse(g));break;case "v":b=T(g.textContent);break;case "vcount":e=T(g.textContent)}}for(h=g=0;h<e.length;h++){for(var k=e[h],l=[],m=0;m<k;m++){for(var o={},n=0;n<f.length;n++){var p=f[n],t=b[g+p.offset];switch(p.semantic){case "JOINT":o.joint=t;break;case "WEIGHT":o.weight=c[p.source].data[t]}}l.push(o);g+=f.length}for(m=
+0;m<l.length;m++)l[m].index=h;this.weights.push(l)}};n.prototype.getChildById=function(a,c){for(var b=0;b<this.nodes.length;b++){var e=this.nodes[b].getChildById(a,c);if(e)return e}return null};n.prototype.getChildBySid=function(a,c){for(var b=0;b<this.nodes.length;b++){var e=this.nodes[b].getChildBySid(a,c);if(e)return e}return null};n.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.nodes=[];for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];
+if(b.nodeType==1)switch(b.nodeName){case "node":this.nodes.push((new o).parse(b))}}return this};o.prototype.getChannelForTransform=function(a){for(var c=0;c<this.channels.length;c++){var b=this.channels[c],e=b.target.split("/");e.shift();var f=e.shift(),h=f.indexOf(".")>=0,g=f.indexOf("(")>=0,k;if(h)e=f.split("."),f=e.shift(),e.shift();else if(g){k=f.split("(");f=k.shift();for(e=0;e<k.length;e++)k[e]=parseInt(k[e].replace(/\)/,""))}if(f==a)return b.info={sid:f,dotSyntax:h,arrSyntax:g,arrIndices:k},
+b}return null};o.prototype.getChildById=function(a,c){if(this.id==a)return this;if(c)for(var b=0;b<this.nodes.length;b++){var e=this.nodes[b].getChildById(a,c);if(e)return e}return null};o.prototype.getChildBySid=function(a,c){if(this.sid==a)return this;if(c)for(var b=0;b<this.nodes.length;b++){var e=this.nodes[b].getChildBySid(a,c);if(e)return e}return null};o.prototype.getTransformBySid=function(a){for(var c=0;c<this.transforms.length;c++)if(this.transforms[c].sid==a)return this.transforms[c];return null};
+o.prototype.parse=function(a){var c;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 b=0;b<a.childNodes.length;b++)if(c=a.childNodes[b],c.nodeType==1)switch(c.nodeName){case "node":this.nodes.push((new o).parse(c));break;case "instance_camera":break;case "instance_controller":this.controllers.push((new u).parse(c));
+break;case "instance_geometry":this.geometries.push((new y).parse(c));break;case "instance_light":break;case "instance_node":c=c.getAttribute("url").replace(/^#/,"");(c=U.evaluate(".//dae:library_nodes//dae:node[@id='"+c+"']",U,Q,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new o).parse(c));break;case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new t).parse(c));break;case "extra":break;default:console.log(c.nodeName)}a=
+[];b=1E6;c=-1E6;for(var e in ca)for(var f=ca[e],h=0;h<f.channel.length;h++){var g=f.channel[h],k=f.sampler[h];e=g.target.split("/")[0];if(e==this.id)k.create(),g.sampler=k,b=Math.min(b,k.startTime),c=Math.max(c,k.endTime),a.push(g)}if(a.length)this.startTime=b,this.endTime=c;if((this.channels=a)&&this.channels.length){e=1E7;for(i=0;i<this.channels.length;i++){a=this.channels[i].sampler;for(b=0;b<a.input.length-1;b++)e=Math.min(e,a.input[b+1]-a.input[b])}b=[];for(a=this.startTime;a<this.endTime;a+=
+e){c=a;for(var f={},l=h=void 0,h=0;h<this.channels.length;h++)l=this.channels[h],f[l.sid]=l;g=new THREE.Matrix4;for(h=0;h<this.transforms.length;h++)if(k=this.transforms[h],l=f[k.sid],l!==void 0){for(var m=l.sampler,n,l=0;l<m.input.length-1;l++)if(m.input[l+1]>c){n=m.output[l];break}g=n!==void 0?n instanceof THREE.Matrix4?g.multiply(g,n):g.multiply(g,k.matrix):g.multiply(g,k.matrix)}else g=g.multiply(g,k.matrix);c=g;b.push({time:a,pos:[c.n14,c.n24,c.n34],rotq:[0,0,0,1],scl:[1,1,1]})}this.keys=b}this.updateMatrix();
+return this};o.prototype.updateMatrix=function(){this.matrix.identity();for(var a=0;a<this.transforms.length;a++)this.matrix.multiply(this.matrix,this.transforms[a].matrix)};t.prototype.parse=function(a){this.sid=a.getAttribute("sid");this.type=a.nodeName;this.data=P(a.textContent);this.updateMatrix();return this};t.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};u.prototype.parse=function(a){this.url=
+a.getAttribute("url").replace(/^#/,"");this.skeleton=[];this.instance_material=[];for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeType==1)switch(b.nodeName){case "skeleton":this.skeleton.push(b.textContent.replace(/^#/,""));break;case "bind_material":if(b=U.evaluate(".//dae:instance_material",b,Q,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(var e=b.iterateNext();e;)this.instance_material.push((new v).parse(e)),e=b.iterateNext()}}return this};v.prototype.parse=function(a){this.symbol=
+a.getAttribute("symbol");this.target=a.getAttribute("target").replace(/^#/,"");return this};y.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.instance_material=[];for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeType==1&&b.nodeName=="bind_material"){if(a=U.evaluate(".//dae:instance_material",b,Q,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(c=a.iterateNext();c;)this.instance_material.push((new v).parse(c)),c=a.iterateNext();break}}return this};
+p.prototype.parse=function(a){this.id=a.getAttribute("id");for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];switch(b.nodeName){case "mesh":this.mesh=(new z(this)).parse(b)}}return this};z.prototype.parse=function(a){function c(a,b){var e=W(a.position);f[e]===void 0&&(f[e]={v:a,index:b});return f[e]}this.primitives=[];var b;for(b=0;b<a.childNodes.length;b++){var e=a.childNodes[b];switch(e.nodeName){case "source":H(e);break;case "vertices":this.vertices=(new D).parse(e);break;case "triangles":this.primitives.push((new w).parse(e));
+break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new x).parse(e))}}var f={};this.geometry3js=new THREE.Geometry;e=V[this.vertices.input.POSITION.source].data;for(a=b=0;b<e.length;b+=3,a++){var h=new THREE.Vertex(new THREE.Vector3(e[b],e[b+1],e[b+2]));c(h,a);this.geometry3js.vertices.push(h)}for(b=0;b<this.primitives.length;b++)primitive=this.primitives[b],primitive.setVertices(this.vertices),this.handlePrimitive(primitive,this.geometry3js,
+f);this.geometry3js.computeCentroids();this.geometry3js.computeFaceNormals();this.geometry3js.computeVertexNormals();this.geometry3js.computeBoundingBox();return this};z.prototype.handlePrimitive=function(a,c,b){var e=0,f,h,g=a.p,k=a.inputs,l,m,o,n=0,p=3,t=[];for(f=0;f<k.length;f++)switch(l=k[f],l.semantic){case "TEXCOORD":t.push(l.set)}for(;e<g.length;){var u=[],v=[],y={},w=[];a.vcount&&(p=a.vcount[n++]);for(f=0;f<p;f++)for(h=0;h<k.length;h++)switch(l=k[h],source=V[l.source],m=g[e+f*k.length+l.offset],
+numParams=source.accessor.params.length,o=m*numParams,l.semantic){case "VERTEX":l=W(c.vertices[m].position);u.push(b[l].index);break;case "NORMAL":v.push(new THREE.Vector3(source.data[o],source.data[o+1],source.data[o+2]));break;case "TEXCOORD":y[l.set]===void 0&&(y[l.set]=[]);y[l.set].push(new THREE.UV(source.data[o],source.data[o+1]));break;case "COLOR":w.push((new THREE.Color).setRGB(source.data[o],source.data[o+1],source.data[o+2]))}var x;p==3?x=new THREE.Face3(u[0],u[1],u[2],[v[0],v[1],v[2]],
+w.length?w:new THREE.Color):p==4&&(x=new THREE.Face4(u[0],u[1],u[2],u[3],[v[0],v[1],v[2],v[3]],w.length?w:new THREE.Color));x.daeMaterial=a.material;c.faces.push(x);for(h=0;h<t.length;h++)f=y[t[h]],c.faceVertexUvs[h].push([f[0],f[1],f[2]]);e+=k.length*p}};x.prototype=new w;x.prototype.constructor=x;w.prototype.setVertices=function(a){for(var c=0;c<this.inputs.length;c++)if(this.inputs[c].source==a.id)this.inputs[c].source=a.input.POSITION.source};w.prototype.parse=function(a){this.inputs=[];this.material=
+a.getAttribute("material");this.count=R(a,"count",0);for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];switch(b.nodeName){case "input":this.inputs.push((new B).parse(a.childNodes[c]));break;case "vcount":this.vcount=T(b.textContent);break;case "p":this.p=T(b.textContent)}}return this};A.prototype.parse=function(a){this.params=[];this.source=a.getAttribute("source");this.count=R(a,"count",0);this.stride=R(a,"stride",0);for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeName==
+"param"){var e={};e.name=b.getAttribute("name");e.type=b.getAttribute("type");this.params.push(e)}}return this};D.prototype.parse=function(a){this.id=a.getAttribute("id");for(var c=0;c<a.childNodes.length;c++)a.childNodes[c].nodeName=="input"&&(input=(new B).parse(a.childNodes[c]),this.input[input.semantic]=input);return this};B.prototype.parse=function(a){this.semantic=a.getAttribute("semantic");this.source=a.getAttribute("source").replace(/^#/,"");this.set=R(a,"set",-1);this.offset=R(a,"offset",
+0);if(this.semantic=="TEXCOORD"&&this.set<0)this.set=0;return this};E.prototype.parse=function(a){this.id=a.getAttribute("id");for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];switch(b.nodeName){case "bool_array":for(var e=X(b.textContent).split(/\s+/),f=[],h=0;h<e.length;h++)f.push(e[h]=="true"||e[h]=="1"?!0:!1);this.data=f;this.type=b.nodeName;break;case "float_array":this.data=P(b.textContent);this.type=b.nodeName;break;case "int_array":this.data=T(b.textContent);this.type=b.nodeName;
+break;case "IDREF_array":case "Name_array":this.data=X(b.textContent).split(/\s+/);this.type=b.nodeName;break;case "technique_common":for(e=0;e<b.childNodes.length;e++)if(b.childNodes[e].nodeName=="accessor"){this.accessor=(new A).parse(b.childNodes[e]);break}}}return this};E.prototype.read=function(){var a=[],c=this.accessor.params[0];switch(c.type){case "IDREF":case "Name":case "name":case "float":return this.data;case "float4x4":for(c=0;c<this.data.length;c+=16){var b=this.data.slice(c,c+16),e=
+new THREE.Matrix4;e.set(b[0],b[1],b[2],b[3],b[4],b[5],b[6],b[7],b[8],b[9],b[10],b[11],b[12],b[13],b[14],b[15]);a.push(e)}break;default:console.log("ColladaLoader: Source: Read dont know how to read "+c.type+".")}return a};I.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");for(var c=0;c<a.childNodes.length;c++)if(a.childNodes[c].nodeName=="instance_effect"){this.instance_effect=(new M).parse(a.childNodes[c]);break}return this};G.prototype.isColor=function(){return this.texture==
+null};G.prototype.isTexture=function(){return this.texture!=null};G.prototype.parse=function(a){for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeType==1)switch(b.nodeName){case "color":b=P(b.textContent);this.color=new THREE.Color(0);this.color.setRGB(b[0],b[1],b[2]);this.color.a=b[3];break;case "texture":this.texture=b.getAttribute("texture"),this.texcoord=b.getAttribute("texcoord")}}return this};K.prototype.parse=function(a){for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];
+if(b.nodeType==1)switch(b.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[b.nodeName]=(new G).parse(b);break;case "shininess":case "reflectivity":case "transparency":var e;e=U.evaluate(".//dae:float",b,Q,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);for(var f=e.iterateNext(),h=[];f;)h.push(f),f=e.iterateNext();e=h;e.length>0&&(this[b.nodeName]=parseFloat(e[0].textContent))}}this.create();return this};K.prototype.create=function(){var a={},c=this.transparency!==
+void 0&&this.transparency<1,b;for(b in this)switch(b){case "ambient":case "emission":case "diffuse":case "specular":var e=this[b];if(e instanceof G)if(e.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid&&(e=fa[this.effect.surface.init_from]))a.map=THREE.ImageUtils.loadTexture(ja+e.init_from),a.map.wrapS=THREE.RepeatWrapping,a.map.wrapT=THREE.RepeatWrapping,a.map.repeat.x=1,a.map.repeat.y=-1}else b=="diffuse"?a.color=e.color.getHex():c||(a[b]=
+e.color.getHex());break;case "shininess":case "reflectivity":a[b]=this[b];break;case "transparency":if(c)a.transparent=!0,a.opacity=this[b],c=!0}a.shading=ka;return this.material=new THREE.MeshLambertMaterial(a)};C.prototype.parse=function(a){for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeType==1)switch(b.nodeName){case "init_from":this.init_from=b.textContent;break;case "format":this.format=b.textContent;break;default:console.log("unhandled Surface prop: "+b.nodeName)}}return this};
+F.prototype.parse=function(a){for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeType==1)switch(b.nodeName){case "source":this.source=b.textContent;break;case "minfilter":this.minfilter=b.textContent;break;case "magfilter":this.magfilter=b.textContent;break;case "mipfilter":this.mipfilter=b.textContent;break;case "wrap_s":this.wrap_s=b.textContent;break;case "wrap_t":this.wrap_t=b.textContent;break;default:console.log("unhandled Sampler2D prop: "+b.nodeName)}}return this};J.prototype.create=
+function(){if(this.shader==null)return null};J.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.shader=null;for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeType==1)switch(b.nodeName){case "profile_COMMON":this.parseTechnique(this.parseProfileCOMMON(b))}}return this};J.prototype.parseNewparam=function(a){for(var c=a.getAttribute("sid"),b=0;b<a.childNodes.length;b++){var e=a.childNodes[b];if(e.nodeType==1)switch(e.nodeName){case "surface":this.surface=
+(new C(this)).parse(e);this.surface.sid=c;break;case "sampler2D":this.sampler=(new F(this)).parse(e);this.sampler.sid=c;break;case "extra":break;default:console.log(e.nodeName)}}};J.prototype.parseProfileCOMMON=function(a){for(var c,b=0;b<a.childNodes.length;b++){var e=a.childNodes[b];if(e.nodeType==1)switch(e.nodeName){case "profile_COMMON":this.parseProfileCOMMON(e);break;case "technique":c=e;break;case "newparam":this.parseNewparam(e);break;case "extra":break;default:console.log(e.nodeName)}}return c};
+J.prototype.parseTechnique=function(a){for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeType==1)switch(b.nodeName){case "lambert":case "blinn":case "phong":this.shader=(new K(b.nodeName,this)).parse(b)}}};M.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");return this};N.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.source={};for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeType==1)switch(b.nodeName){case "source":b=
+(new E).parse(b);this.source[b.id]=b;break;case "sampler":this.sampler.push((new O(this)).parse(b));break;case "channel":this.channel.push((new L(this)).parse(b))}}return this};L.prototype.parse=function(a){this.source=a.getAttribute("source").replace(/^#/,"");this.target=a.getAttribute("target");var c=this.target.split("/");c.shift();var a=c.shift(),b=a.indexOf(".")>=0,e=a.indexOf("(")>=0,f,h;if(b)c=a.split("."),a=c.shift(),h=c.shift();else if(e){f=a.split("(");a=f.shift();for(c=0;c<f.length;c++)f[c]=
+parseInt(f[c].replace(/\)/,""))}this.sid=a;this.dotSyntax=b;this.arrSyntax=e;this.arrIndices=f;this.member=h;return this};O.prototype.parse=function(a){this.id=a.getAttribute("id");this.inputs=[];for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeType==1)switch(b.nodeName){case "input":this.inputs.push((new B).parse(b))}}return this};O.prototype.create=function(){for(var a=0;a<this.inputs.length;a++){var c=this.inputs[a],b=this.animation.source[c.source];switch(c.semantic){case "INPUT":this.input=
+b.read();break;case "OUTPUT":this.output=b.read();break;case "INTERPOLATION":this.interpolation=b.read();break;case "IN_TANGENT":break;case "OUT_TANGENT":break;default:console.log(c.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(c,b){if(document.implementation&&
+document.implementation.createDocument){document.implementation.createDocument("http://www.collada.org/2005/11/COLLADASchema","COLLADA",null);c+="?rnd="+Math.random();var e=new XMLHttpRequest;e.overrideMimeType&&e.overrideMimeType("text/xml");e.onreadystatechange=function(){if(e.readyState==4&&(e.status==0||e.status==200))$=b,a(e.responseXML,void 0,c)};e.open("GET",c,!0);e.send(null)}else alert("Don't know how to parse XML!")},parse:a,setPreferredShading:function(a){ka=a},applySkin:g,geometries:ba}};
+THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;THREE.JSONLoader.prototype.load=function(a){var b=this,c=a.model,e=a.callback,g=a.texture_path?a.texture_path:this.extractUrlbase(c),a=new Worker(c);a.onmessage=function(a){b.createModel(a.data,e,g);b.onLoadComplete()};this.onLoadStart();a.postMessage((new Date).getTime())};
+THREE.JSONLoader.prototype.createModel=function(a,b,c){var e=new THREE.Geometry,g=a.scale!==void 0?1/a.scale:1;this.init_materials(e,a.materials,c);(function(c){if(a.version===void 0||a.version!=2)console.error("Deprecated file format.");else{var b,g,l,m,n,o,t,u,v,y,p,z,x,w,A=a.faces;o=a.vertices;var D=a.normals,B=a.colors,E=0;for(b=0;b<a.uvs.length;b++)a.uvs[b].length&&E++;for(b=0;b<E;b++)e.faceUvs[b]=[],e.faceVertexUvs[b]=[];m=0;for(n=o.length;m<n;)t=new THREE.Vertex,t.position.x=o[m++]*c,t.position.y=
+o[m++]*c,t.position.z=o[m++]*c,e.vertices.push(t);m=0;for(n=A.length;m<n;){c=A[m++];o=c&1;l=c&2;b=c&4;g=c&8;u=c&16;t=c&32;y=c&64;c&=128;o?(p=new THREE.Face4,p.a=A[m++],p.b=A[m++],p.c=A[m++],p.d=A[m++],o=4):(p=new THREE.Face3,p.a=A[m++],p.b=A[m++],p.c=A[m++],o=3);if(l)l=A[m++],p.materials=e.materials[l];l=e.faces.length;if(b)for(b=0;b<E;b++)z=a.uvs[b],v=A[m++],w=z[v*2],v=z[v*2+1],e.faceUvs[b][l]=new THREE.UV(w,v);if(g)for(b=0;b<E;b++){z=a.uvs[b];x=[];for(g=0;g<o;g++)v=A[m++],w=z[v*2],v=z[v*2+1],x[g]=
+new THREE.UV(w,v);e.faceVertexUvs[b][l]=x}if(u)u=A[m++]*3,g=new THREE.Vector3,g.x=D[u++],g.y=D[u++],g.z=D[u],p.normal=g;if(t)for(b=0;b<o;b++)u=A[m++]*3,g=new THREE.Vector3,g.x=D[u++],g.y=D[u++],g.z=D[u],p.vertexNormals.push(g);if(y)t=A[m++],t=new THREE.Color(B[t]),p.color=t;if(c)for(b=0;b<o;b++)t=A[m++],t=new THREE.Color(B[t]),p.vertexColors.push(t);e.faces.push(p)}}})(g);(function(){var c,b,g,l;if(a.skinWeights){c=0;for(b=a.skinWeights.length;c<b;c+=2)g=a.skinWeights[c],l=a.skinWeights[c+1],e.skinWeights.push(new THREE.Vector4(g,
 l,0,0))}if(a.skinIndices){c=0;for(b=a.skinIndices.length;c<b;c+=2)g=a.skinIndices[c],l=a.skinIndices[c+1],e.skinIndices.push(new THREE.Vector4(g,l,0,0))}e.bones=a.bones;e.animation=a.animation})();(function(c){if(a.morphTargets!==void 0){var b,g,l,m,n,o,t,u,v;b=0;for(g=a.morphTargets.length;b<g;b++){e.morphTargets[b]={};e.morphTargets[b].name=a.morphTargets[b].name;e.morphTargets[b].vertices=[];u=e.morphTargets[b].vertices;v=a.morphTargets[b].vertices;l=0;for(m=v.length;l<m;l+=3)n=v[l]*c,o=v[l+1]*
 c,t=v[l+2]*c,u.push(new THREE.Vertex(new THREE.Vector3(n,o,t)))}}if(a.morphColors!==void 0){b=0;for(g=a.morphColors.length;b<g;b++){e.morphColors[b]={};e.morphColors[b].name=a.morphColors[b].name;e.morphColors[b].colors=[];m=e.morphColors[b].colors;n=a.morphColors[b].colors;c=0;for(l=n.length;c<l;c+=3)o=new THREE.Color(16755200),o.setRGB(n[c],n[c+1],n[c+2]),m.push(o)}}})(g);e.computeCentroids();e.computeFaceNormals();this.hasNormals(e)&&e.computeTangents();b(e)};
 THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};
-THREE.SceneLoader.prototype={load:function(a,b){var c=this,e=new Worker(a);e.postMessage(0);var g=THREE.Loader.prototype.extractUrlbase(a);e.onmessage=function(a){function e(a,c){return c=="relativeToHTML"?a:g+"/"+a}function k(){for(u in F.objects)if(!G.objects[u])if(w=F.objects[u],w.geometry!==void 0){if(B=G.geometries[w.geometry]){var a=!1;J=[];for(P=0;P<w.materials.length;P++)J[P]=G.materials[w.materials[P]],a=J[P]instanceof THREE.ShaderMaterial;a&&B.computeTangents();x=w.position;r=w.rotation;
-q=w.quaternion;s=w.scale;q=0;J.length==0&&(J[0]=new THREE.MeshFaceMaterial);J.length>1&&(J=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(B,J);object.name=u;object.position.set(x[0],x[1],x[2]);q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=w.visible;G.scene.add(object);G.objects[u]=object;w.meshCollider&&(a=THREE.CollisionUtils.MeshColliderWBox(object),G.scene.collisions.colliders.push(a));
-if(w.castsShadow)a=new THREE.ShadowVolume(B),G.scene.add(a),a.position=object.position,a.rotation=object.rotation,a.scale=object.scale;w.trigger&&w.trigger.toLowerCase()!="none"&&(a={type:w.trigger,object:w},G.triggers[object.name]=a)}}else x=w.position,r=w.rotation,q=w.quaternion,s=w.scale,q=0,object=new THREE.Object3D,object.name=u,object.position.set(x[0],x[1],x[2]),q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]),object.scale.set(s[0],
-s[1],s[2]),object.visible=w.visible!==void 0?w.visible:!1,G.scene.add(object),G.objects[u]=object,G.empties[u]=object,w.trigger&&w.trigger.toLowerCase()!="none"&&(a={type:w.trigger,object:w},G.triggers[object.name]=a)}function l(a){return function(b){G.geometries[a]=b;k();M-=1;c.onLoadComplete();n()}}function m(a){return function(c){G.geometries[a]=c}}function n(){c.callbackProgress({totalModels:L,totalTextures:O,loadedModels:L-M,loadedTextures:O-N},G);c.onLoadProgress();M==0&&N==0&&b(G)}var o,t,
-u,v,y,p,z,w,x,A,D,B,E,I,H,J,C,F,K,M,N,L,O,G;F=a.data;H=new THREE.BinaryLoader;K=new THREE.JSONLoader;N=M=0;G={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};a=!1;for(u in F.objects)if(w=F.objects[u],w.meshCollider){a=!0;break}if(a)G.scene.collisions=new THREE.CollisionSystem;if(F.transform){a=F.transform.position;A=F.transform.rotation;var S=F.transform.scale;a&&G.scene.position.set(a[0],a[1],a[2]);A&&G.scene.rotation.set(A[0],
-A[1],A[2]);S&&G.scene.scale.set(S[0],S[1],S[2]);(a||A||S)&&G.scene.updateMatrix()}a=function(){N-=1;n();c.onLoadComplete()};for(y in F.cameras)A=F.cameras[y],A.type=="perspective"?E=new THREE.PerspectiveCamera(A.fov,A.aspect,A.near,A.far):A.type=="ortho"&&(E=new THREE.OrthographicCamera(A.left,A.right,A.top,A.bottom,A.near,A.far)),x=A.position,A=A.target,E.position.set(x[0],x[1],x[2]),E.target=new THREE.Vector3(A[0],A[1],A[2]),G.cameras[y]=E;for(v in F.lights)y=F.lights[v],E=y.color!==void 0?y.color:
-16777215,A=y.intensity!==void 0?y.intensity:1,y.type=="directional"?(x=y.direction,C=new THREE.DirectionalLight(E,A),C.position.set(x[0],x[1],x[2]),C.position.normalize()):y.type=="point"?(x=y.position,d=y.distance,C=new THREE.PointLight(E,A,d),C.position.set(x[0],x[1],x[2])):y.type=="ambient"&&(C=new THREE.AmbientLight(E)),G.scene.add(C),G.lights[v]=C;for(p in F.fogs)v=F.fogs[p],v.type=="linear"?I=new THREE.Fog(0,v.near,v.far):v.type=="exp2"&&(I=new THREE.FogExp2(0,v.density)),A=v.color,I.color.setRGB(A[0],
-A[1],A[2]),G.fogs[p]=I;if(G.cameras&&F.defaults.camera)G.currentCamera=G.cameras[F.defaults.camera];if(G.fogs&&F.defaults.fog)G.scene.fog=G.fogs[F.defaults.fog];A=F.defaults.bgcolor;G.bgColor=new THREE.Color;G.bgColor.setRGB(A[0],A[1],A[2]);G.bgColorAlpha=F.defaults.bgalpha;for(o in F.geometries)if(p=F.geometries[o],p.type=="bin_mesh"||p.type=="ascii_mesh")M+=1,c.onLoadStart();L=M;for(o in F.geometries)p=F.geometries[o],p.type=="cube"?(B=new THREE.CubeGeometry(p.width,p.height,p.depth,p.segmentsWidth,
-p.segmentsHeight,p.segmentsDepth,null,p.flipped,p.sides),G.geometries[o]=B):p.type=="plane"?(B=new THREE.PlaneGeometry(p.width,p.height,p.segmentsWidth,p.segmentsHeight),G.geometries[o]=B):p.type=="sphere"?(B=new THREE.SphereGeometry(p.radius,p.segmentsWidth,p.segmentsHeight),G.geometries[o]=B):p.type=="cylinder"?(B=new THREE.CylinderGeometry(p.topRad,p.botRad,p.height,p.radSegs,p.heightSegs),G.geometries[o]=B):p.type=="torus"?(B=new THREE.TorusGeometry(p.radius,p.tube,p.segmentsR,p.segmentsT),G.geometries[o]=
-B):p.type=="icosahedron"?(B=new THREE.IcosahedronGeometry(p.subdivisions),G.geometries[o]=B):p.type=="bin_mesh"?H.load({model:e(p.url,F.urlBaseType),callback:l(o)}):p.type=="ascii_mesh"?K.load({model:e(p.url,F.urlBaseType),callback:l(o)}):p.type=="embedded_mesh"&&(p=F.embeds[p.id])&&K.createModel(p,m(o),"");for(z in F.textures)if(o=F.textures[z],o.url instanceof Array){N+=o.url.length;for(H=0;H<o.url.length;H++)c.onLoadStart()}else N+=1,c.onLoadStart();O=N;for(z in F.textures){o=F.textures[z];if(o.mapping!=
-void 0&&THREE[o.mapping]!=void 0)o.mapping=new THREE[o.mapping];if(o.url instanceof Array){H=[];for(var P=0;P<o.url.length;P++)H[P]=e(o.url[P],F.urlBaseType);H=THREE.ImageUtils.loadTextureCube(H,o.mapping,a)}else{H=THREE.ImageUtils.loadTexture(e(o.url,F.urlBaseType),o.mapping,a);if(THREE[o.minFilter]!=void 0)H.minFilter=THREE[o.minFilter];if(THREE[o.magFilter]!=void 0)H.magFilter=THREE[o.magFilter];if(o.repeat){H.repeat.set(o.repeat[0],o.repeat[1]);if(o.repeat[0]!=1)H.wrapS=THREE.RepeatWrapping;if(o.repeat[1]!=
-1)H.wrapT=THREE.RepeatWrapping}o.offset&&H.offset.set(o.offset[0],o.offset[1]);if(o.wrap){K={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(K[o.wrap[0]]!==void 0)H.wrapS=K[o.wrap[0]];if(K[o.wrap[1]]!==void 0)H.wrapT=K[o.wrap[1]]}}G.textures[z]=H}for(t in F.materials){z=F.materials[t];for(D in z.parameters)if(D=="envMap"||D=="map"||D=="lightMap")z.parameters[D]=G.textures[z.parameters[D]];else if(D=="shading")z.parameters[D]=z.parameters[D]=="flat"?THREE.FlatShading:THREE.SmoothShading;
+THREE.SceneLoader.prototype={load:function(a,b){var c=this,e=new Worker(a);e.postMessage(0);var g=THREE.Loader.prototype.extractUrlbase(a);e.onmessage=function(a){function e(a,c){return c=="relativeToHTML"?a:g+"/"+a}function k(){for(u in F.objects)if(!H.objects[u])if(x=F.objects[u],x.geometry!==void 0){if(B=H.geometries[x.geometry]){var a=!1;K=[];for(P=0;P<x.materials.length;P++)K[P]=H.materials[x.materials[P]],a=K[P]instanceof THREE.ShaderMaterial;a&&B.computeTangents();w=x.position;r=x.rotation;
+q=x.quaternion;s=x.scale;q=0;K.length==0&&(K[0]=new THREE.MeshFaceMaterial);K.length>1&&(K=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(B,K);object.name=u;object.position.set(w[0],w[1],w[2]);q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=x.visible;H.scene.add(object);H.objects[u]=object;x.meshCollider&&(a=THREE.CollisionUtils.MeshColliderWBox(object),H.scene.collisions.colliders.push(a));
+if(x.castsShadow)a=new THREE.ShadowVolume(B),H.scene.add(a),a.position=object.position,a.rotation=object.rotation,a.scale=object.scale;x.trigger&&x.trigger.toLowerCase()!="none"&&(a={type:x.trigger,object:x},H.triggers[object.name]=a)}}else w=x.position,r=x.rotation,q=x.quaternion,s=x.scale,q=0,object=new THREE.Object3D,object.name=u,object.position.set(w[0],w[1],w[2]),q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]),object.scale.set(s[0],
+s[1],s[2]),object.visible=x.visible!==void 0?x.visible:!1,H.scene.add(object),H.objects[u]=object,H.empties[u]=object,x.trigger&&x.trigger.toLowerCase()!="none"&&(a={type:x.trigger,object:x},H.triggers[object.name]=a)}function l(a){return function(b){H.geometries[a]=b;k();M-=1;c.onLoadComplete();n()}}function m(a){return function(c){H.geometries[a]=c}}function n(){c.callbackProgress({totalModels:L,totalTextures:O,loadedModels:L-M,loadedTextures:O-N},H);c.onLoadProgress();M==0&&N==0&&b(H)}var o,t,
+u,v,y,p,z,x,w,A,D,B,E,I,G,K,C,F,J,M,N,L,O,H;F=a.data;G=new THREE.BinaryLoader;J=new THREE.JSONLoader;N=M=0;H={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};a=!1;for(u in F.objects)if(x=F.objects[u],x.meshCollider){a=!0;break}if(a)H.scene.collisions=new THREE.CollisionSystem;if(F.transform){a=F.transform.position;A=F.transform.rotation;var Q=F.transform.scale;a&&H.scene.position.set(a[0],a[1],a[2]);A&&H.scene.rotation.set(A[0],
+A[1],A[2]);Q&&H.scene.scale.set(Q[0],Q[1],Q[2]);(a||A||Q)&&H.scene.updateMatrix()}a=function(){N-=1;n();c.onLoadComplete()};for(y in F.cameras)A=F.cameras[y],A.type=="perspective"?E=new THREE.PerspectiveCamera(A.fov,A.aspect,A.near,A.far):A.type=="ortho"&&(E=new THREE.OrthographicCamera(A.left,A.right,A.top,A.bottom,A.near,A.far)),w=A.position,A=A.target,E.position.set(w[0],w[1],w[2]),E.target=new THREE.Vector3(A[0],A[1],A[2]),H.cameras[y]=E;for(v in F.lights)y=F.lights[v],E=y.color!==void 0?y.color:
+16777215,A=y.intensity!==void 0?y.intensity:1,y.type=="directional"?(w=y.direction,C=new THREE.DirectionalLight(E,A),C.position.set(w[0],w[1],w[2]),C.position.normalize()):y.type=="point"?(w=y.position,d=y.distance,C=new THREE.PointLight(E,A,d),C.position.set(w[0],w[1],w[2])):y.type=="ambient"&&(C=new THREE.AmbientLight(E)),H.scene.add(C),H.lights[v]=C;for(p in F.fogs)v=F.fogs[p],v.type=="linear"?I=new THREE.Fog(0,v.near,v.far):v.type=="exp2"&&(I=new THREE.FogExp2(0,v.density)),A=v.color,I.color.setRGB(A[0],
+A[1],A[2]),H.fogs[p]=I;if(H.cameras&&F.defaults.camera)H.currentCamera=H.cameras[F.defaults.camera];if(H.fogs&&F.defaults.fog)H.scene.fog=H.fogs[F.defaults.fog];A=F.defaults.bgcolor;H.bgColor=new THREE.Color;H.bgColor.setRGB(A[0],A[1],A[2]);H.bgColorAlpha=F.defaults.bgalpha;for(o in F.geometries)if(p=F.geometries[o],p.type=="bin_mesh"||p.type=="ascii_mesh")M+=1,c.onLoadStart();L=M;for(o in F.geometries)p=F.geometries[o],p.type=="cube"?(B=new THREE.CubeGeometry(p.width,p.height,p.depth,p.segmentsWidth,
+p.segmentsHeight,p.segmentsDepth,null,p.flipped,p.sides),H.geometries[o]=B):p.type=="plane"?(B=new THREE.PlaneGeometry(p.width,p.height,p.segmentsWidth,p.segmentsHeight),H.geometries[o]=B):p.type=="sphere"?(B=new THREE.SphereGeometry(p.radius,p.segmentsWidth,p.segmentsHeight),H.geometries[o]=B):p.type=="cylinder"?(B=new THREE.CylinderGeometry(p.topRad,p.botRad,p.height,p.radSegs,p.heightSegs),H.geometries[o]=B):p.type=="torus"?(B=new THREE.TorusGeometry(p.radius,p.tube,p.segmentsR,p.segmentsT),H.geometries[o]=
+B):p.type=="icosahedron"?(B=new THREE.IcosahedronGeometry(p.subdivisions),H.geometries[o]=B):p.type=="bin_mesh"?G.load({model:e(p.url,F.urlBaseType),callback:l(o)}):p.type=="ascii_mesh"?J.load({model:e(p.url,F.urlBaseType),callback:l(o)}):p.type=="embedded_mesh"&&(p=F.embeds[p.id])&&J.createModel(p,m(o),"");for(z in F.textures)if(o=F.textures[z],o.url instanceof Array){N+=o.url.length;for(G=0;G<o.url.length;G++)c.onLoadStart()}else N+=1,c.onLoadStart();O=N;for(z in F.textures){o=F.textures[z];if(o.mapping!=
+void 0&&THREE[o.mapping]!=void 0)o.mapping=new THREE[o.mapping];if(o.url instanceof Array){G=[];for(var P=0;P<o.url.length;P++)G[P]=e(o.url[P],F.urlBaseType);G=THREE.ImageUtils.loadTextureCube(G,o.mapping,a)}else{G=THREE.ImageUtils.loadTexture(e(o.url,F.urlBaseType),o.mapping,a);if(THREE[o.minFilter]!=void 0)G.minFilter=THREE[o.minFilter];if(THREE[o.magFilter]!=void 0)G.magFilter=THREE[o.magFilter];if(o.repeat){G.repeat.set(o.repeat[0],o.repeat[1]);if(o.repeat[0]!=1)G.wrapS=THREE.RepeatWrapping;if(o.repeat[1]!=
+1)G.wrapT=THREE.RepeatWrapping}o.offset&&G.offset.set(o.offset[0],o.offset[1]);if(o.wrap){J={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(J[o.wrap[0]]!==void 0)G.wrapS=J[o.wrap[0]];if(J[o.wrap[1]]!==void 0)G.wrapT=J[o.wrap[1]]}}H.textures[z]=G}for(t in F.materials){z=F.materials[t];for(D in z.parameters)if(D=="envMap"||D=="map"||D=="lightMap")z.parameters[D]=H.textures[z.parameters[D]];else if(D=="shading")z.parameters[D]=z.parameters[D]=="flat"?THREE.FlatShading:THREE.SmoothShading;
 else if(D=="blending")z.parameters[D]=THREE[z.parameters[D]]?THREE[z.parameters[D]]:THREE.NormalBlending;else if(D=="combine")z.parameters[D]=z.parameters[D]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(D=="vertexColors")if(z.parameters[D]=="face")z.parameters[D]=THREE.FaceColors;else if(z.parameters[D])z.parameters[D]=THREE.VertexColors;if(z.parameters.opacity!==void 0&&z.parameters.opacity<1)z.parameters.transparent=!0;if(z.parameters.normalMap){o=THREE.ShaderUtils.lib.normal;
-a=THREE.UniformsUtils.clone(o.uniforms);H=z.parameters.color;K=z.parameters.specular;p=z.parameters.ambient;I=z.parameters.shininess;a.tNormal.texture=G.textures[z.parameters.normalMap];if(z.parameters.normalMapFactor)a.uNormalScale.value=z.parameters.normalMapFactor;if(z.parameters.map)a.tDiffuse.texture=z.parameters.map,a.enableDiffuse.value=!0;if(z.parameters.lightMap)a.tAO.texture=z.parameters.lightMap,a.enableAO.value=!0;if(z.parameters.specularMap)a.tSpecular.texture=G.textures[z.parameters.specularMap],
-a.enableSpecular.value=!0;a.uDiffuseColor.value.setHex(H);a.uSpecularColor.value.setHex(K);a.uAmbientColor.value.setHex(p);a.uShininess.value=I;if(z.parameters.opacity)a.uOpacity.value=z.parameters.opacity;z=new THREE.ShaderMaterial({fragmentShader:o.fragmentShader,vertexShader:o.vertexShader,uniforms:a,lights:!0,fog:!0})}else z=new THREE[z.type](z.parameters);G.materials[t]=z}k();c.callbackSync(G)}},constructor:THREE.SceneLoader};THREE.UTF8Loader=function(){};THREE.UTF8Loader.prototype=new THREE.UTF8Loader;
+a=THREE.UniformsUtils.clone(o.uniforms);G=z.parameters.color;J=z.parameters.specular;p=z.parameters.ambient;I=z.parameters.shininess;a.tNormal.texture=H.textures[z.parameters.normalMap];if(z.parameters.normalMapFactor)a.uNormalScale.value=z.parameters.normalMapFactor;if(z.parameters.map)a.tDiffuse.texture=z.parameters.map,a.enableDiffuse.value=!0;if(z.parameters.lightMap)a.tAO.texture=z.parameters.lightMap,a.enableAO.value=!0;if(z.parameters.specularMap)a.tSpecular.texture=H.textures[z.parameters.specularMap],
+a.enableSpecular.value=!0;a.uDiffuseColor.value.setHex(G);a.uSpecularColor.value.setHex(J);a.uAmbientColor.value.setHex(p);a.uShininess.value=I;if(z.parameters.opacity)a.uOpacity.value=z.parameters.opacity;z=new THREE.ShaderMaterial({fragmentShader:o.fragmentShader,vertexShader:o.vertexShader,uniforms:a,lights:!0,fog:!0})}else z=new THREE[z.type](z.parameters);H.materials[t]=z}k();c.callbackSync(H)}},constructor:THREE.SceneLoader};THREE.UTF8Loader=function(){};THREE.UTF8Loader.prototype=new THREE.UTF8Loader;
 THREE.UTF8Loader.prototype.constructor=THREE.UTF8Loader;
 THREE.UTF8Loader.prototype.load=function(a){var b=new XMLHttpRequest,c=a.model,e=a.callback,g=a.scale!==void 0?a.scale:1,h=a.offsetX!==void 0?a.offsetX:0,f=a.offsetY!==void 0?a.offsetY:0,k=a.offsetZ!==void 0?a.offsetZ:0;b.onreadystatechange=function(){b.readyState==4?b.status==200||b.status==0?THREE.UTF8Loader.prototype.createModel(b.responseText,e,g,h,f,k):alert("Couldn't load ["+c+"] ["+b.status+"]"):b.readyState!=3&&b.readyState==2&&b.getResponseHeader("Content-Length")};b.open("GET",c,!0);b.send(null)};
 THREE.UTF8Loader.prototype.decompressMesh=function(a){var b=a.charCodeAt(0);b>=57344&&(b-=2048);b++;for(var c=new Float32Array(8*b),e=1,g=0;g<8;g++){for(var h=0,f=0;f<b;++f){var k=a.charCodeAt(f+e);h+=k>>1^-(k&1);c[8*f+g]=h}e+=b}b=a.length-e;h=new Uint16Array(b);for(g=f=0;g<b;g++)k=a.charCodeAt(g+e),h[g]=f-k,k==0&&f++;return[c,h]};
 THREE.UTF8Loader.prototype.createModel=function(a,b,c,e,g,h){var f=function(){var b=this;b.materials=[];THREE.Geometry.call(this);var f=THREE.UTF8Loader.prototype.decompressMesh(a),m=[],n=[];(function(a,f,l){for(var m,n,p,z=a.length;l<z;l+=f)m=a[l],n=a[l+1],p=a[l+2],m=m/16383*c,n=n/16383*c,p=p/16383*c,m+=e,n+=g,p+=h,b.vertices.push(new THREE.Vertex(new THREE.Vector3(m,n,p)))})(f[0],8,0);(function(a,c,b){for(var e,f,g=a.length;b<g;b+=c)e=a[b],f=a[b+1],e/=1023,f/=1023,n.push(e,1-f)})(f[0],8,3);(function(a,
-c,b){for(var e,f,g,h=a.length;b<h;b+=c)e=a[b],f=a[b+1],g=a[b+2],e=(e-512)/511,f=(f-512)/511,g=(g-512)/511,m.push(e,f,g)})(f[0],8,5);(function(a){var c,e,f,g,h,l,w,x,A,D=a.length;for(c=0;c<D;c+=3){e=a[c];f=a[c+1];g=a[c+2];h=b;x=e;A=f;l=g;w=e;var B=f,E=g,I=h.materials[0],H=m[B*3],J=m[B*3+1],B=m[B*3+2],C=m[E*3],F=m[E*3+1],E=m[E*3+2];w=new THREE.Vector3(m[w*3],m[w*3+1],m[w*3+2]);B=new THREE.Vector3(H,J,B);E=new THREE.Vector3(C,F,E);h.faces.push(new THREE.Face3(x,A,l,[w,B,E],null,I));h=n[e*2];e=n[e*2+
-1];l=n[f*2];w=n[f*2+1];x=n[g*2];A=n[g*2+1];g=b.faceVertexUvs[0];f=l;l=w;w=[];w.push(new THREE.UV(h,e));w.push(new THREE.UV(f,l));w.push(new THREE.UV(x,A));g.push(w)}})(f[1]);this.computeCentroids();this.computeFaceNormals()};f.prototype=new THREE.Geometry;f.prototype.constructor=f;b(new f)};
+c,b){for(var e,f,g,h=a.length;b<h;b+=c)e=a[b],f=a[b+1],g=a[b+2],e=(e-512)/511,f=(f-512)/511,g=(g-512)/511,m.push(e,f,g)})(f[0],8,5);(function(a){var c,e,f,g,h,l,x,w,A,D=a.length;for(c=0;c<D;c+=3){e=a[c];f=a[c+1];g=a[c+2];h=b;w=e;A=f;l=g;x=e;var B=f,E=g,I=h.materials[0],G=m[B*3],K=m[B*3+1],B=m[B*3+2],C=m[E*3],F=m[E*3+1],E=m[E*3+2];x=new THREE.Vector3(m[x*3],m[x*3+1],m[x*3+2]);B=new THREE.Vector3(G,K,B);E=new THREE.Vector3(C,F,E);h.faces.push(new THREE.Face3(w,A,l,[x,B,E],null,I));h=n[e*2];e=n[e*2+
+1];l=n[f*2];x=n[f*2+1];w=n[g*2];A=n[g*2+1];g=b.faceVertexUvs[0];f=l;l=x;x=[];x.push(new THREE.UV(h,e));x.push(new THREE.UV(f,l));x.push(new THREE.UV(w,A));g.push(x)}})(f[1]);this.computeCentroids();this.computeFaceNormals()};f.prototype=new THREE.Geometry;f.prototype.constructor=f;b(new f)};
 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 b=new THREE.CylinderGeometry(0,5,25,5,1),c=new THREE.Line(a,new THREE.LineBasicMaterial({color:16711680}));c.rotation.z=-Math.PI/2;this.add(c);c=new THREE.Mesh(b,new THREE.MeshBasicMaterial({color:16711680}));c.position.x=100;c.rotation.z=-Math.PI/2;this.add(c);c=new THREE.Line(a,new THREE.LineBasicMaterial({color:65280}));this.add(c);
 c=new THREE.Mesh(b,new THREE.MeshBasicMaterial({color:65280}));c.position.y=100;this.add(c);c=new THREE.Line(a,new THREE.LineBasicMaterial({color:255}));c.rotation.x=Math.PI/2;this.add(c);c=new THREE.Mesh(b,new THREE.MeshBasicMaterial({color:255}));c.position.z=100;c.rotation.x=Math.PI/2;this.add(c)};THREE.Axes.prototype=new THREE.Object3D;THREE.Axes.prototype.constructor=THREE.Axes;
 THREE.MarchingCubes=function(a,b){THREE.Object3D.call(this);this.materials=b instanceof Array?b:[b];this.init=function(a){this.isolation=80;this.size=a;this.size2=this.size*this.size;this.size3=this.size2*this.size;this.halfsize=this.size/2;this.delta=2/this.size;this.yd=this.size;this.zd=this.size2;this.field=new Float32Array(this.size3);this.normal_cache=new Float32Array(this.size3*3);this.vlist=new Float32Array(36);this.nlist=new Float32Array(36);this.firstDraw=!0;this.maxCount=4096;this.count=
 0;this.hasNormal=this.hasPos=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(a,b,g){return a+(b-a)*g};this.VIntX=function(a,b,g,h,f,k,l,m,n,o){f=(f-n)/(o-n);n=this.normal_cache;b[h]=k+f*this.delta;b[h+1]=l;b[h+2]=m;g[h]=this.lerp(n[a],n[a+3],f);g[h+1]=this.lerp(n[a+1],n[a+4],f);g[h+2]=this.lerp(n[a+2],n[a+5],f)};this.VIntY=function(a,b,g,h,f,k,l,m,n,o){f=(f-n)/(o-n);n=this.normal_cache;b[h]=k;b[h+1]=l+f*this.delta;b[h+
 2]=m;b=a+this.yd*3;g[h]=this.lerp(n[a],n[b],f);g[h+1]=this.lerp(n[a+1],n[b+1],f);g[h+2]=this.lerp(n[a+2],n[b+2],f)};this.VIntZ=function(a,b,g,h,f,k,l,m,n,o){f=(f-n)/(o-n);n=this.normal_cache;b[h]=k;b[h+1]=l;b[h+2]=m+f*this.delta;b=a+this.zd*3;g[h]=this.lerp(n[a],n[b],f);g[h+1]=this.lerp(n[a+1],n[b+1],f);g[h+2]=this.lerp(n[a+2],n[b+2],f)};this.compNorm=function(a){var b=a*3;this.normal_cache[b]==0&&(this.normal_cache[b]=this.field[a-1]-this.field[a+1],this.normal_cache[b+1]=this.field[a-this.yd]-this.field[a+
-this.yd],this.normal_cache[b+2]=this.field[a-this.zd]-this.field[a+this.zd])};this.polygonize=function(a,b,g,h,f,k){var l=h+1,m=h+this.yd,n=h+this.zd,o=l+this.yd,t=l+this.zd,u=h+this.yd+this.zd,v=l+this.yd+this.zd,y=0,p=this.field[h],z=this.field[l],w=this.field[m],x=this.field[o],A=this.field[n],D=this.field[t],B=this.field[u],E=this.field[v];p<f&&(y|=1);z<f&&(y|=2);w<f&&(y|=8);x<f&&(y|=4);A<f&&(y|=16);D<f&&(y|=32);B<f&&(y|=128);E<f&&(y|=64);var I=THREE.edgeTable[y];if(I==0)return 0;var H=this.delta,
-J=a+H,C=b+H,H=g+H;I&1&&(this.compNorm(h),this.compNorm(l),this.VIntX(h*3,this.vlist,this.nlist,0,f,a,b,g,p,z));I&2&&(this.compNorm(l),this.compNorm(o),this.VIntY(l*3,this.vlist,this.nlist,3,f,J,b,g,z,x));I&4&&(this.compNorm(m),this.compNorm(o),this.VIntX(m*3,this.vlist,this.nlist,6,f,a,C,g,w,x));I&8&&(this.compNorm(h),this.compNorm(m),this.VIntY(h*3,this.vlist,this.nlist,9,f,a,b,g,p,w));I&16&&(this.compNorm(n),this.compNorm(t),this.VIntX(n*3,this.vlist,this.nlist,12,f,a,b,H,A,D));I&32&&(this.compNorm(t),
-this.compNorm(v),this.VIntY(t*3,this.vlist,this.nlist,15,f,J,b,H,D,E));I&64&&(this.compNorm(u),this.compNorm(v),this.VIntX(u*3,this.vlist,this.nlist,18,f,a,C,H,B,E));I&128&&(this.compNorm(n),this.compNorm(u),this.VIntY(n*3,this.vlist,this.nlist,21,f,a,b,H,A,B));I&256&&(this.compNorm(h),this.compNorm(n),this.VIntZ(h*3,this.vlist,this.nlist,24,f,a,b,g,p,A));I&512&&(this.compNorm(l),this.compNorm(t),this.VIntZ(l*3,this.vlist,this.nlist,27,f,J,b,g,z,D));I&1024&&(this.compNorm(o),this.compNorm(v),this.VIntZ(o*
-3,this.vlist,this.nlist,30,f,J,C,g,x,E));I&2048&&(this.compNorm(m),this.compNorm(u),this.VIntZ(m*3,this.vlist,this.nlist,33,f,a,C,g,w,B));y<<=4;for(f=h=0;THREE.triTable[y+f]!=-1;)a=y+f,b=a+1,g=a+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[a],3*THREE.triTable[b],3*THREE.triTable[g],k),f+=3,h++;return h};this.posnormtriv=function(a,b,g,h,f,k){var l=this.count*3;this.positionArray[l]=a[g];this.positionArray[l+1]=a[g+1];this.positionArray[l+2]=a[g+2];this.positionArray[l+3]=a[h];this.positionArray[l+
+this.yd],this.normal_cache[b+2]=this.field[a-this.zd]-this.field[a+this.zd])};this.polygonize=function(a,b,g,h,f,k){var l=h+1,m=h+this.yd,n=h+this.zd,o=l+this.yd,t=l+this.zd,u=h+this.yd+this.zd,v=l+this.yd+this.zd,y=0,p=this.field[h],z=this.field[l],x=this.field[m],w=this.field[o],A=this.field[n],D=this.field[t],B=this.field[u],E=this.field[v];p<f&&(y|=1);z<f&&(y|=2);x<f&&(y|=8);w<f&&(y|=4);A<f&&(y|=16);D<f&&(y|=32);B<f&&(y|=128);E<f&&(y|=64);var I=THREE.edgeTable[y];if(I==0)return 0;var G=this.delta,
+K=a+G,C=b+G,G=g+G;I&1&&(this.compNorm(h),this.compNorm(l),this.VIntX(h*3,this.vlist,this.nlist,0,f,a,b,g,p,z));I&2&&(this.compNorm(l),this.compNorm(o),this.VIntY(l*3,this.vlist,this.nlist,3,f,K,b,g,z,w));I&4&&(this.compNorm(m),this.compNorm(o),this.VIntX(m*3,this.vlist,this.nlist,6,f,a,C,g,x,w));I&8&&(this.compNorm(h),this.compNorm(m),this.VIntY(h*3,this.vlist,this.nlist,9,f,a,b,g,p,x));I&16&&(this.compNorm(n),this.compNorm(t),this.VIntX(n*3,this.vlist,this.nlist,12,f,a,b,G,A,D));I&32&&(this.compNorm(t),
+this.compNorm(v),this.VIntY(t*3,this.vlist,this.nlist,15,f,K,b,G,D,E));I&64&&(this.compNorm(u),this.compNorm(v),this.VIntX(u*3,this.vlist,this.nlist,18,f,a,C,G,B,E));I&128&&(this.compNorm(n),this.compNorm(u),this.VIntY(n*3,this.vlist,this.nlist,21,f,a,b,G,A,B));I&256&&(this.compNorm(h),this.compNorm(n),this.VIntZ(h*3,this.vlist,this.nlist,24,f,a,b,g,p,A));I&512&&(this.compNorm(l),this.compNorm(t),this.VIntZ(l*3,this.vlist,this.nlist,27,f,K,b,g,z,D));I&1024&&(this.compNorm(o),this.compNorm(v),this.VIntZ(o*
+3,this.vlist,this.nlist,30,f,K,C,g,w,E));I&2048&&(this.compNorm(m),this.compNorm(u),this.VIntZ(m*3,this.vlist,this.nlist,33,f,a,C,g,x,B));y<<=4;for(f=h=0;THREE.triTable[y+f]!=-1;)a=y+f,b=a+1,g=a+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[a],3*THREE.triTable[b],3*THREE.triTable[g],k),f+=3,h++;return h};this.posnormtriv=function(a,b,g,h,f,k){var l=this.count*3;this.positionArray[l]=a[g];this.positionArray[l+1]=a[g+1];this.positionArray[l+2]=a[g+2];this.positionArray[l+3]=a[h];this.positionArray[l+
 4]=a[h+1];this.positionArray[l+5]=a[h+2];this.positionArray[l+6]=a[f];this.positionArray[l+7]=a[f+1];this.positionArray[l+8]=a[f+2];this.normalArray[l]=b[g];this.normalArray[l+1]=b[g+1];this.normalArray[l+2]=b[g+2];this.normalArray[l+3]=b[h];this.normalArray[l+4]=b[h+1];this.normalArray[l+5]=b[h+2];this.normalArray[l+6]=b[f];this.normalArray[l+7]=b[f+1];this.normalArray[l+8]=b[f+2];this.hasNormal=this.hasPos=!0;this.count+=3;this.count>=this.maxCount-3&&k(this)};this.begin=function(){this.count=0;
 this.hasNormal=this.hasPos=!1};this.end=function(a){if(this.count!=0){for(var b=this.count*3;b<this.positionArray.length;b++)this.positionArray[b]=0;a(this)}};this.addBall=function(a,b,g,h,f){var k=this.size*Math.sqrt(h/f),l=g*this.size,m=b*this.size,n=a*this.size,o=Math.floor(l-k);o<1&&(o=1);l=Math.floor(l+k);l>this.size-1&&(l=this.size-1);var t=Math.floor(m-k);t<1&&(t=1);m=Math.floor(m+k);m>this.size-1&&(m=this.size-1);var u=Math.floor(n-k);u<1&&(u=1);k=Math.floor(n+k);k>this.size-1&&(k=this.size-
-1);for(var v,y,p,z,w,x;o<l;o++){n=this.size2*o;y=o/this.size-g;w=y*y;for(y=t;y<m;y++){p=n+this.size*y;v=y/this.size-b;x=v*v;for(v=u;v<k;v++)z=v/this.size-a,z=h/(1.0E-6+z*z+x+w)-f,z>0&&(this.field[p+v]+=z)}}};this.addPlaneX=function(a,b){var g,h,f,k,l,m=this.size,n=this.yd,o=this.zd,t=this.field,u=m*Math.sqrt(a/b);u>m&&(u=m);for(g=0;g<u;g++)if(h=g/m,h*=h,k=a/(1.0E-4+h)-b,k>0)for(h=0;h<m;h++){l=g+h*n;for(f=0;f<m;f++)t[o*f+l]+=k}};this.addPlaneY=function(a,b){var g,h,f,k,l,m,n=this.size,o=this.yd,t=
+1);for(var v,y,p,z,x,w;o<l;o++){n=this.size2*o;y=o/this.size-g;x=y*y;for(y=t;y<m;y++){p=n+this.size*y;v=y/this.size-b;w=v*v;for(v=u;v<k;v++)z=v/this.size-a,z=h/(1.0E-6+z*z+w+x)-f,z>0&&(this.field[p+v]+=z)}}};this.addPlaneX=function(a,b){var g,h,f,k,l,m=this.size,n=this.yd,o=this.zd,t=this.field,u=m*Math.sqrt(a/b);u>m&&(u=m);for(g=0;g<u;g++)if(h=g/m,h*=h,k=a/(1.0E-4+h)-b,k>0)for(h=0;h<m;h++){l=g+h*n;for(f=0;f<m;f++)t[o*f+l]+=k}};this.addPlaneY=function(a,b){var g,h,f,k,l,m,n=this.size,o=this.yd,t=
 this.zd,u=this.field,v=n*Math.sqrt(a/b);v>n&&(v=n);for(h=0;h<v;h++)if(g=h/n,g*=g,k=a/(1.0E-4+g)-b,k>0){l=h*o;for(g=0;g<n;g++){m=l+g;for(f=0;f<n;f++)u[t*f+m]+=k}}};this.addPlaneZ=function(a,b){var g,h,f,k,l,m;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(a/b);dist>size&&(dist=size);for(f=0;f<dist;f++)if(g=f/size,g*=g,k=a/(1.0E-4+g)-b,k>0){l=zd*f;for(h=0;h<size;h++){m=l+h*yd;for(g=0;g<size;g++)field[m+g]+=k}}};this.reset=function(){var a;for(a=0;a<this.size3;a++)this.normal_cache[a*
 3]=0,this.field[a]=0};this.render=function(a){this.begin();var b,g,h,f,k,l,m,n,o,t=this.size-2;for(f=1;f<t;f++){o=this.size2*f;m=(f-this.halfsize)/this.halfsize;for(h=1;h<t;h++){n=o+this.size*h;l=(h-this.halfsize)/this.halfsize;for(g=1;g<t;g++)k=(g-this.halfsize)/this.halfsize,b=n+g,this.polygonize(k,l,m,b,this.isolation,a)}}this.end(a)};this.generateGeometry=function(){var a=0,b=new THREE.Geometry,g=[];this.render(function(h){var f,k,l,m,n,o,t,u;for(f=0;f<h.count;f++)t=f*3,n=t+1,u=t+2,k=h.positionArray[t],
 l=h.positionArray[n],m=h.positionArray[u],o=new THREE.Vector3(k,l,m),k=h.normalArray[t],l=h.normalArray[n],m=h.normalArray[u],t=new THREE.Vector3(k,l,m),t.normalize(),n=new THREE.Vertex(o),b.vertices.push(n),g.push(t);nfaces=h.count/3;for(f=0;f<nfaces;f++)t=(a+f)*3,n=t+1,u=t+2,o=g[t],k=g[n],l=g[u],t=new THREE.Face3(t,n,u,[o,k,l]),b.faces.push(t);a+=nfaces;h.count=0});return b};this.init(a)};THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
@@ -356,7 +355,7 @@ THREE.CollisionSystem.__r=new THREE.Ray;THREE.CollisionUtils={};THREE.CollisionU
 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);var b=this,c=this.setSize,e=this.render,g=new THREE.PerspectiveCamera,h=new THREE.PerspectiveCamera,f=new THREE.Matrix4,k=new THREE.Matrix4,l,m,n;g.matrixAutoUpdate=h.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},o=new THREE.WebGLRenderTarget(512,512,a),t=new THREE.WebGLRenderTarget(512,512,a),u=new THREE.PerspectiveCamera(53,1,1,1E4);u.position.z=
 2;_material=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:o},mapRight:{type:"t",value:1,texture:t}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D mapLeft;\nuniform sampler2D mapRight;\nvarying vec2 vUv;\nvoid main() {\nvec4 colorL, colorR;\nvec2 uv = vUv;\ncolorL = texture2D( mapLeft, uv );\ncolorR = texture2D( mapRight, uv );\ngl_FragColor = vec4( colorL.g * 0.7 + colorL.b * 0.3, colorR.g, colorR.b, colorL.a + colorR.a ) * 1.1;\n}"});
-var v=new THREE.Scene;v.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));this.setSize=function(a,e){c.call(b,a,e);o.width=a;o.height=e;t.width=a;t.height=e};this.render=function(a,c){c.update(null,!0);if(l!==c.aspect||m!==c.near||n!==c.fov){l=c.aspect;m=c.near;n=c.fov;var z=c.projectionMatrix.clone(),w=125/30*0.5,x=w*m/125,A=m*Math.tan(n*Math.PI/360),D;f.n14=w;k.n14=-w;w=-A*l+x;D=A*l+x;z.n11=2*m/(D-w);z.n13=(D+w)/(D-w);g.projectionMatrix=z.clone();w=-A*l-x;D=A*l-x;z.n11=2*m/(D-w);z.n13=
-(D+w)/(D-w);h.projectionMatrix=z.clone()}g.matrix=c.matrixWorld.clone().multiplySelf(k);g.update(null,!0);g.position.copy(c.position);g.near=m;g.far=c.far;e.call(b,a,g,o,!0);h.matrix=c.matrixWorld.clone().multiplySelf(f);h.update(null,!0);h.position.copy(c.position);h.near=m;h.far=c.far;e.call(b,a,h,t,!0);e.call(b,v,u)}};
+var v=new THREE.Scene;v.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));this.setSize=function(a,e){c.call(b,a,e);o.width=a;o.height=e;t.width=a;t.height=e};this.render=function(a,c){c.update(null,!0);if(l!==c.aspect||m!==c.near||n!==c.fov){l=c.aspect;m=c.near;n=c.fov;var z=c.projectionMatrix.clone(),x=125/30*0.5,w=x*m/125,A=m*Math.tan(n*Math.PI/360),D;f.n14=x;k.n14=-x;x=-A*l+w;D=A*l+w;z.n11=2*m/(D-x);z.n13=(D+x)/(D-x);g.projectionMatrix=z.clone();x=-A*l-w;D=A*l-w;z.n11=2*m/(D-x);z.n13=
+(D+x)/(D-x);h.projectionMatrix=z.clone()}g.matrix=c.matrixWorld.clone().multiplySelf(k);g.update(null,!0);g.position.copy(c.position);g.near=m;g.far=c.far;e.call(b,a,g,o,!0);h.matrix=c.matrixWorld.clone().multiplySelf(f);h.update(null,!0);h.position.copy(c.position);h.near=m;h.far=c.far;e.call(b,a,h,t,!0);e.call(b,v,u)}};
 if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoClear=!1;var b=this,c=this.setSize,e=this.render,g,h,f=new THREE.PerspectiveCamera;f.target=new THREE.Vector3(0,0,0);var k=new THREE.PerspectiveCamera;k.target=new THREE.Vector3(0,0,0);b.separation=10;if(a&&a.separation!==void 0)b.separation=a.separation;this.setSize=function(a,e){c.call(b,a,e);g=a/2;h=e};this.render=function(a,c){this.clear();f.fov=c.fov;f.aspect=0.5*c.aspect;f.near=c.near;f.far=
 c.far;f.updateProjectionMatrix();f.position.copy(c.position);f.target.copy(c.target);f.translateX(b.separation);f.lookAt(f.target);k.projectionMatrix=f.projectionMatrix;k.position.copy(c.position);k.target.copy(c.target);k.translateX(-b.separation);k.lookAt(k.target);this.setViewport(0,0,g,h);e.call(b,a,f);this.setViewport(g,0,g,h);e.call(b,a,k,!1)}};

+ 51 - 0
gui/index.html

@@ -104,6 +104,57 @@
 			}, false );
 			document.body.appendChild( xr );
 
+			//
+
+			document.addEventListener( 'dragover', function ( event ) {
+
+				event.preventDefault();
+
+			}, false );
+			document.addEventListener( 'dragleave', function ( event ) {
+
+				event.preventDefault();
+
+			}, false );
+			document.addEventListener( 'drop', function ( event ) {
+
+				event.preventDefault();
+
+				var file = event.dataTransfer.files[ 0 ];
+				var reader = new FileReader();
+
+				reader.onload = function ( event ) {
+
+					var parser = new DOMParser();
+					var xml = parser.parseFromString( event.target.result, 'text/xml' );
+
+					var loader = new THREE.ColladaLoader();
+					loader.parse( xml, function ( collada ) {
+
+						console.log( collada );
+
+						signals.added.dispatch( collada.scene );
+
+					} );
+
+					/*
+					var loader = new THREE.JSONLoader();
+					loader.createModel( event.target.result, function ( geometry ) {
+
+						var material = new THREE.MeshBasicMaterial( { color: 0xffffff, wireframe: true } );
+						var mesh = new THREE.Mesh( geometry, material );
+
+						signals.added.dispatch( mesh );
+
+					} );
+					*/
+
+				};
+
+				reader.readAsText( file );
+
+			}, false );
+
 			// Add Sphere
 
 			var geometry = new THREE.SphereGeometry( 75, 20, 10 );

+ 1 - 0
src/extras/loaders/ColladaLoader.js

@@ -3220,6 +3220,7 @@ THREE.ColladaLoader = function () {
 	return {
 
 		load: load,
+		parse: parse,
 		setPreferredShading: setPreferredShading,
 		applySkin: applySkin,
 		geometries : geometries

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