提交 50658bd4 编写于 作者: M Mr.doob

Fixed missing "};". Updated builds.

上级 f4c2a0e5
因为 它太大了无法显示 source diff 。你可以改为 查看blob
// ThreeCanvas.js r47 - http://github.com/mrdoob/three.js
// ThreeCanvas.js r48dev - http://github.com/mrdoob/three.js
'use strict';var THREE=THREE||{};if(!self.Int32Array)self.Int32Array=Array,self.Float32Array=Array;
(function(){for(var a=0,b=["ms","moz","webkit","o"],c=0;c<b.length&&!window.requestAnimationFrame;++c)window.requestAnimationFrame=window[b[c]+"RequestAnimationFrame"],window.cancelAnimationFrame=window[b[c]+"CancelAnimationFrame"]||window[b[c]+"RequestCancelAnimationFrame"];if(!window.requestAnimationFrame)window.requestAnimationFrame=function(b){var c=(new Date).getTime(),f=Math.max(0,16-(c-a)),g=window.setTimeout(function(){b(c+f)},f);a=c+f;return g};if(!window.cancelAnimationFrame)window.cancelAnimationFrame=
function(a){clearTimeout(a)}})();THREE.Color=function(a){void 0!==a&&this.setHex(a);return this};
......
// ThreeDOM.js r47 - http://github.com/mrdoob/three.js
// ThreeDOM.js r48dev - http://github.com/mrdoob/three.js
'use strict';var THREE=THREE||{};if(!self.Int32Array)self.Int32Array=Array,self.Float32Array=Array;
(function(){for(var a=0,b=["ms","moz","webkit","o"],c=0;c<b.length&&!window.requestAnimationFrame;++c)window.requestAnimationFrame=window[b[c]+"RequestAnimationFrame"],window.cancelAnimationFrame=window[b[c]+"CancelAnimationFrame"]||window[b[c]+"RequestCancelAnimationFrame"];if(!window.requestAnimationFrame)window.requestAnimationFrame=function(b){var c=(new Date).getTime(),f=Math.max(0,16-(c-a)),g=window.setTimeout(function(){b(c+f)},f);a=c+f;return g};if(!window.cancelAnimationFrame)window.cancelAnimationFrame=
function(a){clearTimeout(a)}})();THREE.Color=function(a){void 0!==a&&this.setHex(a);return this};
......
// ThreeExtras.js r47 - http://github.com/mrdoob/three.js
// ThreeExtras.js r48dev - http://github.com/mrdoob/three.js
'use strict';THREE.ColorUtils={adjustHSV:function(a,b,c,d){var f=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(a,f);f.h=THREE.Math.clamp(f.h+b,0,1);f.s=THREE.Math.clamp(f.s+c,0,1);f.v=THREE.Math.clamp(f.v+d,0,1);a.setHSV(f.h,f.s,f.v)},rgbToHsv:function(a,b){var c=a.r,d=a.g,f=a.b,g=Math.max(Math.max(c,d),f),e=Math.min(Math.min(c,d),f);if(e===g)e=c=0;else{var h=g-e,e=h/g,c=(c===g?(d-f)/h:d===g?2+(f-c)/h:4+(c-d)/h)/6;0>c&&(c+=1);1<c&&(c-=1)}void 0===b&&(b={h:0,s:0,v:0});b.h=c;b.s=e;b.v=g;return b}};
THREE.ColorUtils.__hsv={h:0,s:0,v:0};
THREE.GeometryUtils={merge:function(a,b){for(var c,d,f=a.vertices.length,g=b instanceof THREE.Mesh?b.geometry:b,e=a.vertices,h=g.vertices,i=a.faces,k=g.faces,j=a.faceVertexUvs[0],m=g.faceVertexUvs[0],p={},n=0;n<a.materials.length;n++)p[a.materials[n].id]=n;if(b instanceof THREE.Mesh)b.matrixAutoUpdate&&b.updateMatrix(),c=b.matrix,d=new THREE.Matrix4,d.extractRotation(c,b.scale);for(var n=0,l=h.length;n<l;n++){var o=new THREE.Vertex(h[n].position.clone());c&&c.multiplyVector3(o.position);e.push(o)}for(n=
......@@ -156,7 +156,7 @@ c.target.addSelf(b);c.staticMoving?j=m:j.addSelf(a.sub(m,j).multiplyScalar(c.dyn
c.object.position.add(c.target,g);c.checkDistances();c.object.lookAt(c.target)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){c.enabled&&(d&&(e=h=c.getMouseProjectionOnBall(a.clientX,a.clientY),i=k=c.getMouseOnScreen(a.clientX,a.clientY),j=m=c.getMouseOnScreen(a.clientX,a.clientY),d=!1),-1!==f&&(0===f&&!c.noRotate?h=c.getMouseProjectionOnBall(a.clientX,a.clientY):1===f&&!c.noZoom?k=c.getMouseOnScreen(a.clientX,
a.clientY):2===f&&!c.noPan&&(m=c.getMouseOnScreen(a.clientX,a.clientY))))},!1);this.domElement.addEventListener("mousedown",function(a){if(c.enabled&&(a.preventDefault(),a.stopPropagation(),-1===f))f=a.button,0===f&&!c.noRotate?e=h=c.getMouseProjectionOnBall(a.clientX,a.clientY):1===f&&!c.noZoom?i=k=c.getMouseOnScreen(a.clientX,a.clientY):this.noPan||(j=m=c.getMouseOnScreen(a.clientX,a.clientY))},!1);this.domElement.addEventListener("mouseup",function(a){c.enabled&&(a.preventDefault(),a.stopPropagation(),
f=-1)},!1);window.addEventListener("keydown",function(a){c.enabled&&-1===f&&(a.keyCode===c.keys[0]&&!c.noRotate?f=0:a.keyCode===c.keys[1]&&!c.noZoom?f=1:a.keyCode===c.keys[2]&&!c.noPan&&(f=2),-1!==f&&(d=!0))},!1);window.addEventListener("keyup",function(){c.enabled&&-1!==f&&(f=-1)},!1)};
THREE.CubeGeometry=function(a,b,c,d,f,g,e,h){function i(a,b,c,e,h,i,j,m){var l,p=d||1,o=f||1,n=h/2,r=i/2,q=k.vertices.length;if("x"===a&&"y"===b||"y"===a&&"x"===b)l="z";else if("x"===a&&"z"===b||"z"===a&&"x"===b)l="y",o=g||1;else if("z"===a&&"y"===b||"y"===a&&"z"===b)l="x",p=g||1;var s=p+1,t=o+1,C=h/p,L=i/o,N=new THREE.Vector3;N[l]=0<j?1:-1;for(h=0;h<t;h++)for(i=0;i<s;i++){var M=new THREE.Vector3;M[a]=(i*C-n)*c;M[b]=(h*L-r)*e;M[l]=j;k.vertices.push(new THREE.Vertex(M))}for(h=0;h<o;h++)for(i=0;i<p;i++)a=
THREE.CubeGeometry=function(a,b,c,d,f,g,e,h){function i(a,b,c,e,h,i,j,m){var l,p=d||1,o=f||1,n=h/2,r=i/2,q=k.vertices.length;if("x"===a&&"y"===b||"y"===a&&"x"===b)l="z";else if("x"===a&&"z"===b||"z"===a&&"x"===b)l="y",o=g||1;else if("z"===a&&"y"===b||"y"===a&&"z"===b)l="x",p=g||1;var s=p+1,t=o+1,C=h/p,K=i/o,N=new THREE.Vector3;N[l]=0<j?1:-1;for(h=0;h<t;h++)for(i=0;i<s;i++){var M=new THREE.Vector3;M[a]=(i*C-n)*c;M[b]=(h*K-r)*e;M[l]=j;k.vertices.push(new THREE.Vertex(M))}for(h=0;h<o;h++)for(i=0;i<p;i++)a=
new THREE.Face4(i+s*h+q,i+s*(h+1)+q,i+1+s*(h+1)+q,i+1+s*h+q),a.normal.copy(N),a.vertexNormals.push(N.clone(),N.clone(),N.clone(),N.clone()),a.materialIndex=m,k.faces.push(a),k.faceVertexUvs[0].push([new THREE.UV(i/p,h/o),new THREE.UV(i/p,(h+1)/o),new THREE.UV((i+1)/p,(h+1)/o),new THREE.UV((i+1)/p,h/o)])}THREE.Geometry.call(this);var k=this,j=a/2,m=b/2,p=c/2,n,l,o,q,r,s;if(void 0!==e){if(e instanceof Array)this.materials=e;else{this.materials=[];for(n=0;6>n;n++)this.materials.push(e)}n=0;q=1;l=2;r=
3;o=4;s=5}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(void 0!=h)for(var t in h)void 0!==this.sides[t]&&(this.sides[t]=h[t]);this.sides.px&&i("z","y",-1,-1,c,b,j,n);this.sides.nx&&i("z","y",1,-1,c,b,-j,q);this.sides.py&&i("x","z",1,1,a,c,m,l);this.sides.ny&&i("x","z",1,-1,a,c,-m,r);this.sides.pz&&i("x","y",1,-1,a,b,p,o);this.sides.nz&&i("x","y",-1,-1,a,b,-p,s);this.computeCentroids();this.mergeVertices()};THREE.CubeGeometry.prototype=new THREE.Geometry;
THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
......@@ -166,13 +166,13 @@ p=k[i+1][h+1],n=k[i][h+1],l=this.vertices[c].position.clone().setY(0).normalize(
0),s=j[i][h+1].clone(),t=j[i][h].clone(),v=new THREE.UV(t.u,1),this.faces.push(new THREE.Face3(c,m,p,[l,o,q])),this.faceVertexUvs[0].push([s,t,v])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
THREE.ExtrudeGeometry=function(a,b){if("undefined"!==typeof a){THREE.Geometry.call(this);var a=a instanceof Array?a:[a],c,d,f=a.length;this.shapebb=a[f-1].getBoundingBox();for(d=0;d<f;d++)c=a[d],this.addShape(c,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,b,c){b||console.log("die");return b.clone().multiplyScalar(c).addSelf(a)}function d(a,b,c){var d=THREE.ExtrudeGeometry.__v1,e=THREE.ExtrudeGeometry.__v2,f=THREE.ExtrudeGeometry.__v3,g=THREE.ExtrudeGeometry.__v4,h=THREE.ExtrudeGeometry.__v5,i=THREE.ExtrudeGeometry.__v6;d.set(a.x-b.x,a.y-b.y);e.set(a.x-c.x,a.y-c.y);d=d.normalize();e=e.normalize();f.set(-d.y,d.x);g.set(e.y,-e.x);h.copy(a).addSelf(f);i.copy(a).addSelf(g);if(h.equals(i))return g.clone();
h.copy(b).addSelf(f);i.copy(c).addSelf(g);f=d.dot(g);g=i.subSelf(h).dot(g);0===f&&(console.log("Either infinite or no solutions!"),0===g?console.log("Its finite solutions."):console.log("Too bad, no solutions."));g/=f;return 0>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),new THREE.Vector2(a,c)):d.multiplyScalar(g).addSelf(h).subSelf(a).clone()}function f(a){for(y=a.length;0<=--y;){C=y;L=y-1;0>L&&(L=a.length-1);for(var b=
0,c=n+2*j,b=0;b<c;b++){var d=G*b,e=G*(b+1),f=R+C+d,g=R+C+e,k=f,d=R+L+d,e=R+L+e,m=g,k=k+F,d=d+F,e=e+F,m=m+F;A.faces.push(new THREE.Face4(k,d,e,m,null,null,v));void 0!==v&&(k=b/c,d=(b+1)/c,e=h+2*i,f=(A.vertices[f].position.z+i)/e,g=(A.vertices[g].position.z+i)/e,A.faceVertexUvs[0].push([new THREE.UV(f,k),new THREE.UV(g,k),new THREE.UV(g,d),new THREE.UV(f,d)]))}}}function g(a,b,c){A.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function e(a,b,c){a+=F;b+=F;c+=F;A.faces.push(new THREE.Face3(a,
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;return 0>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),new THREE.Vector2(a,c)):d.multiplyScalar(g).addSelf(h).subSelf(a).clone()}function f(a){for(y=a.length;0<=--y;){C=y;K=y-1;0>K&&(K=a.length-1);for(var b=
0,c=n+2*j,b=0;b<c;b++){var d=G*b,e=G*(b+1),f=O+C+d,g=O+C+e,k=f,d=O+K+d,e=O+K+e,m=g,k=k+F,d=d+F,e=e+F,m=m+F;A.faces.push(new THREE.Face4(k,d,e,m,null,null,v));void 0!==v&&(k=b/c,d=(b+1)/c,e=h+2*i,f=(A.vertices[f].position.z+i)/e,g=(A.vertices[g].position.z+i)/e,A.faceVertexUvs[0].push([new THREE.UV(f,k),new THREE.UV(g,k),new THREE.UV(g,d),new THREE.UV(f,d)]))}}}function g(a,b,c){A.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function e(a,b,c){a+=F;b+=F;c+=F;A.faces.push(new THREE.Face3(a,
b,c,null,null,t));if(void 0!==t){var d=u.minX,e=u.minY,f=u.maxY,g=u.maxX,h=A.vertices[b].position.x-d,b=A.vertices[b].position.y-e,i=A.vertices[c].position.x-d,c=A.vertices[c].position.y-e;A.faceVertexUvs[0].push([new THREE.UV((A.vertices[a].position.x-d)/g,(A.vertices[a].position.y-e)/f),new THREE.UV(h/g,b/f),new THREE.UV(i/g,c/f)])}}var h=void 0!==b.amount?b.amount:100,i=void 0!==b.bevelThickness?b.bevelThickness:6,k=void 0!==b.bevelSize?b.bevelSize:i-2,j=void 0!==b.bevelSegments?b.bevelSegments:
3,m=void 0!==b.bevelEnabled?b.bevelEnabled:!0,p=void 0!==b.curveSegments?b.curveSegments:12,n=void 0!==b.steps?b.steps:1,l=b.bendPath,o=b.extrudePath,q,r=!1,s=void 0!==b.useSpacedPoints?b.useSpacedPoints:!1,t=b.material,v=b.extrudeMaterial,u=this.shapebb;if(o)q=o.getPoints(p),n=q.length,r=!0,m=!1;m||(k=i=j=0);var w,z,x,A=this,F=this.vertices.length;l&&a.addWrapPath(l);p=s?a.extractAllSpacedPoints(p):a.extractAllPoints(p);l=p.shape;p=p.holes;if(o=!THREE.Shape.Utils.isClockWise(l)){l=l.reverse();for(z=
0,x=p.length;z<x;z++)w=p[z],THREE.Shape.Utils.isClockWise(w)&&(p[z]=w.reverse());o=!1}o=THREE.Shape.Utils.triangulateShape(l,p);s=l;for(z=0,x=p.length;z<x;z++)w=p[z],l=l.concat(w);for(var E,I,J,B,G=l.length,D=o.length,H=[],y=0,K=s.length,C=K-1,L=y+1;y<K;y++,C++,L++)C===K&&(C=0),L===K&&(L=0),H[y]=d(s[y],s[C],s[L]);var N=[],M,O=H.concat();for(z=0,x=p.length;z<x;z++){w=p[z];M=[];for(y=0,K=w.length,C=K-1,L=y+1;y<K;y++,C++,L++)C===K&&(C=0),L===K&&(L=0),M[y]=d(w[y],w[C],w[L]);N.push(M);O=O.concat(M)}for(E=
0;E<j;E++){I=E/j;J=i*(1-I);I=k*Math.sin(I*Math.PI/2);for(y=0,K=s.length;y<K;y++)B=c(s[y],H[y],I),g(B.x,B.y,-J);for(z=0,x=p.length;z<x;z++){w=p[z];M=N[z];for(y=0,K=w.length;y<K;y++)B=c(w[y],M[y],I),g(B.x,B.y,-J)}}I=k;for(y=0;y<G;y++)B=m?c(l[y],O[y],I):l[y],r?g(B.x,B.y+q[0].y,q[0].x):g(B.x,B.y,0);for(E=1;E<=n;E++)for(y=0;y<G;y++)B=m?c(l[y],O[y],I):l[y],r?g(B.x,B.y+q[E-1].y,q[E-1].x):g(B.x,B.y,h/n*E);for(E=j-1;0<=E;E--){I=E/j;J=i*(1-I);I=k*Math.sin(I*Math.PI/2);for(y=0,K=s.length;y<K;y++)B=c(s[y],H[y],
I),g(B.x,B.y,h+J);for(z=0,x=p.length;z<x;z++){w=p[z];M=N[z];for(y=0,K=w.length;y<K;y++)B=c(w[y],M[y],I),r?g(B.x,B.y+q[n-1].y,q[n-1].x+J):g(B.x,B.y,h+J)}}if(m){m=0*G;for(y=0;y<D;y++)k=o[y],e(k[2]+m,k[1]+m,k[0]+m);m=G*(n+2*j);for(y=0;y<D;y++)k=o[y],e(k[0]+m,k[1]+m,k[2]+m)}else{for(y=0;y<D;y++)k=o[y],e(k[2],k[1],k[0]);for(y=0;y<D;y++)k=o[y],e(k[0]+G*n,k[1]+G*n,k[2]+G*n)}var R=0;f(s);R+=s.length;for(z=0,x=p.length;z<x;z++)w=p[z],f(w),R+=w.length};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;
0,x=p.length;z<x;z++)w=p[z],THREE.Shape.Utils.isClockWise(w)&&(p[z]=w.reverse());o=!1}o=THREE.Shape.Utils.triangulateShape(l,p);s=l;for(z=0,x=p.length;z<x;z++)w=p[z],l=l.concat(w);for(var E,I,J,B,G=l.length,D=o.length,H=[],y=0,L=s.length,C=L-1,K=y+1;y<L;y++,C++,K++)C===L&&(C=0),K===L&&(K=0),H[y]=d(s[y],s[C],s[K]);var N=[],M,S=H.concat();for(z=0,x=p.length;z<x;z++){w=p[z];M=[];for(y=0,L=w.length,C=L-1,K=y+1;y<L;y++,C++,K++)C===L&&(C=0),K===L&&(K=0),M[y]=d(w[y],w[C],w[K]);N.push(M);S=S.concat(M)}for(E=
0;E<j;E++){I=E/j;J=i*(1-I);I=k*Math.sin(I*Math.PI/2);for(y=0,L=s.length;y<L;y++)B=c(s[y],H[y],I),g(B.x,B.y,-J);for(z=0,x=p.length;z<x;z++){w=p[z];M=N[z];for(y=0,L=w.length;y<L;y++)B=c(w[y],M[y],I),g(B.x,B.y,-J)}}I=k;for(y=0;y<G;y++)B=m?c(l[y],S[y],I):l[y],r?g(B.x,B.y+q[0].y,q[0].x):g(B.x,B.y,0);for(E=1;E<=n;E++)for(y=0;y<G;y++)B=m?c(l[y],S[y],I):l[y],r?g(B.x,B.y+q[E-1].y,q[E-1].x):g(B.x,B.y,h/n*E);for(E=j-1;0<=E;E--){I=E/j;J=i*(1-I);I=k*Math.sin(I*Math.PI/2);for(y=0,L=s.length;y<L;y++)B=c(s[y],H[y],
I),g(B.x,B.y,h+J);for(z=0,x=p.length;z<x;z++){w=p[z];M=N[z];for(y=0,L=w.length;y<L;y++)B=c(w[y],M[y],I),r?g(B.x,B.y+q[n-1].y,q[n-1].x+J):g(B.x,B.y,h+J)}}if(m){m=0*G;for(y=0;y<D;y++)k=o[y],e(k[2]+m,k[1]+m,k[0]+m);m=G*(n+2*j);for(y=0;y<D;y++)k=o[y],e(k[0]+m,k[1]+m,k[2]+m)}else{for(y=0;y<D;y++)k=o[y],e(k[2],k[1],k[0]);for(y=0;y<D;y++)k=o[y],e(k[0]+G*n,k[1]+G*n,k[2]+G*n)}var O=0;f(s);O+=s.length;for(z=0,x=p.length;z<x;z++)w=p[z],f(w),O+=w.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,b,c){var d=Math.sqrt(a*a+b*b+c*c);return f.vertices.push(new THREE.Vertex(new THREE.Vector3(a/d,b/d,c/d)))-1}function c(a,b,c,d){var e=f.vertices[a].position,g=f.vertices[b].position,h=f.vertices[c].position,a=new THREE.Face3(a,b,c);a.vertexNormals.push(e.clone().normalize(),g.clone().normalize(),h.clone().normalize());d.faces.push(a);d.faceVertexUvs[0].push([new THREE.UV(1-0.5*((Math.atan2(e.z,e.x)+Math.PI)%Math.PI/Math.PI),0.5-e.y/2),new THREE.UV(1-
0.5*((Math.atan2(g.z,g.x)+Math.PI)%Math.PI/Math.PI),0.5-g.y/2),new THREE.UV(1-0.5*((Math.atan2(h.z,h.x)+Math.PI)%Math.PI/Math.PI),0.5-h.y/2)])}function d(a,c){var d=f.vertices[a].position,e=f.vertices[c].position;return b((d.x+e.x)/2,(d.y+e.y)/2,(d.z+e.z)/2)}var f=this,g=new THREE.Geometry;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;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,g);c(0,5,1,
......@@ -196,7 +196,7 @@ THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:
j));f.lineTo(i,j);break;case "q":i=b[a++]*c+d;j=b[a++]*c;n=b[a++]*c+d;l=b[a++]*c;f.quadraticCurveTo(n,l,i,j);if(e=g[g.length-1]){m=e.x;p=e.y;for(e=1,h=this.divisions;e<=h;e++){var s=e/h,t=THREE.Shape.Utils.b2(s,m,n,i),s=THREE.Shape.Utils.b2(s,p,l,j);g.push(new THREE.Vector2(t,s))}}break;case "b":if(i=b[a++]*c+d,j=b[a++]*c,n=b[a++]*c+d,l=b[a++]*-c,o=b[a++]*c+d,q=b[a++]*-c,f.bezierCurveTo(i,j,n,l,o,q),e=g[g.length-1]){m=e.x;p=e.y;for(e=1,h=this.divisions;e<=h;e++)s=e/h,t=THREE.Shape.Utils.b3(s,m,n,
o,i),s=THREE.Shape.Utils.b3(s,p,l,q,j),g.push(new THREE.Vector2(t,s))}}}return{offset:r.ha*c,points:g,path:f}}}};
(function(a){var b=function(a){for(var b=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;return 0.5*f};a.Triangulate=function(a,d){var f=a.length;if(3>f)return null;var g=[],e=[],h=[],i,k,j;if(0<b(a))for(k=0;k<f;k++)e[k]=k;else for(k=0;k<f;k++)e[k]=f-1-k;var m=2*f;for(k=f-1;2<f;){if(0>=m--){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);var p;a:{p=a;var n=i,l=k,o=j,q=f,r=e,s=void 0,t=void 0,v=void 0,u=void 0,w=void 0,
z=void 0,x=void 0,A=void 0,F=void 0,t=p[r[n]].x,v=p[r[n]].y,u=p[r[l]].x,w=p[r[l]].y,z=p[r[o]].x,x=p[r[o]].y;if(1.0E-10>(u-t)*(x-v)-(w-v)*(z-t))p=!1;else{for(s=0;s<q;s++)if(!(s==n||s==l||s==o)){var A=p[r[s]].x,F=p[r[s]].y,E=void 0,I=void 0,J=void 0,B=void 0,G=void 0,D=void 0,H=void 0,y=void 0,K=void 0,C=void 0,L=void 0,N=void 0,E=J=G=void 0,E=z-u,I=x-w,J=t-z,B=v-x,G=u-t,D=w-v,H=A-t,y=F-v,K=A-u,C=F-w,L=A-z,N=F-x,E=E*C-I*K,G=G*y-D*H,J=J*N-B*L;if(0<=E&&0<=J&&0<=G){p=!1;break a}}p=!0}}if(p){g.push([a[e[i]],
z=void 0,x=void 0,A=void 0,F=void 0,t=p[r[n]].x,v=p[r[n]].y,u=p[r[l]].x,w=p[r[l]].y,z=p[r[o]].x,x=p[r[o]].y;if(1.0E-10>(u-t)*(x-v)-(w-v)*(z-t))p=!1;else{for(s=0;s<q;s++)if(!(s==n||s==l||s==o)){var A=p[r[s]].x,F=p[r[s]].y,E=void 0,I=void 0,J=void 0,B=void 0,G=void 0,D=void 0,H=void 0,y=void 0,L=void 0,C=void 0,K=void 0,N=void 0,E=J=G=void 0,E=z-u,I=x-w,J=t-z,B=v-x,G=u-t,D=w-v,H=A-t,y=F-v,L=A-u,C=F-w,K=A-z,N=F-x,E=E*C-I*L,G=G*y-D*H,J=J*N-B*K;if(0<=E&&0<=J&&0<=G){p=!1;break a}}p=!0}}if(p){g.push([a[e[i]],
a[e[k]],a[e[j]]]);h.push([e[i],e[k],e[j]]);for(i=k,j=k+1;j<f;i++,j++)e[i]=e[j];f--;m=2*f}}return d?h:g};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,d,f){THREE.Geometry.call(this);this.radius=a||100;this.tube=b||40;this.segmentsR=c||8;this.segmentsT=d||6;this.arc=f||2*Math.PI;f=new THREE.Vector3;a=[];b=[];for(c=0;c<=this.segmentsR;c++)for(d=0;d<=this.segmentsT;d++){var g=d/this.segmentsT*this.arc,e=2*c/this.segmentsR*Math.PI;f.x=this.radius*Math.cos(g);f.y=this.radius*Math.sin(g);var h=new THREE.Vector3;h.x=(this.radius+this.tube*Math.cos(e))*Math.cos(g);h.y=(this.radius+this.tube*Math.cos(e))*Math.sin(g);h.z=
this.tube*Math.sin(e);this.vertices.push(new THREE.Vertex(h));a.push(new THREE.UV(d/this.segmentsT,1-c/this.segmentsR));b.push(h.clone().subSelf(f).normalize())}for(c=1;c<=this.segmentsR;c++)for(d=1;d<=this.segmentsT;d++){var f=(this.segmentsT+1)*c+d-1,g=(this.segmentsT+1)*(c-1)+d-1,e=(this.segmentsT+1)*(c-1)+d,h=(this.segmentsT+1)*c+d,i=new THREE.Face4(f,g,e,h,[b[f],b[g],b[e],b[h]]);i.normal.addSelf(b[f]);i.normal.addSelf(b[g]);i.normal.addSelf(b[e]);i.normal.addSelf(b[h]);i.normal.normalize();this.faces.push(i);
......@@ -239,76 +239,78 @@ THREE.BinaryLoader.prototype.createBinModel=function(a,b,c,d){var f=function(b){
m.push(new THREE.UV(f,k));g.push(m)}}function F(b,c){var d,e,f,g,h,i,j,k,l,m,o=new Uint32Array(a,c,4*b);for(d=0;d<b;d++){e=o[4*d];f=o[4*d+1];g=o[4*d+2];h=o[4*d+3];i=y[2*e];e=y[2*e+1];j=y[2*f];l=y[2*f+1];k=y[2*g];m=y[2*g+1];g=y[2*h];f=y[2*h+1];h=G.faceVertexUvs[0];var n=[];n.push(new THREE.UV(i,e));n.push(new THREE.UV(j,l));n.push(new THREE.UV(k,m));n.push(new THREE.UV(g,f));h.push(n)}}function E(b,c,d){for(var e,f,g,h,c=new Uint32Array(a,c,3*b),i=new Uint16Array(a,d,b),d=0;d<b;d++)e=c[3*d],f=c[3*
d+1],g=c[3*d+2],h=i[d],G.faces.push(new THREE.Face3(e,f,g,null,null,h))}function I(b,c,d){for(var e,f,g,h,i,c=new Uint32Array(a,c,4*b),j=new Uint16Array(a,d,b),d=0;d<b;d++)e=c[4*d],f=c[4*d+1],g=c[4*d+2],h=c[4*d+3],i=j[d],G.faces.push(new THREE.Face4(e,f,g,h,null,null,i))}function J(b,c,d,e){for(var f,g,h,i,j,k,l,c=new Uint32Array(a,c,3*b),d=new Uint32Array(a,d,3*b),m=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[3*e];g=c[3*e+1];h=c[3*e+2];j=d[3*e];k=d[3*e+1];l=d[3*e+2];i=m[e];var o=H[3*k],n=H[3*k+1];k=
H[3*k+2];var p=H[3*l],r=H[3*l+1];l=H[3*l+2];G.faces.push(new THREE.Face3(f,g,h,[new THREE.Vector3(H[3*j],H[3*j+1],H[3*j+2]),new THREE.Vector3(o,n,k),new THREE.Vector3(p,r,l)],null,i))}}function B(b,c,d,e){for(var f,g,h,i,j,k,l,m,o,c=new Uint32Array(a,c,4*b),d=new Uint32Array(a,d,4*b),n=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[4*e];g=c[4*e+1];h=c[4*e+2];i=c[4*e+3];k=d[4*e];l=d[4*e+1];m=d[4*e+2];o=d[4*e+3];j=n[e];var p=H[3*l],r=H[3*l+1];l=H[3*l+2];var q=H[3*m],s=H[3*m+1];m=H[3*m+2];var t=H[3*o],u=H[3*
o+1];o=H[3*o+2];G.faces.push(new THREE.Face4(f,g,h,i,[new THREE.Vector3(H[3*k],H[3*k+1],H[3*k+2]),new THREE.Vector3(p,r,l),new THREE.Vector3(q,s,m),new THREE.Vector3(t,u,o)],null,j))}}var G=this,D=0,H=[],y=[],K,C;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(G,d,b);c=function(a,b,c){for(var a=new Uint8Array(a,b,c),d="",e=0;e<c;e++)d+=String.fromCharCode(a[b+e]);return d}(a,D,12);f=z(a,D+12);z(a,D+13);z(a,D+14);z(a,D+15);i=z(a,D+16);k=z(a,D+17);j=z(a,D+18);m=z(a,D+19);p=x(a,D+20);
n=x(a,D+20+4);l=x(a,D+20+8);b=x(a,D+20+12);o=x(a,D+20+16);q=x(a,D+20+20);r=x(a,D+20+24);s=x(a,D+20+28);t=x(a,D+20+32);v=x(a,D+20+36);u=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+m;C=4*i+m;f=b*c;K=o*(c+3*k);i=q*(c+3*j);m=r*(c+3*k+3*j);c=s*C;k=t*(C+4*k);j=v*(C+4*j);D+=function(b){var b=new Float32Array(a,b,3*p),c,d,e,f;for(c=0;c<p;c++)d=b[3*c],e=b[3*c+1],f=b[3*c+2],G.vertices.push(new THREE.Vertex(new THREE.Vector3(d,e,f)));return 3*
p*Float32Array.BYTES_PER_ELEMENT}(D);D+=function(b){if(n){var b=new Int8Array(a,b,3*n),c,d,e,f;for(c=0;c<n;c++)d=b[3*c],e=b[3*c+1],f=b[3*c+2],H.push(d/127,e/127,f/127)}return 3*n*Int8Array.BYTES_PER_ELEMENT}(D);D+=w(3*n);D+=function(b){if(l){var b=new Float32Array(a,b,2*l),c,d,e;for(c=0;c<l;c++)d=b[2*c],e=b[2*c+1],y.push(d,e)}return 2*l*Float32Array.BYTES_PER_ELEMENT}(D);f=D+f+w(2*b);K=f+K+w(2*o);i=K+i+w(2*q);m=i+m+w(2*r);c=m+c+w(2*s);k=c+k+w(2*t);j=k+j+w(2*v);(function(a){if(q){var b=a+3*q*Uint32Array.BYTES_PER_ELEMENT;
E(q,a,b+3*q*Uint32Array.BYTES_PER_ELEMENT);A(q,b)}})(K);(function(a){if(r){var b=a+3*r*Uint32Array.BYTES_PER_ELEMENT,c=b+3*r*Uint32Array.BYTES_PER_ELEMENT;J(r,a,b,c+3*r*Uint32Array.BYTES_PER_ELEMENT);A(r,c)}})(i);(function(a){if(v){var b=a+4*v*Uint32Array.BYTES_PER_ELEMENT;I(v,a,b+4*v*Uint32Array.BYTES_PER_ELEMENT);F(v,b)}})(k);(function(a){if(u){var b=a+4*u*Uint32Array.BYTES_PER_ELEMENT,c=b+4*u*Uint32Array.BYTES_PER_ELEMENT;B(u,a,b,c+4*u*Uint32Array.BYTES_PER_ELEMENT);F(u,c)}})(j);b&&E(b,D,D+3*b*
o+1];o=H[3*o+2];G.faces.push(new THREE.Face4(f,g,h,i,[new THREE.Vector3(H[3*k],H[3*k+1],H[3*k+2]),new THREE.Vector3(p,r,l),new THREE.Vector3(q,s,m),new THREE.Vector3(t,u,o)],null,j))}}var G=this,D=0,H=[],y=[],L,C;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(G,d,b);c=function(a,b,c){for(var a=new Uint8Array(a,b,c),d="",e=0;e<c;e++)d+=String.fromCharCode(a[b+e]);return d}(a,D,12);f=z(a,D+12);z(a,D+13);z(a,D+14);z(a,D+15);i=z(a,D+16);k=z(a,D+17);j=z(a,D+18);m=z(a,D+19);p=x(a,D+20);
n=x(a,D+20+4);l=x(a,D+20+8);b=x(a,D+20+12);o=x(a,D+20+16);q=x(a,D+20+20);r=x(a,D+20+24);s=x(a,D+20+28);t=x(a,D+20+32);v=x(a,D+20+36);u=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+m;C=4*i+m;f=b*c;L=o*(c+3*k);i=q*(c+3*j);m=r*(c+3*k+3*j);c=s*C;k=t*(C+4*k);j=v*(C+4*j);D+=function(b){var b=new Float32Array(a,b,3*p),c,d,e,f;for(c=0;c<p;c++)d=b[3*c],e=b[3*c+1],f=b[3*c+2],G.vertices.push(new THREE.Vertex(new THREE.Vector3(d,e,f)));return 3*
p*Float32Array.BYTES_PER_ELEMENT}(D);D+=function(b){if(n){var b=new Int8Array(a,b,3*n),c,d,e,f;for(c=0;c<n;c++)d=b[3*c],e=b[3*c+1],f=b[3*c+2],H.push(d/127,e/127,f/127)}return 3*n*Int8Array.BYTES_PER_ELEMENT}(D);D+=w(3*n);D+=function(b){if(l){var b=new Float32Array(a,b,2*l),c,d,e;for(c=0;c<l;c++)d=b[2*c],e=b[2*c+1],y.push(d,e)}return 2*l*Float32Array.BYTES_PER_ELEMENT}(D);f=D+f+w(2*b);L=f+L+w(2*o);i=L+i+w(2*q);m=i+m+w(2*r);c=m+c+w(2*s);k=c+k+w(2*t);j=k+j+w(2*v);(function(a){if(q){var b=a+3*q*Uint32Array.BYTES_PER_ELEMENT;
E(q,a,b+3*q*Uint32Array.BYTES_PER_ELEMENT);A(q,b)}})(L);(function(a){if(r){var b=a+3*r*Uint32Array.BYTES_PER_ELEMENT,c=b+3*r*Uint32Array.BYTES_PER_ELEMENT;J(r,a,b,c+3*r*Uint32Array.BYTES_PER_ELEMENT);A(r,c)}})(i);(function(a){if(v){var b=a+4*v*Uint32Array.BYTES_PER_ELEMENT;I(v,a,b+4*v*Uint32Array.BYTES_PER_ELEMENT);F(v,b)}})(k);(function(a){if(u){var b=a+4*u*Uint32Array.BYTES_PER_ELEMENT,c=b+4*u*Uint32Array.BYTES_PER_ELEMENT;B(u,a,b,c+4*u*Uint32Array.BYTES_PER_ELEMENT);F(u,c)}})(j);b&&E(b,D,D+3*b*
Uint32Array.BYTES_PER_ELEMENT);(function(a){if(o){var b=a+3*o*Uint32Array.BYTES_PER_ELEMENT;J(o,a,b,b+3*o*Uint32Array.BYTES_PER_ELEMENT)}})(f);s&&I(s,m,m+4*s*Uint32Array.BYTES_PER_ELEMENT);(function(a){if(t){var b=a+4*t*Uint32Array.BYTES_PER_ELEMENT;B(t,a,b,b+4*t*Uint32Array.BYTES_PER_ELEMENT)}})(c);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};f.prototype=new THREE.Geometry;f.prototype.constructor=f;b(new f(c))};
THREE.ColladaLoader=function(){function a(a,d,f){P=a;d=d||ia;void 0!==f&&(a=f.split("/"),a.pop(),ja=1>a.length?"":a.join("/")+"/");if((a=P.evaluate("//dae:asset",P,K,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&a.childNodes)for(f=0;f<a.childNodes.length;f++){var i=a.childNodes[f];switch(i.nodeName){case "unit":(i=i.getAttribute("meter"))&&parseFloat(i);break;case "up_axis":Z=i.textContent.charAt(0)}}if(!Q.convertUpAxis||Z===Q.upAxis)V=null;else switch(Z){case "X":V="Y"===Q.upAxis?
"XtoY":"XtoZ";break;case "Y":V="X"===Q.upAxis?"YtoX":"YtoZ";break;case "Z":V="X"===Q.upAxis?"ZtoX":"ZtoY"}ca=b("//dae:library_images/dae:image",e,"image");da=b("//dae:library_materials/dae:material",x,"material");ea=b("//dae:library_effects/dae:effect",J,"effect");U=b("//dae:library_geometries/dae:geometry",q,"geometry");T=b("//dae:library_controllers/dae:controller",h,"controller");W=b("//dae:library_animations/dae:animation",G,"animation");ga=b(".//dae:library_visual_scenes/dae:visual_scene",j,
"visual_scene");$=[];aa=[];(a=P.evaluate(".//dae:scene/dae:instance_visual_scene",P,K,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(a=a.getAttribute("url").replace(/^#/,""),S=ga[a]):S=null;X=new THREE.Object3D;for(a=0;a<S.nodes.length;a++)X.add(g(S.nodes[a]));fa=[];c(X);a={scene:X,morphs:$,skins:aa,animations:fa,dae:{images:ca,materials:da,effects:ea,geometries:U,controllers:T,animations:W,visualScenes:ga,scene:S}};d&&d(a);return a}function b(a,b,c){for(var a=P.evaluate(a,P,K,XPathResult.ORDERED_NODE_ITERATOR_TYPE,
null),d={},e=a.iterateNext(),f=0;e;){e=(new b).parse(e);if(!e.id||0==e.id.length)e.id=c+f++;d[e.id]=e;e=a.iterateNext()}return d}function c(a){var b=S.getChildById(a.name,!0),d=null;if(b&&b.keys){d={fps:60,hierarchy:[{node:b,keys:b.keys,sids:b.sids}],node:a,name:"animation_"+a.name,length:0};fa.push(d);for(var e=0,f=b.keys.length;e<f;e++)d.length=Math.max(d.length,b.keys[e].time)}else d={hierarchy:[{keys:[],sids:[]}]};e=0;for(f=a.children.length;e<f;e++)for(var b=0,g=c(a.children[e]).hierarchy.length;b<
g;b++)d.hierarchy.push({keys:[],sids:[]});return d}function d(a,b,c,e){a.world=a.world||new THREE.Matrix4;a.world.copy(a.matrix);if(a.channels&&a.channels.length){var f=a.channels[0].sampler.output[c];f instanceof THREE.Matrix4&&a.world.copy(f)}e&&a.world.multiply(e,a.world);b.push(a);for(e=0;e<a.nodes.length;e++)d(a.nodes[e],b,c,a.world)}function f(a,b,c){var e,f=T[b.url];if(!f||!f.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 c=1E6,g=-c,h=0;for(e in W)for(var i=W[e],j=0;j<i.sampler.length;j++){var k=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(var b=S.getChildById(b.skeleton[0],!0)||S.getChildBySid(b.skeleton[0],!0),l,m,g=new THREE.Vector3,o,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(new THREE.Vertex(new THREE.Vector3));d(b,h,c);j=h;
k=f.skin;for(m=0;m<j.length;m++)if(l=j[m],o=-1,"JOINT"==l.type){for(var n=0;n<k.joints.length;n++)if(l.sid==k.joints[n]){o=n;break}if(0<=o){n=k.invBindMatrices[o];l.invBindMatrix=n;l.skinningMatrix=new THREE.Matrix4;l.skinningMatrix.multiply(l.world,n);l.weights=[];for(n=0;n<k.weights.length;n++)for(var p=0;p<k.weights[n].length;p++){var r=k.weights[n][p];r.joint==o&&l.weights.push(r)}}else throw"ColladaLoader: Could not find joint '"+l.sid+"'.";}for(j=0;j<h.length;j++)if("JOINT"==h[j].type)for(k=
0;k<h[j].weights.length;k++)l=h[j].weights[k],m=l.index,l=l.weight,o=a.vertices[m],m=i[m],g.x=o.position.x,g.y=o.position.y,g.z=o.position.z,h[j].skinningMatrix.multiplyVector3(g),m.position.x+=g.x*l,m.position.y+=g.y*l,m.position.z+=g.z*l;a.morphTargets.push({name:"target_"+c,vertices:i})}}}function g(a){var b=new THREE.Object3D,c,d,e,h;for(e=0;e<a.controllers.length;e++){var i=T[a.controllers[e].url];switch(i.type){case "skin":if(U[i.skin.source]){var j=new o;j.url=i.skin.source;j.instance_material=
a.controllers[e].instance_material;a.geometries.push(j);c=a.controllers[e]}else if(T[i.skin.source]&&(d=i=T[i.skin.source],i.morph&&U[i.morph.source]))j=new o,j.url=i.morph.source,j.instance_material=a.controllers[e].instance_material,a.geometries.push(j);break;case "morph":if(U[i.morph.source])j=new o,j.url=i.morph.source,j.instance_material=a.controllers[e].instance_material,a.geometries.push(j),d=a.controllers[e];console.log("ColladaLoader: Morph-controller partially supported.")}}for(e=0;e<a.geometries.length;e++){var i=
a.geometries[e],j=i.instance_material,i=U[i.url],k={},l=[],m=0,p;if(i&&i.mesh&&i.mesh.primitives){if(0==b.name.length)b.name=i.id;if(j)for(h=0;h<j.length;h++){p=j[h];var r=ea[da[p.target].instance_effect.url].shader;r.material.opacity=!r.material.opacity?1:r.material.opacity;k[p.symbol]=m;l.push(r.material);p=r.material;m++}j=p||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});i=i.mesh.geometry3js;if(1<m){j=new THREE.MeshFaceMaterial;i.materials=l;for(h=0;h<i.faces.length;h++)l=
i.faces[h],l.materialIndex=k[l.daeMaterial]}if(void 0!==c)f(i,c),j.morphTargets=!0,j=new THREE.SkinnedMesh(i,j),j.skeleton=c.skeleton,j.skinController=T[c.url],j.skinInstanceController=c,j.name="skin_"+aa.length,aa.push(j);else if(void 0!==d){h=i;k=d instanceof n?T[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(m=U[k.targets[l]],m.mesh&&m.mesh.primitives&&m.mesh.primitives.length)m=m.mesh.primitives[0].geometry,m.vertices.length===
h.vertices.length&&h.morphTargets.push({name:"target_1",vertices:m.vertices});h.morphTargets.push({name:"target_Z",vertices:h.vertices})}j.morphTargets=!0;j=new THREE.Mesh(i,j);j.name="morph_"+$.length;$.push(j)}else j=new THREE.Mesh(i,j);1<a.geometries.length?b.add(j):b=j}}b.name=a.id||"";b.matrix=a.matrix;c=a.matrix.decompose();b.position=c[0];b.quaternion=c[1];b.useQuaternion=!0;b.scale=c[2];Q.centerGeometry&&b.geometry&&(c=THREE.GeometryUtils.center(b.geometry),b.quaternion.multiplyVector3(c.multiplySelf(b.scale)),
b.position.subSelf(c));for(e=0;e<a.nodes.length;e++)b.add(g(a.nodes[e],a));return b}function e(){this.init_from=this.id=""}function h(){this.type=this.name=this.id="";this.morph=this.skin=null}function i(){this.weights=this.targets=this.source=this.method=null}function k(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function j(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function m(){this.sid=this.name=this.id="";this.nodes=
[];this.controllers=[];this.transforms=[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function p(){this.type=this.sid="";this.data=[];this.obj=null}function n(){this.url="";this.skeleton=[];this.instance_material=[]}function l(){this.target=this.symbol=""}function o(){this.url="";this.instance_material=[]}function q(){this.id="";this.mesh=null}function r(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function s(){}function t(){this.material="";this.count=
0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function v(){this.source="";this.stride=this.count=0;this.params=[]}function u(){this.input={}}function w(){this.semantic="";this.offset=0;this.source="";this.set=0}function z(a){this.id=a;this.type=null}function x(){this.name=this.id="";this.instance_effect=null}function A(){this.color=new THREE.Color(0);this.color.setRGB(Math.random(),Math.random(),Math.random());this.color.a=1;this.texOpts=this.texcoord=this.texture=null}
function F(a,b){this.type=a;this.effect=b;this.material=null}function E(a){this.effect=a;this.format=this.init_from=null}function I(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 B(){this.url=""}function G(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function D(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=
this.arrSyntax=this.dotSyntax=this.sid=this.fullSid=null}function H(a){this.id="";this.animation=a;this.inputs=[];this.endTime=this.startTime=this.interpolation=this.strideOut=this.output=this.input=null;this.duration=0}function y(a){this.targets=[];this.time=a}function K(a){return"dae"==a?"http://www.collada.org/2005/11/COLLADASchema":null}function C(a){for(var a=N(a).split(/\s+/),b=[],c=0;c<a.length;c++)b.push(parseFloat(a[c]));return b}function L(a){for(var a=N(a).split(/\s+/),b=[],c=0;c<a.length;c++)b.push(parseInt(a[c],
10));return b}function N(a){return a.replace(/^\s+/,"").replace(/\s+$/,"")}function M(a,b,c){return a.hasAttribute(b)?parseInt(a.getAttribute(b),10):c}function O(a,b){if(Q.convertUpAxis&&Z!==Q.upAxis)switch(V){case "XtoY":var c=a[0];a[0]=b*a[1];a[1]=c;break;case "XtoZ":c=a[2];a[2]=a[1];a[1]=a[0];a[0]=c;break;case "YtoX":c=a[0];a[0]=a[1];a[1]=b*c;break;case "YtoZ":c=a[1];a[1]=b*a[2];a[2]=c;break;case "ZtoX":c=a[0];a[0]=a[1];a[1]=a[2];a[2]=c;break;case "ZtoY":c=a[1],a[1]=a[2],a[2]=b*c}}function R(a,
b){var c=[a[b],a[b+1],a[b+2]];O(c,-1);return new THREE.Vector3(c[0],c[1],c[2])}function ba(a){if(Q.convertUpAxis){var b=[a[0],a[4],a[8]];O(b,-1);a[0]=b[0];a[4]=b[1];a[8]=b[2];b=[a[1],a[5],a[9]];O(b,-1);a[1]=b[0];a[5]=b[1];a[9]=b[2];b=[a[2],a[6],a[10]];O(b,-1);a[2]=b[0];a[6]=b[1];a[10]=b[2];b=[a[0],a[1],a[2]];O(b,-1);a[0]=b[0];a[1]=b[1];a[2]=b[2];b=[a[4],a[5],a[6]];O(b,-1);a[4]=b[0];a[5]=b[1];a[6]=b[2];b=[a[8],a[9],a[10]];O(b,-1);a[8]=b[0];a[9]=b[1];a[10]=b[2];b=[a[3],a[7],a[11]];O(b,-1);a[3]=b[0];
a[7]=b[1];a[11]=b[2]}return new THREE.Matrix4(a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8],a[9],a[10],a[11],a[12],a[13],a[14],a[15])}var P=null,X=null,S,ia=null,Y={},ca={},W={},T={},U={},da={},ea={},fa,ga,ja,$,aa,ka=THREE.SmoothShading,Q={centerGeometry:!1,convertUpAxis:!1,subdivideFaces:!0,upAxis:"Y"},Z="Y",V=null,ha=Math.PI/180;e.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if("init_from"==c.nodeName)this.init_from=c.textContent}return this};
h.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.type="none";for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "skin":this.skin=(new k).parse(c);this.type=c.nodeName;break;case "morph":this.morph=(new i).parse(c),this.type=c.nodeName}}return this};i.prototype.parse=function(a){var b={},c=[],d;this.method=a.getAttribute("method");this.source=a.getAttribute("source").replace(/^#/,"");for(d=0;d<a.childNodes.length;d++){var e=
a.childNodes[d];if(1==e.nodeType)switch(e.nodeName){case "source":e=(new z).parse(e);b[e.id]=e;break;case "targets":c=this.parseInputs(e);break;default:console.log(e.nodeName)}}for(d=0;d<c.length;d++)switch(a=c[d],e=b[a.source],a.semantic){case "MORPH_TARGET":this.targets=e.read();break;case "MORPH_WEIGHT":this.weights=e.read()}return this};i.prototype.parseInputs=function(a){for(var b=[],c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(1==d.nodeType)switch(d.nodeName){case "input":b.push((new w).parse(d))}}return b};
k.prototype.parse=function(a){var b={},c,d;this.source=a.getAttribute("source").replace(/^#/,"");this.invBindMatrices=[];this.joints=[];this.weights=[];for(var e=0;e<a.childNodes.length;e++){var f=a.childNodes[e];if(1==f.nodeType)switch(f.nodeName){case "bind_shape_matrix":f=C(f.textContent);this.bindShapeMatrix=ba(f);break;case "source":f=(new z).parse(f);b[f.id]=f;break;case "joints":c=f;break;case "vertex_weights":d=f;break;default:console.log(f.nodeName)}}this.parseJoints(c,b);this.parseWeights(d,
b);return this};k.prototype.parseJoints=function(a,b){for(var c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(1==d.nodeType)switch(d.nodeName){case "input":var d=(new w).parse(d),e=b[d.source];if("JOINT"==d.semantic)this.joints=e.read();else if("INV_BIND_MATRIX"==d.semantic)this.invBindMatrices=e.read()}}};k.prototype.parseWeights=function(a,b){for(var c,d,e=[],f=0;f<a.childNodes.length;f++){var g=a.childNodes[f];if(1==g.nodeType)switch(g.nodeName){case "input":e.push((new w).parse(g));break;
case "v":c=L(g.textContent);break;case "vcount":d=L(g.textContent)}}for(f=g=0;f<d.length;f++){for(var h=d[f],i=[],j=0;j<h;j++){for(var k={},l=0;l<e.length;l++){var m=e[l],o=c[g+m.offset];switch(m.semantic){case "JOINT":k.joint=o;break;case "WEIGHT":k.weight=b[m.source].data[o]}}i.push(k);g+=e.length}for(j=0;j<i.length;j++)i[j].index=f;this.weights.push(i)}};j.prototype.getChildById=function(a,b){for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildById(a,b);if(d)return d}return null};
j.prototype.getChildBySid=function(a,b){for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildBySid(a,b);if(d)return d}return null};j.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.nodes=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "node":this.nodes.push((new m).parse(c))}}return this};m.prototype.getChannelForTransform=function(a){for(var b=0;b<this.channels.length;b++){var c=this.channels[b],
d=c.target.split("/");d.shift();var e=d.shift(),f=0<=e.indexOf("."),g=0<=e.indexOf("("),h;if(f)d=e.split("."),e=d.shift(),d.shift();else if(g){h=e.split("(");e=h.shift();for(d=0;d<h.length;d++)h[d]=parseInt(h[d].replace(/\)/,""))}if(e==a)return c.info={sid:e,dotSyntax:f,arrSyntax:g,arrIndices:h},c}return null};m.prototype.getChildById=function(a,b){if(this.id==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildById(a,b);if(d)return d}return null};m.prototype.getChildBySid=
function(a,b){if(this.sid==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildBySid(a,b);if(d)return d}return null};m.prototype.getTransformBySid=function(a){for(var b=0;b<this.transforms.length;b++)if(this.transforms[b].sid==a)return this.transforms[b];return null};m.prototype.parse=function(a){var b;this.id=a.getAttribute("id");this.sid=a.getAttribute("sid");this.name=a.getAttribute("name");this.type=a.getAttribute("type");this.type="JOINT"==this.type?this.type:
"NODE";this.nodes=[];this.transforms=[];this.geometries=[];this.controllers=[];this.matrix=new THREE.Matrix4;for(var c=0;c<a.childNodes.length;c++)if(b=a.childNodes[c],1==b.nodeType)switch(b.nodeName){case "node":this.nodes.push((new m).parse(b));break;case "instance_camera":break;case "instance_controller":this.controllers.push((new n).parse(b));break;case "instance_geometry":this.geometries.push((new o).parse(b));break;case "instance_light":break;case "instance_node":b=b.getAttribute("url").replace(/^#/,
"");(b=P.evaluate(".//dae:library_nodes//dae:node[@id='"+b+"']",P,K,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new m).parse(b));break;case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new p).parse(b));break;case "extra":break;default:console.log(b.nodeName)}a=[];c=1E6;b=-1E6;for(var d in W)for(var e=W[d],f=0;f<e.channel.length;f++){var g=e.channel[f],h=e.sampler[f];d=g.target.split("/")[0];if(d==this.id)h.create(),
g.sampler=h,c=Math.min(c,h.startTime),b=Math.max(b,h.endTime),a.push(g)}if(a.length)this.startTime=c,this.endTime=b;if((this.channels=a)&&this.channels.length){d=[];a=[];c=0;for(e=this.channels.length;c<e;c++){b=this.channels[c];f=b.fullSid;g=b.member;if(Q.convertUpAxis)switch(g){case "X":switch(V){case "XtoY":case "XtoZ":case "YtoX":g="Y";break;case "ZtoX":g="Z"}break;case "Y":switch(V){case "XtoY":case "YtoX":case "ZtoX":g="X";break;case "XtoZ":case "YtoZ":case "ZtoY":g="Z"}break;case "Z":switch(V){case "XtoZ":g=
"X";break;case "YtoZ":case "ZtoX":case "ZtoY":g="Y"}}var h=b.sampler,i=h.input,j=this.getTransformBySid(b.sid);if(j){-1===a.indexOf(f)&&a.push(f);b=0;for(var k=i.length;b<k;b++){var l=i[b],r=h.getData(j.type,b),q;q=null;for(var s=0,t=d.length;s<t&&null==q;s++){var u=d[s];if(u.time===l)q=u;else if(u.time>l)break}if(!q){q=new y(l);s=-1;t=0;for(u=d.length;t<u&&-1==s;t++)d[t].time>=l&&(s=t);l=s;d.splice(-1==l?d.length:l,0,q)}q.addTarget(f,j,g,r)}}else console.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(q=d[b],!q.hasTarget(e)){h=d;f=q;j=b;g=e;i=void 0;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;break a}i=null}k=void 0;a:{for(j+=1;j<h.length;j++)if(k=h[j],k.hasTarget(g))break a;k=null}if(i&&k){h=(f.time-i.time)/(k.time-i.time);i=i.getTarget(g);j=k.getTarget(g).data;k=i.data;r=void 0;if(k.length){r=[];for(l=0;l<k.length;++l)r[l]=k[l]+(j[l]-k[l])*h}else r=k+(j-k)*h;f.addTarget(g,i.transform,i.member,r)}}}this.keys=
d;this.sids=a}this.updateMatrix();return this};m.prototype.updateMatrix=function(){this.matrix.identity();for(var a=0;a<this.transforms.length;a++)this.transforms[a].apply(this.matrix)};p.prototype.parse=function(a){this.sid=a.getAttribute("sid");this.type=a.nodeName;this.data=C(a.textContent);this.convert();return this};p.prototype.convert=function(){switch(this.type){case "matrix":this.obj=ba(this.data);break;case "rotate":this.angle=this.data[3]*ha;case "translate":O(this.data,-1);this.obj=new THREE.Vector3(this.data[0],
this.data[1],this.data[2]);break;case "scale":O(this.data,1);this.obj=new THREE.Vector3(this.data[0],this.data[1],this.data[2]);break;default:console.log("Can not convert Transform of type "+this.type)}};p.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)}};p.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=a;break;case "Y":this.obj.y=a;break;case "Z":this.obj.z=a;break;case "ANGLE":this.angle=a*ha;break;default:this.obj.x=a[0],this.obj.y=a[1],this.obj.z=a[2],this.angle=a[3]*ha}}};n.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.skeleton=
[];this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "skeleton":this.skeleton.push(c.textContent.replace(/^#/,""));break;case "bind_material":if(c=P.evaluate(".//dae:instance_material",c,K,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(var d=c.iterateNext();d;)this.instance_material.push((new l).parse(d)),d=c.iterateNext()}}return this};l.prototype.parse=function(a){this.symbol=a.getAttribute("symbol");this.target=a.getAttribute("target").replace(/^#/,
"");return this};o.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType&&"bind_material"==c.nodeName){if(a=P.evaluate(".//dae:instance_material",c,K,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(b=a.iterateNext();b;)this.instance_material.push((new l).parse(b)),b=a.iterateNext();break}}return this};q.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<
a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "mesh":this.mesh=(new r(this)).parse(c)}}return this};r.prototype.parse=function(a){this.primitives=[];var b;for(b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "source":var d=c.getAttribute("id");void 0==Y[d]&&(Y[d]=(new z(d)).parse(c));break;case "vertices":this.vertices=(new u).parse(c);break;case "triangles":this.primitives.push((new t).parse(c));break;case "polygons":console.warn("polygon holes not yet supported!");
case "polylist":this.primitives.push((new s).parse(c))}}this.geometry3js=new THREE.Geometry;a=Y[this.vertices.input.POSITION.source].data;for(b=0;b<a.length;b+=3)this.geometry3js.vertices.push(new THREE.Vertex(R(a,b)));for(b=0;b<this.primitives.length;b++)a=this.primitives[b],a.setVertices(this.vertices),this.handlePrimitive(a,this.geometry3js);this.geometry3js.computeCentroids();this.geometry3js.computeFaceNormals();this.geometry3js.computeVertexNormals();this.geometry3js.computeBoundingBox();return this};
r.prototype.handlePrimitive=function(a,b){var c=0,d,e,f=a.p,g=a.inputs,h,i,j,k,l=0,m=3,o=[];for(d=0;d<g.length;d++)switch(h=g[d],h.semantic){case "TEXCOORD":o.push(h.set)}for(;c<f.length;){var n=[],p=[],r={},q=[];a.vcount&&(m=a.vcount[l++]);for(d=0;d<m;d++)for(e=0;e<g.length;e++)switch(h=g[e],k=Y[h.source],i=f[c+d*g.length+h.offset],j=k.accessor.params.length,j*=i,h.semantic){case "VERTEX":n.push(i);break;case "NORMAL":p.push(R(k.data,j));break;case "TEXCOORD":void 0===r[h.set]&&(r[h.set]=[]);r[h.set].push(new THREE.UV(k.data[j],
1-k.data[j+1]));break;case "COLOR":q.push((new THREE.Color).setRGB(k.data[j],k.data[j+1],k.data[j+2]))}e=null;d=[];if(3===m)d.push(new THREE.Face3(n[0],n[1],n[2],[p[0],p[1],p[2]],q.length?q:new THREE.Color));else if(4===m)d.push(new THREE.Face4(n[0],n[1],n[2],n[3],[p[0],p[1],p[2],p[3]],q.length?q:new THREE.Color));else if(4<m&&Q.subdivideFaces){q=q.length?q:new THREE.Color;for(e=1;e<m-1;)d.push(new THREE.Face3(n[0],n[e],n[e+1],[p[0],p[e++],p[e]],q))}if(d.length){n=0;for(p=d.length;n<p;n++){e=d[n];
e.daeMaterial=a.material;b.faces.push(e);for(e=0;e<o.length;e++)q=r[o[e]],q=4<m?[q[0],q[n+1],q[n+2]]:4===m?[q[0],q[1],q[2],q[3]]:[q[0],q[1],q[2]],b.faceVertexUvs[e]||(b.faceVertexUvs[e]=[]),b.faceVertexUvs[e].push(q)}}else console.log("dropped face with vcount "+m+" for geometry with id: "+b.id);c+=g.length*m}};s.prototype=new t;s.prototype.constructor=s;t.prototype.setVertices=function(a){for(var b=0;b<this.inputs.length;b++)if(this.inputs[b].source==a.id)this.inputs[b].source=a.input.POSITION.source};
t.prototype.parse=function(a){this.inputs=[];this.material=a.getAttribute("material");this.count=M(a,"count",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "input":this.inputs.push((new w).parse(a.childNodes[b]));break;case "vcount":this.vcount=L(c.textContent);break;case "p":this.p=L(c.textContent)}}return this};v.prototype.parse=function(a){this.params=[];this.source=a.getAttribute("source");this.count=M(a,"count",0);this.stride=M(a,"stride",0);for(var b=
0;b<a.childNodes.length;b++){var c=a.childNodes[b];if("param"==c.nodeName){var d={};d.name=c.getAttribute("name");d.type=c.getAttribute("type");this.params.push(d)}}return this};u.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++)if("input"==a.childNodes[b].nodeName){var c=(new w).parse(a.childNodes[b]);this.input[c.semantic]=c}return this};w.prototype.parse=function(a){this.semantic=a.getAttribute("semantic");this.source=a.getAttribute("source").replace(/^#/,
"");this.set=M(a,"set",-1);this.offset=M(a,"offset",0);if("TEXCOORD"==this.semantic&&0>this.set)this.set=0;return this};z.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "bool_array":for(var d=N(c.textContent).split(/\s+/),e=[],f=0;f<d.length;f++)e.push("true"==d[f]||"1"==d[f]?!0:!1);this.data=e;this.type=c.nodeName;break;case "float_array":this.data=C(c.textContent);this.type=c.nodeName;break;case "int_array":this.data=
L(c.textContent);this.type=c.nodeName;break;case "IDREF_array":case "Name_array":this.data=N(c.textContent).split(/\s+/);this.type=c.nodeName;break;case "technique_common":for(d=0;d<c.childNodes.length;d++)if("accessor"==c.childNodes[d].nodeName){this.accessor=(new v).parse(c.childNodes[d]);break}}}return this};z.prototype.read=function(){var a=[],b=this.accessor.params[0];switch(b.type){case "IDREF":case "Name":case "name":case "float":return this.data;case "float4x4":for(b=0;b<this.data.length;b+=
16){var c=this.data.slice(b,b+16),c=ba(c);a.push(c)}break;default:console.log("ColladaLoader: Source: Read dont know how to read "+b.type+".")}return a};x.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");for(var b=0;b<a.childNodes.length;b++)if("instance_effect"==a.childNodes[b].nodeName){this.instance_effect=(new B).parse(a.childNodes[b]);break}return this};A.prototype.isColor=function(){return null==this.texture};A.prototype.isTexture=function(){return null!=
this.texture};A.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "color":c=C(c.textContent);this.color=new THREE.Color(0);this.color.setRGB(c[0],c[1],c[2]);this.color.a=c[3];break;case "texture":this.texture=c.getAttribute("texture"),this.texcoord=c.getAttribute("texcoord"),this.texOpts={offsetU:0,offsetV:0,repeatU:1,repeatV:1,wrapU:1,wrapV:1},this.parseTexture(c)}}return this};A.prototype.parseTexture=function(a){if(!a.childNodes)return this;
a.childNodes[1]&&"extra"===a.childNodes[1].nodeName&&(a=a.childNodes[1],a.childNodes[1]&&"technique"===a.childNodes[1].nodeName&&(a=a.childNodes[1]));for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "offsetU":case "offsetV":case "repeatU":case "repeatV":this.texOpts[c.nodeName]=parseFloat(c.textContent);break;case "wrapU":case "wrapV":this.texOpts[c.nodeName]=parseInt(c.textContent);break;default:this.texOpts[c.nodeName]=c.textContent}}return this};F.prototype.parse=
function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[c.nodeName]=(new A).parse(c);break;case "shininess":case "reflectivity":case "transparency":var d;d=P.evaluate(".//dae:float",c,K,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);for(var e=d.iterateNext(),f=[];e;)f.push(e),e=d.iterateNext();d=f;0<d.length&&(this[c.nodeName]=parseFloat(d[0].textContent))}}this.create();
return this};F.prototype.create=function(){var a={},b=void 0!==this.transparency&&1>this.transparency,c;for(c in this)switch(c){case "ambient":case "emission":case "diffuse":case "specular":var d=this[c];if(d instanceof A)if(d.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid){var e=ca[this.effect.surface.init_from];if(e)e=THREE.ImageUtils.loadTexture(ja+e.init_from),e.wrapS=d.texOpts.wrapU?THREE.RepeatWrapping:THREE.ClampToEdgeWrapping,
e.wrapT=d.texOpts.wrapV?THREE.RepeatWrapping:THREE.ClampToEdgeWrapping,e.offset.x=d.texOpts.offsetU,e.offset.y=d.texOpts.offsetV,e.repeat.x=d.texOpts.repeatU,e.repeat.y=d.texOpts.repeatV,a.map=e}}else"diffuse"==c?a.color=d.color.getHex():b||(a[c]=d.color.getHex());break;case "shininess":case "reflectivity":a[c]=this[c];break;case "transparency":if(b)a.transparent=!0,a.opacity=this[c],b=!0}a.shading=ka;return this.material=new THREE.MeshLambertMaterial(a)};E.prototype.parse=function(a){for(var b=0;b<
a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "init_from":this.init_from=c.textContent;break;case "format":this.format=c.textContent;break;default:console.log("unhandled Surface prop: "+c.nodeName)}}return this};I.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "source":this.source=c.textContent;break;case "minfilter":this.minfilter=c.textContent;break;case "magfilter":this.magfilter=
c.textContent;break;case "mipfilter":this.mipfilter=c.textContent;break;case "wrap_s":this.wrap_s=c.textContent;break;case "wrap_t":this.wrap_t=c.textContent;break;default:console.log("unhandled Sampler2D prop: "+c.nodeName)}}return this};J.prototype.create=function(){if(null==this.shader)return null};J.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.shader=null;for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "profile_COMMON":this.parseTechnique(this.parseProfileCOMMON(c))}}return this};
J.prototype.parseNewparam=function(a){for(var b=a.getAttribute("sid"),c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(1==d.nodeType)switch(d.nodeName){case "surface":this.surface=(new E(this)).parse(d);this.surface.sid=b;break;case "sampler2D":this.sampler=(new I(this)).parse(d);this.sampler.sid=b;break;case "extra":break;default:console.log(d.nodeName)}}};J.prototype.parseProfileCOMMON=function(a){for(var b,c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(1==d.nodeType)switch(d.nodeName){case "profile_COMMON":this.parseProfileCOMMON(d);
break;case "technique":b=d;break;case "newparam":this.parseNewparam(d);break;case "extra":break;default:console.log(d.nodeName)}}return b};J.prototype.parseTechnique=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "constant":case "lambert":case "blinn":case "phong":this.shader=(new F(c.nodeName,this)).parse(c)}}};B.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");return this};G.prototype.parse=function(a){this.id=
a.getAttribute("id");this.name=a.getAttribute("name");this.source={};for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "source":c=(new z).parse(c);this.source[c.id]=c;break;case "sampler":this.sampler.push((new H(this)).parse(c));break;case "channel":this.channel.push((new D(this)).parse(c))}}return this};D.prototype.parse=function(a){this.source=a.getAttribute("source").replace(/^#/,"");this.target=a.getAttribute("target");var b=this.target.split("/");
b.shift();var a=b.shift(),c=0<=a.indexOf("."),d=0<=a.indexOf("(");if(c)b=a.split("."),this.sid=b.shift(),this.member=b.shift();else if(d){b=a.split("(");this.sid=b.shift();for(var e=0;e<b.length;e++)b[e]=parseInt(b[e].replace(/\)/,""));this.arrIndices=b}else this.sid=a;this.fullSid=a;this.dotSyntax=c;this.arrSyntax=d;return this};H.prototype.parse=function(a){this.id=a.getAttribute("id");this.inputs=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "input":this.inputs.push((new w).parse(c))}}return this};
H.prototype.create=function(){for(var a=0;a<this.inputs.length;a++){var b=this.inputs[a],c=this.animation.source[b.source];switch(b.semantic){case "INPUT":this.input=c.read();break;case "OUTPUT":this.output=c.read();this.strideOut=c.accessor.stride;break;case "INTERPOLATION":this.interpolation=c.read();break;case "IN_TANGENT":break;case "OUT_TANGENT":break;default:console.log(b.semantic)}}this.duration=this.endTime=this.startTime=0;if(this.input.length){this.startTime=1E8;this.endTime=-1E8;for(a=
0;a<this.input.length;a++)this.startTime=Math.min(this.startTime,this.input[a]),this.endTime=Math.max(this.endTime,this.input[a]);this.duration=this.endTime-this.startTime}};H.prototype.getData=function(a,b){var c;if(1<this.strideOut){c=[];for(var b=b*this.strideOut,d=0;d<this.strideOut;++d)c[d]=this.output[b+d];if(3===this.strideOut)switch(a){case "rotate":case "translate":O(c,-1);break;case "scale":O(c,1)}}else c=this.output[b];return c};y.prototype.addTarget=function(a,b,c,d){this.targets.push({sid:a,
member:c,transform:b,data:d})};y.prototype.apply=function(a){for(var b=0;b<this.targets.length;++b){var c=this.targets[b];(!a||c.sid===a)&&c.transform.update(c.data,c.member)}};y.prototype.getTarget=function(a){for(var b=0;b<this.targets.length;++b)if(this.targets[b].sid===a)return this.targets[b];return null};y.prototype.hasTarget=function(a){for(var b=0;b<this.targets.length;++b)if(this.targets[b].sid===a)return!0;return!1};y.prototype.interpolate=function(a,b){for(var c=0;c<this.targets.length;++c){var d=
this.targets[c],e=a.getTarget(d.sid);if(e){var f=(b-this.time)/(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(var e=[],i=0;i<h.length;++i)e[i]=h[i]+(g[i]-h[i])*f;else e=h+(g-h)*f}else e=d.data;d.transform.update(e,d.member)}};return{load:function(b,c,d){var e=0;if(document.implementation&&document.implementation.createDocument){var f=new XMLHttpRequest;f.overrideMimeType&&f.overrideMimeType("text/xml");f.onreadystatechange=
function(){if(4==f.readyState){if(0==f.status||200==f.status)f.responseXML?(ia=c,a(f.responseXML,void 0,b)):console.error("ColladaLoader: Empty or non-existing file ("+b+")")}else 3==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)}else alert("Don't know how to parse XML!")},parse:a,setPreferredShading:function(a){ka=a},applySkin:f,geometries:U,options:Q}};
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.ColladaLoader=function(){function a(a,d,f){Q=a;d=d||la;void 0!==f&&(a=f.split("/"),a.pop(),ma=1>a.length?"":a.join("/")+"/");if((a=Q.evaluate("//dae:asset",Q,K,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&a.childNodes)for(f=0;f<a.childNodes.length;f++){var i=a.childNodes[f];switch(i.nodeName){case "unit":(i=i.getAttribute("meter"))&&parseFloat(i);break;case "up_axis":$=i.textContent.charAt(0)}}if(!R.convertUpAxis||$===R.upAxis)W=null;else switch($){case "X":W="Y"===R.upAxis?
"XtoY":"XtoZ";break;case "Y":W="X"===R.upAxis?"YtoX":"YtoZ";break;case "Z":W="X"===R.upAxis?"ZtoX":"ZtoY"}da=b("//dae:library_images/dae:image",e,"image");ea=b("//dae:library_materials/dae:material",x,"material");fa=b("//dae:library_effects/dae:effect",J,"effect");V=b("//dae:library_geometries/dae:geometry",q,"geometry");ga=b(".//dae:library_cameras/dae:camera",L,"camera");U=b("//dae:library_controllers/dae:controller",h,"controller");X=b("//dae:library_animations/dae:animation",G,"animation");ha=
b(".//dae:library_visual_scenes/dae:visual_scene",j,"visual_scene");aa=[];ba=[];(a=Q.evaluate(".//dae:scene/dae:instance_visual_scene",Q,K,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(a=a.getAttribute("url").replace(/^#/,""),T=ha[a]):T=null;Y=new THREE.Object3D;for(a=0;a<T.nodes.length;a++)Y.add(g(T.nodes[a]));ia=[];c(Y);a={scene:Y,morphs:aa,skins:ba,animations:ia,dae:{images:da,materials:ea,cameras:ga,effects:fa,geometries:V,controllers:U,animations:X,visualScenes:ha,scene:T}};d&&
d(a);return a}function b(a,b,c){for(var a=Q.evaluate(a,Q,K,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null),d={},e=a.iterateNext(),f=0;e;){e=(new b).parse(e);if(!e.id||0==e.id.length)e.id=c+f++;d[e.id]=e;e=a.iterateNext()}return d}function c(a){var b=T.getChildById(a.name,!0),d=null;if(b&&b.keys){d={fps:60,hierarchy:[{node:b,keys:b.keys,sids:b.sids}],node:a,name:"animation_"+a.name,length:0};ia.push(d);for(var e=0,f=b.keys.length;e<f;e++)d.length=Math.max(d.length,b.keys[e].time)}else d={hierarchy:[{keys:[],
sids:[]}]};e=0;for(f=a.children.length;e<f;e++)for(var b=0,g=c(a.children[e]).hierarchy.length;b<g;b++)d.hierarchy.push({keys:[],sids:[]});return d}function d(a,b,c,e){a.world=a.world||new THREE.Matrix4;a.world.copy(a.matrix);if(a.channels&&a.channels.length){var f=a.channels[0].sampler.output[c];f instanceof THREE.Matrix4&&a.world.copy(f)}e&&a.world.multiply(e,a.world);b.push(a);for(e=0;e<a.nodes.length;e++)d(a.nodes[e],b,c,a.world)}function f(a,b,c){var e,f=U[b.url];if(!f||!f.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 c=1E6,g=-c,h=0;for(e in X)for(var i=X[e],j=0;j<i.sampler.length;j++){var k=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(var b=T.getChildById(b.skeleton[0],!0)||T.getChildBySid(b.skeleton[0],!0),l,m,g=new THREE.Vector3,o,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(new THREE.Vertex(new THREE.Vector3));d(b,h,c);j=h;k=f.skin;for(m=0;m<j.length;m++)if(l=j[m],o=-1,"JOINT"==l.type){for(var n=0;n<k.joints.length;n++)if(l.sid==k.joints[n]){o=n;break}if(0<=o){n=k.invBindMatrices[o];l.invBindMatrix=n;l.skinningMatrix=new THREE.Matrix4;l.skinningMatrix.multiply(l.world,n);l.weights=[];for(n=0;n<k.weights.length;n++)for(var p=0;p<k.weights[n].length;p++){var r=k.weights[n][p];r.joint==o&&l.weights.push(r)}}else throw"ColladaLoader: Could not find joint '"+
l.sid+"'.";}for(j=0;j<h.length;j++)if("JOINT"==h[j].type)for(k=0;k<h[j].weights.length;k++)l=h[j].weights[k],m=l.index,l=l.weight,o=a.vertices[m],m=i[m],g.x=o.position.x,g.y=o.position.y,g.z=o.position.z,h[j].skinningMatrix.multiplyVector3(g),m.position.x+=g.x*l,m.position.y+=g.y*l,m.position.z+=g.z*l;a.morphTargets.push({name:"target_"+c,vertices:i})}}}function g(a){var b=new THREE.Object3D,c,d,e,h;for(e=0;e<a.controllers.length;e++){var i=U[a.controllers[e].url];switch(i.type){case "skin":if(V[i.skin.source]){var j=
new o;j.url=i.skin.source;j.instance_material=a.controllers[e].instance_material;a.geometries.push(j);c=a.controllers[e]}else if(U[i.skin.source]&&(d=i=U[i.skin.source],i.morph&&V[i.morph.source]))j=new o,j.url=i.morph.source,j.instance_material=a.controllers[e].instance_material,a.geometries.push(j);break;case "morph":if(V[i.morph.source])j=new o,j.url=i.morph.source,j.instance_material=a.controllers[e].instance_material,a.geometries.push(j),d=a.controllers[e];console.log("ColladaLoader: Morph-controller partially supported.")}}for(e=
0;e<a.geometries.length;e++){var i=a.geometries[e],j=i.instance_material,i=V[i.url],k={},l=[],m=0,p;if(i&&i.mesh&&i.mesh.primitives){if(0==b.name.length)b.name=i.id;if(j)for(h=0;h<j.length;h++){p=j[h];var r=fa[ea[p.target].instance_effect.url].shader;r.material.opacity=!r.material.opacity?1:r.material.opacity;k[p.symbol]=m;l.push(r.material);p=r.material;m++}j=p||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});i=i.mesh.geometry3js;if(1<m){j=new THREE.MeshFaceMaterial;i.materials=
l;for(h=0;h<i.faces.length;h++)l=i.faces[h],l.materialIndex=k[l.daeMaterial]}if(void 0!==c)f(i,c),j.morphTargets=!0,j=new THREE.SkinnedMesh(i,j),j.skeleton=c.skeleton,j.skinController=U[c.url],j.skinInstanceController=c,j.name="skin_"+ba.length,ba.push(j);else if(void 0!==d){h=i;k=d instanceof n?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(m=V[k.targets[l]],m.mesh&&m.mesh.primitives&&m.mesh.primitives.length)m=m.mesh.primitives[0].geometry,
m.vertices.length===h.vertices.length&&h.morphTargets.push({name:"target_1",vertices:m.vertices});h.morphTargets.push({name:"target_Z",vertices:h.vertices})}j.morphTargets=!0;j=new THREE.Mesh(i,j);j.name="morph_"+aa.length;aa.push(j)}else j=new THREE.Mesh(i,j);1<a.geometries.length?b.add(j):b=j}}for(e=0;e<a.cameras.length;e++)b=ga[a.cameras[e].url],b=new THREE.PerspectiveCamera(b.fov,b.aspect_ratio,b.znear,b.zfar);b.name=a.id||"";b.matrix=a.matrix;e=a.matrix.decompose();b.position=e[0];b.quaternion=
e[1];b.useQuaternion=!0;b.scale=e[2];R.centerGeometry&&b.geometry&&(e=THREE.GeometryUtils.center(b.geometry),b.quaternion.multiplyVector3(e.multiplySelf(b.scale)),b.position.subSelf(e));for(e=0;e<a.nodes.length;e++)b.add(g(a.nodes[e],a));return b}function e(){this.init_from=this.id=""}function h(){this.type=this.name=this.id="";this.morph=this.skin=null}function i(){this.weights=this.targets=this.source=this.method=null}function k(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];
this.joints=[];this.weights=[]}function j(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function m(){this.sid=this.name=this.id="";this.nodes=[];this.controllers=[];this.transforms=[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function p(){this.type=this.sid="";this.data=[];this.obj=null}function n(){this.url="";this.skeleton=[];this.instance_material=[]}function l(){this.target=this.symbol=""}function o(){this.url="";this.instance_material=[]}function q(){this.id=
"";this.mesh=null}function r(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function s(){}function t(){this.material="";this.count=0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function v(){this.source="";this.stride=this.count=0;this.params=[]}function u(){this.input={}}function w(){this.semantic="";this.offset=0;this.source="";this.set=0}function z(a){this.id=a;this.type=null}function x(){this.name=this.id="";this.instance_effect=null}
function A(){this.color=new THREE.Color(0);this.color.setRGB(Math.random(),Math.random(),Math.random());this.color.a=1;this.texOpts=this.texcoord=this.texture=null}function F(a,b){this.type=a;this.effect=b;this.material=null}function E(a){this.effect=a;this.format=this.init_from=null}function I(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 B(){this.url=""}
function G(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function D(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=this.dotSyntax=this.sid=this.fullSid=null}function H(a){this.id="";this.animation=a;this.inputs=[];this.endTime=this.startTime=this.interpolation=this.strideOut=this.output=this.input=null;this.duration=0}function y(a){this.targets=[];this.time=a}function L(){this.name=this.id=""}function C(){this.url=""}function K(a){return"dae"==
a?"http://www.collada.org/2005/11/COLLADASchema":null}function N(a){for(var a=S(a).split(/\s+/),b=[],c=0;c<a.length;c++)b.push(parseFloat(a[c]));return b}function M(a){for(var a=S(a).split(/\s+/),b=[],c=0;c<a.length;c++)b.push(parseInt(a[c],10));return b}function S(a){return a.replace(/^\s+/,"").replace(/\s+$/,"")}function O(a,b,c){return a.hasAttribute(b)?parseInt(a.getAttribute(b),10):c}function P(a,b){if(R.convertUpAxis&&$!==R.upAxis)switch(W){case "XtoY":var c=a[0];a[0]=b*a[1];a[1]=c;break;case "XtoZ":c=
a[2];a[2]=a[1];a[1]=a[0];a[0]=c;break;case "YtoX":c=a[0];a[0]=a[1];a[1]=b*c;break;case "YtoZ":c=a[1];a[1]=b*a[2];a[2]=c;break;case "ZtoX":c=a[0];a[0]=a[1];a[1]=a[2];a[2]=c;break;case "ZtoY":c=a[1],a[1]=a[2],a[2]=b*c}}function ka(a,b){var c=[a[b],a[b+1],a[b+2]];P(c,-1);return new THREE.Vector3(c[0],c[1],c[2])}function ca(a){if(R.convertUpAxis){var b=[a[0],a[4],a[8]];P(b,-1);a[0]=b[0];a[4]=b[1];a[8]=b[2];b=[a[1],a[5],a[9]];P(b,-1);a[1]=b[0];a[5]=b[1];a[9]=b[2];b=[a[2],a[6],a[10]];P(b,-1);a[2]=b[0];
a[6]=b[1];a[10]=b[2];b=[a[0],a[1],a[2]];P(b,-1);a[0]=b[0];a[1]=b[1];a[2]=b[2];b=[a[4],a[5],a[6]];P(b,-1);a[4]=b[0];a[5]=b[1];a[6]=b[2];b=[a[8],a[9],a[10]];P(b,-1);a[8]=b[0];a[9]=b[1];a[10]=b[2];b=[a[3],a[7],a[11]];P(b,-1);a[3]=b[0];a[7]=b[1];a[11]=b[2]}return new THREE.Matrix4(a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8],a[9],a[10],a[11],a[12],a[13],a[14],a[15])}var Q=null,Y=null,T,la=null,Z={},da={},X={},U={},V={},ea={},fa={},ga={},ia,ha,ma,aa,ba,na=THREE.SmoothShading,R={centerGeometry:!1,convertUpAxis:!1,
subdivideFaces:!0,upAxis:"Y"},$="Y",W=null,ja=Math.PI/180;e.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if("init_from"==c.nodeName)this.init_from=c.textContent}return this};h.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.type="none";for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "skin":this.skin=(new k).parse(c);this.type=c.nodeName;break;
case "morph":this.morph=(new i).parse(c),this.type=c.nodeName}}return this};i.prototype.parse=function(a){var b={},c=[],d;this.method=a.getAttribute("method");this.source=a.getAttribute("source").replace(/^#/,"");for(d=0;d<a.childNodes.length;d++){var e=a.childNodes[d];if(1==e.nodeType)switch(e.nodeName){case "source":e=(new z).parse(e);b[e.id]=e;break;case "targets":c=this.parseInputs(e);break;default:console.log(e.nodeName)}}for(d=0;d<c.length;d++)switch(a=c[d],e=b[a.source],a.semantic){case "MORPH_TARGET":this.targets=
e.read();break;case "MORPH_WEIGHT":this.weights=e.read()}return this};i.prototype.parseInputs=function(a){for(var b=[],c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(1==d.nodeType)switch(d.nodeName){case "input":b.push((new w).parse(d))}}return b};k.prototype.parse=function(a){var b={},c,d;this.source=a.getAttribute("source").replace(/^#/,"");this.invBindMatrices=[];this.joints=[];this.weights=[];for(var e=0;e<a.childNodes.length;e++){var f=a.childNodes[e];if(1==f.nodeType)switch(f.nodeName){case "bind_shape_matrix":f=
N(f.textContent);this.bindShapeMatrix=ca(f);break;case "source":f=(new z).parse(f);b[f.id]=f;break;case "joints":c=f;break;case "vertex_weights":d=f;break;default:console.log(f.nodeName)}}this.parseJoints(c,b);this.parseWeights(d,b);return this};k.prototype.parseJoints=function(a,b){for(var c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(1==d.nodeType)switch(d.nodeName){case "input":var d=(new w).parse(d),e=b[d.source];if("JOINT"==d.semantic)this.joints=e.read();else if("INV_BIND_MATRIX"==
d.semantic)this.invBindMatrices=e.read()}}};k.prototype.parseWeights=function(a,b){for(var c,d,e=[],f=0;f<a.childNodes.length;f++){var g=a.childNodes[f];if(1==g.nodeType)switch(g.nodeName){case "input":e.push((new w).parse(g));break;case "v":c=M(g.textContent);break;case "vcount":d=M(g.textContent)}}for(f=g=0;f<d.length;f++){for(var h=d[f],i=[],j=0;j<h;j++){for(var k={},l=0;l<e.length;l++){var m=e[l],o=c[g+m.offset];switch(m.semantic){case "JOINT":k.joint=o;break;case "WEIGHT":k.weight=b[m.source].data[o]}}i.push(k);
g+=e.length}for(j=0;j<i.length;j++)i[j].index=f;this.weights.push(i)}};j.prototype.getChildById=function(a,b){for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildById(a,b);if(d)return d}return null};j.prototype.getChildBySid=function(a,b){for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildBySid(a,b);if(d)return d}return null};j.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.nodes=[];for(var b=0;b<a.childNodes.length;b++){var c=
a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "node":this.nodes.push((new m).parse(c))}}return this};m.prototype.getChannelForTransform=function(a){for(var b=0;b<this.channels.length;b++){var c=this.channels[b],d=c.target.split("/");d.shift();var e=d.shift(),f=0<=e.indexOf("."),g=0<=e.indexOf("("),h;if(f)d=e.split("."),e=d.shift(),d.shift();else if(g){h=e.split("(");e=h.shift();for(d=0;d<h.length;d++)h[d]=parseInt(h[d].replace(/\)/,""))}if(e==a)return c.info={sid:e,dotSyntax:f,arrSyntax:g,
arrIndices:h},c}return null};m.prototype.getChildById=function(a,b){if(this.id==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildById(a,b);if(d)return d}return null};m.prototype.getChildBySid=function(a,b){if(this.sid==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildBySid(a,b);if(d)return d}return null};m.prototype.getTransformBySid=function(a){for(var b=0;b<this.transforms.length;b++)if(this.transforms[b].sid==a)return this.transforms[b];
return null};m.prototype.parse=function(a){var b;this.id=a.getAttribute("id");this.sid=a.getAttribute("sid");this.name=a.getAttribute("name");this.type=a.getAttribute("type");this.type="JOINT"==this.type?this.type:"NODE";this.nodes=[];this.transforms=[];this.geometries=[];this.cameras=[];this.controllers=[];this.matrix=new THREE.Matrix4;for(var c=0;c<a.childNodes.length;c++)if(b=a.childNodes[c],1==b.nodeType)switch(b.nodeName){case "node":this.nodes.push((new m).parse(b));break;case "instance_camera":this.cameras.push((new C).parse(b));
break;case "instance_controller":this.controllers.push((new n).parse(b));break;case "instance_geometry":this.geometries.push((new o).parse(b));break;case "instance_light":break;case "instance_node":b=b.getAttribute("url").replace(/^#/,"");(b=Q.evaluate(".//dae:library_nodes//dae:node[@id='"+b+"']",Q,K,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new m).parse(b));break;case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new p).parse(b));
break;case "extra":break;default:console.log(b.nodeName)}a=[];c=1E6;b=-1E6;for(var d in X)for(var e=X[d],f=0;f<e.channel.length;f++){var g=e.channel[f],h=e.sampler[f];d=g.target.split("/")[0];if(d==this.id)h.create(),g.sampler=h,c=Math.min(c,h.startTime),b=Math.max(b,h.endTime),a.push(g)}if(a.length)this.startTime=c,this.endTime=b;if((this.channels=a)&&this.channels.length){d=[];a=[];c=0;for(e=this.channels.length;c<e;c++){b=this.channels[c];f=b.fullSid;g=b.member;if(R.convertUpAxis)switch(g){case "X":switch(W){case "XtoY":case "XtoZ":case "YtoX":g=
"Y";break;case "ZtoX":g="Z"}break;case "Y":switch(W){case "XtoY":case "YtoX":case "ZtoX":g="X";break;case "XtoZ":case "YtoZ":case "ZtoY":g="Z"}break;case "Z":switch(W){case "XtoZ":g="X";break;case "YtoZ":case "ZtoX":case "ZtoY":g="Y"}}var h=b.sampler,i=h.input,j=this.getTransformBySid(b.sid);if(j){-1===a.indexOf(f)&&a.push(f);b=0;for(var k=i.length;b<k;b++){var l=i[b],r=h.getData(j.type,b),q;q=null;for(var s=0,t=d.length;s<t&&null==q;s++){var u=d[s];if(u.time===l)q=u;else if(u.time>l)break}if(!q){q=
new y(l);s=-1;t=0;for(u=d.length;t<u&&-1==s;t++)d[t].time>=l&&(s=t);l=s;d.splice(-1==l?d.length:l,0,q)}q.addTarget(f,j,g,r)}}else console.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(q=d[b],!q.hasTarget(e)){h=d;f=q;j=b;g=e;i=void 0;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;break a}i=null}k=void 0;a:{for(j+=1;j<h.length;j++)if(k=h[j],k.hasTarget(g))break a;k=null}if(i&&k){h=(f.time-i.time)/(k.time-
i.time);i=i.getTarget(g);j=k.getTarget(g).data;k=i.data;r=void 0;if(k.length){r=[];for(l=0;l<k.length;++l)r[l]=k[l]+(j[l]-k[l])*h}else r=k+(j-k)*h;f.addTarget(g,i.transform,i.member,r)}}}this.keys=d;this.sids=a}this.updateMatrix();return this};m.prototype.updateMatrix=function(){this.matrix.identity();for(var a=0;a<this.transforms.length;a++)this.transforms[a].apply(this.matrix)};p.prototype.parse=function(a){this.sid=a.getAttribute("sid");this.type=a.nodeName;this.data=N(a.textContent);this.convert();
return this};p.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=new THREE.Vector3(this.data[0],this.data[1],this.data[2]);break;case "scale":P(this.data,1);this.obj=new THREE.Vector3(this.data[0],this.data[1],this.data[2]);break;default:console.log("Can not convert Transform of type "+this.type)}};p.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)}};p.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=
a;break;case "Y":this.obj.y=a;break;case "Z":this.obj.z=a;break;case "ANGLE":this.angle=a*ja;break;default:this.obj.x=a[0],this.obj.y=a[1],this.obj.z=a[2],this.angle=a[3]*ja}}};n.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.skeleton=[];this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "skeleton":this.skeleton.push(c.textContent.replace(/^#/,""));break;case "bind_material":if(c=Q.evaluate(".//dae:instance_material",
c,K,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(var d=c.iterateNext();d;)this.instance_material.push((new l).parse(d)),d=c.iterateNext()}}return this};l.prototype.parse=function(a){this.symbol=a.getAttribute("symbol");this.target=a.getAttribute("target").replace(/^#/,"");return this};o.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType&&"bind_material"==c.nodeName){if(a=
Q.evaluate(".//dae:instance_material",c,K,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(b=a.iterateNext();b;)this.instance_material.push((new l).parse(b)),b=a.iterateNext();break}}return this};q.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "mesh":this.mesh=(new r(this)).parse(c)}}return this};r.prototype.parse=function(a){this.primitives=[];var b;for(b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];
switch(c.nodeName){case "source":var d=c.getAttribute("id");void 0==Z[d]&&(Z[d]=(new z(d)).parse(c));break;case "vertices":this.vertices=(new u).parse(c);break;case "triangles":this.primitives.push((new t).parse(c));break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new s).parse(c))}}this.geometry3js=new THREE.Geometry;a=Z[this.vertices.input.POSITION.source].data;for(b=0;b<a.length;b+=3)this.geometry3js.vertices.push(new THREE.Vertex(ka(a,
b)));for(b=0;b<this.primitives.length;b++)a=this.primitives[b],a.setVertices(this.vertices),this.handlePrimitive(a,this.geometry3js);this.geometry3js.computeCentroids();this.geometry3js.computeFaceNormals();this.geometry3js.computeVertexNormals();this.geometry3js.computeBoundingBox();return this};r.prototype.handlePrimitive=function(a,b){var c=0,d,e,f=a.p,g=a.inputs,h,i,j,k,l=0,m=3,o=[];for(d=0;d<g.length;d++)switch(h=g[d],h.semantic){case "TEXCOORD":o.push(h.set)}for(;c<f.length;){var n=[],p=[],
r={},q=[];a.vcount&&(m=a.vcount[l++]);for(d=0;d<m;d++)for(e=0;e<g.length;e++)switch(h=g[e],k=Z[h.source],i=f[c+d*g.length+h.offset],j=k.accessor.params.length,j*=i,h.semantic){case "VERTEX":n.push(i);break;case "NORMAL":p.push(ka(k.data,j));break;case "TEXCOORD":void 0===r[h.set]&&(r[h.set]=[]);r[h.set].push(new THREE.UV(k.data[j],1-k.data[j+1]));break;case "COLOR":q.push((new THREE.Color).setRGB(k.data[j],k.data[j+1],k.data[j+2]))}e=null;d=[];if(3===m)d.push(new THREE.Face3(n[0],n[1],n[2],[p[0],
p[1],p[2]],q.length?q:new THREE.Color));else if(4===m)d.push(new THREE.Face4(n[0],n[1],n[2],n[3],[p[0],p[1],p[2],p[3]],q.length?q:new THREE.Color));else if(4<m&&R.subdivideFaces){q=q.length?q:new THREE.Color;for(e=1;e<m-1;)d.push(new THREE.Face3(n[0],n[e],n[e+1],[p[0],p[e++],p[e]],q))}if(d.length){n=0;for(p=d.length;n<p;n++){e=d[n];e.daeMaterial=a.material;b.faces.push(e);for(e=0;e<o.length;e++)q=r[o[e]],q=4<m?[q[0],q[n+1],q[n+2]]:4===m?[q[0],q[1],q[2],q[3]]:[q[0],q[1],q[2]],b.faceVertexUvs[e]||(b.faceVertexUvs[e]=
[]),b.faceVertexUvs[e].push(q)}}else console.log("dropped face with vcount "+m+" for geometry with id: "+b.id);c+=g.length*m}};s.prototype=new t;s.prototype.constructor=s;t.prototype.setVertices=function(a){for(var b=0;b<this.inputs.length;b++)if(this.inputs[b].source==a.id)this.inputs[b].source=a.input.POSITION.source};t.prototype.parse=function(a){this.inputs=[];this.material=a.getAttribute("material");this.count=O(a,"count",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "input":this.inputs.push((new w).parse(a.childNodes[b]));
break;case "vcount":this.vcount=M(c.textContent);break;case "p":this.p=M(c.textContent)}}return this};v.prototype.parse=function(a){this.params=[];this.source=a.getAttribute("source");this.count=O(a,"count",0);this.stride=O(a,"stride",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if("param"==c.nodeName){var d={};d.name=c.getAttribute("name");d.type=c.getAttribute("type");this.params.push(d)}}return this};u.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++)if("input"==
a.childNodes[b].nodeName){var c=(new w).parse(a.childNodes[b]);this.input[c.semantic]=c}return this};w.prototype.parse=function(a){this.semantic=a.getAttribute("semantic");this.source=a.getAttribute("source").replace(/^#/,"");this.set=O(a,"set",-1);this.offset=O(a,"offset",0);if("TEXCOORD"==this.semantic&&0>this.set)this.set=0;return this};z.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "bool_array":for(var d=
S(c.textContent).split(/\s+/),e=[],f=0;f<d.length;f++)e.push("true"==d[f]||"1"==d[f]?!0:!1);this.data=e;this.type=c.nodeName;break;case "float_array":this.data=N(c.textContent);this.type=c.nodeName;break;case "int_array":this.data=M(c.textContent);this.type=c.nodeName;break;case "IDREF_array":case "Name_array":this.data=S(c.textContent).split(/\s+/);this.type=c.nodeName;break;case "technique_common":for(d=0;d<c.childNodes.length;d++)if("accessor"==c.childNodes[d].nodeName){this.accessor=(new v).parse(c.childNodes[d]);
break}}}return this};z.prototype.read=function(){var a=[],b=this.accessor.params[0];switch(b.type){case "IDREF":case "Name":case "name":case "float":return this.data;case "float4x4":for(b=0;b<this.data.length;b+=16){var c=this.data.slice(b,b+16),c=ca(c);a.push(c)}break;default:console.log("ColladaLoader: Source: Read dont know how to read "+b.type+".")}return a};x.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");for(var b=0;b<a.childNodes.length;b++)if("instance_effect"==
a.childNodes[b].nodeName){this.instance_effect=(new B).parse(a.childNodes[b]);break}return this};A.prototype.isColor=function(){return null==this.texture};A.prototype.isTexture=function(){return null!=this.texture};A.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "color":c=N(c.textContent);this.color=new THREE.Color(0);this.color.setRGB(c[0],c[1],c[2]);this.color.a=c[3];break;case "texture":this.texture=c.getAttribute("texture"),
this.texcoord=c.getAttribute("texcoord"),this.texOpts={offsetU:0,offsetV:0,repeatU:1,repeatV:1,wrapU:1,wrapV:1},this.parseTexture(c)}}return this};A.prototype.parseTexture=function(a){if(!a.childNodes)return this;a.childNodes[1]&&"extra"===a.childNodes[1].nodeName&&(a=a.childNodes[1],a.childNodes[1]&&"technique"===a.childNodes[1].nodeName&&(a=a.childNodes[1]));for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "offsetU":case "offsetV":case "repeatU":case "repeatV":this.texOpts[c.nodeName]=
parseFloat(c.textContent);break;case "wrapU":case "wrapV":this.texOpts[c.nodeName]=parseInt(c.textContent);break;default:this.texOpts[c.nodeName]=c.textContent}}return this};F.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[c.nodeName]=(new A).parse(c);break;case "shininess":case "reflectivity":case "transparency":var d;d=Q.evaluate(".//dae:float",
c,K,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);for(var e=d.iterateNext(),f=[];e;)f.push(e),e=d.iterateNext();d=f;0<d.length&&(this[c.nodeName]=parseFloat(d[0].textContent))}}this.create();return this};F.prototype.create=function(){var a={},b=void 0!==this.transparency&&1>this.transparency,c;for(c in this)switch(c){case "ambient":case "emission":case "diffuse":case "specular":var d=this[c];if(d instanceof A)if(d.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==
this.effect.surface.sid){var e=da[this.effect.surface.init_from];if(e)e=THREE.ImageUtils.loadTexture(ma+e.init_from),e.wrapS=d.texOpts.wrapU?THREE.RepeatWrapping:THREE.ClampToEdgeWrapping,e.wrapT=d.texOpts.wrapV?THREE.RepeatWrapping:THREE.ClampToEdgeWrapping,e.offset.x=d.texOpts.offsetU,e.offset.y=d.texOpts.offsetV,e.repeat.x=d.texOpts.repeatU,e.repeat.y=d.texOpts.repeatV,a.map=e}}else"diffuse"==c?a.color=d.color.getHex():b||(a[c]=d.color.getHex());break;case "shininess":case "reflectivity":a[c]=
this[c];break;case "transparency":if(b)a.transparent=!0,a.opacity=this[c],b=!0}a.shading=na;return this.material=new THREE.MeshLambertMaterial(a)};E.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "init_from":this.init_from=c.textContent;break;case "format":this.format=c.textContent;break;default:console.log("unhandled Surface prop: "+c.nodeName)}}return this};I.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=
a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "source":this.source=c.textContent;break;case "minfilter":this.minfilter=c.textContent;break;case "magfilter":this.magfilter=c.textContent;break;case "mipfilter":this.mipfilter=c.textContent;break;case "wrap_s":this.wrap_s=c.textContent;break;case "wrap_t":this.wrap_t=c.textContent;break;default:console.log("unhandled Sampler2D prop: "+c.nodeName)}}return this};J.prototype.create=function(){if(null==this.shader)return null};J.prototype.parse=
function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.shader=null;for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "profile_COMMON":this.parseTechnique(this.parseProfileCOMMON(c))}}return this};J.prototype.parseNewparam=function(a){for(var b=a.getAttribute("sid"),c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(1==d.nodeType)switch(d.nodeName){case "surface":this.surface=(new E(this)).parse(d);this.surface.sid=b;
break;case "sampler2D":this.sampler=(new I(this)).parse(d);this.sampler.sid=b;break;case "extra":break;default:console.log(d.nodeName)}}};J.prototype.parseProfileCOMMON=function(a){for(var b,c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(1==d.nodeType)switch(d.nodeName){case "profile_COMMON":this.parseProfileCOMMON(d);break;case "technique":b=d;break;case "newparam":this.parseNewparam(d);break;case "extra":break;default:console.log(d.nodeName)}}return b};J.prototype.parseTechnique=function(a){for(var b=
0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "constant":case "lambert":case "blinn":case "phong":this.shader=(new F(c.nodeName,this)).parse(c)}}};B.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");return this};G.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.source={};for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "source":c=
(new z).parse(c);this.source[c.id]=c;break;case "sampler":this.sampler.push((new H(this)).parse(c));break;case "channel":this.channel.push((new D(this)).parse(c))}}return this};D.prototype.parse=function(a){this.source=a.getAttribute("source").replace(/^#/,"");this.target=a.getAttribute("target");var b=this.target.split("/");b.shift();var a=b.shift(),c=0<=a.indexOf("."),d=0<=a.indexOf("(");if(c)b=a.split("."),this.sid=b.shift(),this.member=b.shift();else if(d){b=a.split("(");this.sid=b.shift();for(var e=
0;e<b.length;e++)b[e]=parseInt(b[e].replace(/\)/,""));this.arrIndices=b}else this.sid=a;this.fullSid=a;this.dotSyntax=c;this.arrSyntax=d;return this};H.prototype.parse=function(a){this.id=a.getAttribute("id");this.inputs=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "input":this.inputs.push((new w).parse(c))}}return this};H.prototype.create=function(){for(var a=0;a<this.inputs.length;a++){var b=this.inputs[a],c=this.animation.source[b.source];
switch(b.semantic){case "INPUT":this.input=c.read();break;case "OUTPUT":this.output=c.read();this.strideOut=c.accessor.stride;break;case "INTERPOLATION":this.interpolation=c.read();break;case "IN_TANGENT":break;case "OUT_TANGENT":break;default:console.log(b.semantic)}}this.duration=this.endTime=this.startTime=0;if(this.input.length){this.startTime=1E8;this.endTime=-1E8;for(a=0;a<this.input.length;a++)this.startTime=Math.min(this.startTime,this.input[a]),this.endTime=Math.max(this.endTime,this.input[a]);
this.duration=this.endTime-this.startTime}};H.prototype.getData=function(a,b){var c;if(1<this.strideOut){c=[];for(var b=b*this.strideOut,d=0;d<this.strideOut;++d)c[d]=this.output[b+d];if(3===this.strideOut)switch(a){case "rotate":case "translate":P(c,-1);break;case "scale":P(c,1)}}else c=this.output[b];return c};y.prototype.addTarget=function(a,b,c,d){this.targets.push({sid:a,member:c,transform:b,data:d})};y.prototype.apply=function(a){for(var b=0;b<this.targets.length;++b){var c=this.targets[b];
(!a||c.sid===a)&&c.transform.update(c.data,c.member)}};y.prototype.getTarget=function(a){for(var b=0;b<this.targets.length;++b)if(this.targets[b].sid===a)return this.targets[b];return null};y.prototype.hasTarget=function(a){for(var b=0;b<this.targets.length;++b)if(this.targets[b].sid===a)return!0;return!1};y.prototype.interpolate=function(a,b){for(var c=0;c<this.targets.length;++c){var d=this.targets[c],e=a.getTarget(d.sid);if(e){var f=(b-this.time)/(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(var e=[],i=0;i<h.length;++i)e[i]=h[i]+(g[i]-h[i])*f;else e=h+(g-h)*f}else e=d.data;d.transform.update(e,d.member)}};L.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "optics":this.parseOptics(c)}}return this};L.prototype.parseOptics=function(a){for(var b=0;b<a.childNodes.length;b++)if("technique_common"==
a.childNodes[b].nodeName)for(var c=a.childNodes[b],d=0;d<c.childNodes.length;d++)if("perspective"==c.childNodes[d].nodeName)for(var e=c.childNodes[d],f=0;f<e.childNodes.length;f++){var g=e.childNodes[f];switch(g.nodeName){case "xfov":this.fov=g.textContent;break;case "znear":this.znear=0.4;break;case "zfar":this.zfar=1E15;break;case "aspect_ratio":this.aspect_ratio=g.textContent}}return this};C.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");return this};return{load:function(b,
c,d){var e=0;if(document.implementation&&document.implementation.createDocument){var f=new XMLHttpRequest;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,void 0,b)):console.error("ColladaLoader: Empty or non-existing file ("+b+")")}else 3==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)}else alert("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=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;
THREE.JSONLoader.prototype.load=function(a,b,c){if(a instanceof Object)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){var g=new XMLHttpRequest,e=0;g.onreadystatechange=function(){if(4==g.readyState)if(200==g.status||0==g.status){try{var h=JSON.parse(g.responseText)}catch(i){console.warn("DEPRECATED: ["+b+"] seems to be using old model format")}a.createModel(h,c,d);a.onLoadComplete()}else console.error("Couldn't load ["+b+"] ["+g.status+"]");else 3==g.readyState?f&&(0==e&&(e=g.getResponseHeader("Content-Length")),f({total:e,loaded:g.responseText.length})):
2==g.readyState&&(e=g.getResponseHeader("Content-Length"))};g.open("GET",b,!0);g.overrideMimeType&&g.overrideMimeType("text/plain; charset=x-user-defined");g.setRequestHeader("Content-Type","text/plain");g.send(null)};
......@@ -320,16 +322,16 @@ l=a.morphTargets[c].vertices;for(i=0,k=l.length;i<k;i+=3)j=l[i]*b,m=l[i+1]*b,p=l
d.computeTangents();b(d)};THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};THREE.SceneLoader.prototype.constructor=THREE.SceneLoader;
THREE.SceneLoader.prototype.load=function(a,b){var c=this,d=new XMLHttpRequest;d.onreadystatechange=function(){if(4==d.readyState)if(200==d.status||0==d.status)try{var f=JSON.parse(d.responseText);void 0===f.metadata||void 0===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")}else console.error("Couldn't load ["+a+"] ["+d.status+"]")};
d.open("GET",a,!0);d.overrideMimeType&&d.overrideMimeType("text/plain; charset=x-user-defined");d.setRequestHeader("Content-Type","text/plain");d.send(null)};
THREE.SceneLoader.prototype.createScene=function(a,b,c){function d(a,b){return"relativeToHTML"==b?a:k+"/"+a}function f(){var a;for(p in B.objects)if(!C.objects[p])if(r=B.objects[p],void 0!==r.geometry){if(F=C.geometries[r.geometry]){a=!1;for(L=0;L<r.materials.length;L++)J=C.materials[r.materials[L]],a=J instanceof THREE.ShaderMaterial;a&&F.computeTangents();v=r.position;u=r.rotation;w=r.quaternion;z=r.scale;w=0;0==J.length&&(J=new THREE.MeshFaceMaterial);1<J.length&&(J=new THREE.MeshFaceMaterial);
THREE.SceneLoader.prototype.createScene=function(a,b,c){function d(a,b){return"relativeToHTML"==b?a:k+"/"+a}function f(){var a;for(p in B.objects)if(!C.objects[p])if(r=B.objects[p],void 0!==r.geometry){if(F=C.geometries[r.geometry]){a=!1;for(K=0;K<r.materials.length;K++)J=C.materials[r.materials[K]],a=J instanceof THREE.ShaderMaterial;a&&F.computeTangents();v=r.position;u=r.rotation;w=r.quaternion;z=r.scale;w=0;0==J.length&&(J=new THREE.MeshFaceMaterial);1<J.length&&(J=new THREE.MeshFaceMaterial);
a=new THREE.Mesh(F,J);a.name=p;a.position.set(v[0],v[1],v[2]);w?(a.quaternion.set(w[0],w[1],w[2],w[3]),a.useQuaternion=!0):a.rotation.set(u[0],u[1],u[2]);a.scale.set(z[0],z[1],z[2]);a.visible=r.visible;C.scene.add(a);C.objects[p]=a;if(r.meshCollider){var b=THREE.CollisionUtils.MeshColliderWBox(a);C.scene.collisions.colliders.push(b)}if(r.castsShadow)b=new THREE.ShadowVolume(F),C.scene.add(b),b.position=a.position,b.rotation=a.rotation,b.scale=a.scale;r.trigger&&"none"!=r.trigger.toLowerCase()&&(b=
{type:r.trigger,object:r},C.triggers[a.name]=b)}}else v=r.position,u=r.rotation,w=r.quaternion,z=r.scale,w=0,a=new THREE.Object3D,a.name=p,a.position.set(v[0],v[1],v[2]),w?(a.quaternion.set(w[0],w[1],w[2],w[3]),a.useQuaternion=!0):a.rotation.set(u[0],u[1],u[2]),a.scale.set(z[0],z[1],z[2]),a.visible=void 0!==r.visible?r.visible:!1,C.scene.add(a),C.objects[p]=a,C.empties[p]=a,r.trigger&&"none"!=r.trigger.toLowerCase()&&(b={type:r.trigger,object:r},C.triggers[a.name]=b)}function g(a){return function(b){C.geometries[a]=
b;f();D-=1;i.onLoadComplete();h()}}function e(a){return function(b){C.geometries[a]=b}}function h(){i.callbackProgress({totalModels:y,totalTextures:K,loadedModels:y-D,loadedTextures:K-H},C);i.onLoadProgress();0==D&&0==H&&b(C)}var i=this,k=THREE.Loader.prototype.extractUrlbase(c),j,m,p,n,l,o,q,r,s,t,v,u,w,z,x,A,F,E,I,J,B,G,D,H,y,K,C;B=a;c=new THREE.BinaryLoader;G=new THREE.JSONLoader;H=D=0;C={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},
b;f();D-=1;i.onLoadComplete();h()}}function e(a){return function(b){C.geometries[a]=b}}function h(){i.callbackProgress({totalModels:y,totalTextures:L,loadedModels:y-D,loadedTextures:L-H},C);i.onLoadProgress();0==D&&0==H&&b(C)}var i=this,k=THREE.Loader.prototype.extractUrlbase(c),j,m,p,n,l,o,q,r,s,t,v,u,w,z,x,A,F,E,I,J,B,G,D,H,y,L,C;B=a;c=new THREE.BinaryLoader;G=new THREE.JSONLoader;H=D=0;C={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},
empties:{}};a=!1;for(p in B.objects)if(r=B.objects[p],r.meshCollider){a=!0;break}if(a)C.scene.collisions=new THREE.CollisionSystem;if(B.transform)a=B.transform.position,s=B.transform.rotation,x=B.transform.scale,a&&C.scene.position.set(a[0],a[1],a[2]),s&&C.scene.rotation.set(s[0],s[1],s[2]),x&&C.scene.scale.set(x[0],x[1],x[2]),(a||s||x)&&C.scene.updateMatrix();a=function(){H-=1;h();i.onLoadComplete()};for(l in B.cameras)x=B.cameras[l],"perspective"==x.type?E=new THREE.PerspectiveCamera(x.fov,x.aspect,
x.near,x.far):"ortho"==x.type&&(E=new THREE.OrthographicCamera(x.left,x.right,x.top,x.bottom,x.near,x.far)),v=x.position,s=x.target,x=x.up,E.position.set(v[0],v[1],v[2]),E.target=new THREE.Vector3(s[0],s[1],s[2]),x&&E.up.set(x[0],x[1],x[2]),C.cameras[l]=E;for(n in B.lights)s=B.lights[n],l=void 0!==s.color?s.color:16777215,E=void 0!==s.intensity?s.intensity:1,"directional"==s.type?(v=s.direction,t=new THREE.DirectionalLight(l,E),t.position.set(v[0],v[1],v[2]),t.position.normalize()):"point"==s.type?
(v=s.position,t=s.distance,t=new THREE.PointLight(l,E,t),t.position.set(v[0],v[1],v[2])):"ambient"==s.type&&(t=new THREE.AmbientLight(l)),C.scene.add(t),C.lights[n]=t;for(o in B.fogs)n=B.fogs[o],"linear"==n.type?I=new THREE.Fog(0,n.near,n.far):"exp2"==n.type&&(I=new THREE.FogExp2(0,n.density)),x=n.color,I.color.setRGB(x[0],x[1],x[2]),C.fogs[o]=I;if(C.cameras&&B.defaults.camera)C.currentCamera=C.cameras[B.defaults.camera];if(C.fogs&&B.defaults.fog)C.scene.fog=C.fogs[B.defaults.fog];x=B.defaults.bgcolor;
C.bgColor=new THREE.Color;C.bgColor.setRGB(x[0],x[1],x[2]);C.bgColorAlpha=B.defaults.bgalpha;for(j in B.geometries)if(o=B.geometries[j],"bin_mesh"==o.type||"ascii_mesh"==o.type)D+=1,i.onLoadStart();y=D;for(j in B.geometries)o=B.geometries[j],"cube"==o.type?(F=new THREE.CubeGeometry(o.width,o.height,o.depth,o.segmentsWidth,o.segmentsHeight,o.segmentsDepth,null,o.flipped,o.sides),C.geometries[j]=F):"plane"==o.type?(F=new THREE.PlaneGeometry(o.width,o.height,o.segmentsWidth,o.segmentsHeight),C.geometries[j]=
F):"sphere"==o.type?(F=new THREE.SphereGeometry(o.radius,o.segmentsWidth,o.segmentsHeight),C.geometries[j]=F):"cylinder"==o.type?(F=new THREE.CylinderGeometry(o.topRad,o.botRad,o.height,o.radSegs,o.heightSegs),C.geometries[j]=F):"torus"==o.type?(F=new THREE.TorusGeometry(o.radius,o.tube,o.segmentsR,o.segmentsT),C.geometries[j]=F):"icosahedron"==o.type?(F=new THREE.IcosahedronGeometry(o.subdivisions),C.geometries[j]=F):"bin_mesh"==o.type?c.load(d(o.url,B.urlBaseType),g(j)):"ascii_mesh"==o.type?G.load(d(o.url,
B.urlBaseType),g(j)):"embedded_mesh"==o.type&&(o=B.embeds[o.id])&&G.createModel(o,e(j),"");for(q in B.textures)if(j=B.textures[q],j.url instanceof Array){H+=j.url.length;for(o=0;o<j.url.length;o++)i.onLoadStart()}else H+=1,i.onLoadStart();K=H;for(q in B.textures){j=B.textures[q];if(void 0!=j.mapping&&void 0!=THREE[j.mapping])j.mapping=new THREE[j.mapping];if(j.url instanceof Array){o=[];for(var L=0;L<j.url.length;L++)o[L]=d(j.url[L],B.urlBaseType);o=THREE.ImageUtils.loadTextureCube(o,j.mapping,a)}else{o=
B.urlBaseType),g(j)):"embedded_mesh"==o.type&&(o=B.embeds[o.id])&&G.createModel(o,e(j),"");for(q in B.textures)if(j=B.textures[q],j.url instanceof Array){H+=j.url.length;for(o=0;o<j.url.length;o++)i.onLoadStart()}else H+=1,i.onLoadStart();L=H;for(q in B.textures){j=B.textures[q];if(void 0!=j.mapping&&void 0!=THREE[j.mapping])j.mapping=new THREE[j.mapping];if(j.url instanceof Array){o=[];for(var K=0;K<j.url.length;K++)o[K]=d(j.url[K],B.urlBaseType);o=THREE.ImageUtils.loadTextureCube(o,j.mapping,a)}else{o=
THREE.ImageUtils.loadTexture(d(j.url,B.urlBaseType),j.mapping,a);if(void 0!=THREE[j.minFilter])o.minFilter=THREE[j.minFilter];if(void 0!=THREE[j.magFilter])o.magFilter=THREE[j.magFilter];if(j.repeat){o.repeat.set(j.repeat[0],j.repeat[1]);if(1!=j.repeat[0])o.wrapS=THREE.RepeatWrapping;if(1!=j.repeat[1])o.wrapT=THREE.RepeatWrapping}j.offset&&o.offset.set(j.offset[0],j.offset[1]);if(j.wrap){I={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(void 0!==I[j.wrap[0]])o.wrapS=I[j.wrap[0]];
if(void 0!==I[j.wrap[1]])o.wrapT=I[j.wrap[1]]}}C.textures[q]=o}for(m in B.materials){q=B.materials[m];for(A in q.parameters)if("envMap"==A||"map"==A||"lightMap"==A)q.parameters[A]=C.textures[q.parameters[A]];else if("shading"==A)q.parameters[A]="flat"==q.parameters[A]?THREE.FlatShading:THREE.SmoothShading;else if("blending"==A)q.parameters[A]=THREE[q.parameters[A]]?THREE[q.parameters[A]]:THREE.NormalBlending;else if("combine"==A)q.parameters[A]="MixOperation"==q.parameters[A]?THREE.MixOperation:THREE.MultiplyOperation;
else if("vertexColors"==A)if("face"==q.parameters[A])q.parameters[A]=THREE.FaceColors;else if(q.parameters[A])q.parameters[A]=THREE.VertexColors;if(void 0!==q.parameters.opacity&&1>q.parameters.opacity)q.parameters.transparent=!0;if(q.parameters.normalMap){j=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(j.uniforms);o=q.parameters.color;I=q.parameters.specular;c=q.parameters.ambient;G=q.parameters.shininess;a.tNormal.texture=C.textures[q.parameters.normalMap];if(q.parameters.normalMapFactor)a.uNormalScale.value=
......
// ThreeSVG.js r47 - http://github.com/mrdoob/three.js
// ThreeSVG.js r48dev - http://github.com/mrdoob/three.js
'use strict';var THREE=THREE||{};if(!self.Int32Array)self.Int32Array=Array,self.Float32Array=Array;
(function(){for(var a=0,b=["ms","moz","webkit","o"],c=0;c<b.length&&!window.requestAnimationFrame;++c)window.requestAnimationFrame=window[b[c]+"RequestAnimationFrame"],window.cancelAnimationFrame=window[b[c]+"CancelAnimationFrame"]||window[b[c]+"RequestCancelAnimationFrame"];if(!window.requestAnimationFrame)window.requestAnimationFrame=function(b){var c=(new Date).getTime(),f=Math.max(0,16-(c-a)),g=window.setTimeout(function(){b(c+f)},f);a=c+f;return g};if(!window.cancelAnimationFrame)window.cancelAnimationFrame=
function(a){clearTimeout(a)}})();THREE.Color=function(a){void 0!==a&&this.setHex(a);return this};
......
// ThreeWebGL.js r47 - http://github.com/mrdoob/three.js
// ThreeWebGL.js r48dev - http://github.com/mrdoob/three.js
'use strict';var THREE=THREE||{};if(!self.Int32Array)self.Int32Array=Array,self.Float32Array=Array;
(function(){for(var a=0,b=["ms","moz","webkit","o"],c=0;c<b.length&&!window.requestAnimationFrame;++c)window.requestAnimationFrame=window[b[c]+"RequestAnimationFrame"],window.cancelAnimationFrame=window[b[c]+"CancelAnimationFrame"]||window[b[c]+"RequestCancelAnimationFrame"];if(!window.requestAnimationFrame)window.requestAnimationFrame=function(b){var c=(new Date).getTime(),f=Math.max(0,16-(c-a)),h=window.setTimeout(function(){b(c+f)},f);a=c+f;return h};if(!window.cancelAnimationFrame)window.cancelAnimationFrame=
function(a){clearTimeout(a)}})();THREE.Color=function(a){void 0!==a&&this.setHex(a);return this};
......
......@@ -3623,7 +3623,9 @@ THREE.ColladaLoader = function () {
}
function Camera () {
};
function Camera() {
this.id = "";
this.name = "";
......@@ -3675,6 +3677,7 @@ THREE.ColladaLoader = function () {
for ( var k = 0; k < perspective.childNodes.length; k ++ ) {
var param = perspective.childNodes[ k ];
switch ( param.nodeName ) {
case 'xfov':
......@@ -3705,6 +3708,7 @@ THREE.ColladaLoader = function () {
return this;
};
function InstanceCamera() {
this.url = "";
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册