h.copy(b).addSelf(f);i.copy(c).addSelf(g);f=d.dot(g);g=i.subSelf(h).dot(g);0===f&&(console.log("Either infinite or no solutions!"),0===g?console.log("Its finite solutions."):console.log("Too bad, no solutions."));g/=f;return0>g?(b=Math.atan2(b.y-a.y,b.x-a.x),a=Math.atan2(c.y-a.y,c.x-a.x),b>a&&(a+=2*Math.PI),c=(b+a)/2,a=-Math.cos(c),c=-Math.sin(c),newTHREE.Vector2(a,c)):d.multiplyScalar(g).addSelf(h).subSelf(a).clone()}functionf(a){for(y=a.length;0<=--y;){C=y;K=y-1;0>K&&(K=a.length-1);for(varb=
h.copy(b).addSelf(f);i.copy(c).addSelf(g);f=d.dot(g);g=i.subSelf(h).dot(g);0===f&&(console.log("Either infinite or no solutions!"),0===g?console.log("Its finite solutions."):console.log("Too bad, no solutions."));g/=f;return0>g?(b=Math.atan2(b.y-a.y,b.x-a.x),a=Math.atan2(c.y-a.y,c.x-a.x),b>a&&(a+=2*Math.PI),c=(b+a)/2,a=-Math.cos(c),c=-Math.sin(c),newTHREE.Vector2(a,c)):d.multiplyScalar(g).addSelf(h).subSelf(a).clone()}functionf(a){for(y=a.length;0<=--y;){C=y;L=y-1;0>L&&(L=a.length-1);for(varb=
(function(a){varb=function(a){for(varb=a.length,f=0,g=b-1,e=0;e<b;g=e++)f+=a[g].x*a[e].y-a[e].x*a[g].y;return0.5*f};a.Triangulate=function(a,d){varf=a.length;if(3>f)returnnull;varg=[],e=[],h=[],i,k,j;if(0<b(a))for(k=0;k<f;k++)e[k]=k;elsefor(k=0;k<f;k++)e[k]=f-1-k;varq=2*f;for(k=f-1;2<f;){if(0>=q--){console.log("Warning, unable to triangulate polygon!");break}i=k;f<=i&&(i=0);k=i+1;f<=k&&(k=0);j=k+1;f<=j&&(j=0);varl;a:{l=a;varn=i,r=k,m=j,o=f,p=e,s=void0,t=void0,u=void0,v=void0,w=void0,
(function(a){varb=function(a){for(varb=a.length,f=0,g=b-1,e=0;e<b;g=e++)f+=a[g].x*a[e].y-a[e].x*a[g].y;return0.5*f};a.Triangulate=function(a,d){varf=a.length;if(3>f)returnnull;varg=[],e=[],h=[],i,k,j;if(0<b(a))for(k=0;k<f;k++)e[k]=k;elsefor(k=0;k<f;k++)e[k]=f-1-k;varq=2*f;for(k=f-1;2<f;){if(0>=q--){console.log("Warning, unable to triangulate polygon!");break}i=k;f<=i&&(i=0);k=i+1;f<=k&&(k=0);j=k+1;f<=j&&(j=0);varl;a:{l=a;varn=i,r=k,m=j,p=f,o=e,s=void0,t=void0,u=void0,v=void0,w=void0,
p,A)):pinstanceofTHREE.Face4?(u=c(p.a,p.b),w=c(p.b,p.c),E=c(p.c,p.d),I=c(p.d,p.a),b(t,j[u],p.b,j[w],p,F),b(t,j[w],p.c,j[E],p,J),b(t,j[E],p.d,j[I],p,B),b(t,j[I],p.a,j[u],p,G)):console.log("face should be a face!",p);d=i;i=newTHREE.Vector3;j=newTHREE.Vector3;for(n=0,r=h.length;n<r;n++)if(void0!==z[n]){i.set(0,0,0);j.set(0,0,0);p=newTHREE.Vector3(0,0,0);t=0;for(minx[n])i.addSelf(k[m]),t++;u=0;s=z[n].length;for(m=0;m<s;m++)q[c(z[n][m][0],z[n][m][1])]&&u++;if(2!=u){i.divideScalar(t);for(m=0;m<
o,A)):oinstanceofTHREE.Face4?(u=c(o.a,o.b),w=c(o.b,o.c),E=c(o.c,o.d),J=c(o.d,o.a),b(t,j[u],o.b,j[w],o,F),b(t,j[w],o.c,j[E],o,G),b(t,j[E],o.d,j[J],o,B),b(t,j[J],o.a,j[u],o,H)):console.log("face should be a face!",o);d=i;i=newTHREE.Vector3;j=newTHREE.Vector3;for(n=0,r=h.length;n<r;n++)if(void0!==z[n]){i.set(0,0,0);j.set(0,0,0);o=newTHREE.Vector3(0,0,0);t=0;for(minx[n])i.addSelf(k[m]),t++;u=0;s=z[n].length;for(m=0;m<s;m++)q[c(z[n][m][0],z[n][m][1])]&&u++;if(2!=u){i.divideScalar(t);for(m=0;m<
n=x(a,D+20+4);r=x(a,D+20+8);b=x(a,D+20+12);m=x(a,D+20+16);o=x(a,D+20+20);p=x(a,D+20+24);s=x(a,D+20+28);t=x(a,D+20+32);u=x(a,D+20+36);v=x(a,D+20+40);"Three.js 003"!==c&&console.warn("DEPRECATED: binary model seems to be using old format");D+=f;c=3*i+q;C=4*i+q;f=b*c;L=m*(c+3*k);i=o*(c+3*j);q=p*(c+3*k+3*j);c=s*C;k=t*(C+4*k);j=u*(C+4*j);D+=function(b){varb=newFloat32Array(a,b,3*l),c,d,e,f;for(c=0;c<l;c++)d=b[3*c],e=b[3*c+1],f=b[3*c+2],G.vertices.push(newTHREE.Vertex(newTHREE.Vector3(d,e,f)));return3*
n=x(a,D+20+4);r=x(a,D+20+8);b=x(a,D+20+12);m=x(a,D+20+16);p=x(a,D+20+20);o=x(a,D+20+24);s=x(a,D+20+28);t=x(a,D+20+32);u=x(a,D+20+36);v=x(a,D+20+40);"Three.js 003"!==c&&console.warn("DEPRECATED: binary model seems to be using old format");D+=f;c=3*i+q;C=4*i+q;f=b*c;K=m*(c+3*k);i=p*(c+3*j);q=o*(c+3*k+3*j);c=s*C;k=t*(C+4*k);j=u*(C+4*j);D+=function(b){varb=newFloat32Array(a,b,3*l),c,d,e,f;for(c=0;c<l;c++)d=b[3*c],e=b[3*c+1],f=b[3*c+2],H.vertices.push(newTHREE.Vertex(newTHREE.Vector3(d,e,f)));return3*
sids:[]}]};e=0;for(f=a.children.length;e<f;e++)for(varb=0,g=c(a.children[e]).hierarchy.length;b<g;b++)d.hierarchy.push({keys:[],sids:[]});returnd}functiond(a,b,c,e){a.world=a.world||newTHREE.Matrix4;a.world.copy(a.matrix);if(a.channels&&a.channels.length){varf=a.channels[0].sampler.output[c];finstanceofTHREE.Matrix4&&a.world.copy(f)}e&&a.world.multiply(e,a.world);b.push(a);for(e=0;e<a.nodes.length;e++)d(a.nodes[e],b,c,a.world)}functionf(a,b,c){vare,f=U[b.url];if(!f||!f.skin)console.log("ColladaLoader: Could not find skin controller.");
elseif(!b.skeleton||!b.skeleton.length)console.log("ColladaLoader: Could not find the skeleton for the skin. ");else{varc=1E6,g=-c,h=0;for(einX)for(vari=X[e],j=0;j<i.sampler.length;j++){vark=i.sampler[j];k.create();c=Math.min(c,k.startTime);g=Math.max(g,k.endTime);h=Math.max(h,k.input.length)}e=h;for(varb=T.getChildById(b.skeleton[0],!0)||T.getChildBySid(b.skeleton[0],!0),m,l,g=newTHREE.Vector3,n,j=0;j<a.vertices.length;j++)f.skin.bindShapeMatrix.multiplyVector3(a.vertices[j].position);for(c=
0;c<e;c++){h=[];i=[];for(j=0;j<a.vertices.length;j++)i.push(newTHREE.Vertex(newTHREE.Vector3));d(b,h,c);j=h;k=f.skin;for(l=0;l<j.length;l++)if(m=j[l],n=-1,"JOINT"==m.type){for(varq=0;q<k.joints.length;q++)if(m.sid==k.joints[q]){n=q;break}if(0<=n){q=k.invBindMatrices[n];m.invBindMatrix=q;m.skinningMatrix=newTHREE.Matrix4;m.skinningMatrix.multiply(m.world,q);m.weights=[];for(q=0;q<k.weights.length;q++)for(varo=0;o<k.weights[q].length;o++){varp=k.weights[q][o];p.joint==n&&m.weights.push(p)}}elsethrow"ColladaLoader: Could not find joint '"+
...
...
@@ -255,10 +256,10 @@ new m;j.url=i.skin.source;j.instance_material=a.controllers[e].instance_material
l;for(h=0;h<i.faces.length;h++)l=i.faces[h],l.materialIndex=k[l.daeMaterial]}if(void0!==c)f(i,c),j.morphTargets=!0,j=newTHREE.SkinnedMesh(i,j),j.skeleton=c.skeleton,j.skinController=U[c.url],j.skinInstanceController=c,j.name="skin_"+ba.length,ba.push(j);elseif(void0!==d){h=i;k=dinstanceofn?U[d.url]:d;if(!k||!k.morph)console.log("could not find morph controller!");else{k=k.morph;for(l=0;l<k.targets.length;l++)if(q=V[k.targets[l]],q.mesh&&q.mesh.primitives&&q.mesh.primitives.length)q=q.mesh.primitives[0].geometry,
newy(o);s=-1;t=0;for(u=d.length;t<u&&-1==s;t++)d[t].time>=o&&(s=t);o=s;d.splice(-1==o?d.length:o,0,r)}r.addTarget(f,j,g,p)}}elseconsole.log('Could not find transform "'+b.sid+'" in node '+this.id)}for(c=0;c<a.length;c++){e=a[c];for(b=0;b<d.length;b++)if(r=d[b],!r.hasTarget(e)){h=d;f=r;j=b;g=e;i=void0;a:{i=j?j-1:0;for(i=0<=i?i:i+h.length;0<=i;i--)if(k=h[i],k.hasTarget(g)){i=k;breaka}i=null}k=void0;a:{for(j+=1;j<h.length;j++)if(k=h[j],k.hasTarget(g))breaka;k=null}if(i&&k){h=(f.time-i.time)/(k.time-
returnthis};l.prototype.convert=function(){switch(this.type){case"matrix":this.obj=ca(this.data);break;case"rotate":this.angle=this.data[3]*ja;case"translate":P(this.data,-1);this.obj=newTHREE.Vector3(this.data[0],this.data[1],this.data[2]);break;case"scale":P(this.data,1);this.obj=newTHREE.Vector3(this.data[0],this.data[1],this.data[2]);break;default:console.log("Can not convert Transform of type "+this.type)}};l.prototype.apply=function(a){switch(this.type){case"matrix":a.multiplySelf(this.obj);
break;case"translate":a.translate(this.obj);break;case"rotate":a.rotateByAxis(this.obj,this.angle);break;case"scale":a.scale(this.obj)}};l.prototype.update=function(a,b){switch(this.type){case"matrix":console.log("Currently not handling matrix transform updates");break;case"translate":case"scale":switch(b){case"X":this.obj.x=a;break;case"Y":this.obj.y=a;break;case"Z":this.obj.z=a;break;default:this.obj.x=a[0],this.obj.y=a[1],this.obj.z=a[2]}break;case"rotate":switch(b){case"X":this.obj.x=
switch(c.nodeName){case"source":vard=c.getAttribute("id");void0==Z[d]&&(Z[d]=(newz(d)).parse(c));break;case"vertices":this.vertices=(newv).parse(c);break;case"triangles":this.primitives.push((newt).parse(c));break;case"polygons":console.warn("polygon holes not yet supported!");case"polylist":this.primitives.push((news).parse(c))}}this.geometry3js=newTHREE.Geometry;a=Z[this.vertices.input.POSITION.source].data;for(b=0;b<a.length;b+=3)this.geometry3js.vertices.push(newTHREE.Vertex(ka(a,
(b.faceVertexUvs[e]=[]),b.faceVertexUvs[e].push(s)}}elseconsole.log("dropped face with vcount "+m+" for geometry with id: "+b.id);c+=n*m}};s.prototype=newt;s.prototype.constructor=s;t.prototype.setVertices=function(a){for(varb=0;b<this.inputs.length;b++)if(this.inputs[b].source==a.id)this.inputs[b].source=a.input.POSITION.source};t.prototype.parse=function(a){this.inputs=[];this.material=a.getAttribute("material");this.count=O(a,"count",0);for(varb=0;b<a.childNodes.length;b++){varc=a.childNodes[b];
(a.time-this.time),g=e.data,h=d.data;if(0>f||1<f)console.log("Key.interpolate: Warning! Scale out of bounds:"+f),f=0>f?0:1;if(h.length)for(vare=[],i=0;i<h.length;++i)e[i]=h[i]+(g[i]-h[i])*f;elsee=h+(g-h)*f}elsee=d.data;d.transform.update(e,d.member)}};L.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");for(varb=0;b<a.childNodes.length;b++){varc=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case"optics":this.parseOptics(c)}}returnthis};L.prototype.parseOptics=
(a.time-this.time),g=e.data,h=d.data;if(0>f||1<f)console.log("Key.interpolate: Warning! Scale out of bounds:"+f),f=0>f?0:1;if(h.length)for(vare=[],i=0;i<h.length;++i)e[i]=h[i]+(g[i]-h[i])*f;elsee=h+(g-h)*f}elsee=d.data;d.transform.update(e,d.member)}};K.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");for(varb=0;b<a.childNodes.length;b++){varc=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case"optics":this.parseOptics(c)}}returnthis};K.prototype.parseOptics=
a.getAttribute("url").replace(/^#/,"");returnthis};return{load:function(b,c,d){vare=0;if(document.implementation&&document.implementation.createDocument){varf=newXMLHttpRequest;f.overrideMimeType&&f.overrideMimeType("text/xml");f.onreadystatechange=function(){if(4==f.readyState){if(0==f.status||200==f.status)f.responseXML?(la=c,a(f.responseXML,void0,b)):console.error("ColladaLoader: Empty or non-existing file ("+b+")")}else3==f.readyState&&d&&(0==e&&(e=f.getResponseHeader("Content-Length")),
d({total:e,loaded:f.responseText.length}))};f.open("GET",b,!0);f.send(null)}elsealert("Don't know how to parse XML!")},parse:a,setPreferredShading:function(a){na=a},applySkin:f,geometries:V,options:R}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=newTHREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;
THREE.JSONLoader.prototype.load=function(a,b,c){if(ainstanceofObject)console.warn("DEPRECATED: JSONLoader( parameters ) is now JSONLoader( url, callback, texturePath )."),c=a,a=c.model,b=c.callback,c=c.texture_path;c=c?c:this.extractUrlbase(a);this.onLoadStart();this.loadAjaxJSON(this,a,b,c)};
THREE.JSONLoader.prototype.loadAjaxJSON=function(a,b,c,d,f){varg=newXMLHttpRequest,e=0;g.onreadystatechange=function(){if(4==g.readyState)if(200==g.status||0==g.status){try{varh=JSON.parse(g.responseText)}catch(i){console.warn("DEPRECATED: ["+b+"] seems to be using old model format")}a.createModel(h,c,d);a.onLoadComplete()}elseconsole.error("Couldn't load ["+b+"] ["+g.status+"]");else3==g.readyState?f&&(0==e&&(e=g.getResponseHeader("Content-Length")),f({total:e,loaded:g.responseText.length})):
THREE.SceneLoader.prototype.load=function(a,b){varc=this,d=newXMLHttpRequest;d.onreadystatechange=function(){if(4==d.readyState)if(200==d.status||0==d.status)try{varf=JSON.parse(d.responseText);void0===f.metadata||void0===f.metadata.formatVersion||3!==f.metadata.formatVersion?console.error("Deprecated file format."):c.createScene(f,b,a)}catch(g){console.error(g),console.warn("DEPRECATED: ["+a+"] seems to be using old model format")}elseconsole.error("Couldn't load ["+a+"] ["+d.status+"]")};
else{console.error("Unsupported light type for shadow");continue}i.add(l.shadowCamera);b.autoUpdateScene&&i.updateMatrixWorld()}if(l.shadowCameraVisible&&!l.cameraHelper)l.cameraHelper=newTHREE.CameraHelper(l.shadowCamera),l.shadowCamera.add(l.cameraHelper);if(l.isVirtual&&u.originalCamera==k){r=k;n=l.shadowCamera;m=l.pointsFrustum;s=l.pointsWorld;e.set(Infinity,Infinity,Infinity);h.set(-Infinity,-Infinity,-Infinity);for(o=0;8>o;o++){p=s[o];p.copy(m[o]);THREE.ShadowMapPlugin.__projector.unprojectVector(p,
else{console.error("Unsupported light type for shadow");continue}i.add(l.shadowCamera);b.autoUpdateScene&&i.updateMatrixWorld()}if(l.shadowCameraVisible&&!l.cameraHelper)l.cameraHelper=newTHREE.CameraHelper(l.shadowCamera),l.shadowCamera.add(l.cameraHelper);if(l.isVirtual&&u.originalCamera==k){r=k;n=l.shadowCamera;m=l.pointsFrustum;s=l.pointsWorld;e.set(Infinity,Infinity,Infinity);h.set(-Infinity,-Infinity,-Infinity);for(p=0;8>p;p++){o=s[p];o.copy(m[p]);THREE.ShadowMapPlugin.__projector.unprojectVector(o,