|
|
@@ -1,19 +1,19 @@
|
|
|
// ThreeExtras.js r46dev - http://github.com/mrdoob/three.js
|
|
|
-THREE.ColorUtils={adjustHSV:function(a,c,b,e){var g=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(a,g);g.h=THREE.Math.clamp(g.h+c,0,1);g.s=THREE.Math.clamp(g.s+b,0,1);g.v=THREE.Math.clamp(g.v+e,0,1);a.setHSV(g.h,g.s,g.v)},rgbToHsv:function(a,c){var b=a.r,e=a.g,g=a.b,h=Math.max(Math.max(b,e),g),f=Math.min(Math.min(b,e),g);if(f===h)f=b=0;else{var k=h-f,f=k/h,b=b===h?(e-g)/k:e===h?2+(g-b)/k:4+(b-e)/k;b/=6;b<0&&(b+=1);b>1&&(b-=1)}c===void 0&&(c={h:0,s:0,v:0});c.h=b;c.s=f;c.v=h;return c}};
|
|
|
+THREE.ColorUtils={adjustHSV:function(a,c,b,d){var f=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(a,f);f.h=THREE.Math.clamp(f.h+c,0,1);f.s=THREE.Math.clamp(f.s+b,0,1);f.v=THREE.Math.clamp(f.v+d,0,1);a.setHSV(f.h,f.s,f.v)},rgbToHsv:function(a,c){var b=a.r,d=a.g,f=a.b,g=Math.max(Math.max(b,d),f),e=Math.min(Math.min(b,d),f);if(e===g)e=b=0;else{var h=g-e,e=h/g,b=b===g?(d-f)/h:d===g?2+(f-b)/h:4+(b-d)/h;b/=6;b<0&&(b+=1);b>1&&(b-=1)}c===void 0&&(c={h:0,s:0,v:0});c.h=b;c.s=e;c.v=g;return c}};
|
|
|
THREE.ColorUtils.__hsv={h:0,s:0,v:0};
|
|
|
-THREE.GeometryUtils={merge:function(a,c){for(var b,e,g=a.vertices.length,h=c instanceof THREE.Mesh?c.geometry:c,f=a.vertices,k=h.vertices,l=a.faces,m=h.faces,n=a.faceVertexUvs[0],o=h.faceVertexUvs[0],u={},p=0;p<a.materials.length;p++)u[a.materials[p].id]=p;if(c instanceof THREE.Mesh)c.matrixAutoUpdate&&c.updateMatrix(),b=c.matrix,e=new THREE.Matrix4,e.extractRotation(b,c.scale);for(var p=0,z=k.length;p<z;p++){var w=new THREE.Vertex(k[p].position.clone());b&&b.multiplyVector3(w.position);f.push(w)}p=
|
|
|
-0;for(z=m.length;p<z;p++){var f=m[p],x,v,y=f.vertexNormals,t=f.vertexColors;f instanceof THREE.Face3?x=new THREE.Face3(f.a+g,f.b+g,f.c+g):f instanceof THREE.Face4&&(x=new THREE.Face4(f.a+g,f.b+g,f.c+g,f.d+g));x.normal.copy(f.normal);e&&e.multiplyVector3(x.normal);k=0;for(w=y.length;k<w;k++)v=y[k].clone(),e&&e.multiplyVector3(v),x.vertexNormals.push(v);x.color.copy(f.color);k=0;for(w=t.length;k<w;k++)v=t[k],x.vertexColors.push(v.clone());if(f.materialIndex!==void 0){k=h.materials[f.materialIndex];
|
|
|
-w=u[k.id];if(w===void 0)w=a.materials.length,a.materials.push(k);x.materialIndex=w}x.centroid.copy(f.centroid);b&&b.multiplyVector3(x.centroid);l.push(x)}p=0;for(z=o.length;p<z;p++){b=o[p];e=[];k=0;for(w=b.length;k<w;k++)e.push(new THREE.UV(b[k].u,b[k].v));n.push(e)}},clone:function(a){var c=new THREE.Geometry,b,e=a.vertices,g=a.faces,h=a.faceVertexUvs[0];if(a.materials)c.materials=a.materials.slice();a=0;for(b=e.length;a<b;a++){var f=new THREE.Vertex(e[a].position.clone());c.vertices.push(f)}a=0;
|
|
|
-for(b=g.length;a<b;a++){var k=g[a],l,m,n=k.vertexNormals,o=k.vertexColors;k instanceof THREE.Face3?l=new THREE.Face3(k.a,k.b,k.c):k instanceof THREE.Face4&&(l=new THREE.Face4(k.a,k.b,k.c,k.d));l.normal.copy(k.normal);e=0;for(f=n.length;e<f;e++)m=n[e],l.vertexNormals.push(m.clone());l.color.copy(k.color);e=0;for(f=o.length;e<f;e++)m=o[e],l.vertexColors.push(m.clone());l.materialIndex=k.materialIndex;l.centroid.copy(k.centroid);c.faces.push(l)}a=0;for(b=h.length;a<b;a++){g=h[a];l=[];e=0;for(f=g.length;e<
|
|
|
-f;e++)l.push(new THREE.UV(g[e].u,g[e].v));c.faceVertexUvs[0].push(l)}return c},randomPointInTriangle:function(a,c,b){var e,g,h,f=new THREE.Vector3,k=THREE.GeometryUtils.__v1;e=THREE.GeometryUtils.random();g=THREE.GeometryUtils.random();e+g>1&&(e=1-e,g=1-g);h=1-e-g;f.copy(a);f.multiplyScalar(e);k.copy(c);k.multiplyScalar(g);f.addSelf(k);k.copy(b);k.multiplyScalar(h);f.addSelf(k);return f},randomPointInFace:function(a,c,b){var e,g,h;if(a instanceof THREE.Face3)return e=c.vertices[a.a].position,g=c.vertices[a.b].position,
|
|
|
-h=c.vertices[a.c].position,THREE.GeometryUtils.randomPointInTriangle(e,g,h);else if(a instanceof THREE.Face4){e=c.vertices[a.a].position;g=c.vertices[a.b].position;h=c.vertices[a.c].position;var c=c.vertices[a.d].position,f;b?a._area1&&a._area2?(b=a._area1,f=a._area2):(b=THREE.GeometryUtils.triangleArea(e,g,c),f=THREE.GeometryUtils.triangleArea(g,h,c),a._area1=b,a._area2=f):(b=THREE.GeometryUtils.triangleArea(e,g,c),f=THREE.GeometryUtils.triangleArea(g,h,c));return THREE.GeometryUtils.random()*(b+
|
|
|
-f)<b?THREE.GeometryUtils.randomPointInTriangle(e,g,c):THREE.GeometryUtils.randomPointInTriangle(g,h,c)}},randomPointsInGeometry:function(a,c){function b(a){function b(e,c){if(c<e)return e;var f=e+Math.floor((c-e)/2);return m[f]>a?b(e,f-1):m[f]<a?b(f+1,c):f}return b(0,m.length-1)}var e,g,h=a.faces,f=a.vertices,k=h.length,l=0,m=[],n,o,u,p;for(g=0;g<k;g++){e=h[g];if(e instanceof THREE.Face3)n=f[e.a].position,o=f[e.b].position,u=f[e.c].position,e._area=THREE.GeometryUtils.triangleArea(n,o,u);else if(e instanceof
|
|
|
-THREE.Face4)n=f[e.a].position,o=f[e.b].position,u=f[e.c].position,p=f[e.d].position,e._area1=THREE.GeometryUtils.triangleArea(n,o,p),e._area2=THREE.GeometryUtils.triangleArea(o,u,p),e._area=e._area1+e._area2;l+=e._area;m[g]=l}e=[];f={};for(g=0;g<c;g++)k=THREE.GeometryUtils.random()*l,k=b(k),e[g]=THREE.GeometryUtils.randomPointInFace(h[k],a,!0),f[k]?f[k]+=1:f[k]=1;return e},triangleArea:function(a,c,b){var e,g=THREE.GeometryUtils.__v1;g.sub(a,c);e=g.length();g.sub(a,b);a=g.length();g.sub(c,b);b=g.length();
|
|
|
-c=0.5*(e+a+b);return Math.sqrt(c*(c-e)*(c-a)*(c-b))},center:function(a){a.computeBoundingBox();var c=new THREE.Matrix4;c.setTranslation(-0.5*(a.boundingBox.x[1]+a.boundingBox.x[0]),-0.5*(a.boundingBox.y[1]+a.boundingBox.y[0]),-0.5*(a.boundingBox.z[1]+a.boundingBox.z[0]));a.applyMatrix(c);a.computeBoundingBox()}};THREE.GeometryUtils.random=THREE.Math.random16;THREE.GeometryUtils.__v1=new THREE.Vector3;
|
|
|
-THREE.ImageUtils={loadTexture:function(a,c,b){var e=new Image,g=new THREE.Texture(e,c);e.onload=function(){g.needsUpdate=!0;b&&b(this)};e.crossOrigin="";e.src=a;return g},loadTextureCube:function(a,c,b){var e,g=[],h=new THREE.Texture(g,c),c=g.loadCount=0;for(e=a.length;c<e;++c)g[c]=new Image,g[c].onload=function(){g.loadCount+=1;if(g.loadCount===6)h.needsUpdate=!0;b&&b(this)},g[c].crossOrigin="",g[c].src=a[c];return h},getNormalMap:function(a,c){var b=function(a){var b=Math.sqrt(a[0]*a[0]+a[1]*a[1]+
|
|
|
-a[2]*a[2]);return[a[0]/b,a[1]/b,a[2]/b]};c|=1;var e=a.width,g=a.height,h=document.createElement("canvas");h.width=e;h.height=g;var f=h.getContext("2d");f.drawImage(a,0,0);for(var k=f.getImageData(0,0,e,g).data,l=f.createImageData(e,g),m=l.data,n=0;n<e;n++)for(var o=1;o<g;o++){var u=o-1<0?g-1:o-1,p=(o+1)%g,z=n-1<0?e-1:n-1,w=(n+1)%e,x=[],v=[0,0,k[(o*e+n)*4]/255*c];x.push([-1,0,k[(o*e+z)*4]/255*c]);x.push([-1,-1,k[(u*e+z)*4]/255*c]);x.push([0,-1,k[(u*e+n)*4]/255*c]);x.push([1,-1,k[(u*e+w)*4]/255*c]);
|
|
|
-x.push([1,0,k[(o*e+w)*4]/255*c]);x.push([1,1,k[(p*e+w)*4]/255*c]);x.push([0,1,k[(p*e+n)*4]/255*c]);x.push([-1,1,k[(p*e+z)*4]/255*c]);u=[];z=x.length;for(p=0;p<z;p++){var w=x[p],y=x[(p+1)%z],w=[w[0]-v[0],w[1]-v[1],w[2]-v[2]],y=[y[0]-v[0],y[1]-v[1],y[2]-v[2]];u.push(b([w[1]*y[2]-w[2]*y[1],w[2]*y[0]-w[0]*y[2],w[0]*y[1]-w[1]*y[0]]))}x=[0,0,0];for(p=0;p<u.length;p++)x[0]+=u[p][0],x[1]+=u[p][1],x[2]+=u[p][2];x[0]/=u.length;x[1]/=u.length;x[2]/=u.length;v=(o*e+n)*4;m[v]=(x[0]+1)/2*255|0;m[v+1]=(x[1]+0.5)*
|
|
|
-255|0;m[v+2]=x[2]*255|0;m[v+3]=255}f.putImageData(l,0,0);return h}};THREE.SceneUtils={showHierarchy:function(a,c){THREE.SceneUtils.traverseHierarchy(a,function(a){a.visible=c})},traverseHierarchy:function(a,c){var b,e,g=a.children.length;for(e=0;e<g;e++)b=a.children[e],c(b),THREE.SceneUtils.traverseHierarchy(b,c)},createMultiMaterialObject:function(a,c){var b,e=c.length,g=new THREE.Object3D;for(b=0;b<e;b++){var h=new THREE.Mesh(a,c[b]);g.add(h)}return g}};
|
|
|
+THREE.GeometryUtils={merge:function(a,c){for(var b,d,f=a.vertices.length,g=c instanceof THREE.Mesh?c.geometry:c,e=a.vertices,h=g.vertices,i=a.faces,j=g.faces,k=a.faceVertexUvs[0],m=g.faceVertexUvs[0],o={},n=0;n<a.materials.length;n++)o[a.materials[n].id]=n;if(c instanceof THREE.Mesh)c.matrixAutoUpdate&&c.updateMatrix(),b=c.matrix,d=new THREE.Matrix4,d.extractRotation(b,c.scale);for(var n=0,t=h.length;n<t;n++){var q=new THREE.Vertex(h[n].position.clone());b&&b.multiplyVector3(q.position);e.push(q)}n=
|
|
|
+0;for(t=j.length;n<t;n++){var e=j[n],r,p,s=e.vertexNormals,l=e.vertexColors;e instanceof THREE.Face3?r=new THREE.Face3(e.a+f,e.b+f,e.c+f):e instanceof THREE.Face4&&(r=new THREE.Face4(e.a+f,e.b+f,e.c+f,e.d+f));r.normal.copy(e.normal);d&&d.multiplyVector3(r.normal);h=0;for(q=s.length;h<q;h++)p=s[h].clone(),d&&d.multiplyVector3(p),r.vertexNormals.push(p);r.color.copy(e.color);h=0;for(q=l.length;h<q;h++)p=l[h],r.vertexColors.push(p.clone());if(e.materialIndex!==void 0){h=g.materials[e.materialIndex];
|
|
|
+q=o[h.id];if(q===void 0)q=a.materials.length,a.materials.push(h);r.materialIndex=q}r.centroid.copy(e.centroid);b&&b.multiplyVector3(r.centroid);i.push(r)}n=0;for(t=m.length;n<t;n++){b=m[n];d=[];h=0;for(q=b.length;h<q;h++)d.push(new THREE.UV(b[h].u,b[h].v));k.push(d)}},clone:function(a){var c=new THREE.Geometry,b,d=a.vertices,f=a.faces,g=a.faceVertexUvs[0];if(a.materials)c.materials=a.materials.slice();a=0;for(b=d.length;a<b;a++){var e=new THREE.Vertex(d[a].position.clone());c.vertices.push(e)}a=0;
|
|
|
+for(b=f.length;a<b;a++){var h=f[a],i,j,k=h.vertexNormals,m=h.vertexColors;h instanceof THREE.Face3?i=new THREE.Face3(h.a,h.b,h.c):h instanceof THREE.Face4&&(i=new THREE.Face4(h.a,h.b,h.c,h.d));i.normal.copy(h.normal);d=0;for(e=k.length;d<e;d++)j=k[d],i.vertexNormals.push(j.clone());i.color.copy(h.color);d=0;for(e=m.length;d<e;d++)j=m[d],i.vertexColors.push(j.clone());i.materialIndex=h.materialIndex;i.centroid.copy(h.centroid);c.faces.push(i)}a=0;for(b=g.length;a<b;a++){f=g[a];i=[];d=0;for(e=f.length;d<
|
|
|
+e;d++)i.push(new THREE.UV(f[d].u,f[d].v));c.faceVertexUvs[0].push(i)}return c},randomPointInTriangle:function(a,c,b){var d,f,g,e=new THREE.Vector3,h=THREE.GeometryUtils.__v1;d=THREE.GeometryUtils.random();f=THREE.GeometryUtils.random();d+f>1&&(d=1-d,f=1-f);g=1-d-f;e.copy(a);e.multiplyScalar(d);h.copy(c);h.multiplyScalar(f);e.addSelf(h);h.copy(b);h.multiplyScalar(g);e.addSelf(h);return e},randomPointInFace:function(a,c,b){var d,f,g;if(a instanceof THREE.Face3)return d=c.vertices[a.a].position,f=c.vertices[a.b].position,
|
|
|
+g=c.vertices[a.c].position,THREE.GeometryUtils.randomPointInTriangle(d,f,g);else if(a instanceof THREE.Face4){d=c.vertices[a.a].position;f=c.vertices[a.b].position;g=c.vertices[a.c].position;var c=c.vertices[a.d].position,e;b?a._area1&&a._area2?(b=a._area1,e=a._area2):(b=THREE.GeometryUtils.triangleArea(d,f,c),e=THREE.GeometryUtils.triangleArea(f,g,c),a._area1=b,a._area2=e):(b=THREE.GeometryUtils.triangleArea(d,f,c),e=THREE.GeometryUtils.triangleArea(f,g,c));return THREE.GeometryUtils.random()*(b+
|
|
|
+e)<b?THREE.GeometryUtils.randomPointInTriangle(d,f,c):THREE.GeometryUtils.randomPointInTriangle(f,g,c)}},randomPointsInGeometry:function(a,c){function b(a){function b(d,c){if(c<d)return d;var e=d+Math.floor((c-d)/2);return j[e]>a?b(d,e-1):j[e]<a?b(e+1,c):e}return b(0,j.length-1)}var d,f,g=a.faces,e=a.vertices,h=g.length,i=0,j=[],k,m,o,n;for(f=0;f<h;f++){d=g[f];if(d instanceof THREE.Face3)k=e[d.a].position,m=e[d.b].position,o=e[d.c].position,d._area=THREE.GeometryUtils.triangleArea(k,m,o);else if(d instanceof
|
|
|
+THREE.Face4)k=e[d.a].position,m=e[d.b].position,o=e[d.c].position,n=e[d.d].position,d._area1=THREE.GeometryUtils.triangleArea(k,m,n),d._area2=THREE.GeometryUtils.triangleArea(m,o,n),d._area=d._area1+d._area2;i+=d._area;j[f]=i}d=[];e={};for(f=0;f<c;f++)h=THREE.GeometryUtils.random()*i,h=b(h),d[f]=THREE.GeometryUtils.randomPointInFace(g[h],a,!0),e[h]?e[h]+=1:e[h]=1;return d},triangleArea:function(a,c,b){var d,f=THREE.GeometryUtils.__v1;f.sub(a,c);d=f.length();f.sub(a,b);a=f.length();f.sub(c,b);b=f.length();
|
|
|
+c=0.5*(d+a+b);return Math.sqrt(c*(c-d)*(c-a)*(c-b))},center:function(a){a.computeBoundingBox();var c=new THREE.Matrix4;c.setTranslation(-0.5*(a.boundingBox.x[1]+a.boundingBox.x[0]),-0.5*(a.boundingBox.y[1]+a.boundingBox.y[0]),-0.5*(a.boundingBox.z[1]+a.boundingBox.z[0]));a.applyMatrix(c);a.computeBoundingBox()}};THREE.GeometryUtils.random=THREE.Math.random16;THREE.GeometryUtils.__v1=new THREE.Vector3;
|
|
|
+THREE.ImageUtils={loadTexture:function(a,c,b){var d=new Image,f=new THREE.Texture(d,c);d.onload=function(){f.needsUpdate=!0;b&&b(this)};d.crossOrigin="";d.src=a;return f},loadTextureCube:function(a,c,b){var d,f=[],g=new THREE.Texture(f,c),c=f.loadCount=0;for(d=a.length;c<d;++c)f[c]=new Image,f[c].onload=function(){f.loadCount+=1;if(f.loadCount===6)g.needsUpdate=!0;b&&b(this)},f[c].crossOrigin="",f[c].src=a[c];return g},getNormalMap:function(a,c){var b=function(a){var b=Math.sqrt(a[0]*a[0]+a[1]*a[1]+
|
|
|
+a[2]*a[2]);return[a[0]/b,a[1]/b,a[2]/b]};c|=1;var d=a.width,f=a.height,g=document.createElement("canvas");g.width=d;g.height=f;var e=g.getContext("2d");e.drawImage(a,0,0);for(var h=e.getImageData(0,0,d,f).data,i=e.createImageData(d,f),j=i.data,k=0;k<d;k++)for(var m=1;m<f;m++){var o=m-1<0?f-1:m-1,n=(m+1)%f,t=k-1<0?d-1:k-1,q=(k+1)%d,r=[],p=[0,0,h[(m*d+k)*4]/255*c];r.push([-1,0,h[(m*d+t)*4]/255*c]);r.push([-1,-1,h[(o*d+t)*4]/255*c]);r.push([0,-1,h[(o*d+k)*4]/255*c]);r.push([1,-1,h[(o*d+q)*4]/255*c]);
|
|
|
+r.push([1,0,h[(m*d+q)*4]/255*c]);r.push([1,1,h[(n*d+q)*4]/255*c]);r.push([0,1,h[(n*d+k)*4]/255*c]);r.push([-1,1,h[(n*d+t)*4]/255*c]);o=[];t=r.length;for(n=0;n<t;n++){var q=r[n],s=r[(n+1)%t],q=[q[0]-p[0],q[1]-p[1],q[2]-p[2]],s=[s[0]-p[0],s[1]-p[1],s[2]-p[2]];o.push(b([q[1]*s[2]-q[2]*s[1],q[2]*s[0]-q[0]*s[2],q[0]*s[1]-q[1]*s[0]]))}r=[0,0,0];for(n=0;n<o.length;n++)r[0]+=o[n][0],r[1]+=o[n][1],r[2]+=o[n][2];r[0]/=o.length;r[1]/=o.length;r[2]/=o.length;p=(m*d+k)*4;j[p]=(r[0]+1)/2*255|0;j[p+1]=(r[1]+0.5)*
|
|
|
+255|0;j[p+2]=r[2]*255|0;j[p+3]=255}e.putImageData(i,0,0);return g}};THREE.SceneUtils={showHierarchy:function(a,c){THREE.SceneUtils.traverseHierarchy(a,function(a){a.visible=c})},traverseHierarchy:function(a,c){var b,d,f=a.children.length;for(d=0;d<f;d++)b=a.children[d],c(b),THREE.SceneUtils.traverseHierarchy(b,c)},createMultiMaterialObject:function(a,c){var b,d=c.length,f=new THREE.Object3D;for(b=0;b<d;b++){var g=new THREE.Mesh(a,c[b]);f.add(g)}return f}};
|
|
|
if(THREE.WebGLRenderer)THREE.ShaderUtils={lib:{fresnel:{uniforms:{mRefractionRatio:{type:"f",value:1.02},mFresnelBias:{type:"f",value:0.1},mFresnelPower:{type:"f",value:2},mFresnelScale:{type:"f",value:1},tCube:{type:"t",value:1,texture:null}},fragmentShader:"uniform samplerCube tCube;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 reflectedColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );\nvec4 refractedColor = vec4( 1.0, 1.0, 1.0, 1.0 );\nrefractedColor.r = textureCube( tCube, vec3( -vRefract[0].x, vRefract[0].yz ) ).r;\nrefractedColor.g = textureCube( tCube, vec3( -vRefract[1].x, vRefract[1].yz ) ).g;\nrefractedColor.b = textureCube( tCube, vec3( -vRefract[2].x, vRefract[2].yz ) ).b;\nrefractedColor.a = 1.0;\ngl_FragColor = mix( refractedColor, reflectedColor, clamp( vReflectionFactor, 0.0, 1.0 ) );\n}",
|
|
|
vertexShader:"uniform float mRefractionRatio;\nuniform float mFresnelBias;\nuniform float mFresnelScale;\nuniform float mFresnelPower;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = normalize ( mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal );\nvec3 I = mPosition.xyz - cameraPosition;\nvReflect = reflect( I, nWorld );\nvRefract[0] = refract( normalize( I ), nWorld, mRefractionRatio );\nvRefract[1] = refract( normalize( I ), nWorld, mRefractionRatio * 0.99 );\nvRefract[2] = refract( normalize( I ), nWorld, mRefractionRatio * 0.98 );\nvReflectionFactor = mFresnelBias + mFresnelScale * pow( 1.0 + dot( normalize( I ), nWorld ), mFresnelPower );\ngl_Position = projectionMatrix * mvPosition;\n}"},
|
|
|
normal:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.fog,THREE.UniformsLib.lights,THREE.UniformsLib.shadowmap,{enableAO:{type:"i",value:0},enableDiffuse:{type:"i",value:0},enableSpecular:{type:"i",value:0},enableReflection:{type:"i",value:0},tDiffuse:{type:"t",value:0,texture:null},tCube:{type:"t",value:1,texture:null},tNormal:{type:"t",value:2,texture:null},tSpecular:{type:"t",value:3,texture:null},tAO:{type:"t",value:4,texture:null},tDisplacement:{type:"t",value:5,texture:null},uNormalScale:{type:"f",
|
|
|
@@ -23,74 +23,74 @@ THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\
|
|
|
THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvViewPosition = -mvPosition.xyz;\nvNormal = normalize( normalMatrix * normal );\nvTangent = normalize( normalMatrix * tangent.xyz );\nvBinormal = cross( vNormal, vTangent ) * tangent.w;\nvBinormal = normalize( vBinormal );\nvUv = uv * uRepeat + uOffset;\n#if MAX_POINT_LIGHTS > 0\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\nvec3 lVector = lPosition.xyz - mvPosition.xyz;\nfloat lDistance = 1.0;\nif ( pointLightDistance[ i ] > 0.0 )\nlDistance = 1.0 - min( ( length( lVector ) / pointLightDistance[ i ] ), 1.0 );\nlVector = normalize( lVector );\nvPointLight[ i ] = vec4( lVector, lDistance );\n}\n#endif\n#ifdef VERTEX_TEXTURES\nvec3 dv = texture2D( tDisplacement, uv ).xyz;\nfloat df = uDisplacementScale * dv.x + uDisplacementBias;\nvec4 displacedPosition = vec4( vNormal.xyz * df, 0.0 ) + mvPosition;\ngl_Position = projectionMatrix * displacedPosition;\n#else\ngl_Position = projectionMatrix * mvPosition;\n#endif",
|
|
|
THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n")},cube:{uniforms:{tCube:{type:"t",value:1,texture:null},tFlip:{type:"f",value:-1}},vertexShader:"varying vec3 vViewPosition;\nvoid main() {\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvViewPosition = cameraPosition - mPosition.xyz;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform samplerCube tCube;\nuniform float tFlip;\nvarying vec3 vViewPosition;\nvoid main() {\nvec3 wPos = cameraPosition - vViewPosition;\ngl_FragColor = textureCube( tCube, vec3( tFlip * wPos.x, wPos.yz ) );\n}"}}};
|
|
|
THREE.Curve=function(){};THREE.Curve.prototype.getPoint=function(){console.log("Warning, getPoint() not implemented!");return null};THREE.Curve.prototype.getPointAt=function(a){return this.getPoint(this.getUtoTmapping(a))};THREE.Curve.prototype.getPoints=function(a){a||(a=5);var c,b=[];for(c=0;c<=a;c++)b.push(this.getPoint(c/a));return b};THREE.Curve.prototype.getSpacedPoints=function(a){a||(a=5);var c,b=[];for(c=0;c<=a;c++)b.push(this.getPointAt(c/a));return b};
|
|
|
-THREE.Curve.prototype.getLength=function(){var a=this.getLengths();return a[a.length-1]};THREE.Curve.prototype.getLengths=function(a){a||(a=200);if(this.cacheArcLengths&&this.cacheArcLengths.length==a+1)return this.cacheArcLengths;var c=[],b,e=this.getPoint(0),g,h=0;c.push(0);for(g=1;g<=a;g++)b=this.getPoint(g/a),h+=b.distanceTo(e),c.push(h),e=b;return this.cacheArcLengths=c};
|
|
|
-THREE.Curve.prototype.getUtoTmapping=function(a,c){var b=this.getLengths(),e=0,g=b.length,h;h=c?c:a*b[g-1];time=Date.now();for(var f=0,k=g-1,l;f<=k;)if(e=Math.floor(f+(k-f)/2),l=b[e]-h,l<0)f=e+1;else if(l>0)k=e-1;else{k=e;break}e=k;if(b[e]==h)return e/(g-1);f=b[e];return b=(e+(h-f)/(b[e+1]-f))/(g-1)};THREE.Curve.prototype.getNormalVector=function(a){a=this.getTangent(a);return new THREE.Vector2(-a.y,a.x)};
|
|
|
-THREE.Curve.prototype.getTangent=function(a){var c=a-1.0E-4;a+=1.0E-4;c<0&&(c=0);a>1&&(a=1);var c=this.getPoint(c),a=this.getPoint(a),b=new THREE.Vector2;b.sub(a,c);return b.unit()};THREE.LineCurve=function(a,c){a instanceof THREE.Vector2?(this.v1=a,this.v2=c):THREE.LineCurve.oldConstructor.apply(this,arguments)};THREE.LineCurve.oldConstructor=function(a,c,b,e){this.constructor(new THREE.Vector2(a,c),new THREE.Vector2(b,e))};THREE.LineCurve.prototype=new THREE.Curve;
|
|
|
+THREE.Curve.prototype.getLength=function(){var a=this.getLengths();return a[a.length-1]};THREE.Curve.prototype.getLengths=function(a){a||(a=200);if(this.cacheArcLengths&&this.cacheArcLengths.length==a+1)return this.cacheArcLengths;var c=[],b,d=this.getPoint(0),f,g=0;c.push(0);for(f=1;f<=a;f++)b=this.getPoint(f/a),g+=b.distanceTo(d),c.push(g),d=b;return this.cacheArcLengths=c};
|
|
|
+THREE.Curve.prototype.getUtoTmapping=function(a,c){var b=this.getLengths(),d=0,f=b.length,g;g=c?c:a*b[f-1];Date.now();for(var e=0,h=f-1,i;e<=h;)if(d=Math.floor(e+(h-e)/2),i=b[d]-g,i<0)e=d+1;else if(i>0)h=d-1;else{h=d;break}d=h;if(b[d]==g)return d/(f-1);e=b[d];return b=(d+(g-e)/(b[d+1]-e))/(f-1)};THREE.Curve.prototype.getNormalVector=function(a){a=this.getTangent(a);return new THREE.Vector2(-a.y,a.x)};
|
|
|
+THREE.Curve.prototype.getTangent=function(a){var c=a-1.0E-4;a+=1.0E-4;c<0&&(c=0);a>1&&(a=1);var c=this.getPoint(c),a=this.getPoint(a),b=new THREE.Vector2;b.sub(a,c);return b.unit()};THREE.LineCurve=function(a,c){a instanceof THREE.Vector2?(this.v1=a,this.v2=c):THREE.LineCurve.oldConstructor.apply(this,arguments)};THREE.LineCurve.oldConstructor=function(a,c,b,d){this.constructor(new THREE.Vector2(a,c),new THREE.Vector2(b,d))};THREE.LineCurve.prototype=new THREE.Curve;
|
|
|
THREE.LineCurve.prototype.constructor=THREE.LineCurve;THREE.LineCurve.prototype.getPoint=function(a){var c=new THREE.Vector2;c.sub(this.v2,this.v1);c.multiplyScalar(a).addSelf(this.v1);return c};THREE.LineCurve.prototype.getPointAt=function(a){return this.getPoint(a)};THREE.LineCurve.prototype.getTangent=function(){var a=new THREE.Vector2;a.sub(this.v2,this.v1);a.normalize();return a};
|
|
|
-THREE.QuadraticBezierCurve=function(a,c,b){if(!(c instanceof THREE.Vector2))var e=Array.prototype.slice.call(arguments),a=new THREE.Vector2(e[0],e[1]),c=new THREE.Vector2(e[2],e[3]),b=new THREE.Vector2(e[4],e[5]);this.v0=a;this.v1=c;this.v2=b};THREE.QuadraticBezierCurve.prototype=new THREE.Curve;THREE.QuadraticBezierCurve.prototype.constructor=THREE.QuadraticBezierCurve;
|
|
|
+THREE.QuadraticBezierCurve=function(a,c,b){if(!(c instanceof THREE.Vector2))var d=Array.prototype.slice.call(arguments),a=new THREE.Vector2(d[0],d[1]),c=new THREE.Vector2(d[2],d[3]),b=new THREE.Vector2(d[4],d[5]);this.v0=a;this.v1=c;this.v2=b};THREE.QuadraticBezierCurve.prototype=new THREE.Curve;THREE.QuadraticBezierCurve.prototype.constructor=THREE.QuadraticBezierCurve;
|
|
|
THREE.QuadraticBezierCurve.prototype.getPoint=function(a){var c;c=THREE.Shape.Utils.b2(a,this.v0.x,this.v1.x,this.v2.x);a=THREE.Shape.Utils.b2(a,this.v0.y,this.v1.y,this.v2.y);return new THREE.Vector2(c,a)};THREE.QuadraticBezierCurve.prototype.getTangent=function(a){var c;c=THREE.Curve.Utils.tangentQuadraticBezier(a,this.v0.x,this.v1.x,this.v2.x);a=THREE.Curve.Utils.tangentQuadraticBezier(a,this.v0.y,this.v1.y,this.v2.y);c=new THREE.Vector2(c,a);c.normalize();return c};
|
|
|
-THREE.CubicBezierCurve=function(a,c,b,e){if(!(c instanceof THREE.Vector2))var g=Array.prototype.slice.call(arguments),a=new THREE.Vector2(g[0],g[1]),c=new THREE.Vector2(g[2],g[3]),b=new THREE.Vector2(g[4],g[5]),e=new THREE.Vector2(g[6],g[7]);this.v0=a;this.v1=c;this.v2=b;this.v3=e};THREE.CubicBezierCurve.prototype=new THREE.Curve;THREE.CubicBezierCurve.prototype.constructor=THREE.CubicBezierCurve;
|
|
|
+THREE.CubicBezierCurve=function(a,c,b,d){if(!(c instanceof THREE.Vector2))var f=Array.prototype.slice.call(arguments),a=new THREE.Vector2(f[0],f[1]),c=new THREE.Vector2(f[2],f[3]),b=new THREE.Vector2(f[4],f[5]),d=new THREE.Vector2(f[6],f[7]);this.v0=a;this.v1=c;this.v2=b;this.v3=d};THREE.CubicBezierCurve.prototype=new THREE.Curve;THREE.CubicBezierCurve.prototype.constructor=THREE.CubicBezierCurve;
|
|
|
THREE.CubicBezierCurve.prototype.getPoint=function(a){var c;c=THREE.Shape.Utils.b3(a,this.v0.x,this.v1.x,this.v2.x,this.v3.x);a=THREE.Shape.Utils.b3(a,this.v0.y,this.v1.y,this.v2.y,this.v3.y);return new THREE.Vector2(c,a)};THREE.CubicBezierCurve.prototype.getTangent=function(a){var c;c=THREE.Curve.Utils.tangentCubicBezier(a,this.v0.x,this.v1.x,this.v2.x,this.v3.x);a=THREE.Curve.Utils.tangentCubicBezier(a,this.v0.y,this.v1.y,this.v2.y,this.v3.y);c=new THREE.Vector2(c,a);c.normalize();return c};
|
|
|
THREE.SplineCurve=function(a){this.points=a};THREE.SplineCurve.prototype=new THREE.Curve;THREE.SplineCurve.prototype.constructor=THREE.SplineCurve;
|
|
|
-THREE.SplineCurve.prototype.getPoint=function(a){var c=new THREE.Vector2,b=[],e=this.points,g;g=(e.length-1)*a;a=Math.floor(g);g-=a;b[0]=a==0?a:a-1;b[1]=a;b[2]=a>e.length-2?a:a+1;b[3]=a>e.length-3?a:a+2;c.x=THREE.Curve.Utils.interpolate(e[b[0]].x,e[b[1]].x,e[b[2]].x,e[b[3]].x,g);c.y=THREE.Curve.Utils.interpolate(e[b[0]].y,e[b[1]].y,e[b[2]].y,e[b[3]].y,g);return c};THREE.ArcCurve=function(a,c,b,e,g,h){this.aX=a;this.aY=c;this.aRadius=b;this.aStartAngle=e;this.aEndAngle=g;this.aClockwise=h};
|
|
|
+THREE.SplineCurve.prototype.getPoint=function(a){var c=new THREE.Vector2,b=[],d=this.points,f;f=(d.length-1)*a;a=Math.floor(f);f-=a;b[0]=a==0?a:a-1;b[1]=a;b[2]=a>d.length-2?a:a+1;b[3]=a>d.length-3?a:a+2;c.x=THREE.Curve.Utils.interpolate(d[b[0]].x,d[b[1]].x,d[b[2]].x,d[b[3]].x,f);c.y=THREE.Curve.Utils.interpolate(d[b[0]].y,d[b[1]].y,d[b[2]].y,d[b[3]].y,f);return c};THREE.ArcCurve=function(a,c,b,d,f,g){this.aX=a;this.aY=c;this.aRadius=b;this.aStartAngle=d;this.aEndAngle=f;this.aClockwise=g};
|
|
|
THREE.ArcCurve.prototype=new THREE.Curve;THREE.ArcCurve.prototype.constructor=THREE.ArcCurve;THREE.ArcCurve.prototype.getPoint=function(a){var c=this.aEndAngle-this.aStartAngle;this.aClockwise||(a=1-a);a=this.aStartAngle+a*c;return new THREE.Vector2(this.aX+this.aRadius*Math.cos(a),this.aY+this.aRadius*Math.sin(a))};
|
|
|
-THREE.Curve.Utils={tangentQuadraticBezier:function(a,c,b,e){return 2*(1-a)*(b-c)+2*a*(e-b)},tangentCubicBezier:function(a,c,b,e,g){return-3*c*(1-a)*(1-a)+3*b*(1-a)*(1-a)-6*a*b*(1-a)+6*a*e*(1-a)-3*a*a*e+3*a*a*g},tangentSpline:function(a){return 6*a*a-6*a+(3*a*a-4*a+1)+(-6*a*a+6*a)+(3*a*a-2*a)},interpolate:function(a,c,b,e,g){var a=(b-a)*0.5,e=(e-c)*0.5,h=g*g;return(2*c-2*b+a+e)*g*h+(-3*c+3*b-2*a-e)*h+a*g+c}};
|
|
|
-THREE.Curve.create=function(a,c){a.prototype=new THREE.Curve;a.prototype.constructor=a;a.prototype.getPoint=c;return a};THREE.LineCurve3=THREE.Curve.create(function(a,c){this.v1=a;this.v2=c},function(a){var c=new THREE.Vector3;c.sub(v2,v1);c.multiplyScalar(a);c.addSelf(this.v1);return c});
|
|
|
+THREE.Curve.Utils={tangentQuadraticBezier:function(a,c,b,d){return 2*(1-a)*(b-c)+2*a*(d-b)},tangentCubicBezier:function(a,c,b,d,f){return-3*c*(1-a)*(1-a)+3*b*(1-a)*(1-a)-6*a*b*(1-a)+6*a*d*(1-a)-3*a*a*d+3*a*a*f},tangentSpline:function(a){return 6*a*a-6*a+(3*a*a-4*a+1)+(-6*a*a+6*a)+(3*a*a-2*a)},interpolate:function(a,c,b,d,f){var a=(b-a)*0.5,d=(d-c)*0.5,g=f*f;return(2*c-2*b+a+d)*f*g+(-3*c+3*b-2*a-d)*g+a*f+c}};
|
|
|
+THREE.Curve.create=function(a,c){a.prototype=new THREE.Curve;a.prototype.constructor=a;a.prototype.getPoint=c;return a};THREE.LineCurve3=THREE.Curve.create(function(a,c){this.v1=a;this.v2=c},function(a){var c=new THREE.Vector3;c.sub(this.v2,this.v1);c.multiplyScalar(a);c.addSelf(this.v1);return c});
|
|
|
THREE.QuadraticBezierCurve3=THREE.Curve.create(function(a,c,b){this.v0=a;this.v1=c;this.v2=b},function(a){var c,b;c=THREE.Shape.Utils.b2(a,this.v0.x,this.v1.x,this.v2.x);b=THREE.Shape.Utils.b2(a,this.v0.y,this.v1.y,this.v2.y);a=THREE.Shape.Utils.b2(a,this.v0.z,this.v1.z,this.v2.z);return new THREE.Vector3(c,b,a)});
|
|
|
-THREE.CubicBezierCurve3=THREE.Curve.create(function(a,c,b,e){this.v0=a;this.v1=c;this.v2=b;this.v3=e},function(a){var c,b;c=THREE.Shape.Utils.b3(a,this.v0.x,this.v1.x,this.v2.x,this.v3.x);b=THREE.Shape.Utils.b3(a,this.v0.y,this.v1.y,this.v2.y,this.v3.y);a=THREE.Shape.Utils.b3(a,this.v0.z,this.v1.z,this.v2.z,this.v3.z);return new THREE.Vector3(c,b,a)});
|
|
|
-THREE.SplineCurve3=THREE.Curve.create(function(a){this.points=a},function(a){var c=new THREE.Vector3,b=[],e=this.points,g;g=(e.length-1)*a;a=Math.floor(g);g-=a;b[0]=a==0?a:a-1;b[1]=a;b[2]=a>e.length-2?a:a+1;b[3]=a>e.length-3?a:a+2;c.x=THREE.Curve.Utils.interpolate(e[b[0]].x,e[b[1]].x,e[b[2]].x,e[b[3]].x,g);c.y=THREE.Curve.Utils.interpolate(e[b[0]].y,e[b[1]].y,e[b[2]].y,e[b[3]].y,g);c.z=THREE.Curve.Utils.interpolate(e[b[0]].z,e[b[1]].z,e[b[2]].z,e[b[3]].z,g);return c});
|
|
|
+THREE.CubicBezierCurve3=THREE.Curve.create(function(a,c,b,d){this.v0=a;this.v1=c;this.v2=b;this.v3=d},function(a){var c,b;c=THREE.Shape.Utils.b3(a,this.v0.x,this.v1.x,this.v2.x,this.v3.x);b=THREE.Shape.Utils.b3(a,this.v0.y,this.v1.y,this.v2.y,this.v3.y);a=THREE.Shape.Utils.b3(a,this.v0.z,this.v1.z,this.v2.z,this.v3.z);return new THREE.Vector3(c,b,a)});
|
|
|
+THREE.SplineCurve3=THREE.Curve.create(function(a){this.points=a},function(a){var c=new THREE.Vector3,b=[],d=this.points,f;f=(d.length-1)*a;a=Math.floor(f);f-=a;b[0]=a==0?a:a-1;b[1]=a;b[2]=a>d.length-2?a:a+1;b[3]=a>d.length-3?a:a+2;c.x=THREE.Curve.Utils.interpolate(d[b[0]].x,d[b[1]].x,d[b[2]].x,d[b[3]].x,f);c.y=THREE.Curve.Utils.interpolate(d[b[0]].y,d[b[1]].y,d[b[2]].y,d[b[3]].y,f);c.z=THREE.Curve.Utils.interpolate(d[b[0]].z,d[b[1]].z,d[b[2]].z,d[b[3]].z,f);return c});
|
|
|
THREE.CurvePath=function(){this.curves=[];this.bends=[]};THREE.CurvePath.prototype=new THREE.Curve;THREE.CurvePath.prototype.constructor=THREE.CurvePath;THREE.CurvePath.prototype.add=function(a){this.curves.push(a)};THREE.CurvePath.prototype.checkConnection=function(){};THREE.CurvePath.prototype.closePath=function(){};
|
|
|
THREE.CurvePath.prototype.getPoint=function(a){for(var c=a*this.getLength(),b=this.getCurveLengths(),a=0;a<b.length;){if(b[a]>=c)return c=b[a]-c,a=this.curves[a],c=1-c/a.getLength(),a.getPointAt(c);a++}return null};THREE.CurvePath.prototype.getLength=function(){var a=this.getCurveLengths();return a[a.length-1]};
|
|
|
-THREE.CurvePath.prototype.getCurveLengths=function(){if(this.cacheLengths&&this.cacheLengths.length==this.curves.length)return this.cacheLengths;var a=[],c=0,b,e=this.curves.length;for(b=0;b<e;b++)c+=this.curves[b].getLength(),a.push(c);return this.cacheLengths=a};
|
|
|
-THREE.CurvePath.prototype.getBoundingBox=function(){var a=this.getPoints(),c,b,e,g;c=b=Number.NEGATIVE_INFINITY;e=g=Number.POSITIVE_INFINITY;var h,f,k,l;l=new THREE.Vector2;f=0;for(k=a.length;f<k;f++){h=a[f];if(h.x>c)c=h.x;else if(h.x<e)e=h.x;if(h.y>b)b=h.y;else if(h.y<b)g=h.y;l.addSelf(h.x,h.y)}return{minX:e,minY:g,maxX:c,maxY:b,centroid:l.divideScalar(k)}};THREE.CurvePath.prototype.createPointsGeometry=function(a){return this.createGeometry(this.getPoints(a,!0))};
|
|
|
+THREE.CurvePath.prototype.getCurveLengths=function(){if(this.cacheLengths&&this.cacheLengths.length==this.curves.length)return this.cacheLengths;var a=[],c=0,b,d=this.curves.length;for(b=0;b<d;b++)c+=this.curves[b].getLength(),a.push(c);return this.cacheLengths=a};
|
|
|
+THREE.CurvePath.prototype.getBoundingBox=function(){var a=this.getPoints(),c,b,d,f;c=b=Number.NEGATIVE_INFINITY;d=f=Number.POSITIVE_INFINITY;var g,e,h,i;i=new THREE.Vector2;e=0;for(h=a.length;e<h;e++){g=a[e];if(g.x>c)c=g.x;else if(g.x<d)d=g.x;if(g.y>b)b=g.y;else if(g.y<b)f=g.y;i.addSelf(g.x,g.y)}return{minX:d,minY:f,maxX:c,maxY:b,centroid:i.divideScalar(h)}};THREE.CurvePath.prototype.createPointsGeometry=function(a){return this.createGeometry(this.getPoints(a,!0))};
|
|
|
THREE.CurvePath.prototype.createSpacedPointsGeometry=function(a){return this.createGeometry(this.getSpacedPoints(a,!0))};THREE.CurvePath.prototype.createGeometry=function(a){for(var c=new THREE.Geometry,b=0;b<a.length;b++)c.vertices.push(new THREE.Vertex(new THREE.Vector3(a[b].x,a[b].y,0)));return c};THREE.CurvePath.prototype.addWrapPath=function(a){this.bends.push(a)};
|
|
|
-THREE.CurvePath.prototype.getTransformedPoints=function(a,c){var b=this.getPoints(a),e,g;if(!c)c=this.bends;e=0;for(g=c.length;e<g;e++)b=this.getWrapPoints(b,c[e]);return b};THREE.CurvePath.prototype.getTransformedSpacedPoints=function(a,c){var b=this.getSpacedPoints(a),e,g;if(!c)c=this.bends;e=0;for(g=c.length;e<g;e++)b=this.getWrapPoints(b,c[e]);return b};
|
|
|
-THREE.CurvePath.prototype.getWrapPoints=function(a,c){var b=this.getBoundingBox(),e,g,h,f,k,l;e=0;for(g=a.length;e<g;e++)h=a[e],f=h.x,k=h.y,l=f/b.maxX,l=c.getUtoTmapping(l,f),f=c.getPoint(l),k=c.getNormalVector(l).multiplyScalar(k),h.x=f.x+k.x,h.y=f.y+k.y;return a};THREE.Path=function(a){THREE.CurvePath.call(this);this.actions=[];a&&this.fromPoints(a)};THREE.Path.prototype=new THREE.CurvePath;THREE.Path.prototype.constructor=THREE.Path;
|
|
|
+THREE.CurvePath.prototype.getTransformedPoints=function(a,c){var b=this.getPoints(a),d,f;if(!c)c=this.bends;d=0;for(f=c.length;d<f;d++)b=this.getWrapPoints(b,c[d]);return b};THREE.CurvePath.prototype.getTransformedSpacedPoints=function(a,c){var b=this.getSpacedPoints(a),d,f;if(!c)c=this.bends;d=0;for(f=c.length;d<f;d++)b=this.getWrapPoints(b,c[d]);return b};
|
|
|
+THREE.CurvePath.prototype.getWrapPoints=function(a,c){var b=this.getBoundingBox(),d,f,g,e,h,i;d=0;for(f=a.length;d<f;d++)g=a[d],e=g.x,h=g.y,i=e/b.maxX,i=c.getUtoTmapping(i,e),e=c.getPoint(i),h=c.getNormalVector(i).multiplyScalar(h),g.x=e.x+h.x,g.y=e.y+h.y;return a};THREE.Path=function(a){THREE.CurvePath.call(this);this.actions=[];a&&this.fromPoints(a)};THREE.Path.prototype=new THREE.CurvePath;THREE.Path.prototype.constructor=THREE.Path;
|
|
|
THREE.PathActions={MOVE_TO:"moveTo",LINE_TO:"lineTo",QUADRATIC_CURVE_TO:"quadraticCurveTo",BEZIER_CURVE_TO:"bezierCurveTo",CSPLINE_THRU:"splineThru",ARC:"arc"};THREE.Path.prototype.fromPoints=function(a){this.moveTo(a[0].x,a[0].y);var c,b=a.length;for(c=1;c<b;c++)this.lineTo(a[c].x,a[c].y)};THREE.Path.prototype.moveTo=function(){var a=Array.prototype.slice.call(arguments);this.actions.push({action:THREE.PathActions.MOVE_TO,args:a})};
|
|
|
-THREE.Path.prototype.lineTo=function(a,c){var b=Array.prototype.slice.call(arguments),e=this.actions[this.actions.length-1].args;this.curves.push(new THREE.LineCurve(new THREE.Vector2(e[e.length-2],e[e.length-1]),new THREE.Vector2(a,c)));this.actions.push({action:THREE.PathActions.LINE_TO,args:b})};
|
|
|
-THREE.Path.prototype.quadraticCurveTo=function(a,c,b,e){var g=Array.prototype.slice.call(arguments),h=this.actions[this.actions.length-1].args;this.curves.push(new THREE.QuadraticBezierCurve(new THREE.Vector2(h[h.length-2],h[h.length-1]),new THREE.Vector2(a,c),new THREE.Vector2(b,e)));this.actions.push({action:THREE.PathActions.QUADRATIC_CURVE_TO,args:g})};
|
|
|
-THREE.Path.prototype.bezierCurveTo=function(a,c,b,e,g,h){var f=Array.prototype.slice.call(arguments),k=this.actions[this.actions.length-1].args;this.curves.push(new THREE.CubicBezierCurve(new THREE.Vector2(k[k.length-2],k[k.length-1]),new THREE.Vector2(a,c),new THREE.Vector2(b,e),new THREE.Vector2(g,h)));this.actions.push({action:THREE.PathActions.BEZIER_CURVE_TO,args:f})};
|
|
|
+THREE.Path.prototype.lineTo=function(a,c){var b=Array.prototype.slice.call(arguments),d=this.actions[this.actions.length-1].args;this.curves.push(new THREE.LineCurve(new THREE.Vector2(d[d.length-2],d[d.length-1]),new THREE.Vector2(a,c)));this.actions.push({action:THREE.PathActions.LINE_TO,args:b})};
|
|
|
+THREE.Path.prototype.quadraticCurveTo=function(a,c,b,d){var f=Array.prototype.slice.call(arguments),g=this.actions[this.actions.length-1].args;this.curves.push(new THREE.QuadraticBezierCurve(new THREE.Vector2(g[g.length-2],g[g.length-1]),new THREE.Vector2(a,c),new THREE.Vector2(b,d)));this.actions.push({action:THREE.PathActions.QUADRATIC_CURVE_TO,args:f})};
|
|
|
+THREE.Path.prototype.bezierCurveTo=function(a,c,b,d,f,g){var e=Array.prototype.slice.call(arguments),h=this.actions[this.actions.length-1].args;this.curves.push(new THREE.CubicBezierCurve(new THREE.Vector2(h[h.length-2],h[h.length-1]),new THREE.Vector2(a,c),new THREE.Vector2(b,d),new THREE.Vector2(f,g)));this.actions.push({action:THREE.PathActions.BEZIER_CURVE_TO,args:e})};
|
|
|
THREE.Path.prototype.splineThru=function(a){var c=Array.prototype.slice.call(arguments),b=this.actions[this.actions.length-1].args,b=[new THREE.Vector2(b[b.length-2],b[b.length-1])];Array.prototype.push.apply(b,a);this.curves.push(new THREE.SplineCurve(b));this.actions.push({action:THREE.PathActions.CSPLINE_THRU,args:c})};
|
|
|
-THREE.Path.prototype.arc=function(a,c,b,e,g,h){var f=Array.prototype.slice.call(arguments);this.curves.push(new THREE.ArcCurve(a,c,b,e,g,h));this.actions.push({action:THREE.PathActions.ARC,args:f})};THREE.Path.prototype.getSpacedPoints=function(a){a||(a=40);for(var c=[],b=0;b<a;b++)c.push(this.getPoint(b/a));return c};
|
|
|
-THREE.Path.prototype.getPoints=function(a,c){var a=a||12,b=[],e,g,h,f,k,l,m,n,o,u,p,z,w;e=0;for(g=this.actions.length;e<g;e++)switch(h=this.actions[e],f=h.action,h=h.args,f){case THREE.PathActions.LINE_TO:b.push(new THREE.Vector2(h[0],h[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:k=h[2];l=h[3];o=h[0];u=h[1];b.length>0?(f=b[b.length-1],p=f.x,z=f.y):(f=this.actions[e-1].args,p=f[f.length-2],z=f[f.length-1]);for(f=1;f<=a;f++)w=f/a,h=THREE.Shape.Utils.b2(w,p,o,k),w=THREE.Shape.Utils.b2(w,z,u,
|
|
|
-l),b.push(new THREE.Vector2(h,w));break;case THREE.PathActions.BEZIER_CURVE_TO:k=h[4];l=h[5];o=h[0];u=h[1];m=h[2];n=h[3];b.length>0?(f=b[b.length-1],p=f.x,z=f.y):(f=this.actions[e-1].args,p=f[f.length-2],z=f[f.length-1]);for(f=1;f<=a;f++)w=f/a,h=THREE.Shape.Utils.b3(w,p,o,m,k),w=THREE.Shape.Utils.b3(w,z,u,n,l),b.push(new THREE.Vector2(h,w));break;case THREE.PathActions.CSPLINE_THRU:f=this.actions[e-1].args;f=[new THREE.Vector2(f[f.length-2],f[f.length-1])];w=a*h[0].length;f=f.concat(h[0]);h=new THREE.SplineCurve(f);
|
|
|
-for(f=1;f<=w;f++)b.push(h.getPointAt(f/w));break;case THREE.PathActions.ARC:f=this.actions[e-1].args;k=h[0];l=h[1];m=h[2];o=h[3];w=h[4];u=!!h[5];n=f[f.length-2];p=f[f.length-1];f.length==0&&(n=p=0);z=w-o;var x=a*2;for(f=1;f<=x;f++)w=f/x,u||(w=1-w),w=o+w*z,h=n+k+m*Math.cos(w),w=p+l+m*Math.sin(w),b.push(new THREE.Vector2(h,w))}c&&b.push(b[0]);return b};THREE.Path.prototype.transform=function(a,c){this.getBoundingBox();return this.getWrapPoints(this.getPoints(c),a)};
|
|
|
-THREE.Path.prototype.nltransform=function(a,c,b,e,g,h){var f=this.getPoints(),k,l,m,n,o;k=0;for(l=f.length;k<l;k++)m=f[k],n=m.x,o=m.y,m.x=a*n+c*o+b,m.y=e*o+g*n+h;return f};
|
|
|
-THREE.Path.prototype.debug=function(a){var c=this.getBoundingBox();a||(a=document.createElement("canvas"),a.setAttribute("width",c.maxX+100),a.setAttribute("height",c.maxY+100),document.body.appendChild(a));c=a.getContext("2d");c.fillStyle="white";c.fillRect(0,0,a.width,a.height);c.strokeStyle="black";c.beginPath();var b,e,g,a=0;for(b=this.actions.length;a<b;a++)e=this.actions[a],g=e.args,e=e.action,e!=THREE.PathActions.CSPLINE_THRU&&c[e].apply(c,g);c.stroke();c.closePath();c.strokeStyle="red";e=
|
|
|
-this.getPoints();a=0;for(b=e.length;a<b;a++)g=e[a],c.beginPath(),c.arc(g.x,g.y,1.5,0,Math.PI*2,!1),c.stroke(),c.closePath()};
|
|
|
-THREE.Path.prototype.toShapes=function(){var a,c,b,e,g=[],h=new THREE.Path;a=0;for(c=this.actions.length;a<c;a++)b=this.actions[a],e=b.args,b=b.action,b==THREE.PathActions.MOVE_TO&&h.actions.length!=0&&(g.push(h),h=new THREE.Path),h[b].apply(h,e);h.actions.length!=0&&g.push(h);if(g.length==0)return[];var f,h=[];if(THREE.Shape.Utils.isClockWise(g[0].getPoints())){a=0;for(c=g.length;a<c;a++)e=g[a],THREE.Shape.Utils.isClockWise(e.getPoints())?(f&&h.push(f),f=new THREE.Shape,f.actions=e.actions,f.curves=
|
|
|
-e.curves):f.holes.push(e);h.push(f)}else{f=new THREE.Shape;a=0;for(c=g.length;a<c;a++)e=g[a],THREE.Shape.Utils.isClockWise(e.getPoints())?(f.actions=e.actions,f.curves=e.curves,h.push(f),f=new THREE.Shape):f.holes.push(e)}return h};THREE.Shape=function(){THREE.Path.apply(this,arguments);this.holes=[]};THREE.Shape.prototype=new THREE.Path;THREE.Shape.prototype.constructor=THREE.Path;THREE.Shape.prototype.extrude=function(a){return new THREE.ExtrudeGeometry(this,a)};
|
|
|
-THREE.Shape.prototype.getPointsHoles=function(a){var c,b=this.holes.length,e=[];for(c=0;c<b;c++)e[c]=this.holes[c].getTransformedPoints(a,this.bends);return e};THREE.Shape.prototype.getSpacedPointsHoles=function(a){var c,b=this.holes.length,e=[];for(c=0;c<b;c++)e[c]=this.holes[c].getTransformedSpacedPoints(a,this.bends);return e};THREE.Shape.prototype.extractAllPoints=function(a){return{shape:this.getTransformedPoints(a),holes:this.getPointsHoles(a)}};
|
|
|
+THREE.Path.prototype.arc=function(a,c,b,d,f,g){var e=Array.prototype.slice.call(arguments);this.curves.push(new THREE.ArcCurve(a,c,b,d,f,g));this.actions.push({action:THREE.PathActions.ARC,args:e})};THREE.Path.prototype.getSpacedPoints=function(a){a||(a=40);for(var c=[],b=0;b<a;b++)c.push(this.getPoint(b/a));return c};
|
|
|
+THREE.Path.prototype.getPoints=function(a,c){var a=a||12,b=[],d,f,g,e,h,i,j,k,m,o,n,t,q;d=0;for(f=this.actions.length;d<f;d++)switch(g=this.actions[d],e=g.action,g=g.args,e){case THREE.PathActions.LINE_TO:b.push(new THREE.Vector2(g[0],g[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:h=g[2];i=g[3];m=g[0];o=g[1];b.length>0?(e=b[b.length-1],n=e.x,t=e.y):(e=this.actions[d-1].args,n=e[e.length-2],t=e[e.length-1]);for(e=1;e<=a;e++)q=e/a,g=THREE.Shape.Utils.b2(q,n,m,h),q=THREE.Shape.Utils.b2(q,t,o,
|
|
|
+i),b.push(new THREE.Vector2(g,q));break;case THREE.PathActions.BEZIER_CURVE_TO:h=g[4];i=g[5];m=g[0];o=g[1];j=g[2];k=g[3];b.length>0?(e=b[b.length-1],n=e.x,t=e.y):(e=this.actions[d-1].args,n=e[e.length-2],t=e[e.length-1]);for(e=1;e<=a;e++)q=e/a,g=THREE.Shape.Utils.b3(q,n,m,j,h),q=THREE.Shape.Utils.b3(q,t,o,k,i),b.push(new THREE.Vector2(g,q));break;case THREE.PathActions.CSPLINE_THRU:e=this.actions[d-1].args;e=[new THREE.Vector2(e[e.length-2],e[e.length-1])];q=a*g[0].length;e=e.concat(g[0]);g=new THREE.SplineCurve(e);
|
|
|
+for(e=1;e<=q;e++)b.push(g.getPointAt(e/q));break;case THREE.PathActions.ARC:e=this.actions[d-1].args;h=g[0];i=g[1];j=g[2];m=g[3];q=g[4];o=!!g[5];k=e[e.length-2];n=e[e.length-1];e.length==0&&(k=n=0);t=q-m;var r=a*2;for(e=1;e<=r;e++)q=e/r,o||(q=1-q),q=m+q*t,g=k+h+j*Math.cos(q),q=n+i+j*Math.sin(q),b.push(new THREE.Vector2(g,q))}c&&b.push(b[0]);return b};THREE.Path.prototype.transform=function(a,c){this.getBoundingBox();return this.getWrapPoints(this.getPoints(c),a)};
|
|
|
+THREE.Path.prototype.nltransform=function(a,c,b,d,f,g){var e=this.getPoints(),h,i,j,k,m;h=0;for(i=e.length;h<i;h++)j=e[h],k=j.x,m=j.y,j.x=a*k+c*m+b,j.y=d*m+f*k+g;return e};
|
|
|
+THREE.Path.prototype.debug=function(a){var c=this.getBoundingBox();a||(a=document.createElement("canvas"),a.setAttribute("width",c.maxX+100),a.setAttribute("height",c.maxY+100),document.body.appendChild(a));c=a.getContext("2d");c.fillStyle="white";c.fillRect(0,0,a.width,a.height);c.strokeStyle="black";c.beginPath();var b,d,f,a=0;for(b=this.actions.length;a<b;a++)d=this.actions[a],f=d.args,d=d.action,d!=THREE.PathActions.CSPLINE_THRU&&c[d].apply(c,f);c.stroke();c.closePath();c.strokeStyle="red";d=
|
|
|
+this.getPoints();a=0;for(b=d.length;a<b;a++)f=d[a],c.beginPath(),c.arc(f.x,f.y,1.5,0,Math.PI*2,!1),c.stroke(),c.closePath()};
|
|
|
+THREE.Path.prototype.toShapes=function(){var a,c,b,d,f=[],g=new THREE.Path;a=0;for(c=this.actions.length;a<c;a++)b=this.actions[a],d=b.args,b=b.action,b==THREE.PathActions.MOVE_TO&&g.actions.length!=0&&(f.push(g),g=new THREE.Path),g[b].apply(g,d);g.actions.length!=0&&f.push(g);if(f.length==0)return[];var e,g=[];if(THREE.Shape.Utils.isClockWise(f[0].getPoints())){a=0;for(c=f.length;a<c;a++)d=f[a],THREE.Shape.Utils.isClockWise(d.getPoints())?(e&&g.push(e),e=new THREE.Shape,e.actions=d.actions,e.curves=
|
|
|
+d.curves):e.holes.push(d);g.push(e)}else{e=new THREE.Shape;a=0;for(c=f.length;a<c;a++)d=f[a],THREE.Shape.Utils.isClockWise(d.getPoints())?(e.actions=d.actions,e.curves=d.curves,g.push(e),e=new THREE.Shape):e.holes.push(d)}return g};THREE.Shape=function(){THREE.Path.apply(this,arguments);this.holes=[]};THREE.Shape.prototype=new THREE.Path;THREE.Shape.prototype.constructor=THREE.Path;THREE.Shape.prototype.extrude=function(a){return new THREE.ExtrudeGeometry(this,a)};
|
|
|
+THREE.Shape.prototype.getPointsHoles=function(a){var c,b=this.holes.length,d=[];for(c=0;c<b;c++)d[c]=this.holes[c].getTransformedPoints(a,this.bends);return d};THREE.Shape.prototype.getSpacedPointsHoles=function(a){var c,b=this.holes.length,d=[];for(c=0;c<b;c++)d[c]=this.holes[c].getTransformedSpacedPoints(a,this.bends);return d};THREE.Shape.prototype.extractAllPoints=function(a){return{shape:this.getTransformedPoints(a),holes:this.getPointsHoles(a)}};
|
|
|
THREE.Shape.prototype.extractAllSpacedPoints=function(a){return{shape:this.getTransformedSpacedPoints(a),holes:this.getSpacedPointsHoles(a)}};
|
|
|
-THREE.Shape.Utils={removeHoles:function(a,c){var b=a.concat(),e=b.concat(),g,h,f,k,l,m,n,o,u,p,z=[];for(l=0;l<c.length;l++){m=c[l];Array.prototype.push.apply(e,m);h=Number.POSITIVE_INFINITY;for(g=0;g<m.length;g++){u=m[g];p=[];for(o=0;o<b.length;o++)n=b[o],n=u.distanceToSquared(n),p.push(n),n<h&&(h=n,f=g,k=o)}g=k-1>=0?k-1:b.length-1;h=f-1>=0?f-1:m.length-1;var w=[m[f],b[k],b[g]];o=THREE.FontUtils.Triangulate.area(w);var x=[m[f],m[h],b[k]];u=THREE.FontUtils.Triangulate.area(x);p=k;n=f;k+=1;f+=-1;k<
|
|
|
-0&&(k+=b.length);k%=b.length;f<0&&(f+=m.length);f%=m.length;g=k-1>=0?k-1:b.length-1;h=f-1>=0?f-1:m.length-1;w=[m[f],b[k],b[g]];w=THREE.FontUtils.Triangulate.area(w);x=[m[f],m[h],b[k]];x=THREE.FontUtils.Triangulate.area(x);o+u>w+x&&(k=p,f=n,k<0&&(k+=b.length),k%=b.length,f<0&&(f+=m.length),f%=m.length,g=k-1>=0?k-1:b.length-1,h=f-1>=0?f-1:m.length-1);o=b.slice(0,k);u=b.slice(k);p=m.slice(f);n=m.slice(0,f);h=[m[f],m[h],b[k]];z.push([m[f],b[k],b[g]]);z.push(h);b=o.concat(p).concat(n).concat(u)}return{shape:b,
|
|
|
-isolatedPts:z,allpoints:e}},triangulateShape:function(a,c){var b=THREE.Shape.Utils.removeHoles(a,c),e=b.allpoints,g=b.isolatedPts,b=THREE.FontUtils.Triangulate(b.shape,!1),h,f,k,l,m={};h=0;for(f=e.length;h<f;h++)l=e[h].x+":"+e[h].y,m[l]!==void 0&&console.log("Duplicate point",l),m[l]=h;h=0;for(f=b.length;h<f;h++){k=b[h];for(e=0;e<3;e++)l=k[e].x+":"+k[e].y,l=m[l],l!==void 0&&(k[e]=l)}h=0;for(f=g.length;h<f;h++){k=g[h];for(e=0;e<3;e++)l=k[e].x+":"+k[e].y,l=m[l],l!==void 0&&(k[e]=l)}return b.concat(g)},
|
|
|
-isClockWise:function(a){return THREE.FontUtils.Triangulate.area(a)<0},b2p0:function(a,c){var b=1-a;return b*b*c},b2p1:function(a,c){return 2*(1-a)*a*c},b2p2:function(a,c){return a*a*c},b2:function(a,c,b,e){return this.b2p0(a,c)+this.b2p1(a,b)+this.b2p2(a,e)},b3p0:function(a,c){var b=1-a;return b*b*b*c},b3p1:function(a,c){var b=1-a;return 3*b*b*a*c},b3p2:function(a,c){return 3*(1-a)*a*a*c},b3p3:function(a,c){return a*a*a*c},b3:function(a,c,b,e,g){return this.b3p0(a,c)+this.b3p1(a,b)+this.b3p2(a,e)+
|
|
|
-this.b3p3(a,g)}};THREE.TextPath=function(a,c){THREE.Path.call(this);this.parameters=c||{};this.set(a)};THREE.TextPath.prototype.set=function(a,c){this.text=a;var c=c||this.parameters,b=c.curveSegments!==void 0?c.curveSegments:4,e=c.font!==void 0?c.font:"helvetiker",g=c.weight!==void 0?c.weight:"normal",h=c.style!==void 0?c.style:"normal";THREE.FontUtils.size=c.size!==void 0?c.size:100;THREE.FontUtils.divisions=b;THREE.FontUtils.face=e;THREE.FontUtils.weight=g;THREE.FontUtils.style=h};
|
|
|
-THREE.TextPath.prototype.toShapes=function(){for(var a=THREE.FontUtils.drawText(this.text).paths,c=[],b=0,e=a.length;b<e;b++)Array.prototype.push.apply(c,a[b].toShapes());return c};
|
|
|
-THREE.AnimationHandler=function(){var a=[],c={},b={update:function(b){for(var e=0;e<a.length;e++)a[e].update(b)},addToUpdate:function(b){a.indexOf(b)===-1&&a.push(b)},removeFromUpdate:function(b){b=a.indexOf(b);b!==-1&&a.splice(b,1)},add:function(a){c[a.name]!==void 0&&console.log("THREE.AnimationHandler.add: Warning! "+a.name+" already exists in library. Overwriting.");c[a.name]=a;if(a.initialized!==!0){for(var b=0;b<a.hierarchy.length;b++){for(var e=0;e<a.hierarchy[b].keys.length;e++){if(a.hierarchy[b].keys[e].time<
|
|
|
-0)a.hierarchy[b].keys[e].time=0;if(a.hierarchy[b].keys[e].rot!==void 0&&!(a.hierarchy[b].keys[e].rot instanceof THREE.Quaternion)){var k=a.hierarchy[b].keys[e].rot;a.hierarchy[b].keys[e].rot=new THREE.Quaternion(k[0],k[1],k[2],k[3])}}if(a.hierarchy[b].keys[0].morphTargets!==void 0){k={};for(e=0;e<a.hierarchy[b].keys.length;e++)for(var l=0;l<a.hierarchy[b].keys[e].morphTargets.length;l++){var m=a.hierarchy[b].keys[e].morphTargets[l];k[m]=-1}a.hierarchy[b].usedMorphTargets=k;for(e=0;e<a.hierarchy[b].keys.length;e++){var n=
|
|
|
-{};for(m in k){for(l=0;l<a.hierarchy[b].keys[e].morphTargets.length;l++)if(a.hierarchy[b].keys[e].morphTargets[l]===m){n[m]=a.hierarchy[b].keys[e].morphTargetsInfluences[l];break}l===a.hierarchy[b].keys[e].morphTargets.length&&(n[m]=0)}a.hierarchy[b].keys[e].morphTargetsInfluences=n}}for(e=1;e<a.hierarchy[b].keys.length;e++)a.hierarchy[b].keys[e].time===a.hierarchy[b].keys[e-1].time&&(a.hierarchy[b].keys.splice(e,1),e--);for(e=1;e<a.hierarchy[b].keys.length;e++)a.hierarchy[b].keys[e].index=e}e=parseInt(a.length*
|
|
|
-a.fps,10);a.JIT={};a.JIT.hierarchy=[];for(b=0;b<a.hierarchy.length;b++)a.JIT.hierarchy.push(Array(e));a.initialized=!0}},get:function(a){if(typeof a==="string")return c[a]?c[a]:(console.log("THREE.AnimationHandler.get: Couldn't find animation "+a),null)},parse:function(a){var b=[];if(a instanceof THREE.SkinnedMesh)for(var c=0;c<a.bones.length;c++)b.push(a.bones[c]);else e(a,b);return b}},e=function(a,b){b.push(a);for(var c=0;c<a.children.length;c++)e(a.children[c],b)};b.LINEAR=0;b.CATMULLROM=1;b.CATMULLROM_FORWARD=
|
|
|
-2;return b}();THREE.Animation=function(a,c,b,e){this.root=a;this.data=THREE.AnimationHandler.get(c);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.loop=this.isPaused=!0;this.interpolationType=b!==void 0?b:THREE.AnimationHandler.LINEAR;this.JITCompile=e!==void 0?e:!0;this.points=[];this.target=new THREE.Vector3};
|
|
|
-THREE.Animation.prototype.play=function(a,c){if(!this.isPlaying){this.isPlaying=!0;this.loop=a!==void 0?a:!0;this.currentTime=c!==void 0?c:0;var b,e=this.hierarchy.length,g;for(b=0;b<e;b++){g=this.hierarchy[b];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)g.useQuaternion=!0;g.matrixAutoUpdate=!0;if(g.animationCache===void 0)g.animationCache={},g.animationCache.prevKey={pos:0,rot:0,scl:0},g.animationCache.nextKey={pos:0,rot:0,scl:0},g.animationCache.originalMatrix=g instanceof
|
|
|
-THREE.Bone?g.skinMatrix:g.matrix;var h=g.animationCache.prevKey;g=g.animationCache.nextKey;h.pos=this.data.hierarchy[b].keys[0];h.rot=this.data.hierarchy[b].keys[0];h.scl=this.data.hierarchy[b].keys[0];g.pos=this.getNextKeyWith("pos",b,1);g.rot=this.getNextKeyWith("rot",b,1);g.scl=this.getNextKeyWith("scl",b,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
|
|
|
+THREE.Shape.Utils={removeHoles:function(a,c){var b=a.concat(),d=b.concat(),f,g,e,h,i,j,k,m,o,n,t=[];for(i=0;i<c.length;i++){j=c[i];Array.prototype.push.apply(d,j);g=Number.POSITIVE_INFINITY;for(f=0;f<j.length;f++){o=j[f];n=[];for(m=0;m<b.length;m++)k=b[m],k=o.distanceToSquared(k),n.push(k),k<g&&(g=k,e=f,h=m)}f=h-1>=0?h-1:b.length-1;g=e-1>=0?e-1:j.length-1;var q=[j[e],b[h],b[f]];m=THREE.FontUtils.Triangulate.area(q);var r=[j[e],j[g],b[h]];o=THREE.FontUtils.Triangulate.area(r);n=h;k=e;h+=1;e+=-1;h<
|
|
|
+0&&(h+=b.length);h%=b.length;e<0&&(e+=j.length);e%=j.length;f=h-1>=0?h-1:b.length-1;g=e-1>=0?e-1:j.length-1;q=[j[e],b[h],b[f]];q=THREE.FontUtils.Triangulate.area(q);r=[j[e],j[g],b[h]];r=THREE.FontUtils.Triangulate.area(r);m+o>q+r&&(h=n,e=k,h<0&&(h+=b.length),h%=b.length,e<0&&(e+=j.length),e%=j.length,f=h-1>=0?h-1:b.length-1,g=e-1>=0?e-1:j.length-1);m=b.slice(0,h);o=b.slice(h);n=j.slice(e);k=j.slice(0,e);g=[j[e],j[g],b[h]];t.push([j[e],b[h],b[f]]);t.push(g);b=m.concat(n).concat(k).concat(o)}return{shape:b,
|
|
|
+isolatedPts:t,allpoints:d}},triangulateShape:function(a,c){var b=THREE.Shape.Utils.removeHoles(a,c),d=b.allpoints,f=b.isolatedPts,b=THREE.FontUtils.Triangulate(b.shape,!1),g,e,h,i,j={};g=0;for(e=d.length;g<e;g++)i=d[g].x+":"+d[g].y,j[i]!==void 0&&console.log("Duplicate point",i),j[i]=g;g=0;for(e=b.length;g<e;g++){h=b[g];for(d=0;d<3;d++)i=h[d].x+":"+h[d].y,i=j[i],i!==void 0&&(h[d]=i)}g=0;for(e=f.length;g<e;g++){h=f[g];for(d=0;d<3;d++)i=h[d].x+":"+h[d].y,i=j[i],i!==void 0&&(h[d]=i)}return b.concat(f)},
|
|
|
+isClockWise:function(a){return THREE.FontUtils.Triangulate.area(a)<0},b2p0:function(a,c){var b=1-a;return b*b*c},b2p1:function(a,c){return 2*(1-a)*a*c},b2p2:function(a,c){return a*a*c},b2:function(a,c,b,d){return this.b2p0(a,c)+this.b2p1(a,b)+this.b2p2(a,d)},b3p0:function(a,c){var b=1-a;return b*b*b*c},b3p1:function(a,c){var b=1-a;return 3*b*b*a*c},b3p2:function(a,c){return 3*(1-a)*a*a*c},b3p3:function(a,c){return a*a*a*c},b3:function(a,c,b,d,f){return this.b3p0(a,c)+this.b3p1(a,b)+this.b3p2(a,d)+
|
|
|
+this.b3p3(a,f)}};THREE.TextPath=function(a,c){THREE.Path.call(this);this.parameters=c||{};this.set(a)};THREE.TextPath.prototype.set=function(a,c){this.text=a;var c=c||this.parameters,b=c.curveSegments!==void 0?c.curveSegments:4,d=c.font!==void 0?c.font:"helvetiker",f=c.weight!==void 0?c.weight:"normal",g=c.style!==void 0?c.style:"normal";THREE.FontUtils.size=c.size!==void 0?c.size:100;THREE.FontUtils.divisions=b;THREE.FontUtils.face=d;THREE.FontUtils.weight=f;THREE.FontUtils.style=g};
|
|
|
+THREE.TextPath.prototype.toShapes=function(){for(var a=THREE.FontUtils.drawText(this.text).paths,c=[],b=0,d=a.length;b<d;b++)Array.prototype.push.apply(c,a[b].toShapes());return c};
|
|
|
+THREE.AnimationHandler=function(){var a=[],c={},b={update:function(b){for(var d=0;d<a.length;d++)a[d].update(b)},addToUpdate:function(b){a.indexOf(b)===-1&&a.push(b)},removeFromUpdate:function(b){b=a.indexOf(b);b!==-1&&a.splice(b,1)},add:function(a){c[a.name]!==void 0&&console.log("THREE.AnimationHandler.add: Warning! "+a.name+" already exists in library. Overwriting.");c[a.name]=a;if(a.initialized!==!0){for(var b=0;b<a.hierarchy.length;b++){for(var d=0;d<a.hierarchy[b].keys.length;d++){if(a.hierarchy[b].keys[d].time<
|
|
|
+0)a.hierarchy[b].keys[d].time=0;if(a.hierarchy[b].keys[d].rot!==void 0&&!(a.hierarchy[b].keys[d].rot instanceof THREE.Quaternion)){var h=a.hierarchy[b].keys[d].rot;a.hierarchy[b].keys[d].rot=new THREE.Quaternion(h[0],h[1],h[2],h[3])}}if(a.hierarchy[b].keys[0].morphTargets!==void 0){h={};for(d=0;d<a.hierarchy[b].keys.length;d++)for(var i=0;i<a.hierarchy[b].keys[d].morphTargets.length;i++){var j=a.hierarchy[b].keys[d].morphTargets[i];h[j]=-1}a.hierarchy[b].usedMorphTargets=h;for(d=0;d<a.hierarchy[b].keys.length;d++){var k=
|
|
|
+{};for(j in h){for(i=0;i<a.hierarchy[b].keys[d].morphTargets.length;i++)if(a.hierarchy[b].keys[d].morphTargets[i]===j){k[j]=a.hierarchy[b].keys[d].morphTargetsInfluences[i];break}i===a.hierarchy[b].keys[d].morphTargets.length&&(k[j]=0)}a.hierarchy[b].keys[d].morphTargetsInfluences=k}}for(d=1;d<a.hierarchy[b].keys.length;d++)a.hierarchy[b].keys[d].time===a.hierarchy[b].keys[d-1].time&&(a.hierarchy[b].keys.splice(d,1),d--);for(d=1;d<a.hierarchy[b].keys.length;d++)a.hierarchy[b].keys[d].index=d}d=parseInt(a.length*
|
|
|
+a.fps,10);a.JIT={};a.JIT.hierarchy=[];for(b=0;b<a.hierarchy.length;b++)a.JIT.hierarchy.push(Array(d));a.initialized=!0}},get:function(a){if(typeof a==="string")return c[a]?c[a]:(console.log("THREE.AnimationHandler.get: Couldn't find animation "+a),null)},parse:function(a){var b=[];if(a instanceof THREE.SkinnedMesh)for(var c=0;c<a.bones.length;c++)b.push(a.bones[c]);else d(a,b);return b}},d=function(a,b){b.push(a);for(var c=0;c<a.children.length;c++)d(a.children[c],b)};b.LINEAR=0;b.CATMULLROM=1;b.CATMULLROM_FORWARD=
|
|
|
+2;return b}();THREE.Animation=function(a,c,b,d){this.root=a;this.data=THREE.AnimationHandler.get(c);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.loop=this.isPaused=!0;this.interpolationType=b!==void 0?b:THREE.AnimationHandler.LINEAR;this.JITCompile=d!==void 0?d:!0;this.points=[];this.target=new THREE.Vector3};
|
|
|
+THREE.Animation.prototype.play=function(a,c){if(!this.isPlaying){this.isPlaying=!0;this.loop=a!==void 0?a:!0;this.currentTime=c!==void 0?c:0;var b,d=this.hierarchy.length,f;for(b=0;b<d;b++){f=this.hierarchy[b];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)f.useQuaternion=!0;f.matrixAutoUpdate=!0;if(f.animationCache===void 0)f.animationCache={},f.animationCache.prevKey={pos:0,rot:0,scl:0},f.animationCache.nextKey={pos:0,rot:0,scl:0},f.animationCache.originalMatrix=f instanceof
|
|
|
+THREE.Bone?f.skinMatrix:f.matrix;var g=f.animationCache.prevKey;f=f.animationCache.nextKey;g.pos=this.data.hierarchy[b].keys[0];g.rot=this.data.hierarchy[b].keys[0];g.scl=this.data.hierarchy[b].keys[0];f.pos=this.getNextKeyWith("pos",b,1);f.rot=this.getNextKeyWith("rot",b,1);f.scl=this.getNextKeyWith("scl",b,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
|
|
|
THREE.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
|
|
|
THREE.Animation.prototype.stop=function(){this.isPaused=this.isPlaying=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.hierarchy.length;a++)if(this.hierarchy[a].animationCache!==void 0)this.hierarchy[a]instanceof THREE.Bone?this.hierarchy[a].skinMatrix=this.hierarchy[a].animationCache.originalMatrix:this.hierarchy[a].matrix=this.hierarchy[a].animationCache.originalMatrix,delete this.hierarchy[a].animationCache};
|
|
|
-THREE.Animation.prototype.update=function(a){if(this.isPlaying){var c=["pos","rot","scl"],b,e,g,h,f,k,l,m,n=this.data.JIT.hierarchy,o,u;this.currentTime+=a*this.timeScale;u=this.currentTime;o=this.currentTime%=this.data.length;m=parseInt(Math.min(o*this.data.fps,this.data.length*this.data.fps),10);for(var p=0,z=this.hierarchy.length;p<z;p++)if(a=this.hierarchy[p],l=a.animationCache,this.JITCompile&&n[p][m]!==void 0)a instanceof THREE.Bone?(a.skinMatrix=n[p][m],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=
|
|
|
-!1):(a.matrix=n[p][m],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=!0);else{if(this.JITCompile)a instanceof THREE.Bone?a.skinMatrix=a.animationCache.originalMatrix:a.matrix=a.animationCache.originalMatrix;for(var w=0;w<3;w++){b=c[w];f=l.prevKey[b];k=l.nextKey[b];if(k.time<=u){if(o<u)if(this.loop){f=this.data.hierarchy[p].keys[0];for(k=this.getNextKeyWith(b,p,1);k.time<o;)f=k,k=this.getNextKeyWith(b,p,k.index+1)}else{this.stop();return}else{do f=k,k=this.getNextKeyWith(b,p,k.index+1);while(k.time<
|
|
|
-o)}l.prevKey[b]=f;l.nextKey[b]=k}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;e=(o-f.time)/(k.time-f.time);g=f[b];h=k[b];if(e<0||e>1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+e+" on bone "+p),e=e<0?0:1;if(b==="pos")if(b=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)b.x=g[0]+(h[0]-g[0])*e,b.y=g[1]+(h[1]-g[1])*e,b.z=g[2]+(h[2]-g[2])*e;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
|
|
|
-this.getPrevKeyWith("pos",p,f.index-1).pos,this.points[1]=g,this.points[2]=h,this.points[3]=this.getNextKeyWith("pos",p,k.index+1).pos,e=e*0.33+0.33,g=this.interpolateCatmullRom(this.points,e),b.x=g[0],b.y=g[1],b.z=g[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)e=this.interpolateCatmullRom(this.points,e*1.01),this.target.set(e[0],e[1],e[2]),this.target.subSelf(b),this.target.y=0,this.target.normalize(),e=Math.atan2(this.target.x,this.target.z),a.rotation.set(0,e,0)}else if(b===
|
|
|
-"rot")THREE.Quaternion.slerp(g,h,a.quaternion,e);else if(b==="scl")b=a.scale,b.x=g[0]+(h[0]-g[0])*e,b.y=g[1]+(h[1]-g[1])*e,b.z=g[2]+(h[2]-g[2])*e}}if(this.JITCompile&&n[0][m]===void 0){this.hierarchy[0].update(null,!0);for(p=0;p<this.hierarchy.length;p++)n[p][m]=this.hierarchy[p]instanceof THREE.Bone?this.hierarchy[p].skinMatrix.clone():this.hierarchy[p].matrix.clone()}}};
|
|
|
-THREE.Animation.prototype.interpolateCatmullRom=function(a,c){var b=[],e=[],g,h,f,k,l,m;g=(a.length-1)*c;h=Math.floor(g);g-=h;b[0]=h===0?h:h-1;b[1]=h;b[2]=h>a.length-2?h:h+1;b[3]=h>a.length-3?h:h+2;h=a[b[0]];k=a[b[1]];l=a[b[2]];m=a[b[3]];b=g*g;f=g*b;e[0]=this.interpolate(h[0],k[0],l[0],m[0],g,b,f);e[1]=this.interpolate(h[1],k[1],l[1],m[1],g,b,f);e[2]=this.interpolate(h[2],k[2],l[2],m[2],g,b,f);return e};
|
|
|
-THREE.Animation.prototype.interpolate=function(a,c,b,e,g,h,f){a=(b-a)*0.5;e=(e-c)*0.5;return(2*(c-b)+a+e)*f+(-3*(c-b)-2*a-e)*h+a*g+c};THREE.Animation.prototype.getNextKeyWith=function(a,c,b){var e=this.data.hierarchy[c].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?b=b<e.length-1?b:e.length-1:b%=e.length;b<e.length;b++)if(e[b][a]!==void 0)return e[b];return this.data.hierarchy[c].keys[0]};
|
|
|
-THREE.Animation.prototype.getPrevKeyWith=function(a,c,b){for(var e=this.data.hierarchy[c].keys,b=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?b>0?b:0:b>=0?b:b+e.length;b>=0;b--)if(e[b][a]!==void 0)return e[b];return this.data.hierarchy[c].keys[e.length-1]};
|
|
|
-THREE.CubeCamera=function(a,c,b,e){this.heightOffset=b;this.position=new THREE.Vector3(0,b,0);this.cameraPX=new THREE.PerspectiveCamera(90,1,a,c);this.cameraNX=new THREE.PerspectiveCamera(90,1,a,c);this.cameraPY=new THREE.PerspectiveCamera(90,1,a,c);this.cameraNY=new THREE.PerspectiveCamera(90,1,a,c);this.cameraPZ=new THREE.PerspectiveCamera(90,1,a,c);this.cameraNZ=new THREE.PerspectiveCamera(90,1,a,c);this.cameraPX.position=this.position;this.cameraNX.position=this.position;this.cameraPY.position=
|
|
|
+THREE.Animation.prototype.update=function(a){if(this.isPlaying){var c=["pos","rot","scl"],b,d,f,g,e,h,i,j,k=this.data.JIT.hierarchy,m,o;this.currentTime+=a*this.timeScale;o=this.currentTime;m=this.currentTime%=this.data.length;j=parseInt(Math.min(m*this.data.fps,this.data.length*this.data.fps),10);for(var n=0,t=this.hierarchy.length;n<t;n++)if(a=this.hierarchy[n],i=a.animationCache,this.JITCompile&&k[n][j]!==void 0)a instanceof THREE.Bone?(a.skinMatrix=k[n][j],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=
|
|
|
+!1):(a.matrix=k[n][j],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=!0);else{if(this.JITCompile)a instanceof THREE.Bone?a.skinMatrix=a.animationCache.originalMatrix:a.matrix=a.animationCache.originalMatrix;for(var q=0;q<3;q++){b=c[q];e=i.prevKey[b];h=i.nextKey[b];if(h.time<=o){if(m<o)if(this.loop){e=this.data.hierarchy[n].keys[0];for(h=this.getNextKeyWith(b,n,1);h.time<m;)e=h,h=this.getNextKeyWith(b,n,h.index+1)}else{this.stop();return}else{do e=h,h=this.getNextKeyWith(b,n,h.index+1);while(h.time<
|
|
|
+m)}i.prevKey[b]=e;i.nextKey[b]=h}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;d=(m-e.time)/(h.time-e.time);f=e[b];g=h[b];if(d<0||d>1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+d+" on bone "+n),d=d<0?0:1;if(b==="pos")if(b=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)b.x=f[0]+(g[0]-f[0])*d,b.y=f[1]+(g[1]-f[1])*d,b.z=f[2]+(g[2]-f[2])*d;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
|
|
|
+this.getPrevKeyWith("pos",n,e.index-1).pos,this.points[1]=f,this.points[2]=g,this.points[3]=this.getNextKeyWith("pos",n,h.index+1).pos,d=d*0.33+0.33,f=this.interpolateCatmullRom(this.points,d),b.x=f[0],b.y=f[1],b.z=f[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)d=this.interpolateCatmullRom(this.points,d*1.01),this.target.set(d[0],d[1],d[2]),this.target.subSelf(b),this.target.y=0,this.target.normalize(),d=Math.atan2(this.target.x,this.target.z),a.rotation.set(0,d,0)}else if(b===
|
|
|
+"rot")THREE.Quaternion.slerp(f,g,a.quaternion,d);else if(b==="scl")b=a.scale,b.x=f[0]+(g[0]-f[0])*d,b.y=f[1]+(g[1]-f[1])*d,b.z=f[2]+(g[2]-f[2])*d}}if(this.JITCompile&&k[0][j]===void 0){this.hierarchy[0].update(null,!0);for(n=0;n<this.hierarchy.length;n++)k[n][j]=this.hierarchy[n]instanceof THREE.Bone?this.hierarchy[n].skinMatrix.clone():this.hierarchy[n].matrix.clone()}}};
|
|
|
+THREE.Animation.prototype.interpolateCatmullRom=function(a,c){var b=[],d=[],f,g,e,h,i,j;f=(a.length-1)*c;g=Math.floor(f);f-=g;b[0]=g===0?g:g-1;b[1]=g;b[2]=g>a.length-2?g:g+1;b[3]=g>a.length-3?g:g+2;g=a[b[0]];h=a[b[1]];i=a[b[2]];j=a[b[3]];b=f*f;e=f*b;d[0]=this.interpolate(g[0],h[0],i[0],j[0],f,b,e);d[1]=this.interpolate(g[1],h[1],i[1],j[1],f,b,e);d[2]=this.interpolate(g[2],h[2],i[2],j[2],f,b,e);return d};
|
|
|
+THREE.Animation.prototype.interpolate=function(a,c,b,d,f,g,e){a=(b-a)*0.5;d=(d-c)*0.5;return(2*(c-b)+a+d)*e+(-3*(c-b)-2*a-d)*g+a*f+c};THREE.Animation.prototype.getNextKeyWith=function(a,c,b){var d=this.data.hierarchy[c].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?b=b<d.length-1?b:d.length-1:b%=d.length;b<d.length;b++)if(d[b][a]!==void 0)return d[b];return this.data.hierarchy[c].keys[0]};
|
|
|
+THREE.Animation.prototype.getPrevKeyWith=function(a,c,b){for(var d=this.data.hierarchy[c].keys,b=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?b>0?b:0:b>=0?b:b+d.length;b>=0;b--)if(d[b][a]!==void 0)return d[b];return this.data.hierarchy[c].keys[d.length-1]};
|
|
|
+THREE.CubeCamera=function(a,c,b,d){this.heightOffset=b;this.position=new THREE.Vector3(0,b,0);this.cameraPX=new THREE.PerspectiveCamera(90,1,a,c);this.cameraNX=new THREE.PerspectiveCamera(90,1,a,c);this.cameraPY=new THREE.PerspectiveCamera(90,1,a,c);this.cameraNY=new THREE.PerspectiveCamera(90,1,a,c);this.cameraPZ=new THREE.PerspectiveCamera(90,1,a,c);this.cameraNZ=new THREE.PerspectiveCamera(90,1,a,c);this.cameraPX.position=this.position;this.cameraNX.position=this.position;this.cameraPY.position=
|
|
|
this.position;this.cameraNY.position=this.position;this.cameraPZ.position=this.position;this.cameraNZ.position=this.position;this.cameraPX.up.set(0,-1,0);this.cameraNX.up.set(0,-1,0);this.cameraPY.up.set(0,0,1);this.cameraNY.up.set(0,0,-1);this.cameraPZ.up.set(0,-1,0);this.cameraNZ.up.set(0,-1,0);this.targetPX=new THREE.Vector3(0,0,0);this.targetNX=new THREE.Vector3(0,0,0);this.targetPY=new THREE.Vector3(0,0,0);this.targetNY=new THREE.Vector3(0,0,0);this.targetPZ=new THREE.Vector3(0,0,0);this.targetNZ=
|
|
|
-new THREE.Vector3(0,0,0);this.renderTarget=new THREE.WebGLRenderTargetCube(e,e,{format:THREE.RGBFormat,magFilter:THREE.LinearFilter,minFilter:THREE.LinearFilter});this.updatePosition=function(a){this.position.copy(a);this.position.y+=this.heightOffset;this.targetPX.copy(this.position);this.targetNX.copy(this.position);this.targetPY.copy(this.position);this.targetNY.copy(this.position);this.targetPZ.copy(this.position);this.targetNZ.copy(this.position);this.targetPX.x+=1;this.targetNX.x-=1;this.targetPY.y+=
|
|
|
-1;this.targetNY.y-=1;this.targetPZ.z+=1;this.targetNZ.z-=1;this.cameraPX.lookAt(this.targetPX);this.cameraNX.lookAt(this.targetNX);this.cameraPY.lookAt(this.targetPY);this.cameraNY.lookAt(this.targetNY);this.cameraPZ.lookAt(this.targetPZ);this.cameraNZ.lookAt(this.targetNZ)};this.updateCubeMap=function(a,b){var e=this.renderTarget;e.activeCubeFace=0;a.render(b,this.cameraPX,e);e.activeCubeFace=1;a.render(b,this.cameraNX,e);e.activeCubeFace=2;a.render(b,this.cameraPY,e);e.activeCubeFace=3;a.render(b,
|
|
|
-this.cameraNY,e);e.activeCubeFace=4;a.render(b,this.cameraPZ,e);e.activeCubeFace=5;a.render(b,this.cameraNZ,e)}};THREE.FirstPersonCamera=function(){console.warn("DEPRECATED: FirstPersonCamera() is FirstPersonControls().")};THREE.PathCamera=function(){console.warn("DEPRECATED: PathCamera() is PathControls().")};THREE.FlyCamera=function(){console.warn("DEPRECATED: FlyCamera() is FlyControls().")};THREE.RollCamera=function(){console.warn("DEPRECATED: RollCamera() is RollControls().")};
|
|
|
-THREE.TrackballCamera=function(){console.warn("DEPRECATED: TrackballCamera() is TrackballControls().")};THREE.CombinedCamera=function(a,c,b,e,g,h,f){THREE.Camera.call(this);this.fov=b;this.left=-a/2;this.right=a/2;this.top=c/2;this.bottom=-c/2;this.cameraO=new THREE.OrthographicCamera(a/-2,a/2,c/2,c/-2,h,f);this.cameraP=new THREE.PerspectiveCamera(b,a/c,e,g);this.zoom=1;this.toPerspective()};THREE.CombinedCamera.prototype=new THREE.Camera;THREE.CombinedCamera.prototype.constructor=THREE.CoolCamera;
|
|
|
+new THREE.Vector3(0,0,0);this.renderTarget=new THREE.WebGLRenderTargetCube(d,d,{format:THREE.RGBFormat,magFilter:THREE.LinearFilter,minFilter:THREE.LinearFilter});this.updatePosition=function(a){this.position.copy(a);this.position.y+=this.heightOffset;this.targetPX.copy(this.position);this.targetNX.copy(this.position);this.targetPY.copy(this.position);this.targetNY.copy(this.position);this.targetPZ.copy(this.position);this.targetNZ.copy(this.position);this.targetPX.x+=1;this.targetNX.x-=1;this.targetPY.y+=
|
|
|
+1;this.targetNY.y-=1;this.targetPZ.z+=1;this.targetNZ.z-=1;this.cameraPX.lookAt(this.targetPX);this.cameraNX.lookAt(this.targetNX);this.cameraPY.lookAt(this.targetPY);this.cameraNY.lookAt(this.targetNY);this.cameraPZ.lookAt(this.targetPZ);this.cameraNZ.lookAt(this.targetNZ)};this.updateCubeMap=function(a,b){var d=this.renderTarget;d.activeCubeFace=0;a.render(b,this.cameraPX,d);d.activeCubeFace=1;a.render(b,this.cameraNX,d);d.activeCubeFace=2;a.render(b,this.cameraPY,d);d.activeCubeFace=3;a.render(b,
|
|
|
+this.cameraNY,d);d.activeCubeFace=4;a.render(b,this.cameraPZ,d);d.activeCubeFace=5;a.render(b,this.cameraNZ,d)}};THREE.FirstPersonCamera=function(){console.warn("DEPRECATED: FirstPersonCamera() is FirstPersonControls().")};THREE.PathCamera=function(){console.warn("DEPRECATED: PathCamera() is PathControls().")};THREE.FlyCamera=function(){console.warn("DEPRECATED: FlyCamera() is FlyControls().")};THREE.RollCamera=function(){console.warn("DEPRECATED: RollCamera() is RollControls().")};
|
|
|
+THREE.TrackballCamera=function(){console.warn("DEPRECATED: TrackballCamera() is TrackballControls().")};THREE.CombinedCamera=function(a,c,b,d,f,g,e){THREE.Camera.call(this);this.fov=b;this.left=-a/2;this.right=a/2;this.top=c/2;this.bottom=-c/2;this.cameraO=new THREE.OrthographicCamera(a/-2,a/2,c/2,c/-2,g,e);this.cameraP=new THREE.PerspectiveCamera(b,a/c,d,f);this.zoom=1;this.toPerspective()};THREE.CombinedCamera.prototype=new THREE.Camera;THREE.CombinedCamera.prototype.constructor=THREE.CoolCamera;
|
|
|
THREE.CombinedCamera.prototype.toPerspective=function(){this.near=this.cameraP.near;this.far=this.cameraP.far;this.cameraP.fov=this.fov/this.zoom;this.cameraP.updateProjectionMatrix();this.projectionMatrix=this.cameraP.projectionMatrix;this.inPersepectiveMode=!0;this.inOrthographicMode=!1};
|
|
|
THREE.CombinedCamera.prototype.toOrthographic=function(){var a=Math.tan(this.fov/2)*((this.cameraP.near+this.cameraP.far)/2),c=2*a*this.cameraP.aspect/2;a/=this.zoom;c/=this.zoom;this.cameraO.left=-c;this.cameraO.right=c;this.cameraO.top=a;this.cameraO.bottom=-a;this.cameraO.updateProjectionMatrix();this.near=this.cameraO.near;this.far=this.cameraO.far;this.projectionMatrix=this.cameraO.projectionMatrix;this.inPersepectiveMode=!1;this.inOrthographicMode=!0};
|
|
|
THREE.CombinedCamera.prototype.setFov=function(a){this.fov=a;this.inPersepectiveMode?this.toPerspective():this.toOrthographic()};THREE.CombinedCamera.prototype.setLens=function(a,c){c||(c=43.25);var b=2*Math.atan(c/(a*2));b*=180/Math.PI;this.setFov(b);return b};THREE.CombinedCamera.prototype.setZoom=function(a){this.zoom=a;this.inPersepectiveMode?this.toPerspective():this.toOrthographic()};
|
|
|
@@ -104,217 +104,216 @@ function(a){switch(a.keyCode){case 38:case 87:this.moveForward=!0;break;case 37:
|
|
|
this.moveUp&&this.object.translateY(b);this.moveDown&&this.object.translateY(-b);b=a*this.lookSpeed;this.activeLook||(b=0);this.lon+=this.mouseX*b;this.lookVertical&&(this.lat-=this.mouseY*b);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;var a=this.target,c=this.object.position;a.x=c.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=c.y+100*Math.cos(this.phi);a.z=c.z+100*Math.sin(this.phi)*Math.sin(this.theta)}a=1;this.constrainVertical&&
|
|
|
(a=Math.PI/(this.verticalMax-this.verticalMin));this.lon+=this.mouseX*b;this.lookVertical&&(this.lat-=this.mouseY*b*a);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;if(this.constrainVertical)this.phi=THREE.Math.mapLinear(this.phi,0,Math.PI,this.verticalMin,this.verticalMax);a=this.target;c=this.object.position;a.x=c.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=c.y+100*Math.cos(this.phi);a.z=c.z+100*Math.sin(this.phi)*Math.sin(this.theta);
|
|
|
this.object.lookAt(a)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",b(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",b(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",b(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",b(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",b(this,this.onKeyUp),!1)};
|
|
|
-THREE.PathControls=function(a,c){function b(a){if((a*=2)<1)return 0.5*a*a;return-0.5*(--a*(a-2)-1)}function e(a,b){return function(){b.apply(a,arguments)}}function g(a,b,e,c){var f={name:e,fps:0.6,length:c,hierarchy:[]},h,g=b.getControlPointsArray(),k=b.getLength(),x=g.length,v=0;h=x-1;b={parent:-1,keys:[]};b.keys[0]={time:0,pos:g[0],rot:[0,0,0,1],scl:[1,1,1]};b.keys[h]={time:c,pos:g[h],rot:[0,0,0,1],scl:[1,1,1]};for(h=1;h<x-1;h++)v=c*k.chunks[h]/k.total,b.keys[h]={time:v,pos:g[h]};f.hierarchy[0]=
|
|
|
-b;THREE.AnimationHandler.add(f);return new THREE.Animation(a,e,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function h(a,b){var e,c,f=new THREE.Geometry;for(e=0;e<a.points.length*b;e++)c=e/(a.points.length*b),c=a.getPoint(c),f.vertices[e]=new THREE.Vertex(new THREE.Vector3(c.x,c.y,c.z));return f}this.object=a;this.domElement=c!==void 0?c:document;this.id="PathControls"+THREE.PathControlsIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=
|
|
|
+THREE.PathControls=function(a,c){function b(a){if((a*=2)<1)return 0.5*a*a;return-0.5*(--a*(a-2)-1)}function d(a,b){return function(){b.apply(a,arguments)}}function f(a,b,d,c){var e={name:d,fps:0.6,length:c,hierarchy:[]},g,f=b.getControlPointsArray(),h=b.getLength(),r=f.length,p=0;g=r-1;b={parent:-1,keys:[]};b.keys[0]={time:0,pos:f[0],rot:[0,0,0,1],scl:[1,1,1]};b.keys[g]={time:c,pos:f[g],rot:[0,0,0,1],scl:[1,1,1]};for(g=1;g<r-1;g++)p=c*h.chunks[g]/h.total,b.keys[g]={time:p,pos:f[g]};e.hierarchy[0]=
|
|
|
+b;THREE.AnimationHandler.add(e);return new THREE.Animation(a,d,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function g(a,b){var d,c,e=new THREE.Geometry;for(d=0;d<a.points.length*b;d++)c=d/(a.points.length*b),c=a.getPoint(c),e.vertices[d]=new THREE.Vertex(new THREE.Vector3(c.x,c.y,c.z));return e}this.object=a;this.domElement=c!==void 0?c:document;this.id="PathControls"+THREE.PathControlsIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=
|
|
|
new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.0050;this.lookHorizontal=this.lookVertical=!0;this.verticalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.horizontalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.target=new THREE.Object3D;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=
|
|
|
-this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));var f=Math.PI*2,k=Math.PI/180;this.update=function(a){var e;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed*a);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed*a);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*k;this.theta=this.lon*k;a=this.phi%f;this.phi=a>=0?a:a+f;e=this.verticalAngleMap.srcRange;
|
|
|
-a=this.verticalAngleMap.dstRange;e=THREE.Math.mapLinear(this.phi,e[0],e[1],a[0],a[1]);var c=a[1]-a[0];this.phi=b((e-a[0])/c)*c+a[0];e=this.horizontalAngleMap.srcRange;a=this.horizontalAngleMap.dstRange;e=THREE.Math.mapLinear(this.theta,e[0],e[1],a[0],a[1]);c=a[1]-a[0];this.theta=b((e-a[0])/c)*c+a[0];a=this.target.position;a.x=100*Math.sin(this.phi)*Math.cos(this.theta);a.y=100*Math.cos(this.phi);a.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.object.lookAt(this.target.position)};this.onMouseMove=
|
|
|
+this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));var e=Math.PI*2,h=Math.PI/180;this.update=function(a){var d;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed*a);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed*a);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*h;this.theta=this.lon*h;a=this.phi%e;this.phi=a>=0?a:a+e;d=this.verticalAngleMap.srcRange;
|
|
|
+a=this.verticalAngleMap.dstRange;d=THREE.Math.mapLinear(this.phi,d[0],d[1],a[0],a[1]);var c=a[1]-a[0];this.phi=b((d-a[0])/c)*c+a[0];d=this.horizontalAngleMap.srcRange;a=this.horizontalAngleMap.dstRange;d=THREE.Math.mapLinear(this.theta,d[0],d[1],a[0],a[1]);c=a[1]-a[0];this.theta=b((d-a[0])/c)*c+a[0];a=this.target.position;a.x=100*Math.sin(this.phi)*Math.cos(this.theta);a.y=100*Math.cos(this.phi);a.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.object.lookAt(this.target.position)};this.onMouseMove=
|
|
|
function(a){this.domElement===document?(this.mouseX=a.pageX-this.viewHalfX,this.mouseY=a.pageY-this.viewHalfY):(this.mouseX=a.pageX-this.domElement.offsetLeft-this.viewHalfX,this.mouseY=a.pageY-this.domElement.offsetTop-this.viewHalfY)};this.init=function(){this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){var a=new THREE.MeshLambertMaterial({color:30719}),b=new THREE.MeshLambertMaterial({color:65280}),
|
|
|
-c=new THREE.CubeGeometry(10,10,20),f=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(c,a);a=new THREE.Mesh(f,b);a.position.set(0,10,0);this.animation=g(this.animationParent,this.spline,this.id,this.duration);this.animationParent.add(this.object);this.animationParent.add(this.target);this.animationParent.add(a)}else this.animation=g(this.animationParent,this.spline,this.id,this.duration),this.animationParent.add(this.target),this.animationParent.add(this.object);if(this.createDebugPath){var a=
|
|
|
-this.debugPath,b=this.spline,c=h(b,10),f=h(b,10),k=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(c,k);particleObj=new THREE.ParticleSystem(f,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);a.add(lineObj);particleObj.scale.set(1,1,1);a.add(particleObj);f=new THREE.SphereGeometry(1,16,8);k=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<b.points.length;i++)c=new THREE.Mesh(f,k),c.position.copy(b.points[i]),a.add(c)}this.domElement.addEventListener("mousemove",
|
|
|
-e(this,this.onMouseMove),!1)}};THREE.PathControlsIdCounter=0;
|
|
|
+c=new THREE.CubeGeometry(10,10,20),e=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(c,a);a=new THREE.Mesh(e,b);a.position.set(0,10,0);this.animation=f(this.animationParent,this.spline,this.id,this.duration);this.animationParent.add(this.object);this.animationParent.add(this.target);this.animationParent.add(a)}else this.animation=f(this.animationParent,this.spline,this.id,this.duration),this.animationParent.add(this.target),this.animationParent.add(this.object);if(this.createDebugPath){var a=
|
|
|
+this.debugPath,b=this.spline,e=g(b,10),c=g(b,10),h=new THREE.LineBasicMaterial({color:16711680,linewidth:3}),e=new THREE.Line(e,h),c=new THREE.ParticleSystem(c,new THREE.ParticleBasicMaterial({color:16755200,size:3}));e.scale.set(1,1,1);a.add(e);c.scale.set(1,1,1);a.add(c);for(var e=new THREE.SphereGeometry(1,16,8),h=new THREE.MeshBasicMaterial({color:65280}),n=0;n<b.points.length;n++)c=new THREE.Mesh(e,h),c.position.copy(b.points[n]),a.add(c)}this.domElement.addEventListener("mousemove",d(this,this.onMouseMove),
|
|
|
+!1)}};THREE.PathControlsIdCounter=0;
|
|
|
THREE.FlyControls=function(a,c){function b(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.domElement=c!==void 0?c:document;c&&this.domElement.setAttribute("tabindex",-1);this.movementSpeed=1;this.rollSpeed=0.0050;this.autoForward=this.dragToLook=!1;this.object.useQuaternion=!0;this.tmpQuaternion=new THREE.Quaternion;this.mouseStatus=0;this.moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0};this.moveVector=new THREE.Vector3(0,
|
|
|
0,0);this.rotationVector=new THREE.Vector3(0,0,0);this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.keydown=function(a){if(!a.altKey){switch(a.keyCode){case 16:this.movementSpeedMultiplier=0.1;break;case 87:this.moveState.forward=1;break;case 83:this.moveState.back=1;break;case 65:this.moveState.left=1;break;case 68:this.moveState.right=1;break;case 82:this.moveState.up=1;break;case 70:this.moveState.down=1;break;case 38:this.moveState.pitchUp=1;break;case 40:this.moveState.pitchDown=
|
|
|
1;break;case 37:this.moveState.yawLeft=1;break;case 39:this.moveState.yawRight=1;break;case 81:this.moveState.rollLeft=1;break;case 69:this.moveState.rollRight=1}this.updateMovementVector();this.updateRotationVector()}};this.keyup=function(a){switch(a.keyCode){case 16:this.movementSpeedMultiplier=1;break;case 87:this.moveState.forward=0;break;case 83:this.moveState.back=0;break;case 65:this.moveState.left=0;break;case 68:this.moveState.right=0;break;case 82:this.moveState.up=0;break;case 70:this.moveState.down=
|
|
|
0;break;case 38:this.moveState.pitchUp=0;break;case 40:this.moveState.pitchDown=0;break;case 37:this.moveState.yawLeft=0;break;case 39:this.moveState.yawRight=0;break;case 81:this.moveState.rollLeft=0;break;case 69:this.moveState.rollRight=0}this.updateMovementVector();this.updateRotationVector()};this.mousedown=function(a){this.domElement!==document&&this.domElement.focus();a.preventDefault();a.stopPropagation();if(this.dragToLook)this.mouseStatus++;else switch(a.button){case 0:this.object.moveForward=
|
|
|
-!0;break;case 2:this.object.moveBackward=!0}};this.mousemove=function(a){if(!this.dragToLook||this.mouseStatus>0){var b=this.getContainerDimensions(),c=b.size[0]/2,f=b.size[1]/2;this.moveState.yawLeft=-(a.pageX-b.offset[0]-c)/c;this.moveState.pitchDown=(a.pageY-b.offset[1]-f)/f;this.updateRotationVector()}};this.mouseup=function(a){a.preventDefault();a.stopPropagation();if(this.dragToLook)this.mouseStatus--,this.moveState.yawLeft=this.moveState.pitchDown=0;else switch(a.button){case 0:this.moveForward=
|
|
|
+!0;break;case 2:this.object.moveBackward=!0}};this.mousemove=function(a){if(!this.dragToLook||this.mouseStatus>0){var b=this.getContainerDimensions(),c=b.size[0]/2,e=b.size[1]/2;this.moveState.yawLeft=-(a.pageX-b.offset[0]-c)/c;this.moveState.pitchDown=(a.pageY-b.offset[1]-e)/e;this.updateRotationVector()}};this.mouseup=function(a){a.preventDefault();a.stopPropagation();if(this.dragToLook)this.mouseStatus--,this.moveState.yawLeft=this.moveState.pitchDown=0;else switch(a.button){case 0:this.moveForward=
|
|
|
!1;break;case 2:this.moveBackward=!1}this.updateRotationVector()};this.update=function(a){var b=a*this.movementSpeed;a*=this.rollSpeed;this.object.translateX(this.moveVector.x*b);this.object.translateY(this.moveVector.y*b);this.object.translateZ(this.moveVector.z*b);this.tmpQuaternion.set(this.rotationVector.x*a,this.rotationVector.y*a,this.rotationVector.z*a,1).normalize();this.object.quaternion.multiplySelf(this.tmpQuaternion);this.object.matrix.setPosition(this.object.position);this.object.matrix.setRotationFromQuaternion(this.object.quaternion);
|
|
|
this.object.matrixWorldNeedsUpdate=!0};this.updateMovementVector=function(){var a=this.moveState.forward||this.autoForward&&!this.moveState.back?1:0;this.moveVector.x=-this.moveState.left+this.moveState.right;this.moveVector.y=-this.moveState.down+this.moveState.up;this.moveVector.z=-a+this.moveState.back};this.updateRotationVector=function(){this.rotationVector.x=-this.moveState.pitchDown+this.moveState.pitchUp;this.rotationVector.y=-this.moveState.yawRight+this.moveState.yawLeft;this.rotationVector.z=
|
|
|
-this.moveState.rollRight+this.moveState.rollLeft};this.getContainerDimensions=function(){return this.domElement!=document?{size:[this.domElement.offsetWidth,this.domElement.offsetHeight],offset:[this.domElement.offsetLeft,this.domElement.offsetTop]}:{size:[window.innerWidth,window.innerHeight],offset:[0,0]}};this.domElement.addEventListener("mousemove",b(this,this.mousemove),!1);this.domElement.addEventListener("mousedown",b(this,this.mousedown),!1);this.domElement.addEventListener("mouseup",b(this,
|
|
|
this.mouseup),!1);this.domElement.addEventListener("keydown",b(this,this.keydown),!1);this.domElement.addEventListener("keyup",b(this,this.keyup),!1);this.updateMovementVector();this.updateRotationVector()};
|
|
|
-THREE.RollControls=function(a,c){this.object=a;this.domElement=c!==void 0?c:document;this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.object.matrixAutoUpdate=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;var b=new THREE.Vector3,e=new THREE.Vector3,g=new THREE.Vector3,h=new THREE.Matrix4,f=!1,k=1,l=0,m=0,n=0,o=0,u=0,p=window.innerWidth/2,z=window.innerHeight/2;this.update=function(a){if(this.mouseLook){var c=a*this.lookSpeed;
|
|
|
-this.rotateHorizontally(c*o);this.rotateVertically(c*u)}c=a*this.movementSpeed;this.object.translateZ(-c*(l>0||this.autoForward&&!(l<0)?1:l));this.object.translateX(c*m);this.object.translateY(c*n);f&&(this.roll+=this.rollSpeed*a*k);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize();else if(this.forward.y<this.constrainVertical[0])this.forward.y=this.constrainVertical[0],this.forward.normalize();g.copy(this.forward);e.set(0,1,0);b.cross(e,
|
|
|
-g).normalize();e.cross(g,b).normalize();this.object.matrix.n11=b.x;this.object.matrix.n12=e.x;this.object.matrix.n13=g.x;this.object.matrix.n21=b.y;this.object.matrix.n22=e.y;this.object.matrix.n23=g.y;this.object.matrix.n31=b.z;this.object.matrix.n32=e.z;this.object.matrix.n33=g.z;h.identity();h.n11=Math.cos(this.roll);h.n12=-Math.sin(this.roll);h.n21=Math.sin(this.roll);h.n22=Math.cos(this.roll);this.object.matrix.multiplySelf(h);this.object.matrixWorldNeedsUpdate=!0;this.object.matrix.n14=this.object.position.x;
|
|
|
+THREE.RollControls=function(a,c){this.object=a;this.domElement=c!==void 0?c:document;this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.object.matrixAutoUpdate=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;var b=new THREE.Vector3,d=new THREE.Vector3,f=new THREE.Vector3,g=new THREE.Matrix4,e=!1,h=1,i=0,j=0,k=0,m=0,o=0,n=window.innerWidth/2,t=window.innerHeight/2;this.update=function(a){if(this.mouseLook){var c=a*this.lookSpeed;
|
|
|
+this.rotateHorizontally(c*m);this.rotateVertically(c*o)}c=a*this.movementSpeed;this.object.translateZ(-c*(i>0||this.autoForward&&!(i<0)?1:i));this.object.translateX(c*j);this.object.translateY(c*k);e&&(this.roll+=this.rollSpeed*a*h);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize();else if(this.forward.y<this.constrainVertical[0])this.forward.y=this.constrainVertical[0],this.forward.normalize();f.copy(this.forward);d.set(0,1,0);b.cross(d,
|
|
|
+f).normalize();d.cross(f,b).normalize();this.object.matrix.n11=b.x;this.object.matrix.n12=d.x;this.object.matrix.n13=f.x;this.object.matrix.n21=b.y;this.object.matrix.n22=d.y;this.object.matrix.n23=f.y;this.object.matrix.n31=b.z;this.object.matrix.n32=d.z;this.object.matrix.n33=f.z;g.identity();g.n11=Math.cos(this.roll);g.n12=-Math.sin(this.roll);g.n21=Math.sin(this.roll);g.n22=Math.cos(this.roll);this.object.matrix.multiplySelf(g);this.object.matrixWorldNeedsUpdate=!0;this.object.matrix.n14=this.object.position.x;
|
|
|
this.object.matrix.n24=this.object.position.y;this.object.matrix.n34=this.object.position.z};this.translateX=function(a){this.object.position.x+=this.object.matrix.n11*a;this.object.position.y+=this.object.matrix.n21*a;this.object.position.z+=this.object.matrix.n31*a};this.translateY=function(a){this.object.position.x+=this.object.matrix.n12*a;this.object.position.y+=this.object.matrix.n22*a;this.object.position.z+=this.object.matrix.n32*a};this.translateZ=function(a){this.object.position.x-=this.object.matrix.n13*
|
|
|
-a;this.object.position.y-=this.object.matrix.n23*a;this.object.position.z-=this.object.matrix.n33*a};this.rotateHorizontally=function(a){b.set(this.object.matrix.n11,this.object.matrix.n21,this.object.matrix.n31);b.multiplyScalar(a);this.forward.subSelf(b);this.forward.normalize()};this.rotateVertically=function(a){e.set(this.object.matrix.n12,this.object.matrix.n22,this.object.matrix.n32);e.multiplyScalar(a);this.forward.addSelf(e);this.forward.normalize()};this.domElement.addEventListener("contextmenu",
|
|
|
-function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){o=(a.clientX-p)/window.innerWidth;u=(a.clientY-z)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:l=1;break;case 2:l=-1}},!1);this.domElement.addEventListener("mouseup",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:l=0;break;case 2:l=0}},!1);this.domElement.addEventListener("keydown",
|
|
|
-function(a){switch(a.keyCode){case 38:case 87:l=1;break;case 37:case 65:m=-1;break;case 40:case 83:l=-1;break;case 39:case 68:m=1;break;case 81:f=!0;k=1;break;case 69:f=!0;k=-1;break;case 82:n=1;break;case 70:n=-1}},!1);this.domElement.addEventListener("keyup",function(a){switch(a.keyCode){case 38:case 87:l=0;break;case 37:case 65:m=0;break;case 40:case 83:l=0;break;case 39:case 68:m=0;break;case 81:f=!1;break;case 69:f=!1;break;case 82:n=0;break;case 70:n=0}},!1)};
|
|
|
-THREE.TrackballControls=function(a,c){var b=this,e={NONE:-1,ROTATE:0,ZOOM:1,PAN:2};this.object=a;this.domElement=c!==void 0?c:document;this.enabled=!0;this.screen={width:window.innerWidth,height:window.innerHeight,offsetLeft:0,offsetTop:0};this.radius=(this.screen.width+this.screen.height)/4;this.rotateSpeed=1;this.zoomSpeed=1.2;this.panSpeed=0.3;this.staticMoving=this.noPan=this.noZoom=!1;this.dynamicDampingFactor=0.2;this.minDistance=0;this.maxDistance=Infinity;this.keys=[65,83,68];this.target=
|
|
|
-new THREE.Vector3(0,0,0);var g=!1,h=e.NONE,f=new THREE.Vector3,k=new THREE.Vector3,l=new THREE.Vector3,m=new THREE.Vector2,n=new THREE.Vector2,o=new THREE.Vector2,u=new THREE.Vector2;this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.getMouseOnScreen=function(a,c){return new THREE.Vector2((a-b.screen.offsetLeft)/b.radius*0.5,(c-b.screen.offsetTop)/b.radius*0.5)};this.getMouseProjectionOnBall=function(a,c){var e=new THREE.Vector3((a-b.screen.width*0.5-b.screen.offsetLeft)/
|
|
|
-b.radius,(b.screen.height*0.5+b.screen.offsetTop-c)/b.radius,0),h=e.length();h>1?e.normalize():e.z=Math.sqrt(1-h*h);f.copy(b.object.position).subSelf(b.target);h=b.object.up.clone().setLength(e.y);h.addSelf(b.object.up.clone().crossSelf(f).setLength(e.x));h.addSelf(f.setLength(e.z));return h};this.rotateCamera=function(){var a=Math.acos(k.dot(l)/k.length()/l.length());if(a){var c=(new THREE.Vector3).cross(k,l).normalize(),e=new THREE.Quaternion;a*=b.rotateSpeed;e.setFromAxisAngle(c,-a);e.multiplyVector3(f);
|
|
|
-e.multiplyVector3(b.object.up);e.multiplyVector3(l);b.staticMoving?k=l:(e.setFromAxisAngle(c,a*(b.dynamicDampingFactor-1)),e.multiplyVector3(k))}};this.zoomCamera=function(){var a=1+(n.y-m.y)*b.zoomSpeed;a!==1&&a>0&&(f.multiplyScalar(a),b.staticMoving?m=n:m.y+=(n.y-m.y)*this.dynamicDampingFactor)};this.panCamera=function(){var a=u.clone().subSelf(o);if(a.lengthSq()){a.multiplyScalar(f.length()*b.panSpeed);var c=f.clone().crossSelf(b.object.up).setLength(a.x);c.addSelf(b.object.up.clone().setLength(a.y));
|
|
|
-b.object.position.addSelf(c);b.target.addSelf(c);b.staticMoving?o=u:o.addSelf(a.sub(u,o).multiplyScalar(b.dynamicDampingFactor))}};this.checkDistances=function(){if(!b.noZoom||!b.noPan)b.object.position.lengthSq()>b.maxDistance*b.maxDistance&&b.object.position.setLength(b.maxDistance),f.lengthSq()<b.minDistance*b.minDistance&&b.object.position.add(b.target,f.setLength(b.minDistance))};this.update=function(){f.copy(b.object.position).subSelf(this.target);b.rotateCamera();b.noZoom||b.zoomCamera();b.noPan||
|
|
|
-b.panCamera();b.object.position.add(b.target,f);b.checkDistances();b.object.lookAt(b.target)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){b.enabled&&(g&&(k=l=b.getMouseProjectionOnBall(a.clientX,a.clientY),m=n=b.getMouseOnScreen(a.clientX,a.clientY),o=u=b.getMouseOnScreen(a.clientX,a.clientY),g=!1),h!==e.NONE&&(h===e.ROTATE?l=b.getMouseProjectionOnBall(a.clientX,a.clientY):h===e.ZOOM&&!b.noZoom?n=b.getMouseOnScreen(a.clientX,
|
|
|
-a.clientY):h===e.PAN&&!b.noPan&&(u=b.getMouseOnScreen(a.clientX,a.clientY))))},!1);this.domElement.addEventListener("mousedown",function(a){if(b.enabled&&(a.preventDefault(),a.stopPropagation(),h===e.NONE))h=a.button,h===e.ROTATE?k=l=b.getMouseProjectionOnBall(a.clientX,a.clientY):h===e.ZOOM&&!b.noZoom?m=n=b.getMouseOnScreen(a.clientX,a.clientY):this.noPan||(o=u=b.getMouseOnScreen(a.clientX,a.clientY))},!1);this.domElement.addEventListener("mouseup",function(a){if(b.enabled)a.preventDefault(),a.stopPropagation(),
|
|
|
-h=e.NONE},!1);window.addEventListener("keydown",function(a){if(b.enabled&&h===e.NONE){if(a.keyCode===b.keys[e.ROTATE])h=e.ROTATE;else if(a.keyCode===b.keys[e.ZOOM]&&!b.noZoom)h=e.ZOOM;else if(a.keyCode===b.keys[e.PAN]&&!b.noPan)h=e.PAN;h!==e.NONE&&(g=!0)}},!1);window.addEventListener("keyup",function(){if(b.enabled&&h!==e.NONE)h=e.NONE},!1)};
|
|
|
-THREE.CubeGeometry=function(a,c,b,e,g,h,f,k){function l(a,b,c,f,k,l,n,p){var o,u,v=e||1,t=g||1,w=k/2,x=l/2,z=m.vertices.length;if(a==="x"&&b==="y"||a==="y"&&b==="x")o="z";else if(a==="x"&&b==="z"||a==="z"&&b==="x")o="y",t=h||1;else if(a==="z"&&b==="y"||a==="y"&&b==="z")o="x",v=h||1;var y=v+1,O=t+1;k/=v;var R=l/t;for(u=0;u<O;u++)for(l=0;l<y;l++){var U=new THREE.Vector3;U[a]=(l*k-w)*c;U[b]=(u*R-x)*f;U[o]=n;m.vertices.push(new THREE.Vertex(U))}for(u=0;u<t;u++)for(l=0;l<v;l++)m.faces.push(new THREE.Face4(l+
|
|
|
-y*u+z,l+y*(u+1)+z,l+1+y*(u+1)+z,l+1+y*u+z,null,null,p)),m.faceVertexUvs[0].push([new THREE.UV(l/v,u/t),new THREE.UV(l/v,(u+1)/t),new THREE.UV((l+1)/v,(u+1)/t),new THREE.UV((l+1)/v,u/t)])}THREE.Geometry.call(this);var m=this,n=a/2,o=c/2,u=b/2,p,z,w,x,v,y;if(f!==void 0){if(f instanceof Array)this.materials=f;else{this.materials=[];for(p=0;p<6;p++)this.materials.push(f)}p=0;x=1;z=2;v=3;w=4;y=5}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(k!=void 0)for(var t in k)this.sides[t]!=
|
|
|
-void 0&&(this.sides[t]=k[t]);this.sides.px&&l("z","y",-1,-1,b,c,n,p);this.sides.nx&&l("z","y",1,-1,b,c,-n,x);this.sides.py&&l("x","z",1,1,a,b,o,z);this.sides.ny&&l("x","z",1,-1,a,b,-o,v);this.sides.pz&&l("x","y",1,-1,a,c,u,w);this.sides.nz&&l("x","y",-1,-1,a,c,-u,y);this.mergeVertices();this.computeCentroids();this.computeFaceNormals()};THREE.CubeGeometry.prototype=new THREE.Geometry;THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
|
|
|
-THREE.CylinderGeometry=function(a,c,b,e,g,h){THREE.Geometry.call(this);var a=a!=null?a:20,c=c!=null?c:20,b=b||100,f=b/2,e=e||8,g=g||1,k,l,m=[],n=[];for(l=0;l<=g;l++){var o=[],u=[],p=l/g,z=p*(c-a)+a;for(k=0;k<=e;k++){var w=k/e;this.vertices.push(new THREE.Vertex(new THREE.Vector3(z*Math.sin(w*Math.PI*2),-p*b+f,z*Math.cos(w*Math.PI*2))));o.push(this.vertices.length-1);u.push(new THREE.UV(w,p))}m.push(o);n.push(u)}for(l=0;l<g;l++)for(k=0;k<e;k++){var b=m[l][k],o=m[l+1][k],u=m[l+1][k+1],p=m[l][k+1],z=
|
|
|
-this.vertices[b].position.clone().setY(0).normalize(),w=this.vertices[o].position.clone().setY(0).normalize(),x=this.vertices[u].position.clone().setY(0).normalize(),v=this.vertices[p].position.clone().setY(0).normalize(),y=n[l][k].clone(),t=n[l+1][k].clone(),A=n[l+1][k+1].clone(),D=n[l][k+1].clone();this.faces.push(new THREE.Face4(b,o,u,p,[z,w,x,v]));this.faceVertexUvs[0].push([y,t,A,D])}if(!h&&a>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,f,0)));for(k=0;k<e;k++)b=m[0][k],o=m[0][k+
|
|
|
-1],u=this.vertices.length-1,z=new THREE.Vector3(0,1,0),w=new THREE.Vector3(0,1,0),x=new THREE.Vector3(0,1,0),y=n[0][k].clone(),t=n[0][k+1].clone(),A=new THREE.UV(t.u,0),this.faces.push(new THREE.Face3(b,o,u,[z,w,x])),this.faceVertexUvs[0].push([y,t,A])}if(!h&&c>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-f,0)));for(k=0;k<e;k++)b=m[l][k+1],o=m[l][k],u=this.vertices.length-1,z=new THREE.Vector3(0,-1,0),w=new THREE.Vector3(0,-1,0),x=new THREE.Vector3(0,-1,0),y=n[l][k+1].clone(),t=n[l][k].clone(),
|
|
|
-A=new THREE.UV(t.u,1),this.faces.push(new THREE.Face3(b,o,u,[z,w,x])),this.faceVertexUvs[0].push([y,t,A])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
|
|
|
-THREE.ExtrudeGeometry=function(a,c){if(typeof a!=="undefined"){THREE.Geometry.call(this);var a=a instanceof Array?a:[a],b,e=a.length,g;this.shapebb=a[e-1].getBoundingBox();for(b=0;b<e;b++)g=a[b],this.addShape(g,c);this.computeCentroids();this.computeFaceNormals()}};THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;
|
|
|
-THREE.ExtrudeGeometry.prototype.addShape=function(a,c){function b(a,b,c){b||console.log("die");return b.clone().multiplyScalar(c).addSelf(a)}function e(a,b,c){var e=THREE.ExtrudeGeometry.__v1,f=THREE.ExtrudeGeometry.__v2,h=THREE.ExtrudeGeometry.__v3,g=THREE.ExtrudeGeometry.__v4,k=THREE.ExtrudeGeometry.__v5,l=THREE.ExtrudeGeometry.__v6;e.set(a.x-b.x,a.y-b.y);f.set(a.x-c.x,a.y-c.y);e=e.normalize();f=f.normalize();h.set(-e.y,e.x);g.set(f.y,-f.x);k.copy(a).addSelf(h);l.copy(a).addSelf(g);if(k.equals(l))return g.clone();
|
|
|
-k.copy(b).addSelf(h);l.copy(c).addSelf(g);h=e.dot(g);g=l.subSelf(k).dot(g);h===0&&(console.log("Either infinite or no solutions!"),g===0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));g/=h;if(g<0)return b=Math.atan2(b.y-a.y,b.x-a.x),a=Math.atan2(c.y-a.y,c.x-a.x),b>a&&(a+=Math.PI*2),anglec=(b+a)/2,new THREE.Vector2(-Math.cos(anglec),-Math.sin(anglec));return e.multiplyScalar(g).addSelf(k).subSelf(a).clone()}function g(a){for(B=a.length;--B>=0;){S=B;T=B-1;T<0&&(T=a.length-
|
|
|
-1);for(var b=0,c=p+n*2,b=0;b<c;b++){var e=P*b,f=P*(b+1),h=X+S+e,g=X+S+f,m=h,e=X+T+e,f=X+T+f,o=g;m+=K;e+=K;f+=K;o+=K;G.faces.push(new THREE.Face4(m,e,f,o,null,null,A));A&&(m=b/c,e=(b+1)/c,f=k+l*2,h=(G.vertices[h].position.z+l)/f,g=(G.vertices[g].position.z+l)/f,G.faceVertexUvs[0].push([new THREE.UV(h,m),new THREE.UV(g,m),new THREE.UV(g,e),new THREE.UV(h,e)]))}}}function h(a,b,c){G.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function f(a,b,c){a+=K;b+=K;c+=K;G.faces.push(new THREE.Face3(a,
|
|
|
-b,c,null,null,t));if(t){var e=D.maxY,f=D.maxX,h=G.vertices[b].position.x,b=G.vertices[b].position.y,g=G.vertices[c].position.x,c=G.vertices[c].position.y;G.faceVertexUvs[0].push([new THREE.UV(G.vertices[a].position.x/f,G.vertices[a].position.y/e),new THREE.UV(h/f,b/e),new THREE.UV(g/f,c/e)])}}var k=c.amount!==void 0?c.amount:100,l=c.bevelThickness!==void 0?c.bevelThickness:6,m=c.bevelSize!==void 0?c.bevelSize:l-2,n=c.bevelSegments!==void 0?c.bevelSegments:3,o=c.bevelEnabled!==void 0?c.bevelEnabled:
|
|
|
-!0,u=c.curveSegments!==void 0?c.curveSegments:12,p=c.steps!==void 0?c.steps:1,z=c.bendPath,w=c.extrudePath,x,v=!1,y=c.useSpacedPoints!==void 0?c.useSpacedPoints:!1,t=c.material,A=c.extrudeMaterial,D=this.shapebb;if(w)x=w.getPoints(u),p=x.length,v=!0,o=!1;o||(m=l=n=0);var C,E,I,G=this,K=this.vertices.length;z&&a.addWrapPath(z);u=y?a.extractAllSpacedPoints(u):a.extractAllPoints(u);z=u.shape;u=u.holes;if(w=!THREE.Shape.Utils.isClockWise(z)){z=z.reverse();E=0;for(I=u.length;E<I;E++)C=u[E],THREE.Shape.Utils.isClockWise(C)&&
|
|
|
-(u[E]=C.reverse());w=!1}w=THREE.Shape.Utils.triangulateShape(z,u);y=z;E=0;for(I=u.length;E<I;E++)C=u[E],z=z.concat(C);var B,F,J,M,N,L,P=z.length,H=w.length,Q=[];B=0;F=y.length;S=F-1;for(T=B+1;B<F;B++,S++,T++)S===F&&(S=0),T===F&&(T=0),Q[B]=e(y[B],y[S],y[T]);var O=[],R,U=Q.concat();E=0;for(I=u.length;E<I;E++){C=u[E];R=[];B=0;F=C.length;S=F-1;for(T=B+1;B<F;B++,S++,T++)S===F&&(S=0),T===F&&(T=0),R[B]=e(C[B],C[S],C[T]);O.push(R);U=U.concat(R)}for(J=0;J<n;J++){M=J/n;N=l*(1-M);M=m*Math.sin(M*Math.PI/2);B=
|
|
|
-0;for(F=y.length;B<F;B++)L=b(y[B],Q[B],M),h(L.x,L.y,-N);E=0;for(I=u.length;E<I;E++){C=u[E];R=O[E];B=0;for(F=C.length;B<F;B++)L=b(C[B],R[B],M),h(L.x,L.y,-N)}}M=m;for(B=0;B<P;B++)L=o?b(z[B],U[B],M):z[B],v?h(L.x,L.y+x[0].y,x[0].x):h(L.x,L.y,0);for(J=1;J<=p;J++)for(B=0;B<P;B++)L=o?b(z[B],U[B],M):z[B],v?h(L.x,L.y+x[J-1].y,x[J-1].x):h(L.x,L.y,k/p*J);for(J=n-1;J>=0;J--){M=J/n;N=l*(1-M);M=m*Math.sin(M*Math.PI/2);B=0;for(F=y.length;B<F;B++)L=b(y[B],Q[B],M),h(L.x,L.y,k+N);E=0;for(I=u.length;E<I;E++){C=u[E];
|
|
|
-R=O[E];B=0;for(F=C.length;B<F;B++)L=b(C[B],R[B],M),v?h(L.x,L.y+x[p-1].y,x[p-1].x+N):h(L.x,L.y,k+N)}}if(o){o=P*0;for(B=0;B<H;B++)m=w[B],f(m[2]+o,m[1]+o,m[0]+o);o=P*(p+n*2);for(B=0;B<H;B++)m=w[B],f(m[0]+o,m[1]+o,m[2]+o)}else{for(B=0;B<H;B++)m=w[B],f(m[2],m[1],m[0]);for(B=0;B<H;B++)m=w[B],f(m[0]+P*p,m[1]+P*p,m[2]+P*p)}var S,T,X=0;g(y);X+=y.length;E=0;for(I=u.length;E<I;E++)C=u[E],g(C),X+=C.length};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;THREE.ExtrudeGeometry.__v2=new THREE.Vector2;
|
|
|
+a;this.object.position.y-=this.object.matrix.n23*a;this.object.position.z-=this.object.matrix.n33*a};this.rotateHorizontally=function(a){b.set(this.object.matrix.n11,this.object.matrix.n21,this.object.matrix.n31);b.multiplyScalar(a);this.forward.subSelf(b);this.forward.normalize()};this.rotateVertically=function(a){d.set(this.object.matrix.n12,this.object.matrix.n22,this.object.matrix.n32);d.multiplyScalar(a);this.forward.addSelf(d);this.forward.normalize()};this.domElement.addEventListener("contextmenu",
|
|
|
+function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){m=(a.clientX-n)/window.innerWidth;o=(a.clientY-t)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:i=1;break;case 2:i=-1}},!1);this.domElement.addEventListener("mouseup",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:i=0;break;case 2:i=0}},!1);this.domElement.addEventListener("keydown",
|
|
|
+function(a){switch(a.keyCode){case 38:case 87:i=1;break;case 37:case 65:j=-1;break;case 40:case 83:i=-1;break;case 39:case 68:j=1;break;case 81:e=!0;h=1;break;case 69:e=!0;h=-1;break;case 82:k=1;break;case 70:k=-1}},!1);this.domElement.addEventListener("keyup",function(a){switch(a.keyCode){case 38:case 87:i=0;break;case 37:case 65:j=0;break;case 40:case 83:i=0;break;case 39:case 68:j=0;break;case 81:e=!1;break;case 69:e=!1;break;case 82:k=0;break;case 70:k=0}},!1)};
|
|
|
+THREE.TrackballControls=function(a,c){var b=this,d={NONE:-1,ROTATE:0,ZOOM:1,PAN:2};this.object=a;this.domElement=c!==void 0?c:document;this.enabled=!0;this.screen={width:window.innerWidth,height:window.innerHeight,offsetLeft:0,offsetTop:0};this.radius=(this.screen.width+this.screen.height)/4;this.rotateSpeed=1;this.zoomSpeed=1.2;this.panSpeed=0.3;this.staticMoving=this.noPan=this.noZoom=!1;this.dynamicDampingFactor=0.2;this.minDistance=0;this.maxDistance=Infinity;this.keys=[65,83,68];this.target=
|
|
|
+new THREE.Vector3(0,0,0);var f=!1,g=d.NONE,e=new THREE.Vector3,h=new THREE.Vector3,i=new THREE.Vector3,j=new THREE.Vector2,k=new THREE.Vector2,m=new THREE.Vector2,o=new THREE.Vector2;this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.getMouseOnScreen=function(a,c){return new THREE.Vector2((a-b.screen.offsetLeft)/b.radius*0.5,(c-b.screen.offsetTop)/b.radius*0.5)};this.getMouseProjectionOnBall=function(a,c){var d=new THREE.Vector3((a-b.screen.width*0.5-b.screen.offsetLeft)/
|
|
|
+b.radius,(b.screen.height*0.5+b.screen.offsetTop-c)/b.radius,0),g=d.length();g>1?d.normalize():d.z=Math.sqrt(1-g*g);e.copy(b.object.position).subSelf(b.target);g=b.object.up.clone().setLength(d.y);g.addSelf(b.object.up.clone().crossSelf(e).setLength(d.x));g.addSelf(e.setLength(d.z));return g};this.rotateCamera=function(){var a=Math.acos(h.dot(i)/h.length()/i.length());if(a){var c=(new THREE.Vector3).cross(h,i).normalize(),d=new THREE.Quaternion;a*=b.rotateSpeed;d.setFromAxisAngle(c,-a);d.multiplyVector3(e);
|
|
|
+d.multiplyVector3(b.object.up);d.multiplyVector3(i);b.staticMoving?h=i:(d.setFromAxisAngle(c,a*(b.dynamicDampingFactor-1)),d.multiplyVector3(h))}};this.zoomCamera=function(){var a=1+(k.y-j.y)*b.zoomSpeed;a!==1&&a>0&&(e.multiplyScalar(a),b.staticMoving?j=k:j.y+=(k.y-j.y)*this.dynamicDampingFactor)};this.panCamera=function(){var a=o.clone().subSelf(m);if(a.lengthSq()){a.multiplyScalar(e.length()*b.panSpeed);var c=e.clone().crossSelf(b.object.up).setLength(a.x);c.addSelf(b.object.up.clone().setLength(a.y));
|
|
|
+b.object.position.addSelf(c);b.target.addSelf(c);b.staticMoving?m=o:m.addSelf(a.sub(o,m).multiplyScalar(b.dynamicDampingFactor))}};this.checkDistances=function(){if(!b.noZoom||!b.noPan)b.object.position.lengthSq()>b.maxDistance*b.maxDistance&&b.object.position.setLength(b.maxDistance),e.lengthSq()<b.minDistance*b.minDistance&&b.object.position.add(b.target,e.setLength(b.minDistance))};this.update=function(){e.copy(b.object.position).subSelf(this.target);b.rotateCamera();b.noZoom||b.zoomCamera();b.noPan||
|
|
|
+b.panCamera();b.object.position.add(b.target,e);b.checkDistances();b.object.lookAt(b.target)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){b.enabled&&(f&&(h=i=b.getMouseProjectionOnBall(a.clientX,a.clientY),j=k=b.getMouseOnScreen(a.clientX,a.clientY),m=o=b.getMouseOnScreen(a.clientX,a.clientY),f=!1),g!==d.NONE&&(g===d.ROTATE?i=b.getMouseProjectionOnBall(a.clientX,a.clientY):g===d.ZOOM&&!b.noZoom?k=b.getMouseOnScreen(a.clientX,
|
|
|
+a.clientY):g===d.PAN&&!b.noPan&&(o=b.getMouseOnScreen(a.clientX,a.clientY))))},!1);this.domElement.addEventListener("mousedown",function(a){if(b.enabled&&(a.preventDefault(),a.stopPropagation(),g===d.NONE))g=a.button,g===d.ROTATE?h=i=b.getMouseProjectionOnBall(a.clientX,a.clientY):g===d.ZOOM&&!b.noZoom?j=k=b.getMouseOnScreen(a.clientX,a.clientY):this.noPan||(m=o=b.getMouseOnScreen(a.clientX,a.clientY))},!1);this.domElement.addEventListener("mouseup",function(a){if(b.enabled)a.preventDefault(),a.stopPropagation(),
|
|
|
+g=d.NONE},!1);window.addEventListener("keydown",function(a){if(b.enabled&&g===d.NONE){if(a.keyCode===b.keys[d.ROTATE])g=d.ROTATE;else if(a.keyCode===b.keys[d.ZOOM]&&!b.noZoom)g=d.ZOOM;else if(a.keyCode===b.keys[d.PAN]&&!b.noPan)g=d.PAN;g!==d.NONE&&(f=!0)}},!1);window.addEventListener("keyup",function(){if(b.enabled&&g!==d.NONE)g=d.NONE},!1)};
|
|
|
+THREE.CubeGeometry=function(a,c,b,d,f,g,e,h){function i(a,b,c,e,h,i,k,n){var m,o,l=d||1,p=f||1,r=h/2,q=i/2,t=j.vertices.length;if(a==="x"&&b==="y"||a==="y"&&b==="x")m="z";else if(a==="x"&&b==="z"||a==="z"&&b==="x")m="y",p=g||1;else if(a==="z"&&b==="y"||a==="y"&&b==="z")m="x",l=g||1;var s=l+1,O=p+1;h/=l;var z=i/p;for(o=0;o<O;o++)for(i=0;i<s;i++){var K=new THREE.Vector3;K[a]=(i*h-r)*c;K[b]=(o*z-q)*e;K[m]=k;j.vertices.push(new THREE.Vertex(K))}for(o=0;o<p;o++)for(i=0;i<l;i++)j.faces.push(new THREE.Face4(i+
|
|
|
+s*o+t,i+s*(o+1)+t,i+1+s*(o+1)+t,i+1+s*o+t,null,null,n)),j.faceVertexUvs[0].push([new THREE.UV(i/l,o/p),new THREE.UV(i/l,(o+1)/p),new THREE.UV((i+1)/l,(o+1)/p),new THREE.UV((i+1)/l,o/p)])}THREE.Geometry.call(this);var j=this,k=a/2,m=c/2,o=b/2,n,t,q,r,p,s;if(e!==void 0){if(e instanceof Array)this.materials=e;else{this.materials=[];for(n=0;n<6;n++)this.materials.push(e)}n=0;r=1;t=2;p=3;q=4;s=5}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(h!=void 0)for(var l in h)this.sides[l]!=
|
|
|
+void 0&&(this.sides[l]=h[l]);this.sides.px&&i("z","y",-1,-1,b,c,k,n);this.sides.nx&&i("z","y",1,-1,b,c,-k,r);this.sides.py&&i("x","z",1,1,a,b,m,t);this.sides.ny&&i("x","z",1,-1,a,b,-m,p);this.sides.pz&&i("x","y",1,-1,a,c,o,q);this.sides.nz&&i("x","y",-1,-1,a,c,-o,s);this.mergeVertices();this.computeCentroids();this.computeFaceNormals()};THREE.CubeGeometry.prototype=new THREE.Geometry;THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
|
|
|
+THREE.CylinderGeometry=function(a,c,b,d,f,g){THREE.Geometry.call(this);var a=a!=null?a:20,c=c!=null?c:20,b=b||100,e=b/2,d=d||8,f=f||1,h,i,j=[],k=[];for(i=0;i<=f;i++){var m=[],o=[],n=i/f,t=n*(c-a)+a;for(h=0;h<=d;h++){var q=h/d;this.vertices.push(new THREE.Vertex(new THREE.Vector3(t*Math.sin(q*Math.PI*2),-n*b+e,t*Math.cos(q*Math.PI*2))));m.push(this.vertices.length-1);o.push(new THREE.UV(q,n))}j.push(m);k.push(o)}for(i=0;i<f;i++)for(h=0;h<d;h++){var b=j[i][h],m=j[i+1][h],o=j[i+1][h+1],n=j[i][h+1],t=
|
|
|
+this.vertices[b].position.clone().setY(0).normalize(),q=this.vertices[m].position.clone().setY(0).normalize(),r=this.vertices[o].position.clone().setY(0).normalize(),p=this.vertices[n].position.clone().setY(0).normalize(),s=k[i][h].clone(),l=k[i+1][h].clone(),v=k[i+1][h+1].clone(),w=k[i][h+1].clone();this.faces.push(new THREE.Face4(b,m,o,n,[t,q,r,p]));this.faceVertexUvs[0].push([s,l,v,w])}if(!g&&a>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,e,0)));for(h=0;h<d;h++)b=j[0][h],m=j[0][h+
|
|
|
+1],o=this.vertices.length-1,t=new THREE.Vector3(0,1,0),q=new THREE.Vector3(0,1,0),r=new THREE.Vector3(0,1,0),s=k[0][h].clone(),l=k[0][h+1].clone(),v=new THREE.UV(l.u,0),this.faces.push(new THREE.Face3(b,m,o,[t,q,r])),this.faceVertexUvs[0].push([s,l,v])}if(!g&&c>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-e,0)));for(h=0;h<d;h++)b=j[i][h+1],m=j[i][h],o=this.vertices.length-1,t=new THREE.Vector3(0,-1,0),q=new THREE.Vector3(0,-1,0),r=new THREE.Vector3(0,-1,0),s=k[i][h+1].clone(),l=k[i][h].clone(),
|
|
|
+v=new THREE.UV(l.u,1),this.faces.push(new THREE.Face3(b,m,o,[t,q,r])),this.faceVertexUvs[0].push([s,l,v])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
|
|
|
+THREE.ExtrudeGeometry=function(a,c){if(typeof a!=="undefined"){THREE.Geometry.call(this);var a=a instanceof Array?a:[a],b,d=a.length,f;this.shapebb=a[d-1].getBoundingBox();for(b=0;b<d;b++)f=a[b],this.addShape(f,c);this.computeCentroids();this.computeFaceNormals()}};THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;
|
|
|
+THREE.ExtrudeGeometry.prototype.addShape=function(a,c){function b(a,b,c){b||console.log("die");return b.clone().multiplyScalar(c).addSelf(a)}function d(a,b,c){var d=THREE.ExtrudeGeometry.__v1,e=THREE.ExtrudeGeometry.__v2,g=THREE.ExtrudeGeometry.__v3,f=THREE.ExtrudeGeometry.__v4,h=THREE.ExtrudeGeometry.__v5,i=THREE.ExtrudeGeometry.__v6;d.set(a.x-b.x,a.y-b.y);e.set(a.x-c.x,a.y-c.y);d=d.normalize();e=e.normalize();g.set(-d.y,d.x);f.set(e.y,-e.x);h.copy(a).addSelf(g);i.copy(a).addSelf(f);if(h.equals(i))return f.clone();
|
|
|
+h.copy(b).addSelf(g);i.copy(c).addSelf(f);g=d.dot(f);f=i.subSelf(h).dot(f);g===0&&(console.log("Either infinite or no solutions!"),f===0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));f/=g;if(f<0)return b=Math.atan2(b.y-a.y,b.x-a.x),a=Math.atan2(c.y-a.y,c.x-a.x),b>a&&(a+=Math.PI*2),a=(b+a)/2,new THREE.Vector2(-Math.cos(a),-Math.sin(a));return d.multiplyScalar(f).addSelf(h).subSelf(a).clone()}function f(a){for(u=a.length;--u>=0;){I=u;L=u-1;L<0&&(L=a.length-1);for(var b=
|
|
|
+0,c=n+k*2,b=0;b<c;b++){var d=J*b,e=J*(b+1),g=R+I+d,f=R+I+e,j=g,d=R+L+d,e=R+L+e,m=f;j+=E;d+=E;e+=E;m+=E;A.faces.push(new THREE.Face4(j,d,e,m,null,null,v));v&&(j=b/c,d=(b+1)/c,e=h+i*2,g=(A.vertices[g].position.z+i)/e,f=(A.vertices[f].position.z+i)/e,A.faceVertexUvs[0].push([new THREE.UV(g,j),new THREE.UV(f,j),new THREE.UV(f,d),new THREE.UV(g,d)]))}}}function g(a,b,c){A.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function e(a,b,c){a+=E;b+=E;c+=E;A.faces.push(new THREE.Face3(a,b,c,null,
|
|
|
+null,l));if(l){var d=w.maxY,e=w.maxX,g=A.vertices[b].position.x,b=A.vertices[b].position.y,f=A.vertices[c].position.x,c=A.vertices[c].position.y;A.faceVertexUvs[0].push([new THREE.UV(A.vertices[a].position.x/e,A.vertices[a].position.y/d),new THREE.UV(g/e,b/d),new THREE.UV(f/e,c/d)])}}var h=c.amount!==void 0?c.amount:100,i=c.bevelThickness!==void 0?c.bevelThickness:6,j=c.bevelSize!==void 0?c.bevelSize:i-2,k=c.bevelSegments!==void 0?c.bevelSegments:3,m=c.bevelEnabled!==void 0?c.bevelEnabled:!0,o=c.curveSegments!==
|
|
|
+void 0?c.curveSegments:12,n=c.steps!==void 0?c.steps:1,t=c.bendPath,q=c.extrudePath,r,p=!1,s=c.useSpacedPoints!==void 0?c.useSpacedPoints:!1,l=c.material,v=c.extrudeMaterial,w=this.shapebb;if(q)r=q.getPoints(o),n=r.length,p=!0,m=!1;m||(j=i=k=0);var x,y,C,A=this,E=this.vertices.length;t&&a.addWrapPath(t);o=s?a.extractAllSpacedPoints(o):a.extractAllPoints(o);t=o.shape;o=o.holes;if(q=!THREE.Shape.Utils.isClockWise(t)){t=t.reverse();y=0;for(C=o.length;y<C;y++)x=o[y],THREE.Shape.Utils.isClockWise(x)&&
|
|
|
+(o[y]=x.reverse());q=!1}q=THREE.Shape.Utils.triangulateShape(t,o);s=t;y=0;for(C=o.length;y<C;y++)x=o[y],t=t.concat(x);var u,G,D,H,B,F,J=t.length,N=q.length,M=[];u=0;G=s.length;I=G-1;for(L=u+1;u<G;u++,I++,L++)I===G&&(I=0),L===G&&(L=0),M[u]=d(s[u],s[I],s[L]);var O=[],z,K=M.concat();y=0;for(C=o.length;y<C;y++){x=o[y];z=[];u=0;G=x.length;I=G-1;for(L=u+1;u<G;u++,I++,L++)I===G&&(I=0),L===G&&(L=0),z[u]=d(x[u],x[I],x[L]);O.push(z);K=K.concat(z)}for(D=0;D<k;D++){H=D/k;B=i*(1-H);H=j*Math.sin(H*Math.PI/2);u=
|
|
|
+0;for(G=s.length;u<G;u++)F=b(s[u],M[u],H),g(F.x,F.y,-B);y=0;for(C=o.length;y<C;y++){x=o[y];z=O[y];u=0;for(G=x.length;u<G;u++)F=b(x[u],z[u],H),g(F.x,F.y,-B)}}H=j;for(u=0;u<J;u++)F=m?b(t[u],K[u],H):t[u],p?g(F.x,F.y+r[0].y,r[0].x):g(F.x,F.y,0);for(D=1;D<=n;D++)for(u=0;u<J;u++)F=m?b(t[u],K[u],H):t[u],p?g(F.x,F.y+r[D-1].y,r[D-1].x):g(F.x,F.y,h/n*D);for(D=k-1;D>=0;D--){H=D/k;B=i*(1-H);H=j*Math.sin(H*Math.PI/2);u=0;for(G=s.length;u<G;u++)F=b(s[u],M[u],H),g(F.x,F.y,h+B);y=0;for(C=o.length;y<C;y++){x=o[y];
|
|
|
+z=O[y];u=0;for(G=x.length;u<G;u++)F=b(x[u],z[u],H),p?g(F.x,F.y+r[n-1].y,r[n-1].x+B):g(F.x,F.y,h+B)}}if(m){m=J*0;for(u=0;u<N;u++)j=q[u],e(j[2]+m,j[1]+m,j[0]+m);m=J*(n+k*2);for(u=0;u<N;u++)j=q[u],e(j[0]+m,j[1]+m,j[2]+m)}else{for(u=0;u<N;u++)j=q[u],e(j[2],j[1],j[0]);for(u=0;u<N;u++)j=q[u],e(j[0]+J*n,j[1]+J*n,j[2]+J*n)}var I,L,R=0;f(s);R+=s.length;y=0;for(C=o.length;y<C;y++)x=o[y],f(x),R+=x.length};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;THREE.ExtrudeGeometry.__v2=new THREE.Vector2;
|
|
|
THREE.ExtrudeGeometry.__v3=new THREE.Vector2;THREE.ExtrudeGeometry.__v4=new THREE.Vector2;THREE.ExtrudeGeometry.__v5=new THREE.Vector2;THREE.ExtrudeGeometry.__v6=new THREE.Vector2;
|
|
|
-THREE.IcosahedronGeometry=function(a){function c(a,b,c){var e=Math.sqrt(a*a+b*b+c*c);return g.vertices.push(new THREE.Vertex(new THREE.Vector3(a/e,b/e,c/e)))-1}function b(a,b,c,e){e.faces.push(new THREE.Face3(a,b,c))}function e(a,b){var e=g.vertices[a].position,f=g.vertices[b].position;return c((e.x+f.x)/2,(e.y+f.y)/2,(e.z+f.z)/2)}var g=this,h=new THREE.Geometry;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;c(-1,a,0);c(1,a,0);c(-1,-a,0);c(1,-a,0);c(0,-1,a);c(0,1,a);c(0,-1,
|
|
|
--a);c(0,1,-a);c(a,0,-1);c(a,0,1);c(-a,0,-1);c(-a,0,1);b(0,11,5,h);b(0,5,1,h);b(0,1,7,h);b(0,7,10,h);b(0,10,11,h);b(1,5,9,h);b(5,11,4,h);b(11,10,2,h);b(10,7,6,h);b(7,1,8,h);b(3,9,4,h);b(3,4,2,h);b(3,2,6,h);b(3,6,8,h);b(3,8,9,h);b(4,9,5,h);b(2,4,11,h);b(6,2,10,h);b(8,6,7,h);b(9,8,1,h);for(var f=0;f<this.subdivisions;f++){var a=new THREE.Geometry,k;for(k in h.faces){var l=e(h.faces[k].a,h.faces[k].b),m=e(h.faces[k].b,h.faces[k].c),n=e(h.faces[k].c,h.faces[k].a);b(h.faces[k].a,l,n,a);b(h.faces[k].b,m,
|
|
|
-l,a);b(h.faces[k].c,n,m,a);b(l,m,n,a)}h.faces=a.faces}g.faces=h.faces;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;
|
|
|
-THREE.LatheGeometry=function(a,c,b){THREE.Geometry.call(this);this.steps=c||12;this.angle=b||2*Math.PI;for(var c=this.angle/this.steps,b=[],e=[],g=[],h=[],f=(new THREE.Matrix4).setRotationZ(c),k=0;k<a.length;k++)this.vertices.push(new THREE.Vertex(a[k])),b[k]=a[k].clone(),e[k]=this.vertices.length-1;for(var l=0;l<=this.angle+0.0010;l+=c){for(k=0;k<b.length;k++)l<this.angle?(b[k]=f.multiplyVector3(b[k].clone()),this.vertices.push(new THREE.Vertex(b[k])),g[k]=this.vertices.length-1):g=h;l==0&&(h=e);
|
|
|
-for(k=0;k<e.length-1;k++)this.faces.push(new THREE.Face4(g[k],g[k+1],e[k+1],e[k])),this.faceVertexUvs[0].push([new THREE.UV(1-l/this.angle,k/a.length),new THREE.UV(1-l/this.angle,(k+1)/a.length),new THREE.UV(1-(l-c)/this.angle,(k+1)/a.length),new THREE.UV(1-(l-c)/this.angle,k/a.length)]);e=g;g=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=new THREE.Geometry;THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry;
|
|
|
-THREE.OctahedronGeometry=function(a,c){function b(b){var c=b.clone().normalize(),c=new THREE.Vertex(c.clone().multiplyScalar(a));c.index=f.vertices.push(c)-1;c.uv=new THREE.UV(Math.atan2(b.z,-b.x)/2/Math.PI+0.5,Math.atan2(-b.y,Math.sqrt(b.x*b.x+b.z*b.z))/Math.PI+0.5);return c}function e(a,b,c,k){k<1?(k=new THREE.Face3(a.index,b.index,c.index,[a.position,b.position,c.position]),k.centroid.addSelf(a.position).addSelf(b.position).addSelf(c.position).divideScalar(3),k.normal=k.centroid.clone().normalize(),
|
|
|
-f.faces.push(k),k=Math.atan2(k.centroid.z,-k.centroid.x),f.faceVertexUvs[0].push([h(a.uv,a.position,k),h(b.uv,b.position,k),h(c.uv,c.position,k)])):(k-=1,e(a,g(a,b),g(a,c),k),e(g(a,b),b,g(b,c),k),e(g(a,c),g(b,c),c,k),e(g(a,b),g(b,c),g(a,c),k))}function g(a,c){k[a.index]||(k[a.index]=[]);k[c.index]||(k[c.index]=[]);var e=k[a.index][c.index];e===void 0&&(k[a.index][c.index]=k[c.index][a.index]=e=b((new THREE.Vector3).add(a.position,c.position).divideScalar(2)));return e}function h(a,b,c){c<0&&a.u===
|
|
|
-1&&(a=new THREE.UV(a.u-1,a.v));b.x===0&&b.z===0&&(a=new THREE.UV(c/2/Math.PI+0.5,a.v));return a}THREE.Geometry.call(this);var c=c||0,f=this;b(new THREE.Vector3(1,0,0));b(new THREE.Vector3(-1,0,0));b(new THREE.Vector3(0,1,0));b(new THREE.Vector3(0,-1,0));b(new THREE.Vector3(0,0,1));b(new THREE.Vector3(0,0,-1));var k=[],l=this.vertices;e(l[0],l[2],l[4],c);e(l[0],l[4],l[3],c);e(l[0],l[3],l[5],c);e(l[0],l[5],l[2],c);e(l[1],l[2],l[5],c);e(l[1],l[5],l[3],c);e(l[1],l[3],l[4],c);e(l[1],l[4],l[2],c);this.boundingSphere=
|
|
|
+THREE.IcosahedronGeometry=function(a){function c(a,b,c){var d=Math.sqrt(a*a+b*b+c*c);return f.vertices.push(new THREE.Vertex(new THREE.Vector3(a/d,b/d,c/d)))-1}function b(a,b,c,d){d.faces.push(new THREE.Face3(a,b,c))}function d(a,b){var d=f.vertices[a].position,e=f.vertices[b].position;return c((d.x+e.x)/2,(d.y+e.y)/2,(d.z+e.z)/2)}var f=this,g=new THREE.Geometry;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;c(-1,a,0);c(1,a,0);c(-1,-a,0);c(1,-a,0);c(0,-1,a);c(0,1,a);c(0,-1,
|
|
|
+-a);c(0,1,-a);c(a,0,-1);c(a,0,1);c(-a,0,-1);c(-a,0,1);b(0,11,5,g);b(0,5,1,g);b(0,1,7,g);b(0,7,10,g);b(0,10,11,g);b(1,5,9,g);b(5,11,4,g);b(11,10,2,g);b(10,7,6,g);b(7,1,8,g);b(3,9,4,g);b(3,4,2,g);b(3,2,6,g);b(3,6,8,g);b(3,8,9,g);b(4,9,5,g);b(2,4,11,g);b(6,2,10,g);b(8,6,7,g);b(9,8,1,g);for(var e=0;e<this.subdivisions;e++){var a=new THREE.Geometry,h;for(h in g.faces){var i=d(g.faces[h].a,g.faces[h].b),j=d(g.faces[h].b,g.faces[h].c),k=d(g.faces[h].c,g.faces[h].a);b(g.faces[h].a,i,k,a);b(g.faces[h].b,j,
|
|
|
+i,a);b(g.faces[h].c,k,j,a);b(i,j,k,a)}g.faces=a.faces}f.faces=g.faces;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;
|
|
|
+THREE.LatheGeometry=function(a,c,b){THREE.Geometry.call(this);this.steps=c||12;this.angle=b||2*Math.PI;for(var c=this.angle/this.steps,b=[],d=[],f=[],g=[],e=(new THREE.Matrix4).setRotationZ(c),h=0;h<a.length;h++)this.vertices.push(new THREE.Vertex(a[h])),b[h]=a[h].clone(),d[h]=this.vertices.length-1;for(var i=0;i<=this.angle+0.0010;i+=c){for(h=0;h<b.length;h++)i<this.angle?(b[h]=e.multiplyVector3(b[h].clone()),this.vertices.push(new THREE.Vertex(b[h])),f[h]=this.vertices.length-1):f=g;i==0&&(g=d);
|
|
|
+for(h=0;h<d.length-1;h++)this.faces.push(new THREE.Face4(f[h],f[h+1],d[h+1],d[h])),this.faceVertexUvs[0].push([new THREE.UV(1-i/this.angle,h/a.length),new THREE.UV(1-i/this.angle,(h+1)/a.length),new THREE.UV(1-(i-c)/this.angle,(h+1)/a.length),new THREE.UV(1-(i-c)/this.angle,h/a.length)]);d=f;f=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=new THREE.Geometry;THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry;
|
|
|
+THREE.OctahedronGeometry=function(a,c){function b(b){var c=b.clone().normalize(),c=new THREE.Vertex(c.clone().multiplyScalar(a));c.index=e.vertices.push(c)-1;c.uv=new THREE.UV(Math.atan2(b.z,-b.x)/2/Math.PI+0.5,Math.atan2(-b.y,Math.sqrt(b.x*b.x+b.z*b.z))/Math.PI+0.5);return c}function d(a,b,c,h){h<1?(h=new THREE.Face3(a.index,b.index,c.index,[a.position,b.position,c.position]),h.centroid.addSelf(a.position).addSelf(b.position).addSelf(c.position).divideScalar(3),h.normal=h.centroid.clone().normalize(),
|
|
|
+e.faces.push(h),h=Math.atan2(h.centroid.z,-h.centroid.x),e.faceVertexUvs[0].push([g(a.uv,a.position,h),g(b.uv,b.position,h),g(c.uv,c.position,h)])):(h-=1,d(a,f(a,b),f(a,c),h),d(f(a,b),b,f(b,c),h),d(f(a,c),f(b,c),c,h),d(f(a,b),f(b,c),f(a,c),h))}function f(a,c){h[a.index]||(h[a.index]=[]);h[c.index]||(h[c.index]=[]);var d=h[a.index][c.index];d===void 0&&(h[a.index][c.index]=h[c.index][a.index]=d=b((new THREE.Vector3).add(a.position,c.position).divideScalar(2)));return d}function g(a,b,c){c<0&&a.u===
|
|
|
+1&&(a=new THREE.UV(a.u-1,a.v));b.x===0&&b.z===0&&(a=new THREE.UV(c/2/Math.PI+0.5,a.v));return a}THREE.Geometry.call(this);var c=c||0,e=this;b(new THREE.Vector3(1,0,0));b(new THREE.Vector3(-1,0,0));b(new THREE.Vector3(0,1,0));b(new THREE.Vector3(0,-1,0));b(new THREE.Vector3(0,0,1));b(new THREE.Vector3(0,0,-1));var h=[],i=this.vertices;d(i[0],i[2],i[4],c);d(i[0],i[4],i[3],c);d(i[0],i[3],i[5],c);d(i[0],i[5],i[2],c);d(i[1],i[2],i[5],c);d(i[1],i[5],i[3],c);d(i[1],i[3],i[4],c);d(i[1],i[4],i[2],c);this.boundingSphere=
|
|
|
{radius:a}};THREE.OctahedronGeometry.prototype=new THREE.Geometry;THREE.OctahedronGeometry.prototype.constructor=THREE.OctahedronGeometry;
|
|
|
-THREE.PlaneGeometry=function(a,c,b,e){THREE.Geometry.call(this);var g,h=a/2,f=c/2,b=b||1,e=e||1,k=b+1,l=e+1;a/=b;var m=c/e;for(g=0;g<l;g++)for(c=0;c<k;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*a-h,-(g*m-f),0)));for(g=0;g<e;g++)for(c=0;c<b;c++)this.faces.push(new THREE.Face4(c+k*g,c+k*(g+1),c+1+k*(g+1),c+1+k*g)),this.faceVertexUvs[0].push([new THREE.UV(c/b,g/e),new THREE.UV(c/b,(g+1)/e),new THREE.UV((c+1)/b,(g+1)/e),new THREE.UV((c+1)/b,g/e)]);this.computeCentroids();this.computeFaceNormals()};
|
|
|
+THREE.PlaneGeometry=function(a,c,b,d){THREE.Geometry.call(this);var f,g=a/2,e=c/2,b=b||1,d=d||1,h=b+1,i=d+1;a/=b;var j=c/d;for(f=0;f<i;f++)for(c=0;c<h;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*a-g,-(f*j-e),0)));for(f=0;f<d;f++)for(c=0;c<b;c++)this.faces.push(new THREE.Face4(c+h*f,c+h*(f+1),c+1+h*(f+1),c+1+h*f)),this.faceVertexUvs[0].push([new THREE.UV(c/b,f/d),new THREE.UV(c/b,(f+1)/d),new THREE.UV((c+1)/b,(f+1)/d),new THREE.UV((c+1)/b,f/d)]);this.computeCentroids();this.computeFaceNormals()};
|
|
|
THREE.PlaneGeometry.prototype=new THREE.Geometry;THREE.PlaneGeometry.prototype.constructor=THREE.PlaneGeometry;
|
|
|
-THREE.SphereGeometry=function(a,c,b){THREE.Geometry.call(this);for(var a=a||50,e,g=Math.PI,h=Math.max(3,c||8),f=Math.max(2,b||6),c=[],b=0;b<f+1;b++){e=b/f;var k=a*Math.cos(e*g),l=a*Math.sin(e*g),m=[],n=0;for(e=0;e<h;e++){var o=2*e/h,u=l*Math.sin(o*g),o=l*Math.cos(o*g);(b==0||b==f)&&e>0||(n=this.vertices.push(new THREE.Vertex(new THREE.Vector3(o,k,u)))-1);m.push(n)}c.push(m)}for(var p,z,w,g=c.length,b=0;b<g;b++)if(h=c[b].length,b>0)for(e=0;e<h;e++){m=e==h-1;f=c[b][m?0:e+1];k=c[b][m?h-1:e];l=c[b-1][m?
|
|
|
-h-1:e];m=c[b-1][m?0:e+1];u=b/(g-1);p=(b-1)/(g-1);z=(e+1)/h;var o=e/h,n=new THREE.UV(1-z,u),u=new THREE.UV(1-o,u),o=new THREE.UV(1-o,p),x=new THREE.UV(1-z,p);b<c.length-1&&(p=this.vertices[f].position.clone(),z=this.vertices[k].position.clone(),w=this.vertices[l].position.clone(),p.normalize(),z.normalize(),w.normalize(),this.faces.push(new THREE.Face3(f,k,l,[new THREE.Vector3(p.x,p.y,p.z),new THREE.Vector3(z.x,z.y,z.z),new THREE.Vector3(w.x,w.y,w.z)])),this.faceVertexUvs[0].push([n,u,o]));b>1&&(p=
|
|
|
-this.vertices[f].position.clone(),z=this.vertices[l].position.clone(),w=this.vertices[m].position.clone(),p.normalize(),z.normalize(),w.normalize(),this.faces.push(new THREE.Face3(f,l,m,[new THREE.Vector3(p.x,p.y,p.z),new THREE.Vector3(z.x,z.y,z.z),new THREE.Vector3(w.x,w.y,w.z)])),this.faceVertexUvs[0].push([n,o,x]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};THREE.SphereGeometry.prototype=new THREE.Geometry;
|
|
|
+THREE.SphereGeometry=function(a,c,b){THREE.Geometry.call(this);for(var a=a||50,d,f=Math.PI,g=Math.max(3,c||8),e=Math.max(2,b||6),c=[],b=0;b<e+1;b++){d=b/e;var h=a*Math.cos(d*f),i=a*Math.sin(d*f),j=[],k=0;for(d=0;d<g;d++){var m=2*d/g,o=i*Math.sin(m*f),m=i*Math.cos(m*f);(b==0||b==e)&&d>0||(k=this.vertices.push(new THREE.Vertex(new THREE.Vector3(m,h,o)))-1);j.push(k)}c.push(j)}for(var n,t,q,f=c.length,b=0;b<f;b++)if(g=c[b].length,b>0)for(d=0;d<g;d++){j=d==g-1;e=c[b][j?0:d+1];h=c[b][j?g-1:d];i=c[b-1][j?
|
|
|
+g-1:d];j=c[b-1][j?0:d+1];o=b/(f-1);n=(b-1)/(f-1);t=(d+1)/g;var m=d/g,k=new THREE.UV(1-t,o),o=new THREE.UV(1-m,o),m=new THREE.UV(1-m,n),r=new THREE.UV(1-t,n);b<c.length-1&&(n=this.vertices[e].position.clone(),t=this.vertices[h].position.clone(),q=this.vertices[i].position.clone(),n.normalize(),t.normalize(),q.normalize(),this.faces.push(new THREE.Face3(e,h,i,[new THREE.Vector3(n.x,n.y,n.z),new THREE.Vector3(t.x,t.y,t.z),new THREE.Vector3(q.x,q.y,q.z)])),this.faceVertexUvs[0].push([k,o,m]));b>1&&(n=
|
|
|
+this.vertices[e].position.clone(),t=this.vertices[i].position.clone(),q=this.vertices[j].position.clone(),n.normalize(),t.normalize(),q.normalize(),this.faces.push(new THREE.Face3(e,i,j,[new THREE.Vector3(n.x,n.y,n.z),new THREE.Vector3(t.x,t.y,t.z),new THREE.Vector3(q.x,q.y,q.z)])),this.faceVertexUvs[0].push([k,m,r]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};THREE.SphereGeometry.prototype=new THREE.Geometry;
|
|
|
THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry;
|
|
|
-THREE.TextGeometry=function(a,c){var b=(new THREE.TextPath(a,c)).toShapes();c.amount=c.height!==void 0?c.height:50;if(c.bevelThickness===void 0)c.bevelThickness=10;if(c.bevelSize===void 0)c.bevelSize=8;if(c.bevelEnabled===void 0)c.bevelEnabled=!1;if(c.bend){var e=b[b.length-1].getBoundingBox().maxX;c.bendPath=new THREE.QuadraticBezierCurve(new THREE.Vector2(0,0),new THREE.Vector2(e/2,120),new THREE.Vector2(e,0))}THREE.ExtrudeGeometry.call(this,b,c)};THREE.TextGeometry.prototype=new THREE.ExtrudeGeometry;
|
|
|
+THREE.TextGeometry=function(a,c){var b=(new THREE.TextPath(a,c)).toShapes();c.amount=c.height!==void 0?c.height:50;if(c.bevelThickness===void 0)c.bevelThickness=10;if(c.bevelSize===void 0)c.bevelSize=8;if(c.bevelEnabled===void 0)c.bevelEnabled=!1;if(c.bend){var d=b[b.length-1].getBoundingBox().maxX;c.bendPath=new THREE.QuadraticBezierCurve(new THREE.Vector2(0,0),new THREE.Vector2(d/2,120),new THREE.Vector2(d,0))}THREE.ExtrudeGeometry.call(this,b,c)};THREE.TextGeometry.prototype=new THREE.ExtrudeGeometry;
|
|
|
THREE.TextGeometry.prototype.constructor=THREE.TextGeometry;
|
|
|
-THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function(){return this.faces[this.face][this.weight][this.style]},getTextShapes:function(a,c){return(new TextPath(a,c)).toShapes()},loadFace:function(a){var c=a.familyName.toLowerCase();this.faces[c]=this.faces[c]||{};this.faces[c][a.cssFontWeight]=this.faces[c][a.cssFontWeight]||{};this.faces[c][a.cssFontWeight][a.cssFontStyle]=a;return this.faces[c][a.cssFontWeight][a.cssFontStyle]=a},drawText:function(a){for(var c=
|
|
|
-this.getFace(),b=this.size/c.resolution,e=0,g=String(a).split(""),h=g.length,f=[],a=0;a<h;a++){var k=new THREE.Path,k=this.extractGlyphPoints(g[a],c,b,e,k);e+=k.offset;f.push(k.path)}return{paths:f,offset:e/2}},extractGlyphPoints:function(a,c,b,e,g){var h=[],f,k,l,m,n,o,u,p,z,w,x=c.glyphs[a]||c.glyphs[ctxt.options.fallbackCharacter];if(x){if(x.o){c=x._cachedOutline||(x._cachedOutline=x.o.split(" "));l=c.length;for(a=0;a<l;)switch(k=c[a++],k){case "m":k=c[a++]*b+e;m=c[a++]*b;h.push(new THREE.Vector2(k,
|
|
|
-m));g.moveTo(k,m);break;case "l":k=c[a++]*b+e;m=c[a++]*b;h.push(new THREE.Vector2(k,m));g.lineTo(k,m);break;case "q":k=c[a++]*b+e;m=c[a++]*b;u=c[a++]*b+e;p=c[a++]*b;g.quadraticCurveTo(u,p,k,m);if(f=h[h.length-1]){n=f.x;o=f.y;f=1;for(divisions=this.divisions;f<=divisions;f++){var v=f/divisions,y=THREE.Shape.Utils.b2(v,n,u,k),v=THREE.Shape.Utils.b2(v,o,p,m);h.push(new THREE.Vector2(y,v))}}break;case "b":if(k=c[a++]*b+e,m=c[a++]*b,u=c[a++]*b+e,p=c[a++]*-b,z=c[a++]*b+e,w=c[a++]*-b,g.bezierCurveTo(k,m,
|
|
|
-u,p,z,w),f=h[h.length-1]){n=f.x;o=f.y;f=1;for(divisions=this.divisions;f<=divisions;f++)v=f/divisions,y=THREE.Shape.Utils.b3(v,n,u,z,k),v=THREE.Shape.Utils.b3(v,o,p,w,m),h.push(new THREE.Vector2(y,v))}}}return{offset:x.ha*b,points:h,path:g}}}};
|
|
|
-(function(a){var c=function(a){for(var c=a.length,g=0,h=c-1,f=0;f<c;h=f++)g+=a[h].x*a[f].y-a[f].x*a[h].y;return g*0.5};a.Triangulate=function(a,e){var g=a.length;if(g<3)return null;var h=[],f=[],k=[],l,m,n;if(c(a)>0)for(m=0;m<g;m++)f[m]=m;else for(m=0;m<g;m++)f[m]=g-1-m;var o=2*g;for(m=g-1;g>2;){if(o--<=0){console.log("Warning, unable to triangulate polygon!");if(e)return k;return h}l=m;g<=l&&(l=0);m=l+1;g<=m&&(m=0);n=m+1;g<=n&&(n=0);var u;a:{u=a;var p=l,z=m,w=n,x=g,v=f,y=void 0,t=void 0,A=void 0,
|
|
|
-D=void 0,C=void 0,E=void 0,I=void 0,G=void 0,K=void 0,t=u[v[p]].x,A=u[v[p]].y,D=u[v[z]].x,C=u[v[z]].y,E=u[v[w]].x,I=u[v[w]].y;if(1.0E-10>(D-t)*(I-A)-(C-A)*(E-t))u=!1;else{for(y=0;y<x;y++)if(!(y==p||y==z||y==w)){var G=u[v[y]].x,K=u[v[y]].y,B=void 0,F=void 0,J=void 0,M=void 0,N=void 0,L=void 0,P=void 0,H=void 0,Q=void 0,O=void 0,R=void 0,U=void 0,B=J=N=void 0,B=E-D,F=I-C,J=t-E,M=A-I,N=D-t,L=C-A,P=G-t,H=K-A,Q=G-D,O=K-C,R=G-E,U=K-I,B=B*O-F*Q,N=N*H-L*P,J=J*U-M*R;if(B>=0&&J>=0&&N>=0){u=!1;break a}}u=!0}}if(u){h.push([a[f[l]],
|
|
|
-a[f[m]],a[f[n]]]);k.push([f[l],f[m],f[n]]);l=m;for(n=m+1;n<g;l++,n++)f[l]=f[n];g--;o=2*g}}if(e)return k;return h};a.Triangulate.area=c;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
|
|
|
-THREE.TorusGeometry=function(a,c,b,e,g){THREE.Geometry.call(this);this.radius=a||100;this.tube=c||40;this.segmentsR=b||8;this.segmentsT=e||6;this.arc=g||Math.PI*2;g=new THREE.Vector3;a=[];c=[];for(b=0;b<=this.segmentsR;b++)for(e=0;e<=this.segmentsT;e++){var h=e/this.segmentsT*this.arc,f=b/this.segmentsR*Math.PI*2;g.x=this.radius*Math.cos(h);g.y=this.radius*Math.sin(h);var k=new THREE.Vector3;k.x=(this.radius+this.tube*Math.cos(f))*Math.cos(h);k.y=(this.radius+this.tube*Math.cos(f))*Math.sin(h);k.z=
|
|
|
-this.tube*Math.sin(f);this.vertices.push(new THREE.Vertex(k));a.push(new THREE.UV(e/this.segmentsT,1-b/this.segmentsR));c.push(k.clone().subSelf(g).normalize())}for(b=1;b<=this.segmentsR;b++)for(e=1;e<=this.segmentsT;e++){var g=(this.segmentsT+1)*b+e-1,h=(this.segmentsT+1)*(b-1)+e-1,f=(this.segmentsT+1)*(b-1)+e,k=(this.segmentsT+1)*b+e,l=new THREE.Face4(g,h,f,k,[c[g],c[h],c[f],c[k]]);l.normal.addSelf(c[g]);l.normal.addSelf(c[h]);l.normal.addSelf(c[f]);l.normal.addSelf(c[k]);l.normal.normalize();this.faces.push(l);
|
|
|
-this.faceVertexUvs[0].push([a[g].clone(),a[h].clone(),a[f].clone(),a[k].clone()])}this.computeCentroids()};THREE.TorusGeometry.prototype=new THREE.Geometry;THREE.TorusGeometry.prototype.constructor=THREE.TorusGeometry;
|
|
|
-THREE.TorusKnotGeometry=function(a,c,b,e,g,h,f){function k(a,b,c,e,f,h){b=c/e*a;c=Math.cos(b);return new THREE.Vector3(f*(2+c)*0.5*Math.cos(a),f*(2+c)*Math.sin(a)*0.5,h*f*Math.sin(b)*0.5)}THREE.Geometry.call(this);this.radius=a||200;this.tube=c||40;this.segmentsR=b||64;this.segmentsT=e||8;this.p=g||2;this.q=h||3;this.heightScale=f||1;this.grid=Array(this.segmentsR);b=new THREE.Vector3;e=new THREE.Vector3;h=new THREE.Vector3;for(a=0;a<this.segmentsR;++a){this.grid[a]=Array(this.segmentsT);for(c=0;c<
|
|
|
-this.segmentsT;++c){var l=a/this.segmentsR*2*this.p*Math.PI,f=c/this.segmentsT*2*Math.PI,g=k(l,f,this.q,this.p,this.radius,this.heightScale),l=k(l+0.01,f,this.q,this.p,this.radius,this.heightScale);b.x=l.x-g.x;b.y=l.y-g.y;b.z=l.z-g.z;e.x=l.x+g.x;e.y=l.y+g.y;e.z=l.z+g.z;h.cross(b,e);e.cross(h,b);h.normalize();e.normalize();l=-this.tube*Math.cos(f);f=this.tube*Math.sin(f);g.x+=l*e.x+f*h.x;g.y+=l*e.y+f*h.y;g.z+=l*e.z+f*h.z;this.grid[a][c]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(g.x,g.y,
|
|
|
-g.z)))-1}}for(a=0;a<this.segmentsR;++a)for(c=0;c<this.segmentsT;++c){var e=(a+1)%this.segmentsR,h=(c+1)%this.segmentsT,g=this.grid[a][c],b=this.grid[e][c],e=this.grid[e][h],h=this.grid[a][h],f=new THREE.UV(a/this.segmentsR,c/this.segmentsT),l=new THREE.UV((a+1)/this.segmentsR,c/this.segmentsT),m=new THREE.UV((a+1)/this.segmentsR,(c+1)/this.segmentsT),n=new THREE.UV(a/this.segmentsR,(c+1)/this.segmentsT);this.faces.push(new THREE.Face4(g,b,e,h));this.faceVertexUvs[0].push([f,l,m,n])}this.computeCentroids();
|
|
|
+THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function(){return this.faces[this.face][this.weight][this.style]},getTextShapes:function(a,c){return(new THREE.TextPath(a,c)).toShapes()},loadFace:function(a){var c=a.familyName.toLowerCase();this.faces[c]=this.faces[c]||{};this.faces[c][a.cssFontWeight]=this.faces[c][a.cssFontWeight]||{};this.faces[c][a.cssFontWeight][a.cssFontStyle]=a;return this.faces[c][a.cssFontWeight][a.cssFontStyle]=a},
|
|
|
+drawText:function(a){for(var c=this.getFace(),b=this.size/c.resolution,d=0,f=String(a).split(""),g=f.length,e=[],a=0;a<g;a++){var h=new THREE.Path,h=this.extractGlyphPoints(f[a],c,b,d,h);d+=h.offset;e.push(h.path)}return{paths:e,offset:d/2}},extractGlyphPoints:function(a,c,b,d,f){var g=[],e,h,i,j,k,m,o,n,t,q,r,p=c.glyphs[a]||c.glyphs["?"];if(p){if(p.o){c=p._cachedOutline||(p._cachedOutline=p.o.split(" "));j=c.length;for(a=0;a<j;)switch(i=c[a++],i){case "m":i=c[a++]*b+d;k=c[a++]*b;g.push(new THREE.Vector2(i,
|
|
|
+k));f.moveTo(i,k);break;case "l":i=c[a++]*b+d;k=c[a++]*b;g.push(new THREE.Vector2(i,k));f.lineTo(i,k);break;case "q":i=c[a++]*b+d;k=c[a++]*b;n=c[a++]*b+d;t=c[a++]*b;f.quadraticCurveTo(n,t,i,k);if(e=g[g.length-1]){m=e.x;o=e.y;e=1;for(h=this.divisions;e<=h;e++){var s=e/h,l=THREE.Shape.Utils.b2(s,m,n,i),s=THREE.Shape.Utils.b2(s,o,t,k);g.push(new THREE.Vector2(l,s))}}break;case "b":if(i=c[a++]*b+d,k=c[a++]*b,n=c[a++]*b+d,t=c[a++]*-b,q=c[a++]*b+d,r=c[a++]*-b,f.bezierCurveTo(i,k,n,t,q,r),e=g[g.length-1]){m=
|
|
|
+e.x;o=e.y;e=1;for(h=this.divisions;e<=h;e++)s=e/h,l=THREE.Shape.Utils.b3(s,m,n,q,i),s=THREE.Shape.Utils.b3(s,o,t,r,k),g.push(new THREE.Vector2(l,s))}}}return{offset:p.ha*b,points:g,path:f}}}};
|
|
|
+(function(a){var c=function(a){for(var c=a.length,f=0,g=c-1,e=0;e<c;g=e++)f+=a[g].x*a[e].y-a[e].x*a[g].y;return f*0.5};a.Triangulate=function(a,d){var f=a.length;if(f<3)return null;var g=[],e=[],h=[],i,j,k;if(c(a)>0)for(j=0;j<f;j++)e[j]=j;else for(j=0;j<f;j++)e[j]=f-1-j;var m=2*f;for(j=f-1;f>2;){if(m--<=0){console.log("Warning, unable to triangulate polygon!");if(d)return h;return g}i=j;f<=i&&(i=0);j=i+1;f<=j&&(j=0);k=j+1;f<=k&&(k=0);var o;a:{o=a;var n=i,t=j,q=k,r=f,p=e,s=void 0,l=void 0,v=void 0,
|
|
|
+w=void 0,x=void 0,y=void 0,C=void 0,A=void 0,E=void 0,l=o[p[n]].x,v=o[p[n]].y,w=o[p[t]].x,x=o[p[t]].y,y=o[p[q]].x,C=o[p[q]].y;if(1.0E-10>(w-l)*(C-v)-(x-v)*(y-l))o=!1;else{for(s=0;s<r;s++)if(!(s==n||s==t||s==q)){var A=o[p[s]].x,E=o[p[s]].y,u=void 0,G=void 0,D=void 0,H=void 0,B=void 0,F=void 0,J=void 0,N=void 0,M=void 0,O=void 0,z=void 0,K=void 0,u=D=B=void 0,u=y-w,G=C-x,D=l-y,H=v-C,B=w-l,F=x-v,J=A-l,N=E-v,M=A-w,O=E-x,z=A-y,K=E-C,u=u*O-G*M,B=B*N-F*J,D=D*K-H*z;if(u>=0&&D>=0&&B>=0){o=!1;break a}}o=!0}}if(o){g.push([a[e[i]],
|
|
|
+a[e[j]],a[e[k]]]);h.push([e[i],e[j],e[k]]);i=j;for(k=j+1;k<f;i++,k++)e[i]=e[k];f--;m=2*f}}if(d)return h;return g};a.Triangulate.area=c;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
|
|
|
+THREE.TorusGeometry=function(a,c,b,d,f){THREE.Geometry.call(this);this.radius=a||100;this.tube=c||40;this.segmentsR=b||8;this.segmentsT=d||6;this.arc=f||Math.PI*2;f=new THREE.Vector3;a=[];c=[];for(b=0;b<=this.segmentsR;b++)for(d=0;d<=this.segmentsT;d++){var g=d/this.segmentsT*this.arc,e=b/this.segmentsR*Math.PI*2;f.x=this.radius*Math.cos(g);f.y=this.radius*Math.sin(g);var h=new THREE.Vector3;h.x=(this.radius+this.tube*Math.cos(e))*Math.cos(g);h.y=(this.radius+this.tube*Math.cos(e))*Math.sin(g);h.z=
|
|
|
+this.tube*Math.sin(e);this.vertices.push(new THREE.Vertex(h));a.push(new THREE.UV(d/this.segmentsT,1-b/this.segmentsR));c.push(h.clone().subSelf(f).normalize())}for(b=1;b<=this.segmentsR;b++)for(d=1;d<=this.segmentsT;d++){var f=(this.segmentsT+1)*b+d-1,g=(this.segmentsT+1)*(b-1)+d-1,e=(this.segmentsT+1)*(b-1)+d,h=(this.segmentsT+1)*b+d,i=new THREE.Face4(f,g,e,h,[c[f],c[g],c[e],c[h]]);i.normal.addSelf(c[f]);i.normal.addSelf(c[g]);i.normal.addSelf(c[e]);i.normal.addSelf(c[h]);i.normal.normalize();this.faces.push(i);
|
|
|
+this.faceVertexUvs[0].push([a[f].clone(),a[g].clone(),a[e].clone(),a[h].clone()])}this.computeCentroids()};THREE.TorusGeometry.prototype=new THREE.Geometry;THREE.TorusGeometry.prototype.constructor=THREE.TorusGeometry;
|
|
|
+THREE.TorusKnotGeometry=function(a,c,b,d,f,g,e){function h(a,b,c,d,e,g){b=c/d*a;c=Math.cos(b);return new THREE.Vector3(e*(2+c)*0.5*Math.cos(a),e*(2+c)*Math.sin(a)*0.5,g*e*Math.sin(b)*0.5)}THREE.Geometry.call(this);this.radius=a||200;this.tube=c||40;this.segmentsR=b||64;this.segmentsT=d||8;this.p=f||2;this.q=g||3;this.heightScale=e||1;this.grid=Array(this.segmentsR);b=new THREE.Vector3;d=new THREE.Vector3;g=new THREE.Vector3;for(a=0;a<this.segmentsR;++a){this.grid[a]=Array(this.segmentsT);for(c=0;c<
|
|
|
+this.segmentsT;++c){var i=a/this.segmentsR*2*this.p*Math.PI,e=c/this.segmentsT*2*Math.PI,f=h(i,e,this.q,this.p,this.radius,this.heightScale),i=h(i+0.01,e,this.q,this.p,this.radius,this.heightScale);b.x=i.x-f.x;b.y=i.y-f.y;b.z=i.z-f.z;d.x=i.x+f.x;d.y=i.y+f.y;d.z=i.z+f.z;g.cross(b,d);d.cross(g,b);g.normalize();d.normalize();i=-this.tube*Math.cos(e);e=this.tube*Math.sin(e);f.x+=i*d.x+e*g.x;f.y+=i*d.y+e*g.y;f.z+=i*d.z+e*g.z;this.grid[a][c]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(f.x,f.y,
|
|
|
+f.z)))-1}}for(a=0;a<this.segmentsR;++a)for(c=0;c<this.segmentsT;++c){var d=(a+1)%this.segmentsR,g=(c+1)%this.segmentsT,f=this.grid[a][c],b=this.grid[d][c],d=this.grid[d][g],g=this.grid[a][g],e=new THREE.UV(a/this.segmentsR,c/this.segmentsT),i=new THREE.UV((a+1)/this.segmentsR,c/this.segmentsT),j=new THREE.UV((a+1)/this.segmentsR,(c+1)/this.segmentsT),k=new THREE.UV(a/this.segmentsR,(c+1)/this.segmentsT);this.faces.push(new THREE.Face4(f,b,d,g));this.faceVertexUvs[0].push([e,i,j,k])}this.computeCentroids();
|
|
|
this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusKnotGeometry.prototype=new THREE.Geometry;THREE.TorusKnotGeometry.prototype.constructor=THREE.TorusKnotGeometry;THREE.SubdivisionModifier=function(a){this.subdivisions=a===void 0?1:a;this.useOldVertexColors=!1;this.supportUVs=!0};THREE.SubdivisionModifier.prototype.constructor=THREE.SubdivisionModifier;THREE.SubdivisionModifier.prototype.modify=function(a){for(var c=this.subdivisions;c-- >0;)this.smooth(a)};
|
|
|
-THREE.SubdivisionModifier.prototype.smooth=function(a){function c(a,b,c,e,k,l){var m=new THREE.Face4(a,b,c,e,null,k.color,k.material);if(f.useOldVertexColors){m.vertexColors=[];for(var p,n,o,v=0;v<4;v++){o=l[v];p=new THREE.Color;p.setRGB(0,0,0);for(var t=0;t<o.length;t++)n=k.vertexColors[o[t]-1],p.r+=n.r,p.g+=n.g,p.b+=n.b;p.r/=o.length;p.g/=o.length;p.b/=o.length;m.vertexColors[v]=p}}g.push(m);(!f.supportUVs||u.length!=0)&&h.push([u[a],u[b],u[c],u[e]])}function b(a,b){return Math.min(a,b)+"_"+Math.max(a,
|
|
|
-b)}var e=[],g=[],h=[],f=this,k=a.vertices,e=a.faces,l=k.concat(),m=[],n={},o={},u=[],p,z,w,x,v,y=a.faceVertexUvs[0];p=0;for(z=y.length;p<z;p++){w=0;for(x=y[p].length;w<x;w++)v=e[p]["abcd".charAt(w)],u[v]||(u[v]=y[p][w])}var t;p=0;for(z=e.length;p<z;p++)if(v=e[p],m.push(v.centroid),l.push(new THREE.Vertex(v.centroid)),f.supportUVs&&u.length!=0){t=new THREE.UV;if(v instanceof THREE.Face3)t.u=u[v.a].u+u[v.b].u+u[v.c].u,t.v=u[v.a].v+u[v.b].v+u[v.c].v,t.u/=3,t.v/=3;else if(v instanceof THREE.Face4)t.u=
|
|
|
-u[v.a].u+u[v.b].u+u[v.c].u+u[v.d].u,t.v=u[v.a].v+u[v.b].v+u[v.c].v+u[v.d].v,t.u/=4,t.v/=4;u.push(t)}z=function(a){function c(a,b,e){a[b]===void 0&&(a[b]=[]);a[b].push(e)}var e,f,h,g,k={};e=0;for(f=a.faces.length;e<f;e++)h=a.faces[e],h instanceof THREE.Face3?(g=b(h.a,h.b),c(k,g,e),g=b(h.b,h.c),c(k,g,e),g=b(h.c,h.a),c(k,g,e)):h instanceof THREE.Face4&&(g=b(h.a,h.b),c(k,g,e),g=b(h.b,h.c),c(k,g,e),g=b(h.c,h.d),c(k,g,e),g=b(h.d,h.a),c(k,g,e));return k}(a);var A=0,y=k.length,D,C,E={},I={},G=function(a,
|
|
|
-b){E[a]===void 0&&(E[a]=[]);E[a].push(b)},K=function(a,b){I[a]===void 0&&(I[a]={});I[a][b]=null};for(p in z){t=z[p];D=p.split("_");C=D[0];D=D[1];G(C,[C,D]);G(D,[C,D]);w=0;for(x=t.length;w<x;w++)v=t[w],K(C,v,p),K(D,v,p);t.length<2&&(o[p]=!0)}for(p in z)if(t=z[p],v=t[0],t=t[1],D=p.split("_"),C=D[0],D=D[1],x=new THREE.Vector3,o[p]?(x.addSelf(k[C].position),x.addSelf(k[D].position),x.multiplyScalar(0.5)):(x.addSelf(m[v]),x.addSelf(m[t]),x.addSelf(k[C].position),x.addSelf(k[D].position),x.multiplyScalar(0.25)),
|
|
|
-n[p]=y+e.length+A,l.push(new THREE.Vertex(x)),A++,f.supportUVs&&u.length!=0)t=new THREE.UV,t.u=u[C].u+u[D].u,t.v=u[C].v+u[D].v,t.u/=2,t.v/=2,u.push(t);var B,F;D=["123","12","2","23"];x=["123","23","3","31"];var G=["123","31","1","12"],K=["1234","12","2","23"],J=["1234","23","3","34"],M=["1234","34","4","41"],N=["1234","41","1","12"];p=0;for(z=m.length;p<z;p++)v=e[p],t=y+p,v instanceof THREE.Face3?(A=b(v.a,v.b),C=b(v.b,v.c),B=b(v.c,v.a),c(t,n[A],v.b,n[C],v,D),c(t,n[C],v.c,n[B],v,x),c(t,n[B],v.a,n[A],
|
|
|
-v,G)):v instanceof THREE.Face4?(A=b(v.a,v.b),C=b(v.b,v.c),B=b(v.c,v.d),F=b(v.d,v.a),c(t,n[A],v.b,n[C],v,K),c(t,n[C],v.c,n[B],v,J),c(t,n[B],v.d,n[F],v,M),c(t,n[F],v.a,n[A],v,N)):console.log("face should be a face!",v);e=l;l=new THREE.Vector3;n=new THREE.Vector3;p=0;for(z=k.length;p<z;p++)if(E[p]!==void 0){l.set(0,0,0);n.set(0,0,0);v=new THREE.Vector3(0,0,0);t=0;for(w in I[p])l.addSelf(m[w]),t++;A=0;y=E[p].length;for(w=0;w<y;w++)o[b(E[p][w][0],E[p][w][1])]&&A++;if(A!=2){l.divideScalar(t);for(w=0;w<
|
|
|
-y;w++)t=E[p][w],t=k[t[0]].position.clone().addSelf(k[t[1]].position).divideScalar(2),n.addSelf(t);n.divideScalar(y);v.addSelf(k[p].position);v.multiplyScalar(y-3);v.addSelf(l);v.addSelf(n.multiplyScalar(2));v.divideScalar(y);e[p].position=v}}a.vertices=e;a.faces=g;a.faceVertexUvs[0]=h;delete a.__tmpVertices;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals()};
|
|
|
+THREE.SubdivisionModifier.prototype.smooth=function(a){function c(a,b,c,d,h,i){var j=new THREE.Face4(a,b,c,d,null,h.color,h.material);if(e.useOldVertexColors){j.vertexColors=[];for(var k,n,m,l=0;l<4;l++){m=i[l];k=new THREE.Color;k.setRGB(0,0,0);for(var p=0;p<m.length;p++)n=h.vertexColors[m[p]-1],k.r+=n.r,k.g+=n.g,k.b+=n.b;k.r/=m.length;k.g/=m.length;k.b/=m.length;j.vertexColors[l]=k}}f.push(j);(!e.supportUVs||o.length!=0)&&g.push([o[a],o[b],o[c],o[d]])}function b(a,b){return Math.min(a,b)+"_"+Math.max(a,
|
|
|
+b)}var d=[],f=[],g=[],e=this,h=a.vertices,d=a.faces,i=h.concat(),j=[],k={},m={},o=[],n,t,q,r,p,s=a.faceVertexUvs[0];n=0;for(t=s.length;n<t;n++){q=0;for(r=s[n].length;q<r;q++)p=d[n]["abcd".charAt(q)],o[p]||(o[p]=s[n][q])}var l;n=0;for(t=d.length;n<t;n++)if(p=d[n],j.push(p.centroid),i.push(new THREE.Vertex(p.centroid)),e.supportUVs&&o.length!=0){l=new THREE.UV;if(p instanceof THREE.Face3)l.u=o[p.a].u+o[p.b].u+o[p.c].u,l.v=o[p.a].v+o[p.b].v+o[p.c].v,l.u/=3,l.v/=3;else if(p instanceof THREE.Face4)l.u=
|
|
|
+o[p.a].u+o[p.b].u+o[p.c].u+o[p.d].u,l.v=o[p.a].v+o[p.b].v+o[p.c].v+o[p.d].v,l.u/=4,l.v/=4;o.push(l)}t=function(a){function c(a,b,d){a[b]===void 0&&(a[b]=[]);a[b].push(d)}var d,e,g,f,h={};d=0;for(e=a.faces.length;d<e;d++)g=a.faces[d],g instanceof THREE.Face3?(f=b(g.a,g.b),c(h,f,d),f=b(g.b,g.c),c(h,f,d),f=b(g.c,g.a),c(h,f,d)):g instanceof THREE.Face4&&(f=b(g.a,g.b),c(h,f,d),f=b(g.b,g.c),c(h,f,d),f=b(g.c,g.d),c(h,f,d),f=b(g.d,g.a),c(h,f,d));return h}(a);var v=0,s=h.length,w,x,y={},C={},A=function(a,
|
|
|
+b){y[a]===void 0&&(y[a]=[]);y[a].push(b)},E=function(a,b){C[a]===void 0&&(C[a]={});C[a][b]=null};for(n in t){l=t[n];w=n.split("_");x=w[0];w=w[1];A(x,[x,w]);A(w,[x,w]);q=0;for(r=l.length;q<r;q++)p=l[q],E(x,p,n),E(w,p,n);l.length<2&&(m[n]=!0)}for(n in t)if(l=t[n],p=l[0],l=l[1],w=n.split("_"),x=w[0],w=w[1],r=new THREE.Vector3,m[n]?(r.addSelf(h[x].position),r.addSelf(h[w].position),r.multiplyScalar(0.5)):(r.addSelf(j[p]),r.addSelf(j[l]),r.addSelf(h[x].position),r.addSelf(h[w].position),r.multiplyScalar(0.25)),
|
|
|
+k[n]=s+d.length+v,i.push(new THREE.Vertex(r)),v++,e.supportUVs&&o.length!=0)l=new THREE.UV,l.u=o[x].u+o[w].u,l.v=o[x].v+o[w].v,l.u/=2,l.v/=2,o.push(l);var u,G;w=["123","12","2","23"];r=["123","23","3","31"];var A=["123","31","1","12"],E=["1234","12","2","23"],D=["1234","23","3","34"],H=["1234","34","4","41"],B=["1234","41","1","12"];n=0;for(t=j.length;n<t;n++)p=d[n],l=s+n,p instanceof THREE.Face3?(v=b(p.a,p.b),x=b(p.b,p.c),u=b(p.c,p.a),c(l,k[v],p.b,k[x],p,w),c(l,k[x],p.c,k[u],p,r),c(l,k[u],p.a,k[v],
|
|
|
+p,A)):p instanceof THREE.Face4?(v=b(p.a,p.b),x=b(p.b,p.c),u=b(p.c,p.d),G=b(p.d,p.a),c(l,k[v],p.b,k[x],p,E),c(l,k[x],p.c,k[u],p,D),c(l,k[u],p.d,k[G],p,H),c(l,k[G],p.a,k[v],p,B)):console.log("face should be a face!",p);d=i;i=new THREE.Vector3;k=new THREE.Vector3;n=0;for(t=h.length;n<t;n++)if(y[n]!==void 0){i.set(0,0,0);k.set(0,0,0);p=new THREE.Vector3(0,0,0);l=0;for(q in C[n])i.addSelf(j[q]),l++;v=0;s=y[n].length;for(q=0;q<s;q++)m[b(y[n][q][0],y[n][q][1])]&&v++;if(v!=2){i.divideScalar(l);for(q=0;q<
|
|
|
+s;q++)l=y[n][q],l=h[l[0]].position.clone().addSelf(h[l[1]].position).divideScalar(2),k.addSelf(l);k.divideScalar(s);p.addSelf(h[n].position);p.multiplyScalar(s-3);p.addSelf(i);p.addSelf(k.multiplyScalar(2));p.divideScalar(s);d[n].position=p}}a.vertices=d;a.faces=f;a.faceVertexUvs[0]=g;delete a.__tmpVertices;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals()};
|
|
|
THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
|
|
|
THREE.Loader.prototype={constructor:THREE.Loader,addStatusElement:function(){var a=document.createElement("div");a.style.position="absolute";a.style.right="0px";a.style.top="0px";a.style.fontSize="0.8em";a.style.textAlign="left";a.style.background="rgba(0,0,0,0.25)";a.style.color="#fff";a.style.width="120px";a.style.padding="0.5em 0.5em 0.5em 0.5em";a.style.zIndex=1E3;a.innerHTML="Loading ...";return a},updateProgress:function(a){var c="Loaded ";c+=a.total?(100*a.loaded/a.total).toFixed(0)+"%":(a.loaded/
|
|
|
-1E3).toFixed(2)+" KB";this.statusDomElement.innerHTML=c},extractUrlbase:function(a){a=a.split("/");a.pop();return a.length<1?"":a.join("/")+"/"},initMaterials:function(a,c,b){a.materials=[];for(var e=0;e<c.length;++e)a.materials[e]=THREE.Loader.prototype.createMaterial(c[e],b)},hasNormals:function(a){var c,b,e=a.materials.length;for(b=0;b<e;b++)if(c=a.materials[b],c instanceof THREE.ShaderMaterial)return!0;return!1},createMaterial:function(a,c){function b(a){a=Math.log(a)/Math.LN2;return Math.floor(a)==
|
|
|
-a}function e(a,c){var e=new Image;e.onload=function(){if(!b(this.width)||!b(this.height)){var c=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),e=Math.pow(2,Math.round(Math.log(this.height)/Math.LN2));a.image.width=c;a.image.height=e;a.image.getContext("2d").drawImage(this,0,0,c,e)}else a.image=this;a.needsUpdate=!0};e.src=c}function g(a,b,f,h,g,k){var l=document.createElement("canvas");a[b]=new THREE.Texture(l);a[b].sourceFile=f;if(h){a[b].repeat.set(h[0],h[1]);if(h[0]!=1)a[b].wrapS=THREE.RepeatWrapping;
|
|
|
-if(h[1]!=1)a[b].wrapT=THREE.RepeatWrapping}g&&a[b].offset.set(g[0],g[1]);if(k){h={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(h[k[0]]!==void 0)a[b].wrapS=h[k[0]];if(h[k[1]]!==void 0)a[b].wrapT=h[k[1]]}e(a[b],c+"/"+f)}function h(a){return(a[0]*255<<16)+(a[1]*255<<8)+a[2]*255}var f,k,l;k="MeshLambertMaterial";f={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:a.wireframe};a.shading&&(a.shading=="Phong"?k="MeshPhongMaterial":a.shading=="Basic"&&(k="MeshBasicMaterial"));
|
|
|
-if(a.blending)if(a.blending=="Additive")f.blending=THREE.AdditiveBlending;else if(a.blending=="Subtractive")f.blending=THREE.SubtractiveBlending;else if(a.blending=="Multiply")f.blending=THREE.MultiplyBlending;if(a.transparent!==void 0||a.opacity<1)f.transparent=a.transparent;if(a.depthTest!==void 0)f.depthTest=a.depthTest;if(a.vertexColors!==void 0)if(a.vertexColors=="face")f.vertexColors=THREE.FaceColors;else if(a.vertexColors)f.vertexColors=THREE.VertexColors;if(a.colorDiffuse)f.color=h(a.colorDiffuse);
|
|
|
-else if(a.DbgColor)f.color=a.DbgColor;if(a.colorSpecular)f.specular=h(a.colorSpecular);if(a.colorAmbient)f.ambient=h(a.colorAmbient);if(a.transparency)f.opacity=a.transparency;if(a.specularCoef)f.shininess=a.specularCoef;a.mapDiffuse&&c&&g(f,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap);a.mapLight&&c&&g(f,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap);a.mapNormal&&c&&g(f,"normalMap",a.mapNormal,a.mapNormalRepeat,a.mapNormalOffset,a.mapNormalWrap);
|
|
|
-a.mapSpecular&&c&&g(f,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){var m=THREE.ShaderUtils.lib.normal,n=THREE.UniformsUtils.clone(m.uniforms),o=f.color;k=f.specular;l=f.ambient;var u=f.shininess;n.tNormal.texture=f.normalMap;if(a.mapNormalFactor)n.uNormalScale.value=a.mapNormalFactor;if(f.map)n.tDiffuse.texture=f.map,n.enableDiffuse.value=!0;if(f.specularMap)n.tSpecular.texture=f.specularMap,n.enableSpecular.value=!0;if(f.lightMap)n.tAO.texture=
|
|
|
-f.lightMap,n.enableAO.value=!0;n.uDiffuseColor.value.setHex(o);n.uSpecularColor.value.setHex(k);n.uAmbientColor.value.setHex(l);n.uShininess.value=u;if(f.opacity)n.uOpacity.value=f.opacity;f=new THREE.ShaderMaterial({fragmentShader:m.fragmentShader,vertexShader:m.vertexShader,uniforms:n,lights:!0,fog:!0})}else f=new THREE[k](f);return f}};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;
|
|
|
+1E3).toFixed(2)+" KB";this.statusDomElement.innerHTML=c},extractUrlbase:function(a){a=a.split("/");a.pop();return a.length<1?"":a.join("/")+"/"},initMaterials:function(a,c,b){a.materials=[];for(var d=0;d<c.length;++d)a.materials[d]=THREE.Loader.prototype.createMaterial(c[d],b)},hasNormals:function(a){var c,b,d=a.materials.length;for(b=0;b<d;b++)if(c=a.materials[b],c instanceof THREE.ShaderMaterial)return!0;return!1},createMaterial:function(a,c){function b(a){a=Math.log(a)/Math.LN2;return Math.floor(a)==
|
|
|
+a}function d(a,c){var d=new Image;d.onload=function(){if(!b(this.width)||!b(this.height)){var c=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),d=Math.pow(2,Math.round(Math.log(this.height)/Math.LN2));a.image.width=c;a.image.height=d;a.image.getContext("2d").drawImage(this,0,0,c,d)}else a.image=this;a.needsUpdate=!0};d.src=c}function f(a,b,e,g,f,h){var i=document.createElement("canvas");a[b]=new THREE.Texture(i);a[b].sourceFile=e;if(g){a[b].repeat.set(g[0],g[1]);if(g[0]!=1)a[b].wrapS=THREE.RepeatWrapping;
|
|
|
+if(g[1]!=1)a[b].wrapT=THREE.RepeatWrapping}f&&a[b].offset.set(f[0],f[1]);if(h){g={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(g[h[0]]!==void 0)a[b].wrapS=g[h[0]];if(g[h[1]]!==void 0)a[b].wrapT=g[h[1]]}d(a[b],c+"/"+e)}function g(a){return(a[0]*255<<16)+(a[1]*255<<8)+a[2]*255}var e,h,i;h="MeshLambertMaterial";e={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:a.wireframe};a.shading&&(a.shading=="Phong"?h="MeshPhongMaterial":a.shading=="Basic"&&(h="MeshBasicMaterial"));
|
|
|
+if(a.blending)if(a.blending=="Additive")e.blending=THREE.AdditiveBlending;else if(a.blending=="Subtractive")e.blending=THREE.SubtractiveBlending;else if(a.blending=="Multiply")e.blending=THREE.MultiplyBlending;if(a.transparent!==void 0||a.opacity<1)e.transparent=a.transparent;if(a.depthTest!==void 0)e.depthTest=a.depthTest;if(a.vertexColors!==void 0)if(a.vertexColors=="face")e.vertexColors=THREE.FaceColors;else if(a.vertexColors)e.vertexColors=THREE.VertexColors;if(a.colorDiffuse)e.color=g(a.colorDiffuse);
|
|
|
+else if(a.DbgColor)e.color=a.DbgColor;if(a.colorSpecular)e.specular=g(a.colorSpecular);if(a.colorAmbient)e.ambient=g(a.colorAmbient);if(a.transparency)e.opacity=a.transparency;if(a.specularCoef)e.shininess=a.specularCoef;a.mapDiffuse&&c&&f(e,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap);a.mapLight&&c&&f(e,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap);a.mapNormal&&c&&f(e,"normalMap",a.mapNormal,a.mapNormalRepeat,a.mapNormalOffset,a.mapNormalWrap);
|
|
|
+a.mapSpecular&&c&&f(e,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){var j=THREE.ShaderUtils.lib.normal,k=THREE.UniformsUtils.clone(j.uniforms),m=e.color;h=e.specular;i=e.ambient;var o=e.shininess;k.tNormal.texture=e.normalMap;if(a.mapNormalFactor)k.uNormalScale.value=a.mapNormalFactor;if(e.map)k.tDiffuse.texture=e.map,k.enableDiffuse.value=!0;if(e.specularMap)k.tSpecular.texture=e.specularMap,k.enableSpecular.value=!0;if(e.lightMap)k.tAO.texture=
|
|
|
+e.lightMap,k.enableAO.value=!0;k.uDiffuseColor.value.setHex(m);k.uSpecularColor.value.setHex(h);k.uAmbientColor.value.setHex(i);k.uShininess.value=o;if(e.opacity)k.uOpacity.value=e.opacity;e=new THREE.ShaderMaterial({fragmentShader:j.fragmentShader,vertexShader:j.vertexShader,uniforms:k,lights:!0,fog:!0})}else e=new THREE[h](e);return e}};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;
|
|
|
THREE.BinaryLoader.prototype.supr=THREE.Loader.prototype;
|
|
|
-THREE.BinaryLoader.prototype.load=function(a,c,b,e){if(a instanceof Object){console.warn("DEPRECATED: BinaryLoader( parameters ) is now BinaryLoader( url, callback, texturePath, binaryPath ).");var g=a,a=g.model,c=g.callback,b=g.texture_path,e=g.bin_path}var b=b?b:this.extractUrlbase(a),e=e?e:this.extractUrlbase(a),g=Date.now(),a=new Worker(a),h=this.showProgress?THREE.Loader.prototype.updateProgress:null;a.onmessage=function(a){THREE.BinaryLoader.prototype.loadAjaxBuffers(a.data.buffers,a.data.materials,
|
|
|
-c,e,b,h)};a.onerror=function(a){alert("worker.onerror: "+a.message+"\n"+a.data);a.preventDefault()};a.postMessage(g)};
|
|
|
-THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,c,b,e,g,h){var f=new XMLHttpRequest,k=e+"/"+a,l=0;f.onreadystatechange=function(){f.readyState==4?f.status==200||f.status==0?THREE.BinaryLoader.prototype.createBinModel(f.responseText,b,g,c):alert("Couldn't load ["+k+"] ["+f.status+"]"):f.readyState==3?h&&(l==0&&(l=f.getResponseHeader("Content-Length")),h({total:l,loaded:f.responseText.length})):f.readyState==2&&(l=f.getResponseHeader("Content-Length"))};f.open("GET",k,!0);f.overrideMimeType("text/plain; charset=x-user-defined");
|
|
|
-f.setRequestHeader("Content-Type","text/plain");f.send(null)};
|
|
|
-THREE.BinaryLoader.prototype.createBinModel=function(a,c,b,e){var g=function(b){function c(a,b){var e=n(a,b),f=n(a,b+1),h=n(a,b+2),g=n(a,b+3),k=(g<<1&255|h>>7)-127;e|=(h&127)<<16|f<<8;if(e==0&&k==-127)return 0;return(1-2*(g>>7))*(1+e*Math.pow(2,-23))*Math.pow(2,k)}function g(a,b){var c=n(a,b),e=n(a,b+1),f=n(a,b+2);return(n(a,b+3)<<24)+(f<<16)+(e<<8)+c}function l(a,b){var c=n(a,b);return(n(a,b+1)<<8)+c}function m(a,b){var c=n(a,b);return c>127?c-256:c}function n(a,b){return a.charCodeAt(b)&255}function o(b){var c,
|
|
|
-e,f;c=g(a,b);e=g(a,b+C);f=g(a,b+E);b=l(a,b+I);v.faces.push(new THREE.Face3(c,e,f,null,null,b))}function u(b){var c,e,f,h,m,n,o;c=g(a,b);e=g(a,b+C);f=g(a,b+E);h=l(a,b+I);m=g(a,b+G);n=g(a,b+K);o=g(a,b+B);var b=A[n*3],p=A[n*3+1];n=A[n*3+2];var u=A[o*3],t=A[o*3+1];o=A[o*3+2];v.faces.push(new THREE.Face3(c,e,f,[new THREE.Vector3(A[m*3],A[m*3+1],A[m*3+2]),new THREE.Vector3(b,p,n),new THREE.Vector3(u,t,o)],null,h))}function p(b){var c,e,f,h;c=g(a,b);e=g(a,b+F);f=g(a,b+J);h=g(a,b+M);b=l(a,b+N);v.faces.push(new THREE.Face4(c,
|
|
|
-e,f,h,null,null,b))}function z(b){var c,e,f,h,m,n,o,p,u;c=g(a,b);e=g(a,b+F);f=g(a,b+J);h=g(a,b+M);m=l(a,b+N);n=g(a,b+L);o=g(a,b+P);p=g(a,b+H);u=g(a,b+Q);var b=A[o*3],t=A[o*3+1];o=A[o*3+2];var la=A[p*3],ma=A[p*3+1];p=A[p*3+2];var na=A[u*3],w=A[u*3+1];u=A[u*3+2];v.faces.push(new THREE.Face4(c,e,f,h,[new THREE.Vector3(A[n*3],A[n*3+1],A[n*3+2]),new THREE.Vector3(b,t,o),new THREE.Vector3(la,ma,p),new THREE.Vector3(na,w,u)],null,m))}function w(b){var c,e,f,h;c=g(a,b);e=g(a,b+O);f=g(a,b+R);b=D[c*2];h=D[c*
|
|
|
-2+1];c=D[e*2];var l=v.faceVertexUvs[0];e=D[e*2+1];var m=D[f*2];f=D[f*2+1];var n=[];n.push(new THREE.UV(b,h));n.push(new THREE.UV(c,e));n.push(new THREE.UV(m,f));l.push(n)}function x(b){var c,e,f,h,l,m;c=g(a,b);e=g(a,b+U);f=g(a,b+S);h=g(a,b+T);b=D[c*2];l=D[c*2+1];c=D[e*2];m=D[e*2+1];e=D[f*2];var n=v.faceVertexUvs[0];f=D[f*2+1];var o=D[h*2];h=D[h*2+1];var p=[];p.push(new THREE.UV(b,l));p.push(new THREE.UV(c,m));p.push(new THREE.UV(e,f));p.push(new THREE.UV(o,h));n.push(p)}var v=this,y=0,t,A=[],D=[],
|
|
|
-C,E,I,G,K,B,F,J,M,N,L,P,H,Q,O,R,U,S,T,X,V,Z,Y,$,W;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(v,e,b);t={signature:a.substr(y,8),header_bytes:n(a,y+8),vertex_coordinate_bytes:n(a,y+9),normal_coordinate_bytes:n(a,y+10),uv_coordinate_bytes:n(a,y+11),vertex_index_bytes:n(a,y+12),normal_index_bytes:n(a,y+13),uv_index_bytes:n(a,y+14),material_index_bytes:n(a,y+15),nvertices:g(a,y+16),nnormals:g(a,y+16+4),nuvs:g(a,y+16+8),ntri_flat:g(a,y+16+12),ntri_smooth:g(a,y+16+16),ntri_flat_uv:g(a,
|
|
|
-y+16+20),ntri_smooth_uv:g(a,y+16+24),nquad_flat:g(a,y+16+28),nquad_smooth:g(a,y+16+32),nquad_flat_uv:g(a,y+16+36),nquad_smooth_uv:g(a,y+16+40)};y+=t.header_bytes;C=t.vertex_index_bytes;E=t.vertex_index_bytes*2;I=t.vertex_index_bytes*3;G=t.vertex_index_bytes*3+t.material_index_bytes;K=t.vertex_index_bytes*3+t.material_index_bytes+t.normal_index_bytes;B=t.vertex_index_bytes*3+t.material_index_bytes+t.normal_index_bytes*2;F=t.vertex_index_bytes;J=t.vertex_index_bytes*2;M=t.vertex_index_bytes*3;N=t.vertex_index_bytes*
|
|
|
-4;L=t.vertex_index_bytes*4+t.material_index_bytes;P=t.vertex_index_bytes*4+t.material_index_bytes+t.normal_index_bytes;H=t.vertex_index_bytes*4+t.material_index_bytes+t.normal_index_bytes*2;Q=t.vertex_index_bytes*4+t.material_index_bytes+t.normal_index_bytes*3;O=t.uv_index_bytes;R=t.uv_index_bytes*2;U=t.uv_index_bytes;S=t.uv_index_bytes*2;T=t.uv_index_bytes*3;b=t.vertex_index_bytes*3+t.material_index_bytes;W=t.vertex_index_bytes*4+t.material_index_bytes;X=t.ntri_flat*b;V=t.ntri_smooth*(b+t.normal_index_bytes*
|
|
|
-3);Z=t.ntri_flat_uv*(b+t.uv_index_bytes*3);Y=t.ntri_smooth_uv*(b+t.normal_index_bytes*3+t.uv_index_bytes*3);$=t.nquad_flat*W;b=t.nquad_smooth*(W+t.normal_index_bytes*4);W=t.nquad_flat_uv*(W+t.uv_index_bytes*4);y+=function(b){for(var e,h,g,k=t.vertex_coordinate_bytes*3,l=b+t.nvertices*k;b<l;b+=k)e=c(a,b),h=c(a,b+t.vertex_coordinate_bytes),g=c(a,b+t.vertex_coordinate_bytes*2),v.vertices.push(new THREE.Vertex(new THREE.Vector3(e,h,g)));return t.nvertices*k}(y);y+=function(b){for(var c,e,f,h=t.normal_coordinate_bytes*
|
|
|
-3,g=b+t.nnormals*h;b<g;b+=h)c=m(a,b),e=m(a,b+t.normal_coordinate_bytes),f=m(a,b+t.normal_coordinate_bytes*2),A.push(c/127,e/127,f/127);return t.nnormals*h}(y);y+=function(b){for(var e,h,g=t.uv_coordinate_bytes*2,k=b+t.nuvs*g;b<k;b+=g)e=c(a,b),h=c(a,b+t.uv_coordinate_bytes),D.push(e,h);return t.nuvs*g}(y);X=y+X;V=X+V;Z=V+Z;Y=Z+Y;$=Y+$;b=$+b;W=b+W;(function(a){var b,c=t.vertex_index_bytes*3+t.material_index_bytes,e=c+t.uv_index_bytes*3,f=a+t.ntri_flat_uv*e;for(b=a;b<f;b+=e)o(b),w(b+c);return f-a})(V);
|
|
|
-(function(a){var b,c=t.vertex_index_bytes*3+t.material_index_bytes+t.normal_index_bytes*3,e=c+t.uv_index_bytes*3,f=a+t.ntri_smooth_uv*e;for(b=a;b<f;b+=e)u(b),w(b+c);return f-a})(Z);(function(a){var b,c=t.vertex_index_bytes*4+t.material_index_bytes,e=c+t.uv_index_bytes*4,f=a+t.nquad_flat_uv*e;for(b=a;b<f;b+=e)p(b),x(b+c);return f-a})(b);(function(a){var b,c=t.vertex_index_bytes*4+t.material_index_bytes+t.normal_index_bytes*4,e=c+t.uv_index_bytes*4,f=a+t.nquad_smooth_uv*e;for(b=a;b<f;b+=e)z(b),x(b+
|
|
|
-c);return f-a})(W);(function(a){var b,c=t.vertex_index_bytes*3+t.material_index_bytes,e=a+t.ntri_flat*c;for(b=a;b<e;b+=c)o(b);return e-a})(y);(function(a){var b,c=t.vertex_index_bytes*3+t.material_index_bytes+t.normal_index_bytes*3,e=a+t.ntri_smooth*c;for(b=a;b<e;b+=c)u(b);return e-a})(X);(function(a){var b,c=t.vertex_index_bytes*4+t.material_index_bytes,e=a+t.nquad_flat*c;for(b=a;b<e;b+=c)p(b);return e-a})(Y);(function(a){var b,c=t.vertex_index_bytes*4+t.material_index_bytes+t.normal_index_bytes*
|
|
|
-4,e=a+t.nquad_smooth*c;for(b=a;b<e;b+=c)z(b);return e-a})($);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};g.prototype=new THREE.Geometry;g.prototype.constructor=g;c(new g(b))};
|
|
|
-THREE.ColladaLoader=function(){function a(a,e,g){V=a;e=e||$;g!==void 0&&(a=g.split("/"),a.pop(),ja=a.length<1?"":a.join("/")+"/");fa=c("//dae:library_images/dae:image",f,"image");ga=c("//dae:library_materials/dae:material",I,"material");ha=c("//dae:library_effects/dae:effect",J,"effect");ba=c("//dae:library_geometries/dae:geometry",x,"geometry");aa=c("//dae:library_controllers/dae:controller",k,"controller");ca=c("//dae:library_animations/dae:animation",N,"animation");ia=c(".//dae:library_visual_scenes/dae:visual_scene",
|
|
|
-n,"visual_scene");da=[];ea=[];(a=V.evaluate(".//dae:scene/dae:instance_visual_scene",V,Q,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(a=a.getAttribute("url").replace(/^#/,""),Y=ia[a]):Y=null;Z=new THREE.Object3D;for(a=0;a<Y.nodes.length;a++)Z.add(h(Y.nodes[a]));b();for(var l in ca);l={scene:Z,morphs:da,skins:ea,dae:{images:fa,materials:ga,effects:ha,geometries:ba,controllers:aa,animations:ca,visualScenes:ia,scene:Y}};e&&e(l);return l}function c(a,b,c){for(var a=V.evaluate(a,V,Q,XPathResult.ORDERED_NODE_ITERATOR_TYPE,
|
|
|
-null),e={},f=a.iterateNext(),h=0;f;){f=(new b).parse(f);if(f.id.length==0)f.id=c+h++;e[f.id]=f;f=a.iterateNext()}return e}function b(){var a=1E6,b=-a,c=0,e;for(e in ca)for(var f=ca[e],h=0;h<f.sampler.length;h++){var g=f.sampler[h];g.create();a=Math.min(a,g.startTime);b=Math.max(b,g.endTime);c=Math.max(c,g.input.length)}return{start:a,end:b,frames:c}}function e(a,b,c,f){a.world=a.world||new THREE.Matrix4;a.world.copy(a.matrix);if(a.channels&&a.channels.length){var h=a.channels[0].sampler.output[c];
|
|
|
-h instanceof THREE.Matrix4&&a.world.copy(h)}f&&a.world.multiply(f,a.world);b.push(a);for(f=0;f<a.nodes.length;f++)e(a.nodes[f],b,c,a.world)}function g(a,c,f){var h=aa[c.url];if(!h||!h.skin)console.log("ColladaLoader: Could not find skin controller.");else if(!c.skeleton||!c.skeleton.length)console.log("ColladaLoader: Could not find the skeleton for the skin. ");else{var g=b(),c=Y.getChildById(c.skeleton[0],!0)||Y.getChildBySid(c.skeleton[0],!0),k,l,m,n,o=new THREE.Vector3,p;for(k=0;k<a.vertices.length;k++)h.skin.bindShapeMatrix.multiplyVector3(a.vertices[k].position);
|
|
|
-for(f=0;f<g.frames;f++){var u=[],v=[];for(k=0;k<a.vertices.length;k++)v.push(new THREE.Vertex(new THREE.Vector3));e(c,u,f);k=u;l=h.skin;for(n=0;n<k.length;n++)if(m=k[n],p=-1,m.type=="JOINT"){for(var t=0;t<l.joints.length;t++)if(m.sid==l.joints[t]){p=t;break}if(p>=0){t=l.invBindMatrices[p];m.invBindMatrix=t;m.skinningMatrix=new THREE.Matrix4;m.skinningMatrix.multiply(m.world,t);m.weights=[];for(t=0;t<l.weights.length;t++)for(var w=0;w<l.weights[t].length;w++){var x=l.weights[t][w];x.joint==p&&m.weights.push(x)}}else throw"ColladaLoader: Could not find joint '"+
|
|
|
-m.sid+"'.";}for(k=0;k<u.length;k++)if(u[k].type=="JOINT")for(l=0;l<u[k].weights.length;l++)m=u[k].weights[l],n=m.index,m=m.weight,p=a.vertices[n],n=v[n],o.x=p.position.x,o.y=p.position.y,o.z=p.position.z,u[k].skinningMatrix.multiplyVector3(o),n.position.x+=o.x*m,n.position.y+=o.y*m,n.position.z+=o.z*m;a.morphTargets.push({name:"target_"+f,vertices:v})}}}function h(a){var b=new THREE.Object3D,c,e,f;for(f=0;f<a.controllers.length;f++){var k=aa[a.controllers[f].url];switch(k.type){case "skin":if(ba[k.skin.source]){var l=
|
|
|
-new w;l.url=k.skin.source;l.instance_material=a.controllers[f].instance_material;a.geometries.push(l);c=a.controllers[f]}else if(aa[k.skin.source]&&(e=k=aa[k.skin.source],k.morph&&ba[k.morph.source]))l=new w,l.url=k.morph.source,l.instance_material=a.controllers[f].instance_material,a.geometries.push(l);break;case "morph":if(ba[k.morph.source])l=new w,l.url=k.morph.source,l.instance_material=a.controllers[f].instance_material,a.geometries.push(l),e=a.controllers[f];console.log("ColladaLoader: Morph-controller partially supported.")}}for(f=
|
|
|
-0;f<a.geometries.length;f++){var k=a.geometries[f],l=k.instance_material,k=ba[k.url],m={},n=0,o;if(k&&k.mesh&&k.mesh.primitives){if(b.name.length==0)b.name=k.id;if(l)for(j=0;j<l.length;j++){o=l[j];var u=ha[ga[o.target].instance_effect.url].shader;u.material.opacity=!u.material.opacity?1:u.material.opacity;o=m[o.symbol]=u.material;n++}l=o||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});k=k.mesh.geometry3js;if(n>1){l=new THREE.MeshFaceMaterial;for(j=0;j<k.faces.length;j++)n=
|
|
|
-k.faces[j],n.materials=[m[n.daeMaterial]]}if(c!==void 0)g(k,c),l.morphTargets=!0,l=new THREE.SkinnedMesh(k,l),l.skeleton=c.skeleton,l.skinController=aa[c.url],l.skinInstanceController=c,l.name="skin_"+ea.length,ea.push(l);else if(e!==void 0){m=k;n=e instanceof p?aa[e.url]:e;if(!n||!n.morph)console.log("could not find morph controller!");else{n=n.morph;for(u=0;u<n.targets.length;u++){var t=ba[n.targets[u]];if(t.mesh&&t.mesh.primitives&&t.mesh.primitives.length)t=t.mesh.primitives[0].geometry,t.vertices.length===
|
|
|
-m.vertices.length&&m.morphTargets.push({name:"target_1",vertices:t.vertices})}m.morphTargets.push({name:"target_Z",vertices:m.vertices})}l.morphTargets=!0;l=new THREE.Mesh(k,l);l.name="morph_"+da.length;da.push(l)}else l=new THREE.Mesh(k,l);a.geometries.length>1?b.add(l):b=l}}b.name=a.id||"";a.matrix.decompose(b.position,b.rotation,b.scale);for(f=0;f<a.nodes.length;f++)b.add(h(a.nodes[f],a));return b}function f(){this.init_from=this.id=""}function k(){this.type=this.name=this.id="";this.morph=this.skin=
|
|
|
-null}function l(){this.weights=this.targets=this.source=this.method=null}function m(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function n(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function o(){this.sid=this.name=this.id="";this.nodes=[];this.controllers=[];this.transforms=[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function u(){this.type=this.sid="";this.data=[];this.matrix=new THREE.Matrix4}function p(){this.url=
|
|
|
-"";this.skeleton=[];this.instance_material=[]}function z(){this.target=this.symbol=""}function w(){this.url="";this.instance_material=[]}function x(){this.id="";this.mesh=null}function v(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function y(){}function t(){this.material="";this.count=0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function A(){this.source="";this.stride=this.count=0;this.params=[]}function D(){this.input={}}function C(){this.semantic=
|
|
|
-"";this.offset=0;this.source="";this.set=0}function E(a){this.id=a;this.type=null}function I(){this.name=this.id="";this.instance_effect=null}function G(){this.color=new THREE.Color(0);this.color.setRGB(Math.random(),Math.random(),Math.random());this.color.a=1;this.texcoord=this.texture=null}function K(a,b){this.type=a;this.effect=b;this.material=null}function B(a){this.effect=a;this.format=this.init_from=null}function F(a){this.effect=a;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=
|
|
|
-this.source=null}function J(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function M(){this.url=""}function N(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function L(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=this.dotSyntax=this.sid=null}function P(a){this.id="";this.animation=a;this.inputs=[];this.endTime=this.startTime=this.interpolation=this.output=this.input=null;this.duration=0}function H(a){var b=a.getAttribute("id");
|
|
|
-if(W[b]!=void 0)return W[b];W[b]=(new E(b)).parse(a);return W[b]}function Q(a){if(a=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function O(a){for(var a=U(a).split(/\s+/),b=[],c=0;c<a.length;c++)b.push(parseFloat(a[c]));return b}function R(a){for(var a=U(a).split(/\s+/),b=[],c=0;c<a.length;c++)b.push(parseInt(a[c],10));return b}function U(a){return a.replace(/^\s+/,"").replace(/\s+$/,"")}function S(a,b,c){return a.hasAttribute(b)?parseInt(a.getAttribute(b),10):c}function T(a,
|
|
|
-b){if(a===void 0){for(var c="0.";c.length<b+2;)c+="0";return c}b=b||2;c=a.toString().split(".");for(c[1]=c.length>1?c[1].substr(0,b):"0";c[1].length<b;)c[1]+="0";return c.join(".")}function X(a,b){var c="";c+=T(a.x,b)+",";c+=T(a.y,b)+",";c+=T(a.z,b);return c}var V=null,Z=null,Y,$=null,W={},fa={},ca={},aa={},ba={},ga={},ha={},ia,ja,da,ea,ka=THREE.SmoothShading;f.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName=="init_from")this.init_from=
|
|
|
-c.textContent}return this};k.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 m).parse(c);this.type=c.nodeName;break;case "morph":this.morph=(new l).parse(c),this.type=c.nodeName}}return this};l.prototype.parse=function(a){var b={},c=[],e;this.method=a.getAttribute("method");this.source=a.getAttribute("source").replace(/^#/,"");for(e=
|
|
|
-0;e<a.childNodes.length;e++){var f=a.childNodes[e];if(f.nodeType==1)switch(f.nodeName){case "source":f=(new E).parse(f);b[f.id]=f;break;case "targets":c=this.parseInputs(f);break;default:console.log(f.nodeName)}}for(e=0;e<c.length;e++)switch(a=c[e],f=b[a.source],a.semantic){case "MORPH_TARGET":this.targets=f.read();break;case "MORPH_WEIGHT":this.weights=f.read()}return this};l.prototype.parseInputs=function(a){for(var b=[],c=0;c<a.childNodes.length;c++){var e=a.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "input":b.push((new C).parse(e))}}return b};
|
|
|
-m.prototype.parse=function(a){var b={},c,e;this.source=a.getAttribute("source").replace(/^#/,"");this.invBindMatrices=[];this.joints=[];this.weights=[];for(var f=0;f<a.childNodes.length;f++){var h=a.childNodes[f];if(h.nodeType==1)switch(h.nodeName){case "bind_shape_matrix":h=O(h.textContent);this.bindShapeMatrix=new THREE.Matrix4;this.bindShapeMatrix.set(h[0],h[1],h[2],h[3],h[4],h[5],h[6],h[7],h[8],h[9],h[10],h[11],h[12],h[13],h[14],h[15]);break;case "source":h=(new E).parse(h);b[h.id]=h;break;case "joints":c=
|
|
|
-h;break;case "vertex_weights":e=h;break;default:console.log(h.nodeName)}}this.parseJoints(c,b);this.parseWeights(e,b);return this};m.prototype.parseJoints=function(a,b){for(var c=0;c<a.childNodes.length;c++){var e=a.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "input":var e=(new C).parse(e),f=b[e.source];if(e.semantic=="JOINT")this.joints=f.read();else if(e.semantic=="INV_BIND_MATRIX")this.invBindMatrices=f.read()}}};m.prototype.parseWeights=function(a,b){for(var c,e,f=[],h=0;h<a.childNodes.length;h++){var g=
|
|
|
-a.childNodes[h];if(g.nodeType==1)switch(g.nodeName){case "input":f.push((new C).parse(g));break;case "v":c=R(g.textContent);break;case "vcount":e=R(g.textContent)}}for(h=g=0;h<e.length;h++){for(var k=e[h],l=[],m=0;m<k;m++){for(var n={},o=0;o<f.length;o++){var p=f[o],u=c[g+p.offset];switch(p.semantic){case "JOINT":n.joint=u;break;case "WEIGHT":n.weight=b[p.source].data[u]}}l.push(n);g+=f.length}for(m=0;m<l.length;m++)l[m].index=h;this.weights.push(l)}};n.prototype.getChildById=function(a,b){for(var c=
|
|
|
-0;c<this.nodes.length;c++){var e=this.nodes[c].getChildById(a,b);if(e)return e}return null};n.prototype.getChildBySid=function(a,b){for(var c=0;c<this.nodes.length;c++){var e=this.nodes[c].getChildBySid(a,b);if(e)return e}return null};n.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.nodes=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "node":this.nodes.push((new o).parse(c))}}return this};o.prototype.getChannelForTransform=
|
|
|
-function(a){for(var b=0;b<this.channels.length;b++){var c=this.channels[b],e=c.target.split("/");e.shift();var f=e.shift(),h=f.indexOf(".")>=0,g=f.indexOf("(")>=0,k;if(h)e=f.split("."),f=e.shift(),e.shift();else if(g){k=f.split("(");f=k.shift();for(e=0;e<k.length;e++)k[e]=parseInt(k[e].replace(/\)/,""))}if(f==a)return c.info={sid:f,dotSyntax:h,arrSyntax:g,arrIndices:k},c}return null};o.prototype.getChildById=function(a,b){if(this.id==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var e=this.nodes[c].getChildById(a,
|
|
|
-b);if(e)return e}return null};o.prototype.getChildBySid=function(a,b){if(this.sid==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var e=this.nodes[c].getChildBySid(a,b);if(e)return e}return null};o.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};o.prototype.parse=function(a){var b;this.id=a.getAttribute("id");this.sid=a.getAttribute("sid");this.name=a.getAttribute("name");this.type=a.getAttribute("type");
|
|
|
-this.type=this.type=="JOINT"?this.type:"NODE";this.nodes=[];this.transforms=[];this.geometries=[];this.controllers=[];this.matrix=new THREE.Matrix4;for(var c=0;c<a.childNodes.length;c++)if(b=a.childNodes[c],b.nodeType==1)switch(b.nodeName){case "node":this.nodes.push((new o).parse(b));break;case "instance_camera":break;case "instance_controller":this.controllers.push((new p).parse(b));break;case "instance_geometry":this.geometries.push((new w).parse(b));break;case "instance_light":break;case "instance_node":b=
|
|
|
-b.getAttribute("url").replace(/^#/,"");(b=V.evaluate(".//dae:library_nodes//dae:node[@id='"+b+"']",V,Q,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new o).parse(b));break;case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new u).parse(b));break;case "extra":break;default:console.log(b.nodeName)}a=[];c=1E6;b=-1E6;for(var e in ca)for(var f=ca[e],h=0;h<f.channel.length;h++){var g=f.channel[h],k=f.sampler[h];e=g.target.split("/")[0];
|
|
|
-if(e==this.id)k.create(),g.sampler=k,c=Math.min(c,k.startTime),b=Math.max(b,k.endTime),a.push(g)}if(a.length)this.startTime=c,this.endTime=b;if((this.channels=a)&&this.channels.length){e=1E7;for(i=0;i<this.channels.length;i++){a=this.channels[i].sampler;for(c=0;c<a.input.length-1;c++)e=Math.min(e,a.input[c+1]-a.input[c])}c=[];for(a=this.startTime;a<this.endTime;a+=e){b=a;for(var f={},l=h=void 0,h=0;h<this.channels.length;h++)l=this.channels[h],f[l.sid]=l;g=new THREE.Matrix4;for(h=0;h<this.transforms.length;h++)if(k=
|
|
|
-this.transforms[h],l=f[k.sid],l!==void 0){for(var m=l.sampler,n,l=0;l<m.input.length-1;l++)if(m.input[l+1]>b){n=m.output[l];break}g=n!==void 0?n instanceof THREE.Matrix4?g.multiply(g,n):g.multiply(g,k.matrix):g.multiply(g,k.matrix)}else g=g.multiply(g,k.matrix);b=g;c.push({time:a,pos:[b.n14,b.n24,b.n34],rotq:[0,0,0,1],scl:[1,1,1]})}this.keys=c}this.updateMatrix();return this};o.prototype.updateMatrix=function(){this.matrix.identity();for(var a=0;a<this.transforms.length;a++)this.matrix.multiply(this.matrix,
|
|
|
-this.transforms[a].matrix)};u.prototype.parse=function(a){this.sid=a.getAttribute("sid");this.type=a.nodeName;this.data=O(a.textContent);this.updateMatrix();return this};u.prototype.updateMatrix=function(){var a=0;this.matrix.identity();switch(this.type){case "matrix":this.matrix.set(this.data[0],this.data[1],this.data[2],this.data[3],this.data[4],this.data[5],this.data[6],this.data[7],this.data[8],this.data[9],this.data[10],this.data[11],this.data[12],this.data[13],this.data[14],this.data[15]);break;
|
|
|
-case "translate":this.matrix.setTranslation(this.data[0],this.data[1],this.data[2]);break;case "rotate":a=this.data[3]*(Math.PI/180);this.matrix.setRotationAxis(new THREE.Vector3(this.data[0],this.data[1],this.data[2]),a);break;case "scale":this.matrix.setScale(this.data[0],this.data[1],this.data[2])}return this.matrix};p.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.skeleton=[];this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];
|
|
|
-if(c.nodeType==1)switch(c.nodeName){case "skeleton":this.skeleton.push(c.textContent.replace(/^#/,""));break;case "bind_material":if(c=V.evaluate(".//dae:instance_material",c,Q,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(var e=c.iterateNext();e;)this.instance_material.push((new z).parse(e)),e=c.iterateNext()}}return this};z.prototype.parse=function(a){this.symbol=a.getAttribute("symbol");this.target=a.getAttribute("target").replace(/^#/,"");return this};w.prototype.parse=function(a){this.url=
|
|
|
-a.getAttribute("url").replace(/^#/,"");this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1&&c.nodeName=="bind_material"){if(a=V.evaluate(".//dae:instance_material",c,Q,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(b=a.iterateNext();b;)this.instance_material.push((new z).parse(b)),b=a.iterateNext();break}}return this};x.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 v(this)).parse(c)}}return this};v.prototype.parse=function(a){function b(a,c){var e=X(a.position);f[e]===void 0&&(f[e]={v:a,index:c});return f[e]}this.primitives=[];var c;for(c=0;c<a.childNodes.length;c++){var e=a.childNodes[c];switch(e.nodeName){case "source":H(e);break;case "vertices":this.vertices=(new D).parse(e);break;case "triangles":this.primitives.push((new t).parse(e));break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new y).parse(e))}}var f=
|
|
|
-{};this.geometry3js=new THREE.Geometry;e=W[this.vertices.input.POSITION.source].data;for(a=c=0;c<e.length;c+=3,a++){var h=new THREE.Vertex(new THREE.Vector3(e[c],e[c+1],e[c+2]));b(h,a);this.geometry3js.vertices.push(h)}for(c=0;c<this.primitives.length;c++)primitive=this.primitives[c],primitive.setVertices(this.vertices),this.handlePrimitive(primitive,this.geometry3js,f);this.geometry3js.computeCentroids();this.geometry3js.computeFaceNormals();this.geometry3js.computeVertexNormals();this.geometry3js.computeBoundingBox();
|
|
|
-return this};v.prototype.handlePrimitive=function(a,b,c){var e=0,f,h,g=a.p,k=a.inputs,l,m,n,o=0,p=3,u=[];for(f=0;f<k.length;f++)switch(l=k[f],l.semantic){case "TEXCOORD":u.push(l.set)}for(;e<g.length;){var t=[],v=[],w={},x=[];a.vcount&&(p=a.vcount[o++]);for(f=0;f<p;f++)for(h=0;h<k.length;h++)switch(l=k[h],source=W[l.source],m=g[e+f*k.length+l.offset],numParams=source.accessor.params.length,n=m*numParams,l.semantic){case "VERTEX":l=X(b.vertices[m].position);t.push(c[l].index);break;case "NORMAL":v.push(new THREE.Vector3(source.data[n],
|
|
|
-source.data[n+1],source.data[n+2]));break;case "TEXCOORD":w[l.set]===void 0&&(w[l.set]=[]);w[l.set].push(new THREE.UV(source.data[n],source.data[n+1]));break;case "COLOR":x.push((new THREE.Color).setRGB(source.data[n],source.data[n+1],source.data[n+2]))}var z;p==3?z=new THREE.Face3(t[0],t[1],t[2],[v[0],v[1],v[2]],x.length?x:new THREE.Color):p==4&&(z=new THREE.Face4(t[0],t[1],t[2],t[3],[v[0],v[1],v[2],v[3]],x.length?x:new THREE.Color));z.daeMaterial=a.material;b.faces.push(z);for(h=0;h<u.length;h++)f=
|
|
|
-w[u[h]],b.faceVertexUvs[h].push([f[0],f[1],f[2]]);e+=k.length*p}};y.prototype=new t;y.prototype.constructor=y;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=S(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 C).parse(a.childNodes[b]));
|
|
|
-break;case "vcount":this.vcount=R(c.textContent);break;case "p":this.p=R(c.textContent)}}return this};A.prototype.parse=function(a){this.params=[];this.source=a.getAttribute("source");this.count=S(a,"count",0);this.stride=S(a,"stride",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName=="param"){var e={};e.name=c.getAttribute("name");e.type=c.getAttribute("type");this.params.push(e)}}return this};D.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++)a.childNodes[b].nodeName==
|
|
|
-"input"&&(input=(new C).parse(a.childNodes[b]),this.input[input.semantic]=input);return this};C.prototype.parse=function(a){this.semantic=a.getAttribute("semantic");this.source=a.getAttribute("source").replace(/^#/,"");this.set=S(a,"set",-1);this.offset=S(a,"offset",0);if(this.semantic=="TEXCOORD"&&this.set<0)this.set=0;return this};E.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "bool_array":for(var e=
|
|
|
-U(c.textContent).split(/\s+/),f=[],h=0;h<e.length;h++)f.push(e[h]=="true"||e[h]=="1"?!0:!1);this.data=f;this.type=c.nodeName;break;case "float_array":this.data=O(c.textContent);this.type=c.nodeName;break;case "int_array":this.data=R(c.textContent);this.type=c.nodeName;break;case "IDREF_array":case "Name_array":this.data=U(c.textContent).split(/\s+/);this.type=c.nodeName;break;case "technique_common":for(e=0;e<c.childNodes.length;e++)if(c.childNodes[e].nodeName=="accessor"){this.accessor=(new A).parse(c.childNodes[e]);
|
|
|
-break}}}return this};E.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),e=new THREE.Matrix4;e.set(c[0],c[1],c[2],c[3],c[4],c[5],c[6],c[7],c[8],c[9],c[10],c[11],c[12],c[13],c[14],c[15]);a.push(e)}break;default:console.log("ColladaLoader: Source: Read dont know how to read "+b.type+".")}return a};I.prototype.parse=function(a){this.id=
|
|
|
-a.getAttribute("id");this.name=a.getAttribute("name");for(var b=0;b<a.childNodes.length;b++)if(a.childNodes[b].nodeName=="instance_effect"){this.instance_effect=(new M).parse(a.childNodes[b]);break}return this};G.prototype.isColor=function(){return this.texture==null};G.prototype.isTexture=function(){return this.texture!=null};G.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "color":c=O(c.textContent);this.color=new THREE.Color(0);
|
|
|
-this.color.setRGB(c[0],c[1],c[2]);this.color.a=c[3];break;case "texture":this.texture=c.getAttribute("texture"),this.texcoord=c.getAttribute("texcoord")}}return this};K.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[c.nodeName]=(new G).parse(c);break;case "shininess":case "reflectivity":case "transparency":var e;e=V.evaluate(".//dae:float",
|
|
|
-c,Q,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);for(var f=e.iterateNext(),h=[];f;)h.push(f),f=e.iterateNext();e=h;e.length>0&&(this[c.nodeName]=parseFloat(e[0].textContent))}}this.create();return this};K.prototype.create=function(){var a={},b=this.transparency!==void 0&&this.transparency<1,c;for(c in this)switch(c){case "ambient":case "emission":case "diffuse":case "specular":var e=this[c];if(e instanceof G)if(e.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==
|
|
|
-this.effect.surface.sid&&(e=fa[this.effect.surface.init_from]))a.map=THREE.ImageUtils.loadTexture(ja+e.init_from),a.map.wrapS=THREE.RepeatWrapping,a.map.wrapT=THREE.RepeatWrapping,a.map.repeat.x=1,a.map.repeat.y=-1}else c=="diffuse"?a.color=e.color.getHex():b||(a[c]=e.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)};B.prototype.parse=function(a){for(var b=
|
|
|
-0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "init_from":this.init_from=c.textContent;break;case "format":this.format=c.textContent;break;default:console.log("unhandled Surface prop: "+c.nodeName)}}return this};F.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "source":this.source=c.textContent;break;case "minfilter":this.minfilter=c.textContent;break;case "magfilter":this.magfilter=
|
|
|
-c.textContent;break;case "mipfilter":this.mipfilter=c.textContent;break;case "wrap_s":this.wrap_s=c.textContent;break;case "wrap_t":this.wrap_t=c.textContent;break;default:console.log("unhandled Sampler2D prop: "+c.nodeName)}}return this};J.prototype.create=function(){if(this.shader==null)return null};J.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.shader=null;for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "profile_COMMON":this.parseTechnique(this.parseProfileCOMMON(c))}}return this};
|
|
|
-J.prototype.parseNewparam=function(a){for(var b=a.getAttribute("sid"),c=0;c<a.childNodes.length;c++){var e=a.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "surface":this.surface=(new B(this)).parse(e);this.surface.sid=b;break;case "sampler2D":this.sampler=(new F(this)).parse(e);this.sampler.sid=b;break;case "extra":break;default:console.log(e.nodeName)}}};J.prototype.parseProfileCOMMON=function(a){for(var b,c=0;c<a.childNodes.length;c++){var e=a.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "profile_COMMON":this.parseProfileCOMMON(e);
|
|
|
-break;case "technique":b=e;break;case "newparam":this.parseNewparam(e);break;case "extra":break;default:console.log(e.nodeName)}}return b};J.prototype.parseTechnique=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "lambert":case "blinn":case "phong":this.shader=(new K(c.nodeName,this)).parse(c)}}};M.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");return this};N.prototype.parse=function(a){this.id=a.getAttribute("id");
|
|
|
-this.name=a.getAttribute("name");this.source={};for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "source":c=(new E).parse(c);this.source[c.id]=c;break;case "sampler":this.sampler.push((new P(this)).parse(c));break;case "channel":this.channel.push((new L(this)).parse(c))}}return this};L.prototype.parse=function(a){this.source=a.getAttribute("source").replace(/^#/,"");this.target=a.getAttribute("target");var b=this.target.split("/");b.shift();var a=
|
|
|
-b.shift(),c=a.indexOf(".")>=0,e=a.indexOf("(")>=0,f,h;if(c)b=a.split("."),a=b.shift(),h=b.shift();else if(e){f=a.split("(");a=f.shift();for(b=0;b<f.length;b++)f[b]=parseInt(f[b].replace(/\)/,""))}this.sid=a;this.dotSyntax=c;this.arrSyntax=e;this.arrIndices=f;this.member=h;return this};P.prototype.parse=function(a){this.id=a.getAttribute("id");this.inputs=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "input":this.inputs.push((new C).parse(c))}}return this};
|
|
|
-P.prototype.create=function(){for(var a=0;a<this.inputs.length;a++){var b=this.inputs[a],c=this.animation.source[b.source];switch(b.semantic){case "INPUT":this.input=c.read();break;case "OUTPUT":this.output=c.read();break;case "INTERPOLATION":this.interpolation=c.read();break;case "IN_TANGENT":break;case "OUT_TANGENT":break;default:console.log(b.semantic)}}this.duration=this.endTime=this.startTime=0;if(this.input.length){this.startTime=1E8;this.endTime=-1E8;for(a=0;a<this.input.length;a++)this.startTime=
|
|
|
-Math.min(this.startTime,this.input[a]),this.endTime=Math.max(this.endTime,this.input[a]);this.duration=this.endTime-this.startTime}};return{load:function(b,c){if(document.implementation&&document.implementation.createDocument){document.implementation.createDocument("http://www.collada.org/2005/11/COLLADASchema","COLLADA",null);b+="?rnd="+Math.random();var e=new XMLHttpRequest;e.overrideMimeType&&e.overrideMimeType("text/xml");e.onreadystatechange=function(){if(e.readyState==4&&(e.status==0||e.status==
|
|
|
-200))$=c,a(e.responseXML,void 0,b)};e.open("GET",b,!0);e.send(null)}else alert("Don't know how to parse XML!")},parse:a,setPreferredShading:function(a){ka=a},applySkin:g,geometries:ba}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;
|
|
|
-THREE.JSONLoader.prototype.load=function(a,c,b){var e,g=this;if(a instanceof Object)console.warn("DEPRECATED: JSONLoader( parameters ) is now JSONLoader( url, callback, texturePath )."),e=a,a=e.model,c=e.callback,b=e.texture_path;e=new Worker(a);b=b?b:this.extractUrlbase(a);e.onmessage=function(a){g.createModel(a.data,c,b);g.onLoadComplete()};this.onLoadStart();e.postMessage(Date.now())};
|
|
|
-THREE.JSONLoader.prototype.createModel=function(a,c,b){var e=new THREE.Geometry,g=a.scale!==void 0?1/a.scale:1;this.initMaterials(e,a.materials,b);(function(b){if(a.version===void 0||a.version!=2)console.error("Deprecated file format.");else{var c,g,l,m,n,o,u,p,z,w,x,v,y,t,A=a.faces;o=a.vertices;var D=a.normals,C=a.colors,E=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&E++;for(c=0;c<E;c++)e.faceUvs[c]=[],e.faceVertexUvs[c]=[];m=0;for(n=o.length;m<n;)u=new THREE.Vertex,u.position.x=o[m++]*b,u.position.y=
|
|
|
-o[m++]*b,u.position.z=o[m++]*b,e.vertices.push(u);m=0;for(n=A.length;m<n;){b=A[m++];o=b&1;l=b&2;c=b&4;g=b&8;p=b&16;u=b&32;w=b&64;b&=128;o?(x=new THREE.Face4,x.a=A[m++],x.b=A[m++],x.c=A[m++],x.d=A[m++],o=4):(x=new THREE.Face3,x.a=A[m++],x.b=A[m++],x.c=A[m++],o=3);if(l)l=A[m++],x.materialIndex=l;l=e.faces.length;if(c)for(c=0;c<E;c++)v=a.uvs[c],z=A[m++],t=v[z*2],z=v[z*2+1],e.faceUvs[c][l]=new THREE.UV(t,z);if(g)for(c=0;c<E;c++){v=a.uvs[c];y=[];for(g=0;g<o;g++)z=A[m++],t=v[z*2],z=v[z*2+1],y[g]=new THREE.UV(t,
|
|
|
-z);e.faceVertexUvs[c][l]=y}if(p)p=A[m++]*3,g=new THREE.Vector3,g.x=D[p++],g.y=D[p++],g.z=D[p],x.normal=g;if(u)for(c=0;c<o;c++)p=A[m++]*3,g=new THREE.Vector3,g.x=D[p++],g.y=D[p++],g.z=D[p],x.vertexNormals.push(g);if(w)u=A[m++],u=new THREE.Color(C[u]),x.color=u;if(b)for(c=0;c<o;c++)u=A[m++],u=new THREE.Color(C[u]),x.vertexColors.push(u);e.faces.push(x)}}})(g);(function(){var b,c,g,l;if(a.skinWeights){b=0;for(c=a.skinWeights.length;b<c;b+=2)g=a.skinWeights[b],l=a.skinWeights[b+1],e.skinWeights.push(new THREE.Vector4(g,
|
|
|
-l,0,0))}if(a.skinIndices){b=0;for(c=a.skinIndices.length;b<c;b+=2)g=a.skinIndices[b],l=a.skinIndices[b+1],e.skinIndices.push(new THREE.Vector4(g,l,0,0))}e.bones=a.bones;e.animation=a.animation})();(function(b){if(a.morphTargets!==void 0){var c,g,l,m,n,o,u,p,z;c=0;for(g=a.morphTargets.length;c<g;c++){e.morphTargets[c]={};e.morphTargets[c].name=a.morphTargets[c].name;e.morphTargets[c].vertices=[];p=e.morphTargets[c].vertices;z=a.morphTargets[c].vertices;l=0;for(m=z.length;l<m;l+=3)n=z[l]*b,o=z[l+1]*
|
|
|
-b,u=z[l+2]*b,p.push(new THREE.Vertex(new THREE.Vector3(n,o,u)))}}if(a.morphColors!==void 0){c=0;for(g=a.morphColors.length;c<g;c++){e.morphColors[c]={};e.morphColors[c].name=a.morphColors[c].name;e.morphColors[c].colors=[];m=e.morphColors[c].colors;n=a.morphColors[c].colors;b=0;for(l=n.length;b<l;b+=3)o=new THREE.Color(16755200),o.setRGB(n[b],n[b+1],n[b+2]),m.push(o)}}})(g);e.computeCentroids();e.computeFaceNormals();this.hasNormals(e)&&e.computeTangents();c(e)};
|
|
|
+THREE.BinaryLoader.prototype.load=function(a,c,b,d){if(a instanceof Object){console.warn("DEPRECATED: BinaryLoader( parameters ) is now BinaryLoader( url, callback, texturePath, binaryPath ).");var f=a,a=f.model,c=f.callback,b=f.texture_path,d=f.bin_path}var b=b?b:this.extractUrlbase(a),d=d?d:this.extractUrlbase(a),f=Date.now(),a=new Worker(a),g=this.showProgress?THREE.Loader.prototype.updateProgress:null;a.onmessage=function(a){THREE.BinaryLoader.prototype.loadAjaxBuffers(a.data.buffers,a.data.materials,
|
|
|
+c,d,b,g)};a.onerror=function(a){alert("worker.onerror: "+a.message+"\n"+a.data);a.preventDefault()};a.postMessage(f)};
|
|
|
+THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,c,b,d,f,g){var e=new XMLHttpRequest,h=d+"/"+a,i=0;e.onreadystatechange=function(){e.readyState==4?e.status==200||e.status==0?THREE.BinaryLoader.prototype.createBinModel(e.responseText,b,f,c):alert("Couldn't load ["+h+"] ["+e.status+"]"):e.readyState==3?g&&(i==0&&(i=e.getResponseHeader("Content-Length")),g({total:i,loaded:e.responseText.length})):e.readyState==2&&(i=e.getResponseHeader("Content-Length"))};e.open("GET",h,!0);e.overrideMimeType("text/plain; charset=x-user-defined");
|
|
|
+e.setRequestHeader("Content-Type","text/plain");e.send(null)};
|
|
|
+THREE.BinaryLoader.prototype.createBinModel=function(a,c,b,d){var f=function(b){function c(a,b){var d=k(a,b),e=k(a,b+1),g=k(a,b+2),f=k(a,b+3),h=(f<<1&255|g>>7)-127;d|=(g&127)<<16|e<<8;if(d==0&&h==-127)return 0;return(1-2*(f>>7))*(1+d*Math.pow(2,-23))*Math.pow(2,h)}function f(a,b){var c=k(a,b),d=k(a,b+1),e=k(a,b+2);return(k(a,b+3)<<24)+(e<<16)+(d<<8)+c}function i(a,b){var c=k(a,b);return(k(a,b+1)<<8)+c}function j(a,b){var c=k(a,b);return c>127?c-256:c}function k(a,b){return a.charCodeAt(b)&255}function m(b){var c,
|
|
|
+d,e;c=f(a,b);d=f(a,b+x);e=f(a,b+y);b=i(a,b+C);p.faces.push(new THREE.Face3(c,d,e,null,null,b))}function o(b){var c,d,e,g,j,k,m;c=f(a,b);d=f(a,b+x);e=f(a,b+y);g=i(a,b+C);j=f(a,b+A);k=f(a,b+E);m=f(a,b+u);var b=v[k*3],l=v[k*3+1];k=v[k*3+2];var n=v[m*3],o=v[m*3+1];m=v[m*3+2];p.faces.push(new THREE.Face3(c,d,e,[new THREE.Vector3(v[j*3],v[j*3+1],v[j*3+2]),new THREE.Vector3(b,l,k),new THREE.Vector3(n,o,m)],null,g))}function n(b){var c,d,e,g;c=f(a,b);d=f(a,b+G);e=f(a,b+D);g=f(a,b+H);b=i(a,b+B);p.faces.push(new THREE.Face4(c,
|
|
|
+d,e,g,null,null,b))}function t(b){var c,d,e,g,j,k,m,l,n;c=f(a,b);d=f(a,b+G);e=f(a,b+D);g=f(a,b+H);j=i(a,b+B);k=f(a,b+F);m=f(a,b+J);l=f(a,b+N);n=f(a,b+M);var b=v[m*3],o=v[m*3+1];m=v[m*3+2];var fa=v[l*3],ga=v[l*3+1];l=v[l*3+2];var ha=v[n*3],q=v[n*3+1];n=v[n*3+2];p.faces.push(new THREE.Face4(c,d,e,g,[new THREE.Vector3(v[k*3],v[k*3+1],v[k*3+2]),new THREE.Vector3(b,o,m),new THREE.Vector3(fa,ga,l),new THREE.Vector3(ha,q,n)],null,j))}function q(b){var c,d,e,g;c=f(a,b);d=f(a,b+O);e=f(a,b+z);b=w[c*2];g=w[c*
|
|
|
+2+1];c=w[d*2];var i=p.faceVertexUvs[0];d=w[d*2+1];var j=w[e*2];e=w[e*2+1];var k=[];k.push(new THREE.UV(b,g));k.push(new THREE.UV(c,d));k.push(new THREE.UV(j,e));i.push(k)}function r(b){var c,d,e,g,i,j;c=f(a,b);d=f(a,b+K);e=f(a,b+I);g=f(a,b+L);b=w[c*2];i=w[c*2+1];c=w[d*2];j=w[d*2+1];d=w[e*2];var k=p.faceVertexUvs[0];e=w[e*2+1];var m=w[g*2];g=w[g*2+1];var l=[];l.push(new THREE.UV(b,i));l.push(new THREE.UV(c,j));l.push(new THREE.UV(d,e));l.push(new THREE.UV(m,g));k.push(l)}var p=this,s=0,l,v=[],w=[],
|
|
|
+x,y,C,A,E,u,G,D,H,B,F,J,N,M,O,z,K,I,L,R,P,T,S,U,Q;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(p,d,b);l={signature:a.substr(s,8),header_bytes:k(a,s+8),vertex_coordinate_bytes:k(a,s+9),normal_coordinate_bytes:k(a,s+10),uv_coordinate_bytes:k(a,s+11),vertex_index_bytes:k(a,s+12),normal_index_bytes:k(a,s+13),uv_index_bytes:k(a,s+14),material_index_bytes:k(a,s+15),nvertices:f(a,s+16),nnormals:f(a,s+16+4),nuvs:f(a,s+16+8),ntri_flat:f(a,s+16+12),ntri_smooth:f(a,s+16+16),ntri_flat_uv:f(a,
|
|
|
+s+16+20),ntri_smooth_uv:f(a,s+16+24),nquad_flat:f(a,s+16+28),nquad_smooth:f(a,s+16+32),nquad_flat_uv:f(a,s+16+36),nquad_smooth_uv:f(a,s+16+40)};s+=l.header_bytes;x=l.vertex_index_bytes;y=l.vertex_index_bytes*2;C=l.vertex_index_bytes*3;A=l.vertex_index_bytes*3+l.material_index_bytes;E=l.vertex_index_bytes*3+l.material_index_bytes+l.normal_index_bytes;u=l.vertex_index_bytes*3+l.material_index_bytes+l.normal_index_bytes*2;G=l.vertex_index_bytes;D=l.vertex_index_bytes*2;H=l.vertex_index_bytes*3;B=l.vertex_index_bytes*
|
|
|
+4;F=l.vertex_index_bytes*4+l.material_index_bytes;J=l.vertex_index_bytes*4+l.material_index_bytes+l.normal_index_bytes;N=l.vertex_index_bytes*4+l.material_index_bytes+l.normal_index_bytes*2;M=l.vertex_index_bytes*4+l.material_index_bytes+l.normal_index_bytes*3;O=l.uv_index_bytes;z=l.uv_index_bytes*2;K=l.uv_index_bytes;I=l.uv_index_bytes*2;L=l.uv_index_bytes*3;b=l.vertex_index_bytes*3+l.material_index_bytes;Q=l.vertex_index_bytes*4+l.material_index_bytes;R=l.ntri_flat*b;P=l.ntri_smooth*(b+l.normal_index_bytes*
|
|
|
+3);T=l.ntri_flat_uv*(b+l.uv_index_bytes*3);S=l.ntri_smooth_uv*(b+l.normal_index_bytes*3+l.uv_index_bytes*3);U=l.nquad_flat*Q;b=l.nquad_smooth*(Q+l.normal_index_bytes*4);Q=l.nquad_flat_uv*(Q+l.uv_index_bytes*4);s+=function(b){for(var d,g,f,h=l.vertex_coordinate_bytes*3,i=b+l.nvertices*h;b<i;b+=h)d=c(a,b),g=c(a,b+l.vertex_coordinate_bytes),f=c(a,b+l.vertex_coordinate_bytes*2),p.vertices.push(new THREE.Vertex(new THREE.Vector3(d,g,f)));return l.nvertices*h}(s);s+=function(b){for(var c,d,e,g=l.normal_coordinate_bytes*
|
|
|
+3,f=b+l.nnormals*g;b<f;b+=g)c=j(a,b),d=j(a,b+l.normal_coordinate_bytes),e=j(a,b+l.normal_coordinate_bytes*2),v.push(c/127,d/127,e/127);return l.nnormals*g}(s);s+=function(b){for(var d,g,f=l.uv_coordinate_bytes*2,h=b+l.nuvs*f;b<h;b+=f)d=c(a,b),g=c(a,b+l.uv_coordinate_bytes),w.push(d,g);return l.nuvs*f}(s);R=s+R;P=R+P;T=P+T;S=T+S;U=S+U;b=U+b;Q=b+Q;(function(a){var b,c=l.vertex_index_bytes*3+l.material_index_bytes,d=c+l.uv_index_bytes*3,e=a+l.ntri_flat_uv*d;for(b=a;b<e;b+=d)m(b),q(b+c);return e-a})(P);
|
|
|
+(function(a){var b,c=l.vertex_index_bytes*3+l.material_index_bytes+l.normal_index_bytes*3,d=c+l.uv_index_bytes*3,e=a+l.ntri_smooth_uv*d;for(b=a;b<e;b+=d)o(b),q(b+c);return e-a})(T);(function(a){var b,c=l.vertex_index_bytes*4+l.material_index_bytes,d=c+l.uv_index_bytes*4,e=a+l.nquad_flat_uv*d;for(b=a;b<e;b+=d)n(b),r(b+c);return e-a})(b);(function(a){var b,c=l.vertex_index_bytes*4+l.material_index_bytes+l.normal_index_bytes*4,d=c+l.uv_index_bytes*4,e=a+l.nquad_smooth_uv*d;for(b=a;b<e;b+=d)t(b),r(b+
|
|
|
+c);return e-a})(Q);(function(a){var b,c=l.vertex_index_bytes*3+l.material_index_bytes,d=a+l.ntri_flat*c;for(b=a;b<d;b+=c)m(b);return d-a})(s);(function(a){var b,c=l.vertex_index_bytes*3+l.material_index_bytes+l.normal_index_bytes*3,d=a+l.ntri_smooth*c;for(b=a;b<d;b+=c)o(b);return d-a})(R);(function(a){var b,c=l.vertex_index_bytes*4+l.material_index_bytes,d=a+l.nquad_flat*c;for(b=a;b<d;b+=c)n(b);return d-a})(S);(function(a){var b,c=l.vertex_index_bytes*4+l.material_index_bytes+l.normal_index_bytes*
|
|
|
+4,d=a+l.nquad_smooth*c;for(b=a;b<d;b+=c)t(b);return d-a})(U);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};f.prototype=new THREE.Geometry;f.prototype.constructor=f;c(new f(b))};
|
|
|
+THREE.ColladaLoader=function(){function a(a,d,f){P=a;d=d||U;f!==void 0&&(a=f.split("/"),a.pop(),da=a.length<1?"":a.join("/")+"/");$=c("//dae:library_images/dae:image",e,"image");aa=c("//dae:library_materials/dae:material",C,"material");ba=c("//dae:library_effects/dae:effect",D,"effect");W=c("//dae:library_geometries/dae:geometry",r,"geometry");V=c("//dae:library_controllers/dae:controller",h,"controller");X=c("//dae:library_animations/dae:animation",B,"animation");ca=c(".//dae:library_visual_scenes/dae:visual_scene",
|
|
|
+k,"visual_scene");Y=[];Z=[];(a=P.evaluate(".//dae:scene/dae:instance_visual_scene",P,M,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(a=a.getAttribute("url").replace(/^#/,""),S=ca[a]):S=null;T=new THREE.Object3D;for(a=0;a<S.nodes.length;a++)T.add(g(S.nodes[a]));b();for(var i in X);i={scene:T,morphs:Y,skins:Z,dae:{images:$,materials:aa,effects:ba,geometries:W,controllers:V,animations:X,visualScenes:ca,scene:S}};d&&d(i);return i}function c(a,b,c){for(var a=P.evaluate(a,P,M,XPathResult.ORDERED_NODE_ITERATOR_TYPE,
|
|
|
+null),d={},e=a.iterateNext(),g=0;e;){e=(new b).parse(e);if(e.id.length==0)e.id=c+g++;d[e.id]=e;e=a.iterateNext()}return d}function b(){var a=1E6,b=-a,c=0,d;for(d in X)for(var e=X[d],g=0;g<e.sampler.length;g++){var f=e.sampler[g];f.create();a=Math.min(a,f.startTime);b=Math.max(b,f.endTime);c=Math.max(c,f.input.length)}return{start:a,end:b,frames:c}}function d(a,b,c,e){a.world=a.world||new THREE.Matrix4;a.world.copy(a.matrix);if(a.channels&&a.channels.length){var g=a.channels[0].sampler.output[c];g instanceof
|
|
|
+THREE.Matrix4&&a.world.copy(g)}e&&a.world.multiply(e,a.world);b.push(a);for(e=0;e<a.nodes.length;e++)d(a.nodes[e],b,c,a.world)}function f(a,c,e){var g=V[c.url];if(!g||!g.skin)console.log("ColladaLoader: Could not find skin controller.");else if(!c.skeleton||!c.skeleton.length)console.log("ColladaLoader: Could not find the skeleton for the skin. ");else{var f=b(),c=S.getChildById(c.skeleton[0],!0)||S.getChildBySid(c.skeleton[0],!0),h,i,j,k,m=new THREE.Vector3,l;for(h=0;h<a.vertices.length;h++)g.skin.bindShapeMatrix.multiplyVector3(a.vertices[h].position);
|
|
|
+for(e=0;e<f.frames;e++){var n=[],o=[];for(h=0;h<a.vertices.length;h++)o.push(new THREE.Vertex(new THREE.Vector3));d(c,n,e);h=n;i=g.skin;for(k=0;k<h.length;k++)if(j=h[k],l=-1,j.type=="JOINT"){for(var p=0;p<i.joints.length;p++)if(j.sid==i.joints[p]){l=p;break}if(l>=0){p=i.invBindMatrices[l];j.invBindMatrix=p;j.skinningMatrix=new THREE.Matrix4;j.skinningMatrix.multiply(j.world,p);j.weights=[];for(p=0;p<i.weights.length;p++)for(var q=0;q<i.weights[p].length;q++){var r=i.weights[p][q];r.joint==l&&j.weights.push(r)}}else throw"ColladaLoader: Could not find joint '"+
|
|
|
+j.sid+"'.";}for(h=0;h<n.length;h++)if(n[h].type=="JOINT")for(i=0;i<n[h].weights.length;i++)j=n[h].weights[i],k=j.index,j=j.weight,l=a.vertices[k],k=o[k],m.x=l.position.x,m.y=l.position.y,m.z=l.position.z,n[h].skinningMatrix.multiplyVector3(m),k.position.x+=m.x*j,k.position.y+=m.y*j,k.position.z+=m.z*j;a.morphTargets.push({name:"target_"+e,vertices:o})}}}function g(a){var b=new THREE.Object3D,c,d,e,h;for(e=0;e<a.controllers.length;e++){var i=V[a.controllers[e].url];switch(i.type){case "skin":if(W[i.skin.source]){var j=
|
|
|
+new q;j.url=i.skin.source;j.instance_material=a.controllers[e].instance_material;a.geometries.push(j);c=a.controllers[e]}else if(V[i.skin.source]&&(d=i=V[i.skin.source],i.morph&&W[i.morph.source]))j=new q,j.url=i.morph.source,j.instance_material=a.controllers[e].instance_material,a.geometries.push(j);break;case "morph":if(W[i.morph.source])j=new q,j.url=i.morph.source,j.instance_material=a.controllers[e].instance_material,a.geometries.push(j),d=a.controllers[e];console.log("ColladaLoader: Morph-controller partially supported.")}}for(e=
|
|
|
+0;e<a.geometries.length;e++){var i=a.geometries[e],j=i.instance_material,i=W[i.url],k={},m=0,l;if(i&&i.mesh&&i.mesh.primitives){if(b.name.length==0)b.name=i.id;if(j)for(h=0;h<j.length;h++){l=j[h];var o=ba[aa[l.target].instance_effect.url].shader;o.material.opacity=!o.material.opacity?1:o.material.opacity;l=k[l.symbol]=o.material;m++}j=l||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});i=i.mesh.geometry3js;if(m>1){j=new THREE.MeshFaceMaterial;for(h=0;h<i.faces.length;h++)m=
|
|
|
+i.faces[h],m.materials=[k[m.daeMaterial]]}if(c!==void 0)f(i,c),j.morphTargets=!0,j=new THREE.SkinnedMesh(i,j),j.skeleton=c.skeleton,j.skinController=V[c.url],j.skinInstanceController=c,j.name="skin_"+Z.length,Z.push(j);else if(d!==void 0){h=i;k=d instanceof n?V[d.url]:d;if(!k||!k.morph)console.log("could not find morph controller!");else{k=k.morph;for(m=0;m<k.targets.length;m++)if(o=W[k.targets[m]],o.mesh&&o.mesh.primitives&&o.mesh.primitives.length)o=o.mesh.primitives[0].geometry,o.vertices.length===
|
|
|
+h.vertices.length&&h.morphTargets.push({name:"target_1",vertices:o.vertices});h.morphTargets.push({name:"target_Z",vertices:h.vertices})}j.morphTargets=!0;j=new THREE.Mesh(i,j);j.name="morph_"+Y.length;Y.push(j)}else j=new THREE.Mesh(i,j);a.geometries.length>1?b.add(j):b=j}}b.name=a.id||"";a.matrix.decompose(b.position,b.rotation,b.scale);for(e=0;e<a.nodes.length;e++)b.add(g(a.nodes[e],a));return b}function e(){this.init_from=this.id=""}function h(){this.type=this.name=this.id="";this.morph=this.skin=
|
|
|
+null}function i(){this.weights=this.targets=this.source=this.method=null}function j(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function k(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function m(){this.sid=this.name=this.id="";this.nodes=[];this.controllers=[];this.transforms=[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function o(){this.type=this.sid="";this.data=[];this.matrix=new THREE.Matrix4}function n(){this.url=
|
|
|
+"";this.skeleton=[];this.instance_material=[]}function t(){this.target=this.symbol=""}function q(){this.url="";this.instance_material=[]}function r(){this.id="";this.mesh=null}function p(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function s(){}function l(){this.material="";this.count=0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function v(){this.source="";this.stride=this.count=0;this.params=[]}function w(){this.input={}}function x(){this.semantic=
|
|
|
+"";this.offset=0;this.source="";this.set=0}function y(a){this.id=a;this.type=null}function C(){this.name=this.id="";this.instance_effect=null}function A(){this.color=new THREE.Color(0);this.color.setRGB(Math.random(),Math.random(),Math.random());this.color.a=1;this.texcoord=this.texture=null}function E(a,b){this.type=a;this.effect=b;this.material=null}function u(a){this.effect=a;this.format=this.init_from=null}function G(a){this.effect=a;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=
|
|
|
+this.source=null}function D(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function H(){this.url=""}function B(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function F(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=this.dotSyntax=this.sid=null}function J(a){this.id="";this.animation=a;this.inputs=[];this.endTime=this.startTime=this.interpolation=this.output=this.input=null;this.duration=0}function N(a){var b=a.getAttribute("id");
|
|
|
+if(Q[b]!=void 0)return Q[b];Q[b]=(new y(b)).parse(a);return Q[b]}function M(a){if(a=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function O(a){for(var a=K(a).split(/\s+/),b=[],c=0;c<a.length;c++)b.push(parseFloat(a[c]));return b}function z(a){for(var a=K(a).split(/\s+/),b=[],c=0;c<a.length;c++)b.push(parseInt(a[c],10));return b}function K(a){return a.replace(/^\s+/,"").replace(/\s+$/,"")}function I(a,b,c){return a.hasAttribute(b)?parseInt(a.getAttribute(b),10):c}function L(a,
|
|
|
+b){if(a===void 0){for(var c="0.";c.length<b+2;)c+="0";return c}b=b||2;c=a.toString().split(".");for(c[1]=c.length>1?c[1].substr(0,b):"0";c[1].length<b;)c[1]+="0";return c.join(".")}function R(a,b){var c="";c+=L(a.x,b)+",";c+=L(a.y,b)+",";c+=L(a.z,b);return c}var P=null,T=null,S,U=null,Q={},$={},X={},V={},W={},aa={},ba={},ca,da,Y,Z,ea=THREE.SmoothShading;e.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName=="init_from")this.init_from=
|
|
|
+c.textContent}return this};h.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.type="none";for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "skin":this.skin=(new j).parse(c);this.type=c.nodeName;break;case "morph":this.morph=(new i).parse(c),this.type=c.nodeName}}return this};i.prototype.parse=function(a){var b={},c=[],d;this.method=a.getAttribute("method");this.source=a.getAttribute("source").replace(/^#/,"");for(d=
|
|
|
+0;d<a.childNodes.length;d++){var e=a.childNodes[d];if(e.nodeType==1)switch(e.nodeName){case "source":e=(new y).parse(e);b[e.id]=e;break;case "targets":c=this.parseInputs(e);break;default:console.log(e.nodeName)}}for(d=0;d<c.length;d++)switch(a=c[d],e=b[a.source],a.semantic){case "MORPH_TARGET":this.targets=e.read();break;case "MORPH_WEIGHT":this.weights=e.read()}return this};i.prototype.parseInputs=function(a){for(var b=[],c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "input":b.push((new x).parse(d))}}return b};
|
|
|
+j.prototype.parse=function(a){var b={},c,d;this.source=a.getAttribute("source").replace(/^#/,"");this.invBindMatrices=[];this.joints=[];this.weights=[];for(var e=0;e<a.childNodes.length;e++){var g=a.childNodes[e];if(g.nodeType==1)switch(g.nodeName){case "bind_shape_matrix":g=O(g.textContent);this.bindShapeMatrix=new THREE.Matrix4;this.bindShapeMatrix.set(g[0],g[1],g[2],g[3],g[4],g[5],g[6],g[7],g[8],g[9],g[10],g[11],g[12],g[13],g[14],g[15]);break;case "source":g=(new y).parse(g);b[g.id]=g;break;case "joints":c=
|
|
|
+g;break;case "vertex_weights":d=g;break;default:console.log(g.nodeName)}}this.parseJoints(c,b);this.parseWeights(d,b);return this};j.prototype.parseJoints=function(a,b){for(var c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "input":var d=(new x).parse(d),e=b[d.source];if(d.semantic=="JOINT")this.joints=e.read();else if(d.semantic=="INV_BIND_MATRIX")this.invBindMatrices=e.read()}}};j.prototype.parseWeights=function(a,b){for(var c,d,e=[],g=0;g<a.childNodes.length;g++){var f=
|
|
|
+a.childNodes[g];if(f.nodeType==1)switch(f.nodeName){case "input":e.push((new x).parse(f));break;case "v":c=z(f.textContent);break;case "vcount":d=z(f.textContent)}}for(g=f=0;g<d.length;g++){for(var h=d[g],i=[],j=0;j<h;j++){for(var k={},m=0;m<e.length;m++){var l=e[m],n=c[f+l.offset];switch(l.semantic){case "JOINT":k.joint=n;break;case "WEIGHT":k.weight=b[l.source].data[n]}}i.push(k);f+=e.length}for(j=0;j<i.length;j++)i[j].index=g;this.weights.push(i)}};k.prototype.getChildById=function(a,b){for(var c=
|
|
|
+0;c<this.nodes.length;c++){var d=this.nodes[c].getChildById(a,b);if(d)return d}return null};k.prototype.getChildBySid=function(a,b){for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildBySid(a,b);if(d)return d}return null};k.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.nodes=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "node":this.nodes.push((new m).parse(c))}}return this};m.prototype.getChannelForTransform=
|
|
|
+function(a){for(var b=0;b<this.channels.length;b++){var c=this.channels[b],d=c.target.split("/");d.shift();var e=d.shift(),g=e.indexOf(".")>=0,f=e.indexOf("(")>=0,h;if(g)d=e.split("."),e=d.shift(),d.shift();else if(f){h=e.split("(");e=h.shift();for(d=0;d<h.length;d++)h[d]=parseInt(h[d].replace(/\)/,""))}if(e==a)return c.info={sid:e,dotSyntax:g,arrSyntax:f,arrIndices:h},c}return null};m.prototype.getChildById=function(a,b){if(this.id==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildById(a,
|
|
|
+b);if(d)return d}return null};m.prototype.getChildBySid=function(a,b){if(this.sid==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildBySid(a,b);if(d)return d}return null};m.prototype.getTransformBySid=function(a){for(var b=0;b<this.transforms.length;b++)if(this.transforms[b].sid==a)return this.transforms[b];return null};m.prototype.parse=function(a){var b;this.id=a.getAttribute("id");this.sid=a.getAttribute("sid");this.name=a.getAttribute("name");this.type=a.getAttribute("type");
|
|
|
+this.type=this.type=="JOINT"?this.type:"NODE";this.nodes=[];this.transforms=[];this.geometries=[];this.controllers=[];this.matrix=new THREE.Matrix4;for(var c=0;c<a.childNodes.length;c++)if(b=a.childNodes[c],b.nodeType==1)switch(b.nodeName){case "node":this.nodes.push((new m).parse(b));break;case "instance_camera":break;case "instance_controller":this.controllers.push((new n).parse(b));break;case "instance_geometry":this.geometries.push((new q).parse(b));break;case "instance_light":break;case "instance_node":b=
|
|
|
+b.getAttribute("url").replace(/^#/,"");(b=P.evaluate(".//dae:library_nodes//dae:node[@id='"+b+"']",P,M,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new m).parse(b));break;case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new o).parse(b));break;case "extra":break;default:console.log(b.nodeName)}a=[];c=1E6;b=-1E6;for(var d in X)for(var e=X[d],g=0;g<e.channel.length;g++){var f=e.channel[g],h=e.sampler[g];d=f.target.split("/")[0];
|
|
|
+if(d==this.id)h.create(),f.sampler=h,c=Math.min(c,h.startTime),b=Math.max(b,h.endTime),a.push(f)}if(a.length)this.startTime=c,this.endTime=b;if((this.channels=a)&&this.channels.length){d=1E7;for(a=0;a<this.channels.length;a++){c=this.channels[a].sampler;for(b=0;b<c.input.length-1;b++)d=Math.min(d,c.input[b+1]-c.input[b])}c=[];for(a=this.startTime;a<this.endTime;a+=d){b=a;for(var e={},i=g=void 0,g=0;g<this.channels.length;g++)i=this.channels[g],e[i.sid]=i;f=new THREE.Matrix4;for(g=0;g<this.transforms.length;g++)if(h=
|
|
|
+this.transforms[g],i=e[h.sid],i!==void 0){for(var j=i.sampler,k,i=0;i<j.input.length-1;i++)if(j.input[i+1]>b){k=j.output[i];break}f=k!==void 0?k instanceof THREE.Matrix4?f.multiply(f,k):f.multiply(f,h.matrix):f.multiply(f,h.matrix)}else f=f.multiply(f,h.matrix);b=f;c.push({time:a,pos:[b.n14,b.n24,b.n34],rotq:[0,0,0,1],scl:[1,1,1]})}this.keys=c}this.updateMatrix();return this};m.prototype.updateMatrix=function(){this.matrix.identity();for(var a=0;a<this.transforms.length;a++)this.matrix.multiply(this.matrix,
|
|
|
+this.transforms[a].matrix)};o.prototype.parse=function(a){this.sid=a.getAttribute("sid");this.type=a.nodeName;this.data=O(a.textContent);this.updateMatrix();return this};o.prototype.updateMatrix=function(){var a=0;this.matrix.identity();switch(this.type){case "matrix":this.matrix.set(this.data[0],this.data[1],this.data[2],this.data[3],this.data[4],this.data[5],this.data[6],this.data[7],this.data[8],this.data[9],this.data[10],this.data[11],this.data[12],this.data[13],this.data[14],this.data[15]);break;
|
|
|
+case "translate":this.matrix.setTranslation(this.data[0],this.data[1],this.data[2]);break;case "rotate":a=this.data[3]*(Math.PI/180);this.matrix.setRotationAxis(new THREE.Vector3(this.data[0],this.data[1],this.data[2]),a);break;case "scale":this.matrix.setScale(this.data[0],this.data[1],this.data[2])}return this.matrix};n.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.skeleton=[];this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];
|
|
|
+if(c.nodeType==1)switch(c.nodeName){case "skeleton":this.skeleton.push(c.textContent.replace(/^#/,""));break;case "bind_material":if(c=P.evaluate(".//dae:instance_material",c,M,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(var d=c.iterateNext();d;)this.instance_material.push((new t).parse(d)),d=c.iterateNext()}}return this};t.prototype.parse=function(a){this.symbol=a.getAttribute("symbol");this.target=a.getAttribute("target").replace(/^#/,"");return this};q.prototype.parse=function(a){this.url=
|
|
|
+a.getAttribute("url").replace(/^#/,"");this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1&&c.nodeName=="bind_material"){if(a=P.evaluate(".//dae:instance_material",c,M,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(b=a.iterateNext();b;)this.instance_material.push((new t).parse(b)),b=a.iterateNext();break}}return this};r.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "mesh":this.mesh=
|
|
|
+(new p(this)).parse(c)}}return this};p.prototype.parse=function(a){function b(a,c){var d=R(a.position);e[d]===void 0&&(e[d]={v:a,index:c});return e[d]}this.primitives=[];var c;for(c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];switch(d.nodeName){case "source":N(d);break;case "vertices":this.vertices=(new w).parse(d);break;case "triangles":this.primitives.push((new l).parse(d));break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new s).parse(d))}}var e=
|
|
|
+{};this.geometry3js=new THREE.Geometry;d=Q[this.vertices.input.POSITION.source].data;for(a=c=0;c<d.length;c+=3,a++){var g=new THREE.Vertex(new THREE.Vector3(d[c],d[c+1],d[c+2]));b(g,a);this.geometry3js.vertices.push(g)}for(c=0;c<this.primitives.length;c++)a=this.primitives[c],a.setVertices(this.vertices),this.handlePrimitive(a,this.geometry3js,e);this.geometry3js.computeCentroids();this.geometry3js.computeFaceNormals();this.geometry3js.computeVertexNormals();this.geometry3js.computeBoundingBox();
|
|
|
+return this};p.prototype.handlePrimitive=function(a,b,c){var d=0,e,g,f=a.p,h=a.inputs,i,j,k,m,l=0,n=3,o=[];for(e=0;e<h.length;e++)switch(i=h[e],i.semantic){case "TEXCOORD":o.push(i.set)}for(;d<f.length;){var p=[],q=[],r={},t=[];a.vcount&&(n=a.vcount[l++]);for(e=0;e<n;e++)for(g=0;g<h.length;g++)switch(i=h[g],m=Q[i.source],j=f[d+e*h.length+i.offset],k=m.accessor.params.length,k*=j,i.semantic){case "VERTEX":i=R(b.vertices[j].position);p.push(c[i].index);break;case "NORMAL":q.push(new THREE.Vector3(m.data[k],
|
|
|
+m.data[k+1],m.data[k+2]));break;case "TEXCOORD":r[i.set]===void 0&&(r[i.set]=[]);r[i.set].push(new THREE.UV(m.data[k],m.data[k+1]));break;case "COLOR":t.push((new THREE.Color).setRGB(m.data[k],m.data[k+1],m.data[k+2]))}var s;n==3?s=new THREE.Face3(p[0],p[1],p[2],[q[0],q[1],q[2]],t.length?t:new THREE.Color):n==4&&(s=new THREE.Face4(p[0],p[1],p[2],p[3],[q[0],q[1],q[2],q[3]],t.length?t:new THREE.Color));s.daeMaterial=a.material;b.faces.push(s);for(g=0;g<o.length;g++)e=r[o[g]],b.faceVertexUvs[g].push([e[0],
|
|
|
+e[1],e[2]]);d+=h.length*n}};s.prototype=new l;s.prototype.constructor=s;l.prototype.setVertices=function(a){for(var b=0;b<this.inputs.length;b++)if(this.inputs[b].source==a.id)this.inputs[b].source=a.input.POSITION.source};l.prototype.parse=function(a){this.inputs=[];this.material=a.getAttribute("material");this.count=I(a,"count",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "input":this.inputs.push((new x).parse(a.childNodes[b]));break;case "vcount":this.vcount=
|
|
|
+z(c.textContent);break;case "p":this.p=z(c.textContent)}}return this};v.prototype.parse=function(a){this.params=[];this.source=a.getAttribute("source");this.count=I(a,"count",0);this.stride=I(a,"stride",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName=="param"){var d={};d.name=c.getAttribute("name");d.type=c.getAttribute("type");this.params.push(d)}}return this};w.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++)if(a.childNodes[b].nodeName==
|
|
|
+"input"){var c=(new x).parse(a.childNodes[b]);this.input[c.semantic]=c}return this};x.prototype.parse=function(a){this.semantic=a.getAttribute("semantic");this.source=a.getAttribute("source").replace(/^#/,"");this.set=I(a,"set",-1);this.offset=I(a,"offset",0);if(this.semantic=="TEXCOORD"&&this.set<0)this.set=0;return this};y.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "bool_array":for(var d=K(c.textContent).split(/\s+/),
|
|
|
+e=[],g=0;g<d.length;g++)e.push(d[g]=="true"||d[g]=="1"?!0:!1);this.data=e;this.type=c.nodeName;break;case "float_array":this.data=O(c.textContent);this.type=c.nodeName;break;case "int_array":this.data=z(c.textContent);this.type=c.nodeName;break;case "IDREF_array":case "Name_array":this.data=K(c.textContent).split(/\s+/);this.type=c.nodeName;break;case "technique_common":for(d=0;d<c.childNodes.length;d++)if(c.childNodes[d].nodeName=="accessor"){this.accessor=(new v).parse(c.childNodes[d]);break}}}return this};
|
|
|
+y.prototype.read=function(){var a=[],b=this.accessor.params[0];switch(b.type){case "IDREF":case "Name":case "name":case "float":return this.data;case "float4x4":for(b=0;b<this.data.length;b+=16){var c=this.data.slice(b,b+16),d=new THREE.Matrix4;d.set(c[0],c[1],c[2],c[3],c[4],c[5],c[6],c[7],c[8],c[9],c[10],c[11],c[12],c[13],c[14],c[15]);a.push(d)}break;default:console.log("ColladaLoader: Source: Read dont know how to read "+b.type+".")}return a};C.prototype.parse=function(a){this.id=a.getAttribute("id");
|
|
|
+this.name=a.getAttribute("name");for(var b=0;b<a.childNodes.length;b++)if(a.childNodes[b].nodeName=="instance_effect"){this.instance_effect=(new H).parse(a.childNodes[b]);break}return this};A.prototype.isColor=function(){return this.texture==null};A.prototype.isTexture=function(){return this.texture!=null};A.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "color":c=O(c.textContent);this.color=new THREE.Color(0);this.color.setRGB(c[0],
|
|
|
+c[1],c[2]);this.color.a=c[3];break;case "texture":this.texture=c.getAttribute("texture"),this.texcoord=c.getAttribute("texcoord")}}return this};E.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[c.nodeName]=(new A).parse(c);break;case "shininess":case "reflectivity":case "transparency":var d;d=P.evaluate(".//dae:float",c,M,XPathResult.ORDERED_NODE_ITERATOR_TYPE,
|
|
|
+null);for(var e=d.iterateNext(),g=[];e;)g.push(e),e=d.iterateNext();d=g;d.length>0&&(this[c.nodeName]=parseFloat(d[0].textContent))}}this.create();return this};E.prototype.create=function(){var a={},b=this.transparency!==void 0&&this.transparency<1,c;for(c in this)switch(c){case "ambient":case "emission":case "diffuse":case "specular":var d=this[c];if(d instanceof A)if(d.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid&&(d=$[this.effect.surface.init_from]))a.map=
|
|
|
+THREE.ImageUtils.loadTexture(da+d.init_from),a.map.wrapS=THREE.RepeatWrapping,a.map.wrapT=THREE.RepeatWrapping,a.map.repeat.x=1,a.map.repeat.y=-1}else c=="diffuse"?a.color=d.color.getHex():b||(a[c]=d.color.getHex());break;case "shininess":case "reflectivity":a[c]=this[c];break;case "transparency":if(b)a.transparent=!0,a.opacity=this[c],b=!0}a.shading=ea;return this.material=new THREE.MeshLambertMaterial(a)};u.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];
|
|
|
+if(c.nodeType==1)switch(c.nodeName){case "init_from":this.init_from=c.textContent;break;case "format":this.format=c.textContent;break;default:console.log("unhandled Surface prop: "+c.nodeName)}}return this};G.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "source":this.source=c.textContent;break;case "minfilter":this.minfilter=c.textContent;break;case "magfilter":this.magfilter=c.textContent;break;case "mipfilter":this.mipfilter=
|
|
|
+c.textContent;break;case "wrap_s":this.wrap_s=c.textContent;break;case "wrap_t":this.wrap_t=c.textContent;break;default:console.log("unhandled Sampler2D prop: "+c.nodeName)}}return this};D.prototype.create=function(){if(this.shader==null)return null};D.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.shader=null;for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "profile_COMMON":this.parseTechnique(this.parseProfileCOMMON(c))}}return this};
|
|
|
+D.prototype.parseNewparam=function(a){for(var b=a.getAttribute("sid"),c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "surface":this.surface=(new u(this)).parse(d);this.surface.sid=b;break;case "sampler2D":this.sampler=(new G(this)).parse(d);this.sampler.sid=b;break;case "extra":break;default:console.log(d.nodeName)}}};D.prototype.parseProfileCOMMON=function(a){for(var b,c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "profile_COMMON":this.parseProfileCOMMON(d);
|
|
|
+break;case "technique":b=d;break;case "newparam":this.parseNewparam(d);break;case "extra":break;default:console.log(d.nodeName)}}return b};D.prototype.parseTechnique=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "lambert":case "blinn":case "phong":this.shader=(new E(c.nodeName,this)).parse(c)}}};H.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");return this};B.prototype.parse=function(a){this.id=a.getAttribute("id");
|
|
|
+this.name=a.getAttribute("name");this.source={};for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "source":c=(new y).parse(c);this.source[c.id]=c;break;case "sampler":this.sampler.push((new J(this)).parse(c));break;case "channel":this.channel.push((new F(this)).parse(c))}}return this};F.prototype.parse=function(a){this.source=a.getAttribute("source").replace(/^#/,"");this.target=a.getAttribute("target");var b=this.target.split("/");b.shift();var a=
|
|
|
+b.shift(),c=a.indexOf(".")>=0,d=a.indexOf("(")>=0,e,g;if(c)b=a.split("."),a=b.shift(),g=b.shift();else if(d){e=a.split("(");a=e.shift();for(b=0;b<e.length;b++)e[b]=parseInt(e[b].replace(/\)/,""))}this.sid=a;this.dotSyntax=c;this.arrSyntax=d;this.arrIndices=e;this.member=g;return this};J.prototype.parse=function(a){this.id=a.getAttribute("id");this.inputs=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "input":this.inputs.push((new x).parse(c))}}return this};
|
|
|
+J.prototype.create=function(){for(var a=0;a<this.inputs.length;a++){var b=this.inputs[a],c=this.animation.source[b.source];switch(b.semantic){case "INPUT":this.input=c.read();break;case "OUTPUT":this.output=c.read();break;case "INTERPOLATION":this.interpolation=c.read();break;case "IN_TANGENT":break;case "OUT_TANGENT":break;default:console.log(b.semantic)}}this.duration=this.endTime=this.startTime=0;if(this.input.length){this.startTime=1E8;this.endTime=-1E8;for(a=0;a<this.input.length;a++)this.startTime=
|
|
|
+Math.min(this.startTime,this.input[a]),this.endTime=Math.max(this.endTime,this.input[a]);this.duration=this.endTime-this.startTime}};return{load:function(b,c){if(document.implementation&&document.implementation.createDocument){document.implementation.createDocument("http://www.collada.org/2005/11/COLLADASchema","COLLADA",null);b+="?rnd="+Math.random();var d=new XMLHttpRequest;d.overrideMimeType&&d.overrideMimeType("text/xml");d.onreadystatechange=function(){if(d.readyState==4&&(d.status==0||d.status==
|
|
|
+200))U=c,a(d.responseXML,void 0,b)};d.open("GET",b,!0);d.send(null)}else alert("Don't know how to parse XML!")},parse:a,setPreferredShading:function(a){ea=a},applySkin:f,geometries:W}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;
|
|
|
+THREE.JSONLoader.prototype.load=function(a,c,b){var d,f=this;if(a instanceof Object)console.warn("DEPRECATED: JSONLoader( parameters ) is now JSONLoader( url, callback, texturePath )."),d=a,a=d.model,c=d.callback,b=d.texture_path;d=new Worker(a);b=b?b:this.extractUrlbase(a);d.onmessage=function(a){f.createModel(a.data,c,b);f.onLoadComplete()};this.onLoadStart();d.postMessage(Date.now())};
|
|
|
+THREE.JSONLoader.prototype.createModel=function(a,c,b){var d=new THREE.Geometry,f=a.scale!==void 0?1/a.scale:1;this.initMaterials(d,a.materials,b);(function(b){if(a.version===void 0||a.version!=2)console.error("Deprecated file format.");else{var c,f,i,j,k,m,o,n,t,q,r,p,s,l,v=a.faces;m=a.vertices;var w=a.normals,x=a.colors,y=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&y++;for(c=0;c<y;c++)d.faceUvs[c]=[],d.faceVertexUvs[c]=[];j=0;for(k=m.length;j<k;)o=new THREE.Vertex,o.position.x=m[j++]*b,o.position.y=
|
|
|
+m[j++]*b,o.position.z=m[j++]*b,d.vertices.push(o);j=0;for(k=v.length;j<k;){b=v[j++];m=b&1;i=b&2;c=b&4;f=b&8;n=b&16;o=b&32;q=b&64;b&=128;m?(r=new THREE.Face4,r.a=v[j++],r.b=v[j++],r.c=v[j++],r.d=v[j++],m=4):(r=new THREE.Face3,r.a=v[j++],r.b=v[j++],r.c=v[j++],m=3);if(i)i=v[j++],r.materialIndex=i;i=d.faces.length;if(c)for(c=0;c<y;c++)p=a.uvs[c],t=v[j++],l=p[t*2],t=p[t*2+1],d.faceUvs[c][i]=new THREE.UV(l,t);if(f)for(c=0;c<y;c++){p=a.uvs[c];s=[];for(f=0;f<m;f++)t=v[j++],l=p[t*2],t=p[t*2+1],s[f]=new THREE.UV(l,
|
|
|
+t);d.faceVertexUvs[c][i]=s}if(n)n=v[j++]*3,f=new THREE.Vector3,f.x=w[n++],f.y=w[n++],f.z=w[n],r.normal=f;if(o)for(c=0;c<m;c++)n=v[j++]*3,f=new THREE.Vector3,f.x=w[n++],f.y=w[n++],f.z=w[n],r.vertexNormals.push(f);if(q)o=v[j++],o=new THREE.Color(x[o]),r.color=o;if(b)for(c=0;c<m;c++)o=v[j++],o=new THREE.Color(x[o]),r.vertexColors.push(o);d.faces.push(r)}}})(f);(function(){var b,c,f,i;if(a.skinWeights){b=0;for(c=a.skinWeights.length;b<c;b+=2)f=a.skinWeights[b],i=a.skinWeights[b+1],d.skinWeights.push(new THREE.Vector4(f,
|
|
|
+i,0,0))}if(a.skinIndices){b=0;for(c=a.skinIndices.length;b<c;b+=2)f=a.skinIndices[b],i=a.skinIndices[b+1],d.skinIndices.push(new THREE.Vector4(f,i,0,0))}d.bones=a.bones;d.animation=a.animation})();(function(b){if(a.morphTargets!==void 0){var c,f,i,j,k,m,o,n,t;c=0;for(f=a.morphTargets.length;c<f;c++){d.morphTargets[c]={};d.morphTargets[c].name=a.morphTargets[c].name;d.morphTargets[c].vertices=[];n=d.morphTargets[c].vertices;t=a.morphTargets[c].vertices;i=0;for(j=t.length;i<j;i+=3)k=t[i]*b,m=t[i+1]*
|
|
|
+b,o=t[i+2]*b,n.push(new THREE.Vertex(new THREE.Vector3(k,m,o)))}}if(a.morphColors!==void 0){c=0;for(f=a.morphColors.length;c<f;c++){d.morphColors[c]={};d.morphColors[c].name=a.morphColors[c].name;d.morphColors[c].colors=[];j=d.morphColors[c].colors;k=a.morphColors[c].colors;b=0;for(i=k.length;b<i;b+=3)m=new THREE.Color(16755200),m.setRGB(k[b],k[b+1],k[b+2]),j.push(m)}}})(f);d.computeCentroids();d.computeFaceNormals();this.hasNormals(d)&&d.computeTangents();c(d)};
|
|
|
THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};
|
|
|
-THREE.SceneLoader.prototype={load:function(a,c){var b=this,e=new Worker(a);e.postMessage(0);var g=THREE.Loader.prototype.extractUrlbase(a);e.onmessage=function(a){function e(a,b){return b=="relativeToHTML"?a:g+"/"+a}function k(){for(p in F.objects)if(!H.objects[p])if(y=F.objects[p],y.geometry!==void 0){if(C=H.geometries[y.geometry]){var a=!1;for(O=0;O<y.materials.length;O++)K=H.materials[y.materials[O]],a=K instanceof THREE.ShaderMaterial;a&&C.computeTangents();t=y.position;r=y.rotation;q=y.quaternion;
|
|
|
-s=y.scale;q=0;K.length==0&&(K=new THREE.MeshFaceMaterial);K.length>1&&(K=new THREE.MeshFaceMaterial);object=new THREE.Mesh(C,K);object.name=p;object.position.set(t[0],t[1],t[2]);q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=y.visible;H.scene.add(object);H.objects[p]=object;y.meshCollider&&(a=THREE.CollisionUtils.MeshColliderWBox(object),H.scene.collisions.colliders.push(a));if(y.castsShadow)a=
|
|
|
-new THREE.ShadowVolume(C),H.scene.add(a),a.position=object.position,a.rotation=object.rotation,a.scale=object.scale;y.trigger&&y.trigger.toLowerCase()!="none"&&(a={type:y.trigger,object:y},H.triggers[object.name]=a)}}else t=y.position,r=y.rotation,q=y.quaternion,s=y.scale,q=0,object=new THREE.Object3D,object.name=p,object.position.set(t[0],t[1],t[2]),q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]),object.scale.set(s[0],s[1],s[2]),object.visible=
|
|
|
-y.visible!==void 0?y.visible:!1,H.scene.add(object),H.objects[p]=object,H.empties[p]=object,y.trigger&&y.trigger.toLowerCase()!="none"&&(a={type:y.trigger,object:y},H.triggers[object.name]=a)}function l(a){return function(c){H.geometries[a]=c;k();M-=1;b.onLoadComplete();n()}}function m(a){return function(b){H.geometries[a]=b}}function n(){b.callbackProgress({totalModels:L,totalTextures:P,loadedModels:L-M,loadedTextures:P-N},H);b.onLoadProgress();M==0&&N==0&&c(H)}var o,u,p,z,w,x,v,y,t,A,D,C,E,I,G,
|
|
|
-K,B,F,J,M,N,L,P,H;F=a.data;G=new THREE.BinaryLoader;J=new THREE.JSONLoader;N=M=0;H={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};a=!1;for(p in F.objects)if(y=F.objects[p],y.meshCollider){a=!0;break}if(a)H.scene.collisions=new THREE.CollisionSystem;if(F.transform){a=F.transform.position;A=F.transform.rotation;var Q=F.transform.scale;a&&H.scene.position.set(a[0],a[1],a[2]);A&&H.scene.rotation.set(A[0],A[1],A[2]);Q&&H.scene.scale.set(Q[0],
|
|
|
-Q[1],Q[2]);(a||A||Q)&&H.scene.updateMatrix()}a=function(){N-=1;n();b.onLoadComplete()};for(w in F.cameras)A=F.cameras[w],A.type=="perspective"?E=new THREE.PerspectiveCamera(A.fov,A.aspect,A.near,A.far):A.type=="ortho"&&(E=new THREE.OrthographicCamera(A.left,A.right,A.top,A.bottom,A.near,A.far)),t=A.position,A=A.target,E.position.set(t[0],t[1],t[2]),E.target=new THREE.Vector3(A[0],A[1],A[2]),H.cameras[w]=E;for(z in F.lights)w=F.lights[z],E=w.color!==void 0?w.color:16777215,A=w.intensity!==void 0?w.intensity:
|
|
|
-1,w.type=="directional"?(t=w.direction,B=new THREE.DirectionalLight(E,A),B.position.set(t[0],t[1],t[2]),B.position.normalize()):w.type=="point"?(t=w.position,d=w.distance,B=new THREE.PointLight(E,A,d),B.position.set(t[0],t[1],t[2])):w.type=="ambient"&&(B=new THREE.AmbientLight(E)),H.scene.add(B),H.lights[z]=B;for(x in F.fogs)z=F.fogs[x],z.type=="linear"?I=new THREE.Fog(0,z.near,z.far):z.type=="exp2"&&(I=new THREE.FogExp2(0,z.density)),A=z.color,I.color.setRGB(A[0],A[1],A[2]),H.fogs[x]=I;if(H.cameras&&
|
|
|
-F.defaults.camera)H.currentCamera=H.cameras[F.defaults.camera];if(H.fogs&&F.defaults.fog)H.scene.fog=H.fogs[F.defaults.fog];A=F.defaults.bgcolor;H.bgColor=new THREE.Color;H.bgColor.setRGB(A[0],A[1],A[2]);H.bgColorAlpha=F.defaults.bgalpha;for(o in F.geometries)if(x=F.geometries[o],x.type=="bin_mesh"||x.type=="ascii_mesh")M+=1,b.onLoadStart();L=M;for(o in F.geometries)x=F.geometries[o],x.type=="cube"?(C=new THREE.CubeGeometry(x.width,x.height,x.depth,x.segmentsWidth,x.segmentsHeight,x.segmentsDepth,
|
|
|
-null,x.flipped,x.sides),H.geometries[o]=C):x.type=="plane"?(C=new THREE.PlaneGeometry(x.width,x.height,x.segmentsWidth,x.segmentsHeight),H.geometries[o]=C):x.type=="sphere"?(C=new THREE.SphereGeometry(x.radius,x.segmentsWidth,x.segmentsHeight),H.geometries[o]=C):x.type=="cylinder"?(C=new THREE.CylinderGeometry(x.topRad,x.botRad,x.height,x.radSegs,x.heightSegs),H.geometries[o]=C):x.type=="torus"?(C=new THREE.TorusGeometry(x.radius,x.tube,x.segmentsR,x.segmentsT),H.geometries[o]=C):x.type=="icosahedron"?
|
|
|
-(C=new THREE.IcosahedronGeometry(x.subdivisions),H.geometries[o]=C):x.type=="bin_mesh"?G.load(e(x.url,F.urlBaseType),l(o)):x.type=="ascii_mesh"?J.load(e(x.url,F.urlBaseType),l(o)):x.type=="embedded_mesh"&&(x=F.embeds[x.id])&&J.createModel(x,m(o),"");for(v in F.textures)if(o=F.textures[v],o.url instanceof Array){N+=o.url.length;for(G=0;G<o.url.length;G++)b.onLoadStart()}else N+=1,b.onLoadStart();P=N;for(v in F.textures){o=F.textures[v];if(o.mapping!=void 0&&THREE[o.mapping]!=void 0)o.mapping=new THREE[o.mapping];
|
|
|
-if(o.url instanceof Array){G=[];for(var O=0;O<o.url.length;O++)G[O]=e(o.url[O],F.urlBaseType);G=THREE.ImageUtils.loadTextureCube(G,o.mapping,a)}else{G=THREE.ImageUtils.loadTexture(e(o.url,F.urlBaseType),o.mapping,a);if(THREE[o.minFilter]!=void 0)G.minFilter=THREE[o.minFilter];if(THREE[o.magFilter]!=void 0)G.magFilter=THREE[o.magFilter];if(o.repeat){G.repeat.set(o.repeat[0],o.repeat[1]);if(o.repeat[0]!=1)G.wrapS=THREE.RepeatWrapping;if(o.repeat[1]!=1)G.wrapT=THREE.RepeatWrapping}o.offset&&G.offset.set(o.offset[0],
|
|
|
-o.offset[1]);if(o.wrap){J={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(J[o.wrap[0]]!==void 0)G.wrapS=J[o.wrap[0]];if(J[o.wrap[1]]!==void 0)G.wrapT=J[o.wrap[1]]}}H.textures[v]=G}for(u in F.materials){v=F.materials[u];for(D in v.parameters)if(D=="envMap"||D=="map"||D=="lightMap")v.parameters[D]=H.textures[v.parameters[D]];else if(D=="shading")v.parameters[D]=v.parameters[D]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(D=="blending")v.parameters[D]=THREE[v.parameters[D]]?
|
|
|
-THREE[v.parameters[D]]:THREE.NormalBlending;else if(D=="combine")v.parameters[D]=v.parameters[D]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(D=="vertexColors")if(v.parameters[D]=="face")v.parameters[D]=THREE.FaceColors;else if(v.parameters[D])v.parameters[D]=THREE.VertexColors;if(v.parameters.opacity!==void 0&&v.parameters.opacity<1)v.parameters.transparent=!0;if(v.parameters.normalMap){o=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(o.uniforms);G=v.parameters.color;
|
|
|
-J=v.parameters.specular;x=v.parameters.ambient;I=v.parameters.shininess;a.tNormal.texture=H.textures[v.parameters.normalMap];if(v.parameters.normalMapFactor)a.uNormalScale.value=v.parameters.normalMapFactor;if(v.parameters.map)a.tDiffuse.texture=v.parameters.map,a.enableDiffuse.value=!0;if(v.parameters.lightMap)a.tAO.texture=v.parameters.lightMap,a.enableAO.value=!0;if(v.parameters.specularMap)a.tSpecular.texture=H.textures[v.parameters.specularMap],a.enableSpecular.value=!0;a.uDiffuseColor.value.setHex(G);
|
|
|
-a.uSpecularColor.value.setHex(J);a.uAmbientColor.value.setHex(x);a.uShininess.value=I;if(v.parameters.opacity)a.uOpacity.value=v.parameters.opacity;v=new THREE.ShaderMaterial({fragmentShader:o.fragmentShader,vertexShader:o.vertexShader,uniforms:a,lights:!0,fog:!0})}else v=new THREE[v.type](v.parameters);H.materials[u]=v}k();b.callbackSync(H);n()}},constructor:THREE.SceneLoader};THREE.UTF8Loader=function(){};THREE.UTF8Loader.prototype=new THREE.UTF8Loader;THREE.UTF8Loader.prototype.constructor=THREE.UTF8Loader;
|
|
|
-THREE.UTF8Loader.prototype.load=function(a,c,b){if(a instanceof Object)console.warn("DEPRECATED: UTF8Loader( parameters ) is now UTF8Loader( url, callback, metaData )."),b=a,a=b.model,c=b.callback,b={scale:b.scale,offsetX:b.offsetX,offsetY:b.offsetY,offsetZ:b.offsetZ};var e=new XMLHttpRequest,g=b.scale!==void 0?b.scale:1,h=b.offsetX!==void 0?b.offsetX:0,f=b.offsetY!==void 0?b.offsetY:0,k=b.offsetZ!==void 0?b.offsetZ:0;e.onreadystatechange=function(){e.readyState==4?e.status==200||e.status==0?THREE.UTF8Loader.prototype.createModel(e.responseText,
|
|
|
-c,g,h,f,k):alert("Couldn't load ["+a+"] ["+e.status+"]"):e.readyState!=3&&e.readyState==2&&e.getResponseHeader("Content-Length")};e.open("GET",a,!0);e.send(null)};THREE.UTF8Loader.prototype.decompressMesh=function(a){var c=a.charCodeAt(0);c>=57344&&(c-=2048);c++;for(var b=new Float32Array(8*c),e=1,g=0;g<8;g++){for(var h=0,f=0;f<c;++f){var k=a.charCodeAt(f+e);h+=k>>1^-(k&1);b[8*f+g]=h}e+=c}c=a.length-e;h=new Uint16Array(c);for(g=f=0;g<c;g++)k=a.charCodeAt(g+e),h[g]=f-k,k==0&&f++;return[b,h]};
|
|
|
-THREE.UTF8Loader.prototype.createModel=function(a,c,b,e,g,h){var f=function(){var c=this;c.materials=[];THREE.Geometry.call(this);var f=THREE.UTF8Loader.prototype.decompressMesh(a),m=[],n=[];(function(a,f,l){for(var m,n,x,v=a.length;l<v;l+=f)m=a[l],n=a[l+1],x=a[l+2],m=m/16383*b,n=n/16383*b,x=x/16383*b,m+=e,n+=g,x+=h,c.vertices.push(new THREE.Vertex(new THREE.Vector3(m,n,x)))})(f[0],8,0);(function(a,b,c){for(var e,f,g=a.length;c<g;c+=b)e=a[c],f=a[c+1],e/=1023,f/=1023,n.push(e,1-f)})(f[0],8,3);(function(a,
|
|
|
-b,c){for(var e,f,g,h=a.length;c<h;c+=b)e=a[c],f=a[c+1],g=a[c+2],e=(e-512)/511,f=(f-512)/511,g=(g-512)/511,m.push(e,f,g)})(f[0],8,5);(function(a){var b,e,f,g,h,l,y,t,A,D=a.length;for(b=0;b<D;b+=3){e=a[b];f=a[b+1];g=a[b+2];h=c;t=e;A=f;l=g;y=e;var C=f,E=g,I=h.materials[0],G=m[C*3],K=m[C*3+1],C=m[C*3+2],B=m[E*3],F=m[E*3+1],E=m[E*3+2];y=new THREE.Vector3(m[y*3],m[y*3+1],m[y*3+2]);C=new THREE.Vector3(G,K,C);E=new THREE.Vector3(B,F,E);h.faces.push(new THREE.Face3(t,A,l,[y,C,E],null,I));h=n[e*2];e=n[e*2+
|
|
|
-1];l=n[f*2];y=n[f*2+1];t=n[g*2];A=n[g*2+1];g=c.faceVertexUvs[0];f=l;l=y;y=[];y.push(new THREE.UV(h,e));y.push(new THREE.UV(f,l));y.push(new THREE.UV(t,A));g.push(y)}})(f[1]);this.computeCentroids();this.computeFaceNormals()};f.prototype=new THREE.Geometry;f.prototype.constructor=f;c(new f)};
|
|
|
+THREE.SceneLoader.prototype={load:function(a,c){var b=this,d=new Worker(a);d.postMessage(0);var f=THREE.Loader.prototype.extractUrlbase(a);d.onmessage=function(a){function d(a,b){return b=="relativeToHTML"?a:f+"/"+a}function h(){var a;for(n in B.objects)if(!z.objects[n])if(s=B.objects[n],s.geometry!==void 0){if(E=z.geometries[s.geometry]){a=!1;for(I=0;I<s.materials.length;I++)H=z.materials[s.materials[I]],a=H instanceof THREE.ShaderMaterial;a&&E.computeTangents();w=s.position;x=s.rotation;y=s.quaternion;
|
|
|
+C=s.scale;y=0;H.length==0&&(H=new THREE.MeshFaceMaterial);H.length>1&&(H=new THREE.MeshFaceMaterial);a=new THREE.Mesh(E,H);a.name=n;a.position.set(w[0],w[1],w[2]);y?(a.quaternion.set(y[0],y[1],y[2],y[3]),a.useQuaternion=!0):a.rotation.set(x[0],x[1],x[2]);a.scale.set(C[0],C[1],C[2]);a.visible=s.visible;z.scene.add(a);z.objects[n]=a;if(s.meshCollider){var b=THREE.CollisionUtils.MeshColliderWBox(a);z.scene.collisions.colliders.push(b)}if(s.castsShadow)b=new THREE.ShadowVolume(E),z.scene.add(b),b.position=
|
|
|
+a.position,b.rotation=a.rotation,b.scale=a.scale;s.trigger&&s.trigger.toLowerCase()!="none"&&(b={type:s.trigger,object:s},z.triggers[a.name]=b)}}else w=s.position,x=s.rotation,y=s.quaternion,C=s.scale,y=0,a=new THREE.Object3D,a.name=n,a.position.set(w[0],w[1],w[2]),y?(a.quaternion.set(y[0],y[1],y[2],y[3]),a.useQuaternion=!0):a.rotation.set(x[0],x[1],x[2]),a.scale.set(C[0],C[1],C[2]),a.visible=s.visible!==void 0?s.visible:!1,z.scene.add(a),z.objects[n]=a,z.empties[n]=a,s.trigger&&s.trigger.toLowerCase()!=
|
|
|
+"none"&&(b={type:s.trigger,object:s},z.triggers[a.name]=b)}function i(a){return function(c){z.geometries[a]=c;h();J-=1;b.onLoadComplete();k()}}function j(a){return function(b){z.geometries[a]=b}}function k(){b.callbackProgress({totalModels:M,totalTextures:O,loadedModels:M-J,loadedTextures:O-N},z);b.onLoadProgress();J==0&&N==0&&c(z)}var m,o,n,t,q,r,p,s,l,v,w,x,y,C,A,E,u,G,D,H,B,F,J,N,M,O,z;B=a.data;D=new THREE.BinaryLoader;F=new THREE.JSONLoader;N=J=0;z={scene:new THREE.Scene,geometries:{},materials:{},
|
|
|
+textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};a=!1;for(n in B.objects)if(s=B.objects[n],s.meshCollider){a=!0;break}if(a)z.scene.collisions=new THREE.CollisionSystem;if(B.transform){a=B.transform.position;l=B.transform.rotation;var K=B.transform.scale;a&&z.scene.position.set(a[0],a[1],a[2]);l&&z.scene.rotation.set(l[0],l[1],l[2]);K&&z.scene.scale.set(K[0],K[1],K[2]);(a||l||K)&&z.scene.updateMatrix()}a=function(){N-=1;k();b.onLoadComplete()};for(q in B.cameras)l=B.cameras[q],
|
|
|
+l.type=="perspective"?u=new THREE.PerspectiveCamera(l.fov,l.aspect,l.near,l.far):l.type=="ortho"&&(u=new THREE.OrthographicCamera(l.left,l.right,l.top,l.bottom,l.near,l.far)),w=l.position,l=l.target,u.position.set(w[0],w[1],w[2]),u.target=new THREE.Vector3(l[0],l[1],l[2]),z.cameras[q]=u;for(t in B.lights)l=B.lights[t],q=l.color!==void 0?l.color:16777215,u=l.intensity!==void 0?l.intensity:1,l.type=="directional"?(w=l.direction,v=new THREE.DirectionalLight(q,u),v.position.set(w[0],w[1],w[2]),v.position.normalize()):
|
|
|
+l.type=="point"?(w=l.position,v=l.distance,v=new THREE.PointLight(q,u,v),v.position.set(w[0],w[1],w[2])):l.type=="ambient"&&(v=new THREE.AmbientLight(q)),z.scene.add(v),z.lights[t]=v;for(r in B.fogs)t=B.fogs[r],t.type=="linear"?G=new THREE.Fog(0,t.near,t.far):t.type=="exp2"&&(G=new THREE.FogExp2(0,t.density)),l=t.color,G.color.setRGB(l[0],l[1],l[2]),z.fogs[r]=G;if(z.cameras&&B.defaults.camera)z.currentCamera=z.cameras[B.defaults.camera];if(z.fogs&&B.defaults.fog)z.scene.fog=z.fogs[B.defaults.fog];
|
|
|
+l=B.defaults.bgcolor;z.bgColor=new THREE.Color;z.bgColor.setRGB(l[0],l[1],l[2]);z.bgColorAlpha=B.defaults.bgalpha;for(m in B.geometries)if(r=B.geometries[m],r.type=="bin_mesh"||r.type=="ascii_mesh")J+=1,b.onLoadStart();M=J;for(m in B.geometries)r=B.geometries[m],r.type=="cube"?(E=new THREE.CubeGeometry(r.width,r.height,r.depth,r.segmentsWidth,r.segmentsHeight,r.segmentsDepth,null,r.flipped,r.sides),z.geometries[m]=E):r.type=="plane"?(E=new THREE.PlaneGeometry(r.width,r.height,r.segmentsWidth,r.segmentsHeight),
|
|
|
+z.geometries[m]=E):r.type=="sphere"?(E=new THREE.SphereGeometry(r.radius,r.segmentsWidth,r.segmentsHeight),z.geometries[m]=E):r.type=="cylinder"?(E=new THREE.CylinderGeometry(r.topRad,r.botRad,r.height,r.radSegs,r.heightSegs),z.geometries[m]=E):r.type=="torus"?(E=new THREE.TorusGeometry(r.radius,r.tube,r.segmentsR,r.segmentsT),z.geometries[m]=E):r.type=="icosahedron"?(E=new THREE.IcosahedronGeometry(r.subdivisions),z.geometries[m]=E):r.type=="bin_mesh"?D.load(d(r.url,B.urlBaseType),i(m)):r.type==
|
|
|
+"ascii_mesh"?F.load(d(r.url,B.urlBaseType),i(m)):r.type=="embedded_mesh"&&(r=B.embeds[r.id])&&F.createModel(r,j(m),"");for(p in B.textures)if(m=B.textures[p],m.url instanceof Array){N+=m.url.length;for(D=0;D<m.url.length;D++)b.onLoadStart()}else N+=1,b.onLoadStart();O=N;for(p in B.textures){m=B.textures[p];if(m.mapping!=void 0&&THREE[m.mapping]!=void 0)m.mapping=new THREE[m.mapping];if(m.url instanceof Array){D=[];for(var I=0;I<m.url.length;I++)D[I]=d(m.url[I],B.urlBaseType);D=THREE.ImageUtils.loadTextureCube(D,
|
|
|
+m.mapping,a)}else{D=THREE.ImageUtils.loadTexture(d(m.url,B.urlBaseType),m.mapping,a);if(THREE[m.minFilter]!=void 0)D.minFilter=THREE[m.minFilter];if(THREE[m.magFilter]!=void 0)D.magFilter=THREE[m.magFilter];if(m.repeat){D.repeat.set(m.repeat[0],m.repeat[1]);if(m.repeat[0]!=1)D.wrapS=THREE.RepeatWrapping;if(m.repeat[1]!=1)D.wrapT=THREE.RepeatWrapping}m.offset&&D.offset.set(m.offset[0],m.offset[1]);if(m.wrap){F={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(F[m.wrap[0]]!==void 0)D.wrapS=
|
|
|
+F[m.wrap[0]];if(F[m.wrap[1]]!==void 0)D.wrapT=F[m.wrap[1]]}}z.textures[p]=D}for(o in B.materials){p=B.materials[o];for(A in p.parameters)if(A=="envMap"||A=="map"||A=="lightMap")p.parameters[A]=z.textures[p.parameters[A]];else if(A=="shading")p.parameters[A]=p.parameters[A]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(A=="blending")p.parameters[A]=THREE[p.parameters[A]]?THREE[p.parameters[A]]:THREE.NormalBlending;else if(A=="combine")p.parameters[A]=p.parameters[A]=="MixOperation"?THREE.MixOperation:
|
|
|
+THREE.MultiplyOperation;else if(A=="vertexColors")if(p.parameters[A]=="face")p.parameters[A]=THREE.FaceColors;else if(p.parameters[A])p.parameters[A]=THREE.VertexColors;if(p.parameters.opacity!==void 0&&p.parameters.opacity<1)p.parameters.transparent=!0;if(p.parameters.normalMap){m=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(m.uniforms);D=p.parameters.color;F=p.parameters.specular;r=p.parameters.ambient;G=p.parameters.shininess;a.tNormal.texture=z.textures[p.parameters.normalMap];if(p.parameters.normalMapFactor)a.uNormalScale.value=
|
|
|
+p.parameters.normalMapFactor;if(p.parameters.map)a.tDiffuse.texture=p.parameters.map,a.enableDiffuse.value=!0;if(p.parameters.lightMap)a.tAO.texture=p.parameters.lightMap,a.enableAO.value=!0;if(p.parameters.specularMap)a.tSpecular.texture=z.textures[p.parameters.specularMap],a.enableSpecular.value=!0;a.uDiffuseColor.value.setHex(D);a.uSpecularColor.value.setHex(F);a.uAmbientColor.value.setHex(r);a.uShininess.value=G;if(p.parameters.opacity)a.uOpacity.value=p.parameters.opacity;p=new THREE.ShaderMaterial({fragmentShader:m.fragmentShader,
|
|
|
+vertexShader:m.vertexShader,uniforms:a,lights:!0,fog:!0})}else p=new THREE[p.type](p.parameters);z.materials[o]=p}h();b.callbackSync(z);k()}},constructor:THREE.SceneLoader};THREE.UTF8Loader=function(){};THREE.UTF8Loader.prototype=new THREE.UTF8Loader;THREE.UTF8Loader.prototype.constructor=THREE.UTF8Loader;
|
|
|
+THREE.UTF8Loader.prototype.load=function(a,c,b){if(a instanceof Object)console.warn("DEPRECATED: UTF8Loader( parameters ) is now UTF8Loader( url, callback, metaData )."),b=a,a=b.model,c=b.callback,b={scale:b.scale,offsetX:b.offsetX,offsetY:b.offsetY,offsetZ:b.offsetZ};var d=new XMLHttpRequest,f=b.scale!==void 0?b.scale:1,g=b.offsetX!==void 0?b.offsetX:0,e=b.offsetY!==void 0?b.offsetY:0,h=b.offsetZ!==void 0?b.offsetZ:0;d.onreadystatechange=function(){d.readyState==4?d.status==200||d.status==0?THREE.UTF8Loader.prototype.createModel(d.responseText,
|
|
|
+c,f,g,e,h):alert("Couldn't load ["+a+"] ["+d.status+"]"):d.readyState!=3&&d.readyState==2&&d.getResponseHeader("Content-Length")};d.open("GET",a,!0);d.send(null)};THREE.UTF8Loader.prototype.decompressMesh=function(a){var c=a.charCodeAt(0);c>=57344&&(c-=2048);c++;for(var b=new Float32Array(8*c),d=1,f=0;f<8;f++){for(var g=0,e=0;e<c;++e){var h=a.charCodeAt(e+d);g+=h>>1^-(h&1);b[8*e+f]=g}d+=c}c=a.length-d;g=new Uint16Array(c);for(f=e=0;f<c;f++)h=a.charCodeAt(f+d),g[f]=e-h,h==0&&e++;return[b,g]};
|
|
|
+THREE.UTF8Loader.prototype.createModel=function(a,c,b,d,f,g){var e=function(){var c=this;c.materials=[];THREE.Geometry.call(this);var e=THREE.UTF8Loader.prototype.decompressMesh(a),j=[],k=[];(function(a,e,i){for(var j,k,r,p=a.length;i<p;i+=e)j=a[i],k=a[i+1],r=a[i+2],j=j/16383*b,k=k/16383*b,r=r/16383*b,j+=d,k+=f,r+=g,c.vertices.push(new THREE.Vertex(new THREE.Vector3(j,k,r)))})(e[0],8,0);(function(a,b,c){for(var d,e,f=a.length;c<f;c+=b)d=a[c],e=a[c+1],d/=1023,e/=1023,k.push(d,1-e)})(e[0],8,3);(function(a,
|
|
|
+b,c){for(var d,e,f,g=a.length;c<g;c+=b)d=a[c],e=a[c+1],f=a[c+2],d=(d-512)/511,e=(e-512)/511,f=(f-512)/511,j.push(d,e,f)})(e[0],8,5);(function(a){var b,d,e,f,g,i,s,l,v,w=a.length;for(b=0;b<w;b+=3){d=a[b];e=a[b+1];f=a[b+2];g=c;l=d;v=e;i=f;s=d;var x=e,y=f,C=g.materials[0],A=j[x*3],E=j[x*3+1],x=j[x*3+2],u=j[y*3],G=j[y*3+1],y=j[y*3+2];s=new THREE.Vector3(j[s*3],j[s*3+1],j[s*3+2]);x=new THREE.Vector3(A,E,x);y=new THREE.Vector3(u,G,y);g.faces.push(new THREE.Face3(l,v,i,[s,x,y],null,C));g=k[d*2];d=k[d*2+
|
|
|
+1];i=k[e*2];s=k[e*2+1];l=k[f*2];v=k[f*2+1];f=c.faceVertexUvs[0];e=i;i=s;s=[];s.push(new THREE.UV(g,d));s.push(new THREE.UV(e,i));s.push(new THREE.UV(l,v));f.push(s)}})(e[1]);this.computeCentroids();this.computeFaceNormals()};e.prototype=new THREE.Geometry;e.prototype.constructor=e;c(new e)};
|
|
|
THREE.Axes=function(){THREE.Object3D.call(this);var a=new THREE.Geometry;a.vertices.push(new THREE.Vertex);a.vertices.push(new THREE.Vertex(new THREE.Vector3(0,100,0)));var c=new THREE.CylinderGeometry(0,5,25,5,1),b=new THREE.Line(a,new THREE.LineBasicMaterial({color:16711680}));b.rotation.z=-Math.PI/2;this.add(b);b=new THREE.Mesh(c,new THREE.MeshBasicMaterial({color:16711680}));b.position.x=100;b.rotation.z=-Math.PI/2;this.add(b);b=new THREE.Line(a,new THREE.LineBasicMaterial({color:65280}));this.add(b);
|
|
|
b=new THREE.Mesh(c,new THREE.MeshBasicMaterial({color:65280}));b.position.y=100;this.add(b);b=new THREE.Line(a,new THREE.LineBasicMaterial({color:255}));b.rotation.x=Math.PI/2;this.add(b);b=new THREE.Mesh(c,new THREE.MeshBasicMaterial({color:255}));b.position.z=100;b.rotation.x=Math.PI/2;this.add(b)};THREE.Axes.prototype=new THREE.Object3D;THREE.Axes.prototype.constructor=THREE.Axes;
|
|
|
THREE.MarchingCubes=function(a,c){THREE.Object3D.call(this);this.materials=c instanceof Array?c:[c];this.init=function(a){this.isolation=80;this.size=a;this.size2=this.size*this.size;this.size3=this.size2*this.size;this.halfsize=this.size/2;this.delta=2/this.size;this.yd=this.size;this.zd=this.size2;this.field=new Float32Array(this.size3);this.normal_cache=new Float32Array(this.size3*3);this.vlist=new Float32Array(36);this.nlist=new Float32Array(36);this.firstDraw=!0;this.maxCount=4096;this.count=
|
|
|
-0;this.hasNormal=this.hasPos=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(a,c,g){return a+(c-a)*g};this.VIntX=function(a,c,g,h,f,k,l,m,n,o){f=(f-n)/(o-n);n=this.normal_cache;c[h]=k+f*this.delta;c[h+1]=l;c[h+2]=m;g[h]=this.lerp(n[a],n[a+3],f);g[h+1]=this.lerp(n[a+1],n[a+4],f);g[h+2]=this.lerp(n[a+2],n[a+5],f)};this.VIntY=function(a,c,g,h,f,k,l,m,n,o){f=(f-n)/(o-n);n=this.normal_cache;c[h]=k;c[h+1]=l+f*this.delta;c[h+
|
|
|
-2]=m;c=a+this.yd*3;g[h]=this.lerp(n[a],n[c],f);g[h+1]=this.lerp(n[a+1],n[c+1],f);g[h+2]=this.lerp(n[a+2],n[c+2],f)};this.VIntZ=function(a,c,g,h,f,k,l,m,n,o){f=(f-n)/(o-n);n=this.normal_cache;c[h]=k;c[h+1]=l;c[h+2]=m+f*this.delta;c=a+this.zd*3;g[h]=this.lerp(n[a],n[c],f);g[h+1]=this.lerp(n[a+1],n[c+1],f);g[h+2]=this.lerp(n[a+2],n[c+2],f)};this.compNorm=function(a){var c=a*3;this.normal_cache[c]===0&&(this.normal_cache[c]=this.field[a-1]-this.field[a+1],this.normal_cache[c+1]=this.field[a-this.yd]-
|
|
|
-this.field[a+this.yd],this.normal_cache[c+2]=this.field[a-this.zd]-this.field[a+this.zd])};this.polygonize=function(a,c,g,h,f,k){var l=h+1,m=h+this.yd,n=h+this.zd,o=l+this.yd,u=l+this.zd,p=h+this.yd+this.zd,z=l+this.yd+this.zd,w=0,x=this.field[h],v=this.field[l],y=this.field[m],t=this.field[o],A=this.field[n],D=this.field[u],C=this.field[p],E=this.field[z];x<f&&(w|=1);v<f&&(w|=2);y<f&&(w|=8);t<f&&(w|=4);A<f&&(w|=16);D<f&&(w|=32);C<f&&(w|=128);E<f&&(w|=64);var I=THREE.edgeTable[w];if(I===0)return 0;
|
|
|
-var G=this.delta,K=a+G,B=c+G,G=g+G;I&1&&(this.compNorm(h),this.compNorm(l),this.VIntX(h*3,this.vlist,this.nlist,0,f,a,c,g,x,v));I&2&&(this.compNorm(l),this.compNorm(o),this.VIntY(l*3,this.vlist,this.nlist,3,f,K,c,g,v,t));I&4&&(this.compNorm(m),this.compNorm(o),this.VIntX(m*3,this.vlist,this.nlist,6,f,a,B,g,y,t));I&8&&(this.compNorm(h),this.compNorm(m),this.VIntY(h*3,this.vlist,this.nlist,9,f,a,c,g,x,y));I&16&&(this.compNorm(n),this.compNorm(u),this.VIntX(n*3,this.vlist,this.nlist,12,f,a,c,G,A,D));
|
|
|
-I&32&&(this.compNorm(u),this.compNorm(z),this.VIntY(u*3,this.vlist,this.nlist,15,f,K,c,G,D,E));I&64&&(this.compNorm(p),this.compNorm(z),this.VIntX(p*3,this.vlist,this.nlist,18,f,a,B,G,C,E));I&128&&(this.compNorm(n),this.compNorm(p),this.VIntY(n*3,this.vlist,this.nlist,21,f,a,c,G,A,C));I&256&&(this.compNorm(h),this.compNorm(n),this.VIntZ(h*3,this.vlist,this.nlist,24,f,a,c,g,x,A));I&512&&(this.compNorm(l),this.compNorm(u),this.VIntZ(l*3,this.vlist,this.nlist,27,f,K,c,g,v,D));I&1024&&(this.compNorm(o),
|
|
|
-this.compNorm(z),this.VIntZ(o*3,this.vlist,this.nlist,30,f,K,B,g,t,E));I&2048&&(this.compNorm(m),this.compNorm(p),this.VIntZ(m*3,this.vlist,this.nlist,33,f,a,B,g,y,C));w<<=4;for(f=h=0;THREE.triTable[w+f]!=-1;)a=w+f,c=a+1,g=a+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[a],3*THREE.triTable[c],3*THREE.triTable[g],k),f+=3,h++;return h};this.posnormtriv=function(a,c,g,h,f,k){var l=this.count*3;this.positionArray[l]=a[g];this.positionArray[l+1]=a[g+1];this.positionArray[l+2]=a[g+2];this.positionArray[l+
|
|
|
-3]=a[h];this.positionArray[l+4]=a[h+1];this.positionArray[l+5]=a[h+2];this.positionArray[l+6]=a[f];this.positionArray[l+7]=a[f+1];this.positionArray[l+8]=a[f+2];this.normalArray[l]=c[g];this.normalArray[l+1]=c[g+1];this.normalArray[l+2]=c[g+2];this.normalArray[l+3]=c[h];this.normalArray[l+4]=c[h+1];this.normalArray[l+5]=c[h+2];this.normalArray[l+6]=c[f];this.normalArray[l+7]=c[f+1];this.normalArray[l+8]=c[f+2];this.hasNormal=this.hasPos=!0;this.count+=3;this.count>=this.maxCount-3&&k(this)};this.begin=
|
|
|
-function(){this.count=0;this.hasNormal=this.hasPos=!1};this.end=function(a){if(this.count!==0){for(var c=this.count*3;c<this.positionArray.length;c++)this.positionArray[c]=0;a(this)}};this.addBall=function(a,c,g,h,f){var k=this.size*Math.sqrt(h/f),l=g*this.size,m=c*this.size,n=a*this.size,o=Math.floor(l-k);o<1&&(o=1);l=Math.floor(l+k);l>this.size-1&&(l=this.size-1);var u=Math.floor(m-k);u<1&&(u=1);m=Math.floor(m+k);m>this.size-1&&(m=this.size-1);var p=Math.floor(n-k);p<1&&(p=1);k=Math.floor(n+k);
|
|
|
-k>this.size-1&&(k=this.size-1);for(var z,w,x,v,y,t;o<l;o++){n=this.size2*o;w=o/this.size-g;y=w*w;for(w=u;w<m;w++){x=n+this.size*w;z=w/this.size-c;t=z*z;for(z=p;z<k;z++)v=z/this.size-a,v=h/(1.0E-6+v*v+t+y)-f,v>0&&(this.field[x+z]+=v)}}};this.addPlaneX=function(a,c){var g,h,f,k,l,m=this.size,n=this.yd,o=this.zd,u=this.field,p=m*Math.sqrt(a/c);p>m&&(p=m);for(g=0;g<p;g++)if(h=g/m,h*=h,k=a/(1.0E-4+h)-c,k>0)for(h=0;h<m;h++){l=g+h*n;for(f=0;f<m;f++)u[o*f+l]+=k}};this.addPlaneY=function(a,c){var g,h,f,k,
|
|
|
-l,m,n=this.size,o=this.yd,u=this.zd,p=this.field,z=n*Math.sqrt(a/c);z>n&&(z=n);for(h=0;h<z;h++)if(g=h/n,g*=g,k=a/(1.0E-4+g)-c,k>0){l=h*o;for(g=0;g<n;g++){m=l+g;for(f=0;f<n;f++)p[u*f+m]+=k}}};this.addPlaneZ=function(a,c){var g,h,f,k,l,m;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(a/c);dist>size&&(dist=size);for(f=0;f<dist;f++)if(g=f/size,g*=g,k=a/(1.0E-4+g)-c,k>0){l=zd*f;for(h=0;h<size;h++){m=l+h*yd;for(g=0;g<size;g++)field[m+g]+=k}}};this.reset=function(){var a;for(a=
|
|
|
-0;a<this.size3;a++)this.normal_cache[a*3]=0,this.field[a]=0};this.render=function(a){this.begin();var c,g,h,f,k,l,m,n,o,u=this.size-2;for(f=1;f<u;f++){o=this.size2*f;m=(f-this.halfsize)/this.halfsize;for(h=1;h<u;h++){n=o+this.size*h;l=(h-this.halfsize)/this.halfsize;for(g=1;g<u;g++)k=(g-this.halfsize)/this.halfsize,c=n+g,this.polygonize(k,l,m,c,this.isolation,a)}}this.end(a)};this.generateGeometry=function(){var a=0,c=new THREE.Geometry,g=[];this.render(function(h){var f,k,l,m,n,o,u,p;for(f=0;f<h.count;f++)u=
|
|
|
-f*3,n=u+1,p=u+2,k=h.positionArray[u],l=h.positionArray[n],m=h.positionArray[p],o=new THREE.Vector3(k,l,m),k=h.normalArray[u],l=h.normalArray[n],m=h.normalArray[p],u=new THREE.Vector3(k,l,m),u.normalize(),n=new THREE.Vertex(o),c.vertices.push(n),g.push(u);nfaces=h.count/3;for(f=0;f<nfaces;f++)u=(a+f)*3,n=u+1,p=u+2,o=g[u],k=g[n],l=g[p],u=new THREE.Face3(u,n,p,[o,k,l]),c.faces.push(u);a+=nfaces;h.count=0});return c};this.init(a)};THREE.MarchingCubes.prototype=new THREE.Object3D;
|
|
|
-THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
|
|
|
+0;this.hasNormal=this.hasPos=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(a,c,f){return a+(c-a)*f};this.VIntX=function(a,c,f,g,e,h,i,j,k,m){e=(e-k)/(m-k);k=this.normal_cache;c[g]=h+e*this.delta;c[g+1]=i;c[g+2]=j;f[g]=this.lerp(k[a],k[a+3],e);f[g+1]=this.lerp(k[a+1],k[a+4],e);f[g+2]=this.lerp(k[a+2],k[a+5],e)};this.VIntY=function(a,c,f,g,e,h,i,j,k,m){e=(e-k)/(m-k);k=this.normal_cache;c[g]=h;c[g+1]=i+e*this.delta;c[g+
|
|
|
+2]=j;c=a+this.yd*3;f[g]=this.lerp(k[a],k[c],e);f[g+1]=this.lerp(k[a+1],k[c+1],e);f[g+2]=this.lerp(k[a+2],k[c+2],e)};this.VIntZ=function(a,c,f,g,e,h,i,j,k,m){e=(e-k)/(m-k);k=this.normal_cache;c[g]=h;c[g+1]=i;c[g+2]=j+e*this.delta;c=a+this.zd*3;f[g]=this.lerp(k[a],k[c],e);f[g+1]=this.lerp(k[a+1],k[c+1],e);f[g+2]=this.lerp(k[a+2],k[c+2],e)};this.compNorm=function(a){var c=a*3;this.normal_cache[c]===0&&(this.normal_cache[c]=this.field[a-1]-this.field[a+1],this.normal_cache[c+1]=this.field[a-this.yd]-
|
|
|
+this.field[a+this.yd],this.normal_cache[c+2]=this.field[a-this.zd]-this.field[a+this.zd])};this.polygonize=function(a,c,f,g,e,h){var i=g+1,j=g+this.yd,k=g+this.zd,m=i+this.yd,o=i+this.zd,n=g+this.yd+this.zd,t=i+this.yd+this.zd,q=0,r=this.field[g],p=this.field[i],s=this.field[j],l=this.field[m],v=this.field[k],w=this.field[o],x=this.field[n],y=this.field[t];r<e&&(q|=1);p<e&&(q|=2);s<e&&(q|=8);l<e&&(q|=4);v<e&&(q|=16);w<e&&(q|=32);x<e&&(q|=128);y<e&&(q|=64);var C=THREE.edgeTable[q];if(C===0)return 0;
|
|
|
+var A=this.delta,E=a+A,u=c+A,A=f+A;C&1&&(this.compNorm(g),this.compNorm(i),this.VIntX(g*3,this.vlist,this.nlist,0,e,a,c,f,r,p));C&2&&(this.compNorm(i),this.compNorm(m),this.VIntY(i*3,this.vlist,this.nlist,3,e,E,c,f,p,l));C&4&&(this.compNorm(j),this.compNorm(m),this.VIntX(j*3,this.vlist,this.nlist,6,e,a,u,f,s,l));C&8&&(this.compNorm(g),this.compNorm(j),this.VIntY(g*3,this.vlist,this.nlist,9,e,a,c,f,r,s));C&16&&(this.compNorm(k),this.compNorm(o),this.VIntX(k*3,this.vlist,this.nlist,12,e,a,c,A,v,w));
|
|
|
+C&32&&(this.compNorm(o),this.compNorm(t),this.VIntY(o*3,this.vlist,this.nlist,15,e,E,c,A,w,y));C&64&&(this.compNorm(n),this.compNorm(t),this.VIntX(n*3,this.vlist,this.nlist,18,e,a,u,A,x,y));C&128&&(this.compNorm(k),this.compNorm(n),this.VIntY(k*3,this.vlist,this.nlist,21,e,a,c,A,v,x));C&256&&(this.compNorm(g),this.compNorm(k),this.VIntZ(g*3,this.vlist,this.nlist,24,e,a,c,f,r,v));C&512&&(this.compNorm(i),this.compNorm(o),this.VIntZ(i*3,this.vlist,this.nlist,27,e,E,c,f,p,w));C&1024&&(this.compNorm(m),
|
|
|
+this.compNorm(t),this.VIntZ(m*3,this.vlist,this.nlist,30,e,E,u,f,l,y));C&2048&&(this.compNorm(j),this.compNorm(n),this.VIntZ(j*3,this.vlist,this.nlist,33,e,a,u,f,s,x));q<<=4;for(e=g=0;THREE.triTable[q+e]!=-1;)a=q+e,c=a+1,f=a+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[a],3*THREE.triTable[c],3*THREE.triTable[f],h),e+=3,g++;return g};this.posnormtriv=function(a,c,f,g,e,h){var i=this.count*3;this.positionArray[i]=a[f];this.positionArray[i+1]=a[f+1];this.positionArray[i+2]=a[f+2];this.positionArray[i+
|
|
|
+3]=a[g];this.positionArray[i+4]=a[g+1];this.positionArray[i+5]=a[g+2];this.positionArray[i+6]=a[e];this.positionArray[i+7]=a[e+1];this.positionArray[i+8]=a[e+2];this.normalArray[i]=c[f];this.normalArray[i+1]=c[f+1];this.normalArray[i+2]=c[f+2];this.normalArray[i+3]=c[g];this.normalArray[i+4]=c[g+1];this.normalArray[i+5]=c[g+2];this.normalArray[i+6]=c[e];this.normalArray[i+7]=c[e+1];this.normalArray[i+8]=c[e+2];this.hasNormal=this.hasPos=!0;this.count+=3;this.count>=this.maxCount-3&&h(this)};this.begin=
|
|
|
+function(){this.count=0;this.hasNormal=this.hasPos=!1};this.end=function(a){if(this.count!==0){for(var c=this.count*3;c<this.positionArray.length;c++)this.positionArray[c]=0;a(this)}};this.addBall=function(a,c,f,g,e){var h=this.size*Math.sqrt(g/e),i=f*this.size,j=c*this.size,k=a*this.size,m=Math.floor(i-h);m<1&&(m=1);i=Math.floor(i+h);i>this.size-1&&(i=this.size-1);var o=Math.floor(j-h);o<1&&(o=1);j=Math.floor(j+h);j>this.size-1&&(j=this.size-1);var n=Math.floor(k-h);n<1&&(n=1);h=Math.floor(k+h);
|
|
|
+h>this.size-1&&(h=this.size-1);for(var t,q,r,p,s,l;m<i;m++){k=this.size2*m;q=m/this.size-f;s=q*q;for(q=o;q<j;q++){r=k+this.size*q;t=q/this.size-c;l=t*t;for(t=n;t<h;t++)p=t/this.size-a,p=g/(1.0E-6+p*p+l+s)-e,p>0&&(this.field[r+t]+=p)}}};this.addPlaneX=function(a,c){var f,g,e,h,i,j=this.size,k=this.yd,m=this.zd,o=this.field,n=j*Math.sqrt(a/c);n>j&&(n=j);for(f=0;f<n;f++)if(g=f/j,g*=g,h=a/(1.0E-4+g)-c,h>0)for(g=0;g<j;g++){i=f+g*k;for(e=0;e<j;e++)o[m*e+i]+=h}};this.addPlaneY=function(a,c){var f,g,e,h,
|
|
|
+i,j,k=this.size,m=this.yd,o=this.zd,n=this.field,t=k*Math.sqrt(a/c);t>k&&(t=k);for(g=0;g<t;g++)if(f=g/k,f*=f,h=a/(1.0E-4+f)-c,h>0){i=g*m;for(f=0;f<k;f++){j=i+f;for(e=0;e<k;e++)n[o*e+j]+=h}}};this.addPlaneZ=function(a,c){var f,g,e,h,i,j,k=this.size,m=this.yd,o=this.zd,n=this.field,t=k*Math.sqrt(a/c);t>k&&(t=k);for(e=0;e<t;e++)if(f=e/k,f*=f,h=a/(1.0E-4+f)-c,h>0){i=o*e;for(g=0;g<k;g++){j=i+g*m;for(f=0;f<k;f++)n[j+f]+=h}}};this.reset=function(){var a;for(a=0;a<this.size3;a++)this.normal_cache[a*3]=0,
|
|
|
+this.field[a]=0};this.render=function(a){this.begin();var c,f,g,e,h,i,j,k,m,o=this.size-2;for(e=1;e<o;e++){m=this.size2*e;j=(e-this.halfsize)/this.halfsize;for(g=1;g<o;g++){k=m+this.size*g;i=(g-this.halfsize)/this.halfsize;for(f=1;f<o;f++)h=(f-this.halfsize)/this.halfsize,c=k+f,this.polygonize(h,i,j,c,this.isolation,a)}}this.end(a)};this.generateGeometry=function(){var a=0,c=new THREE.Geometry,f=[];this.render(function(g){var e,h,i,j,k,m,o,n;for(e=0;e<g.count;e++)o=e*3,k=o+1,n=o+2,h=g.positionArray[o],
|
|
|
+i=g.positionArray[k],j=g.positionArray[n],m=new THREE.Vector3(h,i,j),h=g.normalArray[o],i=g.normalArray[k],j=g.normalArray[n],o=new THREE.Vector3(h,i,j),o.normalize(),k=new THREE.Vertex(m),c.vertices.push(k),f.push(o);m=g.count/3;for(e=0;e<m;e++)o=(a+e)*3,k=o+1,n=o+2,h=f[o],i=f[k],j=f[n],o=new THREE.Face3(o,k,n,[h,i,j]),c.faces.push(o);a+=m;g.count=0});return c};this.init(a)};THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
|
|
|
THREE.edgeTable=new Int32Array([0,265,515,778,1030,1295,1541,1804,2060,2309,2575,2822,3082,3331,3593,3840,400,153,915,666,1430,1183,1941,1692,2460,2197,2975,2710,3482,3219,3993,3728,560,825,51,314,1590,1855,1077,1340,2620,2869,2111,2358,3642,3891,3129,3376,928,681,419,170,1958,1711,1445,1196,2988,2725,2479,2214,4010,3747,3497,3232,1120,1385,1635,1898,102,367,613,876,3180,3429,3695,3942,2154,2403,2665,2912,1520,1273,2035,1786,502,255,1013,764,3580,3317,4095,3830,2554,2291,3065,2800,1616,1881,1107,
|
|
|
1370,598,863,85,348,3676,3925,3167,3414,2650,2899,2137,2384,1984,1737,1475,1226,966,719,453,204,4044,3781,3535,3270,3018,2755,2505,2240,2240,2505,2755,3018,3270,3535,3781,4044,204,453,719,966,1226,1475,1737,1984,2384,2137,2899,2650,3414,3167,3925,3676,348,85,863,598,1370,1107,1881,1616,2800,3065,2291,2554,3830,4095,3317,3580,764,1013,255,502,1786,2035,1273,1520,2912,2665,2403,2154,3942,3695,3429,3180,876,613,367,102,1898,1635,1385,1120,3232,3497,3747,4010,2214,2479,2725,2988,1196,1445,1711,1958,170,
|
|
|
419,681,928,3376,3129,3891,3642,2358,2111,2869,2620,1340,1077,1855,1590,314,51,825,560,3728,3993,3219,3482,2710,2975,2197,2460,1692,1941,1183,1430,666,915,153,400,3840,3593,3331,3082,2822,2575,2309,2060,1804,1541,1295,1030,778,515,265,0]);
|
|
|
@@ -340,23 +339,23 @@ THREE.triTable=new Int32Array([-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0
|
|
|
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,10,8,10,11,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,0,9,3,9,11,11,9,10,-1,-1,-1,-1,-1,-1,-1,0,1,10,0,10,8,8,10,11,-1,-1,-1,-1,-1,-1,-1,3,1,10,11,3,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,2,11,1,11,9,9,11,8,-1,-1,-1,-1,-1,-1,-1,3,0,9,3,9,11,1,2,9,2,11,9,-1,-1,-1,-1,0,2,11,8,0,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,2,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,3,8,2,8,10,10,8,9,-1,-1,-1,-1,-1,-1,-1,9,10,2,0,9,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,3,8,2,8,10,0,1,8,1,10,8,-1,-1,-1,-1,1,10,
|
|
|
2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,3,8,9,1,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,9,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,3,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1]);THREE.PlaneCollider=function(a,c){this.point=a;this.normal=c};THREE.SphereCollider=function(a,c){this.center=a;this.radius=c;this.radiusSq=c*c};THREE.BoxCollider=function(a,c){this.min=a;this.max=c;this.dynamic=!0;this.normal=new THREE.Vector3};
|
|
|
THREE.MeshCollider=function(a,c){this.mesh=a;this.box=c;this.numFaces=this.mesh.geometry.faces.length;this.normal=new THREE.Vector3};THREE.CollisionSystem=function(){this.collisionNormal=new THREE.Vector3;this.colliders=[];this.hits=[]};THREE.Collisions=new THREE.CollisionSystem;THREE.CollisionSystem.prototype.merge=function(a){Array.prototype.push.apply(this.colliders,a.colliders);Array.prototype.push.apply(this.hits,a.hits)};
|
|
|
-THREE.CollisionSystem.prototype.rayCastAll=function(a){a.direction.normalize();this.hits.length=0;var c,b,e,g,h=0;c=0;for(b=this.colliders.length;c<b;c++)if(g=this.colliders[c],e=this.rayCast(a,g),e<Number.MAX_VALUE)g.distance=e,e>h?this.hits.push(g):this.hits.unshift(g),h=e;return this.hits};
|
|
|
-THREE.CollisionSystem.prototype.rayCastNearest=function(a){var c=this.rayCastAll(a);if(c.length==0)return null;for(var b=0;c[b]instanceof THREE.MeshCollider;){var e=this.rayMesh(a,c[b]);if(e.dist<Number.MAX_VALUE){c[b].distance=e.dist;c[b].faceIndex=e.faceIndex;break}b++}if(b>c.length)return null;return c[b]};
|
|
|
+THREE.CollisionSystem.prototype.rayCastAll=function(a){a.direction.normalize();this.hits.length=0;var c,b,d,f,g=0;c=0;for(b=this.colliders.length;c<b;c++)if(f=this.colliders[c],d=this.rayCast(a,f),d<Number.MAX_VALUE)f.distance=d,d>g?this.hits.push(f):this.hits.unshift(f),g=d;return this.hits};
|
|
|
+THREE.CollisionSystem.prototype.rayCastNearest=function(a){var c=this.rayCastAll(a);if(c.length==0)return null;for(var b=0;c[b]instanceof THREE.MeshCollider;){var d=this.rayMesh(a,c[b]);if(d.dist<Number.MAX_VALUE){c[b].distance=d.dist;c[b].faceIndex=d.faceIndex;break}b++}if(b>c.length)return null;return c[b]};
|
|
|
THREE.CollisionSystem.prototype.rayCast=function(a,c){if(c instanceof THREE.PlaneCollider)return this.rayPlane(a,c);else if(c instanceof THREE.SphereCollider)return this.raySphere(a,c);else if(c instanceof THREE.BoxCollider)return this.rayBox(a,c);else if(c instanceof THREE.MeshCollider&&c.box)return this.rayBox(a,c.box)};
|
|
|
-THREE.CollisionSystem.prototype.rayMesh=function(a,c){for(var b=this.makeRayLocal(a,c.mesh),e=Number.MAX_VALUE,g,h=0;h<c.numFaces;h++){var f=c.mesh.geometry.faces[h],k=c.mesh.geometry.vertices[f.a].position,l=c.mesh.geometry.vertices[f.b].position,m=c.mesh.geometry.vertices[f.c].position,n=f instanceof THREE.Face4?c.mesh.geometry.vertices[f.d].position:null;f instanceof THREE.Face3?(f=this.rayTriangle(b,k,l,m,e,this.collisionNormal,c.mesh),f<e&&(e=f,g=h,c.normal.copy(this.collisionNormal),c.normal.normalize())):
|
|
|
-f instanceof THREE.Face4&&(f=this.rayTriangle(b,k,l,n,e,this.collisionNormal,c.mesh),f<e&&(e=f,g=h,c.normal.copy(this.collisionNormal),c.normal.normalize()),f=this.rayTriangle(b,l,m,n,e,this.collisionNormal,c.mesh),f<e&&(e=f,g=h,c.normal.copy(this.collisionNormal),c.normal.normalize()))}return{dist:e,faceIndex:g}};
|
|
|
-THREE.CollisionSystem.prototype.rayTriangle=function(a,c,b,e,g,h,f){var k=THREE.CollisionSystem.__v1,l=THREE.CollisionSystem.__v2;h.set(0,0,0);k.sub(b,c);l.sub(e,b);h.cross(k,l);k=h.dot(a.direction);if(!(k<0))if(f.doubleSided||f.flipSided)h.multiplyScalar(-1),k*=-1;else return Number.MAX_VALUE;f=h.dot(c)-h.dot(a.origin);if(!(f<=0))return Number.MAX_VALUE;if(!(f>=k*g))return Number.MAX_VALUE;f/=k;k=THREE.CollisionSystem.__v3;k.copy(a.direction);k.multiplyScalar(f);k.addSelf(a.origin);Math.abs(h.x)>
|
|
|
-Math.abs(h.y)?Math.abs(h.x)>Math.abs(h.z)?(a=k.y-c.y,h=b.y-c.y,g=e.y-c.y,k=k.z-c.z,b=b.z-c.z,e=e.z-c.z):(a=k.x-c.x,h=b.x-c.x,g=e.x-c.x,k=k.y-c.y,b=b.y-c.y,e=e.y-c.y):Math.abs(h.y)>Math.abs(h.z)?(a=k.x-c.x,h=b.x-c.x,g=e.x-c.x,k=k.z-c.z,b=b.z-c.z,e=e.z-c.z):(a=k.x-c.x,h=b.x-c.x,g=e.x-c.x,k=k.y-c.y,b=b.y-c.y,e=e.y-c.y);c=h*e-b*g;if(c==0)return Number.MAX_VALUE;c=1/c;e=(a*e-k*g)*c;if(!(e>=0))return Number.MAX_VALUE;c*=h*k-b*a;if(!(c>=0))return Number.MAX_VALUE;if(!(1-e-c>=0))return Number.MAX_VALUE;return f};
|
|
|
-THREE.CollisionSystem.prototype.makeRayLocal=function(a,c){var b=THREE.CollisionSystem.__m;b.getInverse(c.matrixWorld);var e=THREE.CollisionSystem.__r;e.origin.copy(a.origin);e.direction.copy(a.direction);b.multiplyVector3(e.origin);b.rotateAxis(e.direction);e.direction.normalize();return e};
|
|
|
-THREE.CollisionSystem.prototype.rayBox=function(a,c){var b;c.dynamic&&c.mesh&&c.mesh.matrixWorld?b=this.makeRayLocal(a,c.mesh):(b=THREE.CollisionSystem.__r,b.origin.copy(a.origin),b.direction.copy(a.direction));var e=0,g=0,h=0,f=0,k=0,l=0,m=!0;b.origin.x<c.min.x?(e=c.min.x-b.origin.x,e/=b.direction.x,m=!1,f=-1):b.origin.x>c.max.x&&(e=c.max.x-b.origin.x,e/=b.direction.x,m=!1,f=1);b.origin.y<c.min.y?(g=c.min.y-b.origin.y,g/=b.direction.y,m=!1,k=-1):b.origin.y>c.max.y&&(g=c.max.y-b.origin.y,g/=b.direction.y,
|
|
|
-m=!1,k=1);b.origin.z<c.min.z?(h=c.min.z-b.origin.z,h/=b.direction.z,m=!1,l=-1):b.origin.z>c.max.z&&(h=c.max.z-b.origin.z,h/=b.direction.z,m=!1,l=1);if(m)return-1;m=0;g>e&&(m=1,e=g);h>e&&(m=2,e=h);switch(m){case 0:k=b.origin.y+b.direction.y*e;if(k<c.min.y||k>c.max.y)return Number.MAX_VALUE;b=b.origin.z+b.direction.z*e;if(b<c.min.z||b>c.max.z)return Number.MAX_VALUE;c.normal.set(f,0,0);break;case 1:f=b.origin.x+b.direction.x*e;if(f<c.min.x||f>c.max.x)return Number.MAX_VALUE;b=b.origin.z+b.direction.z*
|
|
|
-e;if(b<c.min.z||b>c.max.z)return Number.MAX_VALUE;c.normal.set(0,k,0);break;case 2:f=b.origin.x+b.direction.x*e;if(f<c.min.x||f>c.max.x)return Number.MAX_VALUE;k=b.origin.y+b.direction.y*e;if(k<c.min.y||k>c.max.y)return Number.MAX_VALUE;c.normal.set(0,0,l)}return e};THREE.CollisionSystem.prototype.rayPlane=function(a,c){var b=a.direction.dot(c.normal),e=c.point.dot(c.normal);if(b<0)b=(e-a.origin.dot(c.normal))/b;else return Number.MAX_VALUE;return b>0?b:Number.MAX_VALUE};
|
|
|
-THREE.CollisionSystem.prototype.raySphere=function(a,c){var b=c.center.clone().subSelf(a.origin);if(b.lengthSq<c.radiusSq)return-1;var e=b.dot(a.direction.clone());if(e<=0)return Number.MAX_VALUE;b=c.radiusSq-(b.lengthSq()-e*e);if(b>=0)return Math.abs(e)-Math.sqrt(b);return Number.MAX_VALUE};THREE.CollisionSystem.__v1=new THREE.Vector3;THREE.CollisionSystem.__v2=new THREE.Vector3;THREE.CollisionSystem.__v3=new THREE.Vector3;THREE.CollisionSystem.__nr=new THREE.Vector3;THREE.CollisionSystem.__m=new THREE.Matrix4;
|
|
|
+THREE.CollisionSystem.prototype.rayMesh=function(a,c){for(var b=this.makeRayLocal(a,c.mesh),d=Number.MAX_VALUE,f,g=0;g<c.numFaces;g++){var e=c.mesh.geometry.faces[g],h=c.mesh.geometry.vertices[e.a].position,i=c.mesh.geometry.vertices[e.b].position,j=c.mesh.geometry.vertices[e.c].position,k=e instanceof THREE.Face4?c.mesh.geometry.vertices[e.d].position:null;e instanceof THREE.Face3?(e=this.rayTriangle(b,h,i,j,d,this.collisionNormal,c.mesh),e<d&&(d=e,f=g,c.normal.copy(this.collisionNormal),c.normal.normalize())):
|
|
|
+e instanceof THREE.Face4&&(e=this.rayTriangle(b,h,i,k,d,this.collisionNormal,c.mesh),e<d&&(d=e,f=g,c.normal.copy(this.collisionNormal),c.normal.normalize()),e=this.rayTriangle(b,i,j,k,d,this.collisionNormal,c.mesh),e<d&&(d=e,f=g,c.normal.copy(this.collisionNormal),c.normal.normalize()))}return{dist:d,faceIndex:f}};
|
|
|
+THREE.CollisionSystem.prototype.rayTriangle=function(a,c,b,d,f,g,e){var h=THREE.CollisionSystem.__v1,i=THREE.CollisionSystem.__v2;g.set(0,0,0);h.sub(b,c);i.sub(d,b);g.cross(h,i);h=g.dot(a.direction);if(!(h<0))if(e.doubleSided||e.flipSided)g.multiplyScalar(-1),h*=-1;else return Number.MAX_VALUE;e=g.dot(c)-g.dot(a.origin);if(!(e<=0))return Number.MAX_VALUE;if(!(e>=h*f))return Number.MAX_VALUE;e/=h;h=THREE.CollisionSystem.__v3;h.copy(a.direction);h.multiplyScalar(e);h.addSelf(a.origin);Math.abs(g.x)>
|
|
|
+Math.abs(g.y)?Math.abs(g.x)>Math.abs(g.z)?(a=h.y-c.y,g=b.y-c.y,f=d.y-c.y,h=h.z-c.z,b=b.z-c.z,d=d.z-c.z):(a=h.x-c.x,g=b.x-c.x,f=d.x-c.x,h=h.y-c.y,b=b.y-c.y,d=d.y-c.y):Math.abs(g.y)>Math.abs(g.z)?(a=h.x-c.x,g=b.x-c.x,f=d.x-c.x,h=h.z-c.z,b=b.z-c.z,d=d.z-c.z):(a=h.x-c.x,g=b.x-c.x,f=d.x-c.x,h=h.y-c.y,b=b.y-c.y,d=d.y-c.y);c=g*d-b*f;if(c==0)return Number.MAX_VALUE;c=1/c;d=(a*d-h*f)*c;if(!(d>=0))return Number.MAX_VALUE;c*=g*h-b*a;if(!(c>=0))return Number.MAX_VALUE;if(!(1-d-c>=0))return Number.MAX_VALUE;return e};
|
|
|
+THREE.CollisionSystem.prototype.makeRayLocal=function(a,c){var b=THREE.CollisionSystem.__m;b.getInverse(c.matrixWorld);var d=THREE.CollisionSystem.__r;d.origin.copy(a.origin);d.direction.copy(a.direction);b.multiplyVector3(d.origin);b.rotateAxis(d.direction);d.direction.normalize();return d};
|
|
|
+THREE.CollisionSystem.prototype.rayBox=function(a,c){var b;c.dynamic&&c.mesh&&c.mesh.matrixWorld?b=this.makeRayLocal(a,c.mesh):(b=THREE.CollisionSystem.__r,b.origin.copy(a.origin),b.direction.copy(a.direction));var d=0,f=0,g=0,e=0,h=0,i=0,j=!0;b.origin.x<c.min.x?(d=c.min.x-b.origin.x,d/=b.direction.x,j=!1,e=-1):b.origin.x>c.max.x&&(d=c.max.x-b.origin.x,d/=b.direction.x,j=!1,e=1);b.origin.y<c.min.y?(f=c.min.y-b.origin.y,f/=b.direction.y,j=!1,h=-1):b.origin.y>c.max.y&&(f=c.max.y-b.origin.y,f/=b.direction.y,
|
|
|
+j=!1,h=1);b.origin.z<c.min.z?(g=c.min.z-b.origin.z,g/=b.direction.z,j=!1,i=-1):b.origin.z>c.max.z&&(g=c.max.z-b.origin.z,g/=b.direction.z,j=!1,i=1);if(j)return-1;j=0;f>d&&(j=1,d=f);g>d&&(j=2,d=g);switch(j){case 0:h=b.origin.y+b.direction.y*d;if(h<c.min.y||h>c.max.y)return Number.MAX_VALUE;b=b.origin.z+b.direction.z*d;if(b<c.min.z||b>c.max.z)return Number.MAX_VALUE;c.normal.set(e,0,0);break;case 1:e=b.origin.x+b.direction.x*d;if(e<c.min.x||e>c.max.x)return Number.MAX_VALUE;b=b.origin.z+b.direction.z*
|
|
|
+d;if(b<c.min.z||b>c.max.z)return Number.MAX_VALUE;c.normal.set(0,h,0);break;case 2:e=b.origin.x+b.direction.x*d;if(e<c.min.x||e>c.max.x)return Number.MAX_VALUE;h=b.origin.y+b.direction.y*d;if(h<c.min.y||h>c.max.y)return Number.MAX_VALUE;c.normal.set(0,0,i)}return d};THREE.CollisionSystem.prototype.rayPlane=function(a,c){var b=a.direction.dot(c.normal),d=c.point.dot(c.normal);if(b<0)b=(d-a.origin.dot(c.normal))/b;else return Number.MAX_VALUE;return b>0?b:Number.MAX_VALUE};
|
|
|
+THREE.CollisionSystem.prototype.raySphere=function(a,c){var b=c.center.clone().subSelf(a.origin);if(b.lengthSq<c.radiusSq)return-1;var d=b.dot(a.direction.clone());if(d<=0)return Number.MAX_VALUE;b=c.radiusSq-(b.lengthSq()-d*d);if(b>=0)return Math.abs(d)-Math.sqrt(b);return Number.MAX_VALUE};THREE.CollisionSystem.__v1=new THREE.Vector3;THREE.CollisionSystem.__v2=new THREE.Vector3;THREE.CollisionSystem.__v3=new THREE.Vector3;THREE.CollisionSystem.__nr=new THREE.Vector3;THREE.CollisionSystem.__m=new THREE.Matrix4;
|
|
|
THREE.CollisionSystem.__r=new THREE.Ray;THREE.CollisionUtils={};THREE.CollisionUtils.MeshOBB=function(a){a.geometry.computeBoundingBox();var c=a.geometry.boundingBox,b=new THREE.Vector3(c.x[0],c.y[0],c.z[0]),c=new THREE.Vector3(c.x[1],c.y[1],c.z[1]),b=new THREE.BoxCollider(b,c);b.mesh=a;return b};THREE.CollisionUtils.MeshAABB=function(a){var c=THREE.CollisionUtils.MeshOBB(a);c.min.addSelf(a.position);c.max.addSelf(a.position);c.dynamic=!1;return c};
|
|
|
THREE.CollisionUtils.MeshColliderWBox=function(a){return new THREE.MeshCollider(a,THREE.CollisionUtils.MeshOBB(a))};
|
|
|
-if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoUpdateScene=!1;var c=this,b=this.setSize,e=this.render,g=new THREE.PerspectiveCamera,h=new THREE.PerspectiveCamera,f=new THREE.Matrix4,k=new THREE.Matrix4,l,m,n,o;g.matrixAutoUpdate=h.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},u=new THREE.WebGLRenderTarget(512,512,a),p=new THREE.WebGLRenderTarget(512,512,a),z=new THREE.PerspectiveCamera(53,
|
|
|
-1,1,1E4);z.position.z=2;_material=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:u},mapRight:{type:"t",value:1,texture:p}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D mapLeft;\nuniform sampler2D mapRight;\nvarying vec2 vUv;\nvoid main() {\nvec4 colorL, colorR;\nvec2 uv = vUv;\ncolorL = texture2D( mapLeft, uv );\ncolorR = texture2D( mapRight, uv );\ngl_FragColor = vec4( colorL.g * 0.7 + colorL.b * 0.3, colorR.g, colorR.b, colorL.a + colorR.a ) * 1.1;\n}"});
|
|
|
-var w=new THREE.Scene;w.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));w.add(z);this.setSize=function(a,e){b.call(c,a,e);u.width=a;u.height=e;p.width=a;p.height=e};this.render=function(a,b){a.updateMatrixWorld();if(l!==b.aspect||m!==b.near||n!==b.far||o!==b.fov){l=b.aspect;m=b.near;n=b.far;o=b.fov;var y=b.projectionMatrix.clone(),t=125/30*0.5,A=t*m/125,D=m*Math.tan(o*Math.PI/360),C;f.n14=t;k.n14=-t;t=-D*l+A;C=D*l+A;y.n11=2*m/(C-t);y.n13=(C+t)/(C-t);g.projectionMatrix.copy(y);t=-D*l-A;
|
|
|
-C=D*l-A;y.n11=2*m/(C-t);y.n13=(C+t)/(C-t);h.projectionMatrix.copy(y)}g.matrixWorld.copy(b.matrixWorld).multiplySelf(k);g.position.copy(b.position);g.near=b.near;g.far=b.far;e.call(c,a,g,u,!0);h.matrixWorld.copy(b.matrixWorld).multiplySelf(f);h.position.copy(b.position);h.near=b.near;h.far=b.far;e.call(c,a,h,p,!0);w.updateMatrixWorld();e.call(c,w,z)}};
|
|
|
-if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoClear=!1;var c=this,b=this.setSize,e=this.render,g,h,f=new THREE.PerspectiveCamera;f.target=new THREE.Vector3(0,0,0);var k=new THREE.PerspectiveCamera;k.target=new THREE.Vector3(0,0,0);c.separation=10;if(a&&a.separation!==void 0)c.separation=a.separation;this.setSize=function(a,e){b.call(c,a,e);g=a/2;h=e};this.render=function(a,b){this.clear();f.fov=b.fov;f.aspect=0.5*b.aspect;f.near=b.near;f.far=
|
|
|
-b.far;f.updateProjectionMatrix();f.position.copy(b.position);f.target.copy(b.target);f.translateX(c.separation);f.lookAt(f.target);k.projectionMatrix=f.projectionMatrix;k.position.copy(b.position);k.target.copy(b.target);k.translateX(-c.separation);k.lookAt(k.target);this.setViewport(0,0,g,h);e.call(c,a,f);this.setViewport(g,0,g,h);e.call(c,a,k,!1)}};
|
|
|
+if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoUpdateScene=!1;var c=this,b=this.setSize,d=this.render,f=new THREE.PerspectiveCamera,g=new THREE.PerspectiveCamera,e=new THREE.Matrix4,h=new THREE.Matrix4,i,j,k,m;f.matrixAutoUpdate=g.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},o=new THREE.WebGLRenderTarget(512,512,a),n=new THREE.WebGLRenderTarget(512,512,a),t=new THREE.PerspectiveCamera(53,
|
|
|
+1,1,1E4);t.position.z=2;var a=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:o},mapRight:{type:"t",value:1,texture:n}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D mapLeft;\nuniform sampler2D mapRight;\nvarying vec2 vUv;\nvoid main() {\nvec4 colorL, colorR;\nvec2 uv = vUv;\ncolorL = texture2D( mapLeft, uv );\ncolorR = texture2D( mapRight, uv );\ngl_FragColor = vec4( colorL.g * 0.7 + colorL.b * 0.3, colorR.g, colorR.b, colorL.a + colorR.a ) * 1.1;\n}"}),
|
|
|
+q=new THREE.Scene;q.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),a));q.add(t);this.setSize=function(a,d){b.call(c,a,d);o.width=a;o.height=d;n.width=a;n.height=d};this.render=function(a,b){a.updateMatrixWorld();if(i!==b.aspect||j!==b.near||k!==b.far||m!==b.fov){i=b.aspect;j=b.near;k=b.far;m=b.fov;var s=b.projectionMatrix.clone(),l=125/30*0.5,v=l*j/125,w=j*Math.tan(m*Math.PI/360),x;e.n14=l;h.n14=-l;l=-w*i+v;x=w*i+v;s.n11=2*j/(x-l);s.n13=(x+l)/(x-l);f.projectionMatrix.copy(s);l=-w*i-v;x=w*i-v;s.n11=
|
|
|
+2*j/(x-l);s.n13=(x+l)/(x-l);g.projectionMatrix.copy(s)}f.matrixWorld.copy(b.matrixWorld).multiplySelf(h);f.position.copy(b.position);f.near=b.near;f.far=b.far;d.call(c,a,f,o,!0);g.matrixWorld.copy(b.matrixWorld).multiplySelf(e);g.position.copy(b.position);g.near=b.near;g.far=b.far;d.call(c,a,g,n,!0);q.updateMatrixWorld();d.call(c,q,t)}};
|
|
|
+if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoClear=!1;var c=this,b=this.setSize,d=this.render,f,g,e=new THREE.PerspectiveCamera;e.target=new THREE.Vector3(0,0,0);var h=new THREE.PerspectiveCamera;h.target=new THREE.Vector3(0,0,0);c.separation=10;if(a&&a.separation!==void 0)c.separation=a.separation;this.setSize=function(a,d){b.call(c,a,d);f=a/2;g=d};this.render=function(a,b){this.clear();e.fov=b.fov;e.aspect=0.5*b.aspect;e.near=b.near;e.far=
|
|
|
+b.far;e.updateProjectionMatrix();e.position.copy(b.position);e.target.copy(b.target);e.translateX(c.separation);e.lookAt(e.target);h.projectionMatrix=e.projectionMatrix;h.position.copy(b.position);h.target.copy(b.target);h.translateX(-c.separation);h.lookAt(h.target);this.setViewport(0,0,f,g);d.call(c,a,e);this.setViewport(f,0,f,g);d.call(c,a,h,!1)}};
|