o)}l.prevKey[c]=f;l.nextKey[c]=k}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;e=(o-f.time)/(k.time-f.time);h=f[c];g=k[c];if(e<0||e>1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+e+" on bone "+t),e=e<0?0:1;if(c==="pos")if(c=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)c.x=h[0]+(g[0]-h[0])*e,c.y=h[1]+(g[1]-h[1])*e,c.z=h[2]+(g[2]-h[2])*e;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
o)}l.prevKey[c]=f;l.nextKey[c]=k}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;e=(o-f.time)/(k.time-f.time);h=f[c];g=k[c];if(e<0||e>1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+e+" on bone "+p),e=e<0?0:1;if(c==="pos")if(c=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)c.x=h[0]+(g[0]-h[0])*e,c.y=h[1]+(g[1]-h[1])*e,c.z=h[2]+(g[2]-h[2])*e;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
k.copy(c).addSelf(g);l.copy(b).addSelf(h);g=e.dot(h);h=l.subSelf(k).dot(h);g==0&&(console.log("Either infinite or no solutions!"),h==0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));h/=g;if(h<0)returnc=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,newTHREE.Vector2(-Math.cos(anglec),-Math.sin(anglec));returne.multiplyScalar(h).addSelf(k).subSelf(a).clone()}functionh(a){for(B=a.length;--B>=0;){T=B;R=B-1;R<0&&(R=a.length-
(function(a){varb=function(a){for(varb=a.length,h=0,g=b-1,f=0;f<b;g=f++)h+=a[g].x*a[f].y-a[f].x*a[g].y;returnh*0.5};a.Triangulate=function(a,e){varh=a.length;if(h<3)returnnull;varg=[],f=[],k=[],l,m,n;if(b(a)>0)for(m=0;m<h;m++)f[m]=m;elsefor(m=0;m<h;m++)f[m]=h-1-m;varo=2*h;for(m=h-1;h>2;){if(o--<=0){console.log("Warning, unable to triangulate polygon!");if(e)returnk;returng}l=m;h<=l&&(l=0);m=l+1;h<=m&&(m=0);n=m+1;h<=n&&(n=0);varp;a:{p=a;vart=l,x=m,v=n,u=h,z=f,y=void0,w=void0,A=void0,
(function(a){varb=function(a){for(varb=a.length,h=0,g=b-1,f=0;f<b;g=f++)h+=a[g].x*a[f].y-a[f].x*a[g].y;returnh*0.5};a.Triangulate=function(a,e){varh=a.length;if(h<3)returnnull;varg=[],f=[],k=[],l,m,n;if(b(a)>0)for(m=0;m<h;m++)f[m]=m;elsefor(m=0;m<h;m++)f[m]=h-1-m;varo=2*h;for(m=h-1;h>2;){if(o--<=0){console.log("Warning, unable to triangulate polygon!");if(e)returnk;returng}l=m;h<=l&&(l=0);m=l+1;h<=m&&(m=0);n=m+1;h<=n&&(n=0);vart;a:{t=a;varp=l,x=m,v=n,u=h,z=f,y=void0,w=void0,A=void0,
a.world.copy(a.matrix);if(a.channels&&a.channels.length){varg=a.channels[0].sampler.output[e];ginstanceofTHREE.Matrix4&&a.world.copy(g)}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)}functione(a,e,f){varg=aa[e.url];if(!g||!g.skin)console.log("could not find skin controller!");elseif(!e.skeleton||!e.skeleton.length)console.log("could not find the skeleton for the skin!");else{varh=b(),e=X.getChildById(e.skeleton[0],!0)||X.getChildBySid(e.skeleton[0],
for(u=0;u<l.weights.length;u++)for(varx=0;x<l.weights[u].length;x++){varw=l.weights[u][x];w.joint==p&&m.weights.push(w)}}elsethrow"could not find joint!";}for(k=0;k<t.length;k++)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=v[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:v})}}}functionh(a){varc=newTHREE.Object3D,
t.material;n++}l=o||newTHREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});k=k.mesh.geometry3js;if(n>1){l=newTHREE.MeshFaceMaterial;for(j=0;j<k.faces.length;j++)n=k.faces[j],n.materials=[m[n.daeMaterial]]}if(b!==void0)e(k,b),l.morphTargets=!0,l=newTHREE.SkinnedMesh(k,l),l.skeleton=b.skeleton,l.skinController=aa[b.url],l.skinInstanceController=b,l.name="skin_"+da.length,da.push(l);elseif(f!==void0){m=k;n=finstanceofp?aa[f.url]:f;if(!n||!n.morph)console.log("could not find morph controller!");
p.material;n++}l=o||newTHREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});k=k.mesh.geometry3js;if(n>1){l=newTHREE.MeshFaceMaterial;for(j=0;j<k.faces.length;j++)n=k.faces[j],n.materials=[m[n.daeMaterial]]}if(b!==void0)e(k,b),l.morphTargets=!0,l=newTHREE.SkinnedMesh(k,l),l.skeleton=b.skeleton,l.skinController=aa[b.url],l.skinInstanceController=b,l.name="skin_"+da.length,da.push(l);elseif(f!==void0){m=k;n=finstanceoft?aa[f.url]:f;if(!n||!n.morph)console.log("could not find morph controller!");
(newA).parse(e);break;case"triangles":this.primitives.push((newy).parse(e));break;case"polygons":console.warn("polygon holes not yet supported!");case"polylist":this.primitives.push((newz).parse(e))}}varf={};this.geometry3js=newTHREE.Geometry;e=Y[this.vertices.input.POSITION.source].data;for(a=b=0;b<e.length;b+=3,a++){varg=newTHREE.Vertex(newTHREE.Vector3(e[b],e[b+1],e[b+2]));c(g,a);this.geometry3js.vertices.push(g)}for(b=0;b<this.primitives.length;b++)primitive=this.primitives[b],primitive.setVertices(this.vertices),
X=null;Z=newTHREE.Object3D;for(n=0;n<X.nodes.length;n++)Z.addChild(h(X.nodes[n]));b();for(varoinV);o={scene:Z,morphs:ca,skins:da,dae:{images:$,materials:ea,effects:fa,geometries:ba,controllers:aa,animations:V,visualScenes:ga,scene:X}};l&&l(o)}};k.open("GET",c,!0);k.send(null)}elsealert("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=newTHREE.Loader;